diff options
Diffstat (limited to 'src')
-rwxr-xr-x | src/AboutDialogBase.ui | 218 | ||||
-rw-r--r-- | src/CMakeLists.txt | 4 | ||||
-rw-r--r-- | src/MainWindow.cpp | 124 | ||||
-rw-r--r-- | src/MainWindow.h | 9 | ||||
-rwxr-xr-x | src/MainWindowBase.ui | 42 | ||||
-rwxr-xr-x | src/ToolBarWidget.ui | 228 | ||||
-rw-r--r-- | src/UiGuiSettings.cpp | 12 | ||||
-rw-r--r-- | src/UiGuiSettings.h | 7 | ||||
-rw-r--r-- | src/UiGuiSettingsDialog.cpp | 218 | ||||
-rw-r--r-- | src/UiGuiSettingsDialog.h (renamed from src/__TODO/UiGuiSettingsDialog.h) | 25 | ||||
-rwxr-xr-x | src/UiGuiSettingsDialogBase.ui | 338 | ||||
-rw-r--r-- | src/__TODO/UiGuiSettingsDialog.cpp | 205 | ||||
-rwxr-xr-x | src/__TODO/UiGuiSettingsDialog.ui | 460 |
13 files changed, 865 insertions, 1025 deletions
diff --git a/src/AboutDialogBase.ui b/src/AboutDialogBase.ui index 8bc3dab..b67864e 100755 --- a/src/AboutDialogBase.ui +++ b/src/AboutDialogBase.ui @@ -1,114 +1,114 @@ <!DOCTYPE UI><UI version="3.3" stdsetdef="1"> - <class>AboutDialogBase</class> - <widget class="TQDialog"> + <class>AboutDialogBase</class> + <widget class="TQDialog"> <property name="name"> <cstring>AboutDialogBase</cstring> </property> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>588</width> - <height>512</height> - </rect> - </property> - <property name="sizePolicy"> - <sizepolicy> - <hsizetype>0</hsizetype> - <vsizetype>5</vsizetype> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>588</width> - <height>333</height> - </size> - </property> - <property name="caption"> - <string>About UniversalIndentGUI</string> - </property> - <vbox> - <property name="margin"> - <number>0</number> - </property> - <widget class="TQFrame"> - <property name="name"> - <cstring>frame</cstring> - </property> - <property name="frameShape"> - <enum>StyledPanel</enum> - </property> - <vbox> - <widget class="TQLabel"> - <property name="name"> - <cstring>bannerLabel</cstring> - </property> - <property name="sizePolicy"> - <sizepolicy> - <hsizetype>0</hsizetype> - <vsizetype>0</vsizetype> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>570</width> - <height>87</height> - </size> - </property> - <property name="maximumSize"> - <size> - <width>570</width> - <height>87</height> - </size> - </property> - <property name="text"> - <string></string> - </property> - </widget> - <hbox> - <spacer> - <property name="name"> - <cstring>spacer1</cstring> - </property> - <property name="orientation"> - <enum>TQt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - <widget class="TQPushButton"> - <property name="name"> - <cstring>okButton</cstring> - </property> - <property name="text"> - <string>OK</string> - </property> - </widget> - <spacer> - <property name="name"> - <cstring>spacer2</cstring> - </property> - <property name="orientation"> - <enum>TQt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - </hbox> - </vbox> - </widget> - </vbox> - </widget> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>588</width> + <height>512</height> + </rect> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>0</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>588</width> + <height>333</height> + </size> + </property> + <property name="caption"> + <string>About UniversalIndentGUI</string> + </property> + <vbox> + <property name="margin"> + <number>0</number> + </property> + <widget class="TQFrame"> + <property name="name"> + <cstring>frame</cstring> + </property> + <property name="frameShape"> + <enum>StyledPanel</enum> + </property> + <vbox> + <widget class="TQLabel"> + <property name="name"> + <cstring>bannerLabel</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>0</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>570</width> + <height>87</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>570</width> + <height>87</height> + </size> + </property> + <property name="text"> + <string></string> + </property> + </widget> + <hbox> + <spacer> + <property name="name"> + <cstring>spacer1</cstring> + </property> + <property name="orientation"> + <enum>TQt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="TQPushButton"> + <property name="name"> + <cstring>okButton</cstring> + </property> + <property name="text"> + <string>OK</string> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>spacer2</cstring> + </property> + <property name="orientation"> + <enum>TQt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </hbox> + </vbox> + </widget> + </vbox> + </widget> </UI> diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 7d5f6b4..901feca 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -30,6 +30,7 @@ set( ${target}_SRCS MainWindowBase.ui ToolBarWidget.ui + IndentHandler.cpp SettingsPaths.cpp TemplateBatchScript.cpp UiGuiErrorMessage.cpp @@ -38,12 +39,13 @@ set( ${target}_SRCS # ongoing AboutDialogBase.ui + UiGuiSettingsDialogBase.ui AboutDialog.cpp - IndentHandler.cpp MainWindow.cpp main.cpp UiGuiSettings.cpp + UiGuiSettingsDialog.cpp ) tde_add_executable( ${target} AUTOMOC diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp index c945da4..899a029 100644 --- a/src/MainWindow.cpp +++ b/src/MainWindow.cpp @@ -28,10 +28,10 @@ #include "IndentHandler.h" #include "SettingsPaths.h" #include "UiGuiSettings.h" +#include "UiGuiSettingsDialog.h" #include "UiGuiVersion.h" #include "ToolBarWidget.h" ///-- #include "AboutDialogGraphicsView.h" -///-- #include "UiGuiSettingsDialog.h" ///-- #include "UiGuiHighlighter.h" #include <tqaction.h> @@ -50,22 +50,10 @@ #include <tqsplitter.h> #include <tqstatusbar.h> #include <tqtextcodec.h> +#include <tqtooltip.h> #include <tqtranslator.h> #include <tqwidget.h> -///-- #include <tqstring.h> -///-- #include <tqscrollbar.h> -///-- #include <tqtextcursor.h> -///-- #include <tqtextstream.h> -///-- #include <tqtextdocument.h> -///-- #include <tqprinter.h> -///-- #include <tqprintdialog.h> -///-- #include <tqcloseevent.h> -///-- #include <tqhelpevent.h> -///-- #include <tqtooltip.h> -///-- #include <tqdate.h> -///-- #include <tqurl.h> -///-- #include <tqtdebug.h> -///-- + #include <tqextscintilla.h> ///-- #include <Qsci/qsciprinter.h> ///-- @@ -89,13 +77,12 @@ */ MainWindow::MainWindow(TQString file2OpenOnStart, TQWidget *parent) : MainWindowBase(parent), m_aboutDialog(nullptr), m_qSciSourceCodeEditor(nullptr), - m_qTranslator(nullptr), m_uiGuiTranslator(nullptr), m_textEditLineColumnInfoLabel(nullptr), + m_uiGuiTranslator(nullptr), m_textEditLineColumnInfoLabel(nullptr), m_oldLinesNumber(0), m_openEncodingActions(), m_saveEncodingActions(), m_encodingActionGroup(nullptr), m_saveEncodedActionGroup(nullptr), m_highlighterActionGroup(nullptr), m_documentModified(false), m_previewToggled(true), - m_indentHandler(nullptr), m_centralSplitter(nullptr) -///- _mainWindowForm(nullptr), _settings(nullptr) -///- m_highlighter(nullptr), _aboutDialogGraphicsView(nullptr), _settingsDialog(nullptr) + m_indentHandler(nullptr), m_centralSplitter(nullptr), m_settingsDialog(nullptr) +///- m_highlighter(nullptr), _aboutDialogGraphicsView(nullptr) ///- m_textEditVScrollBar(nullptr), _toolBarWidget(nullptr) { // Init of some variables. @@ -133,10 +120,9 @@ MainWindow::MainWindow(TQString file2OpenOnStart, TQWidget *parent) : ///-- _aboutDialogGraphicsView = new AboutDialogGraphicsView(m_aboutDialog, this); connect(actionAboutUniversalIndentGUITQt, SIGNAL(activated()), this, SLOT(showAboutDialog())); -///-- // Generate settings dialog box -///-- _settingsDialog = new UiGuiSettingsDialog(this, _settings); -///-- connect(actionShowSettings, SIGNAL(activated()), _settingsDialog, -///-- SLOT(showDialog())); + // Generate settings dialog box + m_settingsDialog = new UiGuiSettingsDialog(this, m_settings); + connect(actionShowSettings, SIGNAL(activated()), m_settingsDialog, SLOT(showDialog())); if (TQFile::exists(file2OpenOnStart)) { @@ -157,6 +143,7 @@ MainWindow::MainWindow(TQString file2OpenOnStart, TQWidget *parent) : MainWindow::~MainWindow() { + delete m_settingsDialog; delete m_aboutDialog; UiGuiSettings::deleteInstance(); } @@ -254,6 +241,8 @@ void MainWindow::initMainWindow() connect(actionSaveSourceFileAs, SIGNAL(activated()), this, SLOT(saveasSourceFileDialog())); connect(actionExportPDF, SIGNAL(activated()), this, SLOT(exportToPDF())); connect(actionExportHTML, SIGNAL(activated()), this, SLOT(exportToHTML())); + connect(m_settings, SIGNAL(indenterParameterTooltipsEnabled(bool)), + this, SLOT(setIndenterParameterTooltips(bool))); ///-- connect(actionShowLog, SIGNAL(activated()), ///-- debugging::TSLogger::getInstance(), SLOT(show())); @@ -265,9 +254,7 @@ void MainWindow::initMainWindow() this, SLOT(recentlyOpenedFileHighlighted(int))); connect(popupMenuRecentlyOpenedFiles, SIGNAL(activated(int)), this, SLOT(openFileFromRecentlyOpenedList(int))); -///-- //connect( _settings, SIGNAL(recentlyOpenedListSize(int)), this, SLOT(updateRecentlyOpenedList()) -///-- // ); -///-- _settings->registerObjectSlot(this, "updateRecentlyOpenedList()", "recentlyOpenedListSize"); + connect(m_settings, SIGNAL(recentlyOpenedListSize(int)), this, SLOT(updateRecentlyOpenedList())); updateWindowTitle(); } @@ -387,7 +374,7 @@ void MainWindow::initSyntaxHighlighter() /* \brief Initializes the language of UniversalIndentGUI. - If the program language is defined in the _settings, the corresponding language + If the program language is defined in the m_settings, the corresponding language file will be loaded and set for the application. If not set there, the system default language will be set, if a translation file for that language exists. Returns true, if the translation file could be loaded. Otherwise it returns @@ -429,19 +416,10 @@ bool MainWindow::initApplicationLanguage() } // Load the TQt own translation file and set it for the application. - m_qTranslator = new TQTranslator(); - bool translationFileLoaded; - translationFileLoaded = m_qTranslator->load(SettingsPaths::getGlobalFilesPath() + - "/translations/qt_" + languageShort); - if (translationFileLoaded) - { - tqApp->installTranslator(m_qTranslator); - } - // Load the uigui translation file and set it for the application. m_uiGuiTranslator = new TQTranslator(); - translationFileLoaded = m_uiGuiTranslator->load(SettingsPaths::getGlobalFilesPath() + - "/translations/universalindent_" + languageShort); + bool translationFileLoaded = m_uiGuiTranslator->load(SettingsPaths::getGlobalFilesPath() + + "/translations/universalindent_" + languageShort + ".qm"); if (translationFileLoaded) { tqApp->installTranslator(m_uiGuiTranslator); @@ -1102,34 +1080,6 @@ void MainWindow::closeEvent(TQCloseEvent *event) } } -///-- /* -///-- \brief This function is setup to capture tooltip events. -///-- -///-- All widgets that are created by the m_indentHandler object and are responsible -///-- for indenter parameters are connected with this event filter. -///-- So depending on the _settings the tooltips can be enabled and disabled for these widgets. -///-- */ -///-- bool MainWindow::eventFilter(TQObject *obj, TQEvent *event) -///-- { -///-- if (event->type() == TQEvent::ToolTip) -///-- { -///-- if (actionIndenterParameterTooltipsEnabled->isOn()) -///-- { -///-- return TQMainWindow::eventFilter(obj, event); -///-- } -///-- else -///-- { -///-- //TQToolTip::showText( TQPoint(100,100) , "Test1"); -///-- return true; -///-- } -///-- } -///-- else -///-- { -///-- // pass the event on to the parent class -///-- return TQMainWindow::eventFilter(obj, event); -///-- } -///-- } - /* \brief Is called at application exit and asks whether to save the source code file, if it has been changed. @@ -1164,24 +1114,12 @@ void MainWindow::languageChanged(int languageIndex) // Get the mnemonic of the new selected language. TQString languageShort = m_settings->getAvailableTranslations()[languageIndex]; - // Remove the old qt translation. - tqApp->removeTranslator(m_qTranslator); - // Remove the old uigui translation. tqApp->removeTranslator(m_uiGuiTranslator); - // Load the TQt own translation file and set it for the application. - bool translationFileLoaded; - translationFileLoaded = m_qTranslator->load(SettingsPaths::getGlobalFilesPath() + - "/translations/qt_" + languageShort); - if (translationFileLoaded) - { - tqApp->installTranslator(m_qTranslator); - } - // Load the uigui translation file and set it for the application. - translationFileLoaded = m_uiGuiTranslator->load(SettingsPaths::getGlobalFilesPath() + - "/translations/universalindent_" + languageShort); + bool translationFileLoaded = m_uiGuiTranslator->load(SettingsPaths::getGlobalFilesPath() + + "/translations/universalindent_" + languageShort + ".qm"); if (translationFileLoaded) { tqApp->installTranslator(m_uiGuiTranslator); @@ -1337,6 +1275,14 @@ void MainWindow::setWhiteSpaceVisibility(bool visible) } /* + \brief Is called whenever the tooltip visibility is being changed in the settings. + */ +void MainWindow::setIndenterParameterTooltips(bool enabled) +{ + TQToolTip::setGloballyEnabled(enabled); +} + +/* \brief This slot is called whenever the number of lines in the editor changes and adapts the margin for the displayed line numbers. */ @@ -1453,6 +1399,9 @@ void MainWindow::initRecentlyOpenedList() */ void MainWindow::updateRecentlyOpenedList() { + // Make sure to read the currnt max size settings + m_recentlyOpenedListMaxSize = m_settings->getValueByName("RecentlyOpenedListSize").toInt(); + TQString fileName; TQString filePath; @@ -1472,22 +1421,23 @@ void MainWindow::updateRecentlyOpenedList() -1, 0); popupMenuRecentlyOpenedFiles->setWhatsThis(id, m_currentSourceFile); } - // Put the current file at the first position if it not already is and is not empty. + // Put the current file at the first position if it was not in the list else if (currentFileIndex == -1) { m_recentlyOpenedList.prepend(m_currentSourceFile); int id = popupMenuRecentlyOpenedFiles->insertItem(TQFileInfo(m_currentSourceFile).fileName(), -1, 0); popupMenuRecentlyOpenedFiles->setWhatsThis(id, m_currentSourceFile); - // Trim the last element if we have reached the max allowed size - if (m_recentlyOpenedList.size() > m_recentlyOpenedListMaxSize) - { - m_recentlyOpenedList.pop_back(); - popupMenuRecentlyOpenedFiles->removeItemAt(m_recentlyOpenedListMaxSize); - } } } + // Trim excessive elements if the size has shrinked + while (m_recentlyOpenedList.size() > m_recentlyOpenedListMaxSize) + { + m_recentlyOpenedList.pop_back(); + popupMenuRecentlyOpenedFiles->removeItemAt(m_recentlyOpenedListMaxSize); + } + // Enable or disable "actionClearRecentlyOpenedList" actionClearRecentlyOpenedList->setEnabled(!m_recentlyOpenedList.isEmpty()); } diff --git a/src/MainWindow.h b/src/MainWindow.h index 4b500af..2236c5b 100644 --- a/src/MainWindow.h +++ b/src/MainWindow.h @@ -25,14 +25,14 @@ #include "tqvaluelist.h" -/// class UiGuiSettingsDialog; class AboutDialog; /// class AboutDialogGraphicsView; /// class UiGuiHighlighter; class IndentHandler; class UiGuiSettings; +class UiGuiSettingsDialog; class ToolBarWidget; -/// + /// class TQActionGroup; class TQextScintilla; class TQSplitter; @@ -52,7 +52,6 @@ class MainWindow : public MainWindowBase protected: void closeEvent(TQCloseEvent *event); -///-- bool eventFilter(TQObject *obj, TQEvent *event); private slots: void openSourceFileDialog(const TQString &fileName = TQString::null); @@ -63,6 +62,7 @@ class MainWindow : public MainWindowBase void updateSourceView(); void turnHighlightOnOff(bool turnOn); void setWhiteSpaceVisibility(bool visible); + void setIndenterParameterTooltips(bool enabled); void sourceCodeChangedHelperSlot(); void sourceCodeChangedSlot(); void indentSettingsChangedSlot(); @@ -110,7 +110,7 @@ class MainWindow : public MainWindowBase ///-- TQScrollBar *m_textEditVScrollBar; AboutDialog *m_aboutDialog; ///-- AboutDialogGraphicsView *_aboutDialogGraphicsView; -///-- UiGuiSettingsDialog *_settingsDialog; + UiGuiSettingsDialog *m_settingsDialog; int m_actionClearRecentlyOpenedListId; int m_recentlyOpenedListMaxSize; ///-- int _textEditLastScrollPos; @@ -126,7 +126,6 @@ class MainWindow : public MainWindowBase TQValueList<TQAction*> m_openEncodingActions; TQValueList<TQAction*> m_saveEncodingActions; TQTranslator *m_uiGuiTranslator; - TQTranslator *m_qTranslator; bool m_sourceCodeChanged; bool m_indentSettingsChanged; diff --git a/src/MainWindowBase.ui b/src/MainWindowBase.ui index 48679d6..720e8aa 100755 --- a/src/MainWindowBase.ui +++ b/src/MainWindowBase.ui @@ -70,27 +70,27 @@ <action name="actionAboutUniversalIndentGUITQt"/> </item> </menubar> - <toolbars> - <toolbar dock="2"> - <property name="name"> - <cstring>toolBar</cstring> - </property> - <property name="label"> - <string>Tools</string> - </property> - <property name="orientation"> - <enum>TQt::Horizontal</enum> - </property> - <property name="sizePolicy"> - <sizepolicy> - <hsizetype>5</hsizetype> - <vsizetype>5</vsizetype> - <horstretch>1</horstretch> - <verstretch>1</verstretch> - </sizepolicy> - </property> - </toolbar> - </toolbars> + <toolbars> + <toolbar dock="2"> + <property name="name"> + <cstring>toolBar</cstring> + </property> + <property name="label"> + <string>Tools</string> + </property> + <property name="orientation"> + <enum>TQt::Horizontal</enum> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>1</horstretch> + <verstretch>1</verstretch> + </sizepolicy> + </property> + </toolbar> + </toolbars> <actions> <action> <property name="name"> diff --git a/src/ToolBarWidget.ui b/src/ToolBarWidget.ui index 25663c2..14ebc8c 100755 --- a/src/ToolBarWidget.ui +++ b/src/ToolBarWidget.ui @@ -1,116 +1,116 @@ <!DOCTYPE UI><UI version="3.2" stdsetdef="1"> - <class>ToolBarWidget</class> - <widget class="TQWidget"> - <property name="name"> - <cstring>ToolBarWidget</cstring> - </property> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>773</width> - <height>34</height> - </rect> - </property> - <property name="caption"> - <string>Form</string> - </property> - <hbox> - <property name="name"> - <cstring>unnamed</cstring> - </property> - <property name="spacing"> - <number>6</number> - </property> - <property name="margin"> - <number>0</number> - </property> - <widget class="TQPushButton"> - <property name="name"> - <cstring>pbOpenSourceFile</cstring> - </property> - <property name="text"> - <string>Open Source File </string> - </property> - <property name="toolTip" stdset="0"> - <string>Opens a dialog for selecting a source code file</string> - </property> - </widget> - <widget class="TQCheckBox"> - <property name="name"> - <cstring>cbLivePreview</cstring> - </property> - <property name="text"> - <string>Live Indent Preview</string> - </property> - <property name="whatsThis" stdset="0"> - <string>Turns the preview of the reformatted source code on and off</string> - </property> - <property name="accel"> - <string>Ctrl+L</string> - </property> - </widget> - <widget class="TQCheckBox"> - <property name="name"> - <cstring>cbEnableSyntaxHL</cstring> - </property> - <property name="text"> - <string>Syntax Highlight</string> - </property> - <property name="whatsThis" stdset="0"> - <string>Enables and disables the highlighting of the source</string> - </property> - <property name="accel"> - <string>Ctrl+H</string> - </property> - <property name="checked"> - <bool>true</bool> - </property> - </widget> - <spacer> - <property name="name"> - <cstring>spacer1</cstring> - </property> - <property name="orientation"> - <enum>TQt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>2000</width> - <height>20</height> - </size> - </property> - <property name="sizePolicy"> - <sizepolicy> - <hsizetype>5</hsizetype> - <vsizetype>5</vsizetype> - <horstretch>1</horstretch> - <verstretch>1</verstretch> - </sizepolicy> - </property> - </spacer> - <widget class="TQPushButton"> - <property name="name"> - <cstring>pbAbout</cstring> - </property> - <property name="text"> - <string>About</string> - </property> - <property name="toolTip" stdset="0"> - <string>Shows info about UniversalIndentGUI</string> - </property> - </widget> - <widget class="TQPushButton"> - <property name="name"> - <cstring>pbExit</cstring> - </property> - <property name="text"> - <string>Exit</string> - </property> - <property name="toolTip" stdset="0"> - <string>Quits UniversalIndentGUI</string> - </property> - </widget> - </hbox> - </widget> + <class>ToolBarWidget</class> + <widget class="TQWidget"> + <property name="name"> + <cstring>ToolBarWidget</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>773</width> + <height>34</height> + </rect> + </property> + <property name="caption"> + <string>Form</string> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="spacing"> + <number>6</number> + </property> + <property name="margin"> + <number>0</number> + </property> + <widget class="TQPushButton"> + <property name="name"> + <cstring>pbOpenSourceFile</cstring> + </property> + <property name="text"> + <string>Open Source File </string> + </property> + <property name="toolTip" stdset="0"> + <string>Opens a dialog for selecting a source code file</string> + </property> + </widget> + <widget class="TQCheckBox"> + <property name="name"> + <cstring>cbLivePreview</cstring> + </property> + <property name="text"> + <string>Live Indent Preview</string> + </property> + <property name="whatsThis" stdset="0"> + <string>Turns the preview of the reformatted source code on and off</string> + </property> + <property name="accel"> + <string>Ctrl+L</string> + </property> + </widget> + <widget class="TQCheckBox"> + <property name="name"> + <cstring>cbEnableSyntaxHL</cstring> + </property> + <property name="text"> + <string>Syntax Highlight</string> + </property> + <property name="whatsThis" stdset="0"> + <string>Enables and disables the highlighting of the source</string> + </property> + <property name="accel"> + <string>Ctrl+H</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>spacer1</cstring> + </property> + <property name="orientation"> + <enum>TQt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>2000</width> + <height>20</height> + </size> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>1</horstretch> + <verstretch>1</verstretch> + </sizepolicy> + </property> + </spacer> + <widget class="TQPushButton"> + <property name="name"> + <cstring>pbAbout</cstring> + </property> + <property name="text"> + <string>About</string> + </property> + <property name="toolTip" stdset="0"> + <string>Shows info about UniversalIndentGUI</string> + </property> + </widget> + <widget class="TQPushButton"> + <property name="name"> + <cstring>pbExit</cstring> + </property> + <property name="text"> + <string>Exit</string> + </property> + <property name="toolTip" stdset="0"> + <string>Quits UniversalIndentGUI</string> + </property> + </widget> + </hbox> + </widget> </UI> diff --git a/src/UiGuiSettings.cpp b/src/UiGuiSettings.cpp index 0f4ae72..c3fccbb 100644 --- a/src/UiGuiSettings.cpp +++ b/src/UiGuiSettings.cpp @@ -112,7 +112,7 @@ void UiGuiSettings::readAvailableTranslations() // Find all translation files in the "translations" directory. TQDir translationDirectory = TQDir(SettingsPaths::getGlobalFilesPath() + "/translations"); - for (TQString &file : translationDirectory.entryList(TQString("universalindent_*.qm"))) + for (const TQString &file : translationDirectory.entryList(TQString("universalindent_*.qm"))) { languageFileList << file; } @@ -348,7 +348,11 @@ void UiGuiSettings::handleValueChangeFromExtern(bool value) void UiGuiSettings::emitSignalForSetting(TQString settingName) { // Emit the signal for the changed value. - if (settingName == "LoadLastOpenedFileOnStartup") + if (settingName == "RecentlyOpenedListSize") + { + emit recentlyOpenedListSize(m_settings[settingName].toInt()); + } + else if (settingName == "LoadLastOpenedFileOnStartup") { emit loadLastOpenedFileOnStartup(m_settings[settingName].toBool()); } @@ -360,6 +364,10 @@ void UiGuiSettings::emitSignalForSetting(TQString settingName) { emit whiteSpaceIsVisible(m_settings[settingName].toBool()); } + else if (settingName == "IndenterParameterTooltipsEnabled") + { + emit indenterParameterTooltipsEnabled(m_settings[settingName].toBool()); + } else if (settingName == "TabWidth") { emit tabWidth(m_settings[settingName].toInt()); diff --git a/src/UiGuiSettings.h b/src/UiGuiSettings.h index df9d04f..99137b5 100644 --- a/src/UiGuiSettings.h +++ b/src/UiGuiSettings.h @@ -71,9 +71,8 @@ class UiGuiSettings : public TQObject // [--] bool (UiGuiSettings::*callBackFunc)(TQObject *obj, const TQString &propertyName, // [--] const TQString &settingName)); // [--] -// [--] private slots: + private slots: // [--] void handleObjectPropertyChange(); -// [++] void handleValueChangeFromExtern(int value); void handleValueChangeFromExtern(bool value); // [++] void handleValueChangeFromExtern(TQDate value); // [++] void handleValueChangeFromExtern(TQByteArray value); @@ -86,13 +85,13 @@ class UiGuiSettings : public TQObject // [++] void windowPosition(TQPoint value); // [++] void windowSize(TQSize value); // [++] void fileEncoding(TQString value); -// [++] void recentlyOpenedListSize(int value); + void recentlyOpenedListSize(int value); void loadLastOpenedFileOnStartup(bool value); // [++] void lastOpenedFiles(TQString value); // [++] void selectedIndenter(int value); void syntaxHighlightingEnabled(bool value); void whiteSpaceIsVisible(bool value); -// [++] void indenterParameterTooltipsEnabled(bool value); + void indenterParameterTooltipsEnabled(bool value); void tabWidth(int value); void language(int value); // [++] void lastUpdateCheck(TQDate value); diff --git a/src/UiGuiSettingsDialog.cpp b/src/UiGuiSettingsDialog.cpp new file mode 100644 index 0000000..8eb5783 --- /dev/null +++ b/src/UiGuiSettingsDialog.cpp @@ -0,0 +1,218 @@ +/*************************************************************************** +* 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. * +***************************************************************************/ + +#include "config.h" + +#include "UiGuiSettingsDialog.h" +#include "UiGuiSettings.h" + +#include <tqcheckbox.h> +#include <tqcombobox.h> +#include <tqpixmap.h> +#include <tqspinbox.h> +#include <tqtabwidget.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, UiGuiSettings *settings) : + UiGuiSettingsDialogBase(parent) +{ + // Remember pointer to the UiGuiSettings object. + m_settings = settings; + + // For icon setup + const TQString ICONS_PATH(APP_ICONS_PATH); + // Application icon + setIcon(TQPixmap(ICONS_PATH + "preferences-system.png")); + + tabWidget->setTabIconSet(tabCommon, TQPixmap(ICONS_PATH + "applications-system.png")); + tabWidget->setTabIconSet(tabEditor, TQPixmap(ICONS_PATH + "accessories-text-editor.png")); + tabWidget->setTabIconSet(tabSyntaxHighlight, TQPixmap(ICONS_PATH + "syntax-highlight.png")); + + // Init the language selection combobox. + initTranslationSelection(); +} + +/* + \brief By calling this function the combobox for selecting the application language will + be initialized. + + Also the translation itself will be reinitialized. + */ +void UiGuiSettingsDialog::initTranslationSelection() +{ + // For icon setup + const TQString ICONS_PATH(APP_ICONS_PATH); + + // First empty the combo box. + cmbBoxLanguageSelection->clear(); + + // Now add an entry into the box for every language short. + for (const TQString &languageShort : m_settings->getAvailableTranslations()) + { + // Identify the language mnemonic and set the full name. + if (languageShort == "en") + { + cmbBoxLanguageSelection->insertItem(TQPixmap(ICONS_PATH + "language-en.png"), tr("English")); + } + else if (languageShort == "fr") + { + cmbBoxLanguageSelection->insertItem(TQPixmap(ICONS_PATH + "language-fr.png"), tr("French")); + } + else if (languageShort == "de") + { + cmbBoxLanguageSelection->insertItem(TQPixmap(ICONS_PATH + "language-de.png"), tr("German")); + } + else if (languageShort == "zh_TW") + { + cmbBoxLanguageSelection->insertItem(TQPixmap(ICONS_PATH + "language-zh_TW.png"), + tr("Chinese (Taiwan)")); + } + else if (languageShort == "ja") + { + cmbBoxLanguageSelection->insertItem(TQPixmap(ICONS_PATH + "language-ja.png"), tr("Japanese")); + } + else if (languageShort == "ru") + { + cmbBoxLanguageSelection->insertItem(TQPixmap(ICONS_PATH + "language-ru.png"), tr("Russian")); + } + else if (languageShort == "uk") + { + cmbBoxLanguageSelection->insertItem(TQPixmap(ICONS_PATH + "language-uk.png"), tr("Ukrainian")); + } + } +} + +/* + \brief Displays the dialog by calling the dialogs exec function. + + Before it gets all the values needed from the UiGuiSettings object. + */ +void UiGuiSettingsDialog::showDialog() +{ + // Init all settings dialog objects with values from settings. + cbLoadLastOpenedFileOnStartup->setChecked( + m_settings->getValueByName("LoadLastOpenedFileOnStartup").toBool()); + cbEnableIndenterParameterTooltips->setChecked( + m_settings->getValueByName("IndenterParameterTooltipsEnabled").toBool()); + cbWhiteSpaceIsVisible->setChecked( + m_settings->getValueByName("WhiteSpaceIsVisible").toBool()); + cbEnableSyntaxHL->setChecked( + m_settings->getValueByName("SyntaxHighlightingEnabled").toBool()); + sbRecentlyOpenedListSize->setValue(m_settings->getValueByName("RecentlyOpenedListSize").toInt()); + sbTabWidth->setValue(m_settings->getValueByName("TabWidth").toInt()); + + // Execute the dialog. + if (exec() == TQDialog::Accepted) + { + updateSettings(); + } +} + +/* + \brief This slot is called when the dialog box is closed by pressing the Ok button. + + Writes all settings to the UiGuiSettings object. + */ +void UiGuiSettingsDialog::updateSettings() +{ + m_settings->setValueByName("LoadLastOpenedFileOnStartup", + cbLoadLastOpenedFileOnStartup->isChecked()); + m_settings->setValueByName("IndenterParameterTooltipsEnabled", + cbEnableIndenterParameterTooltips->isChecked()); + m_settings->setValueByName("RecentlyOpenedListSize", sbRecentlyOpenedListSize->value()); + m_settings->setValueByName("WhiteSpaceIsVisible", cbWhiteSpaceIsVisible->isChecked()); + m_settings->setValueByName("TabWidth", sbTabWidth->value()); + m_settings->setValueByName("SyntaxHighlightingEnabled", cbEnableSyntaxHL->isChecked()); +} + +//--- /* +//--- \brief Catches language change events and retranslates all needed widgets. +//--- */ +//--- void UiGuiSettingsDialog::changeEvent(TQEvent *event) +//--- { +//--- if (event->type() == TQEvent::LanguageChange) +//--- { +//--- retranslateUi(this); +//--- // If this is not explicit set here, TQt < 4.3.0 does not translate the buttons. +//--- buttonBox->setStandardButtons( +//--- TQDialogButtonBox::Cancel | TQDialogButtonBox::NoButton | TQDialogButtonBox::Ok); +//--- +//--- //TODO: This has to be removed when the properties for the highlighters can be set. +//--- groupBoxSyntaxHighlighterProperties->setToolTip( +//--- "(Will be implemented soon)" + +//--- groupBoxSyntaxHighlighterProperties->toolTip()); +//--- +//--- TQStringList languageShortList = _settings->getAvailableTranslations(); +//--- +//--- // Now retranslate every entry in the language selection box. +//--- for (int i = 0; i < languageShortList.size(); i++) +//--- { +//--- TQString languageShort = languageShortList.at(i); +//--- +//--- // Identify the language mnemonic and set the full name. +//--- if (languageShort == "en") +//--- { +//--- cmbBoxLanguageSelection->setItemText(i, tr("English")); +//--- } +//--- else if (languageShort == "fr") +//--- { +//--- cmbBoxLanguageSelection->setItemText(i, tr("French")); +//--- } +//--- else if (languageShort == "de") +//--- { +//--- cmbBoxLanguageSelection->setItemText(i, tr("German")); +//--- } +//--- else if (languageShort == "zh_TW") +//--- { +//--- cmbBoxLanguageSelection->setItemText(i, tr("Chinese (Taiwan)")); +//--- } +//--- else if (languageShort == "ja") +//--- { +//--- cmbBoxLanguageSelection->setItemText(i, tr("Japanese")); +//--- } +//--- else if (languageShort == "ru") +//--- { +//--- cmbBoxLanguageSelection->setItemText(i, tr("Russian")); +//--- } +//--- else if (languageShort == "uk") +//--- { +//--- cmbBoxLanguageSelection->setItemText(i, tr("Ukrainian")); +//--- } +//--- else +//--- { +//--- cmbBoxLanguageSelection->setItemText(i, +//--- tr("Unknown language mnemonic ") + languageShort); +//--- } +//--- } +//--- } +//--- else +//--- { +//--- TQWidget::changeEvent(event); +//--- } +//--- } + +#include "UiGuiSettingsDialog.moc" diff --git a/src/__TODO/UiGuiSettingsDialog.h b/src/UiGuiSettingsDialog.h index eef08d6..5ef33c2 100644 --- a/src/__TODO/UiGuiSettingsDialog.h +++ b/src/UiGuiSettingsDialog.h @@ -20,36 +20,27 @@ #ifndef UIGUISETTINGSDIALOG_H #define UIGUISETTINGSDIALOG_H -#include <tntqdialog.h> - #include "UiGuiSettings.h" +#include "UiGuiSettingsDialogBase.h" -namespace Ui -{ - class SettingsDialog; -} - - -class UiGuiSettingsDialog : public TQDialog +class UiGuiSettingsDialog : public UiGuiSettingsDialogBase { TQ_OBJECT public: - UiGuiSettingsDialog(TQWidget *parent, TQSharedPointer<UiGuiSettings> settings); + UiGuiSettingsDialog(TQWidget *parent, UiGuiSettings *settings); public slots: - int showDialog(); + void showDialog(); private slots: - void writeWidgetValuesToSettings(); + void updateSettings(); private: - Ui::SettingsDialog *_settingsDialogForm; - - void changeEvent(TQEvent *event); +//--- void changeEvent(TQEvent *event); void initTranslationSelection(); - TQSharedPointer<UiGuiSettings> _settings; + UiGuiSettings *m_settings; }; -#endif // UIGUISETTINGSDIALOG_H +#endif diff --git a/src/UiGuiSettingsDialogBase.ui b/src/UiGuiSettingsDialogBase.ui new file mode 100755 index 0000000..963f240 --- /dev/null +++ b/src/UiGuiSettingsDialogBase.ui @@ -0,0 +1,338 @@ +<!DOCTYPE UI><UI version="3.3" stdsetdef="1"> + <class>UiGuiSettingsDialogBase</class> + <widget class="TQDialog"> + <property name="name"> + <cstring>UiGuiSettingsDialogBase</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>503</width> + <height>336</height> + </rect> + </property> + <property name="caption"> + <string>Settings</string> + </property> + <vbox> + <widget class="TQTabWidget"> + <property name="name"> + <cstring>tabWidget</cstring> + </property> + <property name="currentPage"> + <number>0</number> + </property> + <widget class="TQWidget"> + <property name="name"> + <cstring>tabCommon</cstring> + </property> + <attribute name="title"> + <string>Common</string> + </attribute> + <vbox> + <hbox> + <widget class="TQLabel"> + <property name="name"> + <cstring>languageLabel</cstring> + </property> + <property name="text"> + <string>Application language</string> + </property> + <property name="buddy" stdset="0"> + <cstring>cmbBoxLanguageSelection</cstring> + </property> + <property name="whatsThis" stdset="0"> + <string>Choose UniversalIndentGui language.</string> + </property> + </widget> + <widget class="TQComboBox"> + <property name="name"> + <cstring>cmbBoxLanguageSelection</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="whatsThis" stdset="0"> + <string>Choose UniversalIndentGui language.</string> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>spacer8</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>40</height> + </size> + </property> + </spacer> + </hbox> + <widget class="TQCheckBox"> + <property name="name"> + <cstring>cbLoadLastOpenedFileOnStartup</cstring> + </property> + <property name="text"> + <string>Automatically open last file on startup</string> + </property> + <property name="whatsThis"> + <string>If checked, reopen the last used source code file on startup.</string> + </property> + </widget> + <widget class="TQCheckBox"> + <property name="name"> + <cstring>cbEnableIndenterParameterTooltips</cstring> + </property> + <property name="text"> + <string>Enable Parameter Tooltips</string> + </property> + <property name="whatsThis"> + <string>If checked, tool tips will show up for the indenter parameters.</string> + </property> + </widget> + <hbox> + <widget class="TQLabel"> + <property name="name"> + <cstring>labelRecentlyOpenedListSize</cstring> + </property> + <property name="text"> + <string>Number of files in recently opened list</string> + </property> + <property name="buddy" stdset="0"> + <cstring>sbRecentlyOpenedListSize</cstring> + </property> + <property name="whatsThis" stdset="0"> + <string>Sets number of files in the list of recently opened files.</string> + </property> + </widget> + <widget class="TQSpinBox"> + <property name="name"> + <cstring>sbRecentlyOpenedListSize</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="maxValue"> + <number>30</number> + </property> + <property name="minValue"> + <number>1</number> + </property> + <property name="whatsThis" stdset="0"> + <string>Sets number of files in the list of recently opened files.</string> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>spacer7</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>40</height> + </size> + </property> + </spacer> + </hbox> + <spacer> + <property name="name"> + <cstring>spacer6</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>40</height> + </size> + </property> + </spacer> + </vbox> + </widget> + <widget class="TQWidget"> + <property name="name"> + <cstring>tabEditor</cstring> + </property> + <attribute name="title"> + <string>Editor</string> + </attribute> + <vbox> + <widget class="TQCheckBox"> + <property name="name"> + <cstring>cbWhiteSpaceIsVisible</cstring> + </property> + <property name="text"> + <string>Display white space character (tabs, spaces, etc.)</string> + </property> + <property name="whatsThis"> + <string>Enables or disables displaying of white space characters in the editor.</string> + </property> + </widget> + <hbox> + <widget class="TQLabel"> + <property name="name"> + <cstring>labelTabWidth</cstring> + </property> + <property name="text"> + <string>Displayed width of tabs</string> + </property> + <property name="buddy" stdset="0"> + <cstring>sbTabWidth</cstring> + </property> + <property name="whatsThis" stdset="0"> + <string>Defines how many spaces should be displayed in the editor for one tab.</string> + </property> + </widget> + <widget class="TQSpinBox"> + <property name="name"> + <cstring>sbTabWidth</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="maxValue"> + <number>99</number> + </property> + <property name="minValue"> + <number>1</number> + </property> + <property name="whatsThis" stdset="0"> + <string>Defines how many spaces should be displayed in the editor for one tab.</string> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>spacer5</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>40</height> + </size> + </property> + </spacer> + </hbox> + <spacer> + <property name="name"> + <cstring>spacer4</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>40</height> + </size> + </property> + </spacer> + </vbox> + </widget> + <widget class="TQWidget"> + <property name="name"> + <cstring>tabSyntaxHighlight</cstring> + </property> + <attribute name="title"> + <string>Syntax Highlighting</string> + </attribute> + <vbox> + <widget class="TQCheckBox"> + <property name="name"> + <cstring>cbEnableSyntaxHL</cstring> + </property> + <property name="text"> + <string>Enable syntax highlighting</string> + </property> + <property name="whatsThis"> + <string>By enabling special key words of the source code are highlighted.</string> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>spacer2</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>40</height> + </size> + </property> + </spacer> + </vbox> + </widget> + </widget> + <hbox> + <spacer> + <property name="name"> + <cstring>spacer1</cstring> + </property> + <property name="orientation"> + <enum>TQt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="TQPushButton"> + <property name="name"> + <cstring>okButton</cstring> + </property> + <property name="text"> + <string>&Ok</string> + </property> + <property name="default"> + <bool>true</bool> + </property> + </widget> + <widget class="TQPushButton"> + <property name="name"> + <cstring>cancelButton</cstring> + </property> + <property name="text"> + <string>&Cancel</string> + </property> + </widget> + </hbox> + </vbox> + </widget> + <connections> + <connection> + <sender>okButton</sender> + <signal>clicked()</signal> + <receiver>UiGuiSettingsDialogBase</receiver> + <slot>accept()</slot> + </connection> + <connection> + <sender>cancelButton</sender> + <signal>clicked()</signal> + <receiver>UiGuiSettingsDialogBase</receiver> + <slot>reject()</slot> + </connection> + </connections> +</UI> diff --git a/src/__TODO/UiGuiSettingsDialog.cpp b/src/__TODO/UiGuiSettingsDialog.cpp deleted file mode 100644 index 46fc535..0000000 --- a/src/__TODO/UiGuiSettingsDialog.cpp +++ /dev/null @@ -1,205 +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. * -***************************************************************************/ - -#include "UiGuiSettingsDialog.h" -#include "ui_UiGuiSettingsDialog.h" - -#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, - TQSharedPointer<UiGuiSettings> settings) : - TQDialog(parent) -{ - // Remember pointer to the UiGuiSettings object. - _settings = settings; - - // Init the user interface created by the UIC. - _settingsDialogForm = new Ui::SettingsDialog(); - _settingsDialogForm->setupUi(this); - - //TODO: This call has to be removed when the properties for the highlighters can be set - // with the settings dialog. - _settingsDialogForm->groupBoxSyntaxHighlighterProperties->setToolTip( - "(Will be implemented soon)" + - _settingsDialogForm->groupBoxSyntaxHighlighterProperties->toolTip()); - - // Connect the accepted signal to own function, to write values back to the UiGuiSettings object. - connect(this, SIGNAL(accepted()), this, SLOT(writeWidgetValuesToSettings())); - - // Init the language selection combobox. - initTranslationSelection(); -} - -/* - \brief By calling this function the combobox for selecting the application language will - be initialized. - - Also the translation itself will be reinitialized. - */ -void UiGuiSettingsDialog::initTranslationSelection() -{ - // First empty the combo box. - _settingsDialogForm->languageSelectionComboBox->clear(); - - // Now add an entry into the box for every language short. - foreach(TQString languageShort, _settings->getAvailableTranslations()) - { - // Identify the language mnemonic and set the full name. - if (languageShort == "en") - { - _settingsDialogForm->languageSelectionComboBox->addItem(TQIcon(TQString(":/language/language-" - + languageShort + ".png")), tr("English")); - } - else if (languageShort == "fr") - { - _settingsDialogForm->languageSelectionComboBox->addItem(TQIcon(TQString(":/language/language-" - + languageShort + ".png")), tr("French")); - } - else if (languageShort == "de") - { - _settingsDialogForm->languageSelectionComboBox->addItem(TQIcon(TQString(":/language/language-" - + languageShort + ".png")), tr("German")); - } - else if (languageShort == "zh_TW") - { - _settingsDialogForm->languageSelectionComboBox->addItem(TQIcon(TQString(":/language/language-" - + languageShort + ".png")), tr("Chinese (Taiwan)")); - } - else if (languageShort == "ja") - { - _settingsDialogForm->languageSelectionComboBox->addItem(TQIcon(TQString(":/language/language-" - + languageShort + ".png")), tr("Japanese")); - } - else if (languageShort == "ru") - { - _settingsDialogForm->languageSelectionComboBox->addItem(TQIcon(TQString(":/language/language-" - + languageShort + ".png")), tr("Russian")); - } - else if (languageShort == "uk") - { - _settingsDialogForm->languageSelectionComboBox->addItem(TQIcon(TQString(":/language/language-" - + languageShort + ".png")), tr("Ukrainian")); - } - else - { - _settingsDialogForm->languageSelectionComboBox->addItem(tr( - "Unknown language mnemonic ") + languageShort); - } - } -} - -/* - \brief Displays the dialog by calling the dialogs exec function. - - Before it gets all the values needed from the UiGuiSettings object. - */ -int UiGuiSettingsDialog::showDialog() -{ - // Init all settings dialog objects with values from settings. - _settings->setObjectPropertyToSettingValueRecursive(this); - - // Execute the dialog. - 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. - */ -void UiGuiSettingsDialog::writeWidgetValuesToSettings() -{ - // Write settings dialog object values to settings. - _settings->setSettingToObjectPropertyValueRecursive(this); -} - -/* - \brief Catches language change events and retranslates all needed widgets. - */ -void UiGuiSettingsDialog::changeEvent(TQEvent *event) -{ - if (event->type() == TQEvent::LanguageChange) - { - _settingsDialogForm->retranslateUi(this); - // If this is not explicit set here, TQt < 4.3.0 does not translate the buttons. - _settingsDialogForm->buttonBox->setStandardButtons( - TQDialogButtonBox::Cancel | TQDialogButtonBox::NoButton | TQDialogButtonBox::Ok); - - //TODO: This has to be removed when the properties for the highlighters can be set. - _settingsDialogForm->groupBoxSyntaxHighlighterProperties->setToolTip( - "(Will be implemented soon)" + - _settingsDialogForm->groupBoxSyntaxHighlighterProperties->toolTip()); - - TQStringList languageShortList = _settings->getAvailableTranslations(); - - // Now retranslate every entry in the language selection box. - for (int i = 0; i < languageShortList.size(); i++) - { - TQString languageShort = languageShortList.at(i); - - // Identify the language mnemonic and set the full name. - if (languageShort == "en") - { - _settingsDialogForm->languageSelectionComboBox->setItemText(i, tr("English")); - } - else if (languageShort == "fr") - { - _settingsDialogForm->languageSelectionComboBox->setItemText(i, tr("French")); - } - else if (languageShort == "de") - { - _settingsDialogForm->languageSelectionComboBox->setItemText(i, tr("German")); - } - else if (languageShort == "zh_TW") - { - _settingsDialogForm->languageSelectionComboBox->setItemText(i, tr("Chinese (Taiwan)")); - } - else if (languageShort == "ja") - { - _settingsDialogForm->languageSelectionComboBox->setItemText(i, tr("Japanese")); - } - else if (languageShort == "ru") - { - _settingsDialogForm->languageSelectionComboBox->setItemText(i, tr("Russian")); - } - else if (languageShort == "uk") - { - _settingsDialogForm->languageSelectionComboBox->setItemText(i, tr("Ukrainian")); - } - else - { - _settingsDialogForm->languageSelectionComboBox->setItemText(i, - tr("Unknown language mnemonic ") + languageShort); - } - } - } - else - { - TQWidget::changeEvent(event); - } -} diff --git a/src/__TODO/UiGuiSettingsDialog.ui b/src/__TODO/UiGuiSettingsDialog.ui deleted file mode 100755 index e9f3af6..0000000 --- a/src/__TODO/UiGuiSettingsDialog.ui +++ /dev/null @@ -1,460 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<ui version="4.0"> - <class>SettingsDialog</class> - <widget class="TQDialog" name="SettingsDialog"> - <property name="windowModality"> - <enum>TQt::ApplicationModal</enum> - </property> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>503</width> - <height>336</height> - </rect> - </property> - <property name="windowTitle"> - <string>Settings</string> - </property> - <property name="windowIcon"> - <iconset resource="../resources/Icons.qrc"> - <normaloff>:/mainWindow/preferences-system.png</normaloff>:/mainWindow/preferences-system.png</iconset> - </property> - <layout class="TQVBoxLayout"> - <item> - <widget class="TQTabWidget" name="tabWidget"> - <property name="currentIndex"> - <number>0</number> - </property> - <widget class="TQWidget" name="tab"> - <attribute name="icon"> - <iconset resource="../resources/Icons.qrc"> - <normaloff>:/settingsDialog/applications-system.png</normaloff>:/settingsDialog/applications-system.png</iconset> - </attribute> - <attribute name="title"> - <string>Common</string> - </attribute> - <layout class="TQVBoxLayout"> - <item> - <layout class="TQHBoxLayout"> - <item> - <widget class="TQLabel" name="label"> - <property name="toolTip"> - <string>Displays all available translations for UniversalIndentGui and lets you choose one.</string> - </property> - <property name="text"> - <string>Application language</string> - </property> - <property name="buddy"> - <cstring>languageSelectionComboBox</cstring> - </property> - </widget> - </item> - <item> - <widget class="TQComboBox" name="languageSelectionComboBox"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="toolTip"> - <string>Displays all available translations for UniversalIndentGui and lets you choose one.</string> - </property> - <property name="connectedSettingName" stdset="0"> - <string notr="true">language</string> - </property> - <property name="connectedPropertyName" stdset="0"> - <string notr="true">currentIndex</string> - </property> - </widget> - </item> - <item> - <spacer> - <property name="orientation"> - <enum>TQt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - </layout> - </item> - <item> - <widget class="TQCheckBox" name="loadLastOpenedFileOnStartupComboBox"> - <property name="toolTip"> - <string>If selected opens the source code file on startup that was opened last time.</string> - </property> - <property name="text"> - <string>Automatically open last file on startup</string> - </property> - <property name="connectedSettingName" stdset="0"> - <string notr="true">loadLastSourceCodeFileOnStartup</string> - </property> - <property name="connectedPropertyName" stdset="0"> - <string notr="true">checked</string> - </property> - </widget> - </item> - <item> - <widget class="TQCheckBox" name="enableIndenterParameterTooltipsCheckBox"> - <property name="toolTip"> - <string>If checked, tool tips will show up if the mouse cursor remains over an indenter parameter for a while.</string> - </property> - <property name="text"> - <string>Enable Parameter Tooltips</string> - </property> - <property name="connectedSettingName" stdset="0"> - <string notr="true">indenterParameterTooltipsEnabled</string> - </property> - <property name="connectedPropertyName" stdset="0"> - <string notr="true">checked</string> - </property> - </widget> - </item> - <item> - <layout class="TQHBoxLayout"> - <item> - <widget class="TQLabel" name="labelRecentlyOpenedListSize"> - <property name="toolTip"> - <string>Sets how many files should be remembered in the list of recently opened files.</string> - </property> - <property name="text"> - <string>Number of files in recently opened list</string> - </property> - </widget> - </item> - <item> - <widget class="TQSpinBox" name="recentlyOpenedListSizeSpinBox"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="toolTip"> - <string>Sets how many files should be remembered in the list of recently opened files.</string> - </property> - <property name="minimum"> - <number>1</number> - </property> - <property name="maximum"> - <number>30</number> - </property> - <property name="value"> - <number>1</number> - </property> - <property name="connectedSettingName" stdset="0"> - <string notr="true">recentlyOpenedListSize</string> - </property> - <property name="connectedPropertyName" stdset="0"> - <string notr="true">value</string> - </property> - </widget> - </item> - <item> - <spacer> - <property name="orientation"> - <enum>TQt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - </layout> - </item> - <item> - <spacer> - <property name="orientation"> - <enum>TQt::Vertical</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>20</width> - <height>40</height> - </size> - </property> - </spacer> - </item> - </layout> - </widget> - <widget class="TQWidget" name="tab_2"> - <attribute name="icon"> - <iconset resource="../resources/Icons.qrc"> - <normaloff>:/settingsDialog/accessories-text-editor.png</normaloff>:/settingsDialog/accessories-text-editor.png</iconset> - </attribute> - <attribute name="title"> - <string>Editor</string> - </attribute> - <layout class="TQVBoxLayout"> - <item> - <widget class="TQCheckBox" name="whiteSpaceIsVisibleCheckBox"> - <property name="toolTip"> - <string>Enables or disables displaying of white space characters in the editor.</string> - </property> - <property name="text"> - <string>Display white space character (tabs, spaces, etc.)</string> - </property> - <property name="connectedSettingName" stdset="0"> - <string notr="true">whiteSpaceIsVisible</string> - </property> - <property name="connectedPropertyName" stdset="0"> - <string notr="true">checked</string> - </property> - </widget> - </item> - <item> - <layout class="TQHBoxLayout"> - <item> - <widget class="TQLabel" name="labelTabWidth"> - <property name="toolTip"> - <string>Sets width in single spaces used for tabs</string> - </property> - <property name="statusTip"> - <string>Defines how many spaces should be displayed in the editor for one tab.</string> - </property> - <property name="text"> - <string>Displayed width of tabs</string> - </property> - </widget> - </item> - <item> - <widget class="TQSpinBox" name="tabWidthSpinBox"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="toolTip"> - <string>Defines how many spaces should be displayed in the editor for one tab character.</string> - </property> - <property name="minimum"> - <number>1</number> - </property> - <property name="maximum"> - <number>99</number> - </property> - <property name="value"> - <number>1</number> - </property> - <property name="connectedSettingName" stdset="0"> - <string notr="true">tabWidth</string> - </property> - <property name="connectedPropertyName" stdset="0"> - <string notr="true">value</string> - </property> - </widget> - </item> - <item> - <spacer> - <property name="orientation"> - <enum>TQt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - </layout> - </item> - <item> - <spacer> - <property name="orientation"> - <enum>TQt::Vertical</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>20</width> - <height>40</height> - </size> - </property> - </spacer> - </item> - </layout> - </widget> - <widget class="TQWidget" name="tab_3"> - <attribute name="icon"> - <iconset resource="../resources/Icons.qrc"> - <normaloff>:/settingsDialog/syntax-highlight.png</normaloff>:/settingsDialog/syntax-highlight.png</iconset> - </attribute> - <attribute name="title"> - <string>Syntax Highlighting</string> - </attribute> - <layout class="TQVBoxLayout"> - <item> - <widget class="TQCheckBox" name="cbEnableSyntaxHL"> - <property name="toolTip"> - <string>By enabling special key words of the source code are highlighted.</string> - </property> - <property name="text"> - <string>Enable syntax highlighting</string> - </property> - <property name="connectedSettingName" stdset="0"> - <string notr="true">SyntaxHighlightingEnabled</string> - </property> - <property name="connectedPropertyName" stdset="0"> - <string notr="true">checked</string> - </property> - </widget> - </item> - <item> - <widget class="TQGroupBox" name="groupBoxSyntaxHighlighterProperties"> - <property name="enabled"> - <bool>false</bool> - </property> - <property name="toolTip"> - <string>Lets you make settings for all properties of the available syntax highlighters, like font and color.</string> - </property> - <property name="title"> - <string>Highlighter settings</string> - </property> - <layout class="TQHBoxLayout"> - <item> - <widget class="TQListWidget" name="listWidget"> - <property name="currentRow"> - <number>-1</number> - </property> - </widget> - </item> - <item> - <widget class="TQListWidget" name="listWidget_2"> - <property name="currentRow"> - <number>-1</number> - </property> - </widget> - </item> - <item> - <layout class="TQVBoxLayout"> - <item> - <widget class="TQPushButton" name="pushButton_2"> - <property name="toolTip"> - <string>Set the font for the current selected highlighter property.</string> - </property> - <property name="text"> - <string>Set Font</string> - </property> - </widget> - </item> - <item> - <widget class="TQPushButton" name="pushButton"> - <property name="toolTip"> - <string>Set the color for the current selected highlighter property.</string> - </property> - <property name="text"> - <string>Set Color</string> - </property> - </widget> - </item> - <item> - <spacer> - <property name="orientation"> - <enum>TQt::Vertical</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>20</width> - <height>40</height> - </size> - </property> - </spacer> - </item> - </layout> - </item> - </layout> - </widget> - </item> - <item> - <spacer> - <property name="orientation"> - <enum>TQt::Vertical</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>20</width> - <height>40</height> - </size> - </property> - </spacer> - </item> - </layout> - </widget> - </widget> - </item> - <item> - <widget class="TQDialogButtonBox" name="buttonBox"> - <property name="orientation"> - <enum>TQt::Horizontal</enum> - </property> - <property name="standardButtons"> - <set>TQDialogButtonBox::Cancel|TQDialogButtonBox::Ok</set> - </property> - </widget> - </item> - </layout> - </widget> - <resources> - <include location="../resources/Icons.qrc"/> - </resources> - <connections> - <connection> - <sender>buttonBox</sender> - <signal>accepted()</signal> - <receiver>SettingsDialog</receiver> - <slot>accept()</slot> - <hints> - <hint type="sourcelabel"> - <x>250</x> - <y>316</y> - </hint> - <hint type="destinationlabel"> - <x>153</x> - <y>236</y> - </hint> - </hints> - </connection> - <connection> - <sender>buttonBox</sender> - <signal>rejected()</signal> - <receiver>SettingsDialog</receiver> - <slot>reject()</slot> - <hints> - <hint type="sourcelabel"> - <x>327</x> - <y>316</y> - </hint> - <hint type="destinationlabel"> - <x>282</x> - <y>236</y> - </hint> - </hints> - </connection> - <connection> - <sender>enableProxyCheckBox</sender> - <signal>toggled(bool)</signal> - <receiver>widget</receiver> - <slot>setEnabled(bool)</slot> - <hints> - <hint type="sourcelabel"> - <x>73</x> - <y>68</y> - </hint> - <hint type="destinationlabel"> - <x>76</x> - <y>95</y> - </hint> - </hints> - </connection> - </connections> -</ui> |