diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/CMakeLists.txt | 1 | ||||
-rw-r--r-- | src/MainWindow.cpp | 18 | ||||
-rw-r--r-- | src/MainWindow.h | 6 | ||||
-rw-r--r-- | src/UiGuiSettings.cpp (renamed from src/__TODO/UiGuiSettings.cpp) | 354 | ||||
-rw-r--r-- | src/UiGuiSettings.h | 118 | ||||
-rw-r--r-- | src/__TODO/AboutDialogGraphicsView.cpp | 14 | ||||
-rw-r--r-- | src/__TODO/IndentHandler.cpp | 74 | ||||
-rw-r--r-- | src/__TODO/IndentHandler.h | 20 | ||||
-rw-r--r-- | src/__TODO/TemplateBatchScript.cpp | 2 | ||||
-rw-r--r-- | src/__TODO/UiGuiErrorMessage.cpp | 10 | ||||
-rw-r--r-- | src/__TODO/UiGuiHighlighter.cpp | 35 | ||||
-rw-r--r-- | src/__TODO/UiGuiHighlighter.h | 10 | ||||
-rw-r--r-- | src/__TODO/UiGuiIndentServer.cpp | 4 | ||||
-rw-r--r-- | src/__TODO/UiGuiIniFileParser.cpp | 14 | ||||
-rw-r--r-- | src/__TODO/UiGuiSettings.h | 94 | ||||
-rw-r--r-- | src/__TODO/UiGuiSettingsDialog.cpp | 12 | ||||
-rw-r--r-- | src/__TODO/UiGuiSystemInfo.cpp | 2 | ||||
-rwxr-xr-x | src/main.cpp | 22 |
18 files changed, 445 insertions, 365 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index b896607..753e14f 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -39,6 +39,7 @@ set( ${target}_SRCS AboutDialog.cpp MainWindow.cpp main.cpp + UiGuiSettings.cpp ) tde_add_executable( ${target} AUTOMOC diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp index 72e28a1..81326ab 100644 --- a/src/MainWindow.cpp +++ b/src/MainWindow.cpp @@ -19,19 +19,19 @@ #include "config.h" #include "MainWindow.h" -#include "UiGuiVersion.h" ///-- #include "debugging/TSLogger.h" -///-- #include "SettingsPaths.h" -///-- -#include "ToolBarWidget.h" + #include "AboutDialog.h" +#include "SettingsPaths.h" +#include "UiGuiSettings.h" +#include "UiGuiVersion.h" +#include "ToolBarWidget.h" ///-- #include "AboutDialogGraphicsView.h" -///-- #include "UiGuiSettings.h" ///-- #include "UiGuiSettingsDialog.h" ///-- #include "UiGuiHighlighter.h" ///-- #include "IndentHandler.h" -///-- + #include <tqpixmap.h> #include <tqaction.h> #include <tqcheckbox.h> @@ -89,9 +89,9 @@ MainWindow::MainWindow(TQString file2OpenOnStart, TQWidget *parent) : ///-- // Init of some variables. ///-- _sourceCodeChanged = false; ///-- _scrollPositionChanged = false; -///-- -///-- // Create the _settings object, which loads all UiGui settings from a file. -///-- _settings = UiGuiSettings::getInstance(); + + // Create the _settings object, which loads all UiGui settings from a file. + m_settings = UiGuiSettings::getInstance(); ///-- ///-- // Initialize the language of the application. ///-- initApplicationLanguage(); diff --git a/src/MainWindow.h b/src/MainWindow.h index b5fb704..f99b4c4 100644 --- a/src/MainWindow.h +++ b/src/MainWindow.h @@ -23,13 +23,13 @@ #include "MainWindowBase.h" #include "tqobjdefs.h" -/// #include "UiGuiSettings.h" -/// + /// class UiGuiSettingsDialog; class AboutDialog; /// class AboutDialogGraphicsView; /// class UiGuiHighlighter; /// class IndentHandler +class UiGuiSettings; class ToolBarWidget; /// /// class TQLabel; @@ -97,7 +97,7 @@ class MainWindow : public MainWindowBase ///-- void dropEvent(TQDropEvent *event); ///-- ///-- QsciScintilla *_qSciSourceCodeEditor; -///-- TQSharedPointer<UiGuiSettings> _settings; + UiGuiSettings *m_settings; ///-- ///-- TQString _currentEncoding; ///-- TQString _sourceFileContent; diff --git a/src/__TODO/UiGuiSettings.cpp b/src/UiGuiSettings.cpp index 2722dd3..b231577 100644 --- a/src/__TODO/UiGuiSettings.cpp +++ b/src/UiGuiSettings.cpp @@ -18,86 +18,86 @@ ***************************************************************************/ #include "UiGuiSettings.h" - #include "SettingsPaths.h" -#include <tqsettings.h> +#include <tqdatetime.h> +#include <tqdir.h> #include <tqpoint.h> +#include <tqsettings.h> #include <tqsize.h> -#include <tqdir.h> -#include <tqdate.h> -#include <tqstringlist.h> -#include <tqcoreapplication.h> -#include <tqmetamethod.h> -#include <tqmetaproperty.h> #include <tqwidget.h> -//! \defgroup grp_Settings All concerning the settings. -/*! +/* \class UiGuiSettings - \ingroup grp_Settings \brief Handles the settings of the program. Reads them on startup and saves them on exit. Is a singleton class and can only be accessed via getInstance(). */ // Inits the single class instance pointer. -TQWeakPointer<UiGuiSettings> UiGuiSettings::_instance; - +UiGuiSettings *UiGuiSettings::m_instance = nullptr; -/*! +/* \brief The constructor for the settings. */ -UiGuiSettings::UiGuiSettings() : - TQObject() +UiGuiSettings::UiGuiSettings() : TQObject() { - // Create the main application settings object from the UniversalIndentGUI.ini file. - _qsettings = new TQSettings( - SettingsPaths::getSettingsPath() + "/UniversalIndentGUI.ini", TQSettings::IniFormat, this); - - _indenterDirctoryStr = SettingsPaths::getGlobalFilesPath() + "/indenters"; + // Create the main application settings object from the UniversalIndentGUIrc file. + m_qsettings = new TQSettings(TQSettings::Ini); + // The next lines make user the settings are always stored in + // $HOME/.universalindentgui/universalindentguirc + m_qsettings->insertSearchPath(TQSettings::Unix, SettingsPaths::getSettingsPath()); + m_qsettings->setPath("UniversalIndentGUI", "UniversalIndentGUI", TQSettings::User); + // settings are stored in the universalindentguirc file, group UniversalIndentGUI + m_qsettings->beginGroup("universalindentgui/UniversalIndentGUI"); + + m_indenterDirectoryStr = SettingsPaths::getGlobalFilesPath() + "/indenters"; readAvailableTranslations(); - initSettings(); + loadSettings(); } -/*! - \brief Returns the instance of the settings class. If no instance exists, ONE will be created. +/* + \brief Returns the instance of the settings class. If no instance exists, one will be created. */ -TQSharedPointer<UiGuiSettings> UiGuiSettings::getInstance() +UiGuiSettings* UiGuiSettings::getInstance() { - TQSharedPointer<UiGuiSettings> sharedInstance = _instance.toStrongRef(); - if (sharedInstance.isNull()) + if (!m_instance) { // Create the settings object, which loads all UiGui settings from a file. - sharedInstance = TQSharedPointer<UiGuiSettings>(new UiGuiSettings()); - _instance = sharedInstance.toWeakRef(); + m_instance = new UiGuiSettings(); } - return sharedInstance; + return m_instance; } -/*! - \brief The destructor saves the settings to a file. +/* + \brief Deletes the existing instance of UiGuiSettings and removes the created temp dir. */ -UiGuiSettings::~UiGuiSettings() +void UiGuiSettings::deleteInstance() { - // Convert the language setting from an integer index to a string. - int index = _qsettings->value("UniversalIndentGUI/language", 0).toInt(); - if (index < 0 || index >= _availableTranslations.size()) + SettingsPaths::cleanAndRemoveTempDir(); + if (m_instance) { - index = 0; + delete m_instance; + m_instance = nullptr; } +} - _qsettings->setValue("UniversalIndentGUI/language", _availableTranslations.at(index)); +/* + \brief The destructor saves the settings to a file. + */ +UiGuiSettings::~UiGuiSettings() +{ + saveSettings(); + delete m_qsettings; } -/*! +/* \brief Scans the translations directory for available translation files and - stores them in the TQList \a _availableTranslations. + stores them in the TQList \a m_availableTranslations. */ void UiGuiSettings::readAvailableTranslations() { - TQString languageShort; TQStringList languageFileList; // English is the default language. A translation file does not exist but to have a menu entry, @@ -106,36 +106,66 @@ void UiGuiSettings::readAvailableTranslations() // Find all translation files in the "translations" directory. TQDir translationDirectory = TQDir(SettingsPaths::getGlobalFilesPath() + "/translations"); - languageFileList << translationDirectory.entryList(TQStringList("universalindent_*.qm")); + for (TQString &file : translationDirectory.entryList(TQString("universalindent_*.qm"))) + { + languageFileList << file; + } // Loop for each found translation file - foreach(languageShort, languageFileList) + for (TQString &languageShort : languageFileList) { // Remove the leading string "universalindent_" from the filename. languageShort.remove(0, 16); // Remove trailing file extension ".qm". - languageShort.chop(3); + languageShort.truncate(languageShort.length() - 3); - _availableTranslations.append(languageShort); + m_availableTranslations.append(languageShort); } } -/*! +/* \brief Returns a list of the mnemonics of the available translations. */ -TQStringList UiGuiSettings::getAvailableTranslations() +TQStringList& UiGuiSettings::getAvailableTranslations() { - return _availableTranslations; + return m_availableTranslations; } -/*! +/* \brief Returns the value of the by \a settingsName defined setting as TQVariant. If the named setting does not exist, 0 is being returned. */ -TQVariant UiGuiSettings::getValueByName(TQString settingName) +TQVariant UiGuiSettings::getValueByName(const TQString &settingName) const { - return _qsettings->value("UniversalIndentGUI/" + settingName); + // Test if the named setting really exists. + if (m_settings.contains(settingName)) + { + return m_settings[settingName]; + } + return TQVariant(0); +} + +/* + \brief Sets the value of the by \a settingsName defined setting to the value \a value. + + The to \a settingsName corresponding signal is emitted, if the value has changed. + */ +bool UiGuiSettings::setValueByName(const TQString &settingName, TQVariant value) +{ + // Test if the named setting really exists. + if (m_settings.contains(settingName)) + { + // Test if the new value is different to the one before. + if (m_settings[settingName] != value) + { + m_settings[settingName] = value; + // Emit the signal for the changed setting. + emitSignalForSetting(settingName); + } + return true; + } + return false; } /*! @@ -143,80 +173,130 @@ TQVariant UiGuiSettings::getValueByName(TQString settingName) Settings are for example last selected indenter, last loaded source code file and so on. */ -bool UiGuiSettings::initSettings() +void UiGuiSettings::loadSettings() { // Read the version string saved in the settings file. - _qsettings->setValue("UniversalIndentGUI/version", - _qsettings->value("UniversalIndentGUI/version", "")); + m_settings["VersionInSettingsFile"] = m_qsettings->readEntry("version", TQString::null); // Read windows last size and position from the settings file. - _qsettings->setValue("UniversalIndentGUI/maximized", - _qsettings->value("UniversalIndentGUI/maximized", false)); - _qsettings->setValue("UniversalIndentGUI/position", - _qsettings->value("UniversalIndentGUI/position", TQPoint(50, 50))); - _qsettings->setValue("UniversalIndentGUI/size", - _qsettings->value("UniversalIndentGUI/size", TQSize(800, 600))); + m_settings["WindowIsMaximized"] = m_qsettings->readBoolEntry("maximized", false); + m_settings["WindowPosition"] = m_qsettings->readEntry("position", "@Point(50, 50)"); + m_settings["WindowSize"] = m_qsettings->readEntry("size", "@Size(800, 600)"); // Read last selected encoding for the opened source code file. - _qsettings->setValue("UniversalIndentGUI/encoding", - _qsettings->value("UniversalIndentGUI/encoding", "UTF-8")); + m_settings["FileEncoding"] = m_qsettings->readEntry("encoding", "UTF-8"); // Read maximum length of list for recently opened files. - _qsettings->setValue("UniversalIndentGUI/recentlyOpenedListSize", - _qsettings->value("UniversalIndentGUI/recentlyOpenedListSize", 5)); + m_settings["RecentlyOpenedListSize"] = m_qsettings->readNumEntry("recentlyOpenedListSize", 5); // Read if last opened source code file should be loaded on startup. - _qsettings->setValue("UniversalIndentGUI/loadLastSourceCodeFileOnStartup", - _qsettings->value("UniversalIndentGUI/loadLastSourceCodeFileOnStartup", true)); + m_settings["LoadLastOpenedFileOnStartup"] = m_qsettings->readBoolEntry( + "loadLastSourceCodeFileOnStartup", true); // Read last opened source code file from the settings file. - _qsettings->setValue("UniversalIndentGUI/lastSourceCodeFile", - _qsettings->value("UniversalIndentGUI/lastSourceCodeFile", - _indenterDirctoryStr + "/example.cpp")); + m_settings["LastOpenedFiles"] = m_qsettings->readEntry("lastSourceCodeFile", + m_indenterDirectoryStr + "/example.cpp"); // Read last selected indenter from the settings file. - int selectedIndenter = _qsettings->value("UniversalIndentGUI/selectedIndenter", 0).toInt(); + int selectedIndenter = m_qsettings->readNumEntry("selectedIndenter", 0); if (selectedIndenter < 0) { selectedIndenter = 0; } - _qsettings->setValue("UniversalIndentGUI/selectedIndenter", selectedIndenter); + m_settings["SelectedIndenter"] = selectedIndenter; // Read if syntax highlighting is enabled. - _qsettings->setValue("UniversalIndentGUI/SyntaxHighlightingEnabled", - _qsettings->value("UniversalIndentGUI/SyntaxHighlightingEnabled", true)); + m_settings["SyntaxHighlightningEnabled"] = m_qsettings->readBoolEntry( + "SyntaxHighlightningEnabled", true); // Read if white space characters should be displayed. - _qsettings->setValue("UniversalIndentGUI/whiteSpaceIsVisible", - _qsettings->value("UniversalIndentGUI/whiteSpaceIsVisible", false)); + m_settings["WhiteSpaceIsVisible"] = m_qsettings->readBoolEntry("whiteSpaceIsVisible", false); // Read if indenter parameter tool tips are enabled. - _qsettings->setValue("UniversalIndentGUI/indenterParameterTooltipsEnabled", - _qsettings->value("UniversalIndentGUI/indenterParameterTooltipsEnabled", true)); + m_settings["IndenterParameterTooltipsEnabled"] = m_qsettings->readBoolEntry( + "indenterParameterTooltipsEnabled", true); // Read the tab width from the settings file. - _qsettings->setValue("UniversalIndentGUI/tabWidth", - _qsettings->value("UniversalIndentGUI/tabWidth", 4)); + m_settings["TabWidth"] = m_qsettings->readNumEntry("tabWidth", 4); // Read the last selected language and stores the index it has in the list of available // translations. - _qsettings->setValue("UniversalIndentGUI/language", - _availableTranslations.indexOf(_qsettings->value("UniversalIndentGUI/language", - "").toString())); + TQString language = m_qsettings->readEntry("language", "en"); + int idx = m_availableTranslations.findIndex(language); + if (idx < 0) + { + idx = m_availableTranslations.findIndex("en"); // "en" is always present + } + m_settings["Language"] = idx; + // TODO - MainWindow::saveState() missing in TQt3 // Read the main window state. - _qsettings->setValue("UniversalIndentGUI/MainWindowState", - _qsettings->value("UniversalIndentGUI/MainWindowState", TQByteArray())); - - return true; + // m_settings["MainWindowState"] = m_qsettings->readEntry("MainWindowState", "@ByteArray()"); } /*! + \brief Saves the settings for the main application. + + Settings are for example last selected indenter, last loaded source code file and so on. +*/ +void UiGuiSettings::saveSettings() +{ + // Write the version string saved in the settings file. + m_qsettings->writeEntry("version", m_settings["VersionInSettingsFile"].toString()); + + // Write windows last size and position from the settings file. + m_qsettings->writeEntry("maximized", m_settings["WindowIsMaximized"].toBool()); + m_qsettings->writeEntry("position", m_settings["WindowPosition"].toString()); + m_qsettings->writeEntry("size", m_settings["WindowSize"].toString()); + + // Write last selected encoding for the opened source code file. + m_qsettings->writeEntry("encoding", m_settings["FileEncoding"].toString()); + + // Write maximum length of list for recently opened files. + m_qsettings->writeEntry("recentlyOpenedListSize", m_settings["RecentlyOpenedListSize"].toInt()); + + // Write if last opened source code file should be loaded on startup. + m_qsettings->writeEntry("loadLastSourceCodeFileOnStartup", + m_settings["LoadLastOpenedFileOnStartup"].toBool()); + + // Write last opened source code file from the settings file. + m_qsettings->writeEntry("lastSourceCodeFile", m_settings["LastOpenedFiles"].toString()); + + // Write last selected indenter from the settings file. + m_qsettings->writeEntry("selectedIndenter", m_settings["SelectedIndenter"].toInt()); + + // Write if syntax highlighting is enabled. + m_qsettings->writeEntry("SyntaxHighlightningEnabled", + m_settings["SyntaxHighlightningEnabled"].toBool()); + + // Write if white space characters should be displayed. + m_qsettings->writeEntry("whiteSpaceIsVisible", m_settings["WhiteSpaceIsVisible"].toBool()); + + // Write if indenter parameter tool tips are enabled. + m_qsettings->writeEntry("indenterParameterTooltipsEnabled", + m_settings["IndenterParameterTooltipsEnabled"].toBool()); + + // Write the tab width from the settings file. + m_qsettings->writeEntry("tabWidth", m_settings["TabWidth"].toInt()); + + // Write the last selected language and stores the index it has in the list of available + m_qsettings->writeEntry("language", m_availableTranslations[m_settings["Language"].toInt()]); + + // TODO - MainWindow::saveState() missing in TQt3 + // Write the main window state. + //m_qsettings->writeEntry("MainWindowState", m_settings["MainWindowState"].toByteArray()); +} + +void UiGuiSettings::emitSignalForSetting(TQString settingName) +{ +} + +/* \brief Register the by \a propertyName defined property of \a obj to be connected to the setting defined by \a settingName. The \a propertyName must be one of those that are listed in the TQt "Properties" documentation section of a TQt Object. All further needed info is retrieved via the \a obj's MetaObject, like the to the property bound signal. - */ + * / bool UiGuiSettings::registerObjectProperty(TQObject *obj, const TQString &propertyName, const TQString &settingName) { @@ -247,7 +327,7 @@ bool UiGuiSettings::registerObjectProperty(TQObject *obj, const TQString &proper if (connectSuccess) { - _registeredObjectProperties[obj] = TQStringList() << propertyName << settingName; + m_registeredObjectProperties[obj] = TQStringList() << propertyName << settingName; } else { @@ -258,14 +338,14 @@ bool UiGuiSettings::registerObjectProperty(TQObject *obj, const TQString &proper } // If setting already exists, set the objects property to the setting value. - if (_qsettings->contains("UniversalIndentGUI/" + settingName)) + if (m_qsettings->contains("UniversalIndentGUI/" + settingName)) { - mProp.write(obj, _qsettings->value("UniversalIndentGUI/" + settingName)); + mProp.write(obj, m_qsettings->value("UniversalIndentGUI/" + settingName)); } // Otherwise add the setting and set it to the value of the objects property. else { - _qsettings->setValue("UniversalIndentGUI/" + settingName, mProp.read(obj)); + m_qsettings->setValue("UniversalIndentGUI/" + settingName, mProp.read(obj)); } } else @@ -278,29 +358,12 @@ bool UiGuiSettings::registerObjectProperty(TQObject *obj, const TQString &proper return true; } -/*! - \brief Searches the child TQObjects of \a obj for a property name and setting name definition within - their custom properties and registers this property name to that setting name if both were found. - - The custom properties, for which are searched, are "connectedPropertyName" and "connectedSettingName", - where "connectedPropertyName" is the name of a TQObject property as it is documented in the TQtDocs, and - "connectedSettingName" is the name of a setting here within UiGuiSettings. If the mentioned setting - name doesn't exist, it will be created. - - Returns true, if all found property and setting definitions could be successfully registered. - Returns false, if any of those registrations fails. - */ -bool UiGuiSettings::registerObjectPropertyRecursive(TQObject *obj) -{ - return checkCustomPropertiesAndCallFunction(obj, &UiGuiSettings::registerObjectProperty); -} - -/*! +//* \brief Assigns the by \a settingName defined setting value to the by \a propertyName defined property of \a obj. Returns true, if the value could be assigned, otherwise returns false, which is the case if settingName doesn't exist within the settings or if the mentioned propertyName wasn't found for the \a obj. - */ + * / bool UiGuiSettings::setObjectPropertyToSettingValue(TQObject *obj, const TQString &propertyName, const TQString &settingName) { @@ -312,9 +375,9 @@ bool UiGuiSettings::setObjectPropertyToSettingValue(TQObject *obj, const TQStrin TQMetaProperty mProp = metaObject->property(indexOfProp); // If setting already exists, set the objects property to the setting value. - if (_qsettings->contains("UniversalIndentGUI/" + settingName)) + if (m_qsettings->contains("UniversalIndentGUI/" + settingName)) { - mProp.write(obj, _qsettings->value("UniversalIndentGUI/" + settingName)); + mProp.write(obj, m_qsettings->value("UniversalIndentGUI/" + settingName)); } // The setting didn't exist so return that setting the objects property failed. else @@ -332,7 +395,7 @@ bool UiGuiSettings::setObjectPropertyToSettingValue(TQObject *obj, const TQStrin return true; } -/*! +/* \brief Searches the child TQObjects of \a obj for a property name and setting name definition within their custom properties and sets each property to settings value. @@ -342,20 +405,20 @@ bool UiGuiSettings::setObjectPropertyToSettingValue(TQObject *obj, const TQStrin Returns true, if all found property and setting definitions could be successfully registered. Returns false, if any of those registrations fails. - */ + * / bool UiGuiSettings::setObjectPropertyToSettingValueRecursive(TQObject *obj) { return checkCustomPropertiesAndCallFunction(obj, &UiGuiSettings::setObjectPropertyToSettingValue); } -/*! +/* \brief Assigns the by \a propertyName defined property's value of \a obj to the by \a settingName defined setting. If the \a settingName didn't exist yet, it will be created. Returns true, if the value could be assigned, otherwise returns false, which is the case if the mentioned propertyName wasn't found for the \a obj. - */ + * / bool UiGuiSettings::setSettingToObjectPropertyValue(TQObject *obj, const TQString &propertyName, const TQString &settingName) { @@ -377,7 +440,7 @@ bool UiGuiSettings::setSettingToObjectPropertyValue(TQObject *obj, const TQStrin return true; } -/*! +/* \brief Searches the child TQObjects of \a obj for a property name and setting name definition within their custom properties and sets each setting to the property value. @@ -388,17 +451,17 @@ bool UiGuiSettings::setSettingToObjectPropertyValue(TQObject *obj, const TQStrin Returns true, if all found property and setting definitions could be successfully registered. Returns false, if any of those registrations fails. - */ + * / bool UiGuiSettings::setSettingToObjectPropertyValueRecursive(TQObject *obj) { return checkCustomPropertiesAndCallFunction(obj, &UiGuiSettings::setSettingToObjectPropertyValue); } -/*! +/* \brief Iterates over all \a objs child TQObjects and checks whether they have the custom properties "connectedPropertyName" and "connectedSettingName" set. If both are set, it invokes the \a callBackFunc with both. - */ + * / bool UiGuiSettings::checkCustomPropertiesAndCallFunction(TQObject *obj, bool (UiGuiSettings::*callBackFunc)( TQObject *obj, const TQString &propertyName, const TQString &settingName)) @@ -422,16 +485,16 @@ bool UiGuiSettings::checkCustomPropertiesAndCallFunction(TQObject *obj, bool (Ui return success; } -/*! +/* \brief The with a certain property registered \a obj gets unregistered. - */ + * / void UiGuiSettings::unregisterObjectProperty(TQObject *obj) { - if (_registeredObjectProperties.contains(obj)) + if (m_registeredObjectProperties.contains(obj)) { const TQMetaObject *metaObject = obj->metaObject(); - TQString propertyName = _registeredObjectProperties[obj].first(); - TQString settingName = _registeredObjectProperties[obj].last(); + TQString propertyName = m_registeredObjectProperties[obj].first(); + TQString settingName = m_registeredObjectProperties[obj].last(); bool connectSuccess = false; int indexOfProp = metaObject->indexOfProperty(qPrintable(propertyName)); @@ -449,18 +512,18 @@ void UiGuiSettings::unregisterObjectProperty(TQObject *obj) signal.signature())), this, SLOT(handleObjectPropertyChange())); } } - _registeredObjectProperties.remove(obj); + m_registeredObjectProperties.remove(obj); } } -/*! +/* \brief Registers a slot form the \a obj by its \a slotName to be invoked, if the by \a settingName defined setting changes. The registered slot may have no parameters or exactly one. If it accepts one parameter, whenever the setting \a settingName changes the slot gets tried to be invoked with the settings value as parameter. This only works, if the slot parameter is of the same type as the setting. - */ + * / bool UiGuiSettings::registerObjectSlot(TQObject *obj, const TQString &slotName, const TQString &settingName) { @@ -483,7 +546,7 @@ bool UiGuiSettings::registerObjectSlot(TQObject *obj, const TQString &slotName, // only methods taking max one argument are allowed. if (mMethod.parameterTypes().size() <= 1) { - _registeredObjectSlots.insert(obj, TQStringList() << normalizedSlotName << settingName); + m_registeredObjectSlots.insert(obj, TQStringList() << normalizedSlotName << settingName); } else { @@ -502,16 +565,16 @@ bool UiGuiSettings::registerObjectSlot(TQObject *obj, const TQString &slotName, return true; } -/*! +/* \brief If \a obj, \a slotName and \a settingName are given, that certain connection is unregistered. If only \a obj is given, all to this object registered slot-setting connections are unregistered. - */ + * / void UiGuiSettings::unregisterObjectSlot(TQObject *obj, const TQString &slotName, const TQString &settingName) { //const TQMetaObject *metaObject = obj->metaObject(); TQString normalizedSlotName = TQMetaObject::normalizedSignature(qPrintable(slotName)); - TQMutableMapIterator<TQObject*, TQStringList> it(_registeredObjectSlots); + TQMutableMapIterator<TQObject*, TQStringList> it(m_registeredObjectSlots); while (it.hasNext()) { it.next(); @@ -526,17 +589,17 @@ void UiGuiSettings::unregisterObjectSlot(TQObject *obj, const TQString &slotName } } -/*! +/* \brief This private slot gets invoked whenever a registered objects property changes and distributes the new value to all other to the same settingName registered objects. - */ + * / void UiGuiSettings::handleObjectPropertyChange() { TQObject *obj = TQObject::sender(); TQString className = obj->metaObject()->className(); const TQMetaObject *metaObject = obj->metaObject(); - TQString propertyName = _registeredObjectProperties[obj].first(); - TQString settingName = _registeredObjectProperties[obj].last(); + TQString propertyName = m_registeredObjectProperties[obj].first(); + TQString settingName = m_registeredObjectProperties[obj].last(); int indexOfProp = metaObject->indexOfProperty(qPrintable(propertyName)); if (indexOfProp > -1) @@ -546,23 +609,23 @@ void UiGuiSettings::handleObjectPropertyChange() } } -/*! +/* \brief Sets the setting defined by \a settingName to \a value. When setting a changed value, all to this settingName registered objects get the changed value set too. If the \a settingName didn't exist yet, it will be created. - */ + * / void UiGuiSettings::setValueByName(const TQString &settingName, const TQVariant &value) { // Do the updating only, if the setting was really changed. - if (_qsettings->value("UniversalIndentGUI/" + settingName) != value) + if (m_qsettings->value("UniversalIndentGUI/" + settingName) != value) { - _qsettings->setValue("UniversalIndentGUI/" + settingName, value); + m_qsettings->setValue("UniversalIndentGUI/" + settingName, value); // Set the new value for all registered object properties for settingName. - for (TQMap<TQObject*, TQStringList>::ConstIterator it = _registeredObjectProperties.begin(); - it != _registeredObjectProperties.end(); ++it) + for (TQMap<TQObject*, TQStringList>::ConstIterator it = m_registeredObjectProperties.begin(); + it != m_registeredObjectProperties.end(); ++it) { if (it.value().last() == settingName) { @@ -580,8 +643,8 @@ void UiGuiSettings::setValueByName(const TQString &settingName, const TQVariant } // Invoke all registered object methods for settingName. - for (TQMap<TQObject*, TQStringList>::ConstIterator it = _registeredObjectSlots.begin(); - it != _registeredObjectSlots.end(); ++it) + for (TQMap<TQObject*, TQStringList>::ConstIterator it = m_registeredObjectSlots.begin(); + it != m_registeredObjectSlots.end(); ++it) { if (it.value().last() == settingName) { @@ -925,3 +988,6 @@ bool UiGuiSettings::invokeMethodWithValue(TQObject *obj, TQMetaMethod mMethod, T } } } +*/ + +#include "UiGuiSettings.moc" diff --git a/src/UiGuiSettings.h b/src/UiGuiSettings.h new file mode 100644 index 0000000..de5ddad --- /dev/null +++ b/src/UiGuiSettings.h @@ -0,0 +1,118 @@ +/*************************************************************************** +* Copyright (C) 2006-2012 by Thomas Schweitzer * +* thomas-schweitzer(at)arcor.de * +* * +* This program is free software; you can redistribute it and/or modify * +* it under the terms of the GNU General Public License version 2.0 as * +* published by the Free Software Foundation. * +* * +* This program is distributed in the hope that it will be useful, * +* but WITHOUT ANY WARRANTY; without even the implied warranty of * +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * +* GNU General Public License for more details. * +* * +* You should have received a copy of the GNU General Public License * +* along with this program in the file LICENSE.GPL; if not, write to the * +* Free Software Foundation, Inc., * +* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * +***************************************************************************/ + +#ifndef UIGUISETTINGS_H +#define UIGUISETTINGS_H + +#include <tqmap.h> +#include <tqobject.h> +#include <tqstringlist.h> +#include <tqvariant.h> + +class TQSettings; + + +class UiGuiSettings : public TQObject +{ + Q_OBJECT + + private: + UiGuiSettings(); + + static UiGuiSettings *m_instance; + + public: + static UiGuiSettings* getInstance(); + static void deleteInstance(); + + ~UiGuiSettings(); + +// [--] bool registerObjectProperty(TQObject *obj, const TQString &propertyName, +// [--] const TQString &settingName); +// [--] bool setObjectPropertyToSettingValue(TQObject *obj, const TQString &propertyName, +// [--] const TQString &settingName); +// [--] bool setObjectPropertyToSettingValueRecursive(TQObject *obj); +// [--] bool setSettingToObjectPropertyValue(TQObject *obj, const TQString &propertyName, +// [--] const TQString &settingName); +// [--] bool setSettingToObjectPropertyValueRecursive(TQObject *obj); +// [--] bool registerObjectSlot(TQObject *obj, const TQString &slotName, +// [--] const TQString &settingName); + void loadSettings(); + void saveSettings(); + bool setValueByName(const TQString &settingName, TQVariant value); + TQVariant getValueByName(const TQString &settingName) const; + TQStringList& getAvailableTranslations(); + + public slots: +// [--] void unregisterObjectProperty(TQObject *obj); +// [--] void unregisterObjectSlot(TQObject *obj, const TQString &slotName = TQString::null, +// [--] const TQString &settingName = TQString::null); +// [--] +// [--] protected: +// [--]//---- bool invokeMethodWithValue(TQObject *obj, TQMetaMethod mMethod, TQVariant value); +// [--] +// [--] bool checkCustomPropertiesAndCallFunction(TQObject * obj, +// [--] bool (UiGuiSettings::*callBackFunc)(TQObject *obj, const TQString &propertyName, +// [--] const TQString &settingName)); +// [--] +// [--] private slots: +// [--] void handleObjectPropertyChange(); +// [++] void handleValueChangeFromExtern(int value); +// [++] void handleValueChangeFromExtern(bool value); +// [++] void handleValueChangeFromExtern(TQDate value); +// [++] void handleValueChangeFromExtern(TQByteArray value); + + // Each possible setting needs an own signal. + + signals: +// [++] void versionInSettingsFile(TQString value); +// [++] void windowIsMaximized(bool value); +// [++] void windowPosition(TQPoint value); +// [++] void windowSize(TQSize value); +// [++] void fileEncoding(TQString value); +// [++] void recentlyOpenedListSize(int value); +// [++] void loadLastOpenedFileOnStartup(bool value); +// [++] void lastOpenedFiles(TQString value); +// [++] void selectedIndenter(int value); +// [++] void syntaxHighlightningEnabled(bool value); +// [++] void whiteSpaceIsVisible(bool value); +// [++] void indenterParameterTooltipsEnabled(bool value); +// [++] void tabWidth(int value); +// [++] void language(int value); +// [++] void lastUpdateCheck(TQDate value); +// [++] void mainWindowState(TQByteArray value); + + private: + void emitSignalForSetting(TQString settingName); + void readAvailableTranslations(); + + // Stores the mnemonics of the available translations. + TQStringList m_availableTranslations; + + // The settings file. + TQSettings *m_qsettings; + + // This map holds all possible settings defined by their name as TQString. + TQMap<TQString, TQVariant> m_settings; + + // The path where the indenters are located + TQString m_indenterDirectoryStr; +}; + +#endif // UIGUISETTINGS_H diff --git a/src/__TODO/AboutDialogGraphicsView.cpp b/src/__TODO/AboutDialogGraphicsView.cpp index 3c031f2..b9b527b 100644 --- a/src/__TODO/AboutDialogGraphicsView.cpp +++ b/src/__TODO/AboutDialogGraphicsView.cpp @@ -27,7 +27,7 @@ #include <tqtimeline.h> #include <tntqsplashscreen.h> -/*! +/* \class AboutDialogGraphicsView \brief A container for the real \a AboutDialog. Makes the 3D animation possible. @@ -36,7 +36,7 @@ when shown starts in frameless fullscreen mode with a screenshot of the desktop as background. */ -/*! +/* \brief The constructor initializes everything needed for the 3D animation. */ AboutDialogGraphicsView::AboutDialogGraphicsView(AboutDialog *aboutDialog, TQWidget *parentWindow) : @@ -93,7 +93,7 @@ AboutDialogGraphicsView::~AboutDialogGraphicsView(void) { } -/*! +/* \brief Grabs a screenshot of the full desktop and shows that as background. Above that background the AboutDialog 3D animation is shown. Also grabs the content of the AboutDialog itself. */ @@ -155,7 +155,7 @@ void AboutDialogGraphicsView::show() _timeLine->start(); } -/*! +/* \brief Does the next calculation/transformation step. */ void AboutDialogGraphicsView::updateStep(int step) @@ -170,7 +170,7 @@ void AboutDialogGraphicsView::updateStep(int step) //update(); } -/*! +/* \brief Stops the 3D animation, moves the AboutDialog to the correct place and really shows it. */ void AboutDialogGraphicsView::showAboutDialog() @@ -183,7 +183,7 @@ void AboutDialogGraphicsView::showAboutDialog() _aboutDialog->exec(); } -/*! +/* \brief Does not directly hide the AboutDialog but instead starts the "fade out" 3D animation. */ void AboutDialogGraphicsView::hide() @@ -209,7 +209,7 @@ void AboutDialogGraphicsView::hide() _timeLine->start(); } -/*! +/* \brief This slot really hides this AboutDialog container. */ void AboutDialogGraphicsView::hideReally() diff --git a/src/__TODO/IndentHandler.cpp b/src/__TODO/IndentHandler.cpp index b0378a8..7175221 100644 --- a/src/__TODO/IndentHandler.cpp +++ b/src/__TODO/IndentHandler.cpp @@ -62,9 +62,9 @@ inline void UNUSED_PARAMETER_WARNING_AVOID(T) { } -//! \defgroup grp_Indenter All concerning handling of the indenter. +// \defgroup grp_Indenter All concerning handling of the indenter. -/*! +/* \class IndentHandler \ingroup grp_Indenter \brief A widget for handling many indenters that are configured by an ini file. @@ -76,7 +76,7 @@ inline void UNUSED_PARAMETER_WARNING_AVOID(T) */ -/*! +/* \brief Constructor of the indent handler. By calling this constructor the indenter to be loaded, can be selected by setting @@ -211,7 +211,7 @@ IndentHandler::IndentHandler(int indenterID, TQWidget *mainWindow, TQWidget *par retranslateUi(); } -/*! +/* \brief Implicitly writes the current indenter parameters to the indenters config file. */ IndentHandler::~IndentHandler() @@ -226,7 +226,7 @@ IndentHandler::~IndentHandler() delete _errorMessageDialog; } -/*! +/* \brief Initializes the context menu used for some actions like saving the indenter config file. */ void IndentHandler::initIndenterMenu() @@ -262,7 +262,7 @@ void IndentHandler::initIndenterMenu() } } -/*! +/* \brief Returns the context menu used for some actions like saving the indenter config file. */ TQMenu* IndentHandler::getIndenterMenu() @@ -270,7 +270,7 @@ TQMenu* IndentHandler::getIndenterMenu() return _menuIndenter; } -/*! +/* \brief Returns the actions of the context menu used for some actions like saving the indenter config file. */ TQList<TQAction*> IndentHandler::getIndenterMenuActions() @@ -281,7 +281,7 @@ TQList<TQAction*> IndentHandler::getIndenterMenuActions() return actionList; } -/*! +/* \brief Opens the context menu, used for some actions like saving the indenter config file, at the event position. */ void IndentHandler::contextMenuEvent(TQContextMenuEvent *event) @@ -289,7 +289,7 @@ void IndentHandler::contextMenuEvent(TQContextMenuEvent *event) getIndenterMenu()->exec(event->globalPos()); } -/*! +/* \brief Creates the content for a shell script that can be used as a external tool call to indent an as parameter defined file. */ @@ -400,7 +400,7 @@ TQString IndentHandler::generateShellScript(const TQString &configFilename) return shellScript; } -/*! +/* \brief Format \a sourceCode by calling the indenter. The \a inputFileExtension has to be given as parameter so the called indenter @@ -418,7 +418,7 @@ TQString IndentHandler::callIndenter(TQString sourceCode, TQString inputFileExte } } -/*! +/* \brief Format \a sourceCode by calling the interpreted JavaScript code of the indenter. The \a inputFileExtension has to be given as parameter so the called indenter @@ -442,7 +442,7 @@ TQString IndentHandler::callJavaScriptIndenter(TQString sourceCode) return value.toString(); } -/*! +/* \brief Format \a sourceCode by calling the binary executable of the indenter. The \a inputFileExtension has to be given as parameter so the called indenter @@ -755,7 +755,7 @@ TQString IndentHandler::callExecutableIndenter(TQString sourceCode, TQString inp return formattedSourceCode; } -/*! +/* \brief Generates and returns a string with all parameters needed to call the indenter. */ TQString IndentHandler::getParameterString() @@ -817,7 +817,7 @@ TQString IndentHandler::getParameterString() return parameterString; } -/*! +/* \brief Write settings for the indenter to a config file. */ void IndentHandler::saveConfigFile(TQString filePathName, TQString paramString) @@ -830,7 +830,7 @@ void IndentHandler::saveConfigFile(TQString filePathName, TQString paramString) cfgFile.close(); } -/*! +/* \brief Load the config file for the indenter and apply the settings made there. */ bool IndentHandler::loadConfigFile(TQString filePathName) @@ -1034,7 +1034,7 @@ bool IndentHandler::loadConfigFile(TQString filePathName) return true; } -/*! +/* \brief Sets all indenter parameters to their default values defined in the ini file. */ void IndentHandler::resetToDefaultValues() @@ -1076,7 +1076,7 @@ void IndentHandler::resetToDefaultValues() } } -/*! +/* \brief Opens and parses the indenter ini file that is declared by \a iniFilePath. */ void IndentHandler::readIndentIniFile(TQString iniFilePath) @@ -1417,7 +1417,7 @@ void IndentHandler::readIndentIniFile(TQString iniFilePath) } } -/*! +/* \brief Searches and returns all indenters a configuration file is found for. Opens all uigui ini files found in the list \a _indenterIniFileList, opens each ini file @@ -1453,7 +1453,7 @@ TQStringList IndentHandler::getAvailableIndenters() return indenterNamesList; } -/*! +/* \brief Deletes all elements in the toolbox and initializes the indenter selected by \a indenterID. */ void IndentHandler::setIndenter(int indenterID) @@ -1528,7 +1528,7 @@ void IndentHandler::setIndenter(int indenterID) #endif // UNIVERSALINDENTGUI_NPP_EXPORTS } -/*! +/* \brief Returns a string containing by the indenter supported file types/extensions divided by a space. */ TQString IndentHandler::getPossibleIndenterFileExtensions() @@ -1536,7 +1536,7 @@ TQString IndentHandler::getPossibleIndenterFileExtensions() return _fileTypes; } -/*! +/* \brief Returns the path and filename of the current indenter config file. */ TQString IndentHandler::getIndenterCfgFile() @@ -1545,7 +1545,7 @@ TQString IndentHandler::getIndenterCfgFile() return fileInfo.absoluteFilePath(); } -/*! +/* \brief Tries to create a call path string for the indenter executable. If successful returns true. */ bool IndentHandler::createIndenterCallString() @@ -1709,7 +1709,7 @@ bool IndentHandler::createIndenterCallString() return false; } -/*! +/* \brief Returns a string that points to where the indenters manual can be found. */ TQString IndentHandler::getManual() @@ -1724,7 +1724,7 @@ TQString IndentHandler::getManual() } } -/*! +/* \brief This slot gets the reference to the indenters manual and opens it. */ void IndentHandler::showIndenterManual() @@ -1733,7 +1733,7 @@ void IndentHandler::showIndenterManual() TQDesktopServices::openUrl(manualReference); } -/*! +/* \brief Can be called to update all widgets text to the currently selected language. */ void IndentHandler::retranslateUi() @@ -1776,7 +1776,7 @@ void IndentHandler::retranslateUi() "Resets all indenter parameters to the default values.", 0, TQApplication::UnicodeUTF8)); } -/*! +/* \brief Returns the name of the currently selected indenter. */ TQString IndentHandler::getCurrentIndenterName() @@ -1793,7 +1793,7 @@ TQString IndentHandler::getCurrentIndenterName() return currentIndenterName; } -/*! +/* \brief Shows a file open dialog to open an existing config file for the currently selected indenter. If the file was successfully opened the indent handler is called to load the settings and update itself. @@ -1815,7 +1815,7 @@ void IndentHandler::openConfigFileDialog() } } -/*! +/* \brief Calls the indenter config file save as dialog to save the config file under a chosen name. If the file already exists and it should be overwritten, a warning is shown before. @@ -1839,7 +1839,7 @@ void IndentHandler::saveasIndentCfgFileDialog() } } -/*! +/* \brief Invokes the indenter to create a shell script. Lets the indenter create a shell script for calling the indenter out of any @@ -1904,7 +1904,7 @@ void IndentHandler::createIndenterCallShellScript() } } -/*! +/* \brief Resets all parameters to the indenters default values as they are specified in the uigui ini file but asks the user whether to do it really. */ @@ -1919,7 +1919,7 @@ void IndentHandler::resetIndenterParameter() } } -/*! +/* \brief Catch some events and let some other be handled by the super class. Is needed for use as Notepad++ plugin. @@ -1943,7 +1943,7 @@ bool IndentHandler::event(TQEvent *event) } } -/*! +/* \brief Sets the function pointer \a _parameterChangedCallback to the given callback function \a paramChangedCallback. @@ -1954,7 +1954,7 @@ void IndentHandler::setParameterChangedCallback(void (*paramChangedCallback)(voi _parameterChangedCallback = paramChangedCallback; } -/*! +/* \brief Emits the \a indenterSettingsChanged signal and if set executes the \a _parameterChangedCallback function. Is needed for use as Notepad++ plugin. @@ -1969,7 +1969,7 @@ void IndentHandler::handleChangedIndenterSettings() } } -/*! +/* \brief Sets a callback function that shall be called, when the this indenter parameter window gets closed. Is needed for use as Notepad++ plugin. @@ -1979,7 +1979,7 @@ void IndentHandler::setWindowClosedCallback(void (*winClosedCallback)(void)) _windowClosedCallback = winClosedCallback; } -/*! +/* \brief Is called on this indenter parameter window close and if set calls the function \a _windowClosedCallback. Is needed for use as Notepad++ plugin. @@ -1993,7 +1993,7 @@ void IndentHandler::closeEvent(TQCloseEvent *event) event->accept(); } -/*! +/* \brief Returns the id (list index) of the currently selected indenter. */ int IndentHandler::getIndenterId() @@ -2023,7 +2023,7 @@ void IndentHandler::wheelEvent(TQWheelEvent *event) #endif // UNIVERSALINDENTGUI_NPP_EXPORTS } -/*! +/* \brief Converts characters < > and & in the \a text to HTML codes < > and &. */ diff --git a/src/__TODO/IndentHandler.h b/src/__TODO/IndentHandler.h index f576518..579807d 100644 --- a/src/__TODO/IndentHandler.h +++ b/src/__TODO/IndentHandler.h @@ -89,7 +89,7 @@ class IndentHandler : public TQWidget bool createIndenterCallString(); void initIndenterMenu(); - //! Holds a reference to all created pages of the parameter categories toolbox and the pages + // Holds a reference to all created pages of the parameter categories toolbox and the pages // boxlayout struct IndenterParameterCategoryPage { @@ -99,7 +99,7 @@ class IndentHandler : public TQWidget TQVector<IndenterParameterCategoryPage> _indenterParameterCategoryPages; - //! Holds a reference to all checkboxes needed for boolean parameter setting and the parameters + // Holds a reference to all checkboxes needed for boolean parameter setting and the parameters // name struct ParamBoolean { @@ -111,7 +111,7 @@ class IndentHandler : public TQWidget TQVector<ParamBoolean> _paramBooleans; - //! Holds a reference to all line edits needed for parameter setting and the parameters name + // Holds a reference to all line edits needed for parameter setting and the parameters name struct ParamString { TQString paramName; @@ -123,7 +123,7 @@ class IndentHandler : public TQWidget TQVector<ParamString> _paramStrings; - //! Hold a reference to all spin boxes needed for parameter setting and the parameters name + // Hold a reference to all spin boxes needed for parameter setting and the parameters name struct ParamNumeric { TQString paramName; @@ -135,7 +135,7 @@ class IndentHandler : public TQWidget TQVector<ParamNumeric> _paramNumerics; - //! Hold a reference to all combo boxes needed for parameter setting and the parameters name + // Hold a reference to all combo boxes needed for parameter setting and the parameters name struct ParamMultiple { TQString paramName; @@ -150,14 +150,14 @@ class IndentHandler : public TQWidget TQComboBox *_indenterSelectionCombobox; TQToolButton *_indenterParameterHelpButton; - //! Vertical layout box, into which the toolbox will be added + // Vertical layout box, into which the toolbox will be added TQVBoxLayout *_toolBoxContainerLayout; TQToolBox *_indenterParameterCategoriesToolBox; UiGuiIniFileParser *_indenterSettings; TQStringList _indenterParameters; - //! The indenters name in a descriptive form + // The indenters name in a descriptive form TQString _indenterName; - //! The indenters file name (w/o extension), that is being called + // The indenters file name (w/o extension), that is being called TQString _indenterFileName; TQString _indenterDirctoryStr; TQString _tempDirctoryStr; @@ -183,9 +183,9 @@ class IndentHandler : public TQWidget TQAction *_actionSaveIndenterConfigFile; TQAction *_actionCreateShellScript; TQAction *_actionResetIndenterParameters; - //! Needed for the NPP plugin. + // Needed for the NPP plugin. void (*_parameterChangedCallback)(void); - //! Needed for the NPP plugin. + // Needed for the NPP plugin. void (*_windowClosedCallback)(void); //TODO: This function should go into a string helper/tool class/file. diff --git a/src/__TODO/TemplateBatchScript.cpp b/src/__TODO/TemplateBatchScript.cpp index 0650cb4..cdbf42a 100644 --- a/src/__TODO/TemplateBatchScript.cpp +++ b/src/__TODO/TemplateBatchScript.cpp @@ -22,7 +22,7 @@ // Need to include TQObject here so that platform specific defines like Q_OS_WIN32 are set. #include <tntqobject.h> -/*! +/* \brief The only and static function of this class returns a batch or shell script as string that can be used to call an indenter with the current settings from the command line. diff --git a/src/__TODO/UiGuiErrorMessage.cpp b/src/__TODO/UiGuiErrorMessage.cpp index 67e8e0c..123a807 100644 --- a/src/__TODO/UiGuiErrorMessage.cpp +++ b/src/__TODO/UiGuiErrorMessage.cpp @@ -21,7 +21,7 @@ #include <tntqcheckbox.h> -/*! +/* \class UiGuiErrorMessage \ingroup grp_Dialogs \brief UiGuiErrorMessage is a child of TQErrorMessage. But TQErrorMessages @@ -30,7 +30,7 @@ */ -/*! +/* \brief Initializes the dialog. Retrieves the object pointer to the \a _showAgainCheckBox check box, sets the dialogs @@ -44,14 +44,14 @@ UiGuiErrorMessage::UiGuiErrorMessage(TQWidget *parent) : _showAgainCheckBox->setText(tr("Show this message again")); } -/*! +/* \brief Just a lazy nothin doin destructive destructor. */ UiGuiErrorMessage::~UiGuiErrorMessage(void) { } -/*! +/* \brief Shows an error \a message in a dialog box with \a title. The shown \a message is added to a list, if not already in there. If it is @@ -84,7 +84,7 @@ void UiGuiErrorMessage::showMessage(const TQString &title, const TQString &messa } } -/*! +/* \brief For convinience, for showing a dialog box with the default title "UniversalIndentGUI". */ void UiGuiErrorMessage::showMessage(const TQString &message) diff --git a/src/__TODO/UiGuiHighlighter.cpp b/src/__TODO/UiGuiHighlighter.cpp index 7ee13e8..cfbf299 100644 --- a/src/__TODO/UiGuiHighlighter.cpp +++ b/src/__TODO/UiGuiHighlighter.cpp @@ -74,15 +74,15 @@ #include <Qsci/qscilexeryaml.h> #endif -//! \defgroup grp_EditorComponent All concerning editor widget. +// \defgroup grp_EditorComponent All concerning editor widget. -/*! +/* \class UiGuiHighlighter \ingroup grp_EditorComponent \brief UiGuiHighlighter used for selecting the syntax highlighter/lexer for the QsciScintilla component. */ -/*! +/* \brief The constructor initializes some regular expressions and keywords to identify cpp tokens */ UiGuiHighlighter::UiGuiHighlighter(QsciScintilla *parent) : @@ -159,7 +159,7 @@ UiGuiHighlighter::UiGuiHighlighter(QsciScintilla *parent) : setLexerForExtension("cpp"); } -/*! +/* \brief Returns the available highlighters as TQStringList. */ TQStringList UiGuiHighlighter::getAvailableHighlighters() @@ -167,7 +167,7 @@ TQStringList UiGuiHighlighter::getAvailableHighlighters() return _mapHighlighternameToExtension.keys(); } -/*! +/* \brief This slot handles signals coming from selecting another syntax highlighter. */ void UiGuiHighlighter::setHighlighterByAction(TQAction *highlighterAction) @@ -182,7 +182,7 @@ void UiGuiHighlighter::setHighlighterByAction(TQAction *highlighterAction) _qsciEditorParent->verticalScrollBar()->setValue(scrollPos); } -/*! +/* \brief Turns the syntax parser on. */ void UiGuiHighlighter::turnHighlightOn() @@ -192,23 +192,18 @@ void UiGuiHighlighter::turnHighlightOn() readCurrentSettings(""); } -/*! +/* \brief Turns the syntax parser off. */ void UiGuiHighlighter::turnHighlightOff() { _highlightningIsOn = false; _qsciEditorParent->setLexer(); -#if defined (Q_OS_WIN) || defined (Q_OS_MAC) - _qsciEditorParent->setFont(TQFont("Courier", 10, TQFont::Normal)); - _qsciEditorParent->setMarginsFont(TQFont("Courier", 10, TQFont::Normal)); -#else _qsciEditorParent->setFont(TQFont("Monospace", 10, TQFont::Normal)); _qsciEditorParent->setMarginsFont(TQFont("Monospace", 10, TQFont::Normal)); -#endif } -/*! +/* \brief Read the settings for the current lexer from the settings file. */ @@ -271,9 +266,6 @@ bool UiGuiHighlighter::readCurrentSettings(const char *prefix) { TQFont f; -#if defined (Q_OS_WIN) || defined (Q_OS_MAC) - f.setFamily(fdesc[0]); -#else if (fdesc[0].contains("courier", TQt::CaseInsensitive)) { f.setFamily("Monospace"); @@ -282,7 +274,6 @@ bool UiGuiHighlighter::readCurrentSettings(const char *prefix) { f.setFamily(fdesc[0]); } -#endif f.setPointSize(fdesc[1].toInt()); f.setBold(fdesc[2].toInt()); f.setItalic(fdesc[3].toInt()); @@ -317,7 +308,7 @@ bool UiGuiHighlighter::readCurrentSettings(const char *prefix) return rc; } -/*! +/* \brief Write the settings for the current lexer to the settings file. */ void UiGuiHighlighter::writeCurrentSettings(const char *prefix) @@ -390,7 +381,7 @@ void UiGuiHighlighter::writeCurrentSettings(const char *prefix) } } -/*! +/* \brief Sets the \a color for the given \a style. */ void UiGuiHighlighter::setColor(const TQColor &color, int style) @@ -399,7 +390,7 @@ void UiGuiHighlighter::setColor(const TQColor &color, int style) _lexer->setColor(color, style); } -/*! +/* \brief Sets the \a font for the given \a style. */ void UiGuiHighlighter::setFont(const TQFont &font, int style) @@ -408,7 +399,7 @@ void UiGuiHighlighter::setFont(const TQFont &font, int style) _lexer->setFont(font, style); } -/*! +/* \brief Sets the to be used lexer by giving his name. */ void UiGuiHighlighter::setLexerByName(TQString lexerName) @@ -416,7 +407,7 @@ void UiGuiHighlighter::setLexerByName(TQString lexerName) setLexerForExtension(_mapHighlighternameToExtension[lexerName].first()); } -/*! +/* \brief Sets the proper highlighter / lexer for the given file \a extension. Returns the index of the used lexer in the list. */ int UiGuiHighlighter::setLexerForExtension(TQString extension) diff --git a/src/__TODO/UiGuiHighlighter.h b/src/__TODO/UiGuiHighlighter.h index ad50849..025219e 100644 --- a/src/__TODO/UiGuiHighlighter.h +++ b/src/__TODO/UiGuiHighlighter.h @@ -47,15 +47,15 @@ class UiGuiHighlighter : public TQObject TQStringList getAvailableHighlighters(); public slots: - //! The foreground color for style number \a style is set to \a color. If - //! \a style is -1 then the color is set for all styles. + // The foreground color for style number \a style is set to \a color. If + // \a style is -1 then the color is set for all styles. void setColor(const TQColor &color, int style = -1); - //! The font for style number \a style is set to \a font. If \a style is - //! -1 then the font is set for all styles. + // The font for style number \a style is set to \a font. If \a style is + // -1 then the font is set for all styles. void setFont(const TQFont &font, int style = -1); - //! Sets the lexer that is responsible for the given \a extension. + // Sets the lexer that is responsible for the given \a extension. int setLexerForExtension(TQString extension); void setLexerByName(TQString lexerName); diff --git a/src/__TODO/UiGuiIndentServer.cpp b/src/__TODO/UiGuiIndentServer.cpp index 91c5ec7..8584650 100644 --- a/src/__TODO/UiGuiIndentServer.cpp +++ b/src/__TODO/UiGuiIndentServer.cpp @@ -24,9 +24,9 @@ #include <tntqmessagebox.h> #include <tqtdebug.h> -//! \defgroup grp_Server All concerning the server component. +// \defgroup grp_Server All concerning the server component. -/*! +/* \class UiGuiIndentServer \ingroup grp_Server \brief UiGuiIndentServer is in such an early state, that even the communication diff --git a/src/__TODO/UiGuiIniFileParser.cpp b/src/__TODO/UiGuiIniFileParser.cpp index e690139..9ff892d 100644 --- a/src/__TODO/UiGuiIniFileParser.cpp +++ b/src/__TODO/UiGuiIniFileParser.cpp @@ -24,9 +24,9 @@ #include <tntqvariant.h> #include <tntqtextstream.h> -//! \defgroup grp_Settings All concerning applications settings. +// \defgroup grp_Settings All concerning applications settings. -/*! +/* \class UiGuiIniFileParser \ingroup grp_Settings \brief UiGuiIniFileParser is a simple ini file format parser. @@ -40,7 +40,7 @@ rewrites a settings file sorted. Very annoying for me. */ -/*! +/* \brief Init and empty all needed lists and strings. */ UiGuiIniFileParser::UiGuiIniFileParser(void) @@ -48,7 +48,7 @@ UiGuiIniFileParser::UiGuiIniFileParser(void) init(); } -/*! +/* \brief Directly loads and parses the file with name \a iniFileName. */ UiGuiIniFileParser::UiGuiIniFileParser(const TQString &iniFileName) @@ -69,7 +69,7 @@ UiGuiIniFileParser::~UiGuiIniFileParser(void) { } -/*! +/* \brief Returns the group/section names in the same order as they occurr in the ini file as TQStringList. */ TQStringList UiGuiIniFileParser::childGroups() @@ -84,7 +84,7 @@ TQStringList UiGuiIniFileParser::childGroups() return sectionsStringList; } -/*! +/* \brief Returns the value of the defined \a keyName as TQVariant. The \a keyName is assembled by a section name, a slash and the key name itself. @@ -97,7 +97,7 @@ TQVariant UiGuiIniFileParser::value(const TQString &keyName, const TQString &def return _keyValueMap.value(keyName, defaultValue); } -/*! +/* \brief Parses the ini file and stores the key value pairs in the internal vectors \a keys and \a values. */ void UiGuiIniFileParser::parseIniFile() diff --git a/src/__TODO/UiGuiSettings.h b/src/__TODO/UiGuiSettings.h deleted file mode 100644 index 5068d52..0000000 --- a/src/__TODO/UiGuiSettings.h +++ /dev/null @@ -1,94 +0,0 @@ -/*************************************************************************** -* Copyright (C) 2006-2012 by Thomas Schweitzer * -* thomas-schweitzer(at)arcor.de * -* * -* This program is free software; you can redistribute it and/or modify * -* it under the terms of the GNU General Public License version 2.0 as * -* published by the Free Software Foundation. * -* * -* This program is distributed in the hope that it will be useful, * -* but WITHOUT ANY WARRANTY; without even the implied warranty of * -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * -* GNU General Public License for more details. * -* * -* You should have received a copy of the GNU General Public License * -* along with this program in the file LICENSE.GPL; if not, write to the * -* Free Software Foundation, Inc., * -* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * -***************************************************************************/ - -#ifndef UIGUISETTINGS_H -#define UIGUISETTINGS_H - -#include <tqobject.h> -#include <tqstringlist.h> -/////#include <tqmultimap.h> - -class TQSettings; - - -class UiGuiSettings : public TQObject -{ - Q_OBJECT - - private: - UiGuiSettings(); - - static UiGuiSettings *_instance; - - public: - static UiGuiSettings* getInstance(); - - ~UiGuiSettings(); - - bool registerObjectProperty(TQObject *obj, const TQString &propertyName, - const TQString &settingName); - bool registerObjectPropertyRecursive(TQObject *obj); - bool setObjectPropertyToSettingValue(TQObject *obj, const TQString &propertyName, - const TQString &settingName); - bool setObjectPropertyToSettingValueRecursive(TQObject *obj); - bool setSettingToObjectPropertyValue(TQObject *obj, const TQString &propertyName, - const TQString &settingName); - bool setSettingToObjectPropertyValueRecursive(TQObject *obj); - bool registerObjectSlot(TQObject *obj, const TQString &slotName, - const TQString &settingName); - TQVariant getValueByName(TQString settingName); - TQStringList getAvailableTranslations(); - - public slots: - void setValueByName(const TQString &settingName, const TQVariant &value); - void unregisterObjectProperty(TQObject *obj); - void unregisterObjectSlot(TQObject *obj, const TQString &slotName = "", - const TQString &settingName = ""); - - protected: - bool initSettings(); - bool invokeMethodWithValue(TQObject *obj, TQMetaMethod mMethod, TQVariant value); - - bool checkCustomPropertiesAndCallFunction(TQObject * obj, - bool (UiGuiSettings::*callBackFunc)(TQObject *obj, const TQString &propertyName, - const TQString &settingName)); - - private slots: - void handleObjectPropertyChange(); - - private: - void readAvailableTranslations(); - - //! Stores the mnemonics of the available translations. - TQStringList _availableTranslations; - - //! The settings file. - TQSettings *_qsettings; - - //! Maps an TQObject to a string list containing the property name and the associated setting - // name. - TQMap<TQObject*, TQStringList> _registeredObjectProperties; - - //! Maps TQObjects to a string list containing the method name and the associated setting name. - TQMultiMap<TQObject*, TQStringList> _registeredObjectSlots; - - TQString _indenterDirctoryStr; -}; - -#endif // UIGUISETTINGS_H diff --git a/src/__TODO/UiGuiSettingsDialog.cpp b/src/__TODO/UiGuiSettingsDialog.cpp index 8bfe0e5..46fc535 100644 --- a/src/__TODO/UiGuiSettingsDialog.cpp +++ b/src/__TODO/UiGuiSettingsDialog.cpp @@ -22,13 +22,13 @@ #include "UiGuiSettings.h" -/*! +/* \class UiGuiSettingsDialog \ingroup grp_Settings \brief Displays a dialog window with settings for UniversalIndentGUI */ -/*! +/* \brief The constructor calls the setup function for the ui created by uic. */ UiGuiSettingsDialog::UiGuiSettingsDialog(TQWidget *parent, @@ -55,7 +55,7 @@ UiGuiSettingsDialog::UiGuiSettingsDialog(TQWidget *parent, initTranslationSelection(); } -/*! +/* \brief By calling this function the combobox for selecting the application language will be initialized. @@ -113,7 +113,7 @@ void UiGuiSettingsDialog::initTranslationSelection() } } -/*! +/* \brief Displays the dialog by calling the dialogs exec function. Before it gets all the values needed from the UiGuiSettings object. @@ -127,7 +127,7 @@ int UiGuiSettingsDialog::showDialog() return exec(); } -/*! +/* \brief This slot is called when the dialog box is closed by pressing the Ok button. Writes all settings to the UiGuiSettings object. @@ -138,7 +138,7 @@ void UiGuiSettingsDialog::writeWidgetValuesToSettings() _settings->setSettingToObjectPropertyValueRecursive(this); } -/*! +/* \brief Catches language change events and retranslates all needed widgets. */ void UiGuiSettingsDialog::changeEvent(TQEvent *event) diff --git a/src/__TODO/UiGuiSystemInfo.cpp b/src/__TODO/UiGuiSystemInfo.cpp index 5456519..fdaf954 100644 --- a/src/__TODO/UiGuiSystemInfo.cpp +++ b/src/__TODO/UiGuiSystemInfo.cpp @@ -28,7 +28,7 @@ UiGuiSystemInfo::UiGuiSystemInfo() { } -/*! +/* \brief Returns the operating system UiGUI is currently running on as one string. The String contains name and version of the os. E.g. Linux Ubuntu 9.04. diff --git a/src/main.cpp b/src/main.cpp index c17f0c6..97f66b4 100755 --- a/src/main.cpp +++ b/src/main.cpp @@ -19,26 +19,24 @@ #include "MainWindow.h" -// -- #include "UiGuiIndentServer.h" // -- #include "debugging/TSLogger.h" -// -- #include "UiGuiIniFileParser.h" -// -- #include "UiGuiSettings.h" -// -- #include "UiGuiSystemInfo.h" // -- #include "IndentHandler.h" #include "SettingsPaths.h" +// -- #include "UiGuiIndentServer.h" +// -- #include "UiGuiIniFileParser.h" +#include "UiGuiSettings.h" +// -- #include "UiGuiSystemInfo.h" +#include "UiGuiVersion.h" #include <tqapplication.h> -#include <tqtextcodec.h> #include <tqglobal.h> - -// -- #include <string> -// -- #include <algorithm> - -#include "UiGuiVersion.h" - #include <tqstring.h> +#include <tqtextcodec.h> +// -- #include <algorithm> #include <iostream> +// -- #include <string> + #include <tclap/CmdLine.h> // -- using namespace tschweitzer::debugging; @@ -179,7 +177,7 @@ int main(int argc, char *argv[]) // -- delete indentHandler; delete mainWindow; - SettingsPaths::cleanAndRemoveTempDir(); + UiGuiSettings::deleteInstance(); // -- TSLogger::deleteInstance(); return returnValue; |