2025-06-17 16:42:39 +08:00
|
|
|
#ifndef UTIL_H
|
2025-06-14 23:25:16 +08:00
|
|
|
#define UTIL_H
|
|
|
|
|
|
2025-06-15 14:31:54 +08:00
|
|
|
#include <InfoDirFile.h>
|
2025-06-19 11:59:32 +08:00
|
|
|
#include <QObject>
|
2025-06-14 23:25:16 +08:00
|
|
|
|
|
|
|
|
class Util : public QObject
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
public:
|
|
|
|
|
Util();
|
|
|
|
|
|
|
|
|
|
public:
|
2025-06-15 23:13:30 +08:00
|
|
|
static QString GetUserHome();
|
2025-06-14 23:25:16 +08:00
|
|
|
static void InitLogger(const QString& logPath, const QString& mark);
|
2025-06-17 16:42:39 +08:00
|
|
|
static QString Get2FilePath(const QString& file, const QString& directory);
|
2025-06-18 14:53:56 +08:00
|
|
|
static QString Join(const QString& path, const QString& name);
|
2025-06-20 10:33:03 +08:00
|
|
|
static QString GetCurConfigPath(const QString& sub);
|
2025-06-14 23:25:16 +08:00
|
|
|
static void ConsoleMsgHander(QtMsgType type, const QMessageLogContext& context, const QString& msg);
|
|
|
|
|
};
|
|
|
|
|
|
2025-06-19 11:59:32 +08:00
|
|
|
class DirFileHelper : public QObject
|
|
|
|
|
{
|
2025-06-15 23:13:30 +08:00
|
|
|
Q_OBJECT
|
2025-06-15 14:31:54 +08:00
|
|
|
public:
|
2025-06-19 15:37:39 +08:00
|
|
|
DirFileHelper(QObject* parent = nullptr);
|
2025-06-15 14:31:54 +08:00
|
|
|
virtual ~DirFileHelper() = default;
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
QString GetErr() const;
|
2025-06-19 15:37:39 +08:00
|
|
|
|
|
|
|
|
signals:
|
|
|
|
|
void sigHome(const QString& path);
|
|
|
|
|
void sigDirFile(const DirFileInfoVec& dirFile);
|
2025-06-15 14:31:54 +08:00
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
QString err_;
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
virtual bool GetHome() = 0;
|
|
|
|
|
virtual bool GetDirFile(const QString& dir) = 0;
|
|
|
|
|
};
|
|
|
|
|
|
2025-06-14 23:25:16 +08:00
|
|
|
#endif // UTIL_H
|