::iterator iter = info.begin();
- while (iter != info.end())
- {
- content += *iter;
- ++iter;
- }
-#else
-#ifdef OEM_NEUTRAL
- title = tr("about");
- content = tr("Version: %1
").arg(QString::fromStdString(about->version));
-#else
- title = tr("about %1").arg(QString::fromStdString(about->title));
- content = tr("Version: %1
").arg(QString::fromStdString(about->version));
- content += tr("CopyRight: © %1
").arg(QString::fromStdString(about->copyright));
- for (int i = 0; about->appendix[i].key; ++i)
- {
- if(about->appendix[i].url)
- content += tr("%1: %3").arg(about->appendix[i].key).arg(about->appendix[i].url).arg(about->appendix[i].content);
- else
- content += tr("
%1: %2").arg(about->appendix[i].key).arg(about->appendix[i].content);
- if(m_admin_loggedIn
- && strcmp(about->appendix[i].key, tr("roller number").toLatin1().data()) == 0
- && atoi(about->appendix[i].content) > 0)
- {
- char url[128] = {0};
- sprintf(url, " \346\270\205\351\231\244", MY_URL_SCHEME);
- content += QString::fromStdString(url);
- }
- content += "
";
- }
-#endif
-#endif
- }
- free(about);
- }
- }
-
- QMessageBox::about(this, title, content);
- QDesktopServices::unsetUrlHandler(MY_URL_SCHEME);
-}
-
-void MainWindow::on_act_scannerSettings_triggered()
-{
- if (!dev_que_.is_online() || m_isScanning)
+ if (m_devUser == nullptr)
{
return;
}
- hg_settingdialog dlg(dev_que_.handle(), this, &dev_que_);
- dlg.exec();
- ui->menu_device->deviceMenuUpdate(&dev_que_);
+#if defined(HG_CMP_MSC)
+ HGTwainDeviceCustomInfo info;
+ m_devUser->GetDeviceCustomInfo(&info);
+#else
+ HGSaneCustomInfo info;
+ m_devUser->GetDeviceCustomInfo(&info);
+#endif
+
+ QString title = tr("about %1").arg(windowTitle());
+ QString content;
+ QString wrap("\n\n");
+ content = tr("model: %1").arg(QString(info.model)) + wrap;
+ content += tr("type: %1").arg(QString(info.type)) + wrap;
+ content += tr("fwVer: %1").arg(QString(info.fwVer)) + wrap;
+ content += tr("sn: %1").arg(QString(info.sn)) + wrap;
+ content += tr("ip: %1").arg(QString(info.ip)) + wrap;
+ content += tr("mac: %1").arg(QString(info.mac)) + wrap;
+ content += tr("rollerCount: %1").arg(QString::number(info.rollerCount)) + wrap;
+ content += tr("totalCount: %1").arg(QString::number(info.totalCount));
+
+ QMessageBox::about(this, title, content);
+}
+
+void MainWindow::on_act_scannerSettings_triggered()
+{
+ if (nullptr != m_devUser)
+ m_devUser->ShowSettingDlg();
}
void MainWindow::on_act_acquire_triggered()
@@ -3478,7 +2787,12 @@ void MainWindow::on_act_acquire_triggered()
return;
}
- if (!dev_que_.is_online() || m_isScanning)
+ if (!judgeDiskSpace(Dialog_ClrCache::getCachePath()))
+ {
+ return;
+ }
+
+ if (m_isScanning)
{
return;
}
@@ -3498,56 +2812,23 @@ void MainWindow::on_act_acquire_triggered()
startSaveMessageBox(this);
- m_dpi = getDpi();
- SANE_Status ret = sane_start(dev_que_.handle());
- if (ret != SANE_STATUS_GOOD)
+ HGResult ret = HGBASE_ERR_FAIL;
+ if (nullptr != m_devUser)
+ {
+ ret = m_devUser->StartScan();
+ }
+
+ if (ret != HGBASE_ERR_OK)
{
- m_dialogLog->updateStatus(dev_que_.is_online() && 0 != m_scanType, m_isScanning);
m_wndStatusBar->setDeviceStatusInfo(tr("start failed"), true);
- m_dialogLog->addLog(tr("start failed") + "(" + QString(sane_err_desc(ret)) + ")", true);
HGBase_WriteInfo(HGBASE_INFOTYPE_ERROR, "%s", getStdString(tr("start failed")).c_str());
-
- if(ret == SCANNER_ERR_DEVICE_SLEEPING)
- {
- ui->menu_scan->setEnabled(false);
- ui->act_acquire->setEnabled(false);
- ui->act_scannerSettings->setEnabled(false);
- m_dialogLog->updateStatus(false, false);
- m_dialogLog->show();
-
- if (m_devVersionNum < "G4393B1001"
- && ("439" == m_devPid || "9220" == m_devPid || "8529" == m_devPid || "7039" == m_devPid))//Previous versions of this firmware number and 439 device can only be manually awakened.
- {
- m_dialogLog->addLog(tr("Please wake up the device manually"), true);
- m_wndStatusBar->setDeviceStatusInfo(tr("Please wake up the device manually"), true);
- }
- else
- {
- QTime curTimer = QTime::currentTime().addMSecs(10000);
- while (QTime::currentTime() < curTimer)
- {
- QCoreApplication::processEvents(QEventLoop::AllEvents, 100);
- }
-
- m_dialogLog->addLog(tr("already waked up device"), false);
- m_wndStatusBar->setDeviceStatusInfo(tr("already waked up device"), false);
- }
-
- ui->menu_scan->setEnabled(true);
- ui->act_acquire->setEnabled(true);
- ui->act_scannerSettings->setEnabled(true);
- m_dialogLog->updateStatus(true, false);
- }
}
else
{
m_isScanning = true;
m_thumb->setAcceptDrops(false);
- m_dialogLog->updateStatus(dev_que_.is_online() && 0 != m_scanType, m_isScanning);
updateActionStatus();
}
-
- m_dialogLog->show();
}
void MainWindow::on_act_acquireSingle_triggered()
@@ -3557,7 +2838,7 @@ void MainWindow::on_act_acquireSingle_triggered()
return;
}
- if (!dev_que_.is_online() || m_isScanning)
+ if (m_isScanning)
{
return;
}
@@ -3577,61 +2858,28 @@ void MainWindow::on_act_acquireSingle_triggered()
startSaveMessageBox(this);
- m_dpi = getDpi();
- SANE_Status ret = sane_io_control(dev_que_.handle(), IO_CTRL_CODE_TEST_SINGLE, nullptr, nullptr);
- if (ret != SANE_STATUS_GOOD)
+ HGResult ret = HGBASE_ERR_FAIL;
+ if (nullptr != m_devUser)
+ {
+ ret = m_devUser->StartScan();
+ }
+
+ if (ret != HGBASE_ERR_OK)
{
- m_dialogLog->updateStatus(dev_que_.is_online() && 0 != m_scanType, m_isScanning);
m_wndStatusBar->setDeviceStatusInfo(tr("start failed"), true);
- m_dialogLog->addLog(tr("start failed") + "(" + QString(sane_err_desc(ret)) + ")", true);
HGBase_WriteInfo(HGBASE_INFOTYPE_ERROR, "%s", getStdString(tr("start failed")).c_str());
-
- if(ret == SCANNER_ERR_DEVICE_SLEEPING)
- {
- ui->menu_scan->setEnabled(false);
- ui->act_acquire->setEnabled(false);
- ui->act_scannerSettings->setEnabled(false);
- m_dialogLog->updateStatus(false, false);
- m_dialogLog->show();
-
- if (m_devVersionNum < "G4393B1001"
- && ("439" == m_devPid || "9220" == m_devPid || "8529" == m_devPid))
- {
- m_dialogLog->addLog(tr("Please wake up the device manually"), true);
- m_wndStatusBar->setDeviceStatusInfo(tr("Please wake up the device manually"), true);
- }
- else
- {
- QTime curTimer = QTime::currentTime().addMSecs(10000);
- while (QTime::currentTime() < curTimer)
- {
- QCoreApplication::processEvents(QEventLoop::AllEvents, 100);
- }
-
- m_dialogLog->addLog(tr("already waked up device"), false);
- m_wndStatusBar->setDeviceStatusInfo(tr("already waked up device"), false);
- }
-
- ui->menu_scan->setEnabled(true);
- ui->act_acquire->setEnabled(true);
- ui->act_scannerSettings->setEnabled(true);
- m_dialogLog->updateStatus(true, false);
- }
}
else
{
m_isScanning = true;
m_thumb->setAcceptDrops(false);
- m_dialogLog->updateStatus(dev_que_.is_online() && 0 != m_scanType, m_isScanning);
updateActionStatus();
}
-
- m_dialogLog->show();
}
void MainWindow::on_act_acquireInto_triggered()
{
- if (!dev_que_.is_online() || m_isScanning)
+ if (m_isScanning)
{
return;
}
@@ -3675,56 +2923,23 @@ void MainWindow::on_act_acquireInto_triggered()
startSaveMessageBox(this);
- m_dpi = getDpi();
- SANE_Status ret = sane_start(dev_que_.handle());
- if (ret != SANE_STATUS_GOOD)
+ HGResult ret = HGBASE_ERR_FAIL;
+ if (nullptr != m_devUser)
+ {
+ ret = m_devUser->StartScan();
+ }
+
+ if (ret != HGBASE_ERR_OK)
{
- m_dialogLog->updateStatus(dev_que_.is_online() && 0 != m_scanType, m_isScanning);
m_wndStatusBar->setDeviceStatusInfo(tr("start failed"), true);
- m_dialogLog->addLog(tr("start failed") + "(" + QString(sane_err_desc(ret)) + ")", true);
HGBase_WriteInfo(HGBASE_INFOTYPE_ERROR, "%s", getStdString(tr("start failed")).c_str());
-
- if(ret == SCANNER_ERR_DEVICE_SLEEPING)
- {
- ui->menu_scan->setEnabled(false);
- ui->act_acquire->setEnabled(false);
- ui->act_scannerSettings->setEnabled(false);
- m_dialogLog->updateStatus(false, false);
- m_dialogLog->show();
-
- if (m_devVersionNum < "G4393B1001"
- && ("439" == m_devPid || "9220" == m_devPid || "8529" == m_devPid))
- {
- m_dialogLog->addLog(tr("Please wake up the device manually"), true);
- m_wndStatusBar->setDeviceStatusInfo(tr("Please wake up the device manually"), true);
- }
- else
- {
- QTime curTimer = QTime::currentTime().addMSecs(10000);
- while (QTime::currentTime() < curTimer)
- {
- QCoreApplication::processEvents(QEventLoop::AllEvents, 100);
- }
-
- m_dialogLog->addLog(tr("already waked up device"), false);
- m_wndStatusBar->setDeviceStatusInfo(tr("already waked up device"), false);
- }
-
- ui->menu_scan->setEnabled(true);
- ui->act_acquire->setEnabled(true);
- ui->act_scannerSettings->setEnabled(true);
- m_dialogLog->updateStatus(true, false);
- }
}
else
{
m_isScanning = true;
m_thumb->setAcceptDrops(false);
- m_dialogLog->updateStatus(dev_que_.is_online() && 0 != m_scanType, m_isScanning);
updateActionStatus();
}
-
- m_dialogLog->show();
}
}
@@ -3735,7 +2950,7 @@ void MainWindow::on_act_insertFromScanner_triggered()
return;
}
- if (!dev_que_.is_online() || m_isScanning)
+ if (m_isScanning)
{
return;
}
@@ -3769,56 +2984,23 @@ void MainWindow::on_act_insertFromScanner_triggered()
startSaveMessageBox(this);
- m_dpi = getDpi();
- SANE_Status ret = sane_start(dev_que_.handle());
- if (ret != SANE_STATUS_GOOD)
+ HGResult ret = HGBASE_ERR_FAIL;
+ if (nullptr != m_devUser)
+ {
+ ret = m_devUser->StartScan();
+ }
+
+ if (ret != HGBASE_ERR_OK)
{
- m_dialogLog->updateStatus(dev_que_.is_online() && 0 != m_scanType, m_isScanning);
m_wndStatusBar->setDeviceStatusInfo(tr("start failed"), true);
- m_dialogLog->addLog(tr("start failed") + "(" + QString(sane_err_desc(ret)) + ")", true);
HGBase_WriteInfo(HGBASE_INFOTYPE_ERROR, "%s", getStdString(tr("start failed")).c_str());
-
- if(ret == SCANNER_ERR_DEVICE_SLEEPING)
- {
- ui->menu_scan->setEnabled(false);
- ui->act_acquire->setEnabled(false);
- ui->act_scannerSettings->setEnabled(false);
- m_dialogLog->updateStatus(false, false);
- m_dialogLog->show();
-
- if (m_devVersionNum < "G4393B1001"
- && ("439" == m_devPid || "9220" == m_devPid || "8529" == m_devPid))
- {
- m_dialogLog->addLog(tr("Please wake up the device manually"), true);
- m_wndStatusBar->setDeviceStatusInfo(tr("Please wake up the device manually"), true);
- }
- else
- {
- QTime curTimer = QTime::currentTime().addMSecs(10000);
- while (QTime::currentTime() < curTimer)
- {
- QCoreApplication::processEvents(QEventLoop::AllEvents, 100);
- }
-
- m_dialogLog->addLog(tr("already waked up device"), false);
- m_wndStatusBar->setDeviceStatusInfo(tr("already waked up device"), false);
- }
-
- ui->menu_scan->setEnabled(true);
- ui->act_acquire->setEnabled(true);
- ui->act_scannerSettings->setEnabled(true);
- m_dialogLog->updateStatus(true, false);
- }
}
else
{
m_isScanning = true;
m_thumb->setAcceptDrops(false);
- m_dialogLog->updateStatus(dev_que_.is_online() && 0 != m_scanType, m_isScanning);
updateActionStatus();
}
-
- m_dialogLog->show();
}
}
@@ -3906,35 +3088,7 @@ void MainWindow::on_act_imageEdit_triggered()
}
}
-bool MainWindow::open_scanner(const QString& name, const QString& scheme)
-{
- bool ret = dev_que_.open_scanner(name.toStdString().c_str(), scheme.toStdString().c_str()) == SANE_STATUS_GOOD;
- QString info(tr("open scanner ") + " " + name + " ");
-
- if(ret)
- {
- m_currDeviceName = name;
- info += tr("success");
- m_wndStatusBar->setDeviceStatusInfo(info, false);
- m_dialogLog->addLog(info, false);
- HGBase_WriteInfo(HGBASE_INFOTYPE_DESC, "%s", getStdString(info).c_str());
-
- m_wndStatusBar->setDeviceStatusInfo(tr("be ready"), false);
- }
- else
- {
- info += tr("failed");
- m_wndStatusBar->setDeviceStatusInfo(info, true);
- m_dialogLog->addLog(info, true);
- HGBase_WriteInfo(HGBASE_INFOTYPE_ERROR, "%s", getStdString(info).c_str());
- }
-
- m_dialogLog->updateStatus(dev_que_.is_online() && 0 != m_scanType, m_isScanning);
- updateActionStatus();
- return ret;
-}
-
-bool MainWindow::judgeDiskSpace(QString currentPath, bool showDlg)
+bool MainWindow::judgeDiskSpace(QString currentPath)
{
QStorageInfo storage = QStorageInfo::root();
storage.refresh();
@@ -3943,18 +3097,20 @@ bool MainWindow::judgeDiskSpace(QString currentPath, bool showDlg)
qint64 available_size = 0;
available_size = storage.bytesAvailable()/1024/1024;
- if(available_size < 64)
+ if(available_size < 1024)
{
- if (showDlg)
+ HGBase_WriteInfo(HGBASE_INFOTYPE_ERROR, "disk space is unsufficient!");
+ QMessageBox msg(QMessageBox::Warning, tr("tips"), tr("Detected that there is less than 1GB of disk space. Do you want to continue?"),
+ QMessageBox::Yes | QMessageBox::No, this);
+ msg.exec();
+ if (msg.clickedButton() == msg.button(QMessageBox::Yes))
{
- QString info = tr("the disk space in the current path is unsufficient, please select a new path or clear the disk space in time.");
- m_wndStatusBar->setDeviceStatusInfo(info, true);
- m_dialogLog->addLog(info, true);
- HGBase_WriteInfo(HGBASE_INFOTYPE_ERROR, "disk space is unsufficient!");
- QMessageBox::warning(this, tr("warning"), info);
+ return true;
+ }
+ else
+ {
+ return false;
}
-
- return false;
}
return true;
}
@@ -4168,7 +3324,6 @@ bool MainWindow::isLimitAccessFolder(int type)
}
QMessageBox::critical(this, tr("error"), info);
- m_dialogLog->addLog(info, true);
m_wndStatusBar->setDeviceStatusInfo(info, true);
return false;
}
@@ -4347,48 +3502,6 @@ void MainWindow::deleteUpgradePkg(const QString &cfgFilePath)
}
}
-QString MainWindow::getDevPid()
-{
- VIDPID vidpid;
- int vidpid_val;
- unsigned int len = sizeof(int);
- sane_io_control(dev_que_.handle(), IO_CTRL_CODE_GET_VIDPID, &vidpid_val, &len);
- vidpid.Value = vidpid_val;
- int vid = vidpid.VID;
- int pid = vidpid.PID;
- char buf[10];
- char buf2[10];
- sprintf(buf, "%x", vid);
- sprintf(buf2, "%x", pid);
- return QString::fromStdString(buf2);
-}
-
-QString MainWindow::getDevSerialNum()
-{
- std::string serialNum;
- unsigned int serialNumLen = 0;
- if(SANE_STATUS_NO_MEM == sane_io_control(dev_que_.handle(), IO_CTRL_CODE_GET_SERIAL, nullptr, &serialNumLen)
- && serialNumLen)
- {
- serialNum.resize(serialNumLen);
- sane_io_control(dev_que_.handle(), IO_CTRL_CODE_GET_SERIAL, &serialNum[0], &serialNumLen);
- }
- return QString::fromStdString(serialNum.c_str());
-}
-
-QString MainWindow::getDevFwVersionNum()
-{
- std::string versionNum;
- unsigned int versionNumLen = 0;
- if(SANE_STATUS_NO_MEM == sane_io_control(dev_que_.handle(), IO_CTRL_CODE_GET_HARDWARE_VERSION, nullptr, &versionNumLen)
- && versionNumLen)
- {
- versionNum.resize(versionNumLen);
- sane_io_control(dev_que_.handle(), IO_CTRL_CODE_GET_HARDWARE_VERSION, &versionNum[0], &versionNumLen);
- }
- return QString::fromStdString(versionNum.c_str());
-}
-
void MainWindow::initAcquireIntoComboBox()
{
m_cbtn_acquireIntoCfg = new QComboBox;
@@ -4433,67 +3546,9 @@ void MainWindow::updateSideBar()
m_propertyAnimation2->setDuration(600);
}
-void MainWindow::on_scanOptions_changed(const QString &device, const QString &option, bool checked_now)
-{
- QString title(tr("app name"));
- if(checked_now)
- {
- std::string curdev(dev_que_.opened_scanner_name());
- int ret = 0;
- if(curdev != device.toStdString())
- {
- //ret = dev_que_.open_scanner(device.toStdString().c_str(), option.toStdString().c_str());
- open_scanner(device, option);
- return;
- }
- else {
- ret = dev_que_.apply_scheme(option.toStdString().c_str());
- }
-
- QString info(tr("apply setting") + " '" + option + "' ");
- if(ret == 0)
- {
- info += tr("success");
- }
- else
- {
- ui->menu_device->setOptionChecked(device, option, false);
- info += tr("failed");
- }
-
- m_wndStatusBar->setDeviceStatusInfo(info, ret != 0);
- m_dialogLog->addLog(info, ret != 0);
- HGBase_WriteInfo(ret != 0 ? HGBASE_INFOTYPE_ERROR : HGBASE_INFOTYPE_DESC, "%s", getStdString(info).c_str());
- title = device + "(" + option + ")";
- }
- else
- {
- QMessageBox msg(QMessageBox::Question, title,
- tr("Are you sure to close ") + device + tr(" ?"),
- QMessageBox::Yes | QMessageBox::No, this);
- msg.exec();
- if(msg.clickedButton() == msg.button(QMessageBox::Yes))
- {
- dev_que_.close_scanner();
- m_versionDll->PostDeviceCloseInfo(device.toStdString().c_str(), m_devSerialNum.toStdString().c_str(), "", m_devVersionNum.toStdString().c_str());
-
- m_dialogLog->addLog(tr("close ") + device, false);
- m_wndStatusBar->setDeviceStatusInfo(tr("close ") + device, false);
- }
- else {
- ui->menu_device->setOptionChecked(device, option, true);
- return;
- }
- }
-
- m_dialogLog->updateStatus(dev_que_.is_online() && 0 != m_scanType, m_isScanning);
- updateActionStatus();
- // setWindowTitle(title);
-}
-
void MainWindow::on_act_sortPages_triggered()
{
- if (dev_que_.is_online() && m_isScanning)
+ if (m_isScanning)
{
return;
}
@@ -4586,38 +3641,38 @@ void MainWindow::on_act_feedback_triggered()
void MainWindow::on_act_driver_log_triggered()
{
- char log_file_path[260] = {0};
- unsigned int type = SANE_LogFileType::LOG_FILE_DRIVER;
- SANE_Status statu = sane_io_control(dev_que_.handle(), IO_CTRL_CODE_GET_LOG_FILE, log_file_path, &type);
- if(statu == SANE_STATUS_GOOD)
- {
- if(log_file_path[0])
- QDesktopServices::openUrl(QUrl::fromLocalFile(log_file_path));
- }
- else {
- if(statu == SANE_STATUS_UNSUPPORTED) // 鐠佹儳顦稉宥嗘暜閹镐浇顕氶幙宥勭稊
- QMessageBox::information(this, windowTitle(), tr("The device does not support this operation"));
- else
- QMessageBox::information(this, windowTitle(), tr("IO error")); // IO闁挎瑨顕?
- }
+// char log_file_path[260] = {0};
+// unsigned int type = SANE_LogFileType::LOG_FILE_DRIVER;
+// SANE_Status statu = sane_io_control(dev_que_.handle(), IO_CTRL_CODE_GET_LOG_FILE, log_file_path, &type);
+// if(statu == SANE_STATUS_GOOD)
+// {
+// if(log_file_path[0])
+// QDesktopServices::openUrl(QUrl::fromLocalFile(log_file_path));
+// }
+// else {
+// if(statu == SANE_STATUS_UNSUPPORTED) // 鐠佹儳顦稉宥嗘暜閹镐浇顕氶幙宥勭稊
+// QMessageBox::information(this, windowTitle(), tr("The device does not support this operation"));
+// else
+// QMessageBox::information(this, windowTitle(), tr("IO error")); // IO闁挎瑨顕?
+// }
}
void MainWindow::on_act_device_log_triggered()
{
- char log_file_path[260] = {0};
- unsigned int type = SANE_LogFileType::LOG_FILE_DEVICE;
- SANE_Status statu = sane_io_control(dev_que_.handle(), IO_CTRL_CODE_GET_LOG_FILE, log_file_path, &type);
- if(statu == SANE_STATUS_GOOD)
- {
- if(log_file_path[0])
- QDesktopServices::openUrl(QUrl::fromLocalFile(log_file_path));
- }
- else {
- if(statu == SANE_STATUS_UNSUPPORTED)
- QMessageBox::information(this, windowTitle(), tr("The device does not support this operation"));
- else
- QMessageBox::information(this, windowTitle(), tr("IO error"));
- }
+// char log_file_path[260] = {0};
+// unsigned int type = SANE_LogFileType::LOG_FILE_DEVICE;
+// SANE_Status statu = sane_io_control(dev_que_.handle(), IO_CTRL_CODE_GET_LOG_FILE, log_file_path, &type);
+// if(statu == SANE_STATUS_GOOD)
+// {
+// if(log_file_path[0])
+// QDesktopServices::openUrl(QUrl::fromLocalFile(log_file_path));
+// }
+// else {
+// if(statu == SANE_STATUS_UNSUPPORTED)
+// QMessageBox::information(this, windowTitle(), tr("The device does not support this operation"));
+// else
+// QMessageBox::information(this, windowTitle(), tr("IO error"));
+// }
}
@@ -4700,3 +3755,23 @@ void MainWindow::on_act_deleteFile_triggered()
m_thumb->removeItems(selectIndexs, HGImgThumb::ThumbRemoveFlag_Delete);
}
}
+
+void MainWindow::on_act_selectDevice_triggered()
+{
+ if (nullptr != m_devUser)
+ {
+ disconnect(m_devUser, SIGNAL(newImage(void*)), this, SLOT(on_newImage(void*)));
+ disconnect(m_devUser, SIGNAL(finishScan()), this, SLOT(on_finishScan()));
+ delete m_devUser;
+ m_devUser = nullptr;
+ }
+
+ DeviceUser *devUser = m_devUserMgr->OpenDeviceUser();
+ if (devUser != nullptr)
+ {
+ m_devUser = devUser;
+ m_wndStatusBar->setDeviceStatusInfo(tr("Device %1 is open").arg(m_devUser->GetName()), false);
+ connect(m_devUser, SIGNAL(newImage(void*)), this, SLOT(on_newImage(void*)));
+ connect(m_devUser, SIGNAL(finishScan()), this, SLOT(on_finishScan()));
+ }
+}
diff --git a/app/scanner/mainwindow.h b/app/scanner/mainwindow.h
index 17730ac1..aebb6f22 100644
--- a/app/scanner/mainwindow.h
+++ b/app/scanner/mainwindow.h
@@ -9,14 +9,12 @@
#include
#include "HGImgView.h"
#include "HGImgThumb.h"
-#include "sane/sane_ex.h"
#include "dialog_aquireinto.h"
#include "widget_imgproc_base.h"
#include "widget_imgproc_sidebar.h"
#include "imgfmt/HGImgFmt.h"
#include "VersionDll.h"
-#include "device_menu.h"
-#include "sane_device.h"
+#include "device_user.h"
QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; }
@@ -95,16 +93,6 @@ private slots:
void on_act_autoSave_triggered();
-signals:
- void sane_dev_arrive(QString devName, bool opened);
- void sane_dev_remove(QString devName);
- void sane_dev_error(QString errorInfo);
- void sane_dev_readyStatus(QString promptInfo);
- void pre_new_image(void *img);
- void post_new_image(unsigned int ret, int statu);
- void scan_working(QString workingInfo);
- void scan_finish(QString finishInfo, int err);
-
private slots:
void on_AcquireInto2();
void on_reloadAcquireIntoCfg();
@@ -125,18 +113,8 @@ private slots:
void on_dialog_multirotate_refreshImgFile(const QString &fileName);
void on_multiPageLineEditFinished();
void on_clearCache();
- void on_sane_dev_arrive(QString devName, bool opened);
- void on_sane_dev_remove(QString devName);
- void on_sane_dev_error(QString errorInfo);
- void on_sane_dev_readyStatus(QString promptInfo);
- void on_pre_new_image(void *img);
- void on_post_new_image(unsigned int ret, int statu);
- void on_scan_working(QString workingInfo);
- void on_scan_finish(QString finishInfo, int err);
- void on_export_scanned_image(void);
- void on_continueScan();
- void on_stopScan();
- void on_statusInfoDblClick();
+ void on_newImage(void *image);
+ void on_finishScan();
void on_wrong_image_decide(dialog_wrong_img* dlg, bool save);
void on_m_pbtn_push_clicked();
void on_dialog_sideBar_applyToImage(HGImage img, int brightness, int contrast, double gamma, bool enhanceText);
@@ -216,8 +194,6 @@ private slots:
void on_act_imageEdit_triggered();
- void on_scanOptions_changed(const QString &device, const QString &option, bool checked_now);
-
void on_act_sortPages_triggered();
void on_actionact_update_triggered();
@@ -234,18 +210,15 @@ private slots:
void on_act_deleteFile_triggered();
-public slots:
- void my_url_handler(const QUrl& url);
+ void on_act_selectDevice_triggered();
protected:
virtual void closeEvent(QCloseEvent *e) override;
virtual void resizeEvent(QResizeEvent *e) override;
private:
- static int sane_ex_callback(SANE_Handle hdev, int code, void *data, unsigned int* len, void *param);
static void HGAPI CrashFunc(HGPointer crashAddr, HGPointer param);
- HGUInt getDpi();
QString getCacheFileName(HGImage img);
HGImage createImage();
int getMultiPageCount();
@@ -255,21 +228,19 @@ private:
askIfClear startScanMessageBox(QWidget* parent);
QString passwordEncrypt(const QString& password);
QString passwordDecrypt(const QString& transcode);
- bool open_scanner(const QString& name, const QString& scheme);
- bool judgeDiskSpace(QString currentPath, bool showDlg = true);
+ bool judgeDiskSpace(QString currentPath);
void upgradeApp(QString pkgPath);
bool isLimitAccessFolder(int type); //type:1-aquire,2-aquireInto
static QString GetDevType(const QString& fwVersion, bool &canLock);
void deleteOverdueLogFile(const QString& logFilePath);
void deleteUpgradePkg(const QString& cfgFilePath);
- QString getDevPid();
- QString getDevSerialNum();
- QString getDevFwVersionNum();
void initAcquireIntoComboBox();
void updateSideBar();
private:
Ui::MainWindow *ui;
+ DeviceUserMgr *m_devUserMgr;
+ DeviceUser *m_devUser;
QAction *m_act_acquireInto2;
QComboBox *m_cbtn_acquireIntoCfg;
QString m_currLang;
@@ -291,10 +262,8 @@ private:
QPropertyAnimation *m_propertyAnimation;
QPropertyAnimation *m_propertyAnimation2;
- dev_que dev_que_;
-
- bool auto_save_changes_;
- bool save_from_changed_;
+ bool auto_save_changes_;
+ bool save_from_changed_;
typedef struct _save_opt
{
QString path;
@@ -349,7 +318,6 @@ private:
class HGLineEdit* m_multiPageLineEdit;
class Widget_StatusBar *m_wndStatusBar;
- class dialog_log *m_dialogLog;
class Dialog_AquireInto *m_dialogAcquireinto;
class Dialog_FullScreen *m_dlgFullScreen;
};
diff --git a/app/scanner/mainwindow.ui b/app/scanner/mainwindow.ui
index 30aa63f4..3fc4ab3e 100644
--- a/app/scanner/mainwindow.ui
+++ b/app/scanner/mainwindow.ui
@@ -69,6 +69,7 @@
menu_scan
+
@@ -168,13 +169,7 @@
-
-
@@ -630,14 +625,12 @@
act_enhanceText
+
+
+ act_selectDevice
+
+
-
-
- device_menu
- QMenu
-
-
-
diff --git a/app/scanner/ocrPdf.cpp b/app/scanner/ocrPdf.cpp
deleted file mode 100644
index ffd511c8..00000000
--- a/app/scanner/ocrPdf.cpp
+++ /dev/null
@@ -1,148 +0,0 @@
-#include
-#include "base/HGBase.h"
-#ifdef HG_CMP_MSC
-#include
-#endif
-#include
-#include "base/HGUtility.h"
-
-std::string getOcrPath()
-{
- std::string ocrPath;
-#ifdef HG_CMP_MSC
- HKEY hKey = NULL;
-#ifdef _WIN64
- RegOpenKeyExA(HKEY_LOCAL_MACHINE, "SOFTWARE\\WOW6432Node\\Microtek\\Microtek OCR Engine V1", 0, KEY_QUERY_VALUE, &hKey);
-#else
- RegOpenKeyExA(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microtek\\Microtek OCR Engine V1", 0, KEY_QUERY_VALUE, &hKey);
-#endif
- if (NULL != hKey)
- {
- CHAR szData[MAX_PATH] = { 0 };
- DWORD cbData = MAX_PATH;
- if (ERROR_SUCCESS == RegQueryValueExA(hKey, "InstallPath_Fast", NULL, NULL, (LPBYTE)szData, &cbData))
- {
- ocrPath = szData;
- }
-
- RegCloseKey(hKey);
- }
-#endif
- return ocrPath;
-}
-
-bool createOcrPdf(const std::string &imgPath, const std::string &dstFile, int languageType)
-{
-#ifdef HG_CMP_MSC
- std::string ocrPath = getOcrPath();
- if (ocrPath.empty())
- return false;
-
- DWORD len1 = GetEnvironmentVariableA("Path", NULL, 0);
- char* env1 = (char *)malloc((size_t)len1 + 256);
- if (NULL != env1)
- {
- memset(env1, 0, (size_t)len1 + 256);
- GetEnvironmentVariableA("Path", env1, len1 + 256);
- std::string ss(env1);
- if (ss.find(ocrPath) == std::string::npos)
- {
- strcat(env1, ";");
- strcat(env1, ocrPath.c_str());
- SetEnvironmentVariableA("Path", env1);
- }
-
- free(env1);
- }
-
- char env2[256] = {0};
- strcat(env2, ocrPath.c_str());
- strcat(env2, "\\");
- strcat(env2, "tessdata_f");
- SetEnvironmentVariableA("TESSDATA_PREFIX", env2);
-
-
- DeleteFileA(dstFile.c_str());
-
-
- const int MY_PIPE_BUFFER_SIZE = 1024;
- //初始化管道
- HANDLE hPipeRead = NULL;
- HANDLE hPipeWrite = NULL;
- SECURITY_ATTRIBUTES saOutPipe;
- ::ZeroMemory(&saOutPipe, sizeof(saOutPipe));
- saOutPipe.nLength = sizeof(SECURITY_ATTRIBUTES);
- saOutPipe.lpSecurityDescriptor = NULL;
- saOutPipe.bInheritHandle = TRUE;
- CreatePipe(&hPipeRead, &hPipeWrite, &saOutPipe, MY_PIPE_BUFFER_SIZE);
-
-
- PROCESS_INFORMATION ProcessInfo;
- ::ZeroMemory(&ProcessInfo, sizeof(ProcessInfo));
- STARTUPINFOA StartupInfo;
- ZeroMemory(&StartupInfo, sizeof(StartupInfo));
- StartupInfo.cb = sizeof(StartupInfo);
- StartupInfo.dwFlags = STARTF_USESTDHANDLES | STARTF_USESHOWWINDOW;
- StartupInfo.hStdOutput = hPipeWrite;
- StartupInfo.hStdError = hPipeWrite;
- StartupInfo.wShowWindow = SW_HIDE;
-
- HGChar prefix[256];
- HGBase_GetFilePrefix(dstFile.c_str(), prefix, 256);
-
- bool ret = false;
- char cmd[1024] = {0};
-
- if (0 == languageType)
- {
- sprintf(cmd, "tesseract.exe \"%s\" \"%s\" -l %s --psm %d --oem %d %s", imgPath.c_str(), prefix, "eng", 3, 3, "pdf");
- }
- else if (1 == languageType)
- {
- sprintf(cmd, "tesseract.exe \"%s\" \"%s\" -l %s --psm %d --oem %d %s", imgPath.c_str(), prefix, "chi_sim", 3, 3, "pdf");
- }
- else if (2 == languageType)
- {
- sprintf(cmd, "tesseract.exe \"%s\" \"%s\" -l %s --psm %d --oem %d %s", imgPath.c_str(), prefix, "chi_tra", 3, 3, "pdf");
- }
- else if (3 == languageType)
- {
- sprintf(cmd, "tesseract.exe \"%s\" \"%s\" -l %s --psm %d --oem %d %s", imgPath.c_str(), prefix, "jpn", 3, 3, "pdf");
- }
- else if (4 == languageType)
- {
- sprintf(cmd, "tesseract.exe \"%s\" \"%s\" -l %s --psm %d --oem %d %s", imgPath.c_str(), prefix, "kor", 3, 3, "pdf");
- }
-
- BOOL b = CreateProcessA(NULL, cmd, NULL, NULL, TRUE, CREATE_NO_WINDOW, NULL, NULL, &StartupInfo, &ProcessInfo);
- if (b)
- {
- WaitForSingleObject(ProcessInfo.hProcess, INFINITE);
- DWORD exitCode;
- GetExitCodeProcess(ProcessInfo.hProcess, &exitCode);
- if (0 == exitCode)
- ret = true;
-
- DWORD dwReadLen = 0;
- DWORD dwStdLen = 0;
- if (PeekNamedPipe(hPipeRead, NULL, 0, NULL, &dwReadLen, NULL) && dwReadLen > 0)
- {
- char szPipeOut[MY_PIPE_BUFFER_SIZE];
- ::ZeroMemory(szPipeOut, sizeof(szPipeOut));
- if (ReadFile(hPipeRead, szPipeOut, dwReadLen, &dwStdLen, NULL))
- {
-
- }
- }
-
- CloseHandle(ProcessInfo.hProcess);
- CloseHandle(ProcessInfo.hThread);
- }
-
- CloseHandle(hPipeRead);
- CloseHandle(hPipeWrite);
- return ret;
-#else
- return false;
-#endif
-}
diff --git a/app/scanner/ocrPdf.h b/app/scanner/ocrPdf.h
deleted file mode 100644
index e500ee45..00000000
--- a/app/scanner/ocrPdf.h
+++ /dev/null
@@ -1,9 +0,0 @@
-#ifndef __OCRPDF_H__
-#define __OCRPDF_H__
-
-#include
-
-std::string getOcrPath();
-bool createOcrPdf(const std::string &imgPath, const std::string &dstFile, int languageType);//languageType is the index of the comboBox on export and save_as ui.
-
-#endif /* __OCRPDF_H__ */
diff --git a/app/scanner/sane_device.cpp b/app/scanner/sane_device.cpp
deleted file mode 100644
index c47dd61d..00000000
--- a/app/scanner/sane_device.cpp
+++ /dev/null
@@ -1,65 +0,0 @@
-#include "sane_device.h"
-
-
-sane_dev::sane_dev() : hdev_(nullptr), offline_(true), name_(""), cfg_name_("")
-{}
-sane_dev::~sane_dev()
-{
- close();
-}
-
-bool sane_dev::apply(gb::sane_config_schm* schm)
-{
- SANE_Int count = 0,
- afterdo = 0;
- bool ret = false;
-
- return ret;
-}
-
-std::string sane_dev::name(void)
-{
- return name_;
-}
-std::string sane_dev::current_configuration_name(void)
-{
- return cfg_name_;
-}
-bool sane_dev::is_online(void)
-{
- return !offline_;
-}
-SANE_Handle sane_dev::handle(void)
-{
- return hdev_;
-}
-
-bool sane_dev::open(const std::string& name)
-{
- if(name_ == name)
- return true;
-
- close();
-
- SANE_Status statu = sane_open(name.c_str(), &hdev_);
- if(statu == SANE_STATUS_GOOD)
- {
- }
-
- return statu == SANE_STATUS_GOOD;
-}
-void sane_dev::set_online(bool online)
-{
- offline_ = !online;
-}
-void sane_dev::close(void)
-{
- if(hdev_)
- {
- sane_close(hdev_);
- hdev_ = nullptr;
- }
- offline_ = true;
- name_ = "";
- cfg_name_ = "";
-}
diff --git a/app/scanner/sane_device.h b/app/scanner/sane_device.h
deleted file mode 100644
index f6071060..00000000
--- a/app/scanner/sane_device.h
+++ /dev/null
@@ -1,38 +0,0 @@
-#pragma once
-
-#include
-#include "sane/sane_ex.h"
-#include "cfg/gb_json.h"
-
-
-
-class sane_dev
-{
- SANE_Handle hdev_;
- bool offline_;
- std::string name_;
- std::string cfg_name_;
-
- enum act_result
- {
- ACT_RESULT_NO_NEED = 0,
- ACT_RESULT_FAILED,
- ACT_RESULT_SUCCESS,
- };
-
- bool apply(gb::sane_config_schm* schm);
-
-public:
- sane_dev();
- ~sane_dev();
-
-public:
- std::string name(void);
- std::string current_configuration_name(void);
- bool is_online(void);
- SANE_Handle handle(void);
-
- bool open(const std::string& name);
- void set_online(bool online);
- void close(void);
-};
diff --git a/app/scanner/setpicclrtool.cpp b/app/scanner/setpicclrtool.cpp
deleted file mode 100644
index 78597d89..00000000
--- a/app/scanner/setpicclrtool.cpp
+++ /dev/null
@@ -1,315 +0,0 @@
-#include "setpicclrtool.h"
-#include "ui_setpicclrtool.h"
-#include "widget.h"
-#include
-#include
-
-setPicClrTool::setPicClrTool(QWidget *parent) :
- QDialog(parent),
- ui(new Ui::setPicClrTool)
-{
- ui->setupUi(this);
- setMouseTracking(true);
- ui->inputEdt->setEnabled(false);
- ui->outputEdt->setEnabled(false);
- ui->inputEdt->setValidator(new QIntValidator(0, 255, this));
- ui->outputEdt->setValidator(new QIntValidator(0, 255, this));
- ui->widget->setFocus(Qt::MouseFocusReason);
- connect(ui->widget,SIGNAL(mouseCoordSig(QPoint)),this,SLOT(mouseCoordSlot(QPoint)));
- connect(ui->widget,SIGNAL(dragPointChecked(bool)),this,SLOT(lineEditEnable(bool)));
- connect(ui->widget,SIGNAL(lineChangeSig()),this,SLOT(lineChangeSlot()));
-}
-
-setPicClrTool::~setPicClrTool()
-{
- delete ui;
-}
-
-void setPicClrTool::getGrayTable(uchar *table, size_t length)
-{
- QVector gray = getGrayALLPoint();
- for (size_t i = 0; i < length; i++)
- table[i] = static_cast(gray[static_cast(i)]);
-}
-
-void setPicClrTool::getRGBTable(uchar *table, size_t length)
-{
- if (length != 768)
- throw "length is not 768.";
-
- QVector rgb = getRgbALLPoint();
- QVector red = getRedALLPoint();
- QVector green = getGreenALLPoint();
- QVector blue = getBlueALLPoint();
-
-
- for (size_t i = 0; i < 256; i++)
- {
- //if (i == 255)
- // int a = 0;
- //table member order is B\G\R
- table[i * 3 + 0] = static_cast(blue[rgb[static_cast(i)]]);
- table[i * 3 + 1] = static_cast(green[rgb[static_cast(i)]]);
- table[i * 3 + 2] = static_cast(red[rgb[static_cast(i)]]);
- }
-}
-
-//void setPicClrTool::setGrayTable(const uchar *table, size_t length)
-//{
-// QVector gray;
-// for (size_t i = 0; i < length; i++)
-// gray[static_cast(i)] = int(table[i]);
-// //ui->widget->setGrayALLPoint(gray);
-//}
-
-//void setPicClrTool::setRGBTable(const uchar *table, size_t length)
-//{
-// QVector rgb;
-// QVector red;
-// QVector green;
-// QVector blue;
-// for(int i = 0; i < 256; i++){
-// rgb.append(i);
-// }
-// for (size_t i = 0; i < length; i++){
-// red.append(int(table[i * 3 + 0]));
-// green.append(int(table[i * 3 + 1]));
-// blue.append(int(table[i * 3 + 2]));
-// }
-
-//}
-
-void setPicClrTool::setColorMode(int colorMode)
-{
- QVariant v(6);
- if(colorMode == 0)
- {
- ui->colorSetCmb->setItemData(1,v,Qt::UserRole - 1);
- }
- else
- {
- ui->comboBox->setItemData(2,v,Qt::UserRole - 1);
- ui->colorSetCmb->setItemData(0,v,Qt::UserRole - 1);
- ui->colorSetCmb->setItemData(2,v,Qt::UserRole - 1);
- ui->colorSetCmb->setItemData(3,v,Qt::UserRole - 1);
- ui->colorSetCmb->setItemData(4,v,Qt::UserRole - 1);
- ui->colorSetCmb->setCurrentIndex(1);
- }
-}
-
-QVector > setPicClrTool::getRGBKeyTable()
-{
- QVector> plv;
- plv.append(getRgbKeyPoint());
- plv.append(getRedKeyPoint());
- plv.append(getGreenKeyPoint());
- plv.append(getBlueKeyPoint());
- return plv;
-}
-
-void setPicClrTool::setRGBKeyTable(QVector > &plv)
-{
- setRgbKeyPoint(plv[0]);
- setRedKeyPoint(plv[1]);
- setGreenKeyPoint(plv[2]);
- setBlueKeyPoint(plv[3]);
-}
-
-QList setPicClrTool::getGrayKeyTable()
-{
- return getGrayKeyPoint();
-}
-
-void setPicClrTool::setGrayKeyTable(QList &plv)
-{
- setGrayKeyPoint(plv);
-}
-
-QVector setPicClrTool::getRgbALLPoint()
-{
- return ui->widget->getRgbALLPoint();
-}
-
-QList setPicClrTool::getRgbKeyPoint() const
-{
- qDebug() << "setRgb" << ui->widget->getRgbKeyPoint();
- return ui->widget->getRgbKeyPoint();
-}
-
-void setPicClrTool::setRgbKeyPoint(const QList &pVec)
-{
- qDebug() << "setRgb" << pVec;
- ui->widget->setRgbKeyPoint(pVec);
-}
-
-QList setPicClrTool::getRedKeyPoint() const
-{
- return ui->widget->getRedKeyPoint();
-}
-
-void setPicClrTool::setRedKeyPoint(const QList &pVec)
-{
- ui->widget->setRedKeyPoint(pVec);
-}
-
-QList setPicClrTool::getBlueKeyPoint() const
-{
- return ui->widget->getBlueKeyPoint();
-}
-
-void setPicClrTool::setBlueKeyPoint(const QList &pVec)
-{
- ui->widget->setBlueKeyPoint(pVec);
-}
-
-QList setPicClrTool::getGreenKeyPoint() const
-{
- return ui->widget->getGreenKeyPoint();
-}
-
-void setPicClrTool::setGreenKeyPoint(const QList &pVec)
-{
- ui->widget->setGreenKeyPoint(pVec);
-}
-
-QList setPicClrTool::getGrayKeyPoint() const
-{
- return ui->widget->getGrayKeyPoint();
-}
-
-void setPicClrTool::setGrayKeyPoint(const QList &pVec)
-{
- ui->widget->setGrayKeyPoint(pVec);
-}
-
-QVector setPicClrTool::getRedALLPoint()
-{
- return ui->widget->getRedALLPoint();
-}
-
-QVector setPicClrTool::getBlueALLPoint()
-{
- return ui->widget->getBlueALLPoint();
-}
-
-QVector setPicClrTool::getGreenALLPoint()
-{
- return ui->widget->getGreenALLPoint();
-}
-
-QVector setPicClrTool::getGrayALLPoint()
-{
- return ui->widget->getGrayALLPoint();
-}
-
-void setPicClrTool::mouseCoordSlot(QPoint pos)
-{
- ui->inputEdt->setText(QString::number(pos.x()));
- ui->outputEdt->setText(QString::number(pos.y()));
-}
-
-void setPicClrTool::lineEditEnable(bool a)
-{
- ui->inputEdt->setEnabled(a);
- ui->outputEdt->setEnabled(a);
-}
-
-void setPicClrTool::lineChangeSlot()
-{
- ui->comboBox->setCurrentIndex(0);
-}
-
-void setPicClrTool::on_colorSetCmb_currentIndexChanged(int index)
-{
- (void)index;
- /* switch(index){
- case RED:
- ui->widget->updateCurLinePnt(RED);
- break;
- case GREEN:
- ui->widget->updateCurLinePnt(GREEN);
- break;
- case BLUE:
- ui->widget->updateCurLinePnt(BLUE);
- break;
- case RGB:
- ui->widget->updateCurLinePnt(RGB);
- break;
- case GRAY:
- ui->widget->updateCurLinePnt(GRAY);
- break;
- }*/
-}
-
-void setPicClrTool::on_comboBox_currentIndexChanged(int index)
-{
- if(index == 0){
- ui->widget->initAllLstPnt();
- ui->widget->updateCurLinePnt(ui->colorSetCmb->currentIndex());
- return ;
- }
- ui->widget->initAllLstPnt();
- if(index == 1){
- rgbLine.clear();
- rgbLine.append(QPoint(0,255));
- rgbLine.append(QPoint(255,0));
- ui->widget->setLstPnt_RGB(rgbLine);
- }else if(index == 2){
- redLine.clear();
- redLine.append(QPoint(33,255));
- redLine.append(QPoint(185,0));
- redLine.append(QPoint(119,127));
- greenLine.clear();
- greenLine.append(QPoint(28,255));
- greenLine.append(QPoint(132,0));
- greenLine.append(QPoint(77,127));
- blueLine.clear();
- blueLine.append(QPoint(25,255));
- blueLine.append(QPoint(108,0));
- blueLine.append(QPoint(60,127));
- ui->widget->setLstPnt_RED(redLine);
- ui->widget->setLstPnt_GREEN(greenLine);
- ui->widget->setLstPnt_BLUE(blueLine);
- }else if(index == 4){
- rgbLine.clear();
- rgbLine.append(QPoint(0,0));
- rgbLine.append(QPoint(255,255));
- rgbLine.append(QPoint(103,125));
- ui->widget->setLstPnt_RGB(rgbLine);
- }else if(index == 3){
- rgbLine.clear();
- rgbLine.append(QPoint(0,0));
- rgbLine.append(QPoint(255,255));
- rgbLine.append(QPoint(130,101));
- ui->widget->setLstPnt_RGB(rgbLine);
- }
- ui->widget->updateCurLinePnt(ui->colorSetCmb->currentIndex());
-}
-
-void setPicClrTool::on_inputEdt_textChanged(const QString &arg1)
-{
- ui->widget->setXCoorVal(arg1.toInt());
-}
-
-void setPicClrTool::on_outputEdt_textChanged(const QString &arg1)
-{
- ui->widget->setYCoorVal(arg1.toInt());
-}
-
-void setPicClrTool::on_pushButton_clicked()
-{
- ui->widget->initSelectColLine(ui->colorSetCmb->currentIndex());
-}
-
-void setPicClrTool::on_buttonBox_accepted()
-{
- //close();
- accept();
-}
-
-void setPicClrTool::on_buttonBox_rejected()
-{
- ui->widget->initAllLstPnt();
- //close();
- reject();
-}
diff --git a/app/scanner/setpicclrtool.h b/app/scanner/setpicclrtool.h
deleted file mode 100644
index 59c4c25b..00000000
--- a/app/scanner/setpicclrtool.h
+++ /dev/null
@@ -1,82 +0,0 @@
-#ifndef SETPICCLRTOOL_H
-#define SETPICCLRTOOL_H
-
-//#include "colorlinesetdef.h"
-#include
-
-namespace Ui {
-class setPicClrTool;
-}
-
-class setPicClrTool : public QDialog
-{
- Q_OBJECT
-
-public:
- explicit setPicClrTool(QWidget *parent = nullptr);
- ~setPicClrTool();
-
- void getGrayTable(uchar* table, size_t length = 256);
-
- void getRGBTable(uchar* table, size_t length = 768);
-
-// void setGrayTable(const uchar* table, size_t length = 256);
-
-// void setRGBTable(const uchar* table, size_t length = 768);
-
- void setColorMode(int colorMode);
-
- QVector> getRGBKeyTable();
- void setRGBKeyTable(QVector>& plv);
- QList getGrayKeyTable();
- void setGrayKeyTable(QList &plv);
-
-
-private:
- QVector getRgbALLPoint();
- QVector getRedALLPoint();
- QVector getBlueALLPoint();
- QVector getGreenALLPoint();
- QVector getGrayALLPoint();
-
- QList getRgbKeyPoint()const;
- void setRgbKeyPoint(const QList& pVec);
- QList getRedKeyPoint()const;
- void setRedKeyPoint(const QList& pVec);
- QList getBlueKeyPoint()const;
- void setBlueKeyPoint(const QList& pVec);
- QList getGreenKeyPoint()const;
- void setGreenKeyPoint(const QList& pVec);
- QList getGrayKeyPoint()const;
- void setGrayKeyPoint(const QList& pVec);
-
-private slots:
- void mouseCoordSlot(QPoint);//set QLineEdit value by QPoint setting
- void lineEditEnable(bool);//set 2 LineEdit enable status
- void lineChangeSlot();
-
- void on_colorSetCmb_currentIndexChanged(int index);
-
- void on_comboBox_currentIndexChanged(int index);
-
- void on_inputEdt_textChanged(const QString &arg1);
-
- void on_outputEdt_textChanged(const QString &arg1);
-
- void on_pushButton_clicked();
-
- void on_buttonBox_accepted();
-
- void on_buttonBox_rejected();
-
-private:
- Ui::setPicClrTool *ui;
- QList linePoint;
- QList greenLine;
- QList redLine;
- QList blueLine;
- QList rgbLine;
- QList grayLine;
-};
-
-#endif // SETPICCLRTOOL_H
diff --git a/app/scanner/setpicclrtool.ui b/app/scanner/setpicclrtool.ui
deleted file mode 100644
index 5ba412a6..00000000
--- a/app/scanner/setpicclrtool.ui
+++ /dev/null
@@ -1,167 +0,0 @@
-
-
- setPicClrTool
-
-
-
- 0
- 0
- 259
- 341
-
-
-
- 自定义色调曲线
-
-
- -
-
-
-
-
-
-
-
- 自定义
-
-
- -
-
- 负片(RGB)
-
-
- -
-
- 彩色负片(RGB)
-
-
- -
-
- 较暗(RGB)
-
-
- -
-
- 较亮(RGB)
-
-
-
-
-
-
- -
-
-
-
-
-
- false
-
-
-
-
- RGB
-
-
- -
-
- 灰
-
-
- -
-
- 红
-
-
- -
-
- 蓝
-
-
- -
-
- 绿
-
-
-
-
- -
-
-
- 初始化
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- 40
- 20
-
-
-
-
-
-
- -
-
-
- true
-
-
- Qt::StrongFocus
-
-
-
- -
-
-
-
-
-
- 输入:
-
-
-
- -
-
-
- true
-
-
-
- -
-
-
- 输出:
-
-
-
- -
-
-
- true
-
-
-
-
-
- -
-
-
- QDialogButtonBox::Cancel|QDialogButtonBox::Ok
-
-
-
-
-
-
-
- Widget
- QWidget
-
- 1
-
-
-
-
-
diff --git a/app/scanner/widget.cpp b/app/scanner/widget.cpp
deleted file mode 100644
index 71c943bf..00000000
--- a/app/scanner/widget.cpp
+++ /dev/null
@@ -1,855 +0,0 @@
-#include "widget.h"
-#include "ui_widget.h"
-#include "gaosixy.h"
-#include
-#include
-#include
-#include
-using namespace std;
-
-
-enum COLOR_TPYE
-{
- RGB,
- GRAY,
- RED,
- BLUE,
- GREEN
-};
-
-Widget::Widget(QWidget *parent) :
- QWidget(parent),
- ui(new Ui::Widget)
-{
- ui->setupUi(this);
- setWindowTitle(tr("zuobiaozhou")); //设置标题栏标题
- //resize(300,300); //设置窗口初始大小
- //ui->table->setWindowFlags(Qt::WindowStaysOnTopHint);
- initAllLstPnt();
- initInterface();
-}
-
-Widget::~Widget()
-{
- delete ui;
-}
-
-void Widget::setLstPnt_RGB(const QList &plst)
-{
- rgbLine = QList(plst);
-}
-
-QList Widget::getLstPnt_RGB() const
-{
- return rgbLine;
-}
-
-void Widget::setLstPnt_RED(const QList &plst)
-{
- redLine = QList(plst);
-}
-
-void Widget::setLstPnt_BLUE(const QList &plst)
-{
- blueLine = QList(plst);
-}
-
-QList Widget::getLstPnt_BLUE() const
-{
- return blueLine;
-}
-
-void Widget::setLstPnt_GREEN(const QList &plst)
-{
- greenLine = QList