Browse Source

修改readme,创建release

master
tianzhendong 2 years ago
parent
commit
e009765a2b
  1. 3
      .gitignore
  2. 70
      CMakeLists.txt
  3. 52
      README.md
  4. BIN
      assets/img.png
  5. BIN
      assets/img_1.png
  6. BIN
      assets/img_2.png
  7. 1
      resources/app_win32.rc
  8. BIN
      resources/close.png
  9. BIN
      resources/favicon.ico
  10. BIN
      resources/fullscreen3.png
  11. BIN
      resources/fullscreen4.png
  12. 11
      resources/img.qrc
  13. BIN
      resources/min.png
  14. 145
      src/Rename.cpp
  15. 57
      src/Rename.h
  16. 10
      src/main.cpp
  17. 252
      src/widget.cpp
  18. 76
      src/widget.h
  19. 549
      src/widget.ui
  20. BIN
      windeploy/D3Dcompiler_47.dll
  21. BIN
      windeploy/FileRename.exe
  22. BIN
      windeploy/Qt5Core.dll
  23. BIN
      windeploy/Qt5Gui.dll
  24. BIN
      windeploy/Qt5Svg.dll
  25. BIN
      windeploy/Qt5Widgets.dll
  26. BIN
      windeploy/iconengines/qsvgicon.dll
  27. BIN
      windeploy/imageformats/qgif.dll
  28. BIN
      windeploy/imageformats/qicns.dll
  29. BIN
      windeploy/imageformats/qico.dll
  30. BIN
      windeploy/imageformats/qjpeg.dll
  31. BIN
      windeploy/imageformats/qsvg.dll
  32. BIN
      windeploy/imageformats/qtga.dll
  33. BIN
      windeploy/imageformats/qtiff.dll
  34. BIN
      windeploy/imageformats/qwbmp.dll
  35. BIN
      windeploy/imageformats/qwebp.dll
  36. BIN
      windeploy/libEGL.dll
  37. BIN
      windeploy/libGLESv2.dll
  38. BIN
      windeploy/libgcc_s_seh-1.dll
  39. BIN
      windeploy/libstdc++-6.dll
  40. BIN
      windeploy/libwinpthread-1.dll
  41. BIN
      windeploy/opengl32sw.dll
  42. BIN
      windeploy/platforms/qwindows.dll
  43. BIN
      windeploy/styles/qwindowsvistastyle.dll
  44. BIN
      windeploy/translations/qt_ar.qm
  45. BIN
      windeploy/translations/qt_bg.qm
  46. BIN
      windeploy/translations/qt_ca.qm
  47. BIN
      windeploy/translations/qt_cs.qm
  48. BIN
      windeploy/translations/qt_da.qm
  49. BIN
      windeploy/translations/qt_de.qm
  50. BIN
      windeploy/translations/qt_en.qm
  51. BIN
      windeploy/translations/qt_es.qm
  52. BIN
      windeploy/translations/qt_fi.qm
  53. BIN
      windeploy/translations/qt_fr.qm
  54. BIN
      windeploy/translations/qt_gd.qm
  55. BIN
      windeploy/translations/qt_he.qm
  56. BIN
      windeploy/translations/qt_hu.qm
  57. BIN
      windeploy/translations/qt_it.qm
  58. BIN
      windeploy/translations/qt_ja.qm
  59. BIN
      windeploy/translations/qt_ko.qm
  60. BIN
      windeploy/translations/qt_lv.qm
  61. BIN
      windeploy/translations/qt_pl.qm
  62. BIN
      windeploy/translations/qt_ru.qm
  63. BIN
      windeploy/translations/qt_sk.qm
  64. BIN
      windeploy/translations/qt_uk.qm
  65. BIN
      windeploy/translations/qt_zh_TW.qm

3
.gitignore

@ -1,3 +0,0 @@
/cmake-build-debug/
/cmake-build-release/
/.idea/

70
CMakeLists.txt

