缩略图库将dropevent作为事件处理,对不同的拖动源按照不同的方式处理

This commit is contained in:
luoliangyi 2022-05-14 13:22:20 +08:00
parent 605f2e87ff
commit 73f8715fe3
9 changed files with 230 additions and 307 deletions

Binary file not shown.

View File

@ -1398,33 +1398,59 @@ Please make sure the two passwords are the same.</source>
<name>HGImgThumb</name>
<message>
<location filename="../../ui/HGImgThumb.cpp" line="1214"/>
<location filename="../../ui/HGImgThumb.cpp" line="3382"/>
<location filename="../../ui/HGImgThumb.cpp" line="1230"/>
<source>tips</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../ui/HGImgThumb.cpp" line="1214"/>
<location filename="../../ui/HGImgThumb.cpp" line="3382"/>
<source>unsupported file format</source>
<translation type="unfinished">jpgbmppngtif/tiffpdf和ofd格式</translation>
</message>
<message>
<location filename="../../ui/HGImgThumb.cpp" line="1223"/>
<location filename="../../ui/HGImgThumb.cpp" line="1230"/>
<source>file have been loaded</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../ui/HGImgThumb.cpp" line="1234"/>
<source>file have been loaded, do you want to move to end?</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../ui/HGImgThumb.cpp" line="1235"/>
<source>file have been loaded, do you want to move to specified location?</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../ui/HGImgThumb.cpp" line="1236"/>
<location filename="../../ui/HGImgThumb.cpp" line="1252"/>
<source>Question</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../ui/HGImgThumb.cpp" line="1224"/>
<source>some files have been loaded, do you want to move?</source>
<translation type="unfinished"></translation>
<location filename="../../ui/HGImgThumb.cpp" line="1250"/>
<source>some files have been loaded, do you want to move to end?</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../ui/HGImgThumb.cpp" line="1226"/>
<location filename="../../ui/HGImgThumb.cpp" line="1251"/>
<source>some files have been loaded, do you want to move to specified location?</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>some files have been loaded, do you want to move?</source>
<translation type="obsolete"></translation>
</message>
<message>
<location filename="../../ui/HGImgThumb.cpp" line="1239"/>
<location filename="../../ui/HGImgThumb.cpp" line="1255"/>
<source>yes</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../ui/HGImgThumb.cpp" line="1227"/>
<location filename="../../ui/HGImgThumb.cpp" line="1240"/>
<location filename="../../ui/HGImgThumb.cpp" line="1256"/>
<source>no</source>
<translation type="unfinished"></translation>
</message>
@ -1432,14 +1458,12 @@ Please make sure the two passwords are the same.</source>
<context>
<name>HGImgView</name>
<message>
<location filename="../../ui/HGImgView.cpp" line="1748"/>
<source>tips</source>
<translation type="unfinished"></translation>
<translation type="obsolete"></translation>
</message>
<message>
<location filename="../../ui/HGImgView.cpp" line="1748"/>
<source>unsupported file format</source>
<translation type="unfinished">jpgbmppngtif/tiffpdf和ofd格式</translation>
<translation type="obsolete">jpgbmppngtif/tiffpdf和ofd格式</translation>
</message>
</context>
<context>
@ -1761,46 +1785,46 @@ Please make sure the two passwords are the same.</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="189"/>
<location filename="mainwindow.cpp" line="190"/>
<source>Grid</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="194"/>
<location filename="mainwindow.cpp" line="195"/>
<source>Move To...</source>
<translation type="unfinished">...</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="198"/>
<location filename="mainwindow.cpp" line="199"/>
<source>Insert files</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="223"/>
<location filename="mainwindow.cpp" line="224"/>
<location filename="mainwindow.cpp" line="225"/>
<location filename="mainwindow.cpp" line="226"/>
<source>nodevice</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="383"/>
<location filename="mainwindow.cpp" line="428"/>
<location filename="mainwindow.cpp" line="1146"/>
<location filename="mainwindow.cpp" line="1170"/>
<location filename="mainwindow.cpp" line="1815"/>
<location filename="mainwindow.cpp" line="2106"/>
<location filename="mainwindow.cpp" line="384"/>
<location filename="mainwindow.cpp" line="429"/>
<location filename="mainwindow.cpp" line="1156"/>
<location filename="mainwindow.cpp" line="1180"/>
<location filename="mainwindow.cpp" line="1825"/>
<location filename="mainwindow.cpp" line="2116"/>
<source>Question</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="384"/>
<location filename="mainwindow.cpp" line="1147"/>
<location filename="mainwindow.cpp" line="385"/>
<location filename="mainwindow.cpp" line="1157"/>
<source>modified, save it?</source>
<translation>
</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="429"/>
<location filename="mainwindow.cpp" line="430"/>
<source>file lost, remove it?</source>
<translation type="unfinished"></translation>
</message>
@ -1809,7 +1833,7 @@ Please make sure the two passwords are the same.</source>
<translation type="vanished"> </translation>
</message>
<message>
<location filename="mainwindow.cpp" line="650"/>
<location filename="mainwindow.cpp" line="660"/>
<source> disconnected</source>
<translation> </translation>
</message>
@ -1826,161 +1850,161 @@ Please make sure the two passwords are the same.</source>
<translation type="vanished"></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="1167"/>
<location filename="mainwindow.cpp" line="1177"/>
<source>Clear, then start scan</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="1168"/>
<location filename="mainwindow.cpp" line="1178"/>
<source>Do NOT clear, then start scan</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="1171"/>
<location filename="mainwindow.cpp" line="1181"/>
<source>Already exist images in image list.
Do you want to clear?</source>
<translation>
</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="1205"/>
<location filename="mainwindow.cpp" line="1215"/>
<source>Information</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="1206"/>
<location filename="mainwindow.cpp" line="1216"/>
<source>Insufficient disk space</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="1392"/>
<location filename="mainwindow.cpp" line="1402"/>
<source>Open images</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="1403"/>
<location filename="mainwindow.cpp" line="1413"/>
<source>Insert images</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="1526"/>
<location filename="mainwindow.cpp" line="1531"/>
<location filename="mainwindow.cpp" line="1585"/>
<location filename="mainwindow.cpp" line="1640"/>
<location filename="mainwindow.cpp" line="1645"/>
<location filename="mainwindow.cpp" line="1536"/>
<location filename="mainwindow.cpp" line="1541"/>
<location filename="mainwindow.cpp" line="1595"/>
<location filename="mainwindow.cpp" line="1650"/>
<location filename="mainwindow.cpp" line="1655"/>
<source>info</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="1526"/>
<location filename="mainwindow.cpp" line="1585"/>
<location filename="mainwindow.cpp" line="1640"/>
<location filename="mainwindow.cpp" line="1536"/>
<location filename="mainwindow.cpp" line="1595"/>
<location filename="mainwindow.cpp" line="1650"/>
<source>save failed</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="1531"/>
<location filename="mainwindow.cpp" line="1645"/>
<location filename="mainwindow.cpp" line="1541"/>
<location filename="mainwindow.cpp" line="1655"/>
<source>find savePath in thumbnail</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="1722"/>
<location filename="mainwindow.cpp" line="1732"/>
<source>File name</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="1722"/>
<location filename="mainwindow.cpp" line="1732"/>
<source>File path</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="1722"/>
<location filename="mainwindow.cpp" line="1732"/>
<source>File size</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="1722"/>
<location filename="mainwindow.cpp" line="1732"/>
<source>Creation date/time</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="1722"/>
<location filename="mainwindow.cpp" line="1732"/>
<source>Modified date/time</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="1722"/>
<location filename="mainwindow.cpp" line="1732"/>
<source>Accessed date/time</source>
<translation>访</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="1765"/>
<location filename="mainwindow.cpp" line="1775"/>
<source>Format</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="1765"/>
<location filename="mainwindow.cpp" line="1775"/>
<source>Width</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="1765"/>
<location filename="mainwindow.cpp" line="1775"/>
<source>Height</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="1765"/>
<location filename="mainwindow.cpp" line="1775"/>
<source>depth</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="1765"/>
<location filename="mainwindow.cpp" line="1775"/>
<source>Color model</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="1765"/>
<location filename="mainwindow.cpp" line="1775"/>
<source>DPI</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="1765"/>
<location filename="mainwindow.cpp" line="1775"/>
<source>Print size</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="1765"/>
<location filename="mainwindow.cpp" line="1775"/>
<source>Frame</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="1773"/>
<location filename="mainwindow.cpp" line="1783"/>
<source>None</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="1773"/>
<location filename="mainwindow.cpp" line="1783"/>
<source>Mono</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="1773"/>
<location filename="mainwindow.cpp" line="1783"/>
<source>Gray</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="1773"/>
<location filename="mainwindow.cpp" line="1783"/>
<source>Color</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="1794"/>
<location filename="mainwindow.cpp" line="1804"/>
<source>Warning</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="1794"/>
<location filename="mainwindow.cpp" line="1804"/>
<source>Device is Running!
Please finish scanning first.</source>
<translation>
@ -1993,166 +2017,166 @@ Continue to close?</source>
</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="2107"/>
<location filename="mainwindow.cpp" line="2117"/>
<source>Sure to sign out administrator account?</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="2252"/>
<location filename="mainwindow.cpp" line="2262"/>
<source>&lt;p&gt;%1: &lt;a href=&apos;%2&apos;&gt;%3&lt;/a&gt;</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="2254"/>
<location filename="mainwindow.cpp" line="2264"/>
<source>&lt;p&gt;%1: %2</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="2586"/>
<location filename="mainwindow.cpp" line="2596"/>
<source>open scanner </source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="2587"/>
<location filename="mainwindow.cpp" line="2633"/>
<location filename="mainwindow.cpp" line="2597"/>
<location filename="mainwindow.cpp" line="2643"/>
<source>app name</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="2592"/>
<location filename="mainwindow.cpp" line="2666"/>
<location filename="mainwindow.cpp" line="2602"/>
<location filename="mainwindow.cpp" line="2676"/>
<source>success</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="2601"/>
<location filename="mainwindow.cpp" line="2611"/>
<source>apply setting </source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="2601"/>
<location filename="mainwindow.cpp" line="2611"/>
<source> success</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="2601"/>
<location filename="mainwindow.cpp" line="2611"/>
<source> failed</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="2619"/>
<location filename="mainwindow.cpp" line="2681"/>
<location filename="mainwindow.cpp" line="2629"/>
<location filename="mainwindow.cpp" line="2691"/>
<source>failed</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="2641"/>
<location filename="mainwindow.cpp" line="2651"/>
<source>lost config</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="2662"/>
<location filename="mainwindow.cpp" line="2672"/>
<source>apply setting</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="873"/>
<location filename="mainwindow.cpp" line="874"/>
<location filename="mainwindow.cpp" line="875"/>
<location filename="mainwindow.cpp" line="2341"/>
<location filename="mainwindow.cpp" line="2342"/>
<location filename="mainwindow.cpp" line="2343"/>
<location filename="mainwindow.cpp" line="2388"/>
<location filename="mainwindow.cpp" line="2389"/>
<location filename="mainwindow.cpp" line="2390"/>
<location filename="mainwindow.cpp" line="2445"/>
<location filename="mainwindow.cpp" line="2446"/>
<location filename="mainwindow.cpp" line="2447"/>
<location filename="mainwindow.cpp" line="2507"/>
<location filename="mainwindow.cpp" line="2508"/>
<location filename="mainwindow.cpp" line="2509"/>
<location filename="mainwindow.cpp" line="883"/>
<location filename="mainwindow.cpp" line="884"/>
<location filename="mainwindow.cpp" line="885"/>
<location filename="mainwindow.cpp" line="2351"/>
<location filename="mainwindow.cpp" line="2352"/>
<location filename="mainwindow.cpp" line="2353"/>
<location filename="mainwindow.cpp" line="2398"/>
<location filename="mainwindow.cpp" line="2399"/>
<location filename="mainwindow.cpp" line="2400"/>
<location filename="mainwindow.cpp" line="2455"/>
<location filename="mainwindow.cpp" line="2456"/>
<location filename="mainwindow.cpp" line="2457"/>
<location filename="mainwindow.cpp" line="2517"/>
<location filename="mainwindow.cpp" line="2518"/>
<location filename="mainwindow.cpp" line="2519"/>
<source>start failed</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="386"/>
<location filename="mainwindow.cpp" line="431"/>
<location filename="mainwindow.cpp" line="1149"/>
<location filename="mainwindow.cpp" line="1207"/>
<location filename="mainwindow.cpp" line="1818"/>
<location filename="mainwindow.cpp" line="1832"/>
<location filename="mainwindow.cpp" line="2108"/>
<location filename="mainwindow.cpp" line="387"/>
<location filename="mainwindow.cpp" line="432"/>
<location filename="mainwindow.cpp" line="1159"/>
<location filename="mainwindow.cpp" line="1217"/>
<location filename="mainwindow.cpp" line="1828"/>
<location filename="mainwindow.cpp" line="1842"/>
<location filename="mainwindow.cpp" line="2118"/>
<source>yes</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="387"/>
<location filename="mainwindow.cpp" line="432"/>
<location filename="mainwindow.cpp" line="1150"/>
<location filename="mainwindow.cpp" line="1819"/>
<location filename="mainwindow.cpp" line="1833"/>
<location filename="mainwindow.cpp" line="2109"/>
<location filename="mainwindow.cpp" line="388"/>
<location filename="mainwindow.cpp" line="433"/>
<location filename="mainwindow.cpp" line="1160"/>
<location filename="mainwindow.cpp" line="1829"/>
<location filename="mainwindow.cpp" line="1843"/>
<location filename="mainwindow.cpp" line="2119"/>
<source>no</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="602"/>
<location filename="mainwindow.cpp" line="612"/>
<source>found device </source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="612"/>
<location filename="mainwindow.cpp" line="622"/>
<source> reconnected</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="746"/>
<location filename="mainwindow.cpp" line="788"/>
<location filename="mainwindow.cpp" line="756"/>
<location filename="mainwindow.cpp" line="798"/>
<source>%1%2%3.%4</source>
<translation type="unfinished">%1%2%3.%4</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="1816"/>
<location filename="mainwindow.cpp" line="1826"/>
<source>There are pictures that have not been saved.
Are you sure to close?</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="1829"/>
<location filename="mainwindow.cpp" line="1839"/>
<source>tips</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="1830"/>
<location filename="mainwindow.cpp" line="1840"/>
<source>Are you sure to close?</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="2168"/>
<location filename="mainwindow.cpp" line="2170"/>
<location filename="mainwindow.cpp" line="2212"/>
<location filename="mainwindow.cpp" line="2178"/>
<location filename="mainwindow.cpp" line="2180"/>
<location filename="mainwindow.cpp" line="2222"/>
<source>hint</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="2168"/>
<location filename="mainwindow.cpp" line="2204"/>
<location filename="mainwindow.cpp" line="2178"/>
<location filename="mainwindow.cpp" line="2214"/>
<source>Roller scanned count has been set to 0.</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="2170"/>
<location filename="mainwindow.cpp" line="2210"/>
<location filename="mainwindow.cpp" line="2180"/>
<location filename="mainwindow.cpp" line="2220"/>
<source>Roller scanned count reset failed.</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="2183"/>
<location filename="mainwindow.cpp" line="2193"/>
<source>Error</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="2183"/>
<location filename="mainwindow.cpp" line="2193"/>
<source>Document missing! It would be deleted or renamed.</source>
<translation></translation>
</message>
@ -2185,28 +2209,28 @@ Are you sure to close?</source>
<translation type="vanished">&lt;br&gt;: &lt;a href=&apos;https://j.map.baidu.com/7e/1TO&apos;&gt;百度地图访问&lt;/a&gt;</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="2230"/>
<location filename="mainwindow.cpp" line="2240"/>
<source>About %1</source>
<translation> %1</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="2231"/>
<location filename="mainwindow.cpp" line="2241"/>
<source>&lt;p&gt;%1&lt;/p&gt;&lt;p&gt;Version: %2&lt;br&gt;CopyRight: &amp;#169; %3&lt;/p&gt;&lt;p&gt;%4%5%6%7%8%9&lt;/p&gt;</source>
<translation>&lt;p&gt;%1&lt;/p&gt;&lt;p&gt;: %2&lt;br&gt;: &amp;#169; %3&lt;/p&gt;&lt;p&gt;%4%5%6%7%8%9&lt;/p&gt;</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="2246"/>
<location filename="mainwindow.cpp" line="2256"/>
<source>about %1</source>
<translation> %1</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="2247"/>
<location filename="mainwindow.cpp" line="2257"/>
<source>&lt;p&gt;Version: %1&lt;/p&gt;</source>
<oldsource>&lt;p&gt;: %1&lt;/p&gt;</oldsource>
<translation>&lt;p&gt; %1&lt;/p&gt;</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="2248"/>
<location filename="mainwindow.cpp" line="2258"/>
<source>&lt;p&gt;CopyRight: &amp;#169; %1&lt;/p&gt;</source>
<oldsource>&lt;p&gt;: &amp;#169; %1&lt;/p&gt;</oldsource>
<translation>&lt;p&gt; &amp;#169; %1&lt;/p&gt;</translation>

