HGGitLab
Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
app
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
CI / CD Analytics
Repository Analytics
Value Stream Analytics
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
luoliangyi
app
Commits
aaf5aea2
Commit
aaf5aea2
authored
Apr 26, 2022
by
luoliangyi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
解决导出时不能多张导出的问题
parent
bfca5cb4
Changes
12
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
286 additions
and
186 deletions
+286
-186
app/scanner/Scanner_zh_CN.qm
app/scanner/Scanner_zh_CN.qm
+0
-0
app/scanner/Scanner_zh_CN.ts
app/scanner/Scanner_zh_CN.ts
+136
-128
app/scanner/dialog_aquireinto.ui
app/scanner/dialog_aquireinto.ui
+1
-1
app/scanner/dialog_export.cpp
app/scanner/dialog_export.cpp
+24
-1
app/scanner/dialog_export.h
app/scanner/dialog_export.h
+5
-0
app/scanner/dialog_export.ui
app/scanner/dialog_export.ui
+7
-0
app/scanner/dialog_exportimagefile.cpp
app/scanner/dialog_exportimagefile.cpp
+63
-9
app/scanner/dialog_exportimagefile.h
app/scanner/dialog_exportimagefile.h
+6
-2
app/scanner/dialog_moveto.ui
app/scanner/dialog_moveto.ui
+16
-9
app/scanner/dialog_savequality.cpp
app/scanner/dialog_savequality.cpp
+0
-2
app/scanner/dialog_savequality.ui
app/scanner/dialog_savequality.ui
+14
-2
app/scanner/mainwindow.cpp
app/scanner/mainwindow.cpp
+14
-32
No files found.
app/scanner/Scanner_zh_CN.qm
View file @
aaf5aea2
No preview for this file type
app/scanner/Scanner_zh_CN.ts
View file @
aaf5aea2
This diff is collapsed.
Click to expand it.
app/scanner/dialog_aquireinto.ui
View file @
aaf5aea2
...
...
@@ -6,7 +6,7 @@
<rect>
<x>
0
</x>
<y>
0
</y>
<width>
44
3
</width>
<width>
44
2
</width>
<height>
360
</height>
</rect>
</property>
...
...
app/scanner/dialog_export.cpp
View file @
aaf5aea2
...
...
@@ -43,6 +43,8 @@ Dialog_Export::Dialog_Export(int total, const std::vector<int> &selectedIndexs,
m_saveQuality
=
getCfgValue
(
"export"
,
"quality"
,
0
);
m_suffix
=
getCfgValue
(
"export"
,
"suffix"
,
0
);
ui
->
fileDialog
->
selectNameFilter
(
ui
->
fileDialog
->
nameFilters
().
at
(
m_suffix
));
ui
->
check_saveAsMulti
->
setEnabled
(
m_suffix
>
2
);
ui
->
check_saveAsMulti
->
setChecked
(
getCfgValue
(
"export"
,
"saveAsMulti"
,
false
));
int
exportType
=
getCfgValue
(
"export"
,
"exportType"
,
0
);
if
(
0
==
exportType
)
...
...
@@ -79,11 +81,26 @@ QString Dialog_Export::getSavePath()
return
m_savePath
;
}
QString
Dialog_Export
::
getSaveName
()
{
return
m_saveName
;
}
QString
Dialog_Export
::
getSaveExt
()
{
return
m_saveExt
;
}
int
Dialog_Export
::
getSaveQuality
()
{
return
m_saveQuality
;
}
bool
Dialog_Export
::
isSaveAsMultiPage
()
{
return
ui
->
check_saveAsMulti
->
isChecked
();
}
void
Dialog_Export
::
getSaveIndexs
(
std
::
vector
<
int
>
&
indexs
)
{
indexs
=
m_saveIndexs
;
...
...
@@ -126,7 +143,9 @@ void Dialog_Export::on_dialog_accepted()
if
(
-
1
!=
pos
)
name
=
name
.
left
(
pos
);
m_savePath
=
getStdFileName
(
path
+
name
+
extName
);
m_savePath
=
getStdFileName
(
path
);
m_saveName
=
name
;
m_saveExt
=
extName
;
}
makeSaveIndexs
();
...
...
@@ -142,6 +161,7 @@ void Dialog_Export::on_dialog_accepted()
else
if
(
ui
->
radio_nominatedPages
->
isChecked
())
exportType
=
2
;
saveCfgValue
(
"export"
,
"exportType"
,
exportType
);
saveCfgValue
(
"export"
,
"saveAsMulti"
,
ui
->
check_saveAsMulti
->
isChecked
());
accept
();
}
...
...
@@ -149,6 +169,9 @@ void Dialog_Export::on_dialog_accepted()
void
Dialog_Export
::
on_filterSelected
(
const
QString
&
filterName
)
{
m_suffix
=
ui
->
fileDialog
->
nameFilters
().
indexOf
(
filterName
);
ui
->
check_saveAsMulti
->
setEnabled
(
m_suffix
>
2
);
if
(
m_suffix
<=
2
)
ui
->
check_saveAsMulti
->
setChecked
(
false
);
}
void
Dialog_Export
::
on_btn_option_clicked
()
...
...
app/scanner/dialog_export.h
View file @
aaf5aea2
...
...
@@ -16,7 +16,10 @@ public:
~
Dialog_Export
();
QString
getSavePath
();
QString
getSaveName
();
QString
getSaveExt
();
int
getSaveQuality
();
bool
isSaveAsMultiPage
();
void
getSaveIndexs
(
std
::
vector
<
int
>
&
indexs
);
private
slots
:
...
...
@@ -36,6 +39,8 @@ private:
std
::
vector
<
int
>
m_selectedIndexs
;
QString
m_savePath
;
QString
m_saveName
;
QString
m_saveExt
;
int
m_saveQuality
;
std
::
vector
<
int
>
m_saveIndexs
;
int
m_suffix
;
...
...
app/scanner/dialog_export.ui
View file @
aaf5aea2
...
...
@@ -114,6 +114,13 @@ Page range will be "Chosen Pages".</string>
</item>
</layout>
</item>
<item>
<widget
class=
"QCheckBox"
name=
"check_saveAsMulti"
>
<property
name=
"text"
>
<string>
Save as multipages (TIFF/PDF/OFD)
</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
...
...
app/scanner/dialog_exportimagefile.cpp
View file @
aaf5aea2
...
...
@@ -3,10 +3,14 @@
#include "imgfmt/HGImgFmt.h"
#include "HGUIGlobal.h"
Dialog_ExportImageFile
::
Dialog_ExportImageFile
(
const
QString
&
destFile
,
int
saveQuality
,
const
QStringList
&
srcFiles
,
QWidget
*
parent
)
:
QDialog
(
parent
)
Dialog_ExportImageFile
::
Dialog_ExportImageFile
(
const
QString
&
destPath
,
const
QString
&
destName
,
const
QString
&
destExt
,
bool
isSaveAsMulti
,
int
saveQuality
,
const
QStringList
&
srcFiles
,
QWidget
*
parent
)
:
QDialog
(
parent
)
,
ui
(
new
Ui
::
Dialog_ExportImageFile
)
,
m_destFile
(
destFile
)
,
m_destPath
(
destPath
)
,
m_destName
(
destName
)
,
m_destExt
(
destExt
)
,
m_isSaveAsMulti
(
isSaveAsMulti
)
,
m_saveQuality
(
saveQuality
)
,
m_srcFiles
(
srcFiles
)
{
...
...
@@ -39,10 +43,56 @@ void Dialog_ExportImageFile::ThreadFunc(HGThread thread, HGPointer param)
(
void
)
thread
;
Dialog_ExportImageFile
*
p
=
(
Dialog_ExportImageFile
*
)
param
;
HGImgFmtWriter
imgFmtWriter
=
nullptr
;
HGImgFmt_OpenImageWriter
(
getStdString
(
p
->
m_destFile
).
c_str
(),
0
,
&
imgFmtWriter
);
if
(
nullptr
!=
imgFmtWriter
)
if
(
p
->
m_isSaveAsMulti
)
{
QString
fileName
=
p
->
m_destPath
+
p
->
m_destName
+
p
->
m_destExt
;
HGImgFmtWriter
imgFmtWriter
=
nullptr
;
HGImgFmt_OpenImageWriter
(
getStdString
(
fileName
).
c_str
(),
0
,
&
imgFmtWriter
);
if
(
nullptr
!=
imgFmtWriter
)
{
for
(
int
i
=
0
;
i
<
p
->
m_srcFiles
.
size
();
++
i
)
{
if
(
p
->
m_stopThread
)
{
break
;
}
emit
p
->
updateProgress
(
i
);
HGImgFmtReader
imgFmtReader
=
nullptr
;
HGImgFmt_OpenImageReader
(
getStdString
(
p
->
m_srcFiles
[
i
]).
c_str
(),
0
,
&
imgFmtReader
);
if
(
nullptr
!=
imgFmtReader
)
{
HGUInt
count
=
0
;
HGImgFmt_GetImagePageCount
(
imgFmtReader
,
&
count
);
for
(
HGUInt
j
=
0
;
j
<
count
;
++
j
)
{
if
(
p
->
m_stopThread
)
{
break
;
}
HGImage
img
=
nullptr
;
HGImgFmt_LoadImageFromReader
(
imgFmtReader
,
j
,
nullptr
,
HGBASE_IMGTYPE_RGB
,
HGBASE_IMGORIGIN_TOP
,
&
img
);
if
(
nullptr
!=
img
)
{
HGImgFmt_SaveImageToWriter
(
imgFmtWriter
,
img
,
nullptr
,
(
HGUInt
)
p
->
m_saveQuality
);
HGBase_DestroyImage
(
img
);
}
}
HGImgFmt_CloseImageReader
(
imgFmtReader
);
}
}
HGImgFmt_CloseImageWriter
(
imgFmtWriter
);
}
}
else
{
int
index
=
1
;
for
(
int
i
=
0
;
i
<
p
->
m_srcFiles
.
size
();
++
i
)
{
if
(
p
->
m_stopThread
)
...
...
@@ -69,7 +119,13 @@ void Dialog_ExportImageFile::ThreadFunc(HGThread thread, HGPointer param)
HGImgFmt_LoadImageFromReader
(
imgFmtReader
,
j
,
nullptr
,
HGBASE_IMGTYPE_RGB
,
HGBASE_IMGORIGIN_TOP
,
&
img
);
if
(
nullptr
!=
img
)
{
HGImgFmt_SaveImageToWriter
(
imgFmtWriter
,
img
,
nullptr
,
(
HGUInt
)
p
->
m_saveQuality
);
char
fileName
[
512
];
sprintf
(
fileName
,
"%s%03d"
,
getStdString
(
p
->
m_destName
).
c_str
(),
index
);
++
index
;
QString
saveFileName
=
p
->
m_destPath
+
QString
(
StdStringToUtf8
(
fileName
).
c_str
())
+
p
->
m_destExt
;
HGImgFmt_SaveImage
(
img
,
0
,
nullptr
,
(
HGUInt
)
p
->
m_saveQuality
,
getStdString
(
saveFileName
).
c_str
());
HGBase_DestroyImage
(
img
);
}
}
...
...
@@ -77,8 +133,6 @@ void Dialog_ExportImageFile::ThreadFunc(HGThread thread, HGPointer param)
HGImgFmt_CloseImageReader
(
imgFmtReader
);
}
}
HGImgFmt_CloseImageWriter
(
imgFmtWriter
);
}
emit
p
->
finish
();
...
...
app/scanner/dialog_exportimagefile.h
View file @
aaf5aea2
...
...
@@ -13,7 +13,8 @@ class Dialog_ExportImageFile : public QDialog
Q_OBJECT
public:
explicit
Dialog_ExportImageFile
(
const
QString
&
destFile
,
int
saveQuality
,
const
QStringList
&
srcFiles
,
QWidget
*
parent
=
nullptr
);
explicit
Dialog_ExportImageFile
(
const
QString
&
destPath
,
const
QString
&
destName
,
const
QString
&
destExt
,
bool
isSaveAsMulti
,
int
saveQuality
,
const
QStringList
&
srcFiles
,
QWidget
*
parent
=
nullptr
);
~
Dialog_ExportImageFile
();
private:
...
...
@@ -34,7 +35,10 @@ protected:
private:
Ui
::
Dialog_ExportImageFile
*
ui
;
QString
m_destFile
;
QString
m_destPath
;
QString
m_destName
;
QString
m_destExt
;
bool
m_isSaveAsMulti
;
int
m_saveQuality
;
QStringList
m_srcFiles
;
...
...
app/scanner/dialog_moveto.ui
View file @
aaf5aea2
...
...
@@ -6,8 +6,8 @@
<rect>
<x>
0
</x>
<y>
0
</y>
<width>
2
5
2
</width>
<height>
149
</height>
<width>
2
6
2
</width>
<height>
97
</height>
</rect>
</property>
<property
name=
"windowTitle"
>
...
...
@@ -16,8 +16,8 @@
<widget
class=
"QDialogButtonBox"
name=
"buttonBox"
>
<property
name=
"geometry"
>
<rect>
<x>
7
0
</x>
<y>
10
0
</y>
<x>
8
0
</x>
<y>
5
0
</y>
<width>
171
</width>
<height>
32
</height>
</rect>
...
...
@@ -29,13 +29,13 @@
<set>
QDialogButtonBox::Cancel|QDialogButtonBox::Ok
</set>
</property>
</widget>
<widget
class=
"QWidget"
name=
""
>
<widget
class=
"QWidget"
name=
"
layoutWidget
"
>
<property
name=
"geometry"
>
<rect>
<x>
1
0
</x>
<y>
5
0
</y>
<x>
2
0
</x>
<y>
2
0
</y>
<width>
231
</width>
<height>
2
1
</height>
<height>
2
2
</height>
</rect>
</property>
<layout
class=
"QHBoxLayout"
name=
"horizontalLayout_2"
>
...
...
@@ -47,7 +47,14 @@
</widget>
</item>
<item>
<widget
class=
"QSpinBox"
name=
"spinBox"
/>
<widget
class=
"QSpinBox"
name=
"spinBox"
>
<property
name=
"sizePolicy"
>
<sizepolicy
hsizetype=
"Preferred"
vsizetype=
"Fixed"
>
<horstretch>
0
</horstretch>
<verstretch>
0
</verstretch>
</sizepolicy>
</property>
</widget>
</item>
</layout>
</widget>
...
...
app/scanner/dialog_savequality.cpp
View file @
aaf5aea2
...
...
@@ -7,8 +7,6 @@ Dialog_SaveQuality::Dialog_SaveQuality(int quality, QWidget *parent) :
ui
(
new
Ui
::
Dialog_SaveQuality
)
{
ui
->
setupUi
(
this
);
ui
->
spinBox
->
setFixedWidth
(
180
);
ui
->
spinBox
->
setValue
(
quality
);
ui
->
buttonBox
->
button
(
QDialogButtonBox
::
Ok
)
->
setText
(
tr
(
"ok"
));
...
...
app/scanner/dialog_savequality.ui
View file @
aaf5aea2
...
...
@@ -6,8 +6,8 @@
<rect>
<x>
0
</x>
<y>
0
</y>
<width>
3
97
</width>
<height>
252
</height>
<width>
3
26
</width>
<height>
105
</height>
</rect>
</property>
<property
name=
"windowTitle"
>
...
...
@@ -18,6 +18,12 @@
<layout
class=
"QHBoxLayout"
name=
"horizontalLayout"
>
<item>
<widget
class=
"QSlider"
name=
"horizontalSlider"
>
<property
name=
"sizePolicy"
>
<sizepolicy
hsizetype=
"Preferred"
vsizetype=
"Fixed"
>
<horstretch>
0
</horstretch>
<verstretch>
0
</verstretch>
</sizepolicy>
</property>
<property
name=
"maximum"
>
<number>
100
</number>
</property>
...
...
@@ -28,6 +34,12 @@
</item>
<item>
<widget
class=
"QSpinBox"
name=
"spinBox"
>
<property
name=
"sizePolicy"
>
<sizepolicy
hsizetype=
"Preferred"
vsizetype=
"Fixed"
>
<horstretch>
0
</horstretch>
<verstretch>
0
</verstretch>
</sizepolicy>
</property>
<property
name=
"maximum"
>
<number>
100
</number>
</property>
...
...
app/scanner/mainwindow.cpp
View file @
aaf5aea2
...
...
@@ -1573,45 +1573,27 @@ void MainWindow::on_act_Export_triggered()
Dialog_Export
dlg
(
count
,
selectIndexs
,
this
);
if
(
dlg
.
exec
())
{
QString
savePath
=
dlg
.
getSavePath
()
;
QString
List
srcFiles
;
bool
find
=
false
;
for
(
int
i
=
0
;
i
<
count
;
++
i
)
std
::
vector
<
int
>
saveIndexs
;
dlg
.
getSaveIndexs
(
saveIndexs
);
for
(
size_t
i
=
0
;
i
<
saveIndexs
.
size
();
++
i
)
{
QString
fileName
;
m_thumb
->
getItemFileName
(
i
,
fileName
);
assert
(
!
fileName
.
isEmpty
());
if
(
fileName
==
savePath
)
{
find
=
true
;
break
;
}
m_thumb
->
getItemFileName
(
saveIndexs
[
i
],
fileName
);
srcFiles
.
append
(
fileName
);
}
if
(
!
find
)
if
(
!
srcFiles
.
isEmpty
()
)
{
QStringList
srcFiles
;
std
::
vector
<
int
>
saveIndexs
;
dlg
.
getSaveIndexs
(
saveIndexs
);
for
(
size_t
i
=
0
;
i
<
saveIndexs
.
size
();
++
i
)
{
QString
fileName
;
m_thumb
->
getItemFileName
(
saveIndexs
[
i
],
fileName
);
srcFiles
.
append
(
fileName
);
}
QString
savePath
=
dlg
.
getSavePath
();
QString
saveName
=
dlg
.
getSaveName
();
QString
saveExt
=
dlg
.
getSaveExt
();
bool
isSaveAsMulti
=
dlg
.
isSaveAsMultiPage
();
int
saveQuality
=
dlg
.
getSaveQuality
();
if
(
!
srcFiles
.
isEmpty
())
{
int
saveQuality
=
dlg
.
getSaveQuality
();
Dialog_ExportImageFile
dlgExport
(
savePath
,
saveQuality
,
srcFiles
,
this
);
dlgExport
.
exec
();
}
}
else
{
QMessageBox
::
information
(
this
,
tr
(
"info"
),
tr
(
"find savePath in thumbnail"
));
Dialog_ExportImageFile
dlgExport
(
savePath
,
saveName
,
saveExt
,
isSaveAsMulti
,
saveQuality
,
srcFiles
,
this
);
dlgExport
.
exec
();
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment