pro:初步添加属性窗口。
This commit is contained in:
@@ -28,6 +28,7 @@ Control/cpTableWidget.h Control/cpTableWidget.cpp
|
||||
GuiUtil/Config.h GuiUtil/Config.cpp
|
||||
../Res/qss.qrc Form/Loading.h Form/Loading.cpp
|
||||
Control/Common.h Control/Common.cpp
|
||||
Form/FileInfoForm.h Form/FileInfoForm.cpp Form/FileInfoForm.ui
|
||||
)
|
||||
|
||||
if(${QT_VERSION_MAJOR} GREATER_EQUAL 6)
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#include <QListWidget>
|
||||
#include <QTableWidgetItem>
|
||||
#include <RemoteFile.h>
|
||||
#include "Form/FileInfoForm.h"
|
||||
|
||||
#include "GuiUtil/Public.h"
|
||||
#include "ui_FileControl.h"
|
||||
@@ -106,6 +107,7 @@ void FileManager::InitMenu()
|
||||
menu_ = new QMenu(ui->tableWidget);
|
||||
menu_->addAction(tr("过滤器"), this, &FileManager::ShowFilterForm);
|
||||
menu_->addAction(tr("复制文件路径"), this, &FileManager::CopyFullPath);
|
||||
menu_->addAction(tr("属性"), this, &FileManager::ShowProperties);
|
||||
menu_->addSeparator();
|
||||
}
|
||||
|
||||
@@ -452,6 +454,23 @@ void FileManager::CopyFullPath()
|
||||
}
|
||||
}
|
||||
|
||||
void FileManager::ShowProperties()
|
||||
{
|
||||
int row = ui->tableWidget->currentRow();
|
||||
if (row < 0) {
|
||||
return;
|
||||
}
|
||||
auto* info = new FileInfo(this);
|
||||
|
||||
info->baseName_ = ui->tableWidget->item(row, 1)->text();
|
||||
info->dirName_ = isRemote_ ? GlobalData::Ins()->GetRemoteRoot() : GlobalData::Ins()->GetLocalRoot();
|
||||
info->fileTime_ = ui->tableWidget->item(row, 2)->text();
|
||||
info->fileType_ = ui->tableWidget->item(row, 3)->text();
|
||||
info->fileSize_ = ui->tableWidget->item(row, 4)->text();
|
||||
|
||||
info->exec();
|
||||
}
|
||||
|
||||
QString FileManager::GetRoot()
|
||||
{
|
||||
if (isRemote_) {
|
||||
|
||||
@@ -56,6 +56,7 @@ private:
|
||||
void GenFilter();
|
||||
void ShowFilterForm();
|
||||
void CopyFullPath();
|
||||
void ShowProperties();
|
||||
|
||||
public slots:
|
||||
void evtHome();
|
||||
|
||||
31
Gui/Form/FileInfoForm.cpp
Normal file
31
Gui/Form/FileInfoForm.cpp
Normal file
@@ -0,0 +1,31 @@
|
||||
#include "FileInfoForm.h"
|
||||
|
||||
#include "ui_FileInfoForm.h"
|
||||
|
||||
FileInfo::FileInfo(QWidget* parent) : QDialog(parent), ui(new Ui::FileInfo)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
InitControl();
|
||||
setWindowTitle(tr("属性"));
|
||||
}
|
||||
|
||||
FileInfo::~FileInfo()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
int FileInfo::exec()
|
||||
{
|
||||
ui->pedDir->setPlainText(dirName_);
|
||||
ui->pedName->setPlainText(baseName_);
|
||||
ui->lbSize->setText(fileSize_);
|
||||
ui->lbTime->setText(fileTime_);
|
||||
ui->lbType->setText(fileType_);
|
||||
return QDialog::exec();
|
||||
}
|
||||
|
||||
void FileInfo::InitControl()
|
||||
{
|
||||
ui->pedDir->setReadOnly(true);
|
||||
ui->pedName->setReadOnly(true);
|
||||
}
|
||||
34
Gui/Form/FileInfoForm.h
Normal file
34
Gui/Form/FileInfoForm.h
Normal file
@@ -0,0 +1,34 @@
|
||||
#ifndef FILEINFOFORM_H
|
||||
#define FILEINFOFORM_H
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
namespace Ui {
|
||||
class FileInfo;
|
||||
}
|
||||
|
||||
class FileInfo : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit FileInfo(QWidget* parent = nullptr);
|
||||
~FileInfo();
|
||||
|
||||
int exec() override;
|
||||
|
||||
public:
|
||||
QString baseName_;
|
||||
QString dirName_;
|
||||
QString fileType_;
|
||||
QString fileTime_;
|
||||
QString fileSize_;
|
||||
|
||||
private:
|
||||
void InitControl();
|
||||
|
||||
private:
|
||||
Ui::FileInfo* ui;
|
||||
};
|
||||
|
||||
#endif // FILEINFOFORM_H
|
||||
148
Gui/Form/FileInfoForm.ui
Normal file
148
Gui/Form/FileInfoForm.ui
Normal file
@@ -0,0 +1,148 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>FileInfo</class>
|
||||
<widget class="QDialog" name="FileInfo">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>544</width>
|
||||
<height>300</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Dialog</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>类型:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="lbType">
|
||||
<property name="text">
|
||||
<string>TYPE</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Orientation::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="lbTime">
|
||||
<property name="text">
|
||||
<string>TIME</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>名称:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Orientation::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="lbSize">
|
||||
<property name="text">
|
||||
<string>SIZE</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPlainTextEdit" name="pedName"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>目录:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPlainTextEdit" name="pedDir"/>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Orientation::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="btnCopyFileName">
|
||||
<property name="text">
|
||||
<string>复制文件名</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="btnCopyDirPath">
|
||||
<property name="text">
|
||||
<string>复制目录</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="btnCopyFull">
|
||||
<property name="text">
|
||||
<string>复制全路径</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="btnClose">
|
||||
<property name="text">
|
||||
<string>关闭</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
Reference in New Issue
Block a user