diff options
Diffstat (limited to 'Swift')
-rw-r--r-- | Swift/Controllers/SettingConstants.cpp | 5 | ||||
-rw-r--r-- | Swift/Controllers/SettingConstants.h | 22 | ||||
-rw-r--r-- | Swift/QtUI/QtChatTabs.cpp | 11 | ||||
-rw-r--r-- | Swift/QtUI/QtSpellCheckerWindow.cpp | 11 | ||||
-rw-r--r-- | Swift/QtUI/QtSwift.cpp | 3 | ||||
-rw-r--r-- | Swift/QtUI/QtTextEdit.cpp | 13 | ||||
-rw-r--r-- | Swift/QtUI/QtUISettingConstants.cpp | 7 | ||||
-rw-r--r-- | Swift/QtUI/QtUISettingConstants.h | 24 |
8 files changed, 46 insertions, 50 deletions
diff --git a/Swift/Controllers/SettingConstants.cpp b/Swift/Controllers/SettingConstants.cpp index c3de90f..dedf56b 100644 --- a/Swift/Controllers/SettingConstants.cpp +++ b/Swift/Controllers/SettingConstants.cpp @@ -20,13 +20,8 @@ const SettingsProvider::Setting<bool> SettingConstants::SHOW_OFFLINE("showOfflin const SettingsProvider::Setting<std::string> SettingConstants::EXPANDED_ROSTER_GROUPS("GroupExpandiness", ""); const SettingsProvider::Setting<bool> SettingConstants::PLAY_SOUNDS("playSounds", true); const SettingsProvider::Setting<std::string> SettingConstants::HIGHLIGHT_RULES("highlightRules", "@"); -const SettingsProvider::Setting<bool> SettingConstants::SPELL_CHECKER("spellChecker", false); -const SettingsProvider::Setting<std::string> SettingConstants::SPELL_CHECKER_LANGUAGE("spellCheckerLanguage", "en_US"); const SettingsProvider::Setting<std::string> SettingConstants::INVITE_AUTO_ACCEPT_MODE("inviteAutoAcceptMode", "presence"); -const SettingsProvider::Setting<std::string> SettingConstants::TRELLIS_GRID_SIZE("trellisGridSize", ""); -const SettingsProvider::Setting<std::string> SettingConstants::TRELLIS_GRID_POSITIONS("trellisGridPositions", ""); const SettingsProvider::Setting<bool> SettingConstants::DISCONNECT_ON_CARD_REMOVAL("disconnectOnCardRemoval", true); const SettingsProvider::Setting<bool> SettingConstants::SINGLE_SIGN_ON("singleSignOn", false); -const SettingsProvider::Setting<bool> SettingConstants::ENABLE_SOFTWARE_UPDATES("enableSoftwareUpdates", true); } diff --git a/Swift/Controllers/SettingConstants.h b/Swift/Controllers/SettingConstants.h index 95d0527..3f15c44 100644 --- a/Swift/Controllers/SettingConstants.h +++ b/Swift/Controllers/SettingConstants.h @@ -57,8 +57,6 @@ namespace Swift { * Its value is a Boost serialized representation. */ static const SettingsProvider::Setting<std::string> HIGHLIGHT_RULES; - static const SettingsProvider::Setting<bool> SPELL_CHECKER; - static const SettingsProvider::Setting<std::string> SPELL_CHECKER_LANGUAGE; /** * The #INVITE_AUTO_ACCEPT_MODE setting specifies how to handle invites to chat rooms. * @@ -71,20 +69,6 @@ namespace Swift { */ static const SettingsProvider::Setting<std::string> INVITE_AUTO_ACCEPT_MODE; /** - * The #TRELLIS_GRID_SIZE setting specifies the dimensions of the grid used for the trellis - * layout. - * - * Its value is a Qt serialized representation. - */ - static const SettingsProvider::Setting<std::string> TRELLIS_GRID_SIZE; - /** - * The #TRELLIS_GRID_POSITIONS setting specifies where conversations to contacts or rooms go - * in the trellis grid. - * - * Its value is a Qt serialized representation. - */ - static const SettingsProvider::Setting<std::string> TRELLIS_GRID_POSITIONS; - /** * The #DISCONNECT_ON_CARD_REMOVAL setting * specifies whether or not to sign out the user when * the smartcard is removed. @@ -102,11 +86,5 @@ namespace Swift { * log in the user; else not. */ static const SettingsProvider::Setting<bool> SINGLE_SIGN_ON; - /** - * The #ENABLE_SOFTWARE_UPDATES settings specifies, whether Swift - * should automatically check for software updates in regular - * intervals and install them automatically. - */ - static const SettingsProvider::Setting<bool> ENABLE_SOFTWARE_UPDATES; }; } diff --git a/Swift/QtUI/QtChatTabs.cpp b/Swift/QtUI/QtChatTabs.cpp index 650d807..bb9c005 100644 --- a/Swift/QtUI/QtChatTabs.cpp +++ b/Swift/QtUI/QtChatTabs.cpp @@ -23,12 +23,11 @@ #include <Swiften/Base/Log.h> #include <Swift/Controllers/ChatMessageSummarizer.h> -#include <Swift/Controllers/SettingConstants.h> -#include <Swift/Controllers/Settings/SettingsProvider.h> #include <Swift/QtUI/QtSwiftUtil.h> #include <Swift/QtUI/QtTabWidget.h> #include <Swift/QtUI/QtTabbable.h> +#include <Swift/QtUI/QtUISettingConstants.h> #include <Swift/QtUI/Trellis/QtDynamicGridLayout.h> #include <Swift/QtUI/Trellis/QtGridSelectionDialog.h> @@ -51,7 +50,7 @@ QtChatTabs::QtChatTabs(bool singleWindow, SettingsProvider* settingsProvider, bo if (trellisMode) { // restore size - std::string gridSizeString = settingsProvider->getSetting(SettingConstants::TRELLIS_GRID_SIZE); + std::string gridSizeString = settingsProvider->getSetting(QtUISettingConstants::TRELLIS_GRID_SIZE); if (!gridSizeString.empty()) { QByteArray gridSizeData = QByteArray::fromBase64(P2QSTRING(gridSizeString).toUtf8()); QDataStream dataStreamGridSize(&gridSizeData, QIODevice::ReadWrite); @@ -61,7 +60,7 @@ QtChatTabs::QtChatTabs(bool singleWindow, SettingsProvider* settingsProvider, bo } // restore positions - std::string tabPositionsString = settingsProvider->getSetting(SettingConstants::TRELLIS_GRID_POSITIONS); + std::string tabPositionsString = settingsProvider->getSetting(QtUISettingConstants::TRELLIS_GRID_POSITIONS); if (!tabPositionsString.empty()) { QByteArray tabPositionsData = QByteArray::fromBase64(P2QSTRING(tabPositionsString).toUtf8()); QDataStream inTabPositions(&tabPositionsData, QIODevice::ReadWrite); @@ -383,14 +382,14 @@ void QtChatTabs::storeTabPositions() { QByteArray gridSizeData; QDataStream dataStreamGridSize(&gridSizeData, QIODevice::ReadWrite); dataStreamGridSize << dynamicGrid_->getDimension(); - settingsProvider_->storeSetting(SettingConstants::TRELLIS_GRID_SIZE, Q2PSTRING(QString(gridSizeData.toBase64()))); + settingsProvider_->storeSetting(QtUISettingConstants::TRELLIS_GRID_SIZE, Q2PSTRING(QString(gridSizeData.toBase64()))); // save positions QByteArray tabPositionsData; QDataStream dataStreamTabPositions(&tabPositionsData, QIODevice::ReadWrite); dynamicGrid_->updateTabPositions(); dataStreamTabPositions << dynamicGrid_->getTabPositions(); - settingsProvider_->storeSetting(SettingConstants::TRELLIS_GRID_POSITIONS, Q2PSTRING(QString(tabPositionsData.toBase64()))); + settingsProvider_->storeSetting(QtUISettingConstants::TRELLIS_GRID_POSITIONS, Q2PSTRING(QString(tabPositionsData.toBase64()))); } void QtChatTabs::resizeEvent(QResizeEvent*) { diff --git a/Swift/QtUI/QtSpellCheckerWindow.cpp b/Swift/QtUI/QtSpellCheckerWindow.cpp index ed7e7e8..a8178c4 100644 --- a/Swift/QtUI/QtSpellCheckerWindow.cpp +++ b/Swift/QtUI/QtSpellCheckerWindow.cpp @@ -20,9 +20,6 @@ #include <Swiften/Base/Log.h> -#include <Swift/Controllers/SettingConstants.h> -#include <Swift/Controllers/Settings/SettingsProvider.h> - #include <Swift/QtUI/QtSwiftUtil.h> #include <Swift/QtUI/QtUISettingConstants.h> @@ -48,8 +45,8 @@ void QtSpellCheckerWindow::shrinkWindow() { } void QtSpellCheckerWindow::setFromSettings() { - ui_.spellChecker->setChecked(settings_->getSetting(SettingConstants::SPELL_CHECKER)); - setEnabled(settings_->getSetting(SettingConstants::SPELL_CHECKER)); + ui_.spellChecker->setChecked(settings_->getSetting(QtUISettingConstants::SPELL_CHECKER)); + setEnabled(settings_->getSetting(QtUISettingConstants::SPELL_CHECKER)); } void QtSpellCheckerWindow::setSupportedLanguages(const std::vector<std::string>& languages) { @@ -86,10 +83,10 @@ void QtSpellCheckerWindow::setEnabled(bool state) { } void QtSpellCheckerWindow::handleApply() { - settings_->storeSetting(SettingConstants::SPELL_CHECKER, ui_.spellChecker->isChecked()); + settings_->storeSetting(QtUISettingConstants::SPELL_CHECKER, ui_.spellChecker->isChecked()); QList<QListWidgetItem* > selectedLanguage = ui_.languageView->selectedItems(); if (!selectedLanguage.empty()) { - settings_->storeSetting(SettingConstants::SPELL_CHECKER_LANGUAGE, Q2PSTRING(selectedLanguage.first()->data(Qt::UserRole).toString())); + settings_->storeSetting(QtUISettingConstants::SPELL_CHECKER_LANGUAGE, Q2PSTRING(selectedLanguage.first()->data(Qt::UserRole).toString())); } this->done(0); } diff --git a/Swift/QtUI/QtSwift.cpp b/Swift/QtUI/QtSwift.cpp index 16d8955..3aff999 100644 --- a/Swift/QtUI/QtSwift.cpp +++ b/Swift/QtUI/QtSwift.cpp @@ -50,6 +50,7 @@ #include <Swift/QtUI/QtSwiftUtil.h> #include <Swift/QtUI/QtSystemTray.h> #include <Swift/QtUI/QtUIFactory.h> +#include <Swift/QtUI/QtUISettingConstants.h> #if defined(SWIFTEN_PLATFORM_WINDOWS) #include <Swift/QtUI/WindowsNotifier.h> @@ -284,7 +285,7 @@ QtSwift::QtSwift(const po::variables_map& options) : networkFactories_(&clientMa connect(qApp, SIGNAL(aboutToQuit()), this, SLOT(handleAboutToQuit())); PlatformAutoUpdaterFactory autoUpdaterFactory; - if (autoUpdaterFactory.isSupported() && settingsHierachy_->getSetting(SettingConstants::ENABLE_SOFTWARE_UPDATES)) { + if (autoUpdaterFactory.isSupported() && settingsHierachy_->getSetting(QtUISettingConstants::ENABLE_SOFTWARE_UPDATES)) { autoUpdater_ = autoUpdaterFactory.createAutoUpdater(SWIFT_APPCAST_URL); autoUpdater_->checkForUpdates(); autoUpdater_->onSuggestRestartToUserToUpdate.connect(boost::bind(&QtSwift::handleRecommendRestartToInstallUpdate, this)); diff --git a/Swift/QtUI/QtTextEdit.cpp b/Swift/QtUI/QtTextEdit.cpp index d9ee2f4..e9708bf 100644 --- a/Swift/QtUI/QtTextEdit.cpp +++ b/Swift/QtUI/QtTextEdit.cpp @@ -18,13 +18,12 @@ #include <Swiften/Base/Log.h> -#include <Swift/Controllers/SettingConstants.h> - #include <SwifTools/SpellChecker.h> #include <SwifTools/SpellCheckerFactory.h> #include <Swift/QtUI/QtSpellCheckerWindow.h> #include <Swift/QtUI/QtSwiftUtil.h> +#include <Swift/QtUI/QtUISettingConstants.h> #include <Swift/QtUI/QtUtilities.h> namespace Swift { @@ -215,18 +214,18 @@ void QtTextEdit::setUpSpellChecker() { highlighter_ = nullptr; delete checker_; checker_ = nullptr; - if (settings_->getSetting(SettingConstants::SPELL_CHECKER)) { + if (settings_->getSetting(QtUISettingConstants::SPELL_CHECKER)) { checker_ = SpellCheckerFactory().createSpellChecker(); if (checker_) { if (!checker_->isAutomaticallyDetectingLanguage()) { - checker_->setActiveLanguage(settings_->getSetting(SettingConstants::SPELL_CHECKER_LANGUAGE)); + checker_->setActiveLanguage(settings_->getSetting(QtUISettingConstants::SPELL_CHECKER_LANGUAGE)); } highlighter_ = new QtSpellCheckHighlighter(document(), checker_); } else { // Spellchecking is not working, as we did not get a valid checker from the factory. Disable spellchecking. SWIFT_LOG(warning) << "Spellchecking is currently misconfigured in Swift (e.g. missing dictionary or broken dictionary file). Disable spellchecking." << std::endl; - settings_->storeSetting(SettingConstants::SPELL_CHECKER, false); + settings_->storeSetting(QtUISettingConstants::SPELL_CHECKER, false); } } @@ -254,8 +253,8 @@ void QtTextEdit::spellCheckerSettingsWindow() { } void QtTextEdit::handleSettingChanged(const std::string& settings) { - if (settings == SettingConstants::SPELL_CHECKER.getKey() || - settings == SettingConstants::SPELL_CHECKER_LANGUAGE.getKey()) { + if (settings == QtUISettingConstants::SPELL_CHECKER.getKey() || + settings == QtUISettingConstants::SPELL_CHECKER_LANGUAGE.getKey()) { #ifdef HAVE_SPELLCHECKER setUpSpellChecker(); if (highlighter_) { diff --git a/Swift/QtUI/QtUISettingConstants.cpp b/Swift/QtUI/QtUISettingConstants.cpp index 812e3eb..c81a234 100644 --- a/Swift/QtUI/QtUISettingConstants.cpp +++ b/Swift/QtUI/QtUISettingConstants.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2013 Isode Limited. + * Copyright (c) 2012-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -17,4 +17,9 @@ const SettingsProvider::Setting<int> QtUISettingConstants::HISTORYWINDOW_FONT_SI const SettingsProvider::Setting<bool> QtUISettingConstants::SHOW_EMOTICONS("showEmoticons", true); const SettingsProvider::Setting<bool> QtUISettingConstants::USE_PLAIN_CHATS("plainChats", false); const SettingsProvider::Setting<bool> QtUISettingConstants::USE_SCREENREADER("screenreader", false); +const SettingsProvider::Setting<bool> QtUISettingConstants::SPELL_CHECKER("spellChecker", false); +const SettingsProvider::Setting<std::string> QtUISettingConstants::SPELL_CHECKER_LANGUAGE("spellCheckerLanguage", "en_US"); +const SettingsProvider::Setting<std::string> QtUISettingConstants::TRELLIS_GRID_SIZE("trellisGridSize", ""); +const SettingsProvider::Setting<std::string> QtUISettingConstants::TRELLIS_GRID_POSITIONS("trellisGridPositions", ""); +const SettingsProvider::Setting<bool> QtUISettingConstants::ENABLE_SOFTWARE_UPDATES("enableSoftwareUpdates", true); } diff --git a/Swift/QtUI/QtUISettingConstants.h b/Swift/QtUI/QtUISettingConstants.h index 3e7291f..4616656 100644 --- a/Swift/QtUI/QtUISettingConstants.h +++ b/Swift/QtUI/QtUISettingConstants.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2013 Isode Limited. + * Copyright (c) 2012-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -20,5 +20,27 @@ namespace Swift { static const SettingsProvider::Setting<bool> SHOW_EMOTICONS; static const SettingsProvider::Setting<bool> USE_PLAIN_CHATS; static const SettingsProvider::Setting<bool> USE_SCREENREADER; + static const SettingsProvider::Setting<bool> SPELL_CHECKER; + static const SettingsProvider::Setting<std::string> SPELL_CHECKER_LANGUAGE; + /** + * The #TRELLIS_GRID_SIZE setting specifies the dimensions of the grid used for the trellis + * layout. + * + * Its value is a Qt serialized representation. + */ + static const SettingsProvider::Setting<std::string> TRELLIS_GRID_SIZE; + /** + * The #TRELLIS_GRID_POSITIONS setting specifies where conversations to contacts or rooms go + * in the trellis grid. + * + * Its value is a Qt serialized representation. + */ + static const SettingsProvider::Setting<std::string> TRELLIS_GRID_POSITIONS; + /** + * The #ENABLE_SOFTWARE_UPDATES settings specifies, whether Swift + * should automatically check for software updates in regular + * intervals and install them automatically. + */ + static const SettingsProvider::Setting<bool> ENABLE_SOFTWARE_UPDATES; }; } |