@ -1,70 +0,0 @@
cmake_minimum_required(VERSION 3.22)
project(FileRename)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_PREFIX_PATH "C:/Qt/Qt5.14.2/5.14.2/mingw73_64")
aux_source_directory(${PROJECT_SOURCE_DIR} DIR_MAIN_SRCS)
aux_source_directory(${PROJECT_SOURCE_DIR}/resources DIR_RESOURCES_SRCS)
aux_source_directory(${PROJECT_SOURCE_DIR}/src DIR_SRC_SRCS)
find_package(Qt5 COMPONENTS
Core
Gui
Widgets
REQUIRED)
# qrc
qt5_add_resources(QRC_FILES resources/img.qrc)
#include_directories(resources
# src)
IF (CMAKE_BUILD_TYPE STREQUAL Debug)
add_executable(${PROJECT_NAME}
resources/app_win32.rc
${DIR_MAIN_SRCS} ${DIR_RESOURCES_SRCS} ${DIR_SRC_SRCS} ${QRC_FILES})
else(CMAKE_BUILD_TYPE STREQUAL Release)
add_executable(${PROJECT_NAME}
WIN32 resources/app_win32.rc
${DIR_MAIN_SRCS} ${DIR_RESOURCES_SRCS} ${DIR_SRC_SRCS} ${QRC_FILES})
ENDIF()
target_link_libraries(${PROJECT_NAME}
Qt5::Core
Qt5::Gui
Qt5::Widgets
)
if (WIN32)
set(DEBUG_SUFFIX)
if (MSVC AND CMAKE_BUILD_TYPE MATCHES "Debug")
set(DEBUG_SUFFIX "d")
endif ()
set(QT_INSTALL_PATH "${CMAKE_PREFIX_PATH}")
if (NOT EXISTS "${QT_INSTALL_PATH}/bin")
set(QT_INSTALL_PATH "${QT_INSTALL_PATH}/..")
if (NOT EXISTS "${QT_INSTALL_PATH}/bin")
set(QT_INSTALL_PATH "${QT_INSTALL_PATH}/..")
endif ()
endif ()
if (EXISTS "${QT_INSTALL_PATH}/plugins/platforms/qwindows${DEBUG_SUFFIX}.dll")
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E make_directory
"$<TARGET_FILE_DIR:${PROJECT_NAME}>/plugins/platforms/")
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy
"${QT_INSTALL_PATH}/plugins/platforms/qwindows${DEBUG_SUFFIX}.dll"
"$<TARGET_FILE_DIR:${PROJECT_NAME}>/plugins/platforms/")
endif ()
foreach (QT_LIB Core Gui Widgets)
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy
"${QT_INSTALL_PATH}/bin/Qt5${QT_LIB}${DEBUG_SUFFIX}.dll"
"$<TARGET_FILE_DIR:${PROJECT_NAME}>")
endforeach (QT_LIB)
endif ()

52
README.md

@ -1,52 +0,0 @@
# 文件重命名工具
![](./assets/img.png)
## 环境
- Clion 2022.1.2
- qt 5.14.2
## 功能
- 单个文件重命名
- 文件夹多个文件重命名
## 模式
### 替换模式
> 将文件名中的旧字符串替换为新字符串
旧字符串为空时,将文件名设置为新字符串
新字符串不能存在为:/\<>?*|
新字符串不能为空
### 时间戳模式
> 将文件名中的UTC时间戳替换为北京时间:年月日时分秒
旧文件名用“-”连接,为:前段名-UTC时间戳.后缀 格式
程序会将UTC时间戳替换为北京时间年月日时分秒格式
新名:前段名-北京时间.后缀
## 重复文件处理
当前文件夹有重复文件时,在新名后加“-旧名”字符串
## 使用
deploy目录下为生成的程序,可以直接使用
### 替换模式
- 输入新旧字符串,选择替换模式,点击确认
- 选择文件或者文件夹
![](./assets/img_2.png)
### 时间戳模式
- 选择时间戳模式,点击确认
- 选择文件或者文件夹
![](./assets/img_1.png)
## 更改日志
### 20220620 v1.0.1
- [x] 新增打开文件目录功能(右下角listwidget支持)
- [x] 新增删除文件功能(右下角listwidget支持)

BIN
assets/img.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

BIN
assets/img_1.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 36 KiB

BIN
assets/img_2.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 38 KiB

1
resources/app_win32.rc

@ -1 +0,0 @@
IDI_ICON1 ICON DISCARDABLE "favicon.ico"

BIN
resources/close.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 342 B

BIN
resources/favicon.ico

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.2 KiB

BIN
resources/fullscreen3.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 352 B

BIN
resources/fullscreen4.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 357 B

11
resources/img.qrc

@ -1,11 +0,0 @@
<RCC>
<qresource prefix="img">
<file>favicon.ico</file>
</qresource>
<qresource prefix="png">
<file>close.png</file>
<file>fullscreen3.png</file>
<file>fullscreen4.png</file>
<file>min.png</file>
</qresource>
</RCC>

BIN
resources/min.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 150 B

145
src/Rename.cpp

