Added initial empty GUI for the indenter

Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
master
Michele Calgaro 1 year ago
parent 5fa736197b
commit dfb1b9f10a
Signed by: MicheleC
GPG Key ID: 2A75B7CA8ADED5CF

@ -8,9 +8,13 @@ install(
edit-clear.png
exporthtml.png
exportpdf.png
help.png
info.png
live-preview.png
load_indent_cfg.png
preferences-system.png
save_indent_cfg.png
shell.png
syntax-highlight.png
system-log-out.png
tooltip.png
@ -19,5 +23,6 @@ install(
universalIndentGUI_32x32.xpm
universalIndentGUI_64x64.png
universalIndentGUI_512x512.png
view-refresh.png
DESTINATION ${SHARE_INSTALL_PREFIX}/universal-indent-gui-tqt/icons
)

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

Before

Width:  |  Height:  |  Size: 474 B

After

Width:  |  Height:  |  Size: 474 B

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

@ -26,17 +26,18 @@ link_directories(
set( target universal-indent-gui-tqt )
set( ${target}_SRCS
#completed
# completed
MainWindowBase.ui
ToolBarWidget.ui
SettingsPaths.cpp
UiGuiVersion.cpp
#ongoing
# ongoing
AboutDialogBase.ui
MainWindowBase.ui
AboutDialog.cpp
IndentHandler.cpp
MainWindow.cpp
main.cpp
UiGuiSettings.cpp

File diff suppressed because it is too large Load Diff

@ -0,0 +1,180 @@
/***************************************************************************
* Copyright (C) 2006-2012 by Thomas Schweitzer *
* thomas-schweitzer(at)arcor.de *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License version 2.0 as *
* published by the Free Software Foundation. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program in the file LICENSE.GPL; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#ifndef INDENTHANDLER_H
#define INDENTHANDLER_H
#include <tqwidget.h>
class MainWindow;
///-- class UiGuiErrorMessage;
///-- class UiGuiIniFileParser;
class TQComboBox;
class TQToolBox;
class TQToolButton;
class TQVBoxLayout;
///-- class TQMenu;
///-- class TQLabel;
///-- class TQSpinBox;
///-- class TQCheckBox;
///-- class TQLineEdit;
class IndentHandler : public TQWidget
{
Q_OBJECT
public:
IndentHandler(int indenterID, MainWindow *mainWindow = nullptr, TQWidget *parent = nullptr);
~IndentHandler();
///-- TQString generateShellScript(const TQString &configFilename);
///-- TQString callIndenter(TQString sourceCode, TQString inputFileExtension);
///-- bool loadConfigFile(TQString filePathName);
///-- void resetToDefaultValues();
///-- TQStringList getAvailableIndenters();
///-- TQString getPossibleIndenterFileExtensions();
///-- TQString getParameterString();
///-- TQString getIndenterCfgFile();
///-- TQString getManual();
///-- TQString getCurrentIndenterName();
void contextMenuEvent(TQContextMenuEvent *event);
///-- int getIndenterId();
///--
///-- signals:
///-- void indenterSettingsChanged();
///-- void selectedIndenterIndexChanged(int index);
///--
///-- protected:
///-- bool event(TQEvent *event);
///-- void wheelEvent(TQWheelEvent *event);
///--
private slots:
void setIndenter(int indenterID);
void showIndenterManual() const;
void openConfigFileDialog();
void saveasIndentCfgFileDialog();
void createIndenterCallShellScript();
void resetIndenterParameter();
///-- void handleChangedIndenterSettings();
///--
///-- private:
///-- TQString callExecutableIndenter(TQString sourceCode, TQString inputFileExtension);
///-- TQString callJavaScriptIndenter(TQString sourceCode);
///-- void saveConfigFile(TQString filePathName, TQString parameterString);
///-- void readIndentIniFile(TQString iniFilePath);
///-- bool createIndenterCallString();
///--
///-- // Holds a reference to all created pages of the parameter categories toolbox and the pages
///-- // boxlayout
///-- struct IndenterParameterCategoryPage
///-- {
///-- TQWidget *widget;
///-- TQVBoxLayout *vboxLayout;
///-- };
///--
///-- TQVector<IndenterParameterCategoryPage> _indenterParameterCategoryPages;
///--
///-- // Holds a reference to all checkboxes needed for boolean parameter setting and the parameters
///-- // name
///-- struct ParamBoolean
///-- {
///-- TQString paramName;
///-- TQString trueString;
///-- TQString falseString;
///-- TQCheckBox *checkBox;
///-- };
///--
///-- TQVector<ParamBoolean> _paramBooleans;
///--
///-- // Holds a reference to all line edits needed for parameter setting and the parameters name
///-- struct ParamString
///-- {
///-- TQString paramName;
///-- TQString paramCallName;
///-- TQCheckBox *valueEnabledChkBox;
///-- TQLineEdit *lineEdit;
///-- TQLabel *label;
///-- };
///--
///-- TQVector<ParamString> _paramStrings;
///--
///-- // Hold a reference to all spin boxes needed for parameter setting and the parameters name
///-- struct ParamNumeric
///-- {
///-- TQString paramName;
///-- TQString paramCallName;
///-- TQCheckBox *valueEnabledChkBox;
///-- TQSpinBox *spinBox;
///-- TQLabel *label;
///-- };
///--
///-- TQVector<ParamNumeric> _paramNumerics;
///--
///-- // Hold a reference to all combo boxes needed for parameter setting and the parameters name
///-- struct ParamMultiple
///-- {
///-- TQString paramName;
///-- TQString paramCallName;
///-- TQCheckBox *valueEnabledChkBox;
///-- TQComboBox *comboBox;
///-- TQStringList choicesStrings;
///-- TQStringList choicesStringsReadable;
///-- };
///--
///-- TQVector<ParamMultiple> _paramMultiples;
///--
TQComboBox *m_indenterSelectionCombobox;
TQToolButton *m_indenterParameterHelpButton;
///-- // Vertical layout box, into which the toolbox will be added
TQVBoxLayout *m_toolBoxContainerLayout;
TQToolBox *m_indenterParameterCategoriesToolBox;
///-- UiGuiIniFileParser *_indenterSettings;
///-- TQStringList _indenterParameters;
///-- // The indenters name in a descriptive form
///-- TQString _indenterName;
///-- // The indenters file name (w/o extension), that is being called
///-- TQString _indenterFileName;
TQString m_indenterDirectoryStr;
TQString m_tempDirectoryStr;
TQString m_settingsDirectoryStr;
///-- TQStringList _indenterIniFileList;
///-- TQString _parameterOrder;
///-- TQString _globalConfigFilename;
///-- TQString _cfgFileParameterEnding;
///-- TQString _inputFileParameter;
///-- TQString _inputFileName;
///-- TQString _outputFileParameter;
///-- TQString _outputFileName;
///-- TQString _fileTypes;
///-- TQString _useCfgFileParameter;
///-- TQString _indenterShowHelpParameter;
MainWindow *m_mainWindow;
TQWidget *m_parent;
///-- UiGuiErrorMessage *_errorMessageDialog;
TQString m_indenterExecutableCallString;
TQString m_indenterExecutableSuffix;
///--
///-- //TODO: This function should go into a string helper/tool class/file.
///-- TQString encodeToHTML(const TQString &text);
};
#endif // INDENTHANDLER_H

@ -25,6 +25,7 @@
#include "stdlib.h"
#include "AboutDialog.h"
#include "IndentHandler.h"
#include "SettingsPaths.h"
#include "UiGuiSettings.h"
#include "UiGuiVersion.h"
@ -32,7 +33,6 @@
///-- #include "AboutDialogGraphicsView.h"
///-- #include "UiGuiSettingsDialog.h"
///-- #include "UiGuiHighlighter.h"
///-- #include "IndentHandler.h"
#include <tqaction.h>
#include <tqapplication.h>
@ -47,10 +47,11 @@
#include <tqpixmap.h>
#include <tqpopupmenu.h>
#include <tqpushbutton.h>
#include <tqsplitter.h>
#include <tqstatusbar.h>
#include <tqtextcodec.h>
#include <tqtranslator.h>
///-- #include <tqwidget.h>
#include <tqwidget.h>
///-- #include <tqstring.h>
///-- #include <tqscrollbar.h>
///-- #include <tqtextcursor.h>
@ -91,10 +92,11 @@ MainWindow::MainWindow(TQString file2OpenOnStart, TQWidget *parent) :
m_qTranslator(nullptr), m_uiGuiTranslator(nullptr), m_textEditLineColumnInfoLabel(nullptr),
m_oldLinesNumber(0), m_openEncodingActions(), m_saveEncodingActions(),
m_encodingActionGroup(nullptr), m_saveEncodedActionGroup(nullptr),
m_highlighterActionGroup(nullptr), m_documentModified(false), m_previewToggled(true)
m_highlighterActionGroup(nullptr), m_documentModified(false), m_previewToggled(true),
m_indentHandler(nullptr), m_centralSplitter(nullptr)
///- _mainWindowForm(nullptr), _settings(nullptr)
///- m_highlighter(nullptr), _aboutDialogGraphicsView(nullptr), _settingsDialog(nullptr)
///- m_textEditVScrollBar(nullptr), _toolBarWidget(nullptr), _indentHandler(nullptr)
///- m_textEditVScrollBar(nullptr), _toolBarWidget(nullptr)
{
// Init of some variables.
m_sourceCodeChanged = false;
@ -181,6 +183,11 @@ void MainWindow::initMainWindow()
actionExportPDF->setIconSet(TQPixmap(ICONS_PATH + "exportpdf.png"));
actionExportHTML->setIconSet(TQPixmap(ICONS_PATH + "exporthtml.png"));
actionExit->setIconSet(TQPixmap(ICONS_PATH + "system-log-out.png"));
// - Indenter menu
actionLoadIndenterConfigFile->setIconSet(TQPixmap(ICONS_PATH + "load_indent_cfg.png"));
actionSaveIndenterConfigFile->setIconSet(TQPixmap(ICONS_PATH + "save_indent_cfg.png"));
actionCreateShellScript->setIconSet(TQPixmap(ICONS_PATH + "shell.png"));
actionResetIndenterParameters->setIconSet(TQPixmap(ICONS_PATH + "view-refresh.png"));
// - Setting menu
actionLiveIndentPreview->setIconSet(TQPixmap(ICONS_PATH + "live-preview.png"));
actionEnableSyntaxHighlighting->setIconSet(TQPixmap(ICONS_PATH + "syntax-highlight.png"));
@ -193,6 +200,11 @@ void MainWindow::initMainWindow()
m_actionClearRecentlyOpenedListId = popupMenuRecentlyOpenedFiles->idAt(
popupMenuRecentlyOpenedFiles->count() - 1);
// Central splitter
m_centralSplitter = new TQSplitter(this);
m_centralSplitter->setChildrenCollapsible(true);
setCentralWidget(m_centralSplitter);
// Handle last opened window size
// ------------------------------
bool maximized = m_settings->getValueByName("WindowIsMaximized").toBool();
@ -242,6 +254,7 @@ void MainWindow::initMainWindow()
connect(actionSaveSourceFileAs, SIGNAL(activated()), this, SLOT(saveasSourceFileDialog()));
connect(actionExportPDF, SIGNAL(activated()), this, SLOT(exportToPDF()));
connect(actionExportHTML, SIGNAL(activated()), this, SLOT(exportToHTML()));
///-- connect(actionShowLog, SIGNAL(activated()),
///-- debugging::TSLogger::getInstance(), SLOT(show()));
@ -301,7 +314,7 @@ void MainWindow::initTextEditor()
// Create the TQScintilla widget and add it to the layout.
try
{
m_qSciSourceCodeEditor = new TQextScintilla(this);
m_qSciSourceCodeEditor = new TQextScintilla(m_centralSplitter);
}
catch (...)
{
@ -311,7 +324,6 @@ void MainWindow::initTextEditor()
"versions are not mixed.");
exit(1);
}
setCentralWidget(m_qSciSourceCodeEditor);
// Make some _settings for the TQScintilla widget.
m_qSciSourceCodeEditor->setUtf8(true);
@ -445,15 +457,15 @@ bool MainWindow::initApplicationLanguage()
*/
void MainWindow::initIndenter()
{
///-- // Get Id of last selected indenter.
///-- _currentIndenterID = _settings->getValueByName("selectedIndenter").toInt();
///--
///-- // Create the indenter widget with the ID and add it to the layout.
///-- _indentHandler = new IndentHandler(_currentIndenterID, this, _mainWindowForm->centralwidget);
///-- _mainWindowForm->vboxLayout->addWidget(_indentHandler);
///--
// Get Id of last selected indenter.
m_currentIndenterID = m_settings->getValueByName("SelectedIndenter").toInt();
// Create the indenter widget with the ID and add it to the layout.
m_indentHandler = new IndentHandler(m_currentIndenterID, this, m_centralSplitter);
m_centralSplitter->moveToFirst(m_indentHandler);
///-- // If _settings for the indenter have changed, let the main window know aboud it.
///-- connect(_indentHandler, SIGNAL(indenterSettingsChanged()), this,
///-- connect(m_indentHandler, SIGNAL(indenterSettingsChanged()), this,
///-- SLOT(indentSettingsChangedSlot()));
///--
///-- // Set this true, so the indenter is called at first program start
@ -463,9 +475,6 @@ void MainWindow::initIndenter()
///-- // Handle if indenter parameter tool tips are enabled
///-- _settings->registerObjectProperty(actionIndenterParameterTooltipsEnabled,
///-- "checked", "indenterParameterTooltipsEnabled");
///--
///-- // Add the indenters context menu to the mainwindows menu.
///-- _mainWindowForm->menuIndenter->addActions(_indentHandler->getIndenterMenuActions());
}
/*
@ -515,7 +524,7 @@ void MainWindow::openSourceFileDialog(const TQString &fileName)
TQString openedSourceFileContent = "";
TQString fileExtensions = "*.h *.c *.cpp *.*"; // Remove this line when the indenter is available
///-- TQString fileExtensions = tr("Supported by indenter") + " (" +
///-- _indentHandler->getPossibleIndenterFileExtensions() + ");;" + tr("All files") + " (*.*)";
///-- m_indentHandler->getPossibleIndenterFileExtensions() + ");;" + tr("All files") + " (*.*)";
TQString fileToOpen = fileName;
if (fileToOpen.isEmpty())
@ -558,7 +567,7 @@ bool MainWindow::saveasSourceFileDialog(TQAction *chosenEncodingAction)
{
TQString fileExtensions = "*.h *.c *.cpp *.*"; // Remove this line when the indenter is available
//--- TQString fileExtensions = tr("Supported by indenter") + " (" +
//--- _indentHandler->getPossibleIndenterFileExtensions() + ");;" + tr("All files") + " (*.*)";
//--- m_indentHandler->getPossibleIndenterFileExtensions() + ");;" + tr("All files") + " (*.*)";
TQString fileName = TQFileDialog::getSaveFileName(m_currentSourceFile, fileExtensions, this, nullptr,
tr("Save source code file"));
@ -674,7 +683,7 @@ void MainWindow::updateSourceView()
void MainWindow::callIndenter()
{
TQApplication::setOverrideCursor(TQCursor(TQt::WaitCursor));
///-- m_sourceFormattedContent = _indentHandler->callIndenter(m_sourceFileContent,
///-- m_sourceFormattedContent = m_indentHandler->callIndenter(m_sourceFileContent,
///-- m_currentSourceFileExtension);
updateSourceView();
TQApplication::restoreOverrideCursor();
@ -1112,7 +1121,7 @@ void MainWindow::closeEvent(TQCloseEvent *event)
///-- /*
///-- \brief This function is setup to capture tooltip events.
///--
///-- All widgets that are created by the _indentHandler object and are responsible
///-- All widgets that are created by the m_indentHandler object and are responsible
///-- for indenter parameters are connected with this event filter.
///-- So depending on the _settings the tooltips can be enabled and disabled for these widgets.
///-- */
@ -1377,9 +1386,6 @@ void MainWindow::numberOfLinesChanged()
///-- // Translate the toolbar.
///-- _toolBarWidget->retranslateUi(_mainWindowForm->toolBar);
///--
///-- // Translate the indent handler widget.
///-- _indentHandler->retranslateUi();
///--
///-- // Translate the load encoding menu.
///-- TQList<TQAction*> encodingActionList = m_encodingActionGroup->actions();
///-- for (i = 0; i < encodingActionList.size(); i++)

@ -30,12 +30,13 @@
class AboutDialog;
/// class AboutDialogGraphicsView;
/// class UiGuiHighlighter;
/// class IndentHandler
class IndentHandler;
class UiGuiSettings;
class ToolBarWidget;
///
/// class TQActionGroup;
class TQextScintilla;
class TQSplitter;
class TQLabel;
class TQScrollBar;
class TQTranslator;
@ -50,10 +51,10 @@ class MainWindow : public MainWindowBase
MainWindow(TQString file2OpenOnStart = "", TQWidget *parent = NULL);
~MainWindow();
///-- protected:
protected:
void closeEvent(TQCloseEvent *event);
///-- bool eventFilter(TQObject *obj, TQEvent *event);
///--
private slots:
void openSourceFileDialog(const TQString &fileName = TQString::null);
bool saveSourceFile();
@ -98,6 +99,7 @@ class MainWindow : public MainWindowBase
///-- void dragEnterEvent(TQDragEnterEvent *event);
///-- void dropEvent(TQDropEvent *event);
TQSplitter *m_centralSplitter;
TQextScintilla *m_qSciSourceCodeEditor;
UiGuiSettings *m_settings;
@ -113,7 +115,7 @@ class MainWindow : public MainWindowBase
int m_actionClearRecentlyOpenedListId;
int m_recentlyOpenedListMaxSize;
///-- int _textEditLastScrollPos;
///-- int _currentIndenterID;
int m_currentIndenterID;
int m_oldLinesNumber;
bool m_loadLastSourceCodeFileOnStartup;
TQString m_currentSourceFile;
@ -134,7 +136,7 @@ class MainWindow : public MainWindowBase
TQStringList m_recentlyOpenedList;
ToolBarWidget *m_toolBarWidget;
///-- IndentHandler *_indentHandler;
IndentHandler *m_indentHandler;
TQLabel *m_textEditLineColumnInfoLabel;
};

@ -13,17 +13,6 @@
<height>633</height>
</rect>
</property>
<hbox>
<property name="name">
<cstring>centralWidget</cstring>
</property>
<property name="spacing">
<number>6</number>
</property>
<property name="margin">
<number>0</number>
</property>
</hbox>
</widget>
<menubar>
<property name="name">
@ -60,6 +49,10 @@
<action name="actionExit" />
</item>
<item text="&amp;Indenter" name="menuIndenter">
<action name="actionLoadIndenterConfigFile"/>
<action name="actionSaveIndenterConfigFile"/>
<action name="actionCreateShellScript"/>
<action name="actionResetIndenterParameters"/>
</item>
<item text="&amp;Settings" name="menuSettings">
<action name="actionLiveIndentPreview"/>
@ -232,6 +225,56 @@
<string>Ctrl+Q</string>
</property>
</action>
<action>
<property name="name">
<cstring>actionLoadIndenterConfigFile</cstring>
</property>
<property name="text">
<string>Load Indenter Config File</string>
</property>
<property name="statusTip">
<string>Opens a file dialog to load the original config file of the indenter.</string>
</property>
<property name="accel">
<string>Alt+O</string>
</property>
</action>
<action>
<property name="name">
<cstring>actionSaveIndenterConfigFile</cstring>
</property>
<property name="text">
<string>Save Indenter Config File</string>
</property>
<property name="statusTip">
<string>Opens a dialog to save the current indenter configuration to a file.</string>
</property>
<property name="accel">
<string>Alt+S</string>
</property>
</action>
<action>
<property name="name">
<cstring>actionCreateShellScript</cstring>
</property>
<property name="text">
<string>Create Indenter Call Shell Script</string>
</property>
<property name="statusTip">
<string>Create a shell script that calls the current selected indenter for formatting a given file with the current indent settings.</string>
</property>
</action>
<action>
<property name="name">
<cstring>actionResetIndenterParameters</cstring>
</property>
<property name="text">
<string>Reset indenter parameters</string>
</property>
<property name="statusTip">
<string>Resets all indenter parameters to the default values.</string>
</property>
</action>
<action>
<property name="name">
<cstring>actionLiveIndentPreview</cstring>

@ -63,10 +63,6 @@ void SettingsPaths::init()
m_applicationBinaryPath.truncate(m_applicationBinaryPath.length() - 1);
}
#ifdef UNIVERSALINDENTGUI_NPP_EXPORTS
m_applicationBinaryPath += "/plugins/uigui";
#endif
// If the "config" directory is a subdir of the applications binary path, use this one
// (portable mode)
m_settingsPath = m_applicationBinaryPath + "/config";

File diff suppressed because it is too large Load Diff

@ -1,195 +0,0 @@
/***************************************************************************
* Copyright (C) 2006-2012 by Thomas Schweitzer *
* thomas-schweitzer(at)arcor.de *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License version 2.0 as *
* published by the Free Software Foundation. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program in the file LICENSE.GPL; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#ifndef INDENTHANDLER_H
#define INDENTHANDLER_H
#include <tntqwidget.h>
class UiGuiErrorMessage;
class UiGuiIniFileParser;
class TQMenu;
class TQVBoxLayout;
class TQLabel;
class TQSpinBox;
class TQComboBox;
class TQCheckBox;
class TQLineEdit;
class TQToolButton;
class TQToolBox;
class IndentHandler : public TQWidget
{
Q_OBJECT
public:
IndentHandler(int indenterID, TQWidget *mainWindow = NULL, TQWidget *parent = NULL);
~IndentHandler();
TQString generateShellScript(const TQString &configFilename);
TQString callIndenter(TQString sourceCode, TQString inputFileExtension);
bool loadConfigFile(TQString filePathName);
void resetToDefaultValues();
TQStringList getAvailableIndenters();
TQString getPossibleIndenterFileExtensions();
TQString getParameterString();
TQString getIndenterCfgFile();
TQString getManual();
void retranslateUi();
TQString getCurrentIndenterName();
TQMenu* getIndenterMenu();
TQList<TQAction*> getIndenterMenuActions();
void contextMenuEvent(TQContextMenuEvent *event);
void setParameterChangedCallback(void (*paramChangedCallback)(void));
void setWindowClosedCallback(void (*winClosedCallback)(void));
int getIndenterId();
signals:
void indenterSettingsChanged();
void selectedIndenterIndexChanged(int index);
protected:
bool event(TQEvent *event);
void closeEvent(TQCloseEvent *event);
void wheelEvent(TQWheelEvent *event);
private slots:
void setIndenter(int indenterID);
void showIndenterManual();
void openConfigFileDialog();
void saveasIndentCfgFileDialog();
void createIndenterCallShellScript();
void resetIndenterParameter();
void handleChangedIndenterSettings();
void updateDrawing();
private:
TQString callExecutableIndenter(TQString sourceCode, TQString inputFileExtension);
TQString callJavaScriptIndenter(TQString sourceCode);
void saveConfigFile(TQString filePathName, TQString parameterString);
void readIndentIniFile(TQString iniFilePath);
bool createIndenterCallString();
void initIndenterMenu();
// Holds a reference to all created pages of the parameter categories toolbox and the pages
// boxlayout
struct IndenterParameterCategoryPage
{
TQWidget *widget;
TQVBoxLayout *vboxLayout;
};
TQVector<IndenterParameterCategoryPage> _indenterParameterCategoryPages;
// Holds a reference to all checkboxes needed for boolean parameter setting and the parameters
// name
struct ParamBoolean
{
TQString paramName;
TQString trueString;
TQString falseString;
TQCheckBox *checkBox;
};
TQVector<ParamBoolean> _paramBooleans;
// Holds a reference to all line edits needed for parameter setting and the parameters name
struct ParamString
{
TQString paramName;
TQString paramCallName;
TQCheckBox *valueEnabledChkBox;
TQLineEdit *lineEdit;
TQLabel *label;
};
TQVector<ParamString> _paramStrings;
// Hold a reference to all spin boxes needed for parameter setting and the parameters name
struct ParamNumeric
{
TQString paramName;
TQString paramCallName;
TQCheckBox *valueEnabledChkBox;
TQSpinBox *spinBox;
TQLabel *label;
};
TQVector<ParamNumeric> _paramNumerics;
// Hold a reference to all combo boxes needed for parameter setting and the parameters name
struct ParamMultiple
{
TQString paramName;
TQString paramCallName;
TQCheckBox *valueEnabledChkBox;
TQComboBox *comboBox;
TQStringList choicesStrings;
TQStringList choicesStringsReadable;
};
TQVector<ParamMultiple> _paramMultiples;
TQComboBox *_indenterSelectionCombobox;
TQToolButton *_indenterParameterHelpButton;
// Vertical layout box, into which the toolbox will be added
TQVBoxLayout *_toolBoxContainerLayout;
TQToolBox *_indenterParameterCategoriesToolBox;
UiGuiIniFileParser *_indenterSettings;
TQStringList _indenterParameters;
// The indenters name in a descriptive form
TQString _indenterName;
// The indenters file name (w/o extension), that is being called
TQString _indenterFileName;
TQString _indenterDirctoryStr;
TQString _tempDirctoryStr;
TQString _settingsDirctoryStr;
TQStringList _indenterIniFileList;
TQString _parameterOrder;
TQString _globalConfigFilename;
TQString _cfgFileParameterEnding;
TQString _inputFileParameter;
TQString _inputFileName;
TQString _outputFileParameter;
TQString _outputFileName;
TQString _fileTypes;
TQString _useCfgFileParameter;
TQString _indenterShowHelpParameter;
TQWidget *_mainWindow;
UiGuiErrorMessage *_errorMessageDialog;
TQString _indenterExecutableCallString;
TQString _indenterExecutableSuffix;
TQMenu *_menuIndenter;
TQAction *_actionLoadIndenterConfigFile;
TQAction *_actionSaveIndenterConfigFile;
TQAction *_actionCreateShellScript;
TQAction *_actionResetIndenterParameters;
// Needed for the NPP plugin.
void (*_parameterChangedCallback)(void);
// Needed for the NPP plugin.
void (*_windowClosedCallback)(void);
//TODO: This function should go into a string helper/tool class/file.
TQString encodeToHTML(const TQString &text);
};
#endif // INDENTHANDLER_H

@ -1,51 +0,0 @@
<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
<author>Thomas_-_S</author>
<class>MainWindowUi</class>
<widget class="TQMainWindow">
<property name="name">
<cstring>MainWindowUi</cstring>
</property>
<widget class="TQWidget" name="centralwidget"/>
<widget class="TQStatusBar" name="statusbar"/>
<widget class="TQDockWidget" name="dockWidget">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="features">
<set>TQDockWidget::DockWidgetFloatable|TQDockWidget::DockWidgetMovable</set>
</property>
<property name="allowedAreas">
<set>TQt::LeftDockWidgetArea|TQt::RightDockWidgetArea</set>
</property>
<property name="windowTitle">
<string>Indenter Settings</string>
</property>
<attribute name="dockWidgetArea">
<number>1</number>
</attribute>
<widget class="TQWidget" name="dockWidgetContents">
<layout class="TQHBoxLayout">
<property name="spacing">
<number>6</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item>
<layout class="TQVBoxLayout">
<property name="spacing">
<number>0</number>
</property>
<property name="margin">
<number>0</number>
</property>
</layout>
</item>
</layout>
</widget>
</widget>
</widget>
</UI>

@ -19,9 +19,6 @@
#include "TemplateBatchScript.h"
// Need to include TQObject here so that platform specific defines like Q_OS_WIN32 are set.
#include <tntqobject.h>
/*
\brief The only and static function of this class returns a batch or shell script
as string that can be used to call an indenter with the current settings from
@ -36,51 +33,6 @@
const char* TemplateBatchScript::getTemplateBatchScript()
{
static const char *templateBatchScript =
#if defined (Q_OS_WIN32)
"@echo off\n"
"\n"
"IF (%1)==() GOTO error\n"
"dir /b /ad %1 >nul 2>nul && GOTO indentDir\n"
"IF NOT EXIST %1 GOTO error\n"
"goto indentFile\n"
"\n"
":indentDir\n"
"set searchdir=%1\n"
"\n"
"IF (%2)==() GOTO assignDefaultSuffix\n"
"set filesuffix=%2\n"
"\n"
"GOTO run\n"
"\n"
":assignDefaultSuffix\n"
"::echo !!!!DEFAULT SUFFIX!!!\n"
"set filesuffix=*\n"
"\n"
":run\n"
"FOR /F \"tokens=*\" %%G IN ('DIR /B /S %searchdir%\\*.%filesuffix%') DO (\n"
"echo Indenting file \"%%G\"\n"
"__INDENTERCALLSTRING1__\n"
")\n"
"GOTO ende\n"
"\n"
":indentFile\n"
"echo Indenting one file %1\n"
"__INDENTERCALLSTRING2__\n"
"\n"
"GOTO ende\n"
"\n"
":error\n"
"echo .\n"
"echo ERROR: As parameter given directory or file does not exist!\n"
"echo Syntax is: __INDENTERCALLSTRINGSCRIPTNAME__ dirname filesuffix\n"
"echo Syntax is: __INDENTERCALLSTRINGSCRIPTNAME__ filename\n"
"echo Example: __INDENTERCALLSTRINGSCRIPTNAME__ temp cpp\n"
"echo .\n"
"\n"
":ende\n";
#else
"#!/bin/sh \n"
"\n"
"if [ ! -n \"$1\" ]; then\n"
@ -118,54 +70,5 @@ const char* TemplateBatchScript::getTemplateBatchScript()
"exit 1\n"
"fi\n"
"fi\n";
#endif // #if defined(Q_OS_WIN32)
return templateBatchScript;
}
/* Here comes the original batch script without the c++ markup
@echo off
IF (%1)==() GOTO error
dir /b /ad %1 >nul 2>nul && GOTO indentDir
IF NOT EXIST %1 GOTO error
goto indentFile
:indentDir
set searchdir=%1
IF (%2)==() GOTO assignDefaultSuffix
set filesuffix=%2
GOTO run
:assignDefaultSuffix
::echo !!!!DEFAULT SUFFIX!!!
set filesuffix=*
:run
FOR /F "tokens=*" %%G IN ('DIR /B /S %searchdir%\*.%filesuffix%') DO (
echo Indenting file "%%G"
::call call_CSSTidy.bat "%%G"
"C:/Dokumente und Einstellungen/ts/Eigene Dateien/Visual Studio 2005/Projects/UiGuixy/indenters/csstidy.exe" "%%G" --timestamp=true --allow_html_in_templates=false --compress_colors=true --compress_font=true --lowercase_s=false --preserve_css=false --remove_last_;=false --remove_bslash=true --sort_properties=false --sort_selectors=false indentoutput.css
move /Y indentoutput.css "%%G"
)
GOTO ende
:indentFile
echo Indenting one file %1
"C:/Dokumente und Einstellungen/ts/Eigene Dateien/Visual Studio 2005/Projects/UiGuixy/indenters/csstidy.exe" %1 --timestamp=true --allow_html_in_templates=false --compress_colors=true --compress_font=true --lowercase_s=false --preserve_css=false --remove_last_;=false --remove_bslash=true --sort_properties=false --sort_selectors=false indentoutput.css
move /Y indentoutput.css %1
GOTO ende
:error
echo .
echo ERROR: As parameter given directory or file does not exist!
echo Syntax is: recurse.bat dirname filesuffix
echo Syntax is: recurse.bat filename
echo Example: recurse.bat temp cpp
echo .
:ende
*/

Loading…
Cancel
Save