source: tspsg-svn/trunk/src/mainwindow.h @ 160

Last change on this file since 160 was 159, checked in by laleppa, 13 years ago
  • Solution graph on Symbian is visually larger than on Windows Mobile. Added a hack that makes it about the same size on both platforms.
  • Fixed bug #6 (Bug: Actions in Options Menu).
  • Property svn:eol-style set to native
  • Property svn:keywords set to Id URL
File size: 4.5 KB
RevLine 
[116]1/*!
2 * \file mainwindow.h
[151]3 * \author Copyright &copy; 2007-2011 Lёppa <contacts[at]oleksii[dot]name>
[116]4 *
5 *  $Id: mainwindow.h 159 2011-04-09 00:53:25Z laleppa $
6 *  $URL: https://tspsg.svn.sourceforge.net/svnroot/tspsg/trunk/src/mainwindow.h $
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
[141]38#ifdef Q_WS_WIN32
[149]39    // Forward declaration. A real one is in shobjidl.h
40    struct ITaskbarList3;
[124]41#endif
42
[116]43using namespace TSPSolver;
44
45/*!
46 * \brief Class for handling Main Window UI and logic.
[151]47 * \author Copyright &copy; 2007-2011 Lёppa <contacts[at]oleksii[dot]name>
[116]48 */
49class MainWindow: public QMainWindow, Ui::MainWindow
50{
[149]51    Q_OBJECT
[116]52
53public:
[149]54    MainWindow(QWidget *parent = 0);
55    ~MainWindow();
[116]56
57private slots:
58// Actions
[149]59    void actionFileNewTriggered();
60    void actionFileOpenTriggered();
61    bool actionFileSaveTriggered();
62    void actionFileSaveAsTaskTriggered();
63    void actionFileSaveAsSolutionTriggered();
[116]64#ifndef QT_NO_PRINTER
[149]65    void actionFilePrintPreviewTriggered();
66    void actionFilePrintTriggered();
[116]67#endif // QT_NO_PRINTER
[149]68    void actionSettingsPreferencesTriggered();
69    void actionSettingsLanguageAutodetectTriggered(bool checked);
70    void groupSettingsLanguageListTriggered(QAction *action);
71    void actionSettingsStyleSystemTriggered(bool checked);
72    void groupSettingsStyleListTriggered(QAction *action);
[118]73#ifndef HANDHELD
[149]74    void actionSettingsToolbarsConfigureTriggered();
[118]75#endif // HANDHELD
[149]76    void actionHelpOnlineSupportTriggered();
77    void actionHelpReportBugTriggered();
78    void actionHelpCheck4UpdatesTriggered();
79    void actionHelpAboutTriggered();
[116]80// Buttons
[149]81    void buttonBackToTaskClicked();
82    void buttonRandomClicked();
83    void buttonSolveClicked();
[116]84
[149]85    void dataChanged();
86    void dataChanged(const QModelIndex &tl, const QModelIndex &br);
[141]87#ifdef Q_WS_WINCE_WM
[149]88    void changeEvent(QEvent *ev);
89    void desktopResized(int screen);
[141]90#endif // Q_WS_WINCE_WM
[149]91    void numCitiesChanged(int nCities);
[116]92#ifndef QT_NO_PRINTER
[149]93    void printPreview(QPrinter *printer);
[116]94#endif // QT_NO_PRINTER
[141]95#ifdef Q_WS_WIN32
[149]96    void solverRoutePartFound(int n);
[141]97#endif // Q_WS_WIN32
[149]98    void spinCitiesValueChanged(int nCities);
[116]99
100private:
[149]101    QString fileName;
102    QActionGroup *groupSettingsLanguageList;
103    QActionGroup *groupSettingsStyleList;
[117]104#ifndef HANDHELD
[149]105    QAction *actionSettingsToolbarsConfigure;
106    QtToolBarManager *toolBarManager;
[117]107#endif // HANDHELD
[116]108#ifndef QT_NO_PRINTER
[149]109    QPrinter *printer;
110    QAction *actionFilePrintPreview;
111    QAction *actionFilePrint;
[116]112#endif // QT_NO_PRINTER
[149]113    QAction *actionHelpCheck4Updates;
[159]114#ifdef Q_WS_S60
115    QAction *actionRightSoftKey;
116#endif
[149]117    QSettings *settings;
118    CTSPModel *tspmodel;
[141]119#ifdef Q_WS_WINCE_WM
[149]120    QRect currentGeometry;
[141]121#endif // Q_WS_WINCE_WM
[116]122
[141]123#ifdef Q_WS_WIN32
[149]124    ITaskbarList3 *tl;
[141]125#endif // Q_WS_WIN32
[124]126
[149]127    // The solution graph SVG
128    QPicture graph;
[116]129
[149]130    // Formats
131    QTextTableFormat fmt_table;
132    QTextBlockFormat fmt_paragraph,
133        fmt_cell;
134    QTextCharFormat fmt_default,
135        fmt_selected,
136        fmt_alternate,
137        fmt_altlist;
[116]138
[149]139    void check4Updates(bool silent = false);
140    void closeEvent(QCloseEvent *ev);
141    void dragEnterEvent(QDragEnterEvent *ev);
142    void drawNode(QPainter &pic, int nstep, bool left = false, SStep *step = NULL);
143    void dropEvent(QDropEvent *ev);
144    void initDocStyleSheet();
145    void loadLangList();
146    bool loadLanguage(const QString &lang = QString());
147    void loadStyleList();
148    void loadToolbarList();
149    bool maybeSave();
150    void outputMatrix(QTextCursor &cur, const TMatrix &matrix);
151    void outputMatrix(QTextCursor &cur, const SStep &step);
152    void retranslateUi(bool all = true);
153    bool saveTask();
154    void setFileName(const QString &fileName = tr("Untitled") + ".tspt");
155    void setupUi();
156    void toggleSolutionActions(bool enable = true);
157    void toggleTranclucency(bool enable);
[116]158};
159
160#endif // MAINWINDOW_H
Note: See TracBrowser for help on using the repository browser.