diff options
Diffstat (limited to 'src/UiGuiHighlighter.cpp')
-rwxr-xr-x | src/UiGuiHighlighter.cpp | 166 |
1 files changed, 83 insertions, 83 deletions
diff --git a/src/UiGuiHighlighter.cpp b/src/UiGuiHighlighter.cpp index e35a8ec..c5d7f85 100755 --- a/src/UiGuiHighlighter.cpp +++ b/src/UiGuiHighlighter.cpp @@ -21,9 +21,9 @@ #include "SettingsPaths.h" -#include <tqsettings.h> +#include <tntqsettings.h> #include <tqmenu.h> -#include <tqscrollbar.h> +#include <tntqscrollbar.h> #include <tqcoreapplication.h> #include <Qsci/qsciscintilla.h> @@ -36,7 +36,7 @@ #include <Qsci/qscilexercss.h> #include <Qsci/qscilexerd.h> #include <Qsci/qscilexerdiff.h> -#if ( QSCINTILLA_VERSION >= 0x020300 ) +#if ( TQSCINTILLA_VERSION >= 0x020300 ) #include <Qsci/qscilexerfortran.h> #include <Qsci/qscilexerfortran77.h> #endif @@ -46,30 +46,30 @@ #include <Qsci/qscilexerjavascript.h> #include <Qsci/qscilexerlua.h> #include <Qsci/qscilexermakefile.h> -#if ( QSCINTILLA_VERSION >= 0x020300 ) +#if ( TQSCINTILLA_VERSION >= 0x020300 ) #include <Qsci/qscilexerpascal.h> #endif #include <Qsci/qscilexerperl.h> -#if ( QSCINTILLA_VERSION >= 0x020300 ) +#if ( TQSCINTILLA_VERSION >= 0x020300 ) #include <Qsci/qscilexerpostscript.h> #endif #include <Qsci/qscilexerpov.h> #include <Qsci/qscilexerproperties.h> #include <Qsci/qscilexerpython.h> #include <Qsci/qscilexerruby.h> -#if ( QSCINTILLA_VERSION >= 0x020400 ) +#if ( TQSCINTILLA_VERSION >= 0x020400 ) #include <Qsci/qscilexerspice.h> #endif #include <Qsci/qscilexersql.h> -#if ( QSCINTILLA_VERSION >= 0x020300 ) +#if ( TQSCINTILLA_VERSION >= 0x020300 ) #include <Qsci/qscilexertcl.h> #endif #include <Qsci/qscilexertex.h> -#if ( QSCINTILLA_VERSION >= 0x020400 ) +#if ( TQSCINTILLA_VERSION >= 0x020400 ) #include <Qsci/qscilexerverilog.h> #endif #include <Qsci/qscilexervhdl.h> -#if ( QSCINTILLA_VERSION >= 0x020300 ) +#if ( TQSCINTILLA_VERSION >= 0x020300 ) #include <Qsci/qscilexerxml.h> #include <Qsci/qscilexeryaml.h> #endif @@ -85,66 +85,66 @@ /*! \brief The constructor initializes some regular expressions and keywords to identify cpp tokens */ -UiGuiHighlighter::UiGuiHighlighter(QsciScintilla *parent) : QObject(parent) { +UiGuiHighlighter::UiGuiHighlighter(QsciScintilla *parent) : TQObject(parent) { _qsciEditorParent = parent; // Create the highlighter _settings object from the UiGuiSyntaxHighlightConfig.ini file. - _settings = new QSettings(SettingsPaths::getSettingsPath() + "/UiGuiSyntaxHighlightConfig.ini", QSettings::IniFormat, this); + _settings = new TQSettings(SettingsPaths::getSettingsPath() + "/UiGuiSyntaxHighlightConfig.ini", TQSettings::IniFormat, this); _highlightningIsOn = true; - _mapHighlighternameToExtension["Bash"] = QStringList() << "sh"; - _mapHighlighternameToExtension["Batch"] = QStringList() << "bat"; - _mapHighlighternameToExtension["CMake"] = QStringList() << "cmake"; - _mapHighlighternameToExtension["C++"] = QStringList() << "c" << "h" << "cpp" << "hpp" << "cxx" << "hxx"; - _mapHighlighternameToExtension["C#"] = QStringList() << "cs"; - _mapHighlighternameToExtension["CSS"] = QStringList() << "css"; - _mapHighlighternameToExtension["D"] = QStringList() << "d"; - _mapHighlighternameToExtension["Diff"] = QStringList() << "diff"; -#if ( QSCINTILLA_VERSION >= 0x020300 ) - _mapHighlighternameToExtension["Fortran"] = QStringList() << "f" << "for" << "f90"; - _mapHighlighternameToExtension["Fortran77"] = QStringList() << "f77"; + _mapHighlighternameToExtension["Bash"] = TQStringList() << "sh"; + _mapHighlighternameToExtension["Batch"] = TQStringList() << "bat"; + _mapHighlighternameToExtension["CMake"] = TQStringList() << "cmake"; + _mapHighlighternameToExtension["C++"] = TQStringList() << "c" << "h" << "cpp" << "hpp" << "cxx" << "hxx"; + _mapHighlighternameToExtension["C#"] = TQStringList() << "cs"; + _mapHighlighternameToExtension["CSS"] = TQStringList() << "css"; + _mapHighlighternameToExtension["D"] = TQStringList() << "d"; + _mapHighlighternameToExtension["Diff"] = TQStringList() << "diff"; +#if ( TQSCINTILLA_VERSION >= 0x020300 ) + _mapHighlighternameToExtension["Fortran"] = TQStringList() << "f" << "for" << "f90"; + _mapHighlighternameToExtension["Fortran77"] = TQStringList() << "f77"; #endif - _mapHighlighternameToExtension["HTML"] = QStringList() << "html" << "htm"; - _mapHighlighternameToExtension["IDL"] = QStringList() << "idl"; - _mapHighlighternameToExtension["Java"] = QStringList() << "java"; - _mapHighlighternameToExtension["JavaScript"] = QStringList() << "js"; - _mapHighlighternameToExtension["LUA"] = QStringList() << "lua"; - _mapHighlighternameToExtension["Makefile"] = QStringList() << "makefile"; -#if ( QSCINTILLA_VERSION >= 0x020300 ) - _mapHighlighternameToExtension["Pascal"] = QStringList() << "pas"; + _mapHighlighternameToExtension["HTML"] = TQStringList() << "html" << "htm"; + _mapHighlighternameToExtension["IDL"] = TQStringList() << "idl"; + _mapHighlighternameToExtension["Java"] = TQStringList() << "java"; + _mapHighlighternameToExtension["JavaScript"] = TQStringList() << "js"; + _mapHighlighternameToExtension["LUA"] = TQStringList() << "lua"; + _mapHighlighternameToExtension["Makefile"] = TQStringList() << "makefile"; +#if ( TQSCINTILLA_VERSION >= 0x020300 ) + _mapHighlighternameToExtension["Pascal"] = TQStringList() << "pas"; #endif - _mapHighlighternameToExtension["Perl"] = QStringList() << "perl" << "pl" << "pm"; - _mapHighlighternameToExtension["PHP"] = QStringList() << "php"; -#if ( QSCINTILLA_VERSION >= 0x020300 ) - _mapHighlighternameToExtension["PostScript"] = QStringList() << "ps" << "eps" << "pdf" << "ai" << "fh"; + _mapHighlighternameToExtension["Perl"] = TQStringList() << "perl" << "pl" << "pm"; + _mapHighlighternameToExtension["PHP"] = TQStringList() << "php"; +#if ( TQSCINTILLA_VERSION >= 0x020300 ) + _mapHighlighternameToExtension["PostScript"] = TQStringList() << "ps" << "eps" << "pdf" << "ai" << "fh"; #endif - _mapHighlighternameToExtension["POV"] = QStringList() << "pov"; - _mapHighlighternameToExtension["Ini"] = QStringList() << "ini"; - _mapHighlighternameToExtension["Python"] = QStringList() << "py"; - _mapHighlighternameToExtension["Ruby"] = QStringList() << "rub" << "rb"; -#if ( QSCINTILLA_VERSION >= 0x020400 ) - _mapHighlighternameToExtension["Spice"] = QStringList() << "cir"; + _mapHighlighternameToExtension["POV"] = TQStringList() << "pov"; + _mapHighlighternameToExtension["Ini"] = TQStringList() << "ini"; + _mapHighlighternameToExtension["Python"] = TQStringList() << "py"; + _mapHighlighternameToExtension["Ruby"] = TQStringList() << "rub" << "rb"; +#if ( TQSCINTILLA_VERSION >= 0x020400 ) + _mapHighlighternameToExtension["Spice"] = TQStringList() << "cir"; #endif - _mapHighlighternameToExtension["SQL"] = QStringList() << "sql"; -#if ( QSCINTILLA_VERSION >= 0x020300 ) - _mapHighlighternameToExtension["TCL"] = QStringList() << "tcl"; + _mapHighlighternameToExtension["SQL"] = TQStringList() << "sql"; +#if ( TQSCINTILLA_VERSION >= 0x020300 ) + _mapHighlighternameToExtension["TCL"] = TQStringList() << "tcl"; #endif - _mapHighlighternameToExtension["TeX"] = QStringList() << "tex"; -#if ( QSCINTILLA_VERSION >= 0x020400 ) - _mapHighlighternameToExtension["Verilog"] = QStringList() << "v" << "vh"; + _mapHighlighternameToExtension["TeX"] = TQStringList() << "tex"; +#if ( TQSCINTILLA_VERSION >= 0x020400 ) + _mapHighlighternameToExtension["Verilog"] = TQStringList() << "v" << "vh"; #endif - _mapHighlighternameToExtension["VHDL"] = QStringList() << "vhdl"; - _mapHighlighternameToExtension["XML"] = QStringList() << "xml"; -#if ( QSCINTILLA_VERSION >= 0x020300 ) - _mapHighlighternameToExtension["YAML"] = QStringList() << "yaml"; + _mapHighlighternameToExtension["VHDL"] = TQStringList() << "vhdl"; + _mapHighlighternameToExtension["XML"] = TQStringList() << "xml"; +#if ( TQSCINTILLA_VERSION >= 0x020300 ) + _mapHighlighternameToExtension["YAML"] = TQStringList() << "yaml"; #endif _lexer = NULL; // This code is only for testing. /* - foreach(QStringList extensionList, _mapHighlighternameToExtension.values() ) { + foreach(TQStringList extensionList, _mapHighlighternameToExtension.values() ) { setLexerForExtension( extensionList.at(0) ); } */ @@ -155,9 +155,9 @@ UiGuiHighlighter::UiGuiHighlighter(QsciScintilla *parent) : QObject(parent) { /*! - \brief Returns the available highlighters as QStringList. + \brief Returns the available highlighters as TQStringList. */ -QStringList UiGuiHighlighter::getAvailableHighlighters() { +TQStringList UiGuiHighlighter::getAvailableHighlighters() { return _mapHighlighternameToExtension.keys(); } @@ -165,8 +165,8 @@ QStringList UiGuiHighlighter::getAvailableHighlighters() { /*! \brief This slot handles signals coming from selecting another syntax highlighter. */ -void UiGuiHighlighter::setHighlighterByAction(QAction* highlighterAction) { - QString highlighterName = highlighterAction->text(); +void UiGuiHighlighter::setHighlighterByAction(TQAction* highlighterAction) { + TQString highlighterName = highlighterAction->text(); setLexerForExtension( _mapHighlighternameToExtension[highlighterName].first() ); //TODO: This is really no nice way. How do it better? // Need to do this "text update" to update the syntax highlighting. Otherwise highlighting is wrong. @@ -192,11 +192,11 @@ void UiGuiHighlighter::turnHighlightOff() { _highlightningIsOn = false; _qsciEditorParent->setLexer(); #if defined(Q_OS_WIN) || defined(Q_OS_MAC) - _qsciEditorParent->setFont( QFont("Courier", 10, QFont::Normal) ); - _qsciEditorParent->setMarginsFont( QFont("Courier", 10, QFont::Normal) ); + _qsciEditorParent->setFont( TQFont("Courier", 10, TQFont::Normal) ); + _qsciEditorParent->setMarginsFont( TQFont("Courier", 10, TQFont::Normal) ); #else - _qsciEditorParent->setFont( QFont("Monospace", 10, QFont::Normal) ); - _qsciEditorParent->setMarginsFont( QFont("Monospace", 10, QFont::Normal) ); + _qsciEditorParent->setFont( TQFont("Monospace", 10, TQFont::Normal) ); + _qsciEditorParent->setMarginsFont( TQFont("Monospace", 10, TQFont::Normal) ); #endif } @@ -208,7 +208,7 @@ void UiGuiHighlighter::turnHighlightOff() { bool UiGuiHighlighter::readCurrentSettings( const char *prefix ) { bool ok, flag, rc = true; int num; - QString key; + TQString key; // Reset lists containing fonts and colors for each style _fontForStyles.clear(); @@ -228,7 +228,7 @@ bool UiGuiHighlighter::readCurrentSettings( const char *prefix ) { num = _settings->value(key + "color", 0).toInt(); if (ok) - setColor( QColor((num >> 16) & 0xff, (num >> 8) & 0xff, num & 0xff), i ); + setColor( TQColor((num >> 16) & 0xff, (num >> 8) & 0xff, num & 0xff), i ); else rc = false; @@ -242,18 +242,18 @@ bool UiGuiHighlighter::readCurrentSettings( const char *prefix ) { rc = false; // Read the font - QStringList fdesc; + TQStringList fdesc; ok = _settings->contains(key + "font"); fdesc = _settings->value(key + "font").toStringList(); if (ok && fdesc.count() == 5) { - QFont f; + TQFont f; #if defined(Q_OS_WIN) || defined(Q_OS_MAC) f.setFamily(fdesc[0]); #else - if ( fdesc[0].contains("courier", Qt::CaseInsensitive) ) + if ( fdesc[0].contains("courier", TQt::CaseInsensitive) ) f.setFamily("Monospace"); else f.setFamily(fdesc[0]); @@ -273,7 +273,7 @@ bool UiGuiHighlighter::readCurrentSettings( const char *prefix ) { num = _settings->value(key + "paper", 0).toInt(); if (ok) - _lexer->setPaper( QColor((num >> 16) & 0xff, (num >> 8) & 0xff, num & 0xff), i ); + _lexer->setPaper( TQColor((num >> 16) & 0xff, (num >> 8) & 0xff, num & 0xff), i ); else rc = false; } @@ -291,7 +291,7 @@ bool UiGuiHighlighter::readCurrentSettings( const char *prefix ) { \brief Write the settings for the current lexer to the settings file. */ void UiGuiHighlighter::writeCurrentSettings( const char *prefix ) { - QString key; + TQString key; // Write the styles. for (int i = 0; i < 128; ++i) { @@ -300,7 +300,7 @@ void UiGuiHighlighter::writeCurrentSettings( const char *prefix ) { continue; int num; - QColor c; + TQColor c; key.sprintf( "%s/%s/style%d/", prefix, _lexer->language(), i ); key.replace("+", "p"); @@ -323,9 +323,9 @@ void UiGuiHighlighter::writeCurrentSettings( const char *prefix ) { _settings->setValue( key + "eolfill", _lexer->eolFill(i) ); // Write the font - QStringList fdesc; - QString fmt("%1"); - QFont f; + TQStringList fdesc; + TQString fmt("%1"); + TQFont f; if ( _fontForStyles.contains(i) ) { f = _fontForStyles[i]; @@ -356,7 +356,7 @@ void UiGuiHighlighter::writeCurrentSettings( const char *prefix ) { /*! \brief Sets the \a color for the given \a style. */ -void UiGuiHighlighter::setColor(const QColor &color, int style) { +void UiGuiHighlighter::setColor(const TQColor &color, int style) { _colorForStyles[style] = color; _lexer->setColor( color, style ); } @@ -365,7 +365,7 @@ void UiGuiHighlighter::setColor(const QColor &color, int style) { /*! \brief Sets the \a font for the given \a style. */ -void UiGuiHighlighter::setFont(const QFont &font, int style) { +void UiGuiHighlighter::setFont(const TQFont &font, int style) { _fontForStyles[style] = font; _lexer->setFont( font, style ); } @@ -374,7 +374,7 @@ void UiGuiHighlighter::setFont(const QFont &font, int style) { /*! \brief Sets the to be used lexer by giving his name. */ -void UiGuiHighlighter::setLexerByName( QString lexerName ) { +void UiGuiHighlighter::setLexerByName( TQString lexerName ) { setLexerForExtension( _mapHighlighternameToExtension[lexerName].first() ); } @@ -382,7 +382,7 @@ void UiGuiHighlighter::setLexerByName( QString lexerName ) { /*! \brief Sets the proper highlighter / lexer for the given file \a extension. Returns the index of the used lexer in the list. */ -int UiGuiHighlighter::setLexerForExtension( QString extension ) { +int UiGuiHighlighter::setLexerForExtension( TQString extension ) { int indexOfHighlighter = 0; extension = extension.toLower(); @@ -415,7 +415,7 @@ int UiGuiHighlighter::setLexerForExtension( QString extension ) { else if ( extension == "diff" ) { _lexer = new QsciLexerDiff(); } -#if ( QSCINTILLA_VERSION >= 0x020300 ) +#if ( TQSCINTILLA_VERSION >= 0x020300 ) else if ( extension == "f" || extension == "for" || extension == "f90" ) { _lexer = new QsciLexerFortran(); } @@ -441,7 +441,7 @@ int UiGuiHighlighter::setLexerForExtension( QString extension ) { else if ( extension == "makefile" ) { _lexer = new QsciLexerMakefile(); } -#if ( QSCINTILLA_VERSION >= 0x020300 ) +#if ( TQSCINTILLA_VERSION >= 0x020300 ) else if ( extension == "pas" ) { _lexer = new QsciLexerPascal(); } @@ -452,7 +452,7 @@ int UiGuiHighlighter::setLexerForExtension( QString extension ) { else if ( extension == "php" ) { _lexer = new QsciLexerHTML(); } -#if ( QSCINTILLA_VERSION >= 0x020300 ) +#if ( TQSCINTILLA_VERSION >= 0x020300 ) else if ( extension == "ps" || extension == "eps" || extension == "pdf" || extension == "ai" || extension == "fh") { _lexer = new QsciLexerPostScript(); } @@ -469,7 +469,7 @@ int UiGuiHighlighter::setLexerForExtension( QString extension ) { else if ( extension == "rub" || extension == "rb" ) { _lexer = new QsciLexerRuby(); } -#if ( QSCINTILLA_VERSION >= 0x020400 ) +#if ( TQSCINTILLA_VERSION >= 0x020400 ) else if ( extension == "spice?" ) { _lexer = new QsciLexerSpice(); } @@ -477,7 +477,7 @@ int UiGuiHighlighter::setLexerForExtension( QString extension ) { else if ( extension == "sql" ) { _lexer = new QsciLexerSQL(); } -#if ( QSCINTILLA_VERSION >= 0x020300 ) +#if ( TQSCINTILLA_VERSION >= 0x020300 ) else if ( extension == "tcl" ) { _lexer = new QsciLexerTCL(); } @@ -485,7 +485,7 @@ int UiGuiHighlighter::setLexerForExtension( QString extension ) { else if ( extension == "tex" ) { _lexer = new QsciLexerTeX(); } -#if ( QSCINTILLA_VERSION >= 0x020400 ) +#if ( TQSCINTILLA_VERSION >= 0x020400 ) else if ( extension == "vlog?" ) { _lexer = new QsciLexerVerilog(); } @@ -494,13 +494,13 @@ int UiGuiHighlighter::setLexerForExtension( QString extension ) { _lexer = new QsciLexerVHDL(); } else if ( extension == "xml" ) { -#if ( QSCINTILLA_VERSION >= 0x020300 ) +#if ( TQSCINTILLA_VERSION >= 0x020300 ) _lexer = new QsciLexerXML(); #else _lexer = new QsciLexerHTML(); #endif } -#if ( QSCINTILLA_VERSION >= 0x020300 ) +#if ( TQSCINTILLA_VERSION >= 0x020300 ) else if ( extension == "yaml" ) { _lexer = new QsciLexerYAML(); } @@ -516,7 +516,7 @@ int UiGuiHighlighter::setLexerForExtension( QString extension ) { indexOfHighlighter++; } - // Set the _lexer for the QScintilla widget. + // Set the _lexer for the TQScintilla widget. if ( _highlightningIsOn ) { _qsciEditorParent->setLexer(_lexer); } |