diff options
Diffstat (limited to 'Swift/QtUI/QtMainWindow.cpp')
-rw-r--r-- | Swift/QtUI/QtMainWindow.cpp | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/Swift/QtUI/QtMainWindow.cpp b/Swift/QtUI/QtMainWindow.cpp index ec05684..d312546 100644 --- a/Swift/QtUI/QtMainWindow.cpp +++ b/Swift/QtUI/QtMainWindow.cpp @@ -44,7 +44,7 @@ namespace Swift { -QtMainWindow::QtMainWindow(SettingsProvider* settings, UIEventStream* uiEventStream, QtLoginWindow::QtMenus loginMenus) : QWidget(), MainWindow(false), loginMenus_(loginMenus) { +QtMainWindow::QtMainWindow(SettingsProvider* settings, UIEventStream* uiEventStream, QtLoginWindow::QtMenus loginMenus, bool emoticonsExist) : QWidget(), MainWindow(false), loginMenus_(loginMenus) { uiEventStream_ = uiEventStream; settings_ = settings; setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding)); @@ -99,6 +99,15 @@ QtMainWindow::QtMainWindow(SettingsProvider* settings, UIEventStream* uiEventStr viewMenu->addAction(showOfflineAction_); handleShowOfflineToggled(settings_->getSetting(SettingConstants::SHOW_OFFLINE)); + if (emoticonsExist) { + showEmoticonsAction_ = new QAction(tr("&Show Emoticons"), this); + showEmoticonsAction_->setCheckable(true); + showEmoticonsAction_->setChecked(false); + connect(showEmoticonsAction_, SIGNAL(toggled(bool)), SLOT(handleShowEmoticonsToggled(bool))); + viewMenu->addAction(showEmoticonsAction_); + handleShowEmoticonsToggled(settings_->getSetting(QtUISettingConstants::SHOW_EMOTICONS)); + } + //QAction* compactRosterAction_ = new QAction(tr("&Compact Roster"), this); //compactRosterAction_->setCheckable(true); //compactRosterAction_->setChecked(false); @@ -234,6 +243,9 @@ void QtMainWindow::handleSettingChanged(const std::string& settingPath) { if (settingPath == SettingConstants::SHOW_OFFLINE.getKey()) { handleShowOfflineToggled(settings_->getSetting(SettingConstants::SHOW_OFFLINE)); } + if (settingPath == QtUISettingConstants::SHOW_EMOTICONS.getKey()) { + handleShowEmoticonsToggled(settings_->getSetting(QtUISettingConstants::SHOW_EMOTICONS)); + } if (settingPath == SettingConstants::REQUEST_DELIVERYRECEIPTS.getKey()) { toggleRequestDeliveryReceipts_->setChecked(settings_->getSetting(SettingConstants::REQUEST_DELIVERYRECEIPTS)); } @@ -244,6 +256,11 @@ void QtMainWindow::handleShowOfflineToggled(bool state) { showOfflineAction_->setChecked(settings_->getSetting(SettingConstants::SHOW_OFFLINE)); } +void QtMainWindow::handleShowEmoticonsToggled(bool state) { + settings_->storeSetting(QtUISettingConstants::SHOW_EMOTICONS, state); + showEmoticonsAction_->setChecked(settings_->getSetting(QtUISettingConstants::SHOW_EMOTICONS)); +} + void QtMainWindow::setMyNick(const std::string& nick) { meView_->setNick(P2QSTRING(nick)); } |