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
dbd24150
Commit
dbd24150
authored
Apr 26, 2022
by
luoliangyi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加应用配置功能
parent
de7bd5d0
Changes
18
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
294 additions
and
139 deletions
+294
-139
app/scanner/app_cfg.cpp
app/scanner/app_cfg.cpp
+65
-0
app/scanner/app_cfg.h
app/scanner/app_cfg.h
+14
-0
app/scanner/dialog_aquireinto.cpp
app/scanner/dialog_aquireinto.cpp
+18
-10
app/scanner/dialog_aquireinto.ui
app/scanner/dialog_aquireinto.ui
+6
-0
app/scanner/dialog_export.cpp
app/scanner/dialog_export.cpp
+138
-93
app/scanner/dialog_fullscreen.cpp
app/scanner/dialog_fullscreen.cpp
+1
-1
app/scanner/dialog_insertindex.cpp
app/scanner/dialog_insertindex.cpp
+17
-3
app/scanner/dialog_insertindex.h
app/scanner/dialog_insertindex.h
+2
-8
app/scanner/dialog_moveto.cpp
app/scanner/dialog_moveto.cpp
+1
-0
app/scanner/dialog_moveto.ui
app/scanner/dialog_moveto.ui
+15
-16
app/scanner/dialog_saveas.cpp
app/scanner/dialog_saveas.cpp
+7
-2
app/scanner/dialog_savequality.cpp
app/scanner/dialog_savequality.cpp
+1
-0
app/scanner/mainwindow.cpp
app/scanner/mainwindow.cpp
+3
-2
app/scanner/mainwindow.h
app/scanner/mainwindow.h
+1
-1
build-qt/windows/HGSolution/HGScanner.pro
build-qt/windows/HGSolution/HGScanner.pro
+2
-0
ui/HGImgThumb.cpp
ui/HGImgThumb.cpp
+1
-1
ui/HGImgThumb.h
ui/HGImgThumb.h
+1
-1
ui/HGImgView.cpp
ui/HGImgView.cpp
+1
-1
No files found.
app/scanner/app_cfg.cpp
0 → 100644
View file @
dbd24150
#include "app_cfg.h"
#include "base/HGDef.h"
#include "base/HGInc.h"
#include "base/HGUtility.h"
#include "HGUIGlobal.h"
QString
getCfgValue
(
const
char
*
appName
,
const
char
*
key
,
const
QString
&
def
)
{
HGChar
cfgPath
[
512
];
HGBase_GetConfigPath
(
cfgPath
,
512
);
strcat
(
cfgPath
,
"HGScanner.ini"
);
HGChar
value
[
512
]
=
{
0
};
HGBase_GetProfileString
(
cfgPath
,
appName
,
key
,
getStdString
(
def
).
c_str
(),
value
,
512
);
return
StdStringToUtf8
(
value
).
c_str
();
}
int
getCfgValue
(
const
char
*
appName
,
const
char
*
key
,
int
def
)
{
HGChar
cfgPath
[
512
];
HGBase_GetConfigPath
(
cfgPath
,
512
);
strcat
(
cfgPath
,
"HGScanner.ini"
);
HGInt
value
=
0
;
HGBase_GetProfileInt
(
cfgPath
,
appName
,
key
,
def
,
&
value
);
return
value
;
}
bool
getCfgValue
(
const
char
*
appName
,
const
char
*
key
,
bool
def
)
{
HGChar
cfgPath
[
512
];
HGBase_GetConfigPath
(
cfgPath
,
512
);
strcat
(
cfgPath
,
"HGScanner.ini"
);
HGInt
value
=
0
;
HGBase_GetProfileInt
(
cfgPath
,
appName
,
key
,
(
HGInt
)
def
,
&
value
);
return
(
bool
)
value
;
}
void
saveCfgValue
(
const
char
*
appName
,
const
char
*
key
,
const
QString
&
value
)
{
HGChar
cfgPath
[
512
];
HGBase_GetConfigPath
(
cfgPath
,
512
);
strcat
(
cfgPath
,
"HGScanner.ini"
);
HGBase_SetProfileString
(
cfgPath
,
appName
,
key
,
getStdString
(
value
).
c_str
());
}
void
saveCfgValue
(
const
char
*
appName
,
const
char
*
key
,
int
value
)
{
HGChar
cfgPath
[
512
];
HGBase_GetConfigPath
(
cfgPath
,
512
);
strcat
(
cfgPath
,
"HGScanner.ini"
);
HGBase_SetProfileInt
(
cfgPath
,
appName
,
key
,
value
);
}
void
saveCfgValue
(
const
char
*
appName
,
const
char
*
key
,
bool
value
)
{
HGChar
cfgPath
[
512
];
HGBase_GetConfigPath
(
cfgPath
,
512
);
strcat
(
cfgPath
,
"HGScanner.ini"
);
HGBase_SetProfileInt
(
cfgPath
,
appName
,
key
,
(
HGInt
)
value
);
}
app/scanner/app_cfg.h
0 → 100644
View file @
dbd24150
#ifndef __APP_CFG_H__
#define __APP_CFG_H__
#include <QString>
QString
getCfgValue
(
const
char
*
appName
,
const
char
*
key
,
const
QString
&
def
);
int
getCfgValue
(
const
char
*
appName
,
const
char
*
key
,
int
def
);
bool
getCfgValue
(
const
char
*
appName
,
const
char
*
key
,
bool
def
);
void
saveCfgValue
(
const
char
*
appName
,
const
char
*
key
,
const
QString
&
value
);
void
saveCfgValue
(
const
char
*
appName
,
const
char
*
key
,
int
value
);
void
saveCfgValue
(
const
char
*
appName
,
const
char
*
key
,
bool
value
);
#endif
/* __APP_CFG_H__ */
app/scanner/dialog_aquireinto.cpp
View file @
dbd24150
...
...
@@ -9,11 +9,11 @@
#include "base/HGInc.h"
#include "base/HGUtility.h"
#include "HGUIGlobal.h"
#include "app_cfg.h"
Dialog_AquireInto
::
Dialog_AquireInto
(
QWidget
*
parent
)
:
QDialog
(
parent
),
ui
(
new
Ui
::
Dialog_AquireInto
),
m_saveQuality
(
0
)
ui
(
new
Ui
::
Dialog_AquireInto
)
{
ui
->
setupUi
(
this
);
...
...
@@ -25,16 +25,17 @@ Dialog_AquireInto::Dialog_AquireInto(QWidget* parent) :
strcat
(
aquireIntoPath
,
"Huago/ScannerApp/AquireInto/"
);
QString
filePath
=
getStdFileName
(
StdStringToUtf8
(
aquireIntoPath
).
c_str
());
ui
->
lineEdit_directory
->
setText
(
filePath
);
ui
->
cbtn_subFolder
->
setChecked
(
false
);
m_saveQuality
=
getCfgValue
(
"aquire"
,
"quality"
,
0
);
ui
->
lineEdit_directory
->
setText
(
getCfgValue
(
"aquire"
,
"aquireIntoPath"
,
filePath
));
ui
->
cbtn_subFolder
->
setChecked
(
getCfgValue
(
"aquire"
,
"subFolderByTime"
,
false
));
ui
->
cbtn_subFolderByBlank
->
setChecked
(
false
);
ui
->
cbtn_subFolderByColor
->
setChecked
(
false
);
ui
->
lineEdit_fileName
->
setText
(
"HGScan"
);
ui
->
spin_index
->
setValue
(
1
);
ui
->
cbox_digit
->
setCurrentIndex
(
2
);
ui
->
lineEdit_fileName
->
setText
(
getCfgValue
(
"aquire"
,
"namePrefix"
,
QString
(
"HGScan"
))
);
ui
->
spin_index
->
setValue
(
getCfgValue
(
"aquire"
,
"startIndex"
,
1
)
);
ui
->
cbox_digit
->
setCurrentIndex
(
getCfgValue
(
"aquire"
,
"digit"
,
2
)
);
ui
->
cbox_evenOdd
->
setCurrentIndex
(
0
);
ui
->
cbox_format
->
setCurrentIndex
(
0
);
ui
->
cbtn_multiFile
->
setChecked
(
false
);
ui
->
cbox_format
->
setCurrentIndex
(
getCfgValue
(
"aquire"
,
"format"
,
0
)
);
ui
->
cbtn_multiFile
->
setChecked
(
getCfgValue
(
"aquire"
,
"multiFile"
,
false
)
);
ui
->
radio_multiAll
->
setChecked
(
true
);
ui
->
spinBox_multiPages
->
setValue
(
1
);
...
...
@@ -139,7 +140,14 @@ void Dialog_AquireInto::on_lineEdit_directory_textChanged(const QString& arg1)
void
Dialog_AquireInto
::
on_buttonBox_accepted
()
{
// 保存到配置文件
saveCfgValue
(
"aquire"
,
"quality"
,
m_saveQuality
);
saveCfgValue
(
"aquire"
,
"aquireIntoPath"
,
ui
->
lineEdit_directory
->
text
());
saveCfgValue
(
"aquire"
,
"namePrefix"
,
ui
->
lineEdit_fileName
->
text
());
saveCfgValue
(
"aquire"
,
"subFolderByTime"
,
ui
->
cbtn_subFolder
->
isChecked
());
saveCfgValue
(
"aquire"
,
"startIndex"
,
ui
->
spin_index
->
value
());
saveCfgValue
(
"aquire"
,
"digit"
,
ui
->
cbox_digit
->
currentIndex
());
saveCfgValue
(
"aquire"
,
"format"
,
ui
->
cbox_format
->
currentIndex
());
saveCfgValue
(
"aquire"
,
"multiFile"
,
ui
->
cbtn_multiFile
->
isChecked
());
}
void
Dialog_AquireInto
::
on_cbox_digit_currentIndexChanged
(
int
index
)
...
...
app/scanner/dialog_aquireinto.ui
View file @
dbd24150
...
...
@@ -116,6 +116,12 @@
</item>
<item>
<widget
class=
"QSpinBox"
name=
"spin_index"
>
<property
name=
"minimumSize"
>
<size>
<width>
0
</width>
<height>
0
</height>
</size>
</property>
<property
name=
"maximum"
>
<number>
99999
</number>
</property>
...
...
app/scanner/dialog_export.cpp
View file @
dbd24150
This diff is collapsed.
Click to expand it.
app/scanner/dialog_fullscreen.cpp
View file @
dbd24150
#include "dialog_fullscreen.h"
#
include
"dialog_fullscreen.h"
#include "ui_dialog_fullscreen.h"
#include "mainwindow.h"
#include "imgfmt/HGPdf.h"
...
...
app/scanner/dialog_insertindex.cpp
View file @
dbd24150
...
...
@@ -2,12 +2,12 @@
#include "ui_dialog_insertindex.h"
#include <QButtonGroup>
#include <QPushButton>
#include "app_cfg.h"
Dialog_InsertIndex
::
Dialog_InsertIndex
(
QWidget
*
parent
)
:
QDialog
(
parent
),
ui
(
new
Ui
::
Dialog_InsertIndex
),
button_group
(
new
QButtonGroup
),
m_index
(
afterLast
)
button_group
(
new
QButtonGroup
)
{
ui
->
setupUi
(
this
);
button_group
->
addButton
(
ui
->
rbtn_first
,
0
);
...
...
@@ -17,8 +17,17 @@ Dialog_InsertIndex::Dialog_InsertIndex(QWidget *parent) :
ui
->
buttonBox
->
button
(
QDialogButtonBox
::
Ok
)
->
setText
(
tr
(
"ok"
));
ui
->
buttonBox
->
button
(
QDialogButtonBox
::
Cancel
)
->
setText
(
tr
(
"cancel"
));
connect
(
button_group
,
SIGNAL
(
buttonClicked
(
int
)),
this
,
SLOT
(
on_rbtn_clicked
(
int
)));
m_index
=
getCfgValue
(
"insertScan"
,
"insertType"
,
3
);
if
(
0
==
m_index
)
ui
->
rbtn_first
->
setChecked
(
true
);
else
if
(
1
==
m_index
)
ui
->
rbtn_beforeCurr
->
setChecked
(
true
);
else
if
(
2
==
m_index
)
ui
->
rbtn_afterCurr
->
setChecked
(
true
);
else
ui
->
rbtn_last
->
setChecked
(
true
);
}
Dialog_InsertIndex
::~
Dialog_InsertIndex
()
...
...
@@ -31,3 +40,8 @@ void Dialog_InsertIndex::on_rbtn_clicked(int id)
{
m_index
=
id
;
}
void
Dialog_InsertIndex
::
on_buttonBox_accepted
()
{
saveCfgValue
(
"insertScan"
,
"insertType"
,
m_index
);
}
app/scanner/dialog_insertindex.h
View file @
dbd24150
...
...
@@ -12,14 +12,6 @@ class Dialog_InsertIndex : public QDialog
{
Q_OBJECT
public:
enum
IndexPosition
{
beforeFirst
,
beforeCurrent
,
afterCurrent
,
afterLast
};
public:
explicit
Dialog_InsertIndex
(
QWidget
*
parent
=
nullptr
);
~
Dialog_InsertIndex
();
...
...
@@ -29,6 +21,8 @@ public:
private
slots
:
void
on_rbtn_clicked
(
int
id
);
void
on_buttonBox_accepted
();
private:
Ui
::
Dialog_InsertIndex
*
ui
;
QButtonGroup
*
button_group
;
...
...
app/scanner/dialog_moveto.cpp
View file @
dbd24150
...
...
@@ -7,6 +7,7 @@ Dialog_MoveTo::Dialog_MoveTo(int count, int pos, QWidget *parent) :
{
ui
->
setupUi
(
this
);
ui
->
spinBox
->
setFixedWidth
(
120
);
ui
->
spinBox
->
setMaximum
(
count
);
ui
->
spinBox
->
setMinimum
(
0
);
ui
->
spinBox
->
setValue
(
pos
);
...
...
app/scanner/dialog_moveto.ui
View file @
dbd24150
...
...
@@ -29,28 +29,27 @@
<set>
QDialogButtonBox::Cancel|QDialogButtonBox::Ok
</set>
</property>
</widget>
<widget
class=
"Q
SpinBox"
name=
"spinBox
"
>
<widget
class=
"Q
Widget"
name=
"
"
>
<property
name=
"geometry"
>
<rect>
<x>
1
5
0
</x>
<x>
10
</x>
<y>
50
</y>
<width>
91
</width>
<height>
22
</height>
</rect>
</property>
</widget>
<widget
class=
"QLabel"
name=
"label"
>
<property
name=
"geometry"
>
<rect>
<x>
80
</x>
<y>
50
</y>
<width>
61
</width>
<width>
231
</width>
<height>
21
</height>
</rect>
</property>
<property
name=
"text"
>
<string>
insert pos:
</string>
</property>
<layout
class=
"QHBoxLayout"
name=
"horizontalLayout_2"
>
<item>
<widget
class=
"QLabel"
name=
"label"
>
<property
name=
"text"
>
<string>
insert pos:
</string>
</property>
</widget>
</item>
<item>
<widget
class=
"QSpinBox"
name=
"spinBox"
/>
</item>
</layout>
</widget>
</widget>
<resources/>
...
...
app/scanner/dialog_saveas.cpp
View file @
dbd24150
...
...
@@ -2,12 +2,11 @@
#include "ui_dialog_saveas.h"
#include "dialog_savequality.h"
#include "HGUIGlobal.h"
#include "app_cfg.h"
Dialog_SaveAs
::
Dialog_SaveAs
(
QWidget
*
parent
)
:
QDialog
(
parent
)
,
ui
(
new
Ui
::
Dialog_SaveAs
)
,
m_saveQuality
(
0
)
,
m_suffix
(
0
)
{
ui
->
setupUi
(
this
);
...
...
@@ -26,6 +25,10 @@ Dialog_SaveAs::Dialog_SaveAs(QWidget *parent) :
connect
(
ui
->
fileDialog
,
SIGNAL
(
accepted
()),
this
,
SLOT
(
on_dialog_accepted
()));
connect
(
ui
->
fileDialog
,
SIGNAL
(
rejected
()),
this
,
SLOT
(
close
()));
connect
(
ui
->
fileDialog
,
SIGNAL
(
filterSelected
(
const
QString
&
)),
this
,
SLOT
(
on_filterSelected
(
const
QString
&
)));
m_saveQuality
=
getCfgValue
(
"saveAs"
,
"quality"
,
0
);
m_suffix
=
getCfgValue
(
"saveAs"
,
"suffix"
,
0
);
ui
->
fileDialog
->
selectNameFilter
(
ui
->
fileDialog
->
nameFilters
().
at
(
m_suffix
));
}
Dialog_SaveAs
::~
Dialog_SaveAs
()
...
...
@@ -83,6 +86,8 @@ void Dialog_SaveAs::on_dialog_accepted()
m_savePath
=
getStdFileName
(
path
+
name
+
extName
);
}
saveCfgValue
(
"saveAs"
,
"quality"
,
m_saveQuality
);
saveCfgValue
(
"saveAs"
,
"suffix"
,
m_suffix
);
accept
();
}
...
...
app/scanner/dialog_savequality.cpp
View file @
dbd24150
...
...
@@ -8,6 +8,7 @@ Dialog_SaveQuality::Dialog_SaveQuality(int quality, QWidget *parent) :
{
ui
->
setupUi
(
this
);
ui
->
spinBox
->
setFixedWidth
(
120
);
ui
->
spinBox
->
setValue
(
quality
);
ui
->
buttonBox
->
button
(
QDialogButtonBox
::
Ok
)
->
setText
(
tr
(
"ok"
));
...
...
app/scanner/mainwindow.cpp
View file @
dbd24150
...
...
@@ -34,11 +34,11 @@
#include "imgproc/HGImgProc.h"
#include "base/HGUtility.h"
#include "HGUIGlobal.h"
#include "app_cfg.h"
MainWindow
::
MainWindow
(
QWidget
*
parent
)
:
QMainWindow
(
parent
)
,
ui
(
new
Ui
::
MainWindow
)
,
m_password
(
"123456"
)
,
m_admin_loggedIn
(
false
)
,
m_currFilePath
(
""
)
,
m_currIndex
(
-
1
)
...
...
@@ -222,7 +222,7 @@ MainWindow::MainWindow(QWidget *parent)
m_saneDeviceAction
=
nullptr
;
m_saneDeviceHandle
=
nullptr
;
//
m_password
=
getCfgValue
(
"login"
,
"password"
,
"123456"
);
m_config
.
load
();
SANE_Int
v
=
0
;
...
...
@@ -1967,6 +1967,7 @@ void MainWindow::on_act_passwordChange_triggered()
if
(
dlg
.
exec
())
{
m_password
=
dlg
.
getNewPassword
();
saveCfgValue
(
"login"
,
"password"
,
m_password
);
}
}
...
...
app/scanner/mainwindow.h
View file @
dbd24150
#ifndef MAINWINDOW_H
#
ifndef
MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
...
...
build-qt/windows/HGSolution/HGScanner.pro
View file @
dbd24150
...
...
@@ -42,6 +42,7 @@ INCLUDEPATH += $$PWD/../../../release/include/
INCLUDEPATH
+=
$$
PWD
/../../../
third_party
/
sane
/
SOURCES
+=
\
..
/../../
app
/
scanner
/
app_cfg
.
cpp
\
..
/../../
app
/
scanner
/
dialog_aquireinto
.
cpp
\
..
/../../
app
/
scanner
/
dialog_clrcache
.
cpp
\
..
/../../
app
/
scanner
/
dialog_export
.
cpp
\
...
...
@@ -74,6 +75,7 @@ SOURCES += \
..
/../../
ui
/
HGUIGlobal
.
cpp
HEADERS
+=
\
..
/../../
app
/
scanner
/
app_cfg
.
h
\
..
/../../
app
/
scanner
/
dialog_aquireinto
.
h
\
..
/../../
app
/
scanner
/
dialog_clrcache
.
h
\
..
/../../
app
/
scanner
/
dialog_export
.
h
\
...
...
ui/HGImgThumb.cpp
View file @
dbd24150
#include "HGImgThumb.h"
#
include
"HGImgThumb.h"
#include <QMouseEvent>
#include <QPainter>
#include <QKeyEvent>
...
...
ui/HGImgThumb.h
View file @
dbd24150
#ifndef __HGIMGTHUMB_H__
#
ifndef
__HGIMGTHUMB_H__
#define __HGIMGTHUMB_H__
#include "base/HGDef.h"
...
...
ui/HGImgView.cpp
View file @
dbd24150
#include "HGImgView.h"
#
include
"HGImgView.h"
#include <QMouseEvent>
#include <QPainter>
#include <QToolTip>
...
...
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