[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 | |
---|
[67e53c96d7] | 36 | #include "tspsolver.h" |
---|
[2bc8e278b7] | 37 | #include "tspmodel.h" |
---|
[5515c2c2a7] | 38 | |
---|
[e0fcac5f2c] | 39 | /*! |
---|
| 40 | * \brief Class for handling Main Window UI and logic. |
---|
[1757eb594b] | 41 | * \author Copyright © 2007-2010 Lёppa <contacts[at]oleksii[dot]name> |
---|
[e0fcac5f2c] | 42 | */ |
---|
[5515c2c2a7] | 43 | class MainWindow: public QMainWindow, Ui::MainWindow |
---|
| 44 | { |
---|
| 45 | Q_OBJECT |
---|
[b424a7e320] | 46 | |
---|
[5515c2c2a7] | 47 | public: |
---|
| 48 | MainWindow(QWidget *parent = 0); |
---|
[4ccf855df8] | 49 | ~MainWindow(); |
---|
[b424a7e320] | 50 | |
---|
[5515c2c2a7] | 51 | private slots: |
---|
[e0fcac5f2c] | 52 | // Actions |
---|
[899d1b8e15] | 53 | void actionFileNewTriggered(); |
---|
[993d5af6f6] | 54 | void actionFileOpenTriggered(); |
---|
[aaf2113307] | 55 | void actionFileSaveTriggered(); |
---|
[430bd7f7e9] | 56 | void actionFileSaveAsTaskTriggered(); |
---|
| 57 | void actionFileSaveAsSolutionTriggered(); |
---|
[e0fcac5f2c] | 58 | #ifndef QT_NO_PRINTER |
---|
| 59 | void actionFilePrintPreviewTriggered(); |
---|
| 60 | void actionFilePrintTriggered(); |
---|
| 61 | #endif // QT_NO_PRINTER |
---|
[899d1b8e15] | 62 | void actionSettingsPreferencesTriggered(); |
---|
[0ac9690913] | 63 | void actionSettingsLanguageAutodetectTriggered(bool checked); |
---|
| 64 | void groupSettingsLanguageListTriggered(QAction *action); |
---|
[899d1b8e15] | 65 | void actionHelpAboutTriggered(); |
---|
[e0fcac5f2c] | 66 | // Buttons |
---|
| 67 | void buttonBackToTaskClicked(); |
---|
| 68 | void buttonRandomClicked(); |
---|
| 69 | void buttonSolveClicked(); |
---|
| 70 | |
---|
[690f6939a7] | 71 | void dataChanged(); |
---|
[0ac9690913] | 72 | void dataChanged(const QModelIndex &tl, const QModelIndex &br); |
---|
[b2bf8e3b6b] | 73 | #ifdef Q_OS_WINCE |
---|
[278bc7818f] | 74 | void changeEvent(QEvent *ev); |
---|
[b2bf8e3b6b] | 75 | void desktopResized(int screen); |
---|
| 76 | #endif // Q_OS_WINCE |
---|
[0ac9690913] | 77 | void numCitiesChanged(int nCities); |
---|
[c10297cf73] | 78 | #ifndef QT_NO_PRINTER |
---|
[caef58b531] | 79 | void printPreview(QPrinter *printer); |
---|
[c10297cf73] | 80 | #endif // QT_NO_PRINTER |
---|
[0ac9690913] | 81 | void spinCitiesValueChanged(int nCities); |
---|
[b424a7e320] | 82 | |
---|
[bb994a7ff8] | 83 | private: |
---|
[e0fcac5f2c] | 84 | QString fileName; |
---|
| 85 | QActionGroup *groupSettingsLanguageList; |
---|
| 86 | QStringList output; |
---|
[c10297cf73] | 87 | #ifndef QT_NO_PRINTER |
---|
[899d1b8e15] | 88 | QPrinter *printer; |
---|
[4ccf855df8] | 89 | QAction *actionFilePrintPreview; |
---|
| 90 | QAction *actionFilePrint; |
---|
[c10297cf73] | 91 | #endif // QT_NO_PRINTER |
---|
[e0fcac5f2c] | 92 | QSettings *settings; |
---|
[2bc8e278b7] | 93 | CTSPModel *tspmodel; |
---|
[b2bf8e3b6b] | 94 | #ifdef Q_OS_WINCE |
---|
| 95 | QRect currentGeometry; |
---|
| 96 | #endif // Q_OS_WINCE |
---|
[e0fcac5f2c] | 97 | |
---|
[0ac9690913] | 98 | void closeEvent(QCloseEvent *ev); |
---|
[b424a7e320] | 99 | void initDocStyleSheet(); |
---|
[899d1b8e15] | 100 | void loadLangList(); |
---|
[0ac9690913] | 101 | bool loadLanguage(const QString &lang = QString()); |
---|
[b424a7e320] | 102 | bool maybeSave(); |
---|
[f0464480db] | 103 | void outputMatrix(const TMatrix &matrix, QStringList &output); |
---|
| 104 | void outputMatrix(const SStep &step, QStringList &output); |
---|
[4ccf855df8] | 105 | void retranslateUi(bool all = true); |
---|
[b424a7e320] | 106 | bool saveTask(); |
---|
[1757eb594b] | 107 | void setFileName(const QString &fileName = tr("Untitled") + ".tspt"); |
---|
[4ccf855df8] | 108 | void setupUi(); |
---|
[1fbf016a09] | 109 | void toggleSolutionActions(bool enable = true); |
---|
[11086c2def] | 110 | void toggleTranclucency(bool enable); |
---|
[5515c2c2a7] | 111 | }; |
---|
| 112 | |
---|
| 113 | #endif // MAINWINDOW_H |
---|