Go to the documentation of this file.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 #ifdef Q_WS_WIN32
00039
00040 struct ITaskbarList3;
00041 #endif
00042
00043 using namespace TSPSolver;
00044
00049 class MainWindow: public QMainWindow, Ui::MainWindow
00050 {
00051 Q_OBJECT
00052
00053 public:
00054 MainWindow(QWidget *parent = 0);
00055 ~MainWindow();
00056
00057 private slots:
00058
00059 void actionFileNewTriggered();
00060 void actionFileOpenTriggered();
00061 bool actionFileSaveTriggered();
00062 void actionFileSaveAsTaskTriggered();
00063 void actionFileSaveAsSolutionTriggered();
00064 #ifndef QT_NO_PRINTER
00065 void actionFilePrintPreviewTriggered();
00066 void actionFilePrintTriggered();
00067 #endif // QT_NO_PRINTER
00068 void actionSettingsPreferencesTriggered();
00069 void actionSettingsLanguageAutodetectTriggered(bool checked);
00070 void groupSettingsLanguageListTriggered(QAction *action);
00071 void actionSettingsStyleSystemTriggered(bool checked);
00072 void groupSettingsStyleListTriggered(QAction *action);
00073 #ifndef HANDHELD
00074 void actionSettingsToolbarsConfigureTriggered();
00075 #endif // HANDHELD
00076 void actionHelpOnlineSupportTriggered();
00077 void actionHelpReportBugTriggered();
00078 void actionHelpCheck4UpdatesTriggered();
00079 void actionHelpAboutTriggered();
00080
00081 void buttonBackToTaskClicked();
00082 void buttonRandomClicked();
00083 void buttonSolveClicked();
00084
00085 void dataChanged();
00086 void dataChanged(const QModelIndex &tl, const QModelIndex &br);
00087 #ifdef Q_WS_WINCE_WM
00088 void changeEvent(QEvent *ev);
00089 void desktopResized(int screen);
00090 #endif // Q_WS_WINCE_WM
00091 void numCitiesChanged(int nCities);
00092 #ifndef QT_NO_PRINTER
00093 void printPreview(QPrinter *printer);
00094 #endif // QT_NO_PRINTER
00095 #ifdef Q_WS_WIN32
00096 void solverRoutePartFound(int n);
00097 #endif // Q_WS_WIN32
00098 void spinCitiesValueChanged(int nCities);
00099
00100 private:
00101 QString fileName;
00102 QActionGroup *groupSettingsLanguageList;
00103 QActionGroup *groupSettingsStyleList;
00104 #ifndef HANDHELD
00105 QAction *actionSettingsToolbarsConfigure;
00106 QtToolBarManager *toolBarManager;
00107 #endif // HANDHELD
00108 #ifndef QT_NO_PRINTER
00109 QPrinter *printer;
00110 QAction *actionFilePrintPreview;
00111 QAction *actionFilePrint;
00112 #endif // QT_NO_PRINTER
00113 QAction *actionHelpCheck4Updates;
00114 QSettings *settings;
00115 CTSPModel *tspmodel;
00116 #ifdef Q_WS_WINCE_WM
00117 QRect currentGeometry;
00118 #endif // Q_WS_WINCE_WM
00119
00120 #ifdef Q_WS_WIN32
00121 ITaskbarList3 *tl;
00122 #endif // Q_WS_WIN32
00123
00124
00125 QPicture graph;
00126
00127
00128 QTextTableFormat fmt_table;
00129 QTextBlockFormat fmt_paragraph,
00130 fmt_cell;
00131 QTextCharFormat fmt_default,
00132 fmt_selected,
00133 fmt_alternate,
00134 fmt_altlist;
00135
00136 void check4Updates(bool silent = false);
00137 void closeEvent(QCloseEvent *ev);
00138 void dragEnterEvent(QDragEnterEvent *ev);
00139 void drawNode(QPainter &pic, int nstep, bool left = false, SStep *step = NULL);
00140 void dropEvent(QDropEvent *ev);
00141 void initDocStyleSheet();
00142 void loadLangList();
00143 bool loadLanguage(const QString &lang = QString());
00144 void loadStyleList();
00145 void loadToolbarList();
00146 bool maybeSave();
00147 void outputMatrix(QTextCursor &cur, const TMatrix &matrix);
00148 void outputMatrix(QTextCursor &cur, const SStep &step);
00149 void retranslateUi(bool all = true);
00150 bool saveTask();
00151 void setFileName(const QString &fileName = tr("Untitled") + ".tspt");
00152 void setupUi();
00153 void toggleSolutionActions(bool enable = true);
00154 void toggleTranclucency(bool enable);
00155 };
00156
00157 #endif // MAINWINDOW_H