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 ~MainWindow();
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 checked);
00064 void groupSettingsLanguageListTriggered(QAction *action);
00065 void actionHelpAboutTriggered();
00066
00067 void buttonBackToTaskClicked();
00068 void buttonRandomClicked();
00069 void buttonSolveClicked();
00070
00071 void dataChanged();
00072 void dataChanged(const QModelIndex &tl, const QModelIndex &br);
00073 #ifdef Q_OS_WINCE
00074 void changeEvent(QEvent *ev);
00075 void desktopResized(int screen);
00076 #endif // Q_OS_WINCE
00077 void numCitiesChanged(int nCities);
00078 #ifndef QT_NO_PRINTER
00079 void printPreview(QPrinter *printer);
00080 #endif // QT_NO_PRINTER
00081 void spinCitiesValueChanged(int nCities);
00082
00083 private:
00084 QString fileName;
00085 QActionGroup *groupSettingsLanguageList;
00086 QStringList output;
00087 #ifndef QT_NO_PRINTER
00088 QPrinter *printer;
00089 QAction *actionFilePrintPreview;
00090 QAction *actionFilePrint;
00091 #endif // QT_NO_PRINTER
00092 QSettings *settings;
00093 CTSPModel *tspmodel;
00094 #ifdef Q_OS_WINCE
00095 QRect currentGeometry;
00096 #endif // Q_OS_WINCE
00097
00098 void closeEvent(QCloseEvent *ev);
00099 void initDocStyleSheet();
00100 void loadLangList();
00101 bool loadLanguage(const QString &lang = QString());
00102 bool maybeSave();
00103 void outputMatrix(const TMatrix &matrix, QStringList &output);
00104 void outputMatrix(const SStep &step, QStringList &output);
00105 void retranslateUi(bool all = true);
00106 bool saveTask();
00107 void setFileName(const QString &fileName = tr("Untitled") + ".tspt");
00108 void setupUi();
00109 void toggleSolutionActions(bool enable = true);
00110 void toggleTranclucency(bool enable);
00111 };
00112
00113 #endif // MAINWINDOW_H