UniversalIndentGUI 1.2.0
MainWindow.h
Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (C) 2006-2012 by Thomas Schweitzer                          *
00003  *   thomas-schweitzer(at)arcor.de                                         *
00004  *                                                                         *
00005  *   This program is free software; you can redistribute it and/or modify  *
00006  *   it under the terms of the GNU General Public License version 2.0 as   *
00007  *   published by the Free Software Foundation.                            *
00008  *                                                                         *
00009  *   This program is distributed in the hope that it will be useful,       *
00010  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00011  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00012  *   GNU General Public License for more details.                          *
00013  *                                                                         *
00014  *   You should have received a copy of the GNU General Public License     *
00015  *   along with this program in the file LICENSE.GPL; if not, write to the *
00016  *   Free Software Foundation, Inc.,                                       *
00017  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
00018  ***************************************************************************/
00019 
00020 #ifndef MAINWINDOW_H
00021 #define MAINWINDOW_H
00022 
00023 #include <QMainWindow>
00024 
00025 #include  "UiGuiSettings.h"
00026 
00027 class UiGuiSettingsDialog;
00028 class AboutDialog;
00029 class AboutDialogGraphicsView;
00030 class UiGuiHighlighter;
00031 class IndentHandler;
00032 class UpdateCheckDialog;
00033 namespace Ui {
00034     class ToolBarWidget;
00035     class MainWindowUi;
00036 }
00037 
00038 class QLabel;
00039 class QScrollBar;
00040 class QActionGroup;
00041 class QTranslator;
00042 
00043 class QsciScintilla;
00044 
00045 
00046 class MainWindow : public QMainWindow
00047 {
00048     Q_OBJECT
00049 
00050 public:
00052     MainWindow(QString file2OpenOnStart = "", QWidget *parent = NULL);
00053     ~MainWindow() {
00054         _settings.clear();
00055     }
00056 
00057 protected:
00058     void closeEvent( QCloseEvent *event );
00059     bool eventFilter(QObject *obj, QEvent *event);
00060 
00061 private slots:
00062     void openSourceFileDialog(QString fileName = "");
00063     bool saveasSourceFileDialog(QAction *chosenEncodingAction = NULL);
00064     void saveAsOtherEncoding(QAction *chosenEncodingAction);
00065     bool saveSourceFile();
00066     void callIndenter();
00067     void updateSourceView();
00068     void turnHighlightOnOff(bool turnOn);
00069     void setWhiteSpaceVisibility(bool visible);
00070     void sourceCodeChangedHelperSlot();
00071     void sourceCodeChangedSlot();
00072     void indentSettingsChangedSlot();
00073     void previewTurnedOnOff(bool turnOn);
00074     void exportToPDF();
00075     void exportToHTML();
00076     void languageChanged(int languageIndex);
00077     void encodingChanged(QAction *encodingAction);
00078     void numberOfLinesChanged();
00079     void updateRecentlyOpenedList();
00080     void openFileFromRecentlyOpenedList(QAction* recentlyOpenedAction);
00081     void clearRecentlyOpenedList();
00082     void showAboutDialog();
00083     void setStatusBarCursorPosInfo(int line, int column);
00084 
00085 private:
00086     Ui::MainWindowUi *_mainWindowForm;
00087 
00088     QString loadFile(QString filePath);
00089     QString openFileDialog(QString dialogHeaderStr, QString startPath, QString fileMaskStr);
00090     void updateWindowTitle();
00091     void loadLastOpenedFile();
00092     void saveSettings();
00093     bool maybeSave();
00094     void createEncodingMenu();
00095     void createHighlighterMenu();
00096     bool initApplicationLanguage();
00097     void initMainWindow();
00098     void initToolBar();
00099     void initTextEditor();
00100     void initSyntaxHighlighter();
00101     void initIndenter();
00102     void changeEvent(QEvent *event);
00103     void dragEnterEvent(QDragEnterEvent *event);
00104     void dropEvent(QDropEvent *event);
00105 
00106     QsciScintilla *_qSciSourceCodeEditor;
00107     QSharedPointer<UiGuiSettings> _settings;
00108 
00109     QString _currentEncoding;
00110     QString _sourceFileContent;
00111     QString _sourceFormattedContent;
00112     QString _sourceViewContent;
00113     UiGuiHighlighter *_highlighter;
00114     QScrollBar *_textEditVScrollBar;
00115     AboutDialog *_aboutDialog;
00116     AboutDialogGraphicsView *_aboutDialogGraphicsView;
00117     UiGuiSettingsDialog *_settingsDialog;
00118     int _textEditLastScrollPos;
00119     int _currentIndenterID;
00120     bool _loadLastSourceCodeFileOnStartup;
00121     QString _currentSourceFile;
00122     QString _currentSourceFileExtension;
00123     QString _savedSourceContent;
00124     QActionGroup *_encodingActionGroup;
00125     QActionGroup *_saveEncodedActionGroup;
00126     QActionGroup *_highlighterActionGroup;
00127     QTranslator *_uiGuiTranslator;
00128     QTranslator *_qTTranslator;
00129     bool _isFirstRunOfThisVersion;
00130 
00131     bool _sourceCodeChanged;
00132     bool _scrollPositionChanged;
00133     bool _indentSettingsChanged;
00134     bool _previewToggled;
00135     QStringList _encodingsList;
00136 
00137     Ui::ToolBarWidget *_toolBarWidget;
00138     IndentHandler *_indentHandler;
00139     UpdateCheckDialog *_updateCheckDialog;
00140     QLabel *_textEditLineColumnInfoLabel;
00141 };
00142 
00143 #endif // MAINWINDOW_H
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines