source: tspsg/src/mainwindow.h @ e3533af1cf

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

+ Added support for switching between available Qt Styles.

  • Property mode set to 100644
File size: 3.9 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 "tspmodel.h"
37
38using namespace TSPSolver;
39
40/*!
41 * \brief Class for handling Main Window UI and logic.
42 * \author Copyright &copy; 2007-2010 Lёppa <contacts[at]oleksii[dot]name>
43 */
44class MainWindow: public QMainWindow, Ui::MainWindow
45{
46        Q_OBJECT
47
48public:
49        MainWindow(QWidget *parent = 0);
50        ~MainWindow();
51
52private slots:
53// Actions
54        void actionFileNewTriggered();
55        void actionFileOpenTriggered();
56        bool actionFileSaveTriggered();
57        void actionFileSaveAsTaskTriggered();
58        void actionFileSaveAsSolutionTriggered();
59#ifndef QT_NO_PRINTER
60        void actionFilePrintPreviewTriggered();
61        void actionFilePrintTriggered();
62#endif // QT_NO_PRINTER
63        void actionSettingsPreferencesTriggered();
64        void actionSettingsLanguageAutodetectTriggered(bool checked);
65        void groupSettingsLanguageListTriggered(QAction *action);
66        void actionSettingsStyleSystemTriggered(bool checked);
67        void groupSettingsStyleListTriggered(QAction *action);
68#ifdef Q_OS_WIN32
69        void actionHelpCheck4UpdatesTriggered();
70#endif // Q_OS_WIN32
71        void actionHelpAboutTriggered();
72// Buttons
73        void buttonBackToTaskClicked();
74        void buttonRandomClicked();
75        void buttonSolveClicked();
76
77        void dataChanged();
78        void dataChanged(const QModelIndex &tl, const QModelIndex &br);
79#ifdef Q_OS_WINCE_WM
80        void changeEvent(QEvent *ev);
81        void desktopResized(int screen);
82#endif // Q_OS_WINCE_WM
83        void numCitiesChanged(int nCities);
84#ifndef QT_NO_PRINTER
85        void printPreview(QPrinter *printer);
86#endif // QT_NO_PRINTER
87        void spinCitiesValueChanged(int nCities);
88
89private:
90        QString fileName;
91        QActionGroup *groupSettingsLanguageList;
92        QActionGroup *groupSettingsStyleList;
93#ifndef QT_NO_PRINTER
94        QPrinter *printer;
95        QAction *actionFilePrintPreview;
96        QAction *actionFilePrint;
97#endif // QT_NO_PRINTER
98#ifdef Q_OS_WIN32
99        QAction *actionHelpCheck4Updates;
100#endif // Q_OS_WIN32
101        QSettings *settings;
102        CTSPModel *tspmodel;
103#ifdef Q_OS_WINCE_WM
104        QRect currentGeometry;
105#endif // Q_OS_WINCE_WM
106
107        // The solution graph SVG
108        QPicture graph;
109
110        // Formats
111        QTextTableFormat fmt_table;
112        QTextBlockFormat fmt_paragraph,
113                fmt_cell;
114        QTextCharFormat fmt_default,
115                fmt_selected,
116                fmt_alternate,
117                fmt_altlist;
118
119        void closeEvent(QCloseEvent *ev);
120        void dragEnterEvent(QDragEnterEvent *ev);
121        void drawNode(QPainter &pic, int nstep, bool left = false, SStep *step = NULL);
122        void dropEvent(QDropEvent *ev);
123        bool hasUpdater() const;
124        void initDocStyleSheet();
125        void loadLangList();
126        bool loadLanguage(const QString &lang = QString());
127        void loadStyleList();
128        bool maybeSave();
129        void outputMatrix(QTextCursor &cur, const TMatrix &matrix);
130        void outputMatrix(QTextCursor &cur, const SStep &step);
131        void retranslateUi(bool all = true);
132        bool saveTask();
133        void setFileName(const QString &fileName = tr("Untitled") + ".tspt");
134        void setupUi();
135        void toggleSolutionActions(bool enable = true);
136        void toggleTranclucency(bool enable);
137};
138
139#endif // MAINWINDOW_H
Note: See TracBrowser for help on using the repository browser.