source: tspsg/src/mainwindow.h @ bd4553fa91

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

Removed printing related items from menu as there's no printer.

Made dialogs to be shown maximized.

  • 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
57private slots:
58// Actions
[9eb63a1598]59    void actionFileNewTriggered();
60    void actionFileOpenTriggered();
61    bool actionFileSaveTriggered();
62    void actionFileSaveAsTaskTriggered();
63    void actionFileSaveAsSolutionTriggered();
[ccdffe3a5f]64#ifndef QT_NO_PRINTDIALOG
[9eb63a1598]65    void actionFilePrintPreviewTriggered();
[20e8115cee]66    void actionFilePageSetupTriggered();
[9eb63a1598]67    void actionFilePrintTriggered();
[ccdffe3a5f]68#endif // QT_NO_PRINTDIALOG
[9eb63a1598]69    void actionSettingsPreferencesTriggered();
70    void actionSettingsLanguageAutodetectTriggered(bool checked);
71    void groupSettingsLanguageListTriggered(QAction *action);
72    void actionSettingsStyleSystemTriggered(bool checked);
73    void groupSettingsStyleListTriggered(QAction *action);
[7bb19df196]74#ifndef HANDHELD
[9eb63a1598]75    void actionSettingsToolbarsConfigureTriggered();
[7bb19df196]76#endif // HANDHELD
[9eb63a1598]77    void actionHelpOnlineSupportTriggered();
78    void actionHelpReportBugTriggered();
79    void actionHelpCheck4UpdatesTriggered();
80    void actionHelpAboutTriggered();
[2bbe924ad8]81// Buttons
[9eb63a1598]82    void buttonBackToTaskClicked();
83    void buttonRandomClicked();
84    void buttonSolveClicked();
[2bbe924ad8]85
[9eb63a1598]86    void dataChanged();
87    void dataChanged(const QModelIndex &tl, const QModelIndex &br);
[97e90f9be6]88#ifdef Q_WS_WINCE_WM
[9eb63a1598]89    void changeEvent(QEvent *ev);
90    void desktopResized(int screen);
[97e90f9be6]91#endif // Q_WS_WINCE_WM
[9eb63a1598]92    void numCitiesChanged(int nCities);
[2bbe924ad8]93#ifndef QT_NO_PRINTER
[9eb63a1598]94    void printPreview(QPrinter *printer);
[2bbe924ad8]95#endif // QT_NO_PRINTER
[97e90f9be6]96#ifdef Q_WS_WIN32
[9eb63a1598]97    void solverRoutePartFound(int n);
[97e90f9be6]98#endif // Q_WS_WIN32
[9eb63a1598]99    void spinCitiesValueChanged(int nCities);
[2bbe924ad8]100
101private:
[9eb63a1598]102    QString fileName;
103    QActionGroup *groupSettingsLanguageList;
104    QActionGroup *groupSettingsStyleList;
[94cd045fad]105#ifndef HANDHELD
[9eb63a1598]106    QAction *actionSettingsToolbarsConfigure;
107    QtToolBarManager *toolBarManager;
[94cd045fad]108#endif // HANDHELD
[2bbe924ad8]109#ifndef QT_NO_PRINTER
[9eb63a1598]110    QPrinter *printer;
[ccdffe3a5f]111#ifndef QT_NO_PRINTDIALOG
[9eb63a1598]112    QAction *actionFilePrintPreview;
[20e8115cee]113    QAction *actionFilePageSetup;
[9eb63a1598]114    QAction *actionFilePrint;
[ccdffe3a5f]115#endif // QT_NO_PRINTDIALOG
[2bbe924ad8]116#endif // QT_NO_PRINTER
[9eb63a1598]117    QAction *actionHelpCheck4Updates;
[23ad8db4a5]118#ifdef Q_WS_S60
119    QAction *actionRightSoftKey;
120#endif
[9eb63a1598]121    QSettings *settings;
122    CTSPModel *tspmodel;
[97e90f9be6]123#ifdef Q_WS_WINCE_WM
[9eb63a1598]124    QRect currentGeometry;
[97e90f9be6]125#endif // Q_WS_WINCE_WM
[2bbe924ad8]126
[97e90f9be6]127#ifdef Q_WS_WIN32
[9eb63a1598]128    ITaskbarList3 *tl;
[97e90f9be6]129#endif // Q_WS_WIN32
[43c29c04ba]130
[9eb63a1598]131    // The solution graph SVG
132    QPicture graph;
133
134    // Formats
135    QTextTableFormat fmt_table;
136    QTextBlockFormat fmt_paragraph,
[8f2427aaf0]137        fmt_lastparagraph,
[9eb63a1598]138        fmt_cell;
139    QTextCharFormat fmt_default,
140        fmt_selected,
141        fmt_alternate,
142        fmt_altlist;
143
144    void check4Updates(bool silent = false);
145    void closeEvent(QCloseEvent *ev);
146    void dragEnterEvent(QDragEnterEvent *ev);
147    void drawNode(QPainter &pic, int nstep, bool left = false, SStep *step = NULL);
148    void dropEvent(QDropEvent *ev);
149    void initDocStyleSheet();
150    void loadLangList();
151    bool loadLanguage(const QString &lang = QString());
152    void loadStyleList();
153    void loadToolbarList();
154    bool maybeSave();
155    void outputMatrix(QTextCursor &cur, const TMatrix &matrix);
156    void outputMatrix(QTextCursor &cur, const SStep &step);
157    void retranslateUi(bool all = true);
158    bool saveTask();
159    void setFileName(const QString &fileName = tr("Untitled") + ".tspt");
160    void setupUi();
161    void toggleSolutionActions(bool enable = true);
162    void toggleTranclucency(bool enable);
[2bbe924ad8]163};
164
[fddcfa4b55]165#ifdef Q_WS_S60
166// A quickly hacked QMessageBox for Symbian that supports three buttons.
167class QSMessageBox: public QMessageBox {
168    Q_OBJECT
169private slots:
170    void cancel();
171    void discard();
172public:
173    QSMessageBox(QWidget *parent = 0);
174};
175#endif // Q_WS_S60
176
[2bbe924ad8]177#endif // MAINWINDOW_H
Note: See TracBrowser for help on using the repository browser.