2025-06-17 17:20:54 +08:00
|
|
|
#ifndef FILECONTROL_H
|
2025-06-15 14:31:54 +08:00
|
|
|
#define FILECONTROL_H
|
|
|
|
|
|
|
|
|
|
#include <ClientCore.h>
|
2025-06-18 15:10:28 +08:00
|
|
|
#include <FileTrans.h>
|
2025-06-15 14:31:54 +08:00
|
|
|
#include <InfoDirFile.h>
|
2025-06-28 23:48:15 +08:00
|
|
|
#include <QDialogButtonBox>
|
2025-06-25 10:54:04 +08:00
|
|
|
#include <QMenu>
|
|
|
|
|
#include <QMutex>
|
2025-06-15 14:31:54 +08:00
|
|
|
#include <QWidget>
|
|
|
|
|
#include <Util.h>
|
2025-06-28 22:53:42 +08:00
|
|
|
#include <map>
|
2025-06-28 23:48:15 +08:00
|
|
|
#include <memory>
|
2025-06-15 14:31:54 +08:00
|
|
|
|
|
|
|
|
namespace Ui {
|
|
|
|
|
class FileManager;
|
|
|
|
|
}
|
|
|
|
|
|
2025-06-28 22:53:42 +08:00
|
|
|
enum class SortMethod {
|
|
|
|
|
SMD_BY_NAME_ASC,
|
|
|
|
|
SMD_BY_NAME_DESC,
|
|
|
|
|
SMD_BY_TIME_DESC,
|
|
|
|
|
SMD_BY_TIME_ASC,
|
|
|
|
|
SMD_BY_TYPE_DESC,
|
|
|
|
|
SMD_BY_TYPE_ASC,
|
|
|
|
|
SMD_BY_SIZE_DESC,
|
|
|
|
|
SMD_BY_SIZE_ASC,
|
|
|
|
|
};
|
|
|
|
|
|
2025-06-15 14:31:54 +08:00
|
|
|
class FileManager : public QWidget
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
explicit FileManager(QWidget* parent = nullptr);
|
|
|
|
|
~FileManager();
|
|
|
|
|
|
|
|
|
|
public:
|
2025-06-20 16:00:18 +08:00
|
|
|
QString GetRoot();
|
2025-06-30 01:05:28 +08:00
|
|
|
void SetUiCurrentPath(const QString& path);
|
2025-06-15 14:31:54 +08:00
|
|
|
void SetModeStr(const QString& modeStr, int type = 0, ClientCore* clientCore = nullptr);
|
|
|
|
|
|
2025-06-18 15:10:28 +08:00
|
|
|
signals:
|
|
|
|
|
void sigSendTasks(const QVector<TransTask>& tasks);
|
|
|
|
|
|
2025-06-15 14:31:54 +08:00
|
|
|
private:
|
|
|
|
|
void InitControl();
|
2025-06-28 23:48:15 +08:00
|
|
|
void InitMenu();
|
2025-11-11 08:52:09 +08:00
|
|
|
void ShowPath(const QString& path, const QVector<QString>& drivers);
|
2025-06-15 14:31:54 +08:00
|
|
|
void ShowFile(const DirFileInfoVec& info);
|
|
|
|
|
void doubleClick(int row, int column);
|
2025-06-20 16:00:18 +08:00
|
|
|
void SetRoot(const QString& path);
|
2025-06-28 22:53:42 +08:00
|
|
|
void SortFileInfo(SortMethod method);
|
|
|
|
|
void HeaderClicked(int column);
|
2025-11-11 08:52:09 +08:00
|
|
|
void FilterFile(const QVector<QString>& selectedTypes);
|
2025-06-28 23:48:15 +08:00
|
|
|
void GenFilter();
|
|
|
|
|
void ShowFilterForm();
|
2025-06-29 00:13:35 +08:00
|
|
|
void CopyFullPath();
|
2025-11-11 22:57:38 +08:00
|
|
|
void ShowProperties();
|
2025-11-15 21:54:46 +08:00
|
|
|
void UpDown();
|
2025-11-15 23:48:30 +08:00
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
void OperNewFolder();
|
|
|
|
|
void OperDelete();
|
|
|
|
|
void OperRename();
|
|
|
|
|
void WaitMsg();
|
2025-06-15 14:31:54 +08:00
|
|
|
|
2025-06-26 00:19:45 +08:00
|
|
|
public slots:
|
2025-06-15 14:31:54 +08:00
|
|
|
void evtHome();
|
|
|
|
|
void evtFile();
|
|
|
|
|
void evtUp();
|
2025-06-28 22:53:42 +08:00
|
|
|
void RefreshTab();
|
2025-06-15 14:31:54 +08:00
|
|
|
|
|
|
|
|
private:
|
2025-06-20 16:00:18 +08:00
|
|
|
bool isRemote_;
|
2025-06-15 14:31:54 +08:00
|
|
|
Ui::FileManager* ui;
|
2025-06-18 10:36:19 +08:00
|
|
|
QMenu* menu_;
|
2025-06-18 14:53:56 +08:00
|
|
|
ClientCore* cliCore_;
|
2025-06-19 15:37:39 +08:00
|
|
|
QMutex cbMut_;
|
|
|
|
|
QMutex tbMut_;
|
2025-11-16 16:43:40 +08:00
|
|
|
bool userScrol_{};
|
2025-11-11 08:52:09 +08:00
|
|
|
QVector<QString> drivers_;
|
2025-06-28 23:48:15 +08:00
|
|
|
QSet<QString> fileTypes_;
|
|
|
|
|
QSet<QString> curSelectTypes_;
|
2025-06-28 22:53:42 +08:00
|
|
|
DirFileInfoVec currentInfo_;
|
2025-06-28 23:48:15 +08:00
|
|
|
DirFileInfoVec currentShowInfo_;
|
2025-06-28 22:53:42 +08:00
|
|
|
std::map<int, SortMethod> sortMedRecord_;
|
2025-06-15 14:31:54 +08:00
|
|
|
std::shared_ptr<DirFileHelper> fileHelper_;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
#endif // FILECONTROL_H
|