Build basic application with empty main window

Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
pull/3/head
Michele Calgaro 2 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
main.cpp
UiGuiVersion.cpp
MainWindow.cpp
)
tde_add_executable( ${target} AUTOMOC

File diff suppressed because it is too large Load Diff

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

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

Loading…
Cancel
Save