[65] | 1 | /*! |
---|
[67] | 2 | * \file mainwindow.h |
---|
[65] | 3 | * \author Copyright © 2007-2009 Lёppa <contacts[at]oleksii[dot]name> |
---|
[1] | 4 | * |
---|
[6] | 5 | * $Id: mainwindow.h 71 2009-12-07 16:06:44Z laleppa $ |
---|
| 6 | * $URL: https://tspsg.svn.sourceforge.net/svnroot/tspsg/trunk/src/mainwindow.h $ |
---|
[4] | 7 | * |
---|
[67] | 8 | * \brief Defines MainWindow class. |
---|
| 9 | * |
---|
[65] | 10 | * <b>TSPSG: TSP Solver and Generator</b> |
---|
| 11 | * |
---|
[6] | 12 | * This file is part of TSPSG. |
---|
[1] | 13 | * |
---|
[6] | 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. |
---|
[1] | 18 | * |
---|
[6] | 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. |
---|
[1] | 23 | * |
---|
[6] | 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/>. |
---|
[1] | 26 | */ |
---|
| 27 | |
---|
| 28 | #ifndef MAINWINDOW_H |
---|
| 29 | #define MAINWINDOW_H |
---|
| 30 | |
---|
[31] | 31 | #include "globals.h" |
---|
[64] | 32 | |
---|
[54] | 33 | #include "ui_mainwindow.h" |
---|
[1] | 34 | #include "settingsdialog.h" |
---|
[64] | 35 | |
---|
[12] | 36 | #include "tspsolver.h" |
---|
[15] | 37 | #include "tspmodel.h" |
---|
[1] | 38 | |
---|
[67] | 39 | /*! |
---|
| 40 | * \brief Class for handling Main Window UI and logic. |
---|
| 41 | * \author Copyright © 2007-2009 Lёppa <contacts[at]oleksii[dot]name> |
---|
| 42 | */ |
---|
[1] | 43 | class MainWindow: public QMainWindow, Ui::MainWindow |
---|
| 44 | { |
---|
| 45 | Q_OBJECT |
---|
[47] | 46 | |
---|
[1] | 47 | public: |
---|
| 48 | MainWindow(QWidget *parent = 0); |
---|
[47] | 49 | |
---|
[1] | 50 | private slots: |
---|
[67] | 51 | // Actions |
---|
[29] | 52 | void actionFileNewTriggered(); |
---|
[31] | 53 | void actionFileOpenTriggered(); |
---|
[50] | 54 | void actionFileSaveTriggered(); |
---|
[42] | 55 | void actionFileSaveAsTaskTriggered(); |
---|
| 56 | void actionFileSaveAsSolutionTriggered(); |
---|
[67] | 57 | #ifndef QT_NO_PRINTER |
---|
| 58 | void actionFilePrintPreviewTriggered(); |
---|
| 59 | void actionFilePrintTriggered(); |
---|
| 60 | #endif // QT_NO_PRINTER |
---|
[29] | 61 | void actionSettingsPreferencesTriggered(); |
---|
[71] | 62 | void actionSettingsLanguageAutodetectTriggered(bool checked); |
---|
| 63 | void groupSettingsLanguageListTriggered(QAction *action); |
---|
[29] | 64 | void actionHelpAboutTriggered(); |
---|
[67] | 65 | // Buttons |
---|
| 66 | void buttonBackToTaskClicked(); |
---|
| 67 | void buttonRandomClicked(); |
---|
| 68 | void buttonSolveClicked(); |
---|
| 69 | |
---|
[37] | 70 | void dataChanged(); |
---|
[71] | 71 | void dataChanged(const QModelIndex &tl, const QModelIndex &br); |
---|
| 72 | void numCitiesChanged(int nCities); |
---|
[54] | 73 | #ifndef QT_NO_PRINTER |
---|
[65] | 74 | void printPreview(QPrinter *printer); |
---|
[54] | 75 | #endif // QT_NO_PRINTER |
---|
[71] | 76 | void spinCitiesValueChanged(int nCities); |
---|
[47] | 77 | |
---|
[6] | 78 | private: |
---|
[67] | 79 | QString fileName; |
---|
| 80 | QActionGroup *groupSettingsLanguageList; |
---|
| 81 | QStringList output; |
---|
[54] | 82 | #ifndef QT_NO_PRINTER |
---|
[29] | 83 | QPrinter *printer; |
---|
[54] | 84 | #endif // QT_NO_PRINTER |
---|
[67] | 85 | QSettings *settings; |
---|
[15] | 86 | CTSPModel *tspmodel; |
---|
[67] | 87 | |
---|
[71] | 88 | void closeEvent(QCloseEvent *ev); |
---|
[47] | 89 | void enableSolutionActions(bool enable = true); |
---|
| 90 | void initDocStyleSheet(); |
---|
[67] | 91 | void loadLangList(); |
---|
[71] | 92 | bool loadLanguage(const QString &lang = QString()); |
---|
[47] | 93 | bool maybeSave(); |
---|
[71] | 94 | void outputMatrix(const tMatrix &matrix, QStringList &output, int nRow = -1, int nCol = -1); |
---|
[67] | 95 | bool saveTask(); |
---|
[71] | 96 | void setFileName(const QString &fileName = trUtf8("Untitled") + ".tspt"); |
---|
[1] | 97 | }; |
---|
| 98 | |
---|
| 99 | #endif // MAINWINDOW_H |
---|