[65] | 1 | /*! |
---|
[67] | 2 | * \file mainwindow.h |
---|
[87] | 3 | * \author Copyright © 2007-2010 Lёppa <contacts[at]oleksii[dot]name> |
---|
[1] | 4 | * |
---|
[6] | 5 | * $Id: mainwindow.h 107 2010-04-25 14:36:27Z laleppa $ |
---|
| 6 | * $URL: https://tspsg.svn.sourceforge.net/svnroot/tspsg/trunk/src/mainwindow.h $ |
---|
[4] | 7 | * |
---|
[67] | 8 | * \brief Defines MainWindow class. |
---|
| 9 | * |
---|
[65] | 10 | * <b>TSPSG: TSP Solver and Generator</b> |
---|
| 11 | * |
---|
[6] | 12 | * This file is part of TSPSG. |
---|
[1] | 13 | * |
---|
[6] | 14 | * TSPSG is free software: you can redistribute it and/or modify |
---|
| 15 | * it under the terms of the GNU General Public License as published by |
---|
| 16 | * the Free Software Foundation, either version 3 of the License, or |
---|
| 17 | * (at your option) any later version. |
---|
[1] | 18 | * |
---|
[6] | 19 | * TSPSG is distributed in the hope that it will be useful, |
---|
| 20 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 21 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
| 22 | * GNU General Public License for more details. |
---|
[1] | 23 | * |
---|
[6] | 24 | * You should have received a copy of the GNU General Public License |
---|
| 25 | * along with TSPSG. If not, see <http://www.gnu.org/licenses/>. |
---|
[1] | 26 | */ |
---|
| 27 | |
---|
| 28 | #ifndef MAINWINDOW_H |
---|
| 29 | #define MAINWINDOW_H |
---|
| 30 | |
---|
[31] | 31 | #include "globals.h" |
---|
[64] | 32 | |
---|
[54] | 33 | #include "ui_mainwindow.h" |
---|
[1] | 34 | #include "settingsdialog.h" |
---|
[64] | 35 | |
---|
[15] | 36 | #include "tspmodel.h" |
---|
[1] | 37 | |
---|
[107] | 38 | using namespace TSPSolver; |
---|
| 39 | |
---|
[67] | 40 | /*! |
---|
| 41 | * \brief Class for handling Main Window UI and logic. |
---|
[87] | 42 | * \author Copyright © 2007-2010 Lёppa <contacts[at]oleksii[dot]name> |
---|
[67] | 43 | */ |
---|
[1] | 44 | class MainWindow: public QMainWindow, Ui::MainWindow |
---|
| 45 | { |
---|
| 46 | Q_OBJECT |
---|
[47] | 47 | |
---|
[1] | 48 | public: |
---|
| 49 | MainWindow(QWidget *parent = 0); |
---|
[80] | 50 | ~MainWindow(); |
---|
[47] | 51 | |
---|
[1] | 52 | private slots: |
---|
[67] | 53 | // Actions |
---|
[29] | 54 | void actionFileNewTriggered(); |
---|
[31] | 55 | void actionFileOpenTriggered(); |
---|
[99] | 56 | bool actionFileSaveTriggered(); |
---|
[42] | 57 | void actionFileSaveAsTaskTriggered(); |
---|
| 58 | void actionFileSaveAsSolutionTriggered(); |
---|
[67] | 59 | #ifndef QT_NO_PRINTER |
---|
| 60 | void actionFilePrintPreviewTriggered(); |
---|
| 61 | void actionFilePrintTriggered(); |
---|
| 62 | #endif // QT_NO_PRINTER |
---|
[29] | 63 | void actionSettingsPreferencesTriggered(); |
---|
[71] | 64 | void actionSettingsLanguageAutodetectTriggered(bool checked); |
---|
| 65 | void groupSettingsLanguageListTriggered(QAction *action); |
---|
[99] | 66 | #ifdef Q_OS_WIN32 |
---|
| 67 | void actionHelpCheck4UpdatesTriggered(); |
---|
| 68 | #endif // Q_OS_WIN32 |
---|
[29] | 69 | void actionHelpAboutTriggered(); |
---|
[67] | 70 | // Buttons |
---|
| 71 | void buttonBackToTaskClicked(); |
---|
| 72 | void buttonRandomClicked(); |
---|
| 73 | void buttonSolveClicked(); |
---|
| 74 | |
---|
[37] | 75 | void dataChanged(); |
---|
[71] | 76 | void dataChanged(const QModelIndex &tl, const QModelIndex &br); |
---|
[100] | 77 | #ifdef Q_OS_WINCE_WM |
---|
[95] | 78 | void changeEvent(QEvent *ev); |
---|
[94] | 79 | void desktopResized(int screen); |
---|
[100] | 80 | #endif // Q_OS_WINCE_WM |
---|
[71] | 81 | void numCitiesChanged(int nCities); |
---|
[54] | 82 | #ifndef QT_NO_PRINTER |
---|
[65] | 83 | void printPreview(QPrinter *printer); |
---|
[54] | 84 | #endif // QT_NO_PRINTER |
---|
[71] | 85 | void spinCitiesValueChanged(int nCities); |
---|
[47] | 86 | |
---|
[6] | 87 | private: |
---|
[67] | 88 | QString fileName; |
---|
| 89 | QActionGroup *groupSettingsLanguageList; |
---|
[54] | 90 | #ifndef QT_NO_PRINTER |
---|
[29] | 91 | QPrinter *printer; |
---|
[80] | 92 | QAction *actionFilePrintPreview; |
---|
| 93 | QAction *actionFilePrint; |
---|
[54] | 94 | #endif // QT_NO_PRINTER |
---|
[99] | 95 | #ifdef Q_OS_WIN32 |
---|
| 96 | QAction *actionHelpCheck4Updates; |
---|
| 97 | #endif // Q_OS_WIN32 |
---|
[67] | 98 | QSettings *settings; |
---|
[15] | 99 | CTSPModel *tspmodel; |
---|
[100] | 100 | #ifdef Q_OS_WINCE_WM |
---|
[94] | 101 | QRect currentGeometry; |
---|
[100] | 102 | #endif // Q_OS_WINCE_WM |
---|
[67] | 103 | |
---|
[106] | 104 | // The solution graph SVG |
---|
| 105 | QPicture graph; |
---|
| 106 | |
---|
[104] | 107 | // Formats |
---|
| 108 | QTextTableFormat fmt_table; |
---|
| 109 | QTextBlockFormat fmt_paragraph, |
---|
[106] | 110 | fmt_cell; |
---|
[104] | 111 | QTextCharFormat fmt_default, |
---|
| 112 | fmt_selected, |
---|
| 113 | fmt_alternate, |
---|
| 114 | fmt_altlist; |
---|
| 115 | |
---|
[71] | 116 | void closeEvent(QCloseEvent *ev); |
---|
[105] | 117 | void dragEnterEvent(QDragEnterEvent *ev); |
---|
[106] | 118 | void drawNode(QPainter &pic, int nstep, bool left = false, SStep *step = NULL); |
---|
[105] | 119 | void dropEvent(QDropEvent *ev); |
---|
[99] | 120 | bool hasUpdater() const; |
---|
[47] | 121 | void initDocStyleSheet(); |
---|
[67] | 122 | void loadLangList(); |
---|
[71] | 123 | bool loadLanguage(const QString &lang = QString()); |
---|
[47] | 124 | bool maybeSave(); |
---|
[104] | 125 | void outputMatrix(QTextCursor &cur, const TMatrix &matrix); |
---|
| 126 | void outputMatrix(QTextCursor &cur, const SStep &step); |
---|
[80] | 127 | void retranslateUi(bool all = true); |
---|
[67] | 128 | bool saveTask(); |
---|
[87] | 129 | void setFileName(const QString &fileName = tr("Untitled") + ".tspt"); |
---|
[80] | 130 | void setupUi(); |
---|
[78] | 131 | void toggleSolutionActions(bool enable = true); |
---|
[92] | 132 | void toggleTranclucency(bool enable); |
---|
[1] | 133 | }; |
---|
| 134 | |
---|
| 135 | #endif // MAINWINDOW_H |
---|