diff options
author | Kevin Smith <git@kismith.co.uk> | 2012-10-07 20:37:01 (GMT) |
---|---|---|
committer | Kevin Smith <git@kismith.co.uk> | 2012-12-22 14:29:24 (GMT) |
commit | 8f922ebfe8b1fd8c7d394da0ebeaf02f04c8e48f (patch) | |
tree | 1926a516d3d643160c22925db7bea44e5712ba4f /Swift/QtUI | |
parent | fa500ac6870324e10ae90656c03a88666200634b (diff) | |
download | swift-contrib-8f922ebfe8b1fd8c7d394da0ebeaf02f04c8e48f.zip swift-contrib-8f922ebfe8b1fd8c7d394da0ebeaf02f04c8e48f.tar.bz2 |
Allow toggling of a more compact roster mode
Change-Id: I2da5116ab8467645b83afa1908f438301f326dbe
Diffstat (limited to 'Swift/QtUI')
-rw-r--r-- | Swift/QtUI/QtMainWindow.cpp | 16 | ||||
-rw-r--r-- | Swift/QtUI/QtMainWindow.h | 2 | ||||
-rw-r--r-- | Swift/QtUI/Roster/RosterDelegate.cpp | 1 |
3 files changed, 19 insertions, 0 deletions
diff --git a/Swift/QtUI/QtMainWindow.cpp b/Swift/QtUI/QtMainWindow.cpp index 5d50c1e..8f74a8d 100644 --- a/Swift/QtUI/QtMainWindow.cpp +++ b/Swift/QtUI/QtMainWindow.cpp @@ -95,6 +95,14 @@ QtMainWindow::QtMainWindow(SettingsProvider* settings, UIEventStream* uiEventStr QMenu* viewMenu = new QMenu(tr("&View"), this); menus_.push_back(viewMenu); + + compactRosterAction_ = new QAction(tr("&Compact Roster"), this); + compactRosterAction_->setCheckable(true); + compactRosterAction_->setChecked(false); + connect(compactRosterAction_, SIGNAL(toggled(bool)), SLOT(handleCompactRosterToggled(bool))); + viewMenu->addAction(compactRosterAction_); + handleCompactRosterToggled(settings_->getSetting(QtUISettingConstants::COMPACT_ROSTER)); + showOfflineAction_ = new QAction(tr("&Show offline contacts"), this); showOfflineAction_->setCheckable(true); showOfflineAction_->setChecked(false); @@ -261,6 +269,14 @@ void QtMainWindow::handleSettingChanged(const std::string& settingPath) { if (settingPath == SettingConstants::REQUEST_DELIVERYRECEIPTS.getKey()) { toggleRequestDeliveryReceipts_->setChecked(settings_->getSetting(SettingConstants::REQUEST_DELIVERYRECEIPTS)); } + if (settingPath == QtUISettingConstants::COMPACT_ROSTER.getKey()) { + handleCompactRosterToggled(settings_->getSetting(QtUISettingConstants::COMPACT_ROSTER)); + } +} + +void QtMainWindow::handleCompactRosterToggled(bool state) { + settings_->storeSetting(QtUISettingConstants::COMPACT_ROSTER, state); + compactRosterAction_->setChecked(settings_->getSetting(QtUISettingConstants::COMPACT_ROSTER)); } void QtMainWindow::handleShowOfflineToggled(bool state) { diff --git a/Swift/QtUI/QtMainWindow.h b/Swift/QtUI/QtMainWindow.h index 26d25e1..f91610a 100644 --- a/Swift/QtUI/QtMainWindow.h +++ b/Swift/QtUI/QtMainWindow.h @@ -55,6 +55,7 @@ namespace Swift { private slots: void handleStatusChanged(StatusShow::Type showType, const QString &statusMessage); void handleSettingChanged(const std::string& settingPath); + void handleCompactRosterToggled(bool); void handleShowOfflineToggled(bool); void handleShowEmoticonsToggled(bool); void handleJoinMUCAction(); @@ -81,6 +82,7 @@ namespace Swift { QAction* editUserAction_; QAction* chatUserAction_; QAction* showOfflineAction_; + QAction* compactRosterAction_; QAction* showEmoticonsAction_; QAction* toggleRequestDeliveryReceipts_; QMenu* serverAdHocMenu_; diff --git a/Swift/QtUI/Roster/RosterDelegate.cpp b/Swift/QtUI/Roster/RosterDelegate.cpp index 7e6428b..5c964ca 100644 --- a/Swift/QtUI/Roster/RosterDelegate.cpp +++ b/Swift/QtUI/Roster/RosterDelegate.cpp @@ -35,6 +35,7 @@ RosterDelegate::~RosterDelegate() { void RosterDelegate::setCompact(bool compact) { compact_ = compact; + emit sizeHintChanged(QModelIndex()); } QSize RosterDelegate::sizeHint(const QStyleOptionViewItem& option, const QModelIndex& index ) const { |