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

Last change on this file since 120 was 118, checked in by laleppa, 15 years ago

Finished toolbar customization feature.
It is not available on handheld devices (mainly, because the customization dialog is too big for a small screen).

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id URL
File size: 4.0 KB
Line 
1/*!
2 * \file mainwindow.h
3 * \author Copyright &copy; 2007-2010 Lёppa <contacts[at]oleksii[dot]name>
4 *
5 *  $Id: mainwindow.h 118 2010-05-02 21:59:26Z 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
38using namespace TSPSolver;
39
40/*!
41 * \brief Class for handling Main Window UI and logic.
42 * \author Copyright &copy; 2007-2010 Lёppa <contacts[at]oleksii[dot]name>
43 */
44class MainWindow: public QMainWindow, Ui::MainWindow
45{
46        Q_OBJECT
47
48public:
49        MainWindow(QWidget *parent = 0);
50        ~MainWindow();
51
52private slots:
53// Actions
54        void actionFileNewTriggered();
55        void actionFileOpenTriggered();
56        bool actionFileSaveTriggered();
57        void actionFileSaveAsTaskTriggered();
58        void actionFileSaveAsSolutionTriggered();
59#ifndef QT_NO_PRINTER
60        void actionFilePrintPreviewTriggered();
61        void actionFilePrintTriggered();
62#endif // QT_NO_PRINTER
63        void actionSettingsPreferencesTriggered();
64        void actionSettingsLanguageAutodetectTriggered(bool checked);
65        void groupSettingsLanguageListTriggered(QAction *action);
66        void actionSettingsStyleSystemTriggered(bool checked);
67        void groupSettingsStyleListTriggered(QAction *action);
68#ifndef HANDHELD
69        void actionSettingsToolbarsConfigureTriggered();
70#endif // HANDHELD
71#ifdef Q_OS_WIN32
72        void actionHelpCheck4UpdatesTriggered();
73#endif // Q_OS_WIN32
74        void actionHelpAboutTriggered();
75// Buttons
76        void buttonBackToTaskClicked();
77        void buttonRandomClicked();
78        void buttonSolveClicked();
79
80        void dataChanged();
81        void dataChanged(const QModelIndex &tl, const QModelIndex &br);
82#ifdef Q_OS_WINCE_WM
83        void changeEvent(QEvent *ev);
84        void desktopResized(int screen);
85#endif // Q_OS_WINCE_WM
86        void numCitiesChanged(int nCities);
87#ifndef QT_NO_PRINTER
88        void printPreview(QPrinter *printer);
89#endif // QT_NO_PRINTER
90        void spinCitiesValueChanged(int nCities);
91
92private:
93        QString fileName;
94        QActionGroup *groupSettingsLanguageList;
95        QActionGroup *groupSettingsStyleList;
96#ifndef HANDHELD
97        QAction *actionSettingsToolbarsConfigure;
98        QtToolBarManager *toolBarManager;
99#endif // HANDHELD
100#ifndef QT_NO_PRINTER
101        QPrinter *printer;
102        QAction *actionFilePrintPreview;
103        QAction *actionFilePrint;
104#endif // QT_NO_PRINTER
105#ifdef Q_OS_WIN32
106        QAction *actionHelpCheck4Updates;
107#endif // Q_OS_WIN32
108        QSettings *settings;
109        CTSPModel *tspmodel;
110#ifdef Q_OS_WINCE_WM
111        QRect currentGeometry;
112#endif // Q_OS_WINCE_WM
113
114        // The solution graph SVG
115        QPicture graph;
116
117        // Formats
118        QTextTableFormat fmt_table;
119        QTextBlockFormat fmt_paragraph,
120                fmt_cell;
121        QTextCharFormat fmt_default,
122                fmt_selected,
123                fmt_alternate,
124                fmt_altlist;
125
126        void closeEvent(QCloseEvent *ev);
127        void dragEnterEvent(QDragEnterEvent *ev);
128        void drawNode(QPainter &pic, int nstep, bool left = false, SStep *step = NULL);
129        void dropEvent(QDropEvent *ev);
130        bool hasUpdater() const;
131        void initDocStyleSheet();
132        void loadLangList();
133        bool loadLanguage(const QString &lang = QString());
134        void loadStyleList();
135        void loadToolbarList();
136        bool maybeSave();
137        void outputMatrix(QTextCursor &cur, const TMatrix &matrix);
138        void outputMatrix(QTextCursor &cur, const SStep &step);
139        void retranslateUi(bool all = true);
140        bool saveTask();
141        void setFileName(const QString &fileName = tr("Untitled") + ".tspt");
142        void setupUi();
143        void toggleSolutionActions(bool enable = true);
144        void toggleTranclucency(bool enable);
145};
146
147#endif // MAINWINDOW_H
Note: See TracBrowser for help on using the repository browser.