mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
feat(ui): Add ui to setup spell checking
This commit is contained in:
parent
671b9456a8
commit
8d10fe47ec
|
@ -231,6 +231,7 @@ void Settings::loadGlobal()
|
|||
lightTrayIcon = s.value("lightTrayIcon", false).toBool();
|
||||
useEmoticons = s.value("useEmoticons", true).toBool();
|
||||
statusChangeNotificationEnabled = s.value("statusChangeNotificationEnabled", false).toBool();
|
||||
spellCheckingEnabled = s.value("spellCheckingEnabled", true).toBool();
|
||||
themeColor = s.value("themeColor", 0).toInt();
|
||||
style = s.value("style", "").toString();
|
||||
if (style == "") // Default to Fusion if available, otherwise no style
|
||||
|
@ -547,6 +548,7 @@ void Settings::saveGlobal()
|
|||
s.setValue("themeColor", themeColor);
|
||||
s.setValue("style", style);
|
||||
s.setValue("statusChangeNotificationEnabled", statusChangeNotificationEnabled);
|
||||
s.setValue("spellCheckingEnabled", spellCheckingEnabled);
|
||||
}
|
||||
s.endGroup();
|
||||
|
||||
|
@ -1046,6 +1048,22 @@ void Settings::setStatusChangeNotificationEnabled(bool newValue)
|
|||
}
|
||||
}
|
||||
|
||||
bool Settings::getSpellCheckingEnabled() const
|
||||
{
|
||||
const QMutexLocker locker{&bigLock};
|
||||
return spellCheckingEnabled;
|
||||
}
|
||||
|
||||
void Settings::setSpellCheckingEnabled(bool newValue)
|
||||
{
|
||||
QMutexLocker locker{&bigLock};
|
||||
|
||||
if (newValue != spellCheckingEnabled) {
|
||||
spellCheckingEnabled = newValue;
|
||||
emit statusChangeNotificationEnabledChanged(statusChangeNotificationEnabled);
|
||||
}
|
||||
}
|
||||
|
||||
bool Settings::getShowInFront() const
|
||||
{
|
||||
QMutexLocker locker{&bigLock};
|
||||
|
|
|
@ -91,6 +91,8 @@ class Settings : public QObject, public ICoreSettings, public IFriendSettings,
|
|||
Q_PROPERTY(QString dateFormat READ getDateFormat WRITE setDateFormat NOTIFY dateFormatChanged FINAL)
|
||||
Q_PROPERTY(bool statusChangeNotificationEnabled READ getStatusChangeNotificationEnabled WRITE
|
||||
setStatusChangeNotificationEnabled NOTIFY statusChangeNotificationEnabledChanged FINAL)
|
||||
Q_PROPERTY(bool spellCheckingEnabled READ getSpellCheckingEnabled WRITE
|
||||
setSpellCheckingEnabled NOTIFY spellCheckingEnabledChanged FINAL)
|
||||
|
||||
// Privacy
|
||||
Q_PROPERTY(bool typingNotification READ getTypingNotification WRITE setTypingNotification NOTIFY
|
||||
|
@ -212,6 +214,7 @@ signals:
|
|||
void timestampFormatChanged(const QString& format);
|
||||
void dateFormatChanged(const QString& format);
|
||||
void statusChangeNotificationEnabledChanged(bool enabled);
|
||||
void spellCheckingEnabledChanged(bool enabled);
|
||||
void fauxOfflineMessagingChanged(bool enabled);
|
||||
|
||||
// Privacy
|
||||
|
@ -449,6 +452,9 @@ public:
|
|||
bool getStatusChangeNotificationEnabled() const;
|
||||
void setStatusChangeNotificationEnabled(bool newValue);
|
||||
|
||||
bool getSpellCheckingEnabled() const;
|
||||
void setSpellCheckingEnabled(bool newValue);
|
||||
|
||||
// Privacy
|
||||
bool getTypingNotification() const;
|
||||
void setTypingNotification(bool enabled);
|
||||
|
@ -641,6 +647,7 @@ private:
|
|||
QString timestampFormat;
|
||||
QString dateFormat;
|
||||
bool statusChangeNotificationEnabled;
|
||||
bool spellCheckingEnabled;
|
||||
|
||||
// Privacy
|
||||
bool typingNotification;
|
||||
|
|
|
@ -147,7 +147,9 @@ GenericChatForm::GenericChatForm(const Contact* contact, QWidget* parent)
|
|||
|
||||
msgEdit = new ChatTextEdit();
|
||||
#ifdef SPELL_CHECKING
|
||||
decorator = new Sonnet::SpellCheckDecorator(msgEdit);
|
||||
if (s.getSpellCheckingEnabled()) {
|
||||
decorator = new Sonnet::SpellCheckDecorator(msgEdit);
|
||||
}
|
||||
#endif
|
||||
|
||||
sendButton = createButton("sendButton", this, &GenericChatForm::onSendTriggered);
|
||||
|
|
|
@ -105,6 +105,11 @@ GeneralForm::GeneralForm(SettingsWidget* myParent)
|
|||
#else
|
||||
bodyUI->checkUpdates->setVisible(false);
|
||||
#endif
|
||||
|
||||
#ifndef SPELL_CHECKING
|
||||
bodyUI->cbSpellChecking->setVisible(false);
|
||||
#endif
|
||||
|
||||
bodyUI->checkUpdates->setChecked(s.getCheckUpdates());
|
||||
|
||||
for (int i = 0; i < locales.size(); ++i) {
|
||||
|
@ -126,6 +131,7 @@ GeneralForm::GeneralForm(SettingsWidget* myParent)
|
|||
|
||||
bodyUI->cbAutorun->setChecked(s.getAutorun());
|
||||
|
||||
bodyUI->cbSpellChecking->setChecked(s.getSpellCheckingEnabled());
|
||||
bodyUI->lightTrayIcon->setChecked(s.getLightTrayIcon());
|
||||
bool showSystemTray = s.getShowSystemTray();
|
||||
|
||||
|
@ -172,6 +178,11 @@ void GeneralForm::on_cbAutorun_stateChanged()
|
|||
Settings::getInstance().setAutorun(bodyUI->cbAutorun->isChecked());
|
||||
}
|
||||
|
||||
void GeneralForm::on_cbSpellChecking_stateChanged()
|
||||
{
|
||||
Settings::getInstance().setSpellCheckingEnabled(bodyUI->cbSpellChecking->isChecked());
|
||||
}
|
||||
|
||||
void GeneralForm::on_showSystemTray_stateChanged()
|
||||
{
|
||||
Settings::getInstance().setShowSystemTray(bodyUI->showSystemTray->isChecked());
|
||||
|
|
|
@ -42,6 +42,7 @@ public:
|
|||
private slots:
|
||||
void on_transComboBox_currentIndexChanged(int index);
|
||||
void on_cbAutorun_stateChanged();
|
||||
void on_cbSpellChecking_stateChanged();
|
||||
void on_showSystemTray_stateChanged();
|
||||
void on_startInTray_stateChanged();
|
||||
void on_closeToTray_stateChanged();
|
||||
|
|
|
@ -119,6 +119,13 @@
|
|||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_6">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="cbSpellChecking">
|
||||
<property name="text">
|
||||
<string>Spell checking</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="lightTrayIcon">
|
||||
<property name="sizePolicy">
|
||||
|
|
Loading…
Reference in New Issue
Block a user