summaryrefslogtreecommitdiffstats
path: root/Swift
diff options
context:
space:
mode:
authorKevin Smith <git@kismith.co.uk>2013-03-31 16:14:06 (GMT)
committerSwift Review <review@swift.im>2013-04-05 08:12:53 (GMT)
commit92640bf4e5ff215b9e83e64d78777c7b163409db (patch)
tree6e4a9f7c7906acb12169397c5a234de48c5a5638 /Swift
parent7f4d4ffc8c656c5125fc3a53e5afdd4a8c5ff4f3 (diff)
downloadswift-92640bf4e5ff215b9e83e64d78777c7b163409db.zip
swift-92640bf4e5ff215b9e83e64d78777c7b163409db.tar.bz2
Hide spell checking options when it's not hunspell
Change-Id: Ia127b744e70c46495c45b8976501b7a5e52a93e8
Diffstat (limited to 'Swift')
-rw-r--r--Swift/QtUI/QtSpellCheckerWindow.cpp11
-rw-r--r--Swift/QtUI/QtSpellCheckerWindow.h3
-rw-r--r--Swift/QtUI/QtSpellCheckerWindow.ui122
3 files changed, 83 insertions, 53 deletions
diff --git a/Swift/QtUI/QtSpellCheckerWindow.cpp b/Swift/QtUI/QtSpellCheckerWindow.cpp
index e2c5b0d..db2b1e7 100644
--- a/Swift/QtUI/QtSpellCheckerWindow.cpp
+++ b/Swift/QtUI/QtSpellCheckerWindow.cpp
@@ -15,12 +15,19 @@
#include <QFileDialog>
#include <QDir>
#include <QStringList>
+#include <QTimer>
namespace Swift {
QtSpellCheckerWindow::QtSpellCheckerWindow(SettingsProvider* settings, QWidget* parent) : QDialog(parent) {
settings_ = settings;
ui_.setupUi(this);
+#ifdef HAVE_HUNSPELL
+ ui_.hunspellOptions->show();
+#else
+ ui_.hunspellOptions->hide();
+ QTimer::singleShot(0, this, SLOT(shrinkWindow()));
+#endif
connect(ui_.spellChecker, SIGNAL(toggled(bool)), this, SLOT(handleChecker(bool)));
connect(ui_.cancel, SIGNAL(clicked()), this, SLOT(handleCancel()));
connect(ui_.apply, SIGNAL(clicked()), this, SLOT(handleApply()));
@@ -28,6 +35,10 @@ QtSpellCheckerWindow::QtSpellCheckerWindow(SettingsProvider* settings, QWidget*
setFromSettings();
}
+void QtSpellCheckerWindow::shrinkWindow() {
+ resize(0,0);
+}
+
void QtSpellCheckerWindow::setFromSettings() {
ui_.spellChecker->setChecked(settings_->getSetting(SettingConstants::SPELL_CHECKER));
ui_.pathContent->setText(P2QSTRING(settings_->getSetting(SettingConstants::DICT_PATH)));
diff --git a/Swift/QtUI/QtSpellCheckerWindow.h b/Swift/QtUI/QtSpellCheckerWindow.h
index ad94907..7b63318 100644
--- a/Swift/QtUI/QtSpellCheckerWindow.h
+++ b/Swift/QtUI/QtSpellCheckerWindow.h
@@ -22,7 +22,8 @@ namespace Swift {
void handlePathButton();
void handlePersonalPathButton();
void handleApply();
-
+ private slots:
+ void shrinkWindow();
private:
void setEnabled(bool state);
void setFromSettings();
diff --git a/Swift/QtUI/QtSpellCheckerWindow.ui b/Swift/QtUI/QtSpellCheckerWindow.ui
index b98bb6d..b7f5161 100644
--- a/Swift/QtUI/QtSpellCheckerWindow.ui
+++ b/Swift/QtUI/QtSpellCheckerWindow.ui
@@ -6,15 +6,81 @@
<rect>
<x>0</x>
<y>0</y>
- <width>353</width>
- <height>207</height>
+ <width>399</width>
+ <height>265</height>
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
- <layout class="QGridLayout" name="gridLayout">
- <item row="4" column="3" colspan="2">
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <widget class="QCheckBox" name="spellChecker">
+ <property name="text">
+ <string>Spell Checker Enabled</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QWidget" name="hunspellOptions" native="true">
+ <layout class="QVBoxLayout" name="verticalLayout_2">
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_2">
+ <item>
+ <widget class="QLabel" name="pathLabel">
+ <property name="text">
+ <string>Dictionary Path:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLineEdit" name="pathContent"/>
+ </item>
+ <item>
+ <widget class="QPushButton" name="pathButton">
+ <property name="text">
+ <string>Change</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_3">
+ <item>
+ <widget class="QLabel" name="currentLanguage">
+ <property name="text">
+ <string>Current Language:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="currentLanguageValue">
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_4">
+ <item>
+ <widget class="QLabel" name="language">
+ <property name="text">
+ <string>Language:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QListWidget" name="languageView"/>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QPushButton" name="cancel">
@@ -32,54 +98,6 @@
</item>
</layout>
</item>
- <item row="0" column="0" colspan="3">
- <widget class="QCheckBox" name="spellChecker">
- <property name="text">
- <string>Spell Checker Enabled</string>
- </property>
- </widget>
- </item>
- <item row="1" column="0" colspan="2">
- <widget class="QLabel" name="pathLabel">
- <property name="text">
- <string>Dictionary Path:</string>
- </property>
- </widget>
- </item>
- <item row="1" column="2" colspan="2">
- <widget class="QLineEdit" name="pathContent"/>
- </item>
- <item row="1" column="4">
- <widget class="QPushButton" name="pathButton">
- <property name="text">
- <string>Change</string>
- </property>
- </widget>
- </item>
- <item row="2" column="0" colspan="2">
- <widget class="QLabel" name="currentLanguage">
- <property name="text">
- <string>Current Language:</string>
- </property>
- </widget>
- </item>
- <item row="2" column="2">
- <widget class="QLabel" name="currentLanguageValue">
- <property name="text">
- <string/>
- </property>
- </widget>
- </item>
- <item row="3" column="1" colspan="4">
- <widget class="QListWidget" name="languageView"/>
- </item>
- <item row="3" column="0">
- <widget class="QLabel" name="language">
- <property name="text">
- <string>Language:</string>
- </property>
- </widget>
- </item>
</layout>
</widget>
<resources/>