1
/***************************************************************************
2
* Copyright (C) 2006-2008 by Thomas Schweitzer *
3
* thomas-schweitzer(at)arcor.de *
5
* This program is free software; you can redistribute it and/or modify *
6
* it under the terms of the GNU General Public License version 2.0 as *
7
* published by the Free Software Foundation. *
9
* This program is distributed in the hope that it will be useful, *
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12
* GNU General Public License for more details. *
14
* You should have received a copy of the GNU General Public License *
15
* along with this program in the file LICENSE.GPL; if not, write to the *
16
* Free Software Foundation, Inc., *
17
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
18
***************************************************************************/
23
#include "ui_MainWindow.h"
24
#include "ui_toolBarWidget.h"
25
#include "AboutDialog.h"
26
#include "AboutDialogGraphicsView.h"
27
#include "uiguisettings.h"
28
#include "uiguisettingsdialog.h"
29
#include "UiguiHighlighter.h"
30
#include "IndentHandler.h"
31
#include "updatecheckdialog.h"
36
#include <QTextCursor>
37
#include <QFileDialog>
38
#include <QTextStream>
40
#include <QPrintDialog>
41
#include <QCloseEvent>
44
#include <QTranslator>
49
#include <Qsci/qsciscintilla.h>
50
#include <Qsci/qsciprinter.h>
52
class MainWindow : public QMainWindow, private Ui::MainWindowUi
58
MainWindow(QString file2OpenOnStart = "", QWidget *parent = 0);
61
QString loadFile(QString filePath);
62
QString openFileDialog(QString dialogHeaderStr, QString startPath, QString fileMaskStr);
63
void updateWindowTitle();
64
void loadLastOpenedFile();
67
void createEncodingMenu();
68
void createHighlighterMenu();
69
bool initApplicationLanguage();
70
void initMainWindow();
72
void initTextEditor();
73
void initSyntaxHighlighter();
75
void changeEvent(QEvent *event);
76
void dragEnterEvent(QDragEnterEvent *event);
77
void dropEvent(QDropEvent *event);
79
QsciScintilla *qSciSourceCodeEditor;
80
UiguiSettings *settings;
86
QString currentEncoding;
87
QString sourceFileContent;
88
QString sourceFormattedContent;
89
QString sourceViewContent;
90
UiguiHighlighter *highlighter;
91
QScrollBar *textEditVScrollBar;
92
AboutDialog *aboutDialog;
93
AboutDialogGraphicsView *aboutDialogGraphicsView;
94
UiguiSettingsDialog *settingsDialog;
95
int textEditLastScrollPos;
96
int currentIndenterID;
97
bool loadLastSourceCodeFileOnStartup;
98
QString currentSourceFile;
99
QString currentSourceFileExtension;
100
QString savedSourceContent;
101
QActionGroup *encodingActionGroup;
102
QActionGroup *saveEncodedActionGroup;
103
QActionGroup *highlighterActionGroup;
104
QTranslator *uiGuiTranslator;
105
QTranslator *qTTranslator;
106
bool isFirstRunOfThisVersion;
108
bool sourceCodeChanged;
109
bool scrollPositionChanged;
110
bool indentSettingsChanged;
112
QStringList encodingsList;
114
Ui::toolBarWidget *toolBarWidget;
115
IndentHandler *indentHandler;
116
UpdateCheckDialog *updateCheckDialog;
117
QLabel *textEditLineColumnInfoLabel;
120
void closeEvent( QCloseEvent *event );
121
bool eventFilter(QObject *obj, QEvent *event);
124
void openSourceFileDialog(QString fileName = "");
125
bool saveasSourceFileDialog(QAction *chosenEncodingAction = NULL);
126
void saveAsOtherEncoding(QAction *chosenEncodingAction);
127
bool saveSourceFile();
129
void updateSourceView();
130
void turnHighlightOnOff(bool turnOn);
131
void setWhiteSpaceVisibility(bool visible);
132
void sourceCodeChangedHelperSlot();
133
void sourceCodeChangedSlot();
134
void indentSettingsChangedSlot();
135
void previewTurnedOnOff(bool turnOn);
138
void languageChanged(int languageIndex);
139
void encodingChanged(QAction *encodingAction);
140
void numberOfLinesChanged();
141
void updateRecentlyOpenedList();
142
void openFileFromRecentlyOpenedList(QAction* recentlyOpenedAction);
143
void clearRecentlyOpenedList();
144
void showAboutDialog();
145
void setStatusBarCursorPosInfo(int line, int column);
148
#endif // MAINWINDOW_H