diff options
author | Remko Tronçon <git@el-tramo.be> | 2009-06-01 08:48:42 (GMT) |
---|---|---|
committer | Remko Tronçon <git@el-tramo.be> | 2009-06-01 09:24:28 (GMT) |
commit | 2812bddd81f8a1b804c7460f4e14cd0aa393d129 (patch) | |
tree | d46294f35150c4f0f43deaf2d31fceaf945ae715 /UI/Qt/QtMainWindow.cpp | |
download | swift-contrib-2812bddd81f8a1b804c7460f4e14cd0aa393d129.zip swift-contrib-2812bddd81f8a1b804c7460f4e14cd0aa393d129.tar.bz2 |
Import.
Diffstat (limited to 'UI/Qt/QtMainWindow.cpp')
-rw-r--r-- | UI/Qt/QtMainWindow.cpp | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/UI/Qt/QtMainWindow.cpp b/UI/Qt/QtMainWindow.cpp new file mode 100644 index 0000000..a9ffc51 --- /dev/null +++ b/UI/Qt/QtMainWindow.cpp @@ -0,0 +1,71 @@ +#include "QtMainWindow.h" + +#include "QtJoinMUCDialog.h" +#include "QtSwiftUtil.h" +#include "QtTreeWidgetFactory.h" +#include "QtTreeWidget.h" +#include "QtStatusWidget.h" + +#include <QBoxLayout> +#include <QComboBox> +#include <QLineEdit> +#include <QListWidget> +#include <QListWidgetItem> +#include <QPushButton> +#include <QMenuBar> +#include <QToolBar> + +namespace Swift { + +QtMainWindow::QtMainWindow(QtTreeWidgetFactory *treeWidgetFactory) : QWidget() { + setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding)); + QBoxLayout *mainLayout = new QBoxLayout(QBoxLayout::TopToBottom, this); + mainLayout->setContentsMargins(0,0,0,0); + mainLayout->setSpacing(0); + statusWidget_ = new QtStatusWidget(this); + connect(statusWidget_, SIGNAL(onChangeStatusRequest(StatusShow::Type, const QString&)), this, SLOT(handleStatusChanged(StatusShow::Type, const QString&))); + mainLayout->addWidget(statusWidget_); + treeWidget_ = dynamic_cast<QtTreeWidget*>(treeWidgetFactory->createTreeWidget()); + mainLayout->addWidget(treeWidget_); + + this->setLayout(mainLayout); + + QMenu* viewMenu = new QMenu(tr("View"), this); + menus_.push_back(viewMenu); + QAction* showOfflineAction = new QAction("Show offline contacts", this); + showOfflineAction->setCheckable(true); + showOfflineAction->setChecked(false); + connect(showOfflineAction, SIGNAL(toggled(bool)), SLOT(handleShowOfflineToggled(bool))); + viewMenu->addAction(showOfflineAction); + + QMenu* chatMenu = new QMenu(tr("Chat"), this); + menus_.push_back(chatMenu); + QAction* joinMUCAction = new QAction("Join chatroom", this); + connect(joinMUCAction, SIGNAL(triggered()), SLOT(handleJoinMUCAction())); + chatMenu->addAction(joinMUCAction); +} + +TreeWidget* QtMainWindow::getTreeWidget() { + return treeWidget_; +} + +void QtMainWindow::handleJoinMUCAction() { + QtJoinMUCDialog* joinMUC = new QtJoinMUCDialog("jabber@conference.jabber.org", "SwiftUser", this); + connect(joinMUC, SIGNAL(onJoinCommand(const JID&, const QString&)), SLOT(handleJoinMUCDialogComplete(const JID&, const QString&))); + joinMUC->show(); +} + +void QtMainWindow::handleJoinMUCDialogComplete(const JID& muc, const QString& nick) { + onJoinMUCRequest(muc, Q2PSTRING(nick)); +} + +void QtMainWindow::handleStatusChanged(StatusShow::Type showType, const QString &statusMessage) { + onChangeStatusRequest(showType, Q2PSTRING(statusMessage)); +} + +void QtMainWindow::handleShowOfflineToggled(bool state) { + onShowOfflineToggled(state); +} + +} + |