@ -1,145 +0,0 @@
//
// Created by 12038 on 2022/6/16.
//
#include <QDateTime>
#include "Rename.h"
#include <QProcess>
Rename::Rename(QObject *) {
}
Rename::~Rename() {
}
void Rename::renameFileSlot(const QString &filePath, const QString &strReplaced, const QString &strNew) {
// filePath.lastIndexOf('/')
renameFile(filePath, strReplaced, strNew);
}
void Rename::renameFile(const QString &filePath, const QString &strReplaced, const QString &strNew) {
QFile file(filePath);
QFileInfo fileInfo(filePath);
qDebug()<<fileInfo.path();
qDebug()<<fileInfo.absolutePath();
qDebug()<<fileInfo.fileName();
qDebug()<<fileInfo.suffix();
qDebug()<<fileInfo.baseName();
QString baseName = fileInfo.baseName();
QString newBaseName = baseName;
QString oldFileName = file.fileName();
qDebug()<< "old:" <<oldFileName;
QString newFileName = oldFileName;
if(renameMethodFlag == "时间戳") {
// if(!baseName.contains("flyrecord")) return "";
QString timeStampStr = baseName.section('-', -1, -1);
QString firstName = baseName.section('-', -2, 0);
qint64 timeStamp = timeStampStr.toLongLong();
qDebug() << "时间戳" << timeStamp;
QDateTime dateTime = QDateTime::fromMSecsSinceEpoch(timeStamp);
if((!dateTime.isValid()) || (timeStamp == 0) || (dateTime > QDateTime::currentDateTime())){
emit newFileNameSignal(tr("时间戳有误"));
return;
};
QString time = dateTime.toString("yyyyMMddhhmmss"); //时间戳非毫秒级
QString time1 = dateTime.toString("yyyy-MM-dd hh:mm:ss");
qDebug() << time1;
newBaseName = firstName + '-' +time;
}
else if(renameMethodFlag == "替换"){
qDebug()<<"mode"<<"替换";
if(!baseName.contains(strReplaced)) {
emit newFileNameSignal("文件名中不存在输入的字符串");
return;
};
if(strNew == ""){
emit newFileNameSignal("新替换的字符串为空");
return;
}
if(strReplaced == "") {
newBaseName = strNew;
}
else{
newBaseName = baseName.replace(strReplaced, strNew);
qDebug()<<"newBaseName:"<<newBaseName;
}
}
dirFiles.clear();
dirFiles = getFiles(fileInfo.absolutePath());
newFileName = fileInfo.absolutePath() + '/' + newBaseName + '.' + fileInfo.suffix();
if(dirFiles.contains(newFileName)){
newFileName = fileInfo.absolutePath() + '/' + newBaseName + '-' + baseName +'.' + fileInfo.suffix();
}
qDebug()<< "new:" <<newFileName;
file.rename(newFileName);
emit newFileNameSignal(newFileName);
}
void Rename::getFilesSlot(const QString &filesDirPath, const QString &strReplaced, const QString &strNew) {
//获取文件夹下所有的文件
QStringList files= this->getFiles(filesDirPath);
// emit oldFileNameSignal(files);
QStringList newFiles;
for (int i = 0; i < files.count(); i++){
QString fileName = files.at(i);
emit oldFileNameSignal(fileName);
renameFile(fileName, strReplaced, strNew);
// emit newFileNameSignal(newFile);
emit process(i + 1, files.count());
}
}
QStringList Rename::getFiles(const QString &filesDirPath) {
QStringList files;
QDir filesDir(filesDirPath);
QList<QFileInfo> fileInfoList = filesDir.entryInfoList(QDir::Files);
for(int i = 0; i < fileInfoList.count(); i++){
QFileInfo fileInfo = fileInfoList.at(i);
if(fileInfo.isDir()){
// QStringList subFiles= getFiles(fileInfo.absoluteFilePath());
// files.append(subFiles);
continue;
}
else{
QString fileName = fileInfo.absoluteFilePath();
files.append(fileName);
}
}
return files;
}
void Rename::checkBoxChangedSlot(int) {
}
void Rename::comboxStateChangedSlot(const QString & text) {
renameMethodFlag = text;
qDebug()<< renameMethodFlag;
}
void Rename::getTextSlot(const QString &text) {
qDebug()<<"widget当前的text为:"<< text;
currentText = text;
}
void Rename::openDirSlot() {
QFileInfo fileInfo(currentText);
QString filePath = fileInfo.absolutePath();
qDebug()<<"filePath"<<filePath;
QString path = filePath.replace("/", "\\");
qDebug()<<"path"<<path;
QProcess::startDetached("explorer " + path);
}
void Rename::delActionTriggeredSlot() {
QFile file(currentText);
qDebug()<<"即将删除:"<<currentText;
emit delActionFeedbackSignal(file.remove());
qDebug()<<"删除成功";
}

