diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3efe8e5..d4b3272 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -24,7 +24,7 @@ aux_source_directory(${PROJECT_SOURCE_DIR}/resources DIR_RESOURCES_SRCS)
aux_source_directory(${PROJECT_SOURCE_DIR}/src DIR_SRC_SRCS)
# 添加qrc资源
-qt5_add_resources(QRC_FILES resources/img.qrc)
+#qt5_add_resources(QRC_FILES resources/img.qrc)
#SOURCE_GROUP("Resource Files" FILES ${QRC_SOURCE_FILES})
# 配置debug 和 release,release无cmd窗口
diff --git a/README.md b/README.md
index 9d1cdcd..2e6b4f7 100644
--- a/README.md
+++ b/README.md
@@ -1,8 +1,8 @@
# 重复文件检测工具
-![](resources/img.png)
+![](screenshoot/img.png)
-![](resources/demo.gif)
+![](screenshoot/demo.gif)
## 环境
- Clion 2022.1.2
@@ -14,9 +14,13 @@
## 下载
-[v1.0.2 windows release](https://github.com/tianzhendong/duplicateFilesCheck/releases/download/v1.0.2/duplicateFilesCheckv1.0.2.zip)
+[windowsRelease-v1.0.2](https://github.com/tianzhendong/duplicateFilesCheck/releases/download/v1.0.2/duplicateFilesCheckv1.0.2.zip)
+[windowsRelease-v1.0.3](https://github.com/tianzhendong/duplicateFilesCheck/releases/download/v1.0.3/duplicateFilesCheckv1.0.3.zip)
## 更新记录
### 20220619 v1.0.2
- [x] 增加打开文件目录功能
-- [x] 增加删除文件功能
\ No newline at end of file
+- [x] 增加删除文件功能
+
+### 20220620 v1.0.3
+- [x] 修改UI
diff --git a/resources/close.png b/resources/close.png
deleted file mode 100644
index a8c839d..0000000
Binary files a/resources/close.png and /dev/null differ
diff --git a/resources/demo.gif b/resources/demo.gif
deleted file mode 100644
index 3551cdb..0000000
Binary files a/resources/demo.gif and /dev/null differ
diff --git a/resources/fullscreen3.png b/resources/fullscreen3.png
deleted file mode 100644
index 466b711..0000000
Binary files a/resources/fullscreen3.png and /dev/null differ
diff --git a/resources/fullscreen4.png b/resources/fullscreen4.png
deleted file mode 100644
index 401b0a8..0000000
Binary files a/resources/fullscreen4.png and /dev/null differ
diff --git a/resources/img.png b/resources/img.png
deleted file mode 100644
index 88fb23e..0000000
Binary files a/resources/img.png and /dev/null differ
diff --git a/resources/img.qrc b/resources/img.qrc
deleted file mode 100644
index 43e7a68..0000000
--- a/resources/img.qrc
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
- favicon.ico
-
-
- close.png
- fullscreen3.png
- fullscreen4.png
- min.png
-
-
\ No newline at end of file
diff --git a/resources/min.png b/resources/min.png
deleted file mode 100644
index fbd7577..0000000
Binary files a/resources/min.png and /dev/null differ
diff --git a/screenshoot/demo.gif b/screenshoot/demo.gif
new file mode 100644
index 0000000..b5f7bd4
Binary files /dev/null and b/screenshoot/demo.gif differ
diff --git a/screenshoot/img.png b/screenshoot/img.png
new file mode 100644
index 0000000..3346ea5
Binary files /dev/null and b/screenshoot/img.png differ
diff --git a/src/main.cpp b/src/main.cpp
index a20479a..f0324b0 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -1,10 +1,10 @@
#include
-#include "widget.h"
+#include "mainwindow.h"
int main(int argc, char *argv[]) {
QApplication a(argc, argv);
qRegisterMetaType>("QHash");
- Widget w;
+ MainWindow w;
w.show();
return QApplication::exec();
}
diff --git a/src/widget.cpp b/src/mainwindow.cpp
similarity index 64%
rename from src/widget.cpp
rename to src/mainwindow.cpp
index 06ded25..3b479a8 100644
--- a/src/widget.cpp
+++ b/src/mainwindow.cpp
@@ -1,41 +1,17 @@
//
-// Created by 12038 on 2022/6/15.
+// Created by 12038 on 2022/6/20.
//
-// You may need to build the project (run Qt uic code generator) to get "ui_Widget.h" resolved
+// You may need to build the project (run Qt uic code generator) to get "ui_MainWindow.h" resolved
+#include "mainwindow.h"
+#include "ui_MainWindow.h"
#include
-#include "widget.h"
-#include "ui_widget.h"
-Widget::Widget(QWidget *parent)
- : QWidget(parent)
- , ui(new Ui::Widget)
-{
+MainWindow::MainWindow(QWidget *parent) :
+ QMainWindow(parent), ui(new Ui::MainWindow) {
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)");
-
+ this->setWindowTitle("重复文件检测工具-byTianZD");
duplicateFiles = new DuplicateFiles();
myThread = new QThread();
@@ -80,10 +56,10 @@ Widget::Widget(QWidget *parent)
duplicateFiles, SLOT(openDirSlot()));
connect(duplicateFiles, SIGNAL(delActionFeedbackSignal(bool)),
this, SLOT(delActionFeedbackSlot(bool)));
+
}
-Widget::~Widget()
-{
+MainWindow::~MainWindow() {
duplicateFiles->deleteLater();
myThread->exit();
myThread->wait(10 * 1000);
@@ -92,29 +68,7 @@ Widget::~Widget()
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)
+void MainWindow::closeEvent(QCloseEvent *event)
{
QMessageBox::StandardButton button;
button=QMessageBox::question(this,tr("退出程序"),QString(tr("确认退出程序?")),QMessageBox::Yes|QMessageBox::No);
@@ -128,32 +82,27 @@ void Widget::closeEvent(QCloseEvent *event)
}
}
-void Widget::btnMaxClickedSlot()
+void MainWindow::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()
+void MainWindow::btnMinClickedSlot()
{
this->showMinimized();
}
-void Widget::btnCloseClickedSlot()
+void MainWindow::btnCloseClickedSlot()
{
this->close();
}
-void Widget::calMd5ofFileSlot() {
+void MainWindow::calMd5ofFileSlot() {
QString path = QFileDialog::getOpenFileName(
this, "选择文件",
"./",
@@ -161,29 +110,29 @@ void Widget::calMd5ofFileSlot() {
emit calFileMd5Signal(path);
}
-void Widget::showFileMd5Slot(const QByteArray & md5) {
+void MainWindow::showFileMd5Slot(const QByteArray & md5) {
ui->leMd5Show->setText("");
ui->leMd5Show->setText(md5);
}
-void Widget::selectDirSlot() {
+void MainWindow::selectDirSlot() {
ui->progressBar->setValue(0);
QString dirPathUrl = QFileDialog::getExistingDirectory(this, "选择文件夹", "./");
ui->lineDIrShow->setText(dirPathUrl);
emit getFilesSignal(dirPathUrl);
}
-void Widget::filesSlot(const QStringList &files) {
+void MainWindow::filesSlot(const QStringList &files) {
ui->listWidget_2->clear();
ui->listWidget_2->addItems(files);
}
-void Widget::processSlot(const int &now, const int &total) {
+void MainWindow::processSlot(const int &now, const int &total) {
ui->progressBar->setMaximum(total);
ui->progressBar->setValue(now);
}
-void Widget::duplicateFilesSlot(const QHash &duplicateFiles) {
+void MainWindow::duplicateFilesSlot(const QHash &duplicateFiles) {
ui->listWidget->clear();
this->duplicateResults = duplicateFiles;
for(QHash::const_iterator itr = duplicateFiles.begin(); itr != duplicateFiles.end(); itr++){
@@ -191,12 +140,12 @@ void Widget::duplicateFilesSlot(const QHash &duplicateF
}
}
-void Widget::currentTextChangedSlot(const QString ¤tText) {
+void MainWindow::currentTextChangedSlot(const QString ¤tText) {
ui->listWidget_2->clear();
ui->listWidget_2->addItems(this->duplicateResults[currentText.toLocal8Bit()]);
}
-void Widget::on_listWidget_customContextMenuRequested(const QPoint &pos)
+void MainWindow::on_listWidget_customContextMenuRequested(const QPoint &pos)
{
// ui->listWidget_2->currentTextChanged()
QMenu *menu = new QMenu(this);
@@ -218,7 +167,7 @@ void Widget::on_listWidget_customContextMenuRequested(const QPoint &pos)
delete menu;
}
-void Widget::delActionFeedbackSlot(bool flag) {
+void MainWindow::delActionFeedbackSlot(bool flag) {
if(flag){
qDebug()<<"remove item";
QListWidgetItem * item = ui->listWidget_2->currentItem();
@@ -226,6 +175,4 @@ void Widget::delActionFeedbackSlot(bool flag) {
ui->listWidget_2->removeItemWidget(item);
delete item;
}
-}
-
-
+}
\ No newline at end of file
diff --git a/src/widget.h b/src/mainwindow.h
similarity index 73%
rename from src/widget.h
rename to src/mainwindow.h
index f57054e..07bc667 100644
--- a/src/widget.h
+++ b/src/mainwindow.h
@@ -1,12 +1,12 @@
//
-// Created by 12038 on 2022/6/15.
+// Created by 12038 on 2022/6/20.
//
-#ifndef DUPLICATEFILESCHECK_WIDGET_H
-#define DUPLICATEFILESCHECK_WIDGET_H
+#ifndef DUPLICATEFILESCHECK_MAINWINDOW_H
+#define DUPLICATEFILESCHECK_MAINWINDOW_H
+#include
#include
-#include
#include
#include
#include
@@ -17,23 +17,21 @@
#include
#include
+
+
QT_BEGIN_NAMESPACE
-namespace Ui { class Widget; }
+namespace Ui { class MainWindow; }
QT_END_NAMESPACE
-class Widget : public QWidget
-{
+class MainWindow : public QMainWindow {
Q_OBJECT
public:
- Widget(QWidget *parent = nullptr);
- ~Widget();
+ explicit MainWindow(QWidget *parent = nullptr);
-protected:
- void mousePressEvent(QMouseEvent *event);
- void mouseMoveEvent(QMouseEvent *event);
- void mouseReleaseEvent(QMouseEvent *event);
+ ~MainWindow() override;
+protected:
void closeEvent(QCloseEvent *event);
signals:
@@ -58,7 +56,7 @@ private slots:
void on_listWidget_customContextMenuRequested(const QPoint &pos);
private:
- Ui::Widget *ui;
+ Ui::MainWindow *ui;
DuplicateFiles * duplicateFiles;
QThread *myThread;
@@ -67,9 +65,7 @@ private:
QAction *delAction;
QAction *openAction;
-
-
};
-#endif //DUPLICATEFILESCHECK_WIDGET_H
+#endif //DUPLICATEFILESCHECK_MAINWINDOW_H
diff --git a/src/mainwindow.ui b/src/mainwindow.ui
new file mode 100644
index 0000000..0b4cdfa
--- /dev/null
+++ b/src/mainwindow.ui
@@ -0,0 +1,113 @@
+
+
+ MainWindow
+
+
+
+ 0
+ 0
+ 628
+ 474
+
+
+
+ MainWindow
+
+
+
+
+ 0
+ 0
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+
-
+
+
+ 目录重复文件检测
+
+
+ Qt::AlignCenter
+
+
+
-
+
+
+ 0
+
+
+
+ -
+
+
-
+
+
+ -
+
+
+ Qt::CustomContextMenu
+
+
+
+
+
+ -
+
+
-
+
+
+ 选择目录
+
+
+
+ -
+
+
+
+
+
+
+
+ -
+
+
+ Qt::LeftToRight
+
+
+ 文件Md5计算
+
+
+ Qt::AlignCenter
+
+
+
-
+
+
+ -
+
+
+ 选择文件
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/widget.ui b/src/widget.ui
deleted file mode 100644
index 84bb0a8..0000000
--- a/src/widget.ui
+++ /dev/null
@@ -1,419 +0,0 @@
-
-
- Widget
-
-
-
- 0
- 0
- 800
- 600
-
-
-
- Widget
-
-
-
- 9
-
-
- 9
-
-
- 9
-
-
- 9
-
- -
-
-
- #shadowWidget{
- background-color: rgb(255, 255, 255);
- border-radius: 5px;
- }
-
-
-
-
- 9
-
-
- 9
-
-
- 9
-
-
- 0
-
-
- 0
-
-
-
-
-
- 0
-
-
- 9
-
-
-
-
-
- 0
-
-
- 0
-
-
-
-
-
-
- 0
- 0
-
-
-
-
- 微软雅黑
- 14
-
-
-
- 重复文件检测工具
-
-
- Qt::AlignCenter
-
-
-
- -
-
-
-
- 36
- 36
-
-
-
-
- 36
- 36
-
-
-
-
- 14
- 50
- false
-
-
-
- QPushButton
- {
- border:none;
- }
-
- QPushButton:hover
- {
- background-color: rgb(232, 232, 232);
- }
- QPushButton:pressed
- {
- background-color: rgb(162, 162, 162);
- }
-
-
-
-
-
-
-
-
-
-
- -
-
-
- false
-
-
-
- 30
- 36
-
-
-
-
- 30
- 36
-
-
-
-
- 14
- 50
- false
-
-
-
- QPushButton
- {
- border:none;
- }
-
- QPushButton:hover
- {
- background-color: rgb(232, 232, 232);
- }
- QPushButton:pressed
- {
- background-color: rgb(162, 162, 162);
- }
-
-
-
-
-
-
-
-
-
-
- -
-
-
-
- 36
- 36
-
-
-
-
- 36
- 36
-
-
-
-
- 14
- 50
- false
-
-
-
- QPushButton
- {
- border:none;
- }
-
- QPushButton:hover
- {
- background-color: rgb(232, 232, 232);
- }
- QPushButton:pressed
- {
- background-color: rgb(162, 162, 162);
- }
-
-
-
-
-
-
-
-
-
-
- -
-
-
- false
-
-
-
- 30
- 36
-
-
-
-
- 30
- 36
-
-
-
-
- 14
- 50
- false
-
-
-
- QPushButton
- {
- border:none;
- }
-
- QPushButton:hover
- {
- background-color: rgb(232, 232, 232);
- }
- QPushButton:pressed
- {
- background-color: rgb(162, 162, 162);
- }
-
-
-
-
-
-
-
-
-
-
- -
-
-
-
- 36
- 36
-
-
-
-
- 36
- 36
-
-
-
-
- 14
- 50
- false
-
-
-
- QPushButton
- {
- border:none;
- border-top-right-radius: 5px;
- }
-
- QPushButton:hover
- {
- background-color: rgb(253, 0, 0);
- }
- QPushButton:pressed
- {
- background-color: rgb(211, 0, 0);
- }
-
-
-
-
-
-
-
-
-
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
-
-
-
- Qt::LeftToRight
-
-
- 文件Md5计算
-
-
- Qt::AlignCenter
-
-
-
-
-
-
- 选择文件
-
-
-
- -
-
-
-
-
-
- -
-
-
- 目录重复文件检测
-
-
- Qt::AlignCenter
-
-
-
-
-
-
-
-
-
- 选择目录
-
-
-
- -
-
-
-
-
- -
-
-
-
-
-
- -
-
-
- Qt::CustomContextMenu
-
-
-
-
-
- -
-
-
- 0
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-