source: tspsg/src/mainwindow.h @ 7ed8b57eea

appveyorimgbotreadme
Last change on this file since 7ed8b57eea was 7ed8b57eea, checked in by Oleksii Serdiuk, 11 years ago

[BB10] UI fixes:

  • added proxy style and stylesheet to fix some UI issues on BlackBerry?;
  • removed style selection option because most styles have UI issues and removed About Qt menu item because About Qt dialog is too big;
  • load bigger (128x128) icons on BlackBerry? 10;
  • removed printing related items from menu as there's no printer;
  • made dialogs to be shown maximized;
  • made solution graph smaller;
  • made font smaller;
  • made output text color black;
  • start editing table cells on single tap;
  • don't show keyboard in about dialog.

Cherry-picks from
aa64ad40827cde0a444cd8198b0f3457aa191f8f
95b0ef73dcb4517ac2ae08867494204bbe8d7ea6
ccdffe3a5f84f12fba2e2f19ab249c31f1fcf35d
628500a5d687889823197e476953859d529af4f0

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