#ifndef TOOLS_H #define TOOLS_H #include "program/progitem.h" #include "gutil/qjson.h" #include #include #include #include #include #include #include #include #include extern QTextEdit *gFdResInfo; extern ProgItem *gProgItem; class Tools : public QObject { Q_OBJECT public: static QNetworkAccessManager &netManager() { static QNetworkAccessManager manager; return manager; }; static QRect centerRect(qreal, qreal, int, int); static QString addSufix(QString); static QString readErrStr(QImageReader::ImageReaderError); static QString fileMd5(QString); static QString saveImg(const QString&, const QFontMetrics&, const QFont&, const QColor&, const QString&); 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&); 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