Files
frelay/Util/Util.h

43 lines
1.1 KiB
C
Raw Normal View History

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>
#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-14 23:25:16 +08:00
static void ConsoleMsgHander(QtMsgType type, const QMessageLogContext& context, const QString& msg);
};
class DirFileHelper : public QObject
{
2025-06-15 23:13:30 +08:00
Q_OBJECT
2025-06-15 14:31:54 +08:00
public:
DirFileHelper() = default;
virtual ~DirFileHelper() = default;
public:
QString GetErr() const;
void registerPathCall(const std::function<void(const QString& path)>& call);
void registerFileCall(const std::function<void(const DirFileInfoVec& vec)>& call);
protected:
QString err_;
std::function<void(const QString& path)> pathCall_;
std::function<void(const DirFileInfoVec& info)> fileCall_;
public:
virtual bool GetHome() = 0;
virtual bool GetDirFile(const QString& dir) = 0;
};
2025-06-14 23:25:16 +08:00
#endif // UTIL_H