source: tspsg/src/mainwindow.h @ b574c383b7

0.1.3.145-beta1-symbian0.1.4.170-beta2-bb10appveyorimgbotreadme
Last change on this file since b574c383b7 was b574c383b7, checked in by Oleksii Serdiuk, 14 years ago

+ Added support for opening the file when it is dragged and dropped on the main TSPSG window.

  • Property mode set to 100644
File size: 3.6 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
[67e53c96d7]36#include "tspsolver.h"
[2bc8e278b7]37#include "tspmodel.h"
[5515c2c2a7]38
[e0fcac5f2c]39/*!
40 * \brief Class for handling Main Window UI and logic.
[1757eb594b]41 * \author Copyright &copy; 2007-2010 Lёppa <contacts[at]oleksii[dot]name>
[e0fcac5f2c]42 */
[5515c2c2a7]43class MainWindow: public QMainWindow, Ui::MainWindow
44{
45        Q_OBJECT
[b424a7e320]46
[5515c2c2a7]47public:
48        MainWindow(QWidget *parent = 0);
[4ccf855df8]49        ~MainWindow();
[b424a7e320]50
[5515c2c2a7]51private slots:
[e0fcac5f2c]52// Actions
[899d1b8e15]53        void actionFileNewTriggered();
[993d5af6f6]54        void actionFileOpenTriggered();
[394216e468]55        bool actionFileSaveTriggered();
[430bd7f7e9]56        void actionFileSaveAsTaskTriggered();
57        void actionFileSaveAsSolutionTriggered();
[e0fcac5f2c]58#ifndef QT_NO_PRINTER
59        void actionFilePrintPreviewTriggered();
60        void actionFilePrintTriggered();
61#endif // QT_NO_PRINTER
[899d1b8e15]62        void actionSettingsPreferencesTriggered();
[0ac9690913]63        void actionSettingsLanguageAutodetectTriggered(bool checked);
64        void groupSettingsLanguageListTriggered(QAction *action);
[394216e468]65#ifdef Q_OS_WIN32
66        void actionHelpCheck4UpdatesTriggered();
67#endif // Q_OS_WIN32
[899d1b8e15]68        void actionHelpAboutTriggered();
[e0fcac5f2c]69// Buttons
70        void buttonBackToTaskClicked();
71        void buttonRandomClicked();
72        void buttonSolveClicked();
73
[690f6939a7]74        void dataChanged();
[0ac9690913]75        void dataChanged(const QModelIndex &tl, const QModelIndex &br);
[1babbd6ba3]76#ifdef Q_OS_WINCE_WM
[278bc7818f]77        void changeEvent(QEvent *ev);
[b2bf8e3b6b]78        void desktopResized(int screen);
[1babbd6ba3]79#endif // Q_OS_WINCE_WM
[0ac9690913]80        void numCitiesChanged(int nCities);
[c10297cf73]81#ifndef QT_NO_PRINTER
[caef58b531]82        void printPreview(QPrinter *printer);
[c10297cf73]83#endif // QT_NO_PRINTER
[0ac9690913]84        void spinCitiesValueChanged(int nCities);
[b424a7e320]85
[bb994a7ff8]86private:
[e0fcac5f2c]87        QString fileName;
88        QActionGroup *groupSettingsLanguageList;
[c10297cf73]89#ifndef QT_NO_PRINTER
[899d1b8e15]90        QPrinter *printer;
[4ccf855df8]91        QAction *actionFilePrintPreview;
92        QAction *actionFilePrint;
[c10297cf73]93#endif // QT_NO_PRINTER
[394216e468]94#ifdef Q_OS_WIN32
95        QAction *actionHelpCheck4Updates;
96#endif // Q_OS_WIN32
[e0fcac5f2c]97        QSettings *settings;
[2bc8e278b7]98        CTSPModel *tspmodel;
[1babbd6ba3]99#ifdef Q_OS_WINCE_WM
[b2bf8e3b6b]100        QRect currentGeometry;
[1babbd6ba3]101#endif // Q_OS_WINCE_WM
[e0fcac5f2c]102
[317ba0432e]103        // Formats
104        QTextTableFormat fmt_table;
105        QTextBlockFormat fmt_paragraph,
106                fmt_center;
107        QTextCharFormat fmt_default,
108                fmt_selected,
109                fmt_alternate,
110                fmt_altlist;
111
[0ac9690913]112        void closeEvent(QCloseEvent *ev);
[b574c383b7]113        void dragEnterEvent(QDragEnterEvent *ev);
114        void dropEvent(QDropEvent *ev);
[394216e468]115        bool hasUpdater() const;
[b424a7e320]116        void initDocStyleSheet();
[899d1b8e15]117        void loadLangList();
[0ac9690913]118        bool loadLanguage(const QString &lang = QString());
[b424a7e320]119        bool maybeSave();
[317ba0432e]120        void outputMatrix(QTextCursor &cur, const TMatrix &matrix);
121        void outputMatrix(QTextCursor &cur, const SStep &step);
[4ccf855df8]122        void retranslateUi(bool all = true);
[b424a7e320]123        bool saveTask();
[1757eb594b]124        void setFileName(const QString &fileName = tr("Untitled") + ".tspt");
[4ccf855df8]125        void setupUi();
[1fbf016a09]126        void toggleSolutionActions(bool enable = true);
[11086c2def]127        void toggleTranclucency(bool enable);
[5515c2c2a7]128};
129
130#endif // MAINWINDOW_H
Note: See TracBrowser for help on using the repository browser.