changeset 528:7a1b429fd4e7

- Removed any warnings. - Cleaned up some code. - Refactored the way settings are used in several parts. git-svn-id: svn://svn.code.sf.net/p/universalindent/code/trunk@768 59b1889a-e5ac-428c-b0c7-476e01d41282
author thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
date Wed, 24 Sep 2008 03:32:14 +0000
parents 61f31b998e85
children 43d171d0a92b
files UniversalIndentGUI.pro src/AboutDialogGraphicsView.cpp src/AboutDialogGraphicsView.h src/SettingsPaths.h src/UiGuiSettingsDialog.ui src/UiguiIndentServer.h src/UniversalIndentGUI.vcproj src/highlighter.cpp src/highlighter.h src/indenthandler.cpp src/indenthandler.h src/main.cpp src/mainwindow.cpp src/mainwindow.h src/mainwindow.ui src/templateBatchScript.cpp src/templateBatchScript.h src/toolBarWidget.ui src/uiguisettings.cpp src/uiguisettings.h src/uiguisettingsdialog.cpp
diffstat 21 files changed, 417 insertions(+), 389 deletions(-) [+]
line wrap: on
line diff
--- a/UniversalIndentGUI.pro	Sun Sep 21 20:31:52 2008 +0000
+++ b/UniversalIndentGUI.pro	Wed Sep 24 03:32:14 2008 +0000
@@ -181,7 +181,8 @@
            src/UiguiIndentServer.cpp \
            src/updatecheckdialog.cpp \
            src/SettingsPaths.cpp \
-           src/AboutDialogGraphicsView.cpp
+           src/AboutDialogGraphicsView.cpp \
+           src/templateBatchScript.cpp
 
 RESOURCES += resources/Icons.qrc
 RC_FILE    = resources/programicon.rc
--- a/src/AboutDialogGraphicsView.cpp	Sun Sep 21 20:31:52 2008 +0000
+++ b/src/AboutDialogGraphicsView.cpp	Wed Sep 24 03:32:14 2008 +0000
@@ -19,8 +19,6 @@
 #include <QtGui>
 #include "AboutDialogGraphicsView.h"
 
-#if QT_VERSION >= 0x040400
-
 AboutDialogGraphicsView::AboutDialogGraphicsView(AboutDialog *aboutDialog, QWidget *parent) : QGraphicsView(parent) {
     this->parent = parent;
     setWindowFlags(Qt::SplashScreen);
@@ -119,7 +117,7 @@
 void AboutDialogGraphicsView::showAboutDialog() {
     //hide();
     disconnect(timeLine, SIGNAL(finished()), this, SLOT(showAboutDialog()));
-    aboutDialog->move( parent->geometry().x()+(parent->geometry().width()-graphicsProxyWidget->geometry().width())/2, parent->y()+windowTitleBarWidth );
+    aboutDialog->move( int(parent->geometry().x()+(parent->geometry().width()-graphicsProxyWidget->geometry().width()) / 2), parent->y()+windowTitleBarWidth );
     aboutDialog->exec();
 }
 
@@ -162,6 +160,3 @@
 void AboutDialogGraphicsView::setScreenshotPixmap(const QPixmap &screenShot) {
     originalPixmap = screenShot;
 }
-
-
-#endif // #if QT_VERSION >= 0x040400
\ No newline at end of file
--- a/src/AboutDialogGraphicsView.h	Sun Sep 21 20:31:52 2008 +0000
+++ b/src/AboutDialogGraphicsView.h	Wed Sep 24 03:32:14 2008 +0000
@@ -27,9 +27,6 @@
 #include <QPixmap>
 #include <QSplashScreen>
 
-//Can't use this test, because MOC doesn't understand that code line
-//#if QT_VERSION >= 0x040400
-
 #include "aboutdialog.h"
 
 class AboutDialogGraphicsView : public QGraphicsView
@@ -63,5 +60,3 @@
 };
 
 #endif // ABOUTDIALOGGRAPHICSVIEW_H
-
-//#endif // #if QT_VERSION >= 0x040400
\ No newline at end of file
--- a/src/SettingsPaths.h	Sun Sep 21 20:31:52 2008 +0000
+++ b/src/SettingsPaths.h	Wed Sep 24 03:32:14 2008 +0000
@@ -46,4 +46,4 @@
     static bool portableMode;
 };
 
-#endif // SETTINGSPATHS_H
\ No newline at end of file
+#endif // SETTINGSPATHS_H
--- a/src/UiGuiSettingsDialog.ui	Sun Sep 21 20:31:52 2008 +0000
+++ b/src/UiGuiSettingsDialog.ui	Wed Sep 24 03:32:14 2008 +0000
@@ -16,22 +16,14 @@
    <string>Settings</string>
   </property>
   <property name="windowIcon" >
-   <iconset resource="../resources/Icons.qrc" >:/mainWindow/preferences-system.png</iconset>
+   <iconset resource="../resources/Icons.qrc" >
+    <normaloff>:/mainWindow/preferences-system.png</normaloff>:/mainWindow/preferences-system.png</iconset>
   </property>
   <layout class="QVBoxLayout" >
    <property name="spacing" >
     <number>6</number>
    </property>
-   <property name="leftMargin" >
-    <number>9</number>
-   </property>
-   <property name="topMargin" >
-    <number>9</number>
-   </property>
-   <property name="rightMargin" >
-    <number>9</number>
-   </property>
-   <property name="bottomMargin" >
+   <property name="margin" >
     <number>9</number>
    </property>
    <item>
@@ -44,22 +36,14 @@
        <string>Common</string>
       </attribute>
       <attribute name="icon" >
-       <iconset resource="../resources/Icons.qrc" >:/settingsDialog/applications-system.png</iconset>
+       <iconset resource="../resources/Icons.qrc" >
+        <normaloff>:/settingsDialog/applications-system.png</normaloff>:/settingsDialog/applications-system.png</iconset>
       </attribute>
       <layout class="QVBoxLayout" >
        <property name="spacing" >
         <number>6</number>
        </property>
-       <property name="leftMargin" >
-        <number>9</number>
-       </property>
-       <property name="topMargin" >
-        <number>9</number>
-       </property>
-       <property name="rightMargin" >
-        <number>9</number>
-       </property>
-       <property name="bottomMargin" >
+       <property name="margin" >
         <number>9</number>
        </property>
        <item>
@@ -67,16 +51,7 @@
          <property name="spacing" >
           <number>6</number>
          </property>
-         <property name="leftMargin" >
-          <number>0</number>
-         </property>
-         <property name="topMargin" >
-          <number>0</number>
-         </property>
-         <property name="rightMargin" >
-          <number>0</number>
-         </property>
-         <property name="bottomMargin" >
+         <property name="margin" >
           <number>0</number>
          </property>
          <item>
@@ -110,7 +85,7 @@
            <property name="orientation" >
             <enum>Qt::Horizontal</enum>
            </property>
-           <property name="sizeHint" >
+           <property name="sizeHint" stdset="0" >
             <size>
              <width>40</width>
              <height>20</height>
@@ -145,16 +120,7 @@
          <property name="spacing" >
           <number>6</number>
          </property>
-         <property name="leftMargin" >
-          <number>0</number>
-         </property>
-         <property name="topMargin" >
-          <number>0</number>
-         </property>
-         <property name="rightMargin" >
-          <number>0</number>
-         </property>
-         <property name="bottomMargin" >
+         <property name="margin" >
           <number>0</number>
          </property>
          <item>
@@ -194,7 +160,7 @@
            <property name="orientation" >
             <enum>Qt::Horizontal</enum>
            </property>
-           <property name="sizeHint" >
+           <property name="sizeHint" stdset="0" >
             <size>
              <width>40</width>
              <height>20</height>
@@ -219,7 +185,7 @@
          <property name="orientation" >
           <enum>Qt::Vertical</enum>
          </property>
-         <property name="sizeHint" >
+         <property name="sizeHint" stdset="0" >
           <size>
            <width>20</width>
            <height>40</height>
@@ -234,22 +200,14 @@
        <string>Editor</string>
       </attribute>
       <attribute name="icon" >
