Build basic application with empty main window

Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
pull/3/head
Michele Calgaro 3 years ago
parent 2ba166d1f8
commit 14f7e49438
Signed by: MicheleC
GPG Key ID: 2A75B7CA8ADED5CF

@ -28,6 +28,7 @@ set( target universal-indent-gui-tqt )
set( ${target}_SRCS set( ${target}_SRCS
main.cpp main.cpp
UiGuiVersion.cpp UiGuiVersion.cpp
MainWindow.cpp
) )
tde_add_executable( ${target} AUTOMOC tde_add_executable( ${target} AUTOMOC

File diff suppressed because it is too large Load Diff

@ -20,33 +20,33 @@
#ifndef MAINWINDOW_H #ifndef MAINWINDOW_H
#define MAINWINDOW_H #define MAINWINDOW_H
#include <tntqmainwindow.h> #include <tqmainwindow.h>
#include "UiGuiSettings.h" /// #include "UiGuiSettings.h"
///
class UiGuiSettingsDialog; /// class UiGuiSettingsDialog;
class AboutDialog; /// class AboutDialog;
class AboutDialogGraphicsView; /// class AboutDialogGraphicsView;
class UiGuiHighlighter; /// class UiGuiHighlighter;
class IndentHandler; /// class IndentHandler;
class UpdateCheckDialog; /// class UpdateCheckDialog;
namespace Ui /// namespace Ui
{ /// {
class ToolBarWidget; /// class ToolBarWidget;
class MainWindowUi; /// class MainWindowUi;
} /// }
///
class TQLabel; /// class TQLabel;
class TQScrollBar; /// class TQScrollBar;
class TQActionGroup; /// class TQActionGroup;
class TQTranslator; /// class TQTranslator;
///
class QsciScintilla; /// class QsciScintilla;
class MainWindow : public TQMainWindow class MainWindow : public TQMainWindow
{ {
Q_OBJECT ///--Q_OBJECT
public: public:
//! Constructor //! Constructor
@ -54,93 +54,93 @@ class MainWindow : public TQMainWindow
~MainWindow() ~MainWindow()
{ {
_settings.clear(); ///-- _settings.clear();
} }
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(TQString fileName = ""); ///-- void openSourceFileDialog(TQString fileName = "");
bool saveasSourceFileDialog(TQAction *chosenEncodingAction = NULL); ///-- bool saveasSourceFileDialog(TQAction *chosenEncodingAction = NULL);
void saveAsOtherEncoding(TQAction *chosenEncodingAction); ///-- void saveAsOtherEncoding(TQAction *chosenEncodingAction);
bool saveSourceFile(); ///-- bool saveSourceFile();
void callIndenter(); ///-- void callIndenter();
void updateSourceView(); ///-- void updateSourceView();
void turnHighlightOnOff(bool turnOn); ///-- void turnHighlightOnOff(bool turnOn);
void setWhiteSpaceVisibility(bool visible); ///-- void setWhiteSpaceVisibility(bool visible);
void sourceCodeChangedHelperSlot(); ///-- void sourceCodeChangedHelperSlot();
void sourceCodeChangedSlot(); ///-- void sourceCodeChangedSlot();
void indentSettingsChangedSlot(); ///-- void indentSettingsChangedSlot();
void previewTurnedOnOff(bool turnOn); ///-- void previewTurnedOnOff(bool turnOn);
void exportToPDF(); ///-- void exportToPDF();
void exportToHTML(); ///-- void exportToHTML();
void languageChanged(int languageIndex); ///-- void languageChanged(int languageIndex);
void encodingChanged(TQAction *encodingAction); ///-- void encodingChanged(TQAction *encodingAction);
void numberOfLinesChanged(); ///-- void numberOfLinesChanged();
void updateRecentlyOpenedList(); ///-- void updateRecentlyOpenedList();
void openFileFromRecentlyOpenedList(TQAction *recentlyOpenedAction); ///-- void openFileFromRecentlyOpenedList(TQAction *recentlyOpenedAction);
void clearRecentlyOpenedList(); ///-- void clearRecentlyOpenedList();
void showAboutDialog(); ///-- void showAboutDialog();
void setStatusBarCursorPosInfo(int line, int column); ///-- void setStatusBarCursorPosInfo(int line, int column);
///--
private: ///-- private:
Ui::MainWindowUi *_mainWindowForm; ///-- Ui::MainWindowUi *_mainWindowForm;
///--
TQString loadFile(TQString filePath); ///-- TQString loadFile(TQString filePath);
TQString openFileDialog(TQString dialogHeaderStr, TQString startPath, TQString fileMaskStr); ///-- TQString openFileDialog(TQString dialogHeaderStr, TQString startPath, TQString fileMaskStr);
void updateWindowTitle(); ///-- void updateWindowTitle();
void loadLastOpenedFile(); ///-- void loadLastOpenedFile();
void saveSettings(); ///-- void saveSettings();
bool maybeSave(); ///-- bool maybeSave();
void createEncodingMenu(); ///-- void createEncodingMenu();
void createHighlighterMenu(); ///-- void createHighlighterMenu();
bool initApplicationLanguage(); ///-- bool initApplicationLanguage();
void initMainWindow(); ///-- void initMainWindow();
void initToolBar(); ///-- void initToolBar();
void initTextEditor(); ///-- void initTextEditor();
void initSyntaxHighlighter(); ///-- void initSyntaxHighlighter();
void initIndenter(); ///-- void initIndenter();
void changeEvent(TQEvent *event); ///-- void changeEvent(TQEvent *event);
void dragEnterEvent(TQDragEnterEvent *event); ///-- void dragEnterEvent(TQDragEnterEvent *event);
void dropEvent(TQDropEvent *event); ///-- void dropEvent(TQDropEvent *event);
///--
QsciScintilla *_qSciSourceCodeEditor; ///-- QsciScintilla *_qSciSourceCodeEditor;
TQSharedPointer<UiGuiSettings> _settings; ///-- TQSharedPointer<UiGuiSettings> _settings;
///--
TQString _currentEncoding; ///-- TQString _currentEncoding;
TQString _sourceFileContent; ///-- TQString _sourceFileContent;
TQString _sourceFormattedContent; ///-- TQString _sourceFormattedContent;
TQString _sourceViewContent; ///-- TQString _sourceViewContent;
UiGuiHighlighter *_highlighter; ///-- UiGuiHighlighter *_highlighter;
TQScrollBar *_textEditVScrollBar; ///-- TQScrollBar *_textEditVScrollBar;
AboutDialog *_aboutDialog; ///-- AboutDialog *_aboutDialog;
AboutDialogGraphicsView *_aboutDialogGraphicsView; ///-- AboutDialogGraphicsView *_aboutDialogGraphicsView;
UiGuiSettingsDialog *_settingsDialog; ///-- UiGuiSettingsDialog *_settingsDialog;
int _textEditLastScrollPos; ///-- int _textEditLastScrollPos;
int _currentIndenterID; ///-- int _currentIndenterID;
bool _loadLastSourceCodeFileOnStartup; ///-- bool _loadLastSourceCodeFileOnStartup;
TQString _currentSourceFile; ///-- TQString _currentSourceFile;
TQString _currentSourceFileExtension; ///-- TQString _currentSourceFileExtension;
TQString _savedSourceContent; ///-- TQString _savedSourceContent;
TQActionGroup *_encodingActionGroup; ///-- TQActionGroup *_encodingActionGroup;
TQActionGroup *_saveEncodedActionGroup; ///-- TQActionGroup *_saveEncodedActionGroup;
TQActionGroup *_highlighterActionGroup; ///-- TQActionGroup *_highlighterActionGroup;
TQTranslator *_uiGuiTranslator; ///-- TQTranslator *_uiGuiTranslator;
TQTranslator *_qTTranslator; ///-- TQTranslator *_qTTranslator;
bool _isFirstRunOfThisVersion; ///-- bool _isFirstRunOfThisVersion;
///--
bool _sourceCodeChanged; ///-- bool _sourceCodeChanged;
bool _scrollPositionChanged; ///-- bool _scrollPositionChanged;
bool _indentSettingsChanged; ///-- bool _indentSettingsChanged;
bool _previewToggled; ///-- bool _previewToggled;
TQStringList _encodingsList; ///-- TQStringList _encodingsList;
///--
Ui::ToolBarWidget *_toolBarWidget; ///-- Ui::ToolBarWidget *_toolBarWidget;
IndentHandler *_indentHandler; ///-- IndentHandler *_indentHandler;
UpdateCheckDialog *_updateCheckDialog; ///-- UpdateCheckDialog *_updateCheckDialog;
TQLabel *_textEditLineColumnInfoLabel; ///-- TQLabel *_textEditLineColumnInfoLabel;
}; };
#endif // MAINWINDOW_H #endif // MAINWINDOW_H

@ -17,8 +17,8 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/ ***************************************************************************/
// -- #include "MainWindow.h" #include "MainWindow.h"
// --
// -- #include "UiGuiIndentServer.h" // -- #include "UiGuiIndentServer.h"
// -- #include "debugging/TSLogger.h" // -- #include "debugging/TSLogger.h"
// -- #include "UiGuiIniFileParser.h" // -- #include "UiGuiIniFileParser.h"
@ -26,10 +26,10 @@
// -- #include "UiGuiSystemInfo.h" // -- #include "UiGuiSystemInfo.h"
// -- #include "IndentHandler.h" // -- #include "IndentHandler.h"
// -- #include "SettingsPaths.h" // -- #include "SettingsPaths.h"
// --
// -- #include <tqapplication.h> #include <tqapplication.h>
// -- #include <tqtextcodec.h> #include <tqtextcodec.h>
// -- #include <tqdebug.h> #include <tqglobal.h>
// -- #include <string> // -- #include <string>
// -- #include <algorithm> // -- #include <algorithm>
@ -63,7 +63,6 @@ int main(int argc, char *argv[])
bool tclapExitExceptionThrown = false; bool tclapExitExceptionThrown = false;
int returnValue = 0; int returnValue = 0;
return 0;
// Wrap everything in a try block. Do this every time, // Wrap everything in a try block. Do this every time,
// because exceptions will be thrown for problems. // because exceptions will be thrown for problems.
try try
@ -129,15 +128,15 @@ int main(int argc, char *argv[])
return returnValue; return returnValue;
} }
// -- TQApplication app(argc, argv); TQApplication app(argc, argv);
// -- UiGuiIndentServer server; // -- UiGuiIndentServer server;
// -- MainWindow *mainWindow = NULL; MainWindow *mainWindow = NULL;
// -- IndentHandler *indentHandler = NULL; // -- IndentHandler *indentHandler = NULL;
// -- // --
// -- // Init and install the logger function. // Init and install the logger function.
// -- // Setting UTF-8 as default 8-Bit encoding to ensure that tqDebug does no false string conversion. // Setting UTF-8 as default 8-Bit encoding to ensure that tqDebug does no false string conversion.
// -- TQTextCodec::setCodecForCStrings(TQTextCodec::codecForName("UTF-8")); TQTextCodec::setCodecForCStrings(TQTextCodec::codecForName("UTF-8"));
// -- TQTextCodec::setCodecForLocale(TQTextCodec::codecForName("UTF-8")); TQTextCodec::setCodecForLocale(TQTextCodec::codecForName("UTF-8"));
// -- // Force creation of an TSLogger instance here, to avoid recursion with SettingsPaths init function. // -- // Force creation of an TSLogger instance here, to avoid recursion with SettingsPaths init function.
// -- #ifdef _DEBUG // -- #ifdef _DEBUG
// -- TSLogger::getInstance(0); // -- TSLogger::getInstance(0);
@ -148,16 +147,11 @@ int main(int argc, char *argv[])
// -- TSLogger::messageHandler(TSLoggerInfoMsg, TQString("Starting UiGUI Version %1 %2").arg(PROGRAM_VERSION_STRING).arg(PROGRAM_REVISION).toAscii()); // -- TSLogger::messageHandler(TSLoggerInfoMsg, TQString("Starting UiGUI Version %1 %2").arg(PROGRAM_VERSION_STRING).arg(PROGRAM_REVISION).toAscii());
// -- TSLogger::messageHandler(TSLoggerInfoMsg, TQString("Running on %1").arg(UiGuiSystemInfo::getOperatingSystem()).toAscii()); // -- TSLogger::messageHandler(TSLoggerInfoMsg, TQString("Running on %1").arg(UiGuiSystemInfo::getOperatingSystem()).toAscii());
// -- // --
// -- // Set default values for all by UniversalIndentGUI used settings objects. // Start normal with full gui and without server.
// -- TQCoreApplication::setOrganizationName("UniversalIndentGUI"); if (!startAsPlugin && !startAsServer) {
// -- TQCoreApplication::setOrganizationDomain("universalindent.sf.net"); mainWindow = new MainWindow(file2OpenOnStart);
// -- TQCoreApplication::setApplicationName("UniversalIndentGUI"); mainWindow->show();
// -- }
// -- // Start normal with full gui and without server.
// -- if (!startAsPlugin && !startAsServer) {
// -- mainWindow = new MainWindow(file2OpenOnStart);
// -- mainWindow->show();
// -- }
// -- // Start as plugin with server. // -- // Start as plugin with server.
// -- else if (startAsPlugin) { // -- else if (startAsPlugin) {
// -- server.startServer(); // -- server.startServer();
@ -168,20 +162,23 @@ int main(int argc, char *argv[])
// -- else if (startAsServer) { // -- else if (startAsServer) {
// -- server.startServer(); // -- server.startServer();
// -- } // -- }
// --
// -- try { try
// -- returnValue = app.exec(); {
// -- } app.connect(&app, SIGNAL(lastWindowClosed()), &app, SLOT(quit())); // TODO: remove when no longer needed
// -- catch (std::exception &ex) { returnValue = app.exec();
// -- qCritical() << __LINE__ << " " << __FUNCTION__ << ": Something went terribly wrong:" << ex.what(); }
// -- } catch (std::exception &ex)
{
tqDebug(TQString() + __LINE__ + " " + __FUNCTION__ + ": Something went terribly wrong: " + ex.what());
}
// -- // --
// -- if (startAsPlugin || startAsServer) // -- if (startAsPlugin || startAsServer)
// -- server.stopServer(); // -- server.stopServer();
// -- // --
// -- delete indentHandler; // -- delete indentHandler;
// -- delete mainWindow; delete mainWindow;
// --
// -- SettingsPaths::cleanAndRemoveTempDir(); // -- SettingsPaths::cleanAndRemoveTempDir();
// -- TSLogger::deleteInstance(); // -- TSLogger::deleteInstance();

Loading…
Cancel
Save