source: tspsg/src/mainwindow.h @ 140109febb

0.1.3.145-beta1-symbian0.1.4.170-beta2-bb10appveyorimgbotreadme
Last change on this file since 140109febb was f0464480db, checked in by Oleksii Serdiuk, 14 years ago

+ CTSPSolver class now deletes all solution tree on cleanup and delete to avoid memory leaks.
+ List of alternate candidates for branching is now saved in every solution step and displayed on output.
+ New struct TCandidate that represents a candidate for branching.

  • Renamed sStep to SStep and tMatrix to TMatrix.
  • Made a better and more readable About window.
  • English translation is now loaded too. This is needed to support plurals (e.g., 1 candidate, 4 candidates).
  • Property mode set to 100644
File size: 2.9 KB
Line 
1/*!
2 * \file mainwindow.h
3 * \author Copyright &copy; 2007-2009 Lёppa <contacts[at]oleksii[dot]name>
4 *
5 *  $Id$
6 *  $URL$
7 *
8 * \brief Defines MainWindow class.
9 *
10 *  <b>TSPSG: TSP Solver and Generator</b>
11 *
12 *  This file is part of TSPSG.
13 *
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.
18 *
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.
23 *
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/>.
26 */
27
28#ifndef MAINWINDOW_H
29#define MAINWINDOW_H
30
31#include "globals.h"
32
33#include "ui_mainwindow.h"
34#include "settingsdialog.h"
35
36#include "tspsolver.h"
37#include "tspmodel.h"
38
39/*!
40 * \brief Class for handling Main Window UI and logic.
41 * \author Copyright &copy; 2007-2009 Lёppa <contacts[at]oleksii[dot]name>
42 */
43class MainWindow: public QMainWindow, Ui::MainWindow
44{
45        Q_OBJECT
46
47public:
48        MainWindow(QWidget *parent = 0);
49
50private slots:
51// Actions
52        void actionFileNewTriggered();
53        void actionFileOpenTriggered();
54        void actionFileSaveTriggered();
55        void actionFileSaveAsTaskTriggered();
56        void actionFileSaveAsSolutionTriggered();
57#ifndef QT_NO_PRINTER
58        void actionFilePrintPreviewTriggered();
59        void actionFilePrintTriggered();
60#endif // QT_NO_PRINTER
61        void actionSettingsPreferencesTriggered();
62        void actionSettingsLanguageAutodetectTriggered(bool checked);
63        void groupSettingsLanguageListTriggered(QAction *action);
64        void actionHelpAboutTriggered();
65// Buttons
66        void buttonBackToTaskClicked();
67        void buttonRandomClicked();
68        void buttonSolveClicked();
69
70        void dataChanged();
71        void dataChanged(const QModelIndex &tl, const QModelIndex &br);
72        void numCitiesChanged(int nCities);
73#ifndef QT_NO_PRINTER
74        void printPreview(QPrinter *printer);
75#endif // QT_NO_PRINTER
76        void spinCitiesValueChanged(int nCities);
77
78private:
79        QString fileName;
80        QActionGroup *groupSettingsLanguageList;
81        QStringList output;
82#ifndef QT_NO_PRINTER
83        QPrinter *printer;
84#endif // QT_NO_PRINTER
85        QSettings *settings;
86        CTSPModel *tspmodel;
87
88        void closeEvent(QCloseEvent *ev);
89        void enableSolutionActions(bool enable = true);
90        void initDocStyleSheet();
91        void loadLangList();
92        bool loadLanguage(const QString &lang = QString());
93        bool maybeSave();
94        void outputMatrix(const TMatrix &matrix, QStringList &output);
95        void outputMatrix(const SStep &step, QStringList &output);
96        bool saveTask();
97        void setFileName(const QString &fileName = trUtf8("Untitled") + ".tspt");
98};
99
100#endif // MAINWINDOW_H
Note: See TracBrowser for help on using the repository browser.