修复ISSUESbug
This commit is contained in:
parent
b1493ebc94
commit
ba106fd779
|
@ -1,3 +1,16 @@
|
|||
kylin-scanner (3.2.0-0k7) v101; urgency=medium
|
||||
|
||||
* BUG号:#I5XHE0 【扫描】【平板模式】有最大化/还原按钮
|
||||
#I5XHFF 【扫描】【平板模式】偶现打开扫描后窗口未最大化
|
||||
#I5XFGZ 【平板模式】【扫描】已扫描多张图片,左侧预览图可以左右拖动
|
||||
#I5XFBZ 【次要】【扫描】扫描enter快捷键不生效
|
||||
#I5XFAP 【扫描】最大化模式右上角选项菜单展开后,位置偏移
|
||||
* 需求号:无
|
||||
* 其他改动说明:将2209已解决的bug最新代码同步到平板分支
|
||||
* 其他改动影响域:无
|
||||
|
||||
-- fanyuchen <fanyuchen@kylinos.cn> Tue, 28 Mar 2023 17:06:43 +0800
|
||||
|
||||
kylin-scanner (3.2.0-0k6) v101; urgency=medium
|
||||
|
||||
* BUG号:#144982 【扫描】对扫描文件操作的菜单太小,平板模式不好触摸操作
|
||||
|
|
|
@ -29,7 +29,9 @@ Build-Depends: debhelper-compat (=12),
|
|||
policykit-1,
|
||||
libkysdk-kabase-dev,
|
||||
libkysdk-base-dev,
|
||||
libkysdk-applications-dev
|
||||
libkysdk-applications-dev,
|
||||
libtiff-dev,
|
||||
libudev-dev
|
||||
|
||||
Standards-Version: 4.5.0
|
||||
Rules-Requires-Root: no
|
||||
|
|
|
@ -35,7 +35,8 @@ PKGCONFIG += \
|
|||
gio-2.0 \
|
||||
gio-unix-2.0 \
|
||||
opencv4 \
|
||||
gsettings-qt
|
||||
gsettings-qt \
|
||||
libudev
|
||||
|
||||
LIBS += \
|
||||
-llept \
|
||||
|
@ -43,7 +44,15 @@ LIBS += \
|
|||
-ltesseract \
|
||||
-lX11 \
|
||||
# -ljpeg \
|
||||
-L/usr/lib/libukui-log4qt.so.1.0.0 -lukui-log4qt
|
||||
-L/usr/lib/libukui-log4qt.so.1.0.0 -lukui-log4qt\
|
||||
-ltiff \
|
||||
-lfreeimage
|
||||
|
||||
#opencv
|
||||
INCLUDEPATH += /usr/include/opencv4/
|
||||
LIBS += -lopencv_core \
|
||||
-lopencv_imgcodecs \
|
||||
-lopencv_imgproc \
|
||||
|
||||
#freeimage
|
||||
#LIBS += -lkylinimagecodec
|
||||
|
|
223
src/crop.cpp
223
src/crop.cpp
|
@ -20,9 +20,18 @@
|
|||
|
||||
#include <ukui-log4qt.h>
|
||||
|
||||
/**
|
||||
* 拉伸裁剪框todo list
|
||||
* 1. 得到裁剪区域后,计算【拉伸鼠标样式】的识别区域,包含八个区域:上下左右,四个角,其他区域恢复【箭头鼠标样式】
|
||||
* 2. 当鼠标按下并移动,且初始点在识别区域内,根据所在的识别区域以及鼠标位置,更新矩形框的坐标,触发paintEvent重绘裁剪框
|
||||
* 3. 接收到鼠标release事件,回到步骤1
|
||||
* */
|
||||
|
||||
CropLabel::CropLabel(QLabel *parent)
|
||||
: QLabel(parent)
|
||||
{
|
||||
setMouseTracking(true);
|
||||
setAttribute(Qt::WA_Hover, true);
|
||||
initCropSettings();
|
||||
loadAllPixmaps();
|
||||
|
||||
|
@ -49,8 +58,12 @@ void CropLabel::paintEvent(QPaintEvent *event)
|
|||
// int W = m_endX - m_startX;
|
||||
// int H = m_endY - m_startY;
|
||||
|
||||
int W = m_endPoint.x() - m_beginPoint.x();
|
||||
int H = m_endPoint.y() - m_beginPoint.y();
|
||||
int W = m_endX - m_beginX;
|
||||
int H = m_endY - m_beginY;
|
||||
m_beginPoint.setX(m_beginX);
|
||||
m_beginPoint.setY(m_beginY);
|
||||
m_endPoint.setX(m_endX);
|
||||
m_endPoint.setY(m_endY);
|
||||
m_currentSelectRect = getRect(m_beginPoint, m_endPoint);
|
||||
|
||||
QPainterPath cropPath;
|
||||
|
@ -80,54 +93,186 @@ void CropLabel::paintEvent(QPaintEvent *event)
|
|||
}
|
||||
}
|
||||
|
||||
void CropLabel::initCropRegion(){
|
||||
|
||||
}
|
||||
void CropLabel::calculateDetectRegion(){
|
||||
//更新不同鼠标样式识别区域
|
||||
//重新计算八个描点的区域
|
||||
int width = m_endX - m_beginX;
|
||||
int height = m_endY - m_beginY;
|
||||
//左侧描点区域
|
||||
m_rectLeft = QRect(m_beginX, m_beginY + m_padding, m_padding, height - m_padding * 2);
|
||||
//上侧描点区域
|
||||
m_rectTop = QRect(m_beginX + m_padding, m_beginY, width - m_padding * 2, m_padding);
|
||||
//右侧描点区域
|
||||
m_rectRight = QRect(m_beginX + width - m_padding, m_beginY + m_padding, m_padding, height - m_padding * 2);
|
||||
//下侧描点区域
|
||||
m_rectBottom = QRect(m_beginX + m_padding, m_beginY + height - m_padding, width - m_padding * 2, m_padding);
|
||||
//左上角描点区域
|
||||
m_rectLeftTop = QRect(m_beginX, m_beginY, m_padding, m_padding);
|
||||
//右上角描点区域
|
||||
m_rectRightTop = QRect(m_beginX + width - m_padding, m_beginY, m_padding, m_padding);
|
||||
//左下角描点区域
|
||||
m_rectLeftBottom = QRect(m_beginX, m_beginY + height - m_padding, m_padding, m_padding);
|
||||
//右下角描点区域
|
||||
m_rectRightBottom = QRect(m_beginX + width - m_padding, m_beginY + height - m_padding, m_padding, m_padding);
|
||||
//中间区域
|
||||
m_center = QRect(m_beginX + m_padding, m_beginY + m_padding, width - m_padding * 2, height - m_padding * 2);
|
||||
}
|
||||
|
||||
void CropLabel::mousePressEvent(QMouseEvent *event)
|
||||
{
|
||||
// QApplication::setOverrideCursor(QCursor(Qt::ClosedHandCursor));
|
||||
|
||||
m_isPressed = true;
|
||||
if (event->button() == Qt::LeftButton) {
|
||||
m_beginX = event->pos().x();
|
||||
m_beginY = event->pos().y();
|
||||
m_endX = event->pos().x();
|
||||
m_endY = event->pos().y();
|
||||
|
||||
m_beginPoint = QPoint(m_beginX, m_beginY);
|
||||
KyInfo() << "m_startPoint = " << m_beginPoint;
|
||||
|
||||
m_isPressed = true;
|
||||
//判断按下的手柄的区域位置
|
||||
QPoint lastPos = event->pos();
|
||||
if (m_rectLeft.contains(lastPos)) {
|
||||
m_pressedLeft = true;
|
||||
} else if (m_rectRight.contains(lastPos)) {
|
||||
m_pressedRight = true;
|
||||
} else if (m_rectTop.contains(lastPos)) {
|
||||
m_pressedTop = true;
|
||||
} else if (m_rectBottom.contains(lastPos)) {
|
||||
m_pressedBottom = true;
|
||||
} else if (m_rectLeftTop.contains(lastPos)) {
|
||||
m_pressedLeftTop = true;
|
||||
} else if (m_rectRightTop.contains(lastPos)) {
|
||||
m_pressedRightTop = true;
|
||||
} else if (m_rectLeftBottom.contains(lastPos)) {
|
||||
m_pressedLeftBottom = true;
|
||||
} else if (m_rectRightBottom.contains(lastPos)) {
|
||||
m_pressedRightBottom = true;
|
||||
}else if (m_center.contains(lastPos)){
|
||||
m_pressCenter = true;
|
||||
m_startPos = event->globalPos();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CropLabel::mouseReleaseEvent(QMouseEvent *event)
|
||||
{
|
||||
m_isPressed = false;
|
||||
if(m_isPressed){
|
||||
m_pressedLeft = false; //鼠标按下左侧
|
||||
m_pressedRight = false; //鼠标按下右侧
|
||||
m_pressedTop = false; //鼠标按下上侧
|
||||
m_pressedBottom = false; //鼠标按下下侧
|
||||
m_pressedLeftTop = false; //鼠标按下左上侧
|
||||
m_pressedRightTop = false; //鼠标按下右上侧
|
||||
m_pressedLeftBottom = false; //鼠标按下左下侧
|
||||
m_pressedRightBottom = false; //鼠标按下右下侧
|
||||
m_pressCenter = false;
|
||||
|
||||
if (event->buttons() & Qt::LeftButton) { // For avoid rightButton
|
||||
m_endX = event->pos().x();
|
||||
m_endY = event->pos().y();
|
||||
m_isPressed = false;
|
||||
}
|
||||
|
||||
m_endX = judgePosition(m_endX, 0, this->width());
|
||||
m_endY = judgePosition(m_endY, 0, this->height());
|
||||
|
||||
m_endPoint = QPoint(m_endX, m_endY);
|
||||
|
||||
KyInfo() << "m_endPoint = " << m_endPoint;
|
||||
update();
|
||||
|
||||
// QApplication::restoreOverrideCursor();
|
||||
}
|
||||
|
||||
void CropLabel::mouseMoveEvent(QMouseEvent *event)
|
||||
{
|
||||
//添加裁剪框边边的悬浮鼠标样式
|
||||
QHoverEvent *hoverEvent = (QHoverEvent *)event;
|
||||
QPoint point = hoverEvent->pos();
|
||||
if (m_rectLeft.contains(point)) {
|
||||
setCursor(Qt::SizeHorCursor);
|
||||
} else if (m_rectRight.contains(point)) {
|
||||
setCursor(Qt::SizeHorCursor);
|
||||
} else if (m_rectTop.contains(point)) {
|
||||
setCursor(Qt::SizeVerCursor);
|
||||
} else if (m_rectBottom.contains(point)) {
|
||||
setCursor(Qt::SizeVerCursor);
|
||||
} else if (m_rectLeftTop.contains(point)) {
|
||||
setCursor(Qt::SizeFDiagCursor);
|
||||
} else if (m_rectRightTop.contains(point)) {
|
||||
setCursor(Qt::SizeBDiagCursor);
|
||||
} else if (m_rectLeftBottom.contains(point)) {
|
||||
setCursor(Qt::SizeBDiagCursor);
|
||||
} else if (m_rectRightBottom.contains(point)) {
|
||||
setCursor(Qt::SizeFDiagCursor);
|
||||
} else {
|
||||
setCursor(Qt::ArrowCursor);
|
||||
}
|
||||
|
||||
if (m_isPressed && (event->buttons() & Qt::LeftButton)) {
|
||||
m_endX = event->pos().x();
|
||||
m_endY = event->pos().y();
|
||||
QPoint pos = event->pos();
|
||||
if(m_origRect.contains(pos)){
|
||||
if(m_pressedLeft){
|
||||
m_beginX = pos.x();
|
||||
}else if(m_pressedTop){
|
||||
m_beginY = pos.y();
|
||||
}else if(m_pressedRight){
|
||||
m_endX = pos.x();
|
||||
}else if(m_pressedBottom){
|
||||
m_endY = pos.y();
|
||||
}else if(m_pressedLeftTop){
|
||||
m_beginX = pos.x();
|
||||
m_beginY = pos.y();
|
||||
}else if(m_pressedRightTop){
|
||||
m_endX = pos.x();
|
||||
m_beginY = pos.y();
|
||||
}else if(m_pressedRightBottom){
|
||||
m_endX = pos.x();
|
||||
m_endY = pos.y();
|
||||
}else if(m_pressedLeftBottom){
|
||||
m_beginX = pos.x();
|
||||
m_endY = pos.y();
|
||||
}else if(m_pressCenter){
|
||||
}
|
||||
m_beginX = judgePosition(m_beginX,0,m_origRect.width());
|
||||
m_beginY = judgePosition(m_beginY,0,m_origRect.height());
|
||||
m_endX = judgePosition(m_endX,0,m_origRect.width());
|
||||
m_endY = judgePosition(m_endY,0,m_origRect.height());
|
||||
m_beginPoint.setX(m_beginX);
|
||||
m_beginPoint.setY(m_beginY);
|
||||
m_endPoint.setX(m_endX);
|
||||
m_endPoint.setY(m_endY);
|
||||
calculateDetectRegion();
|
||||
update();
|
||||
}
|
||||
if(m_pressCenter){
|
||||
int tmp_x = event->globalPos().x() - m_startPos.x();
|
||||
int tmp_y = event->globalPos().y() - m_startPos.y();
|
||||
|
||||
m_endPoint = event->pos();
|
||||
m_movePoint = event->pos();
|
||||
KyInfo() << "m_movePooint = " << m_movePoint;
|
||||
m_startPos = event->globalPos();
|
||||
|
||||
int m_beginXTmp = m_beginX + tmp_x;
|
||||
int m_beginYTmp = m_beginY + tmp_y;
|
||||
int m_endXTmp = m_endX + tmp_x;
|
||||
int m_endYTmp = m_endY + tmp_y;
|
||||
|
||||
m_beginXTmp = judgePosition(m_beginXTmp,0,m_origRect.width());
|
||||
m_beginYTmp = judgePosition(m_beginYTmp,0,m_origRect.height());
|
||||
m_endXTmp = judgePosition(m_endXTmp,0,m_origRect.width());
|
||||
m_endYTmp = judgePosition(m_endYTmp,0,m_origRect.height());
|
||||
|
||||
int x_dis = m_endXTmp - m_beginXTmp;
|
||||
int y_dis = m_endYTmp - m_beginYTmp;
|
||||
int width = m_endX - m_beginX;
|
||||
int length = m_endY - m_beginY;
|
||||
|
||||
if(y_dis < length || x_dis < width){
|
||||
return;
|
||||
}else{
|
||||
m_beginX += tmp_x;
|
||||
m_beginY += tmp_y;
|
||||
m_endX += tmp_x;
|
||||
m_endY += tmp_y;
|
||||
qDebug() << "pos:" << tmp_x << tmp_y;
|
||||
}
|
||||
}else{
|
||||
return;
|
||||
}
|
||||
m_beginX = judgePosition(m_beginX,0,m_origRect.width());
|
||||
m_beginY = judgePosition(m_beginY,0,m_origRect.height());
|
||||
m_endX = judgePosition(m_endX,0,m_origRect.width());
|
||||
m_endY = judgePosition(m_endY,0,m_origRect.height());
|
||||
m_beginPoint.setX(m_beginX);
|
||||
m_beginPoint.setY(m_beginY);
|
||||
m_endPoint.setX(m_endX);
|
||||
m_endPoint.setY(m_endY);
|
||||
calculateDetectRegion();
|
||||
update();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -198,13 +343,15 @@ QRect CropLabel::getRect(const QPoint &m_beginPoint, const QPoint &m_endPoint)
|
|||
void CropLabel::initCropSettings()
|
||||
{
|
||||
// Not show crop box in first crop operation
|
||||
m_beginX = -10;
|
||||
m_beginY = -10;
|
||||
m_endX = -10;
|
||||
m_endY = -10;
|
||||
|
||||
m_beginPoint = QPoint(-10, -10);
|
||||
m_endPoint = QPoint(-10, -10);
|
||||
m_origRect.setRect(0,0,this->width(),this->height());
|
||||
m_beginX = 0;
|
||||
m_beginY = 0;
|
||||
m_endX = m_origRect.width();
|
||||
m_endY = m_origRect.height();
|
||||
m_beginPoint = QPoint(m_beginX, m_beginY);
|
||||
m_endPoint = QPoint(m_endX, m_endY);
|
||||
update();
|
||||
calculateDetectRegion();
|
||||
|
||||
m_hasCropRegion = false;
|
||||
}
|
||||
|
|
25
src/crop.h
25
src/crop.h
|
@ -52,6 +52,8 @@ public:
|
|||
bool isPressPointInCropRegion(QPoint mousePressPoint);
|
||||
bool drawPixmapBorder(QRect rect, int W, int H);
|
||||
QRect getRect(const QPoint &m_beginPoint, const QPoint &m_endPoint);
|
||||
void calculateDetectRegion();
|
||||
void initCropRegion();
|
||||
|
||||
inline int getBeginX() const {
|
||||
return m_beginX;
|
||||
|
@ -82,6 +84,29 @@ public:
|
|||
};
|
||||
|
||||
private:
|
||||
QRect m_rectLeft; //左侧区域
|
||||
QRect m_rectRight; //右侧区域
|
||||
QRect m_rectTop; //上侧区域
|
||||
QRect m_rectBottom; //下侧区域
|
||||
QRect m_rectLeftTop; //左上侧区域
|
||||
QRect m_rectRightTop; //右上侧区域
|
||||
QRect m_rectLeftBottom; //左下侧区域
|
||||
QRect m_rectRightBottom; //右下侧区域
|
||||
QRect m_center;
|
||||
const int m_padding = 8;
|
||||
|
||||
bool m_pressedLeft = false; //鼠标按下左侧
|
||||
bool m_pressedRight = false; //鼠标按下右侧
|
||||
bool m_pressedTop = false; //鼠标按下上侧
|
||||
bool m_pressedBottom = false; //鼠标按下下侧
|
||||
bool m_pressedLeftTop = false; //鼠标按下左上侧
|
||||
bool m_pressedRightTop = false; //鼠标按下右上侧
|
||||
bool m_pressedLeftBottom = false; //鼠标按下左下侧
|
||||
bool m_pressedRightBottom = false; //鼠标按下右下侧
|
||||
bool m_pressCenter = false; //鼠标按下中间区域
|
||||
|
||||
QPoint m_startPos;
|
||||
|
||||
bool m_isPressed;
|
||||
bool m_hasCropRegion;
|
||||
|
||||
|
|
|
@ -50,6 +50,7 @@ void DisplayWidget::setupGui()
|
|||
void DisplayWidget::initConnect()
|
||||
{
|
||||
connect(m_defaultConnectFailedPageWidget, &FailedPageWidget::scanButtonClicked, this, &DisplayWidget::showDetectPageSlot);
|
||||
connect(g_user_signal, &GlobalUserSignal::switchToDetectPageSignal, this, &DisplayWidget::showDetectPageSlot);
|
||||
// connect(g_user_signal, &GlobalUserSignal::switchToFailPageSignal, this, &DisplayWidget::showFailedPageSlot);
|
||||
}
|
||||
|
||||
|
|
|
@ -76,7 +76,7 @@ void FailedPageWidget::initConnect()
|
|||
|
||||
void FailedPageWidget::fontSizeChanged()
|
||||
{
|
||||
int systemFontSize = kdk::kabase::Gsettings::getSystemFontSize().toInt();
|
||||
float systemFontSize = kdk::kabase::Gsettings::getSystemFontSize().toFloat();
|
||||
QFont font;
|
||||
font.setPointSize(systemFontSize);
|
||||
m_failedPageButton->setFont(font);
|
||||
|
|
|
@ -42,6 +42,7 @@ void GlobalUserSignal::setDeviceList(const SANE_Device **list){
|
|||
tmp.vendor = list[i]->vendor;
|
||||
deviceList.insert(i,tmp);
|
||||
}
|
||||
qDebug() << "Device Count:" << deviceList.length();
|
||||
}
|
||||
QList<SANE_Device> GlobalUserSignal::getDeviceList(){
|
||||
return deviceList;
|
||||
|
@ -123,7 +124,7 @@ void GlobalUserSignal::scanThreadFinished(int saneStatus)
|
|||
emit scanThreadFinishedSignal(saneStatus);
|
||||
}
|
||||
|
||||
void GlobalUserSignal::scanThreadFinishedImageLoad(QString loadPath,QString savePath)
|
||||
void GlobalUserSignal::scanThreadFinishedImageLoad(QStringList loadPath,QStringList savePath)
|
||||
{
|
||||
emit scanThreadFinishedImageLoadSignal(loadPath,savePath);
|
||||
}
|
||||
|
@ -244,6 +245,16 @@ void GlobalUserSignal::toolbarPercentageChanged()
|
|||
emit toolbarPercentageChangedSignel();
|
||||
}
|
||||
|
||||
void GlobalUserSignal::closeScanDialog()
|
||||
{
|
||||
emit closeScanDialogSignal();
|
||||
}
|
||||
|
||||
void GlobalUserSignal::switchToDetectPage()
|
||||
{
|
||||
emit switchToDetectPageSignal();
|
||||
}
|
||||
|
||||
void GlobalUserSignal::stopOcrTimer()
|
||||
{
|
||||
emit stopOcrTimerSignal();
|
||||
|
|
|
@ -74,7 +74,7 @@ public:
|
|||
void stopOrFinishedScan();
|
||||
|
||||
void scanThreadFinished(int saneStatus);
|
||||
void scanThreadFinishedImageLoad(QString loadPath, QString savePath);
|
||||
void scanThreadFinishedImageLoad(QStringList loadPath, QStringList savePath);
|
||||
|
||||
void showImageAfterClickedThumbnail(QString loadPath);
|
||||
void updateSaveNameTextAfterScanSuccess();
|
||||
|
@ -106,7 +106,8 @@ public:
|
|||
void toolbarZoominOperation();
|
||||
void toolbarPercentageChanged();
|
||||
|
||||
|
||||
void closeScanDialog();
|
||||
void switchToDetectPage();
|
||||
|
||||
signals:
|
||||
void cropOpSig();
|
||||
|
@ -149,7 +150,7 @@ signals:
|
|||
void showImageAfterClickedThumbnailSignal(QString loadPath);
|
||||
void exitOCR();
|
||||
|
||||
void scanThreadFinishedImageLoadSignal(QString,QString);
|
||||
void scanThreadFinishedImageLoadSignal(QStringList, QStringList);
|
||||
void scanThreadFinishedSignal(int saneStatus);
|
||||
|
||||
void stopOrFinishedScanSignal();
|
||||
|
@ -174,7 +175,21 @@ signals:
|
|||
|
||||
void cancelScanning();
|
||||
void cancelOprationOKSignal();
|
||||
void rotationChangedSig(bool);
|
||||
void closeScanDialogSignal();
|
||||
void switchToDetectPageSignal();
|
||||
void setDeviceBoxDisableSignal();
|
||||
void changeToConnectuccessPageSignal();
|
||||
void startUsbHotPlugThreadSignal();
|
||||
void closeUsbHotPlugThreadSignal();
|
||||
|
||||
void setExitFlagTrueSignal();
|
||||
void setExitFlagFalseSignal();
|
||||
void startHotPlugSignal();
|
||||
void refreshListSignal();
|
||||
void setScanIconDisableSignal();
|
||||
void hotPlugScanCompleteSignal();
|
||||
void rotationChangedSig(bool);
|
||||
|
||||
|
||||
private:
|
||||
static GlobalUserSignal* instance;
|
||||
|
|
|
@ -10,7 +10,7 @@ LoadImage::LoadImage(QObject *parent) : QObject(parent)
|
|||
void LoadImage::setFlag(bool res){
|
||||
m_flag = res;
|
||||
}
|
||||
void LoadImage::loadImageToWidget(QString loadPath, QImage *img, QLabel *container, double scale, bool rotationFlag, QSize labSize){
|
||||
void LoadImage::loadImageToWidget(QString loadPath, QString save_path, QImage *img, QLabel *container, double scale, bool rotationFlag, QSize labSize){
|
||||
if(m_flag){
|
||||
m_flag = false;
|
||||
return;
|
||||
|
@ -53,9 +53,11 @@ void LoadImage::loadImageToWidget(QString loadPath, QImage *img, QLabel *contain
|
|||
container->setScaledContents(true);
|
||||
container->setAlignment(Qt::AlignCenter | Qt::AlignVCenter | Qt::AlignHCenter);
|
||||
}
|
||||
QImage image = *img;
|
||||
|
||||
if(m_flag){
|
||||
m_flag = false;
|
||||
return;
|
||||
}
|
||||
emit finished(proportion);
|
||||
emit finished(save_path, proportion, image);
|
||||
}
|
||||
|
|
|
@ -12,13 +12,13 @@ public:
|
|||
explicit LoadImage(QObject *parent = nullptr);
|
||||
void setFlag(bool);
|
||||
public slots:
|
||||
void loadImageToWidget(QString loadPath, QImage *img, QLabel *container,double scale, bool rotationFlag,QSize labSize);
|
||||
void loadImageToWidget(QString loadPath, QString save_path, QImage *img, QLabel *container,double scale, bool rotationFlag,QSize labSize);
|
||||
private:
|
||||
bool m_flag;
|
||||
|
||||
|
||||
signals:
|
||||
void finished(double);
|
||||
void finished(QString, double, QImage);
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#include <QPixmap>
|
||||
#include <QPainter>
|
||||
#include <QDebug>
|
||||
#include <QFile>
|
||||
|
||||
constexpr inline int U(const char *str)
|
||||
{
|
||||
|
@ -33,6 +34,9 @@ bool SaveFileBase::imageSave(QImage *imgOP)
|
|||
/*****************mark***************************/
|
||||
if (m_fileName.endsWith(".png") || m_fileName.endsWith(".jpg") || m_fileName.endsWith(".bmp"))
|
||||
tmp.save(m_fileName);
|
||||
if (m_fileName.endsWith(".tiff")){
|
||||
saveAsTiff(tmp, m_fileName);
|
||||
}
|
||||
} else {
|
||||
if (!m_fileName.endsWith(".txt"))
|
||||
m_fileName += ".txt";
|
||||
|
@ -114,6 +118,52 @@ void SaveFileBase::setPdfSize(QPdfWriter *pdfWriter, QString size)
|
|||
|
||||
}
|
||||
|
||||
void SaveFileBase::saveAsTiff(QImage image, QString file_name)
|
||||
{
|
||||
m_tiffImageList.append(image);
|
||||
m_fileImages.append(file_name);
|
||||
image.save(file_name);
|
||||
|
||||
QString save_name = g_sane_object->saveFullScanFileName + ".tif";
|
||||
if(!QFile::exists(save_name)){
|
||||
m_tiffImageList[0].save(save_name);
|
||||
}
|
||||
|
||||
FREE_IMAGE_FORMAT fif = FIF_TIFF;
|
||||
FIBITMAP *page;
|
||||
int s = g_sane_object->scanPageNumber;
|
||||
if(m_tiffImageList.length() == g_sane_object->scanPageNumber){
|
||||
|
||||
FIMULTIBITMAP *src = FreeImage_OpenMultiBitmap(fif, save_name.toLocal8Bit().data(), false, false, true, 0);
|
||||
for(int i = 1; i < m_tiffImageList.length(); i++){
|
||||
QString newFileName = m_fileImages[i];
|
||||
FIMULTIBITMAP *newfile = FreeImage_OpenMultiBitmap(fif, newFileName.toLocal8Bit().data(), false, true);
|
||||
page = FreeImage_LockPage(newfile, 0);
|
||||
m_filist.append(FreeImage_Clone(page));
|
||||
FreeImage_UnlockPage(newfile, page, 0);
|
||||
}
|
||||
FreeImage_CloseMultiBitmap(src);
|
||||
}
|
||||
|
||||
if(m_filist.length() == (g_sane_object->scanPageNumber - 1)){
|
||||
FIMULTIBITMAP *out = FreeImage_OpenMultiBitmap(fif, save_name.toLocal8Bit().data(), false, false);
|
||||
for(int i = 0; i < m_filist.length(); i++){
|
||||
FreeImage_AppendPage(out, m_filist.at(i));
|
||||
}
|
||||
bool result = FreeImage_CloseMultiBitmap(out);
|
||||
|
||||
if(result){
|
||||
for(int j = 0; j < m_fileImages.length(); j++){
|
||||
QString filename = m_fileImages.at(j);
|
||||
QFile *a = new QFile(filename);
|
||||
a->remove();
|
||||
a->deleteLater();
|
||||
}
|
||||
m_tiffImageList.clear();
|
||||
m_fileImages.clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int SaveFileBase::toUnicode(QString str)
|
||||
{
|
||||
|
|
|
@ -3,6 +3,14 @@
|
|||
|
||||
#include <QObject>
|
||||
#include <QPdfWriter>
|
||||
#include <QImage>
|
||||
#include <opencv4/opencv2/core.hpp>
|
||||
#include <opencv4/opencv2/imgcodecs.hpp>
|
||||
#include <opencv4/opencv2/imgproc.hpp>
|
||||
#include <tiff.h>
|
||||
#include <tiffio.h>
|
||||
#include <FreeImage.h>
|
||||
#include <QFile>
|
||||
|
||||
class SaveFileBase : public QObject
|
||||
{
|
||||
|
@ -14,9 +22,13 @@ public:
|
|||
void saveToPdf(QImage *img);
|
||||
int toUnicode(QString str);
|
||||
void setPdfSize(QPdfWriter *pdfWriter, QString size);
|
||||
void saveAsTiff(QImage image, QString file_name);
|
||||
|
||||
private:
|
||||
QString m_fileName;
|
||||
|
||||
QList<QImage> m_tiffImageList;
|
||||
QStringList m_fileImages;
|
||||
QList<FIBITMAP*> m_filist;
|
||||
signals:
|
||||
|
||||
};
|
||||
|
|
|
@ -52,7 +52,7 @@ void LeftImageHandleSuccessPageWidget::setupGui()
|
|||
void LeftImageHandleSuccessPageWidget::initConnect()
|
||||
{
|
||||
connect(g_user_signal, &GlobalUserSignal::switchPageSig, this, &LeftImageHandleSuccessPageWidget::showOcrWidgetSlot);
|
||||
connect(g_user_signal, &GlobalUserSignal::startScanOperationSignal, this, &LeftImageHandleSuccessPageWidget::showImageWidgetSlot);
|
||||
// connect(g_user_signal, &GlobalUserSignal::startScanOperationSignal, this, &LeftImageHandleSuccessPageWidget::showImageWidgetSlot);
|
||||
}
|
||||
|
||||
void LeftImageHandleSuccessPageWidget::initSettings()
|
||||
|
|
|
@ -272,6 +272,7 @@ int main(int argc, char *argv[])
|
|||
app.installTranslator(&trans_SDK);
|
||||
}
|
||||
}
|
||||
app.setApplicationName(QApplication::tr("Scanner"));
|
||||
if (! app.isRunning()) {
|
||||
QString userNow = getCurrentUserName();
|
||||
int pidNow = app.applicationPid();
|
||||
|
|
|
@ -40,6 +40,8 @@ MainWidget::MainWidget(QWidget *parent)
|
|||
// m_displayScrollArea(new QScrollArea),
|
||||
m_mainWidgetVLayout(new QVBoxLayout())
|
||||
{
|
||||
GlobalUserSignal::getInstance()->setCurrentMode(rotateInfo.getCurrentMode());
|
||||
connect(&rotateInfo,&RotateChangeInfo::rotationChanged,this,&MainWidget::rotationChanged);
|
||||
kabase::WindowManage::getWindowId(&windowId);
|
||||
setupGui();
|
||||
initConnect();
|
||||
|
@ -49,8 +51,8 @@ MainWidget::MainWidget(QWidget *parent)
|
|||
if (g_config_signal->m_kylinScannerImageDebug) {
|
||||
scanThreadFinishedSlot(SANE_STATUS_GOOD);
|
||||
} else {
|
||||
g_sane_object->hotplug_sock = init_hotplug_sock();
|
||||
m_detectScanDevicesThread.start();
|
||||
m_usbHotplugThread.start();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -61,7 +63,10 @@ MainWidget::~MainWidget()
|
|||
exit(0);
|
||||
|
||||
}
|
||||
|
||||
void MainWidget::rotationChanged(bool isPCMode,int width,int height){
|
||||
GlobalUserSignal::getInstance()->setCurrentMode(isPCMode);
|
||||
emit GlobalUserSignal::getInstance()->rotationChangedSig(isPCMode);
|
||||
}
|
||||
void MainWidget::setupGui()
|
||||
{
|
||||
// Frosted glass effect, must before than XAtomHelper
|
||||
|
@ -104,28 +109,23 @@ void MainWidget::initConnect()
|
|||
//扫描设备
|
||||
connect(m_displayWidget, &DisplayWidget::detectScanDevicesSignal, this, &MainWidget::detectScanDevicesSlot, Qt::QueuedConnection);
|
||||
connect(&m_detectScanDevicesThread, &DetectScanDevicesThread::detectScanDevicesFinishedSignal, this, &MainWidget::detectScanDeviceThreadFinishedSlot);
|
||||
//热插拔
|
||||
// connect(&m_usbHotplugThread, &UsbHotplugThread::usbAdd, this, &MainWidget::usbAddedOperationSlot);
|
||||
// connect(&m_usbHotplugThread, &UsbHotplugThread::usbRemove, this, &MainWidget::usbRemovedOperationSlot);
|
||||
connect(g_user_signal, &GlobalUserSignal::startUsbHotPlugThreadSignal, this, &MainWidget::startUsbHotPlugThreadSlot);
|
||||
//扫描过程
|
||||
connect(g_user_signal, &GlobalUserSignal::startScanOperationSignal, this, &MainWidget::startScanOperationSlot, Qt::QueuedConnection);
|
||||
connect(g_user_signal, &GlobalUserSignal::stopScanOperationSignal, this, &MainWidget::stopScanOperationSlot);
|
||||
connect(g_user_signal, &GlobalUserSignal::scanThreadFinishedSignal, this, &MainWidget::scanThreadFinishedSlot);
|
||||
connect(g_user_signal, &GlobalUserSignal::cancelScanning, this, &MainWidget::cancelScanningSlot);
|
||||
//美化过程
|
||||
// connect(g_user_signal, &GlobalUserSignal::toolbarBeautyOperationStartSignal, this, &MainWidget::startBeautyOperationSlot);
|
||||
// connect(g_user_signal, &GlobalUserSignal::doBeautyOperationFinishedSignal, this, &MainWidget::hideBeautyRunningDialog);
|
||||
//纠偏过程
|
||||
// connect(g_user_signal, &GlobalUserSignal::toolbarRectifyOperationStartSignal, this, &MainWidget::showRectifyRunningDialog);
|
||||
// connect(g_user_signal, &GlobalUserSignal::doRectifyOperationSignal, this, &MainWidget::startRectifyOperationSlot);
|
||||
// connect(g_user_signal, &GlobalUserSignal::doRectifyOperationFinishedSignal, this, &MainWidget::hideRectifyRunningDialog);
|
||||
//OCR过程
|
||||
connect(g_user_signal, &GlobalUserSignal::doOcrOperationSignal, this, &MainWidget::startOcrOperationSlot);
|
||||
connect(g_user_signal, &GlobalUserSignal::closeScanDialogSignal, this, &MainWidget::closeScanDialogSlot);
|
||||
//阻止锁屏
|
||||
connect(g_user_signal, &GlobalUserSignal::dbusInhabitSignal, this, &MainWidget::dbusInhabitSlot);
|
||||
connect(g_user_signal, &GlobalUserSignal::dbusUnInhabitSignal, this, &MainWidget::dbusUnInhabitSlot);
|
||||
|
||||
connect(g_user_signal,&GlobalUserSignal::warnMsgSignal,this,&MainWidget::warnMsg);
|
||||
connect(g_user_signal, &GlobalUserSignal::warnMsgSignal,this,&MainWidget::warnMsg);
|
||||
//锁屏信号
|
||||
QDBusConnection::systemBus().connect(QString("org.freedesktop.login1"), QString("/org/freedesktop/login1"),
|
||||
QString("org.freedesktop.login1.Manager"), QString("PrepareForSleep"), this,
|
||||
SLOT(onPrepareForSleep(bool)));
|
||||
connect(g_user_signal, &GlobalUserSignal::closeUsbHotPlugThreadSignal, this, [=](){m_usbHotplugThread.exitWindowFlag = true;});
|
||||
connect(g_user_signal, &GlobalUserSignal::startHotPlugSignal, this, &MainWidget::startHotPlutSlot);
|
||||
connect(g_user_signal, &GlobalUserSignal::hotPlugScanCompleteSignal, this, [=](){g_sane_object->hotPlugScanCompleteSlot();});
|
||||
}
|
||||
|
||||
void MainWidget::initGsettings()
|
||||
|
@ -136,7 +136,6 @@ void MainWidget::initGsettings()
|
|||
connect(kdk::kabase::Gsettings::getPoint(), &kdk::kabase::Gsettings::systemThemeChange, this, &MainWidget::themeChange);
|
||||
connect(kdk::kabase::Gsettings::getPoint(), &kdk::kabase::Gsettings::systemFontSizeChange, this, &MainWidget::fontSizeChange);
|
||||
connect(kdk::kabase::Gsettings::getPoint(), &kdk::kabase::Gsettings::systemTransparencyChange, this, &MainWidget::transparencyChange);
|
||||
return;
|
||||
}
|
||||
|
||||
bool MainWidget::isDarkTheme()
|
||||
|
@ -179,7 +178,7 @@ void MainWidget::themeChange()
|
|||
|
||||
void MainWidget::fontSizeChange()
|
||||
{
|
||||
int fontSize = kdk::kabase::Gsettings::getSystemFontSize().toInt();
|
||||
float fontSize = kdk::kabase::Gsettings::getSystemFontSize().toFloat();
|
||||
KyInfo() << "fontSize = " << fontSize;
|
||||
}
|
||||
|
||||
|
@ -192,6 +191,7 @@ void MainWidget::transparencyChange()
|
|||
void MainWidget::warnMsg(QString msg)
|
||||
{
|
||||
QMessageBox *msgBox = new QMessageBox();
|
||||
m_msgBoxList.append(msgBox);
|
||||
if (isDarkTheme()) {
|
||||
QPalette pal(palette());
|
||||
pal.setColor(QPalette::Background, QColor(0, 0, 0));
|
||||
|
@ -229,9 +229,10 @@ void MainWidget::warnMsg(QString msg)
|
|||
}
|
||||
|
||||
QTimer* timer = new QTimer();
|
||||
timer->start(3000);
|
||||
timer->start(10000);
|
||||
timer->setSingleShot(true);
|
||||
connect(timer, &QTimer::timeout, msgBox, &QMessageBox::accept);
|
||||
connect(msgBox, &QMessageBox::accepted, msgBox, &QMessageBox::deleteLater);
|
||||
connect(kdk::kabase::Gsettings::getPoint(), &kdk::kabase::Gsettings::systemThemeChange, this, [=]{
|
||||
if (isDarkTheme()) {
|
||||
QPalette pal(palette());
|
||||
|
@ -246,7 +247,7 @@ void MainWidget::warnMsg(QString msg)
|
|||
}
|
||||
});
|
||||
|
||||
msgBox->exec();
|
||||
msgBox->show();
|
||||
}
|
||||
|
||||
|
||||
|
@ -290,7 +291,7 @@ void MainWidget::paintEvent(QPaintEvent *event)
|
|||
opt.init(this);
|
||||
|
||||
p.setPen(Qt::NoPen);
|
||||
QColor color = palette().color(QPalette::Base);
|
||||
QColor color = palette().color(QPalette::Window);
|
||||
color.setAlpha(g_config_signal->m_transparency);
|
||||
QPalette pal(this->palette());
|
||||
pal.setColor(QPalette::Window,QColor(color));
|
||||
|
@ -415,7 +416,7 @@ void MainWidget::detectScanDevicesSlot()
|
|||
if (! m_detectScanDevicesThread.isRunning()) {
|
||||
KyInfo() << "Not running detect scan devices thread. Let's detect ...";
|
||||
m_detectScanDevicesThread.start();
|
||||
|
||||
m_usbHotplugThread.start();
|
||||
g_user_signal->detectPageWaitTimerStart();
|
||||
}
|
||||
}
|
||||
|
@ -748,13 +749,21 @@ void MainWidget::showScanDialogSlot()
|
|||
|
||||
m_scanDialog->exec();
|
||||
}
|
||||
|
||||
void MainWidget::closeScanDialogSlot()
|
||||
{
|
||||
if(m_scanDialog->isVisible()){
|
||||
m_scanDialog->close();
|
||||
}
|
||||
}
|
||||
|
||||
void MainWidget::scanThreadFinishedSlot(int saneStatus)
|
||||
{
|
||||
KyInfo() << "saneStatus: " << saneStatus;
|
||||
|
||||
if (saneStatus != SANE_STATUS_GOOD) {
|
||||
if (saneStatus == SANE_STATUS_INVAL) {
|
||||
warnMsg(tr("Invalid argument, please change arguments or switch other scanners.") + tr("error code: ") + QString::number(saneStatus));
|
||||
warnMsg(tr("Invalid argument, please change arguments or switch other scanners.") + tr("error code:") + QString::number(saneStatus));
|
||||
} else if (saneStatus == SANE_STATUS_EOF) {
|
||||
g_sane_object->haveScanSuccessImage = true;
|
||||
|
||||
|
@ -769,19 +778,27 @@ void MainWidget::scanThreadFinishedSlot(int saneStatus)
|
|||
qDebug()<<"delete current image :" << savePath <<" success!";
|
||||
}
|
||||
cancelFlag = false;
|
||||
if(ThumbnailWidget::scanPictureIsEmpty){
|
||||
emit g_user_signal->changeToConnectuccessPageSignal();
|
||||
}
|
||||
}else{
|
||||
g_user_signal->scanThreadFinishedImageLoad(g_sane_object->loadFullScanFileName,g_sane_object->saveFullScanFileName);
|
||||
g_user_signal->scanThreadFinishedImageLoad(g_sane_object->loadFullScanFileNames, g_sane_object->saveFullScanFileNames);
|
||||
ThumbnailWidget::scanPictureIsEmpty = false;
|
||||
}
|
||||
qDebug() << "no more file to read!";
|
||||
|
||||
} else if (saneStatus == SANE_STATUS_DEVICE_BUSY) {
|
||||
warnMsg(tr("Device busy, please wait or switch other scanners.") + tr("error code: ") + QString::number(saneStatus));
|
||||
closeScanDialogSlot();
|
||||
warnMsg(tr("Device busy, please wait or switch other scanners.") + tr("error code:") + QString::number(saneStatus));
|
||||
} else if(saneStatus == SANE_STATUS_NO_DOCS) {
|
||||
warnMsg(tr("Document feeder out of documents, please place papers and scan again.") + tr("error code: ") + QString::number(saneStatus));
|
||||
closeScanDialogSlot();
|
||||
warnMsg(tr("Document feeder out of documents, please place papers and scan again.") + tr("error code:") + QString::number(saneStatus));
|
||||
} else if(saneStatus == SANE_STATUS_CANCELLED) {
|
||||
warnMsg(tr("Scan operation has been cancelled.") + tr("error code: ") + QString::number(saneStatus));
|
||||
closeScanDialogSlot();
|
||||
warnMsg(tr("Scan operation has been cancelled.") + tr("error code:") + QString::number(saneStatus));
|
||||
} else {
|
||||
warnMsg(tr("Scan failed, please check your scanner or switch other scanners.") + tr("error code: ") + QString::number(saneStatus));
|
||||
qDebug() << "met error! saneStatus:" << saneStatus;
|
||||
warnMsg(tr("Scan failed, please check your scanner or switch other scanners. If you want to continue using the scanner, click Options, refresh the list to restart the device.") + tr("error code:") + QString::number(saneStatus));
|
||||
}
|
||||
|
||||
isExited = true;
|
||||
|
@ -801,29 +818,61 @@ void MainWidget::scanThreadFinishedSlot(int saneStatus)
|
|||
qDebug()<<"delete current image :" << savePath <<" success!";
|
||||
}
|
||||
cancelFlag = false;
|
||||
if(ThumbnailWidget::scanPictureIsEmpty){
|
||||
emit g_user_signal->changeToConnectuccessPageSignal();
|
||||
}
|
||||
}else{
|
||||
g_user_signal->scanThreadFinishedImageLoad(g_sane_object->loadFullScanFileName,g_sane_object->saveFullScanFileName);
|
||||
g_user_signal->scanThreadFinishedImageLoad(g_sane_object->loadFullScanFileNames, g_sane_object->saveFullScanFileNames);
|
||||
ThumbnailWidget::scanPictureIsEmpty = false;
|
||||
}
|
||||
// to do: update thumbtailwidget icon to current filepath
|
||||
}
|
||||
}
|
||||
void MainWidget::cancelScanningSlot(){
|
||||
cancelFlag = true;
|
||||
g_sane_object->stopSaneReadFlag = true;
|
||||
// m_scanThread.quit();
|
||||
// while(1){
|
||||
// if(m_scanThread.isFinished()){
|
||||
// isExited = true;
|
||||
// sane_cancel(g_sane_object->handle);
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
void MainWidget::startOcrOperationSlot()
|
||||
void MainWidget::onPrepareForSleep(bool isSleep)
|
||||
{
|
||||
m_ocrThread.start();
|
||||
if (isSleep) //睡眠分支
|
||||
{
|
||||
qDebug() << "睡眠!!!";
|
||||
} else //唤醒分支
|
||||
{
|
||||
qDebug() << "唤醒!!!";
|
||||
}
|
||||
}
|
||||
|
||||
// if (m_isOcrInit) {
|
||||
// return;
|
||||
// }
|
||||
// m_ocrObject = new OcrObject();
|
||||
// m_ocrThread = new QThread();
|
||||
// m_ocrObject->moveToThread(m_ocrThread);
|
||||
// m_ocrThread->start();
|
||||
// m_isOcrInit = true;
|
||||
void MainWidget::newUsbConnectedSlot()
|
||||
{
|
||||
QMessageBox::information(this, tr("Alert"), tr("A new Scanner has been connected."));
|
||||
}
|
||||
|
||||
void MainWidget::startUsbHotPlugThreadSlot()
|
||||
{
|
||||
m_usbHotplugThread.exitWindowFlag = false;
|
||||
while(1){
|
||||
if(m_detectScanDevicesThread.isFinished()){
|
||||
m_usbHotplugThread.start();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void MainWidget::startHotPlutSlot()
|
||||
{
|
||||
emit g_user_signal->setExitFlagFalseSignal();
|
||||
m_usbHotplugThread.start();
|
||||
}
|
||||
|
||||
void MainWidget::showBeautyRunningDialog()
|
||||
|
@ -902,62 +951,49 @@ void DetectScanDevicesThread::run()
|
|||
|
||||
if (! res) {
|
||||
emit detectScanDevicesFinishedSignal(false);
|
||||
emit g_user_signal->closeUsbHotPlugThreadSignal();
|
||||
KyInfo() << "detect scan devices finished: false.";
|
||||
} else {
|
||||
emit detectScanDevicesFinishedSignal(true);
|
||||
KyInfo() << "detect scan devices finished: true.";
|
||||
emit g_user_signal->startUsbHotPlugThreadSignal();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void ScanThread::run()
|
||||
{
|
||||
g_sane_object->isOnScanning = true;
|
||||
int sleepTime = 0;
|
||||
int ret = 0;
|
||||
|
||||
g_sane_object->scanPageNumber = 0;
|
||||
g_sane_object->loadFullScanFileNames.clear();
|
||||
g_sane_object->saveFullScanFileNames.clear();
|
||||
|
||||
QString pageNumber = g_sane_object->userInfo.pageNumber;
|
||||
int retCompare = QString::compare(pageNumber, tr("Multiple"), Qt::CaseInsensitive);
|
||||
|
||||
if (retCompare == 0) {
|
||||
sleepTime = getSleepTime(g_sane_object->userInfo.time);
|
||||
KyInfo() << "sleepTime = " << sleepTime << "多页扫描";
|
||||
}
|
||||
emit g_user_signal->dbusInhabitSignal(); // 阻止扫描过程中睡眠
|
||||
|
||||
do {
|
||||
emit g_user_signal->dbusInhabitSignal();
|
||||
KyInfo() << "start_scanning start";
|
||||
ret = g_sane_object->startScanning(g_sane_object->userInfo);
|
||||
KyInfo() << "start_scanning end, status = " << ret;
|
||||
|
||||
KyInfo() << "start_scanning start";
|
||||
ret = g_sane_object->startScanning(g_sane_object->userInfo);
|
||||
KyInfo() << "start_scanning end, status = " << ret;
|
||||
// if(ret != SANE_STATUS_GOOD){
|
||||
// ;
|
||||
// }
|
||||
|
||||
int saneStatus = ret;
|
||||
int saneStatus = ret;
|
||||
|
||||
g_user_signal->scanThreadFinished(ret);
|
||||
g_user_signal->scanThreadFinished(ret);
|
||||
|
||||
emit g_user_signal->dbusUnInhabitSignal();
|
||||
if(isExited){
|
||||
// emit g_user_signal->cancelOprationOKSignal();
|
||||
qDebug()<<"exit before delay!";
|
||||
break;
|
||||
}
|
||||
emit g_user_signal->dbusUnInhabitSignal();
|
||||
|
||||
if (saneStatus != SANE_STATUS_GOOD) {
|
||||
// Avoid duplicate scan in multiple scanning while meet error
|
||||
break;
|
||||
}
|
||||
KyInfo() << "sleep end."
|
||||
<< "scanPageNumber = " << g_sane_object->scanPageNumber;
|
||||
|
||||
KyInfo() << "start sleep time: " << sleepTime;
|
||||
sleep(sleepTime);
|
||||
|
||||
g_sane_object->scanPageNumber += 1;
|
||||
|
||||
KyInfo() << "sleep end."
|
||||
<< "scanPageNumber = " << g_sane_object->scanPageNumber;
|
||||
|
||||
} while ((sleepTime != 0) && (! isExited));
|
||||
emit g_user_signal->cancelOprationOKSignal();
|
||||
g_sane_object->isOnScanning = false;
|
||||
quit();
|
||||
}
|
||||
|
||||
|
@ -1052,71 +1088,3 @@ void RectifyThread::rectifyThreadStop()
|
|||
wait();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
OcrThread::OcrThread(QObject *parent)
|
||||
: QThread(parent)
|
||||
{
|
||||
KyInfo() << "Create OCR Thread.";
|
||||
}
|
||||
|
||||
OcrThread::~OcrThread()
|
||||
{
|
||||
}
|
||||
|
||||
void OcrThread::run()
|
||||
{
|
||||
KyInfo() << "begin to run ocr thread !\n";
|
||||
tesseract::TessBaseAPI *api = new tesseract::TessBaseAPI();
|
||||
|
||||
if (api->Init(NULL, "chi_sim")) {
|
||||
KyInfo() << "Could not initialize tesseract.\n";
|
||||
g_sane_object->ocrOutputText = tr("Unable to read text");
|
||||
|
||||
terminate();
|
||||
wait();
|
||||
|
||||
g_user_signal->toolbarOcrOperationFinished();
|
||||
return;
|
||||
}
|
||||
|
||||
KyInfo() << "before pixRead.";
|
||||
Pix *image = pixRead(ScanningPicture);
|
||||
if (! image) {
|
||||
KyInfo() << "pixRead error!";
|
||||
g_sane_object->ocrOutputText = tr("Unable to read text");
|
||||
if (api)
|
||||
api->End();
|
||||
|
||||
terminate();
|
||||
wait();
|
||||
|
||||
g_user_signal->toolbarOcrOperationFinished();
|
||||
|
||||
return;
|
||||
}
|
||||
if (image) {
|
||||
KyInfo() << "before setImage.";
|
||||
api->SetImage(image);
|
||||
g_sane_object->ocrOutputText = api->GetUTF8Text();
|
||||
}
|
||||
|
||||
KyInfo() << "before destroy image.";
|
||||
if (api) {
|
||||
api->End();
|
||||
}
|
||||
if (image) {
|
||||
pixDestroy(&image);
|
||||
}
|
||||
|
||||
g_user_signal->toolbarOcrOperationFinished();
|
||||
}
|
||||
|
||||
void OcrThread::ocrThreadStop()
|
||||
{
|
||||
if(isRunning())
|
||||
{
|
||||
terminate();
|
||||
wait();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,6 +25,8 @@
|
|||
#include <QBrush>
|
||||
#include <QColor>
|
||||
#include <QEvent>
|
||||
#include <QList>
|
||||
#include <QMessageBox>
|
||||
#include <QGuiApplication>
|
||||
#include <QHBoxLayout>
|
||||
#include <QPalette>
|
||||
|
@ -63,6 +65,7 @@
|
|||
#include "rectify.h"
|
||||
#include <kylin_system/session_management.hpp>
|
||||
#include "usbhotplugthread.h"
|
||||
#include "utils/rotatechangeinfo.h"
|
||||
|
||||
#include <sane/sane.h>
|
||||
|
||||
|
@ -119,19 +122,6 @@ public:
|
|||
|
||||
};
|
||||
|
||||
class OcrThread : public QThread
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit OcrThread(QObject *parent = 0);
|
||||
~OcrThread();
|
||||
|
||||
void run() Q_DECL_OVERRIDE;
|
||||
|
||||
void ocrThreadStop();
|
||||
|
||||
};
|
||||
|
||||
class MainWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
@ -171,7 +161,7 @@ private:
|
|||
login1dbusManager *m_dbus = nullptr;
|
||||
quint32 flag;
|
||||
kdk::kabase::SessionManagement sessionManagementTest;
|
||||
|
||||
RotateChangeInfo rotateInfo;
|
||||
TitleBar *m_titleBar;
|
||||
DisplayWidget *m_displayWidget;
|
||||
// QScrollArea *m_displayScrollArea;
|
||||
|
@ -191,9 +181,8 @@ private:
|
|||
RunningDialog *m_rectifyRunningDialog;
|
||||
RectifyThread m_rectifyThread;
|
||||
|
||||
OcrThread m_ocrThread;
|
||||
|
||||
bool cancelFlag = false;
|
||||
QList<QMessageBox*> m_msgBoxList;
|
||||
|
||||
bool isDarkTheme();
|
||||
void showHelpDialog();
|
||||
|
@ -205,6 +194,7 @@ private:
|
|||
|
||||
|
||||
public slots:
|
||||
void rotationChanged(bool isPCMode,int width,int height);
|
||||
void warnMsg(QString msg);
|
||||
void maximizeWindowSlot();
|
||||
void closeWindowSlot();
|
||||
|
@ -219,10 +209,9 @@ public slots:
|
|||
void startScanOperationSlot();
|
||||
void stopScanOperationSlot();
|
||||
void showScanDialogSlot();
|
||||
void closeScanDialogSlot();
|
||||
void scanThreadFinishedSlot(int saneStatus);
|
||||
|
||||
void startOcrOperationSlot();
|
||||
|
||||
void showBeautyRunningDialog();
|
||||
void hideBeautyRunningDialog();
|
||||
|
||||
|
@ -235,6 +224,11 @@ public slots:
|
|||
void dbusUnInhabitSlot();
|
||||
|
||||
void cancelScanningSlot();
|
||||
void onPrepareForSleep(bool isSleep);
|
||||
|
||||
void newUsbConnectedSlot();
|
||||
void startUsbHotPlugThreadSlot();
|
||||
void startHotPlutSlot();
|
||||
|
||||
};
|
||||
#endif // MainWidget_H
|
||||
|
|
|
@ -234,6 +234,16 @@ void RunningDialog::setWaitText(QString text)
|
|||
waitText->setText(text);
|
||||
}
|
||||
|
||||
void RunningDialog::disconnectCancelButton()
|
||||
{
|
||||
disconnect(btnCancel, SIGNAL(clicked()), this, SLOT(reject()));
|
||||
}
|
||||
|
||||
void RunningDialog::hideCancelButton()
|
||||
{
|
||||
btnCancel->hide();
|
||||
}
|
||||
|
||||
void RunningDialog::runningDialogStyleChanged()
|
||||
{
|
||||
if (isDarkTheme()) {
|
||||
|
@ -250,6 +260,11 @@ void RunningDialog::runningDialogStyleChanged()
|
|||
}
|
||||
}
|
||||
|
||||
void RunningDialog::m_closeButtondisconnect()
|
||||
{
|
||||
disconnect(m_closeButton, &QPushButton::clicked, this, &RunningDialog::reject);
|
||||
}
|
||||
|
||||
void RunningDialog::showPictures()
|
||||
{
|
||||
QImage image;
|
||||
|
|
|
@ -44,12 +44,15 @@ class RunningDialog : public QDialog
|
|||
Q_OBJECT
|
||||
public:
|
||||
QPushButton *btnCancel;
|
||||
QPushButton *m_closeButton;
|
||||
explicit RunningDialog(QWidget *parent = nullptr);
|
||||
explicit RunningDialog(QWidget *parent = nullptr, QString text="");
|
||||
|
||||
void getFileListNum();
|
||||
QFileInfoList GetFileList(QString path);
|
||||
void setWaitText(QString text);
|
||||
void disconnectCancelButton();
|
||||
void hideCancelButton();
|
||||
|
||||
private:
|
||||
int num = 0;
|
||||
|
@ -62,7 +65,7 @@ private:
|
|||
QTimer *time;
|
||||
|
||||
// QLabel *m_titleLabel;
|
||||
QPushButton *m_closeButton;
|
||||
|
||||
QHBoxLayout *m_titleHBoxLayout;
|
||||
|
||||
QLabel *waitImage;
|
||||
|
@ -80,6 +83,7 @@ private:
|
|||
|
||||
public slots:
|
||||
void runningDialogStyleChanged();
|
||||
void m_closeButtondisconnect();
|
||||
void showPictures();
|
||||
|
||||
};
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
*/
|
||||
#include "saneobject.h"
|
||||
#include <ukui-log4qt.h>
|
||||
|
||||
#include <QApplication>
|
||||
SaneObject * SaneObject::instance = new SaneObject;
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -45,17 +45,18 @@ typedef struct _OptDescriptor {
|
|||
int numSizeTlY;
|
||||
int numPageWidth;
|
||||
int numPageHeight;
|
||||
int numPageCount;
|
||||
} OptDescriptor;
|
||||
|
||||
static OptDescriptor g_optDesc = {2, 3, 6, 10, 11,8,9,6,7};
|
||||
|
||||
static OptDescriptor g_optDesc = {2, 3, 6, 10, 11, 8, 9, 6, 7, 63};
|
||||
|
||||
static double g_saneSizeA4BrY = 297;
|
||||
static SANE_Handle g_device = nullptr;
|
||||
static int g_verbose;
|
||||
static SANE_Byte *g_buf;
|
||||
static size_t g_BufSize;
|
||||
static SANE_Int g_BufSize;
|
||||
static SANE_Device *g_saneDevice = nullptr;
|
||||
const SANE_Device **g_deviceList = nullptr;
|
||||
|
||||
static bool stopSaneExceptionFlag = false;
|
||||
|
||||
|
@ -162,7 +163,8 @@ static void *advance (Image *image)
|
|||
|
||||
static SANE_Status onScanning(FILE *ofp)
|
||||
{
|
||||
int i = 0, len = 0, offset = 0, must_buffer = 0, hundred_percent = 1;
|
||||
int i = 0, offset = 0, must_buffer = 0, hundred_percent = 1;
|
||||
SANE_Int len;
|
||||
bool first_frame = true;
|
||||
SANE_Byte min = 0xff, max = 0;
|
||||
SANE_Parameters parm;
|
||||
|
@ -171,8 +173,8 @@ static SANE_Status onScanning(FILE *ofp)
|
|||
SANE_Word total_bytes = 0;
|
||||
SANE_Int hang_over = -1;
|
||||
|
||||
// int resolution_value = g_sane_object->resolution_value;
|
||||
int resolution_value = 75;
|
||||
int resolution_value = g_sane_object->resolution_value;
|
||||
// int resolution_value = 75;
|
||||
|
||||
#if HAVE_LIBJPEG
|
||||
int jpegrow = 0;
|
||||
|
@ -284,7 +286,7 @@ static SANE_Status onScanning(FILE *ofp)
|
|||
|
||||
hundred_percent = parm.bytes_per_line * parm.lines \
|
||||
*((parm.format == SANE_FRAME_RGB || parm.format == SANE_FRAME_GRAY) ? 1 : 3);
|
||||
while (1) {
|
||||
while (status == SANE_STATUS_GOOD && g_sane_object->stopSaneReadFlag == false) {
|
||||
static int i =0;
|
||||
double progr;
|
||||
qDebug()<<"read file!" << i++;
|
||||
|
@ -300,28 +302,11 @@ static SANE_Status onScanning(FILE *ofp)
|
|||
|
||||
if (status != SANE_STATUS_GOOD) {
|
||||
if (status != SANE_STATUS_EOF) {
|
||||
return status;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
#if 0
|
||||
if (g_sane_object->stopSaneReadFlag) {
|
||||
KyInfo() << "扫描数据读取操作被用户取消!";
|
||||
if (status != SANE_STATUS_EOF) {
|
||||
KyInfo() << "扫描数据操作尚未完成!";
|
||||
status = SANE_STATUS_CANCELLED;
|
||||
|
||||
g_user_signal->scanThreadFinished(status);
|
||||
|
||||
// return status;
|
||||
|
||||
goto cleanup;
|
||||
// return status;
|
||||
}
|
||||
KyInfo() << "扫描数据操作取消: " << status;
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (must_buffer) {
|
||||
KyInfo() << "must_buffer = " << must_buffer;
|
||||
|
@ -431,6 +416,10 @@ static SANE_Status onScanning(FILE *ofp)
|
|||
}
|
||||
}
|
||||
}
|
||||
if(g_sane_object->stopSaneReadFlag == true){
|
||||
return SANE_STATUS_CANCELLED;
|
||||
}
|
||||
fflush(ofp);
|
||||
first_frame = 0;
|
||||
qDebug()<< "0531info: first_frame value has changed:" << first_frame;
|
||||
qDebug()<< "0531info: parm.last_frame value:" << parm.last_frame;
|
||||
|
@ -479,8 +468,6 @@ static SANE_Status onScanning(FILE *ofp)
|
|||
#endif
|
||||
KyInfo() << "end scanning status: " << status;
|
||||
|
||||
fflush( ofp );
|
||||
|
||||
cleanup:
|
||||
#if HAVE_LIBJPEG
|
||||
if(g_sane_object->output_format == OUTPUT_JPEG) {
|
||||
|
@ -494,7 +481,7 @@ cleanup:
|
|||
KyInfo() << "free image data!";
|
||||
free (image.data);
|
||||
}
|
||||
KyInfo() << "end scanning status: " << status;
|
||||
KyInfo() << "end scanning status: " << sane_strstatus(status);
|
||||
return status;
|
||||
}
|
||||
void SaneObject::stopSaneWhenEndThisCircle(){
|
||||
|
@ -512,6 +499,43 @@ void SaneObject::stopSaneWhenEndThisCircle(){
|
|||
g_user_signal->scanThreadFinished(status);
|
||||
}
|
||||
|
||||
static void authCallback (SANE_String_Const resource, SANE_Char *username, SANE_Char *password)
|
||||
{
|
||||
// KyInfo() << "auth_callback" << resource << username << password;
|
||||
}
|
||||
|
||||
void SaneObject::refreshListSlots()
|
||||
{
|
||||
QString name;
|
||||
QStringList names;
|
||||
|
||||
saneClose();
|
||||
saneExit();
|
||||
SANE_Int version_code = 0;
|
||||
sane_init(&version_code, authCallback);
|
||||
SANE_Status status = sane_get_devices (&g_deviceList, SANE_FALSE);
|
||||
GlobalUserSignal::getInstance()->setDeviceList(g_deviceList);
|
||||
|
||||
for (int i = 0; g_deviceList[i]; ++i) {
|
||||
KyInfo() << "mark-Name-usb: " << g_deviceList[i]->name
|
||||
<< "mark-Vendor-usb: " << g_deviceList[i]->vendor
|
||||
<< "mark-Model-usb: " << g_deviceList[i]->model
|
||||
<< "mark-Type-usb: " << g_deviceList[i]->type;
|
||||
|
||||
name = QString("%1 %2 %3").arg(g_deviceList[i]->vendor).arg(g_deviceList[i]->model).arg(g_deviceList[i]->name);
|
||||
names << name;
|
||||
}
|
||||
setSaneNames(names);
|
||||
|
||||
g_sane_object->setSaneHaveHandle(false);
|
||||
g_user_signal->updateSetting();
|
||||
|
||||
QTimer::singleShot(500, this, [this]() {emit g_user_signal->startHotPlugSignal();});
|
||||
// 刷新列表完成
|
||||
QString msg = tr("Refresh list complete.");
|
||||
g_user_signal->warnMsg(msg);
|
||||
}
|
||||
|
||||
void SaneObject::stopSaneForException(){
|
||||
stopSaneExceptionFlag = true;
|
||||
}
|
||||
|
@ -536,45 +560,86 @@ SANE_Status getSaneParameters(SANE_Handle device)
|
|||
SANE_Status doScan(const char *fileName)
|
||||
{
|
||||
SANE_Status status = SANE_STATUS_GOOD;
|
||||
QString text = g_sane_object->userInfo.pageNumber;
|
||||
QString text2 = g_sane_object->userInfo.type;
|
||||
QString suffix;
|
||||
|
||||
g_sane_object->output_format = OUTPUT_PNM;
|
||||
if (g_sane_object->output_format == OUTPUT_JPEG) {
|
||||
suffix = QString(".jpg");
|
||||
}else{
|
||||
suffix = QString(".pnm");
|
||||
}
|
||||
FILE *ofp = nullptr;
|
||||
char path[PATH_MAX] = {0};
|
||||
char part_path[PATH_MAX] = {0};
|
||||
g_BufSize = (32 * 1024);
|
||||
g_buf = static_cast<SANE_Byte *>(malloc(g_BufSize));
|
||||
QString path;
|
||||
QString part_path;
|
||||
QString save_path;
|
||||
g_BufSize = 1024 * 32;
|
||||
g_buf = static_cast<SANE_Byte*>(malloc(g_BufSize));
|
||||
bool multiscan = 0;
|
||||
int pagecount = 1;
|
||||
while (status == SANE_STATUS_GOOD || (status == 5 && multiscan)){
|
||||
path = fileName;
|
||||
QFileInfo pathinfo(path);
|
||||
if(text.compare("Multiple", Qt::CaseInsensitive) == 0 || text.compare("多页扫描", Qt::CaseInsensitive) == 0 || text2.compare("ADF Duplex", Qt::CaseInsensitive) == 0 ||text2.compare("ADF 双面", Qt::CaseInsensitive) == 0){
|
||||
multiscan = 1;
|
||||
part_path = pathinfo.absolutePath() + "/" + pathinfo.baseName() + "[" + QString::number(pagecount) + "]" + suffix + ".part";
|
||||
path = pathinfo.absolutePath() + "/" + pathinfo.baseName() + "[" + QString::number(pagecount) + "]" + suffix;
|
||||
save_path = g_sane_object->saveFullScanFileName + "[" + QString::number(pagecount) + "]" + QString(".") + g_sane_object->userInfo.format;
|
||||
|
||||
do {
|
||||
sprintf (path, "%s", fileName);
|
||||
int len = strlen(fileName);
|
||||
int len1 = strlen(path);
|
||||
strncpy (part_path, path, sizeof(part_path) - 1);
|
||||
strcat (part_path, ".part");
|
||||
g_sane_object->loadFullScanFileNames.append(path);
|
||||
g_sane_object->saveFullScanFileNames.append(save_path);
|
||||
pagecount++;
|
||||
}else{
|
||||
part_path = pathinfo.absolutePath() + "/" + pathinfo.baseName() + suffix + ".part";
|
||||
path = pathinfo.absolutePath() + "/" + pathinfo.baseName() + suffix;
|
||||
save_path = g_sane_object->saveFullScanFileName + QString(".") + g_sane_object->userInfo.format;
|
||||
|
||||
g_sane_object->loadFullScanFileNames.append(path);
|
||||
g_sane_object->saveFullScanFileNames.append(save_path);
|
||||
}
|
||||
KyInfo() << "part_path = " << part_path;
|
||||
status = sane_start(g_device);
|
||||
|
||||
if(status == SANE_STATUS_NO_DOCS){
|
||||
if(g_sane_object->scanPageNumber == 0){
|
||||
return SANE_STATUS_NO_DOCS;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if(status == SANE_STATUS_GOOD){
|
||||
g_sane_object->scanPageNumber += 1;
|
||||
}
|
||||
|
||||
status = sane_start (g_device);
|
||||
KyInfo() << "`sane_start` status: " << sane_strstatus(status);
|
||||
if (status != SANE_STATUS_GOOD) {
|
||||
KyInfo() << "Cannot start scan devices, sane_status = " << status;
|
||||
// g_sane_object->setSaneStatus(false);
|
||||
g_user_signal->closeScanDialog();
|
||||
break;
|
||||
}
|
||||
|
||||
if (nullptr == (ofp = fopen (part_path, "w"))) {
|
||||
if(g_sane_object->scanPageNumber != 1){
|
||||
emit g_sane_object->updatePageNum();
|
||||
}
|
||||
|
||||
if (nullptr == (ofp = fopen(part_path.toLocal8Bit().data(), "w"))) {
|
||||
status = SANE_STATUS_ACCESS_DENIED;
|
||||
break;
|
||||
}
|
||||
|
||||
status = onScanning(ofp);
|
||||
|
||||
switch (status) {
|
||||
switch(status) {
|
||||
case SANE_STATUS_GOOD:
|
||||
case SANE_STATUS_EOF: {
|
||||
status = SANE_STATUS_GOOD;
|
||||
// status = SANE_STATUS_GOOD;
|
||||
if (!ofp || (0 != fclose(ofp))) {
|
||||
status = SANE_STATUS_ACCESS_DENIED;
|
||||
break;
|
||||
} else {
|
||||
ofp = nullptr;
|
||||
if (rename (part_path, path)) {
|
||||
if (rename (part_path.toLocal8Bit().data(), path.toLocal8Bit().data())) {
|
||||
status = SANE_STATUS_ACCESS_DENIED;
|
||||
break;
|
||||
}
|
||||
|
@ -584,54 +649,50 @@ SANE_Status doScan(const char *fileName)
|
|||
default:
|
||||
break;
|
||||
}
|
||||
} while (0);
|
||||
}
|
||||
if(multiscan == 1 && g_sane_object->scanPageNumber != 1 && status !=SANE_STATUS_CANCELLED){
|
||||
g_sane_object->loadFullScanFileNames.removeLast();
|
||||
g_sane_object->saveFullScanFileNames.removeLast();
|
||||
g_sane_object->scanPageNumber -= 1;
|
||||
status = SANE_STATUS_EOF;
|
||||
}
|
||||
|
||||
#if 0
|
||||
if (SANE_STATUS_GOOD != status)
|
||||
sane_cancel (g_device);
|
||||
#endif
|
||||
KyInfo() << "sane_cancel";
|
||||
|
||||
sane_cancel (g_device);
|
||||
KyInfo() << "sane_cancel";
|
||||
|
||||
if (ofp) {
|
||||
fclose (ofp);
|
||||
ofp = nullptr;
|
||||
}
|
||||
|
||||
KyInfo() << "sane_cancel: status = " << status;
|
||||
if (g_buf) {
|
||||
free (g_buf);
|
||||
g_buf = nullptr;
|
||||
}
|
||||
KyInfo() << "sane_cancel: status = " << status;
|
||||
|
||||
sane_cancel(g_device);
|
||||
return status;
|
||||
}
|
||||
|
||||
static void authCallback (SANE_String_Const resource, SANE_Char *username, SANE_Char *password)
|
||||
{
|
||||
KyInfo() << "auth_callback" << resource << username << password;
|
||||
}
|
||||
static void saneInit()
|
||||
{
|
||||
SANE_Int version_code = {0};
|
||||
SANE_Int version_code = 0;
|
||||
|
||||
sane_init (&version_code, authCallback);
|
||||
sane_init(&version_code, authCallback);
|
||||
|
||||
KyInfo() << "version_code = " << version_code;
|
||||
}
|
||||
|
||||
static SANE_Status saneGetDevices(const SANE_Device ***device_list)
|
||||
{
|
||||
SANE_Status status = SANE_STATUS_GOOD;
|
||||
|
||||
KyInfo() << "Get all scan devices, please waiting ...";
|
||||
|
||||
/// This will be crashed unexpectedly, samples can be followed:
|
||||
/// 1. Caused by specific drives, such as `lenovo-image-g-series_1.0-16_arm64`, so we need Vendor developers to handle it
|
||||
/// 2. This will take a long time
|
||||
status = sane_get_devices (device_list, SANE_TRUE);
|
||||
|
||||
memset(device_list, 0x00, sizeof(device_list));
|
||||
|
||||
SANE_Status status = sane_get_devices(device_list, SANE_FALSE);
|
||||
|
||||
if (status) {
|
||||
KyInfo() << "status = " << sane_strstatus(status);
|
||||
|
@ -671,6 +732,8 @@ SANE_Status saneOpen(SANE_Device *device, SANE_Handle *sane_handle)
|
|||
/// status = Error during device I/O: can be this scanner connected by usb is error,
|
||||
/// so check usb connected.
|
||||
KyInfo() << "status = " << sane_strstatus(status);
|
||||
}else{
|
||||
KyInfo() << "Open scanner success";
|
||||
}
|
||||
|
||||
return status;
|
||||
|
@ -687,6 +750,7 @@ SANE_Status getOptionColors(SANE_Handle sane_handle, int optnum)
|
|||
colorScanModes.push_back("24bit Color[Fast]"); /* brother4 driver, Brother DCP-1622WE, ADS3600W; simple-scan(#134), kylin-scanner(#74173) */
|
||||
colorScanModes.push_back("24bit Color"); /* Seen in the proprietary brother3 driver */
|
||||
colorScanModes.push_back("Color - 16 Million Colors"); /*Samsung unified driver. simple-scan(LP: 892915) */
|
||||
colorScanModes.push_back("COLOR"); /* deli */
|
||||
|
||||
QVector<std::string> grayScanModes;
|
||||
grayScanModes.push_back(SANE_VALUE_SCAN_MODE_GRAY);
|
||||
|
@ -696,6 +760,8 @@ SANE_Status getOptionColors(SANE_Handle sane_handle, int optnum)
|
|||
grayScanModes.push_back(SANE_I18N("Grayscale"));
|
||||
grayScanModes.push_back("True Gray"); /* Seen in the proprietary brother3 driver, Brother ADS3600W; however, Gray[Error Diffusion] is error gray scan modes */
|
||||
grayScanModes.push_back("Grayscale - 256 Levels"); /* Samsung unified driver. simple-scan(LP: 892915) */
|
||||
grayScanModes.push_back("GRAY"); /* deli */
|
||||
|
||||
|
||||
QVector<std::string> lineartScanModes;
|
||||
lineartScanModes.push_back(SANE_VALUE_SCAN_MODE_LINEART);
|
||||
|
@ -710,6 +776,7 @@ SANE_Status getOptionColors(SANE_Handle sane_handle, int optnum)
|
|||
lineartScanModes.push_back("Black and White - Line Art"); /* Samsung unified driver. simple-scan(LP: 892915) */
|
||||
lineartScanModes.push_back("Black and White - Halftone");
|
||||
lineartScanModes.push_back("bw"); /* 松下KV-N1058Y for kylin-scanner */
|
||||
lineartScanModes.push_back("BINARY"); /* deli */
|
||||
|
||||
const SANE_Option_Descriptor *opt;
|
||||
SANE_Status status = SANE_STATUS_INVAL;
|
||||
|
@ -760,6 +827,22 @@ SANE_Status getOptionColors(SANE_Handle sane_handle, int optnum)
|
|||
return status;
|
||||
}
|
||||
|
||||
SANE_Status setOptionPages(SANE_Handle sane_handle, SANE_Int pages){
|
||||
SANE_Status status;
|
||||
KyInfo() << "options: " << g_optDesc.numPageCount
|
||||
<< "Set page option = " << pages;
|
||||
status = sane_control_option(sane_handle, static_cast<SANE_Int>(g_optDesc.numPageCount),
|
||||
SANE_ACTION_SET_VALUE, &pages, nullptr);
|
||||
if (status != SANE_STATUS_GOOD) {
|
||||
KyInfo() << "status = " << status << "desc: " << sane_strstatus(status);
|
||||
return status;
|
||||
}
|
||||
|
||||
KyInfo() << "Set countpage success.";
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
SANE_Status setOptionColors(SANE_Handle sane_handle, SANE_String val_color)
|
||||
{
|
||||
SANE_Status status = SANE_STATUS_INVAL;
|
||||
|
@ -954,8 +1037,8 @@ static SANE_Status getOptionResolutions(SANE_Handle sane_handle, int optnum)
|
|||
KyInfo() << "Get resolution option = " << optnum;
|
||||
|
||||
opt = sane_get_option_descriptor(sane_handle, optnum);
|
||||
|
||||
for (int i = 0; opt->constraint.word_list[i]; ++i) {
|
||||
int count = *(opt->constraint.word_list);
|
||||
for (int i = 1; i <= count; ++i) {
|
||||
int res = *(opt->constraint.word_list + i);
|
||||
status = SANE_STATUS_GOOD;
|
||||
// KyInfo() << "resolution int = " << res;
|
||||
|
@ -1149,14 +1232,50 @@ SANE_Status setOptionSizes(SANE_Handle sane_handle, int optnum, SANE_Int val_siz
|
|||
return status;
|
||||
}
|
||||
|
||||
static const SANE_Option_Descriptor *getOptdescByName(SANE_Handle device, const char *name, int *option_num)
|
||||
{
|
||||
SANE_Int num_dev_options;
|
||||
SANE_Status status;
|
||||
|
||||
/* Get the number of options. */
|
||||
status = sane_control_option (device, 0,
|
||||
SANE_ACTION_GET_VALUE, &num_dev_options, nullptr);
|
||||
|
||||
KyInfo() << "\n\n\nGet Option name: " << name << status;
|
||||
|
||||
for (*option_num = 0; *option_num < num_dev_options; (*option_num)++) {
|
||||
const SANE_Option_Descriptor *opt;
|
||||
|
||||
opt = sane_get_option_descriptor (device, *option_num);
|
||||
|
||||
if (opt->name) {
|
||||
// KyInfo() << opt->name;
|
||||
}
|
||||
|
||||
if (opt->name && strcmp(opt->name, name) == 0) {
|
||||
KyInfo() << "Get option desc for " << *option_num << "opt->name = " << opt->name << "name" << name;
|
||||
return (opt);
|
||||
}
|
||||
}
|
||||
return (nullptr);
|
||||
}
|
||||
|
||||
SANE_Status setOptionSizesReal(SANE_Handle sane_handle, SANE_Int val_size_br_x,
|
||||
SANE_Int val_size_br_y)
|
||||
{
|
||||
SANE_Status status = SANE_STATUS_GOOD;
|
||||
KyInfo() << "Size bottom-right location(xy) = " << val_size_br_x << val_size_br_y;
|
||||
int index = -1;
|
||||
const SANE_Option_Descriptor *opt;
|
||||
int optnum;
|
||||
if(g_sane_object->getSaneOptIndex(SANE_NAME_SCAN_BR_X,index)){
|
||||
status = setOptionSizes(sane_handle, index, SANE_FIX(val_size_br_x));
|
||||
opt = getOptdescByName(sane_handle, SANE_NAME_SCAN_BR_X, &optnum);
|
||||
if(opt->type == SANE_TYPE_INT){
|
||||
status = setOptionSizes(sane_handle, index, val_size_br_x);
|
||||
}else{
|
||||
status = setOptionSizes(sane_handle, index, SANE_FIX(val_size_br_x));
|
||||
}
|
||||
|
||||
if (status != SANE_STATUS_GOOD) {
|
||||
KyInfo() << "status = " << sane_strstatus(status);
|
||||
return status;
|
||||
|
@ -1164,7 +1283,13 @@ SANE_Status setOptionSizesReal(SANE_Handle sane_handle, SANE_Int val_size_br_x,
|
|||
index = -1;
|
||||
}
|
||||
if(g_sane_object->getSaneOptIndex(SANE_NAME_SCAN_BR_Y,index)){
|
||||
status = setOptionSizes(sane_handle, index, SANE_FIX(val_size_br_y));
|
||||
|
||||
opt = getOptdescByName(sane_handle, SANE_NAME_SCAN_BR_Y, &optnum);
|
||||
if(opt->type == SANE_TYPE_INT){
|
||||
status = setOptionSizes(sane_handle, index, val_size_br_y);
|
||||
}else{
|
||||
status = setOptionSizes(sane_handle, index, SANE_FIX(val_size_br_y));
|
||||
}
|
||||
if (status != SANE_STATUS_GOOD) {
|
||||
KyInfo() << "status = " << sane_strstatus(status);
|
||||
return status;
|
||||
|
@ -1259,35 +1384,6 @@ static void guardsFree(void *ptr)
|
|||
free(p);
|
||||
}
|
||||
|
||||
static const SANE_Option_Descriptor *getOptdescByName(SANE_Handle device, const char *name,
|
||||
int *option_num)
|
||||
{
|
||||
SANE_Int num_dev_options;
|
||||
SANE_Status status;
|
||||
|
||||
/* Get the number of options. */
|
||||
status = sane_control_option (device, 0,
|
||||
SANE_ACTION_GET_VALUE, &num_dev_options, nullptr);
|
||||
|
||||
KyInfo() << "\n\n\nGet Option name: " << name << status;
|
||||
|
||||
for (*option_num = 0; *option_num < num_dev_options; (*option_num)++) {
|
||||
const SANE_Option_Descriptor *opt;
|
||||
|
||||
opt = sane_get_option_descriptor (device, *option_num);
|
||||
|
||||
if (opt->name) {
|
||||
// KyInfo() << opt->name;
|
||||
}
|
||||
|
||||
if (opt->name && strcmp(opt->name, name) == 0) {
|
||||
KyInfo() << "Get option desc for " << *option_num << "opt->name = " << opt->name << "name" << name;
|
||||
return (opt);
|
||||
}
|
||||
}
|
||||
return (nullptr);
|
||||
}
|
||||
|
||||
void displayOptionValue(SANE_Handle device, int optnum)
|
||||
{
|
||||
const SANE_Option_Descriptor *opt;
|
||||
|
@ -1372,6 +1468,54 @@ static SANE_Status getOptionValue(SANE_Handle device, const char *option_name)
|
|||
<< "resolution = " << val_resolution
|
||||
<< "constraint_type = " << opt->constraint_type;
|
||||
}
|
||||
|
||||
if(!strcmp(option_name, "scan-count")){
|
||||
g_optDesc.numPageCount = optnum;
|
||||
}
|
||||
if(!strcmp(option_name, SANE_NAME_SCAN_BR_X)){
|
||||
g_optDesc.numSizeBrX = optnum;
|
||||
// Via br_x to decide scan sizes
|
||||
int size_range = static_cast<int>( opt->constraint.range->max - opt->constraint.range->min);
|
||||
KyInfo() << "min = " << opt->constraint.range->min
|
||||
<< "max = " << opt->constraint.range->max
|
||||
<< "size_range = " << size_range;
|
||||
if (val_size >= 420)
|
||||
sizes << "A2";
|
||||
if (size_range >= 297)
|
||||
sizes << "A3";
|
||||
if (size_range >= 209)
|
||||
sizes << "A4";
|
||||
if (size_range >= 148)
|
||||
sizes << "A5";
|
||||
if (size_range >= 105)
|
||||
sizes << "A6";
|
||||
|
||||
g_sane_object->setSaneSizes(sizes);
|
||||
KyInfo() << "size optnum = " << g_optDesc.numSizeBrX
|
||||
<< "br_x" << val_size
|
||||
<< "constraint_type = " << opt->constraint_type;
|
||||
}
|
||||
if(!strcmp(option_name, SANE_NAME_SCAN_BR_Y)){
|
||||
g_optDesc.numSizeBrY = optnum;
|
||||
// Need via br_y to decide scan sizes after br_x, in case of (215.9, 296.926) to A4, which should be A5
|
||||
int size_range = static_cast<int>(opt->constraint.range->max - opt->constraint.range->min);
|
||||
double min = opt->constraint.range->min;
|
||||
double max = opt->constraint.range->max;
|
||||
KyInfo() << "min = " << min
|
||||
<< "max = " << max
|
||||
<< "size_range = " << size_range;
|
||||
// Judge max(296.926) less than A4BRY(297)
|
||||
if ((qCeil(max) == A4BRY) && (qFloor(max) == A4BRY - 1)) {
|
||||
KyInfo() << "A4 br_y max = " << max;
|
||||
g_saneSizeA4BrY = max;
|
||||
} else {
|
||||
g_saneSizeA4BrY = A4BRY;
|
||||
}
|
||||
KyInfo() << "size optnum = " << g_optDesc.numSizeBrY
|
||||
<< "br_y" << val_size
|
||||
<< "g_saneSizeA4Bry = " <<g_saneSizeA4BrY
|
||||
<< "constraint_type = " << opt->constraint_type;
|
||||
}
|
||||
break;
|
||||
case SANE_TYPE_BOOL:
|
||||
if (*(SANE_Word *) optval == SANE_FALSE) {
|
||||
|
@ -1413,13 +1557,13 @@ static SANE_Status getOptionValue(SANE_Handle device, const char *option_name)
|
|||
{
|
||||
if (val_size >= 420)
|
||||
sizes << "A2";
|
||||
if (size_range >= 297)
|
||||
if (val_size >= 297)
|
||||
sizes << "A3";
|
||||
if (size_range >= 210)
|
||||
if (val_size >= 209)
|
||||
sizes << "A4";
|
||||
if (size_range >= 148)
|
||||
if (val_size >= 148)
|
||||
sizes << "A5";
|
||||
if (size_range >= 105)
|
||||
if (val_size >= 105)
|
||||
sizes << "A6";
|
||||
}
|
||||
g_sane_object->setSaneSizes(sizes);
|
||||
|
@ -1654,7 +1798,7 @@ static SANE_Status startSaneScan(SANE_Handle sane_handle, SANE_String_Const file
|
|||
return status;
|
||||
}
|
||||
|
||||
void saneCancel(SANE_Handle sane_handle)
|
||||
void SaneObject::saneCancel(SANE_Handle sane_handle)
|
||||
{
|
||||
KyInfo() << "saneCancel()";
|
||||
|
||||
|
@ -1668,54 +1812,58 @@ void saneCancel(SANE_Handle sane_handle)
|
|||
}
|
||||
}
|
||||
|
||||
bool detectSaneDevices()
|
||||
bool SaneObject::detectSaneDevices()
|
||||
{
|
||||
onDetection = true;
|
||||
if(saneHaveStart == true){
|
||||
sane_exit();
|
||||
}
|
||||
KyInfo() << "detectSaneDevices();";
|
||||
QStringList names;
|
||||
SANE_Status sane_status;
|
||||
char name[512] = {0};
|
||||
QString name;
|
||||
saneInit();
|
||||
saneHaveStart = true;
|
||||
//获取扫描设备列表
|
||||
{
|
||||
memset(&g_deviceList,0x00,sizeof(g_deviceList));
|
||||
sane_status = saneGetDevices((&g_deviceList));
|
||||
GlobalUserSignal::getInstance()->setDeviceList(g_deviceList);
|
||||
if (sane_status) {
|
||||
KyInfo() << "Cannot get scan devices, sane_status = " << sane_status;
|
||||
g_sane_object->setSaneStatus(false);
|
||||
return false;
|
||||
}
|
||||
for (int i = 0; g_deviceList[i]; ++i) {
|
||||
KyInfo() << "mark-Name: " << g_deviceList[i]->name
|
||||
<< "mark-Vendor: " << g_deviceList[i]->vendor
|
||||
<< "mark-Model: " << g_deviceList[i]->model
|
||||
<< "mark-Type: " << g_deviceList[i]->type;
|
||||
|
||||
snprintf(name, 512, "%s %s %s", g_deviceList[i]->vendor, g_deviceList[i]->model,g_deviceList[i]->name);
|
||||
sane_status = saneGetDevices(&g_deviceList);
|
||||
GlobalUserSignal::getInstance()->setDeviceList(g_deviceList);
|
||||
if (sane_status) {
|
||||
KyInfo() << "Cannot get scan devices, sane_status = " << sane_status;
|
||||
g_sane_object->setSaneStatus(false);
|
||||
return false;
|
||||
}
|
||||
for (int i = 0; g_deviceList[i]; ++i) {
|
||||
KyInfo() << "mark-Name: " << g_deviceList[i]->name
|
||||
<< "mark-Vendor: " << g_deviceList[i]->vendor
|
||||
<< "mark-Model: " << g_deviceList[i]->model
|
||||
<< "mark-Type: " << g_deviceList[i]->type;
|
||||
name = QString("%1 %2 %3").arg(g_deviceList[i]->vendor).arg( g_deviceList[i]->model).arg(g_deviceList[i]->name);
|
||||
// snprintf(name, 512, "%s %s %s", g_deviceList[i]->vendor, g_deviceList[i]->model,g_deviceList[i]->name);
|
||||
|
||||
names << name;
|
||||
}
|
||||
KyInfo() << names;
|
||||
g_sane_object->setSaneNames(names);
|
||||
|
||||
if (g_deviceList[0]) {
|
||||
g_sane_object->setSaneStatus(true);
|
||||
return true;
|
||||
}else{
|
||||
g_sane_object->setSaneStatus(false);
|
||||
KyInfo() << "find device set status false";
|
||||
return false;
|
||||
}
|
||||
if (g_deviceList[0]) {
|
||||
g_sane_object->setSaneStatus(true);
|
||||
return true;
|
||||
}else{
|
||||
g_sane_object->setSaneStatus(false);
|
||||
KyInfo() << "find device set status false";
|
||||
return false;
|
||||
}
|
||||
onDetection = false;
|
||||
}
|
||||
|
||||
void openSaneDevice(int index)
|
||||
void SaneObject::openSaneDevice(int index)
|
||||
{
|
||||
KyInfo() << "openSaneDevice";
|
||||
|
||||
QStringList names;
|
||||
SANE_Status sane_status;
|
||||
char name[512] = {0};
|
||||
QString name;
|
||||
do {
|
||||
/**
|
||||
* Deal with open same scanner device again meeting `SANE_STATUS_DEVICE_BUSY`,
|
||||
|
@ -1725,10 +1873,11 @@ void openSaneDevice(int index)
|
|||
// Avoid SANE_STATUS_BUSY status
|
||||
KyInfo() << "begin to sane_close()";
|
||||
g_sane_object->setSaneHaveHandle(false);
|
||||
sane_cancel(g_sane_object->handle);
|
||||
sane_close(g_sane_object->handle);
|
||||
}
|
||||
for (int i = 0; g_deviceList[i]; ++i) {
|
||||
snprintf(name, 512, "%s %s %s", g_deviceList[i]->vendor, g_deviceList[i]->model,g_deviceList[i]->name);
|
||||
|
||||
for (int i = 0; g_deviceList[i]; i++) {
|
||||
name = QString("%1 %2 %3").arg(g_deviceList[i]->vendor).arg(g_deviceList[i]->model).arg(g_deviceList[i]->name);
|
||||
names << name;
|
||||
}
|
||||
|
||||
|
@ -1747,6 +1896,7 @@ void openSaneDevice(int index)
|
|||
KyInfo() << "Open a scan device, plese waiting ...";
|
||||
SANE_Handle sane_handle;
|
||||
g_saneDevice = const_cast<SANE_Device *>(*(g_deviceList + index));
|
||||
g_sane_object->devicemodel = g_saneDevice->model;
|
||||
if (!g_saneDevice) {
|
||||
KyInfo() << "No device connected!";
|
||||
sane_status = SANE_STATUS_UNSUPPORTED;
|
||||
|
@ -1768,11 +1918,9 @@ void openSaneDevice(int index)
|
|||
g_sane_object->handle = sane_handle;
|
||||
g_sane_object->setSaneHaveHandle(true);
|
||||
|
||||
KyInfo() << "Start scanning, please waiting ...";
|
||||
|
||||
sane_status = showAllSaneParameters(sane_handle);
|
||||
|
||||
} while(0);
|
||||
emit g_user_signal->hotPlugScanCompleteSignal();
|
||||
}while(0);
|
||||
|
||||
if (sane_status) {
|
||||
g_sane_object->setSaneStatus(false);
|
||||
|
@ -1799,7 +1947,8 @@ SaneObject::SaneObject(QObject *parent) : QObject(parent)
|
|||
|
||||
connect(g_user_signal, &GlobalUserSignal::saneCancelSignal, this, &SaneObject::stopSaneForException);
|
||||
connect(g_user_signal, &GlobalUserSignal::saneRestartSignal, this, &SaneObject::restartSaneForException);
|
||||
connect(g_user_signal,&GlobalUserSignal::openDeviceSignal,this,&SaneObject::openSaneDeviceForPage);
|
||||
connect(g_user_signal, &GlobalUserSignal::openDeviceSignal,this,&SaneObject::openSaneDeviceForPage);
|
||||
connect(g_user_signal, &GlobalUserSignal::refreshListSignal, this, &SaneObject::refreshListSlots);
|
||||
}
|
||||
|
||||
SaneObject::~SaneObject()
|
||||
|
@ -1982,7 +2131,14 @@ void SaneObject::setSaneNameByUser()
|
|||
|
||||
void SaneObject::setSanePageNumberByUser()
|
||||
{
|
||||
|
||||
if(g_sane_object->devicemodel == "HW-3130"){
|
||||
QString userPageNum = g_sane_object->userInfo.pageNumber;
|
||||
if(userPageNum == "单页扫描" || userPageNum == "Single"){
|
||||
setOptionPages(g_sane_object->handle, 1);
|
||||
}else{
|
||||
setOptionPages(g_sane_object->handle, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void SaneObject::setSaneTimeByUser()
|
||||
|
@ -2103,12 +2259,14 @@ void SaneObject::setSaneResolutionByUser()
|
|||
|
||||
int SaneObject::getSaneResolutionByUser(QString resolution)
|
||||
{
|
||||
if (QString::compare(resolution, tr("Auto"), Qt::CaseInsensitive) == 0
|
||||
if (QString::compare(resolution, QApplication::tr("Auto"), Qt::CaseInsensitive) == 0
|
||||
|| QString::compare(resolution, "自动", Qt::CaseInsensitive) == 0
|
||||
|| QString::compare(resolution, "Auto", Qt::CaseInsensitive) == 0) {
|
||||
return 300;
|
||||
return 100;
|
||||
} else if (QString::compare(resolution, tr("75 dpi"), Qt::CaseInsensitive) == 0) {
|
||||
return 75;
|
||||
} else if (QString::compare(resolution, tr("100 dpi"), Qt::CaseInsensitive) == 0){
|
||||
return 100;
|
||||
} else if (QString::compare(resolution, tr("150 dpi"), Qt::CaseInsensitive) == 0) {
|
||||
return 150;
|
||||
} else if (QString::compare(resolution, tr("200 dpi"), Qt::CaseInsensitive) == 0) {
|
||||
|
@ -2124,6 +2282,7 @@ int SaneObject::getSaneResolutionByUser(QString resolution)
|
|||
} else if (QString::compare(resolution, tr("4800 dpi"), Qt::CaseInsensitive) == 0) {
|
||||
return 4800;
|
||||
}
|
||||
return 100;
|
||||
}
|
||||
|
||||
void SaneObject::setSaneSizeByUser()
|
||||
|
@ -2204,15 +2363,9 @@ QString SaneObject::fileNameOperation(){
|
|||
QString saveFullName_tmp;
|
||||
|
||||
QString pageNumber = g_sane_object->userInfo.pageNumber;
|
||||
if (pageNumber.compare("Multiple", Qt::CaseInsensitive) == 0
|
||||
|| pageNumber.compare("多页扫描", Qt::CaseInsensitive) == 0
|
||||
|| pageNumber.compare(tr("Multiple"), Qt::CaseInsensitive) == 0) {
|
||||
|
||||
QString suffix = QString::number(g_sane_object->scanPageNumber);
|
||||
saveFullName_tmp = origSaveName + QString("-") + suffix;
|
||||
}else{
|
||||
saveFullName_tmp = origSaveName;
|
||||
}
|
||||
saveFullName_tmp = origSaveName;
|
||||
|
||||
return saveFullName_tmp;
|
||||
}
|
||||
QString SaneObject::getFullScanFileNameExceptFormatForSave()
|
||||
|
@ -2259,30 +2412,26 @@ int SaneObject::startScanning(UserSelectedInfo info)
|
|||
// openSaneDevice(g_sane_object->openDeviceIndex);
|
||||
|
||||
SANE_Status status = SANE_STATUS_GOOD;
|
||||
|
||||
setSaneAllParametersByUser();
|
||||
|
||||
if(!g_sane_object->m_ParametersHaveSeted){
|
||||
setSaneAllParametersByUser();
|
||||
g_sane_object->m_ParametersHaveSeted = true;
|
||||
}
|
||||
|
||||
QString saveFullName = getFullScanFileNameExceptFormatForSave();
|
||||
QString loadFullName = getFullScanFileNameExceptFormatForPnmLoad();
|
||||
|
||||
output_format = OUTPUT_PNM;
|
||||
if (output_format == OUTPUT_JPEG) {
|
||||
loadFullScanFileName = loadFullName + QString(".jpg");
|
||||
} else {
|
||||
loadFullScanFileName = loadFullName + QString(".pnm");
|
||||
}
|
||||
loadFullScanFileName = loadFullName;
|
||||
|
||||
saveFullScanFileName = saveFullName + QString(".") + g_sane_object->userInfo.format;
|
||||
saveFullScanFileName = saveFullName;
|
||||
|
||||
KyInfo() << "Start scanning, please waiting ...";
|
||||
status = startSaneScan(g_sane_object->handle, loadFullScanFileName.toStdString().c_str());
|
||||
KyInfo() << "Stop scanning, check status: " << status
|
||||
<< "getSaneHaveHandle: " << g_sane_object->getSaneHaveHandle();
|
||||
|
||||
if (g_sane_object->getSaneHaveHandle()) {
|
||||
sane_cancel(g_sane_object->handle);
|
||||
}
|
||||
// if (g_sane_object->getSaneHaveHandle()) {
|
||||
// sane_cancel(g_sane_object->handle);
|
||||
// }
|
||||
KyInfo() << "saveText nowSaveName = " << nowSaveName;
|
||||
|
||||
|
||||
|
@ -2295,6 +2444,12 @@ bool SaneObject::testScannerIsAlive(QString deviceName)
|
|||
return true;
|
||||
}
|
||||
|
||||
void SaneObject::hotPlugScanCompleteSlot()
|
||||
{
|
||||
usbAddSlotIsRunning = false;
|
||||
usbRemoveSlotIsRunning = false;
|
||||
}
|
||||
|
||||
bool SaneObject::getSaneOptIndex(QString desc,int &index)
|
||||
{
|
||||
auto k = m_saneOptions.find(desc);
|
||||
|
|
|
@ -39,6 +39,7 @@
|
|||
#include <QMap>
|
||||
#include <QDir>
|
||||
#include <QDateTime>
|
||||
#include <QTimer>
|
||||
#include <QFileInfo>
|
||||
//using namespace std;
|
||||
|
||||
|
@ -105,7 +106,7 @@ typedef struct _UserSelectedInfo {
|
|||
|
||||
|
||||
enum sizes_type {
|
||||
A2 = 1,
|
||||
A2,
|
||||
A3,
|
||||
A4,
|
||||
A5,
|
||||
|
@ -118,6 +119,8 @@ class SaneObject: public QObject
|
|||
public:
|
||||
static SaneObject *getInstance();
|
||||
|
||||
bool detectSaneDevices();
|
||||
void openSaneDevice(int index);
|
||||
bool getSaneStatus();
|
||||
bool getSaneHaveOpenDevice();
|
||||
bool getSaneHaveHandle();
|
||||
|
@ -136,6 +139,7 @@ public:
|
|||
void setSaneResolutions(QStringList resolution);
|
||||
void setSaneSizes(QStringList size);
|
||||
void setSaneColors(QStringList color);
|
||||
void saneCancel(SANE_Handle sane_handle);
|
||||
void saneExit();
|
||||
void saneClose();
|
||||
|
||||
|
@ -164,14 +168,23 @@ public:
|
|||
QString fileNameOperation();
|
||||
int startScanning(UserSelectedInfo info);
|
||||
bool testScannerIsAlive(QString deviceName);
|
||||
void hotPlugScanCompleteSlot();
|
||||
|
||||
bool m_ParametersHaveSeted = false;
|
||||
|
||||
const SANE_Device **g_deviceList;
|
||||
|
||||
int hotplug_sock;
|
||||
SANE_Handle handle;
|
||||
UserSelectedInfo userInfo;
|
||||
QMap<QString, QString> colorModesMap;
|
||||
QMap<QString, QString> sourceModesMap;
|
||||
|
||||
bool usbAddSlotIsRunning = false;
|
||||
bool usbRemoveSlotIsRunning = false;
|
||||
int haveSourceFlag = 0;
|
||||
|
||||
bool saneHaveStart = false;
|
||||
bool onDetection = false;
|
||||
QString openSaneName;
|
||||
int scanPageNumber = 0;
|
||||
int ocrFlag = 0;
|
||||
|
@ -179,11 +192,14 @@ public:
|
|||
int openDeviceIndex = 0;
|
||||
|
||||
int resolutionValue;
|
||||
|
||||
QString devicemodel;
|
||||
QString nowSaveName;
|
||||
QString normalImagePath;
|
||||
QString saveFullScanFileName;
|
||||
QString loadFullScanFileName;
|
||||
QStringList saveFullScanFileNames;
|
||||
QStringList loadFullScanFileNames;
|
||||
|
||||
bool haveScanSuccessImage = false;
|
||||
|
||||
QString ocrOutputText;
|
||||
|
@ -192,7 +208,7 @@ public:
|
|||
|
||||
bool stopSaneReadFlag = false;
|
||||
|
||||
|
||||
bool isOnScanning = false;
|
||||
|
||||
int output_format = OUTPUT_PNM;
|
||||
int resolution_value;
|
||||
|
@ -215,6 +231,9 @@ public slots:
|
|||
void stopSaneForException();
|
||||
void restartSaneForException();
|
||||
void stopSaneWhenEndThisCircle();
|
||||
void refreshListSlots();
|
||||
signals:
|
||||
void updatePageNum();
|
||||
|
||||
};
|
||||
|
||||
|
@ -229,7 +248,6 @@ extern "C" {
|
|||
* @brief detectScanDevices
|
||||
* detect scan devices to find available devices
|
||||
*/
|
||||
bool detectSaneDevices();
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -137,12 +137,12 @@ void ScanDialog::initConnect()
|
|||
|
||||
connect(m_cancelButton, &QPushButton::clicked, this, [=]{
|
||||
//this->reject();
|
||||
emit g_user_signal->cancelScanning();
|
||||
cancelOpration();
|
||||
g_user_signal->stopScanOperation();
|
||||
emit g_user_signal->cancelScanning();
|
||||
// g_user_signal->stopScanOperation();
|
||||
|
||||
});
|
||||
connect(g_user_signal, &GlobalUserSignal::scanThreadFinishedSignal, this, &ScanDialog::updatePageNumberWhileScanning);
|
||||
connect(g_sane_object, &SaneObject::updatePageNum, this, &ScanDialog::updatePageNumberWhileScanning);
|
||||
connect(g_user_signal, &GlobalUserSignal::cancelOprationOKSignal, this, &ScanDialog::updatePageNumberWhileStopScanning);
|
||||
}
|
||||
void ScanDialog::cancelOpration(){
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
#include <QDateTime>
|
||||
#include <buried_point.hpp>
|
||||
#include <gsettings.hpp>
|
||||
#include <QPalette>
|
||||
#include "include/theme.h"
|
||||
|
||||
ScanSettingsWidget::ScanSettingsWidget(QWidget *parent) :
|
||||
|
@ -70,6 +71,7 @@ ScanSettingsWidget::ScanSettingsWidget(QWidget *parent) :
|
|||
m_mainScrollArea (new QScrollArea()),
|
||||
m_mainVLayout(new QVBoxLayout(this))
|
||||
{
|
||||
m_themeData = new QGSettings(UKUI_THEME_GSETTING_PATH);
|
||||
setupGui();
|
||||
// initTheme();
|
||||
initConnect();
|
||||
|
@ -82,8 +84,18 @@ void ScanSettingsWidget::initTheme(){
|
|||
// pal.setColor(QPalette::Background, QColor(255, 255, 255));
|
||||
// }
|
||||
// setAutoFillBackground(true);
|
||||
// setPalette(pal);
|
||||
// setPalette(pal);
|
||||
}
|
||||
|
||||
void ScanSettingsWidget::setScanIconDisable()
|
||||
{
|
||||
m_scanButton->setEnabled(false);
|
||||
// QPalette pe;
|
||||
// pe.setColor(QPalette::Text, Qt::gray);
|
||||
// scanButtonRightLabel->setPalette(pe);
|
||||
scanButtonRightLabel->setStyleSheet("color:grey;");
|
||||
}
|
||||
|
||||
void ScanSettingsWidget::paintEvent(QPaintEvent *event)
|
||||
{
|
||||
Q_UNUSED(event);
|
||||
|
@ -113,7 +125,7 @@ void ScanSettingsWidget::selectSaveDirectorySlot()
|
|||
|
||||
if (!selectedDir.isEmpty()) {
|
||||
QFileInfo file(selectedDir);
|
||||
if (file.permission(QFileDevice::WriteUser | QFileDevice::ReadGroup)) {
|
||||
if (file.permission(QFileDevice::WriteUser)) {
|
||||
KyInfo() << "The user could read and write " << selectedDir;
|
||||
|
||||
currentSaveDirectory = selectedDir;
|
||||
|
@ -187,22 +199,29 @@ void ScanSettingsWidget::deviceCurrentTextChangedSlot(QString text)
|
|||
*/
|
||||
void ScanSettingsWidget::pageNumberCurrentTextChangedSlot(QString text)
|
||||
{
|
||||
if (text.compare("Multiple", Qt::CaseInsensitive) == 0
|
||||
|| text.compare("多页扫描", Qt::CaseInsensitive) == 0) {
|
||||
g_sane_object->m_ParametersHaveSeted = false;
|
||||
if (text.compare(QApplication::tr("Multiple"), Qt::CaseInsensitive) == 0 || text.compare("多页扫描", Qt::CaseInsensitive) == 0) {
|
||||
if(m_typeComboBox->currentText().compare(QApplication::tr("Flatbed"), Qt::CaseInsensitive) == 0 || m_typeComboBox->currentText().compare("平板式", Qt::CaseInsensitive) == 0){
|
||||
QString msg = tr("Flatbed scan mode not support multiple scan.");
|
||||
g_user_signal->warnMsg(msg);
|
||||
m_pageNumberComboBox->setCurrentText(tr("Single"));
|
||||
return;
|
||||
}
|
||||
g_sane_object->userInfo.pageNumber = tr("Multiple");
|
||||
m_saveNameEdit->setMaxLength(240);
|
||||
m_saveNameEdit->setMaxLength(235);
|
||||
|
||||
// Avoid SANE_STATUS_NO_DOC Error to set time not enable.
|
||||
g_sane_object->setSaneStatus(true);
|
||||
showTimeRow();
|
||||
// 还未删掉showTimeRow()
|
||||
// showTimeRow();
|
||||
kdk::kabase::BuriedPoint buriedPointTest;
|
||||
if (buriedPointTest.functionBuriedPoint(kdk::kabase::AppName::KylinScanner , kdk::kabase::BuriedPoint::PT::KylinScannerMultiPageScan)) {
|
||||
qCritical() << "Error : buried point fail !";
|
||||
};
|
||||
} else {
|
||||
g_sane_object->userInfo.pageNumber = tr("Single");
|
||||
m_saveNameEdit->setMaxLength(246);
|
||||
hideTimeRow();
|
||||
m_saveNameEdit->setMaxLength(230);
|
||||
// hideTimeRow();
|
||||
kdk::kabase::BuriedPoint buriedPointTest;
|
||||
if (buriedPointTest.functionBuriedPoint(kdk::kabase::AppName::KylinScanner , kdk::kabase::BuriedPoint::PT::KylinScannerSinglePageScan)) {
|
||||
qCritical() << "Error : buried point fail !";
|
||||
|
@ -226,6 +245,11 @@ void ScanSettingsWidget::typeCurrentTextChangedSlot(QString text)
|
|||
// } else if(0 == QString::compare(text, tr("ADF Duplex"), Qt::CaseInsensitive)) {
|
||||
// g_sane_object->userInfo.type = "ADF Duplex";
|
||||
// }
|
||||
if(QString::compare(text, tr("Flatbed"), Qt::CaseInsensitive) == 0){
|
||||
m_pageNumberComboBox->setCurrentText(tr("Single"));
|
||||
}
|
||||
|
||||
g_sane_object->m_ParametersHaveSeted = false;
|
||||
g_sane_object->userInfo.type = text;
|
||||
|
||||
KyInfo() << "userInfo.type = " << text;
|
||||
|
@ -233,6 +257,7 @@ void ScanSettingsWidget::typeCurrentTextChangedSlot(QString text)
|
|||
|
||||
void ScanSettingsWidget::colorCurrentTextChangedSlot(QString text)
|
||||
{
|
||||
g_sane_object->m_ParametersHaveSeted = false;
|
||||
if (0 == QString::compare(text, tr("Color"), Qt::CaseInsensitive)) {
|
||||
g_sane_object->userInfo.color = "Color";
|
||||
} else if(0 == QString::compare(text, tr("Lineart"), Qt::CaseInsensitive)) {
|
||||
|
@ -246,6 +271,7 @@ void ScanSettingsWidget::colorCurrentTextChangedSlot(QString text)
|
|||
|
||||
void ScanSettingsWidget::resolutionCurrentTextChangedSlot(QString text)
|
||||
{
|
||||
g_sane_object->m_ParametersHaveSeted = false;
|
||||
if ((0 == text.compare(tr("4800 dpi"), Qt::CaseInsensitive))
|
||||
|| (0 == text.compare(tr("2400 dpi"), Qt::CaseInsensitive))
|
||||
|| (0 == text.compare(tr("1200 dpi"), Qt::CaseInsensitive))) {
|
||||
|
@ -261,12 +287,14 @@ void ScanSettingsWidget::resolutionCurrentTextChangedSlot(QString text)
|
|||
|
||||
void ScanSettingsWidget::sizeCurrentTextChangedSlot(QString text)
|
||||
{
|
||||
g_sane_object->m_ParametersHaveSeted = false;
|
||||
g_sane_object->userInfo.size = text;
|
||||
KyInfo() << "userInfo.size = " << text;
|
||||
}
|
||||
|
||||
void ScanSettingsWidget::formatCurrentTextChangedSlot(QString text)
|
||||
{
|
||||
g_sane_object->m_ParametersHaveSeted = false;
|
||||
g_sane_object->userInfo.format = text;
|
||||
KyInfo() << "userInfo.format = " << text;
|
||||
}
|
||||
|
@ -289,6 +317,11 @@ void ScanSettingsWidget::nameCurrentTextChangedSlot(QString text)
|
|||
QString saveNameEditStr = m_saveNameEdit->text();
|
||||
int len = strlen(saveNameEditStr.toLocal8Bit());
|
||||
qDebug() << "name length:"<<len;
|
||||
while(len > 240){
|
||||
saveNameEditStr = saveNameEditStr.left(saveNameEditStr.size() - 1);
|
||||
len = strlen(saveNameEditStr.toLocal8Bit());
|
||||
}
|
||||
m_saveNameEdit->setText(saveNameEditStr);
|
||||
|
||||
g_sane_object->userInfo.saveName = m_saveNameEdit->text();
|
||||
KyInfo() << "saveName = " << g_sane_object->userInfo.saveName;
|
||||
|
@ -344,13 +377,15 @@ void ScanSettingsWidget::saveAsButtonClickedSlot()
|
|||
filter = QLatin1String("*.txt");
|
||||
} else {
|
||||
if (fileFormat == "jpg") {
|
||||
filter = QLatin1String("*.jpg;;*.png;;*.pdf;;*.bmp");
|
||||
filter = QLatin1String("*.jpg;;*.png;;*.pdf;;*.bmp;;*.tiff");
|
||||
} else if (fileFormat == "png") {
|
||||
filter = QLatin1String("*.png;;*.jpg;;*.pdf;;*.bmp");
|
||||
filter = QLatin1String("*.png;;*.jpg;;*.pdf;;*.bmp;;*.tiff");
|
||||
} else if (fileFormat == "pdf") {
|
||||
filter = QLatin1String("*.pdf;;*.jpg;;*.png;;*.bmp");
|
||||
filter = QLatin1String("*.pdf;;*.jpg;;*.png;;*.bmp;;*.tiff");
|
||||
} else if (fileFormat == "bmp"){
|
||||
filter = QLatin1String("*.bmp;;*.jpg;;*.png;;*.pdf;;*.tiff");
|
||||
} else {
|
||||
filter = QLatin1String("*.bmp;;*.jpg;;*.png;;*.pdf");
|
||||
filter = QLatin1String("*.tiff;;*.bmp;;*.jpg;;*.png;;*.pdf");
|
||||
}
|
||||
}
|
||||
QFileDialog fileDialog;
|
||||
|
@ -402,38 +437,53 @@ void ScanSettingsWidget::saveAsButtonClickedSlot()
|
|||
if (!path.endsWith(".jpg", Qt::CaseInsensitive)
|
||||
&& !path.endsWith(".png", Qt::CaseInsensitive)
|
||||
&& !path.endsWith(".pdf", Qt::CaseInsensitive)
|
||||
&& !path.endsWith(".bmp", Qt::CaseInsensitive)) {
|
||||
&& !path.endsWith(".bmp", Qt::CaseInsensitive)
|
||||
&& !path.endsWith(".tiff", Qt::CaseInsensitive)) {
|
||||
path = path.append(fileType);
|
||||
}
|
||||
}
|
||||
//已有文件的判断
|
||||
QFile file(path);
|
||||
if(file.exists()){
|
||||
QMessageBox::StandardButton box;
|
||||
QString tipsStr1 = tr("The file ");
|
||||
QString tipsStr2 = tr(" already exists, do you want to overwrite it?");
|
||||
QString tipsStr = tipsStr1 + path1 + fileType + tipsStr2;
|
||||
box = QMessageBox::question(this->parentWidget(),tr("tips"),tipsStr,QMessageBox::Yes|QMessageBox::No);
|
||||
if(box == QMessageBox::Yes){
|
||||
qDebug() << "file already exists,user choose overwrite it.";
|
||||
}else{
|
||||
return;
|
||||
}
|
||||
}
|
||||
// //已有文件的判断
|
||||
// QFile file(path);
|
||||
// if(file.exists()){
|
||||
// QMessageBox::StandardButton box;
|
||||
// QString tipsStr1 = tr("The file ");
|
||||
// QString tipsStr2 = tr(" already exists, do you want to overwrite it?");
|
||||
// QString tipsStr = tipsStr1 + path1 + fileType + tipsStr2;
|
||||
// box = QMessageBox::question(this->parentWidget(),tr("tips"),tipsStr,QMessageBox::Yes|QMessageBox::No);
|
||||
// if(box == QMessageBox::Yes){
|
||||
// qDebug() << "file already exists,user choose overwrite it.";
|
||||
// }else{
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
g_user_signal->saveAsButtonClicked(path);
|
||||
g_user_signal->exitWindowWithSaveFlag = false;
|
||||
}
|
||||
bool ScanSettingsWidget::showRunningDialog()
|
||||
{
|
||||
QString fileName = m_saveNameEdit->text();
|
||||
QString path = currentSaveDirectory;
|
||||
QString format = m_formatComboBox->currentText();
|
||||
QString filePath = path + "/" + fileName + "." + format;
|
||||
QFile file(filePath);
|
||||
QString filePath;
|
||||
if(g_sane_object->userInfo.pageNumber.compare(QApplication::tr("Multiple"), Qt::CaseInsensitive) == 0){
|
||||
if(format != "tiff"){
|
||||
filePath = path + "/" + fileName + "[1]" + "." + format;
|
||||
}else{
|
||||
filePath = path + "/" + fileName + "." + "tif";
|
||||
}
|
||||
}else{
|
||||
if(format != "tiff"){
|
||||
filePath = path + "/" + fileName + "." + format;
|
||||
}else{
|
||||
filePath = path + "/" + fileName + "." + "tif";
|
||||
}
|
||||
}
|
||||
QFileInfo file(filePath);
|
||||
if(file.exists()){
|
||||
QMessageBox::StandardButton box;
|
||||
QString tipsStr1 = tr("The file ");
|
||||
QString tipsStr2 = tr(" already exists, do you want to overwrite it?");
|
||||
QString tipsStr = tipsStr1 + fileName + "." + format + tipsStr2;
|
||||
QString tipsStr2 = tr(" already exists, do you want to overwrite it? If you are performing a multi page scan, it may cause multiple files to be overwritten. Please be cautious!");
|
||||
QString tipsStr = tipsStr1 + file.fileName() + tipsStr2;
|
||||
box = QMessageBox::question(this->parentWidget(),tr("tips"),tipsStr,QMessageBox::Yes|QMessageBox::No);
|
||||
if(box == QMessageBox::Yes){
|
||||
return true;
|
||||
|
@ -473,21 +523,26 @@ void ScanSettingsWidget::fontSizeChanged()
|
|||
|
||||
m_sendMailButton->adjustSize();
|
||||
m_sendMailButton->setText(tr("Mail to"));
|
||||
m_sendMailButton->setToolTip(tr("Mail to"));
|
||||
|
||||
m_SaveAsButton->adjustSize();
|
||||
m_SaveAsButton->setText(currentSaveAsDirectory);
|
||||
m_SaveAsButton->setToolTip(currentSaveAsDirectory);
|
||||
|
||||
}
|
||||
|
||||
void ScanSettingsWidget::fontSizeChangedSlot()
|
||||
{
|
||||
fontSizeChanged();
|
||||
int systemFontSize = kdk::kabase::Gsettings::getSystemFontSize().toInt();
|
||||
QFont font;
|
||||
font.setPointSize(systemFontSize);
|
||||
// m_scanButton->setFont(font);
|
||||
float systemFontSize = kdk::kabase::Gsettings::getSystemFontSize().toFloat();
|
||||
QString fontType = m_themeData->get("systemFont").toString();
|
||||
QFont font(fontType, systemFontSize);
|
||||
scanButtonRightLabel->setFont(font);
|
||||
fontSizeChanged();
|
||||
}
|
||||
|
||||
void ScanSettingsWidget::setDeviceBoxDisableSlot()
|
||||
{
|
||||
m_deviceComboBox->setEnabled(false);
|
||||
}
|
||||
bool ScanSettingsWidget::isDarkTheme()
|
||||
{
|
||||
|
@ -509,7 +564,11 @@ void ScanSettingsWidget::setupGui()
|
|||
this->setFixedWidth(ScanSettingsWidgetWidth);
|
||||
|
||||
scanButtonLeftLabel->setPixmap(QPixmap(":/default-connect-page/begin-scan.svg"));
|
||||
scanButtonRightLabel->setText(tr("Begin Scan"));
|
||||
scanButtonRightLabel->setText(tr("Start Scan"));
|
||||
// QPalette pe;
|
||||
// pe.setColor(QPalette::WindowText, QColor("#FFFFFF"));
|
||||
// scanButtonRightLabel->setPalette(pe);
|
||||
scanButtonRightLabel->setStyleSheet("color:white;");
|
||||
|
||||
scanButtonHLayout->addStretch();
|
||||
scanButtonHLayout->addWidget(scanButtonLeftLabel);
|
||||
|
@ -522,7 +581,6 @@ void ScanSettingsWidget::setupGui()
|
|||
m_scanButton->setLayout(scanButtonHLayout);
|
||||
m_scanButton->setCursor(Qt::PointingHandCursor);
|
||||
m_scanButton->setProperty("isImportant", true);
|
||||
scanButtonRightLabel->setStyleSheet("color:white;");
|
||||
scanButtonCrapLayout = new QHBoxLayout(this);
|
||||
scanButtonCrapLayout->addSpacing(24);
|
||||
scanButtonCrapLayout->addWidget(m_scanButton);
|
||||
|
@ -540,6 +598,8 @@ void ScanSettingsWidget::setupGui()
|
|||
m_saveNameEdit->setText(tr("scanner01"));
|
||||
m_saveNameEdit->setMaxLength(246);
|
||||
|
||||
m_saveDirectoryLabel->setFocusPolicy(Qt::TabFocus);
|
||||
|
||||
m_saveDirectoryButtonLayout->addWidget(m_saveDirectoryButtonLabel);
|
||||
m_saveDirectoryButtonLayout->setSpacing(0);
|
||||
m_saveDirectoryButtonLayout->setContentsMargins(8, 0, 0, 0);
|
||||
|
@ -558,10 +618,12 @@ void ScanSettingsWidget::setupGui()
|
|||
currentSaveAsDirectory = tr("Save as");
|
||||
fontSizeChanged();
|
||||
|
||||
int spacing = 7;
|
||||
|
||||
m_settingsFormLayout->setSpacing(0);
|
||||
m_settingsFormLayout->setHorizontalSpacing(spacing);
|
||||
// m_settingsFormLayout->setSpacing(0);
|
||||
m_settingsFormLayout->setRowWrapPolicy(QFormLayout::DontWrapRows);
|
||||
m_settingsFormLayout->setFieldGrowthPolicy(QFormLayout::FieldsStayAtSizeHint);
|
||||
m_settingsFormLayout->setFormAlignment(Qt::AlignHCenter | Qt::AlignTop);
|
||||
m_settingsFormLayout->setLabelAlignment(Qt::AlignLeft);
|
||||
m_settingsFormLayout->setHorizontalSpacing(7);
|
||||
m_settingsFormLayout->setVerticalSpacing(8);
|
||||
m_settingsFormLayout->addRow(m_deviceSettingsLabel);
|
||||
m_settingsFormLayout->addRow(m_deviceLabel, m_deviceComboBox);
|
||||
|
@ -574,8 +636,8 @@ void ScanSettingsWidget::setupGui()
|
|||
m_settingsFormLayout->addRow(m_formatLabel, m_formatComboBox);
|
||||
m_settingsFormLayout->addRow(m_saveNameLabel, m_saveNameEdit);
|
||||
m_settingsFormLayout->addRow(m_saveDirectoryLabel, m_saveDirectoryButton);
|
||||
m_settingsFormLayout->setLabelAlignment(Qt::AlignRight | Qt::AlignVCenter);
|
||||
m_settingsFormLayout->setFormAlignment(Qt::AlignLeft );
|
||||
// m_settingsFormLayout->setLabelAlignment(Qt::AlignLeft | Qt::AlignRight);
|
||||
// m_settingsFormLayout->setFormAlignment(Qt::AlignLeft);
|
||||
m_settingsFormLayout->setContentsMargins(24, 0, 24, 0);
|
||||
|
||||
m_sendMailButton->setMinimumSize(ScanSettingsWidgetButtonSize);
|
||||
|
@ -622,8 +684,7 @@ void ScanSettingsWidget::initConnect()
|
|||
connect(m_SaveAsButton, &QPushButton::clicked, this, &ScanSettingsWidget::saveAsButtonClickedSlot);
|
||||
connect(g_user_signal, &GlobalUserSignal::closeWindowSaveAsSignal, this, &ScanSettingsWidget::saveAsButtonClickedSlot);
|
||||
|
||||
connect(kdk::kabase::Gsettings::getPoint(), &kdk::kabase::Gsettings::systemFontSizeChange, this, &ScanSettingsWidget::fontSizeChangedSlot);
|
||||
|
||||
connect(m_themeData, &QGSettings::changed, this, &ScanSettingsWidget::fontSizeChangedSlot);
|
||||
connect(g_user_signal, &GlobalUserSignal::scanThreadFinishedSignal, this, &ScanSettingsWidget::updateSettingsStatusForEndScan);
|
||||
connect(g_user_signal, &GlobalUserSignal::stopOrFinishedScanSignal, this, &ScanSettingsWidget::updateSaveNameTextSettings);
|
||||
|
||||
|
@ -633,7 +694,9 @@ void ScanSettingsWidget::initConnect()
|
|||
connect(g_user_signal, &GlobalUserSignal::exitOCR, this, &ScanSettingsWidget::updateSaveAsTextRecover);
|
||||
connect(g_user_signal, &GlobalUserSignal::updateSettingSignal, this, &ScanSettingsWidget::updateSettingsForDetectDevices);
|
||||
|
||||
connect(g_user_signal, &GlobalUserSignal::setDeviceBoxDisableSignal, this, &ScanSettingsWidget::setDeviceBoxDisableSlot);
|
||||
connect(GlobalUserSignal::getInstance(),&GlobalUserSignal::rotationChangedSig,this,&ScanSettingsWidget::rotateChangedSlot);
|
||||
connect(g_user_signal, &GlobalUserSignal::setScanIconDisableSignal, this, &ScanSettingsWidget::setScanIconDisable);
|
||||
}
|
||||
void ScanSettingsWidget::rotateChangedSlot(bool isPCMode){
|
||||
if(isPCMode){
|
||||
|
@ -704,6 +767,17 @@ void ScanSettingsWidget::updateScanButtonSettings()
|
|||
{
|
||||
bool saneStatus = g_sane_object->getSaneStatus();
|
||||
m_scanButton->setEnabled(saneStatus);
|
||||
if(saneStatus == true){
|
||||
// QPalette pe;
|
||||
// pe.setColor(QPalette::Text, Qt::white);
|
||||
// scanButtonRightLabel->setPalette(pe);
|
||||
scanButtonRightLabel->setStyleSheet("color:white;");
|
||||
}else{
|
||||
// QPalette pe;
|
||||
// pe.setColor(QPalette::Text, Qt::gray);
|
||||
// scanButtonRightLabel->setPalette(pe);
|
||||
scanButtonRightLabel->setStyleSheet("color:grey;");
|
||||
}
|
||||
}
|
||||
|
||||
void ScanSettingsWidget::updateDeviceSettings()
|
||||
|
@ -766,7 +840,10 @@ void ScanSettingsWidget::updateTimeSettings()
|
|||
|
||||
KyInfo() << "Timer : " << timerStringList;
|
||||
|
||||
m_timeComboBox->setEnabled(saneStatus);
|
||||
if(!m_timeComboBox->isHidden()){
|
||||
m_timeComboBox->setEnabled(saneStatus);
|
||||
}
|
||||
|
||||
setComboboxAttributes(m_timeComboBox, timerStringList);
|
||||
|
||||
}
|
||||
|
@ -934,6 +1011,7 @@ void ScanSettingsWidget::updateSaveAsTextStore()
|
|||
{
|
||||
if(g_sane_object->ocrFlag){
|
||||
m_SaveAsButton->setText(tr("Store text"));
|
||||
m_SaveAsButton->setToolTip(tr("Store text"));
|
||||
}
|
||||
KyInfo() << "m_SaveAsButton text: " << m_SaveAsButton->text();
|
||||
}
|
||||
|
@ -942,6 +1020,7 @@ void ScanSettingsWidget::updateSaveAsTextRecover()
|
|||
{
|
||||
KyInfo() << "m_SaveAsButton text: " << m_SaveAsButton->text();
|
||||
m_SaveAsButton->setText(tr("Save as"));
|
||||
m_SaveAsButton->setToolTip(tr("Save as"));
|
||||
}
|
||||
|
||||
|
||||
|
@ -954,7 +1033,6 @@ void ScanSettingsWidget::updateSettingsForDetectDevices()
|
|||
updateScanButtonSettings();
|
||||
updateDeviceSettings();
|
||||
updatePageNumberSettings();
|
||||
updateTimeSettings();
|
||||
updateTypeSettings();
|
||||
updateColorSettings();
|
||||
updateResolutionSettings(true);
|
||||
|
@ -991,12 +1069,6 @@ void ScanSettingsWidget::updateSettingsStatusForStartScan()
|
|||
m_scanButton->setEnabled(false);
|
||||
// m_deviceComboBox->setEnabled(false);
|
||||
m_pageNumberComboBox->setEnabled(false);
|
||||
|
||||
|
||||
int countRow = m_settingsFormLayout->rowCount();
|
||||
if (countRow == 12) {
|
||||
m_timeComboBox->setEnabled(false);
|
||||
}
|
||||
m_typeComboBox->setEnabled(false);
|
||||
m_colorComboBox->setEnabled(false);
|
||||
m_resolutionComboBox->setEnabled(false);
|
||||
|
@ -1035,6 +1107,10 @@ void ScanSettingsWidget::updateSettingsStatusForEndScan(int saneStatus)
|
|||
|
||||
} else if (saneStatus == SANE_STATUS_INVAL) {
|
||||
m_scanButton->setEnabled(true);
|
||||
// QPalette pe;
|
||||
// pe.setColor(QPalette::Text, Qt::white);
|
||||
// scanButtonRightLabel->setPalette(pe);
|
||||
scanButtonRightLabel->setStyleSheet("color:white;");
|
||||
m_pageNumberComboBox->setEnabled(true);
|
||||
|
||||
int countRow = m_settingsFormLayout->rowCount();
|
||||
|
@ -1054,12 +1130,24 @@ void ScanSettingsWidget::updateSettingsStatusForEndScan(int saneStatus)
|
|||
m_SaveAsButton->setEnabled(false);
|
||||
} else {
|
||||
bool saneStatusBool = true;
|
||||
if (saneStatus == 0) {
|
||||
if (saneStatus == SANE_STATUS_GOOD || saneStatus == SANE_STATUS_EOF) {
|
||||
saneStatusBool = true;
|
||||
} else {
|
||||
saneStatusBool = false;
|
||||
}
|
||||
m_scanButton->setEnabled(saneStatusBool);
|
||||
if(saneStatusBool == true){
|
||||
// QPalette pe;
|
||||
// pe.setColor(QPalette::Text, Qt::white);
|
||||
// scanButtonRightLabel->setPalette(pe);
|
||||
scanButtonRightLabel->setStyleSheet("color:white;");
|
||||
}else{
|
||||
// QPalette pe;
|
||||
// pe.setColor(QPalette::Text, Qt::gray);
|
||||
// scanButtonRightLabel->setPalette(pe);
|
||||
scanButtonRightLabel->setStyleSheet("color:grey;");
|
||||
}
|
||||
|
||||
m_pageNumberComboBox->setEnabled(saneStatusBool);
|
||||
|
||||
int countRow = m_settingsFormLayout->rowCount();
|
||||
|
@ -1080,11 +1168,10 @@ void ScanSettingsWidget::updateSettingsStatusForEndScan(int saneStatus)
|
|||
|
||||
void ScanSettingsWidget::setLabelAttributes(QLabel *label, const QString &text, int labelHeight)
|
||||
{
|
||||
label->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
|
||||
label->setAlignment(Qt::AlignLeft | Qt::AlignVCenter);
|
||||
label->setFixedWidth(ScanSettingsLabelWidth);
|
||||
label->setText(text);
|
||||
|
||||
#if 1
|
||||
int elideWidth = ScanSettingsLabelElideWidth;
|
||||
|
||||
QFontMetrics fontMetrics(label->font());
|
||||
|
@ -1097,7 +1184,6 @@ void ScanSettingsWidget::setLabelAttributes(QLabel *label, const QString &text,
|
|||
label->setText(text);
|
||||
label->setToolTip("");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
@ -1170,10 +1256,8 @@ void ScanSettingsWidget::warnMsg(QString msg)
|
|||
// msgBox->setWindowIcon(QIcon::fromTheme("kylin-scanner"));
|
||||
msgBox->setWindowTitle(tr("Scanner"));
|
||||
msgBox->setStandardButtons(QMessageBox::Yes);
|
||||
msgBox->setStandardButtons(QMessageBox::Cancel);
|
||||
msgBox->setContextMenuPolicy(Qt::NoContextMenu);
|
||||
msgBox->button(QMessageBox::Yes)->setText(tr("Yes"));
|
||||
msgBox->button(QMessageBox::Cancel)->setText(tr("Cancel"));
|
||||
|
||||
QWidget *widget = nullptr;
|
||||
QWidgetList widgetList = QApplication::allWidgets();
|
||||
|
|
|
@ -18,6 +18,8 @@
|
|||
#ifndef SCANSETTINGSWIDGET_H
|
||||
#define SCANSETTINGSWIDGET_H
|
||||
|
||||
#define UKUI_THEME_GSETTING_PATH "org.ukui.style"
|
||||
|
||||
#include "include/common.h"
|
||||
#include "saneobject.h"
|
||||
#include "globalsignal.h"
|
||||
|
@ -126,7 +128,7 @@ public slots:
|
|||
|
||||
void fontSizeChanged();
|
||||
void fontSizeChangedSlot();
|
||||
|
||||
void setDeviceBoxDisableSlot();
|
||||
private:
|
||||
RunningDialog *m_runningDialog = nullptr;
|
||||
|
||||
|
@ -185,10 +187,13 @@ private:
|
|||
|
||||
QVBoxLayout *m_mainVLayout;
|
||||
|
||||
QGSettings *m_themeData = nullptr;
|
||||
bool isDarkTheme();
|
||||
bool showRunningDialog();
|
||||
private slots:
|
||||
void initTheme();
|
||||
void setScanIconDisable();
|
||||
|
||||
};
|
||||
|
||||
#endif // SCANSETTINGSWIDGET_H
|
||||
|
|
|
@ -83,6 +83,7 @@ void NoMailDialog::initLayout()
|
|||
ft.setBold(true);
|
||||
m_noMailtitleLabel->setFont(ft);
|
||||
m_noMailtitleLabel->setText(tr("No email client"));
|
||||
m_noMailtitleLabel->setToolTip(tr("No email client"));
|
||||
m_noMailtitleLabel->setAlignment(Qt::AlignLeft | Qt::AlignVCenter);
|
||||
|
||||
m_noMailLogoTitleHBoxLayout->setSpacing(0);
|
||||
|
@ -109,9 +110,11 @@ void NoMailDialog::initLayout()
|
|||
|
||||
|
||||
m_cancelButton->setText(tr("Cancel"));
|
||||
m_cancelButton->setToolTip(tr("Cancel"));
|
||||
m_cancelButton->setFixedSize(96, 36);
|
||||
|
||||
m_installButton->setText(tr("Install"));
|
||||
m_installButton->setToolTip(tr("Install"));
|
||||
m_installButton->setFixedSize(96, 36);
|
||||
|
||||
m_installButton->setFocus();
|
||||
|
@ -253,9 +256,11 @@ void SendMailDialog::initLayout()
|
|||
|
||||
m_cancelButton->setFixedSize(QSize(96, 32));
|
||||
m_cancelButton->setText(tr("Cancel"));
|
||||
m_cancelButton->setToolTip(tr("Cancel"));
|
||||
|
||||
m_confirmButton->setFixedSize(QSize(96, 32));
|
||||
m_confirmButton->setText(tr("Confirm"));
|
||||
m_confirmButton->setToolTip(tr("Confirm"));
|
||||
m_confirmButton->setFocus();
|
||||
m_confirmButton->setShortcut( QKeySequence::InsertParagraphSeparator);
|
||||
m_confirmButton->setShortcut(Qt::Key_Enter);
|
||||
|
|
|
@ -31,8 +31,8 @@ ShowImageWidget::ShowImageWidget(QWidget *parent) : QWidget(parent)
|
|||
loadImg = new LoadImage;
|
||||
loadImg->moveToThread(&loadImgOP);
|
||||
loadImgOP.start();
|
||||
connect(this,&ShowImageWidget::loadImgSignal,loadImg,&LoadImage::loadImageToWidget);
|
||||
connect(loadImg,&LoadImage::finished,this,&ShowImageWidget::loadImageFinishedSlot);
|
||||
connect(this, &ShowImageWidget::loadImgSignal, loadImg, &LoadImage::loadImageToWidget, Qt::QueuedConnection);
|
||||
connect(loadImg, &LoadImage::finished, this, &ShowImageWidget::loadImageFinishedSlot);
|
||||
setupGui();
|
||||
initConnect();
|
||||
}
|
||||
|
@ -114,7 +114,7 @@ void ShowImageWidget::setupGui()
|
|||
void ShowImageWidget::initConnect()
|
||||
{
|
||||
connect(kdk::kabase::Gsettings::getPoint(), &kdk::kabase::Gsettings::systemThemeChange, this, &ShowImageWidget::themeChangedSlot);
|
||||
connect(g_user_signal, &GlobalUserSignal::scanThreadFinishedImageLoadSignal, this, &ShowImageWidget::showNormalImageAfterScan);
|
||||
connect(g_user_signal, &GlobalUserSignal::scanThreadFinishedImageLoadSignal, this, &ShowImageWidget::showNormalImageAfterScan, Qt::QueuedConnection);
|
||||
|
||||
connect(g_user_signal, &GlobalUserSignal::showImageAfterClickedThumbnailSignal, this, &ShowImageWidget::showImageAfterClickedThumbnail);
|
||||
|
||||
|
@ -136,8 +136,8 @@ void ShowImageWidget::initConnect()
|
|||
|
||||
connect(g_user_signal, &GlobalUserSignal::toolbarOcrOperationStartSignal, this, &ShowImageWidget::ocrStartSlot);
|
||||
|
||||
connect(g_user_signal,&GlobalUserSignal::cropOpSig,this,&ShowImageWidget::cropOp);
|
||||
connect(g_user_signal,&GlobalUserSignal::rollBackOperationSig,this,&ShowImageWidget::rollBackOperation);
|
||||
//connect(g_user_signal,&GlobalUserSignal::cropOpSig,this,&ShowImageWidget::cropOp);
|
||||
//connect(g_user_signal,&GlobalUserSignal::rollBackOperationSig,this,&ShowImageWidget::rollBackOperation);
|
||||
|
||||
connect(m_cancelButton, &QPushButton::clicked, this, &ShowImageWidget::cropCancelSlot);
|
||||
connect(m_okButton, &QPushButton::clicked, this, &ShowImageWidget::cropCompleteSlot);
|
||||
|
@ -235,7 +235,7 @@ QImage *ShowImageWidget::imageSave(QString filename)
|
|||
/*****************mark***************************/
|
||||
if (filename.endsWith(".pdf"))
|
||||
return m_editImage;
|
||||
if (filename.endsWith(".png") || filename.endsWith(".jpg") || filename.endsWith(".bmp"))
|
||||
if (filename.endsWith(".png") || filename.endsWith(".jpg") || filename.endsWith(".bmp") || filename.endsWith(".tiff"))
|
||||
m_editImage->save(filename);
|
||||
} else {
|
||||
if (!filename.endsWith(".txt"))
|
||||
|
@ -258,12 +258,12 @@ QString ShowImageWidget::setPixmapScaled(QImage img, QLabel *lab, double scale)
|
|||
double labWidth = this->width() - 2*ShowImageWidgetSpacing - AddWidthForLargeFontSize;
|
||||
double labHeight = this->height() - 24 -24 - 36 -16;
|
||||
|
||||
double imgWidth = defaultScanImageSize.width();
|
||||
double imgHeight = defaultScanImageSize.height();
|
||||
double imgWidth = img.width();
|
||||
double imgHeight = img.height();
|
||||
|
||||
if(rotationFlag){
|
||||
swap(imgWidth,imgHeight);
|
||||
}
|
||||
// if(rotationFlag){
|
||||
// swap(imgWidth,imgHeight);
|
||||
// }
|
||||
|
||||
qDebug() << "label size: " << lab->size()
|
||||
<< "this size: " << this->size()
|
||||
|
@ -446,8 +446,16 @@ void ShowImageWidget::rollBackOperation(){
|
|||
}
|
||||
}
|
||||
}
|
||||
void ShowImageWidget::cropOp(){
|
||||
if (m_showImageAndCropWidget->currentWidget() == m_cropLabel) {
|
||||
|
||||
void ShowImageWidget::keyPressEvent(QKeyEvent *event)
|
||||
{
|
||||
switch (event->key()) {
|
||||
case Qt::Key_Return:
|
||||
case Qt::Key_Enter:
|
||||
case Qt::Key_Space:
|
||||
|
||||
if (m_showImageAndCropWidget->currentWidget() == m_cropLabel) {
|
||||
KyInfo() << "pressed key(Enter): " << event->key();
|
||||
|
||||
int x1, y1, x2, y2;
|
||||
getCropArea(x1, y1, x2, y2);
|
||||
|
@ -462,14 +470,38 @@ void ShowImageWidget::cropOp(){
|
|||
|
||||
m_cropLabel->initCropSettings();
|
||||
|
||||
|
||||
m_showImageAndCropWidget->setCurrentWidget(m_labelWidget);
|
||||
|
||||
g_sane_object->cropFlag = 0;
|
||||
g_sane_object->cropFlag = 0;
|
||||
m_cancelOkWidget->hide();
|
||||
}
|
||||
break;
|
||||
|
||||
case Qt::Key_Z:
|
||||
if (event->modifiers() == Qt::ControlModifier) {
|
||||
KyInfo() << "pressed key(ctrl+z): " << event->key();
|
||||
rollBackOperation();
|
||||
m_cancelOkWidget->hide();
|
||||
}
|
||||
break;
|
||||
case Qt::Key_Escape:
|
||||
// KyInfo() << "pressed key(Esc): " << event->key();
|
||||
// if (! m_imageStack.isEmpty()) {
|
||||
// *m_editImage = m_imageStack.pop();
|
||||
// setPixmapScaled(*m_editImage, m_showImageLabel);
|
||||
|
||||
// *m_normalImage = m_editImage->copy();
|
||||
// setPixmapScaled(*m_normalImage, m_showImageLabel);
|
||||
// }
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
KyInfo() << "pressed key: " << event->key();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool ShowImageWidget::eventFilter(QObject *obj, QEvent *event)
|
||||
{
|
||||
if (obj == m_showImageLabel) {
|
||||
|
@ -489,7 +521,7 @@ bool ShowImageWidget::eventFilter(QObject *obj, QEvent *event)
|
|||
return QObject::eventFilter(obj,event);
|
||||
}
|
||||
|
||||
void ShowImageWidget::showNormalImageAfterScan(QString loadFileName,QString saveFileName)
|
||||
void ShowImageWidget::showNormalImageAfterScan(QStringList loadFileName, QStringList saveFileName)
|
||||
{
|
||||
m_imageStack.clear();
|
||||
proportionForPercentage = 1.0;
|
||||
|
@ -499,19 +531,16 @@ void ShowImageWidget::showNormalImageAfterScan(QString loadFileName,QString save
|
|||
|
||||
imageNUll(true);
|
||||
|
||||
m_loadPathDelayUpdate = loadFileName;
|
||||
m_savePathDelayUpdate = saveFileName;
|
||||
|
||||
if (g_config_signal->m_kylinScannerImageDebug) {
|
||||
m_loadPathDelayUpdate = g_config_signal->m_openFileName;
|
||||
}
|
||||
|
||||
|
||||
|
||||
double labWidth = this->width() - 2*ShowImageWidgetSpacing - AddWidthForLargeFontSize;
|
||||
double labHeight = this->height() - 24 -24 - 36 -16;
|
||||
QSize labSize(labWidth,labHeight);
|
||||
emit loadImgSignal(m_loadPathDelayUpdate,&(*m_normalImage),&(*m_showImageLabel),1,false,labSize);
|
||||
|
||||
for(int i = 0; i < loadFileName.length(); i++){
|
||||
m_loadPathDelayUpdate = loadFileName[i];
|
||||
m_savePathDelayUpdate = saveFileName[i];
|
||||
m_normalImageList.append(m_normalImage);
|
||||
emit loadImgSignal(m_loadPathDelayUpdate, m_savePathDelayUpdate, m_normalImage, m_showImageLabel, 1, false, labSize);
|
||||
}
|
||||
}
|
||||
|
||||
QPixmap ShowImageWidget::resizePix(const QPixmap &pixmap, const QSize &size)
|
||||
|
@ -561,7 +590,7 @@ void ShowImageWidget::showImageAfterClickedThumbnail(QString loadPath)
|
|||
double labHeight = this->height() - 24 -24 - 36 -16;
|
||||
QSize labSize(labWidth,labHeight);
|
||||
|
||||
emit loadImgSignal(loadPath,&(*m_normalImage),&(*m_showImageLabel),1,false,labSize);
|
||||
emit loadImgSignal(loadPath, NULL, m_normalImage, m_showImageLabel, 1, false, labSize);
|
||||
|
||||
// *m_normalImage = QImage(loadPath);
|
||||
|
||||
|
@ -576,14 +605,21 @@ void ShowImageWidget::showImageAfterClickedThumbnail(QString loadPath)
|
|||
g_user_signal->toolbarOcrOperationStart();
|
||||
}
|
||||
}
|
||||
void ShowImageWidget::loadImageFinishedSlot(double proportion){
|
||||
void ShowImageWidget::loadImageFinishedSlot(QString save_path, double proportion, QImage image){
|
||||
if(showImageAfterClickedThumbnailFlag){
|
||||
showImageAfterClickedThumbnailFlag = false;
|
||||
}else{
|
||||
QString savePath = m_savePathDelayUpdate;
|
||||
KyInfo() << "savePath = " << savePath;
|
||||
g_sane_object->normalImagePath = savePath;
|
||||
m_saveFileBase.saveFileOP(savePath,&(*m_normalImage));
|
||||
if(save_path != NULL){
|
||||
QString savePath = save_path;
|
||||
KyInfo() << "savePath = " << savePath;
|
||||
g_sane_object->normalImagePath = savePath;
|
||||
m_saveFileBase.saveFileOP(savePath, &image);
|
||||
}else{
|
||||
QString savePath = m_savePathDelayUpdate;
|
||||
KyInfo() << "savePath = " << savePath;
|
||||
g_sane_object->normalImagePath = savePath;
|
||||
m_saveFileBase.saveFileOP(savePath, m_normalImage);
|
||||
}
|
||||
}
|
||||
proportionForPercentage = proportion;
|
||||
int proportionInt = qRound(proportionForPercentage * 100);
|
||||
|
@ -601,7 +637,21 @@ void ShowImageWidget::loadImageFinishedSlot(double proportion){
|
|||
}
|
||||
void ShowImageWidget::saveImage(QString filename)
|
||||
{
|
||||
m_saveFileBase.saveFileOP(filename,&(*m_normalImage));
|
||||
QImage tmp = m_normalImage->copy();
|
||||
QFileInfo a(filename);
|
||||
if(a.suffix() != "pdf"){
|
||||
if(a.suffix() != "txt"){
|
||||
tmp.save(filename);
|
||||
}else{
|
||||
QFile file(filename);
|
||||
file.open(QIODevice::ReadWrite | QIODevice::Text);
|
||||
QByteArray str = g_sane_object->ocrOutputText.toUtf8();
|
||||
file.write(str);
|
||||
file.close();
|
||||
}
|
||||
}else{
|
||||
m_saveFileBase.saveFileOP(filename, &tmp);
|
||||
}
|
||||
}
|
||||
|
||||
void ShowImageWidget::cropSlot()
|
||||
|
@ -805,9 +855,18 @@ void ShowImageWidget::showBeautyRunningDialog(QString text)
|
|||
int m_y = (this->height() - m_beautyRunningDialog->height()) / 2;
|
||||
|
||||
m_beautyRunningDialog->move(globalPos.x() + m_x, globalPos.y() + m_y);
|
||||
m_beautyRunningDialog->disconnectCancelButton();
|
||||
m_beautyRunningDialog->m_closeButtondisconnect();
|
||||
|
||||
m_beautyRunningDialog->show();
|
||||
connect(m_beautyRunningDialog->btnCancel, &QPushButton::clicked, this, &ShowImageWidget::cancelImageOperationSlot);
|
||||
connect(m_beautyRunningDialog->m_closeButton, &QPushButton::clicked, this,[=](){
|
||||
m_beautyRunningDialog->btnCancel->click();
|
||||
});
|
||||
connect(m_beautyRunningDialog->btnCancel, &QPushButton::clicked, this, [=](){
|
||||
m_beautyRunningDialog->hideCancelButton();
|
||||
m_beautyRunningDialog->setWaitText(tr("Canceling...Please waiting..."));
|
||||
});
|
||||
connect(g_user_signal, &GlobalUserSignal::exitOCR, this, &ShowImageWidget::cancelImageOperationSlot);
|
||||
}
|
||||
void ShowImageWidget::cancelImageOperationSlot(){
|
||||
|
@ -819,7 +878,7 @@ void ShowImageWidget::beautyStartSlot()
|
|||
{
|
||||
showBeautyRunningDialog(tr("Running beauty ..."));
|
||||
|
||||
imageOp = new ImageOperationBeauty(&(*m_normalImage),&m_imageStack);
|
||||
imageOp = new ImageOperationBeauty(m_normalImage, &m_imageStack);
|
||||
imageOpThread = new QThread;
|
||||
imageOp->moveToThread(imageOpThread);
|
||||
imageOpThread->start();
|
||||
|
@ -831,8 +890,9 @@ void ShowImageWidget::beautyFinished(){
|
|||
delete m_beautyRunningDialog;
|
||||
m_beautyRunningDialog = nullptr;
|
||||
if(imageOp->getIsInterrupt()){
|
||||
// QKeyEvent keyPress(QEvent::KeyPress,Qt::Key_Z,Qt::ControlModifier,QString(""));
|
||||
// QApplication::sendEvent(this,&keyPress);
|
||||
qDebug() << "interupt operation! recover last step image";
|
||||
QKeyEvent keyPress(QEvent::KeyPress,Qt::Key_Z,Qt::ControlModifier,QString(""));
|
||||
QApplication::sendEvent(this,&keyPress);
|
||||
}else{
|
||||
loadAfterBROPicture();
|
||||
}
|
||||
|
@ -850,7 +910,7 @@ void ShowImageWidget::rectifyStartSlot()
|
|||
{
|
||||
qDebug() << "[1]get rectify signal!";
|
||||
showBeautyRunningDialog(tr("Running rectify ..."));
|
||||
imageOp = new ImageOperationRectify(&(*m_normalImage),&m_imageStack);
|
||||
imageOp = new ImageOperationRectify(m_normalImage, &m_imageStack);
|
||||
imageOpThread = new QThread;
|
||||
imageOp->moveToThread(imageOpThread);
|
||||
imageOpThread->start();
|
||||
|
|
|
@ -88,21 +88,22 @@ public:
|
|||
QImage *m_stackImage;
|
||||
QImage *m_editImage;
|
||||
QImage *m_normalImage;
|
||||
QList<QImage*> m_normalImageList;
|
||||
QPixmap m_normalPixmap;
|
||||
QStack<QImage> m_imageStack;
|
||||
|
||||
|
||||
protected:
|
||||
void resizeEvent(QResizeEvent *event) Q_DECL_OVERRIDE;
|
||||
void keyPressEvent(QKeyEvent *event) Q_DECL_OVERRIDE;
|
||||
bool eventFilter(QObject *obj, QEvent *event) Q_DECL_OVERRIDE;
|
||||
public slots:
|
||||
void cropOp();
|
||||
void beautyFinished();
|
||||
void rotateFinished();
|
||||
void cancelImageOperationSlot();
|
||||
void loadImageFinishedSlot(double);
|
||||
void loadImageFinishedSlot(QString, double, QImage);
|
||||
|
||||
void showNormalImageAfterScan(QString,QString);
|
||||
void showNormalImageAfterScan(QStringList, QStringList);
|
||||
QPixmap resizePix(const QPixmap &pixmap , const QSize &size);
|
||||
|
||||
void showImageAfterClickedThumbnail(QString loadPath);
|
||||
|
@ -181,7 +182,7 @@ signals:
|
|||
void rotateSignal();
|
||||
void mirrorSignal();
|
||||
|
||||
void loadImgSignal(QString loadPath, QImage *img, QLabel *container,double scale, bool rotationFlag,QSize labSize);
|
||||
void loadImgSignal(QString loadPath, QString savePath, QImage *img, QLabel *container,double scale, bool rotationFlag,QSize labSize);
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -80,7 +80,7 @@ void showOcrWidget::initConnect()
|
|||
connect(g_user_signal, &GlobalUserSignal::toolbarOcrOperationStartSignal, this, &showOcrWidget::startScanSlot);
|
||||
connect(g_user_signal, &GlobalUserSignal::toolbarOcrOperationFinishedSignal, this, &showOcrWidget::updateOcrTextEdit);
|
||||
|
||||
connect(g_user_signal, &GlobalUserSignal::startScanOperationSignal, this, &showOcrWidget::stopScanStop);
|
||||
// connect(g_user_signal, &GlobalUserSignal::startScanOperationSignal, this, &showOcrWidget::stopScanStop);
|
||||
connect(g_user_signal, &GlobalUserSignal::stopOcrTimerSignal, this, &showOcrWidget::stopScanStop);
|
||||
connect(kdk::kabase::Gsettings::getPoint(), &kdk::kabase::Gsettings::systemThemeChange, this, &showOcrWidget::style_changed);
|
||||
}
|
||||
|
|
|
@ -78,6 +78,7 @@ void SuccessPageWidget::setupGui()
|
|||
|
||||
void SuccessPageWidget::initConnect()
|
||||
{
|
||||
connect(g_user_signal, &GlobalUserSignal::changeToConnectuccessPageSignal, this, [=](){m_leftStackSuccessPageWidget->setCurrentWidget(m_leftSuccessPageWidget);});
|
||||
}
|
||||
|
||||
void SuccessPageWidget::showLeftImageHandleSuccessPage()
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
#include "include/theme.h"
|
||||
|
||||
int ThumbnailWidget::scanPictureCount = 0;
|
||||
|
||||
bool ThumbnailWidget::scanPictureIsEmpty = true;
|
||||
ThumbnailWidget::ThumbnailWidget(QWidget *parent) : QListView(parent)
|
||||
{
|
||||
setupGui();
|
||||
|
@ -56,7 +56,7 @@ void ThumbnailWidget::setupGui()
|
|||
void ThumbnailWidget::initConnect()
|
||||
{
|
||||
|
||||
connect(g_user_signal, &GlobalUserSignal::scanThreadFinishedImageLoadSignal, this, &ThumbnailWidget::showNormalImageAfterScan);
|
||||
connect(g_user_signal, &GlobalUserSignal::scanThreadFinishedImageLoadSignal, this, &ThumbnailWidget::showNormalImagesAfterScan);
|
||||
connect(this, &ThumbnailWidget::clicked, this, &ThumbnailWidget::clickedItemSlot);
|
||||
connect(kdk::kabase::Gsettings::getPoint(), &kdk::kabase::Gsettings::systemThemeChange, this, &ThumbnailWidget::themeChange);
|
||||
|
||||
|
@ -144,6 +144,13 @@ void ThumbnailWidget::showNormalImageAfterScan(QString loadPath, QString savePat
|
|||
|
||||
}
|
||||
|
||||
void ThumbnailWidget::showNormalImagesAfterScan(QStringList loadPathes, QStringList savepathes)
|
||||
{
|
||||
for(int i = 0; i < loadPathes.length(); i++){
|
||||
showNormalImageAfterScan(loadPathes[i], savepathes[i]);
|
||||
}
|
||||
}
|
||||
|
||||
void ThumbnailWidget::clickedItemSlot(const QModelIndex &index)
|
||||
{
|
||||
ScanStandardItem *item = dynamic_cast<ScanStandardItem *>(m_thumbnailItemModel->itemFromIndex(index));
|
||||
|
|
|
@ -26,6 +26,11 @@
|
|||
#include <QStyleOption>
|
||||
#include <QStyle>
|
||||
|
||||
#include <opencv4/opencv2/core.hpp>
|
||||
#include <opencv4/opencv2/imgcodecs.hpp>
|
||||
#include <opencv4/opencv2/imgproc.hpp>
|
||||
using namespace cv;
|
||||
|
||||
|
||||
class ScanStandardItem: public QStandardItem
|
||||
{
|
||||
|
@ -49,7 +54,7 @@ public:
|
|||
explicit ThumbnailWidget(QWidget *parent = nullptr);
|
||||
|
||||
static int scanPictureCount;
|
||||
|
||||
static bool scanPictureIsEmpty;
|
||||
void setupGui();
|
||||
void initConnect();
|
||||
void initSettings();
|
||||
|
@ -70,8 +75,8 @@ signals:
|
|||
public slots:
|
||||
void showThumbnailIcon();
|
||||
|
||||
void showNormalImageAfterScan(QString,QString);
|
||||
|
||||
void showNormalImageAfterScan(QString, QString);
|
||||
void showNormalImagesAfterScan(QStringList, QStringList);
|
||||
void clickedItemSlot(const QModelIndex &index);
|
||||
|
||||
};
|
||||
|
|
|
@ -21,21 +21,44 @@
|
|||
#include <gsettings.hpp>
|
||||
#include <kylin_system/user_manual.hpp>
|
||||
|
||||
|
||||
TitleBar::TitleBar(QWidget *parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::TitleBar),
|
||||
m_menu(new QMenu(this))
|
||||
{
|
||||
ui->setupUi(this);
|
||||
ui->m_logoBtn->setFlat(true);
|
||||
ui->m_logoBtn->setCheckable(false);
|
||||
ui->m_logoBtn->setProperty("useIconHighlightEffect", 0x0);
|
||||
ui->m_logoBtn->setAttribute(Qt::WA_TransparentForMouseEvents, true);
|
||||
setAutoFillBackground(true);
|
||||
setBackgroundRole(QPalette::Base);
|
||||
this->setWindowTitle("Scanner");
|
||||
if (QGSettings::isSchemaInstalled(UKUI_THEME_GSETTING_PATH)) {
|
||||
m_themeData = new QGSettings(UKUI_THEME_GSETTING_PATH);
|
||||
}
|
||||
|
||||
// appname
|
||||
QFont appnameFont;
|
||||
appnameFont.setPixelSize(TitlebarFontSize);
|
||||
QFont appnameFont(m_themeData->get("systemFont").toString(), m_themeData->get("systemFontSize").toFloat());
|
||||
ui->m_appnameLabel->setFont(appnameFont);
|
||||
|
||||
m_menu->addAction(tr("Refresh List"), this, [=](){
|
||||
if(!g_sane_object->isOnScanning && g_sane_object->onDetection == false){
|
||||
// 1、关闭热插拔
|
||||
emit g_user_signal->setExitFlagTrueSignal();
|
||||
// 2、检测设备 & 打开热插拔
|
||||
// 正在刷新列表,请等待刷新成功信息...
|
||||
QString msg = QApplication::tr("Refreshing list. Please wait for the refresh success information...");
|
||||
g_user_signal->warnMsg(msg);
|
||||
g_user_signal->setScanIconDisableSignal();
|
||||
QTimer::singleShot(2000, this, [this]() {emit g_user_signal->refreshListSignal();});
|
||||
}else{
|
||||
// 弹窗告诉用户扫描期间不支持识别设备
|
||||
QString msg = QApplication::tr("Scanner is on detecting...");
|
||||
g_user_signal->warnMsg(msg);
|
||||
}
|
||||
});
|
||||
|
||||
m_menu->addAction(tr("Help"), this, [ = ]() {
|
||||
showHelpDialog();
|
||||
});//, QKeySequence(Qt::Key_F1)
|
||||
|
@ -52,7 +75,6 @@ TitleBar::TitleBar(QWidget *parent) :
|
|||
m_aboutWindow->setWindowModality(Qt::WindowModal);
|
||||
m_aboutWindow->setWindowModality(Qt::ApplicationModal);
|
||||
m_aboutWindow->show();
|
||||
m_aboutWindow->exec();
|
||||
});
|
||||
|
||||
m_menu->addAction(tr("Exit"), [ = ]() {
|
||||
|
@ -70,8 +92,8 @@ TitleBar::TitleBar(QWidget *parent) :
|
|||
ui->m_OptionBtn->setMenu(m_menu);
|
||||
bool isPCMode = GlobalUserSignal::getInstance()->getCurrentMode();
|
||||
rotateChangedSlot(isPCMode);
|
||||
connect(kdk::kabase::Gsettings::getPoint(), &kdk::kabase::Gsettings::systemFontSizeChange, this,&TitleBar::fontSizeChanged);
|
||||
connect(GlobalUserSignal::getInstance(),&GlobalUserSignal::rotationChangedSig,this,&TitleBar::rotateChangedSlot);
|
||||
// connect(kdk::kabase::Gsettings::getPoint(), &kdk::kabase::Gsettings::systemFontSizeChange, this, &TitleBar::fontSizeChanged);
|
||||
connect(m_themeData, &QGSettings::changed, this, &TitleBar::fontSizeChanged);
|
||||
}
|
||||
|
||||
TitleBar::~TitleBar()
|
||||
|
@ -248,8 +270,8 @@ int TitleBar::warnCloseWindow()
|
|||
|
||||
void TitleBar::fontSizeChanged()
|
||||
{
|
||||
int systemFontSize = kdk::kabase::Gsettings::getSystemFontSize().toInt();
|
||||
QFont font;
|
||||
font.setPointSize(systemFontSize);
|
||||
float systemFontSize = kdk::kabase::Gsettings::getSystemFontSize().toFloat();
|
||||
QString fontType = m_themeData->get("systemFont").toString();
|
||||
QFont font(fontType, systemFontSize);
|
||||
ui->m_appnameLabel->setFont(font);
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
// 主题sdk关于
|
||||
#include <kaboutdialog.h>
|
||||
#include "../utils/HorizontalOrVerticalMode.h"
|
||||
|
||||
#include "../saneobject.h"
|
||||
#include "../globalsignal.h"
|
||||
|
||||
namespace Ui {
|
||||
|
@ -45,6 +45,7 @@ class TitleBar;
|
|||
#define TitlebarFontSize 14
|
||||
#define TitlebarButtonSize QSize(30,30)
|
||||
#define TitlebarHeight 40
|
||||
#define UKUI_THEME_GSETTING_PATH "org.ukui.style"
|
||||
|
||||
#include "src/utils/daemondbus.h"
|
||||
#include "../globalsignal.h"
|
||||
|
@ -85,6 +86,7 @@ private:
|
|||
kdk::KAboutDialog *m_aboutWindow = nullptr; // 关于界面
|
||||
QString appShowingName = tr("kylin-scanner");
|
||||
QString appVersion = qApp->applicationVersion();
|
||||
QGSettings *m_themeData = nullptr;
|
||||
};
|
||||
|
||||
#endif // TITLEBAR_H
|
||||
|
|
|
@ -76,9 +76,7 @@
|
|||
<enum>Qt::NoFocus</enum>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">QPushButton{border:0px;border-radius:4px;background:transparent;}
|
||||
QPushButton::hover{border:0px;border-radius:4px;background:transparent;}
|
||||
QPushButton::pressed{border:0px;border-radius:4px;background:transparent;}</string>
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
|
|
|
@ -395,6 +395,96 @@ void ToolBarWidget::keyReleaseEvent(QKeyEvent *event)
|
|||
return;
|
||||
}
|
||||
|
||||
void ToolBarWidget::themeChangedWhiteSlot()
|
||||
{
|
||||
|
||||
|
||||
// themeChangedIconWhiteSettings();
|
||||
|
||||
this->setStyleSheet("background: rgba(249, 249, 249, 0.8); box-shadow: 0px 0px 5px 0px rgba(0, 0, 0, 0.15); border-radius: 6px; filter: blur(18px);");
|
||||
|
||||
// m_leftFrame->setStyleSheet("background: #B3B3B3; box-shadow: 0px 0px 5px 0px rgba(0, 0, 0, 0.15);");
|
||||
// m_rightFrame->setStyleSheet("background: #B3B3B3; box-shadow: 0px 0px 5px 0px rgba(0, 0, 0, 0.15);");
|
||||
|
||||
|
||||
// m_beautyButton->setStyleSheet("QPushButton{border:0px; border-radius: 6px; background:transparent; background-image:url(:/toolbar/beauty.svg);}"
|
||||
// "QPushButton::hover{border:0px; border-radius: 6px; background:transparent; background-image:url(:/toolbar/beauty-blue.svg);}"
|
||||
// "QPushButton::pressed{border:0px; border-radius: 6px; background:transparent; background-image:url(:/toolbar/beauty-blue.svg);}");
|
||||
|
||||
// m_rectifyButton->setStyleSheet("QPushButton{border:0px; border-radius: 6px; background:transparent; background-image:url(:/toolbar/rectify.svg);}"
|
||||
// "QPushButton::hover{border:0px; border-radius: 6px; background:transparent; background-image:url(:/toolbar/rectify-blue.svg);}"
|
||||
// "QPushButton::pressed{border:0px; border-radius: 6px; background:transparent; background-image:url(:/toolbar/rectify-blue.svg);}");
|
||||
|
||||
// m_ocrButton->setStyleSheet("QPushButton{border:0px; border-radius: 6px; background:transparent; background-image:url(:/toolbar/ocr.svg);}"
|
||||
// "QPushButton::hover{border:0px; border-radius: 6px; background:transparent; background-image:url(:/toolbar/ocr-blue.svg);}"
|
||||
// "QPushButton::pressed{border:0px; border-radius: 6px; background:transparent; background-image:url(:/toolbar/ocr-blue.svg);}");
|
||||
|
||||
// m_cropButton->setStyleSheet("QPushButton{border:0px; border-radius: 6px; background:transparent; background-image:url(:/toolbar/crop.svg);}"
|
||||
// "QPushButton::hover{border:0px; border-radius: 6px; background:transparent; background-image:url(:/toolbar/crop-blue.svg);}"
|
||||
// "QPushButton::pressed{border:0px; border-radius: 6px; background:transparent; background-image:url(:/toolbar/crop-blue.svg);}");
|
||||
|
||||
// m_rotateButton->setStyleSheet("QPushButton{border:0px; border-radius: 6px; background:transparent; background-image:url(:/toolbar/rotate.svg);}"
|
||||
// "QPushButton::hover{border:0px; border-radius: 6px; background:transparent; background-image:url(:/toolbar/rotate-blue.svg);}"
|
||||
// "QPushButton::pressed{border:0px; border-radius: 6px; background:transparent; background-image:url(:/toolbar/rotate-blue.svg);}");
|
||||
|
||||
// m_mirrorButton->setStyleSheet("QPushButton{border:0px; border-radius: 6px; background:transparent; background-image:url(:/toolbar/mirror.svg);}"
|
||||
// "QPushButton::hover{border:0px; border-radius: 6px; background:transparent; background-image:url(:/toolbar/mirror-blue.svg);}"
|
||||
// "QPushButton::pressed{border:0px; border-radius: 6px; background:transparent; background-image:url(:/toolbar/mirror-blue.svg);}");
|
||||
|
||||
// m_watermarkButton->setStyleSheet("QPushButton{border:0px; border-radius: 6px; background:transparent; background-image:url(:/toolbar/watermark.svg);}"
|
||||
// "QPushButton::hover{border:0px; border-radius: 6px; background:transparent; background-image:url(:/toolbar/watermark-blue.svg);}"
|
||||
// "QPushButton::pressed{border:0px; border-radius: 6px; background:transparent; background-image:url(:/toolbar/watermark-blue.svg);}");
|
||||
|
||||
|
||||
// m_zoomOutButton->setStyleSheet("background: #FFFFFF; box-shadow: 0px 0px 5px 0px rgba(0, 0, 0, 0.15); border-radius: 10px;");
|
||||
// m_percentageLabel->setStyleSheet("width: 32px; height: 18px; color: #262626;");
|
||||
// m_zoomInButton->setStyleSheet("background: #FFFFFF; box-shadow: 0px 0px 5px 0px rgba(0, 0, 0, 0.15); border-radius: 10px;");
|
||||
}
|
||||
|
||||
void ToolBarWidget::themeChangedBlackSlot()
|
||||
{
|
||||
// themeChangedIconBlackSettings();
|
||||
|
||||
this->setStyleSheet("background: rgba(38, 38, 38, 1); box-shadow: 0px 0px 5px 0px rgba(0, 0, 0, 0.15); border-radius: 6px; filter: blur(18px);");
|
||||
|
||||
// m_leftFrame->setStyleSheet("background: #B3B3B3; box-shadow: 0px 0px 5px 0px rgba(0, 0, 0, 0.15);");
|
||||
// m_rightFrame->setStyleSheet("background: #B3B3B3; box-shadow: 0px 0px 5px 0px rgba(0, 0, 0, 0.15);");
|
||||
|
||||
// m_beautyButton->setStyleSheet("QPushButton{border:0px; border-radius: 6px; background:transparent; background-image:url(:/toolbar/beauty-white.svg);}"
|
||||
// "QPushButton::hover{border:0px; border-radius: 6px; background:transparent; background-image:url(:/toolbar/beauty-blue.svg);}"
|
||||
// "QPushButton::pressed{border:0px; border-radius: 6px; background:transparent; background-image:url(:/toolbar/beauty-blue.svg);}");
|
||||
|
||||
// m_rectifyButton->setStyleSheet("QPushButton{border:0px; border-radius: 6px; background:transparent; background-image:url(:/toolbar/rectify-white.svg);}"
|
||||
// "QPushButton::hover{border:0px; border-radius: 6px; background:transparent; background-image:url(:/toolbar/rectify-blue.svg);}"
|
||||
// "QPushButton::pressed{border:0px; border-radius: 6px; background:transparent; background-image:url(:/toolbar/rectify-blue.svg);}");
|
||||
|
||||
// m_ocrButton->setStyleSheet("QPushButton{border:0px; border-radius: 6px; background:transparent; background-image:url(:/toolbar/ocr-white.svg);}"
|
||||
// "QPushButton::hover{border:0px; border-radius: 6px; background:transparent; background-image:url(:/toolbar/ocr-blue.svg);}"
|
||||
// "QPushButton::pressed{border:0px; border-radius: 6px; background:transparent; background-image:url(:/toolbar/ocr-blue.svg);}");
|
||||
|
||||
// m_cropButton->setStyleSheet("QPushButton{border:0px; border-radius: 6px; background:transparent; background-image:url(:/toolbar/crop-white.svg);}"
|
||||
// "QPushButton::hover{border:0px; border-radius: 6px; background:transparent; background-image:url(:/toolbar/crop-blue.svg);}"
|
||||
// "QPushButton::pressed{border:0px; border-radius: 6px; background:transparent; background-image:url(:/toolbar/crop-blue.svg);}");
|
||||
|
||||
// m_rotateButton->setStyleSheet("QPushButton{border:0px; border-radius: 6px; background:transparent; background-image:url(:/toolbar/rotate-white.svg);}"
|
||||
// "QPushButton::hover{border:0px; border-radius: 6px; background:transparent; background-image:url(:/toolbar/rotate-blue.svg);}"
|
||||
// "QPushButton::pressed{border:0px; border-radius: 6px; background:transparent; background-image:url(:/toolbar/rotate-blue.svg);}");
|
||||
|
||||
// m_mirrorButton->setStyleSheet("QPushButton{border:0px; border-radius: 6px; background:transparent; background-image:url(:/toolbar/mirror-white.svg);}"
|
||||
// "QPushButton::hover{border:0px; border-radius: 6px; background:transparent; background-image:url(:/toolbar/mirror-blue.svg);}"
|
||||
// "QPushButton::pressed{border:0px; border-radius: 6px; background:transparent; background-image:url(:/toolbar/mirror-blue.svg);}");
|
||||
|
||||
// m_watermarkButton->setStyleSheet("QPushButton{border:0px; border-radius: 6px; background:transparent; background-image:url(:/toolbar/watermark-white.svg);}"
|
||||
// "QPushButton::hover{border:0px; border-radius: 6px; background:transparent; background-image:url(:/toolbar/watermark-blue.svg);}"
|
||||
// "QPushButton::pressed{border:0px; border-radius: 6px; background:transparent; background-image:url(:/toolbar/watermark-blue.svg);}");
|
||||
|
||||
|
||||
|
||||
// m_zoomOutButton->setStyleSheet("background: #373738; box-shadow: 0px 0px 5px 0px rgba(0, 0, 0, 0.15); border-radius: 10px;");
|
||||
// m_percentageLabel->setStyleSheet("width: 32px; height: 18px; color: #D9D9D9;");
|
||||
// m_zoomInButton->setStyleSheet("background: #373738; box-shadow: 0px 0px 5px 0px rgba(0, 0, 0, 0.15); border-radius: 10px;");
|
||||
|
||||
}
|
||||
|
||||
void ToolBarWidget::percentageChangedSlot()
|
||||
{
|
||||
|
@ -454,12 +544,12 @@ void ToolBarWidget::ocrButtonClickedSlot()
|
|||
g_sane_object->ocrFlag = 0;
|
||||
}else{
|
||||
ocrOtherIconState(false);
|
||||
g_sane_object->ocrFlag = 1;
|
||||
g_user_signal->toolbarOcrOperationStart();
|
||||
kdk::kabase::BuriedPoint buriedPointTest;
|
||||
if (buriedPointTest.functionBuriedPoint(kdk::kabase::AppName::KylinScanner , kdk::kabase::BuriedPoint::PT::KylinScannerTextRecognition)) {
|
||||
qCritical() << "Error : buried point fail !";
|
||||
};
|
||||
g_sane_object->ocrFlag = 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -57,6 +57,9 @@ protected:
|
|||
|
||||
|
||||
public slots:
|
||||
void themeChangedWhiteSlot();
|
||||
void themeChangedBlackSlot();
|
||||
|
||||
void percentageChangedSlot();
|
||||
|
||||
void beautyButtonClickedSlot();
|
||||
|
|
|
@ -20,14 +20,13 @@
|
|||
|
||||
int init_hotplug_sock()
|
||||
{
|
||||
const int buffersize = 1024;
|
||||
const int buffersize = 16 * 1024 * 1024;
|
||||
int ret;
|
||||
struct sockaddr_nl snl;
|
||||
bzero(&snl, sizeof(struct sockaddr_nl));
|
||||
memset(&snl, 0x00, sizeof(struct sockaddr_nl));
|
||||
snl.nl_family = AF_NETLINK;
|
||||
snl.nl_pid = getpid();
|
||||
snl.nl_groups = 1;
|
||||
snl.nl_groups = 1;
|
||||
int s = socket(PF_NETLINK, SOCK_DGRAM, NETLINK_KOBJECT_UEVENT);
|
||||
if (s == -1) {
|
||||
perror("socket");
|
||||
|
|
|
@ -1,29 +1,30 @@
|
|||
#include "usbhotplugthread.h"
|
||||
#include "usb.h"
|
||||
#include <ukui-log4qt.h>
|
||||
#include <libudev.h>
|
||||
#include "globalsignal.h"
|
||||
#include <QList>
|
||||
#include <QProcess>
|
||||
#include <QMessageBox>
|
||||
#include "saneobject.h"
|
||||
#include "mainwidget.cpp"
|
||||
|
||||
static SANE_Device *g_saneDeviceusb = nullptr;
|
||||
const SANE_Device **g_deviceListusb = nullptr;
|
||||
|
||||
void UsbHotplugThread::run()
|
||||
{
|
||||
qDebug() << "read device list complete!";
|
||||
hotplug_sock = init_hotplug_sock();
|
||||
// hotplug_sock = init_hotplug_sock();
|
||||
|
||||
USBdeviceList = getConnectedScanner();
|
||||
connect(g_user_signal, &GlobalUserSignal::setExitFlagTrueSignal, this, &UsbHotplugThread::setExitFlagTrue);
|
||||
connect(g_user_signal, &GlobalUserSignal::setExitFlagFalseSignal, this, &UsbHotplugThread::setExitFlagFalse);
|
||||
do {
|
||||
/* Netlink message buffer */
|
||||
char buf[UEVENT_BUFFER_SIZE * 2] = {0};
|
||||
recv(hotplug_sock, &buf, sizeof(buf), 0);
|
||||
recv(g_sane_object->hotplug_sock, &buf, sizeof(buf), 0);
|
||||
|
||||
QString recvData = QString(QLatin1String(buf));
|
||||
|
||||
#if 0
|
||||
if (! recvData.isEmpty()) {
|
||||
KyInfo() << "recvData: " << recvData;
|
||||
}
|
||||
#endif
|
||||
QString recvData = QString(buf);
|
||||
|
||||
if (recvData.contains("add@", Qt::CaseInsensitive)
|
||||
&& recvData.contains("devices", Qt::CaseInsensitive)
|
||||
|
@ -31,72 +32,264 @@ void UsbHotplugThread::run()
|
|||
&& recvData.endsWith(":1.0", Qt::CaseInsensitive)) {
|
||||
// ":1.0" means each usb device first directory, which is must
|
||||
// emit usbAdd(recvData);
|
||||
usbAddSlot();
|
||||
if(usbDeviceIdentify(recvData)){
|
||||
while(1){
|
||||
if(!g_sane_object->usbRemoveSlotIsRunning){
|
||||
usbAddSlot(recvData);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (recvData.contains("remove@", Qt::CaseInsensitive)
|
||||
&& recvData.contains("devices", Qt::CaseInsensitive)
|
||||
&& recvData.contains("usb", Qt::CaseInsensitive)
|
||||
&& recvData.endsWith(":1.0", Qt::CaseInsensitive)) {
|
||||
// emit usbRemove(recvData);
|
||||
usbRemoveSlot();
|
||||
if(isRemoveScanner(recvData)){
|
||||
while(1){
|
||||
if(!g_sane_object->usbAddSlotIsRunning){
|
||||
removeToDeviceList(recvData);
|
||||
usbRemoveSlot();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} while (! exitWindowFlag);
|
||||
quit();
|
||||
}
|
||||
void UsbHotplugThread::usbAddSlot(){
|
||||
if(g_user_signal->getIsFailPage()){
|
||||
return;
|
||||
}
|
||||
initSane();
|
||||
//todo:更新UI设备列表
|
||||
qDebug() << "a new scanner may joined!";
|
||||
g_user_signal->updateSetting();
|
||||
}
|
||||
void UsbHotplugThread::usbRemoveSlot(){
|
||||
initSane();
|
||||
QList<SANE_Device> current = GlobalUserSignal::getInstance()->getDeviceList();
|
||||
SANE_Device currentDevice = GlobalUserSignal::getInstance()->getDeviceInUse();
|
||||
bool isInUseDeviceRemoved = true;
|
||||
//
|
||||
|
||||
for(int i = 0; i < current.size(); i++){
|
||||
if(currentDevice.model == current.at(i).model
|
||||
&¤tDevice.name == current.at(i).name
|
||||
&¤tDevice.type == current.at(i).type
|
||||
&¤tDevice.vendor == current.at(i).vendor){
|
||||
isInUseDeviceRemoved = false;
|
||||
void UsbHotplugThread::setExitFlagTrue()
|
||||
{
|
||||
exitWindowFlag = true;
|
||||
}
|
||||
|
||||
void UsbHotplugThread::setExitFlagFalse()
|
||||
{
|
||||
exitWindowFlag = false;
|
||||
}
|
||||
|
||||
void UsbHotplugThread::usbAddSlot(QString qstr){
|
||||
g_sane_object->usbAddSlotIsRunning = true;
|
||||
qDebug() << "新的usb插入了";
|
||||
while(1){
|
||||
// 不在运行时再对设备列表进行刷新
|
||||
if(!g_sane_object->isOnScanning){
|
||||
// 正在查询扫描仪设备,请稍等...
|
||||
QString msg = tr("Querying scanner device. Please waitting...");
|
||||
g_user_signal->warnMsg(msg);
|
||||
g_user_signal->setScanIconDisableSignal();
|
||||
|
||||
if(g_user_signal->getIsFailPage()){
|
||||
return;
|
||||
}
|
||||
|
||||
initSane();
|
||||
//todo:更新UI设备列表
|
||||
qDebug() << "a new scanner may joined!";
|
||||
|
||||
g_sane_object->setSaneHaveHandle(false);
|
||||
g_user_signal->updateSetting();
|
||||
|
||||
addToDeviceList(qstr);
|
||||
g_user_signal->warnMsg(tr("New Scanner has been Connected."));
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(isInUseDeviceRemoved){
|
||||
QString msg = tr("Scanner has been disconnect.");
|
||||
g_user_signal->warnMsg(msg);
|
||||
qDebug() << "scanner in use has removed!";
|
||||
if(current.size() == 0){
|
||||
qDebug() << "no avilable scanner!";
|
||||
//todo:禁止操作右边设置栏
|
||||
g_sane_object->setSaneStatus(false);
|
||||
QStringList tmp;
|
||||
tmp.clear();
|
||||
g_sane_object->setSaneNames(tmp);
|
||||
}
|
||||
|
||||
void UsbHotplugThread::usbRemoveSlot(){
|
||||
g_sane_object->usbRemoveSlotIsRunning = true;
|
||||
qDebug() << "usb拔出了";
|
||||
// 检测到有扫描仪断开链接,如果您断开的是正在扫描的扫描仪,请点击取消扫描或者等待扫描仪报错信息。
|
||||
QString msg = tr("A scanner is disconnected. If you disconnect the scanner is on scanning, click Cancel Scan or wait for the scanner to report an error message.");
|
||||
g_user_signal->warnMsg(msg);
|
||||
|
||||
while(1){
|
||||
if(!g_sane_object->isOnScanning){
|
||||
// 扫描仪断开链接,刷新扫描仪列表,请稍等...
|
||||
QString msg = tr("Scanner is disconnect,refreshing scanner list. Please waitting...");
|
||||
g_user_signal->warnMsg(msg);
|
||||
g_user_signal->setScanIconDisableSignal();
|
||||
initSane();
|
||||
QList<SANE_Device> current = GlobalUserSignal::getInstance()->getDeviceList();
|
||||
g_sane_object->setSaneHaveHandle(false);
|
||||
g_user_signal->updateSetting();
|
||||
}else{
|
||||
//todo:打开列表中一个默认设备,更新ui
|
||||
g_user_signal->openDeviceSignalFun(0);
|
||||
g_user_signal->updateSetting();
|
||||
if(current.size() == 0){
|
||||
qDebug() << "no avilable scanner!";
|
||||
//todo:禁止操作右边设置栏
|
||||
g_sane_object->setSaneStatus(false);
|
||||
QStringList tmp;
|
||||
tmp.clear();
|
||||
g_sane_object->setSaneNames(tmp);
|
||||
// g_sane_object->setSaneHaveHandle(false);
|
||||
g_user_signal->updateSetting();
|
||||
g_sane_object->hotPlugScanCompleteSlot();
|
||||
}else{
|
||||
qDebug() << "have another scanner to open!";
|
||||
//todo:打开列表中一个默认设备,更新ui
|
||||
// g_sane_object->openSaneDeviceForPage(0);
|
||||
g_user_signal->updateSetting();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool UsbHotplugThread::usbDeviceIdentify(QString qstr)
|
||||
{
|
||||
return usbDeviceAdd(qstr);
|
||||
}
|
||||
|
||||
bool UsbHotplugThread::usbDeviceAdd(QString qstr)
|
||||
{
|
||||
QString path = QString("/sys") + qstr.right(qstr.size() - 1 - qstr.indexOf('@'));
|
||||
QString deviceType = getDeviceTypeFromPath(path);
|
||||
|
||||
if(deviceType != "ff"){
|
||||
return false;
|
||||
}else{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
bool UsbHotplugThread::usbDeviceRemove(QString qstr){
|
||||
QString path = QString("/sys") + qstr.right(qstr.size() - 1 - qstr.indexOf('@'));
|
||||
|
||||
}
|
||||
|
||||
QStringList UsbHotplugThread::getConnectedScanner()
|
||||
{
|
||||
struct udev *udev;
|
||||
struct udev_enumerate *enumerate;
|
||||
struct udev_list_entry *devices, *dev_list_entry;
|
||||
struct udev_device *dev;
|
||||
QStringList res;
|
||||
|
||||
udev = udev_new();
|
||||
if (!udev) {
|
||||
qDebug("Can't create udev\n");
|
||||
return res;
|
||||
}
|
||||
|
||||
enumerate = udev_enumerate_new(udev);
|
||||
udev_enumerate_add_match_subsystem(enumerate, "usb");
|
||||
udev_enumerate_add_match_sysattr(enumerate, "bInterfaceClass", "ff");
|
||||
udev_enumerate_scan_devices(enumerate);
|
||||
devices = udev_enumerate_get_list_entry(enumerate);
|
||||
|
||||
udev_list_entry_foreach(dev_list_entry, devices)
|
||||
{
|
||||
const char *path;
|
||||
|
||||
path = udev_list_entry_get_name(dev_list_entry);
|
||||
dev = udev_device_new_from_syspath(udev, path);
|
||||
dev = udev_device_get_parent_with_subsystem_devtype(dev, "usb", "usb_device");
|
||||
if (!dev)
|
||||
{
|
||||
// printf("Unable to find parent usb device.");
|
||||
continue;
|
||||
}
|
||||
res.append(udev_device_get_devpath(dev));
|
||||
udev_device_unref(dev);
|
||||
}
|
||||
udev_enumerate_unref(enumerate);
|
||||
|
||||
udev_unref(udev);
|
||||
res = res.toSet().toList();
|
||||
return res;
|
||||
}
|
||||
|
||||
QString UsbHotplugThread::getDeviceTypeFromPath(QString path)
|
||||
{
|
||||
QString res;
|
||||
QString bInterfaceClass;
|
||||
QStringList bInterfaceClassPathList = getRetFromCommand(QStringList{"find", path ,"-name", "bInterfaceClass"}).split("\n");
|
||||
for (int i = 0; i < bInterfaceClassPathList.size(); i++) {
|
||||
bInterfaceClass = getRetFromCommand(QStringList{"cat", bInterfaceClassPathList.at(i)});
|
||||
if (bInterfaceClass != "ff"){
|
||||
continue;
|
||||
}
|
||||
res = bInterfaceClass;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
QString UsbHotplugThread::getRetFromCommand(QStringList command)
|
||||
{
|
||||
QProcess proc;
|
||||
QStringList options;
|
||||
options << "-c"<< command.join(" ");
|
||||
proc.closeWriteChannel();
|
||||
proc.start("bash", options);
|
||||
if (!proc.waitForFinished())
|
||||
return "";
|
||||
QString res = QString(proc.readAll());
|
||||
proc.close();
|
||||
if(res.right(1) == "\n")
|
||||
res.chop(1);
|
||||
return res;
|
||||
}
|
||||
|
||||
void UsbHotplugThread::addToDeviceList(QString path)
|
||||
{
|
||||
QString newPath = "";
|
||||
QStringList tempList = path.replace("add@", "").split("/");
|
||||
for(int i = 1; i < tempList.length() - 1; i++){
|
||||
newPath.append("/");
|
||||
newPath.append(tempList.at(i));
|
||||
}
|
||||
USBdeviceList.append(newPath);
|
||||
}
|
||||
|
||||
void UsbHotplugThread::removeToDeviceList(QString path)
|
||||
{
|
||||
QString newPath = "";
|
||||
QStringList tempList = path.replace("remove@", "").split("/");
|
||||
for(int i = 1; i < tempList.length() - 1; i++){
|
||||
newPath.append("/");
|
||||
newPath.append(tempList.at(i));
|
||||
}
|
||||
USBdeviceList.removeOne(newPath);
|
||||
}
|
||||
|
||||
bool UsbHotplugThread::isRemoveScanner(QString path)
|
||||
{
|
||||
QString newPath = "";
|
||||
QStringList tempList = path.replace("remove@", "").split("/");
|
||||
for(int i = 1; i < tempList.length() - 1; i++){
|
||||
newPath.append("/");
|
||||
newPath.append(tempList.at(i));
|
||||
}
|
||||
|
||||
if(USBdeviceList.contains(newPath)){
|
||||
return true;
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
static void authCallback (SANE_String_Const resource, SANE_Char *username, SANE_Char *password)
|
||||
{
|
||||
// KyInfo() << "auth_callback" << resource << username << password;
|
||||
}
|
||||
|
||||
static SANE_Status saneGetDevices(const SANE_Device ***device_list)
|
||||
{
|
||||
SANE_Status status = SANE_STATUS_GOOD;
|
||||
|
||||
g_sane_object->saneClose();
|
||||
g_sane_object->saneExit();
|
||||
|
||||
SANE_Int version_code = 0;
|
||||
|
||||
sane_init(&version_code, authCallback);
|
||||
|
||||
KyInfo() << "Get all scan devices, please waiting ...";
|
||||
|
||||
/// This will be crashed unexpectedly, samples can be followed:
|
||||
/// 1. Caused by specific drives, such as `lenovo-image-g-series_1.0-16_arm64`, so we need Vendor developers to handle it
|
||||
/// 2. This will take a long time
|
||||
status = sane_get_devices (device_list, SANE_TRUE);
|
||||
status = sane_get_devices (device_list, SANE_FALSE);
|
||||
|
||||
if (status) {
|
||||
KyInfo() << "status = " << sane_strstatus(status);
|
||||
|
@ -104,31 +297,30 @@ static SANE_Status saneGetDevices(const SANE_Device ***device_list)
|
|||
|
||||
return status;
|
||||
}
|
||||
|
||||
void UsbHotplugThread::initSane(){
|
||||
QStringList names;
|
||||
SANE_Status sane_status;
|
||||
char name[512] = {0};
|
||||
QString name;
|
||||
//获取扫描设备列表
|
||||
{
|
||||
sane_status = saneGetDevices((&g_deviceListusb));
|
||||
GlobalUserSignal::getInstance()->setDeviceList(g_deviceListusb);
|
||||
if (sane_status) {
|
||||
KyInfo() << "Cannot get scan devices, sane_status = " << sane_status;
|
||||
sane_status = saneGetDevices(&g_deviceListusb);
|
||||
GlobalUserSignal::getInstance()->setDeviceList(g_deviceListusb);
|
||||
g_sane_object->g_deviceList = g_deviceListusb;
|
||||
if (sane_status) {
|
||||
KyInfo() << "Cannot get scan devices, sane_status = " << sane_status;
|
||||
// g_sane_object->setSaneStatus(false);
|
||||
return;
|
||||
}
|
||||
qDebug() << "scan device tag!";
|
||||
for (int i = 0; g_deviceListusb[i]; ++i) {
|
||||
KyInfo() << "mark-Name-usb: " << g_deviceListusb[i]->name
|
||||
<< "mark-Vendor-usb: " << g_deviceListusb[i]->vendor
|
||||
<< "mark-Model-usb: " << g_deviceListusb[i]->model
|
||||
<< "mark-Type-usb: " << g_deviceListusb[i]->type;
|
||||
|
||||
snprintf(name, 512, "%s %s %s", g_deviceListusb[i]->vendor, g_deviceListusb[i]->model,g_deviceListusb[i]->name);
|
||||
|
||||
names << name;
|
||||
|
||||
g_sane_object->setSaneNames(names);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
qDebug() << "scan device tag!";
|
||||
for (int i = 0; g_deviceListusb[i]; ++i) {
|
||||
KyInfo() << "mark-Name-usb: " << g_deviceListusb[i]->name
|
||||
<< "mark-Vendor-usb: " << g_deviceListusb[i]->vendor
|
||||
<< "mark-Model-usb: " << g_deviceListusb[i]->model
|
||||
<< "mark-Type-usb: " << g_deviceListusb[i]->type;
|
||||
|
||||
name = QString("%1 %2 %3").arg(g_deviceListusb[i]->vendor).arg(g_deviceListusb[i]->model).arg(g_deviceListusb[i]->name);
|
||||
names << name;
|
||||
}
|
||||
g_sane_object->setSaneNames(names);
|
||||
}
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#include <QObject>
|
||||
#include <QThread>
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
#include <sane/sane.h>
|
||||
|
||||
class UsbHotplugThread : public QThread
|
||||
|
@ -32,10 +33,26 @@ public:
|
|||
|
||||
bool exitWindowFlag = false;
|
||||
int hotplug_sock;
|
||||
QStringList USBdeviceList;
|
||||
const SANE_Device **g_deviceListusb = nullptr;
|
||||
void setExitFlagTrue();
|
||||
void setExitFlagFalse();
|
||||
private:
|
||||
void initSane();
|
||||
void usbAddSlot();
|
||||
void usbAddSlot(QString qstr);
|
||||
void usbRemoveSlot();
|
||||
bool usbDeviceIdentify(QString qstr);
|
||||
bool usbDeviceAdd(QString qstr);
|
||||
bool usbDeviceRemove(QString qstr);
|
||||
|
||||
QStringList getConnectedScanner();
|
||||
|
||||
QString getDeviceTypeFromPath(QString path);
|
||||
QString getRetFromCommand(QStringList command);
|
||||
void addToDeviceList(QString path);
|
||||
void removeToDeviceList(QString path);
|
||||
|
||||
bool isRemoveScanner(QString path);
|
||||
|
||||
Q_SIGNALS:
|
||||
void usbRemove(QString);
|
||||
|
|
Binary file not shown.
|
@ -457,7 +457,7 @@
|
|||
</message>
|
||||
<message>
|
||||
<source>Scan failed, please check your scanner or switch other scanners.</source>
|
||||
<translation>ཞིབ་བཤེར་བྱས་ནས་ཕམ་སོང་། ཁྱེད་ཀྱི་བཤེར་ཆས་ལ་ཞིབ་བཤེར་བྱེད་པའམ་ཡང་ན་བཤེར་ཆས་གཞན་དག་བརྗེ་རོགས།</translation>
|
||||
<translation type="vanished">ཞིབ་བཤེར་བྱས་ནས་ཕམ་སོང་། ཁྱེད་ཀྱི་བཤེར་ཆས་ལ་ཞིབ་བཤེར་བྱེད་པའམ་ཡང་ན་བཤེར་ཆས་གཞན་དག་བརྗེ་རོགས།</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Running beauty ...</source>
|
||||
|
@ -468,8 +468,20 @@
|
|||
<translation>འཁོར་སྐྱོད་དག་ཐེར་ ...</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>error code: </source>
|
||||
<translation type="unfinished"></translation>
|
||||
<source>error code:</source>
|
||||
<translation>ནོར་འཁྲུལ་ཚབ་ཨང་ནི།</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Scan failed, please check your scanner or switch other scanners. If you want to continue using the scanner, click Options, refresh the list to restart the device.</source>
|
||||
<translation>བཤར་འབེབས་ཕམ་པས།ཁྱེད་ཀྱི་བཤར་འབེབས་ཡོ་ཆས་སམ་ཡང་ན་གཞན་པའི་བཤར་འབེབས་ཡོ་ཆས་བརྗེ་རོགས། གལ་ཏེ་མུ་མཐུད་དུ་བཤར་འབེབས་ཆས་བཀོལ་དགོས་ན།འདེམ་བྱང་མནན་དགོས།གསར་བསྒྱུར་རེའུ་མིག་གིས་ཡང་བསྐྱར་སྒྲིག་ཆས་བཀོལ་དགོས།</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Alert</source>
|
||||
<translation>ཉེན་ཟོན་</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>A new Scanner has been connected.</source>
|
||||
<translation>བཤར་འབེབས་ཆས་གསར་པ་འབྲེལ་ཡོད།</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
|
@ -510,7 +522,34 @@
|
|||
<name>OcrThread</name>
|
||||
<message>
|
||||
<source>Unable to read text</source>
|
||||
<translation>ཡི་གེ་ཀློག་མི་ཐུབ་པ།</translation>
|
||||
<translation type="vanished">ཡི་གེ་ཀློག་མི་ཐུབ་པ།</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>QApplication</name>
|
||||
<message>
|
||||
<source>Scanner</source>
|
||||
<translation>བཤར་འབེབས་ཆས་</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Auto</source>
|
||||
<translation>རང་འགུལ་ཅན།</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Multiple</source>
|
||||
<translation>སྣ་མང་།</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Flatbed</source>
|
||||
<translation>ལེབ་རྣམ།</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Refreshing list. Please wait for the refresh success information...</source>
|
||||
<translation>གསར་སྒྱུར་རེའུ་མིག རྒྱལ་ཁའི་ཆ་འཕྲིན་གསར་དུ་གཏོད་པར་སྒུག་རོགས།</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Scanner is on detecting...</source>
|
||||
<translation>བཤར་འབེབས་ཆས་ཀྱིས་ཞིབ་བཤེར་བྱེད་བཞིན་ཡོད།</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
|
@ -667,7 +706,7 @@
|
|||
</message>
|
||||
<message>
|
||||
<source>Auto</source>
|
||||
<translation>རང་འགུལ་གྱིས་རླངས་</translation>
|
||||
<translation type="vanished">རང་འགུལ་གྱིས་རླངས་</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>75 dpi</source>
|
||||
|
@ -703,12 +742,20 @@
|
|||
</message>
|
||||
<message>
|
||||
<source>Multiple</source>
|
||||
<translation>སྣ་མང་།</translation>
|
||||
<translation type="vanished">སྣ་མང་།</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>ADF Duplex</source>
|
||||
<translation>ADF གོ་ཉིས་ཆོད་</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Refresh list complete.</source>
|
||||
<translation>གསར་འདོན་རེའུ་མིག་ལེགས་འགྲུབ་བྱ་དགོས་།</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>100 dpi</source>
|
||||
<translation>100 dpi</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>ScanDialog</name>
|
||||
|
@ -841,7 +888,7 @@
|
|||
</message>
|
||||
<message>
|
||||
<source>Begin Scan</source>
|
||||
<translation>ཞིབ་བཤེར་བྱེད་འགོ་ཚུགས།</translation>
|
||||
<translation type="vanished">ཞིབ་བཤེར་བྱེད་འགོ་ཚུགས།</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Scanner device</source>
|
||||
|
@ -937,7 +984,7 @@
|
|||
</message>
|
||||
<message>
|
||||
<source>Cancel</source>
|
||||
<translation>ཕྱིར་འཐེན།</translation>
|
||||
<translation type="vanished">ཕྱིར་འཐེན།</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>The file </source>
|
||||
|
@ -945,7 +992,7 @@
|
|||
</message>
|
||||
<message>
|
||||
<source> already exists, do you want to overwrite it?</source>
|
||||
<translation> ཡོད་ཟིན་པས་ཁྱོད་ཀྱིས་དེ་ལས་བརྒལ་ན་འདོད་དམ།</translation>
|
||||
<translation type="vanished"> ཡོད་ཟིན་པས་ཁྱོད་ཀྱིས་དེ་ལས་བརྒལ་ན་འདོད་དམ།</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Save As</source>
|
||||
|
@ -959,12 +1006,24 @@
|
|||
<source>File path that does not exist: </source>
|
||||
<translation>ཡིག་ཆའི་འགྲོ་ལམ་གནས་མེད།</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Flatbed scan mode not support multiple scan.</source>
|
||||
<translation>ངོས་ལེབ་བཤར་འབེབས་ཐེངས་མང་ལ་རྒྱབ་སྐྱོར་མི་བྱེད།</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source> already exists, do you want to overwrite it? If you are performing a multi page scan, it may cause multiple files to be overwritten. Please be cautious!</source>
|
||||
<translation>ད་ལྟ་གནས་ཡོད་པ་རེད།དེ་བཀབ་དགོས་སམ། གལ་ཏེ་ཁྱེད་ཀྱིས་ཤོག་ངོས་མང་བོར་བྱབས་འབེབས་ལག་བསྟར་བྱེད་བཞིན་ཡོད་ན།ཕལ་ཆེར་ཡིག་ཆ་མང་པོ་ཞིག་ལ་བཀབ་སྲིད། སེམས་ཆུང་བྱོས།</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Start Scan</source>
|
||||
<translation>བཤར་འབེབས་མགོ་བརྩམས་།</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>ScanThread</name>
|
||||
<message>
|
||||
<source>Multiple</source>
|
||||
<translation>སྣ་མང་།</translation>
|
||||
<translation type="vanished">སྣ་མང་།</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>3s</source>
|
||||
|
@ -1020,6 +1079,14 @@
|
|||
<source>Running rectify ...</source>
|
||||
<translation>འཁོར་སྐྱོད་དག་ཐེར་ ...</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Cancel</source>
|
||||
<translation>མེད་པར་བཟོ་བ་</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Canceling...Please waiting...</source>
|
||||
<translation>མི་དགོས་པ་བཟོ་བ།ཏོག་ཙམ་སྒུག་གནང་རོགས།</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>TitleBar</name>
|
||||
|
@ -1085,11 +1152,15 @@
|
|||
</message>
|
||||
<message>
|
||||
<source>Version: </source>
|
||||
<translation type="unfinished"></translation>
|
||||
<translation>པར་གཞི།</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Message provides text chat and file transfer functions in the LAN. There is no need to build a server. It supports multiple people to interact at the same time and send and receive in parallel.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<translation></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Refresh List</source>
|
||||
<translation>གསར་སྒྱུར་རེའུ་མིག</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
|
@ -1135,7 +1206,23 @@
|
|||
<name>UsbHotplugThread</name>
|
||||
<message>
|
||||
<source>Scanner has been disconnect.</source>
|
||||
<translation>བཤེར་ཆས་ཆད་སོང་།</translation>
|
||||
<translation type="vanished">བཤེར་ཆས་ཆད་སོང་།</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Querying scanner device. Please waitting...</source>
|
||||
<translation>བཤར་འབེབས་ཆས་ཀྱི་སྒྲིག་ཆས་འཚོལ་བཞིན་ཡོད། ཁྱེད་རང་གིས་སྒུག་རོགས་གནང་།</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>New Scanner has been Connected.</source>
|
||||
<translation>བཤར་འབེབས་ཆས་གསར་པ་ཟིན་འབྲེལ་མཐུད་བྱས་པ་རེད་།</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>A scanner is disconnected. If you disconnect the scanner is on scanning, click Cancel Scan or wait for the scanner to report an error message.</source>
|
||||
<translation>བཤར་འབེབས་ཆས་ཀྱི་འབྲེལ་ཐག་བཅད་ཟིན། གལ་ཏེ་འབྲེལ་མཐུད་བྱས་ན།བཤར་འབེབས་ཆས་ཀྱིས་བཤར་འབེབས་བྱེད་བཞིན་ཡོད་པས།བཤར་འབེབས་མེད་པར་བཟོ་བའམ་བཤར་འབེབས་ཆས་ཀྱིས་སྙན་ཞུ་ནོར་འཁྲུལ་ཅན་ལ་སྒུག་རོགས།</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Scanner is disconnect,refreshing scanner list. Please waitting...</source>
|
||||
<translation>བཤར་འབེབས་ཆས་ཀྱི་འབྲེལ་ཐག་བཅད་པས་བཤར་འབེབས་ཆས་ཀྱི་རེའུ་མིག་གསར་འདོན་བྱེད་བཞིན་ཡོད། ཁྱེད་རང་གིས་སྒུག་རོགས་གནང་།</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
|
|
Binary file not shown.
|
@ -83,7 +83,7 @@
|
|||
</message>
|
||||
<message>
|
||||
<source>Scan failed, please check your scanner or switch other scanners.</source>
|
||||
<translation>Сканерлеу сәтсіз аяқталды, сканеріңізді тексеріңіз немесе басқа сканерлерді ауыстырыңыз.</translation>
|
||||
<translation type="vanished">Сканерлеу сәтсіз аяқталды, сканеріңізді тексеріңіз немесе басқа сканерлерді ауыстырыңыз.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Device busy, please wait or switch other scanners.</source>
|
||||
|
@ -126,7 +126,19 @@
|
|||
<translation>Ректификациялау...</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>error code: </source>
|
||||
<source>error code:</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Scan failed, please check your scanner or switch other scanners. If you want to continue using the scanner, click Options, refresh the list to restart the device.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Alert</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>A new Scanner has been connected.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
|
@ -168,7 +180,34 @@
|
|||
<name>OcrThread</name>
|
||||
<message>
|
||||
<source>Unable to read text</source>
|
||||
<translation>Мәтін оқылмады</translation>
|
||||
<translation type="vanished">Мәтін оқылмады</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>QApplication</name>
|
||||
<message>
|
||||
<source>Scanner</source>
|
||||
<translation type="unfinished">Сканер</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Auto</source>
|
||||
<translation type="unfinished">Авто</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Multiple</source>
|
||||
<translation type="unfinished">Бірнешеу</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Flatbed</source>
|
||||
<translation type="unfinished">Флатбед</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Refreshing list. Please wait for the refresh success information...</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Scanner is on detecting...</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
|
@ -289,7 +328,7 @@
|
|||
</message>
|
||||
<message>
|
||||
<source>Auto</source>
|
||||
<translation>Авто</translation>
|
||||
<translation type="vanished">Авто</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>75 dpi</source>
|
||||
|
@ -341,12 +380,20 @@
|
|||
</message>
|
||||
<message>
|
||||
<source>Multiple</source>
|
||||
<translation type="unfinished">Бірнешеу</translation>
|
||||
<translation type="obsolete">Бірнешеу</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>ADF Duplex</source>
|
||||
<translation type="unfinished">ADF Duplex</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Refresh list complete.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>100 dpi</source>
|
||||
<translation type="unfinished">100 н/ д</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>ScanDialog</name>
|
||||
|
@ -415,7 +462,7 @@
|
|||
</message>
|
||||
<message>
|
||||
<source>Begin Scan</source>
|
||||
<translation>Сканерлеуді бастау</translation>
|
||||
<translation type="vanished">Сканерлеуді бастау</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Gray</source>
|
||||
|
@ -575,16 +622,12 @@
|
|||
</message>
|
||||
<message>
|
||||
<source>Cancel</source>
|
||||
<translation type="unfinished">Болдырмау</translation>
|
||||
<translation type="obsolete">Болдырмау</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>The file </source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source> already exists, do you want to overwrite it?</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Save As</source>
|
||||
<translation>باسقا جاققا ساقتاپ بەرۋ</translation>
|
||||
|
@ -597,6 +640,18 @@
|
|||
<source>File path that does not exist: </source>
|
||||
<translation>دەرەكجيىندى جاساۋ جولى</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Flatbed scan mode not support multiple scan.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source> already exists, do you want to overwrite it? If you are performing a multi page scan, it may cause multiple files to be overwritten. Please be cautious!</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Start Scan</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>ScanThread</name>
|
||||
|
@ -622,7 +677,7 @@
|
|||
</message>
|
||||
<message>
|
||||
<source>Multiple</source>
|
||||
<translation>Бірнешеу</translation>
|
||||
<translation type="vanished">Бірнешеу</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
|
@ -658,6 +713,14 @@
|
|||
<source>Running rectify ...</source>
|
||||
<translation type="unfinished">Ректификациялау...</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Cancel</source>
|
||||
<translation type="unfinished">Болдырмау</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Canceling...Please waiting...</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>TitleBar</name>
|
||||
|
@ -729,6 +792,10 @@
|
|||
<source>Message provides text chat and file transfer functions in the LAN. There is no need to build a server. It supports multiple people to interact at the same time and send and receive in parallel.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Refresh List</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>ToolBarWidget</name>
|
||||
|
@ -780,7 +847,19 @@
|
|||
<translation type="obsolete"> ажыратылды.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Scanner has been disconnect.</source>
|
||||
<source>Querying scanner device. Please waitting...</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>New Scanner has been Connected.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>A scanner is disconnected. If you disconnect the scanner is on scanning, click Cancel Scan or wait for the scanner to report an error message.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Scanner is disconnect,refreshing scanner list. Please waitting...</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
|
|
Binary file not shown.
|
@ -83,7 +83,7 @@
|
|||
</message>
|
||||
<message>
|
||||
<source>Scan failed, please check your scanner or switch other scanners.</source>
|
||||
<translation>Сканерлеу ишке ашпады, сураныч, сиздин сканер текшерүү же башка сканерлерди которуу.</translation>
|
||||
<translation type="vanished">Сканерлеу ишке ашпады, сураныч, сиздин сканер текшерүү же башка сканерлерди которуу.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Device busy, please wait or switch other scanners.</source>
|
||||
|
@ -126,7 +126,19 @@
|
|||
<translation>Чуркоо оңдоп ...</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>error code: </source>
|
||||
<source>error code:</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Scan failed, please check your scanner or switch other scanners. If you want to continue using the scanner, click Options, refresh the list to restart the device.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Alert</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>A new Scanner has been connected.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
|
@ -168,7 +180,34 @@
|
|||
<name>OcrThread</name>
|
||||
<message>
|
||||
<source>Unable to read text</source>
|
||||
<translation>Текстти окууга мүмкүн эмес</translation>
|
||||
<translation type="vanished">Текстти окууга мүмкүн эмес</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>QApplication</name>
|
||||
<message>
|
||||
<source>Scanner</source>
|
||||
<translation type="unfinished">Сканер</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Auto</source>
|
||||
<translation type="unfinished">Авто</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Multiple</source>
|
||||
<translation type="unfinished">Көп</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Flatbed</source>
|
||||
<translation type="unfinished">Жалпак түбүндө</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Refreshing list. Please wait for the refresh success information...</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Scanner is on detecting...</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
|
@ -289,7 +328,7 @@
|
|||
</message>
|
||||
<message>
|
||||
<source>Auto</source>
|
||||
<translation>Авто</translation>
|
||||
<translation type="vanished">Авто</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>75 dpi</source>
|
||||
|
@ -341,12 +380,20 @@
|
|||
</message>
|
||||
<message>
|
||||
<source>Multiple</source>
|
||||
<translation type="unfinished">Көп</translation>
|
||||
<translation type="obsolete">Көп</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>ADF Duplex</source>
|
||||
<translation type="unfinished">АДФ Дуплекс</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Refresh list complete.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>100 dpi</source>
|
||||
<translation type="unfinished">100 ДПИ</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>ScanDialog</name>
|
||||
|
@ -415,7 +462,7 @@
|
|||
</message>
|
||||
<message>
|
||||
<source>Begin Scan</source>
|
||||
<translation>Сканерлеуди баштоо</translation>
|
||||
<translation type="vanished">Сканерлеуди баштоо</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Gray</source>
|
||||
|
@ -575,16 +622,12 @@
|
|||
</message>
|
||||
<message>
|
||||
<source>Cancel</source>
|
||||
<translation type="unfinished">Жокко чыгаруу</translation>
|
||||
<translation type="obsolete">Жокко чыгаруу</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>The file </source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source> already exists, do you want to overwrite it?</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Save As</source>
|
||||
<translation>Басқаша сақтау</translation>
|
||||
|
@ -597,6 +640,18 @@
|
|||
<source>File path that does not exist: </source>
|
||||
<translation>Жол жоқ</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Flatbed scan mode not support multiple scan.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source> already exists, do you want to overwrite it? If you are performing a multi page scan, it may cause multiple files to be overwritten. Please be cautious!</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Start Scan</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>ScanThread</name>
|
||||
|
@ -622,7 +677,7 @@
|
|||
</message>
|
||||
<message>
|
||||
<source>Multiple</source>
|
||||
<translation>Көп</translation>
|
||||
<translation type="vanished">Көп</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
|
@ -658,6 +713,14 @@
|
|||
<source>Running rectify ...</source>
|
||||
<translation type="unfinished">Чуркоо оңдоп ...</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Cancel</source>
|
||||
<translation type="unfinished">Жокко чыгаруу</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Canceling...Please waiting...</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>TitleBar</name>
|
||||
|
@ -729,6 +792,10 @@
|
|||
<source>Message provides text chat and file transfer functions in the LAN. There is no need to build a server. It supports multiple people to interact at the same time and send and receive in parallel.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Refresh List</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>ToolBarWidget</name>
|
||||
|
@ -780,7 +847,19 @@
|
|||
<translation type="obsolete"> ажыратылды.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Scanner has been disconnect.</source>
|
||||
<source>Querying scanner device. Please waitting...</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>New Scanner has been Connected.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>A scanner is disconnected. If you disconnect the scanner is on scanning, click Cancel Scan or wait for the scanner to report an error message.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Scanner is disconnect,refreshing scanner list. Please waitting...</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
|
|
Binary file not shown.
|
@ -83,7 +83,7 @@
|
|||
</message>
|
||||
<message>
|
||||
<source>Scan failed, please check your scanner or switch other scanners.</source>
|
||||
<translation>سىكاننېرلاش مەغلۇپ بولدى، سكاننېرىڭىزنى تەكشۈرۈپ بېقىڭ ياكى باشقا سكاننېرلارنى ئالماشتۇرۇڭ.</translation>
|
||||
<translation type="vanished">سىكاننېرلاش مەغلۇپ بولدى، سكاننېرىڭىزنى تەكشۈرۈپ بېقىڭ ياكى باشقا سكاننېرلارنى ئالماشتۇرۇڭ.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Device busy, please wait or switch other scanners.</source>
|
||||
|
@ -126,7 +126,19 @@
|
|||
<translation>يۈگۈرۈشنى تەرتىپكە سېلىش ...</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>error code: </source>
|
||||
<source>error code:</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Scan failed, please check your scanner or switch other scanners. If you want to continue using the scanner, click Options, refresh the list to restart the device.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Alert</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>A new Scanner has been connected.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
|
@ -168,7 +180,34 @@
|
|||
<name>OcrThread</name>
|
||||
<message>
|
||||
<source>Unable to read text</source>
|
||||
<translation>تېكىستنى ئوقۇغىلى بولمايدۇ</translation>
|
||||
<translation type="vanished">تېكىستنى ئوقۇغىلى بولمايدۇ</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>QApplication</name>
|
||||
<message>
|
||||
<source>Scanner</source>
|
||||
<translation type="unfinished">سكاننېر</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Auto</source>
|
||||
<translation type="unfinished">ئاپتۇماتىك</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Multiple</source>
|
||||
<translation type="unfinished">كۆپ</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Flatbed</source>
|
||||
<translation type="unfinished">تۈزلەڭلىك</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Refreshing list. Please wait for the refresh success information...</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Scanner is on detecting...</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
|
@ -289,7 +328,7 @@
|
|||
</message>
|
||||
<message>
|
||||
<source>Auto</source>
|
||||
<translation>ئاپتۇماتىك</translation>
|
||||
<translation type="vanished">ئاپتۇماتىك</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>75 dpi</source>
|
||||
|
@ -341,12 +380,20 @@
|
|||
</message>
|
||||
<message>
|
||||
<source>Multiple</source>
|
||||
<translation type="unfinished">كۆپ</translation>
|
||||
<translation type="obsolete">كۆپ</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>ADF Duplex</source>
|
||||
<translation type="unfinished">ADF Duplex</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Refresh list complete.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>100 dpi</source>
|
||||
<translation type="unfinished">100 dpi</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>ScanDialog</name>
|
||||
|
@ -415,7 +462,7 @@
|
|||
</message>
|
||||
<message>
|
||||
<source>Begin Scan</source>
|
||||
<translation>سىكاننېرلاشنى باشلى</translation>
|
||||
<translation type="vanished">سىكاننېرلاشنى باشلى</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Gray</source>
|
||||
|
@ -575,16 +622,12 @@
|
|||
</message>
|
||||
<message>
|
||||
<source>Cancel</source>
|
||||
<translation type="unfinished">ئەمەلدىن قالدۇرۇش</translation>
|
||||
<translation type="obsolete">ئەمەلدىن قالدۇرۇش</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>The file </source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source> already exists, do you want to overwrite it?</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Save As</source>
|
||||
<translation>ئايرىم ساقلاش ئۈچۈن</translation>
|
||||
|
@ -597,6 +640,18 @@
|
|||
<source>File path that does not exist: </source>
|
||||
<translation>يول مەۋجۇت ئەمەس</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Flatbed scan mode not support multiple scan.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source> already exists, do you want to overwrite it? If you are performing a multi page scan, it may cause multiple files to be overwritten. Please be cautious!</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Start Scan</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>ScanThread</name>
|
||||
|
@ -622,7 +677,7 @@
|
|||
</message>
|
||||
<message>
|
||||
<source>Multiple</source>
|
||||
<translation>كۆپ</translation>
|
||||
<translation type="vanished">كۆپ</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
|
@ -658,6 +713,14 @@
|
|||
<source>Running rectify ...</source>
|
||||
<translation type="unfinished">يۈگۈرۈشنى تەرتىپكە سېلىش ...</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Cancel</source>
|
||||
<translation type="unfinished">ئەمەلدىن قالدۇرۇش</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Canceling...Please waiting...</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>TitleBar</name>
|
||||
|
@ -729,6 +792,10 @@
|
|||
<source>Message provides text chat and file transfer functions in the LAN. There is no need to build a server. It supports multiple people to interact at the same time and send and receive in parallel.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Refresh List</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>ToolBarWidget</name>
|
||||
|
@ -780,7 +847,19 @@
|
|||
<translation type="obsolete"> ئىزچىل ئۈزۈلۈپ قالدى.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Scanner has been disconnect.</source>
|
||||
<source>Querying scanner device. Please waitting...</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>New Scanner has been Connected.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>A scanner is disconnected. If you disconnect the scanner is on scanning, click Cancel Scan or wait for the scanner to report an error message.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Scanner is disconnect,refreshing scanner list. Please waitting...</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
|
|
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue