|
|
@ -51,9 +51,6 @@
|
|
|
|
#include <tqtoolbox.h>
|
|
|
|
#include <tqtoolbox.h>
|
|
|
|
#include <tqtoolbutton.h>
|
|
|
|
#include <tqtoolbutton.h>
|
|
|
|
#include <tqtooltip.h>
|
|
|
|
#include <tqtooltip.h>
|
|
|
|
//--- #include <tqsettings.h>
|
|
|
|
|
|
|
|
//--- #include <tqbytearray.h>
|
|
|
|
|
|
|
|
//--- #include <tqtscript.h>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// \defgroup grp_Indenter All concerning handling of the indenter.
|
|
|
|
// \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)
|
|
|
|
TQString IndentHandler::callIndenter(const TQString &sourceCode, const TQString &inputFileExtension)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (m_indenterExecutableSuffix == ".js")
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return callJavaScriptIndenter(sourceCode);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return callExecutableIndenter(sourceCode, inputFileExtension);
|
|
|
|
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 "";
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
/*
|
|
|
@ -1279,13 +1244,13 @@ void IndentHandler::setIndenter(int indenterID)
|
|
|
|
TQApplication::restoreOverrideCursor();
|
|
|
|
TQApplication::restoreOverrideCursor();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//--- /*
|
|
|
|
/*
|
|
|
|
//--- \brief Returns a string containing by the indenter supported file types/extensions divided by a space.
|
|
|
|
\brief Returns a string containing by the indenter supported file types/extensions divided by a space.
|
|
|
|
//--- */
|
|
|
|
*/
|
|
|
|
//--- TQString IndentHandler::getPossibleIndenterFileExtensions()
|
|
|
|
TQString IndentHandler::getPossibleIndenterFileExtensions()
|
|
|
|
//--- {
|
|
|
|
{
|
|
|
|
//--- return m_fileTypes;
|
|
|
|
return m_fileTypes;
|
|
|
|
//--- }
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
/*
|
|
|
|
\brief Returns the path and filename of the current indenter config file.
|
|
|
|
\brief Returns the path and filename of the current indenter config file.
|
|
|
@ -1523,20 +1488,20 @@ bool IndentHandler::createIndenterCallString()
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//--- /*
|
|
|
|
/*
|
|
|
|
//--- \brief Returns a string that points to where the indenters manual can be found.
|
|
|
|
\brief Returns a string that points to where the indenters manual can be found.
|
|
|
|
//--- */
|
|
|
|
*/
|
|
|
|
//--- TQString IndentHandler::getManual()
|
|
|
|
TQString IndentHandler::getManual()
|
|
|
|
//--- {
|
|
|
|
{
|
|
|
|
//--- if (m_indenterSettings != nullptr)
|
|
|
|
if (m_indenterSettings != nullptr)
|
|
|
|
//--- {
|
|
|
|
{
|
|
|
|
//--- return m_indenterSettings->value("header/manual").toString();
|
|
|
|
return m_indenterSettings->value("header/manual").toString();
|
|
|
|
//--- }
|
|
|
|
}
|
|
|
|
//--- else
|
|
|
|
else
|
|
|
|
//--- {
|
|
|
|
{
|
|
|
|
//--- return "";
|
|
|
|
return "";
|
|
|
|
//--- }
|
|
|
|
}
|
|
|
|
//--- }
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
/*
|
|
|
|
\brief This slot gets the reference to the indenters manual and opens it.
|
|
|
|
\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
|
|
|
|
\brief Emits the \a indenterSettingsChanged signal
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|