From d490e74fbca3e4ab4a75123dd75dab3bc753c010 Mon Sep 17 00:00:00 2001 From: Kevin Smith Date: Mon, 15 Jun 2009 21:20:13 +0100 Subject: Early pass at tabs. Doesn't do closing or title updating diff --git a/Swift/QtUI/QtChatTabs.cpp b/Swift/QtUI/QtChatTabs.cpp new file mode 100644 index 0000000..f2349a9 --- /dev/null +++ b/Swift/QtUI/QtChatTabs.cpp @@ -0,0 +1,27 @@ +#pragma once + +#include "QtChatTabs.h" + +#include +#include + +namespace Swift { +QtChatTabs::QtChatTabs() { + tabs_ = new QTabWidget(this); + QVBoxLayout *layout = new QVBoxLayout; + layout->setSpacing(0); + layout->setContentsMargins(0, 3, 0, 0); + layout->addWidget(tabs_); + setLayout(layout); + resize(400, 300); +} + +void QtChatTabs::addTab(QWidget* tab) { + tabs_->addTab(tab, tab->windowTitle()); +} + +void QtChatTabs::tabClosing() { + +} + +} \ No newline at end of file diff --git a/Swift/QtUI/QtChatTabs.h b/Swift/QtUI/QtChatTabs.h new file mode 100644 index 0000000..6da166d --- /dev/null +++ b/Swift/QtUI/QtChatTabs.h @@ -0,0 +1,21 @@ +#pragma once + +#include + +class QTabWidget; + +namespace Swift { + class QtChatTabs : public QWidget { + Q_OBJECT + public: + QtChatTabs(); + void addTab(QWidget* tab); + + private slots: + void tabClosing(); + + private: + QTabWidget* tabs_; + }; +} + diff --git a/Swift/QtUI/QtChatWindowFactory.cpp b/Swift/QtUI/QtChatWindowFactory.cpp index b0b3679..c3c8f67 100644 --- a/Swift/QtUI/QtChatWindowFactory.cpp +++ b/Swift/QtUI/QtChatWindowFactory.cpp @@ -1,15 +1,21 @@ #include "QtChatWindowFactory.h" + +#include "QtChatTabs.h" #include "QtChatWindow.h" #include "QtSwiftUtil.h" #include "QtTreeWidgetFactory.h" + namespace Swift { QtChatWindowFactory::QtChatWindowFactory(QtTreeWidgetFactory *treeWidgetFactory) : treeWidgetFactory_(treeWidgetFactory) { - + tabs_ = new QtChatTabs(); } + ChatWindow* QtChatWindowFactory::createChatWindow(const JID &contact) { QtChatWindow *chatWindow = new QtChatWindow(P2QSTRING(contact.toString()), treeWidgetFactory_); - chatWindow->show(); + tabs_->addTab(chatWindow); + tabs_->show(); + //chatWindow->show(); return chatWindow; } diff --git a/Swift/QtUI/QtChatWindowFactory.h b/Swift/QtUI/QtChatWindowFactory.h index bda4c01..5ef6bdf 100644 --- a/Swift/QtUI/QtChatWindowFactory.h +++ b/Swift/QtUI/QtChatWindowFactory.h @@ -6,12 +6,14 @@ namespace Swift { class QtTreeWidgetFactory; + class QtChatTabs; class QtChatWindowFactory : public ChatWindowFactory { public: QtChatWindowFactory(QtTreeWidgetFactory *treeWidgetFactory); ChatWindow* createChatWindow(const JID &contact); private: - QtTreeWidgetFactory *treeWidgetFactory_; + QtTreeWidgetFactory* treeWidgetFactory_; + QtChatTabs* tabs_; }; } diff --git a/Swift/QtUI/Swift.pro b/Swift/QtUI/Swift.pro index 1c860b4..f831c02 100644 --- a/Swift/QtUI/Swift.pro +++ b/Swift/QtUI/Swift.pro @@ -59,6 +59,7 @@ HEADERS += \ QtTreeWidgetFactory.h \ QtTreeWidgetItem.h \ QtChatView.h \ + QtChatTabs.h \ ChatSnippet.h \ MessageSnippet.h \ SystemMessageSnippet.h @@ -77,6 +78,7 @@ SOURCES += \ QtSwift.cpp \ QtTreeWidget.cpp \ QtChatView.cpp \ + QtChatTabs.cpp \ ChatSnippet.cpp \ MessageSnippet.cpp \ SystemMessageSnippet.cpp -- cgit v0.10.2-6-g49f6