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
70de9c6c
Commit
70de9c6c
authored
May 03, 2022
by
luoliangyi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
UI微调
parent
f3abd9b7
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
113 additions
and
32 deletions
+113
-32
app/scanner/dialog_aquireinto.cpp
app/scanner/dialog_aquireinto.cpp
+4
-0
app/scanner/dialog_aquireinto.ui
app/scanner/dialog_aquireinto.ui
+4
-4
app/scanner/dialog_imageeditor.cpp
app/scanner/dialog_imageeditor.cpp
+11
-1
app/scanner/dialog_imgproc_adjust.cpp
app/scanner/dialog_imgproc_adjust.cpp
+33
-9
app/scanner/dialog_imgproc_autocrop.cpp
app/scanner/dialog_imgproc_autocrop.cpp
+29
-11
app/scanner/dialog_imgproc_autocrop.ui
app/scanner/dialog_imgproc_autocrop.ui
+4
-4
app/scanner/dialog_openimageindex.ui
app/scanner/dialog_openimageindex.ui
+10
-3
app/scanner/widget_imgproc_base.cpp
app/scanner/widget_imgproc_base.cpp
+15
-0
app/scanner/widget_imgproc_base.h
app/scanner/widget_imgproc_base.h
+3
-0
No files found.
app/scanner/dialog_aquireinto.cpp
View file @
70de9c6c
...
...
@@ -51,6 +51,10 @@ Dialog_AquireInto::Dialog_AquireInto(QWidget* parent) :
ui
->
buttonBox
->
button
(
QDialogButtonBox
::
Ok
)
->
setText
(
tr
(
"ok"
));
ui
->
buttonBox
->
button
(
QDialogButtonBox
::
Cancel
)
->
setText
(
tr
(
"cancel"
));
this
->
setFixedHeight
(
380
);
ui
->
spin_index
->
setFixedWidth
(
160
);
ui
->
cbox_digit
->
setFixedWidth
(
80
);
//Temporarily hide some functions
ui
->
cbtn_subFolderByBlank
->
setVisible
(
false
);
ui
->
cbtn_subFolderByColor
->
setVisible
(
false
);
...
...
app/scanner/dialog_aquireinto.ui
View file @
70de9c6c
...
...
@@ -6,8 +6,8 @@
<rect>
<x>
0
</x>
<y>
0
</y>
<width>
442
</width>
<height>
360
</height>
<width>
554
</width>
<height>
525
</height>
</rect>
</property>
<property
name=
"sizePolicy"
>
...
...
@@ -18,8 +18,8 @@
</property>
<property
name=
"maximumSize"
>
<size>
<width>
462
</width>
<height>
360
</height>
<width>
16777215
</width>
<height>
16777215
</height>
</size>
</property>
<property
name=
"windowTitle"
>
...
...
app/scanner/dialog_imageeditor.cpp
View file @
70de9c6c
...
...
@@ -2,6 +2,8 @@
#include "ui_dialog_imageeditor.h"
#include "graphicsscene.h"
#include <QColorDialog>
#include <app_cfg.h>
int
m_textSize
[]
=
{
6
,
7
,
8
,
9
,
10
,
11
,
12
,
14
,
16
,
18
,
20
,
22
,
24
,
26
,
28
,
36
,
28
,
72
};
int
m_lineWidth
[]
=
{
1
,
3
,
5
,
8
};
float
m_scaled
[]
=
{
0.1
f
,
0.2
f
,
0.3
f
,
0.4
f
,
0.5
f
,
0.6
f
,
0.8
f
,
1.0
f
,
1.2
f
,
1.5
f
,
2.0
f
,
2.5
f
,
4.0
f
,
6.0
f
};
...
...
@@ -19,6 +21,12 @@ Dialog_ImageEditor::Dialog_ImageEditor(QWidget *parent)
ui
->
comboBox_lineWidth
->
setItemData
(
i
,
m_lineWidth
[
i
]);
ui
->
graphicsView
->
setScene
(
m_scene
);
ui
->
btn_color
->
setStyleSheet
(
"QPushButton{background-color:red;border:1px solid red;}"
);
ui
->
comboBox_lineWidth
->
setCurrentIndex
(
getCfgValue
(
"imageEditor"
,
"lineWidth"
,
0
));
ui
->
comboBox_textSize
->
setCurrentIndex
(
getCfgValue
(
"imageEditor"
,
"textSize"
,
0
));
ui
->
comboBox_textSize
->
setFixedWidth
(
80
);
ui
->
comboBox_lineWidth
->
setFixedWidth
(
120
);
}
Dialog_ImageEditor
::~
Dialog_ImageEditor
()
...
...
@@ -154,7 +162,9 @@ void Dialog_ImageEditor::on_btn_undo_clicked()
void
Dialog_ImageEditor
::
on_btn_ok_clicked
()
{
//exportImage().save("2.jpg");
saveCfgValue
(
"imageEditor"
,
"lineWidth"
,
ui
->
comboBox_lineWidth
->
currentIndex
());
saveCfgValue
(
"imageEditor"
,
"textSize"
,
ui
->
comboBox_textSize
->
currentIndex
());
accept
();
}
...
...
app/scanner/dialog_imgproc_adjust.cpp
View file @
70de9c6c
#include "dialog_imgproc_adjust.h"
#include "ui_dialog_imgproc_adjust.h"
#include "imgproc/HGImgProc.h"
#include "app_cfg.h"
Dialog_ImgProc_Adjust
::
Dialog_ImgProc_Adjust
(
HGImage
img
,
QWidget
*
parent
)
:
QDialog
(
parent
),
...
...
@@ -8,23 +9,32 @@ Dialog_ImgProc_Adjust::Dialog_ImgProc_Adjust(HGImage img, QWidget *parent) :
{
ui
->
setupUi
(
this
);
m_base_widget
=
new
Widget_Imgproc_Base
(
this
);
reinterpret_cast
<
QVBoxLayout
*>
(
this
->
layout
())
->
insertWidget
(
2
,
m_base_widget
);
connect
(
m_base_widget
,
SIGNAL
(
brightness_change
(
int
)),
this
,
SLOT
(
on_brightness_change
(
int
)));
connect
(
m_base_widget
,
SIGNAL
(
contrast_change
(
int
)),
this
,
SLOT
(
on_contrast_change
(
int
)));
connect
(
m_base_widget
,
SIGNAL
(
gamma_change
(
double
)),
this
,
SLOT
(
on_gamma_change
(
double
)));
ui
->
view_before
->
addImage
(
img
);
ui
->
view_after
->
addImage
(
img
);
m_brightness
=
getCfgValue
(
"adjust"
,
"brightness"
,
0
);
m_base_widget
->
setBrightness
(
m_brightness
);
m_contrast
=
getCfgValue
(
"adjust"
,
"contrast"
,
0
);
m_base_widget
->
setContrast
(
m_contrast
);
QString
gamma
=
getCfgValue
(
"adjust"
,
"gamma"
,
QString
(
"1.0"
));
m_gamma
=
atof
(
gamma
.
toStdString
().
c_str
());
m_base_widget
->
setGamma
(
m_gamma
);
ui
->
cbtn_preview
->
setChecked
(
getCfgValue
(
"adjust"
,
"preview"
,
false
));
ui
->
cbtn_applyImg
->
setChecked
(
getCfgValue
(
"adjust"
,
"applyImg"
,
false
));
ui
->
gbox_before
->
setVisible
(
ui
->
cbtn_preview
->
isChecked
());
ui
->
gbox_after
->
setVisible
(
ui
->
cbtn_preview
->
isChecked
());
ui
->
buttonBox
->
button
(
QDialogButtonBox
::
Ok
)
->
setText
(
tr
(
"ok"
));
ui
->
buttonBox
->
button
(
QDialogButtonBox
::
Cancel
)
->
setText
(
tr
(
"cancel"
));
ui
->
buttonBox
->
button
(
QDialogButtonBox
::
RestoreDefaults
)
->
setText
(
tr
(
"restore default"
));
m_base_widget
=
new
Widget_Imgproc_Base
(
this
);
reinterpret_cast
<
QVBoxLayout
*>
(
this
->
layout
())
->
insertWidget
(
2
,
m_base_widget
);
connect
(
m_base_widget
,
SIGNAL
(
brightness_change
(
int
)),
this
,
SLOT
(
on_brightness_change
(
int
)));
connect
(
m_base_widget
,
SIGNAL
(
contrast_change
(
int
)),
this
,
SLOT
(
on_contrast_change
(
int
)));
connect
(
m_base_widget
,
SIGNAL
(
gamma_change
(
double
)),
this
,
SLOT
(
on_gamma_change
(
double
)));
m_brightness
=
0
;
m_contrast
=
0
;
m_gamma
=
1.0
;
}
Dialog_ImgProc_Adjust
::~
Dialog_ImgProc_Adjust
()
...
...
@@ -49,18 +59,23 @@ HGImage Dialog_ImgProc_Adjust::getAfterImage()
void
Dialog_ImgProc_Adjust
::
on_brightness_change
(
int
value
)
{
m_brightness
=
value
;
saveCfgValue
(
"adjust"
,
"brightness"
,
m_brightness
);
process
();
}
void
Dialog_ImgProc_Adjust
::
on_contrast_change
(
int
value
)
{
m_contrast
=
value
;
saveCfgValue
(
"adjust"
,
"contrast"
,
m_contrast
);
process
();
}
void
Dialog_ImgProc_Adjust
::
on_gamma_change
(
double
value
)
{
m_gamma
=
value
;
char
gamma
[
32
];
sprintf
(
gamma
,
"%f"
,
m_gamma
);
saveCfgValue
(
"adjust"
,
"gamma"
,
QString
(
gamma
));
process
();
}
...
...
@@ -69,6 +84,7 @@ void Dialog_ImgProc_Adjust::on_cbtn_preview_toggled(bool checked)
reinterpret_cast
<
QVBoxLayout
*>
(
this
->
layout
())
->
setStretch
(
1
,
checked
?
1
:
0
);
ui
->
gbox_before
->
setVisible
(
checked
);
ui
->
gbox_after
->
setVisible
(
checked
);
saveCfgValue
(
"adjust"
,
"preview"
,
checked
);
}
void
Dialog_ImgProc_Adjust
::
on_cbtn_applyImg_toggled
(
bool
checked
)
...
...
@@ -80,6 +96,7 @@ void Dialog_ImgProc_Adjust::on_cbtn_applyImg_toggled(bool checked)
ui
->
view_before
->
getImage
(
&
img
);
assert
(
nullptr
!=
img
);
emit
applyToImage
(
img
);
saveCfgValue
(
"adjust"
,
"applyImg"
,
checked
);
}
void
Dialog_ImgProc_Adjust
::
on_buttonBox_clicked
(
QAbstractButton
*
button
)
...
...
@@ -90,6 +107,13 @@ void Dialog_ImgProc_Adjust::on_buttonBox_clicked(QAbstractButton *button)
m_brightness
=
0
;
m_contrast
=
0
;
m_gamma
=
1.0
;
saveCfgValue
(
"adjust"
,
"brightness"
,
m_brightness
);
saveCfgValue
(
"adjust"
,
"contrast"
,
m_contrast
);
char
gamma
[
32
];
sprintf
(
gamma
,
"%f"
,
m_gamma
);
saveCfgValue
(
"adjust"
,
"gamma"
,
QString
(
gamma
));
process
();
}
}
...
...
app/scanner/dialog_imgproc_autocrop.cpp
View file @
70de9c6c
...
...
@@ -4,6 +4,7 @@
#include <QPushButton>
#include <QMouseEvent>
#include <QDebug>
#include "app_cfg.h"
Dialog_ImgProc_AutoCrop
::
Dialog_ImgProc_AutoCrop
(
QWidget
*
parent
)
:
QDialog
(
parent
)
...
...
@@ -14,8 +15,8 @@ Dialog_ImgProc_AutoCrop::Dialog_ImgProc_AutoCrop(QWidget *parent)
,
m_isCrop
(
false
)
,
m_isDeskew
(
false
)
,
m_isFillBlank
(
false
)
,
m_isConvex
(
fals
e
)
,
m_isAutoColor
(
fals
e
)
,
m_isConvex
(
tru
e
)
,
m_isAutoColor
(
tru
e
)
,
m_isUseAdvancedParam
(
false
)
,
m_threshold
(
40
)
,
m_noise
(
8
)
...
...
@@ -28,15 +29,23 @@ Dialog_ImgProc_AutoCrop::Dialog_ImgProc_AutoCrop(QWidget *parent)
m_btnGroup_backgroundColor
.
addButton
(
ui
->
rbtn_autoColor
);
m_btnGroup_backgroundColor
.
addButton
(
ui
->
rbtn_defaultColor
);
ui
->
cbtn_crop
->
setChecked
(
false
);
ui
->
cbtn_corrSkew
->
setChecked
(
false
);
ui
->
gbox_fillBlank
->
setChecked
(
false
);
ui
->
rbtn_convex
->
setChecked
(
true
);
ui
->
rbtn_autoColor
->
setChecked
(
true
);
ui
->
gbox_param
->
setChecked
(
false
);
ui
->
spin_threshold
->
setValue
(
40
);
ui
->
spin_noise
->
setValue
(
8
);
ui
->
spin_indent
->
setValue
(
5
);
ui
->
cbtn_crop
->
setChecked
(
getCfgValue
(
"autoCrop"
,
"crop"
,
false
));
ui
->
cbtn_corrSkew
->
setChecked
(
getCfgValue
(
"autoCrop"
,
"deskew"
,
false
));
ui
->
gbox_fillBlank
->
setChecked
(
getCfgValue
(
"autoCrop"
,
"fillBlank"
,
false
));
bool
convex
=
getCfgValue
(
"autoCrop"
,
"convex"
,
true
);
if
(
convex
)
ui
->
rbtn_convex
->
setChecked
(
true
);
else
ui
->
rbtn_concave
->
setChecked
(
true
);
bool
autoColor
=
getCfgValue
(
"autoCrop"
,
"autoColor"
,
true
);
if
(
autoColor
)
ui
->
rbtn_autoColor
->
setChecked
(
true
);
else
ui
->
rbtn_defaultColor
->
setChecked
(
true
);
ui
->
gbox_param
->
setChecked
(
getCfgValue
(
"autoCrop"
,
"useAdvancedParam"
,
false
));
ui
->
spin_threshold
->
setValue
(
getCfgValue
(
"autoCrop"
,
"threshold"
,
40
));
ui
->
spin_noise
->
setValue
(
getCfgValue
(
"autoCrop"
,
"noise"
,
8
));
ui
->
spin_indent
->
setValue
(
getCfgValue
(
"autoCrop"
,
"indent"
,
5
));
ui
->
lab_imgBefore
->
setPixmap
(
QPixmap
::
fromImage
(
QImage
()));
ui
->
lab_arrow
->
setPixmap
(
QPixmap
::
fromImage
(
QImage
()));
...
...
@@ -108,14 +117,23 @@ void Dialog_ImgProc_AutoCrop::on_buttonBox_clicked(QAbstractButton *button)
void
Dialog_ImgProc_AutoCrop
::
on_buttonBox_accepted
()
{
m_isCrop
=
ui
->
cbtn_crop
->
isChecked
();
saveCfgValue
(
"autoCrop"
,
"crop"
,
m_isCrop
);
m_isDeskew
=
ui
->
cbtn_corrSkew
->
isChecked
();
saveCfgValue
(
"autoCrop"
,
"deskew"
,
m_isDeskew
);
m_isFillBlank
=
ui
->
gbox_fillBlank
->
isChecked
();
saveCfgValue
(
"autoCrop"
,
"fillBlank"
,
m_isFillBlank
);
m_isConvex
=
ui
->
rbtn_convex
->
isChecked
();
saveCfgValue
(
"autoCrop"
,
"convex"
,
m_isConvex
);
m_isAutoColor
=
ui
->
rbtn_autoColor
->
isChecked
();
saveCfgValue
(
"autoCrop"
,
"autoColor"
,
m_isAutoColor
);
m_isUseAdvancedParam
=
ui
->
gbox_param
->
isChecked
();
saveCfgValue
(
"autoCrop"
,
"useAdvancedParam"
,
m_isUseAdvancedParam
);
m_threshold
=
ui
->
spin_threshold
->
value
();
saveCfgValue
(
"autoCrop"
,
"threshold"
,
m_threshold
);
m_noise
=
ui
->
spin_noise
->
value
();
saveCfgValue
(
"autoCrop"
,
"noise"
,
m_noise
);
m_indent
=
ui
->
spin_indent
->
value
();
saveCfgValue
(
"autoCrop"
,
"indent"
,
m_indent
);
}
void
Dialog_ImgProc_AutoCrop
::
updateExample
(
int
example
)
...
...
app/scanner/dialog_imgproc_autocrop.ui
View file @
70de9c6c
...
...
@@ -7,7 +7,7 @@
<x>
0
</x>
<y>
0
</y>
<width>
600
</width>
<height>
40
6
</height>
<height>
40
8
</height>
</rect>
</property>
<property
name=
"minimumSize"
>
...
...
@@ -124,7 +124,7 @@
<widget
class=
"QSpinBox"
name=
"spin_threshold"
>
<property
name=
"maximumSize"
>
<size>
<width>
1
00
</width>
<width>
1
6777215
</width>
<height>
16777215
</height>
</size>
</property>
...
...
@@ -151,7 +151,7 @@
<widget
class=
"QSpinBox"
name=
"spin_noise"
>
<property
name=
"maximumSize"
>
<size>
<width>
1
00
</width>
<width>
1
6777215
</width>
<height>
16777215
</height>
</size>
</property>
...
...
@@ -178,7 +178,7 @@
<widget
class=
"QSpinBox"
name=
"spin_indent"
>
<property
name=
"maximumSize"
>
<size>
<width>
1
00
</width>
<width>
1
6777215
</width>
<height>
16777215
</height>
</size>
</property>
...
...
app/scanner/dialog_openimageindex.ui
View file @
70de9c6c
...
...
@@ -6,8 +6,8 @@
<rect>
<x>
0
</x>
<y>
0
</y>
<width>
22
6
</width>
<height>
1
02
</height>
<width>
31
6
</width>
<height>
1
27
</height>
</rect>
</property>
<property
name=
"windowTitle"
>
...
...
@@ -26,7 +26,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>
</item>
...
...
app/scanner/widget_imgproc_base.cpp
View file @
70de9c6c
...
...
@@ -17,6 +17,21 @@ Widget_Imgproc_Base::~Widget_Imgproc_Base()
delete
ui
;
}
void
Widget_Imgproc_Base
::
setBrightness
(
int
brightness
)
{
ui
->
spin_brightness
->
setValue
(
brightness
);
}
void
Widget_Imgproc_Base
::
setContrast
(
int
contrast
)
{
ui
->
spin_contrast
->
setValue
(
contrast
);
}
void
Widget_Imgproc_Base
::
setGamma
(
double
gamma
)
{
ui
->
dspin_gamma
->
setValue
(
gamma
);
}
void
Widget_Imgproc_Base
::
setDefault
()
{
ui
->
spin_brightness
->
setValue
(
0
);
...
...
app/scanner/widget_imgproc_base.h
View file @
70de9c6c
...
...
@@ -15,6 +15,9 @@ public:
explicit
Widget_Imgproc_Base
(
QWidget
*
parent
=
nullptr
);
~
Widget_Imgproc_Base
();
void
setBrightness
(
int
brightness
);
void
setContrast
(
int
contrast
);
void
setGamma
(
double
gamma
);
void
setDefault
();
signals:
...
...
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