diff options
author | Remko Tronçon <git@el-tramo.be> | 2010-12-12 17:02:01 (GMT) |
---|---|---|
committer | Remko Tronçon <git@el-tramo.be> | 2010-12-12 17:03:44 (GMT) |
commit | 2a22744ffcea2505b8a0951d4a0791891b99158b (patch) | |
tree | 63a4f7377319763b336f22202230b97ba2a20e5b /Swift | |
parent | e90e08301a03a4ad562a35e60927815d43daebec (diff) | |
download | swift-contrib-2a22744ffcea2505b8a0951d4a0791891b99158b.zip swift-contrib-2a22744ffcea2505b8a0951d4a0791891b99158b.tar.bz2 |
Added menu to switch between 'show nickname' and 'show JID' in roster header.
Resolves: #627
Release-Notes: The roster header can now be configured to show the JID instead of the nick.
Diffstat (limited to 'Swift')
-rw-r--r-- | Swift/QtUI/QtMainWindow.cpp | 4 | ||||
-rw-r--r-- | Swift/QtUI/QtMainWindow.h | 3 | ||||
-rw-r--r-- | Swift/QtUI/QtMainWindowFactory.cpp | 5 | ||||
-rw-r--r-- | Swift/QtUI/QtMainWindowFactory.h | 10 | ||||
-rw-r--r-- | Swift/QtUI/QtNameWidget.cpp | 6 | ||||
-rw-r--r-- | Swift/QtUI/QtNameWidget.h | 4 | ||||
-rw-r--r-- | Swift/QtUI/QtRosterHeader.cpp | 4 | ||||
-rw-r--r-- | Swift/QtUI/QtRosterHeader.h | 3 | ||||
-rw-r--r-- | Swift/QtUI/QtSwift.cpp | 2 |
9 files changed, 25 insertions, 16 deletions
diff --git a/Swift/QtUI/QtMainWindow.cpp b/Swift/QtUI/QtMainWindow.cpp index 5cbc40c..ee83f4d 100644 --- a/Swift/QtUI/QtMainWindow.cpp +++ b/Swift/QtUI/QtMainWindow.cpp @@ -31,13 +31,13 @@ namespace Swift { -QtMainWindow::QtMainWindow(UIEventStream* uiEventStream) : QWidget(), MainWindow(false) { +QtMainWindow::QtMainWindow(QtSettingsProvider* settings, UIEventStream* uiEventStream) : QWidget(), MainWindow(false) { uiEventStream_ = uiEventStream; setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding)); QBoxLayout *mainLayout = new QBoxLayout(QBoxLayout::TopToBottom, this); mainLayout->setContentsMargins(0,0,0,0); mainLayout->setSpacing(0); - meView_ = new QtRosterHeader(this); + meView_ = new QtRosterHeader(settings, this); mainLayout->addWidget(meView_); connect(meView_, SIGNAL(onChangeStatusRequest(StatusShow::Type, const QString&)), this, SLOT(handleStatusChanged(StatusShow::Type, const QString&))); diff --git a/Swift/QtUI/QtMainWindow.h b/Swift/QtUI/QtMainWindow.h index 62aafba..f494fd0 100644 --- a/Swift/QtUI/QtMainWindow.h +++ b/Swift/QtUI/QtMainWindow.h @@ -31,11 +31,12 @@ namespace Swift { class TreeWidget; class UIEventStream; class QtTabWidget; + class QtSettingsProvider; class QtMainWindow : public QWidget, public MainWindow { Q_OBJECT public: - QtMainWindow(UIEventStream* eventStream); + QtMainWindow(QtSettingsProvider*, UIEventStream* eventStream); ~QtMainWindow(); std::vector<QMenu*> getMenus() {return menus_;} void setMyNick(const String& name); diff --git a/Swift/QtUI/QtMainWindowFactory.cpp b/Swift/QtUI/QtMainWindowFactory.cpp index 4405239..8833e03 100644 --- a/Swift/QtUI/QtMainWindowFactory.cpp +++ b/Swift/QtUI/QtMainWindowFactory.cpp @@ -9,12 +9,13 @@ namespace Swift { -QtMainWindowFactory::QtMainWindowFactory() { +QtMainWindowFactory::QtMainWindowFactory(QtSettingsProvider* settings) { + settings_ = settings; lastWindow_ = NULL; } MainWindow* QtMainWindowFactory::createMainWindow(UIEventStream* eventStream) { - lastWindow_ = new QtMainWindow(eventStream); + lastWindow_ = new QtMainWindow(settings_, eventStream); return lastWindow_; } diff --git a/Swift/QtUI/QtMainWindowFactory.h b/Swift/QtUI/QtMainWindowFactory.h index 17eb53c..c6658a9 100644 --- a/Swift/QtUI/QtMainWindowFactory.h +++ b/Swift/QtUI/QtMainWindowFactory.h @@ -4,21 +4,21 @@ * See Documentation/Licenses/GPLv3.txt for more information. */ -#ifndef SWIFT_QtMainWindowFactory_H -#define SWIFT_QtMainWindowFactory_H +#pragma once #include "Swift/Controllers/UIInterfaces/MainWindowFactory.h" namespace Swift { class QtTreeWidgetFactory; + class QtSettingsProvider; + class QtMainWindowFactory : public MainWindowFactory{ public: - QtMainWindowFactory(); + QtMainWindowFactory(QtSettingsProvider* settings); MainWindow* createMainWindow(UIEventStream* eventStream); MainWindow* getLastCreatedWindow(); private: + QtSettingsProvider* settings_; MainWindow* lastWindow_; }; } - -#endif diff --git a/Swift/QtUI/QtNameWidget.cpp b/Swift/QtUI/QtNameWidget.cpp index d123bad..bbbfe3a 100644 --- a/Swift/QtUI/QtNameWidget.cpp +++ b/Swift/QtUI/QtNameWidget.cpp @@ -12,14 +12,17 @@ #include <QtDebug> #include <Swift/QtUI/QtElidingLabel.h> +#include <Swift/QtUI/QtSettingsProvider.h> namespace Swift { -QtNameWidget::QtNameWidget(QWidget *parent) : QWidget(parent), mode(ShowNick) { +QtNameWidget::QtNameWidget(QtSettingsProvider* settings, QWidget *parent) : QWidget(parent), settings(settings) { QHBoxLayout* mainLayout = new QHBoxLayout(this); mainLayout->setSpacing(0); mainLayout->setContentsMargins(0,0,0,0); + mode = settings->getBoolSetting("showNickInRosterHeader", true) ? ShowNick : ShowJID; + textLabel = new QtElidingLabel(this); QFont font = textLabel->font(); font.setBold(true); @@ -61,6 +64,7 @@ void QtNameWidget::mousePressEvent(QMouseEvent* event) { else { mode = ShowNick; } + settings->storeBool("showNickInRosterHeader", mode == ShowNick); updateText(); } diff --git a/Swift/QtUI/QtNameWidget.h b/Swift/QtUI/QtNameWidget.h index 52586b7..313108d 100644 --- a/Swift/QtUI/QtNameWidget.h +++ b/Swift/QtUI/QtNameWidget.h @@ -10,12 +10,13 @@ namespace Swift { class QtElidingLabel; + class QtSettingsProvider; class QtNameWidget : public QWidget { Q_OBJECT public: - QtNameWidget(QWidget *parent); + QtNameWidget(QtSettingsProvider* settings, QWidget *parent); void setNick(const QString& text); void setJID(const QString& jid); @@ -30,6 +31,7 @@ namespace Swift { ShowJID, }; + QtSettingsProvider* settings; Mode mode; QtElidingLabel* textLabel; QString jid; diff --git a/Swift/QtUI/QtRosterHeader.cpp b/Swift/QtUI/QtRosterHeader.cpp index 4649839..5aeaa5d 100644 --- a/Swift/QtUI/QtRosterHeader.cpp +++ b/Swift/QtUI/QtRosterHeader.cpp @@ -18,7 +18,7 @@ #include <Swift/QtUI/QtNameWidget.h> namespace Swift { -QtRosterHeader::QtRosterHeader(QWidget* parent) : QWidget(parent) { +QtRosterHeader::QtRosterHeader(QtSettingsProvider* settings, QWidget* parent) : QWidget(parent) { QHBoxLayout* topLayout = new QHBoxLayout(); topLayout->setSpacing(0); topLayout->setContentsMargins(4,4,4,4); @@ -39,7 +39,7 @@ QtRosterHeader::QtRosterHeader(QWidget* parent) : QWidget(parent) { rightLayout->setContentsMargins(4,0,0,0); topLayout->addLayout(rightLayout); - nameWidget_ = new QtNameWidget(this); + nameWidget_ = new QtNameWidget(settings, this); rightLayout->addWidget(nameWidget_); diff --git a/Swift/QtUI/QtRosterHeader.h b/Swift/QtUI/QtRosterHeader.h index 23e6be0..5634bdf 100644 --- a/Swift/QtUI/QtRosterHeader.h +++ b/Swift/QtUI/QtRosterHeader.h @@ -22,11 +22,12 @@ class QHBoxLayout; namespace Swift { class QtStatusWidget; class QtNameWidget; + class QtSettingsProvider; class QtRosterHeader : public QWidget { Q_OBJECT public: - QtRosterHeader(QWidget* parent = NULL); + QtRosterHeader(QtSettingsProvider* settings, QWidget* parent = NULL); void setAvatar(const QString& path); void setJID(const QString& jid); diff --git a/Swift/QtUI/QtSwift.cpp b/Swift/QtUI/QtSwift.cpp index 2890357..04b9d02 100644 --- a/Swift/QtUI/QtSwift.cpp +++ b/Swift/QtUI/QtSwift.cpp @@ -132,7 +132,7 @@ QtSwift::QtSwift(po::variables_map options) : autoUpdater_(NULL) { systemTrays_.push_back(systemTray); QtLoginWindowFactory* loginWindowFactory = new QtLoginWindowFactory(splitter_, systemTray, settings_); loginWindowFactories_.push_back(loginWindowFactory); - QtMainWindowFactory* rosterWindowFactory = new QtMainWindowFactory(); + QtMainWindowFactory* rosterWindowFactory = new QtMainWindowFactory(settings_); rosterWindowFactories_.push_back(rosterWindowFactory); QtEventWindowFactory* eventWindowFactory = new QtEventWindowFactory(rosterWindowFactory); eventWindowFactories_.push_back(eventWindowFactory); |