source: tspsg/src/mainwindow.h @ ca9cb6dfa5

0.1.4.170-beta2-bb10
Last change on this file since ca9cb6dfa5 was 2512bd5a48, checked in by Oleksii Serdiuk, 12 years ago

Use native BlackBerry? file pickers.

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