57
src/Rename.h

@ -1,57 +0,0 @@
//
// Created by 12038 on 2022/6/16.
//
#ifndef DUPLICATEFILESCHECK_DUPLICATEFILES_H
#define DUPLICATEFILESCHECK_DUPLICATEFILES_H
#include <QObject>
#include <QHash>
#include <QDebug>
#include <QFile>
#include <QCryptographicHash>
#include <QDir>
class Rename : public QObject{
Q_OBJECT
public:
Rename(QObject *parent = nullptr);
~Rename();
signals:
void oldFileNameSignal(const QString &);
void newFileNameSignal(const QString &);
void process(const int &, const int &);
void singleFileSignal(const QString &);
void delActionFeedbackSignal(bool delFlag);
public slots:
void getFilesSlot(const QString & filesDirPath, const QString &strReplaced, const QString &strNew);
void renameFileSlot(const QString &filePath, const QString &strReplaced, const QString &strNew);
void checkBoxChangedSlot(int );
void comboxStateChangedSlot(const QString &);
void openDirSlot();
void delActionTriggeredSlot();
void getTextSlot(const QString &text);
private:
void renameFile(const QString &filePath, const QString &strReplaced, const QString &strNew);
QStringList getFiles(const QString &);
QStringList oldList = QStringList();
QStringList newList = QStringList();
QString renameMethodFlag = "替换";
QStringList dirFiles = QStringList();
QString currentText = "";
};
#endif //DUPLICATEFILESCHECK_DUPLICATEFILES_H

10
src/main.cpp

@ -1,10 +0,0 @@
#include <QApplication>
#include "widget.h"
int main(int argc, char *argv[]) {
QApplication a(argc, argv);
qRegisterMetaType<QHash<QByteArray,QStringList>>("QHash<QByteArray,QStringList>");
Widget w;
w.show();
return QApplication::exec();
}

252
src/widget.cpp

