Finish off the indenter code and update to TQ_OBJECT

Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
pull/3/head
Michele Calgaro 1 year ago
parent c529f9057e
commit e19f9a02df
Signed by: MicheleC
GPG Key ID: 2A75B7CA8ADED5CF

@ -25,7 +25,7 @@
class AboutDialog : public AboutDialogBase class AboutDialog : public AboutDialogBase
{ {
Q_OBJECT TQ_OBJECT
public: public:
AboutDialog(TQWidget *parent = NULL, WFlags flags = 0); AboutDialog(TQWidget *parent = NULL, WFlags flags = 0);

@ -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 callExecutableIndenter(sourceCode, inputFileExtension);
{
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 "";
} }
/* /*
@ -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
*/ */

@ -40,7 +40,7 @@ class TQVBoxLayout;
class IndentHandler : public TQWidget class IndentHandler : public TQWidget
{ {
Q_OBJECT TQ_OBJECT
public: public:
IndentHandler(int indenterID, MainWindow *mainWindow = nullptr, TQWidget *parent = nullptr); IndentHandler(int indenterID, MainWindow *mainWindow = nullptr, TQWidget *parent = nullptr);
@ -51,20 +51,15 @@ class IndentHandler : public TQWidget
bool loadConfigFile(const TQString &filePathName); bool loadConfigFile(const TQString &filePathName);
void resetToDefaultValues(); void resetToDefaultValues();
TQStringList getAvailableIndenters(); TQStringList getAvailableIndenters();
///-- TQString getPossibleIndenterFileExtensions(); TQString getPossibleIndenterFileExtensions();
TQString getParameterString(); TQString getParameterString();
TQString getIndenterCfgFile(); TQString getIndenterCfgFile();
///-- TQString getManual(); TQString getManual();
TQString getCurrentIndenterName(); TQString getCurrentIndenterName();
void contextMenuEvent(TQContextMenuEvent *event); void contextMenuEvent(TQContextMenuEvent *event);
signals: signals:
void indenterSettingsChanged(); void indenterSettingsChanged();
///-- void selectedIndenterIndexChanged(int index);
///-- protected:
///-- bool event(TQEvent *event);
///-- void wheelEvent(TQWheelEvent *event);
private slots: private slots:
void setIndenter(int indenterID); void setIndenter(int indenterID);
@ -78,7 +73,6 @@ class IndentHandler : public TQWidget
private: private:
TQString callExecutableIndenter(const TQString &sourceCode, const TQString &inputFileExt); TQString callExecutableIndenter(const TQString &sourceCode, const TQString &inputFileExt);
TQString callJavaScriptIndenter(const TQString &sourceCode);
void saveConfigFile(const TQString &filePathName, const TQString &parameterString); void saveConfigFile(const TQString &filePathName, const TQString &parameterString);
void readIndentIniFile(const TQString &iniFilePath); void readIndentIniFile(const TQString &iniFilePath);
bool createIndenterCallString(); bool createIndenterCallString();

@ -522,9 +522,8 @@ void MainWindow::openSourceFileDialog(const TQString &fileName)
return; return;
} }
TQString openedSourceFileContent = ""; TQString openedSourceFileContent = "";
TQString fileExtensions = "*.h *.c *.cpp *.*"; // Remove this line when the indenter is available TQString fileExtensions = tr("Supported by indenter") + " (" +
///-- TQString fileExtensions = tr("Supported by indenter") + " (" + m_indentHandler->getPossibleIndenterFileExtensions() + ");;" + tr("All files") + " (*.*)";
///-- m_indentHandler->getPossibleIndenterFileExtensions() + ");;" + tr("All files") + " (*.*)";
TQString fileToOpen = fileName; TQString fileToOpen = fileName;
if (fileToOpen.isEmpty()) if (fileToOpen.isEmpty())
@ -565,9 +564,8 @@ void MainWindow::openSourceFileDialog(const TQString &fileName)
*/ */
bool MainWindow::saveasSourceFileDialog(TQAction *chosenEncodingAction) bool MainWindow::saveasSourceFileDialog(TQAction *chosenEncodingAction)
{ {
TQString fileExtensions = "*.h *.c *.cpp *.*"; // Remove this line when the indenter is available TQString fileExtensions = tr("Supported by indenter") + " (" +
//--- TQString fileExtensions = tr("Supported by indenter") + " (" + m_indentHandler->getPossibleIndenterFileExtensions() + ");;" + tr("All files") + " (*.*)";
//--- m_indentHandler->getPossibleIndenterFileExtensions() + ");;" + tr("All files") + " (*.*)";
TQString fileName = TQFileDialog::getSaveFileName(m_currentSourceFile, fileExtensions, this, nullptr, TQString fileName = TQFileDialog::getSaveFileName(m_currentSourceFile, fileExtensions, this, nullptr,
tr("Save source code file")); tr("Save source code file"));

@ -28,7 +28,7 @@ class TQCheckBox;
class UiGuiErrorMessage : public TQErrorMessage class UiGuiErrorMessage : public TQErrorMessage
{ {
Q_OBJECT TQ_OBJECT
public: public:
UiGuiErrorMessage(TQWidget *parent = nullptr); UiGuiErrorMessage(TQWidget *parent = nullptr);

@ -30,7 +30,7 @@ class TQSettings;
class UiGuiSettings : public TQObject class UiGuiSettings : public TQObject
{ {
Q_OBJECT TQ_OBJECT
private: private:
UiGuiSettings(); UiGuiSettings();

@ -29,7 +29,7 @@ class TQSplashScreen;
class AboutDialogGraphicsView : public TQGraphicsView class AboutDialogGraphicsView : public TQGraphicsView
{ {
Q_OBJECT TQ_OBJECT
public: public:
AboutDialogGraphicsView(AboutDialog *aboutDialog, TQWidget *parentWindow = NULL); AboutDialogGraphicsView(AboutDialog *aboutDialog, TQWidget *parentWindow = NULL);

@ -34,7 +34,7 @@ class QsciLexer;
class UiGuiHighlighter : public TQObject class UiGuiHighlighter : public TQObject
{ {
Q_OBJECT TQ_OBJECT
public: public:
UiGuiHighlighter(TQextScintilla *parent); UiGuiHighlighter(TQextScintilla *parent);

@ -28,7 +28,7 @@ class TQTcpSocket;
class UiGuiIndentServer : public TQObject class UiGuiIndentServer : public TQObject
{ {
Q_OBJECT TQ_OBJECT
public: public:
UiGuiIndentServer(void); UiGuiIndentServer(void);

@ -32,7 +32,7 @@ namespace Ui
class UiGuiSettingsDialog : public TQDialog class UiGuiSettingsDialog : public TQDialog
{ {
Q_OBJECT TQ_OBJECT
public: public:
UiGuiSettingsDialog(TQWidget *parent, TQSharedPointer<UiGuiSettings> settings); UiGuiSettingsDialog(TQWidget *parent, TQSharedPointer<UiGuiSettings> settings);

@ -36,7 +36,7 @@ namespace tschweitzer
class TSLogger : public TQDialog class TSLogger : public TQDialog
{ {
Q_OBJECT TQ_OBJECT
public: public:
static TSLogger* getInstance(int verboseLevel); static TSLogger* getInstance(int verboseLevel);

Loading…
Cancel
Save