[caef58b531] | 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> |
---|
[003e4193be] | 5 | * |
---|
[bb994a7ff8] | 6 | * $Id$ |
---|
| 7 | * $URL$ |
---|
[5515c2c2a7] | 8 | * |
---|
[caef58b531] | 9 | * <b>TSPSG: TSP Solver and Generator</b> |
---|
| 10 | * |
---|
[bb994a7ff8] | 11 | * This file is part of TSPSG. |
---|
[5515c2c2a7] | 12 | * |
---|
[bb994a7ff8] | 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. |
---|
[5515c2c2a7] | 17 | * |
---|
[bb994a7ff8] | 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. |
---|
[5515c2c2a7] | 22 | * |
---|
[bb994a7ff8] | 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/>. |
---|
[5515c2c2a7] | 25 | */ |
---|
| 26 | |
---|
| 27 | #ifndef MAINWINDOW_H |
---|
| 28 | #define MAINWINDOW_H |
---|
| 29 | |
---|
[993d5af6f6] | 30 | #include "globals.h" |
---|
[bc1b8837b6] | 31 | |
---|
[c10297cf73] | 32 | #include "ui_mainwindow.h" |
---|
[5515c2c2a7] | 33 | #include "settingsdialog.h" |
---|
[bc1b8837b6] | 34 | |
---|
[67e53c96d7] | 35 | #include "tspsolver.h" |
---|
[2bc8e278b7] | 36 | #include "tspmodel.h" |
---|
[5515c2c2a7] | 37 | |
---|
| 38 | class MainWindow: public QMainWindow, Ui::MainWindow |
---|
| 39 | { |
---|
| 40 | Q_OBJECT |
---|
[b424a7e320] | 41 | |
---|
[5515c2c2a7] | 42 | public: |
---|
| 43 | MainWindow(QWidget *parent = 0); |
---|
[993d5af6f6] | 44 | void closeEvent(QCloseEvent *); |
---|
[b424a7e320] | 45 | |
---|
[5515c2c2a7] | 46 | private slots: |
---|
[899d1b8e15] | 47 | void actionFileNewTriggered(); |
---|
[993d5af6f6] | 48 | void actionFileOpenTriggered(); |
---|
[aaf2113307] | 49 | void actionFileSaveTriggered(); |
---|
[430bd7f7e9] | 50 | void actionFileSaveAsTaskTriggered(); |
---|
| 51 | void actionFileSaveAsSolutionTriggered(); |
---|
[899d1b8e15] | 52 | void actionSettingsPreferencesTriggered(); |
---|
[993d5af6f6] | 53 | void actionSettingsLanguageAutodetectTriggered(bool); |
---|
| 54 | void groupSettingsLanguageListTriggered(QAction *); |
---|
[899d1b8e15] | 55 | void actionHelpAboutTriggered(); |
---|
[690f6939a7] | 56 | void dataChanged(); |
---|
[2fb523720a] | 57 | void dataChanged(const QModelIndex &, const QModelIndex &); |
---|
[c10297cf73] | 58 | #ifndef QT_NO_PRINTER |
---|
[caef58b531] | 59 | void printPreview(QPrinter *printer); |
---|
[56dca709c9] | 60 | void actionFilePrintPreviewTriggered(); |
---|
| 61 | void actionFilePrintTriggered(); |
---|
[c10297cf73] | 62 | #endif // QT_NO_PRINTER |
---|
[899d1b8e15] | 63 | void buttonSolveClicked(); |
---|
| 64 | void buttonRandomClicked(); |
---|
[aaf2113307] | 65 | void buttonBackToTaskClicked(); |
---|
[993d5af6f6] | 66 | void spinCitiesValueChanged(int); |
---|
| 67 | void numCitiesChanged(int); |
---|
[b424a7e320] | 68 | |
---|
[bb994a7ff8] | 69 | private: |
---|
[665d32434f] | 70 | QSettings *settings; |
---|
[c10297cf73] | 71 | #ifndef QT_NO_PRINTER |
---|
[899d1b8e15] | 72 | QPrinter *printer; |
---|
[c10297cf73] | 73 | #endif // QT_NO_PRINTER |
---|
[2bc8e278b7] | 74 | CTSPModel *tspmodel; |
---|
[b424a7e320] | 75 | QString fileName; |
---|
[899d1b8e15] | 76 | QActionGroup *groupSettingsLanguageList; |
---|
[430bd7f7e9] | 77 | QStringList output; |
---|
[b424a7e320] | 78 | void enableSolutionActions(bool enable = true); |
---|
| 79 | void initDocStyleSheet(); |
---|
[ac4cb71650] | 80 | bool loadLanguage(QString lang = ""); |
---|
[899d1b8e15] | 81 | void loadLangList(); |
---|
[b424a7e320] | 82 | bool maybeSave(); |
---|
[430bd7f7e9] | 83 | void outputMatrix(tMatrix, QStringList &, int nRow = -1, int nCol = -1); |
---|
[b424a7e320] | 84 | void setFileName(QString fileName = trUtf8("Untitled") + ".tspt"); |
---|
| 85 | bool saveTask(); |
---|
[5515c2c2a7] | 86 | }; |
---|
| 87 | |
---|
| 88 | #endif // MAINWINDOW_H |
---|