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

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

@ -13,17 +13,6 @@
<height>633</height> <height>633</height>
</rect> </rect>
</property> </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> </widget>
<menubar> <menubar>
<property name="name"> <property name="name">
@ -60,6 +49,10 @@
<action name="actionExit" /> <action name="actionExit" />
</item> </item>
<item text="&amp;Indenter" name="menuIndenter"> <item text="&amp;Indenter" name="menuIndenter">
<action name="actionLoadIndenterConfigFile"/>
<action name="actionSaveIndenterConfigFile"/>
<action name="actionCreateShellScript"/>
<action name="actionResetIndenterParameters"/>
</item> </item>
<item text="&amp;Settings" name="menuSettings"> <item text="&amp;Settings" name="menuSettings">
<action name="actionLiveIndentPreview"/> <action name="actionLiveIndentPreview"/>
@ -232,6 +225,56 @@
<string>Ctrl+Q</string> <string>Ctrl+Q</string>
</property> </property>
</action> </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> <action>
<property name="name"> <property name="name">
<cstring>actionLiveIndentPreview</cstring> <cstring>actionLiveIndentPreview</cstring>

@ -63,10 +63,6 @@ void SettingsPaths::init()
m_applicationBinaryPath.truncate(m_applicationBinaryPath.length() - 1); 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 // If the "config" directory is a subdir of the applications binary path, use this one
// (portable mode) // (portable mode)
m_settingsPath = m_applicationBinaryPath + "/config"; 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" #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 \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 as string that can be used to call an indenter with the current settings from
@ -36,51 +33,6 @@
const char* TemplateBatchScript::getTemplateBatchScript() const char* TemplateBatchScript::getTemplateBatchScript()
{ {
static const char *templateBatchScript = 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" "#!/bin/sh \n"
"\n" "\n"
"if [ ! -n \"$1\" ]; then\n" "if [ ! -n \"$1\" ]; then\n"
@ -118,54 +70,5 @@ const char* TemplateBatchScript::getTemplateBatchScript()
"exit 1\n" "exit 1\n"
"fi\n" "fi\n"
"fi\n"; "fi\n";
#endif // #if defined(Q_OS_WIN32)
return templateBatchScript; 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