94 lines
3.3 KiB
C++
94 lines
3.3 KiB
C++
#ifndef MCONVERTER_H
|
|
#define MCONVERTER_H
|
|
|
|
#include <QThread>
|
|
#include <QProcess>
|
|
#include <QJsonArray>
|
|
#include <QJsonObject>
|
|
#include <QJsonDocument>
|
|
#include <QDir>
|
|
#include <QFile>
|
|
#include <QUuid>
|
|
#include <QDateTime>
|
|
#include <QTextDocument>
|
|
#include <quazip.h>
|
|
#include <quazipfile.h>
|
|
#include <quazipfileinfo.h>
|
|
|
|
#define MACRO_CONVERT_WIN_RECT \
|
|
int element_x = jRoot["geometry"]["x"].toDouble();\
|
|
int element_y = jRoot["geometry"]["y"].toDouble();\
|
|
int element_w = jRoot["geometry"]["w"].toDouble();\
|
|
int element_h = jRoot["geometry"]["h"].toDouble();
|
|
|
|
class mConverter : public QThread
|
|
{
|
|
Q_OBJECT
|
|
public:
|
|
explicit mConverter(const QString &name,const QString &strPath,const QString &strPassword, QObject *parent = nullptr);
|
|
int m_usbZipFlag=0;
|
|
protected:
|
|
virtual void run() override;
|
|
|
|
protected:
|
|
void cpyResource();
|
|
void cpySubResource(QString strSourceDir,QString strDestDir);
|
|
void genPackage();
|
|
void zipPackage();
|
|
void compressDirByPassword(QString strZipFileName,QString strSrcDir,QString strPassword);
|
|
void AddDirToZipFile(const QString &path,QuaZip *pZip,QString strRoot,QString strPassword);
|
|
void AddFileToZipFile(const QString &strFile,QString strNewInfoInZip,QuaZip *pZip,QString strPassword);
|
|
|
|
QJsonArray scanProg();
|
|
|
|
protected:
|
|
QJsonObject genProgJson (const QString &pProg);
|
|
QJsonArray genPagesJson(const QString &pProg);
|
|
QJsonObject genPageJson (const QJsonDocument &jPage);
|
|
/////////
|
|
QJsonObject genProgramJson(const QJsonDocument &jProg);
|
|
QJsonArray genLayerJson(const QJsonDocument &jPage);
|
|
QJsonObject convertMultElementWindow (const QJsonObject &json);
|
|
|
|
protected:
|
|
int newResId() { return m_resId++; }
|
|
QString newUuid() { return QUuid::createUuid().toString().remove('{').remove('}'); }
|
|
QString getFileMd5(QString filePath);
|
|
protected:
|
|
QJsonObject convertText (const QJsonObject &json);
|
|
QJsonObject convertPhoto (const QJsonObject &json);
|
|
QJsonObject convertMovie (const QJsonObject &json);
|
|
QJsonObject convertGif (const QJsonObject &json);
|
|
QJsonObject convertDClock (const QJsonObject &json);
|
|
QJsonObject convertDClockNew (const QJsonObject &json);
|
|
QJsonObject convertAClock (const QJsonObject &json);
|
|
QJsonObject convertTemp (const QJsonObject &json);
|
|
QJsonObject convertWeather(const QJsonObject &json);
|
|
QJsonObject convertTimer (const QJsonObject &json);
|
|
QJsonObject convertRss (const QJsonObject &json);
|
|
QJsonObject convertOffice(const QJsonObject &json);
|
|
QJsonObject convertColorText(const QJsonObject &json);
|
|
QJsonObject convertWindow (const QJsonObject &json,QJsonArray &oSource);
|
|
void DemoProtcol();
|
|
signals:
|
|
void sProgress(QString, int, bool = false);
|
|
void sigConvertTimerOut();
|
|
public slots:
|
|
|
|
private:
|
|
QString m_nProg;
|
|
QString m_nConv;
|
|
QString m_strProgramItemPath;
|
|
QString m_pProg;
|
|
QString m_pZipProg;
|
|
QString m_pConv;
|
|
QString m_strCurPagePath;
|
|
QJsonDocument m_jProg;
|
|
int m_resId;
|
|
QString m_strPassword="";
|
|
QString makeColorString(const QColor &color, const QString type);
|
|
// void compressDirByPassword(QString strZipFileName,QString strSrcDir,QString strPassword);
|
|
};
|
|
|
|
#endif // MCONVERTER_H
|