diff --git a/app/scanner/Scanner_zh_CN.qm b/app/scanner/Scanner_zh_CN.qm index 1ee20ce3..834bc54a 100644 Binary files a/app/scanner/Scanner_zh_CN.qm and b/app/scanner/Scanner_zh_CN.qm differ diff --git a/app/scanner/Scanner_zh_CN.ts b/app/scanner/Scanner_zh_CN.ts index 956a81f4..63136dc2 100644 --- a/app/scanner/Scanner_zh_CN.ts +++ b/app/scanner/Scanner_zh_CN.ts @@ -1398,33 +1398,59 @@ Please make sure the two passwords are the same. HGImgThumb - + tips 提示 - unsupported file format 拖拽仅支持jpg、bmp、png、tif/tiff、pdf和ofd格式 - + + file have been loaded + 文件已经加载! + + + + file have been loaded, do you want to move to end? + 文件已经加载,是否将其移动到末尾? + + + + file have been loaded, do you want to move to specified location? + 文件已经加载,是否将其移动到指定位置? + + + + Question 提示 - - some files have been loaded, do you want to move? - 有图片已经被打开,是否移动这些图片的位置? + + some files have been loaded, do you want to move to end? + 有文件已经加载,是否将其移动到末尾? - + + some files have been loaded, do you want to move to specified location? + 有文件已经加载,是否将其移动到指定位置? + + + some files have been loaded, do you want to move? + 有图片已经被打开,是否移动这些图片的位置? + + + + yes - + + no @@ -1432,14 +1458,12 @@ Please make sure the two passwords are the same. HGImgView - tips - 提示 + 提示 - unsupported file format - 拖拽仅支持jpg、bmp、png、tif/tiff、pdf和ofd格式 + 拖拽仅支持jpg、bmp、png、tif/tiff、pdf和ofd格式 @@ -1761,46 +1785,46 @@ Please make sure the two passwords are the same. 华高扫描软件 - + Grid 多列显示 - + Move To... 移动到... - + Insert files 插入文件 - + nodevice 没有发现扫描仪 - - - - - - + + + + + + Question 警告 - - + + modified, save it? 图像已被修改。 是否保存修改? - + file lost, remove it? 文件已丢失,是否删除? @@ -1809,7 +1833,7 @@ Please make sure the two passwords are the same. 已连接 - + disconnected 已断开连接 @@ -1826,161 +1850,161 @@ Please make sure the two passwords are the same. 扫描完成 - + Clear, then start scan 清空并启动扫描 - + Do NOT clear, then start scan 不清空并启动扫描 - + Already exist images in image list. Do you want to clear? 图像列表中已存在图像。 是否清空? - + Information 消息 - + Insufficient disk space 磁盘空间不足,请删除不需要的文件,以保证有足够的空间 - + Open images 打开图片 - + Insert images 插入图片 - - - - - + + + + + info 信息 - - - + + + save failed 保存失败 - - + + find savePath in thumbnail 图片名在列表中已存在 - + File name 文件名 - + File path 文件路径 - + File size 文件大小 - + Creation date/time 创建时间 - + Modified date/time 修改时间 - + Accessed date/time 访问时间 - + Format 格式 - + Width 宽度 - + Height 高度 - + depth 深度 - + Color model 色彩模式 - + DPI 每英寸像素点 - + Print size 打印尺寸 - + Frame - + None - + Mono 黑白 - + Gray 灰度 - + Color 彩色 - + Warning 警告 - + Device is Running! Please finish scanning first. 设备正在运行! @@ -1993,166 +2017,166 @@ Continue to close? 是否继续关闭? - + Sure to sign out administrator account? 是否确定登出管理员账户? - + <p>%1: <a href='%2'>%3</a> - + <p>%1: %2 - + open scanner 打开扫描仪 - - + + app name 华高扫描软件 - - + + success 成功 - + apply setting 应用配置 - + success 成功 - + failed 失败 - - + + failed 失败 - + lost config 配置丢失 - + apply setting 应用配置 - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + start failed 启动失败 - - - - - - - + + + + + + + yes 确定 - - - - - - + + + + + + no 取消 - + found device 发现设备 - + reconnected 重新连接 - - + + %1%2%3.%4 %1%2%3.%4 - + There are pictures that have not been saved. Are you sure to close? 有图像未保存,确定关闭? - + tips 提示 - + Are you sure to close? 确定关闭? - - - + + + hint 提示 - - + + Roller scanned count has been set to 0. 辊轴计数已置零 - - + + Roller scanned count reset failed. 重置辊轴计数失败 - + Error 错误 - + Document missing! It would be deleted or renamed. 文档丢失!文档可能已被删除或被重命名。 @@ -2185,28 +2209,28 @@ Are you sure to close? <br>导航地址: <a href='https://j.map.baidu.com/7e/1TO'>百度地图访问</a> - + About %1 关于 %1 - + <p>%1</p><p>Version: %2<br>CopyRight: &#169; %3</p><p>%4%5%6%7%8%9</p> <p>%1</p><p>版本: %2<br>版权: &#169; %3</p><p>%4%5%6%7%8%9</p> - + about %1 关于 %1 - + <p>Version: %1</p> <p>版本: %1</p> <p>版本: %1</p> - + <p>CopyRight: &#169; %1</p> <p>版权: &#169; %1</p> <p>版权: &#169; %1</p> diff --git a/app/scanner/mainwindow.cpp b/app/scanner/mainwindow.cpp index 9c775ac9..dd4950c0 100644 --- a/app/scanner/mainwindow.cpp +++ b/app/scanner/mainwindow.cpp @@ -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() diff --git a/app/scanner/mainwindow.h b/app/scanner/mainwindow.h index 6ff447ae..8f559bc5 100644 --- a/app/scanner/mainwindow.h +++ b/app/scanner/mainwindow.h @@ -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); diff --git a/app/scanner/qt_zh_CN.ts b/app/scanner/qt_zh_CN.ts index 04153b34..52d6309e 100644 --- a/app/scanner/qt_zh_CN.ts +++ b/app/scanner/qt_zh_CN.ts @@ -1131,10 +1131,6 @@ Please make sure the two passwords are the same. Question - - some files have been loaded, do you want to move? - - yes @@ -1143,15 +1139,24 @@ Please make sure the two passwords are the same. no - - - HGImgView - tips + file have been loaded - unsupported file format + file have been loaded, do you want to move to end? + + + + file have been loaded, do you want to move to specified location? + + + + some files have been loaded, do you want to move to end? + + + + some files have been loaded, do you want to move to specified location? diff --git a/ui/HGImgThumb.cpp b/ui/HGImgThumb.cpp index 0aadff5c..93c6a930 100644 --- a/ui/HGImgThumb.cpp +++ b/ui/HGImgThumb.cpp @@ -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 oldSelectedIndexs; - for (int i = 0; i < (int)m_frontItems.size(); ++i) - { - if (m_frontItems[i]->selected) - oldSelectedIndexs.push_back(i); - } - + QStringList fileNames; QList urls = e->mimeData()->urls(); - - std::vector 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 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) diff --git a/ui/HGImgThumb.h b/ui/HGImgThumb.h index 00b2ee5e..e9067203 100644 --- a/ui/HGImgThumb.h +++ b/ui/HGImgThumb.h @@ -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: diff --git a/ui/HGImgView.cpp b/ui/HGImgView.cpp index 723e273e..960438f8 100644 --- a/ui/HGImgView.cpp +++ b/ui/HGImgView.cpp @@ -1716,37 +1716,15 @@ void HGImgView::dropEvent(QDropEvent *e) { Q_UNUSED(e); - QList urls = e->mimeData()->urls(); - QStringList fileNames; + QList 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) diff --git a/ui/HGImgView.h b/ui/HGImgView.h index 822752a0..589c84c6 100644 --- a/ui/HGImgView.h +++ b/ui/HGImgView.h @@ -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: