Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Graphics
digiKam
Commits
59f0bdb6
Commit
59f0bdb6
authored
Nov 15, 2014
by
Marcel Wiesweg
Browse files
Add database cleanup calls to have a clean shutdown of SQLite data at application termination
parent
b9f8dbfe
Changes
2
Hide whitespace changes
Inline
Side-by-side
app/main/main.cpp
View file @
59f0bdb6
...
...
@@ -62,6 +62,7 @@
#include
"databaseparameters.h"
#include
"digikamapp.h"
#include
"scancontroller.h"
#include
"thumbnaildatabaseaccess.h"
#include
"version.h"
using
namespace
Digikam
;
...
...
@@ -235,6 +236,8 @@ int main(int argc, char* argv[])
int
ret
=
app
.
exec
();
DatabaseAccess
::
cleanUpDatabase
();
ThumbnailDatabaseAccess
::
cleanUpDatabase
();
KExiv2Iface
::
KExiv2
::
cleanupExiv2
();
return
ret
;
...
...
tests/testdatabase.cpp
View file @
59f0bdb6
...
...
@@ -30,6 +30,7 @@
#include
<QSqlDatabase>
#include
<QDBusConnection>
#include
<QString>
#include
<QTimer>
// KDE includes
...
...
@@ -47,6 +48,7 @@
#include
"databaseparameters.h"
#include
"scancontroller.h"
#include
"setup.h"
#include
"thumbnaildatabaseaccess.h"
#include
"version.h"
namespace
Digikam
...
...
@@ -76,16 +78,28 @@ int main(int argc, char** argv)
KCmdLineArgs
::
init
(
argc
,
argv
,
&
aboutData
);
KApplication
app
;
DatabaseParameters
params
=
DatabaseParameters
::
parametersFromConfig
(
KGlobal
::
config
());
DatabaseParameters
params
;
params
.
databaseType
=
DatabaseParameters
::
SQLiteDatabaseType
();
params
.
setDatabasePath
(
QDir
::
currentPath
()
+
"/digikam-test.db"
);
params
.
setThumbsDatabasePath
(
QDir
::
currentPath
()
+
"/digikam-thumbs-test.db"
);
params
.
legacyAndDefaultChecks
();
QDBusConnection
::
sessionBus
().
registerService
(
"org.kde.digikam.startup-"
+
QString
::
number
(
QCoreApplication
::
instance
()
->
applicationPid
()));
// initialize database
bool
b
=
AlbumManager
::
instance
()
->
setDatabase
(
params
,
false
);
bool
b
=
AlbumManager
::
instance
()
->
setDatabase
(
params
,
false
,
"/media/fotos/Digikam Sample/"
);
kDebug
()
<<
"Database initialization done: "
<<
b
;
QTimer
::
singleShot
(
500
,
&
app
,
SLOT
(
quit
()));
app
.
exec
();
ScanController
::
instance
()
->
shutDown
();
DatabaseAccess
::
cleanUpDatabase
();
ThumbnailDatabaseAccess
::
cleanUpDatabase
();
return
0
;
}
Write
Preview
Supports
Markdown
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