source: tspsg/src/mainwindow.h @ 317ba0432e

0.1.3.145-beta1-symbian0.1.4.170-beta2-bb10appveyorimgbotreadme
Last change on this file since 317ba0432e was 317ba0432e, checked in by Oleksii Serdiuk, 14 years ago
  • Improved the solution output generation algorithm. Now it works directly with QTextDocument instead of "feeding" it with HTML. Thanks to this the solution output generation is now about 1.65 times faster.
  • Added .txt extension to ChangeLog?, INSTALL and README files to simplify opening these files in Windows.
  • Made a small improvement to Settings Dialog to follow the current application palette.
  • Output text color if not set is now determmined based on the current application palette.
  • Property mode set to 100644
File size: 3.5 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        bool 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#ifdef Q_OS_WIN32
66        void actionHelpCheck4UpdatesTriggered();
67#endif // Q_OS_WIN32
68        void actionHelpAboutTriggered();
69// Buttons
70        void buttonBackToTaskClicked();
71        void buttonRandomClicked();
72        void buttonSolveClicked();
73
74        void dataChanged();
75        void dataChanged(const QModelIndex &tl, const QModelIndex &br);
76#ifdef Q_OS_WINCE_WM
77        void changeEvent(QEvent *ev);
78        void desktopResized(int screen);
79#endif // Q_OS_WINCE_WM
80        void numCitiesChanged(int nCities);
81#ifndef QT_NO_PRINTER
82        void printPreview(QPrinter *printer);
83#endif // QT_NO_PRINTER
84        void spinCitiesValueChanged(int nCities);
85
86private:
87        QString fileName;
88        QActionGroup *groupSettingsLanguageList;
89#ifndef QT_NO_PRINTER
90        QPrinter *printer;
91        QAction *actionFilePrintPreview;
92        QAction *actionFilePrint;
93#endif // QT_NO_PRINTER
94#ifdef Q_OS_WIN32
95        QAction *actionHelpCheck4Updates;
96#endif // Q_OS_WIN32
97        QSettings *settings;
98        CTSPModel *tspmodel;
99#ifdef Q_OS_WINCE_WM
100        QRect currentGeometry;
101#endif // Q_OS_WINCE_WM
102
103        // Formats
104        QTextTableFormat fmt_table;
105        QTextBlockFormat fmt_paragraph,
106                fmt_center;
107        QTextCharFormat fmt_default,
108                fmt_selected,
109                fmt_alternate,
110                fmt_altlist;
111
112        void closeEvent(QCloseEvent *ev);
113        bool hasUpdater() const;
114        void initDocStyleSheet();
115        void loadLangList();
116        bool loadLanguage(const QString &lang = QString());
117        bool maybeSave();
118        void outputMatrix(QTextCursor &cur, const TMatrix &matrix);
119        void outputMatrix(QTextCursor &cur, const SStep &step);
120        void retranslateUi(bool all = true);
121        bool saveTask();
122        void setFileName(const QString &fileName = tr("Untitled") + ".tspt");
123        void setupUi();
124        void toggleSolutionActions(bool enable = true);
125        void toggleTranclucency(bool enable);
126};
127
128#endif // MAINWINDOW_H
Note: See TracBrowser for help on using the repository browser.