-       <iconset resource="../resources/Icons.qrc" >:/settingsDialog/accessories-text-editor.png</iconset>
+       <iconset resource="../resources/Icons.qrc" >
+        <normaloff>:/settingsDialog/accessories-text-editor.png</normaloff>:/settingsDialog/accessories-text-editor.png</iconset>
       </attribute>
       <layout class="QVBoxLayout" >
        <property name="spacing" >
         <number>6</number>
        </property>
-       <property name="leftMargin" >
-        <number>9</number>
-       </property>
-       <property name="topMargin" >
-        <number>9</number>
-       </property>
-       <property name="rightMargin" >
-        <number>9</number>
-       </property>
-       <property name="bottomMargin" >
+       <property name="margin" >
         <number>9</number>
        </property>
        <item>
@@ -267,16 +225,7 @@
          <property name="spacing" >
           <number>6</number>
          </property>
-         <property name="leftMargin" >
-          <number>0</number>
-         </property>
-         <property name="topMargin" >
-          <number>0</number>
-         </property>
-         <property name="rightMargin" >
-          <number>0</number>
-         </property>
-         <property name="bottomMargin" >
+         <property name="margin" >
           <number>0</number>
          </property>
          <item>
@@ -319,7 +268,7 @@
            <property name="orientation" >
             <enum>Qt::Horizontal</enum>
            </property>
-           <property name="sizeHint" >
+           <property name="sizeHint" stdset="0" >
             <size>
              <width>40</width>
              <height>20</height>
@@ -334,7 +283,7 @@
          <property name="orientation" >
           <enum>Qt::Vertical</enum>
          </property>
-         <property name="sizeHint" >
+         <property name="sizeHint" stdset="0" >
           <size>
            <width>20</width>
            <height>40</height>
@@ -349,32 +298,27 @@
        <string>Syntax Highlighting</string>
       </attribute>
       <attribute name="icon" >
-       <iconset resource="../resources/Icons.qrc" >:/settingsDialog/syntax-highlight.png</iconset>
+       <iconset resource="../resources/Icons.qrc" >
+        <normaloff>:/settingsDialog/syntax-highlight.png</normaloff>:/settingsDialog/syntax-highlight.png</iconset>
       </attribute>
       <layout class="QVBoxLayout" >
        <property name="spacing" >
         <number>6</number>
        </property>
-       <property name="leftMargin" >
-        <number>9</number>
-       </property>
-       <property name="topMargin" >
-        <number>9</number>
-       </property>
-       <property name="rightMargin" >
-        <number>9</number>
-       </property>
-       <property name="bottomMargin" >
+       <property name="margin" >
         <number>9</number>
        </property>
        <item>
-        <widget class="QCheckBox" name="uiGuiSyntaxHighlightningEnabled" >
+        <widget class="QCheckBox" name="enableSyntaxHighlightningCheckBox" >
          <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>SyntaxHighlightningEnabled</string>
+         </property>
         </widget>
        </item>
        <item>
@@ -392,16 +336,7 @@
           <property name="spacing" >
            <number>6</number>
           </property>
-          <property name="leftMargin" >
-           <number>9</number>
-          </property>
-          <property name="topMargin" >
-           <number>9</number>
-          </property>
-          <property name="rightMargin" >
-           <number>9</number>
-          </property>
-          <property name="bottomMargin" >
+          <property name="margin" >
            <number>9</number>
           </property>
           <item>
@@ -423,16 +358,7 @@
             <property name="spacing" >
              <number>6</number>
             </property>
-            <property name="leftMargin" >
-             <number>0</number>
-            </property>
-            <property name="topMargin" >
-             <number>0</number>
-            </property>
-            <property name="rightMargin" >
-             <number>0</number>
-            </property>
-            <property name="bottomMargin" >
+            <property name="margin" >
              <number>0</number>
             </property>
             <item>
@@ -460,7 +386,7 @@
               <property name="orientation" >
                <enum>Qt::Vertical</enum>
               </property>
-              <property name="sizeHint" >
+              <property name="sizeHint" stdset="0" >
                <size>
                 <width>20</width>
                 <height>40</height>
@@ -478,7 +404,7 @@
          <property name="orientation" >
           <enum>Qt::Vertical</enum>
          </property>
-         <property name="sizeHint" >
+         <property name="sizeHint" stdset="0" >
           <size>
            <width>20</width>
            <height>40</height>
@@ -496,7 +422,7 @@
       <enum>Qt::Horizontal</enum>
      </property>
      <property name="standardButtons" >
-      <set>QDialogButtonBox::Cancel|QDialogButtonBox::NoButton|QDialogButtonBox::Ok</set>
+      <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
      </property>
     </widget>
    </item>
--- a/src/UiguiIndentServer.h	Sun Sep 21 20:31:52 2008 +0000
+++ b/src/UiguiIndentServer.h	Wed Sep 24 03:32:14 2008 +0000
@@ -50,4 +50,4 @@
     quint32 blockSize;
 };
 
-#endif // UIGUIINDENTSERVER_H
\ No newline at end of file
+#endif // UIGUIINDENTSERVER_H
--- a/src/UniversalIndentGUI.vcproj	Sun Sep 21 20:31:52 2008 +0000
+++ b/src/UniversalIndentGUI.vcproj	Wed Sep 24 03:32:14 2008 +0000
@@ -243,6 +243,10 @@
 				RelativePath=".\SettingsPaths.cpp"
 				>
 			</File>
+            <File
+				RelativePath=".\templateBatchScript.cpp"
+				>
+			</File>
 			<File
 				RelativePath=".\uiguierrormessage.cpp"
 				>
--- a/src/highlighter.cpp	Sun Sep 21 20:31:52 2008 +0000
+++ b/src/highlighter.cpp	Wed Sep 24 03:32:14 2008 +0000
@@ -21,6 +21,8 @@
 
 #include "highlighter.h"
 
+#include "SettingsPaths.h"
+
 //! \defgroup grp_EditorComponent All concerning editor widget.
 
 /*!
@@ -32,14 +34,14 @@
 /*!
     \brief The constructor initializes some regular expressions and keywords to identify cpp tokens
  */