@ -1,252 +0,0 @@
//
// Created by 12038 on 2022/6/15.
//
// You may need to build the project (run Qt uic code generator) to get "ui_Widget.h" resolved
#include "widget.h"
#include "ui_widget.h"
Widget::Widget(QWidget *parent)
: QWidget(parent)
, ui(new Ui::Widget)
{
ui->setupUi(this);
//取消菜单栏
this->setWindowFlags(Qt::FramelessWindowHint);
//阴影边框效果
QGraphicsDropShadowEffect *shadow = new QGraphicsDropShadowEffect();
shadow->setBlurRadius(10);
shadow->setColor(Qt::black);
shadow->setOffset(0);
ui->shadowWidget->setGraphicsEffect(shadow);
//父窗口透明
this->setAttribute(Qt::WA_TranslucentBackground);
//最大化最小化关闭功能实现
connect(ui->btnMax, SIGNAL(clicked()), this, SLOT(btnMaxClickedSlot()));
connect(ui->btnMin, SIGNAL(clicked()), this, SLOT(btnMinClickedSlot()));
connect(ui->btnClose, SIGNAL(clicked()), this, SLOT(btnCloseClickedSlot()));
ui->btnMin->setStyleSheet("border-image: url(:/png/min.png)");
ui->btnMax->setStyleSheet("border-image: url(:/png/fullscreen3.png)");
ui->btnClose->setStyleSheet("border-image: url(:/png/close.png)");
renameFile = new Rename();
myThread = new QThread();
renameFile->moveToThread(myThread);
myThread->start();
connect(renameFile, SIGNAL(destroyed(QObject *)),
myThread, SLOT(deleteLater()));
// ui->labelTitle->setText(" 文件重命名");
connect(ui->btnSelectFile, SIGNAL(clicked(bool)), this, SLOT(selectFileClickedSlot()));
connect(ui->btnSelectDir, SIGNAL(clicked(bool)), this, SLOT(selectDirClickedSlot()));
connect(this, SIGNAL(fileSelectedSignal(const QString &, const QString &, const QString &)),
renameFile, SLOT(renameFileSlot(const QString &, const QString &, const QString &)));
connect(this, SIGNAL(getFilesSignal(const QString &, const QString &, const QString &)),
renameFile, SLOT(getFilesSlot(const QString &, const QString &, const QString &)));
connect(renameFile, SIGNAL(process(const int &, const int &)),
this, SLOT(processSlot(const int &, const int &)));
connect(renameFile, SIGNAL(oldFileNameSignal(const QString &)),
this, SLOT(oldFileNameSlot(const QString &)));
connect(renameFile, SIGNAL(newFileNameSignal(const QString &)),
this, SLOT(newFileNameSlot(const QString &)));
connect(renameFile, SIGNAL(singleFileSignal(const QString &)),
this, SLOT(newFileNameSlot(const QString &)));
connect(ui->comboBox, SIGNAL(currentTextChanged(QString)),
renameFile, SLOT(comboxStateChangedSlot(const QString &)));
connect(ui->btnConfirm, SIGNAL(clicked()),
this, SLOT(btnConfirmClickedSlot()));
ui->listWidget_2->setContextMenuPolicy(Qt::CustomContextMenu);
connect(ui->listWidget_2, SIGNAL(customContextMenuRequested(const QPoint &)),
this, SLOT(on_listWidget_customContextMenuRequested(const QPoint &)));
delAction = new QAction();
delAction->setText("删除文件");
openAction = new QAction();
openAction->setText("打开文件目录");
connect(delAction, SIGNAL(triggered(bool)),
renameFile, SLOT(delActionTriggeredSlot()));
connect(ui->listWidget_2, SIGNAL(currentTextChanged(const QString &)),
renameFile, SLOT(getTextSlot(const QString &)));
connect(openAction, SIGNAL(triggered(bool)),
renameFile, SLOT(openDirSlot()));
connect(renameFile, SIGNAL(delActionFeedbackSignal(bool)),
this, SLOT(delActionFeedbackSlot(bool)));
}
Widget::~Widget()
{
renameFile->deleteLater();
myThread->exit();
myThread->wait(10 * 1000);
openAction->deleteLater();
delAction->deleteLater();
delete ui;
}
void Widget::mousePressEvent(QMouseEvent *event)
{
// QWidget::mousePressEvent(event);
QPoint mouseStartPoint = event->globalPos();
QPoint windowLeftTopPoint = this->geometry().topLeft();
this->mousePosInWindow = mouseStartPoint - windowLeftTopPoint;
}
void Widget::mouseMoveEvent(QMouseEvent *event)
{
// QWidget::mouseMoveEvent(event);
if(this->mousePosInWindow == QPoint()) return;
QPoint mousePoint = event->globalPos();
QPoint windowLeftTopPoint = mousePoint - this->mousePosInWindow;
this->move(windowLeftTopPoint);
}
void Widget::mouseReleaseEvent(QMouseEvent *)
{
this->mousePosInWindow = QPoint();
}
void Widget::closeEvent(QCloseEvent *event)
{
QMessageBox::StandardButton button;
button=QMessageBox::question(this,tr("退出程序"),QString(tr("确认退出程序?")),QMessageBox::Yes|QMessageBox::No);
if(button==QMessageBox::No)
{
event->ignore(); // 忽略退出信号,程序继续进行
}
else if(button==QMessageBox::Yes)
{
event->accept(); // 接受退出信号,程序退出
}
}
void Widget::btnMaxClickedSlot()
{
ui->btnMax->setStyleSheet("border-image: url(:/png/fullscreen4.png)");
if(this->isMaximized()){
ui->layoutMain->setMargin(9);
ui->btnMax->setStyleSheet("border-image: url(:/png/fullscreen3.png)");
this->showNormal();
}
else{
ui->layoutMain->setMargin(0);
ui->btnMax->setStyleSheet("border-image: url(:/png/fullscreen4.png)");
this->showMaximized();
}
}
void Widget::btnMinClickedSlot()
{
this->showMinimized();
}
void Widget::btnCloseClickedSlot()
{
this->close();
}
void Widget::selectFileClickedSlot() {
if(!confirmFlag){
QMessageBox::information(this, "提示", "请先确认配置信息:模式为"+ui->comboBox->currentText());
return;
}
QString path = QFileDialog::getOpenFileName(
this, "选择文件",
"",
"");
if (path == "") return;
ui->progressBar->setValue(0);
ui->listWidget->clear();
ui->listWidget_2->clear();
ui->listWidget->addItem(path);
emit fileSelectedSignal(path, ui->leMd5Show->text(), ui->lineEdit->text());
}
void Widget::selectDirClickedSlot() {
if(!confirmFlag){
QMessageBox::information(this, "提示", "请先确认配置信息:模式为"+ui->comboBox->currentText());
return;
}
QString dirPathUrl = QFileDialog::getExistingDirectory(this, "选择文件夹", "");
ui->lineDIrShow->setText(dirPathUrl);
if (dirPathUrl == "") return;
ui->progressBar->setValue(0);
ui->listWidget->clear();
ui->listWidget_2->clear();
// ui->leMd5Show->clear();
emit getFilesSignal(dirPathUrl, ui->leMd5Show->text(), ui->lineEdit->text());
}
void Widget::processSlot(const int &now, const int &total) {
ui->progressBar->setMaximum(total);
ui->progressBar->setValue(now);
}
void Widget::oldFileNameSlot(const QString &oldName) {
ui->listWidget->addItem(oldName);
}
void Widget::newFileNameSlot(const QString &newName) {
ui->listWidget_2->addItem(newName);
}
void Widget::btnConfirmClickedSlot() {
QString s = ui->lineEdit->text();
if(s.contains('/') || s.contains('\\') || s.contains('<') || s.contains('>') || s.contains('?') || s.contains('*') || s.contains(':') || s.contains('|') || s.contains('"')){
QMessageBox::critical(this, "错误", "文件名中不能包含/\\|<>:?*等字符");
return;
}
confirmFlag = true;
}
void Widget::on_listWidget_customContextMenuRequested(const QPoint &pos)
{
// ui->listWidget_2->currentTextChanged()
QMenu *menu = new QMenu(this);
// menu->addAction(ui->actionAdd);
// menu->addAction(ui->actionClear);
// menu->addAction(ui->actionDelete);
// menu->addAction(ui->actionInsert);
menu->addAction(this->openAction);
menu->addAction(this->delAction);
// menu->addSeparator();
// menu->addAction(ui->actionInit);
// menu->addSeparator();
// menu->addAction(ui->actionSelAll);
// menu->addAction(ui->actionSelInv);
// menu->addAction(ui->actionSelNone);
// menu->addAction(ui->actionSelPopMenu);
menu->exec(QCursor::pos());
delete menu;
}
void Widget::delActionFeedbackSlot(bool flag) {
if(flag){
qDebug()<<"remove item";
QListWidgetItem * item = ui->listWidget_2->currentItem();
qDebug()<<item;
ui->listWidget_2->removeItemWidget(item);
delete item;
}
}

