2022-08-25 18:37:24 +08:00
|
|
|
#ifndef TOOLS_H
|
|
|
|
#define TOOLS_H
|
|
|
|
|
2023-04-18 14:14:46 +08:00
|
|
|
#include "program/progitem.h"
|
2023-09-19 11:49:20 +08:00
|
|
|
#include "gutil/qjson.h"
|
2022-08-25 18:37:24 +08:00
|
|
|
#include <QApplication>
|
|
|
|
#include <QBrush>
|
|
|
|
#include <QColor>
|
|
|
|
#include <QTimer>
|
|
|
|
#include <QPushButton>
|
|
|
|
#include <QFileDialog>
|
|
|
|
#include <QImageReader>
|
|
|
|
#include <QTextEdit>
|
|
|
|
#include <QNetworkAccessManager>
|
2023-04-18 14:14:46 +08:00
|
|
|
|
2022-08-25 18:37:24 +08:00
|
|
|
extern QTextEdit *gFdResInfo;
|
2022-10-27 15:07:45 +08:00
|
|
|
extern ProgItem *gProgItem;
|
2022-08-25 18:37:24 +08:00
|
|
|
|
|
|
|
class Tools : public QObject {
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
static QNetworkAccessManager &netManager() {
|
|
|
|
static QNetworkAccessManager manager;
|
|
|
|
return manager;
|
|
|
|
};
|
2023-05-17 18:19:20 +08:00
|
|
|
static QRect centerRect(qreal, qreal, int, int);
|
2022-08-25 18:37:24 +08:00
|
|
|
static QString addSufix(QString);
|
|
|
|
static QString readErrStr(QImageReader::ImageReaderError);
|
|
|
|
static QString fileMd5(QString);
|
2024-02-21 18:08:50 +08:00
|
|
|
static QString saveImg(const QString&, const QFontMetrics&, const QFont&, const QColor&, const QString&);
|
2023-09-19 11:49:20 +08:00
|
|
|
static void saveImg(const QString&, const QFontMetrics&, const QFont&, const QColor&, JObj&, const QString&, const QString&);
|
|
|
|
static void saveImg2(const QString&, const QFontMetrics&, const QFont&, const QColor&, JArray&, const QString&, const QString&);
|
2022-08-25 18:37:24 +08:00
|
|
|
static QColor int2Color(int value);
|
|
|
|
static int color2Int(const QColor& color);
|
|
|
|
static QBrush getBrush(const QColor& color);
|
|
|
|
static QString selectStr(bool f, const QString &s0, const QString &s1 = "");
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // TOOLS_H
|