diff options
-rw-r--r-- | Swift/Controllers/SettingConstants.cpp | 1 | ||||
-rw-r--r-- | Swift/Controllers/SettingConstants.h | 1 | ||||
-rw-r--r-- | Swift/QtUI/QtAffiliationEditor.cpp | 2 | ||||
-rw-r--r-- | Swift/QtUI/QtAffiliationEditor.h | 2 | ||||
-rw-r--r-- | Swift/QtUI/QtJoinMUCWindow.ui | 6 | ||||
-rw-r--r-- | Swift/QtUI/QtLoginWindow.cpp | 17 | ||||
-rw-r--r-- | Swift/QtUI/QtLoginWindow.h | 3 | ||||
-rw-r--r-- | Swift/QtUI/QtSpellCheckerWindow.cpp | 30 | ||||
-rw-r--r-- | Swift/QtUI/QtSpellCheckerWindow.h | 26 | ||||
-rw-r--r-- | Swift/QtUI/QtSpellCheckerWindow.ui | 103 | ||||
-rw-r--r-- | Swift/QtUI/SConscript | 2 |
11 files changed, 188 insertions, 5 deletions
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<bool> SettingConstants::LOGIN_AUTOMATICALLY = Se const SettingsProvider::Setting<bool> SettingConstants::SHOW_OFFLINE("showOffline", false); const SettingsProvider::Setting<std::string> SettingConstants::EXPANDED_ROSTER_GROUPS("GroupExpandiness", ""); const SettingsProvider::Setting<bool> SettingConstants::PLAY_SOUNDS("playSounds", true); +const SettingsProvider::Setting<bool> 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<bool> SHOW_OFFLINE; static const SettingsProvider::Setting<std::string> EXPANDED_ROSTER_GROUPS; static const SettingsProvider::Setting<bool> PLAY_SOUNDS; + static const SettingsProvider::Setting<bool> 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<MUCOccupant::Affiliation, std::vector<JID> > affiliations_; std::vector<ChangePair> changes_; }; -}
\ No newline at end of file +} diff --git a/Swift/QtUI/QtJoinMUCWindow.ui b/Swift/QtUI/QtJoinMUCWindow.ui index 5a69292..9225f6f 100644 --- a/Swift/QtUI/QtJoinMUCWindow.ui +++ b/Swift/QtUI/QtJoinMUCWindow.ui @@ -43,9 +43,6 @@ </property> </widget> </item> - <item row="1" column="1" colspan="2"> - <widget class="QLineEdit" name="nickName"/> - </item> <item row="0" column="1"> <widget class="QLineEdit" name="room"> <property name="text"> @@ -63,6 +60,9 @@ <item row="2" column="1"> <widget class="QLineEdit" name="password"/> </item> + <item row="1" column="1" colspan="2"> + <widget class="QLineEdit" name="nickName"/> + </item> </layout> </item> <item> diff --git a/Swift/QtUI/QtLoginWindow.cpp b/Swift/QtUI/QtLoginWindow.cpp index c8b40a4..c2854c5 100644 --- a/Swift/QtUI/QtLoginWindow.cpp +++ b/Swift/QtUI/QtLoginWindow.cpp @@ -201,6 +201,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 @@ -432,6 +437,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::make_shared<RequestXMLConsoleUIEvent>()); } diff --git a/Swift/QtUI/QtLoginWindow.h b/Swift/QtUI/QtLoginWindow.h index c1966d8..95a4b2a 100644 --- a/Swift/QtUI/QtLoginWindow.h +++ b/Swift/QtUI/QtLoginWindow.h @@ -18,6 +18,7 @@ #include <Swift/Controllers/UIEvents/UIEventStream.h> #include <Swift/Controllers/UIInterfaces/MainWindow.h> #include <QtAboutWidget.h> +#include <QtSpellCheckerWindow.h> class QLabel; class QToolButton; @@ -65,6 +66,7 @@ namespace Swift { void handleToggleSounds(bool enabled); void handleToggleNotifications(bool enabled); void handleAbout(); + void handleSpellChecker(); void bringToFront(); void toggleBringToFront(); void handleUsernameTextChanged(); @@ -100,6 +102,7 @@ namespace Swift { QAction* toggleNotificationsAction_; UIEventStream* uiEventStream_; QPointer<QtAboutWidget> aboutDialog_; + QPointer<QtSpellCheckerWindow> 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 <Swift/Controllers/Settings/SettingsProvider.h> +#include <Swift/Controllers/SettingConstants.h> +#include <Swift/QtUI/QtUISettingConstants.h> + +#include <QCoreApplication> +#include <QFileDialog> + +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 <QDialog> + +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 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>QtSpellCheckerWindow</class> + <widget class="QDialog" name="QtSpellCheckerWindow"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>431</width> + <height>214</height> + </rect> + </property> + <property name="windowTitle"> + <string>Dialog</string> + </property> + <layout class="QGridLayout" name="gridLayout"> + <item row="0" column="0" colspan="2"> + <widget class="QCheckBox" name="spellCheckerEnabled"> + <property name="text"> + <string>Spell Checker Enabled</string> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="pathLabel"> + <property name="text"> + <string>Dictionary Path:</string> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QLineEdit" name="pathContent"/> + </item> + <item row="1" column="2"> + <widget class="QPushButton" name="changePathButton"> + <property name="text"> + <string>Change</string> + </property> + </widget> + </item> + <item row="2" column="0"> + <widget class="QLabel" name="perosnalDictionaryLabel"> + <property name="text"> + <string>Personal Dictionary</string> + </property> + </widget> + </item> + <item row="2" column="1"> + <widget class="QLineEdit" name="personalDictionaryContent"/> + </item> + <item row="2" column="2"> + <widget class="QPushButton" name="changePersonalButton"> + <property name="text"> + <string>Change</string> + </property> + </widget> + </item> + <item row="3" column="0"> + <widget class="QLabel" name="language"> + <property name="text"> + <string>Language</string> + </property> + </widget> + </item> + <item row="3" column="1"> + <widget class="QListView" name="languagesView"/> + </item> + <item row="4" column="0" colspan="3"> + <layout class="QHBoxLayout" name="horizontalLayout"> + <item> + <spacer name="horizontalSpacer"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QPushButton" name="cancel"> + <property name="text"> + <string>Cancel</string> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="apply"> + <property name="text"> + <string>Apply</string> + </property> + </widget> + </item> + </layout> + </item> + </layout> + </widget> + <resources/> + <connections/> +</ui> diff --git a/Swift/QtUI/SConscript b/Swift/QtUI/SConscript index 392eed9..0a9cec5 100644 --- a/Swift/QtUI/SConscript +++ b/Swift/QtUI/SConscript @@ -73,6 +73,7 @@ myenv.WriteVal("DefaultTheme.qrc", myenv.Value(generateDefaultTheme(myenv.Dir("# sources = [ "main.cpp", "QtAboutWidget.cpp", + "QtSpellCheckerWindow.cpp", "QtAvatarWidget.cpp", "QtUIFactory.cpp", "QtChatWindowFactory.cpp", @@ -219,6 +220,7 @@ myenv.Uic4("QtAffiliationEditor.ui") myenv.Uic4("QtJoinMUCWindow.ui") myenv.Uic4("QtHistoryWindow.ui") myenv.Uic4("QtConnectionSettings.ui") +myenv.Uic4("QtSpellCheckerWindow.ui") myenv.Qrc("DefaultTheme.qrc") myenv.Qrc("Swift.qrc") |