source: tspsg/src/mainwindow.h @ 9cda6e0f5d

0.1.3.145-beta1-symbian0.1.4.170-beta2-bb10appveyorimgbotreadme
Last change on this file since 9cda6e0f5d was 9cda6e0f5d, checked in by Oleksii Serdiuk, 14 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 mode set to 100644
File size: 3.8 KB
RevLine 
[caef58b531]1/*!
[e0fcac5f2c]2 * \file mainwindow.h
[1757eb594b]3 * \author Copyright &copy; 2007-2010 Lёppa <contacts[at]oleksii[dot]name>
[003e4193be]4 *
[bb994a7ff8]5 *  $Id$
6 *  $URL$
[5515c2c2a7]7 *
[e0fcac5f2c]8 * \brief Defines MainWindow class.
9 *
[caef58b531]10 *  <b>TSPSG: TSP Solver and Generator</b>
11 *
[bb994a7ff8]12 *  This file is part of TSPSG.
[5515c2c2a7]13 *
[bb994a7ff8]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.
[5515c2c2a7]18 *
[bb994a7ff8]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.
[5515c2c2a7]23 *
[bb994a7ff8]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/>.
[5515c2c2a7]26 */
27
28#ifndef MAINWINDOW_H
29#define MAINWINDOW_H
30
[993d5af6f6]31#include "globals.h"
[bc1b8837b6]32
[c10297cf73]33#include "ui_mainwindow.h"
[5515c2c2a7]34#include "settingsdialog.h"
[bc1b8837b6]35
[2bc8e278b7]36#include "tspmodel.h"
[5515c2c2a7]37
[9cda6e0f5d]38using namespace TSPSolver;
39
[e0fcac5f2c]40/*!
41 * \brief Class for handling Main Window UI and logic.
[1757eb594b]42 * \author Copyright &copy; 2007-2010 Lёppa <contacts[at]oleksii[dot]name>
[e0fcac5f2c]43 */
[5515c2c2a7]44class MainWindow: public QMainWindow, Ui::MainWindow
45{
46        Q_OBJECT
[b424a7e320]47
[5515c2c2a7]48public:
49        MainWindow(QWidget *parent = 0);
[4ccf855df8]50        ~MainWindow();
[b424a7e320]51
[5515c2c2a7]52private slots:
[e0fcac5f2c]53// Actions
[899d1b8e15]54        void actionFileNewTriggered();
[993d5af6f6]55        void actionFileOpenTriggered();
[394216e468]56        bool actionFileSaveTriggered();
[430bd7f7e9]57        void actionFileSaveAsTaskTriggered();
58        void actionFileSaveAsSolutionTriggered();
[e0fcac5f2c]59#ifndef QT_NO_PRINTER
60        void actionFilePrintPreviewTriggered();
61        void actionFilePrintTriggered();
62#endif // QT_NO_PRINTER
[899d1b8e15]63        void actionSettingsPreferencesTriggered();
[0ac9690913]64        void actionSettingsLanguageAutodetectTriggered(bool checked);
65        void groupSettingsLanguageListTriggered(QAction *action);
[394216e468]66#ifdef Q_OS_WIN32
67        void actionHelpCheck4UpdatesTriggered();
68#endif // Q_OS_WIN32
[899d1b8e15]69        void actionHelpAboutTriggered();
[e0fcac5f2c]70// Buttons
71        void buttonBackToTaskClicked();
72        void buttonRandomClicked();
73        void buttonSolveClicked();
74
[690f6939a7]75        void dataChanged();
[0ac9690913]76        void dataChanged(const QModelIndex &tl, const QModelIndex &br);
[1babbd6ba3]77#ifdef Q_OS_WINCE_WM
[278bc7818f]78        void changeEvent(QEvent *ev);
[b2bf8e3b6b]79        void desktopResized(int screen);
[1babbd6ba3]80#endif // Q_OS_WINCE_WM
[0ac9690913]81        void numCitiesChanged(int nCities);
[c10297cf73]82#ifndef QT_NO_PRINTER
[caef58b531]83        void printPreview(QPrinter *printer);
[c10297cf73]84#endif // QT_NO_PRINTER
[0ac9690913]85        void spinCitiesValueChanged(int nCities);
[b424a7e320]86
[bb994a7ff8]87private:
[e0fcac5f2c]88        QString fileName;
89        QActionGroup *groupSettingsLanguageList;
[c10297cf73]90#ifndef QT_NO_PRINTER
[899d1b8e15]91        QPrinter *printer;
[4ccf855df8]92        QAction *actionFilePrintPreview;
93        QAction *actionFilePrint;
[c10297cf73]94#endif // QT_NO_PRINTER
[394216e468]95#ifdef Q_OS_WIN32
96        QAction *actionHelpCheck4Updates;
97#endif // Q_OS_WIN32
[e0fcac5f2c]98        QSettings *settings;
[2bc8e278b7]99        CTSPModel *tspmodel;
[1babbd6ba3]100#ifdef Q_OS_WINCE_WM
[b2bf8e3b6b]101        QRect currentGeometry;
[1babbd6ba3]102#endif // Q_OS_WINCE_WM
[e0fcac5f2c]103
[345e7b6132]104        // The solution graph SVG
105        QPicture graph;
106
[317ba0432e]107        // Formats
108        QTextTableFormat fmt_table;
109        QTextBlockFormat fmt_paragraph,
[345e7b6132]110                fmt_cell;
[317ba0432e]111        QTextCharFormat fmt_default,
112                fmt_selected,
113                fmt_alternate,
114                fmt_altlist;
115
[0ac9690913]116        void closeEvent(QCloseEvent *ev);
[b574c383b7]117        void dragEnterEvent(QDragEnterEvent *ev);
[345e7b6132]118        void drawNode(QPainter &pic, int nstep, bool left = false, SStep *step = NULL);
[b574c383b7]119        void dropEvent(QDropEvent *ev);
[394216e468]120        bool hasUpdater() const;
[b424a7e320]121        void initDocStyleSheet();
[899d1b8e15]122        void loadLangList();
[0ac9690913]123        bool loadLanguage(const QString &lang = QString());
[b424a7e320]124        bool maybeSave();
[317ba0432e]125        void outputMatrix(QTextCursor &cur, const TMatrix &matrix);
126        void outputMatrix(QTextCursor &cur, const SStep &step);
[4ccf855df8]127        void retranslateUi(bool all = true);
[b424a7e320]128        bool saveTask();
[1757eb594b]129        void setFileName(const QString &fileName = tr("Untitled") + ".tspt");
[4ccf855df8]130        void setupUi();
[1fbf016a09]131        void toggleSolutionActions(bool enable = true);
[11086c2def]132        void toggleTranclucency(bool enable);
[5515c2c2a7]133};
134
135#endif // MAINWINDOW_H
Note: See TracBrowser for help on using the repository browser.