From 424d19ec5f9c7ab6ca28a532540d140a22fafeb9 Mon Sep 17 00:00:00 2001 From: Vlad Voicu Date: Sun, 4 Mar 2012 16:30:51 +0200 Subject: Added minimal SpellChecker Ui Options diff --git a/Swift/Controllers/SettingConstants.cpp b/Swift/Controllers/SettingConstants.cpp index 7ab4ac4..3180b6a 100644 --- a/Swift/Controllers/SettingConstants.cpp +++ b/Swift/Controllers/SettingConstants.cpp @@ -19,4 +19,5 @@ const SettingsProvider::Setting SettingConstants::LOGIN_AUTOMATICALLY = Se const SettingsProvider::Setting SettingConstants::SHOW_OFFLINE("showOffline", false); const SettingsProvider::Setting SettingConstants::EXPANDED_ROSTER_GROUPS("GroupExpandiness", ""); const SettingsProvider::Setting SettingConstants::PLAY_SOUNDS("playSounds", true); +const SettingsProvider::Setting SettingConstants::SPELL_CHECKER("spellChecker", false); } diff --git a/Swift/Controllers/SettingConstants.h b/Swift/Controllers/SettingConstants.h index ff1ed72..4c354f2 100644 --- a/Swift/Controllers/SettingConstants.h +++ b/Swift/Controllers/SettingConstants.h @@ -22,5 +22,6 @@ namespace Swift { static const SettingsProvider::Setting SHOW_OFFLINE; static const SettingsProvider::Setting EXPANDED_ROSTER_GROUPS; static const SettingsProvider::Setting PLAY_SOUNDS; + static const SettingsProvider::Setting SPELL_CHECKER; }; } diff --git a/Swift/QtUI/QtAffiliationEditor.cpp b/Swift/QtUI/QtAffiliationEditor.cpp index ed03c23..0896b92 100644 --- a/Swift/QtUI/QtAffiliationEditor.cpp +++ b/Swift/QtUI/QtAffiliationEditor.cpp @@ -76,4 +76,4 @@ MUCOccupant::Affiliation QtAffiliationEditor::affiliationFromIndex(int affiliati } } -} \ No newline at end of file +} diff --git a/Swift/QtUI/QtAffiliationEditor.h b/Swift/QtUI/QtAffiliationEditor.h index 913b2cc..96536eb 100644 --- a/Swift/QtUI/QtAffiliationEditor.h +++ b/Swift/QtUI/QtAffiliationEditor.h @@ -34,4 +34,4 @@ namespace Swift { std::map > affiliations_; std::vector changes_; }; -} \ No newline at end of file +} diff --git a/Swift/QtUI/QtJoinMUCWindow.ui b/Swift/QtUI/QtJoinMUCWindow.ui index 4c4935a..c97cf24 100644 --- a/Swift/QtUI/QtJoinMUCWindow.ui +++ b/Swift/QtUI/QtJoinMUCWindow.ui @@ -43,9 +43,6 @@ - - - @@ -63,6 +60,9 @@ + + + diff --git a/Swift/QtUI/QtLoginWindow.cpp b/Swift/QtUI/QtLoginWindow.cpp index a3b7837..f7fc3a7 100644 --- a/Swift/QtUI/QtLoginWindow.cpp +++ b/Swift/QtUI/QtLoginWindow.cpp @@ -193,6 +193,11 @@ QtLoginWindow::QtLoginWindow(UIEventStream* uiEventStream, SettingsProvider* set toggleNotificationsAction_->setChecked(settings_->getSetting(SettingConstants::SHOW_NOTIFICATIONS)); connect(toggleNotificationsAction_, SIGNAL(toggled(bool)), SLOT(handleToggleNotifications(bool))); + QAction* spellCheckerAction_ = new QAction(tr("Spell &Checker"), this); + connect(spellCheckerAction_, SIGNAL(triggered()), SLOT(handleSpellChecker())); + generalMenu_->addAction(spellCheckerAction_); + + #ifndef SWIFTEN_PLATFORM_MACOSX swiftMenu_->addSeparator(); #endif @@ -404,6 +409,18 @@ void QtLoginWindow::handleAbout() { } } +void QtLoginWindow::handleSpellChecker() { + if (!spellCheckerDialog_) { + spellCheckerDialog_ = new QtSpellCheckerWindow(settings_); + spellCheckerDialog_->show(); + } + else { + spellCheckerDialog_->show(); + spellCheckerDialog_->raise(); + spellCheckerDialog_->activateWindow(); + } +} + void QtLoginWindow::handleShowXMLConsole() { uiEventStream_->send(boost::shared_ptr(new RequestXMLConsoleUIEvent())); } diff --git a/Swift/QtUI/QtLoginWindow.h b/Swift/QtUI/QtLoginWindow.h index dcd7c18..ed15182 100644 --- a/Swift/QtUI/QtLoginWindow.h +++ b/Swift/QtUI/QtLoginWindow.h @@ -18,6 +18,7 @@ #include #include #include +#include class QLabel; class QToolButton; @@ -63,6 +64,7 @@ namespace Swift { void handleToggleSounds(bool enabled); void handleToggleNotifications(bool enabled); void handleAbout(); + void handleSpellChecker(); void bringToFront(); void handleUsernameTextChanged(); void resizeEvent(QResizeEvent* event); @@ -95,6 +97,7 @@ namespace Swift { QAction* toggleNotificationsAction_; UIEventStream* uiEventStream_; QPointer aboutDialog_; + QPointer spellCheckerDialog_; SettingsProvider* settings_; QAction* xmlConsoleAction_; QAction* fileTransferOverviewAction_; diff --git a/Swift/QtUI/QtSpellCheckerWindow.cpp b/Swift/QtUI/QtSpellCheckerWindow.cpp new file mode 100644 index 0000000..45aa32f --- /dev/null +++ b/Swift/QtUI/QtSpellCheckerWindow.cpp @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2011 Vlad Voicu + * Licensed under the Simplified BSD license. + * See Documentation/Licenses/BSD-simplified.txt for more information. + */ + +#include "Swift/QtUI/QtSpellCheckerWindow.h" + +#include +#include +#include + +#include +#include + +namespace Swift { + +QtSpellCheckerWindow::QtSpellCheckerWindow(SettingsProvider* settings, QWidget* parent) : QDialog(parent) { + settings_ = settings; + ui_.setupUi(this); + connect(ui_.spellCheckerEnabled, SIGNAL(toggled(bool)), this, SLOT(handleChecker(bool))); + ui_.spellCheckerEnabled->setChecked(settings_->getSetting(SettingConstants::SPELL_CHECKER)); + //QString filename = QFileDialog::getOpenFileName(this, tr("Select Dictionaries"), "/home", tr("Images (*.aff, *.dic")); +} + +void QtSpellCheckerWindow::handleChecker(bool state) { + settings_->storeSetting(SettingConstants::SPELL_CHECKER, state); +} + +} diff --git a/Swift/QtUI/QtSpellCheckerWindow.h b/Swift/QtUI/QtSpellCheckerWindow.h new file mode 100644 index 0000000..0d6ac60 --- /dev/null +++ b/Swift/QtUI/QtSpellCheckerWindow.h @@ -0,0 +1,26 @@ +/* + * Copyright (c) 2011 Vlad Voicu + * Licensed under the Simplified BSD license. + * See Documentation/Licenses/BSD-simplified.txt for more information. + */ + +#pragma once + +#include "ui_QtSpellCheckerWindow.h" + +#include + +namespace Swift { + class SettingsProvider; + class QtSpellCheckerWindow : public QDialog, protected Ui::QtSpellCheckerWindow { + Q_OBJECT + public: + QtSpellCheckerWindow(SettingsProvider* settings, QWidget* parent = NULL); + public slots: + void handleChecker(bool state); + + private: + SettingsProvider* settings_; + Ui::QtSpellCheckerWindow ui_; + }; +} diff --git a/Swift/QtUI/QtSpellCheckerWindow.ui b/Swift/QtUI/QtSpellCheckerWindow.ui new file mode 100644 index 0000000..d09edfe --- /dev/null +++ b/Swift/QtUI/QtSpellCheckerWindow.ui @@ -0,0 +1,103 @@ + + + QtSpellCheckerWindow + + + + 0 + 0 + 431 + 214 + + + + Dialog + + + + + + Spell Checker Enabled + + + + + + + Dictionary Path: + + + + + + + + + + Change + + + + + + + Personal Dictionary + + + + + + + + + + Change + + + + + + + Language + + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Cancel + + + + + + + Apply + + + + + + + + + + diff --git a/Swift/QtUI/SConscript b/Swift/QtUI/SConscript index 8d7697a..2c0b28b 100644 --- a/Swift/QtUI/SConscript +++ b/Swift/QtUI/SConscript @@ -68,6 +68,7 @@ myenv.WriteVal("DefaultTheme.qrc", myenv.Value(generateDefaultTheme(myenv.Dir("# sources = [ "main.cpp", "QtAboutWidget.cpp", + "QtSpellCheckerWindow.cpp", "QtAvatarWidget.cpp", "QtUIFactory.cpp", "QtChatWindowFactory.cpp", @@ -187,6 +188,7 @@ myenv.Uic4("UserSearch/QtUserSearchResultsPage.ui") myenv.Uic4("QtBookmarkDetailWindow.ui") myenv.Uic4("QtAffiliationEditor.ui") myenv.Uic4("QtJoinMUCWindow.ui") +myenv.Uic4("QtSpellCheckerWindow.ui") myenv.Qrc("DefaultTheme.qrc") myenv.Qrc("Swift.qrc") -- cgit v0.10.2-6-g49f6