diff options
-rw-r--r-- | src/CMakeLists.txt | 2 | ||||
-rw-r--r-- | src/MainWindow.cpp | 110 | ||||
-rw-r--r-- | src/MainWindow.h | 13 | ||||
-rwxr-xr-x | src/MainWindowBase.ui | 21 | ||||
-rwxr-xr-x | src/ToolBarWidget.ui | 116 | ||||
-rwxr-xr-x | src/__TODO/MainWindow.ui | 25 | ||||
-rwxr-xr-x | src/__TODO/ToolBarWidget.ui | 124 | ||||
-rwxr-xr-x | src/__TODO/UiGuiSettingsDialog.ui | 2 |
8 files changed, 203 insertions, 210 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index a911d9c..19c34a8 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -26,7 +26,7 @@ link_directories( set( target universal-indent-gui-tqt ) set( ${target}_SRCS - MainWindowBase.ui MainWindow.cpp main.cpp + MainWindowBase.ui ToolBarWidget.ui MainWindow.cpp main.cpp UiGuiVersion.cpp ) diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp index c3c6f1c..2d730ac 100644 --- a/src/MainWindow.cpp +++ b/src/MainWindow.cpp @@ -24,7 +24,7 @@ ///-- #include "debugging/TSLogger.h" ///-- #include "SettingsPaths.h" ///-- -///-- #include "ui_ToolBarWidget.h" +#include "ToolBarWidget.h" ///-- #include "AboutDialog.h" ///-- #include "AboutDialogGraphicsView.h" ///-- #include "UiGuiSettings.h" @@ -34,7 +34,9 @@ ///-- #include <tqpixmap.h> #include <tqaction.h> +#include <tqcheckbox.h> #include <tqpopupmenu.h> +#include <tqpushbutton.h> ///-- #include <tqwidget.h> ///-- #include <tqlabel.h> ///-- #include <tqstring.h> @@ -93,13 +95,13 @@ MainWindow::MainWindow(TQString file2OpenOnStart, TQWidget *parent) : ///-- ///-- // Initialize the language of the application. ///-- initApplicationLanguage(); -///-- -///-- // Creates the main window and initializes it. - initMainWindow(); -///-- -///-- // Create toolbar and insert it into the main window. -///-- initToolBar(); -///-- + + // Creates the main window and initializes it. + initMainWindow(); + + // Create toolbar and insert it into the main window. + initToolBar(); + ///-- // Create the text edit component using the TQScintilla widget. ///-- initTextEditor(); ///-- @@ -117,7 +119,6 @@ MainWindow::MainWindow(TQString file2OpenOnStart, TQWidget *parent) : ///-- // Generate about dialog box ///-- _aboutDialog = new AboutDialog(this, TQt::SplashScreen); ///-- _aboutDialogGraphicsView = new AboutDialogGraphicsView(_aboutDialog, this); -///-- connect(_toolBarWidget->pbAbout, SIGNAL(clicked()), this, SLOT(showAboutDialog())); connect(actionAboutUniversalIndentGUITQt, SIGNAL(activated()), this, SLOT(showAboutDialog())); ///-- ///-- // Generate settings dialog box @@ -148,7 +149,7 @@ MainWindow::MainWindow(TQString file2OpenOnStart, TQWidget *parent) : ///-- */ void MainWindow::initMainWindow() { - // Setup icons + // For icon setup TQString ICONS_PATH(APP_ICONS_PATH); // Application icon setIcon(TQPixmap(ICONS_PATH + "universalIndentGUI_64x64.png")); @@ -238,33 +239,40 @@ void MainWindow::initMainWindow() ///-- _settings->registerObjectSlot(this, "updateRecentlyOpenedList()", "recentlyOpenedListSize"); } -///-- /*! -///-- \brief Creates and inits the tool bar. It is added to the main window. -///-- */ -///-- void MainWindow::initToolBar() -///-- { -///-- // Create the tool bar and add it to the main window. -///-- _toolBarWidget = new Ui::ToolBarWidget(); -///-- TQWidget *helpWidget = new TQWidget(); -///-- _toolBarWidget->setupUi(helpWidget); -///-- _mainWindowForm->toolBar->addWidget(helpWidget); -///-- _mainWindowForm->toolBar->setAllowedAreas(TQt::TopToolBarArea | TQt::BottomToolBarArea); -///-- -///-- // Connect the tool bar widgets to their functions. -///-- _settings->registerObjectProperty(_toolBarWidget->enableSyntaxHighlightningCheckBox, "checked", +/*! + \brief Creates and inits the tool bar. It is added to the main window. + */ +void MainWindow::initToolBar() +{ + // For icon setup + TQString ICONS_PATH(APP_ICONS_PATH); + + // Create the tool bar and add it to the main window. + m_toolBarWidget = new ToolBarWidget(toolBar); + + // Connect the tool bar widgets to their functions. +///-- _settings->registerObjectProperty(_toolBarWidget->cbEnableSyntaxHL, "checked", ///-- "SyntaxHighlightingEnabled"); -///-- _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))); -///-- connect(_toolBarWidget->cbLivePreview, SIGNAL(toggled( -///-- bool)), actionLiveIndentPreview, SLOT(setChecked(bool))); + m_toolBarWidget->cbEnableSyntaxHL->hide(); + + m_toolBarWidget->pbOpenSourceFile->setIconSet(TQPixmap(ICONS_PATH + "document-open.png")); + connect(m_toolBarWidget->pbOpenSourceFile, SIGNAL(clicked()), this, SLOT(openSourceFileDialog())); + + m_toolBarWidget->pbAbout->setIconSet(TQPixmap(ICONS_PATH + "info.png")); + connect(m_toolBarWidget->pbAbout, SIGNAL(clicked()), this, SLOT(showAboutDialog())); + + m_toolBarWidget->pbExit->setIconSet(TQPixmap(ICONS_PATH + "system-log-out.png")); + connect(m_toolBarWidget->pbExit, SIGNAL(clicked()), this, SLOT(close())); + + // Settings a pixmap hides the text in TQt3 + //m_toolBarWidget->cbLivePreview->setPixmap(TQPixmap(ICONS_PATH + "live-preview.png")); + connect(m_toolBarWidget->cbLivePreview, SIGNAL(toggled(bool)), this, SLOT(previewTurnedOnOff(bool))); + connect(m_toolBarWidget->cbLivePreview, SIGNAL(toggled(bool)), + actionLiveIndentPreview, SLOT(setChecked(bool))); ///-- connect(actionLiveIndentPreview, SIGNAL(toggled( -///-- bool)), _toolBarWidget->cbLivePreview, SLOT(setChecked(bool))); -///-- } -///-- +///-- bool)), m_toolBarWidget->cbLivePreview, SLOT(setChecked(bool))); +} + ///-- /*! ///-- \brief Create and initialize the text editor component. It uses the TQScintilla widget. ///-- */ @@ -503,7 +511,7 @@ void MainWindow::openSourceFileDialog(TQString fileName) ///-- ///-- openedSourceFileContent = loadFile(fileName); ///-- _sourceFileContent = openedSourceFileContent; -///-- if (_toolBarWidget->cbLivePreview->isChecked()) +///-- if (m_toolBarWidget->cbLivePreview->isChecked()) ///-- { ///-- callIndenter(); ///-- } @@ -636,7 +644,7 @@ bool MainWindow::saveSourceFile() ///-- { ///-- _textEditLastScrollPos = _textEditVScrollBar->value(); ///-- -///-- if (_toolBarWidget->cbLivePreview->isChecked()) +///-- if (m_toolBarWidget->cbLivePreview->isChecked()) ///-- { ///-- _sourceViewContent = _sourceFormattedContent; ///-- } @@ -745,7 +753,7 @@ bool MainWindow::saveSourceFile() ///-- } ///-- ///-- // Call the indenter to reformat the text. -///-- if (_toolBarWidget->cbLivePreview->isChecked()) +///-- if (m_toolBarWidget->cbLivePreview->isChecked()) ///-- { ///-- callIndenter(); ///-- _previewToggled = true; @@ -754,7 +762,7 @@ bool MainWindow::saveSourceFile() ///-- // Update the text editor. ///-- updateSourceView(); ///-- -///-- if (_toolBarWidget->cbLivePreview->isChecked() && !enteredCharacter.isNull() && +///-- if (m_toolBarWidget->cbLivePreview->isChecked() && !enteredCharacter.isNull() && ///-- enteredCharacter != 10) ///-- { ///-- //const char ch = enteredCharacter.toAscii(); @@ -832,7 +840,7 @@ bool MainWindow::saveSourceFile() ///-- _qSciSourceCodeEditor->setCursorPosition(cursorLine, cursorPos); ///-- } ///-- -///-- if (_toolBarWidget->cbLivePreview->isChecked()) +///-- if (m_toolBarWidget->cbLivePreview->isChecked()) ///-- { ///-- _sourceCodeChanged = false; ///-- } @@ -866,7 +874,7 @@ bool MainWindow::saveSourceFile() ///-- int cursorLine, cursorPos; ///-- _qSciSourceCodeEditor->getCursorPosition(&cursorLine, &cursorPos); ///-- -///-- if (_toolBarWidget->cbLivePreview->isChecked()) +///-- if (m_toolBarWidget->cbLivePreview->isChecked()) ///-- { ///-- callIndenter(); ///-- _previewToggled = true; @@ -901,15 +909,15 @@ bool MainWindow::saveSourceFile() ///-- setWindowModified(true); ///-- } ///-- } -///-- -///-- /*! -///-- \brief This slot is called whenever the preview button is turned on or off. -///-- -///-- It calls the selected indenter to format the current source code if -///-- the code has been changed since the last indenter call. -///-- */ -///-- void MainWindow::previewTurnedOnOff(bool turnOn) -///-- { + +/*! + \brief This slot is called whenever the preview button is turned on or off. + + It calls the selected indenter to format the current source code if + the code has been changed since the last indenter call. + */ +void MainWindow::previewTurnedOnOff(bool turnOn) +{ ///-- _previewToggled = true; ///-- ///-- int cursorLine, cursorPos; @@ -953,7 +961,7 @@ bool MainWindow::saveSourceFile() ///-- { ///-- this->setWindowTitle("UniversalIndentGUI " + TQString( ///-- PROGRAM_VERSION_STRING) + " [*]" + _currentSourceFile); -///-- } +} /*! \brief Opens a dialog to save the current source code as a PDF document. diff --git a/src/MainWindow.h b/src/MainWindow.h index 663d161..103b26c 100644 --- a/src/MainWindow.h +++ b/src/MainWindow.h @@ -29,11 +29,8 @@ /// class AboutDialog; /// class AboutDialogGraphicsView; /// class UiGuiHighlighter; -/// class IndentHandler; -/// namespace Ui -/// { -/// class ToolBarWidget; -/// } +/// class IndentHandler +class ToolBarWidget; /// /// class TQLabel; /// class TQScrollBar; @@ -72,7 +69,7 @@ class MainWindow : public MainWindowBase ///-- void sourceCodeChangedHelperSlot(); ///-- void sourceCodeChangedSlot(); ///-- void indentSettingsChangedSlot(); -///-- void previewTurnedOnOff(bool turnOn); + void previewTurnedOnOff(bool turnOn); void exportToPDF(); void exportToHTML(); ///-- void languageChanged(int languageIndex); @@ -95,7 +92,7 @@ class MainWindow : public MainWindowBase ///-- void createHighlighterMenu(); ///-- bool initApplicationLanguage(); void initMainWindow(); -///-- void initToolBar(); + void initToolBar(); ///-- void initTextEditor(); ///-- void initSyntaxHighlighter(); ///-- void initIndenter(); @@ -135,7 +132,7 @@ class MainWindow : public MainWindowBase ///-- bool _previewToggled; ///-- TQStringList _encodingsList; ///-- -///-- Ui::ToolBarWidget *_toolBarWidget; + ToolBarWidget *m_toolBarWidget; ///-- IndentHandler *_indentHandler; ///-- TQLabel *_textEditLineColumnInfoLabel; }; diff --git a/src/MainWindowBase.ui b/src/MainWindowBase.ui index 56256f0..c5e124f 100755 --- a/src/MainWindowBase.ui +++ b/src/MainWindowBase.ui @@ -80,6 +80,27 @@ <action name="actionAboutUniversalIndentGUITQt"/> </item> </menubar> + <toolbars> + <toolbar dock="2"> + <property name="name"> + <cstring>toolBar</cstring> + </property> + <property name="label"> + <string>Tools</string> + </property> + <property name="orientation"> + <enum>TQt::Horizontal</enum> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>1</horstretch> + <verstretch>1</verstretch> + </sizepolicy> + </property> + </toolbar> + </toolbars> <actions> <action> <property name="name"> diff --git a/src/ToolBarWidget.ui b/src/ToolBarWidget.ui new file mode 100755 index 0000000..19f3259 --- /dev/null +++ b/src/ToolBarWidget.ui @@ -0,0 +1,116 @@ +<!DOCTYPE UI><UI version="3.2" stdsetdef="1"> + <class>ToolBarWidget</class> + <widget class="TQWidget"> + <property name="name"> + <cstring>ToolBarWidget</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>773</width> + <height>34</height> + </rect> + </property> + <property name="caption"> + <string>Form</string> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="spacing"> + <number>6</number> + </property> + <property name="margin"> + <number>0</number> + </property> + <widget class="TQPushButton"> + <property name="name"> + <cstring>pbOpenSourceFile</cstring> + </property> + <property name="text"> + <string>Open Source File </string> + </property> + <property name="toolTip" stdset="0"> + <string>Opens a dialog for selecting a source code file</string> + </property> + </widget> + <widget class="TQCheckBox"> + <property name="name"> + <cstring>cbLivePreview</cstring> + </property> + <property name="text"> + <string>Live Indent Preview</string> + </property> + <property name="whatsThis" stdset="0"> + <string>Turns the preview of the reformatted source code on and off</string> + </property> + <property name="accel"> + <string>Ctrl+L</string> + </property> + </widget> + <widget class="TQCheckBox"> + <property name="name"> + <cstring>cbEnableSyntaxHL</cstring> + </property> + <property name="text"> + <string>Syntax Highlight</string> + </property> + <property name="whatsThis" stdset="0"> + <string>Enables and disables the highlightning of the source</string> + </property> + <property name="accel"> + <string>Ctrl+H</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>spacer1</cstring> + </property> + <property name="orientation"> + <enum>TQt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>2000</width> + <height>20</height> + </size> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>1</horstretch> + <verstretch>1</verstretch> + </sizepolicy> + </property> + </spacer> + <widget class="TQPushButton"> + <property name="name"> + <cstring>pbAbout</cstring> + </property> + <property name="text"> + <string>About</string> + </property> + <property name="toolTip" stdset="0"> + <string>Shows info about UniversalIndentGUI</string> + </property> + </widget> + <widget class="TQPushButton"> + <property name="name"> + <cstring>pbExit</cstring> + </property> + <property name="text"> + <string>Exit</string> + </property> + <property name="toolTip" stdset="0"> + <string>Quits UniversalIndentGUI</string> + </property> + </widget> + </hbox> + </widget> +</UI> diff --git a/src/__TODO/MainWindow.ui b/src/__TODO/MainWindow.ui index c7514a3..9ac95b1 100755 --- a/src/__TODO/MainWindow.ui +++ b/src/__TODO/MainWindow.ui @@ -92,31 +92,6 @@ <bool>false</bool> </attribute> </widget> - <action name="actionSave_Source_File"> - </action> - <action name="actionSave_Source_File_As"> - <property name="icon"> - <iconset resource="../resources/Icons.qrc"> - <normaloff>:/mainWindow/document-save-as.png</normaloff>:/mainWindow/document-save-as.png</iconset> - </property> - <property name="text"> - <string>Save Source File As...</string> - </property> - <property name="iconText"> - <string>Save Source File As...</string> - </property> - <property name="toolTip"> - <string>Save Source File As...</string> - </property> - <property name="statusTip"> - <string>Opens a file dialog to save the currently shown source code.</string> - </property> - <property name="shortcut"> - <string>Ctrl+Shift+S</string> - </property> - </action> - <action name="actionClear_Recently_Opened_List"> - </action> </widget> <resources> <include location="../resources/Icons.qrc"/> diff --git a/src/__TODO/ToolBarWidget.ui b/src/__TODO/ToolBarWidget.ui deleted file mode 100755 index 8665cac..0000000 --- a/src/__TODO/ToolBarWidget.ui +++ /dev/null @@ -1,124 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<ui version="4.0"> - <class>ToolBarWidget</class> - <widget class="TQWidget" name="ToolBarWidget"> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>773</width> - <height>34</height> - </rect> - </property> - <property name="windowTitle"> - <string>Form</string> - </property> - <layout class="TQHBoxLayout"> - <property name="spacing"> - <number>6</number> - </property> - <property name="margin"> - <number>0</number> - </property> - <item> - <widget class="TQPushButton" name="pbOpen_Source_File"> - <property name="toolTip"> - <string><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;"><span style=" font-size:8pt;">Opens a dialog for selecting a source code file.</span></p><p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:8pt;">This file will be used to show what the indent tool changes.</p></body></html></string> - </property> - <property name="text"> - <string>Open Source File </string> - </property> - <property name="icon"> - <iconset resource="../resources/Icons.qrc"> - <normaloff>:/mainWindow/document-open.png</normaloff>:/mainWindow/document-open.png</iconset> - </property> - </widget> - </item> - <item> - <widget class="TQCheckBox" name="cbLivePreview"> - <property name="toolTip"> - <string><html><head><meta name="qrichtext" content="1" /></head><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;"><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;">Turns the preview of the reformatted source code on and off.</p><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;">In other words it switches between formatted and nonformatted code. (Ctrl+L)</p></body></html></string> - </property> - <property name="text"> - <string>Live Indent Preview</string> - </property> - <property name="icon"> - <iconset resource="../resources/Icons.qrc"> - <normaloff>:/mainWindow/live-preview.png</normaloff>:/mainWindow/live-preview.png</iconset> - </property> - <property name="shortcut"> - <string>Ctrl+L</string> - </property> - </widget> - </item> - <item> - <widget class="TQCheckBox" name="enableSyntaxHighlightningCheckBox"> - <property name="toolTip"> - <string><html><head><meta name="qrichtext" content="1" /></head><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;"><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</p><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) (Ctrl+H)</p></body></html></string> - </property> - <property name="text"> - <string>Syntax Highlight</string> - </property> - <property name="icon"> - <iconset resource="../resources/Icons.qrc"> - <normaloff>:/mainWindow/syntax-highlight.png</normaloff>:/mainWindow/syntax-highlight.png</iconset> - </property> - <property name="shortcut"> - <string>Ctrl+H</string> - </property> - <property name="checked"> - <bool>true</bool> - </property> - <property name="connectedSettingName" stdset="0"> - <string>DONOTTRANSLATE:SyntaxHighlightingEnabled</string> - </property> - </widget> - </item> - <item> - <spacer> - <property name="orientation"> - <enum>TQt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - <item> - <widget class="TQPushButton" name="pbAbout"> - <property name="toolTip"> - <string><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 info about UniversalIndentGUI</p></body></html></string> - </property> - <property name="text"> - <string>About</string> - </property> - <property name="icon"> - <iconset resource="../resources/Icons.qrc"> - <normaloff>:/mainWindow/info.png</normaloff>:/mainWindow/info.png</iconset> - </property> - </widget> - </item> - <item> - <widget class="TQPushButton" name="pbExit"> - <property name="toolTip"> - <string><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;">Quits the UniversalIndentGUI</p></body></html></string> - </property> - <property name="text"> - <string>Exit</string> - </property> - <property name="icon"> - <iconset resource="../resources/Icons.qrc"> - <normaloff>:/mainWindow/system-log-out.png</normaloff>:/mainWindow/system-log-out.png</iconset> - </property> - </widget> - </item> - </layout> - </widget> - <resources> - <include location="../resources/Icons.qrc"/> - </resources> - <connections/> -</ui> diff --git a/src/__TODO/UiGuiSettingsDialog.ui b/src/__TODO/UiGuiSettingsDialog.ui index 88ed6be..e9f3af6 100755 --- a/src/__TODO/UiGuiSettingsDialog.ui +++ b/src/__TODO/UiGuiSettingsDialog.ui @@ -294,7 +294,7 @@ </attribute> <layout class="TQVBoxLayout"> <item> - <widget class="TQCheckBox" name="enableSyntaxHighlightningCheckBox"> + <widget class="TQCheckBox" name="cbEnableSyntaxHL"> <property name="toolTip"> <string>By enabling special key words of the source code are highlighted.</string> </property> |