76
src/widget.h

@ -1,76 +0,0 @@
//
// Created by 12038 on 2022/6/15.
//
#ifndef DUPLICATEFILESCHECK_WIDGET_H
#define DUPLICATEFILESCHECK_WIDGET_H
#include <QMouseEvent>
#include <QWidget>
#include <QPoint>
#include <QGraphicsDropShadowEffect>
#include <QMessageBox>
#include "Rename.h"
#include <QDir>
#include <QDebug>
#include <QThread>
#include <QFileDialog>
#include <QMenu>
QT_BEGIN_NAMESPACE
namespace Ui { class Widget; }
QT_END_NAMESPACE
class Widget : public QWidget
{
Q_OBJECT
public:
Widget(QWidget *parent = nullptr);
~Widget();
protected:
void mousePressEvent(QMouseEvent *event);
void mouseMoveEvent(QMouseEvent *event);
void mouseReleaseEvent(QMouseEvent *event);
void closeEvent(QCloseEvent *event);
signals:
void fileSelectedSignal(const QString &path, const QString &strReplaced, const QString &strNew);
void getFilesSignal(const QString &dirPath, const QString &strReplaced, const QString &strNew);
void comboxStateChangedSignal(const QString &);
public slots:
void processSlot(const int &, const int &);
void oldFileNameSlot(const QString & oldName);
void newFileNameSlot(const QString & newName);
void delActionFeedbackSlot(bool flag);
private slots:
void btnMaxClickedSlot();
void btnMinClickedSlot();
void btnCloseClickedSlot();
void selectFileClickedSlot();
void selectDirClickedSlot();
void btnConfirmClickedSlot();
void on_listWidget_customContextMenuRequested(const QPoint &pos);
private:
Ui::Widget *ui;
Rename * renameFile;
QThread *myThread;
QPoint mousePosInWindow = QPoint();
bool confirmFlag = false;
QAction *delAction;
QAction *openAction;
};
#endif //DUPLICATEFILESCHECK_WIDGET_H

549
src/widget.ui

