UniversalIndentGUI 1.2.0
|
A widget for handling many indenters that are configured by an ini file. More...
#include <IndentHandler.h>
Classes | |
struct | IndenterParameterCategoryPage |
Holds a reference to all created pages of the parameter categories toolbox and the pages boxlayout. More... | |
struct | ParamBoolean |
Holds a reference to all checkboxes needed for boolean parameter setting and the parameters name. More... | |
struct | ParamMultiple |
Hold a reference to all combo boxes needed for parameter setting and the parameters name. More... | |
struct | ParamNumeric |
Hold a reference to all spin boxes needed for parameter setting and the parameters name. More... | |
struct | ParamString |
Holds a reference to all line edits needed for parameter setting and the parameters name. More... | |
Signals | |
void | indenterSettingsChanged () |
void | selectedIndenterIndexChanged (int index) |
Public Member Functions | |
QString | callIndenter (QString sourceCode, QString inputFileExtension) |
Format sourceCode by calling the indenter. | |
void | contextMenuEvent (QContextMenuEvent *event) |
Opens the context menu, used for some actions like saving the indenter config file, at the event position. | |
QString | generateShellScript (const QString &configFilename) |
Creates the content for a shell script that can be used as a external tool call to indent an as parameter defined file. | |
QStringList | getAvailableIndenters () |
QString | getCurrentIndenterName () |
QString | getIndenterCfgFile () |
int | getIndenterId () |
QMenu * | getIndenterMenu () |
Returns the context menu used for some actions like saving the indenter config file. | |
QList< QAction * > | getIndenterMenuActions () |
Returns the actions of the context menu used for some actions like saving the indenter config file. | |
QString | getManual () |
QString | getParameterString () |
QString | getPossibleIndenterFileExtensions () |
IndentHandler (int indenterID, QWidget *mainWindow=NULL, QWidget *parent=NULL) | |
Constructor of the indent handler. | |
bool | loadConfigFile (QString filePathName) |
void | resetToDefaultValues () |
void | retranslateUi () |
void | setParameterChangedCallback (void(*paramChangedCallback)(void)) |
void | setWindowClosedCallback (void(*winClosedCallback)(void)) |
~IndentHandler () | |
Implicitly writes the current indenter parameters to the indenters config file. | |
Protected Member Functions | |
void | closeEvent (QCloseEvent *event) |
bool | event (QEvent *event) |
void | wheelEvent (QWheelEvent *event) |
Private Slots | |
void | createIndenterCallShellScript () |
void | handleChangedIndenterSettings () |
void | openConfigFileDialog () |
void | resetIndenterParameter () |
void | saveasIndentCfgFileDialog () |
void | setIndenter (int indenterID) |
void | showIndenterManual () |
void | updateDrawing () |
Private Member Functions | |
QString | callExecutableIndenter (QString sourceCode, QString inputFileExtension) |
Format sourceCode by calling the binary executable of the indenter. | |
QString | callJavaScriptIndenter (QString sourceCode) |
Format sourceCode by calling the interpreted JavaScript code of the indenter. | |
bool | createIndenterCallString () |
QString | encodeToHTML (const QString &text) |
void | initIndenterMenu () |
Initializes the context menu used for some actions like saving the indenter config file. | |
void | readIndentIniFile (QString iniFilePath) |
void | saveConfigFile (QString filePathName, QString parameterString) |
Private Attributes | |
QAction * | _actionCreateShellScript |
QAction * | _actionLoadIndenterConfigFile |
QAction * | _actionResetIndenterParameters |
QAction * | _actionSaveIndenterConfigFile |
QString | _cfgFileParameterEnding |
UiGuiErrorMessage * | _errorMessageDialog |
QString | _fileTypes |
QString | _globalConfigFilename |
QString | _indenterDirctoryStr |
QString | _indenterExecutableCallString |
QString | _indenterExecutableSuffix |
QString | _indenterFileName |
The indenters file name (w/o extension), that is being called. | |
QStringList | _indenterIniFileList |
QString | _indenterName |
The indenters name in a descriptive form. | |
QToolBox * | _indenterParameterCategoriesToolBox |
QVector < IndenterParameterCategoryPage > | _indenterParameterCategoryPages |
QToolButton * | _indenterParameterHelpButton |
QStringList | _indenterParameters |
QComboBox * | _indenterSelectionCombobox |
UiGuiIniFileParser * | _indenterSettings |
QString | _indenterShowHelpParameter |
QString | _inputFileName |
QString | _inputFileParameter |
QWidget * | _mainWindow |
QMenu * | _menuIndenter |
QString | _outputFileName |
QString | _outputFileParameter |
QVector< ParamBoolean > | _paramBooleans |
void(* | _parameterChangedCallback )(void) |
Needed for the NPP plugin. | |
QString | _parameterOrder |
QVector< ParamMultiple > | _paramMultiples |
QVector< ParamNumeric > | _paramNumerics |
QVector< ParamString > | _paramStrings |
QString | _settingsDirctoryStr |
QString | _tempDirctoryStr |
QVBoxLayout * | _toolBoxContainerLayout |
Vertical layout box, into which the toolbox will be added. | |
QString | _useCfgFileParameter |
void(* | _windowClosedCallback )(void) |
Needed for the NPP plugin. |
A widget for handling many indenters that are configured by an ini file.
This is a widget that is used by the main window. It handles access to the indenter config file and calls the chosen indenter to reformat the source text. Calls the indenter each time a setting has been changed and informs the main window about the reformatted source code.
Definition at line 39 of file IndentHandler.h.
IndentHandler::IndentHandler | ( | int | indenterID, |
QWidget * | mainWindow = NULL , |
||
QWidget * | parent = NULL |
||
) |
Constructor of the indent handler.
By calling this constructor the indenter to be loaded, can be selected by setting its indenterID, which is the number of found indenter ini files in alphabetic order starting at index 0.
Definition at line 84 of file IndentHandler.cpp.
References _actionCreateShellScript, _actionLoadIndenterConfigFile, _actionResetIndenterParameters, _actionSaveIndenterConfigFile, _errorMessageDialog, _indenterDirctoryStr, _indenterExecutableCallString, _indenterExecutableSuffix, _indenterFileName, _indenterIniFileList, _indenterParameterCategoriesToolBox, _indenterParameterHelpButton, _indenterSelectionCombobox, _mainWindow, _settingsDirctoryStr, _tempDirctoryStr, _toolBoxContainerLayout, createIndenterCallShellScript(), createIndenterCallString(), getAvailableIndenters(), SettingsPaths::getIndenterPath(), UiGuiSettings::getInstance(), SettingsPaths::getSettingsPath(), SettingsPaths::getTempPath(), initIndenterMenu(), loadConfigFile(), openConfigFileDialog(), readIndentIniFile(), resetIndenterParameter(), retranslateUi(), saveasIndentCfgFileDialog(), selectedIndenterIndexChanged(), setIndenter(), showIndenterManual(), UiGuiErrorMessage::showMessage(), and updateDrawing().
IndentHandler::~IndentHandler | ( | ) |
Implicitly writes the current indenter parameters to the indenters config file.
Definition at line 206 of file IndentHandler.cpp.
References _errorMessageDialog, _indenterFileName, _settingsDirctoryStr, getParameterString(), and saveConfigFile().
QString IndentHandler::callExecutableIndenter | ( | QString | sourceCode, |
QString | inputFileExtension | ||
) | [private] |
Format sourceCode by calling the binary executable of the indenter.
The inputFileExtension has to be given as parameter so the called indenter can identify the programming language if needed.
Definition at line 410 of file IndentHandler.cpp.
References _errorMessageDialog, _globalConfigFilename, _indenterDirctoryStr, _indenterExecutableCallString, _indenterFileName, _inputFileName, _inputFileParameter, _outputFileName, _outputFileParameter, _parameterOrder, _tempDirctoryStr, _useCfgFileParameter, encodeToHTML(), getParameterString(), saveConfigFile(), and UiGuiErrorMessage::showMessage().
Referenced by callIndenter().
QString IndentHandler::callIndenter | ( | QString | sourceCode, |
QString | inputFileExtension | ||
) |
Format sourceCode by calling the indenter.
The inputFileExtension has to be given as parameter so the called indenter can identify the programming language if needed.
Definition at line 371 of file IndentHandler.cpp.
References _indenterExecutableSuffix, callExecutableIndenter(), and callJavaScriptIndenter().
Referenced by MainWindow::callIndenter(), and indentText().
QString IndentHandler::callJavaScriptIndenter | ( | QString | sourceCode | ) | [private] |
Format sourceCode by calling the interpreted JavaScript code of the indenter.
The inputFileExtension has to be given as parameter so the called indenter can identify the programming language if needed.
Definition at line 387 of file IndentHandler.cpp.
References _indenterExecutableCallString.
Referenced by callIndenter().
void IndentHandler::closeEvent | ( | QCloseEvent * | event | ) | [protected] |
void IndentHandler::contextMenuEvent | ( | QContextMenuEvent * | event | ) |
Opens the context menu, used for some actions like saving the indenter config file, at the event position.
Definition at line 269 of file IndentHandler.cpp.
References getIndenterMenu().
void IndentHandler::createIndenterCallShellScript | ( | ) | [private, slot] |
bool IndentHandler::createIndenterCallString | ( | ) | [private] |
QString IndentHandler::encodeToHTML | ( | const QString & | text | ) | [private] |
bool IndentHandler::event | ( | QEvent * | event | ) | [protected] |
QString IndentHandler::generateShellScript | ( | const QString & | configFilename | ) |
Creates the content for a shell script that can be used as a external tool call to indent an as parameter defined file.
Definition at line 278 of file IndentHandler.cpp.
References _globalConfigFilename, _indenterExecutableCallString, _inputFileName, _inputFileParameter, _outputFileName, _outputFileParameter, _parameterOrder, _useCfgFileParameter, getParameterString(), and TemplateBatchScript::getTemplateBatchScript().
QStringList IndentHandler::getAvailableIndenters | ( | ) |
QString IndentHandler::getCurrentIndenterName | ( | ) |
QString IndentHandler::getIndenterCfgFile | ( | ) |
int IndentHandler::getIndenterId | ( | ) |
QMenu * IndentHandler::getIndenterMenu | ( | ) |
Returns the context menu used for some actions like saving the indenter config file.
Definition at line 251 of file IndentHandler.cpp.
References _menuIndenter.
Referenced by contextMenuEvent().
QList< QAction * > IndentHandler::getIndenterMenuActions | ( | ) |
Returns the actions of the context menu used for some actions like saving the indenter config file.
Definition at line 259 of file IndentHandler.cpp.
References _actionCreateShellScript, _actionLoadIndenterConfigFile, _actionResetIndenterParameters, and _actionSaveIndenterConfigFile.
Referenced by MainWindow::initIndenter().
QString IndentHandler::getManual | ( | ) |
QString IndentHandler::getParameterString | ( | ) |
Referenced by callExecutableIndenter(), generateShellScript(), and ~IndentHandler().
QString IndentHandler::getPossibleIndenterFileExtensions | ( | ) |
Referenced by MainWindow::openSourceFileDialog(), and MainWindow::saveasSourceFileDialog().
void IndentHandler::handleChangedIndenterSettings | ( | ) | [private, slot] |
void IndentHandler::indenterSettingsChanged | ( | ) | [signal] |
void IndentHandler::initIndenterMenu | ( | ) | [private] |
Initializes the context menu used for some actions like saving the indenter config file.
Definition at line 220 of file IndentHandler.cpp.
References _actionCreateShellScript, _actionLoadIndenterConfigFile, _actionResetIndenterParameters, _actionSaveIndenterConfigFile, and _menuIndenter.
Referenced by IndentHandler().
bool IndentHandler::loadConfigFile | ( | QString | filePathName | ) |
void IndentHandler::openConfigFileDialog | ( | ) | [private, slot] |
void IndentHandler::readIndentIniFile | ( | QString | iniFilePath | ) | [private] |
void IndentHandler::resetIndenterParameter | ( | ) | [private, slot] |
void IndentHandler::resetToDefaultValues | ( | ) |
void IndentHandler::retranslateUi | ( | ) |
Referenced by MainWindow::changeEvent(), and IndentHandler().
void IndentHandler::saveasIndentCfgFileDialog | ( | ) | [private, slot] |
void IndentHandler::saveConfigFile | ( | QString | filePathName, |
QString | parameterString | ||
) | [private] |
Referenced by callExecutableIndenter(), and ~IndentHandler().
void IndentHandler::selectedIndenterIndexChanged | ( | int | index | ) | [signal] |
void IndentHandler::setIndenter | ( | int | indenterID | ) | [private, slot] |
void IndentHandler::setParameterChangedCallback | ( | void(*)(void) | paramChangedCallback | ) |
void IndentHandler::setWindowClosedCallback | ( | void(*)(void) | winClosedCallback | ) |
void IndentHandler::showIndenterManual | ( | ) | [private, slot] |
void IndentHandler::updateDrawing | ( | ) | [private, slot] |
void IndentHandler::wheelEvent | ( | QWheelEvent * | event | ) | [protected] |
QAction* IndentHandler::_actionCreateShellScript [private] |
Definition at line 172 of file IndentHandler.h.
Referenced by getIndenterMenuActions(), IndentHandler(), and initIndenterMenu().
QAction* IndentHandler::_actionLoadIndenterConfigFile [private] |
Definition at line 170 of file IndentHandler.h.
Referenced by getIndenterMenuActions(), IndentHandler(), and initIndenterMenu().
QAction* IndentHandler::_actionResetIndenterParameters [private] |
Definition at line 173 of file IndentHandler.h.
Referenced by getIndenterMenuActions(), IndentHandler(), and initIndenterMenu().
QAction* IndentHandler::_actionSaveIndenterConfigFile [private] |
Definition at line 171 of file IndentHandler.h.
Referenced by getIndenterMenuActions(), IndentHandler(), and initIndenterMenu().
QString IndentHandler::_cfgFileParameterEnding [private] |
Definition at line 156 of file IndentHandler.h.
Definition at line 165 of file IndentHandler.h.
Referenced by callExecutableIndenter(), IndentHandler(), and ~IndentHandler().
QString IndentHandler::_fileTypes [private] |
Definition at line 161 of file IndentHandler.h.
QString IndentHandler::_globalConfigFilename [private] |
Definition at line 155 of file IndentHandler.h.
Referenced by callExecutableIndenter(), and generateShellScript().
QString IndentHandler::_indenterDirctoryStr [private] |
Definition at line 150 of file IndentHandler.h.
Referenced by callExecutableIndenter(), and IndentHandler().
QString IndentHandler::_indenterExecutableCallString [private] |
Definition at line 166 of file IndentHandler.h.
Referenced by callExecutableIndenter(), callJavaScriptIndenter(), generateShellScript(), and IndentHandler().
QString IndentHandler::_indenterExecutableSuffix [private] |
Definition at line 167 of file IndentHandler.h.
Referenced by callIndenter(), and IndentHandler().
QString IndentHandler::_indenterFileName [private] |
The indenters file name (w/o extension), that is being called.
Definition at line 149 of file IndentHandler.h.
Referenced by callExecutableIndenter(), IndentHandler(), and ~IndentHandler().
QStringList IndentHandler::_indenterIniFileList [private] |
Definition at line 153 of file IndentHandler.h.
Referenced by IndentHandler().
QString IndentHandler::_indenterName [private] |
The indenters name in a descriptive form.
Definition at line 147 of file IndentHandler.h.
QToolBox* IndentHandler::_indenterParameterCategoriesToolBox [private] |
Definition at line 143 of file IndentHandler.h.
Referenced by IndentHandler().
QVector<IndenterParameterCategoryPage> IndentHandler::_indenterParameterCategoryPages [private] |
Definition at line 97 of file IndentHandler.h.
QToolButton* IndentHandler::_indenterParameterHelpButton [private] |
Definition at line 140 of file IndentHandler.h.
Referenced by IndentHandler().
QStringList IndentHandler::_indenterParameters [private] |
Definition at line 145 of file IndentHandler.h.
QComboBox* IndentHandler::_indenterSelectionCombobox [private] |
Definition at line 139 of file IndentHandler.h.
Referenced by IndentHandler().
Definition at line 144 of file IndentHandler.h.
QString IndentHandler::_indenterShowHelpParameter [private] |
Definition at line 163 of file IndentHandler.h.
QString IndentHandler::_inputFileName [private] |
Definition at line 158 of file IndentHandler.h.
Referenced by callExecutableIndenter(), and generateShellScript().
QString IndentHandler::_inputFileParameter [private] |
Definition at line 157 of file IndentHandler.h.
Referenced by callExecutableIndenter(), and generateShellScript().
QWidget* IndentHandler::_mainWindow [private] |
Definition at line 164 of file IndentHandler.h.
Referenced by IndentHandler().
QMenu* IndentHandler::_menuIndenter [private] |
Definition at line 169 of file IndentHandler.h.
Referenced by getIndenterMenu(), and initIndenterMenu().
QString IndentHandler::_outputFileName [private] |
Definition at line 160 of file IndentHandler.h.
Referenced by callExecutableIndenter(), and generateShellScript().
QString IndentHandler::_outputFileParameter [private] |
Definition at line 159 of file IndentHandler.h.
Referenced by callExecutableIndenter(), and generateShellScript().
QVector<ParamBoolean> IndentHandler::_paramBooleans [private] |
Definition at line 106 of file IndentHandler.h.
void(* IndentHandler::_parameterChangedCallback)(void) [private] |
Needed for the NPP plugin.
Definition at line 175 of file IndentHandler.h.
QString IndentHandler::_parameterOrder [private] |
Definition at line 154 of file IndentHandler.h.
Referenced by callExecutableIndenter(), and generateShellScript().
QVector<ParamMultiple> IndentHandler::_paramMultiples [private] |
Definition at line 137 of file IndentHandler.h.
QVector<ParamNumeric> IndentHandler::_paramNumerics [private] |
Definition at line 126 of file IndentHandler.h.
QVector<ParamString> IndentHandler::_paramStrings [private] |
Definition at line 116 of file IndentHandler.h.
QString IndentHandler::_settingsDirctoryStr [private] |
Definition at line 152 of file IndentHandler.h.
Referenced by IndentHandler(), and ~IndentHandler().
QString IndentHandler::_tempDirctoryStr [private] |
Definition at line 151 of file IndentHandler.h.
Referenced by callExecutableIndenter(), and IndentHandler().
QVBoxLayout* IndentHandler::_toolBoxContainerLayout [private] |
Vertical layout box, into which the toolbox will be added.
Definition at line 142 of file IndentHandler.h.
Referenced by IndentHandler().
QString IndentHandler::_useCfgFileParameter [private] |
Definition at line 162 of file IndentHandler.h.
Referenced by callExecutableIndenter(), and generateShellScript().
void(* IndentHandler::_windowClosedCallback)(void) [private] |
Needed for the NPP plugin.
Definition at line 177 of file IndentHandler.h.