source: tspsg/src/mainwindow.h @ 280cfd6faa

appveyorimgbotreadme
Last change on this file since 280cfd6faa was 2a5e50e0a9, checked in by Oleksii Serdiuk, 11 years ago

[BB10] Use native file pickers.

Also, use "/accounts/1000/shared" folder as default in open/save dialogs.

Cherry-picks from:
c039ebbe827ae1ba92ae89b2e9caef549a96547c
2512bd5a48d086ea03092bc4bdb368c58fc82854

  • Property mode set to 100644
File size: 5.4 KB
RevLine 
[2bbe924ad8]1/*!
2 * \file mainwindow.h
[21c03af787]3 * \author Copyright &copy; 2007-2013 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
[2940c14782]16 *  the Free Software Foundation, either version 2 of the License, or
[2bbe924ad8]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.
[21c03af787]56 * \author Copyright &copy; 2007-2013 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
[2a5e50e0a9]66#ifdef Q_OS_BLACKBERRY
67public slots:
68    void setWindowModified(bool modified);
69#endif
70
[2bbe924ad8]71private slots:
72// Actions
[9eb63a1598]73    void actionFileNewTriggered();
74    void actionFileOpenTriggered();
75    bool actionFileSaveTriggered();
76    void actionFileSaveAsTaskTriggered();
77    void actionFileSaveAsSolutionTriggered();
[7ed8b57eea]78#ifndef QT_NO_PRINTDIALOG
[9eb63a1598]79    void actionFilePrintPreviewTriggered();
[20e8115cee]80    void actionFilePageSetupTriggered();
[9eb63a1598]81    void actionFilePrintTriggered();
[7ed8b57eea]82#endif // QT_NO_PRINTDIALOG
[9eb63a1598]83    void actionSettingsPreferencesTriggered();
84    void actionSettingsLanguageAutodetectTriggered(bool checked);
85    void groupSettingsLanguageListTriggered(QAction *action);
86    void actionSettingsStyleSystemTriggered(bool checked);
87    void groupSettingsStyleListTriggered(QAction *action);
[7bb19df196]88#ifndef HANDHELD
[9eb63a1598]89    void actionSettingsToolbarsConfigureTriggered();
[7bb19df196]90#endif // HANDHELD
[9eb63a1598]91    void actionHelpOnlineSupportTriggered();
92    void actionHelpReportBugTriggered();
93    void actionHelpCheck4UpdatesTriggered();
94    void actionHelpAboutTriggered();
[2bbe924ad8]95// Buttons
[9eb63a1598]96    void buttonBackToTaskClicked();
97    void buttonRandomClicked();
98    void buttonSolveClicked();
[2bbe924ad8]99
[9eb63a1598]100    void dataChanged();
101    void dataChanged(const QModelIndex &tl, const QModelIndex &br);
[89e5214692]102#ifdef Q_OS_WINCE_WM
[9eb63a1598]103    void changeEvent(QEvent *ev);
104    void desktopResized(int screen);
[89e5214692]105#endif // Q_OS_WINCE_WM
[9eb63a1598]106    void numCitiesChanged(int nCities);
[2bbe924ad8]107#ifndef QT_NO_PRINTER
[9eb63a1598]108    void printPreview(QPrinter *printer);
[2bbe924ad8]109#endif // QT_NO_PRINTER
[89e5214692]110#ifdef Q_OS_WIN32
[9eb63a1598]111    void solverRoutePartFound(int n);
[89e5214692]112#endif // Q_OS_WIN32
[9eb63a1598]113    void spinCitiesValueChanged(int nCities);
[2bbe924ad8]114
115private:
[9eb63a1598]116    QString fileName;
117    QActionGroup *groupSettingsLanguageList;
118    QActionGroup *groupSettingsStyleList;
[94cd045fad]119#ifndef HANDHELD
[9eb63a1598]120    QAction *actionSettingsToolbarsConfigure;
121    QtToolBarManager *toolBarManager;
[94cd045fad]122#endif // HANDHELD
[2bbe924ad8]123#ifndef QT_NO_PRINTER
[9eb63a1598]124    QPrinter *printer;
[7ed8b57eea]125#ifndef QT_NO_PRINTDIALOG
[9eb63a1598]126    QAction *actionFilePrintPreview;
[20e8115cee]127    QAction *actionFilePageSetup;
[9eb63a1598]128    QAction *actionFilePrint;
[7ed8b57eea]129#endif // QT_NO_PRINTDIALOG
[2bbe924ad8]130#endif // QT_NO_PRINTER
[9eb63a1598]131    QAction *actionHelpCheck4Updates;
[89e5214692]132#ifdef Q_OS_SYMBIAN
[23ad8db4a5]133    QAction *actionRightSoftKey;
134#endif
[9eb63a1598]135    QSettings *settings;
136    CTSPModel *tspmodel;
[89e5214692]137#ifdef Q_OS_WINCE_WM
[9eb63a1598]138    QRect currentGeometry;
[89e5214692]139#endif // Q_OS_WINCE_WM
[2bbe924ad8]140
[89e5214692]141#ifdef Q_OS_WIN32
[9eb63a1598]142    ITaskbarList3 *tl;
[89e5214692]143#endif // Q_OS_WIN32
[43c29c04ba]144
[9eb63a1598]145    // The solution graph SVG
146    QPicture graph;
147
148    // Formats
149    QTextTableFormat fmt_table;
150    QTextBlockFormat fmt_paragraph,
[8f2427aaf0]151        fmt_lastparagraph,
[9eb63a1598]152        fmt_cell;
153    QTextCharFormat fmt_default,
154        fmt_selected,
155        fmt_alternate,
156        fmt_altlist;
157
158    void check4Updates(bool silent = false);
159    void closeEvent(QCloseEvent *ev);
160    void dragEnterEvent(QDragEnterEvent *ev);
[07e43cf61a]161    void drawNode(QPainter &pic, int nstep, bool left = false, TSPSolver::SStep *step = NULL);
[9eb63a1598]162    void dropEvent(QDropEvent *ev);
[b26dc16dcf]163    QByteArray generateImage(const QString &format);
[9eb63a1598]164    void initDocStyleSheet();
165    void loadLangList();
166    bool loadLanguage(const QString &lang = QString());
167    void loadStyleList();
168    void loadToolbarList();
169    bool maybeSave();
[07e43cf61a]170    void outputMatrix(QTextCursor &cur, const TSPSolver::TMatrix &matrix);
171    void outputMatrix(QTextCursor &cur, const TSPSolver::SStep &step);
[89e5214692]172#ifdef Q_OS_SYMBIAN
[1b40fef578]173    void resizeEvent(QResizeEvent *ev);
[89e5214692]174#endif // Q_OS_SYMBIAN
[9eb63a1598]175    void retranslateUi(bool all = true);
176    bool saveTask();
177    void setFileName(const QString &fileName = tr("Untitled") + ".tspt");
178    void setupUi();
179    void toggleSolutionActions(bool enable = true);
180    void toggleTranclucency(bool enable);
[2bbe924ad8]181};
182
[89e5214692]183#ifdef Q_OS_SYMBIAN
[07e43cf61a]184#include <QMessageBox>
[fddcfa4b55]185// A quickly hacked QMessageBox for Symbian that supports three buttons.
186class QSMessageBox: public QMessageBox {
187    Q_OBJECT
188private slots:
189    void cancel();
190    void discard();
191public:
192    QSMessageBox(QWidget *parent = 0);
193};
[89e5214692]194#endif // Q_OS_SYMBIAN
[fddcfa4b55]195
[2bbe924ad8]196#endif // MAINWINDOW_H
Note: See TracBrowser for help on using the repository browser.