FluentUI/src/FluTools.h

56 lines
1.8 KiB
C
Raw Normal View History

2023-05-22 16:17:51 +08:00
#ifndef FLUTOOLS_H
2023-04-27 17:29:39 +08:00
#define FLUTOOLS_H
#include <QObject>
2023-05-12 19:26:49 +08:00
#include <QFile>
2023-08-24 15:50:37 +08:00
#include <QColor>
2023-04-27 17:29:39 +08:00
#include <QtQml/qqml.h>
2023-09-13 15:11:22 +08:00
#include "singleton.h"
2023-04-27 17:29:39 +08:00
/**
* @brief The FluTools class
*/
class FluTools : public QObject
{
Q_OBJECT
QML_NAMED_ELEMENT(FluTools)
QML_SINGLETON
2023-05-11 18:24:58 +08:00
private:
2023-04-27 17:29:39 +08:00
explicit FluTools(QObject *parent = nullptr);
2023-05-11 18:24:58 +08:00
public:
2023-09-13 15:11:22 +08:00
SINGLETONG(FluTools)
static FluTools *create(QQmlEngine *qmlEngine, QJSEngine *jsEngine){return getInstance();}
2023-07-24 18:23:26 +08:00
Q_INVOKABLE int qtMajor();
Q_INVOKABLE int qtMinor();
Q_INVOKABLE bool isMacos();
Q_INVOKABLE bool isLinux();
Q_INVOKABLE bool isWin();
2023-04-27 17:29:39 +08:00
Q_INVOKABLE void clipText(const QString& text);
Q_INVOKABLE QString uuid();
2023-07-24 18:23:26 +08:00
Q_INVOKABLE QString readFile(const QString& fileName);
2023-05-31 15:39:59 +08:00
Q_INVOKABLE void setQuitOnLastWindowClosed(bool val);
2023-06-26 18:12:58 +08:00
Q_INVOKABLE void setOverrideCursor(Qt::CursorShape shape);
Q_INVOKABLE void restoreOverrideCursor();
2023-08-10 16:08:27 +08:00
Q_INVOKABLE QString html2PlantText(const QString& html);
2023-07-24 18:23:26 +08:00
Q_INVOKABLE QString toLocalPath(const QUrl& url);
2023-06-28 02:28:34 +08:00
Q_INVOKABLE void deleteItem(QObject *p);
2023-08-17 17:14:31 +08:00
Q_INVOKABLE QString getFileNameByUrl(const QUrl& url);
Q_INVOKABLE QRect getVirtualGeometry();
2023-08-17 23:03:00 +08:00
Q_INVOKABLE QString getApplicationDirPath();
2023-08-18 19:17:45 +08:00
Q_INVOKABLE QUrl getUrlByFilePath(const QString& path);
2023-08-24 15:50:37 +08:00
Q_INVOKABLE QColor colorAlpha(const QColor&,qreal alpha);
2023-09-04 18:37:55 +08:00
Q_INVOKABLE QString md5(QString text);
2023-09-05 16:48:04 +08:00
Q_INVOKABLE QString sha256(QString text);
2023-09-04 18:37:55 +08:00
Q_INVOKABLE QString toBase64(QString text);
Q_INVOKABLE QString fromBase64(QString text);
Q_INVOKABLE bool removeDir(QString dirPath);
2023-09-06 14:05:29 +08:00
Q_INVOKABLE bool removeFile(QString filePath);
Q_INVOKABLE void showFileInFolder(QString path);
2023-09-17 20:36:33 +08:00
Q_INVOKABLE bool isSoftware();
2023-09-21 18:29:09 +08:00
Q_INVOKABLE qint64 currentTimestamp();
2023-09-19 00:31:49 +08:00
Q_INVOKABLE QPoint cursorPos();
2023-12-13 18:13:35 +08:00
Q_INVOKABLE QIcon windowIcon();
2023-04-27 17:29:39 +08:00
};
#endif // FLUTOOLS_H