@ -1,549 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Widget</class>
<widget class="QWidget" name="Widget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>950</width>
<height>668</height>
</rect>
</property>
<property name="windowTitle">
<string>Widget</string>
</property>
<layout class="QGridLayout" name="layoutMain">
<property name="leftMargin">
<number>9</number>
</property>
<property name="topMargin">
<number>9</number>
</property>
<property name="rightMargin">
<number>9</number>
</property>
<property name="bottomMargin">
<number>9</number>
</property>
<item row="0" column="0">
<widget class="QWidget" name="shadowWidget" native="true">
<property name="styleSheet">
<string notr="true">#shadowWidget{
background-color: rgb(255, 255, 255);
border-radius: 5px;
}
</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<property name="spacing">
<number>0</number>
</property>
<item row="0" column="0">
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="spacing">
<number>0</number>
</property>
<property name="leftMargin">
<number>9</number>
</property>
<property name="rightMargin">
<number>9</number>
</property>
<item>
<widget class="QLabel" name="labelTitle">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<family>微软雅黑</family>
<pointsize>12</pointsize>
</font>
</property>
<property name="text">
<string> 文件重命名工具</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="btnMin">
<property name="minimumSize">
<size>
<width>32</width>
<height>32</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>32</width>
<height>32</height>
</size>
</property>
<property name="font">
<font>
<pointsize>14</pointsize>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
<property name="styleSheet">
<string notr="true">QPushButton
{
border:none;
border-image: url(../resources/min.jpeg)
}
QPushButton:hover
{
background-color: rgb(232, 232, 232);
}
QPushButton:pressed
{
background-color: rgb(162, 162, 162);
}
</string>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="btnMin_2">
<property name="enabled">
<bool>false</bool>
</property>
<property name="minimumSize">
<size>
<width>30</width>
<height>10</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>30</width>
<height>10</height>
</size>
</property>
<property name="font">
<font>
<pointsize>14</pointsize>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
<property name="styleSheet">
<string notr="true">QPushButton
{
border:none;
}
QPushButton:hover
{
background-color: rgb(232, 232, 232);
}
QPushButton:pressed
{
background-color: rgb(162, 162, 162);
}
</string>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="btnMax">
<property name="minimumSize">
<size>
<width>32</width>
<height>32</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>32</width>
<height>32</height>
</size>
</property>
<property name="font">
<font>
<pointsize>14</pointsize>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
<property name="styleSheet">
<string notr="true">QPushButton
{
border:none;
border-image: url(../resources/fullscreen3.jpeg)
}
QPushButton:hover
{
background-color: rgb(232, 232, 232);
}
QPushButton:pressed
{
background-color: rgb(162, 162, 162);
}</string>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="btnMin_3">
<property name="enabled">
<bool>false</bool>
</property>
<property name="minimumSize">
<size>
<width>30</width>
<height>10</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>30</width>
<height>10</height>
</size>
</property>
<property name="font">
<font>
<pointsize>14</pointsize>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
<property name="styleSheet">
<string notr="true">QPushButton
{
border:none;
}
QPushButton:hover
{
background-color: rgb(232, 232, 232);
}
QPushButton:pressed
{
background-color: rgb(162, 162, 162);
}
</string>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="btnClose">
<property name="minimumSize">
<size>
<width>30</width>
<height>30</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>30</width>
<height>30</height>
</size>
</property>
<property name="font">
<font>
<pointsize>14</pointsize>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
<property name="styleSheet">
<string notr="true">QPushButton
{
border:none;
border-top-right-radius: 5px;
border-image: url(../resources/close.jpeg)
}
QPushButton:hover
{
background-color: rgb(253, 0, 0);
}
QPushButton:pressed
{
background-color: rgb(211, 0, 0);
}
</string>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="0">
<widget class="QWidget" name="widget" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="topMargin">
<number>10</number>
</property>
<item>
<widget class="QGroupBox" name="groupBox">
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
<property name="title">
<string>配置</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="4">
<widget class="QComboBox" name="comboBox">
<property name="font">
<font>
<pointsize>12</pointsize>
</font>
</property>
<property name="editable">
<bool>false</bool>
</property>
<property name="duplicatesEnabled">
<bool>false</bool>
</property>
<item>
<property name="text">
<string>替换</string>
</property>
</item>
<item>
<property name="text">
<string>时间戳</string>
</property>
</item>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="leMd5Show">
<property name="font">
<font>
<pointsize>12</pointsize>
</font>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QLabel" name="label_2">
<property name="font">
<font>
<pointsize>12</pointsize>
</font>
</property>
<property name="text">
<string>新</string>
</property>
</widget>
</item>
<item row="0" column="3">
<widget class="QLineEdit" name="lineEdit">
<property name="font">
<font>
<pointsize>12</pointsize>
</font>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="font">
<font>
<pointsize>12</pointsize>
</font>
</property>
<property name="text">
<string>旧</string>
</property>
</widget>
</item>
<item row="0" column="5">
<widget class="QPushButton" name="btnConfirm">
<property name="font">
<font>
<pointsize>12</pointsize>
</font>
</property>
<property name="styleSheet">
<string notr="true">QPushButton:hover
{
background-color: #00aaff;
}
QPushButton:pressed
{
background-color: rgb(0, 124, 186);
}</string>
</property>
<property name="text">
<string>确认</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_2">
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="title">
<string>重命名</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QPushButton" name="btnSelectFile">
<property name="font">
<font>
<pointsize>12</pointsize>
</font>
</property>
<property name="styleSheet">
<string notr="true">QPushButton:hover
{
background-color: #00aaff;
}
QPushButton:pressed
{
background-color: rgb(0, 124, 186);
}</string>
</property>
<property name="text">
<string>选择文件</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="btnSelectDir">
<property name="font">
<font>
<pointsize>12</pointsize>
</font>
</property>
<property name="styleSheet">
<string notr="true">QPushButton:hover
{
background-color: #00aaff;
}
QPushButton:pressed
{
background-color: rgb(0, 124, 186);
}</string>
</property>
<property name="text">
<string>选择目录</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="lineDIrShow"/>
</item>
</layout>
</item>
<item row="1" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QListWidget" name="listWidget">
<property name="enabled">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QListWidget" name="listWidget_2">
<property name="enabled">
<bool>true</bool>
</property>
<property name="contextMenuPolicy">
<enum>Qt::CustomContextMenu</enum>
</property>
</widget>
</item>
</layout>
</item>
<item row="2" column="0">
<widget class="QProgressBar" name="progressBar">
<property name="value">
<number>0</number>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

