summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Smith <git@kismith.co.uk>2009-06-15 20:20:13 (GMT)
committerKevin Smith <git@kismith.co.uk>2009-06-15 20:20:13 (GMT)
commitd490e74fbca3e4ab4a75123dd75dab3bc753c010 (patch)
treeefcad5dabeebf4766dc15dc787b9ba9ba1c2aecb /Swift/QtUI
parent9bc8ddaf40d73647944592385bf56ece41046846 (diff)
downloadswift-contrib-d490e74fbca3e4ab4a75123dd75dab3bc753c010.zip
swift-contrib-d490e74fbca3e4ab4a75123dd75dab3bc753c010.tar.bz2
Early pass at tabs. Doesn't do closing or title updating
Diffstat (limited to 'Swift/QtUI')
-rw-r--r--Swift/QtUI/QtChatTabs.cpp27
-rw-r--r--Swift/QtUI/QtChatTabs.h21
-rw-r--r--Swift/QtUI/QtChatWindowFactory.cpp10
-rw-r--r--Swift/QtUI/QtChatWindowFactory.h4
-rw-r--r--Swift/QtUI/Swift.pro2
5 files changed, 61 insertions, 3 deletions
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 <QTabWidget>
+#include <QLayout>
+
+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 <QWidget>
+
+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