1
0
Fork 0
mirror of https://github.com/eliboa/TegraRcmGUI.git synced 2024-12-01 06:32:05 +00:00
TegraRcmGUI/tegrarcmgui.h

85 lines
2.6 KiB
C
Raw Normal View History

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"
#include "kourou/kourou.h"
#include "kourou/usb_command.h"
#include "qkourou.h"
class QPayloadWidget;
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;
bool enableWidget(QWidget *widget, bool enable);
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;
bool m_ready = false;
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-24 19:30:39 +01:00
#endif // TEGRARCMGUI_H