Mercurial > hg > forks > UniversalIndentGUI
changeset 530:fdc684fcc21a
Overhauled and corrected the last setting problems and therefore widget names.
git-svn-id: svn://svn.code.sf.net/p/universalindent/code/trunk@770 59b1889a-e5ac-428c-b0c7-476e01d41282
author | thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282> |
---|---|
date | Wed, 24 Sep 2008 05:59:09 +0000 |
parents | 43d171d0a92b |
children | c7285628202f |
files | src/UiGuiSettingsDialog.ui src/mainwindow.cpp src/mainwindow.ui src/uiguisettingsdialog.cpp |
diffstat | 4 files changed, 109 insertions(+), 65 deletions(-) [+] |
line wrap: on
line diff
--- a/src/UiGuiSettingsDialog.ui Wed Sep 24 05:44:17 2008 +0000 +++ b/src/UiGuiSettingsDialog.ui Wed Sep 24 05:59:09 2008 +0000 @@ -63,12 +63,12 @@ <string>Application language</string> </property> <property name="buddy" > - <cstring>uiGuiLanguage</cstring> + <cstring>uiGuiLanguageSelectionComboBox</cstring> </property> </widget> </item> <item> - <widget class="QComboBox" name="uiGuiLanguage" > + <widget class="QComboBox" name="uiGuiLanguageSelectionComboBox" > <property name="sizePolicy" > <sizepolicy vsizetype="Fixed" hsizetype="Fixed" > <horstretch>0</horstretch> @@ -78,6 +78,9 @@ <property name="toolTip" > <string>Displays all available translations for UniversalIndentGui and lets you choose one.</string> </property> + <property name="connectedSettingName" stdset="0" > + <string>Language</string> + </property> </widget> </item> <item> @@ -96,23 +99,29 @@ </layout> </item> <item> - <widget class="QCheckBox" name="uiGuiLoadLastOpenedFileOnStartup" > + <widget class="QCheckBox" name="uiGuiLoadLastOpenedFileOnStartupComboBox" > <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>LoadLastOpenedFileOnStartup</string> + </property> </widget> </item> <item> - <widget class="QCheckBox" name="uiGuiIndenterParameterTooltipsEnabled" > + <widget class="QCheckBox" name="uiGuiEnableIndenterParameterTooltipsCheckBox" > <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>IndenterParameterTooltipsEnabled</string> + </property> </widget> </item> <item> @@ -134,7 +143,7 @@ </widget> </item> <item> - <widget class="QSpinBox" name="uiGuiRecentlyOpenedListSize" > + <widget class="QSpinBox" name="uiGuiRecentlyOpenedListSizeSpinBox" > <property name="sizePolicy" > <sizepolicy vsizetype="Fixed" hsizetype="Fixed" > <horstretch>0</horstretch> @@ -153,6 +162,9 @@ <property name="value" > <number>1</number> </property> + <property name="connectedSettingName" stdset="0" > + <string>RecentlyOpenedListSize</string> + </property> </widget> </item> <item> @@ -171,13 +183,16 @@ </layout> </item> <item> - <widget class="QCheckBox" name="uiGuiCheckForUpdate" > + <widget class="QCheckBox" name="uiGuiCheckForUpdateCheckBox" > <property name="toolTip" > <string>Checks whether a new version of UniversalIndentGUI exists on program start, but only once a day.</string> </property> <property name="text" > <string>Check online for update on program start</string> </property> + <property name="connectedSettingName" stdset="0" > + <string>CheckForUpdate</string> + </property> </widget> </item> <item> @@ -211,13 +226,16 @@ <number>9</number> </property> <item> - <widget class="QCheckBox" name="uiGuiWhiteSpaceIsVisible" > + <widget class="QCheckBox" name="uiGuiWhiteSpaceIsVisibleCheckBox" > <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>WhiteSpaceIsVisible</string> + </property> </widget> </item> <item> @@ -242,7 +260,7 @@ </widget> </item> <item> - <widget class="QSpinBox" name="uiGuiTabWidth" > + <widget class="QSpinBox" name="uiGuiTabWidthSpinBox" > <property name="sizePolicy" > <sizepolicy vsizetype="Fixed" hsizetype="Fixed" > <horstretch>0</horstretch> @@ -261,6 +279,9 @@ <property name="value" > <number>1</number> </property> + <property name="connectedSettingName" stdset="0" > + <string>TabWidth</string> + </property> </widget> </item> <item> @@ -309,7 +330,7 @@ <number>9</number> </property> <item> - <widget class="QCheckBox" name="enableSyntaxHighlightningCheckBox" > + <widget class="QCheckBox" name="uiGuiEnableSyntaxHighlightningCheckBox" > <property name="toolTip" > <string>By enabling special key words of the source code are highlighted.</string> </property>
--- a/src/mainwindow.cpp Wed Sep 24 05:44:17 2008 +0000 +++ b/src/mainwindow.cpp Wed Sep 24 05:59:09 2008 +0000 @@ -148,14 +148,14 @@ connect( settings, SIGNAL(syntaxHighlightningEnabled(bool)), this, SLOT(turnHighlightOnOff(bool)) ); // Register the load last file setting in the menu to the settings object. - connect( uiGuiLoadLastOpenedFileOnStartup, SIGNAL(toggled(bool)), settings, SLOT(handleValueChangeFromExtern(bool)) ); - connect( settings, SIGNAL(loadLastOpenedFileOnStartup(bool)), uiGuiLoadLastOpenedFileOnStartup, SLOT(setChecked(bool)) ); - uiGuiLoadLastOpenedFileOnStartup->setChecked( settings->getValueByName("LoadLastOpenedFileOnStartup").toBool() ); + connect( loadLastOpenedFileOnStartupAction, SIGNAL(toggled(bool)), settings, SLOT(handleValueChangeFromExtern(bool)) ); + connect( settings, SIGNAL(loadLastOpenedFileOnStartup(bool)), loadLastOpenedFileOnStartupAction, SLOT(setChecked(bool)) ); + loadLastOpenedFileOnStartupAction->setChecked( settings->getValueByName("LoadLastOpenedFileOnStartup").toBool() ); // Register the white space setting in the menu to the settings object. - connect( uiGuiWhiteSpaceIsVisible, SIGNAL(toggled(bool)), settings, SLOT(handleValueChangeFromExtern(bool)) ); - connect( settings, SIGNAL(whiteSpaceIsVisible(bool)), uiGuiWhiteSpaceIsVisible, SLOT(setChecked(bool)) ); - uiGuiWhiteSpaceIsVisible->setChecked( settings->getValueByName("WhiteSpaceIsVisible").toBool() ); + connect( whiteSpaceIsVisibleAction, SIGNAL(toggled(bool)), settings, SLOT(handleValueChangeFromExtern(bool)) ); + connect( settings, SIGNAL(whiteSpaceIsVisible(bool)), whiteSpaceIsVisibleAction, SLOT(setChecked(bool)) ); + whiteSpaceIsVisibleAction->setChecked( settings->getValueByName("WhiteSpaceIsVisible").toBool() ); // Tell the QScintilla editor if it has to show white space. connect( settings, SIGNAL(whiteSpaceIsVisible(bool)), this, SLOT(setWhiteSpaceVisibility(bool)) ); @@ -330,9 +330,9 @@ previewToggled = true; // Handle if indenter parameter tool tips are enabled - connect( uiGuiIndenterParameterTooltipsEnabled, SIGNAL(toggled(bool)), settings, SLOT(handleValueChangeFromExtern(bool)) ); - connect( settings, SIGNAL(indenterParameterTooltipsEnabled(bool)), uiGuiIndenterParameterTooltipsEnabled, SLOT(setChecked(bool)) ); - uiGuiIndenterParameterTooltipsEnabled->setChecked( settings->getValueByName("IndenterParameterTooltipsEnabled").toBool() ); + connect( indenterParameterTooltipsEnabledAction, SIGNAL(toggled(bool)), settings, SLOT(handleValueChangeFromExtern(bool)) ); + connect( settings, SIGNAL(indenterParameterTooltipsEnabled(bool)), indenterParameterTooltipsEnabledAction, SLOT(setChecked(bool)) ); + indenterParameterTooltipsEnabledAction->setChecked( settings->getValueByName("IndenterParameterTooltipsEnabled").toBool() ); // Add the indenters context menu to the mainwindows menu. menuIndenter->addActions( indentHandler->getIndenterMenuActions() ); @@ -913,7 +913,7 @@ //} //settings->setValueByName( "LoadLastOpenedFileOnStartup", uiGuiLoadLastOpenedFileOnStartup->isChecked() ); //settings->setValueByName( "SelectedIndenter", indentHandler->getIndenterId() ); - //settings->setValueByName( "IndenterParameterTooltipsEnabled", uiGuiIndenterParameterTooltipsEnabled->isChecked() ); + //settings->setValueByName( "IndenterParameterTooltipsEnabled", indenterParameterTooltipsEnabledAction->isChecked() ); //settings->setValueByName( "Language", language ); settings->setValueByName( "FileEncoding", currentEncoding ); settings->setValueByName( "VersionInSettingsFile", version ); @@ -924,7 +924,7 @@ } settings->setValueByName( "MainWindowState", saveState() ); //settings->setValueByName( "SyntaxHighlightningEnabled", uiGuiSyntaxHighlightningEnabled->isChecked() ); - //settings->setValueByName( "WhiteSpaceIsVisible", uiGuiWhiteSpaceIsVisible->isChecked() ); + //settings->setValueByName( "WhiteSpaceIsVisible", whiteSpaceIsVisibleAction->isChecked() ); //settings->setValueByName( "TabWidth", txtedSourceCode->tabWidth() ); //FIXME: Needs to be called explicit here, because the destructor of UiGuiSettings doesn't do it. @@ -958,7 +958,7 @@ bool MainWindow::eventFilter(QObject *obj, QEvent *event) { if ( event->type() == QEvent::ToolTip) { - if ( uiGuiIndenterParameterTooltipsEnabled->isChecked() ) { + if ( indenterParameterTooltipsEnabledAction->isChecked() ) { return QMainWindow::eventFilter(obj, event); } else { @@ -1127,7 +1127,7 @@ highlighterAction->setCheckable(true); } highlighterMenu->addActions( highlighterActionGroup->actions() ); - menuSettings->insertMenu(uiGuiIndenterParameterTooltipsEnabled, highlighterMenu ); + menuSettings->insertMenu(indenterParameterTooltipsEnabledAction, highlighterMenu ); connect( highlighterActionGroup, SIGNAL(triggered(QAction*)), this, SLOT(highlighterChanged(QAction*)) ); }
--- a/src/mainwindow.ui Wed Sep 24 05:44:17 2008 +0000 +++ b/src/mainwindow.ui Wed Sep 24 05:59:09 2008 +0000 @@ -102,10 +102,10 @@ </widget> <addaction name="actionLive_Indent_Preview" /> <addaction name="enableSyntaxHighlightningAction" /> - <addaction name="uiGuiWhiteSpaceIsVisible" /> + <addaction name="whiteSpaceIsVisibleAction" /> <addaction name="highlighterMenu" /> - <addaction name="uiGuiIndenterParameterTooltipsEnabled" /> - <addaction name="uiGuiLoadLastOpenedFileOnStartup" /> + <addaction name="indenterParameterTooltipsEnabledAction" /> + <addaction name="loadLastOpenedFileOnStartupAction" /> <addaction name="actionShowSettings" /> </widget> <widget class="QMenu" name="menuHelp" > @@ -280,7 +280,7 @@ <string>Export the currently visible source code as HTML document</string> </property> </action> - <action name="uiGuiIndenterParameterTooltipsEnabled" > + <action name="indenterParameterTooltipsEnabledAction" > <property name="checkable" > <bool>true</bool> </property> @@ -297,6 +297,9 @@ <property name="statusTip" > <string>If checked, tool tips will show up if the mouse cursor remains over an indenter parameter for a while.</string> </property> + <property name="connectedSettingName" stdset="0" > + <string>IndenterParameterTooltipsEnabled</string> + </property> </action> <action name="actionLive_Indent_Preview" > <property name="checkable" > @@ -343,7 +346,7 @@ <string>SyntaxHighlightningEnabled</string> </property> </action> - <action name="uiGuiWhiteSpaceIsVisible" > + <action name="whiteSpaceIsVisibleAction" > <property name="checkable" > <bool>true</bool> </property> @@ -362,8 +365,11 @@ <property name="visible" > <bool>false</bool> </property> + <property name="connectedSettingName" stdset="0" > + <string>WhiteSpaceIsVisible</string> + </property> </action> - <action name="uiGuiLoadLastOpenedFileOnStartup" > + <action name="loadLastOpenedFileOnStartupAction" > <property name="checkable" > <bool>true</bool> </property> @@ -382,6 +388,9 @@ <property name="visible" > <bool>false</bool> </property> + <property name="connectedSettingName" stdset="0" > + <string>LoadLastOpenedFileOnStartup</string> + </property> </action> <action name="actionShowSettings" > <property name="icon" >
--- a/src/uiguisettingsdialog.cpp Wed Sep 24 05:44:17 2008 +0000 +++ b/src/uiguisettingsdialog.cpp Wed Sep 24 05:59:09 2008 +0000 @@ -63,31 +63,31 @@ */ void UiGuiSettingsDialog::initTranslationSelection() { // First empty the combo box. - uiGuiLanguage->clear(); + uiGuiLanguageSelectionComboBox->clear(); // Now add an entry into the box for every language short. foreach (QString languageShort, settings->getAvailableTranslations() ) { // Identify the language mnemonic and set the full name. if ( languageShort == "en" ) { - uiGuiLanguage->addItem( QIcon(QString(":/language/language-"+languageShort+".png")), tr("English") ); + uiGuiLanguageSelectionComboBox->addItem( QIcon(QString(":/language/language-"+languageShort+".png")), tr("English") ); } else if ( languageShort == "de" ) { - uiGuiLanguage->addItem( QIcon(QString(":/language/language-"+languageShort+".png")), tr("German") ); + uiGuiLanguageSelectionComboBox->addItem( QIcon(QString(":/language/language-"+languageShort+".png")), tr("German") ); } else if ( languageShort == "zh_TW" ) { - uiGuiLanguage->addItem( QIcon(QString(":/language/language-"+languageShort+".png")), tr("Chinese (Taiwan)") ); + uiGuiLanguageSelectionComboBox->addItem( QIcon(QString(":/language/language-"+languageShort+".png")), tr("Chinese (Taiwan)") ); } else if ( languageShort == "ja_JP" ) { - uiGuiLanguage->addItem( QIcon(QString(":/language/language-"+languageShort+".png")), tr("Japanese") ); + uiGuiLanguageSelectionComboBox->addItem( QIcon(QString(":/language/language-"+languageShort+".png")), tr("Japanese") ); } else if ( languageShort == "ru" ) { - uiGuiLanguage->addItem( QIcon(QString(":/language/language-"+languageShort+".png")), tr("Russian") ); + uiGuiLanguageSelectionComboBox->addItem( QIcon(QString(":/language/language-"+languageShort+".png")), tr("Russian") ); } else if ( languageShort == "uk" ) { - uiGuiLanguage->addItem( QIcon(QString(":/language/language-"+languageShort+".png")), tr("Ukrainian") ); + uiGuiLanguageSelectionComboBox->addItem( QIcon(QString(":/language/language-"+languageShort+".png")), tr("Ukrainian") ); } else { - uiGuiLanguage->addItem( tr("Unknown language mnemonic ") + languageShort ); + uiGuiLanguageSelectionComboBox->addItem( tr("Unknown language mnemonic ") + languageShort ); } } } @@ -101,12 +101,12 @@ int UiGuiSettingsDialog::showDialog() { // Get the values for the check boxes from the settings object. foreach (QCheckBox* checkBox, checkBoxes) { - // Get the corresponding setting name from the sender objects property. - QString settingName = sender()->property("connectedSettingName").toString(); + // Get the corresponding setting name from the check boxs property. + QString settingName = checkBox->property("connectedSettingName").toString(); // If the property is not set, try using the objects name for convenience. if ( settingName.isEmpty() ) { // Get the objects name and remove "uiGui" from its beginning and use that as setting name. - settingName = sender()->objectName(); + settingName = checkBox->objectName(); settingName.remove(0,5); } @@ -117,12 +117,12 @@ // Get the values for the spin boxes from the settings object. foreach (QSpinBox* spinBox, spinBoxes) { - // Get the corresponding setting name from the sender objects property. - QString settingName = sender()->property("connectedSettingName").toString(); + // Get the corresponding setting name from the spin boxs property. + QString settingName = spinBox->property("connectedSettingName").toString(); // If the property is not set, try using the objects name for convenience. if ( settingName.isEmpty() ) { // Get the objects name and remove "uiGui" from its beginning and use that as setting name. - settingName = sender()->objectName(); + settingName = spinBox->objectName(); settingName.remove(0,5); } @@ -133,12 +133,12 @@ // Get the values for the combo boxes from the settings object. foreach (QComboBox* comboBox, comboBoxes) { - // Get the corresponding setting name from the sender objects property. - QString settingName = sender()->property("connectedSettingName").toString(); + // Get the corresponding setting name from the combo boxs property. + QString settingName = comboBox->property("connectedSettingName").toString(); // If the property is not set, try using the objects name for convenience. if ( settingName.isEmpty() ) { // Get the objects name and remove "uiGui" from its beginning and use that as setting name. - settingName = sender()->objectName(); + settingName = comboBox->objectName(); settingName.remove(0,5); } @@ -160,32 +160,47 @@ void UiGuiSettingsDialog::writeWidgetValuesToSettings() { // Write the values of the check boxes to the settings object. foreach (QCheckBox* checkBox, checkBoxes) { - // Get the objects name and remove "uiGui" from its beginning. - QString objectName = checkBox->objectName(); - objectName.remove(0,5); + // Get the corresponding setting name from the check boxs property. + QString settingName = checkBox->property("connectedSettingName").toString(); + // If the property is not set, try using the objects name for convenience. + if ( settingName.isEmpty() ) { + // Get the objects name and remove "uiGui" from its beginning and use that as setting name. + settingName = checkBox->objectName(); + settingName.remove(0,5); + } // Write the check box value to the settings. - settings->setValueByName( objectName, checkBox->isChecked() ); + settings->setValueByName( settingName, checkBox->isChecked() ); } // Write the values for the spin boxes to the settings object. foreach (QSpinBox* spinBox, spinBoxes) { - // Get the objects name and remove "uiGui" from its beginning. - QString objectName = spinBox->objectName(); - objectName.remove(0,5); + // Get the corresponding setting name from the spin boxs property. + QString settingName = spinBox->property("connectedSettingName").toString(); + // If the property is not set, try using the objects name for convenience. + if ( settingName.isEmpty() ) { + // Get the objects name and remove "uiGui" from its beginning and use that as setting name. + settingName = spinBox->objectName(); + settingName.remove(0,5); + } // Write the spin box value to the settings. - settings->setValueByName( objectName, spinBox->value() ); + settings->setValueByName( settingName, spinBox->value() ); } // Write the values for the spin boxes to the settings object. foreach (QComboBox* comboBox, comboBoxes) { - // Get the objects name and remove "uiGui" from its beginning. - QString objectName = comboBox->objectName(); - objectName.remove(0,5); + // Get the corresponding setting name from the combo boxs property. + QString settingName = comboBox->property("connectedSettingName").toString(); + // If the property is not set, try using the objects name for convenience. + if ( settingName.isEmpty() ) { + // Get the objects name and remove "uiGui" from its beginning and use that as setting name. + settingName = comboBox->objectName(); + settingName.remove(0,5); + } // Write the spin box value to the settings. - settings->setValueByName( objectName, comboBox->currentIndex() ); + settings->setValueByName( settingName, comboBox->currentIndex() ); } } @@ -201,7 +216,6 @@ //TODO: This has to be removed when the properties for the highlighters can be set. groupBoxSyntaxHighlighterProperties->setToolTip( "(Will be implemented soon)" + groupBoxSyntaxHighlighterProperties->toolTip() ); - uiGuiRecentlyOpenedListSize->setToolTip( "(Will be implemented soon)" + uiGuiRecentlyOpenedListSize->toolTip() ); QStringList languageShortList = settings->getAvailableTranslations(); @@ -211,25 +225,25 @@ // Identify the language mnemonic and set the full name. if ( languageShort == "en" ) { - uiGuiLanguage->setItemText( i, tr("English") ); + uiGuiLanguageSelectionComboBox->setItemText( i, tr("English") ); } else if ( languageShort == "de" ) { - uiGuiLanguage->setItemText( i, tr("German") ); + uiGuiLanguageSelectionComboBox->setItemText( i, tr("German") ); } else if ( languageShort == "zh_TW" ) { - uiGuiLanguage->setItemText( i, tr("Chinese (Taiwan)") ); + uiGuiLanguageSelectionComboBox->setItemText( i, tr("Chinese (Taiwan)") ); } else if ( languageShort == "ja_JP" ) { - uiGuiLanguage->setItemText( i, tr("Japanese") ); + uiGuiLanguageSelectionComboBox->setItemText( i, tr("Japanese") ); } else if ( languageShort == "ru" ) { - uiGuiLanguage->setItemText( i, tr("Russian") ); + uiGuiLanguageSelectionComboBox->setItemText( i, tr("Russian") ); } else if ( languageShort == "uk" ) { - uiGuiLanguage->setItemText( i, tr("Ukrainian") ); + uiGuiLanguageSelectionComboBox->setItemText( i, tr("Ukrainian") ); } else { - uiGuiLanguage->setItemText( i, tr("Unknown language mnemonic ") + languageShort ); + uiGuiLanguageSelectionComboBox->setItemText( i, tr("Unknown language mnemonic ") + languageShort ); } } }