UniversalIndentGUI 1.2.0
Classes | Signals | Public Member Functions | Protected Member Functions | Private Slots | Private Member Functions | Private Attributes
IndentHandler Class Reference

A widget for handling many indenters that are configured by an ini file. More...

#include <IndentHandler.h>

Inheritance diagram for IndentHandler:
Inheritance graph
[legend]

List of all members.

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.

Detailed Description

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.


Constructor & Destructor Documentation

IndentHandler::IndentHandler ( int  indenterID,
QWidget mainWindow = NULL,
QWidget parent = NULL 
)
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().

Here is the call graph for this function:


Member Function Documentation

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().

Here is the call graph for this function:

Here is the caller graph for this function:

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().

Here is the call graph for this function:

Here is the caller graph for this function:

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().

Here is the caller graph for this function:

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().

Here is the call graph for this function:

void IndentHandler::createIndenterCallShellScript ( ) [private, slot]

Referenced by IndentHandler().

Here is the caller graph for this function:

bool IndentHandler::createIndenterCallString ( ) [private]

Referenced by IndentHandler().

Here is the caller graph for this function:

QString IndentHandler::encodeToHTML ( const QString &  text) [private]

Referenced by callExecutableIndenter().

Here is the caller graph for this function:

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().

Here is the call graph for this function:

QStringList IndentHandler::getAvailableIndenters ( )

Referenced by IndentHandler().

Here is the caller graph for this function:

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().

Here is the caller graph for this function:

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().

Here is the caller graph for this function:

QString IndentHandler::getManual ( )
QString IndentHandler::getParameterString ( )

Referenced by callExecutableIndenter(), generateShellScript(), and ~IndentHandler().

Here is the caller graph for this function:

QString IndentHandler::getPossibleIndenterFileExtensions ( )

Referenced by MainWindow::openSourceFileDialog(), and MainWindow::saveasSourceFileDialog().

Here is the caller graph for this function:

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().

Here is the caller graph for this function:

bool IndentHandler::loadConfigFile ( QString  filePathName)

Referenced by IndentHandler().

Here is the caller graph for this function:

void IndentHandler::openConfigFileDialog ( ) [private, slot]

Referenced by IndentHandler().

Here is the caller graph for this function:

void IndentHandler::readIndentIniFile ( QString  iniFilePath) [private]

Referenced by IndentHandler().

Here is the caller graph for this function:

void IndentHandler::resetIndenterParameter ( ) [private, slot]

Referenced by IndentHandler().

Here is the caller graph for this function:

void IndentHandler::resetToDefaultValues ( )
void IndentHandler::retranslateUi ( )

Referenced by MainWindow::changeEvent(), and IndentHandler().

Here is the caller graph for this function:

void IndentHandler::saveasIndentCfgFileDialog ( ) [private, slot]

Referenced by IndentHandler().

Here is the caller graph for this function:

void IndentHandler::saveConfigFile ( QString  filePathName,
QString  parameterString 
) [private]

Referenced by callExecutableIndenter(), and ~IndentHandler().

Here is the caller graph for this function:

void IndentHandler::selectedIndenterIndexChanged ( int  index) [signal]

Referenced by IndentHandler().

Here is the caller graph for this function:

void IndentHandler::setIndenter ( int  indenterID) [private, slot]

Referenced by IndentHandler().

Here is the caller graph for this function:

void IndentHandler::setParameterChangedCallback ( void(*)(void)  paramChangedCallback)

Referenced by DllMain(), and toggleAutoUpdate().

Here is the caller graph for this function:

void IndentHandler::setWindowClosedCallback ( void(*)(void)  winClosedCallback)

Referenced by DllMain().

Here is the caller graph for this function:

void IndentHandler::showIndenterManual ( ) [private, slot]

Referenced by IndentHandler().

Here is the caller graph for this function:

void IndentHandler::updateDrawing ( ) [private, slot]

Referenced by IndentHandler().

Here is the caller graph for this function:

void IndentHandler::wheelEvent ( QWheelEvent *  event) [protected]

Member Data Documentation

Definition at line 172 of file IndentHandler.h.

Referenced by getIndenterMenuActions(), IndentHandler(), and initIndenterMenu().

Definition at line 170 of file IndentHandler.h.

Referenced by getIndenterMenuActions(), IndentHandler(), and initIndenterMenu().

Definition at line 173 of file IndentHandler.h.

Referenced by getIndenterMenuActions(), IndentHandler(), and initIndenterMenu().

Definition at line 171 of file IndentHandler.h.

Referenced by getIndenterMenuActions(), IndentHandler(), and initIndenterMenu().

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.

Definition at line 155 of file IndentHandler.h.

Referenced by callExecutableIndenter(), and generateShellScript().

Definition at line 150 of file IndentHandler.h.

Referenced by callExecutableIndenter(), and IndentHandler().

Definition at line 167 of file IndentHandler.h.

Referenced by callIndenter(), and IndentHandler().

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.

Definition at line 143 of file IndentHandler.h.

Referenced by IndentHandler().

Definition at line 97 of file IndentHandler.h.

Definition at line 140 of file IndentHandler.h.

Referenced by IndentHandler().

QStringList IndentHandler::_indenterParameters [private]

Definition at line 145 of file IndentHandler.h.

Definition at line 139 of file IndentHandler.h.

Referenced by IndentHandler().

Definition at line 144 of file IndentHandler.h.

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().

Definition at line 157 of file IndentHandler.h.

Referenced by callExecutableIndenter(), and generateShellScript().

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().

Definition at line 159 of file IndentHandler.h.

Referenced by callExecutableIndenter(), and generateShellScript().

Definition at line 106 of file IndentHandler.h.

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().

Definition at line 137 of file IndentHandler.h.

Definition at line 126 of file IndentHandler.h.

Definition at line 116 of file IndentHandler.h.

Definition at line 152 of file IndentHandler.h.

Referenced by IndentHandler(), and ~IndentHandler().

Definition at line 151 of file IndentHandler.h.

Referenced by callExecutableIndenter(), and IndentHandler().

Vertical layout box, into which the toolbox will be added.

Definition at line 142 of file IndentHandler.h.

Referenced by IndentHandler().

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.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines