[caef58b531] | 1 | /*! |
---|
[e0fcac5f2c] | 2 | * \file mainwindow.h |
---|
[1757eb594b] | 3 | * \author Copyright © 2007-2010 Lёppa <contacts[at]oleksii[dot]name> |
---|
[003e4193be] | 4 | * |
---|
[bb994a7ff8] | 5 | * $Id$ |
---|
| 6 | * $URL$ |
---|
[5515c2c2a7] | 7 | * |
---|
[e0fcac5f2c] | 8 | * \brief Defines MainWindow class. |
---|
| 9 | * |
---|
[caef58b531] | 10 | * <b>TSPSG: TSP Solver and Generator</b> |
---|
| 11 | * |
---|
[bb994a7ff8] | 12 | * This file is part of TSPSG. |
---|
[5515c2c2a7] | 13 | * |
---|
[bb994a7ff8] | 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. |
---|
[5515c2c2a7] | 18 | * |
---|
[bb994a7ff8] | 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. |
---|
[5515c2c2a7] | 23 | * |
---|
[bb994a7ff8] | 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/>. |
---|
[5515c2c2a7] | 26 | */ |
---|
| 27 | |
---|
| 28 | #ifndef MAINWINDOW_H |
---|
| 29 | #define MAINWINDOW_H |
---|
| 30 | |
---|
[993d5af6f6] | 31 | #include "globals.h" |
---|
[bc1b8837b6] | 32 | |
---|
[c10297cf73] | 33 | #include "ui_mainwindow.h" |
---|
[5515c2c2a7] | 34 | #include "settingsdialog.h" |
---|
[bc1b8837b6] | 35 | |
---|
[2bc8e278b7] | 36 | #include "tspmodel.h" |
---|
[5515c2c2a7] | 37 | |
---|
[9cda6e0f5d] | 38 | using namespace TSPSolver; |
---|
| 39 | |
---|
[e0fcac5f2c] | 40 | /*! |
---|
| 41 | * \brief Class for handling Main Window UI and logic. |
---|
[1757eb594b] | 42 | * \author Copyright © 2007-2010 Lёppa <contacts[at]oleksii[dot]name> |
---|
[e0fcac5f2c] | 43 | */ |
---|
[5515c2c2a7] | 44 | class MainWindow: public QMainWindow, Ui::MainWindow |
---|
| 45 | { |
---|
| 46 | Q_OBJECT |
---|
[b424a7e320] | 47 | |
---|
[5515c2c2a7] | 48 | public: |
---|
| 49 | MainWindow(QWidget *parent = 0); |
---|
[4ccf855df8] | 50 | ~MainWindow(); |
---|
[b424a7e320] | 51 | |
---|
[5515c2c2a7] | 52 | private slots: |
---|
[e0fcac5f2c] | 53 | // Actions |
---|
[899d1b8e15] | 54 | void actionFileNewTriggered(); |
---|
[993d5af6f6] | 55 | void actionFileOpenTriggered(); |
---|
[394216e468] | 56 | bool actionFileSaveTriggered(); |
---|
[430bd7f7e9] | 57 | void actionFileSaveAsTaskTriggered(); |
---|
| 58 | void actionFileSaveAsSolutionTriggered(); |
---|
[e0fcac5f2c] | 59 | #ifndef QT_NO_PRINTER |
---|
| 60 | void actionFilePrintPreviewTriggered(); |
---|
| 61 | void actionFilePrintTriggered(); |
---|
| 62 | #endif // QT_NO_PRINTER |
---|
[899d1b8e15] | 63 | void actionSettingsPreferencesTriggered(); |
---|
[0ac9690913] | 64 | void actionSettingsLanguageAutodetectTriggered(bool checked); |
---|
| 65 | void groupSettingsLanguageListTriggered(QAction *action); |
---|
[e3533af1cf] | 66 | void actionSettingsStyleSystemTriggered(bool checked); |
---|
| 67 | void groupSettingsStyleListTriggered(QAction *action); |
---|
[394216e468] | 68 | #ifdef Q_OS_WIN32 |
---|
| 69 | void actionHelpCheck4UpdatesTriggered(); |
---|
| 70 | #endif // Q_OS_WIN32 |
---|
[899d1b8e15] | 71 | void actionHelpAboutTriggered(); |
---|
[e0fcac5f2c] | 72 | // Buttons |
---|
| 73 | void buttonBackToTaskClicked(); |
---|
| 74 | void buttonRandomClicked(); |
---|
| 75 | void buttonSolveClicked(); |
---|
| 76 | |
---|
[690f6939a7] | 77 | void dataChanged(); |
---|
[0ac9690913] | 78 | void dataChanged(const QModelIndex &tl, const QModelIndex &br); |
---|
[1babbd6ba3] | 79 | #ifdef Q_OS_WINCE_WM |
---|
[278bc7818f] | 80 | void changeEvent(QEvent *ev); |
---|
[b2bf8e3b6b] | 81 | void desktopResized(int screen); |
---|
[1babbd6ba3] | 82 | #endif // Q_OS_WINCE_WM |
---|
[0ac9690913] | 83 | void numCitiesChanged(int nCities); |
---|
[c10297cf73] | 84 | #ifndef QT_NO_PRINTER |
---|
[caef58b531] | 85 | void printPreview(QPrinter *printer); |
---|
[c10297cf73] | 86 | #endif // QT_NO_PRINTER |
---|
[0ac9690913] | 87 | void spinCitiesValueChanged(int nCities); |
---|
[b424a7e320] | 88 | |
---|
[bb994a7ff8] | 89 | private: |
---|
[e0fcac5f2c] | 90 | QString fileName; |
---|
| 91 | QActionGroup *groupSettingsLanguageList; |
---|
[e3533af1cf] | 92 | QActionGroup *groupSettingsStyleList; |
---|
[c10297cf73] | 93 | #ifndef QT_NO_PRINTER |
---|
[899d1b8e15] | 94 | QPrinter *printer; |
---|
[4ccf855df8] | 95 | QAction *actionFilePrintPreview; |
---|
| 96 | QAction *actionFilePrint; |
---|
[c10297cf73] | 97 | #endif // QT_NO_PRINTER |
---|
[394216e468] | 98 | #ifdef Q_OS_WIN32 |
---|
| 99 | QAction *actionHelpCheck4Updates; |
---|
| 100 | #endif // Q_OS_WIN32 |
---|
[e0fcac5f2c] | 101 | QSettings *settings; |
---|
[2bc8e278b7] | 102 | CTSPModel *tspmodel; |
---|
[1babbd6ba3] | 103 | #ifdef Q_OS_WINCE_WM |
---|
[b2bf8e3b6b] | 104 | QRect currentGeometry; |
---|
[1babbd6ba3] | 105 | #endif // Q_OS_WINCE_WM |
---|
[e0fcac5f2c] | 106 | |
---|
[345e7b6132] | 107 | // The solution graph SVG |
---|
| 108 | QPicture graph; |
---|
| 109 | |
---|
[317ba0432e] | 110 | // Formats |
---|
| 111 | QTextTableFormat fmt_table; |
---|
| 112 | QTextBlockFormat fmt_paragraph, |
---|
[345e7b6132] | 113 | fmt_cell; |
---|
[317ba0432e] | 114 | QTextCharFormat fmt_default, |
---|
| 115 | fmt_selected, |
---|
| 116 | fmt_alternate, |
---|
| 117 | fmt_altlist; |
---|
| 118 | |
---|
[0ac9690913] | 119 | void closeEvent(QCloseEvent *ev); |
---|
[b574c383b7] | 120 | void dragEnterEvent(QDragEnterEvent *ev); |
---|
[345e7b6132] | 121 | void drawNode(QPainter &pic, int nstep, bool left = false, SStep *step = NULL); |
---|
[b574c383b7] | 122 | void dropEvent(QDropEvent *ev); |
---|
[394216e468] | 123 | bool hasUpdater() const; |
---|
[b424a7e320] | 124 | void initDocStyleSheet(); |
---|
[899d1b8e15] | 125 | void loadLangList(); |
---|
[0ac9690913] | 126 | bool loadLanguage(const QString &lang = QString()); |
---|
[e3533af1cf] | 127 | void loadStyleList(); |
---|
[b424a7e320] | 128 | bool maybeSave(); |
---|
[317ba0432e] | 129 | void outputMatrix(QTextCursor &cur, const TMatrix &matrix); |
---|
| 130 | void outputMatrix(QTextCursor &cur, const SStep &step); |
---|
[4ccf855df8] | 131 | void retranslateUi(bool all = true); |
---|
[b424a7e320] | 132 | bool saveTask(); |
---|
[1757eb594b] | 133 | void setFileName(const QString &fileName = tr("Untitled") + ".tspt"); |
---|
[4ccf855df8] | 134 | void setupUi(); |
---|
[1fbf016a09] | 135 | void toggleSolutionActions(bool enable = true); |
---|
[11086c2def] | 136 | void toggleTranclucency(bool enable); |
---|
[5515c2c2a7] | 137 | }; |
---|
| 138 | |
---|
| 139 | #endif // MAINWINDOW_H |
---|