gui: add basic gui code.

This commit is contained in:
2025-06-15 14:31:54 +08:00
parent 72df3216a5
commit 7d123b2c06
40 changed files with 1483 additions and 12 deletions

View File

@@ -12,6 +12,6 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Core)
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Core)
add_library(Util STATIC Util.h Util.cpp)
target_link_libraries(Util PRIVATE Qt${QT_VERSION_MAJOR}::Core)
add_library(Util STATIC Util.h Util.cpp LocalFile.h LocalFile.cpp)
target_link_libraries(Util PRIVATE Qt${QT_VERSION_MAJOR}::Core Struct)
target_include_directories(Util PUBLIC ${CMAKE_CURRENT_LIST_DIR})

16
Util/LocalFile.cpp Normal file
View File

@@ -0,0 +1,16 @@
#include "LocalFile.h"
bool LocalFile::GetHome()
{
return false;
}
bool LocalFile::GetDirFile(const QString& dir)
{
return false;
}
bool LocalFile::GetDirFile(const QString& dir, DirFileInfoVec& vec)
{
return false;
}

20
Util/LocalFile.h Normal file
View File

@@ -0,0 +1,20 @@
#ifndef LOCALFILE_H
#define LOCALFILE_H
#include <InfoDirFile.h>
#include "Util.h"
class LocalFile : public DirFileHelper
{
public:
LocalFile() = default;
~LocalFile() override = default;
public:
bool GetHome() override;
bool GetDirFile(const QString& dir) override;
bool GetDirFile(const QString& dir, DirFileInfoVec& vec);
};
#endif // LOCALFILE_H

View File

@@ -58,3 +58,16 @@ void Util::ConsoleMsgHander(QtMsgType type, const QMessageLogContext& context, c
break;
}
}
QString DirFileHelper::GetErr() const
{
return QString();
}
void DirFileHelper::registerPathCall(const std::function<void(const QString& path)>& call)
{
}
void DirFileHelper::registerFileCall(const std::function<void(const DirFileInfoVec& vec)>& call)
{
}

View File

@@ -2,6 +2,7 @@
#define UTIL_H
#include <QObject>
#include <InfoDirFile.h>
class Util : public QObject
{
@@ -14,4 +15,25 @@ public:
static void ConsoleMsgHander(QtMsgType type, const QMessageLogContext& context, const QString& msg);
};
class DirFileHelper
{
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;
};
#endif // UTIL_H