diff options
-rw-r--r-- | src/CMakeLists.txt | 2 | ||||
-rw-r--r-- | src/IndentHandler.cpp | 3 | ||||
-rw-r--r-- | src/IndentHandler.h | 41 | ||||
-rw-r--r-- | src/MainWindow.cpp | 14 | ||||
-rw-r--r-- | src/MainWindow.h | 8 | ||||
-rwxr-xr-x | src/MainWindowBase.ui | 16 | ||||
-rw-r--r-- | src/UiGuiInfoDialog.cpp | 67 | ||||
-rw-r--r-- | src/UiGuiInfoDialog.h | 40 | ||||
-rwxr-xr-x | src/UiGuiInfoDialogBase.ui | 310 |
9 files changed, 475 insertions, 26 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index b0db1b9..64c5ed2 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -27,6 +27,7 @@ set( ${target}_SRCS AboutDialogBase.ui MainWindowBase.ui ToolBarWidget.ui + UiGuiInfoDialogBase.ui UiGuiSettingsDialogBase.ui main.cpp @@ -35,6 +36,7 @@ set( ${target}_SRCS TemplateBatchScript.cpp UiGuiErrorMessage.cpp UiGuiHighlighter.cpp + UiGuiInfoDialog.cpp UiGuiIniFileParser.cpp UiGuiSettings.cpp diff --git a/src/IndentHandler.cpp b/src/IndentHandler.cpp index f7508e3..3fdb9b6 100644 --- a/src/IndentHandler.cpp +++ b/src/IndentHandler.cpp @@ -130,6 +130,7 @@ IndentHandler::IndentHandler(int indenterID, MainWindow *mainWindow, TQWidget *p TQSizePolicy::Expanding); m_toolBoxContainerLayout->addWidget(m_indenterParameterCategoriesToolBox); + m_indenterConfigFilename = ""; m_indenterExecutableCallString = ""; m_indenterExecutableSuffix = ""; @@ -594,6 +595,8 @@ bool IndentHandler::loadConfigFile(const TQString &filePathName) cfgFile.close(); } + m_indenterConfigFilename = filePathName; + // Search for name of each boolean parameter and set its value if found. for (const ParamBoolean &pBoolean : m_paramBooleans) { diff --git a/src/IndentHandler.h b/src/IndentHandler.h index dfeb41e..7282df3 100644 --- a/src/IndentHandler.h +++ b/src/IndentHandler.h @@ -143,32 +143,35 @@ class IndentHandler : public TQWidget UiGuiIniFileParser *m_indenterSettings; TQStringList m_indenterParameters; // The indenters name in a descriptive form - TQString m_indenterName; + TQString m_indenterName; + TQString m_indenterConfigFilename; // The indenters file name (w/o extension), that is being called - TQString m_indenterFileName; - TQString m_indenterDirectoryStr; - TQString m_tempDirectoryStr; - TQString m_settingsDirectoryStr; - TQStringList m_indenterIniFileList; - TQString m_globalConfigFilename; - TQString m_cfgFileParameterEnding; - TQString m_parameterOrder; - TQString m_inputFileParameter; - TQString m_inputFileName; - TQString m_outputFileParameter; - TQString m_outputFileName; - TQString m_fileTypes; - TQString m_useCfgFileParameter; - TQString m_indenterShowHelpParameter; + TQString m_indenterFileName; + TQString m_indenterDirectoryStr; + TQString m_tempDirectoryStr; + TQString m_settingsDirectoryStr; + TQStringList m_indenterIniFileList; + TQString m_globalConfigFilename; + TQString m_cfgFileParameterEnding; + TQString m_parameterOrder; + TQString m_inputFileParameter; + TQString m_inputFileName; + TQString m_outputFileParameter; + TQString m_outputFileName; + TQString m_fileTypes; + TQString m_useCfgFileParameter; + TQString m_indenterShowHelpParameter; MainWindow *m_mainWindow; TQWidget *m_parent; UiGuiErrorMessage *m_errorMessageDialog; - TQString m_indenterExecutableCallString; - TQString m_indenterExecutableSuffix; - bool m_indenterProcessFinished; + TQString m_indenterExecutableCallString; + TQString m_indenterExecutableSuffix; + bool m_indenterProcessFinished; //TODO: This function should go into a string helper/tool class/file. TQString encodeToHTML(const TQString &text); + + friend class UiGuiInfoDialog; }; #endif // INDENTHANDLER_H diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp index a00bb52..aa9a14b 100644 --- a/src/MainWindow.cpp +++ b/src/MainWindow.cpp @@ -25,6 +25,7 @@ #include "AboutDialog.h" #include "IndentHandler.h" #include "SettingsPaths.h" +#include "UiGuiInfoDialog.h" #include "UiGuiSettings.h" #include "UiGuiSettingsDialog.h" #include "UiGuiVersion.h" @@ -71,7 +72,7 @@ MainWindow::MainWindow(TQString file2OpenOnStart, TQWidget *parent) : MainWindowBase(parent), m_aboutDialog(nullptr), m_qSciSourceCodeEditor(nullptr), m_uiGuiTranslator(nullptr), m_textEditLineColumnInfoLabel(nullptr), m_oldLinesNumber(0), m_openEncodingActions(), m_saveEncodingActions(), - m_encodingActionGroup(nullptr), m_saveEncodedActionGroup(nullptr), + m_encodingActionGroup(nullptr), m_saveEncodedActionGroup(nullptr), m_infoDialog(nullptr), m_highlighterActionGroup(nullptr), m_documentModified(false), m_previewToggled(true), m_indentHandler(nullptr), m_centralSplitter(nullptr), m_settingsDialog(nullptr), m_highlighter(nullptr), m_highlightingActions(), m_toolBarWidget(nullptr) @@ -109,9 +110,13 @@ MainWindow::MainWindow(TQString file2OpenOnStart, TQWidget *parent) : m_aboutDialog = new AboutDialog(this); connect(actionAboutUniversalIndentGUITQt, TQ_SIGNAL(activated()), this, TQ_SLOT(showAboutDialog())); + // Generate info dialog box + m_infoDialog = new UiGuiInfoDialog(this, m_indentHandler); + connect(actionShowInfo, TQ_SIGNAL(activated()), m_infoDialog, TQ_SLOT(showDialog())); + // Generate settings dialog box - m_settingsDialog = new UiGuiSettingsDialog(this, m_settings); - connect(actionShowSettings, TQ_SIGNAL(activated()), m_settingsDialog, TQ_SLOT(showDialog())); + m_settingsDialog = new UiGuiSettingsDialog(this, m_settings); + connect(actionShowSettings, TQ_SIGNAL(activated()), m_settingsDialog, TQ_SLOT(showDialog())); if (TQFile::exists(file2OpenOnStart)) { @@ -132,8 +137,6 @@ MainWindow::MainWindow(TQString file2OpenOnStart, TQWidget *parent) : MainWindow::~MainWindow() { - delete m_settingsDialog; - delete m_aboutDialog; UiGuiSettings::deleteInstance(); } @@ -158,6 +161,7 @@ void MainWindow::initMainWindow() actionMenuExport->setIconSet(TQPixmap(ICONS_PATH + "exporthtml.png")); actionExportPDF->setIconSet(TQPixmap(ICONS_PATH + "exportpdf.png")); actionExportHTML->setIconSet(TQPixmap(ICONS_PATH + "exporthtml.png")); + actionShowInfo->setIconSet(TQPixmap(ICONS_PATH + "info.png")); actionExit->setIconSet(TQPixmap(ICONS_PATH + "system-log-out.png")); // - Indenter menu actionLoadIndenterConfigFile->setIconSet(TQPixmap(ICONS_PATH + "load_indent_cfg.png")); diff --git a/src/MainWindow.h b/src/MainWindow.h index 8ff6da6..bb8ea10 100644 --- a/src/MainWindow.h +++ b/src/MainWindow.h @@ -26,11 +26,12 @@ class AboutDialog; -class UiGuiHighlighter; class IndentHandler; +class ToolBarWidget; +class UiGuiHighlighter; +class UiGuiInfoDialog; class UiGuiSettings; class UiGuiSettingsDialog; -class ToolBarWidget; class TQextScintilla; class TQLabel; @@ -108,6 +109,7 @@ class MainWindow : public MainWindowBase UiGuiHighlighter *m_highlighter; ///-- TQScrollBar *m_textEditVScrollBar; AboutDialog *m_aboutDialog; + UiGuiInfoDialog *m_infoDialog; UiGuiSettingsDialog *m_settingsDialog; int m_actionClearRecentlyOpenedListId; int m_recentlyOpenedListMaxSize; @@ -135,6 +137,8 @@ class MainWindow : public MainWindowBase ToolBarWidget *m_toolBarWidget; IndentHandler *m_indentHandler; TQLabel *m_textEditLineColumnInfoLabel; + + friend class UiGuiInfoDialog; }; #endif // MAINWINDOW_H diff --git a/src/MainWindowBase.ui b/src/MainWindowBase.ui index 229d41a..5856811 100755 --- a/src/MainWindowBase.ui +++ b/src/MainWindowBase.ui @@ -41,6 +41,8 @@ <action name="actionMenuSaveEncoded"/> <item text="Save Source File As with other Encoding" name="popupMenuSaveEncoded"/> <separator/> + <action name="actionShowInfo"/> + <separator/> <action name="actionExit" /> </item> <item text="&Indenter" name="menuIndenter"> @@ -206,6 +208,20 @@ </action> <action> <property name="name"> + <cstring>actionShowInfo</cstring> + </property> + <property name="text"> + <string>Show file and path info</string> + </property> + <property name="statusTip"> + <string>Opens a window showing some info about the current open file and paths.</string> + </property> + <property name="accel"> + <string>Ctrl+I</string> + </property> + </action> + <action> + <property name="name"> <cstring>actionExit</cstring> </property> <property name="text"> diff --git a/src/UiGuiInfoDialog.cpp b/src/UiGuiInfoDialog.cpp new file mode 100644 index 0000000..4c05d7a --- /dev/null +++ b/src/UiGuiInfoDialog.cpp @@ -0,0 +1,67 @@ +/*************************************************************************** +* This program is free software; you can redistribute it and/or modify * +* it under the terms of the GNU General Public License version 2.0 as * +* published by the Free Software Foundation. * +* * +* This program is distributed in the hope that it will be useful, * +* but WITHOUT ANY WARRANTY; without even the implied warranty of * +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * +* GNU General Public License for more details. * +* * +* You should have received a copy of the GNU General Public License * +* along with this program in the file LICENSE.GPL; if not, write to the * +* Free Software Foundation, Inc., * +* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * +***************************************************************************/ + +#include "config.h" + +#include "UiGuiInfoDialog.h" +#include "IndentHandler.h" +#include "MainWindow.h" +#include "SettingsPaths.h" + +#include <tqlineedit.h> +#include <tqpixmap.h> +#include <tqtabwidget.h> + +/* + \class UiGuiInfoDialog + \brief Displays a dialog window with information about the current file + and about the paths used by the application +*/ + +UiGuiInfoDialog::UiGuiInfoDialog(TQWidget *parent, const IndentHandler *indenter) : + UiGuiInfoDialogBase(parent), m_mainWindow((const MainWindow*)parent), + m_indentHandler(indenter) +{ + // For icon setup + const TQString ICONS_PATH(APP_ICONS_PATH); + // Application icon + setIcon(TQPixmap(ICONS_PATH + "info.png")); + + tabWidget->setTabIconSet(tabFile, TQPixmap(ICONS_PATH + "accessories-text-editor.png")); + tabWidget->setTabIconSet(tabPaths, TQPixmap(ICONS_PATH + "syntax-highlight.png")); +} + +/* + \brief Displays the dialog by calling the dialogs exec function. + */ +void UiGuiInfoDialog::showDialog() +{ + // Populate all dialog objects + leFilename->setText(m_mainWindow->m_currentSourceFile); + leConfigFilename->setText(m_indentHandler->m_indenterConfigFilename); + leIndenter->setText(m_indentHandler->m_indenterName); + + leApplicationPath->setText(SettingsPaths::getApplicationBinaryPath()); + leSettingsPath->setText(SettingsPaths::getSettingsPath()); + leGlobalFilesPath->setText(SettingsPaths::getGlobalFilesPath()); + leIndentersPath->setText(SettingsPaths::getIndenterPath()); + leTempPath->setText(SettingsPaths::getTempPath()); + + // Execute the dialog. + exec(); +} + +#include "UiGuiInfoDialog.moc" diff --git a/src/UiGuiInfoDialog.h b/src/UiGuiInfoDialog.h new file mode 100644 index 0000000..0e7047e --- /dev/null +++ b/src/UiGuiInfoDialog.h @@ -0,0 +1,40 @@ +/*************************************************************************** +* 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. * +***************************************************************************/ + +#ifndef UIGUIINFODIALOG_H +#define UIGUIINFODIALOG_H + +#include "UiGuiInfoDialogBase.h" + +class IndentHandler; +class MainWindow; + +class UiGuiInfoDialog : public UiGuiInfoDialogBase +{ + TQ_OBJECT + + public: + UiGuiInfoDialog(TQWidget *parent, const IndentHandler *indenter); + + public slots: + void showDialog(); + + private: + const MainWindow *m_mainWindow; + const IndentHandler *m_indentHandler; +}; + +#endif diff --git a/src/UiGuiInfoDialogBase.ui b/src/UiGuiInfoDialogBase.ui new file mode 100755 index 0000000..b237aeb --- /dev/null +++ b/src/UiGuiInfoDialogBase.ui @@ -0,0 +1,310 @@ +<!DOCTYPE UI><UI version="3.3" stdsetdef="1"> + <class>UiGuiInfoDialogBase</class> + <widget class="TQDialog"> + <property name="name"> + <cstring>UiGuiInfoDialogBase</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>1100</width> + <height>300</height> + </rect> + </property> + <property name="caption"> + <string>Info</string> + </property> + <vbox> + <widget class="TQTabWidget"> + <property name="name"> + <cstring>tabWidget</cstring> + </property> + <property name="currentPage"> + <number>0</number> + </property> + <widget class="TQWidget"> + <property name="name"> + <cstring>tabFile</cstring> + </property> + <attribute name="title"> + <string>File</string> + </attribute> + <vbox> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>11</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <widget class="TQLabel" row="0" column="0"> + <property name="name"> + <cstring>filenameLabel</cstring> + </property> + <property name="text"> + <string>Open file</string> + </property> + <property name="whatsThis" stdset="0"> + <string>Name of the open file</string> + </property> + </widget> + <widget class="TQLineEdit" row="0" column="1"> + <property name="name"> + <cstring>leFilename</cstring> + </property> + <property name="whatsThis" stdset="0"> + <string>Name of the open file</string> + </property> + <property name="readOnly"> + <bool>true</bool> + </property> + </widget> + <widget class="TQLabel" row="1" column="0"> + <property name="name"> + <cstring>configFilenameLabel</cstring> + </property> + <property name="text"> + <string>Config file</string> + </property> + <property name="whatsThis" stdset="0"> + <string>Name of the config file</string> + </property> + </widget> + <widget class="TQLineEdit" row="1" column="1"> + <property name="name"> + <cstring>leConfigFilename</cstring> + </property> + <property name="whatsThis" stdset="0"> + <string>Name of the config file</string> + </property> + <property name="readOnly"> + <bool>true</bool> + </property> + </widget> + <widget class="TQLabel" row="2" column="0"> + <property name="name"> + <cstring>indenterLabel</cstring> + </property> + <property name="text"> + <string>Indender</string> + </property> + <property name="whatsThis" stdset="0"> + <string>Name of the indenter</string> + </property> + </widget> + <widget class="TQLineEdit" row="2" column="1"> + <property name="name"> + <cstring>leIndenter</cstring> + </property> + <property name="whatsThis" stdset="0"> + <string>Name of the indenter</string> + </property> + <property name="readOnly"> + <bool>true</bool> + </property> + </widget> + </grid> + <spacer> + <property name="name"> + <cstring>spacer2</cstring> + </property> + <property name="orientation"> + <enum>TQt::Vertical</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </vbox> + </widget> + <widget class="TQWidget"> + <property name="name"> + <cstring>tabPaths</cstring> + </property> + <attribute name="title"> + <string>Paths</string> + </attribute> + <vbox> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>11</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <widget class="TQLabel" row="0" column="0"> + <property name="name"> + <cstring>applicationPathLabel</cstring> + </property> + <property name="text"> + <string>Application</string> + </property> + <property name="whatsThis" stdset="0"> + <string>Name of the folder containing the application binary</string> + </property> + </widget> + <widget class="TQLineEdit" row="0" column="1"> + <property name="name"> + <cstring>leApplicationPath</cstring> + </property> + <property name="whatsThis" stdset="0"> + <string>Name of the folder containing the application binary</string> + </property> + <property name="readOnly"> + <bool>true</bool> + </property> + </widget> + <widget class="TQLabel" row="1" column="0"> + <property name="name"> + <cstring>settingsPathLabel</cstring> + </property> + <property name="text"> + <string>Settings</string> + </property> + <property name="whatsThis" stdset="0"> + <string>Name of the folder containing the application settings</string> + </property> + </widget> + <widget class="TQLineEdit" row="1" column="1"> + <property name="name"> + <cstring>leSettingsPath</cstring> + </property> + <property name="whatsThis" stdset="0"> + <string>Name of the folder containing the application settings</string> + </property> + <property name="readOnly"> + <bool>true</bool> + </property> + </widget> + <widget class="TQLabel" row="2" column="0"> + <property name="name"> + <cstring>globalFilesPathLabel</cstring> + </property> + <property name="text"> + <string>Global files</string> + </property> + <property name="whatsThis" stdset="0"> + <string>Name of the folder containing the global files</string> + </property> + </widget> + <widget class="TQLineEdit" row="2" column="1"> + <property name="name"> + <cstring>leGlobalFilesPath</cstring> + </property> + <property name="whatsThis" stdset="0"> + <string>Name of the folder containing the global files</string> + </property> + <property name="readOnly"> + <bool>true</bool> + </property> + </widget> + <widget class="TQLabel" row="3" column="0"> + <property name="name"> + <cstring>indentersPathLabel</cstring> + </property> + <property name="text"> + <string>Indenters</string> + </property> + <property name="whatsThis" stdset="0"> + <string>Name of the folder containing the indenter files</string> + </property> + </widget> + <widget class="TQLineEdit" row="3" column="1"> + <property name="name"> + <cstring>leIndentersPath</cstring> + </property> + <property name="whatsThis" stdset="0"> + <string>Name of the folder containing the indenter files</string> + </property> + <property name="readOnly"> + <bool>true</bool> + </property> + </widget> + <widget class="TQLabel" row="4" column="0"> + <property name="name"> + <cstring>tempPathLabel</cstring> + </property> + <property name="text"> + <string>Temp files</string> + </property> + <property name="whatsThis" stdset="0"> + <string>Name of the folder containing the temporary files</string> + </property> + </widget> + <widget class="TQLineEdit" row="4" column="1"> + <property name="name"> + <cstring>leTempPath</cstring> + </property> + <property name="whatsThis" stdset="0"> + <string>Name of the folder containing the temporary files</string> + </property> + <property name="readOnly"> + <bool>true</bool> + </property> + </widget> + </grid> + <spacer> + <property name="name"> + <cstring>spacer2</cstring> + </property> + <property name="orientation"> + <enum>TQt::Vertical</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </vbox> + </widget> + </widget> + <hbox> + <spacer> + <property name="name"> + <cstring>spacer1</cstring> + </property> + <property name="orientation"> + <enum>TQt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="TQPushButton"> + <property name="name"> + <cstring>okButton</cstring> + </property> + <property name="text"> + <string>&Ok</string> + </property> + <property name="default"> + <bool>true</bool> + </property> + </widget> + </hbox> + </vbox> + </widget> + <connections> + <connection> + <sender>okButton</sender> + <signal>clicked()</signal> + <receiver>UiGuiInfoDialogBase</receiver> + <slot>accept()</slot> + </connection> + </connections> +</UI> |