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

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

+ Added SStep::next that indicates what branch was selected for the next step.
+ Added "Show solution graph" option.
+ New CTSPSolver::getTotalSteps() method that returns a total number of steps in the current solution.

  • Moved SCandidate declaration into SStep declaration.
  • Moved everything in tspsolver.h and tspsolver.cpp into TSPSolver namespace.
  • Force CopyAction? on file drop or it will be deleted after dropping in Windows if MoveAction? was selected.
  • Property svn:keywords set to Id URL
File size: 3.8 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 107 2010-04-25 14:36:27Z 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#ifdef Q_OS_WIN32
67        void actionHelpCheck4UpdatesTriggered();
68#endif // Q_OS_WIN32
69        void actionHelpAboutTriggered();
70// Buttons
71        void buttonBackToTaskClicked();
72        void buttonRandomClicked();
73        void buttonSolveClicked();
74
75        void dataChanged();
76        void dataChanged(const QModelIndex &tl, const QModelIndex &br);
77#ifdef Q_OS_WINCE_WM
78        void changeEvent(QEvent *ev);
79        void desktopResized(int screen);
80#endif // Q_OS_WINCE_WM
81        void numCitiesChanged(int nCities);
82#ifndef QT_NO_PRINTER
83        void printPreview(QPrinter *printer);
84#endif // QT_NO_PRINTER
85        void spinCitiesValueChanged(int nCities);
86
87private:
88        QString fileName;
89        QActionGroup *groupSettingsLanguageList;
90#ifndef QT_NO_PRINTER
91        QPrinter *printer;
92        QAction *actionFilePrintPreview;
93        QAction *actionFilePrint;
94#endif // QT_NO_PRINTER
95#ifdef Q_OS_WIN32
96        QAction *actionHelpCheck4Updates;
97#endif // Q_OS_WIN32
98        QSettings *settings;
99        CTSPModel *tspmodel;
100#ifdef Q_OS_WINCE_WM
101        QRect currentGeometry;
102#endif // Q_OS_WINCE_WM
103
104        // The solution graph SVG
105        QPicture graph;
106
107        // Formats
108        QTextTableFormat fmt_table;
109        QTextBlockFormat fmt_paragraph,
110                fmt_cell;
111        QTextCharFormat fmt_default,
112                fmt_selected,
113                fmt_alternate,
114                fmt_altlist;
115
116        void closeEvent(QCloseEvent *ev);
117        void dragEnterEvent(QDragEnterEvent *ev);
118        void drawNode(QPainter &pic, int nstep, bool left = false, SStep *step = NULL);
119        void dropEvent(QDropEvent *ev);
120        bool hasUpdater() const;
121        void initDocStyleSheet();
122        void loadLangList();
123        bool loadLanguage(const QString &lang = QString());
124        bool maybeSave();
125        void outputMatrix(QTextCursor &cur, const TMatrix &matrix);
126        void outputMatrix(QTextCursor &cur, const SStep &step);
127        void retranslateUi(bool all = true);
128        bool saveTask();
129        void setFileName(const QString &fileName = tr("Untitled") + ".tspt");
130        void setupUi();
131        void toggleSolutionActions(bool enable = true);
132        void toggleTranclucency(bool enable);
133};
134
135#endif // MAINWINDOW_H
Note: See TracBrowser for help on using the repository browser.