diff --git a/app/scanner/Scanner_zh_CN.qm b/app/scanner/Scanner_zh_CN.qm
index d9d8d729..b8af3195 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 b1782b81..81d88145 100644
--- a/app/scanner/Scanner_zh_CN.ts
+++ b/app/scanner/Scanner_zh_CN.ts
@@ -2158,7 +2158,7 @@ bug description:
-
+
扫描至...
@@ -2383,49 +2383,49 @@ bug description:
文本增强
-
+
华高扫描软件
-
+
多列显示
-
+
移动到...
-
+
插入文件
-
+
没有发现扫描仪
-
-
-
-
-
+
+
+
+
+
询问
-
+
图像已被修改。
是否保存修改?
-
+
文件已丢失,是否删除?
@@ -2434,7 +2434,7 @@ bug description:
已连接
-
+
已断开连接
@@ -2451,17 +2451,17 @@ bug description:
扫描完成
-
+
清空并启动扫描
-
+
不清空并启动扫描
-
+
图像列表中已存在图像。
@@ -2476,12 +2476,12 @@ Do you want to clear?
磁盘空间不足,请删除不需要的文件,以保证有足够的空间
-
+
打开图片
-
+
插入图片
@@ -2494,275 +2494,275 @@ Do you want to clear?
保存失败
-
+
黑白
-
+
256级灰度
-
+
24位彩色
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
请手动唤醒设备
-
+
紫光扫描软件
-
-
+
+
默认配置方案
-
+
显示缩略图栏
-
+
隐藏缩略图栏
-
+
取消
-
-
-
+
+
+
保存成功
-
-
+
+
图片名在列表中已存在
-
+
请至少选中一张图片再进行导出
-
+
文件名
-
+
文件路径
-
+
文件大小
-
+
创建时间
-
+
修改时间
-
+
访问时间
-
+
格式
-
+
宽度
-
+
高度
-
+
深度
-
+
色彩模式
-
+
每英寸像素点
-
+
打印尺寸
-
+
帧
-
+
无
-
+
黑白
-
+
灰度
-
+
彩色
-
+
不支持
-
+
警告
-
+
设备正在运行!
请先结束扫描。
-
+
无法访问当前缓存路径:%1
请尝试在【用户】菜单登录管理员账户,前往【缓存设置】更改缓存路径。
-
+
无法访问当前缓存路径:%1
请尝试在【扫描到】更改缓存路径。
-
+
图像处理失败
-
+
OCR初始化错误
-
+
OCR错误
-
+
文件不存在
-
+
加载动态库失败
-
+
文件数据错误
-
+
图像格式处理错误
-
+
内存不足
-
+
错误
-
-
+
+
语言切换成功,下次启动软件时生效!
-
+
您确定彻底删除选中项文件?
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
已唤醒设备
-
+
就绪
@@ -2772,7 +2772,7 @@ Please finish scanning first.
请尝试在【用户】菜单登录管理员账户,前往【缓存设置】更改缓存路径
-
+
文件访问权限不足
@@ -2785,46 +2785,46 @@ Please finish scanning first.
图像处理失败
-
+
您确定要断开设备:
-
+
吗?
-
-
+
+
关闭
-
+
提示
-
+
未获取到其他版本
-
-
+
+
设备不支持该操作
-
-
+
+
IO错误
-
-
+
+
错误
@@ -2839,17 +2839,17 @@ Continue to close?
是否继续关闭?
-
+
是否确定登出管理员账户?
-
+
确认操作
-
+
你确定要清除滚轴计数吗
@@ -2858,36 +2858,36 @@ Continue to close?
请重新进入关于界面以获取最新值
-
-
+
+
-
-
+
+
-
+
滚轴张数
-
+
打开扫描仪
-
-
+
+
华高扫描软件
-
-
+
+
成功
@@ -2904,22 +2904,22 @@ Continue to close?
失败
-
-
+
+
失败
-
-
-
+
+
+
警告
-
-
-
+
+
+
当前路径磁盘空间不足,
请重新选择路径或及时清理磁盘空间。
@@ -2929,64 +2929,64 @@ Continue to close?
配置丢失
-
+
应用配置
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
+
启动失败
-
+
汉王扫描软件
-
+
立思辰扫描软件
-
+
沧田扫描软件
-
+
Microtek DocWizard EX 扫描软件
-
+
语言
-
+
简体中文
-
+
English
@@ -3001,47 +3001,47 @@ Continue to close?
切换图片时,不提醒,直接保存编辑过的图片
-
+
显示状态栏
-
+
隐藏状态栏
-
+
显示工具栏
-
+
隐藏工具栏
-
+
启用图像信息
-
+
关闭图像信息
-
+
启用自动保存
-
+
取消自动保存
-
+
切换图片时,自动保存编辑过的图像。若想取消,请取消勾选菜单项:图像->自动保存
@@ -3062,26 +3062,26 @@ Continue to close?
发现设备
-
+
重新连接
-
+
已经连接,但打开失败
-
-
+
+
存图失败:
-
-
-
-
+
+
+
+
创建文件夹失败:
@@ -3090,102 +3090,102 @@ Continue to close?
%1%2%3.%4
-
-
+
+
创建图片文件失败:
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
保存图片文件失败:
-
+
启动安装程序失败!
-
+
有图像未保存,确定关闭?
-
+
发现设备 : %1
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
提示
-
+
确定关闭应用软件?
-
+
确认操作
-
+
您确定要清除滚轴计数吗
-
-
-
+
+
+
提示
-
-
+
+
辊轴计数已置零
-
-
+
+
重置滚轴计数失败
-
+
错误
-
+
文档丢失!文档可能已被删除或被重命名。
@@ -3226,21 +3226,21 @@ Are you sure to close?
<p>%1</p><p>版本: %2<br>版权: © %3</p><p>%4%5%6%7%8%9</p>
-
-
+
+
关于 %1
-
-
+
+
<p>版本: %1</p>
<p>版本: %1</p>
-
-
+
+
<p>版权: © %1</p>
<p>版权: © %1</p>
@@ -3307,6 +3307,54 @@ Are you sure to close?
Gamma校正
+
+ Widget_Imgproc_SideBar
+
+
+
+
+
+
+
+
+ 确定
+
+
+
+
+ 取消
+
+
+
+
+ 恢复默认值
+
+
+
+
+ 文本增强
+
+
+
+
+ 应用到图像
+
+
+
+
+ 亮度
+
+
+
+
+ Gamma校正
+
+
+
+
+ 对比度
+
+
Widget_StatusBar
diff --git a/app/scanner/Scanner_zh_EN.qm b/app/scanner/Scanner_zh_EN.qm
index 92ff54b5..7a8106c4 100644
Binary files a/app/scanner/Scanner_zh_EN.qm and b/app/scanner/Scanner_zh_EN.qm differ
diff --git a/app/scanner/Scanner_zh_EN.ts b/app/scanner/Scanner_zh_EN.ts
index 6e86e597..4d8b482a 100644
--- a/app/scanner/Scanner_zh_EN.ts
+++ b/app/scanner/Scanner_zh_EN.ts
@@ -1993,7 +1993,7 @@ Please make sure the two passwords are the same.
-
+
Scan to...
@@ -2218,64 +2218,64 @@ Please make sure the two passwords are the same.
Enhance text
-
+
Hanvon scanning software
-
+
LANXUM scanning software
-
+
CUMTENN scanning software
-
+
Microtek DocWizard EX V1.0
-
+
HUAGOSCAN scanning software
-
+
Language
-
+
简体中文
-
+
English
-
+
Multi-column display
-
+
Move to...
-
+
Insert file
-
+
No scanner detected
@@ -2290,61 +2290,61 @@ Please make sure the two passwords are the same.
Do not show prompt and save the edited images directly when switching images.
-
+
Show status bar
-
+
Hide status bar
-
+
Show toolbar
-
+
Hide toolbar
-
+
Enable image information
-
+
Disable image information
-
+
Enable auto save
-
+
Cancel auto save
-
+
Save edited images automatically when switching images. If you want to cancel, please deselect the menu item: Auto save images.
-
-
-
-
-
+
+
+
+
+
Ask
-
+
Image modified, save changes?
@@ -2361,7 +2361,7 @@ Please make sure the two passwords are the same.
No
-
+
File lost; delete?
@@ -2370,414 +2370,414 @@ Please make sure the two passwords are the same.
Device discovered
-
+
Device discovered: %1
-
+
reconnect
-
+
connected, but failed to open
-
+
disconnected
-
-
-
+
+
+
Insufficient disk space for the current path.
Please reselect a path or clear disk space immediately.
-
-
-
+
+
+
Warning
-
-
+
+
Failed to save image:
-
-
-
-
+
+
+
+
Failed to create folder:
-
-
+
+
Failed to create image file:
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
Failed to save image:
-
+
Black and white
-
+
Grayscale
-
+
Color
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
+
Failed to start
-
+
UNI scanning software
-
-
+
+
Default scheme
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
Please wake up the device manually
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
Device is awake
-
+
Show thumbnail bar
-
+
Hide thumbnail bar
-
+
Clear and start scan
-
+
Do not clear and start scan
-
+
Cancel
-
+
Image already exists in the list of images.
Clear?
-
+
Open image
-
+
Insert image
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
prompt
-
-
-
+
+
+
Saved successfully
-
-
+
+
Image name already exists in the list
-
+
Please select at least one image and then export
-
+
File name
-
+
File path
-
+
File size
-
+
Creation time
-
+
Modification time
-
+
Access time
-
+
Format
-
+
Width
-
+
Height
-
+
Depth
-
+
Color mode
-
+
Pixels per inch
-
+
Print size
-
+
Frame
-
+
None
-
+
Black and white
-
+
Gray scale
-
+
Color
-
+
Not supported
-
+
Warning
-
+
Device is currently running!
Please stop scanning first.
-
+
There are unsaved images; are you sure you want to close?
-
+
Are you sure you want to close?
-
+
Are you sure you want to log out of the administrator account?
-
+
Confirm operation
-
+
Are you sure you want to clear the roller count?
-
-
-
+
+
+
Prompt
-
-
+
+
Roller count reset to zero.
-
-
+
+
Failed to reset roller count.
-
+
Error
-
+
File lost! File may be deleted or renamed.
-
+
Confirm operation
-
+
Are you sure you want to clear the roller count?
-
+
Unable to access the current path:%1
Please try to log in to the administrator account in the [User] menu and go to the [Cache settings] to change the cache path.
-
+
Unable to access the current path:%1
Please try to change the cache path in [Scan to].
@@ -2791,76 +2791,76 @@ Please try to change the cache path in [Scan to].
<p>%1</p><p>Version: %2<br>Copyright: © %3</p><p>%4%5%6%7%8%9</p>
-
-
+
+
About %1
-
-
+
+
<p>Version: %1</p>
-
-
+
+
<p>Copyright: © %1</p>
-
-
+
+
<p>%1: <a href='%2'>%3</a>
-
-
+
+
<p>%1: %2
-
+
Number of rollers
-
+
Open scanner
-
-
+
+
HUAGOSCAN scanning software
-
-
+
+
successfully
-
+
Ready
-
-
+
+
failed
-
-
+
+
Error
-
+
Failed to start!
@@ -2870,106 +2870,106 @@ Please try to change the cache path in [Scan to].
Please go to “Scan to” and change the accessible scan folder and then perform the scan.
-
+
Insufficient file access permissions
-
+
Image processing failed
-
+
OCR initialization error
-
+
OCR failed
-
+
File does not exist
-
+
Failed to load dynamic library
-
+
File data error
-
+
Image format processing error
-
+
Insufficient memory
-
+
Failed
-
+
Apply configuration
-
+
Are you sure you want to disconnect device:
-
+
?
-
-
+
+
Close
-
+
Prompt
-
+
No other versions obtained
-
-
+
+
Device does not support this operation
-
-
+
+
IO error
-
-
+
+
The language switch is successful and takes effect the next time the software is started!
-
+
Are you sure to delete the selected file completely?
@@ -3023,6 +3023,54 @@ Please go to “Scan to” and change the accessible scan folder and then perfor
Gamma correction
+
+ Widget_Imgproc_SideBar
+
+
+
+
+
+
+
+
+ OK
+
+
+
+
+ Cancel
+
+
+
+
+ Restore defaults
+
+
+
+
+ Enhance text
+
+
+
+
+ Apply to image
+
+
+
+
+ Brightness
+
+
+
+
+ Gamma correction
+
+
+
+
+ Contrast
+
+
Widget_StatusBar
diff --git a/app/scanner/mainwindow.cpp b/app/scanner/mainwindow.cpp
index 011d2620..20e482d3 100644
--- a/app/scanner/mainwindow.cpp
+++ b/app/scanner/mainwindow.cpp
@@ -82,6 +82,7 @@ MainWindow::MainWindow(const QString& appLang, QWidget *parent)
, m_currDeviceName("")
, m_cacheDirNotify(false)
, m_AquirePathNotify(false)
+ , m_bSideflag(false)
{
ui->setupUi(this);
@@ -333,6 +334,7 @@ MainWindow::MainWindow(const QString& appLang, QWidget *parent)
m_menu_imageInsert->addAction(ui->act_insertFromScanner);
ui->act_consume->setVisible(false);
+ ui->act_enhanceText->setVisible(false);
connect(this, SIGNAL(sane_dev_arrive(QString, bool)), this, SLOT(on_sane_dev_arrive(QString, bool)), Qt::QueuedConnection);
connect(this, SIGNAL(sane_dev_remove(QString)), this, SLOT(on_sane_dev_remove(QString)), Qt::QueuedConnection);
@@ -371,7 +373,6 @@ MainWindow::MainWindow(const QString& appLang, QWidget *parent)
m_dlgFullScreen = nullptr;
m_dialogLog->updateStatus(!dev_que_.opened_scanner_name().empty() && 0 != m_scanType, m_isScanning);
- updateActionStatus();
ui->act_autoSave->setChecked(getCfgValue("save", "autoSave", false));
#if defined(OEM_LISICHENG)
@@ -389,6 +390,18 @@ MainWindow::MainWindow(const QString& appLang, QWidget *parent)
m_vFwUpgradeAndDevLock.clear();
m_threadFwUpgradeAndDevLock = nullptr;
+ m_pbtn_push = new QPushButton(this);
+ m_pbtn_push->setText("<<");
+ m_pbtn_push->setGeometry(0, 0, 25, 50);
+ m_widget_sideBar = new Widget_Imgproc_SideBar(this);
+
+ connect(m_pbtn_push, SIGNAL(clicked()), this, SLOT(on_m_pbtn_push_clicked()));
+ connect(m_widget_sideBar, SIGNAL(applyToImage(HGImage,int,int,double)), this, SLOT(on_dialog_sideBar_applyToImage(HGImage,int,int,double)));
+ connect(m_widget_sideBar, SIGNAL(finish()), this, SLOT(on_dialog_sideBar_finish()));
+
+ updateSideBar();
+ updateActionStatus();
+
SANE_Int v = 0;
sane_init_ex(&v, sane_ex_callback, this);
}
@@ -848,6 +861,16 @@ void MainWindow::on_currItemChanged(int index)
m_modify = false;
}
+ if (m_widget_sideBar != nullptr)
+ {
+ HGImage curImage = nullptr;
+ m_view->getImage(&curImage);
+ if (curImage != nullptr)
+ {
+ m_widget_sideBar->getCurrentImg(curImage);
+ }
+ }
+
int count = 0;
m_thumb->getItemCount(&count);
m_wndStatusBar->setPageInfo(count, m_currIndex);
@@ -1583,6 +1606,61 @@ void MainWindow::on_wrong_image_decide(dialog_wrong_img* dlg, bool save)
delete dlg;
}
+void MainWindow::on_m_pbtn_push_clicked()
+{
+ int mainWndWidth = this->rect().width();
+ int mainWndHeight = this->rect().height();
+ int sideBarWidth = m_widget_sideBar->getWidth();
+ int sideBarHeight = m_widget_sideBar->getHeight();
+
+ if(!m_bSideflag)
+ {
+ m_propertyAnimation->setStartValue(QRect(mainWndWidth, mainWndHeight/2 - sideBarHeight/2, sideBarWidth, sideBarHeight));
+ m_propertyAnimation->setEndValue(QRect(mainWndWidth - sideBarWidth, mainWndHeight/2 - sideBarHeight/2, sideBarWidth, sideBarHeight));
+ m_propertyAnimation->start();
+ m_propertyAnimation2->setStartValue(QRect(mainWndWidth - m_pbtn_push->width(), mainWndHeight/2 - m_pbtn_push->height()/2, m_pbtn_push->width(), m_pbtn_push->height()));
+ m_propertyAnimation2->setEndValue(QRect(mainWndWidth - m_pbtn_push->width() - sideBarWidth, mainWndHeight/2 - m_pbtn_push->height()/2, m_pbtn_push->width(), m_pbtn_push->height()));
+ m_propertyAnimation2->start();
+ m_pbtn_push->setText(">>");
+ m_bSideflag = !m_bSideflag;
+ }
+ else
+ {
+ m_propertyAnimation->setStartValue(QRect(mainWndWidth - sideBarWidth, mainWndHeight/2 - sideBarHeight/2,sideBarWidth, sideBarHeight));
+ m_propertyAnimation->setEndValue(QRect(mainWndWidth, mainWndHeight/2 - sideBarHeight/2, sideBarWidth, sideBarHeight));
+ m_propertyAnimation->start();
+ m_propertyAnimation2->setStartValue(QRect(mainWndWidth - m_pbtn_push->width() - sideBarWidth, mainWndHeight/2 - m_pbtn_push->height()/2, m_pbtn_push->width(), m_pbtn_push->height()));
+ m_propertyAnimation2->setEndValue(QRect(mainWndWidth - m_pbtn_push->width(), mainWndHeight/2 - m_pbtn_push->height()/2, m_pbtn_push->width(), m_pbtn_push->height()));
+ m_propertyAnimation2->start();
+ m_pbtn_push->setText("<<");
+ m_bSideflag = !m_bSideflag;
+ }
+}
+
+void MainWindow::on_dialog_sideBar_applyToImage(HGImage img, int brightness, int contrast, double gamma)
+{
+ assert(nullptr != img);
+
+ HGImageInfo imgInfo;
+ HGBase_GetImageInfo(img, &imgInfo);
+
+ HGImage destImg = nullptr;
+ HGBase_CreateImage(imgInfo.width, imgInfo.height, imgInfo.type, imgInfo.origin, &destImg);
+ if (nullptr != destImg)
+ {
+ HGImgProc_ImageAdjustColors(img, destImg, brightness, contrast, (HGFloat)gamma);
+ m_view->addImage(destImg);
+ HGBase_DestroyImage(destImg);
+ updateStatusBarPixelInfo();
+ }
+}
+
+void MainWindow::on_dialog_sideBar_finish()
+{
+ emit m_pbtn_push->clicked();
+ m_modify = true;
+}
+
void MainWindow::on_act_thumbnailBar_triggered(bool checked)
{
ui->dockWidget->setVisible(checked);
@@ -1847,6 +1925,11 @@ void MainWindow::updateActionStatus()
m_dialogLog->pbtn_export->setEnabled(ui->act_Export->isEnabled());
m_moveToAction->setEnabled(!selectIndexs.empty() && (!dev_que_.is_online() || !m_isScanning));
+ if (m_pbtn_push != nullptr && m_widget_sideBar!= nullptr)
+ {
+ m_pbtn_push->setVisible(nullptr != img);
+ m_widget_sideBar->setVisible(nullptr != img);
+ }
}
void MainWindow::startSaveMessageBox(QWidget* parent)
@@ -2704,6 +2787,26 @@ void MainWindow::closeEvent(QCloseEvent *e)
m_versionDll->PostUserCloseInfo(HGVERSION_APPNAME_SCANNER, m_oemName);
}
+void MainWindow::resizeEvent(QResizeEvent *e)
+{
+ (void)e;
+
+ if (m_bSideflag)
+ {
+ int mainWndWidth = this->rect().width();
+ int mainWndHeight = this->rect().height();
+ int sideBarWidth = m_widget_sideBar->getWidth();
+ int sideBarHeight = m_widget_sideBar->getHeight();
+
+ m_widget_sideBar->move(mainWndWidth - sideBarWidth, mainWndHeight/2 - sideBarHeight/2);
+ m_pbtn_push->move(mainWndWidth - m_pbtn_push->width() - sideBarWidth, mainWndHeight/2 - m_pbtn_push->height()/2);
+ }
+ else
+ {
+ updateSideBar();
+ }
+}
+
int MainWindow::sane_ex_callback(SANE_Handle hdev, int code, void *data, unsigned int* len, void *param)
{
(void)hdev;
@@ -4404,6 +4507,23 @@ void MainWindow::initAcquireIntoComboBox()
connect(m_cbtn_acquireIntoCfg, SIGNAL(currentTextChanged(QString)), this, SLOT(on_m_acquireIntoCfg_changed(QString)));
}
+void MainWindow::updateSideBar()
+{
+ int mainWndWidth = this->rect().width();
+ int mainWndHeight = this->rect().height();
+ int sideBarHeight = m_widget_sideBar->getHeight();
+
+ m_widget_sideBar->move(mainWndWidth, mainWndHeight/2 - sideBarHeight/2);
+ m_pbtn_push->move(mainWndWidth - m_pbtn_push->width(), mainWndHeight/2 - m_pbtn_push->height()/2);
+
+ m_propertyAnimation = new QPropertyAnimation(m_widget_sideBar, "geometry");
+ m_propertyAnimation->setEasingCurve(QEasingCurve::InOutSine);
+ m_propertyAnimation->setDuration(600);
+ m_propertyAnimation2 = new QPropertyAnimation(m_pbtn_push, "geometry");
+ m_propertyAnimation2->setEasingCurve(QEasingCurve::InOutSine);
+ m_propertyAnimation2->setDuration(600);
+}
+
void MainWindow::on_scanOptions_changed(const QString &device, const QString &option, bool checked_now)
{
QString title(tr("app name"));
diff --git a/app/scanner/mainwindow.h b/app/scanner/mainwindow.h
index 4497c43a..d1b133e0 100644
--- a/app/scanner/mainwindow.h
+++ b/app/scanner/mainwindow.h
@@ -6,10 +6,13 @@
#include
#include
#include
+#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"
@@ -155,6 +158,9 @@ private slots:
void on_stopScan();
void on_statusInfoDblClick();
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);
+ void on_dialog_sideBar_finish();
void on_act_thumbnailBar_triggered(bool checked);
@@ -255,6 +261,7 @@ public slots:
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);
@@ -281,6 +288,7 @@ private:
void deleteUpgradePkg(const QString& cfgFilePath);
QString getDevPid();
void initAcquireIntoComboBox();
+ void updateSideBar();
private:
Ui::MainWindow *ui;
@@ -300,6 +308,10 @@ private:
QMenu *m_menu_language;
QAction *m_act_simpCN;
QAction *m_act_English;
+ QPushButton *m_pbtn_push;
+ Widget_Imgproc_SideBar *m_widget_sideBar;
+ QPropertyAnimation *m_propertyAnimation;
+ QPropertyAnimation *m_propertyAnimation2;
dev_que dev_que_;
@@ -352,6 +364,7 @@ private:
const char* m_oemName;
bool m_cacheDirNotify;
bool m_AquirePathNotify;
+ bool m_bSideflag;
// 固件升级和设备锁定
std::vector m_vFwUpgradeAndDevLock;
diff --git a/app/scanner/widget_imgproc_sidebar.cpp b/app/scanner/widget_imgproc_sidebar.cpp
new file mode 100644
index 00000000..fa6e6b1e
--- /dev/null
+++ b/app/scanner/widget_imgproc_sidebar.cpp
@@ -0,0 +1,179 @@
+#include "widget_imgproc_sidebar.h"
+#include "ui_widget_imgproc_sidebar.h"
+#include
+#include
+#include "app_cfg.h"
+
+Widget_Imgproc_SideBar::Widget_Imgproc_SideBar(QWidget *parent) :
+ QWidget(parent),
+ ui(new Ui::Widget_Imgproc_SideBar)
+ , m_curImage(NULL)
+{
+ ui->setupUi(this);
+ updateUiStatus();
+
+ connect(ui->slider_brightness, SIGNAL(valueChanged(int)), ui->spin_brightness, SLOT(setValue(int)));
+ connect(ui->slider_contrast, SIGNAL(valueChanged(int)), ui->spin_contrast, SLOT(setValue(int)));
+}
+
+Widget_Imgproc_SideBar::~Widget_Imgproc_SideBar()
+{
+ if (m_curImage != nullptr)
+ {
+ HGBase_DestroyImage(m_curImage);
+ }
+ delete ui;
+}
+
+int Widget_Imgproc_SideBar::getWidth()
+{
+ return this->width();
+}
+
+int Widget_Imgproc_SideBar::getHeight()
+{
+ return this->height();
+}
+
+void Widget_Imgproc_SideBar::getCurrentImg(HGImage image)
+{
+ HGImageInfo imgInfo;
+ HGBase_GetImageInfo(image, &imgInfo);
+ HGBase_CloneImage(image, imgInfo.type, HGBASE_IMGORIGIN_TOP, &m_curImage);
+ if (NULL == m_curImage)
+ {
+ HGBase_DestroyImage(m_curImage);
+ return;
+ }
+}
+
+void Widget_Imgproc_SideBar::setBrightness(int brightness)
+{
+ ui->spin_brightness->setValue(brightness);
+}
+
+void Widget_Imgproc_SideBar::setContrast(int contrast)
+{
+ ui->spin_contrast->setValue(contrast);
+}
+
+void Widget_Imgproc_SideBar::setGamma(double gamma)
+{
+ ui->dspin_gamma->setValue(gamma);
+}
+
+void Widget_Imgproc_SideBar::paintEvent(QPaintEvent *e)
+{
+ (void)e;
+ QPainter p(this);
+ p.fillRect(0, 0, this->width(), this->height(), qRgb(240, 240, 240));
+ p.setPen(QColor("gray"));
+ p.drawRect(0, 0, width() -1, height() -1);
+}
+
+void Widget_Imgproc_SideBar::updateUiStatus()
+{
+ ui->checkBox_apply->setChecked(getCfgValue("sideBar", "applyImg", true));
+ ui->checkBox_enhanceText->setChecked(getCfgValue("sideBar", "enhanceText", false));
+ ui->spin_brightness->setValue(getCfgValue("sideBar", "brightness", 0));
+ ui->spin_contrast->setValue(getCfgValue("sideBar", "contrast", 0));
+
+ QString strGamma = getCfgValue("sideBar", "gamma", QString("1.0"));
+ double gamma = atof(strGamma.toStdString().c_str());
+ ui->dspin_gamma->setValue(gamma);
+}
+
+void Widget_Imgproc_SideBar::on_spin_brightness_valueChanged(int arg1)
+{
+ ui->slider_brightness->setValue(arg1);
+ if(ui->checkBox_apply->isChecked())
+ emit applyToImage(m_curImage, arg1, ui->spin_contrast->value(), ui->dspin_gamma->value());
+}
+
+void Widget_Imgproc_SideBar::on_spin_contrast_valueChanged(int arg1)
+{
+ ui->slider_contrast->setValue(arg1);
+ if(ui->checkBox_apply->isChecked())
+ emit applyToImage(m_curImage, ui->spin_brightness->value(), arg1, ui->dspin_gamma->value());
+}
+
+void Widget_Imgproc_SideBar::on_dspin_gamma_valueChanged(double arg1)
+{
+ ui->slider_gamma->setValue(static_cast(arg1 * 100));
+ if(ui->checkBox_apply->isChecked())
+ emit applyToImage(m_curImage, ui->spin_brightness->value(), ui->spin_contrast->value(), arg1);
+}
+
+void Widget_Imgproc_SideBar::on_slider_gamma_valueChanged(int value)
+{
+ ui->dspin_gamma->setValue(static_cast(value / 100.0));
+}
+
+void Widget_Imgproc_SideBar::on_checkBox_apply_toggled(bool checked)
+{
+ if(checked)
+ emit applyToImage(m_curImage, ui->spin_brightness->value(), ui->spin_contrast->value(), ui->dspin_gamma->value());
+}
+
+void Widget_Imgproc_SideBar::on_pbtn_restoreDefault_clicked()
+{
+ ui->spin_brightness->setValue(0);
+ ui->spin_contrast->setValue(0);
+ ui->dspin_gamma->setValue(1.0);
+ ui->checkBox_apply->setChecked(true);
+ ui->checkBox_enhanceText->setChecked(false);
+ if(ui->checkBox_apply->isChecked())
+ emit applyToImage(m_curImage, ui->spin_brightness->value(), ui->spin_contrast->value(), ui->dspin_gamma->value());
+}
+
+void Widget_Imgproc_SideBar::on_pbtn_ok_clicked()
+{
+ saveCfgValue("sideBar", "applyImg", ui->checkBox_apply->isChecked());
+ saveCfgValue("sideBar", "enhanceText", ui->checkBox_enhanceText->isChecked());
+
+ saveCfgValue("sideBar", "brightness", ui->spin_brightness->value());
+ saveCfgValue("sideBar", "contrast", ui->spin_contrast->value());
+ char gamma[32];
+ sprintf(gamma, "%f", ui->dspin_gamma->value());
+ saveCfgValue("sideBar", "gamma", QString(gamma));
+
+ if (ui->checkBox_enhanceText->isChecked())
+ {
+ HGUInt xDpi = 0;
+ HGUInt yDpi = 0;
+ HGBase_GetImageDpi(m_curImage, &xDpi, &yDpi);
+
+ HGImageInfo imgInfo;
+ HGBase_GetImageInfo(m_curImage, &imgInfo);
+ HGUInt width = imgInfo.width;
+ HGUInt height = imgInfo.height;
+
+ HGImage destImage = nullptr;
+ HGBase_CreateImage(width, height, imgInfo.type, HGBASE_IMGORIGIN_TOP, &destImage);
+ if (NULL == destImage)
+ {
+ HGBase_DestroyImage(destImage);
+ return;
+ }
+
+ HGImgProc_ImageBinarization(m_curImage, destImage, HGIMGPROC_THRESHTYPE_BINARY, 40, 51, 41);
+ if (nullptr != destImage)
+ {
+ HGBase_SetImageDpi(destImage, xDpi, yDpi);
+ emit applyToImage(destImage, ui->spin_brightness->value(), ui->spin_contrast->value(), ui->dspin_gamma->value());
+ HGBase_DestroyImage(destImage);
+ }
+ }
+ else
+ {
+ emit applyToImage(m_curImage, ui->spin_brightness->value(), ui->spin_contrast->value(), ui->dspin_gamma->value());
+ }
+
+ emit finish();
+}
+
+void Widget_Imgproc_SideBar::on_pbtn_cancel_clicked()
+{
+ updateUiStatus();
+ emit finish();
+}
diff --git a/app/scanner/widget_imgproc_sidebar.h b/app/scanner/widget_imgproc_sidebar.h
new file mode 100644
index 00000000..d01faafb
--- /dev/null
+++ b/app/scanner/widget_imgproc_sidebar.h
@@ -0,0 +1,60 @@
+#ifndef WIDGET_IMGPROC_SIDEBAR_H
+#define WIDGET_IMGPROC_SIDEBAR_H
+
+#include
+#include "imgproc/HGImgProc.h"
+
+namespace Ui {
+class Widget_Imgproc_SideBar;
+}
+
+class Widget_Imgproc_SideBar : public QWidget
+{
+ Q_OBJECT
+
+public:
+ explicit Widget_Imgproc_SideBar(QWidget *parent = nullptr);
+ ~Widget_Imgproc_SideBar();
+
+ int getWidth();
+ int getHeight();
+ void getCurrentImg(HGImage image);
+
+ void setBrightness(int brightness);
+ void setContrast(int contrast);
+ void setGamma(double gamma);
+
+protected:
+ void paintEvent(QPaintEvent *e) override;
+
+private:
+ void updateUiStatus();
+
+signals:
+ void applyToImage(HGImage img, int brightness, int contrast, double gamma);
+ void finish();
+
+private slots:
+ void on_spin_brightness_valueChanged(int arg1);
+
+ void on_spin_contrast_valueChanged(int arg1);
+
+ void on_dspin_gamma_valueChanged(double arg1);
+
+ void on_slider_gamma_valueChanged(int value);
+
+ void on_checkBox_apply_toggled(bool checked);
+
+ void on_pbtn_restoreDefault_clicked();
+
+ void on_pbtn_ok_clicked();
+
+ void on_pbtn_cancel_clicked();
+
+private:
+ Ui::Widget_Imgproc_SideBar *ui;
+
+ HGImage m_curImage;
+};
+
+#endif // WIDGET_IMGPROC_SIDEBAR_H
diff --git a/app/scanner/widget_imgproc_sidebar.ui b/app/scanner/widget_imgproc_sidebar.ui
new file mode 100644
index 00000000..2ef88da3
--- /dev/null
+++ b/app/scanner/widget_imgproc_sidebar.ui
@@ -0,0 +1,390 @@
+
+
+ Widget_Imgproc_SideBar
+
+
+
+ 0
+ 0
+ 220
+ 427
+
+
+
+ Form
+
+
+
+
+ 60
+ 380
+ 75
+ 23
+
+
+
+ Ok
+
+
+
+
+
+ 140
+ 380
+ 75
+ 23
+
+
+
+ Cancel
+
+
+
+
+
+ 10
+ 330
+ 152
+ 25
+
+
+
+ -
+
+
+ Restore defaults
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+
+
+
+
+
+ 10
+ 250
+ 143
+ 22
+
+
+
+ -
+
+
+ Enhance Text
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+
+
+
+
+
+ 10
+ 290
+ 155
+ 22
+
+
+
+ -
+
+
+ Apply to image
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+
+
+
+
+
+ 10
+ 10
+ 201
+ 71
+
+
+
+ Brightness
+
+
+
+
+ 10
+ 35
+ 121
+ 27
+
+
+
+
+ 121
+ 27
+
+
+
+ -255
+
+
+ 255
+
+
+ 0
+
+
+ Qt::Horizontal
+
+
+ QSlider::TicksAbove
+
+
+ 32
+
+
+
+
+
+ 140
+ 40
+ 51
+ 20
+
+
+
+
+ 0
+ 0
+
+
+
+
+ 51
+ 20
+
+
+
+ -255
+
+
+ 255
+
+
+ 0
+
+
+ 10
+
+
+
+
+
+
+ 10
+ 170
+ 201
+ 71
+
+
+
+ Gamma correction
+
+
+
+
+ 10
+ 35
+ 121
+ 27
+
+
+
+
+ 121
+ 27
+
+
+
+ 1
+
+
+ 500
+
+
+ 100
+
+
+ Qt::Horizontal
+
+
+ QSlider::TicksAbove
+
+
+ 25
+
+
+
+
+
+ 140
+ 40
+ 51
+ 20
+
+
+
+
+ 0
+ 0
+
+
+
+
+ 51
+ 20
+
+
+
+ 0.010000000000000
+
+
+ 5.000000000000000
+
+
+ 0.010000000000000
+
+
+ 1.000000000000000
+
+
+
+
+
+
+ 10
+ 90
+ 201
+ 71
+
+
+
+ Contrast
+
+
+
+
+ 10
+ 34
+ 121
+ 27
+
+
+
+
+ 121
+ 27
+
+
+
+ -127
+
+
+ 127
+
+
+ 0
+
+
+ Qt::Horizontal
+
+
+ false
+
+
+ false
+
+
+ QSlider::TicksAbove
+
+
+ 16
+
+
+
+
+
+ 140
+ 40
+ 51
+ 20
+
+
+
+
+ 0
+ 0
+
+
+
+
+ 51
+ 20
+
+
+
+ -127
+
+
+ 127
+
+
+ 0
+
+
+ 10
+
+
+
+
+
+
+
diff --git a/build2/qt/HGScanner/HGScanner.pro b/build2/qt/HGScanner/HGScanner.pro
index f702ee6f..23ada6e0 100644
--- a/build2/qt/HGScanner/HGScanner.pro
+++ b/build2/qt/HGScanner/HGScanner.pro
@@ -246,6 +246,7 @@ SOURCES += \
../../../app/scanner/widget.cpp \
../../../app/scanner/widget_imgproc_base.cpp \
../../../app/scanner/widget_statusbar.cpp \
+ ../../../app/scanner/widget_imgproc_sidebar.cpp \
../../../utility/HGString.cpp
HEADERS += \
@@ -297,6 +298,7 @@ HEADERS += \
../../../app/scanner/widget.h \
../../../app/scanner/widget_imgproc_base.h \
../../../app/scanner/widget_statusbar.h \
+ ../../../app/scanner/widget_imgproc_sidebar.h \
../../../utility/HGString.h
FORMS += \
@@ -333,7 +335,8 @@ FORMS += \
../../../app/scanner/setpicclrtool.ui \
../../../app/scanner/widget.ui \
../../../app/scanner/widget_imgproc_base.ui \
- ../../../app/scanner/widget_statusbar.ui
+ ../../../app/scanner/widget_statusbar.ui \
+ ../../../app/scanner/widget_imgproc_sidebar.ui
RESOURCES += \
../../../app/scanner/Scanner_resource.qrc