summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Smith <git@kismith.co.uk>2012-06-14 21:28:58 (GMT)
committerKevin Smith <git@kismith.co.uk>2012-06-15 07:44:48 (GMT)
commit5a1bdf2f6a4842176be5938f8db5cb9d151aceb5 (patch)
tree338090bf71a0a5836ac1210e8433694479567d50 /Swift/QtUI/QtMainWindow.cpp
parentb4a24233debf8ee7e5005aa787ff48c52abe7df6 (diff)
downloadswift-contrib-5a1bdf2f6a4842176be5938f8db5cb9d151aceb5.zip
swift-contrib-5a1bdf2f6a4842176be5938f8db5cb9d151aceb5.tar.bz2
Preliminary emoticon work.
Parsing and toggling support for emoticons. No emoticons are included so this won't do anything yet.
Diffstat (limited to 'Swift/QtUI/QtMainWindow.cpp')
-rw-r--r--Swift/QtUI/QtMainWindow.cpp19
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
@@ -38,19 +38,19 @@
#if defined(SWIFTEN_PLATFORM_MACOSX)
#include <Swift/QtUI/CocoaUIHelpers.h>
#elif defined(SWIFTEN_PLATFORM_WINDOWS)
#include <Swift/QtUI/WinUIHelpers.h>
#endif
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));
QBoxLayout *mainLayout = new QBoxLayout(QBoxLayout::TopToBottom, this);
mainLayout->setContentsMargins(0,0,0,0);
mainLayout->setSpacing(0);
meView_ = new QtRosterHeader(settings, this);
mainLayout->addWidget(meView_);
connect(meView_, SIGNAL(onChangeStatusRequest(StatusShow::Type, const QString&)), this, SLOT(handleStatusChanged(StatusShow::Type, const QString&)));
@@ -93,18 +93,27 @@ QtMainWindow::QtMainWindow(SettingsProvider* settings, UIEventStream* uiEventStr
QMenu* viewMenu = new QMenu(tr("&View"), this);
menus_.push_back(viewMenu);
showOfflineAction_ = new QAction(tr("&Show offline contacts"), this);
showOfflineAction_->setCheckable(true);
showOfflineAction_->setChecked(false);
connect(showOfflineAction_, SIGNAL(toggled(bool)), SLOT(handleShowOfflineToggled(bool)));
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);
//connect(compactRosterAction_, SIGNAL(toggled(bool)), uiPreferences_, SLOT(setCompactRosters(bool)));
//viewMenu->addAction(compactRosterAction_);
QMenu* actionsMenu = new QMenu(tr("&Actions"), this);
menus_.push_back(actionsMenu);
QAction* editProfileAction = new QAction(tr("Edit &Profile…"), this);
@@ -228,28 +237,36 @@ void QtMainWindow::handleJoinMUCAction() {
void QtMainWindow::handleStatusChanged(StatusShow::Type showType, const QString &statusMessage) {
onChangeStatusRequest(showType, Q2PSTRING(statusMessage));
}
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));
}
}
void QtMainWindow::handleShowOfflineToggled(bool state) {
settings_->storeSetting(SettingConstants::SHOW_OFFLINE, 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));
}
void QtMainWindow::setMyJID(const JID& jid) {
meView_->setJID(P2QSTRING(jid.toBare().toString()));
}
void QtMainWindow::setMyAvatarPath(const std::string& path) {