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 void closeEvent(QCloseEvent *);
00050
00051 private slots:
00052
00053 void actionFileNewTriggered();
00054 void actionFileOpenTriggered();
00055 void actionFileSaveTriggered();
00056 void actionFileSaveAsTaskTriggered();
00057 void actionFileSaveAsSolutionTriggered();
00058 #ifndef QT_NO_PRINTER
00059 void actionFilePrintPreviewTriggered();
00060 void actionFilePrintTriggered();
00061 #endif // QT_NO_PRINTER
00062 void actionSettingsPreferencesTriggered();
00063 void actionSettingsLanguageAutodetectTriggered(bool);
00064 void groupSettingsLanguageListTriggered(QAction *);
00065 void actionHelpAboutTriggered();
00066
00067 void buttonBackToTaskClicked();
00068 void buttonRandomClicked();
00069 void buttonSolveClicked();
00070
00071 void dataChanged();
00072 void dataChanged(const QModelIndex &, const QModelIndex &);
00073 void numCitiesChanged(int);
00074 #ifndef QT_NO_PRINTER
00075 void printPreview(QPrinter *printer);
00076 #endif // QT_NO_PRINTER
00077 void spinCitiesValueChanged(int);
00078
00079 private:
00080 QString fileName;
00081 QActionGroup *groupSettingsLanguageList;
00082 QStringList output;
00083 #ifndef QT_NO_PRINTER
00084 QPrinter *printer;
00085 #endif // QT_NO_PRINTER
00086 QSettings *settings;
00087 CTSPModel *tspmodel;
00088
00089 void enableSolutionActions(bool enable = true);
00090 void initDocStyleSheet();
00091 void loadLangList();
00092 bool loadLanguage(QString lang = "");
00093 bool maybeSave();
00094 void outputMatrix(tMatrix, QStringList &, int nRow = -1, int nCol = -1);
00095 bool saveTask();
00096 void setFileName(QString fileName = trUtf8("Untitled") + ".tspt");
00097 };
00098
00099 #endif // MAINWINDOW_H