UniversalIndentGUI 1.2.0
|
UiGuiHighlighter used for selecting the syntax highlighter/lexer for the QsciScintilla component. More...
#include <UiGuiHighlighter.h>
Public Slots | |
void | setColor (const QColor &color, int style=-1) |
Sets the color for the given style. | |
void | setFont (const QFont &font, int style=-1) |
Sets the font for the given style. | |
void | setHighlighterByAction (QAction *highlighterAction) |
This slot handles signals coming from selecting another syntax highlighter. | |
void | setLexerByName (QString lexerName) |
Sets the to be used lexer by giving his name. | |
int | setLexerForExtension (QString extension) |
Sets the lexer that is responsible for the given extension. | |
Public Member Functions | |
QStringList | getAvailableHighlighters () |
Returns the available highlighters as QStringList. | |
bool | readCurrentSettings (const char *prefix) |
Read the settings for the current lexer from the settings file. | |
void | turnHighlightOff () |
Turns the syntax parser off. | |
void | turnHighlightOn () |
Turns the syntax parser on. | |
UiGuiHighlighter (QsciScintilla *parent) | |
The constructor initializes some regular expressions and keywords to identify cpp tokens. | |
void | writeCurrentSettings (const char *prefix) |
Write the settings for the current lexer to the settings file. | |
Private Attributes | |
QMap< int, QColor > | _colorForStyles |
QMap< int, QFont > | _fontForStyles |
bool | _highlightningIsOn |
QsciLexer * | _lexer |
QMap< QString, QStringList > | _mapHighlighternameToExtension |
QsciScintilla * | _qsciEditorParent |
QSettings * | _settings |
UiGuiHighlighter used for selecting the syntax highlighter/lexer for the QsciScintilla component.
Definition at line 35 of file UiGuiHighlighter.h.
UiGuiHighlighter::UiGuiHighlighter | ( | QsciScintilla * | parent | ) |
The constructor initializes some regular expressions and keywords to identify cpp tokens.
Definition at line 88 of file UiGuiHighlighter.cpp.
References _highlightningIsOn, _lexer, _mapHighlighternameToExtension, _qsciEditorParent, _settings, SettingsPaths::getSettingsPath(), and setLexerForExtension().
QStringList UiGuiHighlighter::getAvailableHighlighters | ( | ) |
Returns the available highlighters as QStringList.
Definition at line 160 of file UiGuiHighlighter.cpp.
References _mapHighlighternameToExtension.
Referenced by MainWindow::changeEvent(), and MainWindow::createHighlighterMenu().
bool UiGuiHighlighter::readCurrentSettings | ( | const char * | prefix | ) |
Read the settings for the current lexer from the settings file.
Definition at line 208 of file UiGuiHighlighter.cpp.
References _colorForStyles, _fontForStyles, _lexer, _settings, setColor(), and setFont().
Referenced by setLexerForExtension(), and turnHighlightOn().
void UiGuiHighlighter::setColor | ( | const QColor & | color, |
int | style = -1 |
||
) | [slot] |
Sets the color for the given style.
The foreground color for style number style is set to color. If style is -1 then the color is set for all styles.
Definition at line 359 of file UiGuiHighlighter.cpp.
References _colorForStyles, and _lexer.
Referenced by readCurrentSettings().
void UiGuiHighlighter::setFont | ( | const QFont & | font, |
int | style = -1 |
||
) | [slot] |
Sets the font for the given style.
The font for style number style is set to font. If style is -1 then the font is set for all styles.
Definition at line 368 of file UiGuiHighlighter.cpp.
References _fontForStyles, and _lexer.
Referenced by readCurrentSettings().
void UiGuiHighlighter::setHighlighterByAction | ( | QAction * | highlighterAction | ) | [slot] |
This slot handles signals coming from selecting another syntax highlighter.
Definition at line 168 of file UiGuiHighlighter.cpp.
References _mapHighlighternameToExtension, _qsciEditorParent, and setLexerForExtension().
void UiGuiHighlighter::setLexerByName | ( | QString | lexerName | ) | [slot] |
Sets the to be used lexer by giving his name.
Definition at line 377 of file UiGuiHighlighter.cpp.
References _mapHighlighternameToExtension, and setLexerForExtension().
int UiGuiHighlighter::setLexerForExtension | ( | QString | extension | ) | [slot] |
Sets the lexer that is responsible for the given extension.
Sets the proper highlighter / lexer for the given file extension. Returns the index of the used lexer in the list.
Definition at line 385 of file UiGuiHighlighter.cpp.
References _highlightningIsOn, _lexer, _mapHighlighternameToExtension, _qsciEditorParent, readCurrentSettings(), and writeCurrentSettings().
Referenced by MainWindow::loadFile(), setHighlighterByAction(), setLexerByName(), and UiGuiHighlighter().
void UiGuiHighlighter::turnHighlightOff | ( | ) |
Turns the syntax parser off.
Definition at line 191 of file UiGuiHighlighter.cpp.
References _highlightningIsOn, and _qsciEditorParent.
Referenced by MainWindow::turnHighlightOnOff().
void UiGuiHighlighter::turnHighlightOn | ( | ) |
Turns the syntax parser on.
Definition at line 182 of file UiGuiHighlighter.cpp.
References _highlightningIsOn, _lexer, _qsciEditorParent, and readCurrentSettings().
Referenced by MainWindow::turnHighlightOnOff().
void UiGuiHighlighter::writeCurrentSettings | ( | const char * | prefix | ) |
Write the settings for the current lexer to the settings file.
Definition at line 293 of file UiGuiHighlighter.cpp.
References _colorForStyles, _fontForStyles, _lexer, and _settings.
Referenced by MainWindow::saveSettings(), and setLexerForExtension().
QMap<int, QColor> UiGuiHighlighter::_colorForStyles [private] |
Definition at line 68 of file UiGuiHighlighter.h.
Referenced by readCurrentSettings(), setColor(), and writeCurrentSettings().
QMap<int, QFont> UiGuiHighlighter::_fontForStyles [private] |
Definition at line 67 of file UiGuiHighlighter.h.
Referenced by readCurrentSettings(), setFont(), and writeCurrentSettings().
bool UiGuiHighlighter::_highlightningIsOn [private] |
Definition at line 65 of file UiGuiHighlighter.h.
Referenced by setLexerForExtension(), turnHighlightOff(), turnHighlightOn(), and UiGuiHighlighter().
QsciLexer* UiGuiHighlighter::_lexer [private] |
Definition at line 69 of file UiGuiHighlighter.h.
Referenced by readCurrentSettings(), setColor(), setFont(), setLexerForExtension(), turnHighlightOn(), UiGuiHighlighter(), and writeCurrentSettings().
QMap<QString, QStringList> UiGuiHighlighter::_mapHighlighternameToExtension [private] |
Definition at line 71 of file UiGuiHighlighter.h.
Referenced by getAvailableHighlighters(), setHighlighterByAction(), setLexerByName(), setLexerForExtension(), and UiGuiHighlighter().
QsciScintilla* UiGuiHighlighter::_qsciEditorParent [private] |
Definition at line 66 of file UiGuiHighlighter.h.
Referenced by setHighlighterByAction(), setLexerForExtension(), turnHighlightOff(), turnHighlightOn(), and UiGuiHighlighter().
QSettings* UiGuiHighlighter::_settings [private] |
Definition at line 70 of file UiGuiHighlighter.h.
Referenced by readCurrentSettings(), UiGuiHighlighter(), and writeCurrentSettings().