/*! * \file mainwindow.h * \author Copyright © 2007-2010 Lёppa * * $Id: mainwindow.h 139 2010-09-29 21:21:46Z laleppa $ * $URL: https://tspsg.svn.sourceforge.net/svnroot/tspsg/trunk/src/mainwindow.h $ * * \brief Defines MainWindow class. * * TSPSG: TSP Solver and Generator * * This file is part of TSPSG. * * TSPSG is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * TSPSG is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with TSPSG. If not, see . */ #ifndef MAINWINDOW_H #define MAINWINDOW_H #include "globals.h" #include "ui_mainwindow.h" #include "settingsdialog.h" #include "tspmodel.h" #ifdef Q_OS_WIN32 // Forward declaration. A real one is in shobjidl.h struct ITaskbarList3; #endif using namespace TSPSolver; /*! * \brief Class for handling Main Window UI and logic. * \author Copyright © 2007-2010 Lёppa */ class MainWindow: public QMainWindow, Ui::MainWindow { Q_OBJECT public: MainWindow(QWidget *parent = 0); ~MainWindow(); private slots: // Actions void actionFileNewTriggered(); void actionFileOpenTriggered(); bool actionFileSaveTriggered(); void actionFileSaveAsTaskTriggered(); void actionFileSaveAsSolutionTriggered(); #ifndef QT_NO_PRINTER void actionFilePrintPreviewTriggered(); void actionFilePrintTriggered(); #endif // QT_NO_PRINTER void actionSettingsPreferencesTriggered(); void actionSettingsLanguageAutodetectTriggered(bool checked); void groupSettingsLanguageListTriggered(QAction *action); void actionSettingsStyleSystemTriggered(bool checked); void groupSettingsStyleListTriggered(QAction *action); #ifndef HANDHELD void actionSettingsToolbarsConfigureTriggered(); #endif // HANDHELD void actionHelpCheck4UpdatesTriggered(); void actionHelpAboutTriggered(); // Buttons void buttonBackToTaskClicked(); void buttonRandomClicked(); void buttonSolveClicked(); void dataChanged(); void dataChanged(const QModelIndex &tl, const QModelIndex &br); #ifdef Q_OS_WINCE_WM void changeEvent(QEvent *ev); void desktopResized(int screen); #endif // Q_OS_WINCE_WM void numCitiesChanged(int nCities); #ifndef QT_NO_PRINTER void printPreview(QPrinter *printer); #endif // QT_NO_PRINTER #ifdef Q_OS_WIN32 void solverRoutePartFound(int n); #endif // Q_OS_WIN32 void spinCitiesValueChanged(int nCities); private: QString fileName; QActionGroup *groupSettingsLanguageList; QActionGroup *groupSettingsStyleList; #ifndef HANDHELD QAction *actionSettingsToolbarsConfigure; QtToolBarManager *toolBarManager; #endif // HANDHELD #ifndef QT_NO_PRINTER QPrinter *printer; QAction *actionFilePrintPreview; QAction *actionFilePrint; #endif // QT_NO_PRINTER QAction *actionHelpCheck4Updates; QSettings *settings; CTSPModel *tspmodel; #ifdef Q_OS_WINCE_WM QRect currentGeometry; #endif // Q_OS_WINCE_WM #ifdef Q_OS_WIN32 ITaskbarList3 *tl; #endif // Q_OS_WIN32 // The solution graph SVG QPicture graph; // Formats QTextTableFormat fmt_table; QTextBlockFormat fmt_paragraph, fmt_cell; QTextCharFormat fmt_default, fmt_selected, fmt_alternate, fmt_altlist; void check4Updates(bool silent = false); void closeEvent(QCloseEvent *ev); void dragEnterEvent(QDragEnterEvent *ev); void drawNode(QPainter &pic, int nstep, bool left = false, SStep *step = NULL); void dropEvent(QDropEvent *ev); void initDocStyleSheet(); void loadLangList(); bool loadLanguage(const QString &lang = QString()); void loadStyleList(); void loadToolbarList(); bool maybeSave(); void outputMatrix(QTextCursor &cur, const TMatrix &matrix); void outputMatrix(QTextCursor &cur, const SStep &step); void retranslateUi(bool all = true); bool saveTask(); void setFileName(const QString &fileName = tr("Untitled") + ".tspt"); void setupUi(); void toggleSolutionActions(bool enable = true); void toggleTranclucency(bool enable); }; #endif // MAINWINDOW_H