[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); |
---|
[993d5af6f6] | 49 | void closeEvent(QCloseEvent *); |
---|
[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(); |
---|
[993d5af6f6] | 63 | void actionSettingsLanguageAutodetectTriggered(bool); |
---|
| 64 | void groupSettingsLanguageListTriggered(QAction *); |
---|
[899d1b8e15] | 65 | void actionHelpAboutTriggered(); |
---|
[e0fcac5f2c] | 66 | // Buttons |
---|
| 67 | void buttonBackToTaskClicked(); |
---|
| 68 | void buttonRandomClicked(); |
---|
| 69 | void buttonSolveClicked(); |
---|
| 70 | |
---|
[690f6939a7] | 71 | void dataChanged(); |
---|
[2fb523720a] | 72 | void dataChanged(const QModelIndex &, const QModelIndex &); |
---|
[e0fcac5f2c] | 73 | void numCitiesChanged(int); |
---|
[c10297cf73] | 74 | #ifndef QT_NO_PRINTER |
---|
[caef58b531] | 75 | void printPreview(QPrinter *printer); |
---|
[c10297cf73] | 76 | #endif // QT_NO_PRINTER |
---|
[993d5af6f6] | 77 | void spinCitiesValueChanged(int); |
---|
[b424a7e320] | 78 | |
---|
[bb994a7ff8] | 79 | private: |
---|
[e0fcac5f2c] | 80 | QString fileName; |
---|
| 81 | QActionGroup *groupSettingsLanguageList; |
---|
| 82 | QStringList output; |
---|
[c10297cf73] | 83 | #ifndef QT_NO_PRINTER |
---|
[899d1b8e15] | 84 | QPrinter *printer; |
---|
[c10297cf73] | 85 | #endif // QT_NO_PRINTER |
---|
[e0fcac5f2c] | 86 | QSettings *settings; |
---|
[2bc8e278b7] | 87 | CTSPModel *tspmodel; |
---|
[e0fcac5f2c] | 88 | |
---|
[b424a7e320] | 89 | void enableSolutionActions(bool enable = true); |
---|
| 90 | void initDocStyleSheet(); |
---|
[899d1b8e15] | 91 | void loadLangList(); |
---|
[e0fcac5f2c] | 92 | bool loadLanguage(QString lang = ""); |
---|
[b424a7e320] | 93 | bool maybeSave(); |
---|
[430bd7f7e9] | 94 | void outputMatrix(tMatrix, QStringList &, int nRow = -1, int nCol = -1); |
---|
[b424a7e320] | 95 | bool saveTask(); |
---|
[e0fcac5f2c] | 96 | void setFileName(QString fileName = trUtf8("Untitled") + ".tspt"); |
---|
[5515c2c2a7] | 97 | }; |
---|
| 98 | |
---|
| 99 | #endif // MAINWINDOW_H |
---|