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
RevLine 
[2bbe924ad8]1/*!
2 * \file mainwindow.h
[bfe1e5e2ea]3 * \author Copyright &copy; 2007-2011 Lёppa <contacts[at]oleksii[dot]name>
[2bbe924ad8]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
[97e90f9be6]38#ifdef Q_WS_WIN32
[9eb63a1598]39    // Forward declaration. A real one is in shobjidl.h
40    struct ITaskbarList3;
[43c29c04ba]41#endif
42
[2bbe924ad8]43using namespace TSPSolver;
44
45/*!
46 * \brief Class for handling Main Window UI and logic.
[bfe1e5e2ea]47 * \author Copyright &copy; 2007-2011 Lёppa <contacts[at]oleksii[dot]name>
[2bbe924ad8]48 */
49class MainWindow: public QMainWindow, Ui::MainWindow
50{
[9eb63a1598]51    Q_OBJECT
[2bbe924ad8]52
53public:
[9eb63a1598]54    MainWindow(QWidget *parent = 0);
55    ~MainWindow();
[2bbe924ad8]56
[2512bd5a48]57#ifdef Q_OS_BLACKBERRY
58public slots:
59    void setWindowModified(bool modified);
60#endif
61
[2bbe924ad8]62private slots:
63// Actions
[9eb63a1598]64    void actionFileNewTriggered();
65    void actionFileOpenTriggered();
66    bool actionFileSaveTriggered();
67    void actionFileSaveAsTaskTriggered();
68    void actionFileSaveAsSolutionTriggered();
[ccdffe3a5f]69#ifndef QT_NO_PRINTDIALOG
[9eb63a1598]70    void actionFilePrintPreviewTriggered();
[20e8115cee]71    void actionFilePageSetupTriggered();
[9eb63a1598]72    void actionFilePrintTriggered();
[ccdffe3a5f]73#endif // QT_NO_PRINTDIALOG
[9eb63a1598]74    void actionSettingsPreferencesTriggered();
75    void actionSettingsLanguageAutodetectTriggered(bool checked);
76    void groupSettingsLanguageListTriggered(QAction *action);
77    void actionSettingsStyleSystemTriggered(bool checked);
78    void groupSettingsStyleListTriggered(QAction *action);
[7bb19df196]79#ifndef HANDHELD
[9eb63a1598]80    void actionSettingsToolbarsConfigureTriggered();
[7bb19df196]81#endif // HANDHELD
[9eb63a1598]82    void actionHelpOnlineSupportTriggered();
83    void actionHelpReportBugTriggered();
84    void actionHelpCheck4UpdatesTriggered();
85    void actionHelpAboutTriggered();
[2bbe924ad8]86// Buttons
[9eb63a1598]87    void buttonBackToTaskClicked();
88    void buttonRandomClicked();
89    void buttonSolveClicked();
[2bbe924ad8]90
[9eb63a1598]91    void dataChanged();
92    void dataChanged(const QModelIndex &tl, const QModelIndex &br);
[97e90f9be6]93#ifdef Q_WS_WINCE_WM
[9eb63a1598]94    void changeEvent(QEvent *ev);
95    void desktopResized(int screen);
[97e90f9be6]96#endif // Q_WS_WINCE_WM
[9eb63a1598]97    void numCitiesChanged(int nCities);
[2bbe924ad8]98#ifndef QT_NO_PRINTER
[9eb63a1598]99    void printPreview(QPrinter *printer);
[2bbe924ad8]100#endif // QT_NO_PRINTER
[97e90f9be6]101#ifdef Q_WS_WIN32
[9eb63a1598]102    void solverRoutePartFound(int n);
[97e90f9be6]103#endif // Q_WS_WIN32
[9eb63a1598]104    void spinCitiesValueChanged(int nCities);
[2bbe924ad8]105
106private:
[9eb63a1598]107    QString fileName;
108    QActionGroup *groupSettingsLanguageList;
109    QActionGroup *groupSettingsStyleList;
[94cd045fad]110#ifndef HANDHELD
[9eb63a1598]111    QAction *actionSettingsToolbarsConfigure;
112    QtToolBarManager *toolBarManager;
[94cd045fad]113#endif // HANDHELD
[2bbe924ad8]114#ifndef QT_NO_PRINTER
[9eb63a1598]115    QPrinter *printer;
[ccdffe3a5f]116#ifndef QT_NO_PRINTDIALOG
[9eb63a1598]117    QAction *actionFilePrintPreview;
[20e8115cee]118    QAction *actionFilePageSetup;
[9eb63a1598]119    QAction *actionFilePrint;
[ccdffe3a5f]120#endif // QT_NO_PRINTDIALOG
[2bbe924ad8]121#endif // QT_NO_PRINTER
[9eb63a1598]122    QAction *actionHelpCheck4Updates;
[23ad8db4a5]123#ifdef Q_WS_S60
124    QAction *actionRightSoftKey;
125#endif
[9eb63a1598]126    QSettings *settings;
127    CTSPModel *tspmodel;
[97e90f9be6]128#ifdef Q_WS_WINCE_WM
[9eb63a1598]129    QRect currentGeometry;
[97e90f9be6]130#endif // Q_WS_WINCE_WM
[2bbe924ad8]131
[97e90f9be6]132#ifdef Q_WS_WIN32
[9eb63a1598]133    ITaskbarList3 *tl;
[97e90f9be6]134#endif // Q_WS_WIN32
[43c29c04ba]135
[9eb63a1598]136    // The solution graph SVG
137    QPicture graph;
138
139    // Formats
140    QTextTableFormat fmt_table;
141    QTextBlockFormat fmt_paragraph,
[8f2427aaf0]142        fmt_lastparagraph,
[9eb63a1598]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);
[2bbe924ad8]168};
169
[fddcfa4b55]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
[2bbe924ad8]182#endif // MAINWINDOW_H
Note: See TracBrowser for help on using the repository browser.