Accessing digikam database from external application

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Accessing digikam database from external application

Xavier Chardon-2
Hi all,

Could someone give me some hints on how to access a digikam database from a new application, using libdigikamdatabase?

I tried to look in the source code of digikam. I found out I should do something like that:

#include <databaseaccess.h>
 
int main(){
  
   Digikam::DatabaseAccess::setParameters(
                    Digikam::DatabaseParameters(Digikam::DatabaseParameters::parametersForSQLiteDefaultFile("/path/to/database")    )
                    );

   Digikam::DatabaseAccess::checkReadyForUse ();
 
   Digikam::DatabaseAccess DbA = Digikam::DatabaseAccess();
   // Then I should be able to access the database with:
   DbA.db()

 };


Now, the problem occurs when I call the function "setParameters". I get the following output:
QEventLoop: Cannot be used without QApplication
QObject::connect: Cannot connect (null)::aboutToQuit() to Digikam::DatabaseCoreBackend::slotMainThreadFinished()
QEventLoop: Cannot be used without QApplication


So the questions are:
Am I on the right way or is there a better solution?
If I am on the right way, can I use the digikam libs outside of a QApplication? Will it work in a plasmoid?

Thanks,

Xavier

_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

Re: Accessing digikam database from external application

Marcel Wiesweg
> Hi all,
>
> Could someone give me some hints on how to access a digikam database from a
> new application, using libdigikamdatabase?

Disclaimer: libdigikamdatabase is in no way a public API and subject to change
at any time.

>
> Now, the problem occurs when I call the function "setParameters". I get the
> following output:
> QEventLoop: Cannot be used without QApplication
> QObject::connect: Cannot connect (null)::aboutToQuit() to
> Digikam::DatabaseCoreBackend::slotMainThreadFinished()
> QEventLoop: Cannot be used without QApplication
> So the questions are:
> Am I on the right way or is there a better solution?
> If I am on the right way, can I use the digikam libs outside of a
> QApplication?

The ioslaves do not have a QApplication, but they create a QCoreApplication
because the SQL drivers fail to load otherwise.


> Will it work in a plasmoid?

Noone tried... it works in a kioslave though.
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel