00001
00028 #ifndef MAINWINDOW_H
00029 #define MAINWINDOW_H
00030
00031 #include "globals.h"
00032
00033 #include "ui_mainwindow.h"
00034 #include "settingsdialog.h"
00035
00036 #include "tspsolver.h"
00037 #include "tspmodel.h"
00038
00043 class MainWindow: public QMainWindow, Ui::MainWindow
00044 {
00045 Q_OBJECT
00046
00047 public:
00048 MainWindow(QWidget *parent = 0);
00049
00050 private slots:
00051
00052 void actionFileNewTriggered();
00053 void actionFileOpenTriggered();
00054 void actionFileSaveTriggered();
00055 void actionFileSaveAsTaskTriggered();
00056 void actionFileSaveAsSolutionTriggered();
00057 #ifndef QT_NO_PRINTER
00058 void actionFilePrintPreviewTriggered();
00059 void actionFilePrintTriggered();
00060 #endif // QT_NO_PRINTER
00061 void actionSettingsPreferencesTriggered();
00062 void actionSettingsLanguageAutodetectTriggered(bool checked);
00063 void groupSettingsLanguageListTriggered(QAction *action);
00064 void actionHelpAboutTriggered();
00065
00066 void buttonBackToTaskClicked();
00067 void buttonRandomClicked();
00068 void buttonSolveClicked();
00069
00070 void dataChanged();
00071 void dataChanged(const QModelIndex &tl, const QModelIndex &br);
00072 void numCitiesChanged(int nCities);
00073 #ifndef QT_NO_PRINTER
00074 void printPreview(QPrinter *printer);
00075 #endif // QT_NO_PRINTER
00076 void spinCitiesValueChanged(int nCities);
00077
00078 private:
00079 QString fileName;
00080 QActionGroup *groupSettingsLanguageList;
00081 QStringList output;
00082 #ifndef QT_NO_PRINTER
00083 QPrinter *printer;
00084 #endif // QT_NO_PRINTER
00085 QSettings *settings;
00086 CTSPModel *tspmodel;
00087
00088 void closeEvent(QCloseEvent *ev);
00089 void enableSolutionActions(bool enable = true);
00090 void initDocStyleSheet();
00091 void loadLangList();
00092 bool loadLanguage(const QString &lang = QString());
00093 bool maybeSave();
00094 void outputMatrix(const TMatrix &matrix, QStringList &output);
00095 void outputMatrix(const SStep &step, QStringList &output);
00096 bool saveTask();
00097 void setFileName(const QString &fileName = trUtf8("Untitled") + ".tspt");
00098 };
00099
00100 #endif // MAINWINDOW_H