فهرست منبع

Add Copy Image.

Satoshi Yoneda 1 ماه پیش
والد
کامیت
1240dc547b

+ 22 - 1
src/MainWindow.cpp

@@ -613,14 +613,35 @@ void MainWindow::onContextMenuRequested(const std::string &path, int groupId,
 
     QMenu menu;
     QAction *copyAction = menu.addAction(tr("Copy Full Path(&C)"));
+    QAction *copyImageAction = menu.addAction(tr("Copy Image(&I)"));
     QAction *openAction =
         menu.addAction(isUrl ? tr("Open URL(&O)") : tr("Open File Location(&O)"));
     menu.addSeparator();
     QAction *removeAction = menu.addAction(tr("Remove from List(&R)"));
 
     QAction *selectedAction = menu.exec(globalPos);
-    if (selectedAction == copyAction) {
+ if (selectedAction == copyAction) {
       QApplication::clipboard()->setText(qPath);
+    } else if (selectedAction == copyImageAction && !isUrl) {
+      QImage img(path.c_str());
+      if (!img.isNull()) {
+        QApplication::clipboard()->setPixmap(QPixmap::fromImage(img));
+      } else {
+        QFile file(QString::fromStdString(path));
+        if (file.open(QIODevice::ReadOnly)) {
+          QByteArray data = file.readAll();
+          cv::Mat mat = cv::imdecode(
+              cv::Mat(1, data.size(), CV_8U, data.data()), cv::IMREAD_COLOR);
+          if (!mat.empty()) {
+            cv::Mat rgb;
+            cv::cvtColor(mat, rgb, cv::COLOR_BGR2RGB);
+            QImage qImg((uchar*)rgb.data, rgb.cols, rgb.rows,
+                        static_cast<int>(rgb.step), QImage::Format_RGB888);
+            QApplication::clipboard()
+                ->setPixmap(QPixmap::fromImage(qImg.copy()));
+          }
+        }
+      }
     } else if (selectedAction == removeAction) {
       removeGroupFromView(groupId);
     } else if (selectedAction == openAction) {

+ 4 - 0
translations/dupfind_de.ts

@@ -59,6 +59,10 @@
         <source>Copy Full Path(&amp;C)</source>
         <translation>Vollständigen Pfad kopieren(&amp;C)</translation>
     </message>
+    <message>
+        <source>Copy Image(&amp;I)</source>
+        <translation>Bild kopieren(&amp;I)</translation>
+    </message>
     <message>
         <source>Remove from List(&amp;R)</source>
         <translation>Aus Liste entfernen(&amp;R)</translation>

+ 4 - 0
translations/dupfind_en.ts

@@ -59,6 +59,10 @@
         <source>Copy Full Path(&amp;C)</source>
         <translation>Copy Full Path(&amp;C)</translation>
     </message>
+    <message>
+        <source>Copy Image(&amp;I)</source>
+        <translation>Copy Image(&amp;I)</translation>
+    </message>
     <message>
         <source>Remove from List(&amp;R)</source>
         <translation>Remove from List(&amp;R)</translation>

+ 4 - 0
translations/dupfind_es.ts

@@ -59,6 +59,10 @@
         <source>Copy Full Path(&amp;C)</source>
         <translation>Copiar ruta completa(&amp;C)</translation>
     </message>
+    <message>
+        <source>Copy Image(&amp;I)</source>
+        <translation>Copiar imagen(&amp;I)</translation>
+    </message>
     <message>
         <source>Remove from List(&amp;R)</source>
         <translation>Eliminar de la lista(&amp;R)</translation>

+ 4 - 0
translations/dupfind_ja.ts

@@ -59,6 +59,10 @@
         <source>Copy Full Path(&amp;C)</source>
         <translation>フルパスをコピー(&amp;C)</translation>
     </message>
+    <message>
+        <source>Copy Image(&amp;I)</source>
+        <translation>画像をコピー(&amp;I)</translation>
+    </message>
     <message>
         <source>Remove from List(&amp;R)</source>
         <translation>リストから除外(&amp;R)</translation>

+ 5 - 1
translations/dupfind_ko.ts

@@ -56,9 +56,13 @@
         <translation>중복 파일 검색 중... %p%</translation>
     </message>
     <message>
-        <source>Copy Full Path(&amp;C)</source>
+      <source>Copy Full Path(&amp;C)</source>
         <translation>전체 경로 복사(&amp;C)</translation>
     </message>
+    <message>
+        <source>Copy Image(&amp;I)</source>
+        <translation>이미지 복사(&amp;I)</translation>
+    </message>
     <message>
         <source>Remove from List(&amp;R)</source>
         <translation>목록에서 삭제(&amp;R)</translation>

+ 4 - 0
translations/dupfind_pl.ts

@@ -59,6 +59,10 @@
         <source>Copy Full Path(&amp;C)</source>
         <translation>Kopiuj pełną ścieżkę(&amp;C)</translation>
     </message>
+    <message>
+        <source>Copy Image(&amp;I)</source>
+        <translation>Kopiuj obraz(&amp;I)</translation>
+    </message>
     <message>
         <source>Remove from List(&amp;R)</source>
         <translation>Usuń z listy(&amp;R)</translation>

+ 4 - 0
translations/dupfind_pt.ts

@@ -59,6 +59,10 @@
         <source>Copy Full Path(&amp;C)</source>
         <translation>Copiar caminho completo(&amp;C)</translation>
     </message>
+    <message>
+        <source>Copy Image(&amp;I)</source>
+        <translation>Copiar imagem(&amp;I)</translation>
+    </message>
     <message>
         <source>Remove from List(&amp;R)</source>
         <translation>Remover da lista(&amp;R)</translation>

+ 4 - 0
translations/dupfind_ru.ts

@@ -59,6 +59,10 @@
         <source>Copy Full Path(&amp;C)</source>
         <translation>Копировать полный путь(&amp;C)</translation>
     </message>
+    <message>
+        <source>Copy Image(&amp;I)</source>
+        <translation>Копировать изображение(&amp;I)</translation>
+    </message>
     <message>
         <source>Remove from List(&amp;R)</source>
         <translation>Удалить из списка(&amp;R)</translation>

+ 4 - 0
translations/dupfind_zh_CN.ts

@@ -59,6 +59,10 @@
         <source>Copy Full Path(&amp;C)</source>
         <translation>复制完整路径(&amp;C)</translation>
     </message>
+    <message>
+        <source>Copy Image(&amp;I)</source>
+        <translation>复制图像(&amp;I)</translation>
+    </message>
     <message>
         <source>Remove from List(&amp;R)</source>
         <translation>从列表中移除(&amp;R)</translation>

+ 4 - 0
translations/dupfind_zh_TW.ts

@@ -59,6 +59,10 @@
         <source>Copy Full Path(&amp;C)</source>
         <translation>複製完整路徑(&amp;C)</translation>
     </message>
+    <message>
+        <source>Copy Image(&amp;I)</source>
+        <translation>複製影像(&amp;I)</translation>
+    </message>
     <message>
         <source>Remove from List(&amp;R)</source>
         <translation>從清單中移除(&amp;R)</translation>