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