/*! * \file mainwindow.h * \author Copyright © 2007-2009 Lёppa * * $Id$ * $URL$ * * \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 "tspsolver.h" #include "tspmodel.h" /*! * \brief Class for handling Main Window UI and logic. * \author Copyright © 2007-2009 Lёppa */ class MainWindow: public QMainWindow, Ui::MainWindow { Q_OBJECT public: MainWindow(QWidget *parent = 0); private slots: // Actions void actionFileNewTriggered(); void actionFileOpenTriggered(); void 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 actionHelpAboutTriggered(); // Buttons void buttonBackToTaskClicked(); void buttonRandomClicked(); void buttonSolveClicked(); void dataChanged(); void dataChanged(const QModelIndex &tl, const QModelIndex &br); void numCitiesChanged(int nCities); #ifndef QT_NO_PRINTER void printPreview(QPrinter *printer); #endif // QT_NO_PRINTER void spinCitiesValueChanged(int nCities); private: QString fileName; QActionGroup *groupSettingsLanguageList; QStringList output; #ifndef QT_NO_PRINTER QPrinter *printer; #endif // QT_NO_PRINTER QSettings *settings; CTSPModel *tspmodel; void closeEvent(QCloseEvent *ev); void enableSolutionActions(bool enable = true); void initDocStyleSheet(); void loadLangList(); bool loadLanguage(const QString &lang = QString()); bool maybeSave(); void outputMatrix(const TMatrix &matrix, QStringList &output); void outputMatrix(const SStep &step, QStringList &output); bool saveTask(); void setFileName(const QString &fileName = trUtf8("Untitled") + ".tspt"); }; #endif // MAINWINDOW_H