BIN
windeploy/D3Dcompiler_47.dll

Binary file not shown.

BIN
windeploy/FileRename.exe

Binary file not shown.

BIN
windeploy/Qt5Core.dll

Binary file not shown.

BIN
windeploy/Qt5Gui.dll

Binary file not shown.

BIN
windeploy/Qt5Svg.dll

Binary file not shown.

BIN
windeploy/Qt5Widgets.dll

Binary file not shown.

BIN
windeploy/iconengines/qsvgicon.dll

Binary file not shown.

BIN
windeploy/imageformats/qgif.dll

Binary file not shown.

BIN
windeploy/imageformats/qicns.dll

Binary file not shown.

BIN
windeploy/imageformats/qico.dll

Binary file not shown.

BIN
windeploy/imageformats/qjpeg.dll

Binary file not shown.

BIN
windeploy/imageformats/qsvg.dll

Binary file not shown.

BIN
windeploy/imageformats/qtga.dll

Binary file not shown.

BIN
windeploy/imageformats/qtiff.dll

Binary file not shown.

BIN
windeploy/imageformats/qwbmp.dll

Binary file not shown.

BIN
windeploy/imageformats/qwebp.dll

Binary file not shown.

BIN
windeploy/libEGL.dll

Binary file not shown.

BIN
windeploy/libGLESv2.dll

Binary file not shown.

BIN
windeploy/libgcc_s_seh-1.dll

Binary file not shown.

BIN
windeploy/libstdc++-6.dll

Binary file not shown.

BIN
windeploy/libwinpthread-1.dll

Binary file not shown.

BIN
windeploy/opengl32sw.dll

Binary file not shown.

BIN
windeploy/platforms/qwindows.dll

Binary file not shown.

BIN
windeploy/styles/qwindowsvistastyle.dll

Binary file not shown.

BIN
windeploy/translations/qt_ar.qm

Binary file not shown.

BIN
windeploy/translations/qt_bg.qm

Binary file not shown.

BIN
windeploy/translations/qt_ca.qm

Binary file not shown.

BIN
windeploy/translations/qt_cs.qm

Binary file not shown.

BIN
windeploy/translations/qt_da.qm

Binary file not shown.

BIN
windeploy/translations/qt_de.qm

Binary file not shown.

BIN
windeploy/translations/qt_en.qm

Binary file not shown.

BIN
windeploy/translations/qt_es.qm

Binary file not shown.

BIN
windeploy/translations/qt_fi.qm

Binary file not shown.

BIN
windeploy/translations/qt_fr.qm

Binary file not shown.

BIN
windeploy/translations/qt_gd.qm

Binary file not shown.

BIN
windeploy/translations/qt_he.qm

Binary file not shown.

BIN
windeploy/translations/qt_hu.qm

Binary file not shown.

BIN
windeploy/translations/qt_it.qm

Binary file not shown.

BIN
windeploy/translations/qt_ja.qm

Binary file not shown.

BIN
windeploy/translations/qt_ko.qm

Binary file not shown.

BIN
windeploy/translations/qt_lv.qm

Binary file not shown.

BIN
windeploy/translations/qt_pl.qm

Binary file not shown.

BIN
windeploy/translations/qt_ru.qm

Binary file not shown.

BIN
windeploy/translations/qt_sk.qm

Binary file not shown.

BIN
windeploy/translations/qt_uk.qm

Binary file not shown.

BIN
windeploy/translations/qt_zh_TW.qm

Binary file not shown.
Loading…
Cancel
Save