code_production/app/HGProductionTool/mainwindow.h

112 lines
2.8 KiB
C++

#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include "form_texttips.h"
#include "form_burnmode.h"
#include "form_maininterface.h"
#include <QtWidgets>
#include <QSplitter>
#include "sane/sane_ex.h"
#include "base/HGLock.h"
#include "hgscanner.h"
#include "dialog_login.h"
QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; }
QT_END_NAMESPACE
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
MainWindow(const QString &accountName, Dialog_logIn::DeviceType deviceType, const QString &deviceConfig,
Dialog_logIn::LogInType loginType, QWidget *parent = nullptr);
~MainWindow();
bool isExitApp();
void updateSplitter();
Form_mainInterface* FindInterface(const QString &sn);
Form_mainInterface* FindInterfaceByDevName(const QString &devName);
Form_mainInterface* FindInterface(SANE_Handle handle);
bool AddInterface(Form_mainInterface * mainInterface);
bool RemoveInterface(Form_mainInterface *mainInterface);
void updateActionStatus(bool enable);
void addTestingRef();
void releaseTesting();
void initTestingRef();
bool isTesting();
QString getDevSn(SANE_Handle handle);
protected:
void closeEvent(QCloseEvent *event);
private:
static int sane_ex_callback(SANE_Handle hdev, int code, void* data, unsigned int* len, void* param);
std::vector<std::string> getDevices();
QString getDevType(SANE_Handle handle);
QString getDevFwNum(SANE_Handle handle);
struct SaneParams
{
SANE_Handle hdev;
int code;
void *data;
unsigned int len;
};
signals:
void sane_dev_arrive(QString devName);
void sane_dev_remove(QString devName);
void sane_create_interface(SaneParams *saneParams);
private slots:
void on_sane_dev_arrive(QString devName);
void on_sane_dev_remove(QString devName);
void on_sane_create_interface(SaneParams *saneParams);
void on_burnmode_refresh_clicked();
void on_burnmode_ok_clicked();
private slots:
void on_act_manage_triggered();
void on_act_changePwd_triggered();
void on_act_logOut_triggered();
void on_act_close_triggered();
void on_act_upload_triggered();
void on_act_refreshDevice_triggered();
void on_act_openLog_triggered();
void on_act_about_triggered();
private:
QSplitter *m_top_splitter;
QSplitter *m_bot_splitter;
bool m_isLogOut;
private:
Ui::MainWindow *ui;
HGLock m_lock;
int m_testingRef;
QString m_accountName;
Dialog_logIn::DeviceType m_deviceType;
QString m_deviceConfig;
Dialog_logIn::LogInType m_loginType;
class QDialog *m_burnDlg;
Form_BurnMode *m_burnForm;
class Dialog_InputSerialNum *m_inputSnDlg;
Form_BurnMode *m_formBurnMode;
public:
QString m_tmpDevType;
};
#endif // MAINWINDOW_H