summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVlad Voicu <vladv@rosedu.org>2012-03-04 14:30:51 (GMT)
committerKevin Smith <git@kismith.co.uk>2012-03-09 15:04:06 (GMT)
commit424d19ec5f9c7ab6ca28a532540d140a22fafeb9 (patch)
treeb95864555d98c39bf8ee1fcd540bb2eaaccaba2a
parent1c8cd160b79b6bbcec72042bdb104ba530508a93 (diff)
downloadswift-contrib-424d19ec5f9c7ab6ca28a532540d140a22fafeb9.zip
swift-contrib-424d19ec5f9c7ab6ca28a532540d140a22fafeb9.tar.bz2
Added minimal SpellChecker Ui Options
-rw-r--r--Swift/Controllers/SettingConstants.cpp1
-rw-r--r--Swift/Controllers/SettingConstants.h1
-rw-r--r--Swift/QtUI/QtAffiliationEditor.cpp2
-rw-r--r--Swift/QtUI/QtAffiliationEditor.h2
-rw-r--r--Swift/QtUI/QtJoinMUCWindow.ui6
-rw-r--r--Swift/QtUI/QtLoginWindow.cpp17
-rw-r--r--Swift/QtUI/QtLoginWindow.h3
-rw-r--r--Swift/QtUI/QtSpellCheckerWindow.cpp30
-rw-r--r--Swift/QtUI/QtSpellCheckerWindow.h26
-rw-r--r--Swift/QtUI/QtSpellCheckerWindow.ui103
-rw-r--r--Swift/QtUI/SConscript2
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 4c4935a..c97cf24 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 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<RequestXMLConsoleUIEvent>(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 <Swift/Controllers/UIEvents/UIEventStream.h>
#include <Swift/Controllers/UIInterfaces/MainWindow.h>
#include <QtAboutWidget.h>
+#include <QtSpellCheckerWindow.h>
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<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 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")