-Highlighter::Highlighter(QsciScintilla *parent, bool portableMode, QString globalFilesDirectoryStr)
+Highlighter::Highlighter(QsciScintilla *parent)
 : QObject(parent)
 {
     this->parent = parent;
 
     // If a "indenters" subdir in the applications binary path exists, use local config files (portable mode)
-    if ( portableMode ) {
-        this->settings = new QSettings(globalFilesDirectoryStr + "/config/UiGuiSyntaxHighlightConfig.ini", QSettings::IniFormat, this);
+    if ( SettingsPaths::getPortableMode() ) {
+        this->settings = new QSettings(SettingsPaths::getGlobalFilesPath() + "/config/UiGuiSyntaxHighlightConfig.ini", QSettings::IniFormat, this);
     } 
     // ... otherwise use the users application data default dir.
     else {
--- a/src/highlighter.h	Sun Sep 21 20:31:52 2008 +0000
+++ b/src/highlighter.h	Wed Sep 24 03:32:14 2008 +0000
@@ -62,7 +62,7 @@
     Q_OBJECT
 
 public:
-    Highlighter(QsciScintilla *parent, bool portableMode, QString globalFilesDirectoryStr);
+    Highlighter(QsciScintilla *parent);
     void turnHighlightOff();
     void turnHighlightOn();
 	
--- a/src/indenthandler.cpp	Sun Sep 21 20:31:52 2008 +0000
+++ b/src/indenthandler.cpp	Wed Sep 24 03:32:14 2008 +0000
@@ -19,6 +19,8 @@
 
 #include "indenthandler.h"
 
+#include "uiguisettings.h"
+
 //! \defgroup grp_Indenter All concerning handling of the indenter.
 
 /*!
@@ -77,11 +79,14 @@
     vboxLayout->addLayout( hboxLayout );
 
     // Create the indenter selection combo box.
-    indenterSelectionComboBox = new QComboBox(this);
-    indenterSelectionComboBox->setSizeAdjustPolicy(QComboBox::AdjustToMinimumContentsLengthWithIcon);
-    indenterSelectionComboBox->setMinimumContentsLength(20);
-    connect( indenterSelectionComboBox, SIGNAL(activated(int)), this, SLOT(setIndenter(int)) );
-    hboxLayout->addWidget( indenterSelectionComboBox );
+    indenterSelectionCombobox = new QComboBox(this);
+    indenterSelectionCombobox->setObjectName(QString::fromUtf8("indenterSelectionCombobox"));
+    indenterSelectionCombobox->setProperty("connectedSettingName", "SelectedIndenter");
+    indenterSelectionCombobox->setSizeAdjustPolicy(QComboBox::AdjustToMinimumContentsLengthWithIcon);
+    indenterSelectionCombobox->setMinimumContentsLength(20);
+    connect( indenterSelectionCombobox, SIGNAL(activated(int)), UiGuiSettings::getInstance(), SLOT(handleValueChangeFromExtern(int)) );
+    connect( UiGuiSettings::getInstance(), SIGNAL(selectedIndenter(int)), this, SLOT(setIndenter(int)) );
+    hboxLayout->addWidget( indenterSelectionCombobox );
 
     // Create the indenter parameter help button.
     indenterParameterHelpButton = new QToolButton(this);
@@ -129,7 +134,7 @@
             indenterID = indenterIniFileList.count() - 1;
         }
 
-        // reads and parses the by indenterID defined indent ini file and creates toolbox entries
+        // Reads and parses the by indenterID defined indent ini file and creates toolbox entries
         readIndentIniFile( indenterDirctoryStr + "/" + indenterIniFileList.at(indenterID) );
 
         // Find out how the indenter can be executed.
@@ -140,8 +145,9 @@
 
         // Fill the indenter selection combo box with the list of available indenters.
         if ( !getAvailableIndenters().isEmpty() ) {
-            indenterSelectionComboBox->addItems( getAvailableIndenters() );
-            indenterSelectionComboBox->setCurrentIndex( indenterID );
+            indenterSelectionCombobox->addItems( getAvailableIndenters() );
+            indenterSelectionCombobox->setCurrentIndex( indenterID );
+            connect( indenterSelectionCombobox, SIGNAL(currentIndexChanged(int)), this, SIGNAL(selectedIndenterIndexChanged(int)) );
         }
     }
     else {
@@ -307,13 +313,13 @@
     }
 
 #if defined(Q_OS_WIN32)
-    QString shellScript(templateBatchScript);
+    QString shellScript( TemplateBatchScript::getTemplateBatchScript() );
     shellScript = shellScript.replace("__INDENTERCALLSTRING2__", indenterCompleteCallString + "\n" + replaceInputFileCommand);
     indenterCompleteCallString = indenterCompleteCallString.replace("%1", "%%G");
     replaceInputFileCommand = replaceInputFileCommand.replace("%1", "%%G");
     shellScript = shellScript.replace("__INDENTERCALLSTRING1__", indenterCompleteCallString + "\n" + replaceInputFileCommand);
 #else
-    QString shellScript(templateBatchScript);
+    QString shellScript( TemplateBatchScript::getTemplateBatchScript() );
     shellScript = shellScript.replace("__INDENTERCALLSTRING2__", indenterCompleteCallString + "\n" + replaceInputFileCommand);
     indenterCompleteCallString = indenterCompleteCallString.replace("$1", "$file2indent");
     replaceInputFileCommand = replaceInputFileCommand.replace("$1", "$file2indent");
@@ -1326,7 +1332,7 @@
     \brief Can be called to update all widgets text to the currently selected language.
  */
 void IndentHandler::retranslateUi() {
-    indenterSelectionComboBox->setToolTip( tr("<html><head><meta name=\"qrichtext\" content=\"1\" /></head><body style=\" white-space: pre-wrap; font-family:MS Shell Dlg; font-size:8.25pt; font-weight:400; font-style:normal; text-decoration:none;\"><p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Shows the currently chosen indenters name and lets you choose other available indenters</p></body></html>") );
+    indenterSelectionCombobox->setToolTip( tr("<html><head><meta name=\"qrichtext\" content=\"1\" /></head><body style=\" white-space: pre-wrap; font-family:MS Shell Dlg; font-size:8.25pt; font-weight:400; font-style:normal; text-decoration:none;\"><p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Shows the currently chosen indenters name and lets you choose other available indenters</p></body></html>") );
     indenterParameterHelpButton->setToolTip( tr("Brings you to the online manual of the currently selected indenter, where you can get further help on the possible parameters.") );
 
     actionLoad_Indenter_Config_File->setText(QApplication::translate("IndentHandler", "Load Indenter Config File", 0, QApplication::UnicodeUTF8));
@@ -1351,7 +1357,7 @@
     \brief Returns the name of the currently selected indenter.
  */
 QString IndentHandler::getCurrentIndenterName() {
-    QString currentIndenterName = indenterSelectionComboBox->currentText();
+    QString currentIndenterName = indenterSelectionCombobox->currentText();
 
     // Remove the supported programming languages from indenters name, which are set in braces.
     if ( currentIndenterName.indexOf("(") > 0 ) {
@@ -1440,7 +1446,7 @@
     outSrcFile.open( QFile::ReadWrite | QFile::Text );
     outSrcFile.write( indenterCallShellScript.toAscii() );
 #if !defined(Q_OS_WIN32)
-    // For none Windows systems the files executable flag
+    // For none Windows systems set the files executable flag
     outSrcFile.setPermissions( outSrcFile.permissions() | QFile::ExeOwner | QFile::ExeUser| QFile::ExeGroup );
 #endif
     outSrcFile.close();
@@ -1462,12 +1468,10 @@
 
 bool IndentHandler::event( QEvent *event ) {
     if ( event->type() == QEvent::WindowActivate ) {
-        int i = 0;
         event->accept();
         return true;
     }
     else if ( event->type() == QEvent::WindowDeactivate ) {
-        int i = 0;
         event->accept();
         return true;
     } 
@@ -1502,4 +1506,9 @@
         windowClosedCallback();
     }
     event->accept();
-}
\ No newline at end of file
+}
+
+
+int IndentHandler::getIndenterId() {
+    return indenterSelectionCombobox->currentIndex();
+}
--- a/src/indenthandler.h	Sun Sep 21 20:31:52 2008 +0000
+++ b/src/indenthandler.h	Wed Sep 24 03:32:14 2008 +0000
@@ -76,9 +76,11 @@
     void contextMenuEvent( QContextMenuEvent *event );
     void setParameterChangedCallback( void(*paramChangedCallback)(void) );
     void setWindowClosedCallback( void(*winClosedCallback)(void) );
+    int getIndenterId();
 
 signals:
     void indenterSettingsChanged();
+    void selectedIndenterIndexChanged(int index);
 
 protected:
     bool event( QEvent *event );
@@ -148,7 +150,7 @@
     };
     QVector<ParamMultiple> paramMultiples;
 
-    QComboBox *indenterSelectionComboBox;
+    QComboBox *indenterSelectionCombobox;
     QToolButton *indenterParameterHelpButton;
     QVBoxLayout *vboxLayout;
     QToolBox *toolBox;
--- a/src/main.cpp	Sun Sep 21 20:31:52 2008 +0000
+++ b/src/main.cpp	Wed Sep 24 03:32:14 2008 +0000
@@ -23,6 +23,7 @@
 #include "UiguiIndentServer.h"
 
 #include "uiguiIniFileParser.h"
+#include "uiguisettings.h"
 
 /*!
     /brief Entry point to UniversalIndentGUI application.
@@ -72,6 +73,12 @@
             exit(1);
         }
     }
+    
+    
+    // Set default values for all by UniversalIndentGUI used settings objects.
+    QCoreApplication::setOrganizationName("UniversalIndentGUI");
+    QCoreApplication::setOrganizationDomain("universalindent.sf.net");
+    QCoreApplication::setApplicationName("UniversalIndentGUI");
 
     // Start normal with full gui and without server.
     if ( !startAsPlugin && !startAsServer ) {
@@ -90,4 +97,6 @@
     }
 
     return app.exec();
+    
+    UiGuiSettings::deleteInstance();
 }
--- a/src/mainwindow.cpp	Sun Sep 21 20:31:52 2008 +0000
+++ b/src/mainwindow.cpp	Wed Sep 24 03:32:14 2008 +0000
@@ -41,22 +41,12 @@
     QDate buildDate(2008, 05, 26);
     buildDateStr = buildDate.toString("d. MMMM yyyy");
 
-    // Get all necessary paths.
-    globalFilesDirectoryStr = SettingsPaths::getGlobalFilesPath();
-    indenterDirctoryStr = SettingsPaths::getIndenterPath();
-    portableMode = SettingsPaths::getPortableMode();
-
     // Init of some variables.
     sourceCodeChanged = false;
     scrollPositionChanged = false;
 
-    // Set default values for all by UniversalIndentGUI used settings objects.
-    QCoreApplication::setOrganizationName("UniversalIndentGUI");
-    QCoreApplication::setOrganizationDomain("universalindent.sf.net");
-    QCoreApplication::setApplicationName("UniversalIndentGUI");
-
     // Create the settings object, which loads all UiGui settings from a file.
-	settings = new UiGuiSettings( portableMode, globalFilesDirectoryStr );
+	settings = UiGuiSettings::getInstance();
 
     // Initialize the language of the application.
     initApplicationLanguage();
@@ -82,16 +72,10 @@
 	
 
     // generate about dialog box
-#if QT_VERSION >= 0x040400
     aboutDialog = new AboutDialog(this, Qt::SplashScreen, version, revision, buildDateStr);
     aboutDialogGraphicsView = new AboutDialogGraphicsView(aboutDialog, this);
     connect( toolBarWidget->pbAbout, SIGNAL(clicked()), this, SLOT(showAboutDialog()) );
     connect( actionAbout_UniversalIndentGUI, SIGNAL(triggered()), this, SLOT(showAboutDialog()) );
-#else
-    aboutDialog = new AboutDialog(this, Qt::Dialog, version, revision, buildDateStr);
-    connect( actionAbout_UniversalIndentGUI, SIGNAL(triggered()), aboutDialog, SLOT(exec()) );
-    connect( toolBarWidget->pbAbout, SIGNAL(clicked()), aboutDialog, SLOT(exec()) );
-#endif
 
 	// generate settings dialog box
 	settingsDialog = new UiGuiSettingsDialog(this, settings);
@@ -157,9 +141,9 @@
     updateCheckDialog = new UpdateCheckDialog(version, settings, this);
 
     // Register the syntax highlightning setting in the menu to the settings object.
-    connect( uiGuiSyntaxHighlightningEnabled, SIGNAL(toggled(bool)), settings, SLOT(handleValueChangeFromExtern(bool)) );
-    connect( settings, SIGNAL(syntaxHighlightningEnabled(bool)), uiGuiSyntaxHighlightningEnabled, SLOT(setChecked(bool)) );
-    uiGuiSyntaxHighlightningEnabled->setChecked( settings->getValueByName("SyntaxHighlightningEnabled").toBool() );
+    connect( enableSyntaxHighlightningAction, SIGNAL(toggled(bool)), settings, SLOT(handleValueChangeFromExtern(bool)) );
+    connect( settings, SIGNAL(syntaxHighlightningEnabled(bool)), enableSyntaxHighlightningAction, SLOT(setChecked(bool)) );
+    enableSyntaxHighlightningAction->setChecked( settings->getValueByName("SyntaxHighlightningEnabled").toBool() );
     // Tell the highlighter if it has to be enabled or disabled.
     connect( settings, SIGNAL(syntaxHighlightningEnabled(bool)), this, SLOT(turnHighlightOnOff(bool)) );
 
@@ -202,10 +186,10 @@
     toolBar->setAllowedAreas( Qt::TopToolBarArea | Qt::BottomToolBarArea );
 
     // Connect the tool bar widgets to their functions.
-    connect( toolBarWidget->uiGuiSyntaxHighlightningEnabled, SIGNAL(toggled(bool)), settings, SLOT(handleValueChangeFromExtern(bool)) );
-    connect( settings, SIGNAL(syntaxHighlightningEnabled(bool)), toolBarWidget->uiGuiSyntaxHighlightningEnabled, SLOT(setChecked(bool)) );
-    toolBarWidget->uiGuiSyntaxHighlightningEnabled->setChecked( settings->getValueByName("SyntaxHighlightningEnabled").toBool() );
-    toolBarWidget->uiGuiSyntaxHighlightningEnabled->hide();
+    connect( toolBarWidget->enableSyntaxHighlightningCheckBox, SIGNAL(toggled(bool)), settings, SLOT(handleValueChangeFromExtern(bool)) );
+    connect( settings, SIGNAL(syntaxHighlightningEnabled(bool)), toolBarWidget->enableSyntaxHighlightningCheckBox, SLOT(setChecked(bool)) );
+    toolBarWidget->enableSyntaxHighlightningCheckBox->setChecked( settings->getValueByName("SyntaxHighlightningEnabled").toBool() );
+    toolBarWidget->enableSyntaxHighlightningCheckBox->hide();
     connect( toolBarWidget->pbOpen_Source_File, SIGNAL(clicked()), this, SLOT(openSourceFileDialog()) );
     connect( toolBarWidget->pbExit, SIGNAL(clicked()), this, SLOT(close()));
     connect( toolBarWidget->cbLivePreview, SIGNAL(toggled(bool)), this, SLOT(previewTurnedOnOff(bool)) );
@@ -261,7 +245,7 @@
  */
 void MainWindow::initSyntaxHighlighter() {
     // Create the highlighter.
-    highlighter = new Highlighter(txtedSourceCode, portableMode, globalFilesDirectoryStr);
+    highlighter = new Highlighter(txtedSourceCode);
 
     // Handle if syntax highlighting is enabled
 	bool syntaxHighlightningEnabled = settings->getValueByName("SyntaxHighlightningEnabled").toBool();
@@ -309,14 +293,14 @@
     // Load the Qt own translation file and set it for the application.
     qTTranslator = new QTranslator();
     bool translationFileLoaded;
-    translationFileLoaded = qTTranslator->load( globalFilesDirectoryStr + "/translations/qt_" + languageShort );
+    translationFileLoaded = qTTranslator->load( SettingsPaths::getGlobalFilesPath() + "/translations/qt_" + languageShort );
     if ( translationFileLoaded ) {
         qApp->installTranslator(qTTranslator);
     }
 
     // Load the uigui translation file and set it for the application.
     uiGuiTranslator = new QTranslator();
-    translationFileLoaded = uiGuiTranslator->load( globalFilesDirectoryStr + "/translations/universalindent_" + languageShort );
+    translationFileLoaded = uiGuiTranslator->load( SettingsPaths::getGlobalFilesPath() + "/translations/universalindent_" + languageShort );
     if ( translationFileLoaded ) {
         qApp->installTranslator(uiGuiTranslator);
     }
@@ -332,7 +316,7 @@
  */
 void MainWindow::initIndenter() {
     // Get Id of last selected indenter.
-	currentIndenterID = settings->getValueByName("LastSelectedIndenterID").toInt();
+	currentIndenterID = settings->getValueByName("SelectedIndenter").toInt();
 
     // Create the indenter widget with the ID and add it to the layout.
     indentHandler = new IndentHandler(currentIndenterID, this, centralwidget);
@@ -653,7 +637,6 @@
         bool charFound = false;
 
         // Search forward
-        int lineBreakCounter = 0;
         for ( cursorLine = saveCursorLine; cursorLine-saveCursorLine < 6 && cursorLine < txtedSourceCode->lines(); cursorLine++ ) {
             text = txtedSourceCode->text(cursorLine);
             while ( cursorPos < text.count() && enteredCharacter != text.at(cursorPos)) {
@@ -675,7 +658,7 @@
             if ( cursorPos >= text.count() ) {
                 cursorPos = text.count() - 1;
             }
-            int lineBreakCounter = 0;
+
             for ( cursorLine = saveCursorLine; saveCursorLine-cursorLine < 6 && cursorLine >= 0; cursorLine-- ) {
                 text = txtedSourceCode->text(cursorLine);
                 while ( cursorPos >= 0 && enteredCharacter != text.at(cursorPos)) {
@@ -893,8 +876,8 @@
 			sourceFileContent = loadFile(currentSourceFile);
 		}
         // If the last opened source code file does not exist, try to load the default example.cpp file.
-        else if ( QFile::exists(indenterDirctoryStr + "/example.cpp") ) {
-			QFileInfo fileInfo(indenterDirctoryStr + "/example.cpp");
+        else if ( QFile::exists( SettingsPaths::getIndenterPath() + "/example.cpp" ) ) {
+			QFileInfo fileInfo( SettingsPaths::getIndenterPath() + "/example.cpp" );
 			currentSourceFile = fileInfo.absoluteFilePath();
 			sourceFileContent = loadFile(currentSourceFile);
 		}
@@ -929,7 +912,7 @@
     //    settings->setValueByName( "LastOpenedFiles", currentSourceFile );
     //}
 	//settings->setValueByName( "LoadLastOpenedFileOnStartup", uiGuiLoadLastOpenedFileOnStartup->isChecked() );
-    settings->setValueByName( "LastSelectedIndenterID", currentIndenterID );
+    //settings->setValueByName( "SelectedIndenter", indentHandler->getIndenterId() );
     //settings->setValueByName( "IndenterParameterTooltipsEnabled", uiGuiIndenterParameterTooltipsEnabled->isChecked() );
     //settings->setValueByName( "Language", language );
 	settings->setValueByName( "FileEncoding", currentEncoding );
@@ -1028,13 +1011,13 @@
 
     // Load the Qt own translation file and set it for the application.
     bool translationFileLoaded;
-    translationFileLoaded = qTTranslator->load( globalFilesDirectoryStr + "/translations/qt_" + languageShort );
+    translationFileLoaded = qTTranslator->load( SettingsPaths::getGlobalFilesPath() + "/translations/qt_" + languageShort );
     if ( translationFileLoaded ) {
         qApp->installTranslator(qTTranslator);
     }
 
     // Load the uigui translation file and set it for the application.
-    translationFileLoaded = uiGuiTranslator->load( globalFilesDirectoryStr + "/translations/universalindent_" + languageShort );
+    translationFileLoaded = uiGuiTranslator->load( SettingsPaths::getGlobalFilesPath() + "/translations/universalindent_" + languageShort );
     if ( translationFileLoaded ) {
         qApp->installTranslator(uiGuiTranslator);
     }
--- a/src/mainwindow.h	Sun Sep 21 20:31:52 2008 +0000
+++ b/src/mainwindow.h	Wed Sep 24 03:32:14 2008 +0000
@@ -29,7 +29,6 @@
 #include "highlighter.h"
 #include "indenthandler.h"
 #include "updatecheckdialog.h"
-#include "SettingsPaths.h"
 
 #include <QWidget>
 #include <QString>
@@ -83,9 +82,7 @@
     QString version;
     QString revision;
     QString buildDateStr;
-    bool portableMode;
-	QString globalFilesDirectoryStr;
-	QString indenterDirctoryStr;
+
 	QString currentEncoding;
     QString sourceFileContent;
     QString sourceFormattedContent;
@@ -93,9 +90,7 @@
     Highlighter *highlighter;
     QScrollBar *textEditVScrollBar;
     AboutDialog *aboutDialog;
-#if QT_VERSION >= 0x040400
     AboutDialogGraphicsView *aboutDialogGraphicsView;
-#endif
 	UiGuiSettingsDialog *settingsDialog;
     int textEditLastScrollPos;
     int currentIndenterID;
--- a/src/mainwindow.ui	Sun Sep 21 20:31:52 2008 +0000
+++ b/src/mainwindow.ui	Wed Sep 24 03:32:14 2008 +0000
@@ -101,7 +101,7 @@
      </property>
     </widget>
     <addaction name="actionLive_Indent_Preview" />
-    <addaction name="uiGuiSyntaxHighlightningEnabled" />
+    <addaction name="enableSyntaxHighlightningAction" />
     <addaction name="uiGuiWhiteSpaceIsVisible" />
     <addaction name="highlighterMenu" />
     <addaction name="uiGuiIndenterParameterTooltipsEnabled" />
@@ -316,7 +316,7 @@
     <bool>false</bool>
    </property>
   </action>
-  <action name="uiGuiSyntaxHighlightningEnabled" >
+  <action name="enableSyntaxHighlightningAction" >
    <property name="checkable" >
     <bool>true</bool>
    </property>
@@ -339,6 +339,9 @@
    <property name="statusTip" >
     <string>By enabling special key words of the source code are highlighted.</string>
    </property>
+   <property name="connectedSettingName" stdset="0" >
+    <string>SyntaxHighlightningEnabled</string>
+   </property>
   </action>
   <action name="uiGuiWhiteSpaceIsVisible" >
    <property name="checkable" >
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/templateBatchScript.cpp	Wed Sep 24 03:32:14 2008 +0000
@@ -0,0 +1,157 @@
+/***************************************************************************
+ *   Copyright (C) 2006-2008 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 "templateBatchScript.h"
+
+const char* TemplateBatchScript::getTemplateBatchScript() {
+    static const char* templateBatchScript =
+#if defined(Q_OS_WIN32)
+    "@echo off\n"
+    "\n"
+    "IF (%1)==() GOTO error\n"
+    "dir /b /ad %1 >nul 2>nul && GOTO indentDir\n"
+    "IF NOT EXIST %1 GOTO error\n"
+    "goto indentFile\n"
+    "\n"
+    ":indentDir\n"
+    "set searchdir=%1\n"
+    "\n"
+    "IF (%2)==() GOTO assignDefaultSuffix\n"
+    "set filesuffix=%2\n"
+    "\n"
+    "GOTO run\n"
+    "\n"
+    ":assignDefaultSuffix\n"
+    "::echo !!!!DEFAULT SUFFIX!!!\n"
+    "set filesuffix=*\n"
+    "\n"
+    ":run\n"
+    "FOR /F \"tokens=*\" %%G IN ('DIR /B /S %searchdir%\\*.%filesuffix%') DO (\n"
+        "echo Indenting file \"%%G\"\n"
+        "__INDENTERCALLSTRING1__\n"
+    ")\n"
+    "GOTO ende\n"
+    "\n"
+    ":indentFile\n"
+    "echo Indenting one file %1\n"
+    "__INDENTERCALLSTRING2__\n"
+    "\n"
+    "GOTO ende\n"
+    "\n"
+    ":error\n"
+    "echo .\n"
+    "echo ERROR: As parameter given directory or file does not exist!\n"
+    "echo Syntax is: __INDENTERCALLSTRINGSCRIPTNAME__ dirname filesuffix\n"
+    "echo Syntax is: __INDENTERCALLSTRINGSCRIPTNAME__ filename\n"
+    "echo Example: recurse.bat temp cpp\n"
+    "echo .\n"
+    "\n"
+    ":ende\n";
+
+#else
+
+    "#!/bin/sh \n"
+    "\n"
+    "if [ ! -n \"$1\" ]; then\n"
+        "echo \"Syntax is: recurse.sh dirname filesuffix\"\n"
+        "echo \"Syntax is: recurse.sh filename\"\n"
+        "echo \"Example: recurse.sh temp cpp\"\n"
+        "exit 1\n"
+    "fi\n"
+    "\n"
+    "if [ -d \"$1\" ]; then\n"
+        "#echo \"Dir ${1} exists\"\n"
+        "if [ -n \"$2\" ]; then\n"
+            "filesuffix=$2\n"
+        "else\n"
+            "filesuffix=\"*\"\n"
+        "fi\n"
+        "\n"
+        "#echo \"Filtering files using suffix ${filesuffix}\"\n"
+        "\n"
+        "file_list=`find ${1} -name \"*.${filesuffix}\" -type f`\n"
+        "for file2indent in $file_list\n"
+        "do \n"
+            "echo \"Indenting file $file2indent\"\n"
+            "__INDENTERCALLSTRING1__\n"
+        "done\n"
+    "else\n"
+        "if [ -f \"$1\" ]; then\n"
+            "echo \"Indenting one file $1\"\n"
+            "__INDENTERCALLSTRING2__\n"
+        "else\n"
+            "echo \"ERROR: As parameter given directory or file does not exist!\"\n"
+            "echo \"Syntax is: __INDENTERCALLSTRINGSCRIPTNAME__ dirname filesuffix\"\n"
+            "echo \"Syntax is: __INDENTERCALLSTRINGSCRIPTNAME__ filename\"\n"
+            "echo \"Example: recurse.sh temp cpp\"\n"
+            "exit 1\n"
+        "fi\n"
+    "fi\n";
+#endif // #if defined(Q_OS_WIN32)
+    return templateBatchScript;
+}
+
+
+/* Here comes the original batch script without the c++ markup
+@echo off
+
+IF (%1)==() GOTO error
+dir /b /ad %1 >nul 2>nul && GOTO indentDir
+IF NOT EXIST %1 GOTO error
+goto indentFile
+
+:indentDir
+set searchdir=%1
+
+IF (%2)==() GOTO assignDefaultSuffix
+set filesuffix=%2
+
+GOTO run
+
+:assignDefaultSuffix
+::echo !!!!DEFAULT SUFFIX!!!
+set filesuffix=*
+
+:run
+FOR /F "tokens=*" %%G IN ('DIR /B /S %searchdir%\*.%filesuffix%') DO (
+    echo Indenting file "%%G"
+    ::call call_CSSTidy.bat "%%G"
+	"C:/Dokumente und Einstellungen/ts/Eigene Dateien/Visual Studio 2005/Projects/UiGuixy/indenters/csstidy.exe" "%%G" --timestamp=true --allow_html_in_templates=false --compress_colors=true --compress_font=true --lowercase_s=false --preserve_css=false --remove_last_;=false --remove_bslash=true --sort_properties=false --sort_selectors=false  indentoutput.css
+    move /Y indentoutput.css "%%G"
+)
+GOTO ende
+
+:indentFile
+echo Indenting one file %1
+"C:/Dokumente und Einstellungen/ts/Eigene Dateien/Visual Studio 2005/Projects/UiGuixy/indenters/csstidy.exe" %1 --timestamp=true --allow_html_in_templates=false --compress_colors=true --compress_font=true --lowercase_s=false --preserve_css=false --remove_last_;=false --remove_bslash=true --sort_properties=false --sort_selectors=false  indentoutput.css
+move /Y indentoutput.css %1
+
+GOTO ende
+
+:error
+echo .
+echo ERROR: As parameter given directory or file does not exist!
+echo Syntax is: recurse.bat dirname filesuffix
+echo Syntax is: recurse.bat filename
+echo Example: recurse.bat temp cpp
+echo .
+
+:ende
+
+*/
--- a/src/templateBatchScript.h	Sun Sep 21 20:31:52 2008 +0000
+++ b/src/templateBatchScript.h	Wed Sep 24 03:32:14 2008 +0000
@@ -20,137 +20,12 @@
 #ifndef TEMPLATEBATCHSCRIPT_H
 #define TEMPLATEBATCHSCRIPT_H
 
-static const char* templateBatchScript =
-#if defined(Q_OS_WIN32)
-"@echo off\n"
-"\n"
-"IF (%1)==() GOTO error\n"
-"dir /b /ad %1 >nul 2>nul && GOTO indentDir\n"
-"IF NOT EXIST %1 GOTO error\n"
-"goto indentFile\n"
-"\n"
-":indentDir\n"
-"set searchdir=%1\n"
-"\n"
-"IF (%2)==() GOTO assignDefaultSuffix\n"
-"set filesuffix=%2\n"
-"\n"
-"GOTO run\n"
-"\n"
-":assignDefaultSuffix\n"
-"::echo !!!!DEFAULT SUFFIX!!!\n"
-"set filesuffix=*\n"
-"\n"
-":run\n"
-"FOR /F \"tokens=*\" %%G IN ('DIR /B /S %searchdir%\\*.%filesuffix%') DO (\n"
-    "echo Indenting file \"%%G\"\n"
-    "__INDENTERCALLSTRING1__\n"
-")\n"
-"GOTO ende\n"
-"\n"
-":indentFile\n"
-"echo Indenting one file %1\n"
-"__INDENTERCALLSTRING2__\n"
-"\n"
-"GOTO ende\n"
-"\n"
-":error\n"
-"echo .\n"
-"echo ERROR: As parameter given directory or file does not exist!\n"
-"echo Syntax is: __INDENTERCALLSTRINGSCRIPTNAME__ dirname filesuffix\n"
-"echo Syntax is: __INDENTERCALLSTRINGSCRIPTNAME__ filename\n"
-"echo Example: recurse.bat temp cpp\n"
-"echo .\n"
-"\n"
-":ende\n";
-
-#else
-
-"#!/bin/sh \n"
-"\n"
-"if [ ! -n \"$1\" ]; then\n"
-    "echo \"Syntax is: recurse.sh dirname filesuffix\"\n"
-    "echo \"Syntax is: recurse.sh filename\"\n"
-    "echo \"Example: recurse.sh temp cpp\"\n"
-    "exit 1\n"
-"fi\n"
-"\n"
-"if [ -d \"$1\" ]; then\n"
-    "#echo \"Dir ${1} exists\"\n"
-    "if [ -n \"$2\" ]; then\n"
-        "filesuffix=$2\n"
-    "else\n"
-        "filesuffix=\"*\"\n"
-    "fi\n"
-    "\n"
-    "#echo \"Filtering files using suffix ${filesuffix}\"\n"
-    "\n"
-    "file_list=`find ${1} -name \"*.${filesuffix}\" -type f`\n"
-    "for file2indent in $file_list\n"
-    "do \n"
-        "echo \"Indenting file $file2indent\"\n"
-        "__INDENTERCALLSTRING1__\n"
-    "done\n"
-"else\n"
-    "if [ -f \"$1\" ]; then\n"
-        "echo \"Indenting one file $1\"\n"
-        "__INDENTERCALLSTRING2__\n"
-    "else\n"
-        "echo \"ERROR: As parameter given directory or file does not exist!\"\n"
-        "echo \"Syntax is: __INDENTERCALLSTRINGSCRIPTNAME__ dirname filesuffix\"\n"
-        "echo \"Syntax is: __INDENTERCALLSTRINGSCRIPTNAME__ filename\"\n"
-        "echo \"Example: recurse.sh temp cpp\"\n"
-        "exit 1\n"
-    "fi\n"
-"fi\n";
-#endif // #if defined(Q_OS_WIN32)
+class TemplateBatchScript
+{
+private:
+    TemplateBatchScript();
+public:
+    static const char* getTemplateBatchScript();
+};
 
 #endif // TEMPLATEBATCHSCRIPT_H
-
-/* Here comes the original batch script without the c++ markup
-@echo off
-
-IF (%1)==() GOTO error
-dir /b /ad %1 >nul 2>nul && GOTO indentDir
-IF NOT EXIST %1 GOTO error
-goto indentFile
-
-:indentDir
-set searchdir=%1
-
-IF (%2)==() GOTO assignDefaultSuffix
-set filesuffix=%2
-
-GOTO run
-
-:assignDefaultSuffix
-::echo !!!!DEFAULT SUFFIX!!!
-set filesuffix=*
-
-:run
-FOR /F "tokens=*" %%G IN ('DIR /B /S %searchdir%\*.%filesuffix%') DO (
-    echo Indenting file "%%G"
-    ::call call_CSSTidy.bat "%%G"
-	"C:/Dokumente und Einstellungen/ts/Eigene Dateien/Visual Studio 2005/Projects/UiGuixy/indenters/csstidy.exe" "%%G" --timestamp=true --allow_html_in_templates=false --compress_colors=true --compress_font=true --lowercase_s=false --preserve_css=false --remove_last_;=false --remove_bslash=true --sort_properties=false --sort_selectors=false  indentoutput.css
-    move /Y indentoutput.css "%%G"
-)
-GOTO ende
-
-:indentFile
-echo Indenting one file %1
-"C:/Dokumente und Einstellungen/ts/Eigene Dateien/Visual Studio 2005/Projects/UiGuixy/indenters/csstidy.exe" %1 --timestamp=true --allow_html_in_templates=false --compress_colors=true --compress_font=true --lowercase_s=false --preserve_css=false --remove_last_;=false --remove_bslash=true --sort_properties=false --sort_selectors=false  indentoutput.css
-move /Y indentoutput.css %1
-
-GOTO ende
-
-:error
-echo .
-echo ERROR: As parameter given directory or file does not exist!
-echo Syntax is: recurse.bat dirname filesuffix
-echo Syntax is: recurse.bat filename
-echo Example: recurse.bat temp cpp
-echo .
-
-:ende
-
-*/
--- a/src/toolBarWidget.ui	Sun Sep 21 20:31:52 2008 +0000
+++ b/src/toolBarWidget.ui	Wed Sep 24 03:32:14 2008 +0000
@@ -16,16 +16,7 @@
    <property name="spacing" >
     <number>6</number>
    </property>
-   <property name="leftMargin" >
-    <number>0</number>
-   </property>
-   <property name="topMargin" >
-    <number>0</number>
-   </property>
-   <property name="rightMargin" >
-    <number>0</number>
-   </property>
-   <property name="bottomMargin" >
+   <property name="margin" >
     <number>0</number>
    </property>
    <item>
@@ -37,7 +28,8 @@
       <string> Open Source File </string>
      </property>
      <property name="icon" >
-      <iconset resource="../resources/Icons.qrc" >:/mainWindow/document-open.png</iconset>
+      <iconset resource="../resources/Icons.qrc" >
+       <normaloff>:/mainWindow/document-open.png</normaloff>:/mainWindow/document-open.png</iconset>
      </property>
     </widget>
    </item>
@@ -50,12 +42,13 @@
       <string>Live Indent Preview</string>
      </property>
      <property name="icon" >
-      <iconset resource="../resources/Icons.qrc" >:/mainWindow/live-preview.png</iconset>
+      <iconset resource="../resources/Icons.qrc" >
+       <normaloff>:/mainWindow/live-preview.png</normaloff>:/mainWindow/live-preview.png</iconset>
      </property>
     </widget>
    </item>
    <item>
-    <widget class="QCheckBox" name="uiGuiSyntaxHighlightningEnabled" >
+    <widget class="QCheckBox" name="enableSyntaxHighlightningCheckBox" >
      <property name="toolTip" >
       <string>&lt;html>&lt;head>&lt;meta name="qrichtext" content="1" />&lt;/head>&lt;body style=" white-space: pre-wrap; font-family:MS Shell Dlg 2; font-size:8.25pt; font-weight:400; font-style:normal; text-decoration:none;">&lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:MS Shell Dlg; font-size:8pt;">Enables and disables the highlightning of the source&lt;/p>&lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:MS Shell Dlg; font-size:8pt;">code shown below. (Still needs some performance improvements) (Strg+H)&lt;/p>&lt;/body>&lt;/html></string>
      </property>
@@ -63,7 +56,8 @@
       <string>Syntax Highlight</string>
      </property>
      <property name="icon" >
-      <iconset resource="../resources/Icons.qrc" >:/mainWindow/syntax-highlight.png</iconset>
+      <iconset resource="../resources/Icons.qrc" >
+       <normaloff>:/mainWindow/syntax-highlight.png</normaloff>:/mainWindow/syntax-highlight.png</iconset>
      </property>
      <property name="shortcut" >
       <string>Ctrl+H</string>
@@ -71,6 +65,9 @@
      <property name="checked" >
       <bool>true</bool>
      </property>
+     <property name="connectedSettingName" stdset="0" >
+      <string>SyntaxHighlightningEnabled</string>
+     </property>
     </widget>
    </item>
    <item>
@@ -78,7 +75,7 @@
      <property name="orientation" >
       <enum>Qt::Horizontal</enum>
      </property>
-     <property name="sizeHint" >
+     <property name="sizeHint" stdset="0" >
       <size>
        <width>40</width>
        <height>20</height>
@@ -95,7 +92,8 @@
       <string>About</string>
      </property>
      <property name="icon" >
-      <iconset resource="../resources/Icons.qrc" >:/mainWindow/info.png</iconset>
+      <iconset resource="../resources/Icons.qrc" >
+       <normaloff>:/mainWindow/info.png</normaloff>:/mainWindow/info.png</iconset>
      </property>
     </widget>
    </item>
@@ -108,7 +106,8 @@
       <string>Exit</string>
      </property>
      <property name="icon" >
-      <iconset resource="../resources/Icons.qrc" >:/mainWindow/system-log-out.png</iconset>
+      <iconset resource="../resources/Icons.qrc" >
+       <normaloff>:/mainWindow/system-log-out.png</normaloff>:/mainWindow/system-log-out.png</iconset>
      </property>
     </widget>
    </item>
--- a/src/uiguisettings.cpp	Sun Sep 21 20:31:52 2008 +0000
+++ b/src/uiguisettings.cpp	Wed Sep 24 03:32:14 2008 +0000
@@ -19,18 +19,27 @@
 
 #include "uiguisettings.h"
 
+#include "SettingsPaths.h"
+
 //! \defgroup grp_Settings All concerning the settings.
 
 /*!
 	\class UiGuiSettings
     \ingroup grp_Settings
 	\brief Handles the settings of the program. Reads them on startup and saves them on exit.
+    Is a singleton class and can only be accessed via getInstance().
 */
 
+// Inits the single class instance pointer.
+ UiGuiSettings* UiGuiSettings::instance = NULL;
+
 /*!
 	\brief The constructor for the settings.
 */
-UiGuiSettings::UiGuiSettings(bool portableMode, QString globalFilesDirectoryStr) : QObject() {
+UiGuiSettings::UiGuiSettings() : QObject() {
+    portableMode = SettingsPaths::getPortableMode();
+    globalFilesDirectoryStr = SettingsPaths::getGlobalFilesPath();
+    
     // If a "indenters" subdir in the applications binary path exists, use local config files (portable mode)
     if ( portableMode ) {
         qsettings = new QSettings(globalFilesDirectoryStr + "/config/UniversalIndentGUI.ini", QSettings::IniFormat, this);
@@ -40,8 +49,6 @@
         qsettings = new QSettings(QSettings::IniFormat, QSettings::UserScope, QCoreApplication::organizationName(), QCoreApplication::applicationName(), this);
     }
 
-    this->globalFilesDirectoryStr = globalFilesDirectoryStr;
-    this->portableMode = portableMode;
     indenterDirctoryStr = globalFilesDirectoryStr + "/indenters";
 	readAvailableTranslations();
 	loadSettings();
@@ -49,6 +56,27 @@
 
 
 /*!
+    \brief Returns the instance of the settings class. If no instance exists, ONE will be created.
+ */
+UiGuiSettings* UiGuiSettings::getInstance() {
+    if ( instance == NULL ) {
+        // Create the settings object, which loads all UiGui settings from a file.
+    	instance = new UiGuiSettings();
+    }
+
+    return instance;
+}
+
+
+void UiGuiSettings::deleteInstance() {
+    if ( instance != NULL ) {
+        delete instance;
+        instance = NULL;
+    }
+}
+
+
+/*!
     \brief The destructor saves the settings to a file.
  */
 UiGuiSettings::~UiGuiSettings() {
@@ -95,66 +123,91 @@
 /*!
     \brief Extern widgets can connect to this slot to change settings.
 
-    According to the objects name the corresponding setting is known and set.
+    According to the objects property "connectedSettingName" the corresponding
+    setting is known and set.
  */
 void UiGuiSettings::handleValueChangeFromExtern(int value) {
     if ( sender() ) {
-        // Get the objects name and remove "uiGui" from its beginning.
-        QString objectName = sender()->objectName();
-        objectName.remove(0,5);
+        // Get the corresponding setting name from the sender objects property.
+        QString settingName = sender()->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.remove(0,5);
+        }
 
         // Set the value of the setting to the objects value.
-        setValueByName( objectName, value );
+        setValueByName( settingName, value );
     }
 }
 
 
 /*!
-    \brief Extern widgets can connect to this slot to change settings. 
+    \brief Extern widgets can connect to this slot to change settings.
 
-    According to the objects name the corresponding setting is known and set.
+    According to the objects property "connectedSettingName" the corresponding
+    setting is known and set.
  */
 void UiGuiSettings::handleValueChangeFromExtern(bool value) {
     if ( sender() ) {
-        // Get the objects name and remove "uiGui" from its beginning.
-        QString objectName = sender()->objectName();
-        objectName.remove(0,5);
+        // Get the corresponding setting name from the sender objects property.
+        QString settingName = sender()->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.remove(0,5);
+        }
 
         // Set the value of the setting to the objects value.
-        setValueByName( objectName, value );
-    }
-}
-
-/*!
-    \brief Extern widgets can connect to this slot to change settings. 
-
-    According to the objects name the corresponding setting is known and set.
-*/
-void UiGuiSettings::handleValueChangeFromExtern(QDate value) {
-    if ( sender() ) {
-        // Get the objects name and remove "uiGui" from its beginning.
-        QString objectName = sender()->objectName();
-        objectName.remove(0,5);
-
-        // Set the value of the setting to the objects value.
-        setValueByName( objectName, value );
+        setValueByName( settingName, value );
     }
 }
 
 
 /*!
-    \brief Extern widgets can connect to this slot to change settings. 
+    \brief Extern widgets can connect to this slot to change settings.
 
-    According to the objects name the corresponding setting is known and set.
-*/
+    According to the objects property "connectedSettingName" the corresponding
+    setting is known and set.
+ */
+void UiGuiSettings::handleValueChangeFromExtern(QDate value) {
+    if ( sender() ) {
+        // Get the corresponding setting name from the sender objects property.
+        QString settingName = sender()->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.remove(0,5);
+        }
+
+        // Set the value of the setting to the objects value.
+        setValueByName( settingName, value );
+    }
+}
+
+
+/*!
+    \brief Extern widgets can connect to this slot to change settings.
+
+    According to the objects property "connectedSettingName" the corresponding
+    setting is known and set.
+ */
 void UiGuiSettings::handleValueChangeFromExtern(QByteArray value) {
     if ( sender() ) {
-        // Get the objects name and remove "uiGui" from its beginning.
-        QString objectName = sender()->objectName();
-        objectName.remove(0,5);
+        // Get the corresponding setting name from the sender objects property.
+        QString settingName = sender()->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.remove(0,5);
+        }
 
         // Set the value of the setting to the objects value.
-        setValueByName( objectName, value );
+        setValueByName( settingName, value );
     }
 }
 
@@ -196,7 +249,7 @@
     else if ( settingName == "RecentlyOpenedListSize" ) emit recentlyOpenedListSize( settings[settingName].toInt() );
     else if ( settingName == "LoadLastOpenedFileOnStartup" ) emit loadLastOpenedFileOnStartup( settings[settingName].toBool() );
     else if ( settingName == "LastOpenedFiles" ) emit lastOpenedFiles( settings[settingName].toString() );
-    else if ( settingName == "LastSelectedIndenterID" ) emit lastSelectedIndenterID( settings[settingName].toInt() );
+    else if ( settingName == "SelectedIndenter" ) emit selectedIndenter( settings[settingName].toInt() );
     else if ( settingName == "SyntaxHighlightningEnabled" ) emit syntaxHighlightningEnabled( settings[settingName].toBool() );
     else if ( settingName == "WhiteSpaceIsVisible" ) emit whiteSpaceIsVisible( settings[settingName].toBool() );
     else if ( settingName == "IndenterParameterTooltipsEnabled" ) emit indenterParameterTooltipsEnabled( settings[settingName].toBool() );
@@ -214,7 +267,7 @@
         emit recentlyOpenedListSize( settings["RecentlyOpenedListSize"].toInt() );
         emit loadLastOpenedFileOnStartup( settings["LoadLastOpenedFileOnStartup"].toBool() );
         emit lastOpenedFiles( settings["LastOpenedFiles"].toString() );
-        emit lastSelectedIndenterID( settings["LastSelectedIndenterID"].toInt() );
+        emit selectedIndenter( settings["SelectedIndenter"].toInt() );
         emit syntaxHighlightningEnabled( settings["SyntaxHighlightningEnabled"].toBool() );
         emit whiteSpaceIsVisible( settings["WhiteSpaceIsVisible"].toBool() );
         emit indenterParameterTooltipsEnabled( settings["IndenterParameterTooltipsEnabled"].toBool() );
@@ -277,11 +330,11 @@
 	settings["LastOpenedFiles"] = qsettings->value("UniversalIndentGUI/lastSourceCodeFile", indenterDirctoryStr+"/example.cpp").toString();
 
 	// Read last selected indenter from the settings file.
-	int LastSelectedIndenterID = qsettings->value("UniversalIndentGUI/lastSelectedIndenter", 0).toInt();
-	if ( LastSelectedIndenterID < 0 ) {
-		LastSelectedIndenterID = 0;
+	int SelectedIndenter = qsettings->value("UniversalIndentGUI/selectedIndenter", 0).toInt();
+	if ( SelectedIndenter < 0 ) {
+		SelectedIndenter = 0;
 	}
-	settings["LastSelectedIndenterID"] = LastSelectedIndenterID;
+	settings["SelectedIndenter"] = SelectedIndenter;
 
     // Read if syntax highlighting is enabled.
 	settings["SyntaxHighlightningEnabled"] = qsettings->value("UniversalIndentGUI/SyntaxHighlightningEnabled", true).toBool();
@@ -318,7 +371,7 @@
 	qsettings->setValue( "UniversalIndentGUI/recentlyOpenedListSize", settings["RecentlyOpenedListSize"] );
     qsettings->setValue( "UniversalIndentGUI/lastSourceCodeFile", settings["LastOpenedFiles"] );
 	qsettings->setValue( "UniversalIndentGUI/loadLastSourceCodeFileOnStartup", settings["LoadLastOpenedFileOnStartup"] );
-    qsettings->setValue( "UniversalIndentGUI/lastSelectedIndenter", settings["LastSelectedIndenterID"] );
+    qsettings->setValue( "UniversalIndentGUI/selectedIndenter", settings["SelectedIndenter"] );
     qsettings->setValue( "UniversalIndentGUI/indenterParameterTooltipsEnabled", settings["IndenterParameterTooltipsEnabled"] );
     qsettings->setValue( "UniversalIndentGUI/language", availableTranslations[ settings["Language"].toInt() ] );
 	qsettings->setValue( "UniversalIndentGUI/encoding", settings["FileEncoding"] );
--- a/src/uiguisettings.h	Sun Sep 21 20:31:52 2008 +0000
+++ b/src/uiguisettings.h	Wed Sep 24 03:32:14 2008 +0000
@@ -33,10 +33,14 @@
 class UiGuiSettings : public QObject
 {
 	Q_OBJECT
+private:
+    UiGuiSettings();
+    static UiGuiSettings* instance;
 
 public:
-	UiGuiSettings(bool portableMode, QString globalFilesDirectoryStr);
-    virtual ~UiGuiSettings();
+	static UiGuiSettings* getInstance();
+    static void deleteInstance();
+    ~UiGuiSettings();
     bool loadSettings();
     bool saveSettings();
     bool setValueByName(QString settingName, QVariant value);
@@ -62,7 +66,7 @@
     void recentlyOpenedListSize(int value);
     void loadLastOpenedFileOnStartup(bool value);
     void lastOpenedFiles(QString value);
-    void lastSelectedIndenterID(int value);
+    void selectedIndenter(int value);
     void syntaxHighlightningEnabled(bool value);
     void whiteSpaceIsVisible(bool value);
     void indenterParameterTooltipsEnabled(bool value);
--- a/src/uiguisettingsdialog.cpp	Sun Sep 21 20:31:52 2008 +0000
+++ b/src/uiguisettingsdialog.cpp	Wed Sep 24 03:32:14 2008 +0000
@@ -54,6 +54,7 @@
 	initTranslationSelection();
 }
 
+
 /*!
 	\brief By calling this function the combobox for selecting the application language will
 	be initialized. 
@@ -100,34 +101,49 @@
 int UiGuiSettingsDialog::showDialog() {
     // Get the values for the check boxes from 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 sender objects property.
+        QString settingName = sender()->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.remove(0,5);
+        }
 
         // Get value from settings and assign it to the checkbox.
-        bool value = settings->getValueByName( objectName ).toBool();
+        bool value = settings->getValueByName( settingName ).toBool();
         checkBox->setChecked(value);
     }
 
     // Get the values for the spin boxes from 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 sender objects property.
+        QString settingName = sender()->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.remove(0,5);
+        }
 
         // Get value from settings and assign it to the checkbox.
-        int value = settings->getValueByName( objectName ).toInt();
+        int value = settings->getValueByName( settingName ).toInt();
         spinBox->setValue(value);
     }
 
     // Get the values for the combo boxes from 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 sender objects property.
+        QString settingName = sender()->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.remove(0,5);
+        }
 
         // Get value from settings and assign it to the checkbox.
-        int value = settings->getValueByName( objectName ).toInt();
+        int value = settings->getValueByName( settingName ).toInt();
         comboBox->setCurrentIndex(value);
     }