View File

@ -111,13 +111,14 @@ MainWindow::MainWindow(QWidget *parent)
connect(m_view, SIGNAL(scaleChanged(double)), this, SLOT(on_viewerScale(double)));
connect(m_view, SIGNAL(mousePos(int, int)), this, SLOT(on_viewerMousePos(int, int)));
connect(m_view, SIGNAL(drop(const QStringList &)), this, SLOT(on_viewerDrop(const QStringList &)));
connect(m_view, SIGNAL(drop(const QObject*, const QStringList &)), this, SLOT(on_viewerDrop(const QObject*, const QStringList &)));
connect(m_view, SIGNAL(doubleClicked()), this, SLOT(on_viewerDblClick()));
connect(m_thumb, SIGNAL(itemCountChanged(int)), this, SLOT(on_itemCountChanged(int)));
connect(m_thumb, SIGNAL(itemSelectingChanged()), this, SLOT(on_itemSelectingChanged()));
connect(m_thumb, SIGNAL(currItemChanged(int)), this, SLOT(on_currItemChanged(int)));
connect(m_thumb, SIGNAL(itemDoubleClicked(int)), this, SLOT(on_itemDoubleClicked(int)));
connect(m_thumb, SIGNAL(contextMenuEvent(int)), this, SLOT(on_thumbContextMenu(int)));
connect(m_thumb, SIGNAL(drop(const QObject*, const QStringList &, int)), this, SLOT(on_thumbDrop(const QObject*, const QStringList &, int)));
connect(m_multiPageLineEdit, SIGNAL(editingFinished()), this, SLOT(on_multiPageLineEditFinished()));
@ -482,9 +483,18 @@ void MainWindow::on_viewerMousePos(int x, int y)
m_wndStatusBar->setMousePosInfo(x, y);
}
void MainWindow::on_viewerDrop(const QStringList &fileNames)
void MainWindow::on_thumbDrop(const QObject *source, const QStringList &fileNames, int pos)
{
m_thumb->addItems(fileNames);
if (source != m_thumb)
m_thumb->insertItems(fileNames, pos);
else
m_thumb->moveItems(fileNames, pos);
}
void MainWindow::on_viewerDrop(const QObject *source, const QStringList &fileNames)
{
if (source != m_thumb)
m_thumb->addItems(fileNames);
}
void MainWindow::on_viewerDblClick()

