From 38b13ed886f50d861798e8cad3cc056f04173415 Mon Sep 17 00:00:00 2001
From: AaronFeng753 <52553688+AaronFeng753@users.noreply.github.com>
Date: Sun, 2 May 2021 06:23:17 +0800
Subject: [PATCH] Rename SRC Folder
---
.../FFmpeg_Encoders_List_waifu2xEX.bat | 0
.../NFSound_Waifu2xEX.mp3 | Bin
...y_6b5b848b-c6b5-49fc-98b9-312103aae1dc.dat | 0
.../TitleImage.png | Bin
.../Waifu2x-Extension-QT-Launcher.pro | 0
.../Waifu2x-Extension-QT-Launcher.pro.user | 0
.../icon/icon.ico | Bin
.../icon/icon_main.png | Bin
.../Waifu2x-Extension-QT-Launcher/main.cpp | 0
.../mainwindow.cpp | 0
.../mainwindow.h | 0
.../mainwindow.ui | 0
.../Waifu2x-Extension-QT-Launcher/pic.qrc | 0
.../Waifu2x-Extension-QT/AnimatedPNG.cpp | 0
.../Waifu2x-Extension-QT/Anime4K.cpp | 4350 +--
.../CompatibilityTest.cpp | 0
.../Current_File_Progress.cpp | 254 +-
.../Waifu2x-Extension-QT/CustomResolution.cpp | 896 +-
.../Waifu2x-Extension-QT/Donate.cpp | 0
.../Waifu2x-Extension-QT/Finish_Action.cpp | 0
.../Frame_Interpolation.cpp | 0
.../Waifu2x-Extension-QT/OtherPic.qrc | 10 +-
.../OtherPic/AspectRatioStrategy.jpg | Bin
.../Waifu2x-Extension-QT/Right-click_Menu.cpp | 0
...y_3d7bd0e1-f8ab-4ddc-a52a-15db18477d2f.dat | 0
.../Waifu2x-Extension-QT/SystemTrayIcon.cpp | 0
.../Waifu2x-Extension-QT.pro | 186 +-
.../Waifu2x-Extension-QT.pro.user | 692 +-
.../Waifu2x-Extension-QT.pro.user.hLgbqF | 0
.../Waifu2x-Extension-QT/Web_Activities.cpp | 0
.../Waifu2x-Extension-QT/backgroundImage.qrc | 10 +-
.../Waifu2x-Extension-QT/checkupdate.cpp | 378 +-
.../Waifu2x-Extension-QT/donate.qrc | 10 +-
.../donate/Donate_QRCode.jpg | Bin
.../Waifu2x-Extension-QT/files.cpp | 1258 +-
.../Waifu2x-Extension-QT/gif.cpp | 620 +-
.../Waifu2x-Extension-QT/icon.qrc | 108 +-
.../Waifu2x-Extension-QT/icon/About.png | Bin
.../Waifu2x-Extension-QT/icon/AddNewFile.png | Bin
.../icon/AddNewFile_disabled.png | Bin
.../icon/AddNewFile_hover.png | Bin
.../Waifu2x-Extension-QT/icon/AddSetting.png | Bin
.../Waifu2x-Extension-QT/icon/Apply.png | Bin
.../icon/BackgroudMode.png | Bin
.../Waifu2x-Extension-QT/icon/ClearList.png | Bin
.../icon/ClearList_disabled.png | Bin
.../icon/ClearList_hover.png | Bin
.../icon/CompatibilityTest.png | Bin
.../icon/EngineSettings.png | Bin
.../Waifu2x-Extension-QT/icon/Exit.png | Bin
.../Waifu2x-Extension-QT/icon/Home.png | Bin
.../Waifu2x-Extension-QT/icon/Minimize.png | Bin
.../icon/Pause_SysTray.png | Bin
.../icon/Read_FileList.png | Bin
.../icon/Read_FileList_disabled.png | Bin
.../icon/Read_FileList_hover.png | Bin
.../Waifu2x-Extension-QT/icon/RemoveFile.png | Bin
.../Waifu2x-Extension-QT/icon/RemoveItem.png | Bin
.../icon/RemoveItem_disabled.png | Bin
.../icon/RemoveItem_hover.png | Bin
.../icon/ResizeFilesListSplitter.png | Bin
.../icon/ResizeFilesListSplitter_disabled.png | Bin
.../icon/ResizeFilesListSplitter_hover.png | Bin
.../icon/Save_FileList.png | Bin
.../icon/Save_FileList_disabled.png | Bin
.../icon/Save_FileList_hover.png | Bin
.../icon/SendFeedback.png | Bin
.../Waifu2x-Extension-QT/icon/ShowWindow.png | Bin
.../icon/Start_SysTray.png | Bin
.../icon/TurnOffScreen.png | Bin
.../icon/TurnOffScreen_disabled.png | Bin
.../icon/TurnOffScreen_hover.png | Bin
.../icon/VideoSettings.png | Bin
.../Waifu2x-Extension-QT/icon/cancel.png | Bin
.../icon/donateTabIcon.png | Bin
.../icon/donateTabIcon_1.png | Bin
.../Waifu2x-Extension-QT/icon/gif_Rmenu.png | Bin
.../Waifu2x-Extension-QT/icon/icon.ico | Bin
.../Waifu2x-Extension-QT/icon/icon_main.png | Bin
.../Waifu2x-Extension-QT/icon/opne_folder.png | Bin
.../Waifu2x-Extension-QT/icon/patreon.png | Bin
.../icon/patreon_sysTray.png | Bin
.../icon/pause-button.png | Bin
.../Waifu2x-Extension-QT/icon/paypal.png | Bin
.../icon/picture_Rmenu.png | Bin
.../Waifu2x-Extension-QT/icon/refresh.png | Bin
.../Waifu2x-Extension-QT/icon/video_Rmenu.png | Bin
.../Waifu2x-Extension-QT/icon/view_file.png | Bin
.../Waifu2x-Extension-QT/image.cpp | 0
.../Waifu2x-Extension-QT/language_Chinese.qm | Bin
.../Waifu2x-Extension-QT/language_Chinese.ts | 0
.../Waifu2x-Extension-QT/language_English.qm | Bin
.../Waifu2x-Extension-QT/language_English.ts | 0
.../language_TraditionalChinese.qm | Bin
.../language_TraditionalChinese.ts | 0
.../Waifu2x-Extension-QT/main.cpp | 170 +-
.../Waifu2x-Extension-QT/mainwindow.cpp | 4224 +--
.../Waifu2x-Extension-QT/mainwindow.h | 2186 +-
.../Waifu2x-Extension-QT/mainwindow.ui | 22454 ++++++++--------
.../Waifu2x-Extension-QT/progressBar.cpp | 118 +-
.../realsr_ncnn_vulkan.cpp | 4362 +--
.../Waifu2x-Extension-QT/settings.cpp | 1306 +-
.../Waifu2x-Extension-QT/srmd-cuda.cpp | 0
.../Waifu2x-Extension-QT/srmd_ncnn_vulkan.cpp | 4544 ++--
.../Waifu2x-Extension-QT/table.cpp | 1766 +-
.../Waifu2x-Extension-QT/textBrowser.cpp | 108 +-
.../topsupporterslist.cpp | 0
.../Waifu2x-Extension-QT/topsupporterslist.h | 0
.../Waifu2x-Extension-QT/topsupporterslist.ui | 0
.../Waifu2x-Extension-QT/video.cpp | 2730 +-
.../Waifu2x-Extension-QT/waifu2x.cpp | 2702 +-
.../Waifu2x-Extension-QT/waifu2x_caffe.cpp | 4308 +--
.../waifu2x_converter.cpp | 4280 +--
.../waifu2x_ncnn_vulkan.cpp | 4458 +--
114 files changed, 34244 insertions(+), 34244 deletions(-)
rename {SRC => SRC_v3.41.01-beta}/FFmpeg_Encoders_List_waifu2xEX.bat (100%)
rename {SRC => SRC_v3.41.01-beta}/NFSound_Waifu2xEX.mp3 (100%)
rename {SRC => SRC_v3.41.01-beta}/Waifu2x-Extension-QT-Launcher/SyncToy_6b5b848b-c6b5-49fc-98b9-312103aae1dc.dat (100%)
rename {SRC => SRC_v3.41.01-beta}/Waifu2x-Extension-QT-Launcher/TitleImage.png (100%)
rename {SRC => SRC_v3.41.01-beta}/Waifu2x-Extension-QT-Launcher/Waifu2x-Extension-QT-Launcher.pro (100%)
rename {SRC => SRC_v3.41.01-beta}/Waifu2x-Extension-QT-Launcher/Waifu2x-Extension-QT-Launcher.pro.user (100%)
rename {SRC => SRC_v3.41.01-beta}/Waifu2x-Extension-QT-Launcher/icon/icon.ico (100%)
rename {SRC => SRC_v3.41.01-beta}/Waifu2x-Extension-QT-Launcher/icon/icon_main.png (100%)
rename {SRC => SRC_v3.41.01-beta}/Waifu2x-Extension-QT-Launcher/main.cpp (100%)
rename {SRC => SRC_v3.41.01-beta}/Waifu2x-Extension-QT-Launcher/mainwindow.cpp (100%)
rename {SRC => SRC_v3.41.01-beta}/Waifu2x-Extension-QT-Launcher/mainwindow.h (100%)
rename {SRC => SRC_v3.41.01-beta}/Waifu2x-Extension-QT-Launcher/mainwindow.ui (100%)
rename {SRC => SRC_v3.41.01-beta}/Waifu2x-Extension-QT-Launcher/pic.qrc (100%)
rename {SRC => SRC_v3.41.01-beta}/Waifu2x-Extension-QT/AnimatedPNG.cpp (100%)
rename {SRC => SRC_v3.41.01-beta}/Waifu2x-Extension-QT/Anime4K.cpp (97%)
rename {SRC => SRC_v3.41.01-beta}/Waifu2x-Extension-QT/CompatibilityTest.cpp (100%)
rename {SRC => SRC_v3.41.01-beta}/Waifu2x-Extension-QT/Current_File_Progress.cpp (97%)
rename {SRC => SRC_v3.41.01-beta}/Waifu2x-Extension-QT/CustomResolution.cpp (97%)
rename {SRC => SRC_v3.41.01-beta}/Waifu2x-Extension-QT/Donate.cpp (100%)
rename {SRC => SRC_v3.41.01-beta}/Waifu2x-Extension-QT/Finish_Action.cpp (100%)
rename {SRC => SRC_v3.41.01-beta}/Waifu2x-Extension-QT/Frame_Interpolation.cpp (100%)
rename {SRC => SRC_v3.41.01-beta}/Waifu2x-Extension-QT/OtherPic.qrc (96%)
rename {SRC => SRC_v3.41.01-beta}/Waifu2x-Extension-QT/OtherPic/AspectRatioStrategy.jpg (100%)
rename {SRC => SRC_v3.41.01-beta}/Waifu2x-Extension-QT/Right-click_Menu.cpp (100%)
rename {SRC => SRC_v3.41.01-beta}/Waifu2x-Extension-QT/SyncToy_3d7bd0e1-f8ab-4ddc-a52a-15db18477d2f.dat (100%)
rename {SRC => SRC_v3.41.01-beta}/Waifu2x-Extension-QT/SystemTrayIcon.cpp (100%)
rename {SRC => SRC_v3.41.01-beta}/Waifu2x-Extension-QT/Waifu2x-Extension-QT.pro (96%)
rename {SRC => SRC_v3.41.01-beta}/Waifu2x-Extension-QT/Waifu2x-Extension-QT.pro.user (98%)
rename {SRC => SRC_v3.41.01-beta}/Waifu2x-Extension-QT/Waifu2x-Extension-QT.pro.user.hLgbqF (100%)
rename {SRC => SRC_v3.41.01-beta}/Waifu2x-Extension-QT/Web_Activities.cpp (100%)
rename {SRC => SRC_v3.41.01-beta}/Waifu2x-Extension-QT/backgroundImage.qrc (95%)
rename {SRC => SRC_v3.41.01-beta}/Waifu2x-Extension-QT/checkupdate.cpp (97%)
rename {SRC => SRC_v3.41.01-beta}/Waifu2x-Extension-QT/donate.qrc (95%)
rename {SRC => SRC_v3.41.01-beta}/Waifu2x-Extension-QT/donate/Donate_QRCode.jpg (100%)
rename {SRC => SRC_v3.41.01-beta}/Waifu2x-Extension-QT/files.cpp (96%)
rename {SRC => SRC_v3.41.01-beta}/Waifu2x-Extension-QT/gif.cpp (97%)
rename {SRC => SRC_v3.41.01-beta}/Waifu2x-Extension-QT/icon.qrc (97%)
rename {SRC => SRC_v3.41.01-beta}/Waifu2x-Extension-QT/icon/About.png (100%)
rename {SRC => SRC_v3.41.01-beta}/Waifu2x-Extension-QT/icon/AddNewFile.png (100%)
rename {SRC => SRC_v3.41.01-beta}/Waifu2x-Extension-QT/icon/AddNewFile_disabled.png (100%)
rename {SRC => SRC_v3.41.01-beta}/Waifu2x-Extension-QT/icon/AddNewFile_hover.png (100%)
rename {SRC => SRC_v3.41.01-beta}/Waifu2x-Extension-QT/icon/AddSetting.png (100%)
rename {SRC => SRC_v3.41.01-beta}/Waifu2x-Extension-QT/icon/Apply.png (100%)
rename {SRC => SRC_v3.41.01-beta}/Waifu2x-Extension-QT/icon/BackgroudMode.png (100%)
rename {SRC => SRC_v3.41.01-beta}/Waifu2x-Extension-QT/icon/ClearList.png (100%)
rename {SRC => SRC_v3.41.01-beta}/Waifu2x-Extension-QT/icon/ClearList_disabled.png (100%)
rename {SRC => SRC_v3.41.01-beta}/Waifu2x-Extension-QT/icon/ClearList_hover.png (100%)
rename {SRC => SRC_v3.41.01-beta}/Waifu2x-Extension-QT/icon/CompatibilityTest.png (100%)
rename {SRC => SRC_v3.41.01-beta}/Waifu2x-Extension-QT/icon/EngineSettings.png (100%)
rename {SRC => SRC_v3.41.01-beta}/Waifu2x-Extension-QT/icon/Exit.png (100%)
rename {SRC => SRC_v3.41.01-beta}/Waifu2x-Extension-QT/icon/Home.png (100%)
rename {SRC => SRC_v3.41.01-beta}/Waifu2x-Extension-QT/icon/Minimize.png (100%)
rename {SRC => SRC_v3.41.01-beta}/Waifu2x-Extension-QT/icon/Pause_SysTray.png (100%)
rename {SRC => SRC_v3.41.01-beta}/Waifu2x-Extension-QT/icon/Read_FileList.png (100%)
rename {SRC => SRC_v3.41.01-beta}/Waifu2x-Extension-QT/icon/Read_FileList_disabled.png (100%)
rename {SRC => SRC_v3.41.01-beta}/Waifu2x-Extension-QT/icon/Read_FileList_hover.png (100%)
rename {SRC => SRC_v3.41.01-beta}/Waifu2x-Extension-QT/icon/RemoveFile.png (100%)
rename {SRC => SRC_v3.41.01-beta}/Waifu2x-Extension-QT/icon/RemoveItem.png (100%)
rename {SRC => SRC_v3.41.01-beta}/Waifu2x-Extension-QT/icon/RemoveItem_disabled.png (100%)
rename {SRC => SRC_v3.41.01-beta}/Waifu2x-Extension-QT/icon/RemoveItem_hover.png (100%)
rename {SRC => SRC_v3.41.01-beta}/Waifu2x-Extension-QT/icon/ResizeFilesListSplitter.png (100%)
rename {SRC => SRC_v3.41.01-beta}/Waifu2x-Extension-QT/icon/ResizeFilesListSplitter_disabled.png (100%)
rename {SRC => SRC_v3.41.01-beta}/Waifu2x-Extension-QT/icon/ResizeFilesListSplitter_hover.png (100%)
rename {SRC => SRC_v3.41.01-beta}/Waifu2x-Extension-QT/icon/Save_FileList.png (100%)
rename {SRC => SRC_v3.41.01-beta}/Waifu2x-Extension-QT/icon/Save_FileList_disabled.png (100%)
rename {SRC => SRC_v3.41.01-beta}/Waifu2x-Extension-QT/icon/Save_FileList_hover.png (100%)
rename {SRC => SRC_v3.41.01-beta}/Waifu2x-Extension-QT/icon/SendFeedback.png (100%)
rename {SRC => SRC_v3.41.01-beta}/Waifu2x-Extension-QT/icon/ShowWindow.png (100%)
rename {SRC => SRC_v3.41.01-beta}/Waifu2x-Extension-QT/icon/Start_SysTray.png (100%)
rename {SRC => SRC_v3.41.01-beta}/Waifu2x-Extension-QT/icon/TurnOffScreen.png (100%)
rename {SRC => SRC_v3.41.01-beta}/Waifu2x-Extension-QT/icon/TurnOffScreen_disabled.png (100%)
rename {SRC => SRC_v3.41.01-beta}/Waifu2x-Extension-QT/icon/TurnOffScreen_hover.png (100%)
rename {SRC => SRC_v3.41.01-beta}/Waifu2x-Extension-QT/icon/VideoSettings.png (100%)
rename {SRC => SRC_v3.41.01-beta}/Waifu2x-Extension-QT/icon/cancel.png (100%)
rename {SRC => SRC_v3.41.01-beta}/Waifu2x-Extension-QT/icon/donateTabIcon.png (100%)
rename {SRC => SRC_v3.41.01-beta}/Waifu2x-Extension-QT/icon/donateTabIcon_1.png (100%)
rename {SRC => SRC_v3.41.01-beta}/Waifu2x-Extension-QT/icon/gif_Rmenu.png (100%)
rename {SRC => SRC_v3.41.01-beta}/Waifu2x-Extension-QT/icon/icon.ico (100%)
rename {SRC => SRC_v3.41.01-beta}/Waifu2x-Extension-QT/icon/icon_main.png (100%)
rename {SRC => SRC_v3.41.01-beta}/Waifu2x-Extension-QT/icon/opne_folder.png (100%)
rename {SRC => SRC_v3.41.01-beta}/Waifu2x-Extension-QT/icon/patreon.png (100%)
rename {SRC => SRC_v3.41.01-beta}/Waifu2x-Extension-QT/icon/patreon_sysTray.png (100%)
rename {SRC => SRC_v3.41.01-beta}/Waifu2x-Extension-QT/icon/pause-button.png (100%)
rename {SRC => SRC_v3.41.01-beta}/Waifu2x-Extension-QT/icon/paypal.png (100%)
rename {SRC => SRC_v3.41.01-beta}/Waifu2x-Extension-QT/icon/picture_Rmenu.png (100%)
rename {SRC => SRC_v3.41.01-beta}/Waifu2x-Extension-QT/icon/refresh.png (100%)
rename {SRC => SRC_v3.41.01-beta}/Waifu2x-Extension-QT/icon/video_Rmenu.png (100%)
rename {SRC => SRC_v3.41.01-beta}/Waifu2x-Extension-QT/icon/view_file.png (100%)
rename {SRC => SRC_v3.41.01-beta}/Waifu2x-Extension-QT/image.cpp (100%)
rename {SRC => SRC_v3.41.01-beta}/Waifu2x-Extension-QT/language_Chinese.qm (100%)
rename {SRC => SRC_v3.41.01-beta}/Waifu2x-Extension-QT/language_Chinese.ts (100%)
rename {SRC => SRC_v3.41.01-beta}/Waifu2x-Extension-QT/language_English.qm (100%)
rename {SRC => SRC_v3.41.01-beta}/Waifu2x-Extension-QT/language_English.ts (100%)
rename {SRC => SRC_v3.41.01-beta}/Waifu2x-Extension-QT/language_TraditionalChinese.qm (100%)
rename {SRC => SRC_v3.41.01-beta}/Waifu2x-Extension-QT/language_TraditionalChinese.ts (100%)
rename {SRC => SRC_v3.41.01-beta}/Waifu2x-Extension-QT/main.cpp (97%)
rename {SRC => SRC_v3.41.01-beta}/Waifu2x-Extension-QT/mainwindow.cpp (97%)
rename {SRC => SRC_v3.41.01-beta}/Waifu2x-Extension-QT/mainwindow.h (97%)
rename {SRC => SRC_v3.41.01-beta}/Waifu2x-Extension-QT/mainwindow.ui (97%)
rename {SRC => SRC_v3.41.01-beta}/Waifu2x-Extension-QT/progressBar.cpp (96%)
rename {SRC => SRC_v3.41.01-beta}/Waifu2x-Extension-QT/realsr_ncnn_vulkan.cpp (97%)
rename {SRC => SRC_v3.41.01-beta}/Waifu2x-Extension-QT/settings.cpp (98%)
rename {SRC => SRC_v3.41.01-beta}/Waifu2x-Extension-QT/srmd-cuda.cpp (100%)
rename {SRC => SRC_v3.41.01-beta}/Waifu2x-Extension-QT/srmd_ncnn_vulkan.cpp (97%)
rename {SRC => SRC_v3.41.01-beta}/Waifu2x-Extension-QT/table.cpp (97%)
rename {SRC => SRC_v3.41.01-beta}/Waifu2x-Extension-QT/textBrowser.cpp (97%)
rename {SRC => SRC_v3.41.01-beta}/Waifu2x-Extension-QT/topsupporterslist.cpp (100%)
rename {SRC => SRC_v3.41.01-beta}/Waifu2x-Extension-QT/topsupporterslist.h (100%)
rename {SRC => SRC_v3.41.01-beta}/Waifu2x-Extension-QT/topsupporterslist.ui (100%)
rename {SRC => SRC_v3.41.01-beta}/Waifu2x-Extension-QT/video.cpp (97%)
rename {SRC => SRC_v3.41.01-beta}/Waifu2x-Extension-QT/waifu2x.cpp (97%)
rename {SRC => SRC_v3.41.01-beta}/Waifu2x-Extension-QT/waifu2x_caffe.cpp (97%)
rename {SRC => SRC_v3.41.01-beta}/Waifu2x-Extension-QT/waifu2x_converter.cpp (97%)
rename {SRC => SRC_v3.41.01-beta}/Waifu2x-Extension-QT/waifu2x_ncnn_vulkan.cpp (97%)
diff --git a/SRC/FFmpeg_Encoders_List_waifu2xEX.bat b/SRC_v3.41.01-beta/FFmpeg_Encoders_List_waifu2xEX.bat
similarity index 100%
rename from SRC/FFmpeg_Encoders_List_waifu2xEX.bat
rename to SRC_v3.41.01-beta/FFmpeg_Encoders_List_waifu2xEX.bat
diff --git a/SRC/NFSound_Waifu2xEX.mp3 b/SRC_v3.41.01-beta/NFSound_Waifu2xEX.mp3
similarity index 100%
rename from SRC/NFSound_Waifu2xEX.mp3
rename to SRC_v3.41.01-beta/NFSound_Waifu2xEX.mp3
diff --git a/SRC/Waifu2x-Extension-QT-Launcher/SyncToy_6b5b848b-c6b5-49fc-98b9-312103aae1dc.dat b/SRC_v3.41.01-beta/Waifu2x-Extension-QT-Launcher/SyncToy_6b5b848b-c6b5-49fc-98b9-312103aae1dc.dat
similarity index 100%
rename from SRC/Waifu2x-Extension-QT-Launcher/SyncToy_6b5b848b-c6b5-49fc-98b9-312103aae1dc.dat
rename to SRC_v3.41.01-beta/Waifu2x-Extension-QT-Launcher/SyncToy_6b5b848b-c6b5-49fc-98b9-312103aae1dc.dat
diff --git a/SRC/Waifu2x-Extension-QT-Launcher/TitleImage.png b/SRC_v3.41.01-beta/Waifu2x-Extension-QT-Launcher/TitleImage.png
similarity index 100%
rename from SRC/Waifu2x-Extension-QT-Launcher/TitleImage.png
rename to SRC_v3.41.01-beta/Waifu2x-Extension-QT-Launcher/TitleImage.png
diff --git a/SRC/Waifu2x-Extension-QT-Launcher/Waifu2x-Extension-QT-Launcher.pro b/SRC_v3.41.01-beta/Waifu2x-Extension-QT-Launcher/Waifu2x-Extension-QT-Launcher.pro
similarity index 100%
rename from SRC/Waifu2x-Extension-QT-Launcher/Waifu2x-Extension-QT-Launcher.pro
rename to SRC_v3.41.01-beta/Waifu2x-Extension-QT-Launcher/Waifu2x-Extension-QT-Launcher.pro
diff --git a/SRC/Waifu2x-Extension-QT-Launcher/Waifu2x-Extension-QT-Launcher.pro.user b/SRC_v3.41.01-beta/Waifu2x-Extension-QT-Launcher/Waifu2x-Extension-QT-Launcher.pro.user
similarity index 100%
rename from SRC/Waifu2x-Extension-QT-Launcher/Waifu2x-Extension-QT-Launcher.pro.user
rename to SRC_v3.41.01-beta/Waifu2x-Extension-QT-Launcher/Waifu2x-Extension-QT-Launcher.pro.user
diff --git a/SRC/Waifu2x-Extension-QT-Launcher/icon/icon.ico b/SRC_v3.41.01-beta/Waifu2x-Extension-QT-Launcher/icon/icon.ico
similarity index 100%
rename from SRC/Waifu2x-Extension-QT-Launcher/icon/icon.ico
rename to SRC_v3.41.01-beta/Waifu2x-Extension-QT-Launcher/icon/icon.ico
diff --git a/SRC/Waifu2x-Extension-QT-Launcher/icon/icon_main.png b/SRC_v3.41.01-beta/Waifu2x-Extension-QT-Launcher/icon/icon_main.png
similarity index 100%
rename from SRC/Waifu2x-Extension-QT-Launcher/icon/icon_main.png
rename to SRC_v3.41.01-beta/Waifu2x-Extension-QT-Launcher/icon/icon_main.png
diff --git a/SRC/Waifu2x-Extension-QT-Launcher/main.cpp b/SRC_v3.41.01-beta/Waifu2x-Extension-QT-Launcher/main.cpp
similarity index 100%
rename from SRC/Waifu2x-Extension-QT-Launcher/main.cpp
rename to SRC_v3.41.01-beta/Waifu2x-Extension-QT-Launcher/main.cpp
diff --git a/SRC/Waifu2x-Extension-QT-Launcher/mainwindow.cpp b/SRC_v3.41.01-beta/Waifu2x-Extension-QT-Launcher/mainwindow.cpp
similarity index 100%
rename from SRC/Waifu2x-Extension-QT-Launcher/mainwindow.cpp
rename to SRC_v3.41.01-beta/Waifu2x-Extension-QT-Launcher/mainwindow.cpp
diff --git a/SRC/Waifu2x-Extension-QT-Launcher/mainwindow.h b/SRC_v3.41.01-beta/Waifu2x-Extension-QT-Launcher/mainwindow.h
similarity index 100%
rename from SRC/Waifu2x-Extension-QT-Launcher/mainwindow.h
rename to SRC_v3.41.01-beta/Waifu2x-Extension-QT-Launcher/mainwindow.h
diff --git a/SRC/Waifu2x-Extension-QT-Launcher/mainwindow.ui b/SRC_v3.41.01-beta/Waifu2x-Extension-QT-Launcher/mainwindow.ui
similarity index 100%
rename from SRC/Waifu2x-Extension-QT-Launcher/mainwindow.ui
rename to SRC_v3.41.01-beta/Waifu2x-Extension-QT-Launcher/mainwindow.ui
diff --git a/SRC/Waifu2x-Extension-QT-Launcher/pic.qrc b/SRC_v3.41.01-beta/Waifu2x-Extension-QT-Launcher/pic.qrc
similarity index 100%
rename from SRC/Waifu2x-Extension-QT-Launcher/pic.qrc
rename to SRC_v3.41.01-beta/Waifu2x-Extension-QT-Launcher/pic.qrc
diff --git a/SRC/Waifu2x-Extension-QT/AnimatedPNG.cpp b/SRC_v3.41.01-beta/Waifu2x-Extension-QT/AnimatedPNG.cpp
similarity index 100%
rename from SRC/Waifu2x-Extension-QT/AnimatedPNG.cpp
rename to SRC_v3.41.01-beta/Waifu2x-Extension-QT/AnimatedPNG.cpp
diff --git a/SRC/Waifu2x-Extension-QT/Anime4K.cpp b/SRC_v3.41.01-beta/Waifu2x-Extension-QT/Anime4K.cpp
similarity index 97%
rename from SRC/Waifu2x-Extension-QT/Anime4K.cpp
rename to SRC_v3.41.01-beta/Waifu2x-Extension-QT/Anime4K.cpp
index 6911635..7cda3cb 100644
--- a/SRC/Waifu2x-Extension-QT/Anime4K.cpp
+++ b/SRC_v3.41.01-beta/Waifu2x-Extension-QT/Anime4K.cpp
@@ -1,2175 +1,2175 @@
-/*
- Copyright (C) 2021 Aaron Feng
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU Affero General Public License as published
- by the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU Affero General Public License for more details.
-
- You should have received a copy of the GNU Affero General Public License
- along with this program. If not, see .
-
- My Github homepage: https://github.com/AaronFeng753
-*/
-#include "mainwindow.h"
-#include "ui_mainwindow.h"
-/*
-处理图片
-*/
-int MainWindow::Anime4k_Image(int rowNum,bool ReProcess_MissingAlphaChannel)
-{
- //============================= 读取设置 ================================
- int ScaleRatio = 0;
- int denoiseLevel = ui->spinBox_DenoiseLevel_image->value();//获取降噪等级
- bool isDenoiseEnabled = (denoiseLevel != -1);//若降噪等级等于-1就是没启用降噪
- bool DelOriginal = (ui->checkBox_DelOriginal->isChecked()||ui->checkBox_ReplaceOriginalFile->isChecked());
- bool PreserveAlphaChannel = Imgae_hasAlphaChannel(rowNum);
- QString OutPutPath_Final ="";
- //========================= 拆解map得到参数 =============================
- emit Send_Table_image_ChangeStatus_rowNumInt_statusQString(rowNum, "Processing");
- QString SourceFile_fullPath = Table_model_image->item(rowNum,2)->text();
- if(!QFile::exists(SourceFile_fullPath))
- {
- emit Send_TextBrowser_NewMessage(tr("Error occured when processing [")+SourceFile_fullPath+tr("]. Error: [File does not exist.]"));
- emit Send_Table_image_ChangeStatus_rowNumInt_statusQString(rowNum, "Failed");
- emit Send_progressbar_Add();
- mutex_ThreadNumRunning.lock();
- ThreadNumRunning--;
- mutex_ThreadNumRunning.unlock();//线程数量统计-1
- return 0;
- }
- //========= 转换到 PNG =========
- QString SourceFile_fullPath_Original = SourceFile_fullPath;
- SourceFile_fullPath = Imgae_PreProcess(SourceFile_fullPath_Original,ReProcess_MissingAlphaChannel);
- //================================
- // 自定义分辨率设定
- //================================
- bool CustRes_isEnabled = false;
- int CustRes_height=0;
- int CustRes_width=0;
- if(CustRes_isContained(SourceFile_fullPath_Original))
- {
- CustRes_isEnabled=true;
- QMap Res_map = CustRes_getResMap(SourceFile_fullPath_Original);//res_map["fullpath"],["height"],["width"]
- ScaleRatio = CustRes_CalNewScaleRatio(SourceFile_fullPath,Res_map["height"].toInt(),Res_map["width"].toInt());
- if(ScaleRatio==0)
- {
- emit Send_TextBrowser_NewMessage(tr("Error occured when processing [")+SourceFile_fullPath_Original+tr("]. Error: [The resolution of the source file cannot be read, so the image cannot be scaled to a custom resolution.]"));
- emit Send_Table_image_ChangeStatus_rowNumInt_statusQString(rowNum, "Failed");
- emit Send_progressbar_Add();
- mutex_ThreadNumRunning.lock();
- ThreadNumRunning--;
- mutex_ThreadNumRunning.unlock();//线程数量统计-1
- return 0;
- }
- CustRes_height=Res_map["height"].toInt();
- CustRes_width=Res_map["width"].toInt();
- }
- else
- {
- double ScaleRatio_double_tmp = ui->doubleSpinBox_ScaleRatio_image->value();
- if(ScaleRatio_double_tmp == (int)ScaleRatio_double_tmp)
- {
- ScaleRatio = qRound(ScaleRatio_double_tmp);
- }
- else
- {
- CustRes_isEnabled=true;
- QMap Res_map = DoubleScaleRatio_Cal_NewScaleRatio_NewHW(SourceFile_fullPath,ScaleRatio_double_tmp);
- //====
- if(Res_map.isEmpty())
- {
- emit Send_TextBrowser_NewMessage(tr("Error occured when processing [")+SourceFile_fullPath+tr("]. Error: [Unable to read the resolution of the source file.]"));
- emit Send_Table_image_ChangeStatus_rowNumInt_statusQString(rowNum, "Failed");
- emit Send_progressbar_Add();
- mutex_ThreadNumRunning.lock();
- ThreadNumRunning--;
- mutex_ThreadNumRunning.unlock();//线程数量统计-1
- return 0;
- }
- //====
- ScaleRatio = Res_map["ScaleRatio"].toInt();
- CustRes_height = Res_map["Height_new"].toInt();
- CustRes_width = Res_map["width_new"].toInt();
- }
- }
- //=======================================================
- QFileInfo fileinfo(SourceFile_fullPath);
- QString SourceFile_fullPath_FileName = file_getBaseName(SourceFile_fullPath);
- QString SourceFile_fullPath_FileExt = fileinfo.suffix();
- QString SourceFile_fullPath_FolderPath = file_getFolderPath(fileinfo);
- QString OutPut_Path = SourceFile_fullPath_FolderPath + "/" + SourceFile_fullPath_FileName + "_waifu2x_"+QString::number(ScaleRatio, 10)+"x_"+SourceFile_fullPath_FileExt+".png";
- if(isDenoiseEnabled == true)
- {
- OutPut_Path = SourceFile_fullPath_FolderPath + "/" + SourceFile_fullPath_FileName + "_waifu2x_"+QString::number(ScaleRatio, 10)+"x_"+QString::number(denoiseLevel, 10)+"n_"+SourceFile_fullPath_FileExt+".png";
- }
- else
- {
- OutPut_Path = SourceFile_fullPath_FolderPath + "/" + SourceFile_fullPath_FileName + "_waifu2x_"+QString::number(ScaleRatio, 10)+"x_"+SourceFile_fullPath_FileExt+".png";
- }
- //============================== 放大 =======================================
- QProcess *Waifu2x = new QProcess();
- QString CMD = "\"" + Anime4k_ProgramPath + "\" -i \"" + SourceFile_fullPath + "\" -o \"" + OutPut_Path + "\" -z " + QString::number(ScaleRatio, 10) + HDNDenoiseLevel_image + Anime4k_ReadSettings(PreserveAlphaChannel);
- //========
- for(int retry=0; retry<(ui->spinBox_retry->value()+ForceRetryCount); retry++)
- {
- Waifu2x->start(CMD);
- while(!Waifu2x->waitForStarted(100)&&!QProcess_stop) {}
- while(!Waifu2x->waitForFinished(500)&&!QProcess_stop)
- {
- if(waifu2x_STOP)
- {
- Waifu2x->close();
- QFile::remove(OutPut_Path);
- emit Send_Table_image_ChangeStatus_rowNumInt_statusQString(rowNum, "Interrupted");
- mutex_ThreadNumRunning.lock();
- ThreadNumRunning--;
- mutex_ThreadNumRunning.unlock();
- return 0;
- }
- }
- DelTrash_ForceRetry_Anime4k(OutPut_Path);//删除强制关闭导致生成的垃圾缓存文件
- if(QFile::exists(OutPut_Path))//判断是否成功输出目标文件
- {
- break;
- }
- else
- {
- if(retry==ui->spinBox_retry->value()+(ForceRetryCount-1))break;
- Delay_sec_sleep(5);
- emit Send_TextBrowser_NewMessage(tr("Automatic retry, please wait."));
- }
- }
- //========
- if(QFile::exists(OutPut_Path)==false)
- {
- if(SourceFile_fullPath_Original!=SourceFile_fullPath)
- {
- QFile::remove(SourceFile_fullPath);
- }
- emit Send_TextBrowser_NewMessage(tr("Error occured when processing [")+SourceFile_fullPath_Original+tr("]. Error: [Unable to scale the picture.]"));
- emit Send_Table_image_ChangeStatus_rowNumInt_statusQString(rowNum, "Failed");
- emit Send_progressbar_Add();
- mutex_ThreadNumRunning.lock();
- ThreadNumRunning--;
- mutex_ThreadNumRunning.unlock();
- return 0;
- }
- //============================ 调整大小 ====================================================
- if(CustRes_isEnabled == true)
- {
- do
- {
- QImage qimage_adj(OutPut_Path);
- //读取放大后的图片并调整大小
- QImage qimage_adj_scaled = qimage_adj.scaled(CustRes_width,CustRes_height,CustRes_AspectRatioMode,Qt::SmoothTransformation);
- QImageWriter qimageW_adj;
- qimageW_adj.setFormat("png");
- qimageW_adj.setFileName(OutPut_Path);
- if(qimageW_adj.canWrite())
- {
- qimageW_adj.write(qimage_adj_scaled);
- }
- if(!QFile::exists(OutPut_Path))
- {
- emit Send_TextBrowser_NewMessage(tr("Error occured when processing [")+SourceFile_fullPath+tr("]. Error: [Unable to resize the scaled picture to the target size]"));
- emit Send_Table_image_ChangeStatus_rowNumInt_statusQString(rowNum, "Failed");
- emit Send_progressbar_Add();
- mutex_ThreadNumRunning.lock();
- ThreadNumRunning--;
- mutex_ThreadNumRunning.unlock();//线程数量统计-1
- return 0;
- }
- }
- while(false);
- QString OutPut_Path_CustRes = SourceFile_fullPath_FolderPath + "/" + SourceFile_fullPath_FileName + "_waifu2x_"+QString::number(CustRes_width, 10)+"x"+QString::number(CustRes_height, 10)+"_"+SourceFile_fullPath_FileExt+".png";
- QFile::remove(OutPut_Path_CustRes);
- QFile::rename(OutPut_Path,OutPut_Path_CustRes);
- //=========================== 另存为JPG&压缩JPG ===========================================
- OutPutPath_Final = SaveImageAs_FormatAndQuality(SourceFile_fullPath_Original,OutPut_Path_CustRes,isDenoiseEnabled,denoiseLevel);
- }
- else
- {
- //=========================== 另存为JPG&压缩JPG ===========================================
- OutPutPath_Final = SaveImageAs_FormatAndQuality(SourceFile_fullPath_Original,OutPut_Path,isDenoiseEnabled,denoiseLevel);
- }
- //================== 检查是否丢失了透明通道 =====================
- if(ReProcess_MissingAlphaChannel==false)
- {
- QImage QImage_Final(OutPutPath_Final);
- if(PreserveAlphaChannel == true && QImage_Final.hasAlphaChannel() == false && ui->checkBox_AutoDetectAlphaChannel->isChecked())
- {
- QFile::remove(OutPutPath_Final);
- emit Send_TextBrowser_NewMessage(tr("Since the Alpha channel in the resulting image is lost, this image will be reprocessed to fix it:[")+SourceFile_fullPath_Original+tr("].\nIf the reprocessing happens a lot, you should consider enable [Always pre-process images with Alpha Channel] in [Additional settings]."));
- return Anime4k_Image(rowNum,true);
- }
- }
- //============================= 删除原文件 & 更新table status ============================
- if(SourceFile_fullPath_Original!=SourceFile_fullPath)
- {
- QFile::remove(SourceFile_fullPath);
- }
- if(DelOriginal == true)
- {
- if(ReplaceOriginalFile(SourceFile_fullPath_Original,OutPutPath_Final)==false)
- {
- if(QAction_checkBox_MoveToRecycleBin_checkBox_DelOriginal->isChecked())
- {
- file_MoveToTrash(SourceFile_fullPath_Original);
- }
- else
- {
- QFile::remove(SourceFile_fullPath_Original);
- }
- }
- emit Send_Table_image_ChangeStatus_rowNumInt_statusQString(rowNum, "Finished, original file deleted");
- }
- else
- {
- emit Send_Table_image_ChangeStatus_rowNumInt_statusQString(rowNum, "Finished");
- }
- //========== 移动到输出路径 =========
- if(ui->checkBox_OutPath_isEnabled->isChecked())
- {
- MoveFileToOutputPath(OutPutPath_Final,SourceFile_fullPath_Original);
- }
- //============================ 更新进度条 =================================
- emit Send_progressbar_Add();
- //=========================== 更新线程数量统计==============================
- mutex_ThreadNumRunning.lock();
- ThreadNumRunning--;
- mutex_ThreadNumRunning.unlock();//线程数量统计-1
- //=======
- return 0;
-}
-/*
-处理GIF
-*/
-int MainWindow::Anime4k_GIF(int rowNum)
-{
- //============================= 读取设置 ================================
- int ScaleRatio = ui->doubleSpinBox_ScaleRatio_gif->value();
- bool DelOriginal = (ui->checkBox_DelOriginal->isChecked()||ui->checkBox_ReplaceOriginalFile->isChecked());
- int Sub_gif_ThreadNumRunning = 0;
- QString OutPutPath_Final ="";
- //========================= 拆解map得到参数 =============================
- emit Send_Table_gif_ChangeStatus_rowNumInt_statusQString(rowNum, "Processing");
- QString SourceFile_fullPath = Table_model_gif->item(rowNum,2)->text();
- if(!QFile::exists(SourceFile_fullPath))
- {
- emit Send_TextBrowser_NewMessage(tr("Error occured when processing [")+SourceFile_fullPath+tr("]. Error: [File does not exist.]"));
- emit Send_Table_gif_ChangeStatus_rowNumInt_statusQString(rowNum, "Failed");
- emit Send_progressbar_Add();
- return 0;
- }
- //==========================
- bool CustRes_isEnabled = false;
- int CustRes_height=0;
- int CustRes_width=0;
- if(CustRes_isContained(SourceFile_fullPath))
- {
- CustRes_isEnabled=true;
- QMap Res_map = CustRes_getResMap(SourceFile_fullPath);//res_map["fullpath"],["height"],["width"]
- CustRes_height=Res_map["height"].toInt();
- CustRes_width=Res_map["width"].toInt();
- }
- //==========================
- QFileInfo fileinfo(SourceFile_fullPath);
- QString file_name = file_getBaseName(SourceFile_fullPath);
- QString file_ext = fileinfo.suffix();
- QString file_path = file_getFolderPath(fileinfo);
- QString ResGIFPath = file_path + "/" + file_name + "_waifu2x_"+QString::number(ScaleRatio, 10)+"x.gif";
- //=========================== 获取帧时间 ====================================
- int GIF_Duration = Gif_getDuration(SourceFile_fullPath);
- if(GIF_Duration==0)//检查是否成功获取duration
- {
- emit Send_TextBrowser_NewMessage(tr("Error occured when processing [")+SourceFile_fullPath+tr("]. Error: [Can't get Duration value of GIF file.]"));
- emit Send_Table_gif_ChangeStatus_rowNumInt_statusQString(rowNum, "Failed");
- //file_DelDir(SplitFramesFolderPath);
- emit Send_progressbar_Add();
- return 0;//如果启用stop位,则直接return
- }
- //============================== 拆分 ==========================================
- QString SplitFramesFolderPath = file_path+"/"+file_name+"_SplitFrames_W2xEX";//拆分后存储frame的文件夹
- Gif_splitGif(SourceFile_fullPath,SplitFramesFolderPath);
- //============================== 扫描获取文件名 ===============================
- QStringList Frame_fileName_list = file_getFileNames_in_Folder_nofilter(SplitFramesFolderPath);
- if(Frame_fileName_list.isEmpty())//检查是否成功拆分gif
- {
- emit Send_TextBrowser_NewMessage(tr("Error occured when processing [")+SourceFile_fullPath+tr("]. Error: [Can't split GIF into frames.]"));
- emit Send_Table_gif_ChangeStatus_rowNumInt_statusQString(rowNum, "Failed");
- file_DelDir(SplitFramesFolderPath);
- emit Send_progressbar_Add();
- return 0;//如果启用stop位,则直接return
- }
- //===========建立存储放大后frame的文件夹===========
- QString ScaledFramesFolderPath = SplitFramesFolderPath+"/ScaledFrames_W2xEX";
- if(file_isDirExist(ScaledFramesFolderPath))
- {
- file_DelDir(ScaledFramesFolderPath);
- file_mkDir(ScaledFramesFolderPath);
- }
- else
- {
- file_mkDir(ScaledFramesFolderPath);
- }
- //=============================开始放大==========================
- //启动进度条
- emit Send_CurrentFileProgress_Start(file_name+"."+file_ext,Frame_fileName_list.size());
- FileProgressWatch_isEnabled=true;
- QFuture FileProgressWatch_QFuture = QtConcurrent::run(this, &MainWindow::CurrentFileProgress_WatchFolderFileNum, ScaledFramesFolderPath);//启动waifu2x 主线程
- if(ui->checkBox_ShowInterPro->isChecked()==false)
- {
- FileProgressWatch_isEnabled=false;
- FileProgressWatch_QFuture.cancel();
- emit Send_CurrentFileProgress_Stop();
- }
- //=======获取显卡信息========
- int NumOfGPU = 1;
- if(ui->checkBox_SpecifyGPU_Anime4k->isChecked()==true)
- {
- NumOfGPU = Get_NumOfGPU_Anime4k();
- }
- //============创建显卡文件夹===========
- QStringList GPU_SplitFramesFolderPath_List;
- for(int i = 0; i < NumOfGPU; i++)
- {
- QString GPU_SplitFramesFolderPath = SplitFramesFolderPath+"/"+"GPU_"+QString::number(i);
- if(file_isDirExist(GPU_SplitFramesFolderPath))
- {
- file_DelDir(GPU_SplitFramesFolderPath);
- file_mkDir(GPU_SplitFramesFolderPath);
- }
- else
- {
- file_mkDir(GPU_SplitFramesFolderPath);
- }
- GPU_SplitFramesFolderPath_List.append(GPU_SplitFramesFolderPath);
- }
- int TotalFramesNum = Frame_fileName_list.size();
- int FramesNumForEachGPU = TotalFramesNum/NumOfGPU;
- if(FramesNumForEachGPU<1)FramesNumForEachGPU=1;
- int start_num=0;
- for(int x = 0; x < GPU_SplitFramesFolderPath_List.size(); x++)
- {
- if(x==GPU_SplitFramesFolderPath_List.size()-1)FramesNumForEachGPU=TotalFramesNum;
- QStringList file_waitformove = Frame_fileName_list.mid(start_num,FramesNumForEachGPU);
- for(int i = 0; i < file_waitformove.size(); i++)
- {
- QString FileName = file_waitformove.at(i);
- QFile::rename(SplitFramesFolderPath+"/"+FileName,GPU_SplitFramesFolderPath_List.at(x)+"/"+FileName);
- }
- start_num+=FramesNumForEachGPU;
- }
- //===
- QMap Sub_Thread_info;
- Sub_Thread_info["ScaledFramesFolderPath"]=ScaledFramesFolderPath;
- if(CustRes_isEnabled == true)
- {
- Sub_Thread_info["ScaleRatio"] = QString("%1").arg(CustRes_CalNewScaleRatio(SourceFile_fullPath,CustRes_height,CustRes_width));
- }
- else
- {
- Sub_Thread_info["ScaleRatio"] = QString("%1").arg(qRound(ui->doubleSpinBox_ScaleRatio_gif->value()));
- }
- //=========================
- bool Frame_failed = false;//放大失败标志
- //=========================
- for(int i = 0; i < GPU_SplitFramesFolderPath_List.size(); i++)
- {
- Sub_Thread_info["SplitFramesFolderPath"]=GPU_SplitFramesFolderPath_List.at(i);
- mutex_SubThreadNumRunning.lock();
- Sub_gif_ThreadNumRunning++;
- mutex_SubThreadNumRunning.unlock();
- QtConcurrent::run(this,&MainWindow::Anime4k_GIF_scale,Sub_Thread_info,&Sub_gif_ThreadNumRunning,&Frame_failed);
- while (Sub_gif_ThreadNumRunning >= NumOfGPU)
- {
- Delay_msec_sleep(500);
- }
- if(waifu2x_STOP)
- {
- while (Sub_gif_ThreadNumRunning > 0)
- {
- Delay_msec_sleep(500);
- }
- FileProgressWatch_isEnabled=false;
- FileProgressWatch_QFuture.cancel();
- file_DelDir(SplitFramesFolderPath);
- emit Send_Table_gif_ChangeStatus_rowNumInt_statusQString(rowNum, "Interrupted");
- return 0;//如果启用stop位,则直接return
- }
- if(Frame_failed)
- {
- FileProgressWatch_isEnabled=false;
- FileProgressWatch_QFuture.cancel();
- emit Send_TextBrowser_NewMessage(tr("Error occured when processing [")+SourceFile_fullPath+tr("]. Error: [Failed to scale frames.]"));
- emit Send_Table_gif_ChangeStatus_rowNumInt_statusQString(rowNum, "Failed");
- file_DelDir(SplitFramesFolderPath);
- emit Send_progressbar_Add();
- return 0;//如果启用stop位,则直接return
- }
- }
- while (Sub_gif_ThreadNumRunning!=0)
- {
- Delay_msec_sleep(500);
- }
- FileProgressWatch_isEnabled=false;
- FileProgressWatch_QFuture.cancel();
- emit Send_CurrentFileProgress_Stop();
- //======================= 检查是否成功放大所有帧 ===========================
- QStringList Frame_fileName_list_scaled = file_getFileNames_in_Folder_nofilter(ScaledFramesFolderPath);
- if(Frame_fileName_list.size()!=Frame_fileName_list_scaled.size())
- {
- emit Send_TextBrowser_NewMessage(tr("Error occured when processing [")+SourceFile_fullPath+tr("]. Error: [Failed to scale frames.]"));
- emit Send_Table_gif_ChangeStatus_rowNumInt_statusQString(rowNum, "Failed");
- file_DelDir(SplitFramesFolderPath);
- emit Send_progressbar_Add();
- return 0;//如果启用stop位,则直接return
- }
- //======================================== 组装 ======================================================
- if(CustRes_isEnabled)
- {
- ResGIFPath = file_path + "/" + file_name + "_waifu2x_"+QString::number(CustRes_width, 10)+"x"+QString::number(CustRes_height,10)+".gif";
- }
- //=======================
- // 修改文件名,添加降噪等级
- //=======================
- int denoiseLevel = ui->spinBox_DenoiseLevel_gif->value();
- if(denoiseLevel != -1)
- {
- QFileInfo fileinfo_tmp(ResGIFPath);
- ResGIFPath = file_getFolderPath(fileinfo_tmp) + "/" + file_getBaseName(ResGIFPath) + "_"+QString::number(denoiseLevel, 10)+"n.gif";
- }
- //======================
- Gif_assembleGif(ResGIFPath,ScaledFramesFolderPath,GIF_Duration,CustRes_isEnabled,CustRes_height,CustRes_width,false,"");
- if(!QFile::exists(ResGIFPath))
- {
- emit Send_TextBrowser_NewMessage(tr("Error occured when processing [")+SourceFile_fullPath+tr("]. Error: [Unable to assemble gif.]"));
- emit Send_Table_gif_ChangeStatus_rowNumInt_statusQString(rowNum, "Failed");
- file_DelDir(SplitFramesFolderPath);
- emit Send_progressbar_Add();
- return 0;//如果启用stop位,则直接return
- }
- OutPutPath_Final = ResGIFPath;
- //======================================= 优化gif ===================================================
- if(ui->checkBox_OptGIF->isChecked() == true)
- {
- QFileInfo fileinfo_tmp(OutPutPath_Final);
- QString ResGIFPath_compressed = file_getFolderPath(fileinfo_tmp) + "/" + file_getBaseName(OutPutPath_Final) + "_opt.gif";
- OutPutPath_Final = Gif_compressGif(ResGIFPath,ResGIFPath_compressed);
- }
- //============================== 删除缓存文件 ====================================================
- file_DelDir(SplitFramesFolderPath);
- //============================= 删除原文件 & & 更新table status ============================
- if(DelOriginal)
- {
- if(ReplaceOriginalFile(SourceFile_fullPath,OutPutPath_Final)==false)
- {
- if(QAction_checkBox_MoveToRecycleBin_checkBox_DelOriginal->isChecked())
- {
- file_MoveToTrash(SourceFile_fullPath);
- }
- else
- {
- QFile::remove(SourceFile_fullPath);
- }
- }
- emit Send_Table_gif_ChangeStatus_rowNumInt_statusQString(rowNum, "Finished, original file deleted");
- }
- else
- {
- emit Send_Table_gif_ChangeStatus_rowNumInt_statusQString(rowNum, "Finished");
- }
- //========== 移动到输出路径 =========
- if(ui->checkBox_OutPath_isEnabled->isChecked())
- {
- MoveFileToOutputPath(OutPutPath_Final,SourceFile_fullPath);
- }
- //============================ 更新进度条 =================================
- emit Send_progressbar_Add();
- //=========================== ==============================
- return 0;
-}
-/*
-Anime4k GIF放大子线程
-放大,修改大小
-*/
-int MainWindow::Anime4k_GIF_scale(QMap Sub_Thread_info,int *Sub_gif_ThreadNumRunning,bool *Frame_failed)
-{
- bool AllFinished=true;
- QString SplitFramesFolderPath = Sub_Thread_info["SplitFramesFolderPath"];
- QString ScaledFramesFolderPath = Sub_Thread_info["ScaledFramesFolderPath"];
- //==================
- // 生成输出文件列表
- //==================
- QStringList OutPutFilesFullPathList;
- do
- {
- QStringList InputFilesNameList = file_getFileNames_in_Folder_nofilter(SplitFramesFolderPath);
- for(int i=0; ispinBox_retry->value()+ForceRetryCount); retry++)
- {
- Anime4k->start(CMD);
- while(!Anime4k->waitForStarted(100)&&!QProcess_stop) {}
- while(!Anime4k->waitForFinished(500)&&!QProcess_stop)
- {
- if(waifu2x_STOP)
- {
- Anime4k->close();
- mutex_SubThreadNumRunning.lock();
- *Sub_gif_ThreadNumRunning=*Sub_gif_ThreadNumRunning-1;
- mutex_SubThreadNumRunning.unlock();
- return 0;
- }
- }
- AllFinished = true;
- for(int i=0; ispinBox_retry->value()+(ForceRetryCount-1))break;
- Delay_sec_sleep(5);
- emit Send_TextBrowser_NewMessage(tr("Automatic retry, please wait."));
- AllFinished=false;
- break;
- }
- }
- if(AllFinished == true)break;
- }
- //=========
- AllFinished = true;
- for(int i=0; idoubleSpinBox_ScaleRatio_video->value();
- bool DelOriginal = (ui->checkBox_DelOriginal->isChecked()||ui->checkBox_ReplaceOriginalFile->isChecked());
- bool isCacheExists = false;
- bool isVideoConfigChanged = true;
- int Sub_video_ThreadNumRunning = 0;
- //========================= 拆解map得到参数 =============================
- emit Send_Table_video_ChangeStatus_rowNumInt_statusQString(rowNum, "Processing");
- QString SourceFile_fullPath = Table_model_video->item(rowNum,2)->text();
- if(!QFile::exists(SourceFile_fullPath))
- {
- emit Send_TextBrowser_NewMessage(tr("Error occured when processing [")+SourceFile_fullPath+tr("]. Error: [File does not exist.]"));
- emit Send_Table_video_ChangeStatus_rowNumInt_statusQString(rowNum, "Failed");
- emit Send_progressbar_Add();
- return 0;
- }
- //==========================
- QFileInfo fileinfo(SourceFile_fullPath);
- QString file_name = file_getBaseName(SourceFile_fullPath);
- QString file_ext = fileinfo.suffix();
- QString file_path = file_getFolderPath(fileinfo);
- //===================================================================
- //生成mp4
- QString video_mp4_fullpath=video_To_CFRMp4(SourceFile_fullPath);
- if(!QFile::exists(video_mp4_fullpath))//检查是否成功生成mp4
- {
- emit Send_TextBrowser_NewMessage(tr("Error occured when processing [")+SourceFile_fullPath+tr("]. Error: [Cannot convert video format to mp4.]"));
- emit Send_Table_video_ChangeStatus_rowNumInt_statusQString(rowNum, "Failed");
- emit Send_progressbar_Add();
- return 0;//如果启用stop位,则直接return
- }
- QString AudioPath = file_path+"/Audio_"+file_name+"_"+file_ext+"_W2xEX.wav";//音频
- QString SplitFramesFolderPath = file_path+"/"+file_name+"_"+file_ext+"_SplitFrames_W2xEX";//拆分后存储frame的文件夹
- QString ScaledFramesFolderPath = SplitFramesFolderPath+"/ScaledFrames_W2xEX";//存储放大后的帧
- //==========================
- // 读取自定义分辨率设定
- //==========================
- bool CustRes_isEnabled = false;
- int CustRes_height=0;
- int CustRes_width=0;
- if(CustRes_isContained(SourceFile_fullPath))
- {
- CustRes_isEnabled=true;
- QMap Res_map = CustRes_getResMap(SourceFile_fullPath);//res_map["fullpath"],["height"],["width"]
- CustRes_height=Res_map["height"].toInt();
- CustRes_width=Res_map["width"].toInt();
- }
- //==========================
- // 检测之前的视频配置文件
- //==========================
- QString VideoConfiguration_fullPath = file_path+"/VideoConfiguration_"+file_name+"_"+file_ext+"_Waifu2xEX.ini";
- if(QFile::exists(VideoConfiguration_fullPath))
- {
- QSettings *configIniRead = new QSettings(VideoConfiguration_fullPath, QSettings::IniFormat);
- configIniRead->setIniCodec(QTextCodec::codecForName("UTF-8"));
- //=================== 加载之前存储的视频信息 =========================
- int ScaleRatio_old = configIniRead->value("/VideoConfiguration/ScaleRatio").toInt();
- bool CustRes_isEnabled_old = configIniRead->value("/VideoConfiguration/CustRes_isEnabled").toBool();
- int CustRes_height_old = configIniRead->value("/VideoConfiguration/CustRes_height").toInt();
- int CustRes_width_old = configIniRead->value("/VideoConfiguration/CustRes_width").toInt();
- QString EngineName_old = configIniRead->value("/VideoConfiguration/EngineName").toString();
- bool isProcessBySegment_old = configIniRead->value("/VideoConfiguration/isProcessBySegment").toBool();
- //=================== 比对信息 ================================
- if(EngineName_old=="anime4k")
- {
- if(CustRes_isEnabled_old==false&&CustRes_isEnabled==false)
- {
- if(ScaleRatio_old!=ScaleRatio)
- {
- isVideoConfigChanged=true;
- }
- else
- {
- isVideoConfigChanged=false;
- }
- }
- else
- {
- if(CustRes_isEnabled_old==true&&CustRes_isEnabled==true)
- {
- if(CustRes_height_old!=CustRes_height||CustRes_width_old!=CustRes_width)
- {
- isVideoConfigChanged=true;
- }
- else
- {
- isVideoConfigChanged=false;
- }
- }
- else
- {
- isVideoConfigChanged=true;
- }
- }
- if(isProcessBySegment_old==true)
- {
- isVideoConfigChanged=true;
- }
- }
- else
- {
- isVideoConfigChanged=true;
- }
- }
- else
- {
- emit Send_video_write_VideoConfiguration(VideoConfiguration_fullPath,ScaleRatio,0,CustRes_isEnabled,CustRes_height,CustRes_width,"anime4k",false,"","",ui->groupBox_FrameInterpolation->isChecked(),0);
- }
- //=======================
- // 检测缓存是否存在
- //=======================
- if(QFile::exists(video_mp4_fullpath)&&file_isDirExist(SplitFramesFolderPath)&&file_isDirExist(ScaledFramesFolderPath)&&QFile::exists(VideoConfiguration_fullPath))
- {
- if(!isVideoConfigChanged)
- {
- isCacheExists=true;
- emit Send_TextBrowser_NewMessage(tr("The previous video cache file is detected and processing of the previous video cache will continue. If you want to restart processing of the current video:[")+SourceFile_fullPath+tr("], delete the cache manually."));
- }
- else
- {
- isCacheExists=false;
- //========
- QFile::remove(VideoConfiguration_fullPath);
- file_DelDir(SplitFramesFolderPath);
- QFile::remove(AudioPath);
- DelVfiDir(video_mp4_fullpath);
- emit Send_video_write_VideoConfiguration(VideoConfiguration_fullPath,ScaleRatio,0,CustRes_isEnabled,CustRes_height,CustRes_width,"anime4k",false,"","",ui->groupBox_FrameInterpolation->isChecked(),0);
- //=======
- emit Send_TextBrowser_NewMessage(tr("The previous video cache file was detected, but because you changed the settings about the video resolution, the previous cache will be deleted and processing of the video:[")+SourceFile_fullPath+tr("] will restart."));
- }
- }
- else
- {
- isCacheExists=false;
- //========
- QFile::remove(VideoConfiguration_fullPath);
- file_DelDir(SplitFramesFolderPath);
- QFile::remove(AudioPath);
- DelVfiDir(video_mp4_fullpath);
- emit Send_video_write_VideoConfiguration(VideoConfiguration_fullPath,ScaleRatio,0,CustRes_isEnabled,CustRes_height,CustRes_width,"anime4k",false,"","",ui->groupBox_FrameInterpolation->isChecked(),0);
- //========
- }
- //==========================================
- // 拆分(正常)
- //==========================================
- if(!isCacheExists)
- {
- if(file_isDirExist(SplitFramesFolderPath))
- {
- file_DelDir(SplitFramesFolderPath);
- file_mkDir(SplitFramesFolderPath);
- }
- else
- {
- file_mkDir(SplitFramesFolderPath);
- }
- QFile::remove(AudioPath);
- video_video2images(video_mp4_fullpath,SplitFramesFolderPath,AudioPath);
- if(waifu2x_STOP)
- {
- emit Send_Table_video_ChangeStatus_rowNumInt_statusQString(rowNum, "Interrupted");
- return 0;//如果启用stop位,则直接return
- }
- }
- //============================== 扫描获取文件名 ===============================
- QStringList Frame_fileName_list = file_getFileNames_in_Folder_nofilter(SplitFramesFolderPath);
- if(!isCacheExists)
- {
- if(Frame_fileName_list.isEmpty())//检查是否成功拆分为帧
- {
- emit Send_TextBrowser_NewMessage(tr("Error occured when processing [")+SourceFile_fullPath+tr("]. Error: [Unable to split video into pictures.]"));
- emit Send_Table_video_ChangeStatus_rowNumInt_statusQString(rowNum, "Failed");
- emit Send_progressbar_Add();
- return 0;//如果启用stop位,则直接return
- }
- }
- //============================== 放大 =======================================
- //===========建立存储放大后frame的文件夹===========
- if(!isCacheExists)
- {
- if(file_isDirExist(ScaledFramesFolderPath))
- {
- file_DelDir(ScaledFramesFolderPath);
- file_mkDir(ScaledFramesFolderPath);
- }
- else
- {
- file_mkDir(ScaledFramesFolderPath);
- }
- }
- //==========开始放大==========================
- emit Send_CurrentFileProgress_Start(file_name+"."+file_ext,(Frame_fileName_list.size()+file_getFileNames_in_Folder_nofilter(ScaledFramesFolderPath).size()));
- FileProgressWatch_isEnabled=true;
- QFuture FileProgressWatch_QFuture = QtConcurrent::run(this, &MainWindow::CurrentFileProgress_WatchFolderFileNum, ScaledFramesFolderPath);//启动waifu2x 主线程
- if(ui->checkBox_ShowInterPro->isChecked()==false)
- {
- FileProgressWatch_isEnabled=false;
- FileProgressWatch_QFuture.cancel();
- emit Send_CurrentFileProgress_Stop();
- }
- //=======获取显卡信息========
- int NumOfGPU = 1;
- if(ui->checkBox_SpecifyGPU_Anime4k->isChecked()==true)
- {
- NumOfGPU = Get_NumOfGPU_Anime4k();
- }
- //============创建显卡文件夹===========
- QStringList GPU_SplitFramesFolderPath_List;
- for(int i = 0; i < NumOfGPU; i++)
- {
- QString GPU_SplitFramesFolderPath = SplitFramesFolderPath+"/"+"GPU_"+QString::number(i);
- if(file_isDirExist(GPU_SplitFramesFolderPath)==false)
- {
- file_DelDir(GPU_SplitFramesFolderPath);
- file_mkDir(GPU_SplitFramesFolderPath);
- }
- else
- {
- file_mkDir(GPU_SplitFramesFolderPath);
- }
- GPU_SplitFramesFolderPath_List.append(GPU_SplitFramesFolderPath);
- }
- int TotalFramesNum = Frame_fileName_list.size();
- int FramesNumForEachGPU = TotalFramesNum/NumOfGPU;
- if(FramesNumForEachGPU<1)FramesNumForEachGPU=1;
- int start_num=0;
- for(int x = 0; x < GPU_SplitFramesFolderPath_List.size(); x++)
- {
- if(x==GPU_SplitFramesFolderPath_List.size()-1)FramesNumForEachGPU=TotalFramesNum;
- QStringList file_waitformove = Frame_fileName_list.mid(start_num,FramesNumForEachGPU);
- for(int i = 0; i < file_waitformove.size(); i++)
- {
- QString FileName = file_waitformove.at(i);
- QFile::rename(SplitFramesFolderPath+"/"+FileName,GPU_SplitFramesFolderPath_List.at(x)+"/"+FileName);
- }
- start_num+=FramesNumForEachGPU;
- }
- //=========================
- bool Frame_failed = false;//放大失败标志
- QMap Sub_Thread_info;
- Sub_Thread_info["ScaledFramesFolderPath"]=ScaledFramesFolderPath;
- if(CustRes_isEnabled == true)
- {
- Sub_Thread_info["ScaleRatio"] = QString("%1").arg(CustRes_CalNewScaleRatio(video_mp4_fullpath,CustRes_height,CustRes_width));
- }
- else
- {
- Sub_Thread_info["ScaleRatio"] = QString("%1").arg(ScaleRatio);
- }
- //=========================
- for(int i = 0; i < GPU_SplitFramesFolderPath_List.size(); i++)
- {
- Sub_Thread_info["SplitFramesFolderPath"]=GPU_SplitFramesFolderPath_List.at(i);
- mutex_SubThreadNumRunning.lock();
- Sub_video_ThreadNumRunning++;
- mutex_SubThreadNumRunning.unlock();
- QtConcurrent::run(this,&MainWindow::Anime4k_Video_scale,Sub_Thread_info,&Sub_video_ThreadNumRunning,&Frame_failed);
- while (Sub_video_ThreadNumRunning >= NumOfGPU)
- {
- Delay_msec_sleep(500);
- }
- if(waifu2x_STOP)
- {
- while (Sub_video_ThreadNumRunning > 0)
- {
- Delay_msec_sleep(500);
- }
- FileProgressWatch_isEnabled=false;
- FileProgressWatch_QFuture.cancel();
- Restore_SplitFramesFolderPath(SplitFramesFolderPath,GPU_SplitFramesFolderPath_List);
- emit Send_Table_video_ChangeStatus_rowNumInt_statusQString(rowNum, "Interrupted");
- return 0;//如果启用stop位,则直接return
- }
- if(Frame_failed)
- {
- FileProgressWatch_isEnabled=false;
- FileProgressWatch_QFuture.cancel();
- Restore_SplitFramesFolderPath(SplitFramesFolderPath,GPU_SplitFramesFolderPath_List);
- emit Send_TextBrowser_NewMessage(tr("Error occured when processing [")+SourceFile_fullPath+tr("]. Error: [Failed to scale frames.]"));
- emit Send_Table_video_ChangeStatus_rowNumInt_statusQString(rowNum, "Failed");
- emit Send_progressbar_Add();
- return 0;//如果启用stop位,则直接return
- }
- }
- while (Sub_video_ThreadNumRunning!=0)
- {
- Delay_msec_sleep(500);
- }
- FileProgressWatch_isEnabled=false;
- FileProgressWatch_QFuture.cancel();
- emit Send_CurrentFileProgress_Stop();
- //================ 扫描放大后的帧文件数量,判断是否放大成功 =======================
- QStringList Frame_fileName_list_scaled = file_getFileNames_in_Folder_nofilter(ScaledFramesFolderPath);
- if(Frame_fileName_list_scaled.size()spinBox_DenoiseLevel_video->value();
- if(denoiseLevel != -1)
- {
- denoiseLevel_inName_str = QString::number(denoiseLevel,10)+"n_";
- }
- //生成最终视频文件名
- QString video_mp4_scaled_fullpath = "";
- if(CustRes_isEnabled == true)
- {
- video_mp4_scaled_fullpath = file_path+"/"+file_name+"_waifu2x_"+QString::number(CustRes_width,10)+"x"+QString::number(CustRes_height,10)+"_"+denoiseLevel_inName_str+file_ext+".mp4";
- }
- else
- {
- video_mp4_scaled_fullpath = file_path+"/"+file_name+"_waifu2x_"+QString::number(ScaleRatio,10)+"x_"+denoiseLevel_inName_str+file_ext+".mp4";
- }
- video_images2video(video_mp4_fullpath,video_mp4_scaled_fullpath,ScaledFramesFolderPath,AudioPath,CustRes_isEnabled,CustRes_height,CustRes_width,false);
- if(QFile::exists(video_mp4_scaled_fullpath)==false)//检查是否成功成功生成视频
- {
- if(waifu2x_STOP)
- {
- emit Send_Table_video_ChangeStatus_rowNumInt_statusQString(rowNum, "Interrupted");
- return 0;//如果启用stop位,则直接return
- }
- emit Send_TextBrowser_NewMessage(tr("Error occured when processing [")+SourceFile_fullPath+tr("]. Error: [Unable to assemble pictures into videos.]"));
- emit Send_Table_video_ChangeStatus_rowNumInt_statusQString(rowNum, "Failed");
- emit Send_progressbar_Add();
- return 0;//如果启用stop位,则直接return
- }
- //============================== 删除缓存文件 ====================================================
- if(ui->checkBox_KeepVideoCache->isChecked()==false)
- {
- QFile::remove(VideoConfiguration_fullPath);
- file_DelDir(SplitFramesFolderPath);
- QFile::remove(AudioPath);
- if(SourceFile_fullPath!=video_mp4_fullpath)QFile::remove(video_mp4_fullpath);
- }
- else
- {
- DelOriginal=false;
- }
- //============================= 删除原文件 & & 更新table status ============================
- if(DelOriginal)
- {
- if(ReplaceOriginalFile(SourceFile_fullPath,video_mp4_scaled_fullpath)==false)
- {
- if(QAction_checkBox_MoveToRecycleBin_checkBox_DelOriginal->isChecked())
- {
- file_MoveToTrash(SourceFile_fullPath);
- }
- else
- {
- QFile::remove(SourceFile_fullPath);
- }
- }
- emit Send_Table_video_ChangeStatus_rowNumInt_statusQString(rowNum, "Finished, original file deleted");
- }
- else
- {
- emit Send_Table_video_ChangeStatus_rowNumInt_statusQString(rowNum, "Finished");
- }
- //========== 移动到输出路径 =========
- if(ui->checkBox_OutPath_isEnabled->isChecked())
- {
- MoveFileToOutputPath(video_mp4_scaled_fullpath,SourceFile_fullPath);
- }
- //============================ 更新进度条 =================================
- emit Send_progressbar_Add();
- //=========================== ==============================
- return 0;
-}
-/*
-#### 分段处理 ####
-调用Anime4k处理视频
-读取设置,拆分,创建放大子线程,组装视频
-*/
-int MainWindow::Anime4k_Video_BySegment(int rowNum)
-{
- //============================= 读取设置 ================================
- int ScaleRatio = ui->doubleSpinBox_ScaleRatio_video->value();
- bool DelOriginal = (ui->checkBox_DelOriginal->isChecked()||ui->checkBox_ReplaceOriginalFile->isChecked());
- bool isCacheExists = false;
- bool isVideoConfigChanged = true;
- int Sub_video_ThreadNumRunning = 0;
- int SegmentDuration = ui->spinBox_SegmentDuration->value();
- //========================= 拆解map得到参数 =============================
- emit Send_Table_video_ChangeStatus_rowNumInt_statusQString(rowNum, "Processing");
- QString SourceFile_fullPath = Table_model_video->item(rowNum,2)->text();
- if(!QFile::exists(SourceFile_fullPath))
- {
- emit Send_TextBrowser_NewMessage(tr("Error occured when processing [")+SourceFile_fullPath+tr("]. Error: [File does not exist.]"));
- emit Send_Table_video_ChangeStatus_rowNumInt_statusQString(rowNum, "Failed");
- emit Send_progressbar_Add();
- return 0;
- }
- //==========================
- QFileInfo fileinfo(SourceFile_fullPath);
- QString file_name = file_getBaseName(SourceFile_fullPath);
- QString file_ext = fileinfo.suffix();
- QString file_path = file_getFolderPath(fileinfo);
- //===================================================================
- //生成mp4
- QString video_mp4_fullpath=video_To_CFRMp4(SourceFile_fullPath);
- if(!QFile::exists(video_mp4_fullpath))//检查是否成功生成mp4
- {
- emit Send_TextBrowser_NewMessage(tr("Error occured when processing [")+SourceFile_fullPath+tr("]. Error: [Cannot convert video format to mp4.]"));
- emit Send_Table_video_ChangeStatus_rowNumInt_statusQString(rowNum, "Failed");
- emit Send_progressbar_Add();
- return 0;//如果启用stop位,则直接return
- }
- //============= 读取自定义分辨率 =============
- bool CustRes_isEnabled = false;
- int CustRes_height=0;
- int CustRes_width=0;
- if(CustRes_isContained(SourceFile_fullPath))
- {
- CustRes_isEnabled=true;
- QMap Res_map = CustRes_getResMap(SourceFile_fullPath);//res_map["fullpath"],["height"],["width"]
- CustRes_height=Res_map["height"].toInt();
- CustRes_width=Res_map["width"].toInt();
- }
- //=================
- QString AudioPath = file_path+"/Audio_"+file_name+"_"+file_ext+"_W2xEX.wav";//音频
- QString SplitFramesFolderPath = file_path+"/"+file_name+"_"+file_ext+"_SplitFrames_W2xEX";//拆分后存储frame的文件夹
- QString ScaledFramesFolderPath = SplitFramesFolderPath+"/ScaledFrames_W2xEX";//存储放大后的帧
- //===
- QString VideoClipsFolderPath = "";//存储视频片段的文件夹(完整路径)
- QString DateStr = "";
- do
- {
- DateStr = video_getClipsFolderNo();
- VideoClipsFolderPath = file_path+"/"+DateStr+"_VideoClipsWaifu2xEX";//存储视频片段的文件夹(完整路径)
- }
- while(file_isDirExist(VideoClipsFolderPath));
- QString VideoClipsFolderName = DateStr+"_VideoClipsWaifu2xEX";//存储视频片段的文件夹(名称)
- //==========================
- // 检测之前的视频配置文件
- //==========================
- QString VideoConfiguration_fullPath = file_path+"/VideoConfiguration_"+file_name+"_"+file_ext+"_Waifu2xEX.ini";
- if(QFile::exists(VideoConfiguration_fullPath))
- {
- QSettings *configIniRead = new QSettings(VideoConfiguration_fullPath, QSettings::IniFormat);
- configIniRead->setIniCodec(QTextCodec::codecForName("UTF-8"));
- //=================== 加载之前存储的视频信息 =========================
- int ScaleRatio_old = configIniRead->value("/VideoConfiguration/ScaleRatio").toInt();
- bool CustRes_isEnabled_old = configIniRead->value("/VideoConfiguration/CustRes_isEnabled").toBool();
- int CustRes_height_old = configIniRead->value("/VideoConfiguration/CustRes_height").toInt();
- int CustRes_width_old = configIniRead->value("/VideoConfiguration/CustRes_width").toInt();
- QString EngineName_old = configIniRead->value("/VideoConfiguration/EngineName").toString();
- bool isProcessBySegment_old = configIniRead->value("/VideoConfiguration/isProcessBySegment").toBool();
- bool isVideoFrameInterpolationEnabled_old = configIniRead->value("/VideoConfiguration/isVideoFrameInterpolationEnabled").toBool();
- int MultipleOfFPS_old = configIniRead->value("/VideoConfiguration/MultipleOfFPS").toInt();
- //=================== 比对信息 ================================
- if(EngineName_old=="anime4k")
- {
- if(CustRes_isEnabled_old==false&&CustRes_isEnabled==false)
- {
- if(ScaleRatio_old!=ScaleRatio)
- {
- isVideoConfigChanged=true;
- }
- else
- {
- isVideoConfigChanged=false;
- }
- }
- else
- {
- if(CustRes_isEnabled_old==true&&CustRes_isEnabled==true)
- {
- if(CustRes_height_old!=CustRes_height||CustRes_width_old!=CustRes_width)
- {
- isVideoConfigChanged=true;
- }
- else
- {
- isVideoConfigChanged=false;
- }
- }
- else
- {
- isVideoConfigChanged=true;
- }
- }
- if(isProcessBySegment_old == false)
- {
- isVideoConfigChanged=true;
- }
- if(isVideoFrameInterpolationEnabled_old != ui->groupBox_FrameInterpolation->isChecked())
- {
- isVideoConfigChanged=true;
- }
- if(MultipleOfFPS_old != ui->spinBox_MultipleOfFPS_VFI->value() && ui->groupBox_FrameInterpolation->isChecked())
- {
- isVideoConfigChanged=true;
- }
- }
- else
- {
- isVideoConfigChanged=true;
- }
- //============ 修正文件夹名称 =============
- QString VideoClipsFolderPath_old = configIniRead->value("/VideoConfiguration/VideoClipsFolderPath").toString();
- QString VideoClipsFolderName_old = configIniRead->value("/VideoConfiguration/VideoClipsFolderName").toString();
- file_mkDir(VideoClipsFolderPath_old);
- if(file_isDirExist(VideoClipsFolderPath_old)==true)
- {
- VideoClipsFolderPath = VideoClipsFolderPath_old;
- VideoClipsFolderName = VideoClipsFolderName_old;
- }
- }
- else
- {
- emit Send_video_write_VideoConfiguration(VideoConfiguration_fullPath,ScaleRatio,0,CustRes_isEnabled,CustRes_height,CustRes_width,"anime4k",true,VideoClipsFolderPath,VideoClipsFolderName,ui->groupBox_FrameInterpolation->isChecked(),ui->spinBox_MultipleOfFPS_VFI->value());
- }
- //=======================
- // 检测缓存是否存在
- //=======================
- if(file_isDirExist(SplitFramesFolderPath))
- {
- if(!isVideoConfigChanged)
- {
- isCacheExists=true;
- emit Send_TextBrowser_NewMessage(tr("The previous video cache file is detected and processing of the previous video cache will continue. If you want to restart processing of the current video:[")+SourceFile_fullPath+tr("], delete the cache manually."));
- }
- else
- {
- isCacheExists=false;
- //========
- QFile::remove(VideoConfiguration_fullPath);
- file_DelDir(SplitFramesFolderPath);
- file_DelDir(VideoClipsFolderPath);
- QFile::remove(AudioPath);
- DelVfiDir(video_mp4_fullpath);
- emit Send_video_write_VideoConfiguration(VideoConfiguration_fullPath,ScaleRatio,0,CustRes_isEnabled,CustRes_height,CustRes_width,"anime4k",true,VideoClipsFolderPath,VideoClipsFolderName,ui->groupBox_FrameInterpolation->isChecked(),ui->spinBox_MultipleOfFPS_VFI->value());
- //=======
- emit Send_TextBrowser_NewMessage(tr("The previous video cache file was detected, but because you changed the settings about the video resolution, the previous cache will be deleted and processing of the video:[")+SourceFile_fullPath+tr("] will restart."));
- }
- }
- else
- {
- isCacheExists=false;
- //========
- QFile::remove(VideoConfiguration_fullPath);
- file_DelDir(SplitFramesFolderPath);
- file_DelDir(VideoClipsFolderPath);
- QFile::remove(AudioPath);
- DelVfiDir(video_mp4_fullpath);
- emit Send_video_write_VideoConfiguration(VideoConfiguration_fullPath,ScaleRatio,0,CustRes_isEnabled,CustRes_height,CustRes_width,"anime4k",true,VideoClipsFolderPath,VideoClipsFolderName,ui->groupBox_FrameInterpolation->isChecked(),ui->spinBox_MultipleOfFPS_VFI->value());
- //========
- }
- /*====================================
- 提取音频
- ======================================*/
- if(!QFile::exists(AudioPath))
- {
- video_get_audio(video_mp4_fullpath,AudioPath);
- }
- //================================== 开始分段处理视频 =================================================
- int StartTime = 0;//起始时间(秒)
- int VideoDuration = video_get_duration(video_mp4_fullpath);
- bool isSplitComplete = false;
- bool isScaleComplete = false;
- /*
- ============================================
- 开始之前先读取进度
- ============================================
- */
- int OLD_SegmentDuration=-1;
- bool read_OLD_SegmentDuration =false;
- int LastVideoClipNo = -1;
- if(QFile::exists(VideoConfiguration_fullPath))
- {
- QSettings *configIniRead = new QSettings(VideoConfiguration_fullPath, QSettings::IniFormat);
- configIniRead->setIniCodec(QTextCodec::codecForName("UTF-8"));
- //=================== 加载进度 =========================
- StartTime = configIniRead->value("/Progress/StartTime").toInt();
- isSplitComplete = configIniRead->value("/Progress/isSplitComplete").toBool();
- isScaleComplete = configIniRead->value("/Progress/isScaleComplete").toBool();
- OLD_SegmentDuration = configIniRead->value("/Progress/OLDSegmentDuration").toInt();
- LastVideoClipNo = configIniRead->value("/Progress/LastVideoClipNo").toInt();
- }
- if(OLD_SegmentDuration>0)
- {
- read_OLD_SegmentDuration = true;
- }
- /*
- 加载进度条
- */
- int SegmentDuration_tmp_progressbar = 0;
- if(read_OLD_SegmentDuration)
- {
- SegmentDuration_tmp_progressbar = OLD_SegmentDuration;
- }
- else
- {
- SegmentDuration_tmp_progressbar = SegmentDuration;
- }
- if(ui->checkBox_ShowInterPro->isChecked()&&VideoDuration>SegmentDuration_tmp_progressbar)
- {
- emit Send_CurrentFileProgress_Start(file_name+"."+file_ext,VideoDuration);
- if(StartTime>0)
- {
- emit Send_CurrentFileProgress_progressbar_Add_SegmentDuration(StartTime);
- }
- }
- /*
- ============================================
- 正式开始处理
- ============================================
- */
- int SegmentDuration_tmp=0;
- int TimeLeft_tmp=0;
- while(VideoDuration>StartTime)
- {
- /*==========================
- 计算视频片段时间
- ==========================*/
- TimeLeft_tmp = VideoDuration-StartTime;
- if((TimeLeft_tmp)>=SegmentDuration)
- {
- SegmentDuration_tmp = SegmentDuration;
- }
- else
- {
- SegmentDuration_tmp = TimeLeft_tmp;
- }
- if(read_OLD_SegmentDuration)
- {
- SegmentDuration_tmp = OLD_SegmentDuration;
- read_OLD_SegmentDuration=false;
- }
- /*==========================
- 拆分视频片段
- ==========================*/
- if(isSplitComplete==false)
- {
- if(file_isDirExist(SplitFramesFolderPath))
- {
- file_DelDir(SplitFramesFolderPath);
- file_mkDir(SplitFramesFolderPath);
- }
- else
- {
- file_mkDir(SplitFramesFolderPath);
- }
- video_video2images_ProcessBySegment(video_mp4_fullpath,SplitFramesFolderPath,StartTime,SegmentDuration_tmp);
- if(waifu2x_STOP)
- {
- emit Send_Table_video_ChangeStatus_rowNumInt_statusQString(rowNum, "Interrupted");
- return 0;//如果启用stop位,则直接return
- }
- }
- /*==========================
- 处理视频片段的帧
- ==========================*/
- if(isScaleComplete==false)
- {
- //============================== 扫描获取文件名 ===============================
- QStringList Frame_fileName_list = file_getFileNames_in_Folder_nofilter(SplitFramesFolderPath);
- if(isSplitComplete==false)
- {
- if(Frame_fileName_list.isEmpty())//检查是否成功拆分为帧
- {
- emit Send_TextBrowser_NewMessage(tr("Error occured when processing [")+SourceFile_fullPath+tr("]. Error: [Unable to split video into pictures.]"));
- emit Send_Table_video_ChangeStatus_rowNumInt_statusQString(rowNum, "Failed");
- emit Send_progressbar_Add();
- return 0;//如果启用stop位,则直接return
- }
- }
- /*
- 记录进度
- 帧拆分成功
- */
- emit Send_video_write_Progress_ProcessBySegment(VideoConfiguration_fullPath,StartTime,true,false,SegmentDuration_tmp,LastVideoClipNo);
- //============================== 放大 =======================================
- //===========建立存储放大后frame的文件夹===========
- if(isSplitComplete==false)
- {
- if(file_isDirExist(ScaledFramesFolderPath))
- {
- file_DelDir(ScaledFramesFolderPath);
- file_mkDir(ScaledFramesFolderPath);
- }
- else
- {
- file_mkDir(ScaledFramesFolderPath);
- }
- }
- //==========开始放大==========================
- FileProgressWatch_isEnabled=true;
- QFuture FileProgressWatch_QFuture = QtConcurrent::run(this, &MainWindow::CurrentFileProgress_WatchFolderFileNum_Textbrower, SourceFile_fullPath,ScaledFramesFolderPath,Frame_fileName_list.size()+file_getFileNames_in_Folder_nofilter(ScaledFramesFolderPath).size());
- if(ui->checkBox_ShowInterPro->isChecked()==false)
- {
- FileProgressWatch_isEnabled=false;
- FileProgressWatch_QFuture.cancel();
- }
- //=======获取显卡信息========
- int NumOfGPU = 1;
- if(ui->checkBox_SpecifyGPU_Anime4k->isChecked()==true)
- {
- NumOfGPU = Get_NumOfGPU_Anime4k();
- }
- //============创建显卡文件夹===========
- QStringList GPU_SplitFramesFolderPath_List;
- for(int i = 0; i < NumOfGPU; i++)
- {
- QString GPU_SplitFramesFolderPath = SplitFramesFolderPath+"/"+"GPU_"+QString::number(i);
- if(file_isDirExist(GPU_SplitFramesFolderPath)==false)
- {
- file_DelDir(GPU_SplitFramesFolderPath);
- file_mkDir(GPU_SplitFramesFolderPath);
- }
- else
- {
- file_mkDir(GPU_SplitFramesFolderPath);
- }
- GPU_SplitFramesFolderPath_List.append(GPU_SplitFramesFolderPath);
- }
- int TotalFramesNum = Frame_fileName_list.size();
- int FramesNumForEachGPU = TotalFramesNum/NumOfGPU;
- if(FramesNumForEachGPU<1)FramesNumForEachGPU=1;
- int start_num=0;
- for(int x = 0; x < GPU_SplitFramesFolderPath_List.size(); x++)
- {
- if(x==GPU_SplitFramesFolderPath_List.size()-1)FramesNumForEachGPU=TotalFramesNum;
- QStringList file_waitformove = Frame_fileName_list.mid(start_num,FramesNumForEachGPU);
- for(int i = 0; i < file_waitformove.size(); i++)
- {
- QString FileName = file_waitformove.at(i);
- QFile::rename(SplitFramesFolderPath+"/"+FileName,GPU_SplitFramesFolderPath_List.at(x)+"/"+FileName);
- }
- start_num+=FramesNumForEachGPU;
- }
- //=========================
- bool Frame_failed = false;//放大失败标志
- QMap Sub_Thread_info;
- Sub_Thread_info["ScaledFramesFolderPath"]=ScaledFramesFolderPath;
- if(CustRes_isEnabled == true)
- {
- Sub_Thread_info["ScaleRatio"] = QString("%1").arg(CustRes_CalNewScaleRatio(video_mp4_fullpath,CustRes_height,CustRes_width));
- }
- else
- {
- Sub_Thread_info["ScaleRatio"] = QString("%1").arg(ScaleRatio);
- }
- //=========================
- for(int i = 0; i < GPU_SplitFramesFolderPath_List.size(); i++)
- {
- Sub_Thread_info["SplitFramesFolderPath"]=GPU_SplitFramesFolderPath_List.at(i);
- mutex_SubThreadNumRunning.lock();
- Sub_video_ThreadNumRunning++;
- mutex_SubThreadNumRunning.unlock();
- QtConcurrent::run(this,&MainWindow::Anime4k_Video_scale,Sub_Thread_info,&Sub_video_ThreadNumRunning,&Frame_failed);
- while (Sub_video_ThreadNumRunning >= NumOfGPU)
- {
- Delay_msec_sleep(500);
- }
- if(waifu2x_STOP)
- {
- while (Sub_video_ThreadNumRunning > 0)
- {
- Delay_msec_sleep(500);
- }
- FileProgressWatch_isEnabled=false;
- FileProgressWatch_QFuture.cancel();
- Restore_SplitFramesFolderPath(SplitFramesFolderPath,GPU_SplitFramesFolderPath_List);
- emit Send_Table_video_ChangeStatus_rowNumInt_statusQString(rowNum, "Interrupted");
- return 0;//如果启用stop位,则直接return
- }
- if(Frame_failed)
- {
- FileProgressWatch_isEnabled=false;
- FileProgressWatch_QFuture.cancel();
- Restore_SplitFramesFolderPath(SplitFramesFolderPath,GPU_SplitFramesFolderPath_List);
- emit Send_TextBrowser_NewMessage(tr("Error occured when processing [")+SourceFile_fullPath+tr("]. Error: [Failed to scale frames.]"));
- emit Send_Table_video_ChangeStatus_rowNumInt_statusQString(rowNum, "Failed");
- emit Send_progressbar_Add();
- return 0;//如果启用stop位,则直接return
- }
- }
- while (Sub_video_ThreadNumRunning!=0)
- {
- Delay_msec_sleep(500);
- }
- FileProgressWatch_isEnabled=false;
- FileProgressWatch_QFuture.cancel();
- //================ 扫描放大后的帧文件数量,判断是否放大成功 =======================
- QStringList Frame_fileName_list_scaled = file_getFileNames_in_Folder_nofilter(ScaledFramesFolderPath);
- if(Frame_fileName_list_scaled.size()checkBox_ShowInterPro->isChecked())
- {
- emit Send_CurrentFileProgress_progressbar_Add_SegmentDuration(SegmentDuration_tmp);
- }
- StartTime+=SegmentDuration_tmp;
- isSplitComplete = false;
- isScaleComplete = false;
- LastVideoClipNo=VideoClipNo;
- emit Send_video_write_Progress_ProcessBySegment(VideoConfiguration_fullPath,StartTime,false,false,-1,VideoClipNo);
- }
- emit Send_CurrentFileProgress_Stop();
- //======================================================
- // 组装(片段到成片)
- //======================================================
- //确定是否插入降噪值
- QString denoiseLevel_inName_str = "";
- int denoiseLevel = ui->spinBox_DenoiseLevel_video->value();
- if(denoiseLevel != -1)
- {
- denoiseLevel_inName_str = QString::number(denoiseLevel,10)+"n_";
- }
- //生成最终视频名称
- QString video_mp4_scaled_fullpath = "";
- if(CustRes_isEnabled)
- {
- video_mp4_scaled_fullpath = file_path+"/"+file_name+"_waifu2x_"+QString::number(CustRes_width,10)+"x"+QString::number(CustRes_height,10)+"_"+denoiseLevel_inName_str+file_ext+".mp4";
- }
- else
- {
- video_mp4_scaled_fullpath = file_path+"/"+file_name+"_waifu2x_"+QString::number(ScaleRatio,10)+"x_"+denoiseLevel_inName_str+file_ext+".mp4";
- }
- QFile::remove(video_mp4_scaled_fullpath);
- video_AssembleVideoClips(VideoClipsFolderPath,VideoClipsFolderName,video_mp4_scaled_fullpath,AudioPath);
- if(QFile::exists(video_mp4_scaled_fullpath)==false)//检查是否成功生成视频
- {
- if(waifu2x_STOP)
- {
- emit Send_Table_video_ChangeStatus_rowNumInt_statusQString(rowNum, "Interrupted");
- return 0;//如果启用stop位,则直接return
- }
- emit Send_TextBrowser_NewMessage(tr("Error occured when processing [")+SourceFile_fullPath+tr("]. Error: [Unable to assemble video clips.]"));
- emit Send_Table_video_ChangeStatus_rowNumInt_statusQString(rowNum, "Failed");
- emit Send_progressbar_Add();
- return 0;//如果启用stop位,则直接return
- }
- //============================== 删除缓存文件 ====================================================
- if(ui->checkBox_KeepVideoCache->isChecked()==false)
- {
- QFile::remove(VideoConfiguration_fullPath);
- file_DelDir(SplitFramesFolderPath);
- file_DelDir(VideoClipsFolderPath);
- QFile::remove(AudioPath);
- if(SourceFile_fullPath!=video_mp4_fullpath)QFile::remove(video_mp4_fullpath);
- }
- else
- {
- DelOriginal=false;
- }
- //============================= 删除原文件 & & 更新table status ============================
- if(DelOriginal)
- {
- if(ReplaceOriginalFile(SourceFile_fullPath,video_mp4_scaled_fullpath)==false)
- {
- if(QAction_checkBox_MoveToRecycleBin_checkBox_DelOriginal->isChecked())
- {
- file_MoveToTrash(SourceFile_fullPath);
- }
- else
- {
- QFile::remove(SourceFile_fullPath);
- }
- }
- emit Send_Table_video_ChangeStatus_rowNumInt_statusQString(rowNum, "Finished, original file deleted");
- }
- else
- {
- emit Send_Table_video_ChangeStatus_rowNumInt_statusQString(rowNum, "Finished");
- }
- //========== 移动到输出路径 =========
- if(ui->checkBox_OutPath_isEnabled->isChecked())
- {
- MoveFileToOutputPath(video_mp4_scaled_fullpath,SourceFile_fullPath);
- }
- //============================ 更新进度条 =================================
- emit Send_progressbar_Add();
- //=========================== ==============================
- return 0;
-}
-/*
-Anime4k视频放大子线程
-放大,修改大小
-*/
-int MainWindow::Anime4k_Video_scale(QMap Sub_Thread_info,int *Sub_video_ThreadNumRunning,bool *Frame_failed)
-{
- bool AllFinished=true;
- QString SplitFramesFolderPath = Sub_Thread_info["SplitFramesFolderPath"];
- QString ScaledFramesFolderPath = Sub_Thread_info["ScaledFramesFolderPath"];
- //===========
- QStringList OutPutFilesFullPathList;
- do
- {
- QStringList InputFilesNameList = file_getFileNames_in_Folder_nofilter(SplitFramesFolderPath);
- for(int i=0; ispinBox_retry->value()+ForceRetryCount); retry++)
- {
- Anime4k->start(CMD);
- while(!Anime4k->waitForStarted(100)&&!QProcess_stop) {}
- while(!Anime4k->waitForFinished(500)&&!QProcess_stop)
- {
- if(waifu2x_STOP)
- {
- QStringList FinfishedFileList = WaitForEngineIO(OutPutFilesFullPathList);
- Anime4k->close();
- //============
- QString file_fullpath_tmp="";
- QString file_name="";
- QString file_ext="";
- for(int i=0; ispinBox_retry->value()+(ForceRetryCount-1))break;
- Delay_sec_sleep(5);
- emit Send_TextBrowser_NewMessage(tr("Automatic retry, please wait."));
- AllFinished=false;
- break;
- }
- }
- if(AllFinished== true)break;
- }
- //=========
- AllFinished = true;
- for(int i=0; icheckBox_FastMode_Anime4K->isChecked())
- {
- Anime4k_Settings_str.append("-f ");
- }
- //GPU加速
- if(ui->checkBox_GPUMode_Anime4K->isChecked())
- {
- Anime4k_Settings_str.append("-q ");
- //加载GPGPU模式
- QString GPGPU_Model = ui->comboBox_GPGPUModel_A4k->currentText().toLower().trimmed();
- Anime4k_Settings_str.append("-M "+GPGPU_Model+" ");
- //加载OpenCL选项
- if(GPGPU_Model=="opencl")
- {
- if(ui->checkBox_OpenCLParallelIO_A4k->isChecked())Anime4k_Settings_str.append("-P ");
- Anime4k_Settings_str.append("-Q "+QString::number(ui->spinBox_OpenCLCommandQueues_A4k->value(),10)+" ");
- }
- }
- //ACNet
- if(ui->checkBox_ACNet_Anime4K->isChecked())
- {
- Anime4k_Settings_str.append("-w ");//启用acnet
- if(ui->checkBox_HDNMode_Anime4k->isChecked())
- {
- Anime4k_Settings_str.append("-H ");//启用HDN
- }
- return Anime4k_Settings_str;
- }
- //============= 非ACNET选项 ===========
- //Passes
- Anime4k_Settings_str.append("-p "+QString::number(ui->spinBox_Passes_Anime4K->value(),10)+" ");
- //Push color count
- Anime4k_Settings_str.append("-n "+QString::number(ui->spinBox_PushColorCount_Anime4K->value(),10)+" ");
- //Push color strength
- Anime4k_Settings_str.append("-c "+QString::number(ui->doubleSpinBox_PushColorStrength_Anime4K->value(),'f',2)+" ");
- //Push gradient strength
- Anime4k_Settings_str.append("-g "+QString::number(ui->doubleSpinBox_PushGradientStrength_Anime4K->value(),'f',2)+" ");
- //Pre-processing
- if(ui->checkBox_EnablePreProcessing_Anime4k->isChecked())
- {
- Anime4k_Settings_str.append("-b ");
- uint8_t PreProcessingFilters = 0;
- //读取滤镜选择情况
- if (ui->checkBox_MedianBlur_Pre_Anime4k->isChecked())
- {
- PreProcessingFilters|=1;
- }
- if (ui->checkBox_MeanBlur_Pre_Anime4k->isChecked())
- {
- PreProcessingFilters|=2;
- }
- if (ui->checkBox_CASSharping_Pre_Anime4k->isChecked())
- {
- PreProcessingFilters|=4;
- }
- if (ui->checkBox_GaussianBlurWeak_Pre_Anime4k->isChecked())
- {
- PreProcessingFilters|=8;
- }
- if (ui->checkBox_GaussianBlur_Pre_Anime4k->isChecked())
- {
- PreProcessingFilters|=16;
- }
- if (ui->checkBox_BilateralFilter_Pre_Anime4k->isChecked())
- {
- PreProcessingFilters|=32;
- }
- if (ui->checkBox_BilateralFilterFaster_Pre_Anime4k->isChecked())
- {
- PreProcessingFilters|=64;
- }
- //生成添加滤镜指令
- if(PreProcessingFilters!=0)
- {
- Anime4k_Settings_str.append("-r "+QString::number(PreProcessingFilters,10)+" ");
- }
- else
- {
- Anime4k_Settings_str.append("-r 4 ");
- }
- }
- //Post-processing
- if(ui->checkBox_EnablePostProcessing_Anime4k->isChecked())
- {
- Anime4k_Settings_str.append("-a ");
- uint8_t PostProcessingFilters = 0;
- //读取滤镜选择情况
- if (ui->checkBox_MedianBlur_Post_Anime4k->isChecked())
- {
- PostProcessingFilters|=1;
- }
- if (ui->checkBox_MeanBlur_Post_Anime4k->isChecked())
- {
- PostProcessingFilters|=2;
- }
- if (ui->checkBox_CASSharping_Post_Anime4k->isChecked())
- {
- PostProcessingFilters|=4;
- }
- if (ui->checkBox_GaussianBlurWeak_Post_Anime4k->isChecked())
- {
- PostProcessingFilters|=8;
- }
- if (ui->checkBox_GaussianBlur_Post_Anime4k->isChecked())
- {
- PostProcessingFilters|=16;
- }
- if (ui->checkBox_BilateralFilter_Post_Anime4k->isChecked())
- {
- PostProcessingFilters|=32;
- }
- if (ui->checkBox_BilateralFilterFaster_Post_Anime4k->isChecked())
- {
- PostProcessingFilters|=64;
- }
- //生成添加滤镜指令
- if(PostProcessingFilters!=0)
- {
- Anime4k_Settings_str.append("-e "+QString::number(PostProcessingFilters,10)+" ");
- }
- else
- {
- Anime4k_Settings_str.append("-e 4 ");
- }
- }
- return Anime4k_Settings_str;
-}
-/*
-Anime4k
-读取配置生成配置string
-*/
-QString MainWindow::Anime4k_ReadSettings(bool PreserveAlphaChannel)
-{
- QString Anime4k_Settings_str = "";
- //=================================
- Anime4k_Settings_str.append(Anime4k_PreLoad_Settings_Str);
- //保留透明通道
- if(PreserveAlphaChannel)
- {
- Anime4k_Settings_str.append("-A ");//保留透明通道
- }
- //GPU加速
- if(ui->checkBox_GPUMode_Anime4K->isChecked())
- {
- //指定GPU
- if(ui->checkBox_SpecifyGPU_Anime4k->isChecked())
- {
- Anime4k_Settings_str.append(Anime4k_GetGPUInfo()+" ");
- }
- }
- //=================================
- return Anime4k_Settings_str;
-}
-
-QString MainWindow::Anime4k_GetGPUInfo()
-{
- GetGPUInfo_QMutex_Anime4k.lock();
- //====
- QStringList GPU_List = ui->lineEdit_GPUs_Anime4k->text().trimmed().remove(" ").remove(" ").split(":");
- GPU_List.removeDuplicates();
- GPU_List.removeAll("");
- //====
- int MAX_GPU_ID_Anime4k = GPU_List.size()-1;
- if(GPU_ID_Anime4k_GetGPUInfo>MAX_GPU_ID_Anime4k)
- {
- GPU_ID_Anime4k_GetGPUInfo=0;
- }
- //======
- QString GPUInfo="";
- QStringList PID_DID = GPU_List.at(GPU_ID_Anime4k_GetGPUInfo).split(",");
- PID_DID.removeAll("");
- if(PID_DID.size()==2)
- {
- GPUInfo = "-h "+PID_DID.at(0).trimmed()+" -d "+PID_DID.at(1).trimmed();
- }
- else
- {
- GPUInfo = "-h 0 -d 0";
- }
- //======
- GPU_ID_Anime4k_GetGPUInfo++;
- if(GPU_ID_Anime4k_GetGPUInfo>MAX_GPU_ID_Anime4k)
- {
- GPU_ID_Anime4k_GetGPUInfo=0;
- }
- //======
- GetGPUInfo_QMutex_Anime4k.unlock();
- return GPUInfo;
-}
-/*
-列出可用的GPUs
-*/
-void MainWindow::on_pushButton_ListGPUs_Anime4k_clicked()
-{
- QtConcurrent::run(this, &MainWindow::ListGPUs_Anime4k);
-}
-
-void MainWindow::ListGPUs_Anime4k()
-{
- QString cmd = "\"" + Anime4k_ProgramPath + "\" -l";
- ExecuteCMD_batFile(cmd.replace("%","%%")+"\n title = GPU List for Anime4K @ Waifu2x-Extension-GUI\n pause",false);
-}
-
-void MainWindow::on_lineEdit_GPUs_Anime4k_editingFinished()
-{
- QString Format_str="0123456789:,";
- QString GPUs_str = ui->lineEdit_GPUs_Anime4k->text().trimmed().replace(":",":").replace(",",",").remove(" ").remove(" ");
- for (int i=0; ilineEdit_GPUs_Anime4k->setText(GPUs_str);
-}
-
-void MainWindow::on_pushButton_VerifyGPUsConfig_Anime4k_clicked()
-{
- on_lineEdit_GPUs_Anime4k_editingFinished();
- QStringList GPU_List = ui->lineEdit_GPUs_Anime4k->text().trimmed().remove(" ").remove(" ").split(":");
- GPU_List.removeDuplicates();
- GPU_List.removeAll("");
- //======
- QString VerRes = "";
- //======
- for (int i=0; isetWindowTitle(tr("GPUs List according to your configuration"));
- MSG->setText(VerRes);
- MSG->setIcon(QMessageBox::Information);
- MSG->setModal(true);
- MSG->show();
- //======
- emit Send_TextBrowser_NewMessage(tr("\nAnime4k GPUs List(user configuration):\n")+VerRes.trimmed());
-}
-
-/*
-删除强制重试时生成的垃圾缓存文件
-*/
-void MainWindow::DelTrash_ForceRetry_Anime4k(QString OutPut_Path)
-{
- if(isForceRetryClicked)//判断是否触发强制重试,若触发,直接删除垃圾缓存
- {
- QFile::remove(OutPut_Path);
- isForceRetryClicked_QMutex.lock();
- isForceRetryClicked=false;
- isForceRetryClicked_QMutex.unlock();
- }
- return;
-}
-//阻断其他线程重置是否强制重试的标记,并检测anime4k是否正在运行
-void MainWindow::isForceRetryClicked_SetTrue_Block_Anime4k()
-{
- isForceRetryClicked_QMutex.lock();
- isForceRetryClicked=true;
- Delay_sec_sleep(5);
- QProcess Get_tasklist;
- do
- {
- Get_tasklist.start("tasklist /fo csv");
- while(!Get_tasklist.waitForStarted(100)) {}
- while(!Get_tasklist.waitForFinished(100)) {}
- if(Get_tasklist.readAllStandardOutput().contains("Anime4K_waifu2xEX.exe")==false)
- {
- break;
- }
- Delay_sec_sleep(1);
- }
- while(true);
- isForceRetryClicked_QMutex.unlock();
- emit Send_SetEnable_pushButton_ForceRetry_self();
-}
-
-void MainWindow::DenoiseLevelSpinboxSetting_Anime4k()
-{
- if(ui->checkBox_ACNet_Anime4K->isChecked()&&ui->checkBox_HDNMode_Anime4k->isChecked())
- {
- if(ui->comboBox_Engine_Image->currentIndex()==3)
- {
- ui->spinBox_DenoiseLevel_image->setRange(1,3);
- ui->spinBox_DenoiseLevel_image->setValue(1);
- ui->spinBox_DenoiseLevel_image->setEnabled(1);
- ui->spinBox_DenoiseLevel_image->setToolTip(tr("Range:1~3"));
- ui->label_ImageDenoiseLevel->setToolTip(tr("Range:1~3"));
- }
- if(ui->comboBox_Engine_GIF->currentIndex()==3)
- {
- ui->spinBox_DenoiseLevel_gif->setRange(1,3);
- ui->spinBox_DenoiseLevel_gif->setValue(1);
- ui->spinBox_DenoiseLevel_gif->setEnabled(1);
- ui->spinBox_DenoiseLevel_gif->setToolTip(tr("Range:1~3"));
- ui->label_GIFDenoiseLevel->setToolTip(tr("Range:1~3"));
- }
- if(ui->comboBox_Engine_Video->currentIndex()==2)
- {
- ui->spinBox_DenoiseLevel_video->setRange(1,3);
- ui->spinBox_DenoiseLevel_video->setValue(1);
- ui->spinBox_DenoiseLevel_video->setEnabled(1);
- ui->spinBox_DenoiseLevel_video->setToolTip(tr("Range:1~3"));
- ui->label_VideoDenoiseLevel->setToolTip(tr("Range:1~3"));
- }
- }
- else
- {
- if(ui->comboBox_Engine_Image->currentIndex()==3)
- {
- ui->spinBox_DenoiseLevel_image->setRange(-1,0);
- ui->spinBox_DenoiseLevel_image->setValue(-1);
- ui->spinBox_DenoiseLevel_image->setEnabled(0);
- ui->spinBox_DenoiseLevel_image->setToolTip(tr("Due to current settings, you can\'t adjust denoise level."));
- ui->label_ImageDenoiseLevel->setToolTip(tr("Due to current settings, you can\'t adjust denoise level."));
- }
- if(ui->comboBox_Engine_GIF->currentIndex()==3)
- {
- ui->spinBox_DenoiseLevel_gif->setRange(-1,0);
- ui->spinBox_DenoiseLevel_gif->setValue(-1);
- ui->spinBox_DenoiseLevel_gif->setEnabled(0);
- ui->spinBox_DenoiseLevel_gif->setToolTip(tr("Due to current settings, you can\'t adjust denoise level."));
- ui->label_GIFDenoiseLevel->setToolTip(tr("Due to current settings, you can\'t adjust denoise level."));
- }
- if(ui->comboBox_Engine_Video->currentIndex()==2)
- {
- ui->spinBox_DenoiseLevel_video->setRange(-1,0);
- ui->spinBox_DenoiseLevel_video->setValue(-1);
- ui->spinBox_DenoiseLevel_video->setEnabled(0);
- ui->spinBox_DenoiseLevel_video->setToolTip(tr("Due to current settings, you can\'t adjust denoise level."));
- ui->label_VideoDenoiseLevel->setToolTip(tr("Due to current settings, you can\'t adjust denoise level."));
- }
- }
-}
-/*
-获取可用显卡数量
-*/
-int MainWindow::Get_NumOfGPU_Anime4k()
-{
- QStringList GPU_List = ui->lineEdit_GPUs_Anime4k->text().trimmed().remove(" ").remove(" ").split(":");
- GPU_List.removeDuplicates();
- GPU_List.removeAll("");
- int GPUNum = 0;
- QStringList PID_DID;
- for (int i=0; i FileProgressWatch_QFuture = QtConcurrent::run(this, &MainWindow::CurrentFileProgress_WatchFolderFileNum, scaledFramesFolder);//启动waifu2x 主线程
- if(ui->checkBox_ShowInterPro->isChecked()==false)
- {
- FileProgressWatch_isEnabled=false;
- FileProgressWatch_QFuture.cancel();
- emit Send_CurrentFileProgress_Stop();
- }
- //=======获取显卡信息========
- int NumOfGPU = 1;
- if(ui->checkBox_SpecifyGPU_Anime4k->isChecked()==true)
- {
- NumOfGPU = Get_NumOfGPU_Anime4k();
- }
- //============创建显卡文件夹===========
- QStringList GPU_splitFramesFolder_List;
- for(int i = 0; i < NumOfGPU; i++)
- {
- QString GPU_splitFramesFolder = splitFramesFolder+"/"+"GPU_"+QString::number(i);
- if(file_isDirExist(GPU_splitFramesFolder))
- {
- file_DelDir(GPU_splitFramesFolder);
- file_mkDir(GPU_splitFramesFolder);
- }
- else
- {
- file_mkDir(GPU_splitFramesFolder);
- }
- GPU_splitFramesFolder_List.append(GPU_splitFramesFolder);
- }
- int TotalFramesNum = framesFileName_qStrList.size();
- int FramesNumForEachGPU = TotalFramesNum/NumOfGPU;
- if(FramesNumForEachGPU<1)FramesNumForEachGPU=1;
- int start_num=0;
- for(int x = 0; x < GPU_splitFramesFolder_List.size(); x++)
- {
- if(x==GPU_splitFramesFolder_List.size()-1)FramesNumForEachGPU=TotalFramesNum;
- QStringList file_waitformove = framesFileName_qStrList.mid(start_num,FramesNumForEachGPU);
- for(int i = 0; i < file_waitformove.size(); i++)
- {
- QString FileName = file_waitformove.at(i);
- QFile::rename(splitFramesFolder+"/"+FileName,GPU_splitFramesFolder_List.at(x)+"/"+FileName);
- }
- start_num+=FramesNumForEachGPU;
- }
- //===
- QMap Sub_Thread_info;
- Sub_Thread_info["scaledFramesFolder"]=scaledFramesFolder;
- if(CustRes_isContained(sourceFileFullPath))
- {
- QMap Res_map = CustRes_getResMap(sourceFileFullPath);//res_map["fullpath"],["height"],["width"]
- Sub_Thread_info["ScaleRatio"] = QString("%1").arg(CustRes_CalNewScaleRatio(sourceFileFullPath,Res_map["height"].toInt(),Res_map["width"].toInt()));
- }
- else
- {
- Sub_Thread_info["ScaleRatio"] = QString("%1").arg(qRound(ui->doubleSpinBox_ScaleRatio_gif->value()));
- }
- //=========================
- bool Frame_failed = false;//放大失败标志
- int Sub_gif_ThreadNumRunning=0;//正在运行的线程数量
- //=========================
- for(int i = 0; i < GPU_splitFramesFolder_List.size(); i++)
- {
- Sub_Thread_info["splitFramesFolder"]=GPU_splitFramesFolder_List.at(i);
- mutex_SubThreadNumRunning.lock();
- Sub_gif_ThreadNumRunning++;
- mutex_SubThreadNumRunning.unlock();
- QtConcurrent::run(this,&MainWindow::Anime4k_APNG_scale,Sub_Thread_info,&Sub_gif_ThreadNumRunning,&Frame_failed);
- while (Sub_gif_ThreadNumRunning >= NumOfGPU)
- {
- Delay_msec_sleep(500);
- }
- if(waifu2x_STOP)
- {
- while (Sub_gif_ThreadNumRunning > 0)
- {
- Delay_msec_sleep(500);
- }
- FileProgressWatch_isEnabled=false;
- FileProgressWatch_QFuture.cancel();
- return false;
- }
- if(Frame_failed)
- {
- FileProgressWatch_isEnabled=false;
- FileProgressWatch_QFuture.cancel();
- emit Send_TextBrowser_NewMessage(tr("Error occured when processing [")+sourceFileFullPath+tr("]. Error: [Failed to scale frames.]"));
- return false;
- }
- }
- while (Sub_gif_ThreadNumRunning!=0)
- {
- Delay_msec_sleep(500);
- }
- FileProgressWatch_isEnabled=false;
- FileProgressWatch_QFuture.cancel();
- emit Send_CurrentFileProgress_Stop();
- //======================= 检查是否成功放大所有帧 ===========================
- QStringList framesFileName_qStrList_scaled = file_getFileNames_in_Folder_nofilter(scaledFramesFolder);
- if(framesFileName_qStrList.size()!=framesFileName_qStrList_scaled.size())
- {
- emit Send_TextBrowser_NewMessage(tr("Error occured when processing [")+sourceFileFullPath+tr("]. Error: [Failed to scale frames.]"));
- return false;
- }
- //============================================================
- //组装apng
- APNG_Frames2APNG(sourceFileFullPath, scaledFramesFolder, resultFileFullPath, false);
- return true;
-}
-/*
-Anime4k APNG 放大子线程
-*/
-int MainWindow::Anime4k_APNG_scale(QMap Sub_Thread_info,int *Sub_gif_ThreadNumRunning,bool *Frame_failed)
-{
- bool AllFinished=true;
- QString splitFramesFolder = Sub_Thread_info["splitFramesFolder"];
- QString scaledFramesFolder = Sub_Thread_info["scaledFramesFolder"];
- //==================
- // 生成输出文件列表
- //==================
- QStringList OutPutFilesFullPathList;
- do
- {
- QStringList InputFilesNameList = file_getFileNames_in_Folder_nofilter(splitFramesFolder);
- for(int i=0; ispinBox_retry->value()+ForceRetryCount); retry++)
- {
- Anime4k->start(CMD);
- while(!Anime4k->waitForStarted(100)&&!QProcess_stop) {}
- while(!Anime4k->waitForFinished(500)&&!QProcess_stop)
- {
- if(waifu2x_STOP)
- {
- Anime4k->close();
- mutex_SubThreadNumRunning.lock();
- *Sub_gif_ThreadNumRunning=*Sub_gif_ThreadNumRunning-1;
- mutex_SubThreadNumRunning.unlock();
- return 0;
- }
- }
- AllFinished = true;
- for(int i=0; ispinBox_retry->value()+(ForceRetryCount-1))break;
- Delay_sec_sleep(5);
- emit Send_TextBrowser_NewMessage(tr("Automatic retry, please wait."));
- AllFinished=false;
- break;
- }
- }
- if(AllFinished == true)break;
- }
- //=========
- AllFinished = true;
- for(int i=0; i.
+
+ My Github homepage: https://github.com/AaronFeng753
+*/
+#include "mainwindow.h"
+#include "ui_mainwindow.h"
+/*
+处理图片
+*/
+int MainWindow::Anime4k_Image(int rowNum,bool ReProcess_MissingAlphaChannel)
+{
+ //============================= 读取设置 ================================
+ int ScaleRatio = 0;
+ int denoiseLevel = ui->spinBox_DenoiseLevel_image->value();//获取降噪等级
+ bool isDenoiseEnabled = (denoiseLevel != -1);//若降噪等级等于-1就是没启用降噪
+ bool DelOriginal = (ui->checkBox_DelOriginal->isChecked()||ui->checkBox_ReplaceOriginalFile->isChecked());
+ bool PreserveAlphaChannel = Imgae_hasAlphaChannel(rowNum);
+ QString OutPutPath_Final ="";
+ //========================= 拆解map得到参数 =============================
+ emit Send_Table_image_ChangeStatus_rowNumInt_statusQString(rowNum, "Processing");
+ QString SourceFile_fullPath = Table_model_image->item(rowNum,2)->text();
+ if(!QFile::exists(SourceFile_fullPath))
+ {
+ emit Send_TextBrowser_NewMessage(tr("Error occured when processing [")+SourceFile_fullPath+tr("]. Error: [File does not exist.]"));
+ emit Send_Table_image_ChangeStatus_rowNumInt_statusQString(rowNum, "Failed");
+ emit Send_progressbar_Add();
+ mutex_ThreadNumRunning.lock();
+ ThreadNumRunning--;
+ mutex_ThreadNumRunning.unlock();//线程数量统计-1
+ return 0;
+ }
+ //========= 转换到 PNG =========
+ QString SourceFile_fullPath_Original = SourceFile_fullPath;
+ SourceFile_fullPath = Imgae_PreProcess(SourceFile_fullPath_Original,ReProcess_MissingAlphaChannel);
+ //================================
+ // 自定义分辨率设定
+ //================================
+ bool CustRes_isEnabled = false;
+ int CustRes_height=0;
+ int CustRes_width=0;
+ if(CustRes_isContained(SourceFile_fullPath_Original))
+ {
+ CustRes_isEnabled=true;
+ QMap Res_map = CustRes_getResMap(SourceFile_fullPath_Original);//res_map["fullpath"],["height"],["width"]
+ ScaleRatio = CustRes_CalNewScaleRatio(SourceFile_fullPath,Res_map["height"].toInt(),Res_map["width"].toInt());
+ if(ScaleRatio==0)
+ {
+ emit Send_TextBrowser_NewMessage(tr("Error occured when processing [")+SourceFile_fullPath_Original+tr("]. Error: [The resolution of the source file cannot be read, so the image cannot be scaled to a custom resolution.]"));
+ emit Send_Table_image_ChangeStatus_rowNumInt_statusQString(rowNum, "Failed");
+ emit Send_progressbar_Add();
+ mutex_ThreadNumRunning.lock();
+ ThreadNumRunning--;
+ mutex_ThreadNumRunning.unlock();//线程数量统计-1
+ return 0;
+ }
+ CustRes_height=Res_map["height"].toInt();
+ CustRes_width=Res_map["width"].toInt();
+ }
+ else
+ {
+ double ScaleRatio_double_tmp = ui->doubleSpinBox_ScaleRatio_image->value();
+ if(ScaleRatio_double_tmp == (int)ScaleRatio_double_tmp)
+ {
+ ScaleRatio = qRound(ScaleRatio_double_tmp);
+ }
+ else
+ {
+ CustRes_isEnabled=true;
+ QMap Res_map = DoubleScaleRatio_Cal_NewScaleRatio_NewHW(SourceFile_fullPath,ScaleRatio_double_tmp);
+ //====
+ if(Res_map.isEmpty())
+ {
+ emit Send_TextBrowser_NewMessage(tr("Error occured when processing [")+SourceFile_fullPath+tr("]. Error: [Unable to read the resolution of the source file.]"));
+ emit Send_Table_image_ChangeStatus_rowNumInt_statusQString(rowNum, "Failed");
+ emit Send_progressbar_Add();
+ mutex_ThreadNumRunning.lock();
+ ThreadNumRunning--;
+ mutex_ThreadNumRunning.unlock();//线程数量统计-1
+ return 0;
+ }
+ //====
+ ScaleRatio = Res_map["ScaleRatio"].toInt();
+ CustRes_height = Res_map["Height_new"].toInt();
+ CustRes_width = Res_map["width_new"].toInt();
+ }
+ }
+ //=======================================================
+ QFileInfo fileinfo(SourceFile_fullPath);
+ QString SourceFile_fullPath_FileName = file_getBaseName(SourceFile_fullPath);
+ QString SourceFile_fullPath_FileExt = fileinfo.suffix();
+ QString SourceFile_fullPath_FolderPath = file_getFolderPath(fileinfo);
+ QString OutPut_Path = SourceFile_fullPath_FolderPath + "/" + SourceFile_fullPath_FileName + "_waifu2x_"+QString::number(ScaleRatio, 10)+"x_"+SourceFile_fullPath_FileExt+".png";
+ if(isDenoiseEnabled == true)
+ {
+ OutPut_Path = SourceFile_fullPath_FolderPath + "/" + SourceFile_fullPath_FileName + "_waifu2x_"+QString::number(ScaleRatio, 10)+"x_"+QString::number(denoiseLevel, 10)+"n_"+SourceFile_fullPath_FileExt+".png";
+ }
+ else
+ {
+ OutPut_Path = SourceFile_fullPath_FolderPath + "/" + SourceFile_fullPath_FileName + "_waifu2x_"+QString::number(ScaleRatio, 10)+"x_"+SourceFile_fullPath_FileExt+".png";
+ }
+ //============================== 放大 =======================================
+ QProcess *Waifu2x = new QProcess();
+ QString CMD = "\"" + Anime4k_ProgramPath + "\" -i \"" + SourceFile_fullPath + "\" -o \"" + OutPut_Path + "\" -z " + QString::number(ScaleRatio, 10) + HDNDenoiseLevel_image + Anime4k_ReadSettings(PreserveAlphaChannel);
+ //========
+ for(int retry=0; retry<(ui->spinBox_retry->value()+ForceRetryCount); retry++)
+ {
+ Waifu2x->start(CMD);
+ while(!Waifu2x->waitForStarted(100)&&!QProcess_stop) {}
+ while(!Waifu2x->waitForFinished(500)&&!QProcess_stop)
+ {
+ if(waifu2x_STOP)
+ {
+ Waifu2x->close();
+ QFile::remove(OutPut_Path);
+ emit Send_Table_image_ChangeStatus_rowNumInt_statusQString(rowNum, "Interrupted");
+ mutex_ThreadNumRunning.lock();
+ ThreadNumRunning--;
+ mutex_ThreadNumRunning.unlock();
+ return 0;
+ }
+ }
+ DelTrash_ForceRetry_Anime4k(OutPut_Path);//删除强制关闭导致生成的垃圾缓存文件
+ if(QFile::exists(OutPut_Path))//判断是否成功输出目标文件
+ {
+ break;
+ }
+ else
+ {
+ if(retry==ui->spinBox_retry->value()+(ForceRetryCount-1))break;
+ Delay_sec_sleep(5);
+ emit Send_TextBrowser_NewMessage(tr("Automatic retry, please wait."));
+ }
+ }
+ //========
+ if(QFile::exists(OutPut_Path)==false)
+ {
+ if(SourceFile_fullPath_Original!=SourceFile_fullPath)
+ {
+ QFile::remove(SourceFile_fullPath);
+ }
+ emit Send_TextBrowser_NewMessage(tr("Error occured when processing [")+SourceFile_fullPath_Original+tr("]. Error: [Unable to scale the picture.]"));
+ emit Send_Table_image_ChangeStatus_rowNumInt_statusQString(rowNum, "Failed");
+ emit Send_progressbar_Add();
+ mutex_ThreadNumRunning.lock();
+ ThreadNumRunning--;
+ mutex_ThreadNumRunning.unlock();
+ return 0;
+ }
+ //============================ 调整大小 ====================================================
+ if(CustRes_isEnabled == true)
+ {
+ do
+ {
+ QImage qimage_adj(OutPut_Path);
+ //读取放大后的图片并调整大小
+ QImage qimage_adj_scaled = qimage_adj.scaled(CustRes_width,CustRes_height,CustRes_AspectRatioMode,Qt::SmoothTransformation);
+ QImageWriter qimageW_adj;
+ qimageW_adj.setFormat("png");
+ qimageW_adj.setFileName(OutPut_Path);
+ if(qimageW_adj.canWrite())
+ {
+ qimageW_adj.write(qimage_adj_scaled);
+ }
+ if(!QFile::exists(OutPut_Path))
+ {
+ emit Send_TextBrowser_NewMessage(tr("Error occured when processing [")+SourceFile_fullPath+tr("]. Error: [Unable to resize the scaled picture to the target size]"));
+ emit Send_Table_image_ChangeStatus_rowNumInt_statusQString(rowNum, "Failed");
+ emit Send_progressbar_Add();
+ mutex_ThreadNumRunning.lock();
+ ThreadNumRunning--;
+ mutex_ThreadNumRunning.unlock();//线程数量统计-1
+ return 0;
+ }
+ }
+ while(false);
+ QString OutPut_Path_CustRes = SourceFile_fullPath_FolderPath + "/" + SourceFile_fullPath_FileName + "_waifu2x_"+QString::number(CustRes_width, 10)+"x"+QString::number(CustRes_height, 10)+"_"+SourceFile_fullPath_FileExt+".png";
+ QFile::remove(OutPut_Path_CustRes);
+ QFile::rename(OutPut_Path,OutPut_Path_CustRes);
+ //=========================== 另存为JPG&压缩JPG ===========================================
+ OutPutPath_Final = SaveImageAs_FormatAndQuality(SourceFile_fullPath_Original,OutPut_Path_CustRes,isDenoiseEnabled,denoiseLevel);
+ }
+ else
+ {
+ //=========================== 另存为JPG&压缩JPG ===========================================
+ OutPutPath_Final = SaveImageAs_FormatAndQuality(SourceFile_fullPath_Original,OutPut_Path,isDenoiseEnabled,denoiseLevel);
+ }
+ //================== 检查是否丢失了透明通道 =====================
+ if(ReProcess_MissingAlphaChannel==false)
+ {
+ QImage QImage_Final(OutPutPath_Final);
+ if(PreserveAlphaChannel == true && QImage_Final.hasAlphaChannel() == false && ui->checkBox_AutoDetectAlphaChannel->isChecked())
+ {
+ QFile::remove(OutPutPath_Final);
+ emit Send_TextBrowser_NewMessage(tr("Since the Alpha channel in the resulting image is lost, this image will be reprocessed to fix it:[")+SourceFile_fullPath_Original+tr("].\nIf the reprocessing happens a lot, you should consider enable [Always pre-process images with Alpha Channel] in [Additional settings]."));
+ return Anime4k_Image(rowNum,true);
+ }
+ }
+ //============================= 删除原文件 & 更新table status ============================
+ if(SourceFile_fullPath_Original!=SourceFile_fullPath)
+ {
+ QFile::remove(SourceFile_fullPath);
+ }
+ if(DelOriginal == true)
+ {
+ if(ReplaceOriginalFile(SourceFile_fullPath_Original,OutPutPath_Final)==false)
+ {
+ if(QAction_checkBox_MoveToRecycleBin_checkBox_DelOriginal->isChecked())
+ {
+ file_MoveToTrash(SourceFile_fullPath_Original);
+ }
+ else
+ {
+ QFile::remove(SourceFile_fullPath_Original);
+ }
+ }
+ emit Send_Table_image_ChangeStatus_rowNumInt_statusQString(rowNum, "Finished, original file deleted");
+ }
+ else
+ {
+ emit Send_Table_image_ChangeStatus_rowNumInt_statusQString(rowNum, "Finished");
+ }
+ //========== 移动到输出路径 =========
+ if(ui->checkBox_OutPath_isEnabled->isChecked())
+ {
+ MoveFileToOutputPath(OutPutPath_Final,SourceFile_fullPath_Original);
+ }
+ //============================ 更新进度条 =================================
+ emit Send_progressbar_Add();
+ //=========================== 更新线程数量统计==============================
+ mutex_ThreadNumRunning.lock();
+ ThreadNumRunning--;
+ mutex_ThreadNumRunning.unlock();//线程数量统计-1
+ //=======
+ return 0;
+}
+/*
+处理GIF
+*/
+int MainWindow::Anime4k_GIF(int rowNum)
+{
+ //============================= 读取设置 ================================
+ int ScaleRatio = ui->doubleSpinBox_ScaleRatio_gif->value();
+ bool DelOriginal = (ui->checkBox_DelOriginal->isChecked()||ui->checkBox_ReplaceOriginalFile->isChecked());
+ int Sub_gif_ThreadNumRunning = 0;
+ QString OutPutPath_Final ="";
+ //========================= 拆解map得到参数 =============================
+ emit Send_Table_gif_ChangeStatus_rowNumInt_statusQString(rowNum, "Processing");
+ QString SourceFile_fullPath = Table_model_gif->item(rowNum,2)->text();
+ if(!QFile::exists(SourceFile_fullPath))
+ {
+ emit Send_TextBrowser_NewMessage(tr("Error occured when processing [")+SourceFile_fullPath+tr("]. Error: [File does not exist.]"));
+ emit Send_Table_gif_ChangeStatus_rowNumInt_statusQString(rowNum, "Failed");
+ emit Send_progressbar_Add();
+ return 0;
+ }
+ //==========================
+ bool CustRes_isEnabled = false;
+ int CustRes_height=0;
+ int CustRes_width=0;
+ if(CustRes_isContained(SourceFile_fullPath))
+ {
+ CustRes_isEnabled=true;
+ QMap Res_map = CustRes_getResMap(SourceFile_fullPath);//res_map["fullpath"],["height"],["width"]
+ CustRes_height=Res_map["height"].toInt();
+ CustRes_width=Res_map["width"].toInt();
+ }
+ //==========================
+ QFileInfo fileinfo(SourceFile_fullPath);
+ QString file_name = file_getBaseName(SourceFile_fullPath);
+ QString file_ext = fileinfo.suffix();
+ QString file_path = file_getFolderPath(fileinfo);
+ QString ResGIFPath = file_path + "/" + file_name + "_waifu2x_"+QString::number(ScaleRatio, 10)+"x.gif";
+ //=========================== 获取帧时间 ====================================
+ int GIF_Duration = Gif_getDuration(SourceFile_fullPath);
+ if(GIF_Duration==0)//检查是否成功获取duration
+ {
+ emit Send_TextBrowser_NewMessage(tr("Error occured when processing [")+SourceFile_fullPath+tr("]. Error: [Can't get Duration value of GIF file.]"));
+ emit Send_Table_gif_ChangeStatus_rowNumInt_statusQString(rowNum, "Failed");
+ //file_DelDir(SplitFramesFolderPath);
+ emit Send_progressbar_Add();
+ return 0;//如果启用stop位,则直接return
+ }
+ //============================== 拆分 ==========================================
+ QString SplitFramesFolderPath = file_path+"/"+file_name+"_SplitFrames_W2xEX";//拆分后存储frame的文件夹
+ Gif_splitGif(SourceFile_fullPath,SplitFramesFolderPath);
+ //============================== 扫描获取文件名 ===============================
+ QStringList Frame_fileName_list = file_getFileNames_in_Folder_nofilter(SplitFramesFolderPath);
+ if(Frame_fileName_list.isEmpty())//检查是否成功拆分gif
+ {
+ emit Send_TextBrowser_NewMessage(tr("Error occured when processing [")+SourceFile_fullPath+tr("]. Error: [Can't split GIF into frames.]"));
+ emit Send_Table_gif_ChangeStatus_rowNumInt_statusQString(rowNum, "Failed");
+ file_DelDir(SplitFramesFolderPath);
+ emit Send_progressbar_Add();
+ return 0;//如果启用stop位,则直接return
+ }
+ //===========建立存储放大后frame的文件夹===========
+ QString ScaledFramesFolderPath = SplitFramesFolderPath+"/ScaledFrames_W2xEX";
+ if(file_isDirExist(ScaledFramesFolderPath))
+ {
+ file_DelDir(ScaledFramesFolderPath);
+ file_mkDir(ScaledFramesFolderPath);
+ }
+ else
+ {
+ file_mkDir(ScaledFramesFolderPath);
+ }
+ //=============================开始放大==========================
+ //启动进度条
+ emit Send_CurrentFileProgress_Start(file_name+"."+file_ext,Frame_fileName_list.size());
+ FileProgressWatch_isEnabled=true;
+ QFuture FileProgressWatch_QFuture = QtConcurrent::run(this, &MainWindow::CurrentFileProgress_WatchFolderFileNum, ScaledFramesFolderPath);//启动waifu2x 主线程
+ if(ui->checkBox_ShowInterPro->isChecked()==false)
+ {
+ FileProgressWatch_isEnabled=false;
+ FileProgressWatch_QFuture.cancel();
+ emit Send_CurrentFileProgress_Stop();
+ }
+ //=======获取显卡信息========
+ int NumOfGPU = 1;
+ if(ui->checkBox_SpecifyGPU_Anime4k->isChecked()==true)
+ {
+ NumOfGPU = Get_NumOfGPU_Anime4k();
+ }
+ //============创建显卡文件夹===========
+ QStringList GPU_SplitFramesFolderPath_List;
+ for(int i = 0; i < NumOfGPU; i++)
+ {
+ QString GPU_SplitFramesFolderPath = SplitFramesFolderPath+"/"+"GPU_"+QString::number(i);
+ if(file_isDirExist(GPU_SplitFramesFolderPath))
+ {
+ file_DelDir(GPU_SplitFramesFolderPath);
+ file_mkDir(GPU_SplitFramesFolderPath);
+ }
+ else
+ {
+ file_mkDir(GPU_SplitFramesFolderPath);
+ }
+ GPU_SplitFramesFolderPath_List.append(GPU_SplitFramesFolderPath);
+ }
+ int TotalFramesNum = Frame_fileName_list.size();
+ int FramesNumForEachGPU = TotalFramesNum/NumOfGPU;
+ if(FramesNumForEachGPU<1)FramesNumForEachGPU=1;
+ int start_num=0;
+ for(int x = 0; x < GPU_SplitFramesFolderPath_List.size(); x++)
+ {
+ if(x==GPU_SplitFramesFolderPath_List.size()-1)FramesNumForEachGPU=TotalFramesNum;
+ QStringList file_waitformove = Frame_fileName_list.mid(start_num,FramesNumForEachGPU);
+ for(int i = 0; i < file_waitformove.size(); i++)
+ {
+ QString FileName = file_waitformove.at(i);
+ QFile::rename(SplitFramesFolderPath+"/"+FileName,GPU_SplitFramesFolderPath_List.at(x)+"/"+FileName);
+ }
+ start_num+=FramesNumForEachGPU;
+ }
+ //===
+ QMap Sub_Thread_info;
+ Sub_Thread_info["ScaledFramesFolderPath"]=ScaledFramesFolderPath;
+ if(CustRes_isEnabled == true)
+ {
+ Sub_Thread_info["ScaleRatio"] = QString("%1").arg(CustRes_CalNewScaleRatio(SourceFile_fullPath,CustRes_height,CustRes_width));
+ }
+ else
+ {
+ Sub_Thread_info["ScaleRatio"] = QString("%1").arg(qRound(ui->doubleSpinBox_ScaleRatio_gif->value()));
+ }
+ //=========================
+ bool Frame_failed = false;//放大失败标志
+ //=========================
+ for(int i = 0; i < GPU_SplitFramesFolderPath_List.size(); i++)
+ {
+ Sub_Thread_info["SplitFramesFolderPath"]=GPU_SplitFramesFolderPath_List.at(i);
+ mutex_SubThreadNumRunning.lock();
+ Sub_gif_ThreadNumRunning++;
+ mutex_SubThreadNumRunning.unlock();
+ QtConcurrent::run(this,&MainWindow::Anime4k_GIF_scale,Sub_Thread_info,&Sub_gif_ThreadNumRunning,&Frame_failed);
+ while (Sub_gif_ThreadNumRunning >= NumOfGPU)
+ {
+ Delay_msec_sleep(500);
+ }
+ if(waifu2x_STOP)
+ {
+ while (Sub_gif_ThreadNumRunning > 0)
+ {
+ Delay_msec_sleep(500);
+ }
+ FileProgressWatch_isEnabled=false;
+ FileProgressWatch_QFuture.cancel();
+ file_DelDir(SplitFramesFolderPath);
+ emit Send_Table_gif_ChangeStatus_rowNumInt_statusQString(rowNum, "Interrupted");
+ return 0;//如果启用stop位,则直接return
+ }
+ if(Frame_failed)
+ {
+ FileProgressWatch_isEnabled=false;
+ FileProgressWatch_QFuture.cancel();
+ emit Send_TextBrowser_NewMessage(tr("Error occured when processing [")+SourceFile_fullPath+tr("]. Error: [Failed to scale frames.]"));
+ emit Send_Table_gif_ChangeStatus_rowNumInt_statusQString(rowNum, "Failed");
+ file_DelDir(SplitFramesFolderPath);
+ emit Send_progressbar_Add();
+ return 0;//如果启用stop位,则直接return
+ }
+ }
+ while (Sub_gif_ThreadNumRunning!=0)
+ {
+ Delay_msec_sleep(500);
+ }
+ FileProgressWatch_isEnabled=false;
+ FileProgressWatch_QFuture.cancel();
+ emit Send_CurrentFileProgress_Stop();
+ //======================= 检查是否成功放大所有帧 ===========================
+ QStringList Frame_fileName_list_scaled = file_getFileNames_in_Folder_nofilter(ScaledFramesFolderPath);
+ if(Frame_fileName_list.size()!=Frame_fileName_list_scaled.size())
+ {
+ emit Send_TextBrowser_NewMessage(tr("Error occured when processing [")+SourceFile_fullPath+tr("]. Error: [Failed to scale frames.]"));
+ emit Send_Table_gif_ChangeStatus_rowNumInt_statusQString(rowNum, "Failed");
+ file_DelDir(SplitFramesFolderPath);
+ emit Send_progressbar_Add();
+ return 0;//如果启用stop位,则直接return
+ }
+ //======================================== 组装 ======================================================
+ if(CustRes_isEnabled)
+ {
+ ResGIFPath = file_path + "/" + file_name + "_waifu2x_"+QString::number(CustRes_width, 10)+"x"+QString::number(CustRes_height,10)+".gif";
+ }
+ //=======================
+ // 修改文件名,添加降噪等级
+ //=======================
+ int denoiseLevel = ui->spinBox_DenoiseLevel_gif->value();
+ if(denoiseLevel != -1)
+ {
+ QFileInfo fileinfo_tmp(ResGIFPath);
+ ResGIFPath = file_getFolderPath(fileinfo_tmp) + "/" + file_getBaseName(ResGIFPath) + "_"+QString::number(denoiseLevel, 10)+"n.gif";
+ }
+ //======================
+ Gif_assembleGif(ResGIFPath,ScaledFramesFolderPath,GIF_Duration,CustRes_isEnabled,CustRes_height,CustRes_width,false,"");
+ if(!QFile::exists(ResGIFPath))
+ {
+ emit Send_TextBrowser_NewMessage(tr("Error occured when processing [")+SourceFile_fullPath+tr("]. Error: [Unable to assemble gif.]"));
+ emit Send_Table_gif_ChangeStatus_rowNumInt_statusQString(rowNum, "Failed");
+ file_DelDir(SplitFramesFolderPath);
+ emit Send_progressbar_Add();
+ return 0;//如果启用stop位,则直接return
+ }
+ OutPutPath_Final = ResGIFPath;
+ //======================================= 优化gif ===================================================
+ if(ui->checkBox_OptGIF->isChecked() == true)
+ {
+ QFileInfo fileinfo_tmp(OutPutPath_Final);
+ QString ResGIFPath_compressed = file_getFolderPath(fileinfo_tmp) + "/" + file_getBaseName(OutPutPath_Final) + "_opt.gif";
+ OutPutPath_Final = Gif_compressGif(ResGIFPath,ResGIFPath_compressed);
+ }
+ //============================== 删除缓存文件 ====================================================
+ file_DelDir(SplitFramesFolderPath);
+ //============================= 删除原文件 & & 更新table status ============================
+ if(DelOriginal)
+ {
+ if(ReplaceOriginalFile(SourceFile_fullPath,OutPutPath_Final)==false)
+ {
+ if(QAction_checkBox_MoveToRecycleBin_checkBox_DelOriginal->isChecked())
+ {
+ file_MoveToTrash(SourceFile_fullPath);
+ }
+ else
+ {
+ QFile::remove(SourceFile_fullPath);
+ }
+ }
+ emit Send_Table_gif_ChangeStatus_rowNumInt_statusQString(rowNum, "Finished, original file deleted");
+ }
+ else
+ {
+ emit Send_Table_gif_ChangeStatus_rowNumInt_statusQString(rowNum, "Finished");
+ }
+ //========== 移动到输出路径 =========
+ if(ui->checkBox_OutPath_isEnabled->isChecked())
+ {
+ MoveFileToOutputPath(OutPutPath_Final,SourceFile_fullPath);
+ }
+ //============================ 更新进度条 =================================
+ emit Send_progressbar_Add();
+ //=========================== ==============================
+ return 0;
+}
+/*
+Anime4k GIF放大子线程
+放大,修改大小
+*/
+int MainWindow::Anime4k_GIF_scale(QMap Sub_Thread_info,int *Sub_gif_ThreadNumRunning,bool *Frame_failed)
+{
+ bool AllFinished=true;
+ QString SplitFramesFolderPath = Sub_Thread_info["SplitFramesFolderPath"];
+ QString ScaledFramesFolderPath = Sub_Thread_info["ScaledFramesFolderPath"];
+ //==================
+ // 生成输出文件列表
+ //==================
+ QStringList OutPutFilesFullPathList;
+ do
+ {
+ QStringList InputFilesNameList = file_getFileNames_in_Folder_nofilter(SplitFramesFolderPath);
+ for(int i=0; ispinBox_retry->value()+ForceRetryCount); retry++)
+ {
+ Anime4k->start(CMD);
+ while(!Anime4k->waitForStarted(100)&&!QProcess_stop) {}
+ while(!Anime4k->waitForFinished(500)&&!QProcess_stop)
+ {
+ if(waifu2x_STOP)
+ {
+ Anime4k->close();
+ mutex_SubThreadNumRunning.lock();
+ *Sub_gif_ThreadNumRunning=*Sub_gif_ThreadNumRunning-1;
+ mutex_SubThreadNumRunning.unlock();
+ return 0;
+ }
+ }
+ AllFinished = true;
+ for(int i=0; ispinBox_retry->value()+(ForceRetryCount-1))break;
+ Delay_sec_sleep(5);
+ emit Send_TextBrowser_NewMessage(tr("Automatic retry, please wait."));
+ AllFinished=false;
+ break;
+ }
+ }
+ if(AllFinished == true)break;
+ }
+ //=========
+ AllFinished = true;
+ for(int i=0; idoubleSpinBox_ScaleRatio_video->value();
+ bool DelOriginal = (ui->checkBox_DelOriginal->isChecked()||ui->checkBox_ReplaceOriginalFile->isChecked());
+ bool isCacheExists = false;
+ bool isVideoConfigChanged = true;
+ int Sub_video_ThreadNumRunning = 0;
+ //========================= 拆解map得到参数 =============================
+ emit Send_Table_video_ChangeStatus_rowNumInt_statusQString(rowNum, "Processing");
+ QString SourceFile_fullPath = Table_model_video->item(rowNum,2)->text();
+ if(!QFile::exists(SourceFile_fullPath))
+ {
+ emit Send_TextBrowser_NewMessage(tr("Error occured when processing [")+SourceFile_fullPath+tr("]. Error: [File does not exist.]"));
+ emit Send_Table_video_ChangeStatus_rowNumInt_statusQString(rowNum, "Failed");
+ emit Send_progressbar_Add();
+ return 0;
+ }
+ //==========================
+ QFileInfo fileinfo(SourceFile_fullPath);
+ QString file_name = file_getBaseName(SourceFile_fullPath);
+ QString file_ext = fileinfo.suffix();
+ QString file_path = file_getFolderPath(fileinfo);
+ //===================================================================
+ //生成mp4
+ QString video_mp4_fullpath=video_To_CFRMp4(SourceFile_fullPath);
+ if(!QFile::exists(video_mp4_fullpath))//检查是否成功生成mp4
+ {
+ emit Send_TextBrowser_NewMessage(tr("Error occured when processing [")+SourceFile_fullPath+tr("]. Error: [Cannot convert video format to mp4.]"));
+ emit Send_Table_video_ChangeStatus_rowNumInt_statusQString(rowNum, "Failed");
+ emit Send_progressbar_Add();
+ return 0;//如果启用stop位,则直接return
+ }
+ QString AudioPath = file_path+"/Audio_"+file_name+"_"+file_ext+"_W2xEX.wav";//音频
+ QString SplitFramesFolderPath = file_path+"/"+file_name+"_"+file_ext+"_SplitFrames_W2xEX";//拆分后存储frame的文件夹
+ QString ScaledFramesFolderPath = SplitFramesFolderPath+"/ScaledFrames_W2xEX";//存储放大后的帧
+ //==========================
+ // 读取自定义分辨率设定
+ //==========================
+ bool CustRes_isEnabled = false;
+ int CustRes_height=0;
+ int CustRes_width=0;
+ if(CustRes_isContained(SourceFile_fullPath))
+ {
+ CustRes_isEnabled=true;
+ QMap Res_map = CustRes_getResMap(SourceFile_fullPath);//res_map["fullpath"],["height"],["width"]
+ CustRes_height=Res_map["height"].toInt();
+ CustRes_width=Res_map["width"].toInt();
+ }
+ //==========================
+ // 检测之前的视频配置文件
+ //==========================
+ QString VideoConfiguration_fullPath = file_path+"/VideoConfiguration_"+file_name+"_"+file_ext+"_Waifu2xEX.ini";
+ if(QFile::exists(VideoConfiguration_fullPath))
+ {
+ QSettings *configIniRead = new QSettings(VideoConfiguration_fullPath, QSettings::IniFormat);
+ configIniRead->setIniCodec(QTextCodec::codecForName("UTF-8"));
+ //=================== 加载之前存储的视频信息 =========================
+ int ScaleRatio_old = configIniRead->value("/VideoConfiguration/ScaleRatio").toInt();
+ bool CustRes_isEnabled_old = configIniRead->value("/VideoConfiguration/CustRes_isEnabled").toBool();
+ int CustRes_height_old = configIniRead->value("/VideoConfiguration/CustRes_height").toInt();
+ int CustRes_width_old = configIniRead->value("/VideoConfiguration/CustRes_width").toInt();
+ QString EngineName_old = configIniRead->value("/VideoConfiguration/EngineName").toString();
+ bool isProcessBySegment_old = configIniRead->value("/VideoConfiguration/isProcessBySegment").toBool();
+ //=================== 比对信息 ================================
+ if(EngineName_old=="anime4k")
+ {
+ if(CustRes_isEnabled_old==false&&CustRes_isEnabled==false)
+ {
+ if(ScaleRatio_old!=ScaleRatio)
+ {
+ isVideoConfigChanged=true;
+ }
+ else
+ {
+ isVideoConfigChanged=false;
+ }
+ }
+ else
+ {
+ if(CustRes_isEnabled_old==true&&CustRes_isEnabled==true)
+ {
+ if(CustRes_height_old!=CustRes_height||CustRes_width_old!=CustRes_width)
+ {
+ isVideoConfigChanged=true;
+ }
+ else
+ {
+ isVideoConfigChanged=false;
+ }
+ }
+ else
+ {
+ isVideoConfigChanged=true;
+ }
+ }
+ if(isProcessBySegment_old==true)
+ {
+ isVideoConfigChanged=true;
+ }
+ }
+ else
+ {
+ isVideoConfigChanged=true;
+ }
+ }
+ else
+ {
+ emit Send_video_write_VideoConfiguration(VideoConfiguration_fullPath,ScaleRatio,0,CustRes_isEnabled,CustRes_height,CustRes_width,"anime4k",false,"","",ui->groupBox_FrameInterpolation->isChecked(),0);
+ }
+ //=======================
+ // 检测缓存是否存在
+ //=======================
+ if(QFile::exists(video_mp4_fullpath)&&file_isDirExist(SplitFramesFolderPath)&&file_isDirExist(ScaledFramesFolderPath)&&QFile::exists(VideoConfiguration_fullPath))
+ {
+ if(!isVideoConfigChanged)
+ {
+ isCacheExists=true;
+ emit Send_TextBrowser_NewMessage(tr("The previous video cache file is detected and processing of the previous video cache will continue. If you want to restart processing of the current video:[")+SourceFile_fullPath+tr("], delete the cache manually."));
+ }
+ else
+ {
+ isCacheExists=false;
+ //========
+ QFile::remove(VideoConfiguration_fullPath);
+ file_DelDir(SplitFramesFolderPath);
+ QFile::remove(AudioPath);
+ DelVfiDir(video_mp4_fullpath);
+ emit Send_video_write_VideoConfiguration(VideoConfiguration_fullPath,ScaleRatio,0,CustRes_isEnabled,CustRes_height,CustRes_width,"anime4k",false,"","",ui->groupBox_FrameInterpolation->isChecked(),0);
+ //=======
+ emit Send_TextBrowser_NewMessage(tr("The previous video cache file was detected, but because you changed the settings about the video resolution, the previous cache will be deleted and processing of the video:[")+SourceFile_fullPath+tr("] will restart."));
+ }
+ }
+ else
+ {
+ isCacheExists=false;
+ //========
+ QFile::remove(VideoConfiguration_fullPath);
+ file_DelDir(SplitFramesFolderPath);
+ QFile::remove(AudioPath);
+ DelVfiDir(video_mp4_fullpath);
+ emit Send_video_write_VideoConfiguration(VideoConfiguration_fullPath,ScaleRatio,0,CustRes_isEnabled,CustRes_height,CustRes_width,"anime4k",false,"","",ui->groupBox_FrameInterpolation->isChecked(),0);
+ //========
+ }
+ //==========================================
+ // 拆分(正常)
+ //==========================================
+ if(!isCacheExists)
+ {
+ if(file_isDirExist(SplitFramesFolderPath))
+ {
+ file_DelDir(SplitFramesFolderPath);
+ file_mkDir(SplitFramesFolderPath);
+ }
+ else
+ {
+ file_mkDir(SplitFramesFolderPath);
+ }
+ QFile::remove(AudioPath);
+ video_video2images(video_mp4_fullpath,SplitFramesFolderPath,AudioPath);
+ if(waifu2x_STOP)
+ {
+ emit Send_Table_video_ChangeStatus_rowNumInt_statusQString(rowNum, "Interrupted");
+ return 0;//如果启用stop位,则直接return
+ }
+ }
+ //============================== 扫描获取文件名 ===============================
+ QStringList Frame_fileName_list = file_getFileNames_in_Folder_nofilter(SplitFramesFolderPath);
+ if(!isCacheExists)
+ {
+ if(Frame_fileName_list.isEmpty())//检查是否成功拆分为帧
+ {
+ emit Send_TextBrowser_NewMessage(tr("Error occured when processing [")+SourceFile_fullPath+tr("]. Error: [Unable to split video into pictures.]"));
+ emit Send_Table_video_ChangeStatus_rowNumInt_statusQString(rowNum, "Failed");
+ emit Send_progressbar_Add();
+ return 0;//如果启用stop位,则直接return
+ }
+ }
+ //============================== 放大 =======================================
+ //===========建立存储放大后frame的文件夹===========
+ if(!isCacheExists)
+ {
+ if(file_isDirExist(ScaledFramesFolderPath))
+ {
+ file_DelDir(ScaledFramesFolderPath);
+ file_mkDir(ScaledFramesFolderPath);
+ }
+ else
+ {
+ file_mkDir(ScaledFramesFolderPath);
+ }
+ }
+ //==========开始放大==========================
+ emit Send_CurrentFileProgress_Start(file_name+"."+file_ext,(Frame_fileName_list.size()+file_getFileNames_in_Folder_nofilter(ScaledFramesFolderPath).size()));
+ FileProgressWatch_isEnabled=true;
+ QFuture FileProgressWatch_QFuture = QtConcurrent::run(this, &MainWindow::CurrentFileProgress_WatchFolderFileNum, ScaledFramesFolderPath);//启动waifu2x 主线程
+ if(ui->checkBox_ShowInterPro->isChecked()==false)
+ {
+ FileProgressWatch_isEnabled=false;
+ FileProgressWatch_QFuture.cancel();
+ emit Send_CurrentFileProgress_Stop();
+ }
+ //=======获取显卡信息========
+ int NumOfGPU = 1;
+ if(ui->checkBox_SpecifyGPU_Anime4k->isChecked()==true)
+ {
+ NumOfGPU = Get_NumOfGPU_Anime4k();
+ }
+ //============创建显卡文件夹===========
+ QStringList GPU_SplitFramesFolderPath_List;
+ for(int i = 0; i < NumOfGPU; i++)
+ {
+ QString GPU_SplitFramesFolderPath = SplitFramesFolderPath+"/"+"GPU_"+QString::number(i);
+ if(file_isDirExist(GPU_SplitFramesFolderPath)==false)
+ {
+ file_DelDir(GPU_SplitFramesFolderPath);
+ file_mkDir(GPU_SplitFramesFolderPath);
+ }
+ else
+ {
+ file_mkDir(GPU_SplitFramesFolderPath);
+ }
+ GPU_SplitFramesFolderPath_List.append(GPU_SplitFramesFolderPath);
+ }
+ int TotalFramesNum = Frame_fileName_list.size();
+ int FramesNumForEachGPU = TotalFramesNum/NumOfGPU;
+ if(FramesNumForEachGPU<1)FramesNumForEachGPU=1;
+ int start_num=0;
+ for(int x = 0; x < GPU_SplitFramesFolderPath_List.size(); x++)
+ {
+ if(x==GPU_SplitFramesFolderPath_List.size()-1)FramesNumForEachGPU=TotalFramesNum;
+ QStringList file_waitformove = Frame_fileName_list.mid(start_num,FramesNumForEachGPU);
+ for(int i = 0; i < file_waitformove.size(); i++)
+ {
+ QString FileName = file_waitformove.at(i);
+ QFile::rename(SplitFramesFolderPath+"/"+FileName,GPU_SplitFramesFolderPath_List.at(x)+"/"+FileName);
+ }
+ start_num+=FramesNumForEachGPU;
+ }
+ //=========================
+ bool Frame_failed = false;//放大失败标志
+ QMap Sub_Thread_info;
+ Sub_Thread_info["ScaledFramesFolderPath"]=ScaledFramesFolderPath;
+ if(CustRes_isEnabled == true)
+ {
+ Sub_Thread_info["ScaleRatio"] = QString("%1").arg(CustRes_CalNewScaleRatio(video_mp4_fullpath,CustRes_height,CustRes_width));
+ }
+ else
+ {
+ Sub_Thread_info["ScaleRatio"] = QString("%1").arg(ScaleRatio);
+ }
+ //=========================
+ for(int i = 0; i < GPU_SplitFramesFolderPath_List.size(); i++)
+ {
+ Sub_Thread_info["SplitFramesFolderPath"]=GPU_SplitFramesFolderPath_List.at(i);
+ mutex_SubThreadNumRunning.lock();
+ Sub_video_ThreadNumRunning++;
+ mutex_SubThreadNumRunning.unlock();
+ QtConcurrent::run(this,&MainWindow::Anime4k_Video_scale,Sub_Thread_info,&Sub_video_ThreadNumRunning,&Frame_failed);
+ while (Sub_video_ThreadNumRunning >= NumOfGPU)
+ {
+ Delay_msec_sleep(500);
+ }
+ if(waifu2x_STOP)
+ {
+ while (Sub_video_ThreadNumRunning > 0)
+ {
+ Delay_msec_sleep(500);
+ }
+ FileProgressWatch_isEnabled=false;
+ FileProgressWatch_QFuture.cancel();
+ Restore_SplitFramesFolderPath(SplitFramesFolderPath,GPU_SplitFramesFolderPath_List);
+ emit Send_Table_video_ChangeStatus_rowNumInt_statusQString(rowNum, "Interrupted");
+ return 0;//如果启用stop位,则直接return
+ }
+ if(Frame_failed)
+ {
+ FileProgressWatch_isEnabled=false;
+ FileProgressWatch_QFuture.cancel();
+ Restore_SplitFramesFolderPath(SplitFramesFolderPath,GPU_SplitFramesFolderPath_List);
+ emit Send_TextBrowser_NewMessage(tr("Error occured when processing [")+SourceFile_fullPath+tr("]. Error: [Failed to scale frames.]"));
+ emit Send_Table_video_ChangeStatus_rowNumInt_statusQString(rowNum, "Failed");
+ emit Send_progressbar_Add();
+ return 0;//如果启用stop位,则直接return
+ }
+ }
+ while (Sub_video_ThreadNumRunning!=0)
+ {
+ Delay_msec_sleep(500);
+ }
+ FileProgressWatch_isEnabled=false;
+ FileProgressWatch_QFuture.cancel();
+ emit Send_CurrentFileProgress_Stop();
+ //================ 扫描放大后的帧文件数量,判断是否放大成功 =======================
+ QStringList Frame_fileName_list_scaled = file_getFileNames_in_Folder_nofilter(ScaledFramesFolderPath);
+ if(Frame_fileName_list_scaled.size()spinBox_DenoiseLevel_video->value();
+ if(denoiseLevel != -1)
+ {
+ denoiseLevel_inName_str = QString::number(denoiseLevel,10)+"n_";
+ }
+ //生成最终视频文件名
+ QString video_mp4_scaled_fullpath = "";
+ if(CustRes_isEnabled == true)
+ {
+ video_mp4_scaled_fullpath = file_path+"/"+file_name+"_waifu2x_"+QString::number(CustRes_width,10)+"x"+QString::number(CustRes_height,10)+"_"+denoiseLevel_inName_str+file_ext+".mp4";
+ }
+ else
+ {
+ video_mp4_scaled_fullpath = file_path+"/"+file_name+"_waifu2x_"+QString::number(ScaleRatio,10)+"x_"+denoiseLevel_inName_str+file_ext+".mp4";
+ }
+ video_images2video(video_mp4_fullpath,video_mp4_scaled_fullpath,ScaledFramesFolderPath,AudioPath,CustRes_isEnabled,CustRes_height,CustRes_width,false);
+ if(QFile::exists(video_mp4_scaled_fullpath)==false)//检查是否成功成功生成视频
+ {
+ if(waifu2x_STOP)
+ {
+ emit Send_Table_video_ChangeStatus_rowNumInt_statusQString(rowNum, "Interrupted");
+ return 0;//如果启用stop位,则直接return
+ }
+ emit Send_TextBrowser_NewMessage(tr("Error occured when processing [")+SourceFile_fullPath+tr("]. Error: [Unable to assemble pictures into videos.]"));
+ emit Send_Table_video_ChangeStatus_rowNumInt_statusQString(rowNum, "Failed");
+ emit Send_progressbar_Add();
+ return 0;//如果启用stop位,则直接return
+ }
+ //============================== 删除缓存文件 ====================================================
+ if(ui->checkBox_KeepVideoCache->isChecked()==false)
+ {
+ QFile::remove(VideoConfiguration_fullPath);
+ file_DelDir(SplitFramesFolderPath);
+ QFile::remove(AudioPath);
+ if(SourceFile_fullPath!=video_mp4_fullpath)QFile::remove(video_mp4_fullpath);
+ }
+ else
+ {
+ DelOriginal=false;
+ }
+ //============================= 删除原文件 & & 更新table status ============================
+ if(DelOriginal)
+ {
+ if(ReplaceOriginalFile(SourceFile_fullPath,video_mp4_scaled_fullpath)==false)
+ {
+ if(QAction_checkBox_MoveToRecycleBin_checkBox_DelOriginal->isChecked())
+ {
+ file_MoveToTrash(SourceFile_fullPath);
+ }
+ else
+ {
+ QFile::remove(SourceFile_fullPath);
+ }
+ }
+ emit Send_Table_video_ChangeStatus_rowNumInt_statusQString(rowNum, "Finished, original file deleted");
+ }
+ else
+ {
+ emit Send_Table_video_ChangeStatus_rowNumInt_statusQString(rowNum, "Finished");
+ }
+ //========== 移动到输出路径 =========
+ if(ui->checkBox_OutPath_isEnabled->isChecked())
+ {
+ MoveFileToOutputPath(video_mp4_scaled_fullpath,SourceFile_fullPath);
+ }
+ //============================ 更新进度条 =================================
+ emit Send_progressbar_Add();
+ //=========================== ==============================
+ return 0;
+}
+/*
+#### 分段处理 ####
+调用Anime4k处理视频
+读取设置,拆分,创建放大子线程,组装视频
+*/
+int MainWindow::Anime4k_Video_BySegment(int rowNum)
+{
+ //============================= 读取设置 ================================
+ int ScaleRatio = ui->doubleSpinBox_ScaleRatio_video->value();
+ bool DelOriginal = (ui->checkBox_DelOriginal->isChecked()||ui->checkBox_ReplaceOriginalFile->isChecked());
+ bool isCacheExists = false;
+ bool isVideoConfigChanged = true;
+ int Sub_video_ThreadNumRunning = 0;
+ int SegmentDuration = ui->spinBox_SegmentDuration->value();
+ //========================= 拆解map得到参数 =============================
+ emit Send_Table_video_ChangeStatus_rowNumInt_statusQString(rowNum, "Processing");
+ QString SourceFile_fullPath = Table_model_video->item(rowNum,2)->text();
+ if(!QFile::exists(SourceFile_fullPath))
+ {
+ emit Send_TextBrowser_NewMessage(tr("Error occured when processing [")+SourceFile_fullPath+tr("]. Error: [File does not exist.]"));
+ emit Send_Table_video_ChangeStatus_rowNumInt_statusQString(rowNum, "Failed");
+ emit Send_progressbar_Add();
+ return 0;
+ }
+ //==========================
+ QFileInfo fileinfo(SourceFile_fullPath);
+ QString file_name = file_getBaseName(SourceFile_fullPath);
+ QString file_ext = fileinfo.suffix();
+ QString file_path = file_getFolderPath(fileinfo);
+ //===================================================================
+ //生成mp4
+ QString video_mp4_fullpath=video_To_CFRMp4(SourceFile_fullPath);
+ if(!QFile::exists(video_mp4_fullpath))//检查是否成功生成mp4
+ {
+ emit Send_TextBrowser_NewMessage(tr("Error occured when processing [")+SourceFile_fullPath+tr("]. Error: [Cannot convert video format to mp4.]"));
+ emit Send_Table_video_ChangeStatus_rowNumInt_statusQString(rowNum, "Failed");
+ emit Send_progressbar_Add();
+ return 0;//如果启用stop位,则直接return
+ }
+ //============= 读取自定义分辨率 =============
+ bool CustRes_isEnabled = false;
+ int CustRes_height=0;
+ int CustRes_width=0;
+ if(CustRes_isContained(SourceFile_fullPath))
+ {
+ CustRes_isEnabled=true;
+ QMap Res_map = CustRes_getResMap(SourceFile_fullPath);//res_map["fullpath"],["height"],["width"]
+ CustRes_height=Res_map["height"].toInt();
+ CustRes_width=Res_map["width"].toInt();
+ }
+ //=================
+ QString AudioPath = file_path+"/Audio_"+file_name+"_"+file_ext+"_W2xEX.wav";//音频
+ QString SplitFramesFolderPath = file_path+"/"+file_name+"_"+file_ext+"_SplitFrames_W2xEX";//拆分后存储frame的文件夹
+ QString ScaledFramesFolderPath = SplitFramesFolderPath+"/ScaledFrames_W2xEX";//存储放大后的帧
+ //===
+ QString VideoClipsFolderPath = "";//存储视频片段的文件夹(完整路径)
+ QString DateStr = "";
+ do
+ {
+ DateStr = video_getClipsFolderNo();
+ VideoClipsFolderPath = file_path+"/"+DateStr+"_VideoClipsWaifu2xEX";//存储视频片段的文件夹(完整路径)
+ }
+ while(file_isDirExist(VideoClipsFolderPath));
+ QString VideoClipsFolderName = DateStr+"_VideoClipsWaifu2xEX";//存储视频片段的文件夹(名称)
+ //==========================
+ // 检测之前的视频配置文件
+ //==========================
+ QString VideoConfiguration_fullPath = file_path+"/VideoConfiguration_"+file_name+"_"+file_ext+"_Waifu2xEX.ini";
+ if(QFile::exists(VideoConfiguration_fullPath))
+ {
+ QSettings *configIniRead = new QSettings(VideoConfiguration_fullPath, QSettings::IniFormat);
+ configIniRead->setIniCodec(QTextCodec::codecForName("UTF-8"));
+ //=================== 加载之前存储的视频信息 =========================
+ int ScaleRatio_old = configIniRead->value("/VideoConfiguration/ScaleRatio").toInt();
+ bool CustRes_isEnabled_old = configIniRead->value("/VideoConfiguration/CustRes_isEnabled").toBool();
+ int CustRes_height_old = configIniRead->value("/VideoConfiguration/CustRes_height").toInt();
+ int CustRes_width_old = configIniRead->value("/VideoConfiguration/CustRes_width").toInt();
+ QString EngineName_old = configIniRead->value("/VideoConfiguration/EngineName").toString();
+ bool isProcessBySegment_old = configIniRead->value("/VideoConfiguration/isProcessBySegment").toBool();
+ bool isVideoFrameInterpolationEnabled_old = configIniRead->value("/VideoConfiguration/isVideoFrameInterpolationEnabled").toBool();
+ int MultipleOfFPS_old = configIniRead->value("/VideoConfiguration/MultipleOfFPS").toInt();
+ //=================== 比对信息 ================================
+ if(EngineName_old=="anime4k")
+ {
+ if(CustRes_isEnabled_old==false&&CustRes_isEnabled==false)
+ {
+ if(ScaleRatio_old!=ScaleRatio)
+ {
+ isVideoConfigChanged=true;
+ }
+ else
+ {
+ isVideoConfigChanged=false;
+ }
+ }
+ else
+ {
+ if(CustRes_isEnabled_old==true&&CustRes_isEnabled==true)
+ {
+ if(CustRes_height_old!=CustRes_height||CustRes_width_old!=CustRes_width)
+ {
+ isVideoConfigChanged=true;
+ }
+ else
+ {
+ isVideoConfigChanged=false;
+ }
+ }
+ else
+ {
+ isVideoConfigChanged=true;
+ }
+ }
+ if(isProcessBySegment_old == false)
+ {
+ isVideoConfigChanged=true;
+ }
+ if(isVideoFrameInterpolationEnabled_old != ui->groupBox_FrameInterpolation->isChecked())
+ {
+ isVideoConfigChanged=true;
+ }
+ if(MultipleOfFPS_old != ui->spinBox_MultipleOfFPS_VFI->value() && ui->groupBox_FrameInterpolation->isChecked())
+ {
+ isVideoConfigChanged=true;
+ }
+ }
+ else
+ {
+ isVideoConfigChanged=true;
+ }
+ //============ 修正文件夹名称 =============
+ QString VideoClipsFolderPath_old = configIniRead->value("/VideoConfiguration/VideoClipsFolderPath").toString();
+ QString VideoClipsFolderName_old = configIniRead->value("/VideoConfiguration/VideoClipsFolderName").toString();
+ file_mkDir(VideoClipsFolderPath_old);
+ if(file_isDirExist(VideoClipsFolderPath_old)==true)
+ {
+ VideoClipsFolderPath = VideoClipsFolderPath_old;
+ VideoClipsFolderName = VideoClipsFolderName_old;
+ }
+ }
+ else
+ {
+ emit Send_video_write_VideoConfiguration(VideoConfiguration_fullPath,ScaleRatio,0,CustRes_isEnabled,CustRes_height,CustRes_width,"anime4k",true,VideoClipsFolderPath,VideoClipsFolderName,ui->groupBox_FrameInterpolation->isChecked(),ui->spinBox_MultipleOfFPS_VFI->value());
+ }
+ //=======================
+ // 检测缓存是否存在
+ //=======================
+ if(file_isDirExist(SplitFramesFolderPath))
+ {
+ if(!isVideoConfigChanged)
+ {
+ isCacheExists=true;
+ emit Send_TextBrowser_NewMessage(tr("The previous video cache file is detected and processing of the previous video cache will continue. If you want to restart processing of the current video:[")+SourceFile_fullPath+tr("], delete the cache manually."));
+ }
+ else
+ {
+ isCacheExists=false;
+ //========
+ QFile::remove(VideoConfiguration_fullPath);
+ file_DelDir(SplitFramesFolderPath);
+ file_DelDir(VideoClipsFolderPath);
+ QFile::remove(AudioPath);
+ DelVfiDir(video_mp4_fullpath);
+ emit Send_video_write_VideoConfiguration(VideoConfiguration_fullPath,ScaleRatio,0,CustRes_isEnabled,CustRes_height,CustRes_width,"anime4k",true,VideoClipsFolderPath,VideoClipsFolderName,ui->groupBox_FrameInterpolation->isChecked(),ui->spinBox_MultipleOfFPS_VFI->value());
+ //=======
+ emit Send_TextBrowser_NewMessage(tr("The previous video cache file was detected, but because you changed the settings about the video resolution, the previous cache will be deleted and processing of the video:[")+SourceFile_fullPath+tr("] will restart."));
+ }
+ }
+ else
+ {
+ isCacheExists=false;
+ //========
+ QFile::remove(VideoConfiguration_fullPath);
+ file_DelDir(SplitFramesFolderPath);
+ file_DelDir(VideoClipsFolderPath);
+ QFile::remove(AudioPath);
+ DelVfiDir(video_mp4_fullpath);
+ emit Send_video_write_VideoConfiguration(VideoConfiguration_fullPath,ScaleRatio,0,CustRes_isEnabled,CustRes_height,CustRes_width,"anime4k",true,VideoClipsFolderPath,VideoClipsFolderName,ui->groupBox_FrameInterpolation->isChecked(),ui->spinBox_MultipleOfFPS_VFI->value());
+ //========
+ }
+ /*====================================
+ 提取音频
+ ======================================*/
+ if(!QFile::exists(AudioPath))
+ {
+ video_get_audio(video_mp4_fullpath,AudioPath);
+ }
+ //================================== 开始分段处理视频 =================================================
+ int StartTime = 0;//起始时间(秒)
+ int VideoDuration = video_get_duration(video_mp4_fullpath);
+ bool isSplitComplete = false;
+ bool isScaleComplete = false;
+ /*
+ ============================================
+ 开始之前先读取进度
+ ============================================
+ */
+ int OLD_SegmentDuration=-1;
+ bool read_OLD_SegmentDuration =false;
+ int LastVideoClipNo = -1;
+ if(QFile::exists(VideoConfiguration_fullPath))
+ {
+ QSettings *configIniRead = new QSettings(VideoConfiguration_fullPath, QSettings::IniFormat);
+ configIniRead->setIniCodec(QTextCodec::codecForName("UTF-8"));
+ //=================== 加载进度 =========================
+ StartTime = configIniRead->value("/Progress/StartTime").toInt();
+ isSplitComplete = configIniRead->value("/Progress/isSplitComplete").toBool();
+ isScaleComplete = configIniRead->value("/Progress/isScaleComplete").toBool();
+ OLD_SegmentDuration = configIniRead->value("/Progress/OLDSegmentDuration").toInt();
+ LastVideoClipNo = configIniRead->value("/Progress/LastVideoClipNo").toInt();
+ }
+ if(OLD_SegmentDuration>0)
+ {
+ read_OLD_SegmentDuration = true;
+ }
+ /*
+ 加载进度条
+ */
+ int SegmentDuration_tmp_progressbar = 0;
+ if(read_OLD_SegmentDuration)
+ {
+ SegmentDuration_tmp_progressbar = OLD_SegmentDuration;
+ }
+ else
+ {
+ SegmentDuration_tmp_progressbar = SegmentDuration;
+ }
+ if(ui->checkBox_ShowInterPro->isChecked()&&VideoDuration>SegmentDuration_tmp_progressbar)
+ {
+ emit Send_CurrentFileProgress_Start(file_name+"."+file_ext,VideoDuration);
+ if(StartTime>0)
+ {
+ emit Send_CurrentFileProgress_progressbar_Add_SegmentDuration(StartTime);
+ }
+ }
+ /*
+ ============================================
+ 正式开始处理
+ ============================================
+ */
+ int SegmentDuration_tmp=0;
+ int TimeLeft_tmp=0;
+ while(VideoDuration>StartTime)
+ {
+ /*==========================
+ 计算视频片段时间
+ ==========================*/
+ TimeLeft_tmp = VideoDuration-StartTime;
+ if((TimeLeft_tmp)>=SegmentDuration)
+ {
+ SegmentDuration_tmp = SegmentDuration;
+ }
+ else
+ {
+ SegmentDuration_tmp = TimeLeft_tmp;
+ }
+ if(read_OLD_SegmentDuration)
+ {
+ SegmentDuration_tmp = OLD_SegmentDuration;
+ read_OLD_SegmentDuration=false;
+ }
+ /*==========================
+ 拆分视频片段
+ ==========================*/
+ if(isSplitComplete==false)
+ {
+ if(file_isDirExist(SplitFramesFolderPath))
+ {
+ file_DelDir(SplitFramesFolderPath);
+ file_mkDir(SplitFramesFolderPath);
+ }
+ else
+ {
+ file_mkDir(SplitFramesFolderPath);
+ }
+ video_video2images_ProcessBySegment(video_mp4_fullpath,SplitFramesFolderPath,StartTime,SegmentDuration_tmp);
+ if(waifu2x_STOP)
+ {
+ emit Send_Table_video_ChangeStatus_rowNumInt_statusQString(rowNum, "Interrupted");
+ return 0;//如果启用stop位,则直接return
+ }
+ }
+ /*==========================
+ 处理视频片段的帧
+ ==========================*/
+ if(isScaleComplete==false)
+ {
+ //============================== 扫描获取文件名 ===============================
+ QStringList Frame_fileName_list = file_getFileNames_in_Folder_nofilter(SplitFramesFolderPath);
+ if(isSplitComplete==false)
+ {
+ if(Frame_fileName_list.isEmpty())//检查是否成功拆分为帧
+ {
+ emit Send_TextBrowser_NewMessage(tr("Error occured when processing [")+SourceFile_fullPath+tr("]. Error: [Unable to split video into pictures.]"));
+ emit Send_Table_video_ChangeStatus_rowNumInt_statusQString(rowNum, "Failed");
+ emit Send_progressbar_Add();
+ return 0;//如果启用stop位,则直接return
+ }
+ }
+ /*
+ 记录进度
+ 帧拆分成功
+ */
+ emit Send_video_write_Progress_ProcessBySegment(VideoConfiguration_fullPath,StartTime,true,false,SegmentDuration_tmp,LastVideoClipNo);
+ //============================== 放大 =======================================
+ //===========建立存储放大后frame的文件夹===========
+ if(isSplitComplete==false)
+ {
+ if(file_isDirExist(ScaledFramesFolderPath))
+ {
+ file_DelDir(ScaledFramesFolderPath);
+ file_mkDir(ScaledFramesFolderPath);
+ }
+ else
+ {
+ file_mkDir(ScaledFramesFolderPath);
+ }
+ }
+ //==========开始放大==========================
+ FileProgressWatch_isEnabled=true;
+ QFuture FileProgressWatch_QFuture = QtConcurrent::run(this, &MainWindow::CurrentFileProgress_WatchFolderFileNum_Textbrower, SourceFile_fullPath,ScaledFramesFolderPath,Frame_fileName_list.size()+file_getFileNames_in_Folder_nofilter(ScaledFramesFolderPath).size());
+ if(ui->checkBox_ShowInterPro->isChecked()==false)
+ {
+ FileProgressWatch_isEnabled=false;
+ FileProgressWatch_QFuture.cancel();
+ }
+ //=======获取显卡信息========
+ int NumOfGPU = 1;
+ if(ui->checkBox_SpecifyGPU_Anime4k->isChecked()==true)
+ {
+ NumOfGPU = Get_NumOfGPU_Anime4k();
+ }
+ //============创建显卡文件夹===========
+ QStringList GPU_SplitFramesFolderPath_List;
+ for(int i = 0; i < NumOfGPU; i++)
+ {
+ QString GPU_SplitFramesFolderPath = SplitFramesFolderPath+"/"+"GPU_"+QString::number(i);
+ if(file_isDirExist(GPU_SplitFramesFolderPath)==false)
+ {
+ file_DelDir(GPU_SplitFramesFolderPath);
+ file_mkDir(GPU_SplitFramesFolderPath);
+ }
+ else
+ {
+ file_mkDir(GPU_SplitFramesFolderPath);
+ }
+ GPU_SplitFramesFolderPath_List.append(GPU_SplitFramesFolderPath);
+ }
+ int TotalFramesNum = Frame_fileName_list.size();
+ int FramesNumForEachGPU = TotalFramesNum/NumOfGPU;
+ if(FramesNumForEachGPU<1)FramesNumForEachGPU=1;
+ int start_num=0;
+ for(int x = 0; x < GPU_SplitFramesFolderPath_List.size(); x++)
+ {
+ if(x==GPU_SplitFramesFolderPath_List.size()-1)FramesNumForEachGPU=TotalFramesNum;
+ QStringList file_waitformove = Frame_fileName_list.mid(start_num,FramesNumForEachGPU);
+ for(int i = 0; i < file_waitformove.size(); i++)
+ {
+ QString FileName = file_waitformove.at(i);
+ QFile::rename(SplitFramesFolderPath+"/"+FileName,GPU_SplitFramesFolderPath_List.at(x)+"/"+FileName);
+ }
+ start_num+=FramesNumForEachGPU;
+ }
+ //=========================
+ bool Frame_failed = false;//放大失败标志
+ QMap Sub_Thread_info;
+ Sub_Thread_info["ScaledFramesFolderPath"]=ScaledFramesFolderPath;
+ if(CustRes_isEnabled == true)
+ {
+ Sub_Thread_info["ScaleRatio"] = QString("%1").arg(CustRes_CalNewScaleRatio(video_mp4_fullpath,CustRes_height,CustRes_width));
+ }
+ else
+ {
+ Sub_Thread_info["ScaleRatio"] = QString("%1").arg(ScaleRatio);
+ }
+ //=========================
+ for(int i = 0; i < GPU_SplitFramesFolderPath_List.size(); i++)
+ {
+ Sub_Thread_info["SplitFramesFolderPath"]=GPU_SplitFramesFolderPath_List.at(i);
+ mutex_SubThreadNumRunning.lock();
+ Sub_video_ThreadNumRunning++;
+ mutex_SubThreadNumRunning.unlock();
+ QtConcurrent::run(this,&MainWindow::Anime4k_Video_scale,Sub_Thread_info,&Sub_video_ThreadNumRunning,&Frame_failed);
+ while (Sub_video_ThreadNumRunning >= NumOfGPU)
+ {
+ Delay_msec_sleep(500);
+ }
+ if(waifu2x_STOP)
+ {
+ while (Sub_video_ThreadNumRunning > 0)
+ {
+ Delay_msec_sleep(500);
+ }
+ FileProgressWatch_isEnabled=false;
+ FileProgressWatch_QFuture.cancel();
+ Restore_SplitFramesFolderPath(SplitFramesFolderPath,GPU_SplitFramesFolderPath_List);
+ emit Send_Table_video_ChangeStatus_rowNumInt_statusQString(rowNum, "Interrupted");
+ return 0;//如果启用stop位,则直接return
+ }
+ if(Frame_failed)
+ {
+ FileProgressWatch_isEnabled=false;
+ FileProgressWatch_QFuture.cancel();
+ Restore_SplitFramesFolderPath(SplitFramesFolderPath,GPU_SplitFramesFolderPath_List);
+ emit Send_TextBrowser_NewMessage(tr("Error occured when processing [")+SourceFile_fullPath+tr("]. Error: [Failed to scale frames.]"));
+ emit Send_Table_video_ChangeStatus_rowNumInt_statusQString(rowNum, "Failed");
+ emit Send_progressbar_Add();
+ return 0;//如果启用stop位,则直接return
+ }
+ }
+ while (Sub_video_ThreadNumRunning!=0)
+ {
+ Delay_msec_sleep(500);
+ }
+ FileProgressWatch_isEnabled=false;
+ FileProgressWatch_QFuture.cancel();
+ //================ 扫描放大后的帧文件数量,判断是否放大成功 =======================
+ QStringList Frame_fileName_list_scaled = file_getFileNames_in_Folder_nofilter(ScaledFramesFolderPath);
+ if(Frame_fileName_list_scaled.size()checkBox_ShowInterPro->isChecked())
+ {
+ emit Send_CurrentFileProgress_progressbar_Add_SegmentDuration(SegmentDuration_tmp);
+ }
+ StartTime+=SegmentDuration_tmp;
+ isSplitComplete = false;
+ isScaleComplete = false;
+ LastVideoClipNo=VideoClipNo;
+ emit Send_video_write_Progress_ProcessBySegment(VideoConfiguration_fullPath,StartTime,false,false,-1,VideoClipNo);
+ }
+ emit Send_CurrentFileProgress_Stop();
+ //======================================================
+ // 组装(片段到成片)
+ //======================================================
+ //确定是否插入降噪值
+ QString denoiseLevel_inName_str = "";
+ int denoiseLevel = ui->spinBox_DenoiseLevel_video->value();
+ if(denoiseLevel != -1)
+ {
+ denoiseLevel_inName_str = QString::number(denoiseLevel,10)+"n_";
+ }
+ //生成最终视频名称
+ QString video_mp4_scaled_fullpath = "";
+ if(CustRes_isEnabled)
+ {
+ video_mp4_scaled_fullpath = file_path+"/"+file_name+"_waifu2x_"+QString::number(CustRes_width,10)+"x"+QString::number(CustRes_height,10)+"_"+denoiseLevel_inName_str+file_ext+".mp4";
+ }
+ else
+ {
+ video_mp4_scaled_fullpath = file_path+"/"+file_name+"_waifu2x_"+QString::number(ScaleRatio,10)+"x_"+denoiseLevel_inName_str+file_ext+".mp4";
+ }
+ QFile::remove(video_mp4_scaled_fullpath);
+ video_AssembleVideoClips(VideoClipsFolderPath,VideoClipsFolderName,video_mp4_scaled_fullpath,AudioPath);
+ if(QFile::exists(video_mp4_scaled_fullpath)==false)//检查是否成功生成视频
+ {
+ if(waifu2x_STOP)
+ {
+ emit Send_Table_video_ChangeStatus_rowNumInt_statusQString(rowNum, "Interrupted");
+ return 0;//如果启用stop位,则直接return
+ }
+ emit Send_TextBrowser_NewMessage(tr("Error occured when processing [")+SourceFile_fullPath+tr("]. Error: [Unable to assemble video clips.]"));
+ emit Send_Table_video_ChangeStatus_rowNumInt_statusQString(rowNum, "Failed");
+ emit Send_progressbar_Add();
+ return 0;//如果启用stop位,则直接return
+ }
+ //============================== 删除缓存文件 ====================================================
+ if(ui->checkBox_KeepVideoCache->isChecked()==false)
+ {
+ QFile::remove(VideoConfiguration_fullPath);
+ file_DelDir(SplitFramesFolderPath);
+ file_DelDir(VideoClipsFolderPath);
+ QFile::remove(AudioPath);
+ if(SourceFile_fullPath!=video_mp4_fullpath)QFile::remove(video_mp4_fullpath);
+ }
+ else
+ {
+ DelOriginal=false;
+ }
+ //============================= 删除原文件 & & 更新table status ============================
+ if(DelOriginal)
+ {
+ if(ReplaceOriginalFile(SourceFile_fullPath,video_mp4_scaled_fullpath)==false)
+ {
+ if(QAction_checkBox_MoveToRecycleBin_checkBox_DelOriginal->isChecked())
+ {
+ file_MoveToTrash(SourceFile_fullPath);
+ }
+ else
+ {
+ QFile::remove(SourceFile_fullPath);
+ }
+ }
+ emit Send_Table_video_ChangeStatus_rowNumInt_statusQString(rowNum, "Finished, original file deleted");
+ }
+ else
+ {
+ emit Send_Table_video_ChangeStatus_rowNumInt_statusQString(rowNum, "Finished");
+ }
+ //========== 移动到输出路径 =========
+ if(ui->checkBox_OutPath_isEnabled->isChecked())
+ {
+ MoveFileToOutputPath(video_mp4_scaled_fullpath,SourceFile_fullPath);
+ }
+ //============================ 更新进度条 =================================
+ emit Send_progressbar_Add();
+ //=========================== ==============================
+ return 0;
+}
+/*
+Anime4k视频放大子线程
+放大,修改大小
+*/
+int MainWindow::Anime4k_Video_scale(QMap Sub_Thread_info,int *Sub_video_ThreadNumRunning,bool *Frame_failed)
+{
+ bool AllFinished=true;
+ QString SplitFramesFolderPath = Sub_Thread_info["SplitFramesFolderPath"];
+ QString ScaledFramesFolderPath = Sub_Thread_info["ScaledFramesFolderPath"];
+ //===========
+ QStringList OutPutFilesFullPathList;
+ do
+ {
+ QStringList InputFilesNameList = file_getFileNames_in_Folder_nofilter(SplitFramesFolderPath);
+ for(int i=0; ispinBox_retry->value()+ForceRetryCount); retry++)
+ {
+ Anime4k->start(CMD);
+ while(!Anime4k->waitForStarted(100)&&!QProcess_stop) {}
+ while(!Anime4k->waitForFinished(500)&&!QProcess_stop)
+ {
+ if(waifu2x_STOP)
+ {
+ QStringList FinfishedFileList = WaitForEngineIO(OutPutFilesFullPathList);
+ Anime4k->close();
+ //============
+ QString file_fullpath_tmp="";
+ QString file_name="";
+ QString file_ext="";
+ for(int i=0; ispinBox_retry->value()+(ForceRetryCount-1))break;
+ Delay_sec_sleep(5);
+ emit Send_TextBrowser_NewMessage(tr("Automatic retry, please wait."));
+ AllFinished=false;
+ break;
+ }
+ }
+ if(AllFinished== true)break;
+ }
+ //=========
+ AllFinished = true;
+ for(int i=0; icheckBox_FastMode_Anime4K->isChecked())
+ {
+ Anime4k_Settings_str.append("-f ");
+ }
+ //GPU加速
+ if(ui->checkBox_GPUMode_Anime4K->isChecked())
+ {
+ Anime4k_Settings_str.append("-q ");
+ //加载GPGPU模式
+ QString GPGPU_Model = ui->comboBox_GPGPUModel_A4k->currentText().toLower().trimmed();
+ Anime4k_Settings_str.append("-M "+GPGPU_Model+" ");
+ //加载OpenCL选项
+ if(GPGPU_Model=="opencl")
+ {
+ if(ui->checkBox_OpenCLParallelIO_A4k->isChecked())Anime4k_Settings_str.append("-P ");
+ Anime4k_Settings_str.append("-Q "+QString::number(ui->spinBox_OpenCLCommandQueues_A4k->value(),10)+" ");
+ }
+ }
+ //ACNet
+ if(ui->checkBox_ACNet_Anime4K->isChecked())
+ {
+ Anime4k_Settings_str.append("-w ");//启用acnet
+ if(ui->checkBox_HDNMode_Anime4k->isChecked())
+ {
+ Anime4k_Settings_str.append("-H ");//启用HDN
+ }
+ return Anime4k_Settings_str;
+ }
+ //============= 非ACNET选项 ===========
+ //Passes
+ Anime4k_Settings_str.append("-p "+QString::number(ui->spinBox_Passes_Anime4K->value(),10)+" ");
+ //Push color count
+ Anime4k_Settings_str.append("-n "+QString::number(ui->spinBox_PushColorCount_Anime4K->value(),10)+" ");
+ //Push color strength
+ Anime4k_Settings_str.append("-c "+QString::number(ui->doubleSpinBox_PushColorStrength_Anime4K->value(),'f',2)+" ");
+ //Push gradient strength
+ Anime4k_Settings_str.append("-g "+QString::number(ui->doubleSpinBox_PushGradientStrength_Anime4K->value(),'f',2)+" ");
+ //Pre-processing
+ if(ui->checkBox_EnablePreProcessing_Anime4k->isChecked())
+ {
+ Anime4k_Settings_str.append("-b ");
+ uint8_t PreProcessingFilters = 0;
+ //读取滤镜选择情况
+ if (ui->checkBox_MedianBlur_Pre_Anime4k->isChecked())
+ {
+ PreProcessingFilters|=1;
+ }
+ if (ui->checkBox_MeanBlur_Pre_Anime4k->isChecked())
+ {
+ PreProcessingFilters|=2;
+ }
+ if (ui->checkBox_CASSharping_Pre_Anime4k->isChecked())
+ {
+ PreProcessingFilters|=4;
+ }
+ if (ui->checkBox_GaussianBlurWeak_Pre_Anime4k->isChecked())
+ {
+ PreProcessingFilters|=8;
+ }
+ if (ui->checkBox_GaussianBlur_Pre_Anime4k->isChecked())
+ {
+ PreProcessingFilters|=16;
+ }
+ if (ui->checkBox_BilateralFilter_Pre_Anime4k->isChecked())
+ {
+ PreProcessingFilters|=32;
+ }
+ if (ui->checkBox_BilateralFilterFaster_Pre_Anime4k->isChecked())
+ {
+ PreProcessingFilters|=64;
+ }
+ //生成添加滤镜指令
+ if(PreProcessingFilters!=0)
+ {
+ Anime4k_Settings_str.append("-r "+QString::number(PreProcessingFilters,10)+" ");
+ }
+ else
+ {
+ Anime4k_Settings_str.append("-r 4 ");
+ }
+ }
+ //Post-processing
+ if(ui->checkBox_EnablePostProcessing_Anime4k->isChecked())
+ {
+ Anime4k_Settings_str.append("-a ");
+ uint8_t PostProcessingFilters = 0;
+ //读取滤镜选择情况
+ if (ui->checkBox_MedianBlur_Post_Anime4k->isChecked())
+ {
+ PostProcessingFilters|=1;
+ }
+ if (ui->checkBox_MeanBlur_Post_Anime4k->isChecked())
+ {
+ PostProcessingFilters|=2;
+ }
+ if (ui->checkBox_CASSharping_Post_Anime4k->isChecked())
+ {
+ PostProcessingFilters|=4;
+ }
+ if (ui->checkBox_GaussianBlurWeak_Post_Anime4k->isChecked())
+ {
+ PostProcessingFilters|=8;
+ }
+ if (ui->checkBox_GaussianBlur_Post_Anime4k->isChecked())
+ {
+ PostProcessingFilters|=16;
+ }
+ if (ui->checkBox_BilateralFilter_Post_Anime4k->isChecked())
+ {
+ PostProcessingFilters|=32;
+ }
+ if (ui->checkBox_BilateralFilterFaster_Post_Anime4k->isChecked())
+ {
+ PostProcessingFilters|=64;
+ }
+ //生成添加滤镜指令
+ if(PostProcessingFilters!=0)
+ {
+ Anime4k_Settings_str.append("-e "+QString::number(PostProcessingFilters,10)+" ");
+ }
+ else
+ {
+ Anime4k_Settings_str.append("-e 4 ");
+ }
+ }
+ return Anime4k_Settings_str;
+}
+/*
+Anime4k
+读取配置生成配置string
+*/
+QString MainWindow::Anime4k_ReadSettings(bool PreserveAlphaChannel)
+{
+ QString Anime4k_Settings_str = "";
+ //=================================
+ Anime4k_Settings_str.append(Anime4k_PreLoad_Settings_Str);
+ //保留透明通道
+ if(PreserveAlphaChannel)
+ {
+ Anime4k_Settings_str.append("-A ");//保留透明通道
+ }
+ //GPU加速
+ if(ui->checkBox_GPUMode_Anime4K->isChecked())
+ {
+ //指定GPU
+ if(ui->checkBox_SpecifyGPU_Anime4k->isChecked())
+ {
+ Anime4k_Settings_str.append(Anime4k_GetGPUInfo()+" ");
+ }
+ }
+ //=================================
+ return Anime4k_Settings_str;
+}
+
+QString MainWindow::Anime4k_GetGPUInfo()
+{
+ GetGPUInfo_QMutex_Anime4k.lock();
+ //====
+ QStringList GPU_List = ui->lineEdit_GPUs_Anime4k->text().trimmed().remove(" ").remove(" ").split(":");
+ GPU_List.removeDuplicates();
+ GPU_List.removeAll("");
+ //====
+ int MAX_GPU_ID_Anime4k = GPU_List.size()-1;
+ if(GPU_ID_Anime4k_GetGPUInfo>MAX_GPU_ID_Anime4k)
+ {
+ GPU_ID_Anime4k_GetGPUInfo=0;
+ }
+ //======
+ QString GPUInfo="";
+ QStringList PID_DID = GPU_List.at(GPU_ID_Anime4k_GetGPUInfo).split(",");
+ PID_DID.removeAll("");
+ if(PID_DID.size()==2)
+ {
+ GPUInfo = "-h "+PID_DID.at(0).trimmed()+" -d "+PID_DID.at(1).trimmed();
+ }
+ else
+ {
+ GPUInfo = "-h 0 -d 0";
+ }
+ //======
+ GPU_ID_Anime4k_GetGPUInfo++;
+ if(GPU_ID_Anime4k_GetGPUInfo>MAX_GPU_ID_Anime4k)
+ {
+ GPU_ID_Anime4k_GetGPUInfo=0;
+ }
+ //======
+ GetGPUInfo_QMutex_Anime4k.unlock();
+ return GPUInfo;
+}
+/*
+列出可用的GPUs
+*/
+void MainWindow::on_pushButton_ListGPUs_Anime4k_clicked()
+{
+ QtConcurrent::run(this, &MainWindow::ListGPUs_Anime4k);
+}
+
+void MainWindow::ListGPUs_Anime4k()
+{
+ QString cmd = "\"" + Anime4k_ProgramPath + "\" -l";
+ ExecuteCMD_batFile(cmd.replace("%","%%")+"\n title = GPU List for Anime4K @ Waifu2x-Extension-GUI\n pause",false);
+}
+
+void MainWindow::on_lineEdit_GPUs_Anime4k_editingFinished()
+{
+ QString Format_str="0123456789:,";
+ QString GPUs_str = ui->lineEdit_GPUs_Anime4k->text().trimmed().replace(":",":").replace(",",",").remove(" ").remove(" ");
+ for (int i=0; ilineEdit_GPUs_Anime4k->setText(GPUs_str);
+}
+
+void MainWindow::on_pushButton_VerifyGPUsConfig_Anime4k_clicked()
+{
+ on_lineEdit_GPUs_Anime4k_editingFinished();
+ QStringList GPU_List = ui->lineEdit_GPUs_Anime4k->text().trimmed().remove(" ").remove(" ").split(":");
+ GPU_List.removeDuplicates();
+ GPU_List.removeAll("");
+ //======
+ QString VerRes = "";
+ //======
+ for (int i=0; isetWindowTitle(tr("GPUs List according to your configuration"));
+ MSG->setText(VerRes);
+ MSG->setIcon(QMessageBox::Information);
+ MSG->setModal(true);
+ MSG->show();
+ //======
+ emit Send_TextBrowser_NewMessage(tr("\nAnime4k GPUs List(user configuration):\n")+VerRes.trimmed());
+}
+
+/*
+删除强制重试时生成的垃圾缓存文件
+*/
+void MainWindow::DelTrash_ForceRetry_Anime4k(QString OutPut_Path)
+{
+ if(isForceRetryClicked)//判断是否触发强制重试,若触发,直接删除垃圾缓存
+ {
+ QFile::remove(OutPut_Path);
+ isForceRetryClicked_QMutex.lock();
+ isForceRetryClicked=false;
+ isForceRetryClicked_QMutex.unlock();
+ }
+ return;
+}
+//阻断其他线程重置是否强制重试的标记,并检测anime4k是否正在运行
+void MainWindow::isForceRetryClicked_SetTrue_Block_Anime4k()
+{
+ isForceRetryClicked_QMutex.lock();
+ isForceRetryClicked=true;
+ Delay_sec_sleep(5);
+ QProcess Get_tasklist;
+ do
+ {
+ Get_tasklist.start("tasklist /fo csv");
+ while(!Get_tasklist.waitForStarted(100)) {}
+ while(!Get_tasklist.waitForFinished(100)) {}
+ if(Get_tasklist.readAllStandardOutput().contains("Anime4K_waifu2xEX.exe")==false)
+ {
+ break;
+ }
+ Delay_sec_sleep(1);
+ }
+ while(true);
+ isForceRetryClicked_QMutex.unlock();
+ emit Send_SetEnable_pushButton_ForceRetry_self();
+}
+
+void MainWindow::DenoiseLevelSpinboxSetting_Anime4k()
+{
+ if(ui->checkBox_ACNet_Anime4K->isChecked()&&ui->checkBox_HDNMode_Anime4k->isChecked())
+ {
+ if(ui->comboBox_Engine_Image->currentIndex()==3)
+ {
+ ui->spinBox_DenoiseLevel_image->setRange(1,3);
+ ui->spinBox_DenoiseLevel_image->setValue(1);
+ ui->spinBox_DenoiseLevel_image->setEnabled(1);
+ ui->spinBox_DenoiseLevel_image->setToolTip(tr("Range:1~3"));
+ ui->label_ImageDenoiseLevel->setToolTip(tr("Range:1~3"));
+ }
+ if(ui->comboBox_Engine_GIF->currentIndex()==3)
+ {
+ ui->spinBox_DenoiseLevel_gif->setRange(1,3);
+ ui->spinBox_DenoiseLevel_gif->setValue(1);
+ ui->spinBox_DenoiseLevel_gif->setEnabled(1);
+ ui->spinBox_DenoiseLevel_gif->setToolTip(tr("Range:1~3"));
+ ui->label_GIFDenoiseLevel->setToolTip(tr("Range:1~3"));
+ }
+ if(ui->comboBox_Engine_Video->currentIndex()==2)
+ {
+ ui->spinBox_DenoiseLevel_video->setRange(1,3);
+ ui->spinBox_DenoiseLevel_video->setValue(1);
+ ui->spinBox_DenoiseLevel_video->setEnabled(1);
+ ui->spinBox_DenoiseLevel_video->setToolTip(tr("Range:1~3"));
+ ui->label_VideoDenoiseLevel->setToolTip(tr("Range:1~3"));
+ }
+ }
+ else
+ {
+ if(ui->comboBox_Engine_Image->currentIndex()==3)
+ {
+ ui->spinBox_DenoiseLevel_image->setRange(-1,0);
+ ui->spinBox_DenoiseLevel_image->setValue(-1);
+ ui->spinBox_DenoiseLevel_image->setEnabled(0);
+ ui->spinBox_DenoiseLevel_image->setToolTip(tr("Due to current settings, you can\'t adjust denoise level."));
+ ui->label_ImageDenoiseLevel->setToolTip(tr("Due to current settings, you can\'t adjust denoise level."));
+ }
+ if(ui->comboBox_Engine_GIF->currentIndex()==3)
+ {
+ ui->spinBox_DenoiseLevel_gif->setRange(-1,0);
+ ui->spinBox_DenoiseLevel_gif->setValue(-1);
+ ui->spinBox_DenoiseLevel_gif->setEnabled(0);
+ ui->spinBox_DenoiseLevel_gif->setToolTip(tr("Due to current settings, you can\'t adjust denoise level."));
+ ui->label_GIFDenoiseLevel->setToolTip(tr("Due to current settings, you can\'t adjust denoise level."));
+ }
+ if(ui->comboBox_Engine_Video->currentIndex()==2)
+ {
+ ui->spinBox_DenoiseLevel_video->setRange(-1,0);
+ ui->spinBox_DenoiseLevel_video->setValue(-1);
+ ui->spinBox_DenoiseLevel_video->setEnabled(0);
+ ui->spinBox_DenoiseLevel_video->setToolTip(tr("Due to current settings, you can\'t adjust denoise level."));
+ ui->label_VideoDenoiseLevel->setToolTip(tr("Due to current settings, you can\'t adjust denoise level."));
+ }
+ }
+}
+/*
+获取可用显卡数量
+*/
+int MainWindow::Get_NumOfGPU_Anime4k()
+{
+ QStringList GPU_List = ui->lineEdit_GPUs_Anime4k->text().trimmed().remove(" ").remove(" ").split(":");
+ GPU_List.removeDuplicates();
+ GPU_List.removeAll("");
+ int GPUNum = 0;
+ QStringList PID_DID;
+ for (int i=0; i FileProgressWatch_QFuture = QtConcurrent::run(this, &MainWindow::CurrentFileProgress_WatchFolderFileNum, scaledFramesFolder);//启动waifu2x 主线程
+ if(ui->checkBox_ShowInterPro->isChecked()==false)
+ {
+ FileProgressWatch_isEnabled=false;
+ FileProgressWatch_QFuture.cancel();
+ emit Send_CurrentFileProgress_Stop();
+ }
+ //=======获取显卡信息========
+ int NumOfGPU = 1;
+ if(ui->checkBox_SpecifyGPU_Anime4k->isChecked()==true)
+ {
+ NumOfGPU = Get_NumOfGPU_Anime4k();
+ }
+ //============创建显卡文件夹===========
+ QStringList GPU_splitFramesFolder_List;
+ for(int i = 0; i < NumOfGPU; i++)
+ {
+ QString GPU_splitFramesFolder = splitFramesFolder+"/"+"GPU_"+QString::number(i);
+ if(file_isDirExist(GPU_splitFramesFolder))
+ {
+ file_DelDir(GPU_splitFramesFolder);
+ file_mkDir(GPU_splitFramesFolder);
+ }
+ else
+ {
+ file_mkDir(GPU_splitFramesFolder);
+ }
+ GPU_splitFramesFolder_List.append(GPU_splitFramesFolder);
+ }
+ int TotalFramesNum = framesFileName_qStrList.size();
+ int FramesNumForEachGPU = TotalFramesNum/NumOfGPU;
+ if(FramesNumForEachGPU<1)FramesNumForEachGPU=1;
+ int start_num=0;
+ for(int x = 0; x < GPU_splitFramesFolder_List.size(); x++)
+ {
+ if(x==GPU_splitFramesFolder_List.size()-1)FramesNumForEachGPU=TotalFramesNum;
+ QStringList file_waitformove = framesFileName_qStrList.mid(start_num,FramesNumForEachGPU);
+ for(int i = 0; i < file_waitformove.size(); i++)
+ {
+ QString FileName = file_waitformove.at(i);
+ QFile::rename(splitFramesFolder+"/"+FileName,GPU_splitFramesFolder_List.at(x)+"/"+FileName);
+ }
+ start_num+=FramesNumForEachGPU;
+ }
+ //===
+ QMap Sub_Thread_info;
+ Sub_Thread_info["scaledFramesFolder"]=scaledFramesFolder;
+ if(CustRes_isContained(sourceFileFullPath))
+ {
+ QMap Res_map = CustRes_getResMap(sourceFileFullPath);//res_map["fullpath"],["height"],["width"]
+ Sub_Thread_info["ScaleRatio"] = QString("%1").arg(CustRes_CalNewScaleRatio(sourceFileFullPath,Res_map["height"].toInt(),Res_map["width"].toInt()));
+ }
+ else
+ {
+ Sub_Thread_info["ScaleRatio"] = QString("%1").arg(qRound(ui->doubleSpinBox_ScaleRatio_gif->value()));
+ }
+ //=========================
+ bool Frame_failed = false;//放大失败标志
+ int Sub_gif_ThreadNumRunning=0;//正在运行的线程数量
+ //=========================
+ for(int i = 0; i < GPU_splitFramesFolder_List.size(); i++)
+ {
+ Sub_Thread_info["splitFramesFolder"]=GPU_splitFramesFolder_List.at(i);
+ mutex_SubThreadNumRunning.lock();
+ Sub_gif_ThreadNumRunning++;
+ mutex_SubThreadNumRunning.unlock();
+ QtConcurrent::run(this,&MainWindow::Anime4k_APNG_scale,Sub_Thread_info,&Sub_gif_ThreadNumRunning,&Frame_failed);
+ while (Sub_gif_ThreadNumRunning >= NumOfGPU)
+ {
+ Delay_msec_sleep(500);
+ }
+ if(waifu2x_STOP)
+ {
+ while (Sub_gif_ThreadNumRunning > 0)
+ {
+ Delay_msec_sleep(500);
+ }
+ FileProgressWatch_isEnabled=false;
+ FileProgressWatch_QFuture.cancel();
+ return false;
+ }
+ if(Frame_failed)
+ {
+ FileProgressWatch_isEnabled=false;
+ FileProgressWatch_QFuture.cancel();
+ emit Send_TextBrowser_NewMessage(tr("Error occured when processing [")+sourceFileFullPath+tr("]. Error: [Failed to scale frames.]"));
+ return false;
+ }
+ }
+ while (Sub_gif_ThreadNumRunning!=0)
+ {
+ Delay_msec_sleep(500);
+ }
+ FileProgressWatch_isEnabled=false;
+ FileProgressWatch_QFuture.cancel();
+ emit Send_CurrentFileProgress_Stop();
+ //======================= 检查是否成功放大所有帧 ===========================
+ QStringList framesFileName_qStrList_scaled = file_getFileNames_in_Folder_nofilter(scaledFramesFolder);
+ if(framesFileName_qStrList.size()!=framesFileName_qStrList_scaled.size())
+ {
+ emit Send_TextBrowser_NewMessage(tr("Error occured when processing [")+sourceFileFullPath+tr("]. Error: [Failed to scale frames.]"));
+ return false;
+ }
+ //============================================================
+ //组装apng
+ APNG_Frames2APNG(sourceFileFullPath, scaledFramesFolder, resultFileFullPath, false);
+ return true;
+}
+/*
+Anime4k APNG 放大子线程
+*/
+int MainWindow::Anime4k_APNG_scale(QMap Sub_Thread_info,int *Sub_gif_ThreadNumRunning,bool *Frame_failed)
+{
+ bool AllFinished=true;
+ QString splitFramesFolder = Sub_Thread_info["splitFramesFolder"];
+ QString scaledFramesFolder = Sub_Thread_info["scaledFramesFolder"];
+ //==================
+ // 生成输出文件列表
+ //==================
+ QStringList OutPutFilesFullPathList;
+ do
+ {
+ QStringList InputFilesNameList = file_getFileNames_in_Folder_nofilter(splitFramesFolder);
+ for(int i=0; ispinBox_retry->value()+ForceRetryCount); retry++)
+ {
+ Anime4k->start(CMD);
+ while(!Anime4k->waitForStarted(100)&&!QProcess_stop) {}
+ while(!Anime4k->waitForFinished(500)&&!QProcess_stop)
+ {
+ if(waifu2x_STOP)
+ {
+ Anime4k->close();
+ mutex_SubThreadNumRunning.lock();
+ *Sub_gif_ThreadNumRunning=*Sub_gif_ThreadNumRunning-1;
+ mutex_SubThreadNumRunning.unlock();
+ return 0;
+ }
+ }
+ AllFinished = true;
+ for(int i=0; ispinBox_retry->value()+(ForceRetryCount-1))break;
+ Delay_sec_sleep(5);
+ emit Send_TextBrowser_NewMessage(tr("Automatic retry, please wait."));
+ AllFinished=false;
+ break;
+ }
+ }
+ if(AllFinished == true)break;
+ }
+ //=========
+ AllFinished = true;
+ for(int i=0; i.
-
- My Github homepage: https://github.com/AaronFeng753
-*/
-
-#include "mainwindow.h"
-#include "ui_mainwindow.h"
-
-/*
-开始处理当前文件
-*/
-void MainWindow::CurrentFileProgress_Start(QString FileName,int FrameNum)
-{
- ui->groupBox_CurrentFile->setTitle(tr("Current File:")+" "+FileName);
- //=================================
- ui->progressBar_CurrentFile->setRange(0,FrameNum);
- ui->progressBar_CurrentFile->setValue(0);
- //=================================
- ui->label_FrameProgress_CurrentFile->setText("0/"+QString::number(FrameNum,10));
- ui->label_TimeRemain_CurrentFile->setText(tr("Time remaining:NULL"));
- ui->label_TimeCost_CurrentFile->setText(tr("Time taken:NULL"));
- ui->label_ETA_CurrentFile->setText(tr("ETA:NULL"));
- //=================================
- TimeCost_CurrentFile = 0;
- TaskNumTotal_CurrentFile=FrameNum;
- TaskNumFinished_CurrentFile=0;
- NewTaskFinished_CurrentFile=false;
- ETA_CurrentFile=0;
- //=================================
- ui->groupBox_CurrentFile->setVisible(1);
- //=================================
- isStart_CurrentFile = true;
- return;
-}
-/*
-停止处理当前文件
-*/
-void MainWindow::CurrentFileProgress_Stop()
-{
- ui->groupBox_CurrentFile->setVisible(0);
- isStart_CurrentFile = false;
- return;
-}
-/*
-进度条 进度+1
-*/
-void MainWindow::CurrentFileProgress_progressbar_Add()
-{
- TaskNumFinished_CurrentFile++;
- NewTaskFinished_CurrentFile=true;
- ui->progressBar_CurrentFile->setValue(TaskNumFinished_CurrentFile);
- ui->label_FrameProgress_CurrentFile->setText(QString::number(TaskNumFinished_CurrentFile,10)+"/"+QString::number(TaskNumTotal_CurrentFile,10));
-}
-/*
-进度条 进度+片段時長
-*/
-void MainWindow::CurrentFileProgress_progressbar_Add_SegmentDuration(int SegmentDuration)
-{
- TaskNumFinished_CurrentFile+=SegmentDuration;
- NewTaskFinished_CurrentFile=true;
- ui->progressBar_CurrentFile->setValue(TaskNumFinished_CurrentFile);
- ui->label_FrameProgress_CurrentFile->setText(QString::number(TaskNumFinished_CurrentFile,10)+"/"+QString::number(TaskNumTotal_CurrentFile,10));
-}
-/*
-进度条 进度+片段時長
-*/
-void MainWindow::CurrentFileProgress_progressbar_SetFinishedValue(int FinishedValue)
-{
- TaskNumFinished_CurrentFile=FinishedValue;
- NewTaskFinished_CurrentFile=true;
- ui->progressBar_CurrentFile->setValue(TaskNumFinished_CurrentFile);
- ui->label_FrameProgress_CurrentFile->setText(QString::number(TaskNumFinished_CurrentFile,10)+"/"+QString::number(TaskNumTotal_CurrentFile,10));
-}
-/*
-监视文件夹内文件数量
-*/
-void MainWindow::CurrentFileProgress_WatchFolderFileNum(QString FolderPath)
-{
- QStringList FilesNameList;
- do
- {
- if(FileProgressWatch_isEnabled==false)return;
- Delay_msec_sleep(2300);
- if(file_isDirExist(FolderPath)==false)return;
- FilesNameList = file_getFileNames_in_Folder_nofilter(FolderPath);
- emit Send_CurrentFileProgress_progressbar_SetFinishedValue(FilesNameList.size());
- }
- while(true);
-}
-/*
-监视文件夹内文件数量
-*/
-void MainWindow::CurrentFileProgress_WatchFolderFileNum_Textbrower(QString SourceFile_fullPath,QString FolderPath,int TotalFileNum)
-{
- QStringList FilesNameList;
- int OLD_num=0;
- int New_num=0;
- do
- {
- if(FileProgressWatch_isEnabled==false)return;
- Delay_msec_sleep(2300);
- //==========
- if(file_isDirExist(FolderPath)==false)return;
- //=========
- New_num = file_getFileNames_in_Folder_nofilter(FolderPath).size();
- if(New_num!=OLD_num)
- {
- OLD_num=New_num;
- emit Send_TextBrowser_NewMessage(tr("File name:[")+SourceFile_fullPath+tr("] Scale progress:[")+QString::number(New_num,10)+"/"+QString::number(TotalFileNum,10)+tr("] Frames"));
- }
- }
- while(true);
-}
+/*
+ Copyright (C) 2021 Aaron Feng
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published
+ by the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see .
+
+ My Github homepage: https://github.com/AaronFeng753
+*/
+
+#include "mainwindow.h"
+#include "ui_mainwindow.h"
+
+/*
+开始处理当前文件
+*/
+void MainWindow::CurrentFileProgress_Start(QString FileName,int FrameNum)
+{
+ ui->groupBox_CurrentFile->setTitle(tr("Current File:")+" "+FileName);
+ //=================================
+ ui->progressBar_CurrentFile->setRange(0,FrameNum);
+ ui->progressBar_CurrentFile->setValue(0);
+ //=================================
+ ui->label_FrameProgress_CurrentFile->setText("0/"+QString::number(FrameNum,10));
+ ui->label_TimeRemain_CurrentFile->setText(tr("Time remaining:NULL"));
+ ui->label_TimeCost_CurrentFile->setText(tr("Time taken:NULL"));
+ ui->label_ETA_CurrentFile->setText(tr("ETA:NULL"));
+ //=================================
+ TimeCost_CurrentFile = 0;
+ TaskNumTotal_CurrentFile=FrameNum;
+ TaskNumFinished_CurrentFile=0;
+ NewTaskFinished_CurrentFile=false;
+ ETA_CurrentFile=0;
+ //=================================
+ ui->groupBox_CurrentFile->setVisible(1);
+ //=================================
+ isStart_CurrentFile = true;
+ return;
+}
+/*
+停止处理当前文件
+*/
+void MainWindow::CurrentFileProgress_Stop()
+{
+ ui->groupBox_CurrentFile->setVisible(0);
+ isStart_CurrentFile = false;
+ return;
+}
+/*
+进度条 进度+1
+*/
+void MainWindow::CurrentFileProgress_progressbar_Add()
+{
+ TaskNumFinished_CurrentFile++;
+ NewTaskFinished_CurrentFile=true;
+ ui->progressBar_CurrentFile->setValue(TaskNumFinished_CurrentFile);
+ ui->label_FrameProgress_CurrentFile->setText(QString::number(TaskNumFinished_CurrentFile,10)+"/"+QString::number(TaskNumTotal_CurrentFile,10));
+}
+/*
+进度条 进度+片段時長
+*/
+void MainWindow::CurrentFileProgress_progressbar_Add_SegmentDuration(int SegmentDuration)
+{
+ TaskNumFinished_CurrentFile+=SegmentDuration;
+ NewTaskFinished_CurrentFile=true;
+ ui->progressBar_CurrentFile->setValue(TaskNumFinished_CurrentFile);
+ ui->label_FrameProgress_CurrentFile->setText(QString::number(TaskNumFinished_CurrentFile,10)+"/"+QString::number(TaskNumTotal_CurrentFile,10));
+}
+/*
+进度条 进度+片段時長
+*/
+void MainWindow::CurrentFileProgress_progressbar_SetFinishedValue(int FinishedValue)
+{
+ TaskNumFinished_CurrentFile=FinishedValue;
+ NewTaskFinished_CurrentFile=true;
+ ui->progressBar_CurrentFile->setValue(TaskNumFinished_CurrentFile);
+ ui->label_FrameProgress_CurrentFile->setText(QString::number(TaskNumFinished_CurrentFile,10)+"/"+QString::number(TaskNumTotal_CurrentFile,10));
+}
+/*
+监视文件夹内文件数量
+*/
+void MainWindow::CurrentFileProgress_WatchFolderFileNum(QString FolderPath)
+{
+ QStringList FilesNameList;
+ do
+ {
+ if(FileProgressWatch_isEnabled==false)return;
+ Delay_msec_sleep(2300);
+ if(file_isDirExist(FolderPath)==false)return;
+ FilesNameList = file_getFileNames_in_Folder_nofilter(FolderPath);
+ emit Send_CurrentFileProgress_progressbar_SetFinishedValue(FilesNameList.size());
+ }
+ while(true);
+}
+/*
+监视文件夹内文件数量
+*/
+void MainWindow::CurrentFileProgress_WatchFolderFileNum_Textbrower(QString SourceFile_fullPath,QString FolderPath,int TotalFileNum)
+{
+ QStringList FilesNameList;
+ int OLD_num=0;
+ int New_num=0;
+ do
+ {
+ if(FileProgressWatch_isEnabled==false)return;
+ Delay_msec_sleep(2300);
+ //==========
+ if(file_isDirExist(FolderPath)==false)return;
+ //=========
+ New_num = file_getFileNames_in_Folder_nofilter(FolderPath).size();
+ if(New_num!=OLD_num)
+ {
+ OLD_num=New_num;
+ emit Send_TextBrowser_NewMessage(tr("File name:[")+SourceFile_fullPath+tr("] Scale progress:[")+QString::number(New_num,10)+"/"+QString::number(TotalFileNum,10)+tr("] Frames"));
+ }
+ }
+ while(true);
+}
diff --git a/SRC/Waifu2x-Extension-QT/CustomResolution.cpp b/SRC_v3.41.01-beta/Waifu2x-Extension-QT/CustomResolution.cpp
similarity index 97%
rename from SRC/Waifu2x-Extension-QT/CustomResolution.cpp
rename to SRC_v3.41.01-beta/Waifu2x-Extension-QT/CustomResolution.cpp
index b209b2d..b890178 100644
--- a/SRC/Waifu2x-Extension-QT/CustomResolution.cpp
+++ b/SRC_v3.41.01-beta/Waifu2x-Extension-QT/CustomResolution.cpp
@@ -1,448 +1,448 @@
-/*
- Copyright (C) 2021 Aaron Feng
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU Affero General Public License as published
- by the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU Affero General Public License for more details.
-
- You should have received a copy of the GNU Affero General Public License
- along with this program. If not, see .
-
- My Github homepage: https://github.com/AaronFeng753
-*/
-
-#include "mainwindow.h"
-#include "ui_mainwindow.h"
-/*
-Apply自定义分辨率
-*/
-int MainWindow::CustRes_SetCustRes()
-{
- int CustRes_height_spinBoxIntValue = ui->spinBox_CustRes_height->value();
- int CustRes_width_spinBoxIntValue = ui->spinBox_CustRes_width->value();
- QString CustRes_height_qStr = QString::number(CustRes_height_spinBoxIntValue,10);
- QString CustRes_width_qStr = QString::number(CustRes_width_spinBoxIntValue,10);
- //========
- if(ui->checkBox_custres_isAll->isChecked()&&EnableApply2All_CustRes)
- {
- int row_count_image = Table_image_get_rowNum();
- int row_count_gif = Table_gif_get_rowNum();
- int row_count_video = Table_video_get_rowNum();
- //====
- if((row_count_image+row_count_gif+row_count_video)==0)
- {
- QMessageBox *CustRes_NoItem = new QMessageBox();
- CustRes_NoItem->setWindowTitle(tr("Error"));
- CustRes_NoItem->setText(tr("No items are in the list."));
- CustRes_NoItem->setIcon(QMessageBox::Warning);
- CustRes_NoItem->setModal(true);
- CustRes_NoItem->show();
- return 0;
- }
- //====
- for(int i=0; i res_map;
- //读取文件信息
- QString SourceFile_fullPath = Table_model_image->item(i,2)->text();
- CustRes_remove(SourceFile_fullPath);//移除原来的设定,防止重复
- res_map["fullpath"] = SourceFile_fullPath;
- res_map["height"] = CustRes_height_qStr;
- res_map["width"] = CustRes_width_qStr;
- Custom_resolution_list.append(res_map);
- Table_image_CustRes_rowNumInt_HeightQString_WidthQString(i,res_map["height"],res_map["width"]);
- }
- //=====
- for(int i=0; i res_map;
- //读取文件信息
- QString SourceFile_fullPath = Table_model_gif->item(i,2)->text();
- CustRes_remove(SourceFile_fullPath);//移除原来的设定,防止重复
- res_map["fullpath"] = SourceFile_fullPath;
- res_map["height"] = CustRes_height_qStr;
- res_map["width"] = CustRes_width_qStr;
- Custom_resolution_list.append(res_map);
- Table_gif_CustRes_rowNumInt_HeightQString_WidthQString(i,res_map["height"],res_map["width"]);
- }
- //========
- if(row_count_video==0)//如果列表里没视频,直接return
- {
- return 0;
- }
- //读取自定义分辨率设定
- int CustRes_width_video=CustRes_width_spinBoxIntValue;
- int CustRes_height_video=CustRes_height_spinBoxIntValue;
- //判断自定义分辨率是否包含奇数
- if(CustRes_height_spinBoxIntValue%2!=0||CustRes_width_spinBoxIntValue%2!=0)
- {
- QMessageBox *MSG = new QMessageBox();
- MSG->setWindowTitle(tr("Warning"));
- MSG->setText(tr("When setting a custom resolution for a video, neither the height value nor the width value can be odd.\n\nTherefore, the custom resolution for video has been automatically corrected by this software."));
- MSG->setIcon(QMessageBox::Warning);
- MSG->setModal(false);
- MSG->show();
- //自动校正分辨率
- if(CustRes_height_video%2!=0)CustRes_height_video++;
- if(CustRes_width_video%2!=0)CustRes_width_video++;
- }
- QString CustRes_height_video_qStr = QString::number(CustRes_height_video,10);
- QString CustRes_width_video_qStr = QString::number(CustRes_width_video,10);
- //开始apply自定义分辨率设定
- for(int i=0; i res_map;
- //读取文件信息
- QString SourceFile_fullPath = Table_model_video->item(i,2)->text();
- CustRes_remove(SourceFile_fullPath);//移除原来的设定,防止重复
- res_map["fullpath"] = SourceFile_fullPath;
- res_map["height"] = CustRes_height_video_qStr;
- res_map["width"] = CustRes_width_video_qStr;
- Custom_resolution_list.append(res_map);
- Table_video_CustRes_rowNumInt_HeightQString_WidthQString(i,res_map["height"],res_map["width"]);
- }
- return 0;
- }
- //如果没有选中任何row,则直接return
- if(curRow_image==-1&&curRow_video==-1&&curRow_gif==-1)
- {
- QMessageBox *CustRes_NoItem = new QMessageBox();
- CustRes_NoItem->setWindowTitle(tr("Error"));
- CustRes_NoItem->setText(tr("No items are currently selected."));
- CustRes_NoItem->setIcon(QMessageBox::Warning);
- CustRes_NoItem->setModal(true);
- CustRes_NoItem->show();
- return 0;
- }
- if(curRow_image >= 0)//如果已选中图片
- {
- QMap res_map;
- //读取文件信息
- QString SourceFile_fullPath = Table_model_image->item(curRow_image,2)->text();
- CustRes_remove(SourceFile_fullPath);//移除原来的设定,防止重复
- res_map["fullpath"] = SourceFile_fullPath;
- res_map["height"] = CustRes_height_qStr;
- res_map["width"] = CustRes_width_qStr;
- Custom_resolution_list.append(res_map);
- Table_image_CustRes_rowNumInt_HeightQString_WidthQString(curRow_image,res_map["height"],res_map["width"]);
- return 0;
- }
- if(curRow_gif >= 0)
- {
- QMap res_map;
- //读取文件信息
- QString SourceFile_fullPath = Table_model_gif->item(curRow_gif,2)->text();
- CustRes_remove(SourceFile_fullPath);//移除原来的设定,防止重复
- res_map["fullpath"] = SourceFile_fullPath;
- res_map["height"] = CustRes_height_qStr;
- res_map["width"] = CustRes_width_qStr;
- Custom_resolution_list.append(res_map);
- Table_gif_CustRes_rowNumInt_HeightQString_WidthQString(curRow_gif,res_map["height"],res_map["width"]);
- return 0;
- }
- if(curRow_video >= 0)
- {
- //读取自定义分辨率设定
- int CustRes_width_video=CustRes_width_spinBoxIntValue;
- int CustRes_height_video=CustRes_height_spinBoxIntValue;
- //判断自定义分辨率是否包含奇数
- if(CustRes_height_spinBoxIntValue%2!=0||CustRes_width_spinBoxIntValue%2!=0)
- {
- QMessageBox *MSG = new QMessageBox();
- MSG->setWindowTitle(tr("Warning"));
- MSG->setText(tr("When setting a custom resolution for a video, neither the height value nor the width value can be odd.\n\nTherefore, the custom resolution for video has been automatically corrected by this software."));
- MSG->setIcon(QMessageBox::Warning);
- MSG->setModal(false);
- MSG->show();
- //自动校正分辨率
- if(CustRes_height_video%2!=0)CustRes_height_video++;
- if(CustRes_width_video%2!=0)CustRes_width_video++;
- }
- //====
- QMap res_map;
- //读取文件信息
- QString SourceFile_fullPath = Table_model_video->item(curRow_video,2)->text();
- CustRes_remove(SourceFile_fullPath);//移除原来的设定,防止重复
- res_map["fullpath"] = SourceFile_fullPath;
- res_map["height"] = QString::number(CustRes_height_video,10);
- res_map["width"] = QString::number(CustRes_width_video,10);
- Custom_resolution_list.append(res_map);
- Table_video_CustRes_rowNumInt_HeightQString_WidthQString(curRow_video,res_map["height"],res_map["width"]);
- return 0;
- }
- return 0;
-}
-/*
-取消 自定义分辨率设定
-*/
-int MainWindow::CustRes_CancelCustRes()
-{
- if(ui->checkBox_custres_isAll->isChecked()&&EnableApply2All_CustRes)
- {
- int row_count_image = Table_image_get_rowNum();
- int row_count_gif = Table_gif_get_rowNum();
- int row_count_video = Table_video_get_rowNum();
- if((row_count_image+row_count_gif+row_count_video)==0)
- {
- QMessageBox *CustRes_NoItem = new QMessageBox();
- CustRes_NoItem->setWindowTitle(tr("Error"));
- CustRes_NoItem->setText(tr("No items are in the list."));
- CustRes_NoItem->setIcon(QMessageBox::Warning);
- CustRes_NoItem->setModal(true);
- CustRes_NoItem->show();
- return 0;
- }
- //====
- for(int i=0; iitem(i,2)->text());//从自定义分辨率列表移除
- Table_image_CustRes_Cancel_rowNumInt(i);//清空指定row的自定义分辨率
- }
- for(int i=0; iitem(i,2)->text());//从自定义分辨率列表移除
- Table_gif_CustRes_Cancel_rowNumInt(i);//清空指定row的自定义分辨率
- }
- for(int i=0; iitem(i,2)->text());//从自定义分辨率列表移除
- Table_video_CustRes_Cancel_rowNumInt(i);//清空指定row的自定义分辨率
- }
- return 0;
- }
- //如果没有任何选中的,则弹窗后return
- if(curRow_image==-1&&curRow_video==-1&&curRow_gif==-1)
- {
- QMessageBox *MSG = new QMessageBox();
- MSG->setWindowTitle(tr("Error"));
- MSG->setText(tr("No items are currently selected."));
- MSG->setIcon(QMessageBox::Warning);
- MSG->setModal(true);
- MSG->show();
- return 0;
- }
- if(curRow_image >= 0)//如果已选中图片
- {
- QString SourceFile_fullPath = Table_model_image->item(curRow_image,2)->text();
- CustRes_remove(SourceFile_fullPath);//从自定义分辨率列表移除
- Table_image_CustRes_Cancel_rowNumInt(curRow_image);//清空指定row的自定义分辨率
- return 0;
- }
- if(curRow_gif >= 0)
- {
- QString SourceFile_fullPath = Table_model_gif->item(curRow_gif,2)->text();
- CustRes_remove(SourceFile_fullPath);//从自定义分辨率列表移除
- Table_gif_CustRes_Cancel_rowNumInt(curRow_gif);//清空指定row的自定义分辨率
- return 0;
- }
- if(curRow_video >= 0)
- {
- QString SourceFile_fullPath = Table_model_video->item(curRow_video,2)->text();
- CustRes_remove(SourceFile_fullPath);//从自定义分辨率列表移除
- Table_video_CustRes_Cancel_rowNumInt(curRow_video);//清空指定row的自定义分辨率
- return 0;
- }
- return 0;
-}
-
-void MainWindow::CustRes_remove(QString fullpath)
-{
- for(int i=0; i map_res = Custom_resolution_list.at(i);
- if(map_res["fullpath"]==fullpath)
- {
- Custom_resolution_list.removeAll(map_res);
- }
- }
-}
-
-bool MainWindow::CustRes_isContained(QString fullpath)
-{
- for(int i=0; i map_res = Custom_resolution_list.at(i);
- if(map_res["fullpath"]==fullpath)
- {
- return true;
- }
- }
- return false;
-}
-
-QMap MainWindow::CustRes_getResMap(QString fullpath)
-{
- for(int i=0; i map_res = Custom_resolution_list.at(i);
- if(map_res["fullpath"]==fullpath)
- {
- return map_res;
- }
- }
- QMap empty;
- empty.clear();
- return empty;
-}
-
-int MainWindow::CustRes_CalNewScaleRatio(QString fullpath,int Height_new,int width_new)
-{
- QImage qimage_original;
- qimage_original.load(fullpath);
- int original_height = 0;
- int original_width = 0;
- //===================== 判断文件类型,获取分辨率 =============================
- //判断是否为图片或gif
- QFileInfo fileinfo(fullpath);
- QString file_ext_lower = fileinfo.suffix();
- QString Ext_image_str = ui->Ext_image->text();
- QStringList nameFilters_image = Ext_image_str.split(":");
- if (nameFilters_image.contains(file_ext_lower) || file_ext_lower=="gif" || file_ext_lower=="apng")
- {
- //是图片或动态图
- QMap res_map = Image_Gif_Read_Resolution(fullpath);
- original_height = res_map["height"];
- original_width = res_map["width"];
- }
- else//不是图片&动态图就是视频了
- {
- QMap res_map = video_get_Resolution(fullpath);
- original_height = res_map["height"];
- original_width = res_map["width"];
- }
- //获取失败
- if(original_height<=0||original_width<=0)
- {
- emit Send_TextBrowser_NewMessage(tr("Error occured when processing [")+fullpath+tr("] [Unable to get resolution.]"));
- return 0;
- }
- //=====================分别计算高和宽的放大倍数=======================
- //==== 高 ======
- int ScaleRatio_height;
- double ScaleRatio_height_double = (double)Height_new/(double)original_height;
- if((ScaleRatio_height_double-(int)ScaleRatio_height_double)>0)
- {
- ScaleRatio_height = (int)(ScaleRatio_height_double)+1;
- }
- else
- {
- ScaleRatio_height = (int)(ScaleRatio_height_double);
- }
- //==== 宽 ======
- int ScaleRatio_width;
- double ScaleRatio_width_double = (double)width_new/(double)original_width;
- if((ScaleRatio_width_double-(int)ScaleRatio_width_double)>0)
- {
- ScaleRatio_width = (int)(ScaleRatio_width_double)+1;
- }
- else
- {
- ScaleRatio_width = (int)(ScaleRatio_width_double);
- }
- //========================比较决定取哪个放大倍数值返回=====================
- if((ScaleRatio_height<=1)&&(ScaleRatio_width<=1))
- {
- return 1;
- }
- if(ScaleRatio_height>=ScaleRatio_width)
- {
- return ScaleRatio_height;
- }
- else
- {
- return ScaleRatio_width;
- }
-}
-
-QMap MainWindow::DoubleScaleRatio_Cal_NewScaleRatio_NewHW(QString fullpath,double ScaleRatio_double)
-{
- QMap Res_map;
- //===========
- QImage qimage_original;
- qimage_original.load(fullpath);
- int original_height = 0;
- int original_width = 0;
- //===================== 判断文件类型,获取分辨率 =============================
- bool isVideo=false;
- //判断是否为图片或gif
- QFileInfo fileinfo(fullpath);
- QString file_ext_lower = fileinfo.suffix();
- QString Ext_image_str = ui->Ext_image->text();
- QStringList nameFilters_image = Ext_image_str.split(":");
- if (nameFilters_image.contains(file_ext_lower) || file_ext_lower=="gif" || file_ext_lower=="apng")
- {
- //是图片或动态图
- QMap res_map = Image_Gif_Read_Resolution(fullpath);
- original_height = res_map["height"];
- original_width = res_map["width"];
- }
- else//不是图片&动态图就是视频了
- {
- isVideo=true;
- QMap res_map = video_get_Resolution(fullpath);
- original_height = res_map["height"];
- original_width = res_map["width"];
- }
- //获取失败
- if(original_height<=0||original_width<=0)
- {
- emit Send_TextBrowser_NewMessage(tr("Error occured when processing [")+fullpath+tr("] [Unable to get resolution.]"));
- Res_map.clear();
- return Res_map;
- }
- //========= 计算新的高度宽度 ==================
- int Height_new = ScaleRatio_double * original_height;
- int width_new = ScaleRatio_double * original_width;
- if(isVideo == true)
- {
- if(Height_new%2!=0)Height_new++;
- if(width_new%2!=0)width_new++;
- }
- Res_map["Height_new"] = QString::number(Height_new,10);
- Res_map["width_new"] = QString::number(width_new,10);
- //=====================分别计算高和宽的放大倍数=======================
- //==== 高 ======
- int ScaleRatio_height;
- double ScaleRatio_height_double = (double)Height_new/(double)original_height;
- if((ScaleRatio_height_double-(int)ScaleRatio_height_double)>0)
- {
- ScaleRatio_height = (int)(ScaleRatio_height_double)+1;
- }
- else
- {
- ScaleRatio_height = (int)(ScaleRatio_height_double);
- }
- //==== 宽 ======
- int ScaleRatio_width;
- double ScaleRatio_width_double = (double)width_new/(double)original_width;
- if((ScaleRatio_width_double-(int)ScaleRatio_width_double)>0)
- {
- ScaleRatio_width = (int)(ScaleRatio_width_double)+1;
- }
- else
- {
- ScaleRatio_width = (int)(ScaleRatio_width_double);
- }
- //========================比较决定取哪个放大倍数值返回=====================
- if((ScaleRatio_height<=1)&&(ScaleRatio_width<=1))
- {
- Res_map["ScaleRatio"] = QString::number(1,10);
- return Res_map;
- }
- if(ScaleRatio_height>=ScaleRatio_width)
- {
- Res_map["ScaleRatio"] = QString::number(ScaleRatio_height,10);
- return Res_map;
- }
- else
- {
- Res_map["ScaleRatio"] = QString::number(ScaleRatio_width,10);
- return Res_map;
- }
-}
+/*
+ Copyright (C) 2021 Aaron Feng
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published
+ by the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see .
+
+ My Github homepage: https://github.com/AaronFeng753
+*/
+
+#include "mainwindow.h"
+#include "ui_mainwindow.h"
+/*
+Apply自定义分辨率
+*/
+int MainWindow::CustRes_SetCustRes()
+{
+ int CustRes_height_spinBoxIntValue = ui->spinBox_CustRes_height->value();
+ int CustRes_width_spinBoxIntValue = ui->spinBox_CustRes_width->value();
+ QString CustRes_height_qStr = QString::number(CustRes_height_spinBoxIntValue,10);
+ QString CustRes_width_qStr = QString::number(CustRes_width_spinBoxIntValue,10);
+ //========
+ if(ui->checkBox_custres_isAll->isChecked()&&EnableApply2All_CustRes)
+ {
+ int row_count_image = Table_image_get_rowNum();
+ int row_count_gif = Table_gif_get_rowNum();
+ int row_count_video = Table_video_get_rowNum();
+ //====
+ if((row_count_image+row_count_gif+row_count_video)==0)
+ {
+ QMessageBox *CustRes_NoItem = new QMessageBox();
+ CustRes_NoItem->setWindowTitle(tr("Error"));
+ CustRes_NoItem->setText(tr("No items are in the list."));
+ CustRes_NoItem->setIcon(QMessageBox::Warning);
+ CustRes_NoItem->setModal(true);
+ CustRes_NoItem->show();
+ return 0;
+ }
+ //====
+ for(int i=0; i res_map;
+ //读取文件信息
+ QString SourceFile_fullPath = Table_model_image->item(i,2)->text();
+ CustRes_remove(SourceFile_fullPath);//移除原来的设定,防止重复
+ res_map["fullpath"] = SourceFile_fullPath;
+ res_map["height"] = CustRes_height_qStr;
+ res_map["width"] = CustRes_width_qStr;
+ Custom_resolution_list.append(res_map);
+ Table_image_CustRes_rowNumInt_HeightQString_WidthQString(i,res_map["height"],res_map["width"]);
+ }
+ //=====
+ for(int i=0; i res_map;
+ //读取文件信息
+ QString SourceFile_fullPath = Table_model_gif->item(i,2)->text();
+ CustRes_remove(SourceFile_fullPath);//移除原来的设定,防止重复
+ res_map["fullpath"] = SourceFile_fullPath;
+ res_map["height"] = CustRes_height_qStr;
+ res_map["width"] = CustRes_width_qStr;
+ Custom_resolution_list.append(res_map);
+ Table_gif_CustRes_rowNumInt_HeightQString_WidthQString(i,res_map["height"],res_map["width"]);
+ }
+ //========
+ if(row_count_video==0)//如果列表里没视频,直接return
+ {
+ return 0;
+ }
+ //读取自定义分辨率设定
+ int CustRes_width_video=CustRes_width_spinBoxIntValue;
+ int CustRes_height_video=CustRes_height_spinBoxIntValue;
+ //判断自定义分辨率是否包含奇数
+ if(CustRes_height_spinBoxIntValue%2!=0||CustRes_width_spinBoxIntValue%2!=0)
+ {
+ QMessageBox *MSG = new QMessageBox();
+ MSG->setWindowTitle(tr("Warning"));
+ MSG->setText(tr("When setting a custom resolution for a video, neither the height value nor the width value can be odd.\n\nTherefore, the custom resolution for video has been automatically corrected by this software."));
+ MSG->setIcon(QMessageBox::Warning);
+ MSG->setModal(false);
+ MSG->show();
+ //自动校正分辨率
+ if(CustRes_height_video%2!=0)CustRes_height_video++;
+ if(CustRes_width_video%2!=0)CustRes_width_video++;
+ }
+ QString CustRes_height_video_qStr = QString::number(CustRes_height_video,10);
+ QString CustRes_width_video_qStr = QString::number(CustRes_width_video,10);
+ //开始apply自定义分辨率设定
+ for(int i=0; i res_map;
+ //读取文件信息
+ QString SourceFile_fullPath = Table_model_video->item(i,2)->text();
+ CustRes_remove(SourceFile_fullPath);//移除原来的设定,防止重复
+ res_map["fullpath"] = SourceFile_fullPath;
+ res_map["height"] = CustRes_height_video_qStr;
+ res_map["width"] = CustRes_width_video_qStr;
+ Custom_resolution_list.append(res_map);
+ Table_video_CustRes_rowNumInt_HeightQString_WidthQString(i,res_map["height"],res_map["width"]);
+ }
+ return 0;
+ }
+ //如果没有选中任何row,则直接return
+ if(curRow_image==-1&&curRow_video==-1&&curRow_gif==-1)
+ {
+ QMessageBox *CustRes_NoItem = new QMessageBox();
+ CustRes_NoItem->setWindowTitle(tr("Error"));
+ CustRes_NoItem->setText(tr("No items are currently selected."));
+ CustRes_NoItem->setIcon(QMessageBox::Warning);
+ CustRes_NoItem->setModal(true);
+ CustRes_NoItem->show();
+ return 0;
+ }
+ if(curRow_image >= 0)//如果已选中图片
+ {
+ QMap res_map;
+ //读取文件信息
+ QString SourceFile_fullPath = Table_model_image->item(curRow_image,2)->text();
+ CustRes_remove(SourceFile_fullPath);//移除原来的设定,防止重复
+ res_map["fullpath"] = SourceFile_fullPath;
+ res_map["height"] = CustRes_height_qStr;
+ res_map["width"] = CustRes_width_qStr;
+ Custom_resolution_list.append(res_map);
+ Table_image_CustRes_rowNumInt_HeightQString_WidthQString(curRow_image,res_map["height"],res_map["width"]);
+ return 0;
+ }
+ if(curRow_gif >= 0)
+ {
+ QMap res_map;
+ //读取文件信息
+ QString SourceFile_fullPath = Table_model_gif->item(curRow_gif,2)->text();
+ CustRes_remove(SourceFile_fullPath);//移除原来的设定,防止重复
+ res_map["fullpath"] = SourceFile_fullPath;
+ res_map["height"] = CustRes_height_qStr;
+ res_map["width"] = CustRes_width_qStr;
+ Custom_resolution_list.append(res_map);
+ Table_gif_CustRes_rowNumInt_HeightQString_WidthQString(curRow_gif,res_map["height"],res_map["width"]);
+ return 0;
+ }
+ if(curRow_video >= 0)
+ {
+ //读取自定义分辨率设定
+ int CustRes_width_video=CustRes_width_spinBoxIntValue;
+ int CustRes_height_video=CustRes_height_spinBoxIntValue;
+ //判断自定义分辨率是否包含奇数
+ if(CustRes_height_spinBoxIntValue%2!=0||CustRes_width_spinBoxIntValue%2!=0)
+ {
+ QMessageBox *MSG = new QMessageBox();
+ MSG->setWindowTitle(tr("Warning"));
+ MSG->setText(tr("When setting a custom resolution for a video, neither the height value nor the width value can be odd.\n\nTherefore, the custom resolution for video has been automatically corrected by this software."));
+ MSG->setIcon(QMessageBox::Warning);
+ MSG->setModal(false);
+ MSG->show();
+ //自动校正分辨率
+ if(CustRes_height_video%2!=0)CustRes_height_video++;
+ if(CustRes_width_video%2!=0)CustRes_width_video++;
+ }
+ //====
+ QMap res_map;
+ //读取文件信息
+ QString SourceFile_fullPath = Table_model_video->item(curRow_video,2)->text();
+ CustRes_remove(SourceFile_fullPath);//移除原来的设定,防止重复
+ res_map["fullpath"] = SourceFile_fullPath;
+ res_map["height"] = QString::number(CustRes_height_video,10);
+ res_map["width"] = QString::number(CustRes_width_video,10);
+ Custom_resolution_list.append(res_map);
+ Table_video_CustRes_rowNumInt_HeightQString_WidthQString(curRow_video,res_map["height"],res_map["width"]);
+ return 0;
+ }
+ return 0;
+}
+/*
+取消 自定义分辨率设定
+*/
+int MainWindow::CustRes_CancelCustRes()
+{
+ if(ui->checkBox_custres_isAll->isChecked()&&EnableApply2All_CustRes)
+ {
+ int row_count_image = Table_image_get_rowNum();
+ int row_count_gif = Table_gif_get_rowNum();
+ int row_count_video = Table_video_get_rowNum();
+ if((row_count_image+row_count_gif+row_count_video)==0)
+ {
+ QMessageBox *CustRes_NoItem = new QMessageBox();
+ CustRes_NoItem->setWindowTitle(tr("Error"));
+ CustRes_NoItem->setText(tr("No items are in the list."));
+ CustRes_NoItem->setIcon(QMessageBox::Warning);
+ CustRes_NoItem->setModal(true);
+ CustRes_NoItem->show();
+ return 0;
+ }
+ //====
+ for(int i=0; iitem(i,2)->text());//从自定义分辨率列表移除
+ Table_image_CustRes_Cancel_rowNumInt(i);//清空指定row的自定义分辨率
+ }
+ for(int i=0; iitem(i,2)->text());//从自定义分辨率列表移除
+ Table_gif_CustRes_Cancel_rowNumInt(i);//清空指定row的自定义分辨率
+ }
+ for(int i=0; iitem(i,2)->text());//从自定义分辨率列表移除
+ Table_video_CustRes_Cancel_rowNumInt(i);//清空指定row的自定义分辨率
+ }
+ return 0;
+ }
+ //如果没有任何选中的,则弹窗后return
+ if(curRow_image==-1&&curRow_video==-1&&curRow_gif==-1)
+ {
+ QMessageBox *MSG = new QMessageBox();
+ MSG->setWindowTitle(tr("Error"));
+ MSG->setText(tr("No items are currently selected."));
+ MSG->setIcon(QMessageBox::Warning);
+ MSG->setModal(true);
+ MSG->show();
+ return 0;
+ }
+ if(curRow_image >= 0)//如果已选中图片
+ {
+ QString SourceFile_fullPath = Table_model_image->item(curRow_image,2)->text();
+ CustRes_remove(SourceFile_fullPath);//从自定义分辨率列表移除
+ Table_image_CustRes_Cancel_rowNumInt(curRow_image);//清空指定row的自定义分辨率
+ return 0;
+ }
+ if(curRow_gif >= 0)
+ {
+ QString SourceFile_fullPath = Table_model_gif->item(curRow_gif,2)->text();
+ CustRes_remove(SourceFile_fullPath);//从自定义分辨率列表移除
+ Table_gif_CustRes_Cancel_rowNumInt(curRow_gif);//清空指定row的自定义分辨率
+ return 0;
+ }
+ if(curRow_video >= 0)
+ {
+ QString SourceFile_fullPath = Table_model_video->item(curRow_video,2)->text();
+ CustRes_remove(SourceFile_fullPath);//从自定义分辨率列表移除
+ Table_video_CustRes_Cancel_rowNumInt(curRow_video);//清空指定row的自定义分辨率
+ return 0;
+ }
+ return 0;
+}
+
+void MainWindow::CustRes_remove(QString fullpath)
+{
+ for(int i=0; i map_res = Custom_resolution_list.at(i);
+ if(map_res["fullpath"]==fullpath)
+ {
+ Custom_resolution_list.removeAll(map_res);
+ }
+ }
+}
+
+bool MainWindow::CustRes_isContained(QString fullpath)
+{
+ for(int i=0; i map_res = Custom_resolution_list.at(i);
+ if(map_res["fullpath"]==fullpath)
+ {
+ return true;
+ }
+ }
+ return false;
+}
+
+QMap MainWindow::CustRes_getResMap(QString fullpath)
+{
+ for(int i=0; i map_res = Custom_resolution_list.at(i);
+ if(map_res["fullpath"]==fullpath)
+ {
+ return map_res;
+ }
+ }
+ QMap empty;
+ empty.clear();
+ return empty;
+}
+
+int MainWindow::CustRes_CalNewScaleRatio(QString fullpath,int Height_new,int width_new)
+{
+ QImage qimage_original;
+ qimage_original.load(fullpath);
+ int original_height = 0;
+ int original_width = 0;
+ //===================== 判断文件类型,获取分辨率 =============================
+ //判断是否为图片或gif
+ QFileInfo fileinfo(fullpath);
+ QString file_ext_lower = fileinfo.suffix();
+ QString Ext_image_str = ui->Ext_image->text();
+ QStringList nameFilters_image = Ext_image_str.split(":");
+ if (nameFilters_image.contains(file_ext_lower) || file_ext_lower=="gif" || file_ext_lower=="apng")
+ {
+ //是图片或动态图
+ QMap res_map = Image_Gif_Read_Resolution(fullpath);
+ original_height = res_map["height"];
+ original_width = res_map["width"];
+ }
+ else//不是图片&动态图就是视频了
+ {
+ QMap res_map = video_get_Resolution(fullpath);
+ original_height = res_map["height"];
+ original_width = res_map["width"];
+ }
+ //获取失败
+ if(original_height<=0||original_width<=0)
+ {
+ emit Send_TextBrowser_NewMessage(tr("Error occured when processing [")+fullpath+tr("] [Unable to get resolution.]"));
+ return 0;
+ }
+ //=====================分别计算高和宽的放大倍数=======================
+ //==== 高 ======
+ int ScaleRatio_height;
+ double ScaleRatio_height_double = (double)Height_new/(double)original_height;
+ if((ScaleRatio_height_double-(int)ScaleRatio_height_double)>0)
+ {
+ ScaleRatio_height = (int)(ScaleRatio_height_double)+1;
+ }
+ else
+ {
+ ScaleRatio_height = (int)(ScaleRatio_height_double);
+ }
+ //==== 宽 ======
+ int ScaleRatio_width;
+ double ScaleRatio_width_double = (double)width_new/(double)original_width;
+ if((ScaleRatio_width_double-(int)ScaleRatio_width_double)>0)
+ {
+ ScaleRatio_width = (int)(ScaleRatio_width_double)+1;
+ }
+ else
+ {
+ ScaleRatio_width = (int)(ScaleRatio_width_double);
+ }
+ //========================比较决定取哪个放大倍数值返回=====================
+ if((ScaleRatio_height<=1)&&(ScaleRatio_width<=1))
+ {
+ return 1;
+ }
+ if(ScaleRatio_height>=ScaleRatio_width)
+ {
+ return ScaleRatio_height;
+ }
+ else
+ {
+ return ScaleRatio_width;
+ }
+}
+
+QMap MainWindow::DoubleScaleRatio_Cal_NewScaleRatio_NewHW(QString fullpath,double ScaleRatio_double)
+{
+ QMap Res_map;
+ //===========
+ QImage qimage_original;
+ qimage_original.load(fullpath);
+ int original_height = 0;
+ int original_width = 0;
+ //===================== 判断文件类型,获取分辨率 =============================
+ bool isVideo=false;
+ //判断是否为图片或gif
+ QFileInfo fileinfo(fullpath);
+ QString file_ext_lower = fileinfo.suffix();
+ QString Ext_image_str = ui->Ext_image->text();
+ QStringList nameFilters_image = Ext_image_str.split(":");
+ if (nameFilters_image.contains(file_ext_lower) || file_ext_lower=="gif" || file_ext_lower=="apng")
+ {
+ //是图片或动态图
+ QMap res_map = Image_Gif_Read_Resolution(fullpath);
+ original_height = res_map["height"];
+ original_width = res_map["width"];
+ }
+ else//不是图片&动态图就是视频了
+ {
+ isVideo=true;
+ QMap res_map = video_get_Resolution(fullpath);
+ original_height = res_map["height"];
+ original_width = res_map["width"];
+ }
+ //获取失败
+ if(original_height<=0||original_width<=0)
+ {
+ emit Send_TextBrowser_NewMessage(tr("Error occured when processing [")+fullpath+tr("] [Unable to get resolution.]"));
+ Res_map.clear();
+ return Res_map;
+ }
+ //========= 计算新的高度宽度 ==================
+ int Height_new = ScaleRatio_double * original_height;
+ int width_new = ScaleRatio_double * original_width;
+ if(isVideo == true)
+ {
+ if(Height_new%2!=0)Height_new++;
+ if(width_new%2!=0)width_new++;
+ }
+ Res_map["Height_new"] = QString::number(Height_new,10);
+ Res_map["width_new"] = QString::number(width_new,10);
+ //=====================分别计算高和宽的放大倍数=======================
+ //==== 高 ======
+ int ScaleRatio_height;
+ double ScaleRatio_height_double = (double)Height_new/(double)original_height;
+ if((ScaleRatio_height_double-(int)ScaleRatio_height_double)>0)
+ {
+ ScaleRatio_height = (int)(ScaleRatio_height_double)+1;
+ }
+ else
+ {
+ ScaleRatio_height = (int)(ScaleRatio_height_double);
+ }
+ //==== 宽 ======
+ int ScaleRatio_width;
+ double ScaleRatio_width_double = (double)width_new/(double)original_width;
+ if((ScaleRatio_width_double-(int)ScaleRatio_width_double)>0)
+ {
+ ScaleRatio_width = (int)(ScaleRatio_width_double)+1;
+ }
+ else
+ {
+ ScaleRatio_width = (int)(ScaleRatio_width_double);
+ }
+ //========================比较决定取哪个放大倍数值返回=====================
+ if((ScaleRatio_height<=1)&&(ScaleRatio_width<=1))
+ {
+ Res_map["ScaleRatio"] = QString::number(1,10);
+ return Res_map;
+ }
+ if(ScaleRatio_height>=ScaleRatio_width)
+ {
+ Res_map["ScaleRatio"] = QString::number(ScaleRatio_height,10);
+ return Res_map;
+ }
+ else
+ {
+ Res_map["ScaleRatio"] = QString::number(ScaleRatio_width,10);
+ return Res_map;
+ }
+}
diff --git a/SRC/Waifu2x-Extension-QT/Donate.cpp b/SRC_v3.41.01-beta/Waifu2x-Extension-QT/Donate.cpp
similarity index 100%
rename from SRC/Waifu2x-Extension-QT/Donate.cpp
rename to SRC_v3.41.01-beta/Waifu2x-Extension-QT/Donate.cpp
diff --git a/SRC/Waifu2x-Extension-QT/Finish_Action.cpp b/SRC_v3.41.01-beta/Waifu2x-Extension-QT/Finish_Action.cpp
similarity index 100%
rename from SRC/Waifu2x-Extension-QT/Finish_Action.cpp
rename to SRC_v3.41.01-beta/Waifu2x-Extension-QT/Finish_Action.cpp
diff --git a/SRC/Waifu2x-Extension-QT/Frame_Interpolation.cpp b/SRC_v3.41.01-beta/Waifu2x-Extension-QT/Frame_Interpolation.cpp
similarity index 100%
rename from SRC/Waifu2x-Extension-QT/Frame_Interpolation.cpp
rename to SRC_v3.41.01-beta/Waifu2x-Extension-QT/Frame_Interpolation.cpp
diff --git a/SRC/Waifu2x-Extension-QT/OtherPic.qrc b/SRC_v3.41.01-beta/Waifu2x-Extension-QT/OtherPic.qrc
similarity index 96%
rename from SRC/Waifu2x-Extension-QT/OtherPic.qrc
rename to SRC_v3.41.01-beta/Waifu2x-Extension-QT/OtherPic.qrc
index 45f8a05..7b2cf92 100644
--- a/SRC/Waifu2x-Extension-QT/OtherPic.qrc
+++ b/SRC_v3.41.01-beta/Waifu2x-Extension-QT/OtherPic.qrc
@@ -1,5 +1,5 @@
-
-
- OtherPic/AspectRatioStrategy.jpg
-
-
+
+
+ OtherPic/AspectRatioStrategy.jpg
+
+
diff --git a/SRC/Waifu2x-Extension-QT/OtherPic/AspectRatioStrategy.jpg b/SRC_v3.41.01-beta/Waifu2x-Extension-QT/OtherPic/AspectRatioStrategy.jpg
similarity index 100%
rename from SRC/Waifu2x-Extension-QT/OtherPic/AspectRatioStrategy.jpg
rename to SRC_v3.41.01-beta/Waifu2x-Extension-QT/OtherPic/AspectRatioStrategy.jpg
diff --git a/SRC/Waifu2x-Extension-QT/Right-click_Menu.cpp b/SRC_v3.41.01-beta/Waifu2x-Extension-QT/Right-click_Menu.cpp
similarity index 100%
rename from SRC/Waifu2x-Extension-QT/Right-click_Menu.cpp
rename to SRC_v3.41.01-beta/Waifu2x-Extension-QT/Right-click_Menu.cpp
diff --git a/SRC/Waifu2x-Extension-QT/SyncToy_3d7bd0e1-f8ab-4ddc-a52a-15db18477d2f.dat b/SRC_v3.41.01-beta/Waifu2x-Extension-QT/SyncToy_3d7bd0e1-f8ab-4ddc-a52a-15db18477d2f.dat
similarity index 100%
rename from SRC/Waifu2x-Extension-QT/SyncToy_3d7bd0e1-f8ab-4ddc-a52a-15db18477d2f.dat
rename to SRC_v3.41.01-beta/Waifu2x-Extension-QT/SyncToy_3d7bd0e1-f8ab-4ddc-a52a-15db18477d2f.dat
diff --git a/SRC/Waifu2x-Extension-QT/SystemTrayIcon.cpp b/SRC_v3.41.01-beta/Waifu2x-Extension-QT/SystemTrayIcon.cpp
similarity index 100%
rename from SRC/Waifu2x-Extension-QT/SystemTrayIcon.cpp
rename to SRC_v3.41.01-beta/Waifu2x-Extension-QT/SystemTrayIcon.cpp
diff --git a/SRC/Waifu2x-Extension-QT/Waifu2x-Extension-QT.pro b/SRC_v3.41.01-beta/Waifu2x-Extension-QT/Waifu2x-Extension-QT.pro
similarity index 96%
rename from SRC/Waifu2x-Extension-QT/Waifu2x-Extension-QT.pro
rename to SRC_v3.41.01-beta/Waifu2x-Extension-QT/Waifu2x-Extension-QT.pro
index 13017bc..044193e 100644
--- a/SRC/Waifu2x-Extension-QT/Waifu2x-Extension-QT.pro
+++ b/SRC_v3.41.01-beta/Waifu2x-Extension-QT/Waifu2x-Extension-QT.pro
@@ -1,93 +1,93 @@
-# Copyright (C) 2021 Aaron Feng
-
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as
-# published by the Free Software Foundation, either version 3 of the
-# License, or (at your option) any later version.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Affero General Public License for more details.
-
-# You should have received a copy of the GNU Affero General Public License
-# along with this program. If not, see .
-
-# My Github homepage: https://github.com/AaronFeng753
-
-QT += core gui
-QT += concurrent
-QT += multimedia
-
-greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
-
-CONFIG += c++11
-
-# The following define makes your compiler emit warnings if you use
-# any Qt feature that has been marked deprecated (the exact warnings
-# depend on your compiler). Please consult the documentation of the
-# deprecated API in order to know how to port your code away from it.
-DEFINES += QT_DEPRECATED_WARNINGS
-
-# You can also make your code fail to compile if it uses deprecated APIs.
-# In order to do so, uncomment the following line.
-# You can also select to disable deprecated APIs only up to a certain version of Qt.
-#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
-
-SOURCES += \
- AnimatedPNG.cpp \
- Anime4K.cpp \
- CompatibilityTest.cpp \
- Current_File_Progress.cpp \
- CustomResolution.cpp \
- Donate.cpp \
- Finish_Action.cpp \
- Frame_Interpolation.cpp \
- Right-click_Menu.cpp \
- SystemTrayIcon.cpp \
- Web_Activities.cpp \
- checkupdate.cpp \
- files.cpp \
- gif.cpp \
- image.cpp \
- main.cpp \
- mainwindow.cpp \
- progressBar.cpp \
- realsr_ncnn_vulkan.cpp \
- settings.cpp \
- srmd-cuda.cpp \
- srmd_ncnn_vulkan.cpp \
- table.cpp \
- textBrowser.cpp \
- topsupporterslist.cpp \
- video.cpp \
- waifu2x.cpp \
- waifu2x_caffe.cpp \
- waifu2x_converter.cpp \
- waifu2x_ncnn_vulkan.cpp
-
-HEADERS += \
- mainwindow.h \
- topsupporterslist.h
-
-FORMS += \
- mainwindow.ui \
- topsupporterslist.ui
-
-TRANSLATIONS += language_English.ts \
- language_Chinese.ts \
- language_TraditionalChinese.ts
-
-TARGET = Waifu2x-Extension-GUI
-
-# Default rules for deployment.
-qnx: target.path = /tmp/$${TARGET}/bin
-else: unix:!android: target.path = /opt/$${TARGET}/bin
-!isEmpty(target.path): INSTALLS += target
-
-RESOURCES += \
- OtherPic.qrc \
- donate.qrc \
- icon.qrc
-
-RC_ICONS =icon/icon.ico
+# Copyright (C) 2021 Aaron Feng
+
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see .
+
+# My Github homepage: https://github.com/AaronFeng753
+
+QT += core gui
+QT += concurrent
+QT += multimedia
+
+greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
+
+CONFIG += c++11
+
+# The following define makes your compiler emit warnings if you use
+# any Qt feature that has been marked deprecated (the exact warnings
+# depend on your compiler). Please consult the documentation of the
+# deprecated API in order to know how to port your code away from it.
+DEFINES += QT_DEPRECATED_WARNINGS
+
+# You can also make your code fail to compile if it uses deprecated APIs.
+# In order to do so, uncomment the following line.
+# You can also select to disable deprecated APIs only up to a certain version of Qt.
+#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
+
+SOURCES += \
+ AnimatedPNG.cpp \
+ Anime4K.cpp \
+ CompatibilityTest.cpp \
+ Current_File_Progress.cpp \
+ CustomResolution.cpp \
+ Donate.cpp \
+ Finish_Action.cpp \
+ Frame_Interpolation.cpp \
+ Right-click_Menu.cpp \
+ SystemTrayIcon.cpp \
+ Web_Activities.cpp \
+ checkupdate.cpp \
+ files.cpp \
+ gif.cpp \
+ image.cpp \
+ main.cpp \
+ mainwindow.cpp \
+ progressBar.cpp \
+ realsr_ncnn_vulkan.cpp \
+ settings.cpp \
+ srmd-cuda.cpp \
+ srmd_ncnn_vulkan.cpp \
+ table.cpp \
+ textBrowser.cpp \
+ topsupporterslist.cpp \
+ video.cpp \
+ waifu2x.cpp \
+ waifu2x_caffe.cpp \
+ waifu2x_converter.cpp \
+ waifu2x_ncnn_vulkan.cpp
+
+HEADERS += \
+ mainwindow.h \
+ topsupporterslist.h
+
+FORMS += \
+ mainwindow.ui \
+ topsupporterslist.ui
+
+TRANSLATIONS += language_English.ts \
+ language_Chinese.ts \
+ language_TraditionalChinese.ts
+
+TARGET = Waifu2x-Extension-GUI
+
+# Default rules for deployment.
+qnx: target.path = /tmp/$${TARGET}/bin
+else: unix:!android: target.path = /opt/$${TARGET}/bin
+!isEmpty(target.path): INSTALLS += target
+
+RESOURCES += \
+ OtherPic.qrc \
+ donate.qrc \
+ icon.qrc
+
+RC_ICONS =icon/icon.ico
diff --git a/SRC/Waifu2x-Extension-QT/Waifu2x-Extension-QT.pro.user b/SRC_v3.41.01-beta/Waifu2x-Extension-QT/Waifu2x-Extension-QT.pro.user
similarity index 98%
rename from SRC/Waifu2x-Extension-QT/Waifu2x-Extension-QT.pro.user
rename to SRC_v3.41.01-beta/Waifu2x-Extension-QT/Waifu2x-Extension-QT.pro.user
index f9ce5bc..d353a3f 100644
--- a/SRC/Waifu2x-Extension-QT/Waifu2x-Extension-QT.pro.user
+++ b/SRC_v3.41.01-beta/Waifu2x-Extension-QT/Waifu2x-Extension-QT.pro.user
@@ -1,346 +1,346 @@
-
-
-
-
-
- EnvironmentId
- {8ba12143-2f96-4a62-9cc5-70a8911b1041}
-
-
- ProjectExplorer.Project.ActiveTarget
- 0
-
-
- ProjectExplorer.Project.EditorSettings
-
- true
- false
- true
-
- Cpp
-
- CppGlobal
-
-
-
- QmlJS
-
- QmlJSGlobal
-
-
- 2
- UTF-8
- false
- 4
- false
- 80
- true
- true
- 1
- true
- false
- 0
- true
- true
- 0
- 8
- true
- 0
- true
- true
- true
- false
-
-
-
- ProjectExplorer.Project.PluginSettings
-
-
- -fno-delayed-template-parsing
-
- false
- {a5ca5d65-944d-44d0-9f07-5c2f9679e35a}
- false
-
- true
-
- 0
-
-
-
- true
-
- true
-
-
-
- true
-
-
-
- ProjectExplorer.Project.Target.0
-
- Desktop Qt 5.15.0 MinGW 64-bit
- Desktop Qt 5.15.0 MinGW 64-bit
- qt.qt5.5150.win64_mingw81_kit
- 1
- 0
- 0
-
- true
- 0
- D:\workspace\Waifu2x-Extension-QT\build-Waifu2x-Extension-QT-Desktop_Qt_5_15_0_MinGW_64_bit-Debug
- D:/workspace/Waifu2x-Extension-QT/build-Waifu2x-Extension-QT-Desktop_Qt_5_15_0_MinGW_64_bit-Debug
-
-
- true
- QtProjectManager.QMakeBuildStep
-
- false
-
-
-
- true
- Qt4ProjectManager.MakeStep
-
- false
-
-
- false
-
- 2
- Build
- Build
- ProjectExplorer.BuildSteps.Build
-
-
-
- true
- Qt4ProjectManager.MakeStep
-
- true
- clean
-
- false
-
- 1
- Clean
- Clean
- ProjectExplorer.BuildSteps.Clean
-
- 2
- false
-
- Debug
- Qt4ProjectManager.Qt4BuildConfiguration
- 2
- 2
- 2
-
-
- true
- 2
- D:\workspace\Waifu2x-Extension-QT\build-Waifu2x-Extension-QT-Desktop_Qt_5_15_0_MinGW_64_bit-Release
- D:/workspace/Waifu2x-Extension-QT/build-Waifu2x-Extension-QT-Desktop_Qt_5_15_0_MinGW_64_bit-Release
-
-
- true
- QtProjectManager.QMakeBuildStep
-
- false
-
-
-
- true
- Qt4ProjectManager.MakeStep
-
- false
-
-
- false
-
- 2
- Build
- Build
- ProjectExplorer.BuildSteps.Build
-
-
-
- true
- Qt4ProjectManager.MakeStep
-
- true
- clean
-
- false
-
- 1
- Clean
- Clean
- ProjectExplorer.BuildSteps.Clean
-
- 2
- false
-
- Release
- Qt4ProjectManager.Qt4BuildConfiguration
- 0
- 0
- 2
-
-
- true
- 0
- D:\workspace\Waifu2x-Extension-QT\build-Waifu2x-Extension-QT-Desktop_Qt_5_15_0_MinGW_64_bit-Profile
- D:/workspace/Waifu2x-Extension-QT/build-Waifu2x-Extension-QT-Desktop_Qt_5_15_0_MinGW_64_bit-Profile
-
-
- true
- QtProjectManager.QMakeBuildStep
-
- false
-
-
-
- true
- Qt4ProjectManager.MakeStep
-
- false
-
-
- false
-
- 2
- Build
- Build
- ProjectExplorer.BuildSteps.Build
-
-
-
- true
- Qt4ProjectManager.MakeStep
-
- true
- clean
-
- false
-
- 1
- Clean
- Clean
- ProjectExplorer.BuildSteps.Clean
-
- 2
- false
-
- Profile
- Qt4ProjectManager.Qt4BuildConfiguration
- 0
- 0
- 0
-
- 3
-
-
- 0
- Deploy
- Deploy
- ProjectExplorer.BuildSteps.Deploy
-
- 1
-
- false
- ProjectExplorer.DefaultDeployConfiguration
-
- 1
-
-
- dwarf
-
- cpu-cycles
-
-
- 250
-
- -e
- cpu-cycles
- --call-graph
- dwarf,4096
- -F
- 250
-
- -F
- true
- 4096
- false
- false
- 1000
-
- true
-
- false
- false
- false
- false
- true
- 0.01
- 10
- true
- kcachegrind
- 1
- 25
-
- 1
- true
- false
- true
- valgrind
-
- 0
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
-
- 0
-
- Qt4ProjectManager.Qt4RunConfiguration:D:/workspace/Waifu2x-Extension-QT/Waifu2x-Extension-QT/Waifu2x-Extension-QT.pro
- D:/workspace/Waifu2x-Extension-QT/Waifu2x-Extension-QT/Waifu2x-Extension-QT.pro
-
- false
-
- false
- true
- true
- false
- false
- true
-
- D:/workspace/Waifu2x-Extension-QT/build-Waifu2x-Extension-QT-Desktop_Qt_5_15_0_MinGW_64_bit-Release
-
- 1
-
-
-
- ProjectExplorer.Project.TargetCount
- 1
-
-
- ProjectExplorer.Project.Updater.FileVersion
- 22
-
-
- Version
- 22
-
-
+
+
+
+
+
+ EnvironmentId
+ {8ba12143-2f96-4a62-9cc5-70a8911b1041}
+
+
+ ProjectExplorer.Project.ActiveTarget
+ 0
+
+
+ ProjectExplorer.Project.EditorSettings
+
+ true
+ false
+ true
+
+ Cpp
+
+ CppGlobal
+
+
+
+ QmlJS
+
+ QmlJSGlobal
+
+
+ 2
+ UTF-8
+ false
+ 4
+ false
+ 80
+ true
+ true
+ 1
+ true
+ false
+ 0
+ true
+ true
+ 0
+ 8
+ true
+ 0
+ true
+ true
+ true
+ false
+
+
+
+ ProjectExplorer.Project.PluginSettings
+
+
+ -fno-delayed-template-parsing
+
+ false
+ {a5ca5d65-944d-44d0-9f07-5c2f9679e35a}
+ false
+
+ true
+
+ 0
+
+
+
+ true
+
+ true
+
+
+
+ true
+
+
+
+ ProjectExplorer.Project.Target.0
+
+ Desktop Qt 5.15.0 MinGW 64-bit
+ Desktop Qt 5.15.0 MinGW 64-bit
+ qt.qt5.5150.win64_mingw81_kit
+ 1
+ 0
+ 0
+
+ true
+ 0
+ D:\workspace\Waifu2x-Extension-QT\build-Waifu2x-Extension-QT-Desktop_Qt_5_15_0_MinGW_64_bit-Debug
+ D:/workspace/Waifu2x-Extension-QT/build-Waifu2x-Extension-QT-Desktop_Qt_5_15_0_MinGW_64_bit-Debug
+
+
+ true
+ QtProjectManager.QMakeBuildStep
+
+ false
+
+
+
+ true
+ Qt4ProjectManager.MakeStep
+
+ false
+
+
+ false
+
+ 2
+ Build
+ Build
+ ProjectExplorer.BuildSteps.Build
+
+
+
+ true
+ Qt4ProjectManager.MakeStep
+
+ true
+ clean
+
+ false
+
+ 1
+ Clean
+ Clean
+ ProjectExplorer.BuildSteps.Clean
+
+ 2
+ false
+
+ Debug
+ Qt4ProjectManager.Qt4BuildConfiguration
+ 2
+ 2
+ 2
+
+
+ true
+ 2
+ D:\workspace\Waifu2x-Extension-QT\build-Waifu2x-Extension-QT-Desktop_Qt_5_15_0_MinGW_64_bit-Release
+ D:/workspace/Waifu2x-Extension-QT/build-Waifu2x-Extension-QT-Desktop_Qt_5_15_0_MinGW_64_bit-Release
+
+
+ true
+ QtProjectManager.QMakeBuildStep
+
+ false
+
+
+
+ true
+ Qt4ProjectManager.MakeStep
+
+ false
+
+
+ false
+
+ 2
+ Build
+ Build
+ ProjectExplorer.BuildSteps.Build
+
+
+
+ true
+ Qt4ProjectManager.MakeStep
+
+ true
+ clean
+
+ false
+
+ 1
+ Clean
+ Clean
+ ProjectExplorer.BuildSteps.Clean
+
+ 2
+ false
+
+ Release
+ Qt4ProjectManager.Qt4BuildConfiguration
+ 0
+ 0
+ 2
+
+
+ true
+ 0
+ D:\workspace\Waifu2x-Extension-QT\build-Waifu2x-Extension-QT-Desktop_Qt_5_15_0_MinGW_64_bit-Profile
+ D:/workspace/Waifu2x-Extension-QT/build-Waifu2x-Extension-QT-Desktop_Qt_5_15_0_MinGW_64_bit-Profile
+
+
+ true
+ QtProjectManager.QMakeBuildStep
+
+ false
+
+
+
+ true
+ Qt4ProjectManager.MakeStep
+
+ false
+
+
+ false
+
+ 2
+ Build
+ Build
+ ProjectExplorer.BuildSteps.Build
+
+
+
+ true
+ Qt4ProjectManager.MakeStep
+
+ true
+ clean
+
+ false
+
+ 1
+ Clean
+ Clean
+ ProjectExplorer.BuildSteps.Clean
+
+ 2
+ false
+
+ Profile
+ Qt4ProjectManager.Qt4BuildConfiguration
+ 0
+ 0
+ 0
+
+ 3
+
+
+ 0
+ Deploy
+ Deploy
+ ProjectExplorer.BuildSteps.Deploy
+
+ 1
+
+ false
+ ProjectExplorer.DefaultDeployConfiguration
+
+ 1
+
+
+ dwarf
+
+ cpu-cycles
+
+
+ 250
+
+ -e
+ cpu-cycles
+ --call-graph
+ dwarf,4096
+ -F
+ 250
+
+ -F
+ true
+ 4096
+ false
+ false
+ 1000
+
+ true
+
+ false
+ false
+ false
+ false
+ true
+ 0.01
+ 10
+ true
+ kcachegrind
+ 1
+ 25
+
+ 1
+ true
+ false
+ true
+ valgrind
+
+ 0
+ 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+ 10
+ 11
+ 12
+ 13
+ 14
+
+ 0
+
+ Qt4ProjectManager.Qt4RunConfiguration:D:/workspace/Waifu2x-Extension-QT/Waifu2x-Extension-QT/Waifu2x-Extension-QT.pro
+ D:/workspace/Waifu2x-Extension-QT/Waifu2x-Extension-QT/Waifu2x-Extension-QT.pro
+
+ false
+
+ false
+ true
+ true
+ false
+ false
+ true
+
+ D:/workspace/Waifu2x-Extension-QT/build-Waifu2x-Extension-QT-Desktop_Qt_5_15_0_MinGW_64_bit-Release
+
+ 1
+
+
+
+ ProjectExplorer.Project.TargetCount
+ 1
+
+
+ ProjectExplorer.Project.Updater.FileVersion
+ 22
+
+
+ Version
+ 22
+
+
diff --git a/SRC/Waifu2x-Extension-QT/Waifu2x-Extension-QT.pro.user.hLgbqF b/SRC_v3.41.01-beta/Waifu2x-Extension-QT/Waifu2x-Extension-QT.pro.user.hLgbqF
similarity index 100%
rename from SRC/Waifu2x-Extension-QT/Waifu2x-Extension-QT.pro.user.hLgbqF
rename to SRC_v3.41.01-beta/Waifu2x-Extension-QT/Waifu2x-Extension-QT.pro.user.hLgbqF
diff --git a/SRC/Waifu2x-Extension-QT/Web_Activities.cpp b/SRC_v3.41.01-beta/Waifu2x-Extension-QT/Web_Activities.cpp
similarity index 100%
rename from SRC/Waifu2x-Extension-QT/Web_Activities.cpp
rename to SRC_v3.41.01-beta/Waifu2x-Extension-QT/Web_Activities.cpp
diff --git a/SRC/Waifu2x-Extension-QT/backgroundImage.qrc b/SRC_v3.41.01-beta/Waifu2x-Extension-QT/backgroundImage.qrc
similarity index 95%
rename from SRC/Waifu2x-Extension-QT/backgroundImage.qrc
rename to SRC_v3.41.01-beta/Waifu2x-Extension-QT/backgroundImage.qrc
index 3743ddd..51cb67f 100644
--- a/SRC/Waifu2x-Extension-QT/backgroundImage.qrc
+++ b/SRC_v3.41.01-beta/Waifu2x-Extension-QT/backgroundImage.qrc
@@ -1,5 +1,5 @@
-
-
- background/luke-chesser.jpg
-
-
+
+
+ background/luke-chesser.jpg
+
+
diff --git a/SRC/Waifu2x-Extension-QT/checkupdate.cpp b/SRC_v3.41.01-beta/Waifu2x-Extension-QT/checkupdate.cpp
similarity index 97%
rename from SRC/Waifu2x-Extension-QT/checkupdate.cpp
rename to SRC_v3.41.01-beta/Waifu2x-Extension-QT/checkupdate.cpp
index 768b71e..b0296dd 100644
--- a/SRC/Waifu2x-Extension-QT/checkupdate.cpp
+++ b/SRC_v3.41.01-beta/Waifu2x-Extension-QT/checkupdate.cpp
@@ -1,189 +1,189 @@
-/*
- Copyright (C) 2021 Aaron Feng
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU Affero General Public License as published
- by the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU Affero General Public License for more details.
-
- You should have received a copy of the GNU Affero General Public License
- along with this program. If not, see .
-
- My Github homepage: https://github.com/AaronFeng753
-*/
-#include "mainwindow.h"
-#include "ui_mainwindow.h"
-
-/*
-手动检查更新:直接打开release页面
-*/
-void MainWindow::on_pushButton_CheckUpdate_clicked()
-{
- if(ui->comboBox_language->currentIndex()==1)
- {
- QDesktopServices::openUrl(QUrl("https://gitee.com/aaronfeng0711/Waifu2x-Extension-GUI/releases"));
- }
- QDesktopServices::openUrl(QUrl("https://github.com/AaronFeng753/Waifu2x-Extension-GUI/releases"));
-}
-/*
-自动检查更新:
-启动软件时以单独线程运行,检测更新,如有则弹窗
-*/
-int MainWindow::CheckUpadte_Auto()
-{
- bool isGiteeBanned = ui->checkBox_BanGitee->isChecked();
- //============
- QString Latest_Ver="";
- QString Current_Ver="";
- QString Github_UpdateInfo_online = "";
- QString Gitee_UpdateInfo_online = "";
- QString UpdateType=ui->comboBox_UpdateChannel->currentText();
- switch(ui->comboBox_UpdateChannel->currentIndex())
- {
- case 0:
- Current_Ver=LastStableVer;
- Github_UpdateInfo_online = "https://raw.githubusercontent.com/AaronFeng753/Waifu2x-Extension-GUI/master/.github/Update_Info.ini";
- Gitee_UpdateInfo_online = "https://gitee.com/aaronfeng0711/Waifu2x-Extension-GUI/raw/master/.github/Update_Info.ini";
- break;
- case 1:
- Current_Ver=LastBetaVer;
- Github_UpdateInfo_online = "https://raw.githubusercontent.com/AaronFeng753/Waifu2x-Extension-GUI/master/.github/Update_Info_Beta.ini";
- Gitee_UpdateInfo_online = "https://gitee.com/aaronfeng0711/Waifu2x-Extension-GUI/raw/master/.github/Update_Info_Beta.ini";
- break;
- default:
- break;
- }
- //============================
- QString Github_UpdateInfo_local = Current_Path+"/Update_Info_Github.ini";
- QString Gitee_UpdateInfo_local = Current_Path+"/Update_Info_Gitee.ini";
- //============= 从Github下载更新信息 ==============
- emit Send_TextBrowser_NewMessage(tr("Starting to download update information(for auto-check update) from Github."));
- DownloadTo(Github_UpdateInfo_online,Github_UpdateInfo_local);
- //========= 检查github的文件是否下载成功 =================
- if(QFile::exists(Github_UpdateInfo_local))
- {
- emit Send_TextBrowser_NewMessage(tr("Successfully downloaded update information from Github."));
- //==
- QSettings *configIniRead = new QSettings(Github_UpdateInfo_local, QSettings::IniFormat);
- configIniRead->setIniCodec(QTextCodec::codecForName("UTF-8"));
- //=====
- if(configIniRead->value("/Latest_Version/Ver") == QVariant() || configIniRead->value("/Change_log/log") == QVariant())
- {
- emit Send_TextBrowser_NewMessage(tr("Unable to check for updates! Please check your network or check for updates manually."));
- QFile::remove(Github_UpdateInfo_local);
- QFile::remove(Gitee_UpdateInfo_local);
- return 0;
- }
- //=====
- Latest_Ver = configIniRead->value("/Latest_Version/Ver").toString();
- QString Change_log = configIniRead->value("/Change_log/log").toString();
- Latest_Ver = Latest_Ver.trimmed();
- if(Latest_Ver!=Current_Ver&&Latest_Ver!="")
- {
- emit Send_CheckUpadte_NewUpdate(Latest_Ver,Change_log);
- }
- else
- {
- emit Send_TextBrowser_NewMessage(tr("No update found, you are using the latest ")+UpdateType+tr(" version."));
- }
- QFile::remove(Github_UpdateInfo_local);
- QFile::remove(Gitee_UpdateInfo_local);
- return 0;
- }
- else
- {
- emit Send_TextBrowser_NewMessage(tr("Unable to download update information from Github."));
- }
- //============= 从码云下载更新信息 ==============
- if(isGiteeBanned==false)
- {
- emit Send_TextBrowser_NewMessage(tr("Starting to download update information(for auto-check update) from Gitee."));
- DownloadTo(Gitee_UpdateInfo_online,Gitee_UpdateInfo_local);
- //========= 检查gitee的文件是否下载成功 =================
- if(QFile::exists(Gitee_UpdateInfo_local))
- {
- emit Send_TextBrowser_NewMessage(tr("Successfully downloaded update information from Gitee."));
- //==
- QSettings *configIniRead = new QSettings(Gitee_UpdateInfo_local, QSettings::IniFormat);
- configIniRead->setIniCodec(QTextCodec::codecForName("UTF-8"));
- //=====
- if(configIniRead->value("/Latest_Version/Ver") == QVariant() || configIniRead->value("/Change_log/log") == QVariant())
- {
- emit Send_TextBrowser_NewMessage(tr("Unable to check for updates! Please check your network or check for updates manually."));
- QFile::remove(Github_UpdateInfo_local);
- QFile::remove(Gitee_UpdateInfo_local);
- return 0;
- }
- //=====
- Latest_Ver = configIniRead->value("/Latest_Version/Ver").toString();
- QString Change_log = configIniRead->value("/Change_log/log").toString();
- Latest_Ver = Latest_Ver.trimmed();
- if(Latest_Ver!=Current_Ver&&Latest_Ver!="")
- {
- emit Send_CheckUpadte_NewUpdate(Latest_Ver,Change_log);
- }
- else
- {
- emit Send_TextBrowser_NewMessage(tr("No update found, you are using the latest ")+UpdateType+tr(" version."));
- }
- QFile::remove(Github_UpdateInfo_local);
- QFile::remove(Gitee_UpdateInfo_local);
- return 0;
- }
- else
- {
- emit Send_TextBrowser_NewMessage(tr("Unable to download update information from Gitee."));
- }
- }
- if(Latest_Ver=="")
- {
- emit Send_TextBrowser_NewMessage(tr("Unable to check for updates! Please check your network or check for updates manually."));
- }
- QFile::remove(Github_UpdateInfo_local);
- QFile::remove(Gitee_UpdateInfo_local);
- return 0;
-}
-/*
-自动更新弹窗
-*/
-int MainWindow::CheckUpadte_NewUpdate(QString update_str,QString Change_log)
-{
- QString UpdateType=ui->comboBox_UpdateChannel->currentText();
- //======
- if(ui->checkBox_UpdatePopup->isChecked())
- {
- QMessageBox Msg(QMessageBox::Question, QString(tr("New ")+UpdateType+tr(" update available!")), QString(tr("New version: %1\n\nBrief change log:\n%2\n\nDo you wanna update now???")).arg(update_str).arg(Change_log));
- Msg.setIcon(QMessageBox::Information);
- if(ui->comboBox_language->currentIndex()==1)
- {
- QAbstractButton *pYesBtn_Github = Msg.addButton(QString("前往Github下载"), QMessageBox::YesRole);
- QAbstractButton *pYesBtn_Gitee = Msg.addButton(QString("前往码云下载"), QMessageBox::YesRole);
- Msg.addButton(QString(tr("NO")), QMessageBox::NoRole);
- Msg.exec();
- if (Msg.clickedButton() == pYesBtn_Github)QDesktopServices::openUrl(QUrl("https://github.com/AaronFeng753/Waifu2x-Extension-GUI/releases/"+update_str.trimmed()));
- if (Msg.clickedButton() == pYesBtn_Gitee)QDesktopServices::openUrl(QUrl("https://gitee.com/aaronfeng0711/Waifu2x-Extension-GUI/releases/"+update_str.trimmed()));
- return 0;
- }
- else
- {
- QAbstractButton *pYesBtn = Msg.addButton(QString(tr("YES")), QMessageBox::YesRole);
- Msg.addButton(QString(tr("NO")), QMessageBox::NoRole);
- Msg.exec();
- if (Msg.clickedButton() == pYesBtn)QDesktopServices::openUrl(QUrl("https://github.com/AaronFeng753/Waifu2x-Extension-GUI/releases/"+update_str.trimmed()));
- return 0;
- }
- }
- else
- {
- QString update_msg_str = QString(tr("New ")+UpdateType+tr(" update: %1 is available! Click [Check update] button to download the latest version!")).arg(update_str);
- emit Send_SystemTray_NewMessage(update_msg_str);
- emit Send_TextBrowser_NewMessage(update_msg_str);
- }
- return 0;
-}
-
+/*
+ Copyright (C) 2021 Aaron Feng
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published
+ by the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see .
+
+ My Github homepage: https://github.com/AaronFeng753
+*/
+#include "mainwindow.h"
+#include "ui_mainwindow.h"
+
+/*
+手动检查更新:直接打开release页面
+*/
+void MainWindow::on_pushButton_CheckUpdate_clicked()
+{
+ if(ui->comboBox_language->currentIndex()==1)
+ {
+ QDesktopServices::openUrl(QUrl("https://gitee.com/aaronfeng0711/Waifu2x-Extension-GUI/releases"));
+ }
+ QDesktopServices::openUrl(QUrl("https://github.com/AaronFeng753/Waifu2x-Extension-GUI/releases"));
+}
+/*
+自动检查更新:
+启动软件时以单独线程运行,检测更新,如有则弹窗
+*/
+int MainWindow::CheckUpadte_Auto()
+{
+ bool isGiteeBanned = ui->checkBox_BanGitee->isChecked();
+ //============
+ QString Latest_Ver="";
+ QString Current_Ver="";
+ QString Github_UpdateInfo_online = "";
+ QString Gitee_UpdateInfo_online = "";
+ QString UpdateType=ui->comboBox_UpdateChannel->currentText();
+ switch(ui->comboBox_UpdateChannel->currentIndex())
+ {
+ case 0:
+ Current_Ver=LastStableVer;
+ Github_UpdateInfo_online = "https://raw.githubusercontent.com/AaronFeng753/Waifu2x-Extension-GUI/master/.github/Update_Info.ini";
+ Gitee_UpdateInfo_online = "https://gitee.com/aaronfeng0711/Waifu2x-Extension-GUI/raw/master/.github/Update_Info.ini";
+ break;
+ case 1:
+ Current_Ver=LastBetaVer;
+ Github_UpdateInfo_online = "https://raw.githubusercontent.com/AaronFeng753/Waifu2x-Extension-GUI/master/.github/Update_Info_Beta.ini";
+ Gitee_UpdateInfo_online = "https://gitee.com/aaronfeng0711/Waifu2x-Extension-GUI/raw/master/.github/Update_Info_Beta.ini";
+ break;
+ default:
+ break;
+ }
+ //============================
+ QString Github_UpdateInfo_local = Current_Path+"/Update_Info_Github.ini";
+ QString Gitee_UpdateInfo_local = Current_Path+"/Update_Info_Gitee.ini";
+ //============= 从Github下载更新信息 ==============
+ emit Send_TextBrowser_NewMessage(tr("Starting to download update information(for auto-check update) from Github."));
+ DownloadTo(Github_UpdateInfo_online,Github_UpdateInfo_local);
+ //========= 检查github的文件是否下载成功 =================
+ if(QFile::exists(Github_UpdateInfo_local))
+ {
+ emit Send_TextBrowser_NewMessage(tr("Successfully downloaded update information from Github."));
+ //==
+ QSettings *configIniRead = new QSettings(Github_UpdateInfo_local, QSettings::IniFormat);
+ configIniRead->setIniCodec(QTextCodec::codecForName("UTF-8"));
+ //=====
+ if(configIniRead->value("/Latest_Version/Ver") == QVariant() || configIniRead->value("/Change_log/log") == QVariant())
+ {
+ emit Send_TextBrowser_NewMessage(tr("Unable to check for updates! Please check your network or check for updates manually."));
+ QFile::remove(Github_UpdateInfo_local);
+ QFile::remove(Gitee_UpdateInfo_local);
+ return 0;
+ }
+ //=====
+ Latest_Ver = configIniRead->value("/Latest_Version/Ver").toString();
+ QString Change_log = configIniRead->value("/Change_log/log").toString();
+ Latest_Ver = Latest_Ver.trimmed();
+ if(Latest_Ver!=Current_Ver&&Latest_Ver!="")
+ {
+ emit Send_CheckUpadte_NewUpdate(Latest_Ver,Change_log);
+ }
+ else
+ {
+ emit Send_TextBrowser_NewMessage(tr("No update found, you are using the latest ")+UpdateType+tr(" version."));
+ }
+ QFile::remove(Github_UpdateInfo_local);
+ QFile::remove(Gitee_UpdateInfo_local);
+ return 0;
+ }
+ else
+ {
+ emit Send_TextBrowser_NewMessage(tr("Unable to download update information from Github."));
+ }
+ //============= 从码云下载更新信息 ==============
+ if(isGiteeBanned==false)
+ {
+ emit Send_TextBrowser_NewMessage(tr("Starting to download update information(for auto-check update) from Gitee."));
+ DownloadTo(Gitee_UpdateInfo_online,Gitee_UpdateInfo_local);
+ //========= 检查gitee的文件是否下载成功 =================
+ if(QFile::exists(Gitee_UpdateInfo_local))
+ {
+ emit Send_TextBrowser_NewMessage(tr("Successfully downloaded update information from Gitee."));
+ //==
+ QSettings *configIniRead = new QSettings(Gitee_UpdateInfo_local, QSettings::IniFormat);
+ configIniRead->setIniCodec(QTextCodec::codecForName("UTF-8"));
+ //=====
+ if(configIniRead->value("/Latest_Version/Ver") == QVariant() || configIniRead->value("/Change_log/log") == QVariant())
+ {
+ emit Send_TextBrowser_NewMessage(tr("Unable to check for updates! Please check your network or check for updates manually."));
+ QFile::remove(Github_UpdateInfo_local);
+ QFile::remove(Gitee_UpdateInfo_local);
+ return 0;
+ }
+ //=====
+ Latest_Ver = configIniRead->value("/Latest_Version/Ver").toString();
+ QString Change_log = configIniRead->value("/Change_log/log").toString();
+ Latest_Ver = Latest_Ver.trimmed();
+ if(Latest_Ver!=Current_Ver&&Latest_Ver!="")
+ {
+ emit Send_CheckUpadte_NewUpdate(Latest_Ver,Change_log);
+ }
+ else
+ {
+ emit Send_TextBrowser_NewMessage(tr("No update found, you are using the latest ")+UpdateType+tr(" version."));
+ }
+ QFile::remove(Github_UpdateInfo_local);
+ QFile::remove(Gitee_UpdateInfo_local);
+ return 0;
+ }
+ else
+ {
+ emit Send_TextBrowser_NewMessage(tr("Unable to download update information from Gitee."));
+ }
+ }
+ if(Latest_Ver=="")
+ {
+ emit Send_TextBrowser_NewMessage(tr("Unable to check for updates! Please check your network or check for updates manually."));
+ }
+ QFile::remove(Github_UpdateInfo_local);
+ QFile::remove(Gitee_UpdateInfo_local);
+ return 0;
+}
+/*
+自动更新弹窗
+*/
+int MainWindow::CheckUpadte_NewUpdate(QString update_str,QString Change_log)
+{
+ QString UpdateType=ui->comboBox_UpdateChannel->currentText();
+ //======
+ if(ui->checkBox_UpdatePopup->isChecked())
+ {
+ QMessageBox Msg(QMessageBox::Question, QString(tr("New ")+UpdateType+tr(" update available!")), QString(tr("New version: %1\n\nBrief change log:\n%2\n\nDo you wanna update now???")).arg(update_str).arg(Change_log));
+ Msg.setIcon(QMessageBox::Information);
+ if(ui->comboBox_language->currentIndex()==1)
+ {
+ QAbstractButton *pYesBtn_Github = Msg.addButton(QString("前往Github下载"), QMessageBox::YesRole);
+ QAbstractButton *pYesBtn_Gitee = Msg.addButton(QString("前往码云下载"), QMessageBox::YesRole);
+ Msg.addButton(QString(tr("NO")), QMessageBox::NoRole);
+ Msg.exec();
+ if (Msg.clickedButton() == pYesBtn_Github)QDesktopServices::openUrl(QUrl("https://github.com/AaronFeng753/Waifu2x-Extension-GUI/releases/"+update_str.trimmed()));
+ if (Msg.clickedButton() == pYesBtn_Gitee)QDesktopServices::openUrl(QUrl("https://gitee.com/aaronfeng0711/Waifu2x-Extension-GUI/releases/"+update_str.trimmed()));
+ return 0;
+ }
+ else
+ {
+ QAbstractButton *pYesBtn = Msg.addButton(QString(tr("YES")), QMessageBox::YesRole);
+ Msg.addButton(QString(tr("NO")), QMessageBox::NoRole);
+ Msg.exec();
+ if (Msg.clickedButton() == pYesBtn)QDesktopServices::openUrl(QUrl("https://github.com/AaronFeng753/Waifu2x-Extension-GUI/releases/"+update_str.trimmed()));
+ return 0;
+ }
+ }
+ else
+ {
+ QString update_msg_str = QString(tr("New ")+UpdateType+tr(" update: %1 is available! Click [Check update] button to download the latest version!")).arg(update_str);
+ emit Send_SystemTray_NewMessage(update_msg_str);
+ emit Send_TextBrowser_NewMessage(update_msg_str);
+ }
+ return 0;
+}
+
diff --git a/SRC/Waifu2x-Extension-QT/donate.qrc b/SRC_v3.41.01-beta/Waifu2x-Extension-QT/donate.qrc
similarity index 95%
rename from SRC/Waifu2x-Extension-QT/donate.qrc
rename to SRC_v3.41.01-beta/Waifu2x-Extension-QT/donate.qrc
index cff499d..b1b9173 100644
--- a/SRC/Waifu2x-Extension-QT/donate.qrc
+++ b/SRC_v3.41.01-beta/Waifu2x-Extension-QT/donate.qrc
@@ -1,5 +1,5 @@
-
-
- donate/Donate_QRCode.jpg
-
-
+
+
+ donate/Donate_QRCode.jpg
+
+
diff --git a/SRC/Waifu2x-Extension-QT/donate/Donate_QRCode.jpg b/SRC_v3.41.01-beta/Waifu2x-Extension-QT/donate/Donate_QRCode.jpg
similarity index 100%
rename from SRC/Waifu2x-Extension-QT/donate/Donate_QRCode.jpg
rename to SRC_v3.41.01-beta/Waifu2x-Extension-QT/donate/Donate_QRCode.jpg
diff --git a/SRC/Waifu2x-Extension-QT/files.cpp b/SRC_v3.41.01-beta/Waifu2x-Extension-QT/files.cpp
similarity index 96%
rename from SRC/Waifu2x-Extension-QT/files.cpp
rename to SRC_v3.41.01-beta/Waifu2x-Extension-QT/files.cpp
index 46198f2..b5747cd 100644
--- a/SRC/Waifu2x-Extension-QT/files.cpp
+++ b/SRC_v3.41.01-beta/Waifu2x-Extension-QT/files.cpp
@@ -1,629 +1,629 @@
-/*
- Copyright (C) 2021 Aaron Feng
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU Affero General Public License as published
- by the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU Affero General Public License for more details.
-
- You should have received a copy of the GNU Affero General Public License
- along with this program. If not, see .
-
- My Github homepage: https://github.com/AaronFeng753
-*/
-
-#include "mainwindow.h"
-#include "ui_mainwindow.h"
-
-void MainWindow::dragEnterEvent(QDragEnterEvent *event)
-{
- //如果为文件,则支持拖放
- if (event->mimeData()->hasFormat("text/uri-list"))
- event->acceptProposedAction();
-}
-/*
-拖放文件event
-*/
-void MainWindow::dropEvent(QDropEvent *event)
-{
- //重置 是否有某种类型的新文件加入 的判断标志
- AddNew_gif=false;
- AddNew_image=false;
- AddNew_video=false;
- //================
- QList urls = event->mimeData()->urls();
- if(urls.isEmpty())
- return;
- //================== 界面管制 ========================
- ui_tableViews_setUpdatesEnabled(false);
- //================
- ui->groupBox_Setting->setEnabled(0);
- ui->groupBox_FileList->setEnabled(0);
- ui->groupBox_InputExt->setEnabled(0);
- pushButton_Start_setEnabled_self(0);
- ui->checkBox_ScanSubFolders->setEnabled(0);
- this->setAcceptDrops(0);
- ui->label_DropFile->setText(tr("Adding files, please wait."));
- emit Send_TextBrowser_NewMessage(tr("Adding files, please wait."));
- //===================================================
- QtConcurrent::run(this, &MainWindow::Read_urls, urls);
-}
-/*
-读取urls
-*/
-void MainWindow::Read_urls(QList urls)
-{
- Progressbar_MaxVal = urls.size();
- Progressbar_CurrentVal = 0;
- emit Send_PrograssBar_Range_min_max(0, Progressbar_MaxVal);
- if(ui->checkBox_ScanSubFolders->isChecked())
- {
- foreach(QUrl url, urls)
- {
- Add_File_Folder_IncludeSubFolder(url.toLocalFile());
- emit Send_progressbar_Add();
- }
- }
- else
- {
- foreach(QUrl url, urls)
- {
- Add_File_Folder(url.toLocalFile());
- emit Send_progressbar_Add();
- }
- }
- emit Send_Read_urls_finfished();
- return;
-}
-/*
-读取urls
-善后
-*/
-void MainWindow::Read_urls_finfished()
-{
- //================== 解除界面管制 ========================
- ui_tableViews_setUpdatesEnabled(true);
- //===
- ui->groupBox_Setting->setEnabled(1);
- ui->groupBox_FileList->setEnabled(1);
- pushButton_Start_setEnabled_self(1);
- ui->groupBox_InputExt->setEnabled(1);
- ui->checkBox_ScanSubFolders->setEnabled(1);
- this->setAcceptDrops(1);
- ui->label_DropFile->setText(tr("Drag and drop files or folders here\n(Image, GIF and Video)"));
- emit Send_TextBrowser_NewMessage(tr("Add file complete."));
- //===================================================
- Progressbar_MaxVal = 0;
- Progressbar_CurrentVal = 0;
- progressbar_clear();
- //======================
- //如果没有增加任何文件
- if(AddNew_gif==false&&AddNew_image==false&&AddNew_video==false)
- {
- QMessageBox *MSG = new QMessageBox();
- MSG->setWindowTitle(tr("Warning"));
- MSG->setText(tr("The file format is not supported, please enter supported file format, or add more file extensions yourself."));
- MSG->setIcon(QMessageBox::Warning);
- MSG->setModal(true);
- MSG->show();
- return;
- }
- if(AddNew_image)
- {
- ui->label_DropFile->setVisible(0);//隐藏文件投放label
- ui->tableView_image->setVisible(1);
- }
- if(AddNew_gif)
- {
- ui->label_DropFile->setVisible(0);//隐藏文件投放label
- ui->tableView_gif->setVisible(1);
- }
- if(AddNew_video)
- {
- ui->label_DropFile->setVisible(0);//隐藏文件投放label
- ui->tableView_video->setVisible(1);
- }
- //===================
- ui->tableView_gif->scrollToBottom();
- ui->tableView_image->scrollToBottom();
- ui->tableView_video->scrollToBottom();
- QScrollBar *image_ScrBar = ui->tableView_image->horizontalScrollBar();
- image_ScrBar->setValue(0);
- QScrollBar *gif_ScrBar = ui->tableView_gif->horizontalScrollBar();
- gif_ScrBar->setValue(0);
- QScrollBar *video_ScrBar = ui->tableView_video->horizontalScrollBar();
- video_ScrBar->setValue(0);
- //==========
- AddNew_image=false;
- AddNew_gif=false;
- AddNew_video=false;
- //============
- Table_FileCount_reload();
-}
-
-
-/*
-添加文件&文件夹
-*/
-void MainWindow::Add_File_Folder(QString Full_Path)
-{
- QFileInfo fileinfo(Full_Path);
- if(fileinfo.isFile())
- {
- QString file_name = fileinfo.fileName();
- FileList_Add(file_name, Full_Path);
- }
- else
- {
- QStringList FileNameList = file_getFileNames_in_Folder_nofilter(Full_Path);//读取合法的文件名
- QString Full_Path_File = "";
- if(!FileNameList.isEmpty())
- {
- QString tmp="";
- for(int i = 0; i < FileNameList.size(); i++)
- {
- tmp = FileNameList.at(i);
- Full_Path_File = Full_Path + "/" + tmp;
- FileList_Add(tmp, Full_Path_File);
- }
- }
- }
-}
-/*
-添加文件&文件夹
-扫描子文件夹
-*/
-void MainWindow::Add_File_Folder_IncludeSubFolder(QString Full_Path)
-{
- QFileInfo fileinfo(Full_Path);
- if(fileinfo.isFile())
- {
- QString file_name = fileinfo.fileName();
- FileList_Add(file_name, Full_Path);
- }
- else
- {
- QStringList FileNameList = getFileNames_IncludeSubFolder(Full_Path);//读取合法的文件名
- QString Full_Path_File = "";
- if(!FileNameList.isEmpty())
- {
- QString tmp="";
- for(int i = 0; i < FileNameList.size(); i++)
- {
- tmp = FileNameList.at(i);
- Full_Path_File = Full_Path + "/" + tmp;
- QFileInfo fileinfo_tmp(Full_Path_File);
- if(fileinfo_tmp.isFile())
- {
- if(QFile::exists(Full_Path_File))FileList_Add(tmp, Full_Path_File);
- }
- else
- {
- //if(QFile::exists(Full_Path_File))
- if(file_isDirExist(Full_Path_File))Add_File_Folder_IncludeSubFolder(Full_Path_File);
- }
- }
- }
- }
-}
-/*
-读取文件夹下的文件名(包括子文件夹
-*/
-QStringList MainWindow::getFileNames_IncludeSubFolder(QString path)
-{
- QDir dir(path);
- QStringList files_old;
- QStringList files_new;
- while(true)
- {
- files_new = dir.entryList(QDir::Dirs | QDir::Files | QDir::Writable, QDir::Name);
- if(files_new!=files_old)
- {
- files_old = files_new;
- Delay_msec_sleep(100);
- }
- else
- {
- break;
- }
- }
- files_new.removeAll("..");
- files_new.removeAll(".");
- return files_new;
-}
-/*
-扫描文件夹下文件名列表(无过滤
-*/
-QStringList MainWindow::file_getFileNames_in_Folder_nofilter(QString path)
-{
- QDir dir(path);
- QStringList files_old;
- QStringList files_new;
- while(true)
- {
- files_new = dir.entryList(QDir::Files | QDir::Writable, QDir::Name);
- if(files_new!=files_old)
- {
- files_old = files_new;
- Delay_msec_sleep(100);
- }
- else
- {
- break;
- }
- }
- files_new.removeAll("..");
- files_new.removeAll(".");
- return files_new;
-}
-
-/*
-向文件列表和table添加文件
-*/
-int MainWindow::FileList_Add(QString fileName, QString SourceFile_fullPath)
-{
- QFileInfo fileinfo(SourceFile_fullPath);
- QString file_ext = fileinfo.suffix().toLower();
- //============================ 判断是否为图片 ===============================
- QString Ext_image_str = ui->Ext_image->text().toLower();
- QStringList nameFilters_image = Ext_image_str.split(":");
- nameFilters_image.removeAll("gif");
- nameFilters_image.removeAll("apng");
- if (nameFilters_image.contains(file_ext))
- {
- AddNew_image=true;
- int rowNum = Table_image_get_rowNum();
- QMap map;
- map["SourceFile_fullPath"] = SourceFile_fullPath;
- map["rowNum"] = QString::number(rowNum, 10);
- if(!Deduplicate_filelist(SourceFile_fullPath))
- {
- mutex_Table_insert_finished.lock();
- Table_insert_finished=false;
- mutex_Table_insert_finished.unlock();
- emit Send_Table_image_insert_fileName_fullPath(fileName, SourceFile_fullPath);
- while(!Table_insert_finished)
- {
- Delay_msec_sleep(10);
- }
- }
- return 0;
- }
- //============================ 判断是否为视频 ===============================
- QString Ext_video_str = ui->Ext_video->text().toLower();
- QStringList nameFilters_video = Ext_video_str.split(":");
- nameFilters_video.removeAll("gif");
- nameFilters_video.removeAll("apng");
- if (nameFilters_video.contains(file_ext))
- {
- AddNew_video=true;
- int rowNum = Table_video_get_rowNum();
- QMap map;
- map["SourceFile_fullPath"] = SourceFile_fullPath;
- map["rowNum"] = QString::number(rowNum, 10);
- if(!Deduplicate_filelist(SourceFile_fullPath))
- {
- mutex_Table_insert_finished.lock();
- Table_insert_finished=false;
- mutex_Table_insert_finished.unlock();
- emit Send_Table_video_insert_fileName_fullPath(fileName, SourceFile_fullPath);
- while(!Table_insert_finished)
- {
- Delay_msec_sleep(10);
- }
- }
- return 0;
- }
- //============================ 最后只能是gif & apng ===============================
- if(file_ext=="gif" || file_ext=="apng")
- {
- int rowNum = Table_gif_get_rowNum();
- QMap map;
- map["SourceFile_fullPath"] = SourceFile_fullPath;
- map["rowNum"] = QString::number(rowNum, 10);
- AddNew_gif=true;
- if(!Deduplicate_filelist(SourceFile_fullPath))
- {
- mutex_Table_insert_finished.lock();
- Table_insert_finished=false;
- mutex_Table_insert_finished.unlock();
- emit Send_Table_gif_insert_fileName_fullPath(fileName, SourceFile_fullPath);
- while(!Table_insert_finished)
- {
- Delay_msec_sleep(10);
- }
- }
- return 0;
- }
- return 0;
-}
-/*
-判断是否已经在文件列表内
-*/
-bool MainWindow::Deduplicate_filelist(QString SourceFile_fullPath)
-{
- for ( int i = 0; i < Table_model_image->rowCount(); i++ )
- {
- QString fullpath_readRow = Table_model_image->item(i,2)->text();
- if(fullpath_readRow == SourceFile_fullPath)
- {
- return true;
- }
- }
- for ( int i = 0; i < Table_model_gif->rowCount(); i++ )
- {
- QString fullpath_readRow = Table_model_gif->item(i,2)->text();
- if(fullpath_readRow == SourceFile_fullPath)
- {
- return true;
- }
- }
- for ( int i = 0; i < Table_model_video->rowCount(); i++ )
- {
- QString fullpath_readRow = Table_model_video->item(i,2)->text();
- if(fullpath_readRow == SourceFile_fullPath)
- {
- return true;
- }
- }
- return false;
-}
-/*
-文件夹是否存在
-*/
-bool MainWindow::file_isDirExist(QString SourceFile_fullPath)
-{
- QDir dir(SourceFile_fullPath.trimmed());
- return dir.exists();
-}
-/*
-创建文件夹
-*/
-void MainWindow::file_mkDir(QString SourceFile_fullPath)
-{
- QDir dir(SourceFile_fullPath);
- if(dir.exists() == false)
- {
- dir.mkdir(SourceFile_fullPath);
- }
-}
-/*
-文件夹是为空
-*/
-bool MainWindow::file_isDirEmpty(QString FolderPath)
-{
- QDir dir(FolderPath);
- return dir.isEmpty();
-}
-
-/*
-删除文件夹
-*/
-bool MainWindow::file_DelDir(const QString &path)
-{
- if (path.isEmpty())
- {
- return false;
- }
- QDir dir(path);
- if(!dir.exists())
- {
- return true;
- }
- dir.setFilter(QDir::AllEntries | QDir::NoDotAndDotDot); //设置过滤
- QFileInfoList fileList = dir.entryInfoList(); // 获取所有的文件信息
- foreach (QFileInfo file, fileList) //遍历文件信息
- {
- if (file.isFile()) // 是文件,删除
- {
- file.dir().remove(file.fileName());
- }
- else // 递归删除
- {
- file_DelDir(file.absoluteFilePath());
- }
- }
- return dir.rmpath(dir.absolutePath()); // 删除文件夹
-}
-/*
-重写的获取basename函数
-*/
-QString MainWindow::file_getBaseName(QString path)
-{
- QFileInfo fileinfo(path);
- QString file_fullname = fileinfo.fileName();
- QStringList parts = file_fullname.split(".");
- QString file_basename="";
- for(int i=0; i<(parts.size()-1); i++)
- {
- file_basename+=parts.at(i);
- file_basename+=".";
- }
- if(file_basename.right(1)==".")
- {
- file_basename = file_basename.left(file_basename.length() - 1);
- }
- return file_basename;
-}
-/*
-移动文件到回收站
-*/
-void MainWindow::file_MoveToTrash( QString file )
-{
- QFileInfo fileinfo( file );
- if( !fileinfo.exists() )
- return;
- WCHAR from[ MAX_PATH ];
- memset( from, 0, sizeof( from ));
- int l = fileinfo.absoluteFilePath().toWCharArray( from );
- Q_ASSERT( 0 <= l && l < MAX_PATH );
- from[ l ] = '\0';
- SHFILEOPSTRUCT fileop;
- memset( &fileop, 0, sizeof( fileop ) );
- fileop.wFunc = FO_DELETE;
- fileop.pFrom = from;
- fileop.fFlags = FOF_ALLOWUNDO | FOF_NOCONFIRMATION | FOF_NOERRORUI | FOF_SILENT;
- int rv = SHFileOperation( &fileop );
- if( 0 != rv )
- {
- return;
- }
-}
-
-/*
-获取文件夹路径(去除末尾的"/")
-*/
-QString MainWindow::file_getFolderPath(QFileInfo fileInfo)
-{
- QString folder_path = fileInfo.path();
- if(folder_path.right(1)=="/")
- {
- folder_path = folder_path.left(folder_path.length() - 1);
- }
- return folder_path;
-}
-/*
-检测文件夹是否可写入
-*/
-bool MainWindow::file_isDirWritable(QString DirPath)
-{
- if(DirPath.right(1)=="/")
- {
- DirPath = DirPath.left(DirPath.length() - 1);
- }
- QString TestTemp = DirPath+"/RWTest_W2xEX.tmp";
- QFile file_TestTemp(TestTemp);
- file_TestTemp.remove();
- if (file_TestTemp.open(QIODevice::ReadWrite | QIODevice::Text)) //QIODevice::ReadWrite支持读写
- {
- QTextStream stream(&file_TestTemp);
- stream << "W2xEX";
- }
- if(QFile::exists(TestTemp))
- {
- file_TestTemp.remove();
- return true;
- }
- else
- {
- file_TestTemp.remove();
- return false;
- }
-}
-/*
-判断当前处理的文件所在的文件夹是否可以写入
-*/
-bool MainWindow::file_isFilesFolderWritable_row_image(int rowNum)
-{
- QString SourceFile_fullPath = Table_model_image->item(rowNum,2)->text();
- QFileInfo fileinfo(SourceFile_fullPath);
- QString file_FolderPath = file_getFolderPath(fileinfo);
- if(file_isDirWritable(file_FolderPath))
- {
- return true;
- }
- else
- {
- emit Send_TextBrowser_NewMessage(tr("Error occured when processing [")+SourceFile_fullPath+tr("]. Error: [Insufficient permissions, administrator permissions is needed.]"));
- QString status = "Failed";
- emit Send_Table_image_ChangeStatus_rowNumInt_statusQString(rowNum, status);
- return false;
- }
-}
-
-bool MainWindow::file_isFilesFolderWritable_row_gif(int rowNum)
-{
- QString SourceFile_fullPath = Table_model_gif->item(rowNum,2)->text();
- QFileInfo fileinfo(SourceFile_fullPath);
- QString file_FolderPath = file_getFolderPath(fileinfo);
- if(file_isDirWritable(file_FolderPath))
- {
- return true;
- }
- else
- {
- emit Send_TextBrowser_NewMessage(tr("Error occured when processing [")+SourceFile_fullPath+tr("]. Error: [Insufficient permissions, administrator permissions is needed.]"));
- QString status = "Failed";
- emit Send_Table_gif_ChangeStatus_rowNumInt_statusQString(rowNum, status);
- return false;
- }
-}
-
-bool MainWindow::file_isFilesFolderWritable_row_video(int rowNum)
-{
- QString SourceFile_fullPath = Table_model_video->item(rowNum,2)->text();
- QFileInfo fileinfo(SourceFile_fullPath);
- QString file_FolderPath = file_getFolderPath(fileinfo);
- if(file_isDirWritable(file_FolderPath))
- {
- return true;
- }
- else
- {
- emit Send_TextBrowser_NewMessage(tr("Error occured when processing [")+SourceFile_fullPath+tr("]. Error: [Insufficient permissions, administrator permissions is needed.]"));
- emit Send_Table_video_ChangeStatus_rowNumInt_statusQString(rowNum, "Failed");
- return false;
- }
-}
-
-bool MainWindow::file_OpenFolder(QString FolderPath)
-{
- if(file_isDirExist(FolderPath))
- {
- FolderPath= FolderPath.replace("/","\\");
- QProcess::execute("explorer \""+FolderPath+"\"");
- return true;
- }
- else
- {
- return false;
- }
-}
-
-bool MainWindow::file_OpenFilesFolder(QString FilePath)
-{
- QFileInfo finfo = QFileInfo(FilePath);
- return file_OpenFolder(file_getFolderPath(finfo));
-}
-
-bool MainWindow::file_OpenFile(QString FilePath)
-{
- if(QFile::exists(FilePath))
- {
- if(QDesktopServices::openUrl(QUrl("file:"+QUrl::toPercentEncoding(FilePath),QUrl::TolerantMode))==false)
- {
- ExecuteCMD_batFile("start \"\" \""+FilePath.replace("%","%%")+"\"",false);
- }
- return true;
- }
- else
- {
- return false;
- }
-}
-
-bool MainWindow::file_generateMarkFile(QString FileFullPath,QString Msg)
-{
- QFile file(FileFullPath);
- file.remove();
- if (file.open(QIODevice::ReadWrite | QIODevice::Text)) //QIODevice::ReadWrite支持读写
- {
- QTextStream stream(&file);
- if(Msg.trimmed() == "")
- {
- stream << "Waifu2x-Extension-GUI\nDo NOT delete this file!!";
- }
- else
- {
- stream << Msg;
- }
- }
- return file.exists();
-}
-
-
+/*
+ Copyright (C) 2021 Aaron Feng
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published
+ by the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see .
+
+ My Github homepage: https://github.com/AaronFeng753
+*/
+
+#include "mainwindow.h"
+#include "ui_mainwindow.h"
+
+void MainWindow::dragEnterEvent(QDragEnterEvent *event)
+{
+ //如果为文件,则支持拖放
+ if (event->mimeData()->hasFormat("text/uri-list"))
+ event->acceptProposedAction();
+}
+/*
+拖放文件event
+*/
+void MainWindow::dropEvent(QDropEvent *event)
+{
+ //重置 是否有某种类型的新文件加入 的判断标志
+ AddNew_gif=false;
+ AddNew_image=false;
+ AddNew_video=false;
+ //================
+ QList urls = event->mimeData()->urls();
+ if(urls.isEmpty())
+ return;
+ //================== 界面管制 ========================
+ ui_tableViews_setUpdatesEnabled(false);
+ //================
+ ui->groupBox_Setting->setEnabled(0);
+ ui->groupBox_FileList->setEnabled(0);
+ ui->groupBox_InputExt->setEnabled(0);
+ pushButton_Start_setEnabled_self(0);
+ ui->checkBox_ScanSubFolders->setEnabled(0);
+ this->setAcceptDrops(0);
+ ui->label_DropFile->setText(tr("Adding files, please wait."));
+ emit Send_TextBrowser_NewMessage(tr("Adding files, please wait."));
+ //===================================================
+ QtConcurrent::run(this, &MainWindow::Read_urls, urls);
+}
+/*
+读取urls
+*/
+void MainWindow::Read_urls(QList urls)
+{
+ Progressbar_MaxVal = urls.size();
+ Progressbar_CurrentVal = 0;
+ emit Send_PrograssBar_Range_min_max(0, Progressbar_MaxVal);
+ if(ui->checkBox_ScanSubFolders->isChecked())
+ {
+ foreach(QUrl url, urls)
+ {
+ Add_File_Folder_IncludeSubFolder(url.toLocalFile());
+ emit Send_progressbar_Add();
+ }
+ }
+ else
+ {
+ foreach(QUrl url, urls)
+ {
+ Add_File_Folder(url.toLocalFile());
+ emit Send_progressbar_Add();
+ }
+ }
+ emit Send_Read_urls_finfished();
+ return;
+}
+/*
+读取urls
+善后
+*/
+void MainWindow::Read_urls_finfished()
+{
+ //================== 解除界面管制 ========================
+ ui_tableViews_setUpdatesEnabled(true);
+ //===
+ ui->groupBox_Setting->setEnabled(1);
+ ui->groupBox_FileList->setEnabled(1);
+ pushButton_Start_setEnabled_self(1);
+ ui->groupBox_InputExt->setEnabled(1);
+ ui->checkBox_ScanSubFolders->setEnabled(1);
+ this->setAcceptDrops(1);
+ ui->label_DropFile->setText(tr("Drag and drop files or folders here\n(Image, GIF and Video)"));
+ emit Send_TextBrowser_NewMessage(tr("Add file complete."));
+ //===================================================
+ Progressbar_MaxVal = 0;
+ Progressbar_CurrentVal = 0;
+ progressbar_clear();
+ //======================
+ //如果没有增加任何文件
+ if(AddNew_gif==false&&AddNew_image==false&&AddNew_video==false)
+ {
+ QMessageBox *MSG = new QMessageBox();
+ MSG->setWindowTitle(tr("Warning"));
+ MSG->setText(tr("The file format is not supported, please enter supported file format, or add more file extensions yourself."));
+ MSG->setIcon(QMessageBox::Warning);
+ MSG->setModal(true);
+ MSG->show();
+ return;
+ }
+ if(AddNew_image)
+ {
+ ui->label_DropFile->setVisible(0);//隐藏文件投放label
+ ui->tableView_image->setVisible(1);
+ }
+ if(AddNew_gif)
+ {
+ ui->label_DropFile->setVisible(0);//隐藏文件投放label
+ ui->tableView_gif->setVisible(1);
+ }
+ if(AddNew_video)
+ {
+ ui->label_DropFile->setVisible(0);//隐藏文件投放label
+ ui->tableView_video->setVisible(1);
+ }
+ //===================
+ ui->tableView_gif->scrollToBottom();
+ ui->tableView_image->scrollToBottom();
+ ui->tableView_video->scrollToBottom();
+ QScrollBar *image_ScrBar = ui->tableView_image->horizontalScrollBar();
+ image_ScrBar->setValue(0);
+ QScrollBar *gif_ScrBar = ui->tableView_gif->horizontalScrollBar();
+ gif_ScrBar->setValue(0);
+ QScrollBar *video_ScrBar = ui->tableView_video->horizontalScrollBar();
+ video_ScrBar->setValue(0);
+ //==========
+ AddNew_image=false;
+ AddNew_gif=false;
+ AddNew_video=false;
+ //============
+ Table_FileCount_reload();
+}
+
+
+/*
+添加文件&文件夹
+*/
+void MainWindow::Add_File_Folder(QString Full_Path)
+{
+ QFileInfo fileinfo(Full_Path);
+ if(fileinfo.isFile())
+ {
+ QString file_name = fileinfo.fileName();
+ FileList_Add(file_name, Full_Path);
+ }
+ else
+ {
+ QStringList FileNameList = file_getFileNames_in_Folder_nofilter(Full_Path);//读取合法的文件名
+ QString Full_Path_File = "";
+ if(!FileNameList.isEmpty())
+ {
+ QString tmp="";
+ for(int i = 0; i < FileNameList.size(); i++)
+ {
+ tmp = FileNameList.at(i);
+ Full_Path_File = Full_Path + "/" + tmp;
+ FileList_Add(tmp, Full_Path_File);
+ }
+ }
+ }
+}
+/*
+添加文件&文件夹
+扫描子文件夹
+*/
+void MainWindow::Add_File_Folder_IncludeSubFolder(QString Full_Path)
+{
+ QFileInfo fileinfo(Full_Path);
+ if(fileinfo.isFile())
+ {
+ QString file_name = fileinfo.fileName();
+ FileList_Add(file_name, Full_Path);
+ }
+ else
+ {
+ QStringList FileNameList = getFileNames_IncludeSubFolder(Full_Path);//读取合法的文件名
+ QString Full_Path_File = "";
+ if(!FileNameList.isEmpty())
+ {
+ QString tmp="";
+ for(int i = 0; i < FileNameList.size(); i++)
+ {
+ tmp = FileNameList.at(i);
+ Full_Path_File = Full_Path + "/" + tmp;
+ QFileInfo fileinfo_tmp(Full_Path_File);
+ if(fileinfo_tmp.isFile())
+ {
+ if(QFile::exists(Full_Path_File))FileList_Add(tmp, Full_Path_File);
+ }
+ else
+ {
+ //if(QFile::exists(Full_Path_File))
+ if(file_isDirExist(Full_Path_File))Add_File_Folder_IncludeSubFolder(Full_Path_File);
+ }
+ }
+ }
+ }
+}
+/*
+读取文件夹下的文件名(包括子文件夹
+*/
+QStringList MainWindow::getFileNames_IncludeSubFolder(QString path)
+{
+ QDir dir(path);
+ QStringList files_old;
+ QStringList files_new;
+ while(true)
+ {
+ files_new = dir.entryList(QDir::Dirs | QDir::Files | QDir::Writable, QDir::Name);
+ if(files_new!=files_old)
+ {
+ files_old = files_new;
+ Delay_msec_sleep(100);
+ }
+ else
+ {
+ break;
+ }
+ }
+ files_new.removeAll("..");
+ files_new.removeAll(".");
+ return files_new;
+}
+/*
+扫描文件夹下文件名列表(无过滤
+*/
+QStringList MainWindow::file_getFileNames_in_Folder_nofilter(QString path)
+{
+ QDir dir(path);
+ QStringList files_old;
+ QStringList files_new;
+ while(true)
+ {
+ files_new = dir.entryList(QDir::Files | QDir::Writable, QDir::Name);
+ if(files_new!=files_old)
+ {
+ files_old = files_new;
+ Delay_msec_sleep(100);
+ }
+ else
+ {
+ break;
+ }
+ }
+ files_new.removeAll("..");
+ files_new.removeAll(".");
+ return files_new;
+}
+
+/*
+向文件列表和table添加文件
+*/
+int MainWindow::FileList_Add(QString fileName, QString SourceFile_fullPath)
+{
+ QFileInfo fileinfo(SourceFile_fullPath);
+ QString file_ext = fileinfo.suffix().toLower();
+ //============================ 判断是否为图片 ===============================
+ QString Ext_image_str = ui->Ext_image->text().toLower();
+ QStringList nameFilters_image = Ext_image_str.split(":");
+ nameFilters_image.removeAll("gif");
+ nameFilters_image.removeAll("apng");
+ if (nameFilters_image.contains(file_ext))
+ {
+ AddNew_image=true;
+ int rowNum = Table_image_get_rowNum();
+ QMap map;
+ map["SourceFile_fullPath"] = SourceFile_fullPath;
+ map["rowNum"] = QString::number(rowNum, 10);
+ if(!Deduplicate_filelist(SourceFile_fullPath))
+ {
+ mutex_Table_insert_finished.lock();
+ Table_insert_finished=false;
+ mutex_Table_insert_finished.unlock();
+ emit Send_Table_image_insert_fileName_fullPath(fileName, SourceFile_fullPath);
+ while(!Table_insert_finished)
+ {
+ Delay_msec_sleep(10);
+ }
+ }
+ return 0;
+ }
+ //============================ 判断是否为视频 ===============================
+ QString Ext_video_str = ui->Ext_video->text().toLower();
+ QStringList nameFilters_video = Ext_video_str.split(":");
+ nameFilters_video.removeAll("gif");
+ nameFilters_video.removeAll("apng");
+ if (nameFilters_video.contains(file_ext))
+ {
+ AddNew_video=true;
+ int rowNum = Table_video_get_rowNum();
+ QMap map;
+ map["SourceFile_fullPath"] = SourceFile_fullPath;
+ map["rowNum"] = QString::number(rowNum, 10);
+ if(!Deduplicate_filelist(SourceFile_fullPath))
+ {
+ mutex_Table_insert_finished.lock();
+ Table_insert_finished=false;
+ mutex_Table_insert_finished.unlock();
+ emit Send_Table_video_insert_fileName_fullPath(fileName, SourceFile_fullPath);
+ while(!Table_insert_finished)
+ {
+ Delay_msec_sleep(10);
+ }
+ }
+ return 0;
+ }
+ //============================ 最后只能是gif & apng ===============================
+ if(file_ext=="gif" || file_ext=="apng")
+ {
+ int rowNum = Table_gif_get_rowNum();
+ QMap map;
+ map["SourceFile_fullPath"] = SourceFile_fullPath;
+ map["rowNum"] = QString::number(rowNum, 10);
+ AddNew_gif=true;
+ if(!Deduplicate_filelist(SourceFile_fullPath))
+ {
+ mutex_Table_insert_finished.lock();
+ Table_insert_finished=false;
+ mutex_Table_insert_finished.unlock();
+ emit Send_Table_gif_insert_fileName_fullPath(fileName, SourceFile_fullPath);
+ while(!Table_insert_finished)
+ {
+ Delay_msec_sleep(10);
+ }
+ }
+ return 0;
+ }
+ return 0;
+}
+/*
+判断是否已经在文件列表内
+*/
+bool MainWindow::Deduplicate_filelist(QString SourceFile_fullPath)
+{
+ for ( int i = 0; i < Table_model_image->rowCount(); i++ )
+ {
+ QString fullpath_readRow = Table_model_image->item(i,2)->text();
+ if(fullpath_readRow == SourceFile_fullPath)
+ {
+ return true;
+ }
+ }
+ for ( int i = 0; i < Table_model_gif->rowCount(); i++ )
+ {
+ QString fullpath_readRow = Table_model_gif->item(i,2)->text();
+ if(fullpath_readRow == SourceFile_fullPath)
+ {
+ return true;
+ }
+ }
+ for ( int i = 0; i < Table_model_video->rowCount(); i++ )
+ {
+ QString fullpath_readRow = Table_model_video->item(i,2)->text();
+ if(fullpath_readRow == SourceFile_fullPath)
+ {
+ return true;
+ }
+ }
+ return false;
+}
+/*
+文件夹是否存在
+*/
+bool MainWindow::file_isDirExist(QString SourceFile_fullPath)
+{
+ QDir dir(SourceFile_fullPath.trimmed());
+ return dir.exists();
+}
+/*
+创建文件夹
+*/
+void MainWindow::file_mkDir(QString SourceFile_fullPath)
+{
+ QDir dir(SourceFile_fullPath);
+ if(dir.exists() == false)
+ {
+ dir.mkdir(SourceFile_fullPath);
+ }
+}
+/*
+文件夹是为空
+*/
+bool MainWindow::file_isDirEmpty(QString FolderPath)
+{
+ QDir dir(FolderPath);
+ return dir.isEmpty();
+}
+
+/*
+删除文件夹
+*/
+bool MainWindow::file_DelDir(const QString &path)
+{
+ if (path.isEmpty())
+ {
+ return false;
+ }
+ QDir dir(path);
+ if(!dir.exists())
+ {
+ return true;
+ }
+ dir.setFilter(QDir::AllEntries | QDir::NoDotAndDotDot); //设置过滤
+ QFileInfoList fileList = dir.entryInfoList(); // 获取所有的文件信息
+ foreach (QFileInfo file, fileList) //遍历文件信息
+ {
+ if (file.isFile()) // 是文件,删除
+ {
+ file.dir().remove(file.fileName());
+ }
+ else // 递归删除
+ {
+ file_DelDir(file.absoluteFilePath());
+ }
+ }
+ return dir.rmpath(dir.absolutePath()); // 删除文件夹
+}
+/*
+重写的获取basename函数
+*/
+QString MainWindow::file_getBaseName(QString path)
+{
+ QFileInfo fileinfo(path);
+ QString file_fullname = fileinfo.fileName();
+ QStringList parts = file_fullname.split(".");
+ QString file_basename="";
+ for(int i=0; i<(parts.size()-1); i++)
+ {
+ file_basename+=parts.at(i);
+ file_basename+=".";
+ }
+ if(file_basename.right(1)==".")
+ {
+ file_basename = file_basename.left(file_basename.length() - 1);
+ }
+ return file_basename;
+}
+/*
+移动文件到回收站
+*/
+void MainWindow::file_MoveToTrash( QString file )
+{
+ QFileInfo fileinfo( file );
+ if( !fileinfo.exists() )
+ return;
+ WCHAR from[ MAX_PATH ];
+ memset( from, 0, sizeof( from ));
+ int l = fileinfo.absoluteFilePath().toWCharArray( from );
+ Q_ASSERT( 0 <= l && l < MAX_PATH );
+ from[ l ] = '\0';
+ SHFILEOPSTRUCT fileop;
+ memset( &fileop, 0, sizeof( fileop ) );
+ fileop.wFunc = FO_DELETE;
+ fileop.pFrom = from;
+ fileop.fFlags = FOF_ALLOWUNDO | FOF_NOCONFIRMATION | FOF_NOERRORUI | FOF_SILENT;
+ int rv = SHFileOperation( &fileop );
+ if( 0 != rv )
+ {
+ return;
+ }
+}
+
+/*
+获取文件夹路径(去除末尾的"/")
+*/
+QString MainWindow::file_getFolderPath(QFileInfo fileInfo)
+{
+ QString folder_path = fileInfo.path();
+ if(folder_path.right(1)=="/")
+ {
+ folder_path = folder_path.left(folder_path.length() - 1);
+ }
+ return folder_path;
+}
+/*
+检测文件夹是否可写入
+*/
+bool MainWindow::file_isDirWritable(QString DirPath)
+{
+ if(DirPath.right(1)=="/")
+ {
+ DirPath = DirPath.left(DirPath.length() - 1);
+ }
+ QString TestTemp = DirPath+"/RWTest_W2xEX.tmp";
+ QFile file_TestTemp(TestTemp);
+ file_TestTemp.remove();
+ if (file_TestTemp.open(QIODevice::ReadWrite | QIODevice::Text)) //QIODevice::ReadWrite支持读写
+ {
+ QTextStream stream(&file_TestTemp);
+ stream << "W2xEX";
+ }
+ if(QFile::exists(TestTemp))
+ {
+ file_TestTemp.remove();
+ return true;
+ }
+ else
+ {
+ file_TestTemp.remove();
+ return false;
+ }
+}
+/*
+判断当前处理的文件所在的文件夹是否可以写入
+*/
+bool MainWindow::file_isFilesFolderWritable_row_image(int rowNum)
+{
+ QString SourceFile_fullPath = Table_model_image->item(rowNum,2)->text();
+ QFileInfo fileinfo(SourceFile_fullPath);
+ QString file_FolderPath = file_getFolderPath(fileinfo);
+ if(file_isDirWritable(file_FolderPath))
+ {
+ return true;
+ }
+ else
+ {
+ emit Send_TextBrowser_NewMessage(tr("Error occured when processing [")+SourceFile_fullPath+tr("]. Error: [Insufficient permissions, administrator permissions is needed.]"));
+ QString status = "Failed";
+ emit Send_Table_image_ChangeStatus_rowNumInt_statusQString(rowNum, status);
+ return false;
+ }
+}
+
+bool MainWindow::file_isFilesFolderWritable_row_gif(int rowNum)
+{
+ QString SourceFile_fullPath = Table_model_gif->item(rowNum,2)->text();
+ QFileInfo fileinfo(SourceFile_fullPath);
+ QString file_FolderPath = file_getFolderPath(fileinfo);
+ if(file_isDirWritable(file_FolderPath))
+ {
+ return true;
+ }
+ else
+ {
+ emit Send_TextBrowser_NewMessage(tr("Error occured when processing [")+SourceFile_fullPath+tr("]. Error: [Insufficient permissions, administrator permissions is needed.]"));
+ QString status = "Failed";
+ emit Send_Table_gif_ChangeStatus_rowNumInt_statusQString(rowNum, status);
+ return false;
+ }
+}
+
+bool MainWindow::file_isFilesFolderWritable_row_video(int rowNum)
+{
+ QString SourceFile_fullPath = Table_model_video->item(rowNum,2)->text();
+ QFileInfo fileinfo(SourceFile_fullPath);
+ QString file_FolderPath = file_getFolderPath(fileinfo);
+ if(file_isDirWritable(file_FolderPath))
+ {
+ return true;
+ }
+ else
+ {
+ emit Send_TextBrowser_NewMessage(tr("Error occured when processing [")+SourceFile_fullPath+tr("]. Error: [Insufficient permissions, administrator permissions is needed.]"));
+ emit Send_Table_video_ChangeStatus_rowNumInt_statusQString(rowNum, "Failed");
+ return false;
+ }
+}
+
+bool MainWindow::file_OpenFolder(QString FolderPath)
+{
+ if(file_isDirExist(FolderPath))
+ {
+ FolderPath= FolderPath.replace("/","\\");
+ QProcess::execute("explorer \""+FolderPath+"\"");
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+}
+
+bool MainWindow::file_OpenFilesFolder(QString FilePath)
+{
+ QFileInfo finfo = QFileInfo(FilePath);
+ return file_OpenFolder(file_getFolderPath(finfo));
+}
+
+bool MainWindow::file_OpenFile(QString FilePath)
+{
+ if(QFile::exists(FilePath))
+ {
+ if(QDesktopServices::openUrl(QUrl("file:"+QUrl::toPercentEncoding(FilePath),QUrl::TolerantMode))==false)
+ {
+ ExecuteCMD_batFile("start \"\" \""+FilePath.replace("%","%%")+"\"",false);
+ }
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+}
+
+bool MainWindow::file_generateMarkFile(QString FileFullPath,QString Msg)
+{
+ QFile file(FileFullPath);
+ file.remove();
+ if (file.open(QIODevice::ReadWrite | QIODevice::Text)) //QIODevice::ReadWrite支持读写
+ {
+ QTextStream stream(&file);
+ if(Msg.trimmed() == "")
+ {
+ stream << "Waifu2x-Extension-GUI\nDo NOT delete this file!!";
+ }
+ else
+ {
+ stream << Msg;
+ }
+ }
+ return file.exists();
+}
+
+
diff --git a/SRC/Waifu2x-Extension-QT/gif.cpp b/SRC_v3.41.01-beta/Waifu2x-Extension-QT/gif.cpp
similarity index 97%
rename from SRC/Waifu2x-Extension-QT/gif.cpp
rename to SRC_v3.41.01-beta/Waifu2x-Extension-QT/gif.cpp
index a6b5c54..f3cc985 100644
--- a/SRC/Waifu2x-Extension-QT/gif.cpp
+++ b/SRC_v3.41.01-beta/Waifu2x-Extension-QT/gif.cpp
@@ -1,310 +1,310 @@
-/*
- Copyright (C) 2021 Aaron Feng
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU Affero General Public License as published
- by the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU Affero General Public License for more details.
-
- You should have received a copy of the GNU Affero General Public License
- along with this program. If not, see .
-
- My Github homepage: https://github.com/AaronFeng753
-*/
-
-#include "mainwindow.h"
-#include "ui_mainwindow.h"
-/*
-根据行数从自定义分辨率列表移除gif文件
-*/
-void MainWindow::Gif_RemoveFromCustResList(int RowNumber)
-{
- QString SourceFile_fullPath = Table_model_gif->item(RowNumber,2)->text();
- CustRes_remove(SourceFile_fullPath);
-}
-
-/*
-当gif没有自定义分辨率且此时放大倍率为double,则计算一个添加到自定义列表里
-*/
-bool MainWindow::Gif_DoubleScaleRatioPrep(int RowNumber)
-{
- QString SourceFile_fullPath = Table_model_gif->item(RowNumber,2)->text();
- if(CustRes_isContained(SourceFile_fullPath) == true)
- {
- return false;
- }
- else
- {
- //===================== 获取分辨率 =============================
- QMap Map_OrgRes = Image_Gif_Read_Resolution(SourceFile_fullPath);
- //========= 计算新的高度宽度 ==================
- double ScaleRatio_double = ui->doubleSpinBox_ScaleRatio_gif->value();
- int Height_new = qRound(ScaleRatio_double * Map_OrgRes["height"]);
- int width_new = qRound(ScaleRatio_double * Map_OrgRes["width"]);
- if(Height_new<1 || width_new<1)
- {
- emit Send_TextBrowser_NewMessage("Warning! Unable to read the resolution of ["+SourceFile_fullPath+"]. This file will only be scaled to "+QString::number((int)ScaleRatio_double,10)+"X.");
- return false;
- }
- //======== 存入自定义分辨率列表中 ============
- QMap res_map;
- res_map["fullpath"] = SourceFile_fullPath;
- res_map["height"] = QString::number(Height_new,10);
- res_map["width"] = QString::number(width_new,10);
- Custom_resolution_list.append(res_map);
- //=========
- return true;
- }
-}
-/*
-获取gif帧间隔时间
-*/
-int MainWindow::Gif_getDuration(QString gifPath)
-{
- //========================= 调用ffprobe读取GIF信息 ======================
- QProcess *Get_GifAvgFPS_process = new QProcess();
- QString cmd = "\""+Current_Path+"/ffprobe_waifu2xEX.exe\" -i \""+gifPath+"\" -select_streams v -show_streams -v quiet -print_format ini -show_format";
- Get_GifAvgFPS_process->start(cmd);
- while(!Get_GifAvgFPS_process->waitForStarted(100)&&!QProcess_stop) {}
- while(!Get_GifAvgFPS_process->waitForFinished(100)&&!QProcess_stop) {}
- //============= 保存ffprobe输出的ini格式文本 =============
- QString ffprobe_output_str = Get_GifAvgFPS_process->readAllStandardOutput();
- //================ 将ini写入文件保存 ================
- QFileInfo videoFileInfo(gifPath);
- QString Path_gif_info_ini = "";
- QString video_dir = file_getFolderPath(gifPath);
- int FileNo = 0;
- do
- {
- FileNo++;
- Path_gif_info_ini = video_dir+"/"+file_getBaseName(gifPath)+"_GifInfo_"+QString::number(FileNo,10)+"_W2xEX.ini";
- }
- while(QFile::exists(Path_gif_info_ini));
- //=========
- QFile gif_info_ini(Path_gif_info_ini);
- gif_info_ini.remove();
- if (gif_info_ini.open(QIODevice::ReadWrite | QIODevice::Text)) //QIODevice::ReadWrite支持读写
- {
- QTextStream stream(&gif_info_ini);
- stream << ffprobe_output_str;
- }
- gif_info_ini.close();
- //================== 读取ini获得参数 =====================
- QString FPS_Division = "";
- QSettings *configIniRead_videoInfo = new QSettings(Path_gif_info_ini, QSettings::IniFormat);
- if(configIniRead_videoInfo->value("/streams.stream.0/avg_frame_rate") != QVariant())
- {
- FPS_Division = configIniRead_videoInfo->value("/streams.stream.0/avg_frame_rate").toString().trimmed();
- }
- gif_info_ini.remove();
- //=======================
- int Duration = 0;
- if(FPS_Division!="")
- {
- QStringList FPS_Nums = FPS_Division.split("/");
- if(FPS_Nums.size()==2)
- {
- double FPS_Num_0 = FPS_Nums.at(0).toDouble();
- double FPS_Num_1 = FPS_Nums.at(1).toDouble();
- if(FPS_Num_0>0&&FPS_Num_1>0)
- {
- double Duration_double = 100/(FPS_Num_0/FPS_Num_1);
- Duration = qRound(Duration_double);
- }
- }
- }
- if(Duration<=0)
- {
- QMovie movie(gifPath);
- movie.setSpeed(1);
- movie.start();
- movie.stop();
- Duration = ((movie.nextFrameDelay()/100)+1)/10;
- }
- return Duration;
-}
-/*
-获取gif帧数量的位数
-*/
-int MainWindow::Gif_getFrameDigits(QString gifPath)
-{
- QMovie movie(gifPath);
- int FrameCount=1+(int)log10(movie.frameCount());//获取frame位数
- return FrameCount;
-}
-/*
-拆分gif
-*/
-void MainWindow::Gif_splitGif(QString gifPath,QString SplitFramesFolderPath)
-{
- emit Send_TextBrowser_NewMessage(tr("Start splitting GIF:[")+gifPath+"]");
- int FrameDigits = Gif_getFrameDigits(gifPath);
- //删除并新建帧文件夹
- file_DelDir(SplitFramesFolderPath);
- file_mkDir(SplitFramesFolderPath);
- //开始用convert处理
- QString program = Current_Path+"/convert_waifu2xEX.exe";
- QString cmd = "\"" + program + "\"" + " -coalesce " + "\"" + gifPath + "\"" + " " + "\"" + SplitFramesFolderPath + "/%0"+QString::number(FrameDigits,10)+"d.png\"";
- QProcess *SplitGIF=new QProcess();
- SplitGIF->start(cmd);
- while(!SplitGIF->waitForStarted(100)&&!QProcess_stop) {}
- while(!SplitGIF->waitForFinished(100)&&!QProcess_stop) {}
- if(file_isDirEmpty(SplitFramesFolderPath))//如果拆分失败,尝试win7兼容指令
- {
- QString cmd = "\"" + program + "\"" + " -coalesce " + "\"" + gifPath + "\"" + " " + "\"" + SplitFramesFolderPath + "/%%0"+QString::number(FrameDigits,10)+"d.png\"";
- QProcess *SplitGIF=new QProcess();
- SplitGIF->start(cmd);
- while(!SplitGIF->waitForStarted(100)&&!QProcess_stop) {}
- while(!SplitGIF->waitForFinished(100)&&!QProcess_stop) {}
- }
- emit Send_TextBrowser_NewMessage(tr("Finish splitting GIF:[")+gifPath+"]");
-}
-/*
-组装gif
-*/
-void MainWindow::Gif_assembleGif(QString ResGifPath,QString ScaledFramesPath,int Duration,bool CustRes_isEnabled,int CustRes_height,int CustRes_width,bool isOverScaled,QString SourceGifFullPath)
-{
- emit Send_TextBrowser_NewMessage(tr("Start to assemble GIF:[")+ResGifPath+"]");
- //===============================
- QString resize_cmd ="";
- QString program = Current_Path+"/convert_waifu2xEX.exe";
- if(ui->checkBox_DisableResize_gif->isChecked()==false)
- {
- if(CustRes_isEnabled || isOverScaled)
- {
- if(isOverScaled==true && CustRes_isEnabled==false)
- {
- QMap res_map = Image_Gif_Read_Resolution(SourceGifFullPath);
- int OriginalScaleRatio = ui->doubleSpinBox_ScaleRatio_gif->value();
- resize_cmd =" -resize "+QString::number(res_map["width"]*OriginalScaleRatio,10)+"x"+QString::number(res_map["height"]*OriginalScaleRatio,10)+"! ";
- }
- if(CustRes_AspectRatioMode==Qt::IgnoreAspectRatio && CustRes_isEnabled==true)
- {
- resize_cmd =" -resize "+QString::number(CustRes_width,10)+"x"+QString::number(CustRes_height,10)+"! ";
- }
- if(CustRes_AspectRatioMode==Qt::KeepAspectRatio && CustRes_isEnabled==true)
- {
- resize_cmd =" -resize "+QString::number(CustRes_width,10)+"x"+QString::number(CustRes_height,10)+" ";
- }
- if(CustRes_AspectRatioMode==Qt::KeepAspectRatioByExpanding && CustRes_isEnabled==true)
- {
- if(CustRes_width>CustRes_height)
- {
- resize_cmd =" -resize "+QString::number(CustRes_width,10)+" ";
- }
- else
- {
- resize_cmd =" -resize x"+QString::number(CustRes_height,10)+" ";
- }
- }
- }
- QString cmd = "\"" + program + "\" "+resize_cmd+" -delay " + QString::number(Duration, 10) + " -loop 0 \"" + ScaledFramesPath + "/*png\" \""+ResGifPath+"\"";
- QProcess *AssembleGIF=new QProcess();
- AssembleGIF->start(cmd);
- while(!AssembleGIF->waitForStarted(100)&&!QProcess_stop) {}
- while(!AssembleGIF->waitForFinished(100)&&!QProcess_stop) {}
- //======= 纠正文件名称错误(当 结果gif文件路径内有 % 符号时) ======
- if(QFile::exists(ResGifPath)==false)
- {
- QFileInfo fileinfo(ResGifPath);
- QString file_name = file_getBaseName(ResGifPath);
- QString file_ext = fileinfo.suffix();
- QString file_path = file_getFolderPath(fileinfo);
- QString ActualResGifPath = file_path + "/" + file_name + "-0." + file_ext;
- if(QFile::exists(ActualResGifPath)==true)
- {
- QFile::rename(ActualResGifPath,ResGifPath);
- }
- }
- if(QFile::exists(ResGifPath))
- {
- emit Send_TextBrowser_NewMessage(tr("Finish assembling GIF:[")+ResGifPath+"]");
- return;
- }
- AssembleGIF->kill();
- }
- //自行调整图片大小再组装
- if(CustRes_isEnabled || isOverScaled)
- {
- int New_width=0;
- int New_height=0;
- if(isOverScaled==true && CustRes_isEnabled==false)
- {
- QMap res_map = Image_Gif_Read_Resolution(SourceGifFullPath);
- int OriginalScaleRatio = ui->doubleSpinBox_ScaleRatio_gif->value();
- New_width = res_map["width"]*OriginalScaleRatio;
- New_height = res_map["height"]*OriginalScaleRatio;
- }
- if(CustRes_isEnabled==true)
- {
- New_width = CustRes_width;
- New_height = CustRes_height;
- }
- ImagesResize_Folder_MultiThread(New_width,New_height,ScaledFramesPath);
- }
- QString cmd = "\"" + program + "\" \"" + ScaledFramesPath + "/*png\" -delay " + QString::number(Duration, 10) + " -loop 0 \""+ResGifPath+"\"";
- QProcess *AssembleGIF_1=new QProcess();
- AssembleGIF_1->start(cmd);
- while(!AssembleGIF_1->waitForStarted(100)&&!QProcess_stop) {}
- while(!AssembleGIF_1->waitForFinished(100)&&!QProcess_stop) {}
- //======= 纠正文件名称错误(当 结果gif文件路径内有 % 符号时) ======
- if(QFile::exists(ResGifPath)==false)
- {
- QFileInfo fileinfo(ResGifPath);
- QString file_name = file_getBaseName(ResGifPath);
- QString file_ext = fileinfo.suffix();
- QString file_path = file_getFolderPath(fileinfo);
- QString ActualResGifPath = file_path + "/" + file_name + "-0." + file_ext;
- if(QFile::exists(ActualResGifPath)==true)
- {
- QFile::rename(ActualResGifPath,ResGifPath);
- }
- }
- //=====================
- if(QFile::exists(ResGifPath))
- {
- emit Send_TextBrowser_NewMessage(tr("Finish assembling GIF:[")+ResGifPath+"]");
- if(ui->checkBox_DisableResize_gif->isChecked()==false)emit Send_Set_checkBox_DisableResize_gif_Checked();
- }
- return;
-}
-/*
-压缩gif
-*/
-QString MainWindow::Gif_compressGif(QString gifPath,QString gifPath_compressd)
-{
- emit Send_TextBrowser_NewMessage(tr("Starting to optimize GIF:[")+gifPath+"]");
- //=====
- QString program = Current_Path+"/gifsicle_waifu2xEX.exe";
- QString cmd = "\"" + program + "\"" + " -O3 -i \""+gifPath+"\" -o \""+gifPath_compressd+"\"";
- QProcess *CompressGIF=new QProcess();
- CompressGIF->start(cmd);
- while(!CompressGIF->waitForStarted(100)&&!QProcess_stop) {}
- while(!CompressGIF->waitForFinished(100)&&!QProcess_stop) {}
- //======
- //判断是否生成压缩后的gif
- if(QFile::exists(gifPath_compressd) == false)
- {
- emit Send_TextBrowser_NewMessage(tr("Error occured when processing [")+gifPath+tr("]. Error: [Can't optimize gif.]"));
- return gifPath;//返回源文件路径
- }
- //======
- //比较文件大小,判断压缩是否有效
- QFileInfo *gifPath_QFileInfo = new QFileInfo(gifPath);
- QFileInfo *gifPath_compressd_QFileInfo = new QFileInfo(gifPath_compressd);
- if(gifPath_compressd_QFileInfo->size() >= gifPath_QFileInfo->size())
- {
- emit Send_TextBrowser_NewMessage(tr("Failed to optimize gif [")+gifPath+tr("] to reduce storage usage, the optimized gif file will be deleted."));
- QFile::remove(gifPath_compressd);
- return gifPath;//返回源文件路径
- }
- //======
- QFile::remove(gifPath);
- emit Send_TextBrowser_NewMessage(tr("Finish optimizing GIF:[")+gifPath+"]");
- return gifPath_compressd;//返回处理完成的文件路径
-}
+/*
+ Copyright (C) 2021 Aaron Feng
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published
+ by the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see .
+
+ My Github homepage: https://github.com/AaronFeng753
+*/
+
+#include "mainwindow.h"
+#include "ui_mainwindow.h"
+/*
+根据行数从自定义分辨率列表移除gif文件
+*/
+void MainWindow::Gif_RemoveFromCustResList(int RowNumber)
+{
+ QString SourceFile_fullPath = Table_model_gif->item(RowNumber,2)->text();
+ CustRes_remove(SourceFile_fullPath);
+}
+
+/*
+当gif没有自定义分辨率且此时放大倍率为double,则计算一个添加到自定义列表里
+*/
+bool MainWindow::Gif_DoubleScaleRatioPrep(int RowNumber)
+{
+ QString SourceFile_fullPath = Table_model_gif->item(RowNumber,2)->text();
+ if(CustRes_isContained(SourceFile_fullPath) == true)
+ {
+ return false;
+ }
+ else
+ {
+ //===================== 获取分辨率 =============================
+ QMap Map_OrgRes = Image_Gif_Read_Resolution(SourceFile_fullPath);
+ //========= 计算新的高度宽度 ==================
+ double ScaleRatio_double = ui->doubleSpinBox_ScaleRatio_gif->value();
+ int Height_new = qRound(ScaleRatio_double * Map_OrgRes["height"]);
+ int width_new = qRound(ScaleRatio_double * Map_OrgRes["width"]);
+ if(Height_new<1 || width_new<1)
+ {
+ emit Send_TextBrowser_NewMessage("Warning! Unable to read the resolution of ["+SourceFile_fullPath+"]. This file will only be scaled to "+QString::number((int)ScaleRatio_double,10)+"X.");
+ return false;
+ }
+ //======== 存入自定义分辨率列表中 ============
+ QMap res_map;
+ res_map["fullpath"] = SourceFile_fullPath;
+ res_map["height"] = QString::number(Height_new,10);
+ res_map["width"] = QString::number(width_new,10);
+ Custom_resolution_list.append(res_map);
+ //=========
+ return true;
+ }
+}
+/*
+获取gif帧间隔时间
+*/
+int MainWindow::Gif_getDuration(QString gifPath)
+{
+ //========================= 调用ffprobe读取GIF信息 ======================
+ QProcess *Get_GifAvgFPS_process = new QProcess();
+ QString cmd = "\""+Current_Path+"/ffprobe_waifu2xEX.exe\" -i \""+gifPath+"\" -select_streams v -show_streams -v quiet -print_format ini -show_format";
+ Get_GifAvgFPS_process->start(cmd);
+ while(!Get_GifAvgFPS_process->waitForStarted(100)&&!QProcess_stop) {}
+ while(!Get_GifAvgFPS_process->waitForFinished(100)&&!QProcess_stop) {}
+ //============= 保存ffprobe输出的ini格式文本 =============
+ QString ffprobe_output_str = Get_GifAvgFPS_process->readAllStandardOutput();
+ //================ 将ini写入文件保存 ================
+ QFileInfo videoFileInfo(gifPath);
+ QString Path_gif_info_ini = "";
+ QString video_dir = file_getFolderPath(gifPath);
+ int FileNo = 0;
+ do
+ {
+ FileNo++;
+ Path_gif_info_ini = video_dir+"/"+file_getBaseName(gifPath)+"_GifInfo_"+QString::number(FileNo,10)+"_W2xEX.ini";
+ }
+ while(QFile::exists(Path_gif_info_ini));
+ //=========
+ QFile gif_info_ini(Path_gif_info_ini);
+ gif_info_ini.remove();
+ if (gif_info_ini.open(QIODevice::ReadWrite | QIODevice::Text)) //QIODevice::ReadWrite支持读写
+ {
+ QTextStream stream(&gif_info_ini);
+ stream << ffprobe_output_str;
+ }
+ gif_info_ini.close();
+ //================== 读取ini获得参数 =====================
+ QString FPS_Division = "";
+ QSettings *configIniRead_videoInfo = new QSettings(Path_gif_info_ini, QSettings::IniFormat);
+ if(configIniRead_videoInfo->value("/streams.stream.0/avg_frame_rate") != QVariant())
+ {
+ FPS_Division = configIniRead_videoInfo->value("/streams.stream.0/avg_frame_rate").toString().trimmed();
+ }
+ gif_info_ini.remove();
+ //=======================
+ int Duration = 0;
+ if(FPS_Division!="")
+ {
+ QStringList FPS_Nums = FPS_Division.split("/");
+ if(FPS_Nums.size()==2)
+ {
+ double FPS_Num_0 = FPS_Nums.at(0).toDouble();
+ double FPS_Num_1 = FPS_Nums.at(1).toDouble();
+ if(FPS_Num_0>0&&FPS_Num_1>0)
+ {
+ double Duration_double = 100/(FPS_Num_0/FPS_Num_1);
+ Duration = qRound(Duration_double);
+ }
+ }
+ }
+ if(Duration<=0)
+ {
+ QMovie movie(gifPath);
+ movie.setSpeed(1);
+ movie.start();
+ movie.stop();
+ Duration = ((movie.nextFrameDelay()/100)+1)/10;
+ }
+ return Duration;
+}
+/*
+获取gif帧数量的位数
+*/
+int MainWindow::Gif_getFrameDigits(QString gifPath)
+{
+ QMovie movie(gifPath);
+ int FrameCount=1+(int)log10(movie.frameCount());//获取frame位数
+ return FrameCount;
+}
+/*
+拆分gif
+*/
+void MainWindow::Gif_splitGif(QString gifPath,QString SplitFramesFolderPath)
+{
+ emit Send_TextBrowser_NewMessage(tr("Start splitting GIF:[")+gifPath+"]");
+ int FrameDigits = Gif_getFrameDigits(gifPath);
+ //删除并新建帧文件夹
+ file_DelDir(SplitFramesFolderPath);
+ file_mkDir(SplitFramesFolderPath);
+ //开始用convert处理
+ QString program = Current_Path+"/convert_waifu2xEX.exe";
+ QString cmd = "\"" + program + "\"" + " -coalesce " + "\"" + gifPath + "\"" + " " + "\"" + SplitFramesFolderPath + "/%0"+QString::number(FrameDigits,10)+"d.png\"";
+ QProcess *SplitGIF=new QProcess();
+ SplitGIF->start(cmd);
+ while(!SplitGIF->waitForStarted(100)&&!QProcess_stop) {}
+ while(!SplitGIF->waitForFinished(100)&&!QProcess_stop) {}
+ if(file_isDirEmpty(SplitFramesFolderPath))//如果拆分失败,尝试win7兼容指令
+ {
+ QString cmd = "\"" + program + "\"" + " -coalesce " + "\"" + gifPath + "\"" + " " + "\"" + SplitFramesFolderPath + "/%%0"+QString::number(FrameDigits,10)+"d.png\"";
+ QProcess *SplitGIF=new QProcess();
+ SplitGIF->start(cmd);
+ while(!SplitGIF->waitForStarted(100)&&!QProcess_stop) {}
+ while(!SplitGIF->waitForFinished(100)&&!QProcess_stop) {}
+ }
+ emit Send_TextBrowser_NewMessage(tr("Finish splitting GIF:[")+gifPath+"]");
+}
+/*
+组装gif
+*/
+void MainWindow::Gif_assembleGif(QString ResGifPath,QString ScaledFramesPath,int Duration,bool CustRes_isEnabled,int CustRes_height,int CustRes_width,bool isOverScaled,QString SourceGifFullPath)
+{
+ emit Send_TextBrowser_NewMessage(tr("Start to assemble GIF:[")+ResGifPath+"]");
+ //===============================
+ QString resize_cmd ="";
+ QString program = Current_Path+"/convert_waifu2xEX.exe";
+ if(ui->checkBox_DisableResize_gif->isChecked()==false)
+ {
+ if(CustRes_isEnabled || isOverScaled)
+ {
+ if(isOverScaled==true && CustRes_isEnabled==false)
+ {
+ QMap res_map = Image_Gif_Read_Resolution(SourceGifFullPath);
+ int OriginalScaleRatio = ui->doubleSpinBox_ScaleRatio_gif->value();
+ resize_cmd =" -resize "+QString::number(res_map["width"]*OriginalScaleRatio,10)+"x"+QString::number(res_map["height"]*OriginalScaleRatio,10)+"! ";
+ }
+ if(CustRes_AspectRatioMode==Qt::IgnoreAspectRatio && CustRes_isEnabled==true)
+ {
+ resize_cmd =" -resize "+QString::number(CustRes_width,10)+"x"+QString::number(CustRes_height,10)+"! ";
+ }
+ if(CustRes_AspectRatioMode==Qt::KeepAspectRatio && CustRes_isEnabled==true)
+ {
+ resize_cmd =" -resize "+QString::number(CustRes_width,10)+"x"+QString::number(CustRes_height,10)+" ";
+ }
+ if(CustRes_AspectRatioMode==Qt::KeepAspectRatioByExpanding && CustRes_isEnabled==true)
+ {
+ if(CustRes_width>CustRes_height)
+ {
+ resize_cmd =" -resize "+QString::number(CustRes_width,10)+" ";
+ }
+ else
+ {
+ resize_cmd =" -resize x"+QString::number(CustRes_height,10)+" ";
+ }
+ }
+ }
+ QString cmd = "\"" + program + "\" "+resize_cmd+" -delay " + QString::number(Duration, 10) + " -loop 0 \"" + ScaledFramesPath + "/*png\" \""+ResGifPath+"\"";
+ QProcess *AssembleGIF=new QProcess();
+ AssembleGIF->start(cmd);
+ while(!AssembleGIF->waitForStarted(100)&&!QProcess_stop) {}
+ while(!AssembleGIF->waitForFinished(100)&&!QProcess_stop) {}
+ //======= 纠正文件名称错误(当 结果gif文件路径内有 % 符号时) ======
+ if(QFile::exists(ResGifPath)==false)
+ {
+ QFileInfo fileinfo(ResGifPath);
+ QString file_name = file_getBaseName(ResGifPath);
+ QString file_ext = fileinfo.suffix();
+ QString file_path = file_getFolderPath(fileinfo);
+ QString ActualResGifPath = file_path + "/" + file_name + "-0." + file_ext;
+ if(QFile::exists(ActualResGifPath)==true)
+ {
+ QFile::rename(ActualResGifPath,ResGifPath);
+ }
+ }
+ if(QFile::exists(ResGifPath))
+ {
+ emit Send_TextBrowser_NewMessage(tr("Finish assembling GIF:[")+ResGifPath+"]");
+ return;
+ }
+ AssembleGIF->kill();
+ }
+ //自行调整图片大小再组装
+ if(CustRes_isEnabled || isOverScaled)
+ {
+ int New_width=0;
+ int New_height=0;
+ if(isOverScaled==true && CustRes_isEnabled==false)
+ {
+ QMap res_map = Image_Gif_Read_Resolution(SourceGifFullPath);
+ int OriginalScaleRatio = ui->doubleSpinBox_ScaleRatio_gif->value();
+ New_width = res_map["width"]*OriginalScaleRatio;
+ New_height = res_map["height"]*OriginalScaleRatio;
+ }
+ if(CustRes_isEnabled==true)
+ {
+ New_width = CustRes_width;
+ New_height = CustRes_height;
+ }
+ ImagesResize_Folder_MultiThread(New_width,New_height,ScaledFramesPath);
+ }
+ QString cmd = "\"" + program + "\" \"" + ScaledFramesPath + "/*png\" -delay " + QString::number(Duration, 10) + " -loop 0 \""+ResGifPath+"\"";
+ QProcess *AssembleGIF_1=new QProcess();
+ AssembleGIF_1->start(cmd);
+ while(!AssembleGIF_1->waitForStarted(100)&&!QProcess_stop) {}
+ while(!AssembleGIF_1->waitForFinished(100)&&!QProcess_stop) {}
+ //======= 纠正文件名称错误(当 结果gif文件路径内有 % 符号时) ======
+ if(QFile::exists(ResGifPath)==false)
+ {
+ QFileInfo fileinfo(ResGifPath);
+ QString file_name = file_getBaseName(ResGifPath);
+ QString file_ext = fileinfo.suffix();
+ QString file_path = file_getFolderPath(fileinfo);
+ QString ActualResGifPath = file_path + "/" + file_name + "-0." + file_ext;
+ if(QFile::exists(ActualResGifPath)==true)
+ {
+ QFile::rename(ActualResGifPath,ResGifPath);
+ }
+ }
+ //=====================
+ if(QFile::exists(ResGifPath))
+ {
+ emit Send_TextBrowser_NewMessage(tr("Finish assembling GIF:[")+ResGifPath+"]");
+ if(ui->checkBox_DisableResize_gif->isChecked()==false)emit Send_Set_checkBox_DisableResize_gif_Checked();
+ }
+ return;
+}
+/*
+压缩gif
+*/
+QString MainWindow::Gif_compressGif(QString gifPath,QString gifPath_compressd)
+{
+ emit Send_TextBrowser_NewMessage(tr("Starting to optimize GIF:[")+gifPath+"]");
+ //=====
+ QString program = Current_Path+"/gifsicle_waifu2xEX.exe";
+ QString cmd = "\"" + program + "\"" + " -O3 -i \""+gifPath+"\" -o \""+gifPath_compressd+"\"";
+ QProcess *CompressGIF=new QProcess();
+ CompressGIF->start(cmd);
+ while(!CompressGIF->waitForStarted(100)&&!QProcess_stop) {}
+ while(!CompressGIF->waitForFinished(100)&&!QProcess_stop) {}
+ //======
+ //判断是否生成压缩后的gif
+ if(QFile::exists(gifPath_compressd) == false)
+ {
+ emit Send_TextBrowser_NewMessage(tr("Error occured when processing [")+gifPath+tr("]. Error: [Can't optimize gif.]"));
+ return gifPath;//返回源文件路径
+ }
+ //======
+ //比较文件大小,判断压缩是否有效
+ QFileInfo *gifPath_QFileInfo = new QFileInfo(gifPath);
+ QFileInfo *gifPath_compressd_QFileInfo = new QFileInfo(gifPath_compressd);
+ if(gifPath_compressd_QFileInfo->size() >= gifPath_QFileInfo->size())
+ {
+ emit Send_TextBrowser_NewMessage(tr("Failed to optimize gif [")+gifPath+tr("] to reduce storage usage, the optimized gif file will be deleted."));
+ QFile::remove(gifPath_compressd);
+ return gifPath;//返回源文件路径
+ }
+ //======
+ QFile::remove(gifPath);
+ emit Send_TextBrowser_NewMessage(tr("Finish optimizing GIF:[")+gifPath+"]");
+ return gifPath_compressd;//返回处理完成的文件路径
+}
diff --git a/SRC/Waifu2x-Extension-QT/icon.qrc b/SRC_v3.41.01-beta/Waifu2x-Extension-QT/icon.qrc
similarity index 97%
rename from SRC/Waifu2x-Extension-QT/icon.qrc
rename to SRC_v3.41.01-beta/Waifu2x-Extension-QT/icon.qrc
index 967bbb5..555bf27 100644
--- a/SRC/Waifu2x-Extension-QT/icon.qrc
+++ b/SRC_v3.41.01-beta/Waifu2x-Extension-QT/icon.qrc
@@ -1,54 +1,54 @@
-
-
- icon/icon_main.png
- icon/Home.png
- icon/AddSetting.png
- icon/EngineSettings.png
- icon/VideoSettings.png
- icon/CompatibilityTest.png
- icon/pause-button.png
- icon/refresh.png
- icon/donateTabIcon_1.png
- icon/paypal.png
- icon/gif_Rmenu.png
- icon/picture_Rmenu.png
- icon/video_Rmenu.png
- icon/view_file.png
- icon/cancel.png
- icon/Apply.png
- icon/RemoveFile.png
- icon/opne_folder.png
- icon/Read_FileList.png
- icon/Save_FileList.png
- icon/Read_FileList_hover.png
- icon/Save_FileList_hover.png
- icon/RemoveItem.png
- icon/RemoveItem_hover.png
- icon/ClearList.png
- icon/ClearList_hover.png
- icon/AddNewFile.png
- icon/AddNewFile_hover.png
- icon/AddNewFile_disabled.png
- icon/RemoveItem_disabled.png
- icon/ClearList_disabled.png
- icon/Read_FileList_disabled.png
- icon/Save_FileList_disabled.png
- icon/ResizeFilesListSplitter.png
- icon/ResizeFilesListSplitter_disabled.png
- icon/ResizeFilesListSplitter_hover.png
- icon/TurnOffScreen.png
- icon/TurnOffScreen_disabled.png
- icon/TurnOffScreen_hover.png
- icon/Exit.png
- icon/SendFeedback.png
- icon/ShowWindow.png
- icon/Minimize.png
- icon/BackgroudMode.png
- icon/About.png
- icon/Pause_SysTray.png
- icon/Start_SysTray.png
- icon/patreon.png
- icon/patreon_sysTray.png
- icon/donateTabIcon.png
-
-
+
+
+ icon/icon_main.png
+ icon/Home.png
+ icon/AddSetting.png
+ icon/EngineSettings.png
+ icon/VideoSettings.png
+ icon/CompatibilityTest.png
+ icon/pause-button.png
+ icon/refresh.png
+ icon/donateTabIcon_1.png
+ icon/paypal.png
+ icon/gif_Rmenu.png
+ icon/picture_Rmenu.png
+ icon/video_Rmenu.png
+ icon/view_file.png
+ icon/cancel.png
+ icon/Apply.png
+ icon/RemoveFile.png
+ icon/opne_folder.png
+ icon/Read_FileList.png
+ icon/Save_FileList.png
+ icon/Read_FileList_hover.png
+ icon/Save_FileList_hover.png
+ icon/RemoveItem.png
+ icon/RemoveItem_hover.png
+ icon/ClearList.png
+ icon/ClearList_hover.png
+ icon/AddNewFile.png
+ icon/AddNewFile_hover.png
+ icon/AddNewFile_disabled.png
+ icon/RemoveItem_disabled.png
+ icon/ClearList_disabled.png
+ icon/Read_FileList_disabled.png
+ icon/Save_FileList_disabled.png
+ icon/ResizeFilesListSplitter.png
+ icon/ResizeFilesListSplitter_disabled.png
+ icon/ResizeFilesListSplitter_hover.png
+ icon/TurnOffScreen.png
+ icon/TurnOffScreen_disabled.png
+ icon/TurnOffScreen_hover.png
+ icon/Exit.png
+ icon/SendFeedback.png
+ icon/ShowWindow.png
+ icon/Minimize.png
+ icon/BackgroudMode.png
+ icon/About.png
+ icon/Pause_SysTray.png
+ icon/Start_SysTray.png
+ icon/patreon.png
+ icon/patreon_sysTray.png
+ icon/donateTabIcon.png
+
+
diff --git a/SRC/Waifu2x-Extension-QT/icon/About.png b/SRC_v3.41.01-beta/Waifu2x-Extension-QT/icon/About.png
similarity index 100%
rename from SRC/Waifu2x-Extension-QT/icon/About.png
rename to SRC_v3.41.01-beta/Waifu2x-Extension-QT/icon/About.png
diff --git a/SRC/Waifu2x-Extension-QT/icon/AddNewFile.png b/SRC_v3.41.01-beta/Waifu2x-Extension-QT/icon/AddNewFile.png
similarity index 100%
rename from SRC/Waifu2x-Extension-QT/icon/AddNewFile.png
rename to SRC_v3.41.01-beta/Waifu2x-Extension-QT/icon/AddNewFile.png
diff --git a/SRC/Waifu2x-Extension-QT/icon/AddNewFile_disabled.png b/SRC_v3.41.01-beta/Waifu2x-Extension-QT/icon/AddNewFile_disabled.png
similarity index 100%
rename from SRC/Waifu2x-Extension-QT/icon/AddNewFile_disabled.png
rename to SRC_v3.41.01-beta/Waifu2x-Extension-QT/icon/AddNewFile_disabled.png
diff --git a/SRC/Waifu2x-Extension-QT/icon/AddNewFile_hover.png b/SRC_v3.41.01-beta/Waifu2x-Extension-QT/icon/AddNewFile_hover.png
similarity index 100%
rename from SRC/Waifu2x-Extension-QT/icon/AddNewFile_hover.png
rename to SRC_v3.41.01-beta/Waifu2x-Extension-QT/icon/AddNewFile_hover.png
diff --git a/SRC/Waifu2x-Extension-QT/icon/AddSetting.png b/SRC_v3.41.01-beta/Waifu2x-Extension-QT/icon/AddSetting.png
similarity index 100%
rename from SRC/Waifu2x-Extension-QT/icon/AddSetting.png
rename to SRC_v3.41.01-beta/Waifu2x-Extension-QT/icon/AddSetting.png
diff --git a/SRC/Waifu2x-Extension-QT/icon/Apply.png b/SRC_v3.41.01-beta/Waifu2x-Extension-QT/icon/Apply.png
similarity index 100%
rename from SRC/Waifu2x-Extension-QT/icon/Apply.png
rename to SRC_v3.41.01-beta/Waifu2x-Extension-QT/icon/Apply.png
diff --git a/SRC/Waifu2x-Extension-QT/icon/BackgroudMode.png b/SRC_v3.41.01-beta/Waifu2x-Extension-QT/icon/BackgroudMode.png
similarity index 100%
rename from SRC/Waifu2x-Extension-QT/icon/BackgroudMode.png
rename to SRC_v3.41.01-beta/Waifu2x-Extension-QT/icon/BackgroudMode.png
diff --git a/SRC/Waifu2x-Extension-QT/icon/ClearList.png b/SRC_v3.41.01-beta/Waifu2x-Extension-QT/icon/ClearList.png
similarity index 100%
rename from SRC/Waifu2x-Extension-QT/icon/ClearList.png
rename to SRC_v3.41.01-beta/Waifu2x-Extension-QT/icon/ClearList.png
diff --git a/SRC/Waifu2x-Extension-QT/icon/ClearList_disabled.png b/SRC_v3.41.01-beta/Waifu2x-Extension-QT/icon/ClearList_disabled.png
similarity index 100%
rename from SRC/Waifu2x-Extension-QT/icon/ClearList_disabled.png
rename to SRC_v3.41.01-beta/Waifu2x-Extension-QT/icon/ClearList_disabled.png
diff --git a/SRC/Waifu2x-Extension-QT/icon/ClearList_hover.png b/SRC_v3.41.01-beta/Waifu2x-Extension-QT/icon/ClearList_hover.png
similarity index 100%
rename from SRC/Waifu2x-Extension-QT/icon/ClearList_hover.png
rename to SRC_v3.41.01-beta/Waifu2x-Extension-QT/icon/ClearList_hover.png
diff --git a/SRC/Waifu2x-Extension-QT/icon/CompatibilityTest.png b/SRC_v3.41.01-beta/Waifu2x-Extension-QT/icon/CompatibilityTest.png
similarity index 100%
rename from SRC/Waifu2x-Extension-QT/icon/CompatibilityTest.png
rename to SRC_v3.41.01-beta/Waifu2x-Extension-QT/icon/CompatibilityTest.png
diff --git a/SRC/Waifu2x-Extension-QT/icon/EngineSettings.png b/SRC_v3.41.01-beta/Waifu2x-Extension-QT/icon/EngineSettings.png
similarity index 100%
rename from SRC/Waifu2x-Extension-QT/icon/EngineSettings.png
rename to SRC_v3.41.01-beta/Waifu2x-Extension-QT/icon/EngineSettings.png
diff --git a/SRC/Waifu2x-Extension-QT/icon/Exit.png b/SRC_v3.41.01-beta/Waifu2x-Extension-QT/icon/Exit.png
similarity index 100%
rename from SRC/Waifu2x-Extension-QT/icon/Exit.png
rename to SRC_v3.41.01-beta/Waifu2x-Extension-QT/icon/Exit.png
diff --git a/SRC/Waifu2x-Extension-QT/icon/Home.png b/SRC_v3.41.01-beta/Waifu2x-Extension-QT/icon/Home.png
similarity index 100%
rename from SRC/Waifu2x-Extension-QT/icon/Home.png
rename to SRC_v3.41.01-beta/Waifu2x-Extension-QT/icon/Home.png
diff --git a/SRC/Waifu2x-Extension-QT/icon/Minimize.png b/SRC_v3.41.01-beta/Waifu2x-Extension-QT/icon/Minimize.png
similarity index 100%
rename from SRC/Waifu2x-Extension-QT/icon/Minimize.png
rename to SRC_v3.41.01-beta/Waifu2x-Extension-QT/icon/Minimize.png
diff --git a/SRC/Waifu2x-Extension-QT/icon/Pause_SysTray.png b/SRC_v3.41.01-beta/Waifu2x-Extension-QT/icon/Pause_SysTray.png
similarity index 100%
rename from SRC/Waifu2x-Extension-QT/icon/Pause_SysTray.png
rename to SRC_v3.41.01-beta/Waifu2x-Extension-QT/icon/Pause_SysTray.png
diff --git a/SRC/Waifu2x-Extension-QT/icon/Read_FileList.png b/SRC_v3.41.01-beta/Waifu2x-Extension-QT/icon/Read_FileList.png
similarity index 100%
rename from SRC/Waifu2x-Extension-QT/icon/Read_FileList.png
rename to SRC_v3.41.01-beta/Waifu2x-Extension-QT/icon/Read_FileList.png
diff --git a/SRC/Waifu2x-Extension-QT/icon/Read_FileList_disabled.png b/SRC_v3.41.01-beta/Waifu2x-Extension-QT/icon/Read_FileList_disabled.png
similarity index 100%
rename from SRC/Waifu2x-Extension-QT/icon/Read_FileList_disabled.png
rename to SRC_v3.41.01-beta/Waifu2x-Extension-QT/icon/Read_FileList_disabled.png
diff --git a/SRC/Waifu2x-Extension-QT/icon/Read_FileList_hover.png b/SRC_v3.41.01-beta/Waifu2x-Extension-QT/icon/Read_FileList_hover.png
similarity index 100%
rename from SRC/Waifu2x-Extension-QT/icon/Read_FileList_hover.png
rename to SRC_v3.41.01-beta/Waifu2x-Extension-QT/icon/Read_FileList_hover.png
diff --git a/SRC/Waifu2x-Extension-QT/icon/RemoveFile.png b/SRC_v3.41.01-beta/Waifu2x-Extension-QT/icon/RemoveFile.png
similarity index 100%
rename from SRC/Waifu2x-Extension-QT/icon/RemoveFile.png
rename to SRC_v3.41.01-beta/Waifu2x-Extension-QT/icon/RemoveFile.png
diff --git a/SRC/Waifu2x-Extension-QT/icon/RemoveItem.png b/SRC_v3.41.01-beta/Waifu2x-Extension-QT/icon/RemoveItem.png
similarity index 100%
rename from SRC/Waifu2x-Extension-QT/icon/RemoveItem.png
rename to SRC_v3.41.01-beta/Waifu2x-Extension-QT/icon/RemoveItem.png
diff --git a/SRC/Waifu2x-Extension-QT/icon/RemoveItem_disabled.png b/SRC_v3.41.01-beta/Waifu2x-Extension-QT/icon/RemoveItem_disabled.png
similarity index 100%
rename from SRC/Waifu2x-Extension-QT/icon/RemoveItem_disabled.png
rename to SRC_v3.41.01-beta/Waifu2x-Extension-QT/icon/RemoveItem_disabled.png
diff --git a/SRC/Waifu2x-Extension-QT/icon/RemoveItem_hover.png b/SRC_v3.41.01-beta/Waifu2x-Extension-QT/icon/RemoveItem_hover.png
similarity index 100%
rename from SRC/Waifu2x-Extension-QT/icon/RemoveItem_hover.png
rename to SRC_v3.41.01-beta/Waifu2x-Extension-QT/icon/RemoveItem_hover.png
diff --git a/SRC/Waifu2x-Extension-QT/icon/ResizeFilesListSplitter.png b/SRC_v3.41.01-beta/Waifu2x-Extension-QT/icon/ResizeFilesListSplitter.png
similarity index 100%
rename from SRC/Waifu2x-Extension-QT/icon/ResizeFilesListSplitter.png
rename to SRC_v3.41.01-beta/Waifu2x-Extension-QT/icon/ResizeFilesListSplitter.png
diff --git a/SRC/Waifu2x-Extension-QT/icon/ResizeFilesListSplitter_disabled.png b/SRC_v3.41.01-beta/Waifu2x-Extension-QT/icon/ResizeFilesListSplitter_disabled.png
similarity index 100%
rename from SRC/Waifu2x-Extension-QT/icon/ResizeFilesListSplitter_disabled.png
rename to SRC_v3.41.01-beta/Waifu2x-Extension-QT/icon/ResizeFilesListSplitter_disabled.png
diff --git a/SRC/Waifu2x-Extension-QT/icon/ResizeFilesListSplitter_hover.png b/SRC_v3.41.01-beta/Waifu2x-Extension-QT/icon/ResizeFilesListSplitter_hover.png
similarity index 100%
rename from SRC/Waifu2x-Extension-QT/icon/ResizeFilesListSplitter_hover.png
rename to SRC_v3.41.01-beta/Waifu2x-Extension-QT/icon/ResizeFilesListSplitter_hover.png
diff --git a/SRC/Waifu2x-Extension-QT/icon/Save_FileList.png b/SRC_v3.41.01-beta/Waifu2x-Extension-QT/icon/Save_FileList.png
similarity index 100%
rename from SRC/Waifu2x-Extension-QT/icon/Save_FileList.png
rename to SRC_v3.41.01-beta/Waifu2x-Extension-QT/icon/Save_FileList.png
diff --git a/SRC/Waifu2x-Extension-QT/icon/Save_FileList_disabled.png b/SRC_v3.41.01-beta/Waifu2x-Extension-QT/icon/Save_FileList_disabled.png
similarity index 100%
rename from SRC/Waifu2x-Extension-QT/icon/Save_FileList_disabled.png
rename to SRC_v3.41.01-beta/Waifu2x-Extension-QT/icon/Save_FileList_disabled.png
diff --git a/SRC/Waifu2x-Extension-QT/icon/Save_FileList_hover.png b/SRC_v3.41.01-beta/Waifu2x-Extension-QT/icon/Save_FileList_hover.png
similarity index 100%
rename from SRC/Waifu2x-Extension-QT/icon/Save_FileList_hover.png
rename to SRC_v3.41.01-beta/Waifu2x-Extension-QT/icon/Save_FileList_hover.png
diff --git a/SRC/Waifu2x-Extension-QT/icon/SendFeedback.png b/SRC_v3.41.01-beta/Waifu2x-Extension-QT/icon/SendFeedback.png
similarity index 100%
rename from SRC/Waifu2x-Extension-QT/icon/SendFeedback.png
rename to SRC_v3.41.01-beta/Waifu2x-Extension-QT/icon/SendFeedback.png
diff --git a/SRC/Waifu2x-Extension-QT/icon/ShowWindow.png b/SRC_v3.41.01-beta/Waifu2x-Extension-QT/icon/ShowWindow.png
similarity index 100%
rename from SRC/Waifu2x-Extension-QT/icon/ShowWindow.png
rename to SRC_v3.41.01-beta/Waifu2x-Extension-QT/icon/ShowWindow.png
diff --git a/SRC/Waifu2x-Extension-QT/icon/Start_SysTray.png b/SRC_v3.41.01-beta/Waifu2x-Extension-QT/icon/Start_SysTray.png
similarity index 100%
rename from SRC/Waifu2x-Extension-QT/icon/Start_SysTray.png
rename to SRC_v3.41.01-beta/Waifu2x-Extension-QT/icon/Start_SysTray.png
diff --git a/SRC/Waifu2x-Extension-QT/icon/TurnOffScreen.png b/SRC_v3.41.01-beta/Waifu2x-Extension-QT/icon/TurnOffScreen.png
similarity index 100%
rename from SRC/Waifu2x-Extension-QT/icon/TurnOffScreen.png
rename to SRC_v3.41.01-beta/Waifu2x-Extension-QT/icon/TurnOffScreen.png
diff --git a/SRC/Waifu2x-Extension-QT/icon/TurnOffScreen_disabled.png b/SRC_v3.41.01-beta/Waifu2x-Extension-QT/icon/TurnOffScreen_disabled.png
similarity index 100%
rename from SRC/Waifu2x-Extension-QT/icon/TurnOffScreen_disabled.png
rename to SRC_v3.41.01-beta/Waifu2x-Extension-QT/icon/TurnOffScreen_disabled.png
diff --git a/SRC/Waifu2x-Extension-QT/icon/TurnOffScreen_hover.png b/SRC_v3.41.01-beta/Waifu2x-Extension-QT/icon/TurnOffScreen_hover.png
similarity index 100%
rename from SRC/Waifu2x-Extension-QT/icon/TurnOffScreen_hover.png
rename to SRC_v3.41.01-beta/Waifu2x-Extension-QT/icon/TurnOffScreen_hover.png
diff --git a/SRC/Waifu2x-Extension-QT/icon/VideoSettings.png b/SRC_v3.41.01-beta/Waifu2x-Extension-QT/icon/VideoSettings.png
similarity index 100%
rename from SRC/Waifu2x-Extension-QT/icon/VideoSettings.png
rename to SRC_v3.41.01-beta/Waifu2x-Extension-QT/icon/VideoSettings.png
diff --git a/SRC/Waifu2x-Extension-QT/icon/cancel.png b/SRC_v3.41.01-beta/Waifu2x-Extension-QT/icon/cancel.png
similarity index 100%
rename from SRC/Waifu2x-Extension-QT/icon/cancel.png
rename to SRC_v3.41.01-beta/Waifu2x-Extension-QT/icon/cancel.png
diff --git a/SRC/Waifu2x-Extension-QT/icon/donateTabIcon.png b/SRC_v3.41.01-beta/Waifu2x-Extension-QT/icon/donateTabIcon.png
similarity index 100%
rename from SRC/Waifu2x-Extension-QT/icon/donateTabIcon.png
rename to SRC_v3.41.01-beta/Waifu2x-Extension-QT/icon/donateTabIcon.png
diff --git a/SRC/Waifu2x-Extension-QT/icon/donateTabIcon_1.png b/SRC_v3.41.01-beta/Waifu2x-Extension-QT/icon/donateTabIcon_1.png
similarity index 100%
rename from SRC/Waifu2x-Extension-QT/icon/donateTabIcon_1.png
rename to SRC_v3.41.01-beta/Waifu2x-Extension-QT/icon/donateTabIcon_1.png
diff --git a/SRC/Waifu2x-Extension-QT/icon/gif_Rmenu.png b/SRC_v3.41.01-beta/Waifu2x-Extension-QT/icon/gif_Rmenu.png
similarity index 100%
rename from SRC/Waifu2x-Extension-QT/icon/gif_Rmenu.png
rename to SRC_v3.41.01-beta/Waifu2x-Extension-QT/icon/gif_Rmenu.png
diff --git a/SRC/Waifu2x-Extension-QT/icon/icon.ico b/SRC_v3.41.01-beta/Waifu2x-Extension-QT/icon/icon.ico
similarity index 100%
rename from SRC/Waifu2x-Extension-QT/icon/icon.ico
rename to SRC_v3.41.01-beta/Waifu2x-Extension-QT/icon/icon.ico
diff --git a/SRC/Waifu2x-Extension-QT/icon/icon_main.png b/SRC_v3.41.01-beta/Waifu2x-Extension-QT/icon/icon_main.png
similarity index 100%
rename from SRC/Waifu2x-Extension-QT/icon/icon_main.png
rename to SRC_v3.41.01-beta/Waifu2x-Extension-QT/icon/icon_main.png
diff --git a/SRC/Waifu2x-Extension-QT/icon/opne_folder.png b/SRC_v3.41.01-beta/Waifu2x-Extension-QT/icon/opne_folder.png
similarity index 100%
rename from SRC/Waifu2x-Extension-QT/icon/opne_folder.png
rename to SRC_v3.41.01-beta/Waifu2x-Extension-QT/icon/opne_folder.png
diff --git a/SRC/Waifu2x-Extension-QT/icon/patreon.png b/SRC_v3.41.01-beta/Waifu2x-Extension-QT/icon/patreon.png
similarity index 100%
rename from SRC/Waifu2x-Extension-QT/icon/patreon.png
rename to SRC_v3.41.01-beta/Waifu2x-Extension-QT/icon/patreon.png
diff --git a/SRC/Waifu2x-Extension-QT/icon/patreon_sysTray.png b/SRC_v3.41.01-beta/Waifu2x-Extension-QT/icon/patreon_sysTray.png
similarity index 100%
rename from SRC/Waifu2x-Extension-QT/icon/patreon_sysTray.png
rename to SRC_v3.41.01-beta/Waifu2x-Extension-QT/icon/patreon_sysTray.png
diff --git a/SRC/Waifu2x-Extension-QT/icon/pause-button.png b/SRC_v3.41.01-beta/Waifu2x-Extension-QT/icon/pause-button.png
similarity index 100%
rename from SRC/Waifu2x-Extension-QT/icon/pause-button.png
rename to SRC_v3.41.01-beta/Waifu2x-Extension-QT/icon/pause-button.png
diff --git a/SRC/Waifu2x-Extension-QT/icon/paypal.png b/SRC_v3.41.01-beta/Waifu2x-Extension-QT/icon/paypal.png
similarity index 100%
rename from SRC/Waifu2x-Extension-QT/icon/paypal.png
rename to SRC_v3.41.01-beta/Waifu2x-Extension-QT/icon/paypal.png
diff --git a/SRC/Waifu2x-Extension-QT/icon/picture_Rmenu.png b/SRC_v3.41.01-beta/Waifu2x-Extension-QT/icon/picture_Rmenu.png
similarity index 100%
rename from SRC/Waifu2x-Extension-QT/icon/picture_Rmenu.png
rename to SRC_v3.41.01-beta/Waifu2x-Extension-QT/icon/picture_Rmenu.png
diff --git a/SRC/Waifu2x-Extension-QT/icon/refresh.png b/SRC_v3.41.01-beta/Waifu2x-Extension-QT/icon/refresh.png
similarity index 100%
rename from SRC/Waifu2x-Extension-QT/icon/refresh.png
rename to SRC_v3.41.01-beta/Waifu2x-Extension-QT/icon/refresh.png
diff --git a/SRC/Waifu2x-Extension-QT/icon/video_Rmenu.png b/SRC_v3.41.01-beta/Waifu2x-Extension-QT/icon/video_Rmenu.png
similarity index 100%
rename from SRC/Waifu2x-Extension-QT/icon/video_Rmenu.png
rename to SRC_v3.41.01-beta/Waifu2x-Extension-QT/icon/video_Rmenu.png
diff --git a/SRC/Waifu2x-Extension-QT/icon/view_file.png b/SRC_v3.41.01-beta/Waifu2x-Extension-QT/icon/view_file.png
similarity index 100%
rename from SRC/Waifu2x-Extension-QT/icon/view_file.png
rename to SRC_v3.41.01-beta/Waifu2x-Extension-QT/icon/view_file.png
diff --git a/SRC/Waifu2x-Extension-QT/image.cpp b/SRC_v3.41.01-beta/Waifu2x-Extension-QT/image.cpp
similarity index 100%
rename from SRC/Waifu2x-Extension-QT/image.cpp
rename to SRC_v3.41.01-beta/Waifu2x-Extension-QT/image.cpp
diff --git a/SRC/Waifu2x-Extension-QT/language_Chinese.qm b/SRC_v3.41.01-beta/Waifu2x-Extension-QT/language_Chinese.qm
similarity index 100%
rename from SRC/Waifu2x-Extension-QT/language_Chinese.qm
rename to SRC_v3.41.01-beta/Waifu2x-Extension-QT/language_Chinese.qm
diff --git a/SRC/Waifu2x-Extension-QT/language_Chinese.ts b/SRC_v3.41.01-beta/Waifu2x-Extension-QT/language_Chinese.ts
similarity index 100%
rename from SRC/Waifu2x-Extension-QT/language_Chinese.ts
rename to SRC_v3.41.01-beta/Waifu2x-Extension-QT/language_Chinese.ts
diff --git a/SRC/Waifu2x-Extension-QT/language_English.qm b/SRC_v3.41.01-beta/Waifu2x-Extension-QT/language_English.qm
similarity index 100%
rename from SRC/Waifu2x-Extension-QT/language_English.qm
rename to SRC_v3.41.01-beta/Waifu2x-Extension-QT/language_English.qm
diff --git a/SRC/Waifu2x-Extension-QT/language_English.ts b/SRC_v3.41.01-beta/Waifu2x-Extension-QT/language_English.ts
similarity index 100%
rename from SRC/Waifu2x-Extension-QT/language_English.ts
rename to SRC_v3.41.01-beta/Waifu2x-Extension-QT/language_English.ts
diff --git a/SRC/Waifu2x-Extension-QT/language_TraditionalChinese.qm b/SRC_v3.41.01-beta/Waifu2x-Extension-QT/language_TraditionalChinese.qm
similarity index 100%
rename from SRC/Waifu2x-Extension-QT/language_TraditionalChinese.qm
rename to SRC_v3.41.01-beta/Waifu2x-Extension-QT/language_TraditionalChinese.qm
diff --git a/SRC/Waifu2x-Extension-QT/language_TraditionalChinese.ts b/SRC_v3.41.01-beta/Waifu2x-Extension-QT/language_TraditionalChinese.ts
similarity index 100%
rename from SRC/Waifu2x-Extension-QT/language_TraditionalChinese.ts
rename to SRC_v3.41.01-beta/Waifu2x-Extension-QT/language_TraditionalChinese.ts
diff --git a/SRC/Waifu2x-Extension-QT/main.cpp b/SRC_v3.41.01-beta/Waifu2x-Extension-QT/main.cpp
similarity index 97%
rename from SRC/Waifu2x-Extension-QT/main.cpp
rename to SRC_v3.41.01-beta/Waifu2x-Extension-QT/main.cpp
index ed4f1eb..ffd8e1c 100644
--- a/SRC/Waifu2x-Extension-QT/main.cpp
+++ b/SRC_v3.41.01-beta/Waifu2x-Extension-QT/main.cpp
@@ -1,85 +1,85 @@
-/*
- Copyright (C) 2021 Aaron Feng
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU Affero General Public License as published
- by the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU Affero General Public License for more details.
-
- You should have received a copy of the GNU Affero General Public License
- along with this program. If not, see .
-
- My Github homepage: https://github.com/AaronFeng753
-*/
-
-#include "mainwindow.h"
-
-#include
-
-int main(int argc, char *argv[])
-{
- QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);//高分辨率屏幕支持
- QApplication a(argc,argv);
- a.setQuitOnLastWindowClosed(false);//隐藏无窗口时保持运行
- MainWindow *w = new MainWindow;
- w->show();
- return a.exec();
-}
-
-/*
-Change log:
-
-****************** 补全中文翻译 ***********************
-
-v3.41.02-beta:
-- Fix bug: Unable to assemble APNG when there are "%" in the path.
-
-v3.41.01-beta:
-- New Feature: APNG(Animated PNG) support.
-- Improve GUI.
-- Some other improvements.
-
-v3.31.21-beta:
-- Performance optimization.
-- Update FFmpeg, ImageMagick.
-- Some other improvements.
-
---------------------------------------------------------------------------
-To do:
-- APNG插件兼容性测试
-- 找一个性能更好的apng组装插件(试试ffmpeg)
-- 添加对"图片文件夹"的支持,一次处理一个文件夹.
-- 改进自动调整引擎设定
-- 插帧时避免黑帧混乱,避免转场混乱 (插帧后的帧编号 = N*2-1)
-- 自动将GIF转换为mp4
-- 在SRMD和REALSR正式加入cpu支持后, 在GPU ID tooltip上添加[★ "-1" is CPU,others are GPUs ★]
-- CRF参数调整支持
-- 自动监控文件夹
----------------------------------------------------------------------------
-Integrated component:
-- gifsicle version 1.92
-- SoX 14.4.2-win32
-- waifu2x-caffe 1.2.0.4
-- Waifu2x-converter 9e0284ae23d43c990efb6320253ff0f1e3776854
-- Waifu2x-NCNN-Vulkan 20210210
-- SRMD-NCNN-Vulkan 20210210
-- RealSR-NCNN-Vulkan 20210210
-- ImageMagick 7.0.11-8-portable-Q16-x64
-- Anime4KCPP v2.5.0
-- FFmpeg 2021-04-20-git-718e03e5f2-full_build
-- NirCmd v2.86
-- Ghostscript 9.53.3
-- GNU Wget 1.20.3
-- rife-ncnn-vulkan 20210227
-- cain-ncnn-vulkan 20210210
----------------------------------------------------------------------------
-Icons made by :
-Freepik (https://www.flaticon.com/authors/freepik) From Flaticon : https://www.flaticon.com/
-Roundicons (https://www.flaticon.com/authors/roundicons) From Flaticon : https://www.flaticon.com/
-Icongeek26 (https://www.flaticon.com/authors/Icongeek26) From Flaticon : https://www.flaticon.com/
-*/
+/*
+ Copyright (C) 2021 Aaron Feng
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published
+ by the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see .
+
+ My Github homepage: https://github.com/AaronFeng753
+*/
+
+#include "mainwindow.h"
+
+#include
+
+int main(int argc, char *argv[])
+{
+ QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);//高分辨率屏幕支持
+ QApplication a(argc,argv);
+ a.setQuitOnLastWindowClosed(false);//隐藏无窗口时保持运行
+ MainWindow *w = new MainWindow;
+ w->show();
+ return a.exec();
+}
+
+/*
+Change log:
+
+****************** 补全中文翻译 ***********************
+
+v3.41.02-beta:
+- Fix bug: Unable to assemble APNG when there are "%" in the path.
+
+v3.41.01-beta:
+- New Feature: APNG(Animated PNG) support.
+- Improve GUI.
+- Some other improvements.
+
+v3.31.21-beta:
+- Performance optimization.
+- Update FFmpeg, ImageMagick.
+- Some other improvements.
+
+--------------------------------------------------------------------------
+To do:
+- APNG插件兼容性测试
+- 找一个性能更好的apng组装插件(试试ffmpeg)
+- 添加对"图片文件夹"的支持,一次处理一个文件夹.
+- 改进自动调整引擎设定
+- 插帧时避免黑帧混乱,避免转场混乱 (插帧后的帧编号 = N*2-1)
+- 自动将GIF转换为mp4
+- 在SRMD和REALSR正式加入cpu支持后, 在GPU ID tooltip上添加[★ "-1" is CPU,others are GPUs ★]
+- CRF参数调整支持
+- 自动监控文件夹
+---------------------------------------------------------------------------
+Integrated component:
+- gifsicle version 1.92
+- SoX 14.4.2-win32
+- waifu2x-caffe 1.2.0.4
+- Waifu2x-converter 9e0284ae23d43c990efb6320253ff0f1e3776854
+- Waifu2x-NCNN-Vulkan 20210210
+- SRMD-NCNN-Vulkan 20210210
+- RealSR-NCNN-Vulkan 20210210
+- ImageMagick 7.0.11-8-portable-Q16-x64
+- Anime4KCPP v2.5.0
+- FFmpeg 2021-04-20-git-718e03e5f2-full_build
+- NirCmd v2.86
+- Ghostscript 9.53.3
+- GNU Wget 1.20.3
+- rife-ncnn-vulkan 20210227
+- cain-ncnn-vulkan 20210210
+---------------------------------------------------------------------------
+Icons made by :
+Freepik (https://www.flaticon.com/authors/freepik) From Flaticon : https://www.flaticon.com/
+Roundicons (https://www.flaticon.com/authors/roundicons) From Flaticon : https://www.flaticon.com/
+Icongeek26 (https://www.flaticon.com/authors/Icongeek26) From Flaticon : https://www.flaticon.com/
+*/
diff --git a/SRC/Waifu2x-Extension-QT/mainwindow.cpp b/SRC_v3.41.01-beta/Waifu2x-Extension-QT/mainwindow.cpp
similarity index 97%
rename from SRC/Waifu2x-Extension-QT/mainwindow.cpp
rename to SRC_v3.41.01-beta/Waifu2x-Extension-QT/mainwindow.cpp
index acf87d8..4057788 100644
--- a/SRC/Waifu2x-Extension-QT/mainwindow.cpp
+++ b/SRC_v3.41.01-beta/Waifu2x-Extension-QT/mainwindow.cpp
@@ -1,2112 +1,2112 @@
-/*
- Copyright (C) 2021 Aaron Feng
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU Affero General Public License as published
- by the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU Affero General Public License for more details.
-
- You should have received a copy of the GNU Affero General Public License
- along with this program. If not, see .
-
- My Github homepage: https://github.com/AaronFeng753
-*/
-
-#include "mainwindow.h"
-#include "ui_mainwindow.h"
-
-MainWindow::MainWindow(QWidget *parent)
- : QMainWindow(parent)
- , ui(new Ui::MainWindow)
-{
- ui->setupUi(this);
- qRegisterMetaTypeStreamOperators("QList_QMap_QStrQStr");
- QThreadPool::globalInstance()->setMaxThreadCount(60);//解除全局线程池的最大线程数量限制
- //==============
- this->setWindowTitle("Waifu2x-Extension-GUI "+VERSION+" by Aaron Feng");
- //==============
- translator = new QTranslator(this);
- //==============
- ui->tabWidget->setCurrentIndex(1);//显示home tab
- ui->tabWidget->tabBar()->setTabTextColor(0,Qt::red);
- on_tabWidget_currentChanged(1);
- ui->tabWidget_Engines->setCurrentIndex(0);
- this->setAcceptDrops(true);//mainwindow接收drop
- Init_Table();//初始化table
- ui->groupBox_CurrentFile->setVisible(0);//隐藏当前文件进度
- pushButton_Stop_setEnabled_self(0);//禁用隐藏暂停按钮
- ui->pushButton_ForceRetry->setVisible(0);
- ui->progressBar_CompatibilityTest->setVisible(0);
- //=================== 初始隐藏所有table和禁用按钮 ======================
- ui->tableView_image->setVisible(0);
- ui->tableView_gif->setVisible(0);
- ui->tableView_video->setVisible(0);
- Table_FileCount_reload();//重载文件列表下的文件数量统计
- //==============
- Init_ActionsMenu_checkBox_ReplaceOriginalFile();//第一次初始化[替换原文件]的右键菜单(需要在载入设定前设置为checkable
- Init_ActionsMenu_checkBox_DelOriginal();
- //=========安装事件过滤器==========
- ui->tableView_image->installEventFilter(this);
- ui->tableView_gif->installEventFilter(this);
- ui->tableView_video->installEventFilter(this);
- //===========================================
- connect(this, SIGNAL(Send_Set_checkBox_DisableResize_gif_Checked()), this, SLOT(Set_checkBox_DisableResize_gif_Checked()));
- connect(this, SIGNAL(Send_Table_EnableSorting(bool)), this, SLOT(Table_EnableSorting(bool)));
- connect(this, SIGNAL(Send_Add_progressBar_CompatibilityTest()), this, SLOT(Add_progressBar_CompatibilityTest()));
- connect(this, SIGNAL(Send_Unable2Connect_RawGithubusercontentCom()), this, SLOT(Unable2Connect_RawGithubusercontentCom()));
- connect(this, SIGNAL(Send_SetEnable_pushButton_ForceRetry_self()), this, SLOT(SetEnable_pushButton_ForceRetry_self()));
- connect(this, SIGNAL(Send_SystemTray_NewMessage(QString)), this, SLOT(SystemTray_NewMessage(QString)));
- connect(this, SIGNAL(Send_PrograssBar_Range_min_max(int, int)), this, SLOT(progressbar_setRange_min_max(int, int)));
- connect(this, SIGNAL(Send_progressbar_Add()), this, SLOT(progressbar_Add()));
- connect(this, SIGNAL(Send_Table_image_ChangeStatus_rowNumInt_statusQString(int, QString)), this, SLOT(Table_image_ChangeStatus_rowNumInt_statusQString(int, QString)));
- connect(this, SIGNAL(Send_Table_gif_ChangeStatus_rowNumInt_statusQString(int, QString)), this, SLOT(Table_gif_ChangeStatus_rowNumInt_statusQString(int, QString)));
- connect(this, SIGNAL(Send_Table_video_ChangeStatus_rowNumInt_statusQString(int, QString)), this, SLOT(Table_video_ChangeStatus_rowNumInt_statusQString(int, QString)));
- connect(this, SIGNAL(Send_Table_FileCount_reload()), this, SLOT(Table_FileCount_reload()));
- connect(this, SIGNAL(Send_Table_image_insert_fileName_fullPath(QString,QString)), this, SLOT(Table_image_insert_fileName_fullPath(QString,QString)));
- connect(this, SIGNAL(Send_Table_gif_insert_fileName_fullPath(QString,QString)), this, SLOT(Table_gif_insert_fileName_fullPath(QString,QString)));
- connect(this, SIGNAL(Send_Table_video_insert_fileName_fullPath(QString,QString)), this, SLOT(Table_video_insert_fileName_fullPath(QString,QString)));
- connect(this, SIGNAL(Send_Table_image_CustRes_rowNumInt_HeightQString_WidthQString(int,QString,QString)), this, SLOT(Table_image_CustRes_rowNumInt_HeightQString_WidthQString(int,QString,QString)));
- connect(this, SIGNAL(Send_Table_gif_CustRes_rowNumInt_HeightQString_WidthQString(int,QString,QString)), this, SLOT(Table_gif_CustRes_rowNumInt_HeightQString_WidthQString(int,QString,QString)));
- connect(this, SIGNAL(Send_Table_video_CustRes_rowNumInt_HeightQString_WidthQString(int,QString,QString)), this, SLOT(Table_video_CustRes_rowNumInt_HeightQString_WidthQString(int,QString,QString)));
- connect(this, SIGNAL(Send_Table_Read_Saved_Table_Filelist_Finished(QString)), this, SLOT(Table_Read_Saved_Table_Filelist_Finished(QString)));
- connect(this, SIGNAL(Send_Table_Save_Current_Table_Filelist_Finished()), this, SLOT(Table_Save_Current_Table_Filelist_Finished()));
- connect(this, SIGNAL(Send_Waifu2x_Finished()), this, SLOT(Waifu2x_Finished()));
- connect(this, SIGNAL(Send_Waifu2x_Finished_manual()), this, SLOT(Waifu2x_Finished_manual()));
- connect(this, SIGNAL(Send_TextBrowser_NewMessage(QString)), this, SLOT(TextBrowser_NewMessage(QString)));
- connect(this, SIGNAL(Send_Waifu2x_Compatibility_Test_finished()), this, SLOT(Waifu2x_Compatibility_Test_finished()));
- connect(this, SIGNAL(Send_Waifu2x_DetectGPU_finished()), this, SLOT(Waifu2x_DetectGPU_finished()));
- connect(this, SIGNAL(Send_Realsr_ncnn_vulkan_DetectGPU_finished()), this, SLOT(Realsr_ncnn_vulkan_DetectGPU_finished()));
- connect(this, SIGNAL(Send_CheckUpadte_NewUpdate(QString,QString)), this, SLOT(CheckUpadte_NewUpdate(QString,QString)));
- connect(this, SIGNAL(Send_SystemShutDown()), this, SLOT(SystemShutDown()));
- connect(this, SIGNAL(Send_Waifu2x_DumpProcessorList_converter_finished()), this, SLOT(Waifu2x_DumpProcessorList_converter_finished()));
- connect(this, SIGNAL(Send_Read_urls_finfished()), this, SLOT(Read_urls_finfished()));
- connect(this, SIGNAL(Send_FinishedProcessing_DN()), this, SLOT(FinishedProcessing_DN()));
- connect(this, SIGNAL(Send_SRMD_DetectGPU_finished()), this, SLOT(SRMD_DetectGPU_finished()));
- connect(this, SIGNAL(Send_FrameInterpolation_DetectGPU_finished()), this, SLOT(FrameInterpolation_DetectGPU_finished()));
- connect(this, SIGNAL(Send_video_write_VideoConfiguration(QString,int,int,bool,int,int,QString,bool,QString,QString,bool,int)), this, SLOT(video_write_VideoConfiguration(QString,int,int,bool,int,int,QString,bool,QString,QString,bool,int)));
- connect(this, SIGNAL(Send_Settings_Save()), this, SLOT(Settings_Save()));
- connect(this, SIGNAL(Send_video_write_Progress_ProcessBySegment(QString,int,bool,bool,int,int)), this, SLOT(video_write_Progress_ProcessBySegment(QString,int,bool,bool,int,int)));
- connect(this, SIGNAL(Send_Donate_ReplaceQRCode(QString)), this, SLOT(Donate_ReplaceQRCode(QString)));
- connect(this, SIGNAL(Send_CurrentFileProgress_Start(QString,int)), this, SLOT(CurrentFileProgress_Start(QString,int)));
- connect(this, SIGNAL(Send_CurrentFileProgress_Stop()), this, SLOT(CurrentFileProgress_Stop()));
- connect(this, SIGNAL(Send_CurrentFileProgress_progressbar_Add()), this, SLOT(CurrentFileProgress_progressbar_Add()));
- connect(this, SIGNAL(Send_CurrentFileProgress_progressbar_Add_SegmentDuration(int)), this, SLOT(CurrentFileProgress_progressbar_Add_SegmentDuration(int)));
- connect(this, SIGNAL(Send_CurrentFileProgress_progressbar_SetFinishedValue(int)), this, SLOT(CurrentFileProgress_progressbar_SetFinishedValue(int)));
- //======
- TimeCostTimer = new QTimer();
- connect(TimeCostTimer, SIGNAL(timeout()), this, SLOT(TimeSlot()));
- //==================================================
- Settings_Read_Apply();//读取与应用设置
- //=====================================
- Set_Font_fixed();//固定字体
- //=====================================
- QtConcurrent::run(this, &MainWindow::DeleteErrorLog_Waifu2xCaffe);//删除Waifu2xCaffe生成的错误日志
- QtConcurrent::run(this, &MainWindow::Del_TempBatFile);//删除bat文件缓存
- AutoUpdate = QtConcurrent::run(this, &MainWindow::CheckUpadte_Auto);//自动检查更新线程
- DownloadOnlineQRCode = QtConcurrent::run(this, &MainWindow::Donate_DownloadOnlineQRCode);//在线更新捐赠二维码
- SystemShutDown_isAutoShutDown();//上次是否自动关机
- //====================================
- TextBrowser_StartMes();//显示启动msg
- //===================================
- Tip_FirstTimeStart();//首次启动
- file_mkDir(Current_Path+"/FilesList_W2xEX");//生成保存文件列表的文件夹
- //==============
- /*
- 校验软件是否对所在目录有写权限
- */
- if(file_isDirWritable(Current_Path)==false)
- {
- QMessageBox Msg(QMessageBox::Question, QString(tr("Error")), QString(tr("It is detected that this software lacks the necessary permissions to run."
- "\n\nPlease close this software and start this software again after giving this software administrator permission. "
- "Or reinstall the software into a directory that can run normally without administrator rights.\n\nOtherwise, this software may not work properly.")));
- Msg.setIcon(QMessageBox::Warning);
- Msg.addButton(QString("OK"), QMessageBox::NoRole);
- Msg.exec();
- }
- //==============
- Init_SystemTrayIcon();//初始化托盘图标
- Init_ActionsMenu_lineEdit_outputPath();//初始化 输出路径 lineEDIT的右键菜单
- Init_ActionsMenu_FilesList();
- Init_ActionsMenu_pushButton_RemoveItem();
- Init_ActionsMenu_checkBox_ReplaceOriginalFile();//第二次初始化[替换原文件]的右键菜单(载入语言设置
- Init_ActionsMenu_checkBox_DelOriginal();
- //==============
- this->showNormal();
- this->activateWindow();
- this->setWindowState((this->windowState() & ~Qt::WindowMinimized) | Qt::WindowActive);
- this->adjustSize();
-}
-
-MainWindow::~MainWindow()
-{
- delete ui;
-}
-
-void MainWindow::closeEvent(QCloseEvent *event)
-{
- if(isAlreadyClosed)//解决QT退出时重复调用closeEvent的问题
- {
- event->accept();
- return;
- }
- //=============== 询问是否退出 =======================
- if(ui->checkBox_PromptWhenExit->isChecked())
- {
- QMessageBox Msg(QMessageBox::Question, QString(tr("Notification")), QString(tr("Do you really wanna exit Waifu2x-Extension-GUI ?")));
- Msg.setIcon(QMessageBox::Question);
- QAbstractButton *pYesBtn = Msg.addButton(QString(tr("YES")), QMessageBox::YesRole);
- QAbstractButton *pNoBtn = Msg.addButton(QString(tr("NO")), QMessageBox::NoRole);
- Msg.exec();
- if (Msg.clickedButton() == pNoBtn)
- {
- event->ignore();
- return;
- }
- if (Msg.clickedButton() == pYesBtn)isAlreadyClosed=true;
- }
- //=============================
- systemTray->hide();
- this->hide();
- QApplication::setQuitOnLastWindowClosed(true);//無窗口時不再保持運行
- QApplication::closeAllWindows();
- //====
- if(Waifu2xMain.isRunning() == true)
- {
- TimeCostTimer->stop();
- pushButton_Stop_setEnabled_self(0);//隐藏stop button
- waifu2x_STOP = true;
- emit TextBrowser_NewMessage(tr("Trying to stop, please wait..."));
- //======
- QMessageBox *MSG_2 = new QMessageBox();
- MSG_2->setWindowTitle(tr("Notification")+" @Waifu2x-Extension-GUI");
- MSG_2->setText(tr("Waiting for the files processing thread to pause"));
- MSG_2->setIcon(QMessageBox::Information);
- MSG_2->setModal(true);
- MSG_2->setStandardButtons(NULL);
- MSG_2->setWindowFlags(Qt::CustomizeWindowHint | Qt::WindowTitleHint);
- MSG_2->show();
- }
- else
- {
- QMessageBox *MSG_2 = new QMessageBox();
- MSG_2->setWindowTitle(tr("Notification")+" @Waifu2x-Extension-GUI");
- MSG_2->setText(tr("Closing...\n\nPlease wait"));
- MSG_2->setIcon(QMessageBox::Information);
- MSG_2->setModal(true);
- MSG_2->setStandardButtons(NULL);
- MSG_2->setWindowFlags(Qt::CustomizeWindowHint | Qt::WindowTitleHint);
- MSG_2->show();
- }
- AutoUpdate.cancel();
- DownloadOnlineQRCode.cancel();
- //=====
- bool AutoSaveSettings = ui->checkBox_AutoSaveSettings->isChecked();
- if(AutoSaveSettings&&(!Settings_isReseted))
- {
- Settings_Save();
- QtConcurrent::run(this, &MainWindow::Auto_Save_Settings_Watchdog,true);
- }
- else
- {
- QtConcurrent::run(this, &MainWindow::Auto_Save_Settings_Watchdog,false);
- }
-}
-
-int MainWindow::Auto_Save_Settings_Watchdog(bool isWaitForSave)
-{
- Waifu2xMain.waitForFinished();
- //======
- if(isWaitForSave == true)
- {
- Delay_msec_sleep(1000);
- QString settings_ini = Current_Path+"/settings.ini";
- while(!QFile::exists(settings_ini))
- {
- Delay_msec_sleep(250);
- }
- Delay_msec_sleep(3000);
- }
- //=====
- Force_close();
- //====
- return 0;
-}
-
-int MainWindow::Force_close()
-{
- //=============
- QStringList TaskNameList;
- TaskNameList << "convert_waifu2xEX.exe"<<"ffmpeg_waifu2xEX.exe"<<"ffprobe_waifu2xEX.exe"<<"identify_waifu2xEX.exe"<<"gifsicle_waifu2xEX.exe"<<"waifu2x-ncnn-vulkan_waifu2xEX.exe"
- <<"waifu2x-ncnn-vulkan-fp16p_waifu2xEX.exe"<<"Anime4K_waifu2xEX.exe"<<"waifu2x-caffe_waifu2xEX.exe"<<"srmd-ncnn-vulkan_waifu2xEX.exe"<<"realsr-ncnn-vulkan_waifu2xEX.exe"
- <<"waifu2x-converter-cpp_waifu2xEX.exe"<<"sox_waifu2xEX.exe"<<"wget_waifu2xEX.exe"<<"rife-ncnn-vulkan_waifu2xEX.exe"<<"cain-ncnn-vulkan_waifu2xEX.exe"<<"dain-ncnn-vulkan_waifu2xEX.exe"
- <<"srmd-cuda_waifu2xEX.exe"<<"apngdis_waifu2xEX.exe"<<"apngasm_waifu2xEX.exe";
- KILL_TASK_QStringList(TaskNameList,true);
- //===========
- QProcess Close;
- Close.start("taskkill /f /t /fi \"imagename eq Waifu2x-Extension-GUI.exe\"");
- Close.waitForStarted(10000);
- Close.waitForFinished(10000);
- return 0;
-}
-/*
-最小化
-*/
-void MainWindow::changeEvent(QEvent *e)
-{
- if((e->type()==QEvent::WindowStateChange)&&this->isMinimized())
- {
- if(ui->checkBox_MinimizeToTaskbar->isChecked())
- {
- this->hide();
- }
- }
-}
-/*
-计时器到时执行的代码
-*/
-void MainWindow::TimeSlot()
-{
- TimeCost++;
- //====================总进度==================
- QString TimeCostStr = tr("Time taken:[")+Seconds2hms(TimeCost)+"]";
- ui->label_TimeCost->setText(TimeCostStr);
- if(ui->label_TimeRemain->isVisible())
- {
- long unsigned int TaskNumFinished_tmp = TaskNumFinished;
- long unsigned int TimeCost_tmp = TimeCost;
- long unsigned int TaskNumTotal_tmp = TaskNumTotal;
- if(TaskNumFinished_tmp>0&&TimeCost_tmp>0&&TaskNumTotal_tmp>0)
- {
- if(NewTaskFinished)
- {
- NewTaskFinished=false;
- double avgTimeCost = (double)TimeCost_tmp/(double)TaskNumFinished_tmp;
- ETA = avgTimeCost*((double)TaskNumTotal_tmp-(double)TaskNumFinished_tmp);
- }
- else
- {
- if(ETA>1)
- {
- ETA--;
- }
- }
- QString TimeRemainingStr = tr("Time remaining:[")+Seconds2hms(ETA)+"]";
- ui->label_TimeRemain->setText(TimeRemainingStr);
- QDateTime time = QDateTime::currentDateTime();
- long unsigned int Time_t = time.toTime_t();
- Time_t+=ETA;
- time = QDateTime::fromTime_t(Time_t);
- QString Current_Time = time.toString("hh:mm:ss");
- QString ETA_str = "ETA:["+Current_Time+"]";
- ui->label_ETA->setText(ETA_str);
- }
- }
- //====================当前文件=================
- if(isStart_CurrentFile)
- {
- TimeCost_CurrentFile++;
- QString TimeCostStr_CurrentFile = tr("Time taken:[")+Seconds2hms(TimeCost_CurrentFile)+"]";
- ui->label_TimeCost_CurrentFile->setText(TimeCostStr_CurrentFile);
- long unsigned int TaskNumFinished_tmp_CurrentFile = TaskNumFinished_CurrentFile;
- long unsigned int TimeCost_tmp_CurrentFile = TimeCost_CurrentFile;
- long unsigned int TaskNumTotal_tmp_CurrentFile = TaskNumTotal_CurrentFile;
- if(TaskNumFinished_tmp_CurrentFile>0&&TimeCost_tmp_CurrentFile>0&&TaskNumTotal_tmp_CurrentFile>0)
- {
- if(NewTaskFinished_CurrentFile)
- {
- NewTaskFinished_CurrentFile=false;
- double avgTimeCost_CurrentFile = (double)TimeCost_tmp_CurrentFile/(double)TaskNumFinished_tmp_CurrentFile;
- ETA_CurrentFile = avgTimeCost_CurrentFile*((double)TaskNumTotal_tmp_CurrentFile-(double)TaskNumFinished_tmp_CurrentFile);
- }
- else
- {
- if(ETA_CurrentFile>1)
- {
- ETA_CurrentFile--;
- }
- }
- QString TimeRemainingStr_CurrentFile = tr("Time remaining:[")+Seconds2hms(ETA_CurrentFile)+"]";
- ui->label_TimeRemain_CurrentFile->setText(TimeRemainingStr_CurrentFile);
- QDateTime time_CurrentFile = QDateTime::currentDateTime();
- long unsigned int Time_t_CurrentFile = time_CurrentFile.toTime_t();
- Time_t_CurrentFile+=ETA_CurrentFile;
- time_CurrentFile = QDateTime::fromTime_t(Time_t_CurrentFile);
- QString Current_Time_CurrentFile = time_CurrentFile.toString("hh:mm:ss");
- QString ETA_str_CurrentFile = "ETA:["+Current_Time_CurrentFile+"]";
- ui->label_ETA_CurrentFile->setText(ETA_str_CurrentFile);
- }
- }
-}
-QString MainWindow::Seconds2hms(long unsigned int seconds)
-{
- if(seconds<=0)return "0:0:0";
- long unsigned int hour = seconds / 3600;
- long unsigned int min = (seconds-(hour*3600))/60;
- long unsigned int sec = seconds - hour*3600 - min*60;
- return QString::number(hour,10)+":"+QString::number(min,10)+":"+QString::number(sec,10);
-}
-
-void MainWindow::Set_Font_fixed()
-{
- QFont font;
- if(ui->checkBox_isCustFontEnable->isChecked())
- {
- font = ui->fontComboBox_CustFont->currentFont();
- font.setPixelSize(ui->spinBox_GlobalFontSize->value());
- }
- else
- {
- font = qApp->font();
- font.setPixelSize(15);
- }
- qApp->setFont(font);
-}
-
-void MainWindow::on_pushButton_ClearList_clicked()
-{
- curRow_image = -1;
- curRow_gif = -1;
- curRow_video = -1;
- Table_Clear();
- Custom_resolution_list.clear();
- ui->label_DropFile->setVisible(1);
- ui->tableView_gif->setVisible(0);
- ui->tableView_image->setVisible(0);
- ui->tableView_video->setVisible(0);
- Table_FileCount_reload();
- progressbar_clear();
-}
-
-/*
-停止处理键
-*/
-void MainWindow::on_pushButton_Stop_clicked()
-{
- if(Waifu2xMain.isRunning()==false)return;
- TimeCostTimer->stop();
- pushButton_Stop_setEnabled_self(0);//隐藏stop button
- waifu2x_STOP = true;
- emit TextBrowser_NewMessage(tr("Trying to stop, please wait..."));
- QtConcurrent::run(this, &MainWindow::Wait_waifu2x_stop);
-}
-/*
-等待处理线程完全停止
-*/
-void MainWindow::Wait_waifu2x_stop()
-{
- while(true)
- {
- if(waifu2x_STOP_confirm||ThreadNumRunning==0)
- {
- waifu2x_STOP_confirm = false;
- Waifu2xMain.waitForFinished();
- while(true)
- {
- if(Waifu2xMain.isRunning()==false)break;
- Delay_msec_sleep(300);
- }
- emit TextBrowser_NewMessage(tr("Processing of files has stopped."));
- QtConcurrent::run(this, &MainWindow::Play_NFSound);//成功暂停,播放提示音
- break;
- }
- Delay_msec_sleep(300);
- }
- emit Send_Waifu2x_Finished_manual();
-}
-/*
-从tableview移除item
-*/
-int MainWindow::on_pushButton_RemoveItem_clicked()
-{
- if(curRow_image==-1&&curRow_video==-1&&curRow_gif==-1)
- {
- ui->tableView_image->clearSelection();
- ui->tableView_gif->clearSelection();
- ui->tableView_video->clearSelection();
- //=====
- QMessageBox *MSG = new QMessageBox();
- MSG->setWindowTitle(tr("Warning"));
- MSG->setText(tr("No items are currently selected."));
- MSG->setIcon(QMessageBox::Warning);
- MSG->setModal(true);
- MSG->show();
- //=====
- return 0;
- }
- //==========================
- if(curRow_image >= 0)
- {
- CustRes_remove(Table_model_image->item(curRow_image,2)->text());
- ui->tableView_image->setUpdatesEnabled(false);
- Table_model_image->removeRow(curRow_image);
- ui->tableView_image->setUpdatesEnabled(true);
- curRow_image = -1;
- ui->tableView_image->clearSelection();
- }
- //============================================================
- if(curRow_video >= 0)
- {
- CustRes_remove(Table_model_video->item(curRow_video,2)->text());
- ui->tableView_video->setUpdatesEnabled(false);
- Table_model_video->removeRow(curRow_video);
- ui->tableView_video->setUpdatesEnabled(true);
- curRow_video = -1;
- ui->tableView_video->clearSelection();
- }
- //============================================================
- if(curRow_gif >= 0)
- {
- CustRes_remove(Table_model_gif->item(curRow_gif,2)->text());
- ui->tableView_gif->setUpdatesEnabled(false);
- Table_model_gif->removeRow(curRow_gif);
- ui->tableView_gif->setUpdatesEnabled(true);
- curRow_gif = -1;
- ui->tableView_gif->clearSelection();
- }
- //==================================================
- if(Table_model_gif->rowCount()==0)
- {
- ui->tableView_gif->setVisible(0);
- }
- if(Table_model_image->rowCount()==0)
- {
- ui->tableView_image->setVisible(0);
- }
- if(Table_model_video->rowCount()==0)
- {
- ui->tableView_video->setVisible(0);
- }
- //===================================================
- if(Table_model_gif->rowCount()==0&&Table_model_image->rowCount()==0&&Table_model_video->rowCount()==0)
- {
- on_pushButton_ClearList_clicked();
- }
- Table_FileCount_reload();
- //============
- return 0;
-}
-
-//==========================================================
-/*
-============= 安全的阻塞延时 =====================
-*/
-void MainWindow::Delay_sec_sleep(int time)
-{
- QThread::sleep(time);
-}
-
-void MainWindow::Delay_msec_sleep(int time)
-{
- QThread::msleep(time);
-}
-//==========================================================
-
-/*
-播放提示音
-*/
-void MainWindow::Play_NFSound()
-{
- if(ui->checkBox_NfSound->isChecked()==false)return;
- //====
- QString NFSound = Current_Path+"/NFSound_Waifu2xEX.mp3";
- if(QFile::exists(NFSound)==false)
- {
- emit Send_TextBrowser_NewMessage(tr("Error! Notification sound file is missing!"));
- return;
- }
- //====
- QMediaPlayer *player = new QMediaPlayer;
- player->setMedia(QUrl::fromLocalFile(NFSound));
- player->play();
-}
-
-void MainWindow::on_pushButton_Report_clicked()
-{
- QDesktopServices::openUrl(QUrl("https://github.com/AaronFeng753/Waifu2x-Extension-GUI/issues/new"));
-}
-
-void MainWindow::on_pushButton_ReadMe_clicked()
-{
- if(ui->comboBox_language->currentIndex()==1)
- {
- QDesktopServices::openUrl(QUrl("https://github.com/AaronFeng753/Waifu2x-Extension-GUI/"));
- QDesktopServices::openUrl(QUrl("https://gitee.com/aaronfeng0711/Waifu2x-Extension-GUI/"));
- }
- else
- {
- QDesktopServices::openUrl(QUrl("https://github.com/AaronFeng753/Waifu2x-Extension-GUI/"));
- }
-}
-
-
-
-void MainWindow::on_comboBox_Engine_Image_currentIndexChanged(int index)
-{
- switch(ui->comboBox_Engine_Image->currentIndex())
- {
- case 0:
- {
- ui->spinBox_DenoiseLevel_image->setRange(-1,3);
- ui->spinBox_DenoiseLevel_image->setValue(2);
- ui->spinBox_DenoiseLevel_image->setEnabled(1);
- ui->spinBox_DenoiseLevel_image->setToolTip(tr("Range:-1(No noise reduction)~3"));
- ui->label_ImageDenoiseLevel->setToolTip(tr("Range:-1(No noise reduction)~3"));
- break;
- }
- case 1:
- {
- ui->spinBox_DenoiseLevel_image->setRange(0,3);
- ui->spinBox_DenoiseLevel_image->setValue(2);
- ui->spinBox_DenoiseLevel_image->setEnabled(1);
- ui->spinBox_DenoiseLevel_image->setToolTip(tr("Range:0(No noise reduction)~3"));
- ui->label_ImageDenoiseLevel->setToolTip(tr("Range:0(No noise reduction)~3"));
- break;
- }
- case 2:
- case 6:
- {
- ui->spinBox_DenoiseLevel_image->setRange(-1,10);
- ui->spinBox_DenoiseLevel_image->setValue(4);
- ui->spinBox_DenoiseLevel_image->setEnabled(1);
- ui->spinBox_DenoiseLevel_image->setToolTip(tr("Range:-1(No noise reduction)~10"));
- ui->label_ImageDenoiseLevel->setToolTip(tr("Range:-1(No noise reduction)~10"));
- break;
- }
- case 3:
- {
- DenoiseLevelSpinboxSetting_Anime4k();
- break;
- }
- case 4:
- {
- ui->spinBox_DenoiseLevel_image->setRange(-1,3);
- ui->spinBox_DenoiseLevel_image->setValue(2);
- ui->spinBox_DenoiseLevel_image->setEnabled(1);
- ui->spinBox_DenoiseLevel_image->setToolTip(tr("Range:-1(No noise reduction)~3"));
- ui->label_ImageDenoiseLevel->setToolTip(tr("Range:-1(No noise reduction)~3"));
- break;
- }
- case 5:
- {
- ui->spinBox_DenoiseLevel_image->setRange(0,1);
- ui->spinBox_DenoiseLevel_image->setValue(1);
- ui->spinBox_DenoiseLevel_image->setEnabled(0);
- ui->spinBox_DenoiseLevel_image->setToolTip(tr("Realsr-ncnn-vulkan engine will denoise automatically."));
- ui->label_ImageDenoiseLevel->setToolTip(tr("Realsr-ncnn-vulkan engine will denoise automatically."));
- break;
- }
- }
- isShowAnime4kWarning=true;
- on_comboBox_model_vulkan_currentIndexChanged(0);
- isWaifu2xCaffeEnabled();//判断是否启用caffe图片风格设定
-}
-
-void MainWindow::on_comboBox_Engine_GIF_currentIndexChanged(int index)
-{
- switch(ui->comboBox_Engine_GIF->currentIndex())
- {
- case 0:
- {
- ui->spinBox_DenoiseLevel_gif->setRange(-1,3);
- ui->spinBox_DenoiseLevel_gif->setValue(2);
- ui->spinBox_DenoiseLevel_gif->setEnabled(1);
- ui->spinBox_DenoiseLevel_gif->setToolTip(tr("Range:-1(No noise reduction)~3"));
- ui->label_GIFDenoiseLevel->setToolTip(tr("Range:-1(No noise reduction)~3"));
- break;
- }
- case 1:
- {
- ui->spinBox_DenoiseLevel_gif->setRange(0,3);
- ui->spinBox_DenoiseLevel_gif->setValue(2);
- ui->spinBox_DenoiseLevel_gif->setEnabled(1);
- ui->spinBox_DenoiseLevel_gif->setToolTip(tr("Range:0(No noise reduction)~3"));
- ui->label_GIFDenoiseLevel->setToolTip(tr("Range:0(No noise reduction)~3"));
- break;
- }
- case 2:
- case 6:
- {
- ui->spinBox_DenoiseLevel_gif->setRange(-1,10);
- ui->spinBox_DenoiseLevel_gif->setValue(4);
- ui->spinBox_DenoiseLevel_gif->setEnabled(1);
- ui->spinBox_DenoiseLevel_gif->setToolTip(tr("Range:-1(No noise reduction)~10"));
- ui->label_GIFDenoiseLevel->setToolTip(tr("Range:-1(No noise reduction)~10"));
- break;
- }
- case 3:
- {
- DenoiseLevelSpinboxSetting_Anime4k();
- break;
- }
- case 4:
- {
- ui->spinBox_DenoiseLevel_gif->setRange(-1,3);
- ui->spinBox_DenoiseLevel_gif->setValue(2);
- ui->spinBox_DenoiseLevel_gif->setEnabled(1);
- ui->spinBox_DenoiseLevel_gif->setToolTip(tr("Range:-1(No noise reduction)~3"));
- ui->label_GIFDenoiseLevel->setToolTip(tr("Range:-1(No noise reduction)~3"));
- break;
- }
- case 5:
- {
- ui->spinBox_DenoiseLevel_gif->setRange(0,1);
- ui->spinBox_DenoiseLevel_gif->setValue(1);
- ui->spinBox_DenoiseLevel_gif->setEnabled(0);
- ui->spinBox_DenoiseLevel_gif->setToolTip(tr("Realsr-ncnn-vulkan engine will denoise automatically."));
- ui->label_GIFDenoiseLevel->setToolTip(tr("Realsr-ncnn-vulkan engine will denoise automatically."));
- break;
- }
- }
- on_comboBox_model_vulkan_currentIndexChanged(0);
- isWaifu2xCaffeEnabled();//判断是否启用caffe图片风格设定
-}
-
-void MainWindow::on_comboBox_Engine_Video_currentIndexChanged(int index)
-{
- switch(ui->comboBox_Engine_Video->currentIndex())
- {
- case 0:
- {
- ui->spinBox_DenoiseLevel_video->setRange(-1,3);
- ui->spinBox_DenoiseLevel_video->setValue(2);
- ui->spinBox_DenoiseLevel_video->setEnabled(1);
- ui->spinBox_DenoiseLevel_video->setToolTip(tr("Range:-1(No noise reduction)~3"));
- ui->label_VideoDenoiseLevel->setToolTip(tr("Range:-1(No noise reduction)~3"));
- break;
- }
- case 1:
- {
- ui->spinBox_DenoiseLevel_video->setRange(0,3);
- ui->spinBox_DenoiseLevel_video->setValue(2);
- ui->spinBox_DenoiseLevel_video->setEnabled(1);
- ui->spinBox_DenoiseLevel_video->setToolTip(tr("Range:0(No noise reduction)~3"));
- ui->label_VideoDenoiseLevel->setToolTip(tr("Range:0(No noise reduction)~3"));
- break;
- }
- case 2:
- {
- DenoiseLevelSpinboxSetting_Anime4k();
- break;
- }
- case 3:
- case 6:
- {
- ui->spinBox_DenoiseLevel_video->setRange(-1,10);
- ui->spinBox_DenoiseLevel_video->setValue(4);
- ui->spinBox_DenoiseLevel_video->setEnabled(1);
- ui->spinBox_DenoiseLevel_video->setToolTip(tr("Range:-1(No noise reduction)~10"));
- ui->label_VideoDenoiseLevel->setToolTip(tr("Range:-1(No noise reduction)~10"));
- break;
- }
- case 4:
- {
- ui->spinBox_DenoiseLevel_video->setRange(-1,3);
- ui->spinBox_DenoiseLevel_video->setValue(2);
- ui->spinBox_DenoiseLevel_video->setEnabled(1);
- ui->spinBox_DenoiseLevel_video->setToolTip(tr("Range:-1(No noise reduction)~3"));
- ui->label_VideoDenoiseLevel->setToolTip(tr("Range:-1(No noise reduction)~3"));
- break;
- }
- case 5:
- {
- ui->spinBox_DenoiseLevel_video->setRange(0,1);
- ui->spinBox_DenoiseLevel_video->setValue(1);
- ui->spinBox_DenoiseLevel_video->setEnabled(0);
- ui->spinBox_DenoiseLevel_video->setToolTip(tr("Realsr-ncnn-vulkan engine will denoise automatically."));
- ui->label_VideoDenoiseLevel->setToolTip(tr("Realsr-ncnn-vulkan engine will denoise automatically."));
- break;
- }
- }
- on_comboBox_model_vulkan_currentIndexChanged(0);
- isWaifu2xCaffeEnabled();//判断是否启用caffe图片风格设定
-}
-
-void MainWindow::on_pushButton_clear_textbrowser_clicked()
-{
- ui->textBrowser->clear();
- TextBrowser_StartMes();
-}
-
-void MainWindow::on_spinBox_textbrowser_fontsize_valueChanged(int arg1)
-{
- int size = ui->spinBox_textbrowser_fontsize->value();
- ui->textBrowser->setStyleSheet("font: "+QString::number(size,10)+"pt \"Arial\";");
- ui->textBrowser->moveCursor(QTextCursor::End);
-}
-
-void MainWindow::on_pushButton_CustRes_apply_clicked()
-{
- CustRes_SetCustRes();
-}
-
-void MainWindow::on_pushButton_CustRes_cancel_clicked()
-{
- CustRes_CancelCustRes();
-}
-
-void MainWindow::on_pushButton_HideSettings_clicked()
-{
- if(ui->groupBox_Setting->isVisible())
- {
- ui->groupBox_Setting->setVisible(0);
- isSettingsHide=true;
- ui->pushButton_HideSettings->setText(tr("Show settings"));
- }
- else
- {
- ui->groupBox_Setting->setVisible(1);
- isSettingsHide=false;
- ui->pushButton_HideSettings->setText(tr("Hide settings"));
- }
-}
-
-/*
-改变语言设置
-*/
-void MainWindow::on_comboBox_language_currentIndexChanged(int index)
-{
- //检测是否存在日本语翻译文件,若存在则删除并修正翻译设定
- QString JapaneseQM = Current_Path + "/language_Japanese.qm";
- if(QFile::exists(JapaneseQM))
- {
- QFile::remove(JapaneseQM);
- if(ui->comboBox_language->currentIndex()==2)//若原语言为日语则重置为英语
- {
- ui->comboBox_language->setCurrentIndex(0);
- }
- if(ui->comboBox_language->currentIndex()==3 || ui->comboBox_language->currentIndex()==-1)//若原语言为繁中则修正设定
- {
- ui->comboBox_language->setCurrentIndex(2);
- }
- }
- //==============
- QString qmFilename="";
- switch(ui->comboBox_language->currentIndex())
- {
- case 0:
- {
- qmFilename = Current_Path + "/language_English.qm";
- break;
- }
- case 1:
- {
- qmFilename = Current_Path + "/language_Chinese.qm";
- break;
- }
- case 2:
- {
- qmFilename = Current_Path + "/language_TraditionalChinese.qm";
- break;
- }
- }
- //判断文件是否存在
- if(QFile::exists(qmFilename)==false)
- {
- QMessageBox *MSG_languageFile404 = new QMessageBox();
- MSG_languageFile404->setWindowTitle(tr("Error"));
- MSG_languageFile404->setText(tr("Language file is missing, please reinstall this program."));
- MSG_languageFile404->setIcon(QMessageBox::Warning);
- MSG_languageFile404->setModal(true);
- MSG_languageFile404->show();
- return;
- }
- //加载语言文件
- if (translator->load(qmFilename))
- {
- qApp->installTranslator(translator);
- ui->retranslateUi(this);
- Table_FileCount_reload();
- Init_Table();
- Init_SystemTrayIcon();
- Set_Font_fixed();
- //=========
- if(ui->checkBox_AlwaysHideSettings->isChecked())
- {
- ui->groupBox_Setting->setVisible(0);
- isSettingsHide=true;
- ui->pushButton_HideSettings->setText(tr("Show settings"));
- }
- else
- {
- ui->groupBox_Setting->setVisible(1);
- isSettingsHide=false;
- ui->pushButton_HideSettings->setText(tr("Hide settings"));
- }
- //=========
- if(ui->checkBox_AlwaysHideTextBrowser->isChecked())
- {
- ui->splitter_TextBrowser->setVisible(0);
- ui->pushButton_HideTextBro->setText(tr("Show Text Browser"));
- }
- else
- {
- ui->splitter_TextBrowser->setVisible(1);
- ui->pushButton_HideTextBro->setText(tr("Hide Text Browser"));
- }
- //=========
- if(this->windowState()!=Qt::WindowMaximized)
- {
- this->adjustSize();
- }
- }
- else
- {
- QMessageBox *MSG_Unable2LoadLanguageFiles = new QMessageBox();
- MSG_Unable2LoadLanguageFiles->setWindowTitle(tr("Error"));
- MSG_Unable2LoadLanguageFiles->setText(tr("Language file cannot be loaded properly."));
- MSG_Unable2LoadLanguageFiles->setIcon(QMessageBox::Warning);
- MSG_Unable2LoadLanguageFiles->setModal(true);
- MSG_Unable2LoadLanguageFiles->show();
- }
-}
-
-void MainWindow::on_pushButton_ReadFileList_clicked()
-{
- file_mkDir(Current_Path+"/FilesList_W2xEX");//生成保存文件列表的文件夹
- QString Table_FileList_ini = QFileDialog::getOpenFileName(this, tr("Select saved files list @Waifu2x-Extension-GUI"), Current_Path+"/FilesList_W2xEX", "*.ini");
- if(Table_FileList_ini=="")return;
- //========
- if(QFile::exists(Table_FileList_ini))
- {
- ui_tableViews_setUpdatesEnabled(false);
- this->setAcceptDrops(0);//禁止drop file
- pushButton_Start_setEnabled_self(0);//禁用start button
- ui->pushButton_CustRes_cancel->setEnabled(0);
- ui->pushButton_CustRes_apply->setEnabled(0);
- ui->pushButton_ReadFileList->setEnabled(0);
- ui->pushButton_SaveFileList->setEnabled(0);
- ui->pushButton_BrowserFile->setEnabled(0);
- on_pushButton_ClearList_clicked();
- Send_TextBrowser_NewMessage(tr("Please wait while reading the file."));
- ui->label_DropFile->setText(tr("Loading list, please wait."));
- QtConcurrent::run(this, &MainWindow::Table_Read_Saved_Table_Filelist,Table_FileList_ini);
- }
- else
- {
- QMessageBox *MSG_FileList404 = new QMessageBox();
- MSG_FileList404->setWindowTitle(tr("Error"));
- MSG_FileList404->setText(tr("Target files list doesn't exist!"));
- MSG_FileList404->setIcon(QMessageBox::Warning);
- MSG_FileList404->setModal(true);
- MSG_FileList404->show();
- }
-}
-
-void MainWindow::on_Ext_image_editingFinished()
-{
- QString ext_image_str = ui->Ext_image->text();
- ext_image_str = ext_image_str.trimmed().replace(":",":").remove(" ").remove(" ").replace(":gif:",":");
- ui->Ext_image->setText(ext_image_str);
-}
-
-void MainWindow::on_Ext_video_editingFinished()
-{
- QString ext_video_str = ui->Ext_video->text();
- ext_video_str = ext_video_str.trimmed().replace(":",":").remove(" ").remove(" ").replace(":gif:",":");
- ui->Ext_video->setText(ext_video_str);
-}
-
-void MainWindow::on_checkBox_AutoSaveSettings_clicked()
-{
- QString settings_ini = Current_Path+"/settings.ini";
- if(QFile::exists(settings_ini))
- {
- QSettings *configIniWrite = new QSettings(settings_ini, QSettings::IniFormat);
- configIniWrite->setValue("/settings/AutoSaveSettings", ui->checkBox_AutoSaveSettings->isChecked());
- }
-}
-
-void MainWindow::on_pushButton_about_clicked()
-{
- QMessageBox *MSG = new QMessageBox();
- MSG->setWindowTitle(tr("About"));
- QString line1 = "Waifu2x-Extension-GUI\n\n";
- QString line2 = VERSION+"\n\n";
- QString line3 = "Github: https://github.com/AaronFeng753/Waifu2x-Extension-GUI\n\n";
- QString line4 = "Waifu2x-Extension-GUI is licensed under the\n";
- QString line5 = "GNU Affero General Public License v3.0\n\n";
- QString line6 = "Copyright (C) 2021 Aaron Feng. All rights reserved.\n\n";
- QString line7 = "The program is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.\n\n";
- QString line8 = "Icons made by : Freepik & Icongeek26 & Roundicons From Flaticon(https://www.flaticon.com/)";
- MSG->setText(line1+line2+line3+line4+line5+line6+line7+line8);
- QImage img(":/new/prefix1/icon/icon_main.png");
- QImage img_scaled = img.scaled(50,50,Qt::KeepAspectRatio,Qt::SmoothTransformation);
- QPixmap pix(QPixmap::fromImage(img_scaled));
- MSG->setIconPixmap(pix);
- MSG->setModal(false);
- MSG->show();
-}
-
-void MainWindow::on_comboBox_AspectRatio_custRes_currentIndexChanged(int index)
-{
- int CurrentIndex = ui->comboBox_AspectRatio_custRes->currentIndex();
- switch(CurrentIndex)
- {
- case 0:
- {
- CustRes_AspectRatioMode = Qt::IgnoreAspectRatio;
- break;
- }
- case 1:
- {
- CustRes_AspectRatioMode = Qt::KeepAspectRatio;
- break;
- }
- case 2:
- {
- CustRes_AspectRatioMode = Qt::KeepAspectRatioByExpanding;
- break;
- }
- }
-}
-
-void MainWindow::on_checkBox_AlwaysHideSettings_stateChanged(int arg1)
-{
- if(ui->checkBox_AlwaysHideSettings->isChecked())
- {
- ui->groupBox_Setting->setVisible(0);
- ui->pushButton_HideSettings->setText(tr("Show settings"));
- isSettingsHide=true;
- }
-}
-
-void MainWindow::on_pushButton_Save_GlobalFontSize_clicked()
-{
- QString settings_ini = Current_Path+"/settings.ini";
- QSettings *configIniWrite = new QSettings(settings_ini, QSettings::IniFormat);
- configIniWrite->setValue("/settings/GlobalFontSize", ui->spinBox_GlobalFontSize->value());
- //=========
- QMessageBox *MSG = new QMessageBox();
- MSG->setWindowTitle(tr("Notification"));
- MSG->setText(tr("Custom Font Settings saved successfully.\n\nRestart the software to take effect."));
- MSG->setIcon(QMessageBox::Information);
- MSG->setModal(true);
- MSG->show();
-}
-/*
-==================================================================================================
- 浏览与添加文本
-==================================================================================================
-*/
-void MainWindow::on_pushButton_BrowserFile_clicked()
-{
- QString Last_browsed_path = Current_Path+"/LastBrowsedPath_W2xEX.ini";
- //======== 生成 扩展名过滤 字符串 =========
- QStringList nameFilters;
- nameFilters.append("*.gif");
- nameFilters.append("*.apng");
- QString Ext_image_str = ui->Ext_image->text();
- QStringList nameFilters_image = Ext_image_str.split(":");
- nameFilters_image.removeAll("gif");
- nameFilters_image.removeAll("apng");
- for(int i = 0; i < nameFilters_image.size(); ++i)
- {
- QString tmp = nameFilters_image.at(i).trimmed();
- if(tmp=="")continue;
- tmp = "*." + tmp;
- nameFilters.append(tmp);
- }
- QString Ext_video_str = ui->Ext_video->text();
- QStringList nameFilters_video = Ext_video_str.split(":");
- nameFilters_video.removeAll("gif");
- nameFilters_video.removeAll("apng");
- for(int i = 0; i < nameFilters_video.size(); ++i)
- {
- QString tmp = nameFilters_video.at(i).trimmed();
- if(tmp=="")continue;
- tmp = "*." + tmp;
- nameFilters.append(tmp);
- }
- QString nameFilters_QString = "";
- for(int i = 0; i < nameFilters.size(); ++i)
- {
- QString tmp = nameFilters.at(i).trimmed();
- nameFilters_QString = nameFilters_QString +" "+ tmp;
- }
- //=====================================================
- QString BrowserStartPath = "";//浏览文件时的起始文件夹
- //=========== 读取上一次浏览的文件夹 ===========================
- if(QFile::exists(Last_browsed_path))
- {
- QSettings *configIniRead = new QSettings(Last_browsed_path, QSettings::IniFormat);
- configIniRead->setIniCodec(QTextCodec::codecForName("UTF-8"));
- BrowserStartPath = configIniRead->value("/Path").toString();
- if(!QFile::exists(BrowserStartPath))BrowserStartPath = "";
- }
- //===========================================================
- QStringList Input_path_List = QFileDialog::getOpenFileNames(this, tr("Select files @Waifu2x-Extension-GUI"), BrowserStartPath, tr("All file(")+nameFilters_QString+")");
- if(Input_path_List.isEmpty())
- {
- return;
- }
- //================== 记住上一次浏览的文件夹 =======================
- QFile::remove(Last_browsed_path);
- QSettings *configIniWrite = new QSettings(Last_browsed_path, QSettings::IniFormat);
- configIniWrite->setIniCodec(QTextCodec::codecForName("UTF-8"));
- configIniWrite->setValue("/Warning/EN", "Do not modify this file! It may cause the program to crash! If problems occur after the modification, delete this file and restart the program.");
- QFileInfo lastPath(Input_path_List.at(0));
- QString folder_lastPath = file_getFolderPath(lastPath);
- configIniWrite->setValue("/Path", folder_lastPath);
- //===============================================================
- AddNew_gif=false;
- AddNew_image=false;
- AddNew_video=false;
- //================== 界面管制 ========================
- ui_tableViews_setUpdatesEnabled(false);
- ui->groupBox_Setting->setEnabled(0);
- ui->groupBox_FileList->setEnabled(0);
- ui->groupBox_InputExt->setEnabled(0);
- pushButton_Start_setEnabled_self(0);
- ui->checkBox_ScanSubFolders->setEnabled(0);
- this->setAcceptDrops(0);
- ui->label_DropFile->setText(tr("Adding files, please wait."));
- emit Send_TextBrowser_NewMessage(tr("Adding files, please wait."));
- //===================================================
- QtConcurrent::run(this, &MainWindow::Read_Input_paths_BrowserFile, Input_path_List);
-}
-/*
-读取 路径与添加文件
-*/
-void MainWindow::Read_Input_paths_BrowserFile(QStringList Input_path_List)
-{
- Progressbar_MaxVal = Input_path_List.size();
- Progressbar_CurrentVal = 0;
- emit Send_PrograssBar_Range_min_max(0, Progressbar_MaxVal);
- foreach(QString Input_path, Input_path_List)
- {
- Input_path=Input_path.trimmed();
- if(QFile::exists(Input_path)==false)continue;
- Add_File_Folder(Input_path);
- emit Send_progressbar_Add();
- }
- emit Send_Read_urls_finfished();
-}
-/*
-打开wiki
-*/
-void MainWindow::on_pushButton_wiki_clicked()
-{
- if(ui->comboBox_language->currentIndex()==1)
- {
- QDesktopServices::openUrl(QUrl("https://gitee.com/aaronfeng0711/Waifu2x-Extension-GUI/wikis"));
- }
- QDesktopServices::openUrl(QUrl("https://github.com/AaronFeng753/Waifu2x-Extension-GUI/wiki"));
-}
-
-void MainWindow::on_pushButton_HideTextBro_clicked()
-{
- if(ui->textBrowser->isVisible())
- {
- ui->splitter_TextBrowser->setVisible(0);
- ui->pushButton_HideTextBro->setText(tr("Show Text Browser"));
- }
- else
- {
- ui->splitter_TextBrowser->setVisible(1);
- ui->pushButton_HideTextBro->setText(tr("Hide Text Browser"));
- }
-}
-
-void MainWindow::on_checkBox_AlwaysHideTextBrowser_stateChanged(int arg1)
-{
- if(ui->checkBox_AlwaysHideTextBrowser->isChecked())
- {
- ui->splitter_TextBrowser->setVisible(0);
- ui->pushButton_HideTextBro->setText(tr("Show Text Browser"));
- }
-}
-
-
-
-void MainWindow::on_Ext_image_textChanged(const QString &arg1)
-{
- QString lower = ui->Ext_image->text().toLower();
- ui->Ext_image->setText(lower);
-}
-
-void MainWindow::on_Ext_video_textChanged(const QString &arg1)
-{
- QString lower = ui->Ext_video->text().toLower();
- ui->Ext_video->setText(lower);
-}
-
-void MainWindow::on_comboBox_model_vulkan_currentIndexChanged(int index)
-{
- if(ui->comboBox_model_vulkan->currentIndex()==0)
- {
- ui->comboBox_ImageStyle->setEnabled(1);
- ui->label_ImageStyle_W2xNCNNVulkan->setVisible(1);
- ui->comboBox_ImageStyle->setVisible(1);
- if(ui->comboBox_Engine_Image->currentIndex()!=0&&ui->comboBox_Engine_GIF->currentIndex()!=0&&ui->comboBox_Engine_Video->currentIndex()!=0)
- {
- ui->comboBox_ImageStyle->setEnabled(0);
- ui->label_ImageStyle_W2xNCNNVulkan->setVisible(0);
- ui->comboBox_ImageStyle->setVisible(0);
- }
- }
- if(ui->comboBox_model_vulkan->currentIndex()==1)
- {
- ui->comboBox_ImageStyle->setEnabled(0);
- ui->label_ImageStyle_W2xNCNNVulkan->setVisible(0);
- ui->comboBox_ImageStyle->setVisible(0);
- }
-}
-
-void MainWindow::on_comboBox_ImageStyle_currentIndexChanged(int index)
-{
- if(ui->comboBox_ImageStyle->currentIndex()==0)
- {
- ui->comboBox_model_vulkan->setEnabled(1);
- }
- if(ui->comboBox_ImageStyle->currentIndex()==1)
- {
- ui->comboBox_model_vulkan->setEnabled(0);
- }
-}
-
-void MainWindow::on_pushButton_ResetVideoSettings_clicked()
-{
- ui->lineEdit_pixformat->setText("yuv420p");
- ui->lineEdit_encoder_vid->setText("libx264");
- ui->lineEdit_encoder_audio->setText("aac");
- ui->spinBox_bitrate_vid->setValue(6000);
- ui->spinBox_bitrate_audio->setValue(320);
- //====
- ui->spinBox_bitrate_vid_2mp4->setValue(2500);
- ui->spinBox_bitrate_audio_2mp4->setValue(320);
- ui->checkBox_acodec_copy_2mp4->setChecked(0);
- ui->checkBox_vcodec_copy_2mp4->setChecked(0);
- ui->spinBox_bitrate_vid_2mp4->setEnabled(1);
- ui->spinBox_bitrate_audio_2mp4->setEnabled(1);
- //====
- ui->lineEdit_ExCommand_2mp4->setText("");
- ui->lineEdit_ExCommand_output->setText("");
-}
-
-void MainWindow::on_lineEdit_encoder_vid_textChanged(const QString &arg1)
-{
- QString tmp = ui->lineEdit_encoder_vid->text().trimmed();
- ui->lineEdit_encoder_vid->setText(tmp);
-}
-
-void MainWindow::on_lineEdit_encoder_audio_textChanged(const QString &arg1)
-{
- QString tmp = ui->lineEdit_encoder_audio->text().trimmed();
- ui->lineEdit_encoder_audio->setText(tmp);
-}
-
-void MainWindow::on_lineEdit_pixformat_textChanged(const QString &arg1)
-{
- QString tmp = ui->lineEdit_pixformat->text().trimmed();
- ui->lineEdit_pixformat->setText(tmp);
-}
-
-void MainWindow::on_checkBox_vcodec_copy_2mp4_stateChanged(int arg1)
-{
- if(ui->checkBox_vcodec_copy_2mp4->isChecked())
- {
- ui->spinBox_bitrate_vid_2mp4->setEnabled(0);
- }
- else
- {
- ui->spinBox_bitrate_vid_2mp4->setEnabled(1);
- }
-}
-
-void MainWindow::on_checkBox_acodec_copy_2mp4_stateChanged(int arg1)
-{
- if(ui->checkBox_acodec_copy_2mp4->isChecked())
- {
- ui->spinBox_bitrate_audio_2mp4->setEnabled(0);
- }
- else
- {
- ui->spinBox_bitrate_audio_2mp4->setEnabled(1);
- }
-}
-
-
-void MainWindow::on_pushButton_encodersList_clicked()
-{
- file_OpenFile(Current_Path+"/FFmpeg_Encoders_List_waifu2xEX.bat");
-}
-
-void MainWindow::Tip_FirstTimeStart()
-{
- QString FirstTimeStart = Current_Path+"/FirstTimeStart";
- if(QFile::exists(FirstTimeStart))
- {
- isFirstTimeStart=false;
- return;
- }
- else
- {
- isFirstTimeStart=true;
- /*
- 弹出语言选择对话框
- */
- QMessageBox Msg(QMessageBox::Question, QString("Choose your language"), QString("Choose your language.\n\n选择您的语言。\n\n言語を選んでください。"));
- Msg.setIcon(QMessageBox::Information);
- QAbstractButton *pYesBtn_English = Msg.addButton(QString("English"), QMessageBox::YesRole);
- QAbstractButton *pYesBtn_Chinese = Msg.addButton(QString("简体中文"), QMessageBox::YesRole);
- QAbstractButton *pYesBtn_TraditionalChinese = Msg.addButton(QString("繁體中文(由uimee翻譯)"), QMessageBox::YesRole);
- Msg.exec();
- if (Msg.clickedButton() == pYesBtn_English)ui->comboBox_language->setCurrentIndex(0);
- if (Msg.clickedButton() == pYesBtn_Chinese)ui->comboBox_language->setCurrentIndex(1);
- if (Msg.clickedButton() == pYesBtn_TraditionalChinese)ui->comboBox_language->setCurrentIndex(2);
- on_comboBox_language_currentIndexChanged(0);
- //======
- QMessageBox *MSG_2 = new QMessageBox();
- MSG_2->setWindowTitle(tr("Notification"));
- MSG_2->setText(tr("It is detected that this is the first time you have started the software, so the compatibility test will be performed automatically. Please wait for a while, then check the test result."));
- MSG_2->setIcon(QMessageBox::Information);
- MSG_2->setModal(true);
- MSG_2->show();
- //=======
- file_generateMarkFile(FirstTimeStart,"");
- //=======
- on_pushButton_clear_textbrowser_clicked();
- on_pushButton_compatibilityTest_clicked();
- }
-}
-
-void MainWindow::on_checkBox_DelOriginal_stateChanged(int arg1)
-{
- if(ui->checkBox_DelOriginal->isChecked())
- {
- QAction_checkBox_MoveToRecycleBin_checkBox_DelOriginal->setEnabled(1);
- ui->checkBox_ReplaceOriginalFile->setEnabled(0);
- ui->checkBox_ReplaceOriginalFile->setChecked(0);
- }
- else
- {
- QAction_checkBox_MoveToRecycleBin_checkBox_DelOriginal->setEnabled(0);
- checkBox_ReplaceOriginalFile_setEnabled_True_Self();
- }
-}
-
-void MainWindow::on_checkBox_FileList_Interactive_stateChanged(int arg1)
-{
- if(ui->checkBox_FileList_Interactive->isChecked())
- {
- ui->tableView_image->horizontalHeader()->setSectionResizeMode(QHeaderView::Interactive);
- ui->tableView_gif->horizontalHeader()->setSectionResizeMode(QHeaderView::Interactive);
- ui->tableView_video->horizontalHeader()->setSectionResizeMode(QHeaderView::Interactive);
- }
- else
- {
- ui->tableView_image->horizontalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents);
- ui->tableView_gif->horizontalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents);
- ui->tableView_video->horizontalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents);
- }
-}
-
-void MainWindow::on_checkBox_OutPath_isEnabled_stateChanged(int arg1)
-{
- if(ui->checkBox_OutPath_isEnabled->isChecked())
- {
- ui->lineEdit_outputPath->setEnabled(1);
- ui->checkBox_OutPath_KeepOriginalFileName->setEnabled(1);
- ui->checkBox_KeepParentFolder->setEnabled(1);
- ui->checkBox_OutPath_Overwrite->setEnabled(1);
- ui->checkBox_ReplaceOriginalFile->setEnabled(0);
- ui->checkBox_ReplaceOriginalFile->setChecked(0);
- ui->checkBox_AutoOpenOutputPath->setEnabled(1);
- }
- else
- {
- ui->lineEdit_outputPath->setEnabled(0);
- ui->checkBox_OutPath_KeepOriginalFileName->setEnabled(0);
- ui->checkBox_KeepParentFolder->setEnabled(0);
- ui->checkBox_OutPath_Overwrite->setEnabled(0);
- ui->checkBox_AutoOpenOutputPath->setEnabled(0);
- checkBox_ReplaceOriginalFile_setEnabled_True_Self();
- }
-}
-
-//强制重试
-void MainWindow::on_pushButton_ForceRetry_clicked()
-{
- if(isForceRetryEnabled==false)//处理视频和gif时禁用强制重试
- {
- emit Send_TextBrowser_NewMessage(tr("Force retry is disabled when processing Video or GIF."));
- return;
- }
- //==========
- ui->pushButton_ForceRetry->setEnabled(0);
- //========
- QtConcurrent::run(this, &MainWindow::isForceRetryClicked_SetTrue_Block_Anime4k);//block a4k引擎线程 防止无效图片污染缓存
- //========
- ForceRetryCount++;
- //========
- QProcess Close;
- Close.start("taskkill /f /t /fi \"imagename eq Anime4K_waifu2xEX.exe\"");
- Close.waitForStarted(10000);
- Close.waitForFinished(10000);
- Close.start("taskkill /f /t /fi \"imagename eq waifu2x-ncnn-vulkan_waifu2xEX.exe\"");
- Close.waitForStarted(10000);
- Close.waitForFinished(10000);
- Close.start("taskkill /f /t /fi \"imagename eq waifu2x-ncnn-vulkan-fp16p_waifu2xEX.exe\"");
- Close.waitForStarted(10000);
- Close.waitForFinished(10000);
- Close.start("taskkill /f /t /fi \"imagename eq waifu2x-converter-cpp_waifu2xEX.exe\"");
- Close.waitForStarted(10000);
- Close.waitForFinished(10000);
- Close.start("taskkill /f /t /fi \"imagename eq srmd-ncnn-vulkan_waifu2xEX.exe\"");
- Close.waitForStarted(10000);
- Close.waitForFinished(10000);
- Close.start("taskkill /f /t /fi \"imagename eq waifu2x-caffe_waifu2xEX.exe\"");
- Close.waitForStarted(10000);
- Close.waitForFinished(10000);
- Close.start("taskkill /f /t /fi \"imagename eq realsr-ncnn-vulkan_waifu2xEX.exe\"");
- Close.waitForStarted(10000);
- Close.waitForFinished(10000);
- //========
- emit Send_TextBrowser_NewMessage(tr("Force retry."));
- return;
-}
-//激活强制重试按钮
-void MainWindow::SetEnable_pushButton_ForceRetry_self()
-{
- ui->pushButton_ForceRetry->setEnabled(1);
- return;
-}
-void MainWindow::on_pushButton_PayPal_clicked()
-{
- QDesktopServices::openUrl(QUrl("https://www.paypal.me/aaronfeng753"));
-}
-void MainWindow::on_checkBox_AudioDenoise_stateChanged(int arg1)
-{
- if(ui->checkBox_AudioDenoise->isChecked())
- {
- ui->doubleSpinBox_AudioDenoiseLevel->setEnabled(1);
- }
- else
- {
- ui->doubleSpinBox_AudioDenoiseLevel->setEnabled(0);
- }
-}
-void MainWindow::on_tabWidget_currentChanged(int index)
-{
- switch(ui->tabWidget->currentIndex())
- {
- case 0:
- {
- //tab 0
- ui->label_DonateQRCode->setVisible(1);
- ui->pushButton_PayPal->setVisible(1);
- ui->pushButton_Patreon->setVisible(1);
- ui->label_DonateText->setVisible(1);
- //tab 1
- ui->groupBox_Progress->setVisible(0);
- ui->splitter_2->setVisible(0);
- //tab 2
- ui->groupBox_Engine->setVisible(0);
- ui->groupBox_NumOfThreads->setVisible(0);
- //tab 3
- ui->groupBox_AudioDenoise->setVisible(0);
- ui->groupBox_video_settings->setVisible(0);
- ui->groupBox_FrameInterpolation->setVisible(0);
- //tab 4
- ui->groupBox_3->setVisible(0);
- ui->groupBox_8->setVisible(0);
- ui->groupBox_InputExt->setVisible(0);
- ui->groupBox_other_1->setVisible(0);
- //tab 5
- ui->groupBox_CompatibilityTestRes->setVisible(0);
- ui->pushButton_compatibilityTest->setVisible(0);
- break;
- }
- case 1:
- {
- //tab 0
- ui->label_DonateQRCode->setVisible(0);
- ui->pushButton_PayPal->setVisible(0);
- ui->pushButton_Patreon->setVisible(0);
- ui->label_DonateText->setVisible(0);
- //tab 1
- ui->groupBox_Progress->setVisible(1);
- ui->splitter_2->setVisible(1);
- if(isSettingsHide==false)
- {
- ui->groupBox_Setting->setVisible(1);
- }
- //tab 2
- ui->groupBox_Engine->setVisible(0);
- ui->groupBox_NumOfThreads->setVisible(0);
- //tab 3
- ui->groupBox_AudioDenoise->setVisible(0);
- ui->groupBox_video_settings->setVisible(0);
- ui->groupBox_FrameInterpolation->setVisible(0);
- //tab 4
- ui->groupBox_3->setVisible(0);
- ui->groupBox_8->setVisible(0);
- ui->groupBox_InputExt->setVisible(0);
- ui->groupBox_other_1->setVisible(0);
- //tab 5
- ui->groupBox_CompatibilityTestRes->setVisible(0);
- ui->pushButton_compatibilityTest->setVisible(0);
- break;
- }
- case 2:
- {
- //tab 0
- ui->label_DonateQRCode->setVisible(0);
- ui->pushButton_PayPal->setVisible(0);
- ui->pushButton_Patreon->setVisible(0);
- ui->label_DonateText->setVisible(0);
- //tab 1
- ui->groupBox_Progress->setVisible(0);
- ui->splitter_2->setVisible(0);
- //tab 2
- ui->groupBox_Engine->setVisible(1);
- ui->groupBox_NumOfThreads->setVisible(1);
- //tab 3
- ui->groupBox_AudioDenoise->setVisible(0);
- ui->groupBox_video_settings->setVisible(0);
- ui->groupBox_FrameInterpolation->setVisible(0);
- //tab 4
- ui->groupBox_3->setVisible(0);
- ui->groupBox_8->setVisible(0);
- ui->groupBox_InputExt->setVisible(0);
- ui->groupBox_other_1->setVisible(0);
- //tab 5
- ui->groupBox_CompatibilityTestRes->setVisible(0);
- ui->pushButton_compatibilityTest->setVisible(0);
- break;
- }
- case 3:
- {
- //tab 0
- ui->label_DonateQRCode->setVisible(0);
- ui->pushButton_PayPal->setVisible(0);
- ui->pushButton_Patreon->setVisible(0);
- ui->label_DonateText->setVisible(0);
- //tab 1
- ui->groupBox_Progress->setVisible(0);
- ui->splitter_2->setVisible(0);
- //tab 2
- ui->groupBox_Engine->setVisible(0);
- ui->groupBox_NumOfThreads->setVisible(0);
- //tab 3
- ui->groupBox_AudioDenoise->setVisible(1);
- ui->groupBox_video_settings->setVisible(1);
- ui->groupBox_FrameInterpolation->setVisible(1);
- //tab 4
- ui->groupBox_3->setVisible(0);
- ui->groupBox_8->setVisible(0);
- ui->groupBox_InputExt->setVisible(0);
- ui->groupBox_other_1->setVisible(0);
- //tab 5
- ui->groupBox_CompatibilityTestRes->setVisible(0);
- ui->pushButton_compatibilityTest->setVisible(0);
- break;
- }
- case 4:
- {
- //tab 0
- ui->label_DonateQRCode->setVisible(0);
- ui->pushButton_PayPal->setVisible(0);
- ui->pushButton_Patreon->setVisible(0);
- ui->label_DonateText->setVisible(0);
- //tab 1
- ui->groupBox_Progress->setVisible(0);
- ui->splitter_2->setVisible(0);
- //tab 2
- ui->groupBox_Engine->setVisible(0);
- ui->groupBox_NumOfThreads->setVisible(0);
- //tab 3
- ui->groupBox_AudioDenoise->setVisible(0);
- ui->groupBox_video_settings->setVisible(0);
- ui->groupBox_FrameInterpolation->setVisible(0);
- //tab 4
- ui->groupBox_3->setVisible(1);
- ui->groupBox_8->setVisible(1);
- ui->groupBox_InputExt->setVisible(1);
- ui->groupBox_other_1->setVisible(1);
- //tab 5
- ui->groupBox_CompatibilityTestRes->setVisible(0);
- ui->pushButton_compatibilityTest->setVisible(0);
- break;
- }
- case 5:
- {
- //tab 0
- ui->label_DonateQRCode->setVisible(0);
- ui->pushButton_PayPal->setVisible(0);
- ui->pushButton_Patreon->setVisible(0);
- ui->label_DonateText->setVisible(0);
- //tab 1
- ui->groupBox_Progress->setVisible(0);
- ui->splitter_2->setVisible(0);
- //tab 2
- ui->groupBox_Engine->setVisible(0);
- ui->groupBox_NumOfThreads->setVisible(0);
- //tab 3
- ui->groupBox_AudioDenoise->setVisible(0);
- ui->groupBox_video_settings->setVisible(0);
- ui->groupBox_FrameInterpolation->setVisible(0);
- //tab 4
- ui->groupBox_3->setVisible(0);
- ui->groupBox_8->setVisible(0);
- ui->groupBox_InputExt->setVisible(0);
- ui->groupBox_other_1->setVisible(0);
- //tab 5
- ui->groupBox_CompatibilityTestRes->setVisible(1);
- ui->pushButton_compatibilityTest->setVisible(1);
- break;
- }
- }
-}
-void MainWindow::on_checkBox_ProcessVideoBySegment_stateChanged(int arg1)
-{
- if(ui->checkBox_ProcessVideoBySegment->isChecked())
- {
- ui->label_SegmentDuration->setEnabled(1);
- ui->spinBox_SegmentDuration->setEnabled(1);
- }
- else
- {
- ui->label_SegmentDuration->setEnabled(0);
- ui->spinBox_SegmentDuration->setEnabled(0);
- }
-}
-void MainWindow::on_comboBox_version_Waifu2xNCNNVulkan_currentIndexChanged(int index)
-{
- switch (ui->comboBox_version_Waifu2xNCNNVulkan->currentIndex())
- {
- case 0:
- {
- Waifu2x_ncnn_vulkan_FolderPath = Current_Path + "/waifu2x-ncnn-vulkan";
- Waifu2x_ncnn_vulkan_ProgramPath = Waifu2x_ncnn_vulkan_FolderPath + "/waifu2x-ncnn-vulkan_waifu2xEX.exe";
- ui->checkBox_TTA_vulkan->setEnabled(1);
- return;
- }
- case 1:
- {
- Waifu2x_ncnn_vulkan_FolderPath = Current_Path + "/waifu2x-ncnn-vulkan";
- Waifu2x_ncnn_vulkan_ProgramPath = Waifu2x_ncnn_vulkan_FolderPath + "/waifu2x-ncnn-vulkan-fp16p_waifu2xEX.exe";
- ui->checkBox_TTA_vulkan->setEnabled(1);
- return;
- }
- case 2:
- {
- Waifu2x_ncnn_vulkan_FolderPath = Current_Path + "/waifu2x-ncnn-vulkan-old";
- Waifu2x_ncnn_vulkan_ProgramPath = Waifu2x_ncnn_vulkan_FolderPath + "/waifu2x-ncnn-vulkan_waifu2xEX.exe";
- ui->checkBox_TTA_vulkan->setEnabled(0);
- ui->checkBox_TTA_vulkan->setChecked(0);
- return;
- }
- }
-}
-void MainWindow::on_checkBox_EnablePreProcessing_Anime4k_stateChanged(int arg1)
-{
- if(ui->checkBox_EnablePreProcessing_Anime4k->isChecked())
- {
- ui->checkBox_MedianBlur_Pre_Anime4k->setEnabled(1);
- ui->checkBox_MeanBlur_Pre_Anime4k->setEnabled(1);
- ui->checkBox_CASSharping_Pre_Anime4k->setEnabled(1);
- ui->checkBox_GaussianBlurWeak_Pre_Anime4k->setEnabled(1);
- ui->checkBox_GaussianBlur_Pre_Anime4k->setEnabled(1);
- ui->checkBox_BilateralFilter_Pre_Anime4k->setEnabled(1);
- ui->checkBox_BilateralFilterFaster_Pre_Anime4k->setEnabled(1);
- }
- else
- {
- ui->checkBox_MedianBlur_Pre_Anime4k->setEnabled(0);
- ui->checkBox_MeanBlur_Pre_Anime4k->setEnabled(0);
- ui->checkBox_CASSharping_Pre_Anime4k->setEnabled(0);
- ui->checkBox_GaussianBlurWeak_Pre_Anime4k->setEnabled(0);
- ui->checkBox_GaussianBlur_Pre_Anime4k->setEnabled(0);
- ui->checkBox_BilateralFilter_Pre_Anime4k->setEnabled(0);
- ui->checkBox_BilateralFilterFaster_Pre_Anime4k->setEnabled(0);
- }
-}
-void MainWindow::on_checkBox_EnablePostProcessing_Anime4k_stateChanged(int arg1)
-{
- if(ui->checkBox_EnablePostProcessing_Anime4k->isChecked())
- {
- ui->checkBox_MedianBlur_Post_Anime4k->setEnabled(1);
- ui->checkBox_MeanBlur_Post_Anime4k->setEnabled(1);
- ui->checkBox_CASSharping_Post_Anime4k->setEnabled(1);
- ui->checkBox_GaussianBlurWeak_Post_Anime4k->setEnabled(1);
- ui->checkBox_GaussianBlur_Post_Anime4k->setEnabled(1);
- ui->checkBox_BilateralFilter_Post_Anime4k->setEnabled(1);
- ui->checkBox_BilateralFilterFaster_Post_Anime4k->setEnabled(1);
- }
- else
- {
- ui->checkBox_MedianBlur_Post_Anime4k->setEnabled(0);
- ui->checkBox_MeanBlur_Post_Anime4k->setEnabled(0);
- ui->checkBox_CASSharping_Post_Anime4k->setEnabled(0);
- ui->checkBox_GaussianBlurWeak_Post_Anime4k->setEnabled(0);
- ui->checkBox_GaussianBlur_Post_Anime4k->setEnabled(0);
- ui->checkBox_BilateralFilter_Post_Anime4k->setEnabled(0);
- ui->checkBox_BilateralFilterFaster_Post_Anime4k->setEnabled(0);
- }
-}
-void MainWindow::on_checkBox_SpecifyGPU_Anime4k_stateChanged(int arg1)
-{
- if(ui->checkBox_SpecifyGPU_Anime4k->isChecked())
- {
- ui->lineEdit_GPUs_Anime4k->setEnabled(1);
- ui->pushButton_ListGPUs_Anime4k->setEnabled(1);
- ui->pushButton_VerifyGPUsConfig_Anime4k->setEnabled(1);
- }
- else
- {
- ui->lineEdit_GPUs_Anime4k->setEnabled(0);
- ui->pushButton_ListGPUs_Anime4k->setEnabled(0);
- ui->pushButton_VerifyGPUsConfig_Anime4k->setEnabled(0);
- }
-}
-void MainWindow::on_checkBox_isCompatible_Waifu2x_NCNN_Vulkan_NEW_clicked()
-{
- ui->checkBox_isCompatible_Waifu2x_NCNN_Vulkan_NEW->setChecked(isCompatible_Waifu2x_NCNN_Vulkan_NEW);
-}
-void MainWindow::on_checkBox_isCompatible_Waifu2x_NCNN_Vulkan_NEW_FP16P_clicked()
-{
- ui->checkBox_isCompatible_Waifu2x_NCNN_Vulkan_NEW_FP16P->setChecked(isCompatible_Waifu2x_NCNN_Vulkan_NEW_FP16P);
-}
-void MainWindow::on_checkBox_isCompatible_Waifu2x_NCNN_Vulkan_OLD_clicked()
-{
- ui->checkBox_isCompatible_Waifu2x_NCNN_Vulkan_OLD->setChecked(isCompatible_Waifu2x_NCNN_Vulkan_OLD);
-}
-void MainWindow::on_checkBox_isCompatible_SRMD_NCNN_Vulkan_clicked()
-{
- ui->checkBox_isCompatible_SRMD_NCNN_Vulkan->setChecked(isCompatible_SRMD_NCNN_Vulkan);
-}
-void MainWindow::on_checkBox_isCompatible_SRMD_CUDA_clicked()
-{
- ui->checkBox_isCompatible_SRMD_CUDA->setChecked(isCompatible_SRMD_CUDA);
-}
-void MainWindow::on_checkBox_isCompatible_Waifu2x_Converter_clicked()
-{
- ui->checkBox_isCompatible_Waifu2x_Converter->setChecked(isCompatible_Waifu2x_Converter);
-}
-void MainWindow::on_checkBox_isCompatible_Anime4k_CPU_clicked()
-{
- ui->checkBox_isCompatible_Anime4k_CPU->setChecked(isCompatible_Anime4k_CPU);
-}
-void MainWindow::on_checkBox_isCompatible_Anime4k_GPU_clicked()
-{
- ui->checkBox_isCompatible_Anime4k_GPU->setChecked(isCompatible_Anime4k_GPU);
-}
-void MainWindow::on_checkBox_isCompatible_FFmpeg_clicked()
-{
- ui->checkBox_isCompatible_FFmpeg->setChecked(isCompatible_FFmpeg);
-}
-void MainWindow::on_checkBox_isCompatible_FFprobe_clicked()
-{
- ui->checkBox_isCompatible_FFprobe->setChecked(isCompatible_FFprobe);
-}
-void MainWindow::on_checkBox_isCompatible_ImageMagick_clicked()
-{
- ui->checkBox_isCompatible_ImageMagick->setChecked(isCompatible_ImageMagick);
-}
-void MainWindow::on_checkBox_isCompatible_Gifsicle_clicked()
-{
- ui->checkBox_isCompatible_Gifsicle->setChecked(isCompatible_Gifsicle);
-}
-void MainWindow::on_checkBox_isCompatible_SoX_clicked()
-{
- ui->checkBox_isCompatible_SoX->setChecked(isCompatible_SoX);
-}
-void MainWindow::on_checkBox_GPUMode_Anime4K_stateChanged(int arg1)
-{
- if(ui->checkBox_GPUMode_Anime4K->isChecked())
- {
- ui->checkBox_SpecifyGPU_Anime4k->setEnabled(1);
- ui->comboBox_GPGPUModel_A4k->setEnabled(1);
- on_comboBox_GPGPUModel_A4k_currentIndexChanged(1);
- }
- else
- {
- ui->checkBox_SpecifyGPU_Anime4k->setEnabled(0);
- ui->checkBox_SpecifyGPU_Anime4k->setChecked(0);
- ui->comboBox_GPGPUModel_A4k->setEnabled(0);
- on_comboBox_GPGPUModel_A4k_currentIndexChanged(1);
- }
-}
-void MainWindow::on_checkBox_ShowInterPro_stateChanged(int arg1)
-{
- if(ui->checkBox_ShowInterPro->isChecked()==false)
- {
- emit Send_CurrentFileProgress_Stop();
- }
-}
-void MainWindow::on_checkBox_isCompatible_Waifu2x_Caffe_CPU_clicked()
-{
- ui->checkBox_isCompatible_Waifu2x_Caffe_CPU->setChecked(isCompatible_Waifu2x_Caffe_CPU);
-}
-void MainWindow::on_checkBox_isCompatible_Waifu2x_Caffe_GPU_clicked()
-{
- ui->checkBox_isCompatible_Waifu2x_Caffe_GPU->setChecked(isCompatible_Waifu2x_Caffe_GPU);
-}
-void MainWindow::on_checkBox_isCompatible_Waifu2x_Caffe_cuDNN_clicked()
-{
- ui->checkBox_isCompatible_Waifu2x_Caffe_cuDNN->setChecked(isCompatible_Waifu2x_Caffe_cuDNN);
-}
-void MainWindow::on_pushButton_SplitSize_Add_Waifu2xCaffe_clicked()
-{
- int VAL = ui->spinBox_SplitSize_Waifu2xCaffe->value()*2;
- if(VAL<=999999999)
- {
- ui->spinBox_SplitSize_Waifu2xCaffe->setValue(VAL);
- }
-}
-void MainWindow::on_pushButton_SplitSize_Minus_Waifu2xCaffe_clicked()
-{
- int VAL = ui->spinBox_SplitSize_Waifu2xCaffe->value()/2;
- if(VAL>=2)
- {
- ui->spinBox_SplitSize_Waifu2xCaffe->setValue(VAL);
- }
-}
-void MainWindow::on_checkBox_isCompatible_Realsr_NCNN_Vulkan_clicked()
-{
- ui->checkBox_isCompatible_Realsr_NCNN_Vulkan->setChecked(isCompatible_Realsr_NCNN_Vulkan);
-}
-void MainWindow::on_checkBox_ACNet_Anime4K_stateChanged(int arg1)
-{
- if(ui->checkBox_ACNet_Anime4K->isChecked())
- {
- ui->checkBox_HDNMode_Anime4k->setEnabled(1);
- ui->groupBox_PostProcessing_Anime4k->setEnabled(0);
- ui->groupBox_PreProcessing_Anime4k->setEnabled(0);
- ui->doubleSpinBox_PushColorStrength_Anime4K->setEnabled(0);
- ui->doubleSpinBox_PushGradientStrength_Anime4K->setEnabled(0);
- ui->spinBox_Passes_Anime4K->setEnabled(0);
- ui->spinBox_PushColorCount_Anime4K->setEnabled(0);
- }
- else
- {
- ui->checkBox_HDNMode_Anime4k->setEnabled(0);
- on_checkBox_GPUMode_Anime4K_stateChanged(0);
- on_checkBox_SpecifyGPU_Anime4k_stateChanged(0);
- ui->groupBox_PostProcessing_Anime4k->setEnabled(1);
- ui->groupBox_PreProcessing_Anime4k->setEnabled(1);
- ui->doubleSpinBox_PushColorStrength_Anime4K->setEnabled(1);
- ui->doubleSpinBox_PushGradientStrength_Anime4K->setEnabled(1);
- ui->spinBox_Passes_Anime4K->setEnabled(1);
- ui->spinBox_PushColorCount_Anime4K->setEnabled(1);
- }
- DenoiseLevelSpinboxSetting_Anime4k();
-}
-void MainWindow::on_checkBox_HDNMode_Anime4k_stateChanged(int arg1)
-{
- DenoiseLevelSpinboxSetting_Anime4k();
-}
-/*
-生成独立cmd文件来执行cmd命令
-*/
-void MainWindow::ExecuteCMD_batFile(QString cmd_str,bool requestAdmin)
-{
- ExecuteCMD_batFile_QMutex.lock();
- QString cmd_commands = "@echo off\n "+cmd_str+"\n exit";
- Delay_msec_sleep(10);//延时防止文件名称碰撞
- file_mkDir(Current_Path+"/batFiles_tmp");
- QString Bat_path = Current_Path+"/batFiles_tmp/W2xEX_"+QDateTime::currentDateTime().toString("dhhmmsszzz")+".bat";
- //========
- QFile OpenFile_cmdFile(Bat_path);
- OpenFile_cmdFile.remove();
- if (OpenFile_cmdFile.open(QIODevice::ReadWrite | QIODevice::Text)) //QIODevice::ReadWrite支持读写
- {
- QTextStream stream(&OpenFile_cmdFile);
- stream << cmd_commands;
- }
- OpenFile_cmdFile.close();
- if(requestAdmin)
- {
- ShellExecuteW(NULL, QString("runas").toStdWString().c_str(), QString(Bat_path).toStdWString().c_str(), QString(Bat_path).toStdWString().c_str(), NULL, 1);
- }
- else
- {
- QDesktopServices::openUrl(QUrl("file:"+QUrl::toPercentEncoding(Bat_path)));
- }
- //========
- ExecuteCMD_batFile_QMutex.unlock();
-}
-void MainWindow::Del_TempBatFile()
-{
- file_DelDir(Current_Path+"/batFiles_tmp");
-}
-void MainWindow::comboBox_UpdateChannel_setCurrentIndex_self(int index)
-{
- comboBox_UpdateChannel_setCurrentIndex_self_QMutex.lock();
- isClicked_comboBox_UpdateChannel=false;
- ui->comboBox_UpdateChannel->setCurrentIndex(index);
- isClicked_comboBox_UpdateChannel=true;
- comboBox_UpdateChannel_setCurrentIndex_self_QMutex.unlock();
-}
-void MainWindow::on_comboBox_UpdateChannel_currentIndexChanged(int index)
-{
- if(isClicked_comboBox_UpdateChannel && AutoUpdate.isRunning()==false)
- {
- AutoUpdate = QtConcurrent::run(this, &MainWindow::CheckUpadte_Auto);//自动检查更新线程
- }
-}
-void MainWindow::on_checkBox_ReplaceOriginalFile_stateChanged(int arg1)
-{
- if(ui->checkBox_ReplaceOriginalFile->isChecked())
- {
- ui->groupBox_OutPut->setEnabled(0);
- ui->checkBox_OutPath_isEnabled->setChecked(0);
- ui->checkBox_DelOriginal->setEnabled(0);
- }
- else
- {
- ui->groupBox_OutPut->setEnabled(1);
- ui->checkBox_DelOriginal->setEnabled(1);
- }
-}
-void MainWindow::checkBox_ReplaceOriginalFile_setEnabled_True_Self()
-{
- if(ui->checkBox_DelOriginal->isChecked()==false && ui->checkBox_OutPath_isEnabled->isChecked()==false)
- {
- ui->checkBox_ReplaceOriginalFile->setEnabled(1);
- }
-}
-bool MainWindow::ReplaceOriginalFile(QString original_fullpath,QString output_fullpath)
-{
- //检查是否启用替换源文件,以及输出文件是否存在
- if(ui->checkBox_ReplaceOriginalFile->isChecked()==false || QFile::exists(output_fullpath)==false)return false;
- //=================
- QFileInfo fileinfo_original_fullpath(original_fullpath);
- QFileInfo fileinfo_output_fullpath(output_fullpath);
- QString file_name = file_getBaseName(original_fullpath);//获取源文件的文件名
- QString file_ext = fileinfo_output_fullpath.suffix();//获取输出文件的后辍
- QString file_path = file_getFolderPath(fileinfo_original_fullpath);//获取源文件的文件路径
- //=================
- QString Target_fullpath=file_path+"/"+file_name+"."+file_ext;
- //=================
- if(QAction_checkBox_MoveToRecycleBin_checkBox_ReplaceOriginalFile->isChecked())
- {
- file_MoveToTrash(original_fullpath);
- file_MoveToTrash(Target_fullpath);
- }
- else
- {
- QFile::remove(original_fullpath);
- QFile::remove(Target_fullpath);
- }
- //=================
- if(QFile::rename(output_fullpath,Target_fullpath)==false)
- {
- emit Send_TextBrowser_NewMessage(tr("Error! Failed to move [")+output_fullpath+tr("] to [")+Target_fullpath+"]");
- }
- return true;
-}
-void MainWindow::on_checkBox_isCustFontEnable_stateChanged(int arg1)
-{
- if(ui->checkBox_isCustFontEnable->isChecked())
- {
- ui->pushButton_Save_GlobalFontSize->setEnabled(1);
- ui->spinBox_GlobalFontSize->setEnabled(1);
- ui->fontComboBox_CustFont->setEnabled(1);
- }
- else
- {
- ui->pushButton_Save_GlobalFontSize->setEnabled(0);
- ui->spinBox_GlobalFontSize->setEnabled(0);
- ui->fontComboBox_CustFont->setEnabled(0);
- }
-}
-void MainWindow::OutputSettingsArea_setEnabled(bool isEnabled)
-{
- ui->scrollArea_outputPathSettings->setEnabled(isEnabled);
- ui->lineEdit_outputPath->setClearButtonEnabled(isEnabled);
- if(isEnabled==true)
- {
- ui->lineEdit_outputPath->setFocusPolicy(Qt::StrongFocus);
- }
- else
- {
- ui->lineEdit_outputPath->setFocusPolicy(Qt::NoFocus);
- }
-}
-//事件过滤器
-bool MainWindow::eventFilter(QObject *target, QEvent *event)
-{
- //=============================
- //按下 Delete 移除文件列表里的文件
- //=============================
- if (target == ui->tableView_image || target == ui->tableView_gif || target == ui->tableView_video)
- {
- if (event->type() == QEvent::KeyPress)
- {
- QKeyEvent *keyEvent = static_cast(event);
- if (keyEvent->key() == Qt::Key_Delete)
- {
- if(RemoveFile_FilesList_QAction_FileList->isEnabled())
- {
- on_pushButton_RemoveItem_clicked();
- }
- return true;
- }
- if ((keyEvent->modifiers() == Qt::ControlModifier) && (keyEvent->key() == Qt::Key_A))
- {
- if(Apply_CustRes_QAction_FileList->isEnabled())
- {
- EnableApply2All_CustRes=false;
- on_pushButton_CustRes_apply_clicked();
- EnableApply2All_CustRes=true;
- }
- return true;
- }
- if ((keyEvent->modifiers() == Qt::ControlModifier) && (keyEvent->key() == Qt::Key_C))
- {
- if(Cancel_CustRes_QAction_FileList->isEnabled())
- {
- EnableApply2All_CustRes=false;
- on_pushButton_CustRes_cancel_clicked();
- EnableApply2All_CustRes=true;
- }
- return true;
- }
- }
- }
- //==============
- return false;
-}
-void MainWindow::on_pushButton_ResizeFilesListSplitter_clicked()
-{
- ui->splitter_FilesList->setSizes(QList() << 1 << 1 << 1);
-}
-void MainWindow::on_comboBox_GPGPUModel_A4k_currentIndexChanged(int index)
-{
- if(ui->comboBox_GPGPUModel_A4k->currentText().toLower().trimmed()=="opencl" && ui->checkBox_GPUMode_Anime4K->isChecked())
- {
- ui->spinBox_OpenCLCommandQueues_A4k->setEnabled(1);
- ui->checkBox_OpenCLParallelIO_A4k->setEnabled(1);
- }
- else
- {
- ui->spinBox_OpenCLCommandQueues_A4k->setEnabled(0);
- ui->checkBox_OpenCLParallelIO_A4k->setEnabled(0);
- }
-}
-void MainWindow::on_checkBox_DisableGPU_converter_stateChanged(int arg1)
-{
- if(ui->checkBox_DisableGPU_converter->isChecked())
- {
- ui->checkBox_MultiGPU_Waifu2xConverter->setChecked(0);
- ui->comboBox_TargetProcessor_converter->setEnabled(0);
- ui->comboBox_TargetProcessor_converter->setCurrentIndex(0);
- ui->checkBox_MultiGPU_Waifu2xConverter->setEnabled(0);
- }
- else
- {
- ui->comboBox_TargetProcessor_converter->setEnabled(1);
- ui->checkBox_MultiGPU_Waifu2xConverter->setEnabled(1);
- }
-}
-void MainWindow::on_groupBox_video_settings_clicked()
-{
- if(ui->groupBox_video_settings->isChecked())
- {
- //======
- if(isCustomVideoSettingsClicked==true)
- {
- QMessageBox *MSG = new QMessageBox();
- MSG->setWindowTitle(tr("Warning"));
- MSG->setText(tr("Change Custom video settings might cause ERROR.\n\nMake sure you know what you are doing before change any settings."));
- MSG->setIcon(QMessageBox::Warning);
- MSG->setModal(true);
- MSG->show();
- }
- //======
- ui->groupBox_OutputVideoSettings->setEnabled(1);
- ui->groupBox_ToMp4VideoSettings->setEnabled(1);
- ui->pushButton_encodersList->setEnabled(1);
- ui->pushButton_ResetVideoSettings->setEnabled(1);
- }
- else
- {
- ui->groupBox_OutputVideoSettings->setEnabled(0);
- ui->groupBox_ToMp4VideoSettings->setEnabled(0);
- ui->pushButton_encodersList->setEnabled(0);
- ui->pushButton_ResetVideoSettings->setEnabled(0);
- }
-}
-void MainWindow::Set_checkBox_DisableResize_gif_Checked()
-{
- emit Send_TextBrowser_NewMessage(tr("[Disable \"-resize\"] is automatically enabled to fix compatibility issue and improve performance."));
- ui->checkBox_DisableResize_gif->setChecked(true);
-}
-
-void MainWindow::on_pushButton_TurnOffScreen_clicked()
-{
- if(TurnOffScreen_QF.isRunning() == true)return;
- TurnOffScreen_QF = QtConcurrent::run(this, &MainWindow::TurnOffScreen);//关闭显示器
-}
-/*
-调用nircmd关闭显示器
-*/
-void MainWindow::TurnOffScreen()
-{
- QProcess *OffScreen = new QProcess();
- OffScreen->start("\""+Current_Path+"/nircmd-x64/nircmd.exe\" monitor off");
- OffScreen->waitForStarted(5000);
- OffScreen->waitForFinished(5000);
- OffScreen->kill();
- return;
-}
-/*
-禁用&启用 开始按钮
-*/
-void MainWindow::pushButton_Start_setEnabled_self(bool isEnabled)
-{
- ui->pushButton_Start->setEnabled(isEnabled);
- Start_SystemTrayIcon->setEnabled(isEnabled);
- ui->pushButton_Start->setVisible(isEnabled);
-}
-/*
-禁用&启用 暂停按钮
-*/
-void MainWindow::pushButton_Stop_setEnabled_self(bool isEnabled)
-{
- ui->pushButton_Stop->setEnabled(isEnabled);
- Pause_SystemTrayIcon->setEnabled(isEnabled);
- ui->pushButton_Stop->setVisible(isEnabled);
-}
-
-
-void MainWindow::on_pushButton_MultipleOfFPS_VFI_MIN_clicked()
-{
- int VAL = 2;
- if(ui->comboBox_Engine_VFI->currentIndex()==2)
- {
- VAL = ui->spinBox_MultipleOfFPS_VFI->value()-1;
- }
- else
- {
- VAL = ui->spinBox_MultipleOfFPS_VFI->value()/2;
- }
- if(VAL>=2)
- {
- ui->spinBox_MultipleOfFPS_VFI->setValue(VAL);
- }
-}
-
-void MainWindow::on_pushButton_MultipleOfFPS_VFI_ADD_clicked()
-{
- int VAL = 2;
- if(ui->comboBox_Engine_VFI->currentIndex()==2)
- {
- VAL = ui->spinBox_MultipleOfFPS_VFI->value()+1;
- }
- else
- {
- VAL = ui->spinBox_MultipleOfFPS_VFI->value()*2;
- }
- if(VAL<=999999999)
- {
- ui->spinBox_MultipleOfFPS_VFI->setValue(VAL);
- }
-}
+/*
+ Copyright (C) 2021 Aaron Feng
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published
+ by the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see .
+
+ My Github homepage: https://github.com/AaronFeng753
+*/
+
+#include "mainwindow.h"
+#include "ui_mainwindow.h"
+
+MainWindow::MainWindow(QWidget *parent)
+ : QMainWindow(parent)
+ , ui(new Ui::MainWindow)
+{
+ ui->setupUi(this);
+ qRegisterMetaTypeStreamOperators("QList_QMap_QStrQStr");
+ QThreadPool::globalInstance()->setMaxThreadCount(60);//解除全局线程池的最大线程数量限制
+ //==============
+ this->setWindowTitle("Waifu2x-Extension-GUI "+VERSION+" by Aaron Feng");
+ //==============
+ translator = new QTranslator(this);
+ //==============
+ ui->tabWidget->setCurrentIndex(1);//显示home tab
+ ui->tabWidget->tabBar()->setTabTextColor(0,Qt::red);
+ on_tabWidget_currentChanged(1);
+ ui->tabWidget_Engines->setCurrentIndex(0);
+ this->setAcceptDrops(true);//mainwindow接收drop
+ Init_Table();//初始化table
+ ui->groupBox_CurrentFile->setVisible(0);//隐藏当前文件进度
+ pushButton_Stop_setEnabled_self(0);//禁用隐藏暂停按钮
+ ui->pushButton_ForceRetry->setVisible(0);
+ ui->progressBar_CompatibilityTest->setVisible(0);
+ //=================== 初始隐藏所有table和禁用按钮 ======================
+ ui->tableView_image->setVisible(0);
+ ui->tableView_gif->setVisible(0);
+ ui->tableView_video->setVisible(0);
+ Table_FileCount_reload();//重载文件列表下的文件数量统计
+ //==============
+ Init_ActionsMenu_checkBox_ReplaceOriginalFile();//第一次初始化[替换原文件]的右键菜单(需要在载入设定前设置为checkable
+ Init_ActionsMenu_checkBox_DelOriginal();
+ //=========安装事件过滤器==========
+ ui->tableView_image->installEventFilter(this);
+ ui->tableView_gif->installEventFilter(this);
+ ui->tableView_video->installEventFilter(this);
+ //===========================================
+ connect(this, SIGNAL(Send_Set_checkBox_DisableResize_gif_Checked()), this, SLOT(Set_checkBox_DisableResize_gif_Checked()));
+ connect(this, SIGNAL(Send_Table_EnableSorting(bool)), this, SLOT(Table_EnableSorting(bool)));
+ connect(this, SIGNAL(Send_Add_progressBar_CompatibilityTest()), this, SLOT(Add_progressBar_CompatibilityTest()));
+ connect(this, SIGNAL(Send_Unable2Connect_RawGithubusercontentCom()), this, SLOT(Unable2Connect_RawGithubusercontentCom()));
+ connect(this, SIGNAL(Send_SetEnable_pushButton_ForceRetry_self()), this, SLOT(SetEnable_pushButton_ForceRetry_self()));
+ connect(this, SIGNAL(Send_SystemTray_NewMessage(QString)), this, SLOT(SystemTray_NewMessage(QString)));
+ connect(this, SIGNAL(Send_PrograssBar_Range_min_max(int, int)), this, SLOT(progressbar_setRange_min_max(int, int)));
+ connect(this, SIGNAL(Send_progressbar_Add()), this, SLOT(progressbar_Add()));
+ connect(this, SIGNAL(Send_Table_image_ChangeStatus_rowNumInt_statusQString(int, QString)), this, SLOT(Table_image_ChangeStatus_rowNumInt_statusQString(int, QString)));
+ connect(this, SIGNAL(Send_Table_gif_ChangeStatus_rowNumInt_statusQString(int, QString)), this, SLOT(Table_gif_ChangeStatus_rowNumInt_statusQString(int, QString)));
+ connect(this, SIGNAL(Send_Table_video_ChangeStatus_rowNumInt_statusQString(int, QString)), this, SLOT(Table_video_ChangeStatus_rowNumInt_statusQString(int, QString)));
+ connect(this, SIGNAL(Send_Table_FileCount_reload()), this, SLOT(Table_FileCount_reload()));
+ connect(this, SIGNAL(Send_Table_image_insert_fileName_fullPath(QString,QString)), this, SLOT(Table_image_insert_fileName_fullPath(QString,QString)));
+ connect(this, SIGNAL(Send_Table_gif_insert_fileName_fullPath(QString,QString)), this, SLOT(Table_gif_insert_fileName_fullPath(QString,QString)));
+ connect(this, SIGNAL(Send_Table_video_insert_fileName_fullPath(QString,QString)), this, SLOT(Table_video_insert_fileName_fullPath(QString,QString)));
+ connect(this, SIGNAL(Send_Table_image_CustRes_rowNumInt_HeightQString_WidthQString(int,QString,QString)), this, SLOT(Table_image_CustRes_rowNumInt_HeightQString_WidthQString(int,QString,QString)));
+ connect(this, SIGNAL(Send_Table_gif_CustRes_rowNumInt_HeightQString_WidthQString(int,QString,QString)), this, SLOT(Table_gif_CustRes_rowNumInt_HeightQString_WidthQString(int,QString,QString)));
+ connect(this, SIGNAL(Send_Table_video_CustRes_rowNumInt_HeightQString_WidthQString(int,QString,QString)), this, SLOT(Table_video_CustRes_rowNumInt_HeightQString_WidthQString(int,QString,QString)));
+ connect(this, SIGNAL(Send_Table_Read_Saved_Table_Filelist_Finished(QString)), this, SLOT(Table_Read_Saved_Table_Filelist_Finished(QString)));
+ connect(this, SIGNAL(Send_Table_Save_Current_Table_Filelist_Finished()), this, SLOT(Table_Save_Current_Table_Filelist_Finished()));
+ connect(this, SIGNAL(Send_Waifu2x_Finished()), this, SLOT(Waifu2x_Finished()));
+ connect(this, SIGNAL(Send_Waifu2x_Finished_manual()), this, SLOT(Waifu2x_Finished_manual()));
+ connect(this, SIGNAL(Send_TextBrowser_NewMessage(QString)), this, SLOT(TextBrowser_NewMessage(QString)));
+ connect(this, SIGNAL(Send_Waifu2x_Compatibility_Test_finished()), this, SLOT(Waifu2x_Compatibility_Test_finished()));
+ connect(this, SIGNAL(Send_Waifu2x_DetectGPU_finished()), this, SLOT(Waifu2x_DetectGPU_finished()));
+ connect(this, SIGNAL(Send_Realsr_ncnn_vulkan_DetectGPU_finished()), this, SLOT(Realsr_ncnn_vulkan_DetectGPU_finished()));
+ connect(this, SIGNAL(Send_CheckUpadte_NewUpdate(QString,QString)), this, SLOT(CheckUpadte_NewUpdate(QString,QString)));
+ connect(this, SIGNAL(Send_SystemShutDown()), this, SLOT(SystemShutDown()));
+ connect(this, SIGNAL(Send_Waifu2x_DumpProcessorList_converter_finished()), this, SLOT(Waifu2x_DumpProcessorList_converter_finished()));
+ connect(this, SIGNAL(Send_Read_urls_finfished()), this, SLOT(Read_urls_finfished()));
+ connect(this, SIGNAL(Send_FinishedProcessing_DN()), this, SLOT(FinishedProcessing_DN()));
+ connect(this, SIGNAL(Send_SRMD_DetectGPU_finished()), this, SLOT(SRMD_DetectGPU_finished()));
+ connect(this, SIGNAL(Send_FrameInterpolation_DetectGPU_finished()), this, SLOT(FrameInterpolation_DetectGPU_finished()));
+ connect(this, SIGNAL(Send_video_write_VideoConfiguration(QString,int,int,bool,int,int,QString,bool,QString,QString,bool,int)), this, SLOT(video_write_VideoConfiguration(QString,int,int,bool,int,int,QString,bool,QString,QString,bool,int)));
+ connect(this, SIGNAL(Send_Settings_Save()), this, SLOT(Settings_Save()));
+ connect(this, SIGNAL(Send_video_write_Progress_ProcessBySegment(QString,int,bool,bool,int,int)), this, SLOT(video_write_Progress_ProcessBySegment(QString,int,bool,bool,int,int)));
+ connect(this, SIGNAL(Send_Donate_ReplaceQRCode(QString)), this, SLOT(Donate_ReplaceQRCode(QString)));
+ connect(this, SIGNAL(Send_CurrentFileProgress_Start(QString,int)), this, SLOT(CurrentFileProgress_Start(QString,int)));
+ connect(this, SIGNAL(Send_CurrentFileProgress_Stop()), this, SLOT(CurrentFileProgress_Stop()));
+ connect(this, SIGNAL(Send_CurrentFileProgress_progressbar_Add()), this, SLOT(CurrentFileProgress_progressbar_Add()));
+ connect(this, SIGNAL(Send_CurrentFileProgress_progressbar_Add_SegmentDuration(int)), this, SLOT(CurrentFileProgress_progressbar_Add_SegmentDuration(int)));
+ connect(this, SIGNAL(Send_CurrentFileProgress_progressbar_SetFinishedValue(int)), this, SLOT(CurrentFileProgress_progressbar_SetFinishedValue(int)));
+ //======
+ TimeCostTimer = new QTimer();
+ connect(TimeCostTimer, SIGNAL(timeout()), this, SLOT(TimeSlot()));
+ //==================================================
+ Settings_Read_Apply();//读取与应用设置
+ //=====================================
+ Set_Font_fixed();//固定字体
+ //=====================================
+ QtConcurrent::run(this, &MainWindow::DeleteErrorLog_Waifu2xCaffe);//删除Waifu2xCaffe生成的错误日志
+ QtConcurrent::run(this, &MainWindow::Del_TempBatFile);//删除bat文件缓存
+ AutoUpdate = QtConcurrent::run(this, &MainWindow::CheckUpadte_Auto);//自动检查更新线程
+ DownloadOnlineQRCode = QtConcurrent::run(this, &MainWindow::Donate_DownloadOnlineQRCode);//在线更新捐赠二维码
+ SystemShutDown_isAutoShutDown();//上次是否自动关机
+ //====================================
+ TextBrowser_StartMes();//显示启动msg
+ //===================================
+ Tip_FirstTimeStart();//首次启动
+ file_mkDir(Current_Path+"/FilesList_W2xEX");//生成保存文件列表的文件夹
+ //==============
+ /*
+ 校验软件是否对所在目录有写权限
+ */
+ if(file_isDirWritable(Current_Path)==false)
+ {
+ QMessageBox Msg(QMessageBox::Question, QString(tr("Error")), QString(tr("It is detected that this software lacks the necessary permissions to run."
+ "\n\nPlease close this software and start this software again after giving this software administrator permission. "
+ "Or reinstall the software into a directory that can run normally without administrator rights.\n\nOtherwise, this software may not work properly.")));
+ Msg.setIcon(QMessageBox::Warning);
+ Msg.addButton(QString("OK"), QMessageBox::NoRole);
+ Msg.exec();
+ }
+ //==============
+ Init_SystemTrayIcon();//初始化托盘图标
+ Init_ActionsMenu_lineEdit_outputPath();//初始化 输出路径 lineEDIT的右键菜单
+ Init_ActionsMenu_FilesList();
+ Init_ActionsMenu_pushButton_RemoveItem();
+ Init_ActionsMenu_checkBox_ReplaceOriginalFile();//第二次初始化[替换原文件]的右键菜单(载入语言设置
+ Init_ActionsMenu_checkBox_DelOriginal();
+ //==============
+ this->showNormal();
+ this->activateWindow();
+ this->setWindowState((this->windowState() & ~Qt::WindowMinimized) | Qt::WindowActive);
+ this->adjustSize();
+}
+
+MainWindow::~MainWindow()
+{
+ delete ui;
+}
+
+void MainWindow::closeEvent(QCloseEvent *event)
+{
+ if(isAlreadyClosed)//解决QT退出时重复调用closeEvent的问题
+ {
+ event->accept();
+ return;
+ }
+ //=============== 询问是否退出 =======================
+ if(ui->checkBox_PromptWhenExit->isChecked())
+ {
+ QMessageBox Msg(QMessageBox::Question, QString(tr("Notification")), QString(tr("Do you really wanna exit Waifu2x-Extension-GUI ?")));
+ Msg.setIcon(QMessageBox::Question);
+ QAbstractButton *pYesBtn = Msg.addButton(QString(tr("YES")), QMessageBox::YesRole);
+ QAbstractButton *pNoBtn = Msg.addButton(QString(tr("NO")), QMessageBox::NoRole);
+ Msg.exec();
+ if (Msg.clickedButton() == pNoBtn)
+ {
+ event->ignore();
+ return;
+ }
+ if (Msg.clickedButton() == pYesBtn)isAlreadyClosed=true;
+ }
+ //=============================
+ systemTray->hide();
+ this->hide();
+ QApplication::setQuitOnLastWindowClosed(true);//無窗口時不再保持運行
+ QApplication::closeAllWindows();
+ //====
+ if(Waifu2xMain.isRunning() == true)
+ {
+ TimeCostTimer->stop();
+ pushButton_Stop_setEnabled_self(0);//隐藏stop button
+ waifu2x_STOP = true;
+ emit TextBrowser_NewMessage(tr("Trying to stop, please wait..."));
+ //======
+ QMessageBox *MSG_2 = new QMessageBox();
+ MSG_2->setWindowTitle(tr("Notification")+" @Waifu2x-Extension-GUI");
+ MSG_2->setText(tr("Waiting for the files processing thread to pause"));
+ MSG_2->setIcon(QMessageBox::Information);
+ MSG_2->setModal(true);
+ MSG_2->setStandardButtons(NULL);
+ MSG_2->setWindowFlags(Qt::CustomizeWindowHint | Qt::WindowTitleHint);
+ MSG_2->show();
+ }
+ else
+ {
+ QMessageBox *MSG_2 = new QMessageBox();
+ MSG_2->setWindowTitle(tr("Notification")+" @Waifu2x-Extension-GUI");
+ MSG_2->setText(tr("Closing...\n\nPlease wait"));
+ MSG_2->setIcon(QMessageBox::Information);
+ MSG_2->setModal(true);
+ MSG_2->setStandardButtons(NULL);
+ MSG_2->setWindowFlags(Qt::CustomizeWindowHint | Qt::WindowTitleHint);
+ MSG_2->show();
+ }
+ AutoUpdate.cancel();
+ DownloadOnlineQRCode.cancel();
+ //=====
+ bool AutoSaveSettings = ui->checkBox_AutoSaveSettings->isChecked();
+ if(AutoSaveSettings&&(!Settings_isReseted))
+ {
+ Settings_Save();
+ QtConcurrent::run(this, &MainWindow::Auto_Save_Settings_Watchdog,true);
+ }
+ else
+ {
+ QtConcurrent::run(this, &MainWindow::Auto_Save_Settings_Watchdog,false);
+ }
+}
+
+int MainWindow::Auto_Save_Settings_Watchdog(bool isWaitForSave)
+{
+ Waifu2xMain.waitForFinished();
+ //======
+ if(isWaitForSave == true)
+ {
+ Delay_msec_sleep(1000);
+ QString settings_ini = Current_Path+"/settings.ini";
+ while(!QFile::exists(settings_ini))
+ {
+ Delay_msec_sleep(250);
+ }
+ Delay_msec_sleep(3000);
+ }
+ //=====
+ Force_close();
+ //====
+ return 0;
+}
+
+int MainWindow::Force_close()
+{
+ //=============
+ QStringList TaskNameList;
+ TaskNameList << "convert_waifu2xEX.exe"<<"ffmpeg_waifu2xEX.exe"<<"ffprobe_waifu2xEX.exe"<<"identify_waifu2xEX.exe"<<"gifsicle_waifu2xEX.exe"<<"waifu2x-ncnn-vulkan_waifu2xEX.exe"
+ <<"waifu2x-ncnn-vulkan-fp16p_waifu2xEX.exe"<<"Anime4K_waifu2xEX.exe"<<"waifu2x-caffe_waifu2xEX.exe"<<"srmd-ncnn-vulkan_waifu2xEX.exe"<<"realsr-ncnn-vulkan_waifu2xEX.exe"
+ <<"waifu2x-converter-cpp_waifu2xEX.exe"<<"sox_waifu2xEX.exe"<<"wget_waifu2xEX.exe"<<"rife-ncnn-vulkan_waifu2xEX.exe"<<"cain-ncnn-vulkan_waifu2xEX.exe"<<"dain-ncnn-vulkan_waifu2xEX.exe"
+ <<"srmd-cuda_waifu2xEX.exe"<<"apngdis_waifu2xEX.exe"<<"apngasm_waifu2xEX.exe";
+ KILL_TASK_QStringList(TaskNameList,true);
+ //===========
+ QProcess Close;
+ Close.start("taskkill /f /t /fi \"imagename eq Waifu2x-Extension-GUI.exe\"");
+ Close.waitForStarted(10000);
+ Close.waitForFinished(10000);
+ return 0;
+}
+/*
+最小化
+*/
+void MainWindow::changeEvent(QEvent *e)
+{
+ if((e->type()==QEvent::WindowStateChange)&&this->isMinimized())
+ {
+ if(ui->checkBox_MinimizeToTaskbar->isChecked())
+ {
+ this->hide();
+ }
+ }
+}
+/*
+计时器到时执行的代码
+*/
+void MainWindow::TimeSlot()
+{
+ TimeCost++;
+ //====================总进度==================
+ QString TimeCostStr = tr("Time taken:[")+Seconds2hms(TimeCost)+"]";
+ ui->label_TimeCost->setText(TimeCostStr);
+ if(ui->label_TimeRemain->isVisible())
+ {
+ long unsigned int TaskNumFinished_tmp = TaskNumFinished;
+ long unsigned int TimeCost_tmp = TimeCost;
+ long unsigned int TaskNumTotal_tmp = TaskNumTotal;
+ if(TaskNumFinished_tmp>0&&TimeCost_tmp>0&&TaskNumTotal_tmp>0)
+ {
+ if(NewTaskFinished)
+ {
+ NewTaskFinished=false;
+ double avgTimeCost = (double)TimeCost_tmp/(double)TaskNumFinished_tmp;
+ ETA = avgTimeCost*((double)TaskNumTotal_tmp-(double)TaskNumFinished_tmp);
+ }
+ else
+ {
+ if(ETA>1)
+ {
+ ETA--;
+ }
+ }
+ QString TimeRemainingStr = tr("Time remaining:[")+Seconds2hms(ETA)+"]";
+ ui->label_TimeRemain->setText(TimeRemainingStr);
+ QDateTime time = QDateTime::currentDateTime();
+ long unsigned int Time_t = time.toTime_t();
+ Time_t+=ETA;
+ time = QDateTime::fromTime_t(Time_t);
+ QString Current_Time = time.toString("hh:mm:ss");
+ QString ETA_str = "ETA:["+Current_Time+"]";
+ ui->label_ETA->setText(ETA_str);
+ }
+ }
+ //====================当前文件=================
+ if(isStart_CurrentFile)
+ {
+ TimeCost_CurrentFile++;
+ QString TimeCostStr_CurrentFile = tr("Time taken:[")+Seconds2hms(TimeCost_CurrentFile)+"]";
+ ui->label_TimeCost_CurrentFile->setText(TimeCostStr_CurrentFile);
+ long unsigned int TaskNumFinished_tmp_CurrentFile = TaskNumFinished_CurrentFile;
+ long unsigned int TimeCost_tmp_CurrentFile = TimeCost_CurrentFile;
+ long unsigned int TaskNumTotal_tmp_CurrentFile = TaskNumTotal_CurrentFile;
+ if(TaskNumFinished_tmp_CurrentFile>0&&TimeCost_tmp_CurrentFile>0&&TaskNumTotal_tmp_CurrentFile>0)
+ {
+ if(NewTaskFinished_CurrentFile)
+ {
+ NewTaskFinished_CurrentFile=false;
+ double avgTimeCost_CurrentFile = (double)TimeCost_tmp_CurrentFile/(double)TaskNumFinished_tmp_CurrentFile;
+ ETA_CurrentFile = avgTimeCost_CurrentFile*((double)TaskNumTotal_tmp_CurrentFile-(double)TaskNumFinished_tmp_CurrentFile);
+ }
+ else
+ {
+ if(ETA_CurrentFile>1)
+ {
+ ETA_CurrentFile--;
+ }
+ }
+ QString TimeRemainingStr_CurrentFile = tr("Time remaining:[")+Seconds2hms(ETA_CurrentFile)+"]";
+ ui->label_TimeRemain_CurrentFile->setText(TimeRemainingStr_CurrentFile);
+ QDateTime time_CurrentFile = QDateTime::currentDateTime();
+ long unsigned int Time_t_CurrentFile = time_CurrentFile.toTime_t();
+ Time_t_CurrentFile+=ETA_CurrentFile;
+ time_CurrentFile = QDateTime::fromTime_t(Time_t_CurrentFile);
+ QString Current_Time_CurrentFile = time_CurrentFile.toString("hh:mm:ss");
+ QString ETA_str_CurrentFile = "ETA:["+Current_Time_CurrentFile+"]";
+ ui->label_ETA_CurrentFile->setText(ETA_str_CurrentFile);
+ }
+ }
+}
+QString MainWindow::Seconds2hms(long unsigned int seconds)
+{
+ if(seconds<=0)return "0:0:0";
+ long unsigned int hour = seconds / 3600;
+ long unsigned int min = (seconds-(hour*3600))/60;
+ long unsigned int sec = seconds - hour*3600 - min*60;
+ return QString::number(hour,10)+":"+QString::number(min,10)+":"+QString::number(sec,10);
+}
+
+void MainWindow::Set_Font_fixed()
+{
+ QFont font;
+ if(ui->checkBox_isCustFontEnable->isChecked())
+ {
+ font = ui->fontComboBox_CustFont->currentFont();
+ font.setPixelSize(ui->spinBox_GlobalFontSize->value());
+ }
+ else
+ {
+ font = qApp->font();
+ font.setPixelSize(15);
+ }
+ qApp->setFont(font);
+}
+
+void MainWindow::on_pushButton_ClearList_clicked()
+{
+ curRow_image = -1;
+ curRow_gif = -1;
+ curRow_video = -1;
+ Table_Clear();
+ Custom_resolution_list.clear();
+ ui->label_DropFile->setVisible(1);
+ ui->tableView_gif->setVisible(0);
+ ui->tableView_image->setVisible(0);
+ ui->tableView_video->setVisible(0);
+ Table_FileCount_reload();
+ progressbar_clear();
+}
+
+/*
+停止处理键
+*/
+void MainWindow::on_pushButton_Stop_clicked()
+{
+ if(Waifu2xMain.isRunning()==false)return;
+ TimeCostTimer->stop();
+ pushButton_Stop_setEnabled_self(0);//隐藏stop button
+ waifu2x_STOP = true;
+ emit TextBrowser_NewMessage(tr("Trying to stop, please wait..."));
+ QtConcurrent::run(this, &MainWindow::Wait_waifu2x_stop);
+}
+/*
+等待处理线程完全停止
+*/
+void MainWindow::Wait_waifu2x_stop()
+{
+ while(true)
+ {
+ if(waifu2x_STOP_confirm||ThreadNumRunning==0)
+ {
+ waifu2x_STOP_confirm = false;
+ Waifu2xMain.waitForFinished();
+ while(true)
+ {
+ if(Waifu2xMain.isRunning()==false)break;
+ Delay_msec_sleep(300);
+ }
+ emit TextBrowser_NewMessage(tr("Processing of files has stopped."));
+ QtConcurrent::run(this, &MainWindow::Play_NFSound);//成功暂停,播放提示音
+ break;
+ }
+ Delay_msec_sleep(300);
+ }
+ emit Send_Waifu2x_Finished_manual();
+}
+/*
+从tableview移除item
+*/
+int MainWindow::on_pushButton_RemoveItem_clicked()
+{
+ if(curRow_image==-1&&curRow_video==-1&&curRow_gif==-1)
+ {
+ ui->tableView_image->clearSelection();
+ ui->tableView_gif->clearSelection();
+ ui->tableView_video->clearSelection();
+ //=====
+ QMessageBox *MSG = new QMessageBox();
+ MSG->setWindowTitle(tr("Warning"));
+ MSG->setText(tr("No items are currently selected."));
+ MSG->setIcon(QMessageBox::Warning);
+ MSG->setModal(true);
+ MSG->show();
+ //=====
+ return 0;
+ }
+ //==========================
+ if(curRow_image >= 0)
+ {
+ CustRes_remove(Table_model_image->item(curRow_image,2)->text());
+ ui->tableView_image->setUpdatesEnabled(false);
+ Table_model_image->removeRow(curRow_image);
+ ui->tableView_image->setUpdatesEnabled(true);
+ curRow_image = -1;
+ ui->tableView_image->clearSelection();
+ }
+ //============================================================
+ if(curRow_video >= 0)
+ {
+ CustRes_remove(Table_model_video->item(curRow_video,2)->text());
+ ui->tableView_video->setUpdatesEnabled(false);
+ Table_model_video->removeRow(curRow_video);
+ ui->tableView_video->setUpdatesEnabled(true);
+ curRow_video = -1;
+ ui->tableView_video->clearSelection();
+ }
+ //============================================================
+ if(curRow_gif >= 0)
+ {
+ CustRes_remove(Table_model_gif->item(curRow_gif,2)->text());
+ ui->tableView_gif->setUpdatesEnabled(false);
+ Table_model_gif->removeRow(curRow_gif);
+ ui->tableView_gif->setUpdatesEnabled(true);
+ curRow_gif = -1;
+ ui->tableView_gif->clearSelection();
+ }
+ //==================================================
+ if(Table_model_gif->rowCount()==0)
+ {
+ ui->tableView_gif->setVisible(0);
+ }
+ if(Table_model_image->rowCount()==0)
+ {
+ ui->tableView_image->setVisible(0);
+ }
+ if(Table_model_video->rowCount()==0)
+ {
+ ui->tableView_video->setVisible(0);
+ }
+ //===================================================
+ if(Table_model_gif->rowCount()==0&&Table_model_image->rowCount()==0&&Table_model_video->rowCount()==0)
+ {
+ on_pushButton_ClearList_clicked();
+ }
+ Table_FileCount_reload();
+ //============
+ return 0;
+}
+
+//==========================================================
+/*
+============= 安全的阻塞延时 =====================
+*/
+void MainWindow::Delay_sec_sleep(int time)
+{
+ QThread::sleep(time);
+}
+
+void MainWindow::Delay_msec_sleep(int time)
+{
+ QThread::msleep(time);
+}
+//==========================================================
+
+/*
+播放提示音
+*/
+void MainWindow::Play_NFSound()
+{
+ if(ui->checkBox_NfSound->isChecked()==false)return;
+ //====
+ QString NFSound = Current_Path+"/NFSound_Waifu2xEX.mp3";
+ if(QFile::exists(NFSound)==false)
+ {
+ emit Send_TextBrowser_NewMessage(tr("Error! Notification sound file is missing!"));
+ return;
+ }
+ //====
+ QMediaPlayer *player = new QMediaPlayer;
+ player->setMedia(QUrl::fromLocalFile(NFSound));
+ player->play();
+}
+
+void MainWindow::on_pushButton_Report_clicked()
+{
+ QDesktopServices::openUrl(QUrl("https://github.com/AaronFeng753/Waifu2x-Extension-GUI/issues/new"));
+}
+
+void MainWindow::on_pushButton_ReadMe_clicked()
+{
+ if(ui->comboBox_language->currentIndex()==1)
+ {
+ QDesktopServices::openUrl(QUrl("https://github.com/AaronFeng753/Waifu2x-Extension-GUI/"));
+ QDesktopServices::openUrl(QUrl("https://gitee.com/aaronfeng0711/Waifu2x-Extension-GUI/"));
+ }
+ else
+ {
+ QDesktopServices::openUrl(QUrl("https://github.com/AaronFeng753/Waifu2x-Extension-GUI/"));
+ }
+}
+
+
+
+void MainWindow::on_comboBox_Engine_Image_currentIndexChanged(int index)
+{
+ switch(ui->comboBox_Engine_Image->currentIndex())
+ {
+ case 0:
+ {
+ ui->spinBox_DenoiseLevel_image->setRange(-1,3);
+ ui->spinBox_DenoiseLevel_image->setValue(2);
+ ui->spinBox_DenoiseLevel_image->setEnabled(1);
+ ui->spinBox_DenoiseLevel_image->setToolTip(tr("Range:-1(No noise reduction)~3"));
+ ui->label_ImageDenoiseLevel->setToolTip(tr("Range:-1(No noise reduction)~3"));
+ break;
+ }
+ case 1:
+ {
+ ui->spinBox_DenoiseLevel_image->setRange(0,3);
+ ui->spinBox_DenoiseLevel_image->setValue(2);
+ ui->spinBox_DenoiseLevel_image->setEnabled(1);
+ ui->spinBox_DenoiseLevel_image->setToolTip(tr("Range:0(No noise reduction)~3"));
+ ui->label_ImageDenoiseLevel->setToolTip(tr("Range:0(No noise reduction)~3"));
+ break;
+ }
+ case 2:
+ case 6:
+ {
+ ui->spinBox_DenoiseLevel_image->setRange(-1,10);
+ ui->spinBox_DenoiseLevel_image->setValue(4);
+ ui->spinBox_DenoiseLevel_image->setEnabled(1);
+ ui->spinBox_DenoiseLevel_image->setToolTip(tr("Range:-1(No noise reduction)~10"));
+ ui->label_ImageDenoiseLevel->setToolTip(tr("Range:-1(No noise reduction)~10"));
+ break;
+ }
+ case 3:
+ {
+ DenoiseLevelSpinboxSetting_Anime4k();
+ break;
+ }
+ case 4:
+ {
+ ui->spinBox_DenoiseLevel_image->setRange(-1,3);
+ ui->spinBox_DenoiseLevel_image->setValue(2);
+ ui->spinBox_DenoiseLevel_image->setEnabled(1);
+ ui->spinBox_DenoiseLevel_image->setToolTip(tr("Range:-1(No noise reduction)~3"));
+ ui->label_ImageDenoiseLevel->setToolTip(tr("Range:-1(No noise reduction)~3"));
+ break;
+ }
+ case 5:
+ {
+ ui->spinBox_DenoiseLevel_image->setRange(0,1);
+ ui->spinBox_DenoiseLevel_image->setValue(1);
+ ui->spinBox_DenoiseLevel_image->setEnabled(0);
+ ui->spinBox_DenoiseLevel_image->setToolTip(tr("Realsr-ncnn-vulkan engine will denoise automatically."));
+ ui->label_ImageDenoiseLevel->setToolTip(tr("Realsr-ncnn-vulkan engine will denoise automatically."));
+ break;
+ }
+ }
+ isShowAnime4kWarning=true;
+ on_comboBox_model_vulkan_currentIndexChanged(0);
+ isWaifu2xCaffeEnabled();//判断是否启用caffe图片风格设定
+}
+
+void MainWindow::on_comboBox_Engine_GIF_currentIndexChanged(int index)
+{
+ switch(ui->comboBox_Engine_GIF->currentIndex())
+ {
+ case 0:
+ {
+ ui->spinBox_DenoiseLevel_gif->setRange(-1,3);
+ ui->spinBox_DenoiseLevel_gif->setValue(2);
+ ui->spinBox_DenoiseLevel_gif->setEnabled(1);
+ ui->spinBox_DenoiseLevel_gif->setToolTip(tr("Range:-1(No noise reduction)~3"));
+ ui->label_GIFDenoiseLevel->setToolTip(tr("Range:-1(No noise reduction)~3"));
+ break;
+ }
+ case 1:
+ {
+ ui->spinBox_DenoiseLevel_gif->setRange(0,3);
+ ui->spinBox_DenoiseLevel_gif->setValue(2);
+ ui->spinBox_DenoiseLevel_gif->setEnabled(1);
+ ui->spinBox_DenoiseLevel_gif->setToolTip(tr("Range:0(No noise reduction)~3"));
+ ui->label_GIFDenoiseLevel->setToolTip(tr("Range:0(No noise reduction)~3"));
+ break;
+ }
+ case 2:
+ case 6:
+ {
+ ui->spinBox_DenoiseLevel_gif->setRange(-1,10);
+ ui->spinBox_DenoiseLevel_gif->setValue(4);
+ ui->spinBox_DenoiseLevel_gif->setEnabled(1);
+ ui->spinBox_DenoiseLevel_gif->setToolTip(tr("Range:-1(No noise reduction)~10"));
+ ui->label_GIFDenoiseLevel->setToolTip(tr("Range:-1(No noise reduction)~10"));
+ break;
+ }
+ case 3:
+ {
+ DenoiseLevelSpinboxSetting_Anime4k();
+ break;
+ }
+ case 4:
+ {
+ ui->spinBox_DenoiseLevel_gif->setRange(-1,3);
+ ui->spinBox_DenoiseLevel_gif->setValue(2);
+ ui->spinBox_DenoiseLevel_gif->setEnabled(1);
+ ui->spinBox_DenoiseLevel_gif->setToolTip(tr("Range:-1(No noise reduction)~3"));
+ ui->label_GIFDenoiseLevel->setToolTip(tr("Range:-1(No noise reduction)~3"));
+ break;
+ }
+ case 5:
+ {
+ ui->spinBox_DenoiseLevel_gif->setRange(0,1);
+ ui->spinBox_DenoiseLevel_gif->setValue(1);
+ ui->spinBox_DenoiseLevel_gif->setEnabled(0);
+ ui->spinBox_DenoiseLevel_gif->setToolTip(tr("Realsr-ncnn-vulkan engine will denoise automatically."));
+ ui->label_GIFDenoiseLevel->setToolTip(tr("Realsr-ncnn-vulkan engine will denoise automatically."));
+ break;
+ }
+ }
+ on_comboBox_model_vulkan_currentIndexChanged(0);
+ isWaifu2xCaffeEnabled();//判断是否启用caffe图片风格设定
+}
+
+void MainWindow::on_comboBox_Engine_Video_currentIndexChanged(int index)
+{
+ switch(ui->comboBox_Engine_Video->currentIndex())
+ {
+ case 0:
+ {
+ ui->spinBox_DenoiseLevel_video->setRange(-1,3);
+ ui->spinBox_DenoiseLevel_video->setValue(2);
+ ui->spinBox_DenoiseLevel_video->setEnabled(1);
+ ui->spinBox_DenoiseLevel_video->setToolTip(tr("Range:-1(No noise reduction)~3"));
+ ui->label_VideoDenoiseLevel->setToolTip(tr("Range:-1(No noise reduction)~3"));
+ break;
+ }
+ case 1:
+ {
+ ui->spinBox_DenoiseLevel_video->setRange(0,3);
+ ui->spinBox_DenoiseLevel_video->setValue(2);
+ ui->spinBox_DenoiseLevel_video->setEnabled(1);
+ ui->spinBox_DenoiseLevel_video->setToolTip(tr("Range:0(No noise reduction)~3"));
+ ui->label_VideoDenoiseLevel->setToolTip(tr("Range:0(No noise reduction)~3"));
+ break;
+ }
+ case 2:
+ {
+ DenoiseLevelSpinboxSetting_Anime4k();
+ break;
+ }
+ case 3:
+ case 6:
+ {
+ ui->spinBox_DenoiseLevel_video->setRange(-1,10);
+ ui->spinBox_DenoiseLevel_video->setValue(4);
+ ui->spinBox_DenoiseLevel_video->setEnabled(1);
+ ui->spinBox_DenoiseLevel_video->setToolTip(tr("Range:-1(No noise reduction)~10"));
+ ui->label_VideoDenoiseLevel->setToolTip(tr("Range:-1(No noise reduction)~10"));
+ break;
+ }
+ case 4:
+ {
+ ui->spinBox_DenoiseLevel_video->setRange(-1,3);
+ ui->spinBox_DenoiseLevel_video->setValue(2);
+ ui->spinBox_DenoiseLevel_video->setEnabled(1);
+ ui->spinBox_DenoiseLevel_video->setToolTip(tr("Range:-1(No noise reduction)~3"));
+ ui->label_VideoDenoiseLevel->setToolTip(tr("Range:-1(No noise reduction)~3"));
+ break;
+ }
+ case 5:
+ {
+ ui->spinBox_DenoiseLevel_video->setRange(0,1);
+ ui->spinBox_DenoiseLevel_video->setValue(1);
+ ui->spinBox_DenoiseLevel_video->setEnabled(0);
+ ui->spinBox_DenoiseLevel_video->setToolTip(tr("Realsr-ncnn-vulkan engine will denoise automatically."));
+ ui->label_VideoDenoiseLevel->setToolTip(tr("Realsr-ncnn-vulkan engine will denoise automatically."));
+ break;
+ }
+ }
+ on_comboBox_model_vulkan_currentIndexChanged(0);
+ isWaifu2xCaffeEnabled();//判断是否启用caffe图片风格设定
+}
+
+void MainWindow::on_pushButton_clear_textbrowser_clicked()
+{
+ ui->textBrowser->clear();
+ TextBrowser_StartMes();
+}
+
+void MainWindow::on_spinBox_textbrowser_fontsize_valueChanged(int arg1)
+{
+ int size = ui->spinBox_textbrowser_fontsize->value();
+ ui->textBrowser->setStyleSheet("font: "+QString::number(size,10)+"pt \"Arial\";");
+ ui->textBrowser->moveCursor(QTextCursor::End);
+}
+
+void MainWindow::on_pushButton_CustRes_apply_clicked()
+{
+ CustRes_SetCustRes();
+}
+
+void MainWindow::on_pushButton_CustRes_cancel_clicked()
+{
+ CustRes_CancelCustRes();
+}
+
+void MainWindow::on_pushButton_HideSettings_clicked()
+{
+ if(ui->groupBox_Setting->isVisible())
+ {
+ ui->groupBox_Setting->setVisible(0);
+ isSettingsHide=true;
+ ui->pushButton_HideSettings->setText(tr("Show settings"));
+ }
+ else
+ {
+ ui->groupBox_Setting->setVisible(1);
+ isSettingsHide=false;
+ ui->pushButton_HideSettings->setText(tr("Hide settings"));
+ }
+}
+
+/*
+改变语言设置
+*/
+void MainWindow::on_comboBox_language_currentIndexChanged(int index)
+{
+ //检测是否存在日本语翻译文件,若存在则删除并修正翻译设定
+ QString JapaneseQM = Current_Path + "/language_Japanese.qm";
+ if(QFile::exists(JapaneseQM))
+ {
+ QFile::remove(JapaneseQM);
+ if(ui->comboBox_language->currentIndex()==2)//若原语言为日语则重置为英语
+ {
+ ui->comboBox_language->setCurrentIndex(0);
+ }
+ if(ui->comboBox_language->currentIndex()==3 || ui->comboBox_language->currentIndex()==-1)//若原语言为繁中则修正设定
+ {
+ ui->comboBox_language->setCurrentIndex(2);
+ }
+ }
+ //==============
+ QString qmFilename="";
+ switch(ui->comboBox_language->currentIndex())
+ {
+ case 0:
+ {
+ qmFilename = Current_Path + "/language_English.qm";
+ break;
+ }
+ case 1:
+ {
+ qmFilename = Current_Path + "/language_Chinese.qm";
+ break;
+ }
+ case 2:
+ {
+ qmFilename = Current_Path + "/language_TraditionalChinese.qm";
+ break;
+ }
+ }
+ //判断文件是否存在
+ if(QFile::exists(qmFilename)==false)
+ {
+ QMessageBox *MSG_languageFile404 = new QMessageBox();
+ MSG_languageFile404->setWindowTitle(tr("Error"));
+ MSG_languageFile404->setText(tr("Language file is missing, please reinstall this program."));
+ MSG_languageFile404->setIcon(QMessageBox::Warning);
+ MSG_languageFile404->setModal(true);
+ MSG_languageFile404->show();
+ return;
+ }
+ //加载语言文件
+ if (translator->load(qmFilename))
+ {
+ qApp->installTranslator(translator);
+ ui->retranslateUi(this);
+ Table_FileCount_reload();
+ Init_Table();
+ Init_SystemTrayIcon();
+ Set_Font_fixed();
+ //=========
+ if(ui->checkBox_AlwaysHideSettings->isChecked())
+ {
+ ui->groupBox_Setting->setVisible(0);
+ isSettingsHide=true;
+ ui->pushButton_HideSettings->setText(tr("Show settings"));
+ }
+ else
+ {
+ ui->groupBox_Setting->setVisible(1);
+ isSettingsHide=false;
+ ui->pushButton_HideSettings->setText(tr("Hide settings"));
+ }
+ //=========
+ if(ui->checkBox_AlwaysHideTextBrowser->isChecked())
+ {
+ ui->splitter_TextBrowser->setVisible(0);
+ ui->pushButton_HideTextBro->setText(tr("Show Text Browser"));
+ }
+ else
+ {
+ ui->splitter_TextBrowser->setVisible(1);
+ ui->pushButton_HideTextBro->setText(tr("Hide Text Browser"));
+ }
+ //=========
+ if(this->windowState()!=Qt::WindowMaximized)
+ {
+ this->adjustSize();
+ }
+ }
+ else
+ {
+ QMessageBox *MSG_Unable2LoadLanguageFiles = new QMessageBox();
+ MSG_Unable2LoadLanguageFiles->setWindowTitle(tr("Error"));
+ MSG_Unable2LoadLanguageFiles->setText(tr("Language file cannot be loaded properly."));
+ MSG_Unable2LoadLanguageFiles->setIcon(QMessageBox::Warning);
+ MSG_Unable2LoadLanguageFiles->setModal(true);
+ MSG_Unable2LoadLanguageFiles->show();
+ }
+}
+
+void MainWindow::on_pushButton_ReadFileList_clicked()
+{
+ file_mkDir(Current_Path+"/FilesList_W2xEX");//生成保存文件列表的文件夹
+ QString Table_FileList_ini = QFileDialog::getOpenFileName(this, tr("Select saved files list @Waifu2x-Extension-GUI"), Current_Path+"/FilesList_W2xEX", "*.ini");
+ if(Table_FileList_ini=="")return;
+ //========
+ if(QFile::exists(Table_FileList_ini))
+ {
+ ui_tableViews_setUpdatesEnabled(false);
+ this->setAcceptDrops(0);//禁止drop file
+ pushButton_Start_setEnabled_self(0);//禁用start button
+ ui->pushButton_CustRes_cancel->setEnabled(0);
+ ui->pushButton_CustRes_apply->setEnabled(0);
+ ui->pushButton_ReadFileList->setEnabled(0);
+ ui->pushButton_SaveFileList->setEnabled(0);
+ ui->pushButton_BrowserFile->setEnabled(0);
+ on_pushButton_ClearList_clicked();
+ Send_TextBrowser_NewMessage(tr("Please wait while reading the file."));
+ ui->label_DropFile->setText(tr("Loading list, please wait."));
+ QtConcurrent::run(this, &MainWindow::Table_Read_Saved_Table_Filelist,Table_FileList_ini);
+ }
+ else
+ {
+ QMessageBox *MSG_FileList404 = new QMessageBox();
+ MSG_FileList404->setWindowTitle(tr("Error"));
+ MSG_FileList404->setText(tr("Target files list doesn't exist!"));
+ MSG_FileList404->setIcon(QMessageBox::Warning);
+ MSG_FileList404->setModal(true);
+ MSG_FileList404->show();
+ }
+}
+
+void MainWindow::on_Ext_image_editingFinished()
+{
+ QString ext_image_str = ui->Ext_image->text();
+ ext_image_str = ext_image_str.trimmed().replace(":",":").remove(" ").remove(" ").replace(":gif:",":");
+ ui->Ext_image->setText(ext_image_str);
+}
+
+void MainWindow::on_Ext_video_editingFinished()
+{
+ QString ext_video_str = ui->Ext_video->text();
+ ext_video_str = ext_video_str.trimmed().replace(":",":").remove(" ").remove(" ").replace(":gif:",":");
+ ui->Ext_video->setText(ext_video_str);
+}
+
+void MainWindow::on_checkBox_AutoSaveSettings_clicked()
+{
+ QString settings_ini = Current_Path+"/settings.ini";
+ if(QFile::exists(settings_ini))
+ {
+ QSettings *configIniWrite = new QSettings(settings_ini, QSettings::IniFormat);
+ configIniWrite->setValue("/settings/AutoSaveSettings", ui->checkBox_AutoSaveSettings->isChecked());
+ }
+}
+
+void MainWindow::on_pushButton_about_clicked()
+{
+ QMessageBox *MSG = new QMessageBox();
+ MSG->setWindowTitle(tr("About"));
+ QString line1 = "Waifu2x-Extension-GUI\n\n";
+ QString line2 = VERSION+"\n\n";
+ QString line3 = "Github: https://github.com/AaronFeng753/Waifu2x-Extension-GUI\n\n";
+ QString line4 = "Waifu2x-Extension-GUI is licensed under the\n";
+ QString line5 = "GNU Affero General Public License v3.0\n\n";
+ QString line6 = "Copyright (C) 2021 Aaron Feng. All rights reserved.\n\n";
+ QString line7 = "The program is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.\n\n";
+ QString line8 = "Icons made by : Freepik & Icongeek26 & Roundicons From Flaticon(https://www.flaticon.com/)";
+ MSG->setText(line1+line2+line3+line4+line5+line6+line7+line8);
+ QImage img(":/new/prefix1/icon/icon_main.png");
+ QImage img_scaled = img.scaled(50,50,Qt::KeepAspectRatio,Qt::SmoothTransformation);
+ QPixmap pix(QPixmap::fromImage(img_scaled));
+ MSG->setIconPixmap(pix);
+ MSG->setModal(false);
+ MSG->show();
+}
+
+void MainWindow::on_comboBox_AspectRatio_custRes_currentIndexChanged(int index)
+{
+ int CurrentIndex = ui->comboBox_AspectRatio_custRes->currentIndex();
+ switch(CurrentIndex)
+ {
+ case 0:
+ {
+ CustRes_AspectRatioMode = Qt::IgnoreAspectRatio;
+ break;
+ }
+ case 1:
+ {
+ CustRes_AspectRatioMode = Qt::KeepAspectRatio;
+ break;
+ }
+ case 2:
+ {
+ CustRes_AspectRatioMode = Qt::KeepAspectRatioByExpanding;
+ break;
+ }
+ }
+}
+
+void MainWindow::on_checkBox_AlwaysHideSettings_stateChanged(int arg1)
+{
+ if(ui->checkBox_AlwaysHideSettings->isChecked())
+ {
+ ui->groupBox_Setting->setVisible(0);
+ ui->pushButton_HideSettings->setText(tr("Show settings"));
+ isSettingsHide=true;
+ }
+}
+
+void MainWindow::on_pushButton_Save_GlobalFontSize_clicked()
+{
+ QString settings_ini = Current_Path+"/settings.ini";
+ QSettings *configIniWrite = new QSettings(settings_ini, QSettings::IniFormat);
+ configIniWrite->setValue("/settings/GlobalFontSize", ui->spinBox_GlobalFontSize->value());
+ //=========
+ QMessageBox *MSG = new QMessageBox();
+ MSG->setWindowTitle(tr("Notification"));
+ MSG->setText(tr("Custom Font Settings saved successfully.\n\nRestart the software to take effect."));
+ MSG->setIcon(QMessageBox::Information);
+ MSG->setModal(true);
+ MSG->show();
+}
+/*
+==================================================================================================
+ 浏览与添加文本
+==================================================================================================
+*/
+void MainWindow::on_pushButton_BrowserFile_clicked()
+{
+ QString Last_browsed_path = Current_Path+"/LastBrowsedPath_W2xEX.ini";
+ //======== 生成 扩展名过滤 字符串 =========
+ QStringList nameFilters;
+ nameFilters.append("*.gif");
+ nameFilters.append("*.apng");
+ QString Ext_image_str = ui->Ext_image->text();
+ QStringList nameFilters_image = Ext_image_str.split(":");
+ nameFilters_image.removeAll("gif");
+ nameFilters_image.removeAll("apng");
+ for(int i = 0; i < nameFilters_image.size(); ++i)
+ {
+ QString tmp = nameFilters_image.at(i).trimmed();
+ if(tmp=="")continue;
+ tmp = "*." + tmp;
+ nameFilters.append(tmp);
+ }
+ QString Ext_video_str = ui->Ext_video->text();
+ QStringList nameFilters_video = Ext_video_str.split(":");
+ nameFilters_video.removeAll("gif");
+ nameFilters_video.removeAll("apng");
+ for(int i = 0; i < nameFilters_video.size(); ++i)
+ {
+ QString tmp = nameFilters_video.at(i).trimmed();
+ if(tmp=="")continue;
+ tmp = "*." + tmp;
+ nameFilters.append(tmp);
+ }
+ QString nameFilters_QString = "";
+ for(int i = 0; i < nameFilters.size(); ++i)
+ {
+ QString tmp = nameFilters.at(i).trimmed();
+ nameFilters_QString = nameFilters_QString +" "+ tmp;
+ }
+ //=====================================================
+ QString BrowserStartPath = "";//浏览文件时的起始文件夹
+ //=========== 读取上一次浏览的文件夹 ===========================
+ if(QFile::exists(Last_browsed_path))
+ {
+ QSettings *configIniRead = new QSettings(Last_browsed_path, QSettings::IniFormat);
+ configIniRead->setIniCodec(QTextCodec::codecForName("UTF-8"));
+ BrowserStartPath = configIniRead->value("/Path").toString();
+ if(!QFile::exists(BrowserStartPath))BrowserStartPath = "";
+ }
+ //===========================================================
+ QStringList Input_path_List = QFileDialog::getOpenFileNames(this, tr("Select files @Waifu2x-Extension-GUI"), BrowserStartPath, tr("All file(")+nameFilters_QString+")");
+ if(Input_path_List.isEmpty())
+ {
+ return;
+ }
+ //================== 记住上一次浏览的文件夹 =======================
+ QFile::remove(Last_browsed_path);
+ QSettings *configIniWrite = new QSettings(Last_browsed_path, QSettings::IniFormat);
+ configIniWrite->setIniCodec(QTextCodec::codecForName("UTF-8"));
+ configIniWrite->setValue("/Warning/EN", "Do not modify this file! It may cause the program to crash! If problems occur after the modification, delete this file and restart the program.");
+ QFileInfo lastPath(Input_path_List.at(0));
+ QString folder_lastPath = file_getFolderPath(lastPath);
+ configIniWrite->setValue("/Path", folder_lastPath);
+ //===============================================================
+ AddNew_gif=false;
+ AddNew_image=false;
+ AddNew_video=false;
+ //================== 界面管制 ========================
+ ui_tableViews_setUpdatesEnabled(false);
+ ui->groupBox_Setting->setEnabled(0);
+ ui->groupBox_FileList->setEnabled(0);
+ ui->groupBox_InputExt->setEnabled(0);
+ pushButton_Start_setEnabled_self(0);
+ ui->checkBox_ScanSubFolders->setEnabled(0);
+ this->setAcceptDrops(0);
+ ui->label_DropFile->setText(tr("Adding files, please wait."));
+ emit Send_TextBrowser_NewMessage(tr("Adding files, please wait."));
+ //===================================================
+ QtConcurrent::run(this, &MainWindow::Read_Input_paths_BrowserFile, Input_path_List);
+}
+/*
+读取 路径与添加文件
+*/
+void MainWindow::Read_Input_paths_BrowserFile(QStringList Input_path_List)
+{
+ Progressbar_MaxVal = Input_path_List.size();
+ Progressbar_CurrentVal = 0;
+ emit Send_PrograssBar_Range_min_max(0, Progressbar_MaxVal);
+ foreach(QString Input_path, Input_path_List)
+ {
+ Input_path=Input_path.trimmed();
+ if(QFile::exists(Input_path)==false)continue;
+ Add_File_Folder(Input_path);
+ emit Send_progressbar_Add();
+ }
+ emit Send_Read_urls_finfished();
+}
+/*
+打开wiki
+*/
+void MainWindow::on_pushButton_wiki_clicked()
+{
+ if(ui->comboBox_language->currentIndex()==1)
+ {
+ QDesktopServices::openUrl(QUrl("https://gitee.com/aaronfeng0711/Waifu2x-Extension-GUI/wikis"));
+ }
+ QDesktopServices::openUrl(QUrl("https://github.com/AaronFeng753/Waifu2x-Extension-GUI/wiki"));
+}
+
+void MainWindow::on_pushButton_HideTextBro_clicked()
+{
+ if(ui->textBrowser->isVisible())
+ {
+ ui->splitter_TextBrowser->setVisible(0);
+ ui->pushButton_HideTextBro->setText(tr("Show Text Browser"));
+ }
+ else
+ {
+ ui->splitter_TextBrowser->setVisible(1);
+ ui->pushButton_HideTextBro->setText(tr("Hide Text Browser"));
+ }
+}
+
+void MainWindow::on_checkBox_AlwaysHideTextBrowser_stateChanged(int arg1)
+{
+ if(ui->checkBox_AlwaysHideTextBrowser->isChecked())
+ {
+ ui->splitter_TextBrowser->setVisible(0);
+ ui->pushButton_HideTextBro->setText(tr("Show Text Browser"));
+ }
+}
+
+
+
+void MainWindow::on_Ext_image_textChanged(const QString &arg1)
+{
+ QString lower = ui->Ext_image->text().toLower();
+ ui->Ext_image->setText(lower);
+}
+
+void MainWindow::on_Ext_video_textChanged(const QString &arg1)
+{
+ QString lower = ui->Ext_video->text().toLower();
+ ui->Ext_video->setText(lower);
+}
+
+void MainWindow::on_comboBox_model_vulkan_currentIndexChanged(int index)
+{
+ if(ui->comboBox_model_vulkan->currentIndex()==0)
+ {
+ ui->comboBox_ImageStyle->setEnabled(1);
+ ui->label_ImageStyle_W2xNCNNVulkan->setVisible(1);
+ ui->comboBox_ImageStyle->setVisible(1);
+ if(ui->comboBox_Engine_Image->currentIndex()!=0&&ui->comboBox_Engine_GIF->currentIndex()!=0&&ui->comboBox_Engine_Video->currentIndex()!=0)
+ {
+ ui->comboBox_ImageStyle->setEnabled(0);
+ ui->label_ImageStyle_W2xNCNNVulkan->setVisible(0);
+ ui->comboBox_ImageStyle->setVisible(0);
+ }
+ }
+ if(ui->comboBox_model_vulkan->currentIndex()==1)
+ {
+ ui->comboBox_ImageStyle->setEnabled(0);
+ ui->label_ImageStyle_W2xNCNNVulkan->setVisible(0);
+ ui->comboBox_ImageStyle->setVisible(0);
+ }
+}
+
+void MainWindow::on_comboBox_ImageStyle_currentIndexChanged(int index)
+{
+ if(ui->comboBox_ImageStyle->currentIndex()==0)
+ {
+ ui->comboBox_model_vulkan->setEnabled(1);
+ }
+ if(ui->comboBox_ImageStyle->currentIndex()==1)
+ {
+ ui->comboBox_model_vulkan->setEnabled(0);
+ }
+}
+
+void MainWindow::on_pushButton_ResetVideoSettings_clicked()
+{
+ ui->lineEdit_pixformat->setText("yuv420p");
+ ui->lineEdit_encoder_vid->setText("libx264");
+ ui->lineEdit_encoder_audio->setText("aac");
+ ui->spinBox_bitrate_vid->setValue(6000);
+ ui->spinBox_bitrate_audio->setValue(320);
+ //====
+ ui->spinBox_bitrate_vid_2mp4->setValue(2500);
+ ui->spinBox_bitrate_audio_2mp4->setValue(320);
+ ui->checkBox_acodec_copy_2mp4->setChecked(0);
+ ui->checkBox_vcodec_copy_2mp4->setChecked(0);
+ ui->spinBox_bitrate_vid_2mp4->setEnabled(1);
+ ui->spinBox_bitrate_audio_2mp4->setEnabled(1);
+ //====
+ ui->lineEdit_ExCommand_2mp4->setText("");
+ ui->lineEdit_ExCommand_output->setText("");
+}
+
+void MainWindow::on_lineEdit_encoder_vid_textChanged(const QString &arg1)
+{
+ QString tmp = ui->lineEdit_encoder_vid->text().trimmed();
+ ui->lineEdit_encoder_vid->setText(tmp);
+}
+
+void MainWindow::on_lineEdit_encoder_audio_textChanged(const QString &arg1)
+{
+ QString tmp = ui->lineEdit_encoder_audio->text().trimmed();
+ ui->lineEdit_encoder_audio->setText(tmp);
+}
+
+void MainWindow::on_lineEdit_pixformat_textChanged(const QString &arg1)
+{
+ QString tmp = ui->lineEdit_pixformat->text().trimmed();
+ ui->lineEdit_pixformat->setText(tmp);
+}
+
+void MainWindow::on_checkBox_vcodec_copy_2mp4_stateChanged(int arg1)
+{
+ if(ui->checkBox_vcodec_copy_2mp4->isChecked())
+ {
+ ui->spinBox_bitrate_vid_2mp4->setEnabled(0);
+ }
+ else
+ {
+ ui->spinBox_bitrate_vid_2mp4->setEnabled(1);
+ }
+}
+
+void MainWindow::on_checkBox_acodec_copy_2mp4_stateChanged(int arg1)
+{
+ if(ui->checkBox_acodec_copy_2mp4->isChecked())
+ {
+ ui->spinBox_bitrate_audio_2mp4->setEnabled(0);
+ }
+ else
+ {
+ ui->spinBox_bitrate_audio_2mp4->setEnabled(1);
+ }
+}
+
+
+void MainWindow::on_pushButton_encodersList_clicked()
+{
+ file_OpenFile(Current_Path+"/FFmpeg_Encoders_List_waifu2xEX.bat");
+}
+
+void MainWindow::Tip_FirstTimeStart()
+{
+ QString FirstTimeStart = Current_Path+"/FirstTimeStart";
+ if(QFile::exists(FirstTimeStart))
+ {
+ isFirstTimeStart=false;
+ return;
+ }
+ else
+ {
+ isFirstTimeStart=true;
+ /*
+ 弹出语言选择对话框
+ */
+ QMessageBox Msg(QMessageBox::Question, QString("Choose your language"), QString("Choose your language.\n\n选择您的语言。\n\n言語を選んでください。"));
+ Msg.setIcon(QMessageBox::Information);
+ QAbstractButton *pYesBtn_English = Msg.addButton(QString("English"), QMessageBox::YesRole);
+ QAbstractButton *pYesBtn_Chinese = Msg.addButton(QString("简体中文"), QMessageBox::YesRole);
+ QAbstractButton *pYesBtn_TraditionalChinese = Msg.addButton(QString("繁體中文(由uimee翻譯)"), QMessageBox::YesRole);
+ Msg.exec();
+ if (Msg.clickedButton() == pYesBtn_English)ui->comboBox_language->setCurrentIndex(0);
+ if (Msg.clickedButton() == pYesBtn_Chinese)ui->comboBox_language->setCurrentIndex(1);
+ if (Msg.clickedButton() == pYesBtn_TraditionalChinese)ui->comboBox_language->setCurrentIndex(2);
+ on_comboBox_language_currentIndexChanged(0);
+ //======
+ QMessageBox *MSG_2 = new QMessageBox();
+ MSG_2->setWindowTitle(tr("Notification"));
+ MSG_2->setText(tr("It is detected that this is the first time you have started the software, so the compatibility test will be performed automatically. Please wait for a while, then check the test result."));
+ MSG_2->setIcon(QMessageBox::Information);
+ MSG_2->setModal(true);
+ MSG_2->show();
+ //=======
+ file_generateMarkFile(FirstTimeStart,"");
+ //=======
+ on_pushButton_clear_textbrowser_clicked();
+ on_pushButton_compatibilityTest_clicked();
+ }
+}
+
+void MainWindow::on_checkBox_DelOriginal_stateChanged(int arg1)
+{
+ if(ui->checkBox_DelOriginal->isChecked())
+ {
+ QAction_checkBox_MoveToRecycleBin_checkBox_DelOriginal->setEnabled(1);
+ ui->checkBox_ReplaceOriginalFile->setEnabled(0);
+ ui->checkBox_ReplaceOriginalFile->setChecked(0);
+ }
+ else
+ {
+ QAction_checkBox_MoveToRecycleBin_checkBox_DelOriginal->setEnabled(0);
+ checkBox_ReplaceOriginalFile_setEnabled_True_Self();
+ }
+}
+
+void MainWindow::on_checkBox_FileList_Interactive_stateChanged(int arg1)
+{
+ if(ui->checkBox_FileList_Interactive->isChecked())
+ {
+ ui->tableView_image->horizontalHeader()->setSectionResizeMode(QHeaderView::Interactive);
+ ui->tableView_gif->horizontalHeader()->setSectionResizeMode(QHeaderView::Interactive);
+ ui->tableView_video->horizontalHeader()->setSectionResizeMode(QHeaderView::Interactive);
+ }
+ else
+ {
+ ui->tableView_image->horizontalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents);
+ ui->tableView_gif->horizontalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents);
+ ui->tableView_video->horizontalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents);
+ }
+}
+
+void MainWindow::on_checkBox_OutPath_isEnabled_stateChanged(int arg1)
+{
+ if(ui->checkBox_OutPath_isEnabled->isChecked())
+ {
+ ui->lineEdit_outputPath->setEnabled(1);
+ ui->checkBox_OutPath_KeepOriginalFileName->setEnabled(1);
+ ui->checkBox_KeepParentFolder->setEnabled(1);
+ ui->checkBox_OutPath_Overwrite->setEnabled(1);
+ ui->checkBox_ReplaceOriginalFile->setEnabled(0);
+ ui->checkBox_ReplaceOriginalFile->setChecked(0);
+ ui->checkBox_AutoOpenOutputPath->setEnabled(1);
+ }
+ else
+ {
+ ui->lineEdit_outputPath->setEnabled(0);
+ ui->checkBox_OutPath_KeepOriginalFileName->setEnabled(0);
+ ui->checkBox_KeepParentFolder->setEnabled(0);
+ ui->checkBox_OutPath_Overwrite->setEnabled(0);
+ ui->checkBox_AutoOpenOutputPath->setEnabled(0);
+ checkBox_ReplaceOriginalFile_setEnabled_True_Self();
+ }
+}
+
+//强制重试
+void MainWindow::on_pushButton_ForceRetry_clicked()
+{
+ if(isForceRetryEnabled==false)//处理视频和gif时禁用强制重试
+ {
+ emit Send_TextBrowser_NewMessage(tr("Force retry is disabled when processing Video or GIF."));
+ return;
+ }
+ //==========
+ ui->pushButton_ForceRetry->setEnabled(0);
+ //========
+ QtConcurrent::run(this, &MainWindow::isForceRetryClicked_SetTrue_Block_Anime4k);//block a4k引擎线程 防止无效图片污染缓存
+ //========
+ ForceRetryCount++;
+ //========
+ QProcess Close;
+ Close.start("taskkill /f /t /fi \"imagename eq Anime4K_waifu2xEX.exe\"");
+ Close.waitForStarted(10000);
+ Close.waitForFinished(10000);
+ Close.start("taskkill /f /t /fi \"imagename eq waifu2x-ncnn-vulkan_waifu2xEX.exe\"");
+ Close.waitForStarted(10000);
+ Close.waitForFinished(10000);
+ Close.start("taskkill /f /t /fi \"imagename eq waifu2x-ncnn-vulkan-fp16p_waifu2xEX.exe\"");
+ Close.waitForStarted(10000);
+ Close.waitForFinished(10000);
+ Close.start("taskkill /f /t /fi \"imagename eq waifu2x-converter-cpp_waifu2xEX.exe\"");
+ Close.waitForStarted(10000);
+ Close.waitForFinished(10000);
+ Close.start("taskkill /f /t /fi \"imagename eq srmd-ncnn-vulkan_waifu2xEX.exe\"");
+ Close.waitForStarted(10000);
+ Close.waitForFinished(10000);
+ Close.start("taskkill /f /t /fi \"imagename eq waifu2x-caffe_waifu2xEX.exe\"");
+ Close.waitForStarted(10000);
+ Close.waitForFinished(10000);
+ Close.start("taskkill /f /t /fi \"imagename eq realsr-ncnn-vulkan_waifu2xEX.exe\"");
+ Close.waitForStarted(10000);
+ Close.waitForFinished(10000);
+ //========
+ emit Send_TextBrowser_NewMessage(tr("Force retry."));
+ return;
+}
+//激活强制重试按钮
+void MainWindow::SetEnable_pushButton_ForceRetry_self()
+{
+ ui->pushButton_ForceRetry->setEnabled(1);
+ return;
+}
+void MainWindow::on_pushButton_PayPal_clicked()
+{
+ QDesktopServices::openUrl(QUrl("https://www.paypal.me/aaronfeng753"));
+}
+void MainWindow::on_checkBox_AudioDenoise_stateChanged(int arg1)
+{
+ if(ui->checkBox_AudioDenoise->isChecked())
+ {
+ ui->doubleSpinBox_AudioDenoiseLevel->setEnabled(1);
+ }
+ else
+ {
+ ui->doubleSpinBox_AudioDenoiseLevel->setEnabled(0);
+ }
+}
+void MainWindow::on_tabWidget_currentChanged(int index)
+{
+ switch(ui->tabWidget->currentIndex())
+ {
+ case 0:
+ {
+ //tab 0
+ ui->label_DonateQRCode->setVisible(1);
+ ui->pushButton_PayPal->setVisible(1);
+ ui->pushButton_Patreon->setVisible(1);
+ ui->label_DonateText->setVisible(1);
+ //tab 1
+ ui->groupBox_Progress->setVisible(0);
+ ui->splitter_2->setVisible(0);
+ //tab 2
+ ui->groupBox_Engine->setVisible(0);
+ ui->groupBox_NumOfThreads->setVisible(0);
+ //tab 3
+ ui->groupBox_AudioDenoise->setVisible(0);
+ ui->groupBox_video_settings->setVisible(0);
+ ui->groupBox_FrameInterpolation->setVisible(0);
+ //tab 4
+ ui->groupBox_3->setVisible(0);
+ ui->groupBox_8->setVisible(0);
+ ui->groupBox_InputExt->setVisible(0);
+ ui->groupBox_other_1->setVisible(0);
+ //tab 5
+ ui->groupBox_CompatibilityTestRes->setVisible(0);
+ ui->pushButton_compatibilityTest->setVisible(0);
+ break;
+ }
+ case 1:
+ {
+ //tab 0
+ ui->label_DonateQRCode->setVisible(0);
+ ui->pushButton_PayPal->setVisible(0);
+ ui->pushButton_Patreon->setVisible(0);
+ ui->label_DonateText->setVisible(0);
+ //tab 1
+ ui->groupBox_Progress->setVisible(1);
+ ui->splitter_2->setVisible(1);
+ if(isSettingsHide==false)
+ {
+ ui->groupBox_Setting->setVisible(1);
+ }
+ //tab 2
+ ui->groupBox_Engine->setVisible(0);
+ ui->groupBox_NumOfThreads->setVisible(0);
+ //tab 3
+ ui->groupBox_AudioDenoise->setVisible(0);
+ ui->groupBox_video_settings->setVisible(0);
+ ui->groupBox_FrameInterpolation->setVisible(0);
+ //tab 4
+ ui->groupBox_3->setVisible(0);
+ ui->groupBox_8->setVisible(0);
+ ui->groupBox_InputExt->setVisible(0);
+ ui->groupBox_other_1->setVisible(0);
+ //tab 5
+ ui->groupBox_CompatibilityTestRes->setVisible(0);
+ ui->pushButton_compatibilityTest->setVisible(0);
+ break;
+ }
+ case 2:
+ {
+ //tab 0
+ ui->label_DonateQRCode->setVisible(0);
+ ui->pushButton_PayPal->setVisible(0);
+ ui->pushButton_Patreon->setVisible(0);
+ ui->label_DonateText->setVisible(0);
+ //tab 1
+ ui->groupBox_Progress->setVisible(0);
+ ui->splitter_2->setVisible(0);
+ //tab 2
+ ui->groupBox_Engine->setVisible(1);
+ ui->groupBox_NumOfThreads->setVisible(1);
+ //tab 3
+ ui->groupBox_AudioDenoise->setVisible(0);
+ ui->groupBox_video_settings->setVisible(0);
+ ui->groupBox_FrameInterpolation->setVisible(0);
+ //tab 4
+ ui->groupBox_3->setVisible(0);
+ ui->groupBox_8->setVisible(0);
+ ui->groupBox_InputExt->setVisible(0);
+ ui->groupBox_other_1->setVisible(0);
+ //tab 5
+ ui->groupBox_CompatibilityTestRes->setVisible(0);
+ ui->pushButton_compatibilityTest->setVisible(0);
+ break;
+ }
+ case 3:
+ {
+ //tab 0
+ ui->label_DonateQRCode->setVisible(0);
+ ui->pushButton_PayPal->setVisible(0);
+ ui->pushButton_Patreon->setVisible(0);
+ ui->label_DonateText->setVisible(0);
+ //tab 1
+ ui->groupBox_Progress->setVisible(0);
+ ui->splitter_2->setVisible(0);
+ //tab 2
+ ui->groupBox_Engine->setVisible(0);
+ ui->groupBox_NumOfThreads->setVisible(0);
+ //tab 3
+ ui->groupBox_AudioDenoise->setVisible(1);
+ ui->groupBox_video_settings->setVisible(1);
+ ui->groupBox_FrameInterpolation->setVisible(1);
+ //tab 4
+ ui->groupBox_3->setVisible(0);
+ ui->groupBox_8->setVisible(0);
+ ui->groupBox_InputExt->setVisible(0);
+ ui->groupBox_other_1->setVisible(0);
+ //tab 5
+ ui->groupBox_CompatibilityTestRes->setVisible(0);
+ ui->pushButton_compatibilityTest->setVisible(0);
+ break;
+ }
+ case 4:
+ {
+ //tab 0
+ ui->label_DonateQRCode->setVisible(0);
+ ui->pushButton_PayPal->setVisible(0);
+ ui->pushButton_Patreon->setVisible(0);
+ ui->label_DonateText->setVisible(0);
+ //tab 1
+ ui->groupBox_Progress->setVisible(0);
+ ui->splitter_2->setVisible(0);
+ //tab 2
+ ui->groupBox_Engine->setVisible(0);
+ ui->groupBox_NumOfThreads->setVisible(0);
+ //tab 3
+ ui->groupBox_AudioDenoise->setVisible(0);
+ ui->groupBox_video_settings->setVisible(0);
+ ui->groupBox_FrameInterpolation->setVisible(0);
+ //tab 4
+ ui->groupBox_3->setVisible(1);
+ ui->groupBox_8->setVisible(1);
+ ui->groupBox_InputExt->setVisible(1);
+ ui->groupBox_other_1->setVisible(1);
+ //tab 5
+ ui->groupBox_CompatibilityTestRes->setVisible(0);
+ ui->pushButton_compatibilityTest->setVisible(0);
+ break;
+ }
+ case 5:
+ {
+ //tab 0
+ ui->label_DonateQRCode->setVisible(0);
+ ui->pushButton_PayPal->setVisible(0);
+ ui->pushButton_Patreon->setVisible(0);
+ ui->label_DonateText->setVisible(0);
+ //tab 1
+ ui->groupBox_Progress->setVisible(0);
+ ui->splitter_2->setVisible(0);
+ //tab 2
+ ui->groupBox_Engine->setVisible(0);
+ ui->groupBox_NumOfThreads->setVisible(0);
+ //tab 3
+ ui->groupBox_AudioDenoise->setVisible(0);
+ ui->groupBox_video_settings->setVisible(0);
+ ui->groupBox_FrameInterpolation->setVisible(0);
+ //tab 4
+ ui->groupBox_3->setVisible(0);
+ ui->groupBox_8->setVisible(0);
+ ui->groupBox_InputExt->setVisible(0);
+ ui->groupBox_other_1->setVisible(0);
+ //tab 5
+ ui->groupBox_CompatibilityTestRes->setVisible(1);
+ ui->pushButton_compatibilityTest->setVisible(1);
+ break;
+ }
+ }
+}
+void MainWindow::on_checkBox_ProcessVideoBySegment_stateChanged(int arg1)
+{
+ if(ui->checkBox_ProcessVideoBySegment->isChecked())
+ {
+ ui->label_SegmentDuration->setEnabled(1);
+ ui->spinBox_SegmentDuration->setEnabled(1);
+ }
+ else
+ {
+ ui->label_SegmentDuration->setEnabled(0);
+ ui->spinBox_SegmentDuration->setEnabled(0);
+ }
+}
+void MainWindow::on_comboBox_version_Waifu2xNCNNVulkan_currentIndexChanged(int index)
+{
+ switch (ui->comboBox_version_Waifu2xNCNNVulkan->currentIndex())
+ {
+ case 0:
+ {
+ Waifu2x_ncnn_vulkan_FolderPath = Current_Path + "/waifu2x-ncnn-vulkan";
+ Waifu2x_ncnn_vulkan_ProgramPath = Waifu2x_ncnn_vulkan_FolderPath + "/waifu2x-ncnn-vulkan_waifu2xEX.exe";
+ ui->checkBox_TTA_vulkan->setEnabled(1);
+ return;
+ }
+ case 1:
+ {
+ Waifu2x_ncnn_vulkan_FolderPath = Current_Path + "/waifu2x-ncnn-vulkan";
+ Waifu2x_ncnn_vulkan_ProgramPath = Waifu2x_ncnn_vulkan_FolderPath + "/waifu2x-ncnn-vulkan-fp16p_waifu2xEX.exe";
+ ui->checkBox_TTA_vulkan->setEnabled(1);
+ return;
+ }
+ case 2:
+ {
+ Waifu2x_ncnn_vulkan_FolderPath = Current_Path + "/waifu2x-ncnn-vulkan-old";
+ Waifu2x_ncnn_vulkan_ProgramPath = Waifu2x_ncnn_vulkan_FolderPath + "/waifu2x-ncnn-vulkan_waifu2xEX.exe";
+ ui->checkBox_TTA_vulkan->setEnabled(0);
+ ui->checkBox_TTA_vulkan->setChecked(0);
+ return;
+ }
+ }
+}
+void MainWindow::on_checkBox_EnablePreProcessing_Anime4k_stateChanged(int arg1)
+{
+ if(ui->checkBox_EnablePreProcessing_Anime4k->isChecked())
+ {
+ ui->checkBox_MedianBlur_Pre_Anime4k->setEnabled(1);
+ ui->checkBox_MeanBlur_Pre_Anime4k->setEnabled(1);
+ ui->checkBox_CASSharping_Pre_Anime4k->setEnabled(1);
+ ui->checkBox_GaussianBlurWeak_Pre_Anime4k->setEnabled(1);
+ ui->checkBox_GaussianBlur_Pre_Anime4k->setEnabled(1);
+ ui->checkBox_BilateralFilter_Pre_Anime4k->setEnabled(1);
+ ui->checkBox_BilateralFilterFaster_Pre_Anime4k->setEnabled(1);
+ }
+ else
+ {
+ ui->checkBox_MedianBlur_Pre_Anime4k->setEnabled(0);
+ ui->checkBox_MeanBlur_Pre_Anime4k->setEnabled(0);
+ ui->checkBox_CASSharping_Pre_Anime4k->setEnabled(0);
+ ui->checkBox_GaussianBlurWeak_Pre_Anime4k->setEnabled(0);
+ ui->checkBox_GaussianBlur_Pre_Anime4k->setEnabled(0);
+ ui->checkBox_BilateralFilter_Pre_Anime4k->setEnabled(0);
+ ui->checkBox_BilateralFilterFaster_Pre_Anime4k->setEnabled(0);
+ }
+}
+void MainWindow::on_checkBox_EnablePostProcessing_Anime4k_stateChanged(int arg1)
+{
+ if(ui->checkBox_EnablePostProcessing_Anime4k->isChecked())
+ {
+ ui->checkBox_MedianBlur_Post_Anime4k->setEnabled(1);
+ ui->checkBox_MeanBlur_Post_Anime4k->setEnabled(1);
+ ui->checkBox_CASSharping_Post_Anime4k->setEnabled(1);
+ ui->checkBox_GaussianBlurWeak_Post_Anime4k->setEnabled(1);
+ ui->checkBox_GaussianBlur_Post_Anime4k->setEnabled(1);
+ ui->checkBox_BilateralFilter_Post_Anime4k->setEnabled(1);
+ ui->checkBox_BilateralFilterFaster_Post_Anime4k->setEnabled(1);
+ }
+ else
+ {
+ ui->checkBox_MedianBlur_Post_Anime4k->setEnabled(0);
+ ui->checkBox_MeanBlur_Post_Anime4k->setEnabled(0);
+ ui->checkBox_CASSharping_Post_Anime4k->setEnabled(0);
+ ui->checkBox_GaussianBlurWeak_Post_Anime4k->setEnabled(0);
+ ui->checkBox_GaussianBlur_Post_Anime4k->setEnabled(0);
+ ui->checkBox_BilateralFilter_Post_Anime4k->setEnabled(0);
+ ui->checkBox_BilateralFilterFaster_Post_Anime4k->setEnabled(0);
+ }
+}
+void MainWindow::on_checkBox_SpecifyGPU_Anime4k_stateChanged(int arg1)
+{
+ if(ui->checkBox_SpecifyGPU_Anime4k->isChecked())
+ {
+ ui->lineEdit_GPUs_Anime4k->setEnabled(1);
+ ui->pushButton_ListGPUs_Anime4k->setEnabled(1);
+ ui->pushButton_VerifyGPUsConfig_Anime4k->setEnabled(1);
+ }
+ else
+ {
+ ui->lineEdit_GPUs_Anime4k->setEnabled(0);
+ ui->pushButton_ListGPUs_Anime4k->setEnabled(0);
+ ui->pushButton_VerifyGPUsConfig_Anime4k->setEnabled(0);
+ }
+}
+void MainWindow::on_checkBox_isCompatible_Waifu2x_NCNN_Vulkan_NEW_clicked()
+{
+ ui->checkBox_isCompatible_Waifu2x_NCNN_Vulkan_NEW->setChecked(isCompatible_Waifu2x_NCNN_Vulkan_NEW);
+}
+void MainWindow::on_checkBox_isCompatible_Waifu2x_NCNN_Vulkan_NEW_FP16P_clicked()
+{
+ ui->checkBox_isCompatible_Waifu2x_NCNN_Vulkan_NEW_FP16P->setChecked(isCompatible_Waifu2x_NCNN_Vulkan_NEW_FP16P);
+}
+void MainWindow::on_checkBox_isCompatible_Waifu2x_NCNN_Vulkan_OLD_clicked()
+{
+ ui->checkBox_isCompatible_Waifu2x_NCNN_Vulkan_OLD->setChecked(isCompatible_Waifu2x_NCNN_Vulkan_OLD);
+}
+void MainWindow::on_checkBox_isCompatible_SRMD_NCNN_Vulkan_clicked()
+{
+ ui->checkBox_isCompatible_SRMD_NCNN_Vulkan->setChecked(isCompatible_SRMD_NCNN_Vulkan);
+}
+void MainWindow::on_checkBox_isCompatible_SRMD_CUDA_clicked()
+{
+ ui->checkBox_isCompatible_SRMD_CUDA->setChecked(isCompatible_SRMD_CUDA);
+}
+void MainWindow::on_checkBox_isCompatible_Waifu2x_Converter_clicked()
+{
+ ui->checkBox_isCompatible_Waifu2x_Converter->setChecked(isCompatible_Waifu2x_Converter);
+}
+void MainWindow::on_checkBox_isCompatible_Anime4k_CPU_clicked()
+{
+ ui->checkBox_isCompatible_Anime4k_CPU->setChecked(isCompatible_Anime4k_CPU);
+}
+void MainWindow::on_checkBox_isCompatible_Anime4k_GPU_clicked()
+{
+ ui->checkBox_isCompatible_Anime4k_GPU->setChecked(isCompatible_Anime4k_GPU);
+}
+void MainWindow::on_checkBox_isCompatible_FFmpeg_clicked()
+{
+ ui->checkBox_isCompatible_FFmpeg->setChecked(isCompatible_FFmpeg);
+}
+void MainWindow::on_checkBox_isCompatible_FFprobe_clicked()
+{
+ ui->checkBox_isCompatible_FFprobe->setChecked(isCompatible_FFprobe);
+}
+void MainWindow::on_checkBox_isCompatible_ImageMagick_clicked()
+{
+ ui->checkBox_isCompatible_ImageMagick->setChecked(isCompatible_ImageMagick);
+}
+void MainWindow::on_checkBox_isCompatible_Gifsicle_clicked()
+{
+ ui->checkBox_isCompatible_Gifsicle->setChecked(isCompatible_Gifsicle);
+}
+void MainWindow::on_checkBox_isCompatible_SoX_clicked()
+{
+ ui->checkBox_isCompatible_SoX->setChecked(isCompatible_SoX);
+}
+void MainWindow::on_checkBox_GPUMode_Anime4K_stateChanged(int arg1)
+{
+ if(ui->checkBox_GPUMode_Anime4K->isChecked())
+ {
+ ui->checkBox_SpecifyGPU_Anime4k->setEnabled(1);
+ ui->comboBox_GPGPUModel_A4k->setEnabled(1);
+ on_comboBox_GPGPUModel_A4k_currentIndexChanged(1);
+ }
+ else
+ {
+ ui->checkBox_SpecifyGPU_Anime4k->setEnabled(0);
+ ui->checkBox_SpecifyGPU_Anime4k->setChecked(0);
+ ui->comboBox_GPGPUModel_A4k->setEnabled(0);
+ on_comboBox_GPGPUModel_A4k_currentIndexChanged(1);
+ }
+}
+void MainWindow::on_checkBox_ShowInterPro_stateChanged(int arg1)
+{
+ if(ui->checkBox_ShowInterPro->isChecked()==false)
+ {
+ emit Send_CurrentFileProgress_Stop();
+ }
+}
+void MainWindow::on_checkBox_isCompatible_Waifu2x_Caffe_CPU_clicked()
+{
+ ui->checkBox_isCompatible_Waifu2x_Caffe_CPU->setChecked(isCompatible_Waifu2x_Caffe_CPU);
+}
+void MainWindow::on_checkBox_isCompatible_Waifu2x_Caffe_GPU_clicked()
+{
+ ui->checkBox_isCompatible_Waifu2x_Caffe_GPU->setChecked(isCompatible_Waifu2x_Caffe_GPU);
+}
+void MainWindow::on_checkBox_isCompatible_Waifu2x_Caffe_cuDNN_clicked()
+{
+ ui->checkBox_isCompatible_Waifu2x_Caffe_cuDNN->setChecked(isCompatible_Waifu2x_Caffe_cuDNN);
+}
+void MainWindow::on_pushButton_SplitSize_Add_Waifu2xCaffe_clicked()
+{
+ int VAL = ui->spinBox_SplitSize_Waifu2xCaffe->value()*2;
+ if(VAL<=999999999)
+ {
+ ui->spinBox_SplitSize_Waifu2xCaffe->setValue(VAL);
+ }
+}
+void MainWindow::on_pushButton_SplitSize_Minus_Waifu2xCaffe_clicked()
+{
+ int VAL = ui->spinBox_SplitSize_Waifu2xCaffe->value()/2;
+ if(VAL>=2)
+ {
+ ui->spinBox_SplitSize_Waifu2xCaffe->setValue(VAL);
+ }
+}
+void MainWindow::on_checkBox_isCompatible_Realsr_NCNN_Vulkan_clicked()
+{
+ ui->checkBox_isCompatible_Realsr_NCNN_Vulkan->setChecked(isCompatible_Realsr_NCNN_Vulkan);
+}
+void MainWindow::on_checkBox_ACNet_Anime4K_stateChanged(int arg1)
+{
+ if(ui->checkBox_ACNet_Anime4K->isChecked())
+ {
+ ui->checkBox_HDNMode_Anime4k->setEnabled(1);
+ ui->groupBox_PostProcessing_Anime4k->setEnabled(0);
+ ui->groupBox_PreProcessing_Anime4k->setEnabled(0);
+ ui->doubleSpinBox_PushColorStrength_Anime4K->setEnabled(0);
+ ui->doubleSpinBox_PushGradientStrength_Anime4K->setEnabled(0);
+ ui->spinBox_Passes_Anime4K->setEnabled(0);
+ ui->spinBox_PushColorCount_Anime4K->setEnabled(0);
+ }
+ else
+ {
+ ui->checkBox_HDNMode_Anime4k->setEnabled(0);
+ on_checkBox_GPUMode_Anime4K_stateChanged(0);
+ on_checkBox_SpecifyGPU_Anime4k_stateChanged(0);
+ ui->groupBox_PostProcessing_Anime4k->setEnabled(1);
+ ui->groupBox_PreProcessing_Anime4k->setEnabled(1);
+ ui->doubleSpinBox_PushColorStrength_Anime4K->setEnabled(1);
+ ui->doubleSpinBox_PushGradientStrength_Anime4K->setEnabled(1);
+ ui->spinBox_Passes_Anime4K->setEnabled(1);
+ ui->spinBox_PushColorCount_Anime4K->setEnabled(1);
+ }
+ DenoiseLevelSpinboxSetting_Anime4k();
+}
+void MainWindow::on_checkBox_HDNMode_Anime4k_stateChanged(int arg1)
+{
+ DenoiseLevelSpinboxSetting_Anime4k();
+}
+/*
+生成独立cmd文件来执行cmd命令
+*/
+void MainWindow::ExecuteCMD_batFile(QString cmd_str,bool requestAdmin)
+{
+ ExecuteCMD_batFile_QMutex.lock();
+ QString cmd_commands = "@echo off\n "+cmd_str+"\n exit";
+ Delay_msec_sleep(10);//延时防止文件名称碰撞
+ file_mkDir(Current_Path+"/batFiles_tmp");
+ QString Bat_path = Current_Path+"/batFiles_tmp/W2xEX_"+QDateTime::currentDateTime().toString("dhhmmsszzz")+".bat";
+ //========
+ QFile OpenFile_cmdFile(Bat_path);
+ OpenFile_cmdFile.remove();
+ if (OpenFile_cmdFile.open(QIODevice::ReadWrite | QIODevice::Text)) //QIODevice::ReadWrite支持读写
+ {
+ QTextStream stream(&OpenFile_cmdFile);
+ stream << cmd_commands;
+ }
+ OpenFile_cmdFile.close();
+ if(requestAdmin)
+ {
+ ShellExecuteW(NULL, QString("runas").toStdWString().c_str(), QString(Bat_path).toStdWString().c_str(), QString(Bat_path).toStdWString().c_str(), NULL, 1);
+ }
+ else
+ {
+ QDesktopServices::openUrl(QUrl("file:"+QUrl::toPercentEncoding(Bat_path)));
+ }
+ //========
+ ExecuteCMD_batFile_QMutex.unlock();
+}
+void MainWindow::Del_TempBatFile()
+{
+ file_DelDir(Current_Path+"/batFiles_tmp");
+}
+void MainWindow::comboBox_UpdateChannel_setCurrentIndex_self(int index)
+{
+ comboBox_UpdateChannel_setCurrentIndex_self_QMutex.lock();
+ isClicked_comboBox_UpdateChannel=false;
+ ui->comboBox_UpdateChannel->setCurrentIndex(index);
+ isClicked_comboBox_UpdateChannel=true;
+ comboBox_UpdateChannel_setCurrentIndex_self_QMutex.unlock();
+}
+void MainWindow::on_comboBox_UpdateChannel_currentIndexChanged(int index)
+{
+ if(isClicked_comboBox_UpdateChannel && AutoUpdate.isRunning()==false)
+ {
+ AutoUpdate = QtConcurrent::run(this, &MainWindow::CheckUpadte_Auto);//自动检查更新线程
+ }
+}
+void MainWindow::on_checkBox_ReplaceOriginalFile_stateChanged(int arg1)
+{
+ if(ui->checkBox_ReplaceOriginalFile->isChecked())
+ {
+ ui->groupBox_OutPut->setEnabled(0);
+ ui->checkBox_OutPath_isEnabled->setChecked(0);
+ ui->checkBox_DelOriginal->setEnabled(0);
+ }
+ else
+ {
+ ui->groupBox_OutPut->setEnabled(1);
+ ui->checkBox_DelOriginal->setEnabled(1);
+ }
+}
+void MainWindow::checkBox_ReplaceOriginalFile_setEnabled_True_Self()
+{
+ if(ui->checkBox_DelOriginal->isChecked()==false && ui->checkBox_OutPath_isEnabled->isChecked()==false)
+ {
+ ui->checkBox_ReplaceOriginalFile->setEnabled(1);
+ }
+}
+bool MainWindow::ReplaceOriginalFile(QString original_fullpath,QString output_fullpath)
+{
+ //检查是否启用替换源文件,以及输出文件是否存在
+ if(ui->checkBox_ReplaceOriginalFile->isChecked()==false || QFile::exists(output_fullpath)==false)return false;
+ //=================
+ QFileInfo fileinfo_original_fullpath(original_fullpath);
+ QFileInfo fileinfo_output_fullpath(output_fullpath);
+ QString file_name = file_getBaseName(original_fullpath);//获取源文件的文件名
+ QString file_ext = fileinfo_output_fullpath.suffix();//获取输出文件的后辍
+ QString file_path = file_getFolderPath(fileinfo_original_fullpath);//获取源文件的文件路径
+ //=================
+ QString Target_fullpath=file_path+"/"+file_name+"."+file_ext;
+ //=================
+ if(QAction_checkBox_MoveToRecycleBin_checkBox_ReplaceOriginalFile->isChecked())
+ {
+ file_MoveToTrash(original_fullpath);
+ file_MoveToTrash(Target_fullpath);
+ }
+ else
+ {
+ QFile::remove(original_fullpath);
+ QFile::remove(Target_fullpath);
+ }
+ //=================
+ if(QFile::rename(output_fullpath,Target_fullpath)==false)
+ {
+ emit Send_TextBrowser_NewMessage(tr("Error! Failed to move [")+output_fullpath+tr("] to [")+Target_fullpath+"]");
+ }
+ return true;
+}
+void MainWindow::on_checkBox_isCustFontEnable_stateChanged(int arg1)
+{
+ if(ui->checkBox_isCustFontEnable->isChecked())
+ {
+ ui->pushButton_Save_GlobalFontSize->setEnabled(1);
+ ui->spinBox_GlobalFontSize->setEnabled(1);
+ ui->fontComboBox_CustFont->setEnabled(1);
+ }
+ else
+ {
+ ui->pushButton_Save_GlobalFontSize->setEnabled(0);
+ ui->spinBox_GlobalFontSize->setEnabled(0);
+ ui->fontComboBox_CustFont->setEnabled(0);
+ }
+}
+void MainWindow::OutputSettingsArea_setEnabled(bool isEnabled)
+{
+ ui->scrollArea_outputPathSettings->setEnabled(isEnabled);
+ ui->lineEdit_outputPath->setClearButtonEnabled(isEnabled);
+ if(isEnabled==true)
+ {
+ ui->lineEdit_outputPath->setFocusPolicy(Qt::StrongFocus);
+ }
+ else
+ {
+ ui->lineEdit_outputPath->setFocusPolicy(Qt::NoFocus);
+ }
+}
+//事件过滤器
+bool MainWindow::eventFilter(QObject *target, QEvent *event)
+{
+ //=============================
+ //按下 Delete 移除文件列表里的文件
+ //=============================
+ if (target == ui->tableView_image || target == ui->tableView_gif || target == ui->tableView_video)
+ {
+ if (event->type() == QEvent::KeyPress)
+ {
+ QKeyEvent *keyEvent = static_cast(event);
+ if (keyEvent->key() == Qt::Key_Delete)
+ {
+ if(RemoveFile_FilesList_QAction_FileList->isEnabled())
+ {
+ on_pushButton_RemoveItem_clicked();
+ }
+ return true;
+ }
+ if ((keyEvent->modifiers() == Qt::ControlModifier) && (keyEvent->key() == Qt::Key_A))
+ {
+ if(Apply_CustRes_QAction_FileList->isEnabled())
+ {
+ EnableApply2All_CustRes=false;
+ on_pushButton_CustRes_apply_clicked();
+ EnableApply2All_CustRes=true;
+ }
+ return true;
+ }
+ if ((keyEvent->modifiers() == Qt::ControlModifier) && (keyEvent->key() == Qt::Key_C))
+ {
+ if(Cancel_CustRes_QAction_FileList->isEnabled())
+ {
+ EnableApply2All_CustRes=false;
+ on_pushButton_CustRes_cancel_clicked();
+ EnableApply2All_CustRes=true;
+ }
+ return true;
+ }
+ }
+ }
+ //==============
+ return false;
+}
+void MainWindow::on_pushButton_ResizeFilesListSplitter_clicked()
+{
+ ui->splitter_FilesList->setSizes(QList() << 1 << 1 << 1);
+}
+void MainWindow::on_comboBox_GPGPUModel_A4k_currentIndexChanged(int index)
+{
+ if(ui->comboBox_GPGPUModel_A4k->currentText().toLower().trimmed()=="opencl" && ui->checkBox_GPUMode_Anime4K->isChecked())
+ {
+ ui->spinBox_OpenCLCommandQueues_A4k->setEnabled(1);
+ ui->checkBox_OpenCLParallelIO_A4k->setEnabled(1);
+ }
+ else
+ {
+ ui->spinBox_OpenCLCommandQueues_A4k->setEnabled(0);
+ ui->checkBox_OpenCLParallelIO_A4k->setEnabled(0);
+ }
+}
+void MainWindow::on_checkBox_DisableGPU_converter_stateChanged(int arg1)
+{
+ if(ui->checkBox_DisableGPU_converter->isChecked())
+ {
+ ui->checkBox_MultiGPU_Waifu2xConverter->setChecked(0);
+ ui->comboBox_TargetProcessor_converter->setEnabled(0);
+ ui->comboBox_TargetProcessor_converter->setCurrentIndex(0);
+ ui->checkBox_MultiGPU_Waifu2xConverter->setEnabled(0);
+ }
+ else
+ {
+ ui->comboBox_TargetProcessor_converter->setEnabled(1);
+ ui->checkBox_MultiGPU_Waifu2xConverter->setEnabled(1);
+ }
+}
+void MainWindow::on_groupBox_video_settings_clicked()
+{
+ if(ui->groupBox_video_settings->isChecked())
+ {
+ //======
+ if(isCustomVideoSettingsClicked==true)
+ {
+ QMessageBox *MSG = new QMessageBox();
+ MSG->setWindowTitle(tr("Warning"));
+ MSG->setText(tr("Change Custom video settings might cause ERROR.\n\nMake sure you know what you are doing before change any settings."));
+ MSG->setIcon(QMessageBox::Warning);
+ MSG->setModal(true);
+ MSG->show();
+ }
+ //======
+ ui->groupBox_OutputVideoSettings->setEnabled(1);
+ ui->groupBox_ToMp4VideoSettings->setEnabled(1);
+ ui->pushButton_encodersList->setEnabled(1);
+ ui->pushButton_ResetVideoSettings->setEnabled(1);
+ }
+ else
+ {
+ ui->groupBox_OutputVideoSettings->setEnabled(0);
+ ui->groupBox_ToMp4VideoSettings->setEnabled(0);
+ ui->pushButton_encodersList->setEnabled(0);
+ ui->pushButton_ResetVideoSettings->setEnabled(0);
+ }
+}
+void MainWindow::Set_checkBox_DisableResize_gif_Checked()
+{
+ emit Send_TextBrowser_NewMessage(tr("[Disable \"-resize\"] is automatically enabled to fix compatibility issue and improve performance."));
+ ui->checkBox_DisableResize_gif->setChecked(true);
+}
+
+void MainWindow::on_pushButton_TurnOffScreen_clicked()
+{
+ if(TurnOffScreen_QF.isRunning() == true)return;
+ TurnOffScreen_QF = QtConcurrent::run(this, &MainWindow::TurnOffScreen);//关闭显示器
+}
+/*
+调用nircmd关闭显示器
+*/
+void MainWindow::TurnOffScreen()
+{
+ QProcess *OffScreen = new QProcess();
+ OffScreen->start("\""+Current_Path+"/nircmd-x64/nircmd.exe\" monitor off");
+ OffScreen->waitForStarted(5000);
+ OffScreen->waitForFinished(5000);
+ OffScreen->kill();
+ return;
+}
+/*
+禁用&启用 开始按钮
+*/
+void MainWindow::pushButton_Start_setEnabled_self(bool isEnabled)
+{
+ ui->pushButton_Start->setEnabled(isEnabled);
+ Start_SystemTrayIcon->setEnabled(isEnabled);
+ ui->pushButton_Start->setVisible(isEnabled);
+}
+/*
+禁用&启用 暂停按钮
+*/
+void MainWindow::pushButton_Stop_setEnabled_self(bool isEnabled)
+{
+ ui->pushButton_Stop->setEnabled(isEnabled);
+ Pause_SystemTrayIcon->setEnabled(isEnabled);
+ ui->pushButton_Stop->setVisible(isEnabled);
+}
+
+
+void MainWindow::on_pushButton_MultipleOfFPS_VFI_MIN_clicked()
+{
+ int VAL = 2;
+ if(ui->comboBox_Engine_VFI->currentIndex()==2)
+ {
+ VAL = ui->spinBox_MultipleOfFPS_VFI->value()-1;
+ }
+ else
+ {
+ VAL = ui->spinBox_MultipleOfFPS_VFI->value()/2;
+ }
+ if(VAL>=2)
+ {
+ ui->spinBox_MultipleOfFPS_VFI->setValue(VAL);
+ }
+}
+
+void MainWindow::on_pushButton_MultipleOfFPS_VFI_ADD_clicked()
+{
+ int VAL = 2;
+ if(ui->comboBox_Engine_VFI->currentIndex()==2)
+ {
+ VAL = ui->spinBox_MultipleOfFPS_VFI->value()+1;
+ }
+ else
+ {
+ VAL = ui->spinBox_MultipleOfFPS_VFI->value()*2;
+ }
+ if(VAL<=999999999)
+ {
+ ui->spinBox_MultipleOfFPS_VFI->setValue(VAL);
+ }
+}
diff --git a/SRC/Waifu2x-Extension-QT/mainwindow.h b/SRC_v3.41.01-beta/Waifu2x-Extension-QT/mainwindow.h
similarity index 97%
rename from SRC/Waifu2x-Extension-QT/mainwindow.h
rename to SRC_v3.41.01-beta/Waifu2x-Extension-QT/mainwindow.h
index dabd396..19e152d 100644
--- a/SRC/Waifu2x-Extension-QT/mainwindow.h
+++ b/SRC_v3.41.01-beta/Waifu2x-Extension-QT/mainwindow.h
@@ -1,1093 +1,1093 @@
-/*
- Copyright (C) 2021 Aaron Feng
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU Affero General Public License as published
- by the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU Affero General Public License for more details.
-
- You should have received a copy of the GNU Affero General Public License
- along with this program. If not, see .
-
- My Github homepage: https://github.com/AaronFeng753
-*/
-
-#ifndef MAINWINDOW_H
-#define MAINWINDOW_H
-
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include "topsupporterslist.h"
-
-typedef QList> QList_QMap_QStrQStr;
-Q_DECLARE_METATYPE(QList_QMap_QStrQStr)
-
-QT_BEGIN_NAMESPACE
-namespace Ui
-{
- class MainWindow;
-}
-QT_END_NAMESPACE
-
-class MainWindow : public QMainWindow
-{
- Q_OBJECT
-
-public:
- MainWindow(QWidget *parent = nullptr);
- void changeEvent(QEvent *e);
- //=======================
- QString VERSION = "v3.41.02-beta";//软件版本号
- bool isBetaVer = true;
- QString LastStableVer = "v3.31.13";
- QString LastBetaVer = "v3.41.02-beta";
- //=======================
- QTranslator * translator;//界面翻译
- QIcon *MainIcon_QIcon = new QIcon(":/new/prefix1/icon/icon_main.png");
- TopSupportersList *TopSupportersList_widget;
- //=======
- QString Current_Path = qApp->applicationDirPath();//当前路径
- //=======
- void Set_Font_fixed();
- //================================= File 文件 =================================
- void dragEnterEvent(QDragEnterEvent *event);//拖放文件event
- void dropEvent(QDropEvent *event);
- void Read_urls(QList urls);
- void Read_Input_paths_BrowserFile(QStringList Input_path_List);
- bool AddNew_gif=false;//判断是否有新增文件-gif
- bool AddNew_image=false;//判断是否有新增文件-图片
- bool AddNew_video=false;//判断是否有新增文件-视频
- void Add_File_Folder(QString Full_Path);//添加文件or文件夹(判断一个路径是文件还是文件夹,然后处理判断类型添加到table和file list)
- void Add_File_Folder_IncludeSubFolder(QString Full_Path);//添加文件文件夹(扫描子文件夹
- QStringList getFileNames_IncludeSubFolder(QString path);//读取文件列表, 包括文件夹
- int FileList_Add(QString fileName, QString SourceFile_fullPath);//直接向file list和tableview添加文件
- //判断一个文件是否已存在于一个文件列表中(输入list和完整路径,然后判断返回bool)
- bool Deduplicate_filelist(QString SourceFile_fullPath);
- bool file_isDirExist(QString SourceFile_fullPath);//判断文件夹是否存在
- void file_mkDir(QString SourceFile_fullPath);//创建文件夹
- bool file_isDirEmpty(QString FolderPath);
- QStringList file_getFileNames_in_Folder_nofilter(QString path);//读取文件夹内文件列表并返回(无过滤器)
- bool file_DelDir(const QString &path);//删除文件夹(无论是否为空,强制删除)
- QString file_getBaseName(QString path);//获取basename
- void file_MoveToTrash( QString file );//移动到回收站
- void MoveFileToOutputPath(QString Orginal,QString SourceFilePath);//移动文件
- QMutex MoveFile_QMutex;
- QString file_getFolderPath(QFileInfo fileInfo);//获取文件夹路径(去除末尾的"/")
- bool file_isDirWritable(QString DirPath);//检查文件夹是否可写入
- //检查当前行的文件所在的文件夹是否可写入
- bool file_isFilesFolderWritable_row_image(int rowNum);
- bool file_isFilesFolderWritable_row_video(int rowNum);
- bool file_isFilesFolderWritable_row_gif(int rowNum);
- bool file_OpenFolder(QString FolderPath);//调用系统资源管理器打开文件夹.
- bool file_OpenFilesFolder(QString FilePath);//打开文件所在的文件夹
- bool file_OpenFile(QString FilePath);
- void file_MoveFiles_Folder_NcnnVulkanFolderProcess(QString Old_folder, QString New_folder, bool Delete_);
- bool file_generateMarkFile(QString FileFullPath,QString Msg);
- //================================= Table =================================
- void ui_tableViews_setUpdatesEnabled(bool isEnabled);// 启用/禁用 文件列表table的UI更新
- void Init_Table();//初始化三个tableview
- QStandardItemModel *Table_model_image = new QStandardItemModel();
- QStandardItemModel *Table_model_video = new QStandardItemModel();
- QStandardItemModel *Table_model_gif = new QStandardItemModel();
- //取消指定row的自定义分辨率
- void Table_image_CustRes_Cancel_rowNumInt(int rowNum);
- void Table_gif_CustRes_Cancel_rowNumInt(int rowNum);
- void Table_video_CustRes_Cancel_rowNumInt(int rowNum);
- void Table_ChangeAllStatusToWaiting();//将所有row的状态改为waiting
- QMutex QMutex_Table_ChangeAllStatusToWaiting;
- void Table_Clear();//清空tableview
- //获取下一个row值(用于插入新数据
- int Table_image_get_rowNum();
- int Table_gif_get_rowNum();
- int Table_video_get_rowNum();
- //根据输入的table,返回成对的[完整路径]和[状态]:[fullpath]=status;
- QMap Table_Read_status_fullpath(QStandardItemModel *Table_model);
- //当前选中的rowNum
- int curRow_image = -1;
- int curRow_gif = -1;
- int curRow_video = -1;
-
- int Table_Save_Current_Table_Filelist(QString Table_FileList_ini);//保存当前文件列表(包括table
-
- int Table_Read_Saved_Table_Filelist(QString Table_FileList_ini);//读取保存的文件列表
-
- int Table_Save_Current_Table_Filelist_Watchdog(QString Table_FileList_ini);//保存文件列表的看门狗线程,确保文件成功保存
-
- bool Table_insert_finished=false;
- QMutex mutex_Table_insert_finished;//监管是否完成表格插入的bool值的mutex
-
- QMutex mutex_Table_insert;//监管表格插入的mutex
- //================================= Waifu2x ====================================
- void ShowFileProcessSummary();//展示文件处理总结报告
- QString OutPutFolder_main="";//总输出文件夹
- int Waifu2xMainThread();//waifu2x总线程,负责读取文件列表,调度waifu2x放大线程
- QStringList WaitForEngineIO(QStringList OutPutFilesFullPathList);
- QStringList WaitForEngineIO_NcnnVulkan(QString OutputFolderFullPath);
- void Restore_SplitFramesFolderPath(QString SplitFramesFolderPath, QStringList GPU_SplitFramesFolderPath_List);
- bool isForceRetryEnabled=true;
- //bool KILL_TASK_(QString TaskName,bool RequestAdmin);
- bool KILL_TASK_QStringList(QStringList TaskNameList,bool RequestAdmin);
- //==========================
- QString Waifu2x_ncnn_vulkan_FolderPath = "";
- QString Waifu2x_ncnn_vulkan_ProgramPath = "";
- //===
- int Waifu2x_NCNN_Vulkan_Image(int rowNum,bool ReProcess_MissingAlphaChannel);//vulkan放大图片线程
- //vulakn放大GIF线程:1.主线程,拆分,调度放大子线程,组装&压缩;2.放大子线程,负责放大所有帧以及调整大小
- int Waifu2x_NCNN_Vulkan_GIF(int rowNum);
- //vulkan放大视频线程:1.主线程,拆分,调度放大子线程,组装;2.放大子线程,负责放大所有帧以及调整大小
- int Waifu2x_NCNN_Vulkan_Video(int rowNum);
- int Waifu2x_NCNN_Vulkan_Video_BySegment(int rowNum);
- QString Waifu2x_NCNN_Vulkan_ReadSettings();
- QString Waifu2x_NCNN_Vulkan_ReadSettings_Video_GIF(int ThreadNum);
- //===
- int Realsr_NCNN_Vulkan_Image(int rowNum,bool ReProcess_MissingAlphaChannel);//Realsr放大图片线程
- //Realsr放大GIF线程:1.主线程,拆分,调度放大子线程,组装&压缩;2.放大子线程,负责放大所有帧以及调整大小
- int Realsr_NCNN_Vulkan_GIF(int rowNum);
- //Realsr放大视频线程:1.主线程,拆分,调度放大子线程,组装;2.放大子线程,负责放大所有帧以及调整大小
- int Realsr_NCNN_Vulkan_Video(int rowNum);
- int Realsr_NCNN_Vulkan_Video_BySegment(int rowNum);
- QString Realsr_NCNN_Vulkan_ReadSettings();
- int Calculate_Temporary_ScaleRatio_RealsrNCNNVulkan(int ScaleRatio);
- QString Realsr_NCNN_Vulkan_ReadSettings_Video_GIF(int ThreadNum);
- //=========================
- int Anime4k_Image(int rowNum,bool ReProcess_MissingAlphaChannel);
- int Anime4k_GIF(int rowNum);
- int Anime4k_GIF_scale(QMap Sub_Thread_info,int *Sub_gif_ThreadNumRunning,bool *Frame_failed);
- //Anime4k放大视频线程:1.主线程,拆分,调度放大子线程,组装;2.放大子线程,负责放大所有帧以及调整大小
- int Anime4k_Video(int rowNum);
- int Anime4k_Video_BySegment(int rowNum);
- int Anime4k_Video_scale(QMap Sub_Thread_info,int *Sub_video_ThreadNumRunning,bool *Frame_failed);
- QString Anime4k_ReadSettings(bool PreserveAlphaChannel);
- void DenoiseLevelSpinboxSetting_Anime4k();
- QString Anime4k_ProgramPath = Current_Path + "/Anime4K/Anime4K_waifu2xEX.exe";
- int Get_NumOfGPU_Anime4k();
- //=================================
- int Waifu2x_Converter_Image(int rowNum,bool ReProcess_MissingAlphaChannel);//Converter放大图片线程
- //Converter放大GIF线程:1.主线程,拆分,调度放大子线程,组装&压缩;2.放大子线程,负责放大所有帧以及调整大小
- int Waifu2x_Converter_GIF(int rowNum);
- int Waifu2x_Converter_GIF_scale(QMap Sub_Thread_info,int *Sub_gif_ThreadNumRunning,bool *Frame_failed);
- //Converter放大视频线程:1.主线程,拆分,调度放大子线程,组装;2.放大子线程,负责放大所有帧以及调整大小
- int Waifu2x_Converter_Video(int rowNum);
- int Waifu2x_Converter_Video_BySegment(int rowNum);
- int Waifu2x_Converter_Video_scale(QMap Sub_Thread_info,int *Sub_video_ThreadNumRunning,bool *Frame_failed);
- QString Waifu2xConverter_ReadSettings();
- //===================================
- int SRMD_NCNN_Vulkan_Image(int rowNum,bool ReProcess_MissingAlphaChannel);//SRMD放大图片线程
- //SRMD放大GIF线程:1.主线程,拆分,调度放大子线程,组装&压缩;2.放大子线程,负责放大所有帧以及调整大小
- int SRMD_NCNN_Vulkan_GIF(int rowNum);
- //SRMD放大视频线程:1.主线程,拆分,调度放大子线程,组装;2.放大子线程,负责放大所有帧以及调整大小
- int SRMD_NCNN_Vulkan_Video(int rowNum);
- int SRMD_NCNN_Vulkan_Video_BySegment(int rowNum);
- QString SrmdNcnnVulkan_ReadSettings();
- QMap Calculate_ScaleRatio_SrmdNcnnVulkan(int ScaleRatio);
- QString SrmdNcnnVulkan_ReadSettings_Video_GIF(int ThreadNum);
- //=================================
- int Waifu2x_Caffe_Image(int rowNum,bool ReProcess_MissingAlphaChannel);//Caffe放大图片线程
- //Caffe放大GIF线程:1.主线程,拆分,调度放大子线程,组装&压缩;2.放大子线程,负责放大所有帧以及调整大小
- int Waifu2x_Caffe_GIF(int rowNum);
- int Waifu2x_Caffe_GIF_scale(QMap Sub_Thread_info,int *Sub_gif_ThreadNumRunning,bool *Frame_failed);
- //Caffe放大视频线程:1.主线程,拆分,调度放大子线程,组装;2.放大子线程,负责放大所有帧以及调整大小
- int Waifu2x_Caffe_Video(int rowNum);
- int Waifu2x_Caffe_Video_BySegment(int rowNum);
- int Waifu2x_Caffe_Video_scale(QMap Sub_Thread_info,int *Sub_video_ThreadNumRunning,bool *Frame_failed);
- QString Waifu2x_Caffe_ReadSettings();
- bool isWaifu2xCaffeEnabled();
- void DeleteErrorLog_Waifu2xCaffe();
- //====================================
- int SRMD_CUDA_Image(int rowNum,bool ReProcess_MissingAlphaChannel);//SRMD放大图片线程
- //SRMD放大GIF线程:1.主线程,拆分,调度放大子线程,组装&压缩;2.放大子线程,负责放大所有帧以及调整大小
- int SRMD_CUDA_GIF(int rowNum);
- //SRMD放大视频线程:1.主线程,拆分,调度放大子线程,组装;2.放大子线程,负责放大所有帧以及调整大小
- int SRMD_CUDA_Video(int rowNum);
- int SRMD_CUDA_Video_BySegment(int rowNum);
- //====================================
-
- void Wait_waifu2x_stop();//等待waifu2x主线程完全停止所有子线程的看门狗线程
- bool waifu2x_STOP = false;//负责通知waifu2x主线程及其子线程的停止信号
- bool waifu2x_STOP_confirm = false;//返回给waifu2x停止看门狗的信号
-
- int ThreadNumMax = 0;//waifu2x放大线程最大值
- int ThreadNumRunning = 0;//正在运行的waifu2x线程数量
-
- QMutex mutex_ThreadNumRunning;//监管总线程数量的mutex
- QMutex mutex_SubThreadNumRunning;//监管内部线程数量的mutex
-
- int Waifu2x_DetectGPU();//检测可用gpu(for vulkan)
- QStringList Available_GPUID;//可用GPU ID列表
-
- int Waifu2x_DumpProcessorList_converter();
- int Core_num = 0;
- QStringList Available_ProcessorList_converter;
- QString Processor_converter_STR="";
-
- int SRMD_DetectGPU();//检测可用gpu(for srmd)
- QStringList Available_GPUID_srmd;//可用GPU ID列表
- QString GPU_ID_STR_SRMD="";//向srmd命令行cmd插入的gpuid命令,如果auto则为空
-
- int Realsr_ncnn_vulkan_DetectGPU();//检测可用gpu(for realsr)
- QStringList Available_GPUID_Realsr_ncnn_vulkan;//可用GPU ID列表
-
- void ListGPUs_Anime4k();//列出可用显卡 Anime4k
-
- int FrameInterpolation_DetectGPU();//检测可用gpu(for vulkan)
- QStringList Available_GPUID_FrameInterpolation;//可用GPU ID列表
- //======================== 图片处理 ================================
- bool Image_Gif_AutoSkip_CustRes(int rowNum,bool isGif);
- QMap Image_Gif_Read_Resolution(QString SourceFileFullPath);//获取图片&GIF分辨率
- bool Imgae_hasAlphaChannel(int rowNum);
- QString Imgae_PreProcess(QString ImagePath,bool ReProcess_AlphaChannel);
- QString SaveImageAs_FormatAndQuality(QString OriginalSourceImage_fullPath,QString ScaledImage_fullPath,bool isDenoiseLevelEnabled,int DenoiseLevel);
- //================================================================
- int Waifu2x_Compatibility_Test();//引擎兼容性检测
- //初始化 -兼容性测试进度条
- void Init_progressBar_CompatibilityTest();
- //兼容性测试完成后的操作 -兼容性测试进度条
- void Finish_progressBar_CompatibilityTest();
- //兼容性检测
- bool isCompatible_Waifu2x_NCNN_Vulkan_OLD=false;
- bool isCompatible_Waifu2x_NCNN_Vulkan_NEW=false;
- bool isCompatible_Waifu2x_NCNN_Vulkan_NEW_FP16P=false;
- bool isCompatible_SRMD_NCNN_Vulkan=false;
- bool isCompatible_SRMD_CUDA=false;
- bool isCompatible_Waifu2x_Converter=false;
- bool isCompatible_Anime4k_CPU=false;
- bool isCompatible_Anime4k_GPU=false;
- bool isCompatible_FFmpeg=false;
- bool isCompatible_FFprobe=false;
- bool isCompatible_ImageMagick=false;
- bool isCompatible_Gifsicle=false;
- bool isCompatible_SoX=false;
- bool isCompatible_Waifu2x_Caffe_CPU=false;
- bool isCompatible_Waifu2x_Caffe_GPU=false;
- bool isCompatible_Waifu2x_Caffe_cuDNN=false;
- bool isCompatible_Realsr_NCNN_Vulkan=false;
- bool isCompatible_RifeNcnnVulkan=false;
- bool isCompatible_CainNcnnVulkan=false;
- bool isCompatible_DainNcnnVulkan=false;
- //============================== 多显卡 ==========================================
- //waifu2x-ncnn-vulkan
- int GPU_ID_Waifu2x_NCNN_Vulkan_MultiGPU = 0;
- QMap Waifu2x_NCNN_Vulkan_MultiGPU();
- QMutex MultiGPU_QMutex_Waifu2xNCNNVulkan;
- QList> GPUIDs_List_MultiGPU_Waifu2xNCNNVulkan;
- void AddGPU_MultiGPU_Waifu2xNCNNVulkan(QString GPUID);
-
- //SRMD-ncnn-vulkan
- int GPU_ID_SrmdNcnnVulkan_MultiGPU = 0;
- QMap SrmdNcnnVulkan_MultiGPU();
- QMutex MultiGPU_QMutex_SrmdNcnnVulkan;
- QList> GPUIDs_List_MultiGPU_SrmdNcnnVulkan;
- void AddGPU_MultiGPU_SrmdNcnnVulkan(QString GPUID);
-
- //RealsrNcnnVulkan
- int GPU_ID_RealsrNcnnVulkan_MultiGPU = 0;
- QMap RealsrNcnnVulkan_MultiGPU();
- QMutex MultiGPU_QMutex_RealsrNcnnVulkan;
- QList> GPUIDs_List_MultiGPU_RealsrNcnnVulkan;
- void AddGPU_MultiGPU_RealsrNcnnVulkan(QString GPUID);
-
- //Waifu2xConverter
- int GPU_ID_Waifu2xConverter_MultiGPU = 0;
- QMap Waifu2xConverter_MultiGPU();
- QMutex MultiGPU_QMutex_Waifu2xConverter;
- QList> GPUIDs_List_MultiGPU_Waifu2xConverter;
- void AddGPU_MultiGPU_Waifu2xConverter(QString GPUID);
-
- //Anime4k
- int GPU_ID_Anime4k_GetGPUInfo = 0;
- QString Anime4k_GetGPUInfo();
- QMutex GetGPUInfo_QMutex_Anime4k;
-
- //Waifu2x-caffe
- int GPU_ID_Waifu2xCaffe_GetGPUInfo = 0;
- QString Waifu2xCaffe_GetGPUInfo();
- QMutex GetGPUInfo_QMutex_Waifu2xCaffe;
- int Get_NumOfGPU_W2xCaffe();
- //================================ progressbar ===================================
- int Progressbar_MaxVal = 0;//进度条最大值
- int Progressbar_CurrentVal = 0;//进度条当前值
- void progressbar_clear();//清空进度条
- void progressbar_SetToMax(int maxval);//将进度条设定到最大值
- //=============================== textbrowser===============================
- void TextBrowser_StartMes();//输出启动信息
- //================================ gif ====================================
- void Gif_RemoveFromCustResList(int RowNumber);
- bool Gif_DoubleScaleRatioPrep(int RowNumber);
- int Gif_getDuration(QString gifPath);//获取帧间隔时长
- int Gif_getFrameDigits(QString gifPath);//获取帧数量的位数
- void Gif_splitGif(QString gifPath,QString SplitFramesFolderPath);//拆分gif
- void Gif_assembleGif(QString ResGifPath,QString ScaledFramesPath,int Duration,bool CustRes_isEnabled,int CustRes_height,int CustRes_width,bool isOverScaled,QString SourceGifFullPath);//组装gif
- QString Gif_compressGif(QString gifPath,QString gifPath_compressd);//压缩gif
- //================================= video ===============================
- void video_RemoveFromCustResList(int RowNumber);
- bool video_DoubleScaleRatioPrep(int RowNumber);
- QString isPreVFIDone_MarkFilePath(QString VideoPath);
- int CalNumDigits(int input_num);
- bool isSuccessiveFailuresDetected_VFI=false;
- int FrameInterpolation_Video_BySegment(int rowNum);
- int FrameInterpolation_Video(int rowNum);
- int Old_FrameInterpolation_Engine_Index=0;
- QString FrameInterpolation_ReadConfig(bool isUhdInput,int NumOfFrames);
- bool FrameInterpolation(QString SourcePath,QString OutputPath);
- bool Video_AutoSkip_CustRes(int rowNum);
- QMap video_get_Resolution(QString VideoFileFullPath);//获取视频的帧率
- QString video_get_fps(QString videoPath);//获取视频fps
- int video_get_frameNumDigits(QString videoPath);//获取帧数量的位数
- int video_get_frameNum(QString videoPath);//获取帧数量
-
- //判断视频是否可变帧率
- bool video_isVFR(QString videoPath);
- //拆分视频
- void video_video2images(QString VideoPath,QString FrameFolderPath,QString AudioPath);
- //组装视频
- int video_images2video(QString VideoPath,QString video_mp4_scaled_fullpath,QString ScaledFrameFolderPath,QString AudioPath,bool CustRes_isEnabled,int CustRes_height,int CustRes_width,bool isOverScaled);
- //读取输出视频的设定参数
- QString video_ReadSettings_OutputVid(QString AudioPath);
- //获取视频比特率
- QString video_get_bitrate(QString videoPath,bool isReturnFullCMD,bool isVidOnly);
- //获取视频比特率(根据分辨率计算)
- QString video_get_bitrate_AccordingToRes_FrameFolder(QString ScaledFrameFolderPath,QString VideoPath);
- int video_UseRes2CalculateBitrate(QString VideoFileFullPath);//根据视频的分辨率计算他应该被分配的比特率
- //音频降噪
- QString video_AudioDenoise(QString OriginalAudioPath);
- //获取时长(秒)
- int video_get_duration(QString videoPath);
- //转换为mp4
- QString video_To_CFRMp4(QString VideoPath);
- //提取音频
- void video_get_audio(QString VideoPath,QString AudioPath);
- //拆分视频(分段)
- void video_video2images_ProcessBySegment(QString VideoPath,QString FrameFolderPath,int StartTime,int SegmentDuration);
- //组装视频(mp4片段到成片)
- void video_AssembleVideoClips(QString VideoClipsFolderPath,QString VideoClipsFolderName,QString video_mp4_scaled_fullpath,QString AudioPath);
- //生成视频片段文件夹编号
- QString video_getClipsFolderNo();
- QMutex MultiLine_ErrorOutput_QMutex;
-
- bool video_isNeedProcessBySegment(int rowNum);//根据视频时长,判断是否需要分段处理
- void DelVfiDir(QString VideoPath);
- //============================ custom res ====================================
- //自定义分辨率列表
- QList> Custom_resolution_list;//res_map["fullpath"],["height"],["width"]
- void CustRes_remove(QString fullpath);//根据完整路径,移除自定义分辨率内条目
- bool CustRes_isContained(QString fullpath);//检查是否包括某文件
- QMap CustRes_getResMap(QString fullpath);//读取指定文件的自定义分辨率值
- int CustRes_CalNewScaleRatio(QString fullpath,int Height_new,int width_new);//计算新的放大倍数
- int CustRes_SetCustRes();//设定自定义分辨率
- int CustRes_CancelCustRes();//取消自定义分辨率
- QMap DoubleScaleRatio_Cal_NewScaleRatio_NewHW(QString fullpath,double ScaleRatio_double);
-
- Qt::AspectRatioMode CustRes_AspectRatioMode = Qt::IgnoreAspectRatio;//自定义分辨率的纵横比策略
- //======================== 设置 ===========================================
- int Settings_Read_Apply();//读取与apply设置
- bool Settings_isReseted = false;//是否重置设置标记
- QVariant Settings_Read_value(QString Key);
- bool isReadOldSettings = false;
- //================================ Other =======================================
- bool isCustomVideoSettingsClicked=true;
-
- void pushButton_Start_setEnabled_self(bool isEnabled);
- void pushButton_Stop_setEnabled_self(bool isEnabled);
-
- void TurnOffScreen();
- QFuture TurnOffScreen_QF;//监视是否连续多次点击关闭屏幕,避免连续启动nircmd
-
- bool FileProgressWatch_isEnabled = true;//是否启用输出文件夹进度监控线程
-
- int ForceRetryCount = 1;
-
- void OutputSettingsArea_setEnabled(bool isEnabled);
-
- bool isFirstTimeStart=false;
-
- bool isForceRetryClicked=false;
- QMutex isForceRetryClicked_QMutex;
- void DelTrash_ForceRetry_Anime4k(QString OutPut_Path);
- void isForceRetryClicked_SetTrue_Block_Anime4k();
-
- void AutoFinishAction_Message();
- int SystemShutDown_Countdown();//自动关机倒计时
- int SystemShutDown_isAutoShutDown();//判断之前是否执行过自动关机
- //阻塞延时(安全
- void Delay_sec_sleep(int time);
- void Delay_msec_sleep(int time);
-
- void Play_NFSound();//播放提示音
-
- QTimer *TimeCostTimer;//计算耗时的timer
- long unsigned int TimeCost = 0;//已消耗时间
- QString Seconds2hms(long unsigned int seconds);//秒 转 时:分:秒
- long unsigned int TaskNumTotal=0;//总任务数量(需要处理的文件)
- long unsigned int TaskNumFinished=0;//处理完的文件数量
- bool NewTaskFinished=false;//新任务被完成之标记
- long unsigned int ETA=0;//ETA时间(s)
-
- int CheckUpadte_Auto();//自动检查更新
-
- int Donate_DownloadOnlineQRCode();
-
- bool isSettingsHide=false;//是否隐藏主页的设置groupbox
-
- bool isShowAnime4kWarning=true;
-
- void ConnectivityTest_RawGithubusercontentCom();//检查是否可以连接github
- bool isConnectivityTest_RawGithubusercontentCom_Running=false;
- QMutex QMutex_ConnectivityTest_RawGithubusercontentCom;
-
- bool DownloadTo(QString OnlineLink,QString LocalPath);
- //=========== 关闭窗口时执行的代码 ===============
- void closeEvent(QCloseEvent* event);//关闭事件
- //void Close_self();//包含所有关闭时执行的代码
- bool QProcess_stop=false;//所有QProcess停止标记
- int Auto_Save_Settings_Watchdog(bool isWaitForSave);//自动保存设置的看门狗
- QFuture AutoUpdate;//监视自动检查更新线程
- QFuture DownloadOnlineQRCode;//监视在线下载二维码线程
- QFuture Waifu2xMain;//监视waifu2x主线程
- int Force_close();//调用cmd强制关闭自己
- bool isAlreadyClosed=false;
- //================== 处理当前文件的进度 =========================
- long unsigned int TimeCost_CurrentFile =0;
- long unsigned int TaskNumTotal_CurrentFile=0;
- long unsigned int TaskNumFinished_CurrentFile=0;
- bool NewTaskFinished_CurrentFile=false;
- long unsigned int ETA_CurrentFile=0;
- bool isStart_CurrentFile=false;
- //=============================================
- void Tip_FirstTimeStart();
- //================== 托盘图标 =================
- void Init_SystemTrayIcon();
- QSystemTrayIcon *systemTray = new QSystemTrayIcon(this);
- QMenu *pContextMenu = new QMenu(this);
- QAction *minimumAct_SystemTrayIcon = new QAction(this);
- QAction *restoreAct_SystemTrayIcon = new QAction(this);
- QAction *quitAct_SystemTrayIcon = new QAction(this);
- QAction *BackgroundModeAct_SystemTrayIcon = new QAction(this);
- QAction *SendFeedback_SystemTrayIcon = new QAction(this);
- QAction *About_SystemTrayIcon = new QAction(this);
- QAction *Donate_SystemTrayIcon = new QAction(this);
- QAction *Pause_SystemTrayIcon = new QAction(this);
- QAction *Start_SystemTrayIcon = new QAction(this);
- QAction *BecomePatron_SystemTrayIcon = new QAction(this);
- QAction *TopSupportersList_SystemTrayIcon = new QAction(this);
- //================= 输出路径 lineEdit 的右键菜单 ==============
- void Init_ActionsMenu_lineEdit_outputPath();
- QAction *OpenFolder_lineEdit_outputPath = new QAction(this);
- //================= 文件列表的右键菜单 ====================
- void Init_ActionsMenu_FilesList();
- QAction *OpenFile_QAction_FileList = new QAction(this);
- QAction *OpenFilesFolder_QAction_FileList = new QAction(this);
- QAction *RemoveFile_FilesList_QAction_FileList = new QAction(this);
- bool EnableApply2All_CustRes=true;
- QAction *Apply_CustRes_QAction_FileList = new QAction(this);
- QAction *Cancel_CustRes_QAction_FileList = new QAction(this);
- void OpenSelectedFile_FailedWarning_FilesList();
- //================ 移除条目 按钮的右键菜单=======================
- void Init_ActionsMenu_pushButton_RemoveItem();
- QAction *RemoveALL_image = new QAction(this);
- QAction *RemoveALL_gif = new QAction(this);
- QAction *RemoveALL_video = new QAction(this);
- //=================== 生成bat文件来执行cmd命令 ===========
- void ExecuteCMD_batFile(QString cmd_str,bool requestAdmin);
- QMutex ExecuteCMD_batFile_QMutex;
- void Del_TempBatFile();
- //=====================================================
- void comboBox_UpdateChannel_setCurrentIndex_self(int index);
- QMutex comboBox_UpdateChannel_setCurrentIndex_self_QMutex;
- bool isClicked_comboBox_UpdateChannel=true;
- //===================== 直接替换源文件 =====================
- void checkBox_ReplaceOriginalFile_setEnabled_True_Self();
- bool ReplaceOriginalFile(QString original_fullpath,QString output_fullpath);
- void Init_ActionsMenu_checkBox_ReplaceOriginalFile();//替换源文件 的右键菜单
- QAction *QAction_checkBox_MoveToRecycleBin_checkBox_ReplaceOriginalFile = new QAction(this);
- //===================== 删除原文件的右键菜单 ===========================
- void Init_ActionsMenu_checkBox_DelOriginal();//替换源文件 的右键菜单
- QAction *QAction_checkBox_MoveToRecycleBin_checkBox_DelOriginal = new QAction(this);
- //===================== 事件过滤器 =====================
- bool eventFilter(QObject *target, QEvent *event);
- //===================== 块大小调整 ======================
- int AddTileSize_NCNNVulkan_Converter(int OrginalTileSize);
- int MinusTileSize_NCNNVulkan_Converter(int OrginalTileSize);
- //==================== 预读取引擎设定 ==================
- void PreLoad_Engines_Settings();
- //===
- QString Waifu2x_NCNN_Vulkan_PreLoad_Settings();
- QString Waifu2x_NCNN_Vulkan_PreLoad_Settings_Str = "";
- //===
- QString SrmdNcnnVulkan_PreLoad_Settings();
- QString SrmdNcnnVulkan_PreLoad_Settings_Str = "";
- //===
- QString Realsr_NCNN_Vulkan_PreLoad_Settings();
- QString Realsr_NCNN_Vulkan_PreLoad_Settings_Str = "";
- //===
- QString Waifu2xCaffe_PreLoad_Settings();
- QString Waifu2xCaffe_PreLoad_Settings_Str = "";
- //===
- QString Waifu2xConverter_PreLoad_Settings();
- QString Waifu2xConverter_PreLoad_Settings_Str = "";
- //===
- QString Anime4k_PreLoad_Settings();
- QString Anime4k_PreLoad_Settings_Str = "";
- QString HDNDenoiseLevel_image = "";
- QString HDNDenoiseLevel_gif = "";
- QString HDNDenoiseLevel_video = "";
- //================== 计算临时放大倍率 ====================
- int Calculate_Temporary_ScaleRatio_W2xNCNNVulkan(int ScaleRatio);
- //================== 多线程调整图片大小 =========================
- void ImagesResize_Folder_MultiThread(int New_width,int New_height,QString ImagesFolderPath);
- int TotalNumOfThreads_ImagesResize_Folder_MultiThread;
- int RunningNumOfThreads_ImagesResize_Folder_MultiThread;
- QMutex QMutex_ResizeImage_MultiThread;
- void ResizeImage_MultiThread(int New_width,int New_height,QString ImagesPath);
- //================== 处理APNG =================
- void APNG_Main(int rowNum,bool isFromImageList);
- void APNG_Split2Frames(QString sourceFileFullPath,QString splitFramesFolder);
- void APNG_Frames2APNG(QString sourceFileFullPath,QString scaledFramesFolder,QString resultFileFullPath,bool isOverScaled);
- bool APNG_isAnimatedPNG(int rowNum);
- //Waifu2x-NCNN-Vulkan
- bool APNG_Waifu2xNCNNVulkan(QString splitFramesFolder,QString scaledFramesFolder,QString sourceFileFullPath,QStringList framesFileName_qStrList,QString resultFileFullPath);
- //Waifu2x-Converter
- bool APNG_Waifu2xConverter(QString splitFramesFolder,QString scaledFramesFolder,QString sourceFileFullPath,QStringList framesFileName_qStrList,QString resultFileFullPath);
- int Waifu2x_Converter_APNG_scale(QMap Sub_Thread_info,int *Sub_gif_ThreadNumRunning,bool *Frame_failed);
- //Srmd-NCNN-Vulkan
- bool APNG_SrmdNCNNVulkan(QString splitFramesFolder,QString scaledFramesFolder,QString sourceFileFullPath,QStringList framesFileName_qStrList,QString resultFileFullPath);
- //Anime4k
- bool APNG_Anime4k(QString splitFramesFolder,QString scaledFramesFolder,QString sourceFileFullPath,QStringList framesFileName_qStrList,QString resultFileFullPath);
- int Anime4k_APNG_scale(QMap Sub_Thread_info,int *Sub_gif_ThreadNumRunning,bool *Frame_failed);
- //Srmd-CUDA
- bool APNG_SrmdCUDA(QString splitFramesFolder,QString scaledFramesFolder,QString sourceFileFullPath,QStringList framesFileName_qStrList,QString resultFileFullPath);
- //waifu2x-caffe
- bool APNG_Waifu2xCaffe(QString splitFramesFolder,QString scaledFramesFolder,QString sourceFileFullPath,QStringList framesFileName_qStrList,QString resultFileFullPath);
- int Waifu2x_Caffe_APNG_scale(QMap Sub_Thread_info,int *Sub_gif_ThreadNumRunning,bool *Frame_failed);
- //Realsr-NCNN-Vulkan
- bool APNG_RealsrNCNNVulkan(QString splitFramesFolder,QString scaledFramesFolder,QString sourceFileFullPath,QStringList framesFileName_qStrList,QString resultFileFullPath);
- //=============
- ~MainWindow();
-
-public slots:
- void Table_EnableSorting(bool EnableSorting);
-
- void Apply_CustRes_QAction_FileList_slot();
- void Cancel_CustRes_QAction_FileList_slot();
-
- void RemoveALL_image_slot();
- void RemoveALL_gif_slot();
- void RemoveALL_video_slot();
-
- void Add_progressBar_CompatibilityTest();//进度+1 -兼容性测试进度条
-
- void OpenSelectedFilesFolder_FilesList();
- void OpenSelectedFile_FilesList();
-
- void OpenOutputFolder();
-
- void Unable2Connect_RawGithubusercontentCom();
-
- void SetEnable_pushButton_ForceRetry_self();
-
- void SystemTray_hide_self();
- void SystemTray_showNormal_self();
- void SystemTray_showDonate();
-
- void SystemTray_NewMessage(QString message);
- void EnableBackgroundMode_SystemTray();
- void on_activatedSysTrayIcon(QSystemTrayIcon::ActivationReason reason);
-
- void progressbar_setRange_min_max(int min, int max);//进度条设定min和max
- void progressbar_Add();//进度条进度+1
-
- //根据row修改指定row的状态
- void Table_image_ChangeStatus_rowNumInt_statusQString(int rowNum, QString status);
- void Table_gif_ChangeStatus_rowNumInt_statusQString(int rowNum, QString status);
- void Table_video_ChangeStatus_rowNumInt_statusQString(int rowNum, QString status);
-
- void Waifu2x_Finished();//自动结束时调用的代码(会自动接着调用manual
- void Waifu2x_Finished_manual();//手动停止后调用的结束代码
-
- void TextBrowser_NewMessage(QString message);//Textbrowser发送新消息"[时间] 消息"
-
- void TimeSlot();//计时槽函数
-
- int Waifu2x_Compatibility_Test_finished();//兼容性检测结束后执行的槽函数
-
- int Waifu2x_DetectGPU_finished();//检测可用gpu结束后的执行的槽函数
-
- int Realsr_ncnn_vulkan_DetectGPU_finished();//检测可用gpu结束后的执行的槽函数
-
- int FrameInterpolation_DetectGPU_finished();
-
- int CheckUpadte_NewUpdate(QString update_str,QString Change_log);//检测到更新的弹窗代码
-
- void FinishedProcessing_DN();
-
- int Table_FileCount_reload();//重载table下的文件数量计数
-
- //向table插入文件名和fullpath
- void Table_image_insert_fileName_fullPath(QString fileName, QString SourceFile_fullPath);
- void Table_gif_insert_fileName_fullPath(QString fileName, QString SourceFile_fullPath);
- void Table_video_insert_fileName_fullPath(QString fileName, QString SourceFile_fullPath);
-
- //向table插入自定义分辨率值
- void Table_image_CustRes_rowNumInt_HeightQString_WidthQString(int rowNum, QString height, QString width);
- void Table_gif_CustRes_rowNumInt_HeightQString_WidthQString(int rowNum, QString height, QString width);
- void Table_video_CustRes_rowNumInt_HeightQString_WidthQString(int rowNum, QString height, QString width);
-
- //读取&保存文件列表与table后执行的代码
- int Table_Read_Saved_Table_Filelist_Finished(QString Table_FileList_ini);
- int Table_Save_Current_Table_Filelist_Finished();
-
- void on_pushButton_ClearList_clicked();//清空列表
-
- bool SystemShutDown();//关机
-
- int Waifu2x_DumpProcessorList_converter_finished();
-
- void Read_urls_finfished();
-
- void SRMD_DetectGPU_finished();
-
- void video_write_VideoConfiguration(QString VideoConfiguration_fullPath,int ScaleRatio,int DenoiseLevel,bool CustRes_isEnabled,int CustRes_height,int CustRes_width,QString EngineName,bool isProcessBySegment,QString VideoClipsFolderPath,QString VideoClipsFolderName,bool isVideoFrameInterpolationEnabled,int MultipleOfFPS);
-
- int Settings_Save();//保存设置
-
- //存储进度
- void video_write_Progress_ProcessBySegment(QString VideoConfiguration_fullPath,int StartTime,bool isSplitComplete,bool isScaleComplete,int OLDSegmentDuration,int LastVideoClipNo);
-
- //================== 处理当前文件的进度 =========================
- void CurrentFileProgress_Start(QString FileName,int FrameNum);
- void CurrentFileProgress_Stop();
- void CurrentFileProgress_progressbar_Add();
- void CurrentFileProgress_progressbar_Add_SegmentDuration(int SegmentDuration);
- void CurrentFileProgress_progressbar_SetFinishedValue(int FinishedValue);
- void CurrentFileProgress_WatchFolderFileNum(QString FolderPath);
- void CurrentFileProgress_WatchFolderFileNum_Textbrower(QString SourceFile_fullPath,QString FolderPath,int TotalFileNum);
-
- void Donate_ReplaceQRCode(QString QRCodePath);
-
- void Set_checkBox_DisableResize_gif_Checked();
-
-private slots:
- void on_pushButton_Start_clicked();
-
- void on_pushButton_Stop_clicked();
-
- int on_pushButton_RemoveItem_clicked();
-
- void on_pushButton_CheckUpdate_clicked();
-
- void on_pushButton_Report_clicked();
-
- void on_pushButton_ReadMe_clicked();
-
- void on_comboBox_Engine_Image_currentIndexChanged(int index);
-
- void on_comboBox_Engine_GIF_currentIndexChanged(int index);
-
- void on_comboBox_Engine_Video_currentIndexChanged(int index);
-
- void on_pushButton_clear_textbrowser_clicked();
-
- void on_spinBox_textbrowser_fontsize_valueChanged(int arg1);
-
- void on_pushButton_compatibilityTest_clicked();
-
- void on_pushButton_CustRes_apply_clicked();
-
- void on_pushButton_CustRes_cancel_clicked();
-
- void on_pushButton_HideSettings_clicked();
-
- void on_pushButton_DetectGPU_clicked();
-
- void on_pushButton_SaveSettings_clicked();
-
- void on_pushButton_ResetSettings_clicked();
-
- void on_comboBox_language_currentIndexChanged(int index);
-
- void on_pushButton_SaveFileList_clicked();
-
- void on_pushButton_ReadFileList_clicked();
-
- void on_Ext_image_editingFinished();
-
- void on_Ext_video_editingFinished();
-
- void on_checkBox_AutoSaveSettings_clicked();
-
- void on_pushButton_about_clicked();
-
- void on_comboBox_AspectRatio_custRes_currentIndexChanged(int index);
-
- void on_checkBox_AlwaysHideSettings_stateChanged(int arg1);
-
- void on_pushButton_Save_GlobalFontSize_clicked();
-
- void on_pushButton_BrowserFile_clicked();
-
- void on_pushButton_wiki_clicked();
-
- void on_pushButton_HideTextBro_clicked();
-
- void on_checkBox_AlwaysHideTextBrowser_stateChanged(int arg1);
-
- void on_pushButton_DumpProcessorList_converter_clicked();
-
- void on_comboBox_TargetProcessor_converter_currentIndexChanged(int index);
-
- void on_Ext_image_textChanged(const QString &arg1);
-
- void on_Ext_video_textChanged(const QString &arg1);
-
- void on_comboBox_model_vulkan_currentIndexChanged(int index);
-
- void on_comboBox_ImageStyle_currentIndexChanged(int index);
-
- void on_pushButton_ResetVideoSettings_clicked();
-
- void on_lineEdit_encoder_vid_textChanged(const QString &arg1);
-
- void on_lineEdit_encoder_audio_textChanged(const QString &arg1);
-
- void on_lineEdit_pixformat_textChanged(const QString &arg1);
-
- void on_checkBox_vcodec_copy_2mp4_stateChanged(int arg1);
-
- void on_checkBox_acodec_copy_2mp4_stateChanged(int arg1);
-
- void on_pushButton_encodersList_clicked();
-
- void on_checkBox_DelOriginal_stateChanged(int arg1);
-
- void on_checkBox_FileList_Interactive_stateChanged(int arg1);
-
- void on_checkBox_OutPath_isEnabled_stateChanged(int arg1);
-
- void on_pushButton_ForceRetry_clicked();
-
- void on_pushButton_PayPal_clicked();
-
- void on_pushButton_DetectGPUID_srmd_clicked();
-
- void on_checkBox_AudioDenoise_stateChanged(int arg1);
-
- void on_tabWidget_currentChanged(int index);
-
- void on_checkBox_ProcessVideoBySegment_stateChanged(int arg1);
-
- void on_comboBox_version_Waifu2xNCNNVulkan_currentIndexChanged(int index);
-
- void on_checkBox_EnablePreProcessing_Anime4k_stateChanged(int arg1);
-
- void on_checkBox_EnablePostProcessing_Anime4k_stateChanged(int arg1);
-
- void on_checkBox_isCompatible_Waifu2x_NCNN_Vulkan_NEW_clicked();
-
- void on_checkBox_isCompatible_Waifu2x_NCNN_Vulkan_NEW_FP16P_clicked();
-
- void on_checkBox_isCompatible_Waifu2x_NCNN_Vulkan_OLD_clicked();
-
- void on_checkBox_isCompatible_SRMD_NCNN_Vulkan_clicked();
-
- void on_checkBox_isCompatible_Waifu2x_Converter_clicked();
-
- void on_checkBox_isCompatible_Anime4k_CPU_clicked();
-
- void on_checkBox_isCompatible_Anime4k_GPU_clicked();
-
- void on_checkBox_SpecifyGPU_Anime4k_stateChanged(int arg1);
-
- void on_pushButton_ListGPUs_Anime4k_clicked();
-
- void on_checkBox_isCompatible_FFmpeg_clicked();
-
- void on_checkBox_isCompatible_FFprobe_clicked();
-
- void on_checkBox_isCompatible_ImageMagick_clicked();
-
- void on_checkBox_isCompatible_Gifsicle_clicked();
-
- void on_checkBox_isCompatible_SoX_clicked();
-
- void on_checkBox_GPUMode_Anime4K_stateChanged(int arg1);
-
- void on_checkBox_ShowInterPro_stateChanged(int arg1);
-
- void on_checkBox_isCompatible_Waifu2x_Caffe_CPU_clicked();
-
- void on_checkBox_isCompatible_Waifu2x_Caffe_GPU_clicked();
-
- void on_checkBox_isCompatible_Waifu2x_Caffe_cuDNN_clicked();
-
- void on_pushButton_SplitSize_Add_Waifu2xCaffe_clicked();
-
- void on_pushButton_SplitSize_Minus_Waifu2xCaffe_clicked();
-
- void on_checkBox_isCompatible_Realsr_NCNN_Vulkan_clicked();
-
- void on_pushButton_DetectGPU_RealsrNCNNVulkan_clicked();
-
- void on_checkBox_ACNet_Anime4K_stateChanged(int arg1);
-
- void on_checkBox_MultiGPU_Waifu2xNCNNVulkan_clicked();
-
- void on_comboBox_GPUIDs_MultiGPU_Waifu2xNCNNVulkan_currentIndexChanged(int index);
-
- void on_spinBox_TileSize_CurrentGPU_MultiGPU_Waifu2xNCNNVulkan_valueChanged(int arg1);
-
- void on_checkBox_isEnable_CurrentGPU_MultiGPU_Waifu2xNCNNVulkan_clicked();
-
- void on_checkBox_MultiGPU_Waifu2xNCNNVulkan_stateChanged(int arg1);
-
- void on_checkBox_MultiGPU_SrmdNCNNVulkan_stateChanged(int arg1);
-
- void on_checkBox_MultiGPU_SrmdNCNNVulkan_clicked();
-
- void on_comboBox_GPUIDs_MultiGPU_SrmdNCNNVulkan_currentIndexChanged(int index);
-
- void on_checkBox_isEnable_CurrentGPU_MultiGPU_SrmdNCNNVulkan_clicked();
-
- void on_spinBox_TileSize_CurrentGPU_MultiGPU_SrmdNCNNVulkan_valueChanged(int arg1);
-
- void on_checkBox_MultiGPU_RealsrNcnnVulkan_stateChanged(int arg1);
-
- void on_checkBox_MultiGPU_RealsrNcnnVulkan_clicked();
-
- void on_comboBox_GPUIDs_MultiGPU_RealsrNcnnVulkan_currentIndexChanged(int index);
-
- void on_checkBox_isEnable_CurrentGPU_MultiGPU_RealsrNcnnVulkan_clicked();
-
- void on_spinBox_TileSize_CurrentGPU_MultiGPU_RealsrNcnnVulkan_valueChanged(int arg1);
-
- void on_checkBox_MultiGPU_Waifu2xConverter_clicked();
-
- void on_checkBox_MultiGPU_Waifu2xConverter_stateChanged(int arg1);
-
- void on_comboBox_GPUIDs_MultiGPU_Waifu2xConverter_currentIndexChanged(int index);
-
- void on_checkBox_isEnable_CurrentGPU_MultiGPU_Waifu2xConverter_clicked();
-
- void on_spinBox_TileSize_CurrentGPU_MultiGPU_Waifu2xConverter_valueChanged(int arg1);
-
- void on_checkBox_EnableMultiGPU_Waifu2xCaffe_stateChanged(int arg1);
-
- void on_comboBox_ProcessMode_Waifu2xCaffe_currentIndexChanged(int index);
-
- void on_lineEdit_GPUs_Anime4k_editingFinished();
-
- void on_lineEdit_MultiGPUInfo_Waifu2xCaffe_editingFinished();
-
- void on_pushButton_VerifyGPUsConfig_Anime4k_clicked();
-
- void on_pushButton_VerifyGPUsConfig_Waifu2xCaffe_clicked();
-
- void on_tableView_image_doubleClicked(const QModelIndex &index);
-
- void on_tableView_gif_doubleClicked(const QModelIndex &index);
-
- void on_tableView_video_doubleClicked(const QModelIndex &index);
-
- void on_checkBox_BanGitee_clicked();
-
- void on_pushButton_ShowMultiGPUSettings_Waifu2xNCNNVulkan_clicked();
-
- void on_pushButton_ShowMultiGPUSettings_Waifu2xConverter_clicked();
-
- void on_pushButton_ShowMultiGPUSettings_SrmdNCNNVulkan_clicked();
-
- void on_pushButton_ShowMultiGPUSettings_RealsrNcnnVulkan_clicked();
-
- void on_checkBox_HDNMode_Anime4k_stateChanged(int arg1);
-
- void on_tableView_image_pressed(const QModelIndex &index);
-
- void on_tableView_gif_pressed(const QModelIndex &index);
-
- void on_tableView_video_pressed(const QModelIndex &index);
-
- void on_comboBox_UpdateChannel_currentIndexChanged(int index);
-
- void on_checkBox_ReplaceOriginalFile_stateChanged(int arg1);
-
- void on_checkBox_isCustFontEnable_stateChanged(int arg1);
-
- void on_comboBox_ImageSaveFormat_currentIndexChanged(int index);
-
- void on_pushButton_ResizeFilesListSplitter_clicked();
-
- void on_pushButton_TileSize_Add_W2xNCNNVulkan_clicked();
-
- void on_pushButton_TileSize_Minus_W2xNCNNVulkan_clicked();
-
- void on_pushButton_BlockSize_Add_W2xConverter_clicked();
-
- void on_pushButton_BlockSize_Minus_W2xConverter_clicked();
-
- void on_pushButton_Add_TileSize_SrmdNCNNVulkan_clicked();
-
- void on_pushButton_Minus_TileSize_SrmdNCNNVulkan_clicked();
-
- void on_pushButton_Add_TileSize_RealsrNCNNVulkan_clicked();
-
- void on_pushButton_Minus_TileSize_RealsrNCNNVulkan_clicked();
-
- void on_comboBox_GPGPUModel_A4k_currentIndexChanged(int index);
-
- void on_checkBox_DisableGPU_converter_stateChanged(int arg1);
-
- void on_groupBox_video_settings_clicked();
-
- void on_pushButton_DetectGPU_VFI_clicked();
-
- void on_lineEdit_MultiGPU_IDs_VFI_editingFinished();
-
- void on_checkBox_MultiGPU_VFI_stateChanged(int arg1);
-
- void on_groupBox_FrameInterpolation_clicked();
-
- void on_checkBox_isCompatible_RifeNcnnVulkan_clicked();
-
- void on_comboBox_Engine_VFI_currentIndexChanged(int index);
-
- void on_checkBox_isCompatible_CainNcnnVulkan_clicked();
-
- void on_pushButton_Verify_MultiGPU_VFI_clicked();
-
- void on_checkBox_EnableVFI_Home_clicked();
-
- void on_checkBox_MultiThread_VFI_stateChanged(int arg1);
-
- void on_checkBox_MultiThread_VFI_clicked();
-
- void on_pushButton_TurnOffScreen_clicked();
-
- void on_checkBox_isCompatible_DainNcnnVulkan_clicked();
-
- void on_pushButton_MultipleOfFPS_VFI_MIN_clicked();
-
- void on_pushButton_MultipleOfFPS_VFI_ADD_clicked();
-
- void on_pushButton_Patreon_clicked();
-
- void on_pushButton_SupportersList_clicked();
-
- void on_checkBox_isCompatible_SRMD_CUDA_clicked();
-
-signals:
- void Send_Table_EnableSorting(bool EnableSorting);
-
- void Send_Add_progressBar_CompatibilityTest();//进度+1 -兼容性测试进度条
-
- void Send_Unable2Connect_RawGithubusercontentCom();
-
- void Send_SetEnable_pushButton_ForceRetry_self();
-
- void Send_SystemTray_NewMessage(QString message);
-
- void Send_PrograssBar_Range_min_max(int, int);
- void Send_progressbar_Add();
-
- void Send_Table_image_ChangeStatus_rowNumInt_statusQString(int, QString);
- void Send_Table_gif_ChangeStatus_rowNumInt_statusQString(int, QString);
- void Send_Table_video_ChangeStatus_rowNumInt_statusQString(int, QString);
-
- void Send_Waifu2x_Finished();
- void Send_Waifu2x_Finished_manual();
-
- void Send_TextBrowser_NewMessage(QString);
-
- void Send_Waifu2x_Compatibility_Test_finished();
-
- void Send_Waifu2x_DetectGPU_finished();
-
- void Send_FinishedProcessing_DN();
-
- void Send_Realsr_ncnn_vulkan_DetectGPU_finished();
- void Send_FrameInterpolation_DetectGPU_finished();
-
- void Send_CheckUpadte_NewUpdate(QString, QString);
-
- void Send_Table_FileCount_reload();
-
- void Send_Table_image_insert_fileName_fullPath(QString fileName, QString SourceFile_fullPath);
- void Send_Table_gif_insert_fileName_fullPath(QString fileName, QString SourceFile_fullPath);
- void Send_Table_video_insert_fileName_fullPath(QString fileName, QString SourceFile_fullPath);
-
- void Send_Table_image_CustRes_rowNumInt_HeightQString_WidthQString(int rowNum, QString height, QString width);
- void Send_Table_gif_CustRes_rowNumInt_HeightQString_WidthQString(int rowNum, QString height, QString width);
- void Send_Table_video_CustRes_rowNumInt_HeightQString_WidthQString(int rowNum, QString height, QString width);
-
- void Send_Table_Read_Saved_Table_Filelist_Finished(QString Table_FileList_ini);
- void Send_Table_Save_Current_Table_Filelist_Finished();
-
- void Send_SystemShutDown();
-
- void Send_Waifu2x_DumpProcessorList_converter_finished();
-
- void Send_Read_urls_finfished();
-
- void Send_SRMD_DetectGPU_finished();
-
- void Send_video_write_VideoConfiguration(QString VideoConfiguration_fullPath,int ScaleRatio,int DenoiseLevel,bool CustRes_isEnabled,int CustRes_height,int CustRes_width,QString EngineName,bool isProcessBySegment,QString VideoClipsFolderPath,QString VideoClipsFolderName,bool isVideoFrameInterpolationEnabled,int MultipleOfFPS);
-
- void Send_Settings_Save();
-
- void Send_video_write_Progress_ProcessBySegment(QString VideoConfiguration_fullPath,int StartTime,bool isSplitComplete,bool isScaleComplete,int OLDSegmentDuration,int LastVideoClipNo);
-
- //================== 处理当前文件的进度 =========================
- void Send_CurrentFileProgress_Start(QString FileName,int FrameNum);
- void Send_CurrentFileProgress_Stop();
- void Send_CurrentFileProgress_progressbar_Add();
- void Send_CurrentFileProgress_progressbar_Add_SegmentDuration(int SegmentDuration);
- void Send_CurrentFileProgress_progressbar_SetFinishedValue(int FinishedValue);
-
- void Send_Donate_ReplaceQRCode(QString QRCodePath);
-
- void Send_Set_checkBox_DisableResize_gif_Checked();
-
-private:
- Ui::MainWindow *ui;
-};
-#endif // MAINWINDOW_H
-
+/*
+ Copyright (C) 2021 Aaron Feng
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published
+ by the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see .
+
+ My Github homepage: https://github.com/AaronFeng753
+*/
+
+#ifndef MAINWINDOW_H
+#define MAINWINDOW_H
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include "topsupporterslist.h"
+
+typedef QList> QList_QMap_QStrQStr;
+Q_DECLARE_METATYPE(QList_QMap_QStrQStr)
+
+QT_BEGIN_NAMESPACE
+namespace Ui
+{
+ class MainWindow;
+}
+QT_END_NAMESPACE
+
+class MainWindow : public QMainWindow
+{
+ Q_OBJECT
+
+public:
+ MainWindow(QWidget *parent = nullptr);
+ void changeEvent(QEvent *e);
+ //=======================
+ QString VERSION = "v3.41.02-beta";//软件版本号
+ bool isBetaVer = true;
+ QString LastStableVer = "v3.31.13";
+ QString LastBetaVer = "v3.41.02-beta";
+ //=======================
+ QTranslator * translator;//界面翻译
+ QIcon *MainIcon_QIcon = new QIcon(":/new/prefix1/icon/icon_main.png");
+ TopSupportersList *TopSupportersList_widget;
+ //=======
+ QString Current_Path = qApp->applicationDirPath();//当前路径
+ //=======
+ void Set_Font_fixed();
+ //================================= File 文件 =================================
+ void dragEnterEvent(QDragEnterEvent *event);//拖放文件event
+ void dropEvent(QDropEvent *event);
+ void Read_urls(QList urls);
+ void Read_Input_paths_BrowserFile(QStringList Input_path_List);
+ bool AddNew_gif=false;//判断是否有新增文件-gif
+ bool AddNew_image=false;//判断是否有新增文件-图片
+ bool AddNew_video=false;//判断是否有新增文件-视频
+ void Add_File_Folder(QString Full_Path);//添加文件or文件夹(判断一个路径是文件还是文件夹,然后处理判断类型添加到table和file list)
+ void Add_File_Folder_IncludeSubFolder(QString Full_Path);//添加文件文件夹(扫描子文件夹
+ QStringList getFileNames_IncludeSubFolder(QString path);//读取文件列表, 包括文件夹
+ int FileList_Add(QString fileName, QString SourceFile_fullPath);//直接向file list和tableview添加文件
+ //判断一个文件是否已存在于一个文件列表中(输入list和完整路径,然后判断返回bool)
+ bool Deduplicate_filelist(QString SourceFile_fullPath);
+ bool file_isDirExist(QString SourceFile_fullPath);//判断文件夹是否存在
+ void file_mkDir(QString SourceFile_fullPath);//创建文件夹
+ bool file_isDirEmpty(QString FolderPath);
+ QStringList file_getFileNames_in_Folder_nofilter(QString path);//读取文件夹内文件列表并返回(无过滤器)
+ bool file_DelDir(const QString &path);//删除文件夹(无论是否为空,强制删除)
+ QString file_getBaseName(QString path);//获取basename
+ void file_MoveToTrash( QString file );//移动到回收站
+ void MoveFileToOutputPath(QString Orginal,QString SourceFilePath);//移动文件
+ QMutex MoveFile_QMutex;
+ QString file_getFolderPath(QFileInfo fileInfo);//获取文件夹路径(去除末尾的"/")
+ bool file_isDirWritable(QString DirPath);//检查文件夹是否可写入
+ //检查当前行的文件所在的文件夹是否可写入
+ bool file_isFilesFolderWritable_row_image(int rowNum);
+ bool file_isFilesFolderWritable_row_video(int rowNum);
+ bool file_isFilesFolderWritable_row_gif(int rowNum);
+ bool file_OpenFolder(QString FolderPath);//调用系统资源管理器打开文件夹.
+ bool file_OpenFilesFolder(QString FilePath);//打开文件所在的文件夹
+ bool file_OpenFile(QString FilePath);
+ void file_MoveFiles_Folder_NcnnVulkanFolderProcess(QString Old_folder, QString New_folder, bool Delete_);
+ bool file_generateMarkFile(QString FileFullPath,QString Msg);
+ //================================= Table =================================
+ void ui_tableViews_setUpdatesEnabled(bool isEnabled);// 启用/禁用 文件列表table的UI更新
+ void Init_Table();//初始化三个tableview
+ QStandardItemModel *Table_model_image = new QStandardItemModel();
+ QStandardItemModel *Table_model_video = new QStandardItemModel();
+ QStandardItemModel *Table_model_gif = new QStandardItemModel();
+ //取消指定row的自定义分辨率
+ void Table_image_CustRes_Cancel_rowNumInt(int rowNum);
+ void Table_gif_CustRes_Cancel_rowNumInt(int rowNum);
+ void Table_video_CustRes_Cancel_rowNumInt(int rowNum);
+ void Table_ChangeAllStatusToWaiting();//将所有row的状态改为waiting
+ QMutex QMutex_Table_ChangeAllStatusToWaiting;
+ void Table_Clear();//清空tableview
+ //获取下一个row值(用于插入新数据
+ int Table_image_get_rowNum();
+ int Table_gif_get_rowNum();
+ int Table_video_get_rowNum();
+ //根据输入的table,返回成对的[完整路径]和[状态]:[fullpath]=status;
+ QMap Table_Read_status_fullpath(QStandardItemModel *Table_model);
+ //当前选中的rowNum
+ int curRow_image = -1;
+ int curRow_gif = -1;
+ int curRow_video = -1;
+
+ int Table_Save_Current_Table_Filelist(QString Table_FileList_ini);//保存当前文件列表(包括table
+
+ int Table_Read_Saved_Table_Filelist(QString Table_FileList_ini);//读取保存的文件列表
+
+ int Table_Save_Current_Table_Filelist_Watchdog(QString Table_FileList_ini);//保存文件列表的看门狗线程,确保文件成功保存
+
+ bool Table_insert_finished=false;
+ QMutex mutex_Table_insert_finished;//监管是否完成表格插入的bool值的mutex
+
+ QMutex mutex_Table_insert;//监管表格插入的mutex
+ //================================= Waifu2x ====================================
+ void ShowFileProcessSummary();//展示文件处理总结报告
+ QString OutPutFolder_main="";//总输出文件夹
+ int Waifu2xMainThread();//waifu2x总线程,负责读取文件列表,调度waifu2x放大线程
+ QStringList WaitForEngineIO(QStringList OutPutFilesFullPathList);
+ QStringList WaitForEngineIO_NcnnVulkan(QString OutputFolderFullPath);
+ void Restore_SplitFramesFolderPath(QString SplitFramesFolderPath, QStringList GPU_SplitFramesFolderPath_List);
+ bool isForceRetryEnabled=true;
+ //bool KILL_TASK_(QString TaskName,bool RequestAdmin);
+ bool KILL_TASK_QStringList(QStringList TaskNameList,bool RequestAdmin);
+ //==========================
+ QString Waifu2x_ncnn_vulkan_FolderPath = "";
+ QString Waifu2x_ncnn_vulkan_ProgramPath = "";
+ //===
+ int Waifu2x_NCNN_Vulkan_Image(int rowNum,bool ReProcess_MissingAlphaChannel);//vulkan放大图片线程
+ //vulakn放大GIF线程:1.主线程,拆分,调度放大子线程,组装&压缩;2.放大子线程,负责放大所有帧以及调整大小
+ int Waifu2x_NCNN_Vulkan_GIF(int rowNum);
+ //vulkan放大视频线程:1.主线程,拆分,调度放大子线程,组装;2.放大子线程,负责放大所有帧以及调整大小
+ int Waifu2x_NCNN_Vulkan_Video(int rowNum);
+ int Waifu2x_NCNN_Vulkan_Video_BySegment(int rowNum);
+ QString Waifu2x_NCNN_Vulkan_ReadSettings();
+ QString Waifu2x_NCNN_Vulkan_ReadSettings_Video_GIF(int ThreadNum);
+ //===
+ int Realsr_NCNN_Vulkan_Image(int rowNum,bool ReProcess_MissingAlphaChannel);//Realsr放大图片线程
+ //Realsr放大GIF线程:1.主线程,拆分,调度放大子线程,组装&压缩;2.放大子线程,负责放大所有帧以及调整大小
+ int Realsr_NCNN_Vulkan_GIF(int rowNum);
+ //Realsr放大视频线程:1.主线程,拆分,调度放大子线程,组装;2.放大子线程,负责放大所有帧以及调整大小
+ int Realsr_NCNN_Vulkan_Video(int rowNum);
+ int Realsr_NCNN_Vulkan_Video_BySegment(int rowNum);
+ QString Realsr_NCNN_Vulkan_ReadSettings();
+ int Calculate_Temporary_ScaleRatio_RealsrNCNNVulkan(int ScaleRatio);
+ QString Realsr_NCNN_Vulkan_ReadSettings_Video_GIF(int ThreadNum);
+ //=========================
+ int Anime4k_Image(int rowNum,bool ReProcess_MissingAlphaChannel);
+ int Anime4k_GIF(int rowNum);
+ int Anime4k_GIF_scale(QMap Sub_Thread_info,int *Sub_gif_ThreadNumRunning,bool *Frame_failed);
+ //Anime4k放大视频线程:1.主线程,拆分,调度放大子线程,组装;2.放大子线程,负责放大所有帧以及调整大小
+ int Anime4k_Video(int rowNum);
+ int Anime4k_Video_BySegment(int rowNum);
+ int Anime4k_Video_scale(QMap Sub_Thread_info,int *Sub_video_ThreadNumRunning,bool *Frame_failed);
+ QString Anime4k_ReadSettings(bool PreserveAlphaChannel);
+ void DenoiseLevelSpinboxSetting_Anime4k();
+ QString Anime4k_ProgramPath = Current_Path + "/Anime4K/Anime4K_waifu2xEX.exe";
+ int Get_NumOfGPU_Anime4k();
+ //=================================
+ int Waifu2x_Converter_Image(int rowNum,bool ReProcess_MissingAlphaChannel);//Converter放大图片线程
+ //Converter放大GIF线程:1.主线程,拆分,调度放大子线程,组装&压缩;2.放大子线程,负责放大所有帧以及调整大小
+ int Waifu2x_Converter_GIF(int rowNum);
+ int Waifu2x_Converter_GIF_scale(QMap Sub_Thread_info,int *Sub_gif_ThreadNumRunning,bool *Frame_failed);
+ //Converter放大视频线程:1.主线程,拆分,调度放大子线程,组装;2.放大子线程,负责放大所有帧以及调整大小
+ int Waifu2x_Converter_Video(int rowNum);
+ int Waifu2x_Converter_Video_BySegment(int rowNum);
+ int Waifu2x_Converter_Video_scale(QMap Sub_Thread_info,int *Sub_video_ThreadNumRunning,bool *Frame_failed);
+ QString Waifu2xConverter_ReadSettings();
+ //===================================
+ int SRMD_NCNN_Vulkan_Image(int rowNum,bool ReProcess_MissingAlphaChannel);//SRMD放大图片线程
+ //SRMD放大GIF线程:1.主线程,拆分,调度放大子线程,组装&压缩;2.放大子线程,负责放大所有帧以及调整大小
+ int SRMD_NCNN_Vulkan_GIF(int rowNum);
+ //SRMD放大视频线程:1.主线程,拆分,调度放大子线程,组装;2.放大子线程,负责放大所有帧以及调整大小
+ int SRMD_NCNN_Vulkan_Video(int rowNum);
+ int SRMD_NCNN_Vulkan_Video_BySegment(int rowNum);
+ QString SrmdNcnnVulkan_ReadSettings();
+ QMap Calculate_ScaleRatio_SrmdNcnnVulkan(int ScaleRatio);
+ QString SrmdNcnnVulkan_ReadSettings_Video_GIF(int ThreadNum);
+ //=================================
+ int Waifu2x_Caffe_Image(int rowNum,bool ReProcess_MissingAlphaChannel);//Caffe放大图片线程
+ //Caffe放大GIF线程:1.主线程,拆分,调度放大子线程,组装&压缩;2.放大子线程,负责放大所有帧以及调整大小
+ int Waifu2x_Caffe_GIF(int rowNum);
+ int Waifu2x_Caffe_GIF_scale(QMap Sub_Thread_info,int *Sub_gif_ThreadNumRunning,bool *Frame_failed);
+ //Caffe放大视频线程:1.主线程,拆分,调度放大子线程,组装;2.放大子线程,负责放大所有帧以及调整大小
+ int Waifu2x_Caffe_Video(int rowNum);
+ int Waifu2x_Caffe_Video_BySegment(int rowNum);
+ int Waifu2x_Caffe_Video_scale(QMap Sub_Thread_info,int *Sub_video_ThreadNumRunning,bool *Frame_failed);
+ QString Waifu2x_Caffe_ReadSettings();
+ bool isWaifu2xCaffeEnabled();
+ void DeleteErrorLog_Waifu2xCaffe();
+ //====================================
+ int SRMD_CUDA_Image(int rowNum,bool ReProcess_MissingAlphaChannel);//SRMD放大图片线程
+ //SRMD放大GIF线程:1.主线程,拆分,调度放大子线程,组装&压缩;2.放大子线程,负责放大所有帧以及调整大小
+ int SRMD_CUDA_GIF(int rowNum);
+ //SRMD放大视频线程:1.主线程,拆分,调度放大子线程,组装;2.放大子线程,负责放大所有帧以及调整大小
+ int SRMD_CUDA_Video(int rowNum);
+ int SRMD_CUDA_Video_BySegment(int rowNum);
+ //====================================
+
+ void Wait_waifu2x_stop();//等待waifu2x主线程完全停止所有子线程的看门狗线程
+ bool waifu2x_STOP = false;//负责通知waifu2x主线程及其子线程的停止信号
+ bool waifu2x_STOP_confirm = false;//返回给waifu2x停止看门狗的信号
+
+ int ThreadNumMax = 0;//waifu2x放大线程最大值
+ int ThreadNumRunning = 0;//正在运行的waifu2x线程数量
+
+ QMutex mutex_ThreadNumRunning;//监管总线程数量的mutex
+ QMutex mutex_SubThreadNumRunning;//监管内部线程数量的mutex
+
+ int Waifu2x_DetectGPU();//检测可用gpu(for vulkan)
+ QStringList Available_GPUID;//可用GPU ID列表
+
+ int Waifu2x_DumpProcessorList_converter();
+ int Core_num = 0;
+ QStringList Available_ProcessorList_converter;
+ QString Processor_converter_STR="";
+
+ int SRMD_DetectGPU();//检测可用gpu(for srmd)
+ QStringList Available_GPUID_srmd;//可用GPU ID列表
+ QString GPU_ID_STR_SRMD="";//向srmd命令行cmd插入的gpuid命令,如果auto则为空
+
+ int Realsr_ncnn_vulkan_DetectGPU();//检测可用gpu(for realsr)
+ QStringList Available_GPUID_Realsr_ncnn_vulkan;//可用GPU ID列表
+
+ void ListGPUs_Anime4k();//列出可用显卡 Anime4k
+
+ int FrameInterpolation_DetectGPU();//检测可用gpu(for vulkan)
+ QStringList Available_GPUID_FrameInterpolation;//可用GPU ID列表
+ //======================== 图片处理 ================================
+ bool Image_Gif_AutoSkip_CustRes(int rowNum,bool isGif);
+ QMap Image_Gif_Read_Resolution(QString SourceFileFullPath);//获取图片&GIF分辨率
+ bool Imgae_hasAlphaChannel(int rowNum);
+ QString Imgae_PreProcess(QString ImagePath,bool ReProcess_AlphaChannel);
+ QString SaveImageAs_FormatAndQuality(QString OriginalSourceImage_fullPath,QString ScaledImage_fullPath,bool isDenoiseLevelEnabled,int DenoiseLevel);
+ //================================================================
+ int Waifu2x_Compatibility_Test();//引擎兼容性检测
+ //初始化 -兼容性测试进度条
+ void Init_progressBar_CompatibilityTest();
+ //兼容性测试完成后的操作 -兼容性测试进度条
+ void Finish_progressBar_CompatibilityTest();
+ //兼容性检测
+ bool isCompatible_Waifu2x_NCNN_Vulkan_OLD=false;
+ bool isCompatible_Waifu2x_NCNN_Vulkan_NEW=false;
+ bool isCompatible_Waifu2x_NCNN_Vulkan_NEW_FP16P=false;
+ bool isCompatible_SRMD_NCNN_Vulkan=false;
+ bool isCompatible_SRMD_CUDA=false;
+ bool isCompatible_Waifu2x_Converter=false;
+ bool isCompatible_Anime4k_CPU=false;
+ bool isCompatible_Anime4k_GPU=false;
+ bool isCompatible_FFmpeg=false;
+ bool isCompatible_FFprobe=false;
+ bool isCompatible_ImageMagick=false;
+ bool isCompatible_Gifsicle=false;
+ bool isCompatible_SoX=false;
+ bool isCompatible_Waifu2x_Caffe_CPU=false;
+ bool isCompatible_Waifu2x_Caffe_GPU=false;
+ bool isCompatible_Waifu2x_Caffe_cuDNN=false;
+ bool isCompatible_Realsr_NCNN_Vulkan=false;
+ bool isCompatible_RifeNcnnVulkan=false;
+ bool isCompatible_CainNcnnVulkan=false;
+ bool isCompatible_DainNcnnVulkan=false;
+ //============================== 多显卡 ==========================================
+ //waifu2x-ncnn-vulkan
+ int GPU_ID_Waifu2x_NCNN_Vulkan_MultiGPU = 0;
+ QMap Waifu2x_NCNN_Vulkan_MultiGPU();
+ QMutex MultiGPU_QMutex_Waifu2xNCNNVulkan;
+ QList> GPUIDs_List_MultiGPU_Waifu2xNCNNVulkan;
+ void AddGPU_MultiGPU_Waifu2xNCNNVulkan(QString GPUID);
+
+ //SRMD-ncnn-vulkan
+ int GPU_ID_SrmdNcnnVulkan_MultiGPU = 0;
+ QMap SrmdNcnnVulkan_MultiGPU();
+ QMutex MultiGPU_QMutex_SrmdNcnnVulkan;
+ QList> GPUIDs_List_MultiGPU_SrmdNcnnVulkan;
+ void AddGPU_MultiGPU_SrmdNcnnVulkan(QString GPUID);
+
+ //RealsrNcnnVulkan
+ int GPU_ID_RealsrNcnnVulkan_MultiGPU = 0;
+ QMap RealsrNcnnVulkan_MultiGPU();
+ QMutex MultiGPU_QMutex_RealsrNcnnVulkan;
+ QList> GPUIDs_List_MultiGPU_RealsrNcnnVulkan;
+ void AddGPU_MultiGPU_RealsrNcnnVulkan(QString GPUID);
+
+ //Waifu2xConverter
+ int GPU_ID_Waifu2xConverter_MultiGPU = 0;
+ QMap Waifu2xConverter_MultiGPU();
+ QMutex MultiGPU_QMutex_Waifu2xConverter;
+ QList> GPUIDs_List_MultiGPU_Waifu2xConverter;
+ void AddGPU_MultiGPU_Waifu2xConverter(QString GPUID);
+
+ //Anime4k
+ int GPU_ID_Anime4k_GetGPUInfo = 0;
+ QString Anime4k_GetGPUInfo();
+ QMutex GetGPUInfo_QMutex_Anime4k;
+
+ //Waifu2x-caffe
+ int GPU_ID_Waifu2xCaffe_GetGPUInfo = 0;
+ QString Waifu2xCaffe_GetGPUInfo();
+ QMutex GetGPUInfo_QMutex_Waifu2xCaffe;
+ int Get_NumOfGPU_W2xCaffe();
+ //================================ progressbar ===================================
+ int Progressbar_MaxVal = 0;//进度条最大值
+ int Progressbar_CurrentVal = 0;//进度条当前值
+ void progressbar_clear();//清空进度条
+ void progressbar_SetToMax(int maxval);//将进度条设定到最大值
+ //=============================== textbrowser===============================
+ void TextBrowser_StartMes();//输出启动信息
+ //================================ gif ====================================
+ void Gif_RemoveFromCustResList(int RowNumber);
+ bool Gif_DoubleScaleRatioPrep(int RowNumber);
+ int Gif_getDuration(QString gifPath);//获取帧间隔时长
+ int Gif_getFrameDigits(QString gifPath);//获取帧数量的位数
+ void Gif_splitGif(QString gifPath,QString SplitFramesFolderPath);//拆分gif
+ void Gif_assembleGif(QString ResGifPath,QString ScaledFramesPath,int Duration,bool CustRes_isEnabled,int CustRes_height,int CustRes_width,bool isOverScaled,QString SourceGifFullPath);//组装gif
+ QString Gif_compressGif(QString gifPath,QString gifPath_compressd);//压缩gif
+ //================================= video ===============================
+ void video_RemoveFromCustResList(int RowNumber);
+ bool video_DoubleScaleRatioPrep(int RowNumber);
+ QString isPreVFIDone_MarkFilePath(QString VideoPath);
+ int CalNumDigits(int input_num);
+ bool isSuccessiveFailuresDetected_VFI=false;
+ int FrameInterpolation_Video_BySegment(int rowNum);
+ int FrameInterpolation_Video(int rowNum);
+ int Old_FrameInterpolation_Engine_Index=0;
+ QString FrameInterpolation_ReadConfig(bool isUhdInput,int NumOfFrames);
+ bool FrameInterpolation(QString SourcePath,QString OutputPath);
+ bool Video_AutoSkip_CustRes(int rowNum);
+ QMap video_get_Resolution(QString VideoFileFullPath);//获取视频的帧率
+ QString video_get_fps(QString videoPath);//获取视频fps
+ int video_get_frameNumDigits(QString videoPath);//获取帧数量的位数
+ int video_get_frameNum(QString videoPath);//获取帧数量
+
+ //判断视频是否可变帧率
+ bool video_isVFR(QString videoPath);
+ //拆分视频
+ void video_video2images(QString VideoPath,QString FrameFolderPath,QString AudioPath);
+ //组装视频
+ int video_images2video(QString VideoPath,QString video_mp4_scaled_fullpath,QString ScaledFrameFolderPath,QString AudioPath,bool CustRes_isEnabled,int CustRes_height,int CustRes_width,bool isOverScaled);
+ //读取输出视频的设定参数
+ QString video_ReadSettings_OutputVid(QString AudioPath);
+ //获取视频比特率
+ QString video_get_bitrate(QString videoPath,bool isReturnFullCMD,bool isVidOnly);
+ //获取视频比特率(根据分辨率计算)
+ QString video_get_bitrate_AccordingToRes_FrameFolder(QString ScaledFrameFolderPath,QString VideoPath);
+ int video_UseRes2CalculateBitrate(QString VideoFileFullPath);//根据视频的分辨率计算他应该被分配的比特率
+ //音频降噪
+ QString video_AudioDenoise(QString OriginalAudioPath);
+ //获取时长(秒)
+ int video_get_duration(QString videoPath);
+ //转换为mp4
+ QString video_To_CFRMp4(QString VideoPath);
+ //提取音频
+ void video_get_audio(QString VideoPath,QString AudioPath);
+ //拆分视频(分段)
+ void video_video2images_ProcessBySegment(QString VideoPath,QString FrameFolderPath,int StartTime,int SegmentDuration);
+ //组装视频(mp4片段到成片)
+ void video_AssembleVideoClips(QString VideoClipsFolderPath,QString VideoClipsFolderName,QString video_mp4_scaled_fullpath,QString AudioPath);
+ //生成视频片段文件夹编号
+ QString video_getClipsFolderNo();
+ QMutex MultiLine_ErrorOutput_QMutex;
+
+ bool video_isNeedProcessBySegment(int rowNum);//根据视频时长,判断是否需要分段处理
+ void DelVfiDir(QString VideoPath);
+ //============================ custom res ====================================
+ //自定义分辨率列表
+ QList> Custom_resolution_list;//res_map["fullpath"],["height"],["width"]
+ void CustRes_remove(QString fullpath);//根据完整路径,移除自定义分辨率内条目
+ bool CustRes_isContained(QString fullpath);//检查是否包括某文件
+ QMap CustRes_getResMap(QString fullpath);//读取指定文件的自定义分辨率值
+ int CustRes_CalNewScaleRatio(QString fullpath,int Height_new,int width_new);//计算新的放大倍数
+ int CustRes_SetCustRes();//设定自定义分辨率
+ int CustRes_CancelCustRes();//取消自定义分辨率
+ QMap