diff options
Diffstat (limited to 'src/IndentHandler.cpp')
-rw-r--r-- | src/IndentHandler.cpp | 103 |
1 files changed, 22 insertions, 81 deletions
diff --git a/src/IndentHandler.cpp b/src/IndentHandler.cpp index 40ebe3f..588d6e4 100644 --- a/src/IndentHandler.cpp +++ b/src/IndentHandler.cpp @@ -51,9 +51,6 @@ #include <tqtoolbox.h> #include <tqtoolbutton.h> #include <tqtooltip.h> -//--- #include <tqsettings.h> -//--- #include <tqbytearray.h> -//--- #include <tqtscript.h> // \defgroup grp_Indenter All concerning handling of the indenter. @@ -311,39 +308,7 @@ TQString IndentHandler::generateShellScript(const TQString &configFilename) */ TQString IndentHandler::callIndenter(const TQString &sourceCode, const TQString &inputFileExtension) { - if (m_indenterExecutableSuffix == ".js") - { - return callJavaScriptIndenter(sourceCode); - } - else - { - return callExecutableIndenter(sourceCode, inputFileExtension); - } -} - -/* - \brief Format \a sourceCode by calling the interpreted JavaScript code of the indenter. - - The \a inputFileExtension has to be given as parameter so the called indenter - can identify the programming language if needed. - */ -TQString IndentHandler::callJavaScriptIndenter(const TQString &sourceCode) -{ -//--- TQScriptEngine engine; -//--- -//--- engine.globalObject().setProperty("unformattedCode", sourceCode); -//--- -//--- TQFile jsDecoderFile(m_indenterExecutableCallString); -//--- TQString jsDecoderCode; -//--- if (jsDecoderFile.open(TQFile::ReadOnly)) -//--- { -//--- jsDecoderCode = jsDecoderFile.readAll(); -//--- } -//--- jsDecoderFile.close(); -//--- -//--- TQScriptValue value = engine.evaluate(jsDecoderCode); -//--- return value.toString(); -return ""; + return callExecutableIndenter(sourceCode, inputFileExtension); } /* @@ -1279,13 +1244,13 @@ void IndentHandler::setIndenter(int indenterID) TQApplication::restoreOverrideCursor(); } -//--- /* -//--- \brief Returns a string containing by the indenter supported file types/extensions divided by a space. -//--- */ -//--- TQString IndentHandler::getPossibleIndenterFileExtensions() -//--- { -//--- return m_fileTypes; -//--- } +/* + \brief Returns a string containing by the indenter supported file types/extensions divided by a space. + */ +TQString IndentHandler::getPossibleIndenterFileExtensions() +{ + return m_fileTypes; +} /* \brief Returns the path and filename of the current indenter config file. @@ -1523,20 +1488,20 @@ bool IndentHandler::createIndenterCallString() return false; } -//--- /* -//--- \brief Returns a string that points to where the indenters manual can be found. -//--- */ -//--- TQString IndentHandler::getManual() -//--- { -//--- if (m_indenterSettings != nullptr) -//--- { -//--- return m_indenterSettings->value("header/manual").toString(); -//--- } -//--- else -//--- { -//--- return ""; -//--- } -//--- } +/* + \brief Returns a string that points to where the indenters manual can be found. + */ +TQString IndentHandler::getManual() +{ + if (m_indenterSettings != nullptr) + { + return m_indenterSettings->value("header/manual").toString(); + } + else + { + return ""; + } +} /* \brief This slot gets the reference to the indenters manual and opens it. @@ -1676,30 +1641,6 @@ void IndentHandler::resetIndenterParameter() } } -//--- /* -//--- \brief Catch some events and let some other be handled by the super class. -//--- -//--- Is needed for use as Notepad++ plugin. -//--- */ -//--- bool IndentHandler::event(TQEvent *event) -//--- { -//--- if (event->type() == TQEvent::WindowActivate) -//--- { -//--- event->accept(); -//--- return true; -//--- } -//--- else if (event->type() == TQEvent::WindowDeactivate) -//--- { -//--- event->accept(); -//--- return true; -//--- } -//--- else -//--- { -//--- event->ignore(); -//--- return TQWidget::event(event); -//--- } -//--- } - /* \brief Emits the \a indenterSettingsChanged signal */ |