[65] | 1 | /*! |
---|
| 2 | * \class MainWindow |
---|
| 3 | * \brief Class for handling Main Window UI and logic. |
---|
| 4 | * \author Copyright © 2007-2009 Lёppa <contacts[at]oleksii[dot]name> |
---|
[1] | 5 | * |
---|
[6] | 6 | * $Id: mainwindow.h 65 2009-10-20 19:38:01Z laleppa $ |
---|
| 7 | * $URL: https://tspsg.svn.sourceforge.net/svnroot/tspsg/trunk/src/mainwindow.h $ |
---|
[4] | 8 | * |
---|
[65] | 9 | * <b>TSPSG: TSP Solver and Generator</b> |
---|
| 10 | * |
---|
[6] | 11 | * This file is part of TSPSG. |
---|
[1] | 12 | * |
---|
[6] | 13 | * TSPSG is free software: you can redistribute it and/or modify |
---|
| 14 | * it under the terms of the GNU General Public License as published by |
---|
| 15 | * the Free Software Foundation, either version 3 of the License, or |
---|
| 16 | * (at your option) any later version. |
---|
[1] | 17 | * |
---|
[6] | 18 | * TSPSG is distributed in the hope that it will be useful, |
---|
| 19 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 20 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
| 21 | * GNU General Public License for more details. |
---|
[1] | 22 | * |
---|
[6] | 23 | * You should have received a copy of the GNU General Public License |
---|
| 24 | * along with TSPSG. If not, see <http://www.gnu.org/licenses/>. |
---|
[1] | 25 | */ |
---|
| 26 | |
---|
| 27 | #ifndef MAINWINDOW_H |
---|
| 28 | #define MAINWINDOW_H |
---|
| 29 | |
---|
[31] | 30 | #include "globals.h" |
---|
[64] | 31 | |
---|
[54] | 32 | #include "ui_mainwindow.h" |
---|
[1] | 33 | #include "settingsdialog.h" |
---|
[64] | 34 | |
---|
[12] | 35 | #include "tspsolver.h" |
---|
[15] | 36 | #include "tspmodel.h" |
---|
[1] | 37 | |
---|
| 38 | class MainWindow: public QMainWindow, Ui::MainWindow |
---|
| 39 | { |
---|
| 40 | Q_OBJECT |
---|
[47] | 41 | |
---|
[1] | 42 | public: |
---|
| 43 | MainWindow(QWidget *parent = 0); |
---|
[31] | 44 | void closeEvent(QCloseEvent *); |
---|
[47] | 45 | |
---|
[1] | 46 | private slots: |
---|
[29] | 47 | void actionFileNewTriggered(); |
---|
[31] | 48 | void actionFileOpenTriggered(); |
---|
[50] | 49 | void actionFileSaveTriggered(); |
---|
[42] | 50 | void actionFileSaveAsTaskTriggered(); |
---|
| 51 | void actionFileSaveAsSolutionTriggered(); |
---|
[29] | 52 | void actionSettingsPreferencesTriggered(); |
---|
[31] | 53 | void actionSettingsLanguageAutodetectTriggered(bool); |
---|
| 54 | void groupSettingsLanguageListTriggered(QAction *); |
---|
[29] | 55 | void actionHelpAboutTriggered(); |
---|
[37] | 56 | void dataChanged(); |
---|
[57] | 57 | void dataChanged(const QModelIndex &, const QModelIndex &); |
---|
[54] | 58 | #ifndef QT_NO_PRINTER |
---|
[65] | 59 | void printPreview(QPrinter *printer); |
---|
[52] | 60 | void actionFilePrintPreviewTriggered(); |
---|
| 61 | void actionFilePrintTriggered(); |
---|
[54] | 62 | #endif // QT_NO_PRINTER |
---|
[29] | 63 | void buttonSolveClicked(); |
---|
| 64 | void buttonRandomClicked(); |
---|
[50] | 65 | void buttonBackToTaskClicked(); |
---|
[31] | 66 | void spinCitiesValueChanged(int); |
---|
| 67 | void numCitiesChanged(int); |
---|
[47] | 68 | |
---|
[6] | 69 | private: |
---|
[23] | 70 | QSettings *settings; |
---|
[54] | 71 | #ifndef QT_NO_PRINTER |
---|
[29] | 72 | QPrinter *printer; |
---|
[54] | 73 | #endif // QT_NO_PRINTER |
---|
[15] | 74 | CTSPModel *tspmodel; |
---|
[47] | 75 | QString fileName; |
---|
[29] | 76 | QActionGroup *groupSettingsLanguageList; |
---|
[42] | 77 | QStringList output; |
---|
[47] | 78 | void enableSolutionActions(bool enable = true); |
---|
| 79 | void initDocStyleSheet(); |
---|
[30] | 80 | bool loadLanguage(QString lang = ""); |
---|
[29] | 81 | void loadLangList(); |
---|
[47] | 82 | bool maybeSave(); |
---|
| 83 | void outputMatrix(tMatrix, QStringList &, int nRow = -1, int nCol = -1); |
---|
| 84 | void setFileName(QString fileName = trUtf8("Untitled") + ".tspt"); |
---|
[37] | 85 | bool saveTask(); |
---|
[1] | 86 | }; |
---|
| 87 | |
---|
| 88 | #endif // MAINWINDOW_H |
---|