00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #ifndef ASPECT_MAINWINDOW_H
00013 #define ASPECT_MAINWINDOW_H
00014
00015
00016 #include "data.h"
00017 #include "datapemcu.h"
00018 #include "mcuserial.h"
00019
00020 #include <QDir>
00021 #include <QSettings>
00022 #include <QMainWindow>
00023 #include <QList>
00024 #include <QVector>
00025
00026 class QGraphicsScene;
00027 class QStandardItem;
00028 class QStandardItemModel;
00029 class StatusBar;
00030 class LogDialog;
00031 class SettingsDialog;
00032 class MountDialog;
00033 class McuProxy;
00034
00035
00036 namespace Ui { class MainWindow; };
00037
00038
00039 class MainWindow: public QMainWindow
00040 {
00041 Q_OBJECT
00042
00043 public:
00044 MainWindow();
00045 ~MainWindow();
00046
00047 public slots:
00048 void on_actionQuit_triggered();
00049 void on_actionAbout_Aspect_triggered();
00050 void on_actionAbout_Qt_triggered();
00051
00052 void on_actionLog_View_triggered();
00053 void on_actionSettings_triggered();
00054 void on_actionMount_triggered();
00055
00056 void settingsChanged();
00057
00058 void mcuSerialStatus(bool bOpen, McuSerial::Status eStatus);
00059 void mcuSerialFirmware(const QString &qsFirmware);
00060 void mcuSerialBusy(bool bBusy);
00061
00062 void on_mcuPort_activated(const QString &qsPort);
00063 void on_mcuSettingsTracking_activated(int nSpeed);
00064 void on_mcuSettingsPec_activated(int nIndex);
00065 void on_mcuSettingsIntelly_activated(int nIndex);
00066 void on_mcuSettingsRefresh_clicked();
00067
00068 void on_peFileOpen_clicked();
00069 void on_peFileFollow_clicked();
00070
00071 void on_peProcMode_activated(int nMode);
00072 void on_peProcBeg_valueChanged(int nBeg);
00073 void on_peProcEnd_valueChanged(int nEnd);
00074 void on_peProcCombining_activated(int nMethod);
00075 void on_peProcSmoothWidth_valueChanged(int nWidth);
00076 void on_peProcDrift_valueChanged(double dfDrift);
00077 void on_peProcDecl_valueChanged(double dfDeclination);
00078 void on_peProcScale_valueChanged(double dfScale);
00079 void on_peProcOffset_valueChanged(double dfOffset);
00080 void recalcPeData();
00081
00082 void on_pecTableAggress_valueChanged(int nAggress);
00083 void on_pecTableFactor_valueChanged(int nFactor);
00084 void on_pecOpenTable_clicked();
00085 void on_pecSaveTable_clicked();
00086 void on_pecGetTable_clicked();
00087 void on_pecPutTable_clicked();
00088 void on_pecVerifyTable_clicked();
00089 void on_pecGenFirmware_activated(int nFirmware);
00090 void on_pecGenWormWheel_valueChanged(int nTeeth);
00091 void on_pecMountQuery_clicked();
00092 void on_pecCalculate_clicked();
00093 void on_pecFit_clicked();
00094 void on_pecGraphOffset_valueChanged(double dfOffset);
00095 void changePecItem(QStandardItem *pItem);
00096
00097 void on_pecProfileOffset_valueChanged(double dfOffset);
00098 void on_pecProfileDrift_valueChanged(double dfDrift);
00099 void on_pecProfileOpen_clicked();
00100 void on_pecProfileSave_clicked();
00101 void on_mcuGuideEast_clicked();
00102 void on_mcuGuideWest_clicked();
00103 void on_mcuStart_clicked();
00104 void on_mcuPause_clicked();
00105 void mcuTimer();
00106
00107 void on_toggleChartPeRaw_toggled(bool bOn);
00108 void on_toggleChartPeProcessed_toggled(bool bOn);
00109 void on_toggleChartPecIdeal_toggled(bool bOn);
00110 void on_toggleChartPecTable_toggled(bool bOn);
00111 void on_toggleChartPecProfile_toggled(bool bOn);
00112
00113 private:
00114 bool mcuCommunicationBegin();
00115 void mcuCommunicationEnd();
00116
00117 bool openPeFile(const QString &qsFileName);
00118
00119 bool openPecFile(const QString &qsFileName);
00120 bool savePecFile(const QString &qsFileName);
00121 void getPecTable();
00122 void putPecTable();
00123 void verifyPecTable();
00124 void calcPecParams();
00125 double getPecPosScale(int nFirmware);
00126 void calcPecTable();
00127 void fitPecTable();
00128 void fillPecModel();
00129
00130 void clearPecProfile();
00131 bool startPecProfile(bool bSetSpeed);
00132 void stopPecProfile();
00133 bool openPecProfileFile(const QString &qsFileName);
00134 bool savePecProfileFile(const QString &qsFileName);
00135
00136 void recalcPeChart();
00137
00138 private:
00139 Ui::MainWindow *m_pUi;
00140 bool m_bEnableTabProfile;
00141 int m_nTabProfileIndex;
00142 QString m_qsTabProfileLabel;
00143 bool m_bEnableMenuMount;
00144 StatusBar *m_pStatusBar;
00145 LogDialog *m_pLog;
00146 SettingsDialog *m_pSettings;
00147 MountDialog *m_pMount;
00148 DataPeMcu m_oPeData;
00149 int m_nPeSampleNum;
00150 double m_dfSiderealDay;
00151 int m_nFirmware;
00152 int m_nWormWheelTeeth;
00153 double m_dfPecPosScale;
00154 PecData m_oPecTable;
00155 enum Dir { east, west, stop };
00156 Dir m_eGuideDir;
00157 QList<PeRawSample> m_lstPecProfile;
00158 QStandardItemModel *m_pPecModel;
00159 QStandardItemModel *m_pPecProfileModel;
00160 QGraphicsScene *m_pPeChart;
00161 QTimer *m_pMcuTimer;
00162 QString m_qsSerialPort;
00163 McuProxy *m_pMcuProxy;
00164 };
00165
00166
00167 #endif // ASPECT_MAINWINDOW_H
00168