source: tspsg/src/mainwindow.h @ 1757eb594b

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

+ Added Fractional accuracy (in decimail places) to settings.
+ Created defaults.h file. Moved all default defines there.

  • Replaced all double types with qreal.
  • Replaced all calls to trUtf8() with tr() as we use setCodecForTr() to set UTF-8 encoding as default and tr() is enough.
  • Replaced all 2009 with 2010 in copyrights.
  • Fixed an error when loading .zkt file with less than 5 cities.
  • Property mode set to 100644
File size: 3.0 KB
Line 
1/*!
2 * \file mainwindow.h
3 * \author Copyright &copy; 2007-2010 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-2010 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        ~MainWindow();
50
51private slots:
52// Actions
53        void actionFileNewTriggered();
54        void actionFileOpenTriggered();
55        void actionFileSaveTriggered();
56        void actionFileSaveAsTaskTriggered();
57        void actionFileSaveAsSolutionTriggered();
58#ifndef QT_NO_PRINTER
59        void actionFilePrintPreviewTriggered();
60        void actionFilePrintTriggered();
61#endif // QT_NO_PRINTER
62        void actionSettingsPreferencesTriggered();
63        void actionSettingsLanguageAutodetectTriggered(bool checked);
64        void groupSettingsLanguageListTriggered(QAction *action);
65        void actionHelpAboutTriggered();
66// Buttons
67        void buttonBackToTaskClicked();
68        void buttonRandomClicked();
69        void buttonSolveClicked();
70
71        void dataChanged();
72        void dataChanged(const QModelIndex &tl, const QModelIndex &br);
73        void numCitiesChanged(int nCities);
74#ifndef QT_NO_PRINTER
75        void printPreview(QPrinter *printer);
76#endif // QT_NO_PRINTER
77        void spinCitiesValueChanged(int nCities);
78
79private:
80        QString fileName;
81        QActionGroup *groupSettingsLanguageList;
82        QStringList output;
83#ifndef QT_NO_PRINTER
84        QPrinter *printer;
85        QAction *actionFilePrintPreview;
86        QAction *actionFilePrint;
87#endif // QT_NO_PRINTER
88        QSettings *settings;
89        CTSPModel *tspmodel;
90
91        void closeEvent(QCloseEvent *ev);
92        void initDocStyleSheet();
93        void loadLangList();
94        bool loadLanguage(const QString &lang = QString());
95        bool maybeSave();
96        void outputMatrix(const TMatrix &matrix, QStringList &output);
97        void outputMatrix(const SStep &step, QStringList &output);
98        void retranslateUi(bool all = true);
99        bool saveTask();
100        void setFileName(const QString &fileName = tr("Untitled") + ".tspt");
101        void setupUi();
102        void toggleSolutionActions(bool enable = true);
103};
104
105#endif // MAINWINDOW_H
Note: See TracBrowser for help on using the repository browser.