@ -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.absolute FilePath();
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.
//--- */
//--- */