qt/LedOK/wProgramManager/wprogramitem.h

91 lines
3.2 KiB
C
Raw Normal View History

2022-01-04 18:11:48 +08:00
#ifndef WPROGRAMITEM_H
#define WPROGRAMITEM_H
#include <QObject>
#include <QTreeWidget>
#include <QTreeWidgetItem>
#include <QDir>
#include <QDateTime>
#include <QJsonObject>
#include <QJsonDocument>
#include <QPushButton>
2022-08-25 18:37:24 +08:00
#include <base/loqtreewidget.h>
2022-01-04 18:11:48 +08:00
2022-08-25 18:37:24 +08:00
class wProgramItem : public QObject, public QTreeWidgetItem{
2022-01-04 18:11:48 +08:00
Q_OBJECT
Q_PROPERTY(QString name MEMBER m_name READ name WRITE setName NOTIFY nameChanged )
Q_PROPERTY(int width MEMBER m_width READ width WRITE setWidth NOTIFY widthChanged )
Q_PROPERTY(int height MEMBER m_height READ height WRITE setHeight NOTIFY heightChanged )
Q_PROPERTY(QString remarks MEMBER m_remarks READ remarks WRITE setRemarks NOTIFY remarksChanged)
Q_PROPERTY(int fsize MEMBER m_fsize READ fsize WRITE setFsize NOTIFY fsizeChanged )
Q_PROPERTY(QDateTime last MEMBER m_last READ last WRITE setLast NOTIFY lastChanged )
public:
explicit wProgramItem(const QString &pRoot, const QString &name, int w, int h, const QString & remarks, LoQTreeWidget *parent = nullptr,QWidget *pWnd=nullptr);
explicit wProgramItem(const QString &pRoot, const QJsonObject &json, LoQTreeWidget *parent = nullptr,QWidget *pWnd=nullptr);
void save();
void del();
QJsonObject jRoot();
void refreshLable();
QString name() const { return m_name; }
int width() const { return m_width; }
int height() const { return m_height; }
QString remarks() const { return m_remarks; }
2022-08-25 18:37:24 +08:00
qint64 fsize() const { return m_fsize; }
2022-01-04 18:11:48 +08:00
QDateTime last() const { return m_last; }
void setName(const QString &s) { m_name = s; }
void setWidth(int w) { m_width = w; }
void setHeight(int h) { m_height = h; }
void setRemarks(const QString &s) { m_remarks = s; }
2022-08-25 18:37:24 +08:00
void setFsize(qint64 n) { m_fsize = n; }
2022-01-04 18:11:48 +08:00
void setLast(const QDateTime &s) { m_last = s; }
QString GetBnName();
2022-08-25 18:37:24 +08:00
2022-01-04 18:11:48 +08:00
signals:
void nameChanged(const QString &);
void widthChanged(int);
void heightChanged(int);
void remarksChanged(const QString &);
void fsizeChanged(quint64);
void lastChanged(const QDateTime &);
void sigEditProgram();
protected slots:
void onSetProgram();
void onEditProgram();
void onSendProgram();
void onUsbExportProgram();
void onUsbExportProgramPro(QString strPath,QString strPassword);
2022-08-25 18:37:24 +08:00
2022-01-04 18:11:48 +08:00
private:
2022-08-25 18:37:24 +08:00
void init();
QPushButton *m_bnExport;
QPushButton *m_bnSend;
2022-01-04 18:11:48 +08:00
QString m_name;
int m_width;
int m_height;
QString m_remarks;
qint64 m_fsize;
QDateTime m_last;
LoQTreeWidget *m_parent;
QPushButton *m_bnName;
QString m_strSavePath;
2022-08-25 18:37:24 +08:00
QString mProgDir;
2022-01-04 18:11:48 +08:00
QString m_orgName;
QWidget *m_pWnd=nullptr;
};
enum ENUM_PROGRAMLISTHEADERITEM
{
ENUM_PROGRAMLISTHEADERITEM_CHECK=0,
ENUM_PROGRAMLISTHEADERITEM_NAME,
ENUM_PROGRAMLISTHEADERITEM_RESOLUTION,
ENUM_PROGRAMLISTHEADERITEM_SIZE,
ENUM_PROGRAMLISTHEADERITEM_LASTTIME,
ENUM_PROGRAMLISTHEADERITEM_USB_EXPORT,
ENUM_PROGRAMLISTHEADERITEM_SEND,
ENUM_PROGRAMLISTHEADERITEM_END
};
#endif // WPROGRAMITEM_H