summaryrefslogtreecommitdiffstats
path: root/src/UiGuiSettings.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/UiGuiSettings.cpp')
-rw-r--r--src/UiGuiSettings.cpp49
1 files changed, 45 insertions, 4 deletions
diff --git a/src/UiGuiSettings.cpp b/src/UiGuiSettings.cpp
index baea1d9..e4ab510 100644
--- a/src/UiGuiSettings.cpp
+++ b/src/UiGuiSettings.cpp
@@ -53,6 +53,11 @@ UiGuiSettings::UiGuiSettings() : TQObject()
m_qsettings->beginGroup("universalindentgui/UniversalIndentGUI");
m_indenterDirectoryStr = SettingsPaths::getGlobalFilesPath() + "/indenters";
+
+ m_actionSettings["actionEnableSyntaxHighlighting"] = "SyntaxHighlightingEnabled";
+ m_actionSettings["actionLoadLastOpenedFileOnStartup"] = "LoadLastOpenedFileOnStartup";
+ m_actionSettings["actionWhiteSpaceIsVisible"] = "WhiteSpaceIsVisible";
+
readAvailableTranslations();
loadSettings();
}
@@ -229,8 +234,8 @@ void UiGuiSettings::loadSettings()
m_settings["SelectedIndenter"] = selectedIndenter;
// Read if syntax highlighting is enabled.
- m_settings["SyntaxHighlightningEnabled"] = m_qsettings->readBoolEntry(
- "SyntaxHighlightningEnabled", true);
+ m_settings["SyntaxHighlightingEnabled"] = m_qsettings->readBoolEntry(
+ "SyntaxHighlightingEnabled", true);
// Read if white space characters should be displayed.
m_settings["WhiteSpaceIsVisible"] = m_qsettings->readBoolEntry("whiteSpaceIsVisible", false);
@@ -297,8 +302,8 @@ void UiGuiSettings::saveSettings()
m_qsettings->writeEntry("selectedIndenter", m_settings["SelectedIndenter"].toInt());
// Write if syntax highlighting is enabled.
- m_qsettings->writeEntry("SyntaxHighlightningEnabled",
- m_settings["SyntaxHighlightningEnabled"].toBool());
+ m_qsettings->writeEntry("SyntaxHighlightingEnabled",
+ m_settings["SyntaxHighlightingEnabled"].toBool());
// Write if white space characters should be displayed.
m_qsettings->writeEntry("whiteSpaceIsVisible", m_settings["WhiteSpaceIsVisible"].toBool());
@@ -318,8 +323,44 @@ void UiGuiSettings::saveSettings()
//m_qsettings->writeEntry("MainWindowState", m_settings["MainWindowState"].toByteArray());
}
+/*
+ \brief Extern widgets can connect to this slot to change settings.
+
+ According to the objects property "connectedSettingName" the corresponding
+ setting is known and set.
+ */
+void UiGuiSettings::handleValueChangeFromExtern(bool value)
+{
+ if (sender())
+ {
+ // Get the corresponding setting name from the sender objects property
+ TQString senderName = TQString(sender()->name());
+ if (m_actionSettings.contains(senderName))
+ {
+ TQString settingName = m_actionSettings[senderName];
+
+ // Set the value of the setting to the objects value.
+ setValueByName(settingName, value);
+ tqWarning("MIKE set="+settingName);
+ }
+ }
+}
+
void UiGuiSettings::emitSignalForSetting(TQString settingName)
{
+ // Emit the signal for the changed value.
+ if (settingName == "LoadLastOpenedFileOnStartup")
+ {
+ emit loadLastOpenedFileOnStartup(m_settings[settingName].toBool());
+ }
+ else if (settingName == "SyntaxHighlightingEnabled")
+ {
+ emit syntaxHighlightingEnabled(m_settings[settingName].toBool());
+ }
+ else if (settingName == "WhiteSpaceIsVisible")
+ {
+ emit whiteSpaceIsVisible(m_settings[settingName].toBool());
+ }
}
/*