[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 | |
---|
[85ad815b0b] | 30 | /*! |
---|
| 31 | * \file mainwindow.h |
---|
| 32 | * \brief Defines MainWindow class. |
---|
| 33 | */ |
---|
| 34 | |
---|
[993d5af6f6] | 35 | #include "globals.h" |
---|
[bc1b8837b6] | 36 | |
---|
[c10297cf73] | 37 | #include "ui_mainwindow.h" |
---|
[5515c2c2a7] | 38 | #include "settingsdialog.h" |
---|
[bc1b8837b6] | 39 | |
---|
[67e53c96d7] | 40 | #include "tspsolver.h" |
---|
[2bc8e278b7] | 41 | #include "tspmodel.h" |
---|
[5515c2c2a7] | 42 | |
---|
| 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: |
---|
[899d1b8e15] | 52 | void actionFileNewTriggered(); |
---|
[993d5af6f6] | 53 | void actionFileOpenTriggered(); |
---|
[aaf2113307] | 54 | void actionFileSaveTriggered(); |
---|
[430bd7f7e9] | 55 | void actionFileSaveAsTaskTriggered(); |
---|
| 56 | void actionFileSaveAsSolutionTriggered(); |
---|
[899d1b8e15] | 57 | void actionSettingsPreferencesTriggered(); |
---|
[993d5af6f6] | 58 | void actionSettingsLanguageAutodetectTriggered(bool); |
---|
| 59 | void groupSettingsLanguageListTriggered(QAction *); |
---|
[899d1b8e15] | 60 | void actionHelpAboutTriggered(); |
---|
[690f6939a7] | 61 | void dataChanged(); |
---|
[2fb523720a] | 62 | void dataChanged(const QModelIndex &, const QModelIndex &); |
---|
[c10297cf73] | 63 | #ifndef QT_NO_PRINTER |
---|
[caef58b531] | 64 | void printPreview(QPrinter *printer); |
---|
[56dca709c9] | 65 | void actionFilePrintPreviewTriggered(); |
---|
| 66 | void actionFilePrintTriggered(); |
---|
[c10297cf73] | 67 | #endif // QT_NO_PRINTER |
---|
[899d1b8e15] | 68 | void buttonSolveClicked(); |
---|
| 69 | void buttonRandomClicked(); |
---|
[aaf2113307] | 70 | void buttonBackToTaskClicked(); |
---|
[993d5af6f6] | 71 | void spinCitiesValueChanged(int); |
---|
| 72 | void numCitiesChanged(int); |
---|
[b424a7e320] | 73 | |
---|
[bb994a7ff8] | 74 | private: |
---|
[665d32434f] | 75 | QSettings *settings; |
---|
[c10297cf73] | 76 | #ifndef QT_NO_PRINTER |
---|
[899d1b8e15] | 77 | QPrinter *printer; |
---|
[c10297cf73] | 78 | #endif // QT_NO_PRINTER |
---|
[2bc8e278b7] | 79 | CTSPModel *tspmodel; |
---|
[b424a7e320] | 80 | QString fileName; |
---|
[899d1b8e15] | 81 | QActionGroup *groupSettingsLanguageList; |
---|
[430bd7f7e9] | 82 | QStringList output; |
---|
[b424a7e320] | 83 | void enableSolutionActions(bool enable = true); |
---|
| 84 | void initDocStyleSheet(); |
---|
[ac4cb71650] | 85 | bool loadLanguage(QString lang = ""); |
---|
[899d1b8e15] | 86 | void loadLangList(); |
---|
[b424a7e320] | 87 | bool maybeSave(); |
---|
[430bd7f7e9] | 88 | void outputMatrix(tMatrix, QStringList &, int nRow = -1, int nCol = -1); |
---|
[b424a7e320] | 89 | void setFileName(QString fileName = trUtf8("Untitled") + ".tspt"); |
---|
| 90 | bool saveTask(); |
---|
[5515c2c2a7] | 91 | }; |
---|
| 92 | |
---|
| 93 | #endif // MAINWINDOW_H |
---|