parent
416bbbace7
commit
ca1d9f2134
2 changed files with 9 additions and 1 deletions
|
|
@ -75,7 +75,12 @@ QString AppEntry::keywords() const {
|
|||
|
||||
AppDb::AppDb(QObject* parent)
|
||||
: QObject(parent)
|
||||
, m_timer(new QTimer(this))
|
||||
, m_uuid(QUuid::createUuid().toString()) {
|
||||
m_timer->setSingleShot(true);
|
||||
m_timer->setInterval(300);
|
||||
connect(m_timer, &QTimer::timeout, this, &AppDb::updateApps);
|
||||
|
||||
auto db = QSqlDatabase::addDatabase("QSQLITE", m_uuid);
|
||||
db.setDatabaseName(":memory:");
|
||||
db.open();
|
||||
|
|
@ -125,7 +130,7 @@ void AppDb::setEntries(const QList<QObject*>& entries) {
|
|||
m_entries = entries;
|
||||
emit entriesChanged();
|
||||
|
||||
updateApps();
|
||||
m_timer->start();
|
||||
}
|
||||
|
||||
QList<AppEntry*> AppDb::apps() const {
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
#include <qhash.h>
|
||||
#include <qobject.h>
|
||||
#include <qqmlintegration.h>
|
||||
#include <qtimer.h>
|
||||
|
||||
namespace caelestia {
|
||||
|
||||
|
|
@ -87,6 +88,8 @@ signals:
|
|||
void appsChanged();
|
||||
|
||||
private:
|
||||
QTimer* m_timer;
|
||||
|
||||
const QString m_uuid;
|
||||
QString m_path;
|
||||
QList<QObject*> m_entries;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue