summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Markmann <tm@ayena.de>2016-11-10 11:22:12 (GMT)
committerKevin Smith <kevin.smith@isode.com>2016-11-10 12:37:15 (GMT)
commit94ec9c25311f8d54519f045205d58526d885412a (patch)
tree423bf068441e7314e8736622f53dc2ce42f2244c /Swift/QtUI
parentd2ba1ab8a36333523bf794c23226bd044e1717c2 (diff)
downloadswift-94ec9c25311f8d54519f045205d58526d885412a.zip
swift-94ec9c25311f8d54519f045205d58526d885412a.tar.bz2
Move Qt specific setting constants to QtUISettingConstants.h
Test-Information: Builds on macOS 10.12.1, ./scons test=all passes, Swift successfully logins and remembered Trellis configuration. Change-Id: Id94d6af1448d44d7d46ba2b8606f3e5ebe98be7a
Diffstat (limited to 'Swift/QtUI')
-rw-r--r--Swift/QtUI/QtChatTabs.cpp11
-rw-r--r--Swift/QtUI/QtSpellCheckerWindow.cpp11
-rw-r--r--Swift/QtUI/QtSwift.cpp3
-rw-r--r--Swift/QtUI/QtTextEdit.cpp13
-rw-r--r--Swift/QtUI/QtUISettingConstants.cpp7
-rw-r--r--Swift/QtUI/QtUISettingConstants.h24
6 files changed, 46 insertions, 23 deletions
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;
};
}