Added UiGuiErrorMessage, UiGuiIniFileParse and some code related to

them. Added indenter .ini files.

Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
pull/3/head
Michele Calgaro 2 years ago
parent dfb1b9f10a
commit 44f39b628c
Signed by: MicheleC
GPG Key ID: 2A75B7CA8ADED5CF

@ -1,5 +1,29 @@
install( install(
FILES FILES
example.cpp example.cpp
uigui_astyle.ini
uigui_bcpp.ini
uigui_CblBeau.ini
uigui_csstidy.ini
uigui_f90ppr.ini
uigui_gnuindent.ini
uigui_greatcode.ini
uigui_hindent.ini
uigui_htb.ini
uigui_jsdecoder.ini
uigui_jsppp.ini
uigui_perltidy.ini
uigui_php_Beautifier.ini
uigui_phpCB.ini
uigui_phpStylist.ini
uigui_pindent.ini
uigui_psti.ini
uigui_rbeautify.ini
uigui_rubyformatter.ini
uigui_shellindent.ini
uigui_tidy.ini
uigui_uncrustify.ini
uigui_vbsbeaut.ini
uigui_xmlindent.ini
DESTINATION ${SHARE_INSTALL_PREFIX}/universal-indent-gui-tqt/indenters DESTINATION ${SHARE_INSTALL_PREFIX}/universal-indent-gui-tqt/indenters
) )

