2020-06-24 19:30:39 +01:00
|
|
|
#ifndef TEGRARCMGUI_H
|
|
|
|
#define TEGRARCMGUI_H
|
|
|
|
#include <QMainWindow>
|
2020-06-24 19:31:54 +01:00
|
|
|
#include <QtWidgets>
|
|
|
|
#include <QSettings>
|
|
|
|
#include <QtConcurrent/QtConcurrent>
|
|
|
|
#include "qpayload.h"
|
|
|
|
#include "qtools.h"
|
2020-06-27 16:51:01 +01:00
|
|
|
#include "qsettings.h"
|
2020-06-24 19:31:54 +01:00
|
|
|
#include "kourou/kourou.h"
|
|
|
|
#include "kourou/usb_command.h"
|
|
|
|
#include "qkourou.h"
|
|
|
|
|
|
|
|
class QPayloadWidget;
|
2020-06-27 16:51:01 +01:00
|
|
|
class qTools;
|
|
|
|
class qSettings;
|
2020-06-24 19:31:54 +01:00
|
|
|
class QKourou;
|
2020-06-24 19:30:39 +01:00
|
|
|
|
|
|
|
QT_BEGIN_NAMESPACE
|
|
|
|
namespace Ui { class TegraRcmGUI; }
|
|
|
|
QT_END_NAMESPACE
|
|
|
|
|
|
|
|
class TegraRcmGUI : public QMainWindow
|
|
|
|
{
|
2020-06-24 19:31:54 +01:00
|
|
|
Q_OBJECT
|
2020-06-24 19:30:39 +01:00
|
|
|
|
2020-06-24 19:31:54 +01:00
|
|
|
static TegraRcmGUI* m_instance;
|
2020-06-24 19:30:39 +01:00
|
|
|
public:
|
|
|
|
TegraRcmGUI(QWidget *parent = nullptr);
|
|
|
|
~TegraRcmGUI();
|
2020-06-24 19:31:54 +01:00
|
|
|
static bool hasInstance() { return m_instance; }
|
|
|
|
static TegraRcmGUI * instance() {
|
|
|
|
if (!m_instance) m_instance = new TegraRcmGUI;
|
|
|
|
return m_instance;
|
|
|
|
}
|
|
|
|
QSettings *userSettings;
|
|
|
|
QSettings *userPayloads;
|
|
|
|
Kourou m_device;
|
|
|
|
QKourou *m_kourou;
|
|
|
|
QPayloadWidget *payloadTab;
|
|
|
|
qTools *toolsTab;
|
2020-06-27 16:51:01 +01:00
|
|
|
qSettings *settingsTab;
|
2020-06-24 19:31:54 +01:00
|
|
|
bool enableWidget(QWidget *widget, bool enable);
|
2020-06-27 16:51:01 +01:00
|
|
|
bool isDeviceInfoAvailable() { return m_deviceInfoAvailable; }
|
2020-06-24 19:31:54 +01:00
|
|
|
|
|
|
|
private slots:
|
|
|
|
void on_deviceInfo_received(UC_DeviceInfo di);
|
|
|
|
void on_autoLaunchAriane_toggled(bool value);
|
|
|
|
void pushTimer();
|
|
|
|
void on_Kourou_finished(int res);
|
|
|
|
void trayIconActivated(QSystemTrayIcon::ActivationReason reason);
|
|
|
|
|
|
|
|
public slots:
|
|
|
|
void hotPlugEvent(bool added, KLST_DEVINFO_HANDLE deviceInfo);
|
|
|
|
void deviceInfoTimer();
|
|
|
|
void error(int error);
|
|
|
|
void on_deviceStateChange();
|
|
|
|
void pushMessage(QString message);
|
|
|
|
|
|
|
|
signals:
|
|
|
|
void sign_hotPlugEvent(bool added, KLST_DEVINFO_HANDLE);
|
2020-06-24 19:30:39 +01:00
|
|
|
|
|
|
|
private:
|
|
|
|
Ui::TegraRcmGUI *ui;
|
2020-06-24 19:31:54 +01:00
|
|
|
KHOT_HANDLE m_hotHandle = nullptr;
|
2020-06-27 16:51:01 +01:00
|
|
|
bool m_deviceInfoAvailable = false;
|
2020-06-24 19:31:54 +01:00
|
|
|
std::string tmp_string;
|
|
|
|
QVector<qint64> push_ts;
|
|
|
|
int tsToDeleteCount = 0;
|
|
|
|
qint64 lastTsToDelete = 0;
|
|
|
|
|
|
|
|
const QIcon switchOnIcon = QIcon(":/res/switch_logo_on.png");
|
|
|
|
const QIcon switchOffIcon = QIcon(":/res/switch_logo_off.png");
|
|
|
|
QSystemTrayIcon *trayIcon;
|
|
|
|
QMenu *trayIconMenu;
|
|
|
|
void drawTrayContextMenu();
|
|
|
|
|
|
|
|
void clearDeviceInfo();
|
2020-06-24 19:30:39 +01:00
|
|
|
};
|
2020-06-24 19:31:54 +01:00
|
|
|
|
|
|
|
const QString statusOnStyleSht( "QFrame{border-radius: 10px; background-color: rgb(0, 150, 136); border-color: rgb(0, 0, 0);}"
|
|
|
|
"QLabel{font: 75 9pt \"Calibri\"; color: rgb(255, 255, 255);}");
|
|
|
|
const QString statusOffStyleSht("QFrame{border-radius: 10px; background-color: rgb(213, 213, 213); border-color: rgb(0, 0, 0);}"
|
|
|
|
"QLabel{font: 75 9pt \"Calibri\"; color: rgb(0, 0, 0);}");
|
|
|
|
const QString statusOffRedStyleSht("QFrame{border-radius: 10px; background-color: rgb(150, 35, 0); border-color: rgb(0, 0, 0);}"
|
|
|
|
"QLabel{font: 75 9pt \"Calibri\"; color: rgb(255, 255, 255);}");
|
|
|
|
|
2020-06-27 16:51:01 +01:00
|
|
|
typedef struct ErrorLabel ErrorLabel;
|
|
|
|
struct ErrorLabel {
|
|
|
|
int error;
|
|
|
|
QString label;
|
|
|
|
};
|
|
|
|
|
|
|
|
static ErrorLabel ErrorLabelArr[] =
|
|
|
|
{
|
|
|
|
{ FAILED_TO_SET_AUTORCM, "Failed to set autoRCM" },
|
|
|
|
};
|
|
|
|
|
2020-06-24 19:30:39 +01:00
|
|
|
#endif // TEGRARCMGUI_H
|