[caef58b531] | 1 | /*! |
---|
[e0fcac5f2c] | 2 | * \file mainwindow.h |
---|
[caef58b531] | 3 | * \author Copyright © 2007-2009 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. |
---|
| 41 | * \author Copyright © 2007-2009 Lёppa <contacts[at]oleksii[dot]name> |
---|
| 42 | */ |
---|
[5515c2c2a7] | 43 | class MainWindow: public QMainWindow, Ui::MainWindow |
---|
| 44 | { |
---|
| 45 | Q_OBJECT |
---|
[b424a7e320] | 46 | |
---|
[5515c2c2a7] | 47 | public: |
---|
| 48 | MainWindow(QWidget *parent = 0); |
---|
[b424a7e320] | 49 | |
---|
[5515c2c2a7] | 50 | private slots: |
---|
[e0fcac5f2c] | 51 | // Actions |
---|
[899d1b8e15] | 52 | void actionFileNewTriggered(); |
---|
[993d5af6f6] | 53 | void actionFileOpenTriggered(); |
---|
[aaf2113307] | 54 | void actionFileSaveTriggered(); |
---|
[430bd7f7e9] | 55 | void actionFileSaveAsTaskTriggered(); |
---|
| 56 | void actionFileSaveAsSolutionTriggered(); |
---|
[e0fcac5f2c] | 57 | #ifndef QT_NO_PRINTER |
---|
| 58 | void actionFilePrintPreviewTriggered(); |
---|
| 59 | void actionFilePrintTriggered(); |
---|
| 60 | #endif // QT_NO_PRINTER |
---|
[899d1b8e15] | 61 | void actionSettingsPreferencesTriggered(); |
---|
[0ac9690913] | 62 | void actionSettingsLanguageAutodetectTriggered(bool checked); |
---|
| 63 | void groupSettingsLanguageListTriggered(QAction *action); |
---|
[899d1b8e15] | 64 | void actionHelpAboutTriggered(); |
---|
[e0fcac5f2c] | 65 | // Buttons |
---|
| 66 | void buttonBackToTaskClicked(); |
---|
| 67 | void buttonRandomClicked(); |
---|
| 68 | void buttonSolveClicked(); |
---|
| 69 | |
---|
[690f6939a7] | 70 | void dataChanged(); |
---|
[0ac9690913] | 71 | void dataChanged(const QModelIndex &tl, const QModelIndex &br); |
---|
| 72 | void numCitiesChanged(int nCities); |
---|
[c10297cf73] | 73 | #ifndef QT_NO_PRINTER |
---|
[caef58b531] | 74 | void printPreview(QPrinter *printer); |
---|
[c10297cf73] | 75 | #endif // QT_NO_PRINTER |
---|
[0ac9690913] | 76 | void spinCitiesValueChanged(int nCities); |
---|
[b424a7e320] | 77 | |
---|
[bb994a7ff8] | 78 | private: |
---|
[e0fcac5f2c] | 79 | QString fileName; |
---|
| 80 | QActionGroup *groupSettingsLanguageList; |
---|
| 81 | QStringList output; |
---|
[c10297cf73] | 82 | #ifndef QT_NO_PRINTER |
---|
[899d1b8e15] | 83 | QPrinter *printer; |
---|
[c10297cf73] | 84 | #endif // QT_NO_PRINTER |
---|
[e0fcac5f2c] | 85 | QSettings *settings; |
---|
[2bc8e278b7] | 86 | CTSPModel *tspmodel; |
---|
[e0fcac5f2c] | 87 | |
---|
[0ac9690913] | 88 | void closeEvent(QCloseEvent *ev); |
---|
[b424a7e320] | 89 | void initDocStyleSheet(); |
---|
[899d1b8e15] | 90 | void loadLangList(); |
---|
[0ac9690913] | 91 | bool loadLanguage(const QString &lang = QString()); |
---|
[b424a7e320] | 92 | bool maybeSave(); |
---|
[f0464480db] | 93 | void outputMatrix(const TMatrix &matrix, QStringList &output); |
---|
| 94 | void outputMatrix(const SStep &step, QStringList &output); |
---|
[b424a7e320] | 95 | bool saveTask(); |
---|
[0ac9690913] | 96 | void setFileName(const QString &fileName = trUtf8("Untitled") + ".tspt"); |
---|
[1fbf016a09] | 97 | void toggleSolutionActions(bool enable = true); |
---|
[5515c2c2a7] | 98 | }; |
---|
| 99 | |
---|
| 100 | #endif // MAINWINDOW_H |
---|