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