ソースを参照

Add: Open File Location.

Satoshi Yoneda 2 週間 前
コミット
87f2e65822

+ 1 - 1
CMakeLists.txt

@@ -1,5 +1,5 @@
 cmake_minimum_required(VERSION 3.21)
-project(DupFind VERSION 0.3.0 LANGUAGES CXX)
+project(DupFind VERSION 0.3.1 LANGUAGES CXX)
 
 set(CMAKE_CXX_STANDARD 20)
 set(CMAKE_CXX_STANDARD_REQUIRED ON)

+ 11 - 5
src/MainWindow.cpp

@@ -1,6 +1,5 @@
 #include "MainWindow.hpp"
 #include "ImageHasher.hpp"
-#include <opencv2/imgproc.hpp>
 #include <QDateTime>
 #include <QDir>
 #include <QDirIterator>
@@ -15,12 +14,14 @@
 #include <QVBoxLayout>
 #include <chrono>
 #include <filesystem>
+#include <opencv2/imgproc.hpp>
 
 #include <QAction>
 #include <QApplication>
 #include <QClipboard>
 #include <QContextMenuEvent>
 #include <QCoreApplication>
+#include <QDebug>
 #include <QDesktopServices>
 #include <QImageReader>
 #include <QMenu>
@@ -30,7 +31,6 @@
 #include <QStandardPaths>
 #include <QUrl>
 #include <QtConcurrent>
-#include <QDebug>
 
 MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) {
   QString dataPath =
@@ -61,7 +61,8 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) {
   if (styleFile.open(QFile::ReadOnly)) {
     QString styleSheet = QString::fromUtf8(styleFile.readAll());
     setStyleSheet(styleSheet);
-    qDebug() << "Stylesheet applied successfully from resources. Length:" << styleSheet.length();
+    qDebug() << "Stylesheet applied successfully from resources. Length:"
+             << styleSheet.length();
   } else {
     qWarning() << "Failed to open stylesheet from resource: :/styles/style.qss";
   }
@@ -628,6 +629,7 @@ void MainWindow::onContextMenuRequested(const std::string &path, int groupId,
   if (!path.empty()) {
     QMenu menu;
     QAction *copyAction = menu.addAction(tr("Copy Full Path(&C)"));
+    QAction *openFileLocation = menu.addAction(tr("Open File Location(&O)"));
     menu.addSeparator();
     QAction *removeAction = menu.addAction(tr("Remove from List(&R)"));
 
@@ -636,6 +638,9 @@ void MainWindow::onContextMenuRequested(const std::string &path, int groupId,
       QApplication::clipboard()->setText(QString::fromStdString(path));
     } else if (selectedAction == removeAction) {
       removeGroupFromView(groupId);
+    } else if (selectedAction == openFileLocation) {
+      QFileInfo fileInfo(QString::fromStdString(path));
+      QDesktopServices::openUrl(QUrl::fromLocalFile(fileInfo.absolutePath()));
     }
   }
 }
@@ -736,7 +741,7 @@ void MainWindow::onDeleteSelected() {
     auto images = getFilteredImages();
     m_currentGroups = SimilaritySearch::findDuplicates(
         images, m_currentThreshold, m_strictMode);
-    
+
     // 絞り込み状態を解除
     m_searchBox->clear();
     m_searchBox->hide();
@@ -787,7 +792,8 @@ void MainWindow::onUrlDownloadFinished(QNetworkReply *reply) {
   cv::Mat rgb;
   cv::cvtColor(img, rgb, cv::COLOR_BGR2RGB);
   QImage qimg(rgb.data, rgb.cols, rgb.rows, rgb.step, QImage::Format_RGB888);
-  m_model->addThumbnail(dropped.path, qimg.copy()); // copy to ensure data ownership
+  m_model->addThumbnail(dropped.path,
+                        qimg.copy()); // copy to ensure data ownership
 
   for (const auto &cand : candidates) {
     bool match = false;

+ 4 - 0
translations/dupfind_de.ts

@@ -63,6 +63,10 @@
         <source>Remove from List(&amp;R)</source>
         <translation>Aus Liste entfernen(&amp;R)</translation>
     </message>
+    <message>
+        <source>Open File Location(&amp;O)</source>
+        <translation>Dateipfad öffnen(&amp;O)</translation>
+    </message>
     <message>
         <source>Warning: All images selected</source>
         <translation>Warnung: Alle Bilder ausgewählt</translation>

+ 4 - 0
translations/dupfind_en.ts

@@ -63,6 +63,10 @@
         <source>Remove from List(&amp;R)</source>
         <translation>Remove from List(&amp;R)</translation>
     </message>
+    <message>
+        <source>Open File Location(&amp;O)</source>
+        <translation>Open File Location(&amp;O)</translation>
+    </message>
     <message>
         <source>Warning: All images selected</source>
         <translation>Warning: All images selected</translation>

+ 4 - 0
translations/dupfind_es.ts

@@ -63,6 +63,10 @@
         <source>Remove from List(&amp;R)</source>
         <translation>Eliminar de la lista(&amp;R)</translation>
     </message>
+    <message>
+        <source>Open File Location(&amp;O)</source>
+        <translation>Abrir ubicación del archivo(&amp;O)</translation>
+    </message>
     <message>
         <source>Warning: All images selected</source>
         <translation>Advertencia: Todas las imágenes seleccionadas</translation>

+ 4 - 0
translations/dupfind_ja.ts

@@ -63,6 +63,10 @@
         <source>Remove from List(&amp;R)</source>
         <translation>リストから除外(&amp;R)</translation>
     </message>
+    <message>
+        <source>Open File Location(&amp;O)</source>
+        <translation>ファイルの場所を開く(&amp;O)</translation>
+    </message>
     <message>
         <source>Warning: All images selected</source>
         <translation>警告: すべての画像が選択されています</translation>

+ 4 - 0
translations/dupfind_ko.ts

@@ -63,6 +63,10 @@
         <source>Remove from List(&amp;R)</source>
         <translation>목록에서 삭제(&amp;R)</translation>
     </message>
+    <message>
+        <source>Open File Location(&amp;O)</source>
+        <translation>파일 위치 열기(&amp;O)</translation>
+    </message>
     <message>
         <source>Warning: All images selected</source>
         <translation>경로: 모든 이미지가 선택되었습니다</translation>

+ 4 - 0
translations/dupfind_pl.ts

@@ -63,6 +63,10 @@
         <source>Remove from List(&amp;R)</source>
         <translation>Usuń z listy(&amp;R)</translation>
     </message>
+    <message>
+        <source>Open File Location(&amp;O)</source>
+        <translation>Otwórz lokalizację pliku(&amp;O)</translation>
+    </message>
     <message>
         <source>Warning: All images selected</source>
         <translation>Uwaga: Zaznaczono wszystkie obrazy</translation>

+ 4 - 0
translations/dupfind_pt.ts

@@ -63,6 +63,10 @@
         <source>Remove from List(&amp;R)</source>
         <translation>Remover da lista(&amp;R)</translation>
     </message>
+    <message>
+        <source>Open File Location(&amp;O)</source>
+        <translation>Abrir local do arquivo(&amp;O)</translation>
+    </message>
     <message>
         <source>Warning: All images selected</source>
         <translation>Aviso: Todas as imagens selecionadas</translation>

+ 4 - 0
translations/dupfind_ru.ts

@@ -63,6 +63,10 @@
         <source>Remove from List(&amp;R)</source>
         <translation>Удалить из списка(&amp;R)</translation>
     </message>
+    <message>
+        <source>Open File Location(&amp;O)</source>
+        <translation>Открыть папку с файлом(&amp;O)</translation>
+    </message>
     <message>
         <source>Warning: All images selected</source>
         <translation>Предупреждение: Выбраны все изображения</translation>

+ 4 - 0
translations/dupfind_zh_CN.ts

@@ -63,6 +63,10 @@
         <source>Remove from List(&amp;R)</source>
         <translation>从列表中移除(&amp;R)</translation>
     </message>
+    <message>
+        <source>Open File Location(&amp;O)</source>
+        <translation>打开文件位置(&amp;O)</translation>
+    </message>
     <message>
         <source>Warning: All images selected</source>
         <translation>警告:已选择所有图像</translation>

+ 4 - 0
translations/dupfind_zh_TW.ts

@@ -63,6 +63,10 @@
         <source>Remove from List(&amp;R)</source>
         <translation>從清單中移除(&amp;R)</translation>
     </message>
+    <message>
+        <source>Open File Location(&amp;O)</source>
+        <translation>打開檔案位置(&amp;O)</translation>
+    </message>
     <message>
         <source>Warning: All images selected</source>
         <translation>警告:已選擇所有圖片</translation>