View File

@ -98,7 +98,8 @@ private slots:
void on_thumbContextMenu(int index);
void on_viewerScale(double scale);
void on_viewerMousePos(int x, int y);
void on_viewerDrop(const QStringList &fileNames);
void on_thumbDrop(const QObject *source, const QStringList &fileNames, int pos);
void on_viewerDrop(const QObject *source, const QStringList &fileNames);
void on_viewerDblClick();
void on_act_moveTo_triggered();
void on_act_thumbGrid_triggered(bool checked);

View File

@ -1131,10 +1131,6 @@ Please make sure the two passwords are the same.</source>
<source>Question</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>some files have been loaded, do you want to move?</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>yes</source>
<translation type="unfinished"></translation>
@ -1143,15 +1139,24 @@ Please make sure the two passwords are the same.</source>
<source>no</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>HGImgView</name>
<message>
<source>tips</source>
<source>file have been loaded</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>unsupported file format</source>
<source>file have been loaded, do you want to move to end?</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>file have been loaded, do you want to move to specified location?</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>some files have been loaded, do you want to move to end?</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>some files have been loaded, do you want to move to specified location?</source>
<translation type="unfinished"></translation>
</message>
</context>

View File

@ -1146,7 +1146,7 @@ HGResult HGImgThumb::addItem(const QString &fileName)
HGResult HGImgThumb::addItems(const QStringList &fileNames)
{
return insertItems(fileNames, (int)m_frontItems.size());
return insertItems(fileNames, (int)m_frontItems.size(), true);
}
HGResult HGImgThumb::insertItem(const QString &fileName, int pos)
@ -1156,7 +1156,7 @@ HGResult HGImgThumb::insertItem(const QString &fileName, int pos)
return insertItems(fileNames, pos);
}
HGResult HGImgThumb::insertItems(const QStringList &fileNames, int pos)
HGResult HGImgThumb::insertItems(const QStringList &fileNames, int pos, bool append)
{
if (pos < 0 || pos > (int)m_frontItems.size())
{
@ -1220,15 +1220,45 @@ HGResult HGImgThumb::insertItems(const QStringList &fileNames, int pos)
bool isMove = false;
if (findInThumb)
{
QMessageBox msg(QMessageBox::Question, tr("Question"),
tr("some files have been loaded, do you want to move?"),
QMessageBox::Yes | QMessageBox::No, this);
msg.setButtonText(QMessageBox::Yes, tr("yes"));
msg.setButtonText(QMessageBox::No, tr("no"));
msg.exec();
if (msg.clickedButton() == msg.button(QMessageBox::Yes))
if (1 == stdFileNames.size())
{
isMove = true;
int index = findIndex(stdFileNames[0]);
assert(-1 != index);
if (pos == index || pos == index + 1)
{
QMessageBox::information(this, tr("tips"), tr("file have been loaded"));
}
else
{
QString info = append ? tr("file have been loaded, do you want to move to end?")
: tr("file have been loaded, do you want to move to specified location?");
QMessageBox msg(QMessageBox::Question, tr("Question"),
info,
QMessageBox::Yes | QMessageBox::No, this);
msg.setButtonText(QMessageBox::Yes, tr("yes"));
msg.setButtonText(QMessageBox::No, tr("no"));
msg.exec();
if (msg.clickedButton() == msg.button(QMessageBox::Yes))
{
isMove = true;
}
}
}
else
{
QString info = append ? tr("some files have been loaded, do you want to move to end?")
: tr("some files have been loaded, do you want to move to specified location?");
QMessageBox msg(QMessageBox::Question, tr("Question"),
info,
QMessageBox::Yes | QMessageBox::No, this);
msg.setButtonText(QMessageBox::Yes, tr("yes"));
msg.setButtonText(QMessageBox::No, tr("no"));
msg.exec();
if (msg.clickedButton() == msg.button(QMessageBox::Yes))
{
isMove = true;
}
}
}
@ -3238,117 +3268,14 @@ void HGImgThumb::dragLeaveEvent(QDragLeaveEvent *e)
void HGImgThumb::dropEvent(QDropEvent *e)
{
int oldItemCount = (int)m_frontItems.size();
int oldCurrItemIndex = m_curItemIndex;
QString oldCurrItemFilePath;
if (-1 != oldCurrItemIndex)
oldCurrItemFilePath = m_frontItems[oldCurrItemIndex]->fileName;
std::vector<int> oldSelectedIndexs;
for (int i = 0; i < (int)m_frontItems.size(); ++i)
{
if (m_frontItems[i]->selected)
oldSelectedIndexs.push_back(i);
}
QStringList fileNames;
QList<QUrl> urls = e->mimeData()->urls();
std::vector<QString> stdFileNames;
for (QUrl url : urls)
{
QString stdFileName = getStdFileName(url.toLocalFile());
QFileInfo fileInfo(stdFileName);
if (!fileInfo.isFile())
{
continue;
}
HGUInt fmtType = 0;
HGImgFmt_GetImgFmtTypeFromFileName(getStdString(stdFileName).c_str(), &fmtType);
if (0 != fmtType)
{
stdFileNames.push_back(stdFileName);
}
fileNames.append(url.toLocalFile());
}
if (-1 != m_curInsertPos && !stdFileNames.empty())
{
for (int i = 0; i < (int)m_frontItems.size(); ++i)
{
m_frontItems[i]->selected = false;
}
int pos = m_curInsertPos;
int posEx = pos;
for (int i = 0; i < (int)stdFileNames.size(); ++i)
{
const QString& stdFileName = stdFileNames[i];
int oldIndex = findIndex(stdFileName);
if (-1 == oldIndex)
{
HGImgThumbItem *item = new HGImgThumbItem;
item->fileName = stdFileName;
item->selected = true;
HGBase_EnterLock(m_lockFront);
item->selected = true;
if (posEx != (int)m_frontItems.size())
m_frontItems.insert(m_frontItems.begin() + posEx, item);
else
m_frontItems.push_back(item);
HGBase_LeaveLock(m_lockFront);
HGBase_EnterLock(m_lockBack);
m_backList.push_back(stdFileName);
HGBase_LeaveLock(m_lockBack);
HGBase_SetEvent(m_event);
++posEx;
}
else
{
HGImgThumbItem *item = m_frontItems[oldIndex];
item->selected = true;
if (oldIndex < posEx)
{
if (pos == posEx)
{
--pos;
}
--posEx;
}
HGBase_EnterLock(m_lockFront);
m_frontItems.erase(m_frontItems.begin() + oldIndex);
if (posEx != (int)m_frontItems.size())
m_frontItems.insert(m_frontItems.begin() + posEx, item);
else
m_frontItems.push_back(item);
HGBase_LeaveLock(m_lockFront);
++posEx;
}
}
if (pos != posEx)
{
m_curItemIndex = posEx - 1;
m_signItemIndex = posEx - 1;
int showWidth = 0, showHeight = 0;
calcShowSize(this->width(), this->height(), m_gapSize, m_scrollSize, m_itemSize, m_itemTextHeight, m_type, (int)m_frontItems.size(),
showWidth, showHeight, m_hScroll, m_vScroll);
assert(showWidth > 0 && showHeight > 0);
m_showThumb = true;
m_thumbRect.right = m_thumbRect.left + (double)showWidth;
m_thumbRect.bottom = m_thumbRect.top + (double)showHeight;
locateItem(posEx - 1);
recalcShowRect(this->width(), this->height(), m_scrollSize, m_type, m_hScroll, m_vScroll, m_showThumb, m_thumbRect);
}
}
int pos = m_curInsertPos;
m_curInsertPos = -1;
m_insertPtValid = false;
@ -3357,30 +3284,7 @@ void HGImgThumb::dropEvent(QDropEvent *e)
m_hotItemIndex = getItemIndex(mapFromGlobal(QCursor::pos()), m_mouseMoveStatus);
Show();
int newItemCount = (int)m_frontItems.size();
int newCurrItemIndex = m_curItemIndex;
QString newCurrItemFilePath;
if (-1 != newCurrItemIndex)
newCurrItemFilePath = m_frontItems[newCurrItemIndex]->fileName;
std::vector<int> newSelectedIndexs;
for (int i = 0; i < (int)m_frontItems.size(); ++i)
{
if (m_frontItems[i]->selected)
newSelectedIndexs.push_back(i);
}
if (newItemCount != oldItemCount)
emit itemCountChanged((int)m_frontItems.size());
if (newCurrItemIndex != oldCurrItemIndex || newCurrItemFilePath != oldCurrItemFilePath)
emit currItemChanged(m_curItemIndex);
if (newSelectedIndexs != oldSelectedIndexs)
emit itemSelectingChanged();
if (stdFileNames.empty() && urls.size() > 0)
{
QMessageBox::information(this, tr("tips"), tr("unsupported file format"));
}
emit drop(e->source(), fileNames, pos);
}
void HGImgThumb::mouseDoubleClickEvent(QMouseEvent *e)

View File

@ -56,7 +56,7 @@ public:
HGResult addItem(const QString &fileName);
HGResult addItems(const QStringList &fileNames);
HGResult insertItem(const QString &fileName, int pos);
HGResult insertItems(const QStringList &fileNames, int pos);
HGResult insertItems(const QStringList &fileNames, int pos, bool append = false);
HGResult moveItems(const QStringList &fileNames, int pos);
HGResult getItemFileName(int index, QString &fileName);
HGResult getCurrItem(int *index);
@ -78,6 +78,7 @@ signals:
void itemCountChanged(int count);
void itemSelectingChanged();
void contextMenuEvent(int index);
void drop(const QObject *source, const QStringList &fileNames, int pos);
private:

View File

@ -1716,37 +1716,15 @@ void HGImgView::dropEvent(QDropEvent *e)
{
Q_UNUSED(e);
QList<QUrl> urls = e->mimeData()->urls();
QStringList fileNames;
QList<QUrl> urls = e->mimeData()->urls();
for (QUrl url : urls)
{
QString fileName = getStdFileName(url.toLocalFile());
QFileInfo fileInfo(fileName);
if (!fileInfo.isFile())
{
continue;
}
HGUInt fmtType = 0;
HGImgFmt_GetImgFmtTypeFromFileName(getStdString(fileName).c_str(), &fmtType);
if (0 != fmtType)
{
fileNames.append(fileName);
}
fileNames.append(url.toLocalFile());
}
m_draging = false;
if (!fileNames.empty())
{
emit drop(fileNames);
}
if (fileNames.empty() && urls.size() > 0)
{
QMessageBox::information(this, tr("tips"), tr("unsupported file format"));
}
emit drop(e->source(), fileNames);
}
void HGImgView::mouseDoubleClickEvent(QMouseEvent* e)

View File

@ -49,7 +49,7 @@ signals:
void doubleClicked();
void mousePos(int x, int y);
void scaleChanged(double scale);
void drop(const QStringList &fileNames);
void drop(const QObject *source, const QStringList &fileNames);
private: