SOLARIS_QT6_DAQ/mainwindow.h

169 lines
3.6 KiB
C
Raw Normal View History

2023-01-25 14:59:48 -05:00
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QWidget>
#include <QMainWindow>
#include <QTabWidget>
#include <QPlainTextEdit>
#include <qdebug.h>
#include <QDateTime>
#include <QScrollBar>
#include <QPushButton>
2023-02-06 15:58:21 -05:00
#include <QComboBox>
2023-02-13 17:56:15 -05:00
#include <QLabel>
#include <QTimer>
2023-02-03 16:58:27 -05:00
#include <QChart>
2023-02-03 17:44:36 -05:00
#include <QLineSeries>
2023-01-25 14:59:48 -05:00
2023-01-25 17:16:14 -05:00
#include <vector>
2023-01-30 18:40:24 -05:00
#include <time.h> // time in nano-sec
2023-01-25 17:16:14 -05:00
2023-01-30 18:40:24 -05:00
#include "ClassDigitizer2Gen.h"
#include "influxdb.h"
#include "manyThread.h"
2023-01-30 18:40:24 -05:00
2023-02-23 16:08:47 -05:00
#include "digiSettingsPanel.h"
#include "scope.h"
2023-01-25 14:59:48 -05:00
const int chromeWindowID = 10485763;
//^#===================================================== MainWindow
2023-01-25 14:59:48 -05:00
class MainWindow : public QMainWindow{
2023-02-03 16:58:27 -05:00
Q_OBJECT
2023-01-25 14:59:48 -05:00
public:
2023-02-03 16:58:27 -05:00
MainWindow(QWidget *parent = nullptr);
~MainWindow();
2023-01-25 14:59:48 -05:00
2023-01-30 18:40:24 -05:00
2023-01-25 14:59:48 -05:00
private slots:
2023-02-03 16:58:27 -05:00
void OpenDigitizers();
void CloseDigitizers();
2023-02-09 18:40:47 -05:00
void OpenScope();
2023-02-03 16:58:27 -05:00
void OpenDigitizersSettings();
2023-01-25 17:16:14 -05:00
void AutoRun();
2023-02-13 15:22:24 -05:00
void OpenScaler();
void SetUpScalar();
void DeleteTriggerLineEdit();
2023-02-13 17:07:26 -05:00
void UpdateScalar();
2023-02-13 15:22:24 -05:00
void ProgramSettingsPanel();
bool LoadProgramSettings();
2023-02-03 16:58:27 -05:00
void SaveProgramSettings();
2023-02-13 15:22:24 -05:00
void DecodeIPList();
2023-02-13 18:40:02 -05:00
void SetupInflux();
void CheckElog();
2023-02-03 16:58:27 -05:00
void OpenDirectory(int id);
2023-02-01 16:38:02 -05:00
void SetupNewExpPanel();
bool LoadExpSettings();
2023-02-03 16:58:27 -05:00
void CreateNewExperiment(const QString newExpName);
void ChangeExperiment(const QString newExpName);
void WriteExpNameSh();
void CreateRawDataFolderAndLink();
2023-01-31 18:59:12 -05:00
void closeEvent(QCloseEvent * event){
if( digiSetting != NULL ) digiSetting->close();
if( scope != NULL ) scope->close();
event->accept();
}
void WriteElog(QString htmlText, QString subject = "", QString category = "", int runNumber = 0);
void AppendElog(QString appendHtmlText, int screenID = -1);
2023-01-25 14:59:48 -05:00
signals :
private:
2023-01-30 18:40:24 -05:00
2023-02-03 16:58:27 -05:00
QPushButton * bnProgramSettings;
QPushButton * bnNewExp;
QLineEdit * leExpName;
QPushButton * bnOpenDigitizers;
QPushButton * bnCloseDigitizers;
QPushButton * bnDigiSettings;
QPushButton * bnSOLSettings;
//@--- new scope
Scope * scope;
2023-02-03 16:58:27 -05:00
QPushButton * bnOpenScope;
2023-02-13 15:22:24 -05:00
//@----- scalar;
2023-02-22 12:48:54 -05:00
QMainWindow * scalar;
QPushButton * bnOpenScalar;
QLineEdit *** leTrigger; // need to delete manually
QLineEdit *** leAccept; // need to delete manually
QGridLayout * scalarLayout;
2023-02-13 17:07:26 -05:00
ScalarThread * scalarThread;
2023-02-22 12:48:54 -05:00
QLabel * lbLastUpdateTime;
QLabel * lbScalarACQStatus;
InfluxDB * influx;
2023-02-13 15:22:24 -05:00
2023-02-06 15:58:21 -05:00
//@------ ACQ things
2023-02-03 16:58:27 -05:00
QPushButton * bnStartACQ;
QPushButton * bnStopACQ;
2023-02-13 17:56:15 -05:00
QCheckBox * chkSaveRun;
QComboBox * cbAutoRun;
2023-02-03 16:58:27 -05:00
QLineEdit * leRunID;
QLineEdit * leRawDataPath;
2023-02-14 18:44:10 -05:00
QLineEdit * leRunComment;
2023-02-13 15:22:24 -05:00
ReadDataThread ** readDataThread;
void StartACQ();
void StopACQ();
2023-02-14 18:44:10 -05:00
QString startComment;
QString stopComment;
2023-02-03 16:58:27 -05:00
2023-02-23 16:08:47 -05:00
DigiSettingsPanel * digiSetting;
2023-02-03 16:58:27 -05:00
QPlainTextEdit * logInfo;
static Digitizer2Gen ** digi;
unsigned short nDigi;
void LogMsg(QString msg);
bool logMsgHTMLMode = true;
//---------------- Program settings
QLineEdit * lSaveSettingPath; // only live in ProgramSettigns()
QLineEdit * lAnalysisPath; // only live in ProgramSettigns()
QLineEdit * lDataPath; // only live in ProgramSettigns()
QLineEdit * lIPDomain;
QLineEdit * lDatbaseIP;
QLineEdit * lDatbaseName;
QLineEdit * lElogIP;
QString settingFilePath;
QString analysisPath;
QString dataPath;
QString IPListStr;
QStringList IPList;
QString DatabaseIP;
QString DatabaseName;
QString ElogIP;
//------------- experiment settings
bool isGitExist;
bool useGit;
QString expName;
QString rawDataFolder;
int runID;
2023-02-14 17:39:49 -05:00
QString runIDStr;
int elogID; // 0 = ready, -1 = disable, >1 = elogID
QTimer * runTimer;
unsigned int autoRunStartRunID;
2023-01-25 14:59:48 -05:00
};
#endif // MAINWINDOW_H