source: tspsg/src/mainwindow.h @ b96b44b6b7

appveyorimgbotreadme
Last change on this file since b96b44b6b7 was 07e43cf61a, checked in by Oleksii Serdiuk, 12 years ago

Improved compilation time by about 30%.

By reducing number of includes to only required minimum.

NOTE: Compilation time comparison was done by measuring compilation time
while using only one thread (i.e., "make -j1").

  • Property mode set to 100644
File size: 5.3 KB
RevLine 
[2bbe924ad8]1/*!
2 * \file mainwindow.h
[0af510a462]3 * \author Copyright &copy; 2007-2012 Oleksii Serdiuk <contacts[at]oleksii[dot]name>
[2bbe924ad8]4 *
[7ba743d983]5 *  $Id: $Format:%h %ai %an$ $
6 *  $URL: http://tspsg.info/ $
[2bbe924ad8]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"
[07e43cf61a]34#include "tspsolver.h"
[2bbe924ad8]35
[07e43cf61a]36#include <QPicture>
[2bbe924ad8]37
[89e5214692]38#ifdef Q_OS_WIN32
[9eb63a1598]39    // Forward declaration. A real one is in shobjidl.h
40    struct ITaskbarList3;
[43c29c04ba]41#endif
42
[07e43cf61a]43class CTSPModel;
44
45#ifndef HANDHELD
46    class QtToolbarDialog;
47    class QtToolBarManager;
48#endif
49
50#ifndef QT_NO_PRINTER
51    class QPrinter;
52#endif
[2bbe924ad8]53
54/*!
55 * \brief Class for handling Main Window UI and logic.
[0af510a462]56 * \author Copyright &copy; 2007-2012 Oleksii Serdiuk <contacts[at]oleksii[dot]name>
[2bbe924ad8]57 */
58class MainWindow: public QMainWindow, Ui::MainWindow
59{
[9eb63a1598]60    Q_OBJECT
[2bbe924ad8]61
62public:
[9eb63a1598]63    MainWindow(QWidget *parent = 0);
64    ~MainWindow();
[2bbe924ad8]65
66private slots:
67// Actions
[9eb63a1598]68    void actionFileNewTriggered();
69    void actionFileOpenTriggered();
70    bool actionFileSaveTriggered();
71    void actionFileSaveAsTaskTriggered();
72    void actionFileSaveAsSolutionTriggered();
[2bbe924ad8]73#ifndef QT_NO_PRINTER
[9eb63a1598]74    void actionFilePrintPreviewTriggered();
[20e8115cee]75    void actionFilePageSetupTriggered();
[9eb63a1598]76    void actionFilePrintTriggered();
[2bbe924ad8]77#endif // QT_NO_PRINTER
[9eb63a1598]78    void actionSettingsPreferencesTriggered();
79    void actionSettingsLanguageAutodetectTriggered(bool checked);
80    void groupSettingsLanguageListTriggered(QAction *action);
81    void actionSettingsStyleSystemTriggered(bool checked);
82    void groupSettingsStyleListTriggered(QAction *action);
[7bb19df196]83#ifndef HANDHELD
[9eb63a1598]84    void actionSettingsToolbarsConfigureTriggered();
[7bb19df196]85#endif // HANDHELD
[9eb63a1598]86    void actionHelpOnlineSupportTriggered();
87    void actionHelpReportBugTriggered();
88    void actionHelpCheck4UpdatesTriggered();
89    void actionHelpAboutTriggered();
[2bbe924ad8]90// Buttons
[9eb63a1598]91    void buttonBackToTaskClicked();
92    void buttonRandomClicked();
93    void buttonSolveClicked();
[2bbe924ad8]94
[9eb63a1598]95    void dataChanged();
96    void dataChanged(const QModelIndex &tl, const QModelIndex &br);
[89e5214692]97#ifdef Q_OS_WINCE_WM
[9eb63a1598]98    void changeEvent(QEvent *ev);
99    void desktopResized(int screen);
[89e5214692]100#endif // Q_OS_WINCE_WM
[9eb63a1598]101    void numCitiesChanged(int nCities);
[2bbe924ad8]102#ifndef QT_NO_PRINTER
[9eb63a1598]103    void printPreview(QPrinter *printer);
[2bbe924ad8]104#endif // QT_NO_PRINTER
[89e5214692]105#ifdef Q_OS_WIN32
[9eb63a1598]106    void solverRoutePartFound(int n);
[89e5214692]107#endif // Q_OS_WIN32
[9eb63a1598]108    void spinCitiesValueChanged(int nCities);
[2bbe924ad8]109
110private:
[9eb63a1598]111    QString fileName;
112    QActionGroup *groupSettingsLanguageList;
113    QActionGroup *groupSettingsStyleList;
[94cd045fad]114#ifndef HANDHELD
[9eb63a1598]115    QAction *actionSettingsToolbarsConfigure;
116    QtToolBarManager *toolBarManager;
[94cd045fad]117#endif // HANDHELD
[2bbe924ad8]118#ifndef QT_NO_PRINTER
[9eb63a1598]119    QPrinter *printer;
120    QAction *actionFilePrintPreview;
[20e8115cee]121    QAction *actionFilePageSetup;
[9eb63a1598]122    QAction *actionFilePrint;
[2bbe924ad8]123#endif // QT_NO_PRINTER
[9eb63a1598]124    QAction *actionHelpCheck4Updates;
[89e5214692]125#ifdef Q_OS_SYMBIAN
[23ad8db4a5]126    QAction *actionRightSoftKey;
127#endif
[9eb63a1598]128    QSettings *settings;
129    CTSPModel *tspmodel;
[89e5214692]130#ifdef Q_OS_WINCE_WM
[9eb63a1598]131    QRect currentGeometry;
[89e5214692]132#endif // Q_OS_WINCE_WM
[2bbe924ad8]133
[89e5214692]134#ifdef Q_OS_WIN32
[9eb63a1598]135    ITaskbarList3 *tl;
[89e5214692]136#endif // Q_OS_WIN32
[43c29c04ba]137
[9eb63a1598]138    // The solution graph SVG
139    QPicture graph;
140
141    // Formats
142    QTextTableFormat fmt_table;
143    QTextBlockFormat fmt_paragraph,
[8f2427aaf0]144        fmt_lastparagraph,
[9eb63a1598]145        fmt_cell;
146    QTextCharFormat fmt_default,
147        fmt_selected,
148        fmt_alternate,
149        fmt_altlist;
150
151    void check4Updates(bool silent = false);
152    void closeEvent(QCloseEvent *ev);
153    void dragEnterEvent(QDragEnterEvent *ev);
[07e43cf61a]154    void drawNode(QPainter &pic, int nstep, bool left = false, TSPSolver::SStep *step = NULL);
[9eb63a1598]155    void dropEvent(QDropEvent *ev);
[b26dc16dcf]156    QByteArray generateImage(const QString &format);
[9eb63a1598]157    void initDocStyleSheet();
158    void loadLangList();
159    bool loadLanguage(const QString &lang = QString());
160    void loadStyleList();
161    void loadToolbarList();
162    bool maybeSave();
[07e43cf61a]163    void outputMatrix(QTextCursor &cur, const TSPSolver::TMatrix &matrix);
164    void outputMatrix(QTextCursor &cur, const TSPSolver::SStep &step);
[89e5214692]165#ifdef Q_OS_SYMBIAN
[1b40fef578]166    void resizeEvent(QResizeEvent *ev);
[89e5214692]167#endif // Q_OS_SYMBIAN
[9eb63a1598]168    void retranslateUi(bool all = true);
169    bool saveTask();
170    void setFileName(const QString &fileName = tr("Untitled") + ".tspt");
171    void setupUi();
172    void toggleSolutionActions(bool enable = true);
173    void toggleTranclucency(bool enable);
[2bbe924ad8]174};
175
[89e5214692]176#ifdef Q_OS_SYMBIAN
[07e43cf61a]177#include <QMessageBox>
[fddcfa4b55]178// A quickly hacked QMessageBox for Symbian that supports three buttons.
179class QSMessageBox: public QMessageBox {
180    Q_OBJECT
181private slots:
182    void cancel();
183    void discard();
184public:
185    QSMessageBox(QWidget *parent = 0);
186};
[89e5214692]187#endif // Q_OS_SYMBIAN
[fddcfa4b55]188
[2bbe924ad8]189#endif // MAINWINDOW_H
Note: See TracBrowser for help on using the repository browser.