@ -31,6 +31,8 @@ set( ${target}_SRCS
ToolBarWidget.ui ToolBarWidget.ui
SettingsPaths.cpp SettingsPaths.cpp
UiGuiErrorMessage.cpp
UiGuiIniFileParser.cpp
UiGuiVersion.cpp UiGuiVersion.cpp
# ongoing # ongoing

@ -22,20 +22,22 @@
#include "MainWindow.h" #include "MainWindow.h"
#include "SettingsPaths.h" #include "SettingsPaths.h"
#include "UiGuiErrorMessage.h"
//--- #include "UiGuiSettings.h" //--- #include "UiGuiSettings.h"
//--- #include "UiGuiErrorMessage.h"
//--- #include "TemplateBatchScript.h" //--- #include "TemplateBatchScript.h"
//--- #include "UiGuiIniFileParser.h" //--- #include "UiGuiIniFileParser.h"
#include <tqcombobox.h> #include <tqcombobox.h>
#include <tqdir.h> #include <tqdir.h>
#include <tqfile.h>
#include <tqfiledialog.h>
#include <tqlayout.h> #include <tqlayout.h>
#include <tqmessagebox.h>
#include <tqpopupmenu.h> #include <tqpopupmenu.h>
#include <tqtoolbox.h> #include <tqtoolbox.h>
#include <tqtoolbutton.h> #include <tqtoolbutton.h>
//--- #include <tqapplication.h> //--- #include <tqapplication.h>
//--- #include <tqcheckbox.h> //--- #include <tqcheckbox.h>
//--- #include <tqfile.h>
//--- #include <tqprocess.h> //--- #include <tqprocess.h>
//--- #include <tqsettings.h> //--- #include <tqsettings.h>
//--- #include <tqstringlist.h> //--- #include <tqstringlist.h>
@ -43,14 +45,12 @@
//--- #include <tqspinbox.h> //--- #include <tqspinbox.h>
//--- #include <tqlabel.h> //--- #include <tqlabel.h>
//--- #include <tqbytearray.h> //--- #include <tqbytearray.h>
//--- #include <tqmessagebox.h>
//--- #include <tqtextstream.h> //--- #include <tqtextstream.h>
//--- #include <tqtextcodec.h> //--- #include <tqtextcodec.h>
//--- #include <tqtscript.h> //--- #include <tqtscript.h>
//--- #include <tqdesktopservices.h> //--- #include <tqdesktopservices.h>
//--- #include <tqaction.h> //--- #include <tqaction.h>
//--- #include <tqcontextmenuevent.h> //--- #include <tqcontextmenuevent.h>
//--- #include <tqfiledialog.h>
//--- #include <tqtdebug.h> //--- #include <tqtdebug.h>
// \defgroup grp_Indenter All concerning handling of the indenter. // \defgroup grp_Indenter All concerning handling of the indenter.
@ -76,8 +76,8 @@
IndentHandler::IndentHandler(int indenterID, MainWindow *mainWindow, TQWidget *parent) IndentHandler::IndentHandler(int indenterID, MainWindow *mainWindow, TQWidget *parent)
: TQWidget(parent), m_mainWindow(mainWindow), m_parent(parent), m_toolBoxContainerLayout(nullptr), : TQWidget(parent), m_mainWindow(mainWindow), m_parent(parent), m_toolBoxContainerLayout(nullptr),
m_indenterSelectionCombobox(nullptr), m_indenterParameterHelpButton(nullptr), m_indenterSelectionCombobox(nullptr), m_indenterParameterHelpButton(nullptr),
m_indenterParameterCategoriesToolBox(nullptr) m_indenterParameterCategoriesToolBox(nullptr), m_errorMessageDialog(nullptr)
//--- _indenterSettings(nullptr), _errorMessageDialog(nullptr) //--- m_indenterSettings(nullptr)
{ {
if (indenterID < 0) if (indenterID < 0)
{ {
@ -133,55 +133,55 @@ IndentHandler::IndentHandler(int indenterID, MainWindow *mainWindow, TQWidget *p
m_indenterDirectoryStr = SettingsPaths::getIndenterPath(); m_indenterDirectoryStr = SettingsPaths::getIndenterPath();
m_tempDirectoryStr = SettingsPaths::getTempPath(); m_tempDirectoryStr = SettingsPaths::getTempPath();
m_settingsDirectoryStr = SettingsPaths::getSettingsPath(); m_settingsDirectoryStr = SettingsPaths::getSettingsPath();
if (m_mainWindow)
{
m_errorMessageDialog = new UiGuiErrorMessage(m_mainWindow);
}
else
{
m_errorMessageDialog = new UiGuiErrorMessage(this);
}
TQDir indenterDirectory = TQDir(m_indenterDirectoryStr); TQDir indenterDirectory = TQDir(m_indenterDirectoryStr);
m_indenterIniFileList = indenterDirectory.entryList(TQString("uigui_*.ini"));
if (m_indenterIniFileList.count() > 0)
{
// Take care if the selected indenterID is smaller or greater than the number of existing
// indenters
if (indenterID < 0)
{
indenterID = 0;
}
if (indenterID >= m_indenterIniFileList.count())
{
indenterID = m_indenterIniFileList.count() - 1;
}
//--- if (m_mainWindow != nullptr) // Reads and parses the indenter ini file specified by indenterID and creates toolbox entries
//--- { readIndentIniFile(m_indenterDirectoryStr + "/" + m_indenterIniFileList[indenterID]);
//--- _errorMessageDialog = new UiGuiErrorMessage(m_mainWindow);
//--- }
//--- else
//--- {
//--- _errorMessageDialog = new UiGuiErrorMessage(this);
//--- }
//--- _indenterIniFileList = indenterDirectory.entryList(TQStringList("uigui_*.ini")); // Find out how the indenter can be executed.
//--- if (_indenterIniFileList.count() > 0) createIndenterCallString();
//--- {
//--- // Take care if the selected indenterID is smaller or greater than the number of existing // Load the users last settings made for this indenter.
//--- // indenters loadConfigFile(m_settingsDirectoryStr + "/" + m_indenterFileName + ".cfg");
//--- if (indenterID < 0)
//--- { // Fill the indenter selection combo box with the list of available indenters.
//--- indenterID = 0; TQStringList availableIndenters = getAvailableIndenters();
//--- } if (!availableIndenters.isEmpty())
//--- if (indenterID >= _indenterIniFileList.count()) {
//--- { m_indenterSelectionCombobox->insertStringList(availableIndenters);
//--- indenterID = _indenterIniFileList.count() - 1; m_indenterSelectionCombobox->setCurrentItem(indenterID);
//--- } // MIKE make sure setIndeter() is invoked, so indenter is correctly set at start
//--- }
//--- // Reads and parses the by indenterID defined indent ini file and creates toolbox entries }
//--- readIndentIniFile(m_indenterDirectoryStr + "/" + _indenterIniFileList.at(indenterID)); else
//--- {
//--- // Find out how the indenter can be executed. m_errorMessageDialog->showMessage(tr("No indenter ini files"),
//--- createIndenterCallString(); tr("No valid indenter ini file found in directory ") +
//--- TQDir(m_indenterDirectoryStr).absPath());
//--- // Load the users last settings made for this indenter. }
//--- loadConfigFile(m_settingsDirectoryStr + "/" + _indenterFileName + ".cfg");
//---
//--- // Fill the indenter selection combo box with the list of available indenters.
//--- if (!getAvailableIndenters().isEmpty())
//--- {
//--- m_indenterSelectionCombobox->addItems(getAvailableIndenters());
//--- m_indenterSelectionCombobox->setCurrentIndex(indenterID);
//--- connect(m_indenterSelectionCombobox, SIGNAL(currentIndexChanged(int)), this,
//--- SIGNAL(selectedIndenterIndexChanged(int)));
//--- }
//--- }
//--- else
//--- {
//--- _errorMessageDialog->showMessage(tr("No indenter ini files"),
//--- tr("There exists no indenter ini files in the directory \"") +
//--- TQDir(m_indenterDirectoryStr).absolutePath() + "\".");
//--- }
} }
/* /*
@ -189,14 +189,14 @@ IndentHandler::IndentHandler(int indenterID, MainWindow *mainWindow, TQWidget *p
*/ */
IndentHandler::~IndentHandler() IndentHandler::~IndentHandler()
{ {
//--- // Generate the parameter string that will be saved to the indenters config file. // Generate the parameter string that will be saved to the indenters config file.
//--- TQString parameterString = getParameterString(); TQString parameterString = getParameterString();
//--- if (!_indenterFileName.isEmpty()) if (!m_indenterFileName.isEmpty())
//--- { {
//--- saveConfigFile(m_settingsDirectoryStr + "/" + _indenterFileName + ".cfg", parameterString); saveConfigFile(m_settingsDirectoryStr + "/" + m_indenterFileName + ".cfg", parameterString);
//--- } }
//---
//--- delete _errorMessageDialog; delete m_errorMessageDialog;
} }
/* /*
@ -242,7 +242,7 @@ void IndentHandler::contextMenuEvent(TQContextMenuEvent *event)
//--- //---
//--- // If the config file name is empty it is assumed that all parameters are sent via command line //--- // If the config file name is empty it is assumed that all parameters are sent via command line
//--- // call //--- // call
//--- if (_globalConfigFilename.isEmpty()) //--- if (m_globalConfigFilename.isEmpty())
//--- { //--- {
//--- parameterParameterFile = " " + getParameterString(); //--- parameterParameterFile = " " + getParameterString();
//--- } //--- }
@ -351,9 +351,9 @@ void IndentHandler::contextMenuEvent(TQContextMenuEvent *event)
//--- { //--- {
//--- Q_ASSERT_X(!_inputFileName.isEmpty(), "callIndenter", "_inputFileName is empty"); //--- Q_ASSERT_X(!_inputFileName.isEmpty(), "callIndenter", "_inputFileName is empty");
//--- // Q_ASSERT_X( !_outputFileName.isEmpty(), "callIndenter", "_outputFileName is empty" ); //--- // Q_ASSERT_X( !_outputFileName.isEmpty(), "callIndenter", "_outputFileName is empty" );
//--- Q_ASSERT_X(!_indenterFileName.isEmpty(), "callIndenter", "_indenterFileName is empty"); //--- Q_ASSERT_X(!m_indenterFileName.isEmpty(), "callIndenter", "m_indenterFileName is empty");
//--- //---
//--- if (_indenterFileName.isEmpty()) //--- if (m_indenterFileName.isEmpty())
//--- { //--- {
//--- return ""; //--- return "";
//--- } //--- }
@ -369,9 +369,9 @@ void IndentHandler::contextMenuEvent(TQContextMenuEvent *event)
//--- // Generate the parameter string that will be saved to the indenters config file //--- // Generate the parameter string that will be saved to the indenters config file
//--- TQString parameterString = getParameterString(); //--- TQString parameterString = getParameterString();
//--- //---
//--- if (!_globalConfigFilename.isEmpty()) //--- if (!m_globalConfigFilename.isEmpty())
//--- { //--- {
//--- saveConfigFile(m_tempDirectoryStr + "/" + _globalConfigFilename, parameterString); //--- saveConfigFile(m_tempDirectoryStr + "/" + m_globalConfigFilename, parameterString);
//--- } //--- }
//--- //---
//--- // Only add a dot to file extension if the string is not empty //--- // Only add a dot to file extension if the string is not empty
@ -416,7 +416,7 @@ void IndentHandler::contextMenuEvent(TQContextMenuEvent *event)
//--- //---
//--- // If the config file name is empty it is assumed that all parameters are sent via command line //--- // If the config file name is empty it is assumed that all parameters are sent via command line
//--- // call //--- // call
//--- if (_globalConfigFilename.isEmpty()) //--- if (m_globalConfigFilename.isEmpty())
//--- { //--- {
//--- parameterParameterFile = " " + parameterString; //--- parameterParameterFile = " " + parameterString;
//--- } //--- }
@ -424,7 +424,7 @@ void IndentHandler::contextMenuEvent(TQContextMenuEvent *event)
//--- else if (_useCfgFileParameter != "none") //--- else if (_useCfgFileParameter != "none")
//--- { //--- {
//--- parameterParameterFile = " " + _useCfgFileParameter + "\"" + m_tempDirectoryStr + "/" + //--- parameterParameterFile = " " + _useCfgFileParameter + "\"" + m_tempDirectoryStr + "/" +
//--- _globalConfigFilename + "\""; //--- m_globalConfigFilename + "\"";
//--- } //--- }
//--- //---
//--- // Assemble indenter call string for parameters according to the set order. //--- // Assemble indenter call string for parameters according to the set order.
@ -448,9 +448,9 @@ void IndentHandler::contextMenuEvent(TQContextMenuEvent *event)
//--- // If no indenter executable call string could be created before, show an error message. //--- // If no indenter executable call string could be created before, show an error message.
//--- if (m_indenterExecutableCallString.isEmpty()) //--- if (m_indenterExecutableCallString.isEmpty())
//--- { //--- {
//--- _errorMessageDialog->showMessage(tr("No indenter executable"), tr( //--- m_errorMessageDialog->showMessage(tr("No indenter executable"), tr(
//--- "There exists no indenter executable with the name \"%1\" in the directory \"%2\" nor in the global environment.").arg( //--- "There exists no indenter executable with the name \"%1\" in the directory \"%2\" nor in the global environment.").arg(
//--- _indenterFileName).arg(m_indenterDirectoryStr)); //--- m_indenterFileName).arg(m_indenterDirectoryStr));
//--- return sourceCode; //--- return sourceCode;
//--- } //--- }
//--- //---
@ -538,7 +538,7 @@ void IndentHandler::contextMenuEvent(TQContextMenuEvent *event)
//--- encodeToHTML(indentProcess.readAllStandardError()) + "<br>" + "</pre></html></body>"; //--- encodeToHTML(indentProcess.readAllStandardError()) + "<br>" + "</pre></html></body>";
//--- tqWarning() << __LINE__ << " " << __FUNCTION__ << processReturnString; //--- tqWarning() << __LINE__ << " " << __FUNCTION__ << processReturnString;
//--- TQApplication::restoreOverrideCursor(); //--- TQApplication::restoreOverrideCursor();
//--- _errorMessageDialog->showMessage(tr("Error calling Indenter"), processReturnString); //--- m_errorMessageDialog->showMessage(tr("Error calling Indenter"), processReturnString);
//--- } //--- }
//--- //---
//--- // If the indenter returned an error code != 0 show its output. //--- // If the indenter returned an error code != 0 show its output.
@ -553,7 +553,7 @@ void IndentHandler::contextMenuEvent(TQContextMenuEvent *event)
//--- encodeToHTML(indenterCompleteCallString) + "</html></body>"; //--- encodeToHTML(indenterCompleteCallString) + "</html></body>";
//--- tqWarning() << __LINE__ << " " << __FUNCTION__ << processReturnString; //--- tqWarning() << __LINE__ << " " << __FUNCTION__ << processReturnString;
//--- TQApplication::restoreOverrideCursor(); //--- TQApplication::restoreOverrideCursor();
//--- _errorMessageDialog->showMessage(tr("Indenter returned error"), processReturnString); //--- m_errorMessageDialog->showMessage(tr("Indenter returned error"), processReturnString);
//--- } //--- }
//--- //---
//--- // Only get the formatted source code, if calling the indenter did succeed. //--- // Only get the formatted source code, if calling the indenter did succeed.
@ -596,14 +596,14 @@ void IndentHandler::contextMenuEvent(TQContextMenuEvent *event)
//--- //---
//--- return formattedSourceCode; //--- return formattedSourceCode;
//--- } //--- }
//---
//--- /* /*
//--- \brief Generates and returns a string with all parameters needed to call the indenter. \brief Generates and returns a string with all parameters needed to call the indenter.
//--- */ */
//--- TQString IndentHandler::getParameterString() TQString IndentHandler::getParameterString()
//--- { {
//--- TQString parameterString = ""; TQString parameterString = "";
//---
//--- // generate parameter string for all boolean values //--- // generate parameter string for all boolean values
//--- foreach(ParamBoolean pBoolean, _paramBooleans) //--- foreach(ParamBoolean pBoolean, _paramBooleans)
//--- { //--- {
@ -655,49 +655,49 @@ void IndentHandler::contextMenuEvent(TQContextMenuEvent *event)
//--- _cfgFileParameterEnding; //--- _cfgFileParameterEnding;
//--- } //--- }
//--- } //--- }
//---
//--- return parameterString; return parameterString;
//--- } }
//---
//--- /* /*
//--- \brief Write settings for the indenter to a config file. \brief Write settings for the indenter to a config file.
//--- */ */
//--- void IndentHandler::saveConfigFile(TQString filePathName, TQString paramString) void IndentHandler::saveConfigFile(const TQString &filePathName, const TQString &paramString)
//--- { {
//--- TQFile::remove(filePathName); //--- TQFile::remove(filePathName);
//--- TQFile cfgFile(filePathName); //--- TQFile cfgFile(filePathName);
//--- //---
//--- cfgFile.open(TQFile::ReadWrite | TQFile::Text); //--- cfgFile.open(TQFile::ReadWrite | TQFile::Text);
//--- cfgFile.write(paramString.toAscii()); //--- cfgFile.write(paramString.toAscii());
//--- cfgFile.close(); //--- cfgFile.close();
//--- } }
//---
//--- /* /*
//--- \brief Load the config file for the indenter and apply the settings made there. \brief Load the config file for the indenter and apply the settings made there.
//--- */ */
//--- bool IndentHandler::loadConfigFile(TQString filePathName) bool IndentHandler::loadConfigFile(const TQString &filePathName)
//--- { {
//--- TQFile cfgFile(filePathName); TQFile cfgFile(filePathName);
//--- int index; TQString cfgFileData = TQString::null;
//--- int crPos;
//--- int paramValue = 0; // If the config file to be loaded does not exist, leave all values as they are and return false.
//--- TQString paramValueStr = ""; if (!cfgFile.exists())
//--- TQString cfgFileData = ""; {
//--- return false;
//--- // If the to be loaded config file does not exist leave all values as they are and return false. }
//--- if (!cfgFile.exists()) // else if the to be read config file exists, retrieve its whole content.
//--- { else
//--- return false; {
//--- } // Open the config file and read all data
//--- // else if the to be read config file exists, retrieve its whole content. cfgFile.open(IO_ReadOnly | IO_Translate);
//--- else cfgFileData = TQString(cfgFile.readAll());
//--- { cfgFile.close();
//--- // Open the config file and read all data }
//--- cfgFile.open(TQFile::ReadOnly | TQFile::Text);
//--- cfgFileData = cfgFile.readAll(); int index;
//--- cfgFile.close(); int crPos;
//--- } int paramValue = 0;
//--- TQString paramValueStr = "";
//--- // Search for name of each boolean parameter and set its value if found. //--- // Search for name of each boolean parameter and set its value if found.
//--- foreach(ParamBoolean pBoolean, _paramBooleans) //--- foreach(ParamBoolean pBoolean, _paramBooleans)
//--- { //--- {
@ -727,7 +727,7 @@ void IndentHandler::contextMenuEvent(TQContextMenuEvent *event)
//--- // neither true nor false parameter found so use default value //--- // neither true nor false parameter found so use default value
//--- else //--- else
//--- { //--- {
//--- paramValue = _indenterSettings->value(pBoolean.paramName + "/ValueDefault").toBool(); //--- paramValue = m_indenterSettings->value(pBoolean.paramName + "/ValueDefault").toBool();
//--- } //--- }
//--- } //--- }
//--- } //--- }
@ -753,7 +753,7 @@ void IndentHandler::contextMenuEvent(TQContextMenuEvent *event)
//--- // neither true nor false parameter found so use default value //--- // neither true nor false parameter found so use default value
//--- else //--- else
//--- { //--- {
//--- paramValue = _indenterSettings->value(pBoolean.paramName + "/ValueDefault").toBool(); //--- paramValue = m_indenterSettings->value(pBoolean.paramName + "/ValueDefault").toBool();
//--- } //--- }
//--- } //--- }
//--- } //--- }
@ -790,7 +790,7 @@ void IndentHandler::contextMenuEvent(TQContextMenuEvent *event)
//--- // parameter was not found in config file //--- // parameter was not found in config file
//--- else //--- else
//--- { //--- {
//--- int defaultValue = _indenterSettings->value(pNumeric.paramName + "/ValueDefault").toInt(); //--- int defaultValue = m_indenterSettings->value(pNumeric.paramName + "/ValueDefault").toInt();
//--- pNumeric.spinBox->setValue(defaultValue); //--- pNumeric.spinBox->setValue(defaultValue);
//--- pNumeric.valueEnabledChkBox->setChecked(false); //--- pNumeric.valueEnabledChkBox->setChecked(false);
//--- } //--- }
@ -839,7 +839,7 @@ void IndentHandler::contextMenuEvent(TQContextMenuEvent *event)
//--- // Parameter was not found in config file //--- // Parameter was not found in config file
//--- else //--- else
//--- { //--- {
//--- paramValueStr = _indenterSettings->value(pString.paramName + "/ValueDefault").toString(); //--- paramValueStr = m_indenterSettings->value(pString.paramName + "/ValueDefault").toString();
//--- pString.lineEdit->setText(paramValueStr); //--- pString.lineEdit->setText(paramValueStr);
//--- pString.valueEnabledChkBox->setChecked(false); //--- pString.valueEnabledChkBox->setChecked(false);
//--- } //--- }
@ -867,34 +867,34 @@ void IndentHandler::contextMenuEvent(TQContextMenuEvent *event)
//--- // parameter was not set in config file, so use default value //--- // parameter was not set in config file, so use default value
//--- if (index == -1) //--- if (index == -1)
//--- { //--- {
//--- int defaultValue = _indenterSettings->value(pMultiple.paramName + "/ValueDefault").toInt(); //--- int defaultValue = m_indenterSettings->value(pMultiple.paramName + "/ValueDefault").toInt();
//--- pMultiple.comboBox->setCurrentIndex(defaultValue); //--- pMultiple.comboBox->setCurrentIndex(defaultValue);
//--- pMultiple.valueEnabledChkBox->setChecked(false); //--- pMultiple.valueEnabledChkBox->setChecked(false);
//--- } //--- }
//--- } //--- }
//---
//--- return true; return true;
//--- } }
//---
//--- /* /*
//--- \brief Sets all indenter parameters to their default values defined in the ini file. \brief Sets all indenter parameters to their default values defined in the ini file.
//--- */ */
//--- void IndentHandler::resetToDefaultValues() void IndentHandler::resetToDefaultValues()
//--- { {
//--- // Search for name of each boolean parameter and set its value if found. //--- // Search for name of each boolean parameter and set its value if found.
//--- foreach(ParamBoolean pBoolean, _paramBooleans) //--- foreach(ParamBoolean pBoolean, _paramBooleans)
//--- { //--- {
//--- // Boolean value that will be assigned to the checkbox. //--- // Boolean value that will be assigned to the checkbox.
//--- bool defaultValue = _indenterSettings->value(pBoolean.paramName + "/ValueDefault").toBool(); //--- bool defaultValue = m_indenterSettings->value(pBoolean.paramName + "/ValueDefault").toBool();
//--- pBoolean.checkBox->setChecked(defaultValue); //--- pBoolean.checkBox->setChecked(defaultValue);
//--- } //--- }
//--- //---
//--- // Search for name of each numeric parameter and set the value found behind it. //--- // Search for name of each numeric parameter and set the value found behind it.
//--- foreach(ParamNumeric pNumeric, _paramNumerics) //--- foreach(ParamNumeric pNumeric, _paramNumerics)
//--- { //--- {
//--- int defaultValue = _indenterSettings->value(pNumeric.paramName + "/ValueDefault").toInt(); //--- int defaultValue = m_indenterSettings->value(pNumeric.paramName + "/ValueDefault").toInt();
//--- pNumeric.spinBox->setValue(defaultValue); //--- pNumeric.spinBox->setValue(defaultValue);
//--- pNumeric.valueEnabledChkBox->setChecked(_indenterSettings->value( //--- pNumeric.valueEnabledChkBox->setChecked(m_indenterSettings->value(
//--- pNumeric.paramName + "/Enabled").toBool()); //--- pNumeric.paramName + "/Enabled").toBool());
//--- } //--- }
//--- //---
@ -902,31 +902,36 @@ void IndentHandler::contextMenuEvent(TQContextMenuEvent *event)
//--- foreach(ParamString pString, _paramStrings) //--- foreach(ParamString pString, _paramStrings)
//--- { //--- {
//--- TQString defaultValue = //--- TQString defaultValue =
//--- _indenterSettings->value(pString.paramName + "/ValueDefault").toString(); //--- m_indenterSettings->value(pString.paramName + "/ValueDefault").toString();
//--- pString.lineEdit->setText(defaultValue); //--- pString.lineEdit->setText(defaultValue);
//--- pString.valueEnabledChkBox->setChecked(_indenterSettings->value( //--- pString.valueEnabledChkBox->setChecked(m_indenterSettings->value(
//--- pString.paramName + "/Enabled").toBool()); //--- pString.paramName + "/Enabled").toBool());
//--- } //--- }
//--- //---
//--- // Search for name of each multiple choice parameter and set it. //--- // Search for name of each multiple choice parameter and set it.
//--- foreach(ParamMultiple pMultiple, _paramMultiples) //--- foreach(ParamMultiple pMultiple, _paramMultiples)
//--- { //--- {
//--- int defaultValue = _indenterSettings->value(pMultiple.paramName + "/ValueDefault").toInt(); //--- int defaultValue = m_indenterSettings->value(pMultiple.paramName + "/ValueDefault").toInt();
//--- pMultiple.comboBox->setCurrentIndex(defaultValue); //--- pMultiple.comboBox->setCurrentIndex(defaultValue);
//--- pMultiple.valueEnabledChkBox->setChecked(_indenterSettings->value(pMultiple.paramName + //--- pMultiple.valueEnabledChkBox->setChecked(m_indenterSettings->value(pMultiple.paramName +
//--- "/Enabled").toBool()); //--- "/Enabled").toBool());
//--- } //--- }
//--- } }
//---
//--- /* /*
//--- \brief Opens and parses the indenter ini file that is declared by \a iniFilePath. \brief Opens and parses the indenter ini file that is declared by \a iniFilePath.
//--- */ */
//--- void IndentHandler::readIndentIniFile(TQString iniFilePath) void IndentHandler::readIndentIniFile(const TQString &iniFilePath)
//--- { {
//--- Q_ASSERT_X(!iniFilePath.isEmpty(), "readIndentIniFile", "iniFilePath is empty"); if (iniFilePath.isEmpty())
//--- {
m_errorMessageDialog->showMessage(tr("readIndentIniFile"),
tr("The iniFilePath for the indenter file is empty"));
return;
}
//--- // open the ini-file that contains all available indenter settings with their additional infos //--- // open the ini-file that contains all available indenter settings with their additional infos
//--- _indenterSettings = new UiGuiIniFileParser(iniFilePath); //--- m_indenterSettings = new UiGuiIniFileParser(iniFilePath);
//--- //---
//--- TQStringList categories; //--- TQStringList categories;
//--- //TQString indenterGroupString = ""; //--- //TQString indenterGroupString = "";
@ -936,36 +941,36 @@ void IndentHandler::contextMenuEvent(TQContextMenuEvent *event)
//--- // parse ini file indenter header //--- // parse ini file indenter header
//--- // //--- //
//--- //---
//--- _indenterName = _indenterSettings->value("header/indenterName").toString(); //--- _indenterName = m_indenterSettings->value("header/indenterName").toString();
//--- _indenterFileName = _indenterSettings->value("header/indenterFileName").toString(); //--- m_indenterFileName = m_indenterSettings->value("header/indenterFileName").toString();
//--- _globalConfigFilename = _indenterSettings->value("header/configFilename").toString(); //--- m_globalConfigFilename = m_indenterSettings->value("header/configFilename").toString();
//--- _useCfgFileParameter = _indenterSettings->value("header/useCfgFileParameter").toString(); //--- _useCfgFileParameter = m_indenterSettings->value("header/useCfgFileParameter").toString();
//--- _cfgFileParameterEnding = _indenterSettings->value("header/cfgFileParameterEnding").toString(); //--- _cfgFileParameterEnding = m_indenterSettings->value("header/cfgFileParameterEnding").toString();
//--- if (_cfgFileParameterEnding == "cr") //--- if (_cfgFileParameterEnding == "cr")
//--- { //--- {
//--- _cfgFileParameterEnding = "\n"; //--- _cfgFileParameterEnding = "\n";
//--- } //--- }
//--- _indenterShowHelpParameter = _indenterSettings->value("header/showHelpParameter").toString(); //--- _indenterShowHelpParameter = m_indenterSettings->value("header/showHelpParameter").toString();
//--- //---
//--- if (_indenterFileName.isEmpty()) //--- if (m_indenterFileName.isEmpty())
//--- { //--- {
//--- _errorMessageDialog->showMessage(tr("Indenter ini file header error"), tr( //--- m_errorMessageDialog->showMessage(tr("Indenter ini file header error"), tr(
//--- "The loaded indenter ini file \"%1\"has a faulty header. At least the indenters file name is not set.").arg( //--- "The loaded indenter ini file \"%1\"has a faulty header. At least the indenters file name is not set.").arg(
//--- iniFilePath)); //--- iniFilePath));
//--- } //--- }
//--- //---
//--- // Read the parameter order. Possible values are (p=parameter[file] i=inputfile o=outputfile) //--- // Read the parameter order. Possible values are (p=parameter[file] i=inputfile o=outputfile)
//--- // pio, ipo, iop //--- // pio, ipo, iop
//--- _parameterOrder = _indenterSettings->value("header/parameterOrder", "pio").toString(); //--- _parameterOrder = m_indenterSettings->value("header/parameterOrder", "pio").toString();
//--- _inputFileParameter = _indenterSettings->value("header/inputFileParameter").toString(); //--- _inputFileParameter = m_indenterSettings->value("header/inputFileParameter").toString();
//--- _inputFileName = _indenterSettings->value("header/inputFileName").toString(); //--- _inputFileName = m_indenterSettings->value("header/inputFileName").toString();
//--- _outputFileParameter = _indenterSettings->value("header/outputFileParameter").toString(); //--- _outputFileParameter = m_indenterSettings->value("header/outputFileParameter").toString();
//--- _outputFileName = _indenterSettings->value("header/outputFileName").toString(); //--- _outputFileName = m_indenterSettings->value("header/outputFileName").toString();
//--- _fileTypes = _indenterSettings->value("header/fileTypes").toString(); //--- _fileTypes = m_indenterSettings->value("header/fileTypes").toString();
//--- _fileTypes.replace('|', " "); //--- _fileTypes.replace('|', " ");
//--- //---
//--- // read the categories names which are separated by "|" //--- // read the categories names which are separated by "|"
//--- TQString categoriesStr = _indenterSettings->value("header/categories").toString(); //--- TQString categoriesStr = m_indenterSettings->value("header/categories").toString();
//--- categories = categoriesStr.split("|"); //--- categories = categoriesStr.split("|");
//--- // Assure that the category list is never empty. At least contain a "general" section. //--- // Assure that the category list is never empty. At least contain a "general" section.
//--- if (categories.isEmpty()) //--- if (categories.isEmpty())
@ -995,7 +1000,7 @@ void IndentHandler::contextMenuEvent(TQContextMenuEvent *event)
//--- // //--- //
//--- //---
//--- // read all possible parameters written in brackets [] //--- // read all possible parameters written in brackets []
//--- _indenterParameters = _indenterSettings->childGroups(); //--- _indenterParameters = m_indenterSettings->childGroups();
//--- //---
//--- // read each parameter to create the corresponding input field //--- // read each parameter to create the corresponding input field
//--- foreach(TQString indenterParameter, _indenterParameters) //--- foreach(TQString indenterParameter, _indenterParameters)
@ -1005,25 +1010,25 @@ void IndentHandler::contextMenuEvent(TQContextMenuEvent *event)
//--- if (indenterParameter != "header") //--- if (indenterParameter != "header")
//--- { //--- {
//--- // read to which category the parameter belongs //--- // read to which category the parameter belongs
//--- int category = _indenterSettings->value(indenterParameter + "/Category").toInt(); //--- int category = m_indenterSettings->value(indenterParameter + "/Category").toInt();
//--- // Assure that the category number is never greater than the available categories. //--- // Assure that the category number is never greater than the available categories.
//--- if (category > _indenterParameterCategoryPages.size() - 1) //--- if (category > _indenterParameterCategoryPages.size() - 1)
//--- { //--- {
//--- category = _indenterParameterCategoryPages.size() - 1; //--- category = _indenterParameterCategoryPages.size() - 1;
//--- } //--- }
//--- // read which type of input field the parameter needs //--- // read which type of input field the parameter needs
//--- TQString editType = _indenterSettings->value(indenterParameter + "/EditorType").toString(); //--- TQString editType = m_indenterSettings->value(indenterParameter + "/EditorType").toString();
//--- //---
//--- // edit type is numeric so create a spinbox with label //--- // edit type is numeric so create a spinbox with label
//--- if (editType == "numeric") //--- if (editType == "numeric")
//--- { //--- {
//--- // read the parameter name as it is used at the command line or in its config file //--- // read the parameter name as it is used at the command line or in its config file
//--- TQString parameterCallName = //--- TQString parameterCallName =
//--- _indenterSettings->value(indenterParameter + "/CallName").toString(); //--- m_indenterSettings->value(indenterParameter + "/CallName").toString();
//--- //---
//--- // create checkbox which enables or disables the parameter //--- // create checkbox which enables or disables the parameter
//--- TQCheckBox *chkBox = new TQCheckBox(_indenterParameterCategoryPages.at(category).widget); //--- TQCheckBox *chkBox = new TQCheckBox(_indenterParameterCategoryPages.at(category).widget);
//--- chkBox->setChecked(_indenterSettings->value(indenterParameter + "/Enabled").toBool()); //--- chkBox->setChecked(m_indenterSettings->value(indenterParameter + "/Enabled").toBool());
//--- chkBox->setToolTip( //--- chkBox->setToolTip(
//--- "Enables/disables the parameter. If disabled the indenters default value will be used."); //--- "Enables/disables the parameter. If disabled the indenters default value will be used.");
//--- chkBox->setSizePolicy(TQSizePolicy::Fixed, TQSizePolicy::Fixed); //--- chkBox->setSizePolicy(TQSizePolicy::Fixed, TQSizePolicy::Fixed);
@ -1033,7 +1038,7 @@ void IndentHandler::contextMenuEvent(TQContextMenuEvent *event)
//--- //---
//--- // create the spinbox //--- // create the spinbox
//--- TQSpinBox *spinBox = new TQSpinBox(_indenterParameterCategoryPages.at(category).widget); //--- TQSpinBox *spinBox = new TQSpinBox(_indenterParameterCategoryPages.at(category).widget);
//--- paramToolTip = _indenterSettings->value(indenterParameter + "/Description").toString(); //--- paramToolTip = m_indenterSettings->value(indenterParameter + "/Description").toString();
//--- spinBox->setToolTip(paramToolTip); //--- spinBox->setToolTip(paramToolTip);
//--- spinBox->setMaximumWidth(50); //--- spinBox->setMaximumWidth(50);
//--- spinBox->setMinimumWidth(50); //--- spinBox->setMinimumWidth(50);
@ -1041,17 +1046,17 @@ void IndentHandler::contextMenuEvent(TQContextMenuEvent *event)
//--- { //--- {
//--- spinBox->installEventFilter(m_mainWindow); //--- spinBox->installEventFilter(m_mainWindow);
//--- } //--- }
//--- if (_indenterSettings->value(indenterParameter + "/MinVal").toString() != "") //--- if (m_indenterSettings->value(indenterParameter + "/MinVal").toString() != "")
//--- { //--- {
//--- spinBox->setMinimum(_indenterSettings->value(indenterParameter + "/MinVal").toInt()); //--- spinBox->setMinimum(m_indenterSettings->value(indenterParameter + "/MinVal").toInt());
//--- } //--- }
//--- else //--- else
//--- { //--- {
//--- spinBox->setMinimum(0); //--- spinBox->setMinimum(0);
//--- } //--- }
//--- if (_indenterSettings->value(indenterParameter + "/MaxVal").toString() != "") //--- if (m_indenterSettings->value(indenterParameter + "/MaxVal").toString() != "")
//--- { //--- {
//--- spinBox->setMaximum(_indenterSettings->value(indenterParameter + "/MaxVal").toInt()); //--- spinBox->setMaximum(m_indenterSettings->value(indenterParameter + "/MaxVal").toInt());
//--- } //--- }
//--- else //--- else
//--- { //--- {
@ -1082,7 +1087,7 @@ void IndentHandler::contextMenuEvent(TQContextMenuEvent *event)
//--- paramNumeric.spinBox = spinBox; //--- paramNumeric.spinBox = spinBox;
//--- paramNumeric.label = label; //--- paramNumeric.label = label;
//--- paramNumeric.valueEnabledChkBox = chkBox; //--- paramNumeric.valueEnabledChkBox = chkBox;
//--- paramNumeric.spinBox->setValue(_indenterSettings->value(paramNumeric.paramName + //--- paramNumeric.spinBox->setValue(m_indenterSettings->value(paramNumeric.paramName +
//--- "/ValueDefault").toInt()); //--- "/ValueDefault").toInt());
//--- _paramNumerics.append(paramNumeric); //--- _paramNumerics.append(paramNumeric);
//--- //---
@ -1096,7 +1101,7 @@ void IndentHandler::contextMenuEvent(TQContextMenuEvent *event)
//--- // create the checkbox, make its settings and add it to the toolbox page //--- // create the checkbox, make its settings and add it to the toolbox page
//--- TQCheckBox *chkBox = new TQCheckBox(_indenterParameterCategoryPages.at(category).widget); //--- TQCheckBox *chkBox = new TQCheckBox(_indenterParameterCategoryPages.at(category).widget);
//--- chkBox->setText(indenterParameter); //--- chkBox->setText(indenterParameter);
//--- paramToolTip = _indenterSettings->value(indenterParameter + "/Description").toString(); //--- paramToolTip = m_indenterSettings->value(indenterParameter + "/Description").toString();
//--- chkBox->setToolTip(paramToolTip); //--- chkBox->setToolTip(paramToolTip);
//--- if (m_mainWindow != nullptr) //--- if (m_mainWindow != nullptr)
//--- { //--- {
@ -1109,10 +1114,10 @@ void IndentHandler::contextMenuEvent(TQContextMenuEvent *event)
//--- paramBoolean.paramName = indenterParameter; //--- paramBoolean.paramName = indenterParameter;
//--- paramBoolean.checkBox = chkBox; //--- paramBoolean.checkBox = chkBox;
//--- TQStringList trueFalseStrings = //--- TQStringList trueFalseStrings =
//--- _indenterSettings->value(indenterParameter + "/TrueFalse").toString().split("|"); //--- m_indenterSettings->value(indenterParameter + "/TrueFalse").toString().split("|");
//--- paramBoolean.trueString = trueFalseStrings.at(0); //--- paramBoolean.trueString = trueFalseStrings.at(0);
//--- paramBoolean.falseString = trueFalseStrings.at(1); //--- paramBoolean.falseString = trueFalseStrings.at(1);
//--- paramBoolean.checkBox->setChecked(_indenterSettings->value(paramBoolean.paramName + //--- paramBoolean.checkBox->setChecked(m_indenterSettings->value(paramBoolean.paramName +
//--- "/ValueDefault").toBool()); //--- "/ValueDefault").toBool());
//--- _paramBooleans.append(paramBoolean); //--- _paramBooleans.append(paramBoolean);
//--- //---
@ -1123,11 +1128,11 @@ void IndentHandler::contextMenuEvent(TQContextMenuEvent *event)
//--- { //--- {
//--- // read the parameter name as it is used at the command line or in its config file //--- // read the parameter name as it is used at the command line or in its config file
//--- TQString parameterCallName = //--- TQString parameterCallName =
//--- _indenterSettings->value(indenterParameter + "/CallName").toString(); //--- m_indenterSettings->value(indenterParameter + "/CallName").toString();
//--- //---
//--- // create check box which enables or disables the parameter //--- // create check box which enables or disables the parameter
//--- TQCheckBox *chkBox = new TQCheckBox(_indenterParameterCategoryPages.at(category).widget); //--- TQCheckBox *chkBox = new TQCheckBox(_indenterParameterCategoryPages.at(category).widget);
//--- chkBox->setChecked(_indenterSettings->value(indenterParameter + "/Enabled").toBool()); //--- chkBox->setChecked(m_indenterSettings->value(indenterParameter + "/Enabled").toBool());
//--- chkBox->setToolTip( //--- chkBox->setToolTip(
//--- "Enables/disables the parameter. If disabled the indenters default value will be used."); //--- "Enables/disables the parameter. If disabled the indenters default value will be used.");
//--- chkBox->setSizePolicy(TQSizePolicy::Fixed, TQSizePolicy::Fixed); //--- chkBox->setSizePolicy(TQSizePolicy::Fixed, TQSizePolicy::Fixed);
@ -1137,7 +1142,7 @@ void IndentHandler::contextMenuEvent(TQContextMenuEvent *event)
//--- //---
//--- // create the line edit //--- // create the line edit
//--- TQLineEdit *lineEdit = new TQLineEdit(_indenterParameterCategoryPages.at(category).widget); //--- TQLineEdit *lineEdit = new TQLineEdit(_indenterParameterCategoryPages.at(category).widget);
//--- paramToolTip = _indenterSettings->value(indenterParameter + "/Description").toString(); //--- paramToolTip = m_indenterSettings->value(indenterParameter + "/Description").toString();
//--- lineEdit->setToolTip(paramToolTip); //--- lineEdit->setToolTip(paramToolTip);
//--- lineEdit->setMaximumWidth(50); //--- lineEdit->setMaximumWidth(50);
//--- lineEdit->setMinimumWidth(50); //--- lineEdit->setMinimumWidth(50);
@ -1171,7 +1176,7 @@ void IndentHandler::contextMenuEvent(TQContextMenuEvent *event)
//--- paramString.lineEdit = lineEdit; //--- paramString.lineEdit = lineEdit;
//--- paramString.label = label; //--- paramString.label = label;
//--- paramString.valueEnabledChkBox = chkBox; //--- paramString.valueEnabledChkBox = chkBox;
//--- paramString.lineEdit->setText(_indenterSettings->value(paramString.paramName + //--- paramString.lineEdit->setText(m_indenterSettings->value(paramString.paramName +
//--- "/ValueDefault").toString()); //--- "/ValueDefault").toString());
//--- _paramStrings.append(paramString); //--- _paramStrings.append(paramString);
//--- //---
@ -1184,11 +1189,11 @@ void IndentHandler::contextMenuEvent(TQContextMenuEvent *event)
//--- { //--- {
//--- // read the parameter name as it is used at the command line or in its config file //--- // read the parameter name as it is used at the command line or in its config file
//--- TQString parameterCallName = //--- TQString parameterCallName =
//--- _indenterSettings->value(indenterParameter + "/CallName").toString(); //--- m_indenterSettings->value(indenterParameter + "/CallName").toString();
//--- //---
//--- // create checkbox which enables or disables the parameter //--- // create checkbox which enables or disables the parameter
//--- TQCheckBox *chkBox = new TQCheckBox(_indenterParameterCategoryPages.at(category).widget); //--- TQCheckBox *chkBox = new TQCheckBox(_indenterParameterCategoryPages.at(category).widget);
//--- chkBox->setChecked(_indenterSettings->value(indenterParameter + "/Enabled").toBool()); //--- chkBox->setChecked(m_indenterSettings->value(indenterParameter + "/Enabled").toBool());
//--- chkBox->setToolTip( //--- chkBox->setToolTip(
//--- "Enables/disables the parameter. If disabled the indenters default value will be used."); //--- "Enables/disables the parameter. If disabled the indenters default value will be used.");
//--- chkBox->setSizePolicy(TQSizePolicy::Fixed, TQSizePolicy::Fixed); //--- chkBox->setSizePolicy(TQSizePolicy::Fixed, TQSizePolicy::Fixed);
@ -1200,8 +1205,8 @@ void IndentHandler::contextMenuEvent(TQContextMenuEvent *event)
//--- TQComboBox *comboBox = new TQComboBox(_indenterParameterCategoryPages.at( //--- TQComboBox *comboBox = new TQComboBox(_indenterParameterCategoryPages.at(
//--- category).widget); //--- category).widget);
//--- TQStringList choicesStrings = //--- TQStringList choicesStrings =
//--- _indenterSettings->value(indenterParameter + "/Choices").toString().split("|"); //--- m_indenterSettings->value(indenterParameter + "/Choices").toString().split("|");
//--- TQStringList choicesStringsReadable = _indenterSettings->value( //--- TQStringList choicesStringsReadable = m_indenterSettings->value(
//--- indenterParameter + "/ChoicesReadable").toString().split("|", TQString::SkipEmptyParts); //--- indenterParameter + "/ChoicesReadable").toString().split("|", TQString::SkipEmptyParts);
//--- if (choicesStringsReadable.isEmpty()) //--- if (choicesStringsReadable.isEmpty())
//--- { //--- {
@ -1211,7 +1216,7 @@ void IndentHandler::contextMenuEvent(TQContextMenuEvent *event)
//--- { //--- {
//--- comboBox->addItems(choicesStringsReadable); //--- comboBox->addItems(choicesStringsReadable);
//--- } //--- }
//--- paramToolTip = _indenterSettings->value(indenterParameter + "/Description").toString(); //--- paramToolTip = m_indenterSettings->value(indenterParameter + "/Description").toString();
//--- comboBox->setToolTip(paramToolTip); //--- comboBox->setToolTip(paramToolTip);
//--- if (m_mainWindow != nullptr) //--- if (m_mainWindow != nullptr)
//--- { //--- {
@ -1232,7 +1237,7 @@ void IndentHandler::contextMenuEvent(TQContextMenuEvent *event)
//--- paramMultiple.choicesStrings = choicesStrings; //--- paramMultiple.choicesStrings = choicesStrings;
//--- paramMultiple.choicesStringsReadable = choicesStringsReadable; //--- paramMultiple.choicesStringsReadable = choicesStringsReadable;
//--- paramMultiple.valueEnabledChkBox = chkBox; //--- paramMultiple.valueEnabledChkBox = chkBox;
//--- paramMultiple.comboBox->setCurrentIndex(_indenterSettings->value(paramMultiple.paramName + //--- paramMultiple.comboBox->setCurrentIndex(m_indenterSettings->value(paramMultiple.paramName +
//--- "/ValueDefault").toInt()); //--- "/ValueDefault").toInt());
//--- _paramMultiples.append(paramMultiple); //--- _paramMultiples.append(paramMultiple);
//--- //---
@ -1248,20 +1253,20 @@ void IndentHandler::contextMenuEvent(TQContextMenuEvent *event)
//--- { //--- {
//--- categoryPage.vboxLayout->addStretch(); //--- categoryPage.vboxLayout->addStretch();
//--- } //--- }
//--- } }
//---
//--- /* /*
//--- \brief Searches and returns all indenters a configuration file is found for. \brief Searches and returns all indenters a configuration file is found for.
//---
//--- Opens all uigui ini files found in the list \a _indenterIniFileList, opens each ini file Opens all uigui ini files found in the list \a m_indenterIniFileList, opens each ini file
//--- and reads the there defined real name of the indenter. These names are being returned as TQStringList. and reads the there defined real name of the indenter. These names are being returned as TQStringList.
//--- */ */
//--- TQStringList IndentHandler::getAvailableIndenters() TQStringList IndentHandler::getAvailableIndenters()
//--- { {
//--- TQStringList indenterNamesList; TQStringList indenterNamesList;
//--- //---
//--- // Loop for every existing uigui ini file //--- // Loop for every existing uigui ini file
//--- foreach(TQString indenterIniFile, _indenterIniFileList) //--- foreach(TQString indenterIniFile, m_indenterIniFileList)
//--- { //--- {
//--- // Open the ini file and search for the indenter name //--- // Open the ini file and search for the indenter name
//--- TQFile file(m_indenterDirectoryStr + "/" + indenterIniFile); //--- TQFile file(m_indenterDirectoryStr + "/" + indenterIniFile);
@ -1283,8 +1288,8 @@ void IndentHandler::contextMenuEvent(TQContextMenuEvent *event)
//--- } //--- }
//--- } //--- }
//--- } //--- }
//--- return indenterNamesList; return indenterNamesList;
//--- } }
/* /*
\brief Deletes all elements in the toolbox and initializes the indenter selected by \a indenterID. \brief Deletes all elements in the toolbox and initializes the indenter selected by \a indenterID.
@ -1295,9 +1300,9 @@ void IndentHandler::setIndenter(int indenterID)
//--- //---
//--- // Generate the parameter string that will be saved to the indenters config file. //--- // Generate the parameter string that will be saved to the indenters config file.
//--- TQString parameterString = getParameterString(); //--- TQString parameterString = getParameterString();
//--- if (!_indenterFileName.isEmpty()) //--- if (!m_indenterFileName.isEmpty())
//--- { //--- {
//--- saveConfigFile(m_settingsDirectoryStr + "/" + _indenterFileName + ".cfg", parameterString); //--- saveConfigFile(m_settingsDirectoryStr + "/" + m_indenterFileName + ".cfg", parameterString);
//--- } //--- }
//--- //---
//--- // Take care if the selected indenterID is smaller or greater than the number of existing //--- // Take care if the selected indenterID is smaller or greater than the number of existing
@ -1306,9 +1311,9 @@ void IndentHandler::setIndenter(int indenterID)
//--- { //--- {
//--- indenterID = 0; //--- indenterID = 0;
//--- } //--- }
//--- if (indenterID >= _indenterIniFileList.count()) //--- if (indenterID >= m_indenterIniFileList.count())
//--- { //--- {
//--- indenterID = _indenterIniFileList.count() - 1; //--- indenterID = m_indenterIniFileList.count() - 1;
//--- } //--- }
//--- //---
//--- // MIKE: TODO: need to save selected indenterID into Settings //--- // MIKE: TODO: need to save selected indenterID into Settings
@ -1331,15 +1336,15 @@ void IndentHandler::setIndenter(int indenterID)
//--- _paramNumerics.clear(); //--- _paramNumerics.clear();
//--- _paramBooleans.clear(); //--- _paramBooleans.clear();
//--- _paramMultiples.clear(); //--- _paramMultiples.clear();
//--- delete _indenterSettings; //--- delete m_indenterSettings;
//--- //---
//--- readIndentIniFile(m_indenterDirectoryStr + "/" + _indenterIniFileList.at(indenterID)); //--- readIndentIniFile(m_indenterDirectoryStr + "/" + m_indenterIniFileList.at(indenterID));
//--- //---
//--- // Find out how the indenter can be executed. //--- // Find out how the indenter can be executed.
//--- createIndenterCallString(); //--- createIndenterCallString();
//--- //---
//--- // Load the users last settings made for this indenter. //--- // Load the users last settings made for this indenter.
//--- loadConfigFile(m_settingsDirectoryStr + "/" + _indenterFileName + ".cfg"); //--- loadConfigFile(m_settingsDirectoryStr + "/" + m_indenterFileName + ".cfg");
//--- //---
//--- handleChangedIndenterSettings(); //--- handleChangedIndenterSettings();
//--- //---
@ -1353,24 +1358,24 @@ void IndentHandler::setIndenter(int indenterID)
//--- { //--- {
//--- return _fileTypes; //--- return _fileTypes;
//--- } //--- }
//---
//--- /* /*
//--- \brief Returns the path and filename of the current indenter config file. \brief Returns the path and filename of the current indenter config file.
//--- */ */
//--- TQString IndentHandler::getIndenterCfgFile() TQString IndentHandler::getIndenterCfgFile()
//--- { {
//--- TQFileInfo fileInfo(m_indenterDirectoryStr + "/" + _globalConfigFilename); TQFileInfo fileInfo(m_indenterDirectoryStr + "/" + m_globalConfigFilename);
//--- return fileInfo.absoluteFilePath(); return fileInfo.absFilePath();
//--- } }
//---
//--- /* /*
//--- \brief Tries to create a call path string for the indenter executable. If successful returns true. \brief Tries to create a call path string for the indenter executable. If successful returns true.
//--- */ */
//--- bool IndentHandler::createIndenterCallString() bool IndentHandler::createIndenterCallString()
//--- { {
//--- TQProcess indentProcess; //--- TQProcess indentProcess;
//--- //---
//--- if (_indenterFileName.isEmpty()) //--- if (m_indenterFileName.isEmpty())
//--- { //--- {
//--- return false; //--- return false;
//--- } //--- }
@ -1385,7 +1390,7 @@ void IndentHandler::setIndenter(int indenterID)
//--- { //--- {
//--- m_indenterExecutableSuffix = suffix; //--- m_indenterExecutableSuffix = suffix;
//--- m_indenterExecutableCallString = TQFileInfo(m_indenterDirectoryStr).absoluteFilePath() + "/" + //--- m_indenterExecutableCallString = TQFileInfo(m_indenterDirectoryStr).absoluteFilePath() + "/" +
//--- _indenterFileName; //--- m_indenterFileName;
//--- m_indenterExecutableCallString += suffix; //--- m_indenterExecutableCallString += suffix;
//--- //---
//--- // Only try to call the indenter, if the file exists. //--- // Only try to call the indenter, if the file exists.
@ -1453,7 +1458,7 @@ void IndentHandler::setIndenter(int indenterID)
//--- // now we know an interpreter is needed but it could not be called, so inform the user. //--- // now we know an interpreter is needed but it could not be called, so inform the user.
//--- else //--- else
//--- { //--- {
//--- _errorMessageDialog->showMessage(tr("Interpreter needed"), tr( //--- m_errorMessageDialog->showMessage(tr("Interpreter needed"), tr(
//--- "To use the selected indenter the program \"%1\" needs to be available in the global environment. You should add an entry to your path settings.").arg( //--- "To use the selected indenter the program \"%1\" needs to be available in the global environment. You should add an entry to your path settings.").arg(
//--- interpreterName)); //--- interpreterName));
//--- return true; //--- return true;
@ -1466,7 +1471,7 @@ void IndentHandler::setIndenter(int indenterID)
//--- // ------------------------------------------------------------------- //--- // -------------------------------------------------------------------
//--- m_indenterExecutableSuffix = ".js"; //--- m_indenterExecutableSuffix = ".js";
//--- m_indenterExecutableCallString = TQFileInfo(m_indenterDirectoryStr).absoluteFilePath() + "/" + //--- m_indenterExecutableCallString = TQFileInfo(m_indenterDirectoryStr).absoluteFilePath() + "/" +
//--- _indenterFileName; //--- m_indenterFileName;
//--- m_indenterExecutableCallString += m_indenterExecutableSuffix; //--- m_indenterExecutableCallString += m_indenterExecutableSuffix;
//--- if (TQFile::exists(m_indenterExecutableCallString)) //--- if (TQFile::exists(m_indenterExecutableCallString))
//--- { //--- {
@ -1478,7 +1483,7 @@ void IndentHandler::setIndenter(int indenterID)
//--- foreach(TQString suffix, TQStringList() << "" << ".exe" << ".bat" << ".com" << ".sh") //--- foreach(TQString suffix, TQStringList() << "" << ".exe" << ".bat" << ".com" << ".sh")
//--- { //--- {
//--- m_indenterExecutableSuffix = suffix; //--- m_indenterExecutableSuffix = suffix;
//--- m_indenterExecutableCallString = _indenterFileName + suffix; //--- m_indenterExecutableCallString = m_indenterFileName + suffix;
//--- indentProcess.start(m_indenterExecutableCallString + " " + _indenterShowHelpParameter); //--- indentProcess.start(m_indenterExecutableCallString + " " + _indenterShowHelpParameter);
//--- if (indentProcess.waitForFinished(2000)) //--- if (indentProcess.waitForFinished(2000))
//--- { //--- {
@ -1493,19 +1498,19 @@ void IndentHandler::setIndenter(int indenterID)
//--- // If even globally calling the indenter fails, try calling .com and .exe via wine //--- // If even globally calling the indenter fails, try calling .com and .exe via wine
//--- // ------------------------------------------------------------------------------- //--- // -------------------------------------------------------------------------------
//--- m_indenterExecutableCallString = "\"" + TQFileInfo(m_indenterDirectoryStr).absoluteFilePath() + "/" + //--- m_indenterExecutableCallString = "\"" + TQFileInfo(m_indenterDirectoryStr).absoluteFilePath() + "/" +
//--- _indenterFileName; //--- m_indenterFileName;
//--- //---
//--- foreach(TQString suffix, TQStringList() << ".exe" << ".com") //--- foreach(TQString suffix, TQStringList() << ".exe" << ".com")
//--- { //--- {
//--- m_indenterExecutableSuffix = suffix; //--- m_indenterExecutableSuffix = suffix;
//--- if (TQFile::exists(m_indenterDirectoryStr + "/" + _indenterFileName + suffix)) //--- if (TQFile::exists(m_indenterDirectoryStr + "/" + m_indenterFileName + suffix))
//--- { //--- {
//--- TQProcess wineTestProcess; //--- TQProcess wineTestProcess;
//--- wineTestProcess.start("wine --version"); //--- wineTestProcess.start("wine --version");
//--- // if the process of wine was not callable assume that wine is not installed //--- // if the process of wine was not callable assume that wine is not installed
//--- if (!wineTestProcess.waitForFinished(2000)) //--- if (!wineTestProcess.waitForFinished(2000))
//--- { //--- {
//--- _errorMessageDialog->showMessage(tr("wine not installed"), tr( //--- m_errorMessageDialog->showMessage(tr("wine not installed"), tr(
//--- "There exists only a win32 executable of the indenter and wine does not seem to be installed. Please install wine to be able to run the indenter.")); //--- "There exists only a win32 executable of the indenter and wine does not seem to be installed. Please install wine to be able to run the indenter."));
//--- m_indenterExecutableCallString = ""; //--- m_indenterExecutableCallString = "";
//--- return false; //--- return false;
@ -1514,7 +1519,7 @@ void IndentHandler::setIndenter(int indenterID)
//--- { //--- {
//--- m_indenterExecutableCallString = "\"" + //--- m_indenterExecutableCallString = "\"" +
//--- TQFileInfo(m_indenterDirectoryStr).absoluteFilePath() + "/"; //--- TQFileInfo(m_indenterDirectoryStr).absoluteFilePath() + "/";
//--- m_indenterExecutableCallString += _indenterFileName + suffix + "\""; //--- m_indenterExecutableCallString += m_indenterFileName + suffix + "\"";
//--- m_indenterExecutableCallString = "wine " + m_indenterExecutableCallString; //--- m_indenterExecutableCallString = "wine " + m_indenterExecutableCallString;
//--- //---
//--- return true; //--- return true;
@ -1524,17 +1529,17 @@ void IndentHandler::setIndenter(int indenterID)
//--- //---
//--- m_indenterExecutableCallString = ""; //--- m_indenterExecutableCallString = "";
//--- m_indenterExecutableSuffix = ""; //--- m_indenterExecutableSuffix = "";
//--- return false; return false;
//--- } }
//---
//--- /* //--- /*
//--- \brief Returns a string that points to where the indenters manual can be found. //--- \brief Returns a string that points to where the indenters manual can be found.
//--- */ //--- */
//--- TQString IndentHandler::getManual() //--- TQString IndentHandler::getManual()
//--- { //--- {
//--- if (_indenterSettings != nullptr) //--- if (m_indenterSettings != nullptr)
//--- { //--- {
//--- return _indenterSettings->value("header/manual").toString(); //--- return m_indenterSettings->value("header/manual").toString();
//--- } //--- }
//--- else //--- else
//--- { //--- {
@ -1575,19 +1580,17 @@ void IndentHandler::showIndenterManual() const
*/ */
void IndentHandler::openConfigFileDialog() void IndentHandler::openConfigFileDialog()
{ {
//--- TQString configFilePath; TQString configFilePath = TQFileDialog::getOpenFileName(getIndenterCfgFile(), "All files (*.*)",
//--- nullptr, nullptr, tr("Choose indenter config file"));
//--- configFilePath = TQFileDialog::getOpenFileName(nullptr, tr(
//--- "Choose indenter config file"), getIndenterCfgFile(), "All files (*.*)"); if (!configFilePath.isEmpty())
//--- {
//--- if (configFilePath != "") // If the config file was loaded successfully, inform any who is interested about it.
//--- { if (loadConfigFile(configFilePath))
//--- // If the config file was loaded successfully, inform any who is interested about it. {
//--- if (loadConfigFile(configFilePath)) handleChangedIndenterSettings();
//--- { }
//--- handleChangedIndenterSettings(); }
//--- }
//--- }
} }
/* /*
@ -1645,7 +1648,7 @@ void IndentHandler::createIndenterCallShellScript()
//--- if (outSrcFile.open(TQFile::ReadWrite | TQFile::Text)) //--- if (outSrcFile.open(TQFile::ReadWrite | TQFile::Text))
//--- { //--- {
//--- TQString shellScriptConfigFilename = TQFileInfo(shellScriptFileName).baseName() + "." + //--- TQString shellScriptConfigFilename = TQFileInfo(shellScriptFileName).baseName() + "." +
//--- TQFileInfo(_globalConfigFilename).suffix(); //--- TQFileInfo(m_globalConfigFilename).suffix();
//--- //---
//--- // Get the content of the shell/batch script. //--- // Get the content of the shell/batch script.
//--- TQString indenterCallShellScript = generateShellScript(shellScriptConfigFilename); //--- TQString indenterCallShellScript = generateShellScript(shellScriptConfigFilename);
@ -1662,7 +1665,7 @@ void IndentHandler::createIndenterCallShellScript()
//--- //---
//--- // Save the indenter config file to the same directory, where the shell srcipt was saved to, //--- // Save the indenter config file to the same directory, where the shell srcipt was saved to,
//--- // because the script will reference it there via "./". //--- // because the script will reference it there via "./".
//--- if (!_globalConfigFilename.isEmpty()) //--- if (!m_globalConfigFilename.isEmpty())
//--- { //--- {
//--- saveConfigFile(TQFileInfo( //--- saveConfigFile(TQFileInfo(
//--- shellScriptFileName).path() + "/" + shellScriptConfigFilename, //--- shellScriptFileName).path() + "/" + shellScriptConfigFilename,
@ -1677,13 +1680,13 @@ void IndentHandler::createIndenterCallShellScript()
*/ */
void IndentHandler::resetIndenterParameter() void IndentHandler::resetIndenterParameter()
{ {
//--- int messageBoxAnswer = TQMessageBox::question(this, tr("Really reset parameters?"), tr( int messageBoxAnswer = TQMessageBox::question(this, tr("Really reset parameters?"),
//--- "Do you really want to reset the indenter parameters to the default values?"), tr("Do you really want to reset the indenter parameters to the default values?"),
//--- TQMessageBox::Yes | TQMessageBox::Abort); TQMessageBox::Yes, TQMessageBox::Cancel);
//--- if (messageBoxAnswer == TQMessageBox::Yes) if (messageBoxAnswer == TQMessageBox::Yes)
//--- { {
//--- resetToDefaultValues(); resetToDefaultValues();
//--- } }
} }
//--- /* //--- /*
@ -1709,15 +1712,15 @@ void IndentHandler::resetIndenterParameter()
//--- return TQWidget::event(event); //--- return TQWidget::event(event);
//--- } //--- }
//--- } //--- }
//---
//--- /* /*
//--- \brief Emits the \a indenterSettingsChanged signal \brief Emits the \a indenterSettingsChanged signal
//--- */ */
//--- void IndentHandler::handleChangedIndenterSettings() void IndentHandler::handleChangedIndenterSettings()
//--- { {
//--- emit(indenterSettingsChanged()); emit(indenterSettingsChanged());
//--- } }
//---
//--- /* //--- /*
//--- \brief Returns the id (list index) of the currently selected indenter. //--- \brief Returns the id (list index) of the currently selected indenter.
//--- */ //--- */

@ -23,7 +23,7 @@
#include <tqwidget.h> #include <tqwidget.h>
class MainWindow; class MainWindow;
///-- class UiGuiErrorMessage; class UiGuiErrorMessage;
///-- class UiGuiIniFileParser; ///-- class UiGuiIniFileParser;
class TQComboBox; class TQComboBox;
@ -47,21 +47,21 @@ class IndentHandler : public TQWidget
///-- TQString generateShellScript(const TQString &configFilename); ///-- TQString generateShellScript(const TQString &configFilename);
///-- TQString callIndenter(TQString sourceCode, TQString inputFileExtension); ///-- TQString callIndenter(TQString sourceCode, TQString inputFileExtension);
///-- bool loadConfigFile(TQString filePathName); bool loadConfigFile(const TQString &filePathName);
///-- void resetToDefaultValues(); void resetToDefaultValues();
///-- TQStringList getAvailableIndenters(); TQStringList getAvailableIndenters();
///-- TQString getPossibleIndenterFileExtensions(); ///-- TQString getPossibleIndenterFileExtensions();
///-- TQString getParameterString(); TQString getParameterString();
///-- TQString getIndenterCfgFile(); TQString getIndenterCfgFile();
///-- TQString getManual(); ///-- TQString getManual();
///-- TQString getCurrentIndenterName(); ///-- TQString getCurrentIndenterName();
void contextMenuEvent(TQContextMenuEvent *event); void contextMenuEvent(TQContextMenuEvent *event);
///-- int getIndenterId(); ///-- int getIndenterId();
///-- ///--
///-- signals: signals:
///-- void indenterSettingsChanged(); void indenterSettingsChanged();
///-- void selectedIndenterIndexChanged(int index); ///-- void selectedIndenterIndexChanged(int index);
///--
///-- protected: ///-- protected:
///-- bool event(TQEvent *event); ///-- bool event(TQEvent *event);
///-- void wheelEvent(TQWheelEvent *event); ///-- void wheelEvent(TQWheelEvent *event);
@ -73,14 +73,14 @@ class IndentHandler : public TQWidget
void saveasIndentCfgFileDialog(); void saveasIndentCfgFileDialog();
void createIndenterCallShellScript(); void createIndenterCallShellScript();
void resetIndenterParameter(); void resetIndenterParameter();
///-- void handleChangedIndenterSettings(); void handleChangedIndenterSettings();
///--
///-- private: private:
///-- TQString callExecutableIndenter(TQString sourceCode, TQString inputFileExtension); ///-- TQString callExecutableIndenter(TQString sourceCode, TQString inputFileExtension);
///-- TQString callJavaScriptIndenter(TQString sourceCode); ///-- TQString callJavaScriptIndenter(TQString sourceCode);
///-- void saveConfigFile(TQString filePathName, TQString parameterString); void saveConfigFile(const TQString &filePathName, const TQString &parameterString);
///-- void readIndentIniFile(TQString iniFilePath); void readIndentIniFile(const TQString &iniFilePath);
///-- bool createIndenterCallString(); bool createIndenterCallString();
///-- ///--
///-- // Holds a reference to all created pages of the parameter categories toolbox and the pages ///-- // Holds a reference to all created pages of the parameter categories toolbox and the pages
///-- // boxlayout ///-- // boxlayout
@ -146,18 +146,18 @@ class IndentHandler : public TQWidget
///-- // Vertical layout box, into which the toolbox will be added ///-- // Vertical layout box, into which the toolbox will be added
TQVBoxLayout *m_toolBoxContainerLayout; TQVBoxLayout *m_toolBoxContainerLayout;
TQToolBox *m_indenterParameterCategoriesToolBox; TQToolBox *m_indenterParameterCategoriesToolBox;
///-- UiGuiIniFileParser *_indenterSettings; ///-- UiGuiIniFileParser *m_indenterSettings;
///-- TQStringList _indenterParameters; ///-- TQStringList _indenterParameters;
///-- // The indenters name in a descriptive form ///-- // The indenters name in a descriptive form
///-- TQString _indenterName; ///-- TQString _indenterName;
///-- // The indenters file name (w/o extension), that is being called ///-- // The indenters file name (w/o extension), that is being called
///-- TQString _indenterFileName; TQString m_indenterFileName;
TQString m_indenterDirectoryStr; TQString m_indenterDirectoryStr;
TQString m_tempDirectoryStr; TQString m_tempDirectoryStr;
TQString m_settingsDirectoryStr; TQString m_settingsDirectoryStr;
///-- TQStringList _indenterIniFileList; TQStringList m_indenterIniFileList;
///-- TQString _parameterOrder; ///-- TQString _parameterOrder;
///-- TQString _globalConfigFilename; TQString m_globalConfigFilename;
///-- TQString _cfgFileParameterEnding; ///-- TQString _cfgFileParameterEnding;
///-- TQString _inputFileParameter; ///-- TQString _inputFileParameter;
///-- TQString _inputFileName; ///-- TQString _inputFileName;
@ -168,7 +168,7 @@ class IndentHandler : public TQWidget
///-- TQString _indenterShowHelpParameter; ///-- TQString _indenterShowHelpParameter;
MainWindow *m_mainWindow; MainWindow *m_mainWindow;
TQWidget *m_parent; TQWidget *m_parent;
///-- UiGuiErrorMessage *_errorMessageDialog; UiGuiErrorMessage *m_errorMessageDialog;
TQString m_indenterExecutableCallString; TQString m_indenterExecutableCallString;
TQString m_indenterExecutableSuffix; TQString m_indenterExecutableSuffix;
///-- ///--

@ -464,10 +464,10 @@ void MainWindow::initIndenter()
m_indentHandler = new IndentHandler(m_currentIndenterID, this, m_centralSplitter); m_indentHandler = new IndentHandler(m_currentIndenterID, this, m_centralSplitter);
m_centralSplitter->moveToFirst(m_indentHandler); m_centralSplitter->moveToFirst(m_indentHandler);
///-- // If _settings for the indenter have changed, let the main window know aboud it. // If _settings for the indenter have changed, let the main window know aboud it.
///-- connect(m_indentHandler, SIGNAL(indenterSettingsChanged()), this, connect(m_indentHandler, SIGNAL(indenterSettingsChanged()), this,
///-- SLOT(indentSettingsChangedSlot())); SLOT(indentSettingsChangedSlot()));
///--
///-- // Set this true, so the indenter is called at first program start ///-- // Set this true, so the indenter is called at first program start
///-- _indentSettingsChanged = true; ///-- _indentSettingsChanged = true;
///-- m_previewToggled = true; ///-- m_previewToggled = true;
@ -864,14 +864,14 @@ void MainWindow::sourceCodeChangedSlot()
///-- //m_qSciSourceCodeEditor->SendScintilla(QsciScintillaBase::SCI_SETANCHOR, 50); ///-- //m_qSciSourceCodeEditor->SendScintilla(QsciScintillaBase::SCI_SETANCHOR, 50);
} }
///-- /* /*
///-- \brief This slot is called whenever one of the indenter _settings are changed. \brief This slot is called whenever one of the indenter settings are changed.
///--
///-- It calls the selected indenter if the preview is turned on. If preview It calls the selected indenter if the preview is turned on. If preview
///-- is not active a flag is set, that the _settings have changed. is not active, set a flag to indicate that the settings have changed.
///-- */ */
///-- void MainWindow::indentSettingsChangedSlot() void MainWindow::indentSettingsChangedSlot()
///-- { {
///-- _indentSettingsChanged = true; ///-- _indentSettingsChanged = true;
///-- ///--
///-- int cursorLine, cursorPos; ///-- int cursorLine, cursorPos;
@ -911,7 +911,7 @@ void MainWindow::sourceCodeChangedSlot()
///-- m_qSciSourceCodeEditor->setModified(true); // Has no effect according to TQScintilla docs. ///-- m_qSciSourceCodeEditor->setModified(true); // Has no effect according to TQScintilla docs.
///-- m_documentModified = true; ///-- m_documentModified = true;
///-- } ///-- }
///-- } }
/* /*
\brief This slot is called whenever the preview button is turned on or off. \brief This slot is called whenever the preview button is turned on or off.

@ -66,7 +66,7 @@ class MainWindow : public MainWindowBase
void setWhiteSpaceVisibility(bool visible); void setWhiteSpaceVisibility(bool visible);
void sourceCodeChangedHelperSlot(); void sourceCodeChangedHelperSlot();
void sourceCodeChangedSlot(); void sourceCodeChangedSlot();
///-- void indentSettingsChangedSlot(); void indentSettingsChangedSlot();
void previewTurnedOnOff(bool turnOn); void previewTurnedOnOff(bool turnOn);
void exportToPDF(); void exportToPDF();
void exportToHTML(); void exportToHTML();

@ -19,11 +19,11 @@
#include "UiGuiErrorMessage.h" #include "UiGuiErrorMessage.h"
#include <tntqcheckbox.h> #include <ntqobjectdefs.h>
#include <tqcheckbox.h>
/* /*
\class UiGuiErrorMessage \class UiGuiErrorMessage
\ingroup grp_Dialogs
\brief UiGuiErrorMessage is a child of TQErrorMessage. But TQErrorMessages \brief UiGuiErrorMessage is a child of TQErrorMessage. But TQErrorMessages
"Do not show again" didn't work with my strings, so this is my own, working "Do not show again" didn't work with my strings, so this is my own, working
implementation of it. implementation of it.
@ -32,16 +32,15 @@
/* /*
\brief Initializes the dialog. \brief Initializes the dialog.
Retrieves the object pointer to the \a m_showAgainCheckBox check box, sets the dialogs
Retrieves the object pointer to the \a _showAgainCheckBox check box, sets the dialogs
modality and for a working translation sets the check box text. modality and for a working translation sets the check box text.
*/ */
UiGuiErrorMessage::UiGuiErrorMessage(TQWidget *parent) : UiGuiErrorMessage::UiGuiErrorMessage(TQWidget *parent) :
TQErrorMessage(parent) TQErrorMessage(parent)
{ {
_showAgainCheckBox = findChild<TQCheckBox*>(); m_showAgainCheckBox = Q_CHILD(this, TQCheckBox, "again");
setWindowModality(TQt::ApplicationModal); setModal(true);
_showAgainCheckBox->setText(tr("Show this message again")); m_showAgainCheckBox->setText(tr("Show this message again"));
} }
/* /*
@ -53,7 +52,6 @@ UiGuiErrorMessage::~UiGuiErrorMessage(void)
/* /*
\brief Shows an error \a message in a dialog box with \a title. \brief Shows an error \a message in a dialog box with \a title.
The shown \a message is added to a list, if not already in there. If it is The shown \a message is added to a list, if not already in there. If it is
already in that list and "Show this message again" is not checked, that already in that list and "Show this message again" is not checked, that
message will not be shown. message will not be shown.
@ -62,25 +60,25 @@ void UiGuiErrorMessage::showMessage(const TQString &title, const TQString &messa
{ {
bool showAgain = true; bool showAgain = true;
if (_showAgainCheckBox != 0) if (m_showAgainCheckBox)
{ {
showAgain = _showAgainCheckBox->isChecked(); showAgain = m_showAgainCheckBox->isChecked();
} }
setWindowTitle(title); setCaption(title);
if (!_errorMessageList.contains(message)) if (!m_errorMessageList.contains(message))
{ {
_errorMessageList << message; m_errorMessageList << message;
if (_showAgainCheckBox != 0) if (m_showAgainCheckBox)
{ {
_showAgainCheckBox->setChecked(true); m_showAgainCheckBox->setChecked(true);
} }
TQErrorMessage::showMessage(message); TQErrorMessage::message(message);
} }
else if (showAgain) else if (showAgain)
{ {
TQErrorMessage::showMessage(message); TQErrorMessage::message(message);
} }
} }
@ -91,3 +89,5 @@ void UiGuiErrorMessage::showMessage(const TQString &message)
{ {
showMessage("UniversalIndentGUI", message); showMessage("UniversalIndentGUI", message);
} }
#include "UiGuiErrorMessage.moc"

@ -20,7 +20,8 @@
#ifndef UIGUIERRORMESSAGE_H #ifndef UIGUIERRORMESSAGE_H
#define UIGUIERRORMESSAGE_H #define UIGUIERRORMESSAGE_H
#include <tntqerrormessage.h> #include <tqerrormessage.h>
#include <tqstringlist.h>
class TQCheckBox; class TQCheckBox;
@ -30,15 +31,15 @@ class UiGuiErrorMessage : public TQErrorMessage
Q_OBJECT Q_OBJECT
public: public:
UiGuiErrorMessage(TQWidget *parent = 0); UiGuiErrorMessage(TQWidget *parent = nullptr);
~UiGuiErrorMessage(void); ~UiGuiErrorMessage(void);
void showMessage(const TQString &message); void showMessage(const TQString &message);
void showMessage(const TQString &title, const TQString &message); void showMessage(const TQString &title, const TQString &message);
private: private:
TQCheckBox *_showAgainCheckBox; TQCheckBox *m_showAgainCheckBox;
TQStringList _errorMessageList; TQStringList m_errorMessageList;
}; };
#endif // UIGUIERRORMESSAGE_H #endif // UIGUIERRORMESSAGE_H

@ -19,23 +19,20 @@
#include "UiGuiIniFileParser.h" #include "UiGuiIniFileParser.h"
#include <tntqfile.h> #include <tqfile.h>
#include <tntqstringlist.h> #include <tqstringlist.h>
#include <tntqvariant.h> #include <tqvariant.h>
#include <tntqtextstream.h> #include <tqtextstream.h>
// \defgroup grp_Settings All concerning applications settings.
/* /*
\class UiGuiIniFileParser \class UiGuiIniFileParser
\ingroup grp_Settings
\brief UiGuiIniFileParser is a simple ini file format parser. \brief UiGuiIniFileParser is a simple ini file format parser.
These ini files need to have key-value pairs in the style These ini files need to have key-value pairs in the style
"keyname=keyvalue". Groups can be defined by writing the groupname "key=value". Groups can be defined by writing the groupname
in the style [groupname] before some key-value pairs. in the style [groupname] before some key-value pairs.
The reason why I use my own class instead of TQSettings is mainly, that The reason why I use my own class instead of TQSettings is mainly that
TQSettings always internally sorts the groups alphabetically and also TQSettings always internally sorts the groups alphabetically and also
rewrites a settings file sorted. Very annoying for me. rewrites a settings file sorted. Very annoying for me.
*/ */
@ -54,15 +51,15 @@ UiGuiIniFileParser::UiGuiIniFileParser(void)
UiGuiIniFileParser::UiGuiIniFileParser(const TQString &iniFileName) UiGuiIniFileParser::UiGuiIniFileParser(const TQString &iniFileName)
{ {
init(); init();
_iniFileName = iniFileName; m_iniFileName = iniFileName;
parseIniFile(); parseIniFile();
} }
void UiGuiIniFileParser::init() void UiGuiIniFileParser::init()
{ {
_sections.clear(); m_sections.clear();
_keyValueMap.clear(); m_keyValueMap.clear();
_iniFileName = ""; m_iniFileName = TQString::null;
} }
UiGuiIniFileParser::~UiGuiIniFileParser(void) UiGuiIniFileParser::~UiGuiIniFileParser(void)
@ -74,14 +71,7 @@ UiGuiIniFileParser::~UiGuiIniFileParser(void)
*/ */
TQStringList UiGuiIniFileParser::childGroups() TQStringList UiGuiIniFileParser::childGroups()
{ {
TQStringList sectionsStringList; return m_sections;
for (unsigned int i = 0; i < _sections.size(); i++)
{
sectionsStringList << _sections[i];
}
return sectionsStringList;
} }
/* /*
@ -94,7 +84,11 @@ TQStringList UiGuiIniFileParser::childGroups()
*/ */
TQVariant UiGuiIniFileParser::value(const TQString &keyName, const TQString &defaultValue) TQVariant UiGuiIniFileParser::value(const TQString &keyName, const TQString &defaultValue)
{ {
return _keyValueMap.value(keyName, defaultValue); if (m_keyValueMap.contains(keyName))
{
return m_keyValueMap[keyName];
}
return TQVariant(defaultValue);
} }
/* /*
@ -102,37 +96,35 @@ TQVariant UiGuiIniFileParser::value(const TQString &keyName, const TQString &def
*/ */
void UiGuiIniFileParser::parseIniFile() void UiGuiIniFileParser::parseIniFile()
{ {
TQFile iniFile(_iniFileName); TQFile iniFile(m_iniFileName);
if (iniFile.open(TQFile::ReadOnly)) if (iniFile.open(IO_ReadOnly))
{ {
// Clear the vectors holding the keys and values. // Clear the vectors holding the keys and values.
_sections.clear(); m_sections.clear();
_keyValueMap.clear(); m_keyValueMap.clear();
TQTextStream iniFileStream(&iniFile); TQTextStream iniFileStream(&iniFile);
TQString line; TQString line;
TQString currentSectionName = ""; TQString currentSectionName = TQString::null;
TQString keyName = ""; TQString keyName = TQString::null;
TQString valueAsString = ""; TQString valueAsString = TQString::null;
while (!iniFileStream.atEnd()) while (!iniFileStream.atEnd())
{ {
line = iniFileStream.readLine().trimmed(); line = iniFileStream.readLine().stripWhiteSpace();
// Test if the read line is a section name and if so remeber it. // Test if the read line is a section name and if so remeber it.
if (line.startsWith("[") && line.endsWith("]")) if (line.startsWith("[") && line.endsWith("]"))
{ {
currentSectionName = line.remove(0, 1);
currentSectionName.chop(1);
// Store the section name. // Store the section name.
_sections.push_back(currentSectionName); currentSectionName = line.mid(1, line.length() - 2);
m_sections.push_back(currentSectionName);
} }
// Otherwise test whether the line has a assign char // Otherwise test whether the line has a assign char
else if (line.contains("=")) else if (line.contains("="))
{ {
int indexOfFirstAssign = line.indexOf("="); int indexOfFirstAssign = line.find("=");
keyName = line.left(indexOfFirstAssign); keyName = line.left(indexOfFirstAssign);
if (!keyName.isEmpty()) if (!keyName.isEmpty())
@ -141,8 +133,7 @@ void UiGuiIniFileParser::parseIniFile()
// Remove any existing double quotes from the value. // Remove any existing double quotes from the value.
if (valueAsString.startsWith("\"") && valueAsString.endsWith("\"")) if (valueAsString.startsWith("\"") && valueAsString.endsWith("\""))
{ {
valueAsString = valueAsString.remove(0, 1); valueAsString = valueAsString.mid(1, valueAsString.length() - 2);
valueAsString.chop(1);
} }
// Prepend an eventually section name to the key name. // Prepend an eventually section name to the key name.
@ -152,7 +143,7 @@ void UiGuiIniFileParser::parseIniFile()
} }
// Store the key and value in the map. // Store the key and value in the map.
_keyValueMap.insert(keyName, valueAsString); m_keyValueMap.insert(keyName, valueAsString);
} }
} }
} }

@ -20,10 +20,9 @@
#ifndef UIGUIINIFILEPARSER_H #ifndef UIGUIINIFILEPARSER_H
#define UIGUIINIFILEPARSER_H #define UIGUIINIFILEPARSER_H
#include <tntqmap.h> #include <tqmap.h>
#include <tntqstring.h> #include <tqstring.h>
#include <tqstringlist.h>
#include <vector>
class TQStringList; class TQStringList;
class TQVariant; class TQVariant;
@ -36,7 +35,7 @@ class UiGuiIniFileParser
UiGuiIniFileParser(const TQString &iniFileName); UiGuiIniFileParser(const TQString &iniFileName);
~UiGuiIniFileParser(void); ~UiGuiIniFileParser(void);
TQVariant value(const TQString &keyName, const TQString &defaultValue = ""); TQVariant value(const TQString &keyName, const TQString &defaultValue = TQString::null);
TQStringList childGroups(); TQStringList childGroups();
protected: protected:
@ -45,9 +44,9 @@ class UiGuiIniFileParser
private: private:
void parseIniFile(); void parseIniFile();
TQString _iniFileName; TQString m_iniFileName;
std::vector<TQString> _sections; TQStringList m_sections;
TQMap<TQString, TQVariant> _keyValueMap; TQMap<TQString, TQVariant> m_keyValueMap;
}; };
#endif // UIGUIINIFILEPARSER_H #endif
Loading…
Cancel
Save