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

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

+ Started adding a toolbar customization with the ude of QtToolbarDialog? (http://qt.nokia.com/products/appdev/add-on-products/catalog/4/Widgets/qttoolbardialog/).

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id URL
File size: 3.9 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 117 2010-05-02 10:51:20Z 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#ifndef HANDHELD
66        void on_actionSettingsToolbars_triggered();
67#endif // HANDHELD
68        void groupSettingsLanguageListTriggered(QAction *action);
69        void actionSettingsStyleSystemTriggered(bool checked);
70        void groupSettingsStyleListTriggered(QAction *action);
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        QtToolBarManager *toolBarManager;
98#endif // HANDHELD
99#ifndef QT_NO_PRINTER
100        QPrinter *printer;
101        QAction *actionFilePrintPreview;
102        QAction *actionFilePrint;
103#endif // QT_NO_PRINTER
104#ifdef Q_OS_WIN32
105        QAction *actionHelpCheck4Updates;
106#endif // Q_OS_WIN32
107        QSettings *settings;
108        CTSPModel *tspmodel;
109#ifdef Q_OS_WINCE_WM
110        QRect currentGeometry;
111#endif // Q_OS_WINCE_WM
112
113        // The solution graph SVG
114        QPicture graph;
115
116        // Formats
117        QTextTableFormat fmt_table;
118        QTextBlockFormat fmt_paragraph,
119                fmt_cell;
120        QTextCharFormat fmt_default,
121                fmt_selected,
122                fmt_alternate,
123                fmt_altlist;
124
125        void closeEvent(QCloseEvent *ev);
126        void dragEnterEvent(QDragEnterEvent *ev);
127        void drawNode(QPainter &pic, int nstep, bool left = false, SStep *step = NULL);
128        void dropEvent(QDropEvent *ev);
129        bool hasUpdater() const;
130        void initDocStyleSheet();
131        void loadLangList();
132        bool loadLanguage(const QString &lang = QString());
133        void loadStyleList();
134        bool maybeSave();
135        void outputMatrix(QTextCursor &cur, const TMatrix &matrix);
136        void outputMatrix(QTextCursor &cur, const SStep &step);
137        void retranslateUi(bool all = true);
138        bool saveTask();
139        void setFileName(const QString &fileName = tr("Untitled") + ".tspt");
140        void setupUi();
141        void toggleSolutionActions(bool enable = true);
142        void toggleTranclucency(bool enable);
143};
144
145#endif // MAINWINDOW_H
Note: See TracBrowser for help on using the repository browser.