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 "tspmodel.h"
00037
00038 using namespace TSPSolver;
00039
00044 class MainWindow: public QMainWindow, Ui::MainWindow
00045 {
00046 Q_OBJECT
00047
00048 public:
00049 MainWindow(QWidget *parent = 0);
00050 ~MainWindow();
00051
00052 private slots:
00053
00054 void actionFileNewTriggered();
00055 void actionFileOpenTriggered();
00056 bool actionFileSaveTriggered();
00057 void actionFileSaveAsTaskTriggered();
00058 void actionFileSaveAsSolutionTriggered();
00059 #ifndef QT_NO_PRINTER
00060 void actionFilePrintPreviewTriggered();
00061 void actionFilePrintTriggered();
00062 #endif // QT_NO_PRINTER
00063 void actionSettingsPreferencesTriggered();
00064 void actionSettingsLanguageAutodetectTriggered(bool checked);
00065 void groupSettingsLanguageListTriggered(QAction *action);
00066 #ifdef Q_OS_WIN32
00067 void actionHelpCheck4UpdatesTriggered();
00068 #endif // Q_OS_WIN32
00069 void actionHelpAboutTriggered();
00070
00071 void buttonBackToTaskClicked();
00072 void buttonRandomClicked();
00073 void buttonSolveClicked();
00074
00075 void dataChanged();
00076 void dataChanged(const QModelIndex &tl, const QModelIndex &br);
00077 #ifdef Q_OS_WINCE_WM
00078 void changeEvent(QEvent *ev);
00079 void desktopResized(int screen);
00080 #endif // Q_OS_WINCE_WM
00081 void numCitiesChanged(int nCities);
00082 #ifndef QT_NO_PRINTER
00083 void printPreview(QPrinter *printer);
00084 #endif // QT_NO_PRINTER
00085 void spinCitiesValueChanged(int nCities);
00086
00087 private:
00088 QString fileName;
00089 QActionGroup *groupSettingsLanguageList;
00090 #ifndef QT_NO_PRINTER
00091 QPrinter *printer;
00092 QAction *actionFilePrintPreview;
00093 QAction *actionFilePrint;
00094 #endif // QT_NO_PRINTER
00095 #ifdef Q_OS_WIN32
00096 QAction *actionHelpCheck4Updates;
00097 #endif // Q_OS_WIN32
00098 QSettings *settings;
00099 CTSPModel *tspmodel;
00100 #ifdef Q_OS_WINCE_WM
00101 QRect currentGeometry;
00102 #endif // Q_OS_WINCE_WM
00103
00104
00105 QPicture graph;
00106
00107
00108 QTextTableFormat fmt_table;
00109 QTextBlockFormat fmt_paragraph,
00110 fmt_cell;
00111 QTextCharFormat fmt_default,
00112 fmt_selected,
00113 fmt_alternate,
00114 fmt_altlist;
00115
00116 void closeEvent(QCloseEvent *ev);
00117 void dragEnterEvent(QDragEnterEvent *ev);
00118 void drawNode(QPainter &pic, int nstep, bool left = false, SStep *step = NULL);
00119 void dropEvent(QDropEvent *ev);
00120 bool hasUpdater() const;
00121 void initDocStyleSheet();
00122 void loadLangList();
00123 bool loadLanguage(const QString &lang = QString());
00124 bool maybeSave();
00125 void outputMatrix(QTextCursor &cur, const TMatrix &matrix);
00126 void outputMatrix(QTextCursor &cur, const SStep &step);
00127 void retranslateUi(bool all = true);
00128 bool saveTask();
00129 void setFileName(const QString &fileName = tr("Untitled") + ".tspt");
00130 void setupUi();
00131 void toggleSolutionActions(bool enable = true);
00132 void toggleTranclucency(bool enable);
00133 };
00134
00135 #endif // MAINWINDOW_H