You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

315 lines
8.2 KiB
C

/**********************************************************************
* @file FileDialogDirectory.h
* @brief
* @author BaGuijun (baguijun@163.com)
* @date 2024-09-04
*********************************************************************/
#ifndef _FILEDIALOG_H_
#define _FILEDIALOG_H_
#include "GUIDialogAPI.h"
#include "GUIDialogBase.h"
#include "qfiledialog.h"
#include "qtreewidget.h"
#include <QDirModel>
#define CFDPostSelectFilePath "CFDPostSelectFilePath"
namespace Ui {
class FileDialogDirectory;
}
namespace GUI
{
class GUIDialogAPI FileDialogDirectory : public GUIDialogBase
{
Q_OBJECT;
public:
/**
* @brief
* @param parent-,
* @since Version: 1.0.0
**/
FileDialogDirectory(EventOper::ParaWidgetInterfaceOperator* oper, QWidget *parent = nullptr);
/**
* @brief
* @since Version: 1.0.0
**/
~FileDialogDirectory();
/**
* @brief (/)
* @return
* @since Version: 1.0.0
**/
QString getCurrentFullPath();
/**
* @brief
* @param path-
* @return true-,false-
* @since Version: 1.0.0
**/
static bool isGourpFiles(const QString path);
/**
* @brief
* @param filterString-
* @note (*.) plot3D(*.xyz *.x)
* @since Version: 1.0.0
**/
void iniFileFilterType(QString filterString);
/**
* @brief
* @param dirStr-
* @since Version: 1.0.0
**/
void initWin(QString dirStr);
private:
/**
* @brief Ui
* @since Version: 1.0.0
**/
void initUi();
/**
* @brief
* @since Version: 1.0.0
**/
void SetDirectoryForDrives();
/**
* @brief
* @param record
* @since Version: 1.0.0
**/
void openFilePath(bool recordHistory);
/**
* @brief
* @since Version: 1.0.0
**/
void BuildFilePathTree();
/**
* @brief
* @since Version: 1.0.0
**/
void refreshRightView();
/**
* @brief
* @param dirName-
* @since Version: 1.0.0
**/
void GetFileList(QString dirName);
/**
* @brief
* @param filter-
* @return
* @since Version: 1.0.0
**/
QStringList GetFilterFromString(const QString& filter);
/**
* @brief /
* @param curPath-
* @return
* @since Version: 1.0.0
**/
QString appendSlash(QString curPath);
/**
* @brief
* @param fileName-
* @return
* @since Version: 1.0.0
**/
QString GetFileExt(QString fileName);
/**
* @brief
* @param index-
* @return
* @since Version: 1.0.0
**/
QString FindFullFilename(const QModelIndex& index);
/**
* @brief
* @since Version: 1.0.0
**/
void enterDirectory();
/**
* @brief
* @param filter-
* @since Version: 1.0.0
**/
void filterChange(QString filter);
private slots:
;
/**
* @brief
* @since Version: 1.0.0
**/
void onCancelClicked();
/**
* @brief
* @since Version: 1.0.0
**/
void onOkClicked();
/**
* @brief
* @since Version: 1.0.0
**/
void onFilterChange(QString filter);
/**
* @brief
* @since Version: 1.0.0
**/
void onDoubleClickedObject(QTreeWidgetItem* pitem, int column);
/**
* @brief ()
* @param model index
* @since Version: 1.0.0
**/
void pathTreeViewDoubleClick(const QModelIndex&);
/**
* @brief
* @param model index
* @since Version: 1.0.0
**/
void func_PathTreeViewDoubleClick(const QModelIndex& index);
void unix_PathTreeViewDoubleClick(QString itemName);
/**
* @brief
* @since Version: 1.0.0
**/
void onItemSelectionChanged();
/**
* @brief
* @since Version: 1.0.0
**/
void onUpPushButtonClicked();
/**
* @brief 退
* @since Version: 1.0.0
**/
void onBackClicked();
/**
* @brief
* @since Version: 1.0.0
**/
void onFrontClicked();
private:
Ui::FileDialogDirectory* _ui;
/**
* @brief 退
* @brief 退
* @since Version: 1.0.0
**/
QVector<QString> _pathBackVec{};
QVector<QString> _pathFrontVec{};
/**
* @brief
* @since Version: 1.0.0
**/
QString _currentFilePath;
/**
* @brief
* @since Version: 1.0.0
**/
QDirModel* _dirModel;
/**
* @brief "我的文档"
* @brief "桌面"
* @brief Unix
* @since Version: 1.0.0
**/
QString _docPath;
QString _deskTopPath;
QString userPath, rootPath, userName, rootName;
/**
* @brief
* @since Version: 1.0.0
**/
QModelIndex _currentIndex;
/**
* @brief key12 ...datvalue
* @since Version: 1.0.0
**/
QMap<QString, QVector<QString>> _fileGroup;
/**
* @brief ;
* @since Version: 1.0.0
**/
QString _selectionText;
/**
* @brief
* @since Version: 1.0.0
**/
QStringList _filterList;
/**
* @brief
* @since Version: 1.0.0
**/
QTreeWidget* _fileTree;
/**
* @brief
* @since Version: 1.0.0
**/
QTreeWidgetItem* _builtinItem;
/**
* @brief key12@data,valuedat,
* @since Version: 1.0.0
**/
QHash<QString, int> _headFile;
/**
* @brief
* @since Version: 1.0.0
**/
QVector<QString> _fileList;
/**
* @brief QTreeView
* @since Version: 1.0.0
**/
QString _treeWidgetFilename;
/**
* @brief
* @since Version: 1.0.0
**/
const static QString fatherNodeText;
const static QString splitExt;
};
}
#endif