annotate src/UiGuiSettingsDialog.cpp @ 751:ac165b6ae67e

Done some refactoring: - Moved includes into the cpp files where possible and using class pre-declarations if possible - Made class member variable names begin with an underscore - Made by uic created header files be used as class members instead of inherting them - Renamed some variables to reflect their purpose better - Added some NULL initializations and added some comments - Rearranged some include and declaration code parts to be consistent and better readable - Updated for QScintilla 2.4.5 - Made UiGuiSettings be accessed via a shared pointer only git-svn-id: svn://svn.code.sf.net/p/universalindent/code/trunk@1028 59b1889a-e5ac-428c-b0c7-476e01d41282
author thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
date Thu, 14 Oct 2010 19:52:47 +0000
parents ca1bafc93ee2
children c6d54610983b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
638
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
1 /***************************************************************************
727
aae5a8d04f70 Updated comment copyright year.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents: 648
diff changeset
2 * Copyright (C) 2006-2010 by Thomas Schweitzer *
638
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
3 * thomas-schweitzer(at)arcor.de *
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
4 * *
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
5 * This program is free software; you can redistribute it and/or modify *
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
6 * it under the terms of the GNU General Public License version 2.0 as *
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
7 * published by the Free Software Foundation. *
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
8 * *
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
9 * This program is distributed in the hope that it will be useful, *
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
12 * GNU General Public License for more details. *
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
13 * *
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
14 * You should have received a copy of the GNU General Public License *
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
15 * along with this program in the file LICENSE.GPL; if not, write to the *
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
16 * Free Software Foundation, Inc., *
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
17 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
18 ***************************************************************************/
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
19
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
20 #include "UiGuiSettingsDialog.h"
751
ac165b6ae67e Done some refactoring:
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents: 731
diff changeset
21 #include "ui_UiGuiSettingsDialog.h"
ac165b6ae67e Done some refactoring:
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents: 731
diff changeset
22
ac165b6ae67e Done some refactoring:
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents: 731
diff changeset
23 #include "UiGuiSettings.h"
638
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
24
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
25 /*!
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
26 \class UiGuiSettingsDialog
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
27 \ingroup grp_Settings
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
28 \brief Displays a dialog window with settings for UniversalIndentGUI
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
29 */
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
30
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
31 /*!
751
ac165b6ae67e Done some refactoring:
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents: 731
diff changeset
32 \brief The constructor calls the setup function for the ui created by uic.
638
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
33 */
751
ac165b6ae67e Done some refactoring:
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents: 731
diff changeset
34 UiGuiSettingsDialog::UiGuiSettingsDialog(QWidget* parent, QSharedPointer<UiGuiSettings> settings) : QDialog(parent) {
638
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
35 // Remember pointer to the UiGuiSettings object.
751
ac165b6ae67e Done some refactoring:
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents: 731
diff changeset
36 _settings = settings;
638
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
37
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
38 // Init the user interface created by the UIC.
751
ac165b6ae67e Done some refactoring:
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents: 731
diff changeset
39 _settingsDialogForm = new Ui::SettingsDialog();
ac165b6ae67e Done some refactoring:
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents: 731
diff changeset
40 _settingsDialogForm->setupUi(this);
638
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
41
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
42 //TODO: This call has to be removed when the properties for the highlighters can be set
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
43 // with the settings dialog.
751
ac165b6ae67e Done some refactoring:
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents: 731
diff changeset
44 _settingsDialogForm->groupBoxSyntaxHighlighterProperties->setToolTip( "(Will be implemented soon)" + _settingsDialogForm->groupBoxSyntaxHighlighterProperties->toolTip() );
638
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
45
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
46 // Connect the accepted signal to own function, to write values back to the UiGuiSettings object.
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
47 connect(this, SIGNAL(accepted()), this, SLOT(writeWidgetValuesToSettings()) );
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
48
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
49 // Init the language selection combobox.
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
50 initTranslationSelection();
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
51 }
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
52
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
53
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
54 /*!
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
55 \brief By calling this function the combobox for selecting the application language will
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
56 be initialized.
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
57
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
58 Also the translation itself will be reinitialized.
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
59 */
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
60 void UiGuiSettingsDialog::initTranslationSelection() {
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
61 // First empty the combo box.
751
ac165b6ae67e Done some refactoring:
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents: 731
diff changeset
62 _settingsDialogForm->languageSelectionComboBox->clear();
638
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
63
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
64 // Now add an entry into the box for every language short.
751
ac165b6ae67e Done some refactoring:
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents: 731
diff changeset
65 foreach (QString languageShort, _settings->getAvailableTranslations() ) {
638
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
66 // Identify the language mnemonic and set the full name.
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
67 if ( languageShort == "en" ) {
751
ac165b6ae67e Done some refactoring:
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents: 731
diff changeset
68 _settingsDialogForm->languageSelectionComboBox->addItem( QIcon(QString(":/language/language-"+languageShort+".png")), tr("English") );
638
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
69 }
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
70 else if ( languageShort == "fr" ) {
751
ac165b6ae67e Done some refactoring:
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents: 731
diff changeset
71 _settingsDialogForm->languageSelectionComboBox->addItem( QIcon(QString(":/language/language-"+languageShort+".png")), tr("French") );
638
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
72 }
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
73 else if ( languageShort == "de" ) {
751
ac165b6ae67e Done some refactoring:
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents: 731
diff changeset
74 _settingsDialogForm->languageSelectionComboBox->addItem( QIcon(QString(":/language/language-"+languageShort+".png")), tr("German") );
638
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
75 }
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
76 else if ( languageShort == "zh_TW" ) {
751
ac165b6ae67e Done some refactoring:
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents: 731
diff changeset
77 _settingsDialogForm->languageSelectionComboBox->addItem( QIcon(QString(":/language/language-"+languageShort+".png")), tr("Chinese (Taiwan)") );
638
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
78 }
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
79 else if ( languageShort == "ja_jp" ) {
751
ac165b6ae67e Done some refactoring:
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents: 731
diff changeset
80 _settingsDialogForm->languageSelectionComboBox->addItem( QIcon(QString(":/language/language-"+languageShort+".png")), tr("Japanese") );
638
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
81 }
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
82 else if ( languageShort == "ru" ) {
751
ac165b6ae67e Done some refactoring:
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents: 731
diff changeset
83 _settingsDialogForm->languageSelectionComboBox->addItem( QIcon(QString(":/language/language-"+languageShort+".png")), tr("Russian") );
638
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
84 }
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
85 else if ( languageShort == "uk" ) {
751
ac165b6ae67e Done some refactoring:
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents: 731
diff changeset
86 _settingsDialogForm->languageSelectionComboBox->addItem( QIcon(QString(":/language/language-"+languageShort+".png")), tr("Ukrainian") );
638
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
87 }
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
88
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
89 else {
751
ac165b6ae67e Done some refactoring:
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents: 731
diff changeset
90 _settingsDialogForm->languageSelectionComboBox->addItem( tr("Unknown language mnemonic ") + languageShort );
638
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
91 }
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
92 }
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
93 }
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
94
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
95
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
96 /*!
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
97 \brief Displays the dialog by calling the dialogs exec function.
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
98
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
99 Before it gets all the values needed from the UiGuiSettings object.
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
100 */
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
101 int UiGuiSettingsDialog::showDialog() {
731
ca1bafc93ee2 Drastically simplified the connection between QObject properties and the settings. Thus the UiGuiSettingsDialog widgets do no longer need to have a special object name. Instead they need custom properties "connectedPropertyName" and "connectedSettingName" set, which then can be used to create the connection to the setting.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents: 727
diff changeset
102 // Init all settings dialog objects with values from settings.
751
ac165b6ae67e Done some refactoring:
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents: 731
diff changeset
103 _settings->setObjectPropertyToSettingValueRecursive(this);
638
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
104
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
105 // Execute the dialog.
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
106 return exec();
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
107 }
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
108
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
109
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
110 /*!
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
111 \brief This slot is called when the dialog box is closed by pressing the Ok button.
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
112
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
113 Writes all settings to the UiGuiSettings object.
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
114 */
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
115 void UiGuiSettingsDialog::writeWidgetValuesToSettings() {
731
ca1bafc93ee2 Drastically simplified the connection between QObject properties and the settings. Thus the UiGuiSettingsDialog widgets do no longer need to have a special object name. Instead they need custom properties "connectedPropertyName" and "connectedSettingName" set, which then can be used to create the connection to the setting.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents: 727
diff changeset
116 // Write settings dialog object values to settings.
751
ac165b6ae67e Done some refactoring:
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents: 731
diff changeset
117 _settings->setSettingToObjectPropertyValueRecursive(this);
638
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
118 }
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
119
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
120
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
121 /*!
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
122 \brief Catches language change events and retranslates all needed widgets.
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
123 */
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
124 void UiGuiSettingsDialog::changeEvent(QEvent *event) {
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
125 if (event->type() == QEvent::LanguageChange) {
751
ac165b6ae67e Done some refactoring:
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents: 731
diff changeset
126 _settingsDialogForm->retranslateUi(this);
638
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
127 // If this is not explicit set here, Qt < 4.3.0 does not translate the buttons.
751
ac165b6ae67e Done some refactoring:
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents: 731
diff changeset
128 _settingsDialogForm->buttonBox->setStandardButtons(QDialogButtonBox::Cancel | QDialogButtonBox::NoButton|QDialogButtonBox::Ok);
638
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
129
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
130 //TODO: This has to be removed when the properties for the highlighters can be set.
751
ac165b6ae67e Done some refactoring:
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents: 731
diff changeset
131 _settingsDialogForm->groupBoxSyntaxHighlighterProperties->setToolTip( "(Will be implemented soon)" + _settingsDialogForm->groupBoxSyntaxHighlighterProperties->toolTip() );
638
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
132
751
ac165b6ae67e Done some refactoring:
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents: 731
diff changeset
133 QStringList languageShortList = _settings->getAvailableTranslations();
638
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
134
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
135 // Now retranslate every entry in the language selection box.
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
136 for (int i = 0; i < languageShortList.size(); i++ ) {
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
137 QString languageShort = languageShortList.at(i);
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
138
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
139 // Identify the language mnemonic and set the full name.
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
140 if ( languageShort == "en" ) {
751
ac165b6ae67e Done some refactoring:
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents: 731
diff changeset
141 _settingsDialogForm->languageSelectionComboBox->setItemText( i, tr("English") );
638
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
142 }
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
143 else if ( languageShort == "fr" ) {
751
ac165b6ae67e Done some refactoring:
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents: 731
diff changeset
144 _settingsDialogForm->languageSelectionComboBox->setItemText( i, tr("French") );
638
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
145 }
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
146 else if ( languageShort == "de" ) {
751
ac165b6ae67e Done some refactoring:
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents: 731
diff changeset
147 _settingsDialogForm->languageSelectionComboBox->setItemText( i, tr("German") );
638
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
148 }
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
149 else if ( languageShort == "zh_TW" ) {
751
ac165b6ae67e Done some refactoring:
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents: 731
diff changeset
150 _settingsDialogForm->languageSelectionComboBox->setItemText( i, tr("Chinese (Taiwan)") );
638
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
151 }
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
152 else if ( languageShort == "ja_jp" ) {
751
ac165b6ae67e Done some refactoring:
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents: 731
diff changeset
153 _settingsDialogForm->languageSelectionComboBox->setItemText( i, tr("Japanese") );
638
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
154 }
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
155 else if ( languageShort == "ru" ) {
751
ac165b6ae67e Done some refactoring:
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents: 731
diff changeset
156 _settingsDialogForm->languageSelectionComboBox->setItemText( i, tr("Russian") );
638
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
157 }
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
158 else if ( languageShort == "uk" ) {
751
ac165b6ae67e Done some refactoring:
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents: 731
diff changeset
159 _settingsDialogForm->languageSelectionComboBox->setItemText( i, tr("Ukrainian") );
638
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
160 }
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
161 else {
751
ac165b6ae67e Done some refactoring:
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents: 731
diff changeset
162 _settingsDialogForm->languageSelectionComboBox->setItemText( i, tr("Unknown language mnemonic ") + languageShort );
638
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
163 }
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
164 }
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
165 }
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
166 else {
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
167 QWidget::changeEvent(event);
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
168 }
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
169 }