forked from openkylin/ukui-search
Add app infos in autostart dir.
Add DONT_DISPLAY field to database. Use ApplicationInfoMap instead of the previous structure to transform apps' data.
This commit is contained in:
parent
b1a8486bd1
commit
f9a638c05b
|
@ -1,30 +0,0 @@
|
||||||
#ifndef APPDBCOMMON_H
|
|
||||||
#define APPDBCOMMON_H
|
|
||||||
|
|
||||||
#include <QDir>
|
|
||||||
|
|
||||||
namespace UkuiSearch {
|
|
||||||
|
|
||||||
#define APP_DATABASE_PATH QDir::homePath()+"/.config/org.ukui/ukui-search/appdata/"
|
|
||||||
#define APP_DATABASE_NAME "app-info.db"
|
|
||||||
|
|
||||||
struct AppInfoResult
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
QString desktopPath;
|
|
||||||
QString iconName;
|
|
||||||
QString appLocalName;
|
|
||||||
QString firstLetter;
|
|
||||||
QString category;
|
|
||||||
int top;
|
|
||||||
int favorite;
|
|
||||||
int launchTimes;
|
|
||||||
int lock;
|
|
||||||
|
|
||||||
AppInfoResult() : top(0), favorite(0), launchTimes(0), lock(0) {}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
Q_DECLARE_METATYPE(UkuiSearch::AppInfoResult)
|
|
||||||
|
|
||||||
#endif // APPDBCOMMON_H
|
|
|
@ -1,31 +0,0 @@
|
||||||
#ifndef APPINFODBUSARGUMENT_H
|
|
||||||
#define APPINFODBUSARGUMENT_H
|
|
||||||
|
|
||||||
#include <QDBusArgument>
|
|
||||||
#include "app-db-common.h"
|
|
||||||
|
|
||||||
namespace UkuiSearch {
|
|
||||||
|
|
||||||
QDBusArgument &operator << (QDBusArgument &argument, const AppInfoResult &infoResult)
|
|
||||||
{
|
|
||||||
argument.beginStructure();
|
|
||||||
argument << infoResult.desktopPath << infoResult.iconName << infoResult.appLocalName << infoResult.firstLetter
|
|
||||||
<< infoResult.category << infoResult.top << infoResult.favorite << infoResult.launchTimes << infoResult.lock;
|
|
||||||
argument.endStructure();
|
|
||||||
return argument;
|
|
||||||
}
|
|
||||||
|
|
||||||
const QDBusArgument &operator >> (const QDBusArgument &argument, AppInfoResult &infoResult)
|
|
||||||
{
|
|
||||||
argument.beginStructure();
|
|
||||||
argument >> infoResult.desktopPath >> infoResult.iconName >> infoResult.appLocalName >> infoResult.firstLetter
|
|
||||||
>> infoResult.category >> infoResult.top >> infoResult.favorite >> infoResult.launchTimes >> infoResult.lock;
|
|
||||||
|
|
||||||
argument.endStructure();
|
|
||||||
return argument;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#endif // APPINFODBUSARGUMENT_H
|
|
|
@ -0,0 +1,82 @@
|
||||||
|
#ifndef APPINFODBUSARGUMENT_H
|
||||||
|
#define APPINFODBUSARGUMENT_H
|
||||||
|
|
||||||
|
#include <QDBusArgument>
|
||||||
|
#include "application-property.h"
|
||||||
|
|
||||||
|
namespace UkuiSearch {
|
||||||
|
|
||||||
|
QDBusArgument &operator << (QDBusArgument &argument, const ApplicationProperty::Property &property) {
|
||||||
|
argument.beginStructure();
|
||||||
|
argument << static_cast<int>(property);
|
||||||
|
argument.endStructure();
|
||||||
|
return argument;
|
||||||
|
}
|
||||||
|
|
||||||
|
const QDBusArgument &operator >> (const QDBusArgument &argument, ApplicationProperty::Property &property) {
|
||||||
|
int value;
|
||||||
|
argument.beginStructure();
|
||||||
|
argument >> value;
|
||||||
|
argument.endStructure();
|
||||||
|
property = static_cast<ApplicationProperty::Property>(value);
|
||||||
|
return argument;
|
||||||
|
}
|
||||||
|
|
||||||
|
QDBusArgument &operator << (QDBusArgument &argument, const PropertyMap &appPropertyInfo)
|
||||||
|
{
|
||||||
|
argument.beginMap(/*qMetaTypeId<ApplicationProperty::Property>()*/QVariant::Int, qMetaTypeId<QDBusVariant>());
|
||||||
|
for (auto i = appPropertyInfo.constBegin(); i != appPropertyInfo.constEnd(); ++i) {
|
||||||
|
QDBusVariant dbusVariant(i.value());
|
||||||
|
argument.beginMapEntry();
|
||||||
|
argument << static_cast<int>(i.key()) << dbusVariant;
|
||||||
|
argument.endMapEntry();
|
||||||
|
}
|
||||||
|
argument.endMap();
|
||||||
|
return argument;
|
||||||
|
}
|
||||||
|
|
||||||
|
const QDBusArgument &operator >> (const QDBusArgument &argument, PropertyMap &appPropertyInfo)
|
||||||
|
{
|
||||||
|
argument.beginMap();
|
||||||
|
while (!argument.atEnd()) {
|
||||||
|
int key;
|
||||||
|
QVariant value;
|
||||||
|
argument.beginMapEntry();
|
||||||
|
argument >> key >> value;
|
||||||
|
argument.endMapEntry();
|
||||||
|
appPropertyInfo.insert(static_cast<ApplicationProperty::Property>(key), value);
|
||||||
|
}
|
||||||
|
argument.endMap();
|
||||||
|
return argument;
|
||||||
|
}
|
||||||
|
|
||||||
|
QDBusArgument &operator << (QDBusArgument &argument, const ApplicationInfoMap &appInfo)
|
||||||
|
{
|
||||||
|
argument.beginMap(QVariant::String, qMetaTypeId<PropertyMap>());
|
||||||
|
for (auto i = appInfo.constBegin(); i != appInfo.constEnd(); ++i) {
|
||||||
|
argument.beginMapEntry();
|
||||||
|
argument << i.key() << i.value();
|
||||||
|
argument.endMapEntry();
|
||||||
|
}
|
||||||
|
argument.endMap();
|
||||||
|
return argument;
|
||||||
|
}
|
||||||
|
|
||||||
|
const QDBusArgument &operator >> (const QDBusArgument &argument, ApplicationInfoMap &appInfo)
|
||||||
|
{
|
||||||
|
argument.beginMap();
|
||||||
|
while (!argument.atEnd()) {
|
||||||
|
QString key;
|
||||||
|
PropertyMap value;
|
||||||
|
argument.beginMapEntry();
|
||||||
|
argument >> key >> value;
|
||||||
|
argument.endMapEntry();
|
||||||
|
appInfo.insert(key, value);
|
||||||
|
}
|
||||||
|
argument.endMap();
|
||||||
|
return argument;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#endif // APPINFODBUSARGUMENT_H
|
|
@ -6,7 +6,8 @@ HEADERS += \
|
||||||
# $$PWD/application-info-storage.h \
|
# $$PWD/application-info-storage.h \
|
||||||
$$PWD/application-info.h \
|
$$PWD/application-info.h \
|
||||||
$$PWD/application-property-helper.h \
|
$$PWD/application-property-helper.h \
|
||||||
$$PWD/application-property.h
|
$$PWD/application-property.h \
|
||||||
|
$$PWD/app-info-dbus-argument.h
|
||||||
|
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
$$PWD/app-info-table.cpp \
|
$$PWD/app-info-table.cpp \
|
||||||
|
|
|
@ -4,7 +4,9 @@
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QMap>
|
#include <QMap>
|
||||||
#include <QVector>
|
#include <QVector>
|
||||||
|
#include <QVariant>
|
||||||
namespace UkuiSearch {
|
namespace UkuiSearch {
|
||||||
|
|
||||||
namespace ApplicationProperty {
|
namespace ApplicationProperty {
|
||||||
/**
|
/**
|
||||||
* @brief 表示应用基础信息
|
* @brief 表示应用基础信息
|
||||||
|
@ -39,5 +41,4 @@ typedef QMap<ApplicationProperty::Property, QVariant> PropertyMap;
|
||||||
typedef QMap<QString, PropertyMap> ApplicationInfoMap; // desktopFile->PropertyMap
|
typedef QMap<QString, PropertyMap> ApplicationInfoMap; // desktopFile->PropertyMap
|
||||||
}
|
}
|
||||||
Q_DECLARE_METATYPE(UkuiSearch::ApplicationProperty::Property)
|
Q_DECLARE_METATYPE(UkuiSearch::ApplicationProperty::Property)
|
||||||
|
|
||||||
#endif // APPLICATIONPROPERTY_H
|
#endif // APPLICATIONPROPERTY_H
|
||||||
|
|
|
@ -53,8 +53,6 @@ SOURCES += \
|
||||||
libsearch.cpp
|
libsearch.cpp
|
||||||
|
|
||||||
HEADERS += \
|
HEADERS += \
|
||||||
app-db-common.h \
|
|
||||||
app-info-dbus-argument.h \
|
|
||||||
common.h \
|
common.h \
|
||||||
file-utils.h \
|
file-utils.h \
|
||||||
global-settings.h \
|
global-settings.h \
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -11,12 +11,14 @@
|
||||||
#include <QMutex>
|
#include <QMutex>
|
||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
#include <QThread>
|
#include <QThread>
|
||||||
#include "app-db-common.h"
|
|
||||||
#include "pending-app-info-queue.h"
|
#include "pending-app-info-queue.h"
|
||||||
#include "file-system-watcher.h"
|
#include "file-system-watcher.h"
|
||||||
|
#include "application-property.h"
|
||||||
|
|
||||||
|
#define APP_DATABASE_PATH QDir::homePath()+"/.config/org.ukui/ukui-search/appdata/"
|
||||||
|
#define APP_DATABASE_NAME "app-info.db"
|
||||||
#define CONNECTION_NAME QLatin1String("ukss-appdb-connection")
|
#define CONNECTION_NAME QLatin1String("ukss-appdb-connection")
|
||||||
static const QString APP_DATABASE_VERSION = QStringLiteral("1.0");
|
static const QString APP_DATABASE_VERSION = QStringLiteral("1.1");
|
||||||
|
|
||||||
namespace UkuiSearch {
|
namespace UkuiSearch {
|
||||||
/**
|
/**
|
||||||
|
@ -24,18 +26,6 @@ namespace UkuiSearch {
|
||||||
* 功能:1.遍历并且监听desktop文件目录,建立并且维护应用信息数据库。
|
* 功能:1.遍历并且监听desktop文件目录,建立并且维护应用信息数据库。
|
||||||
* 2.监听应用安装,打开事件,收藏等事件,更新数据库
|
* 2.监听应用安装,打开事件,收藏等事件,更新数据库
|
||||||
*/
|
*/
|
||||||
class NameString {
|
|
||||||
public:
|
|
||||||
explicit NameString(const QString &str_) : app_name(str_) {}
|
|
||||||
NameString() = default;
|
|
||||||
QString app_name;
|
|
||||||
bool operator<(const NameString& name) const {
|
|
||||||
return this->app_name.length() <= name.app_name.length();
|
|
||||||
}
|
|
||||||
bool operator==(const NameString& name) const {
|
|
||||||
return this->app_name == name.app_name;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
class AppDBManager : public QThread
|
class AppDBManager : public QThread
|
||||||
{
|
{
|
||||||
|
@ -52,7 +42,7 @@ public:
|
||||||
static AppDBManager *getInstance();
|
static AppDBManager *getInstance();
|
||||||
|
|
||||||
//刷新数据库数据
|
//刷新数据库数据
|
||||||
void refreshAllData2DB();
|
void refreshAllData2DB(const QStringList &appPaths);
|
||||||
|
|
||||||
//获取desktop文件的md5值
|
//获取desktop文件的md5值
|
||||||
QString getAppDesktopMd5(const QString &desktopfd);
|
QString getAppDesktopMd5(const QString &desktopfd);
|
||||||
|
@ -60,16 +50,15 @@ public:
|
||||||
bool startTransaction();
|
bool startTransaction();
|
||||||
bool startCommit();
|
bool startCommit();
|
||||||
|
|
||||||
bool handleDBItemInsert(const QString &desktopfd);
|
bool handleDBItemInsert(const QString &desktopFilePath);
|
||||||
bool handleDBItemUpdate(const QString &desktopfp);
|
bool handleDBItemUpdate(const QString &desktopFilePath);
|
||||||
bool handleDBItemDelete(const QString &desktopfd);
|
bool handleDBItemDelete(const QString &desktopFilePath);
|
||||||
|
|
||||||
bool handleLocaleDataUpdate(const QString &desktopfp);
|
bool handleLocaleDataUpdate(const QString &desktopFilePath);
|
||||||
bool handleLaunchTimesUpdate(const QString &desktopfp, int num);
|
bool handleLaunchTimesUpdate(const QString &desktopFilePath, int num);
|
||||||
bool handleFavoritesStateUpdate(const QString &desktopfp, int num, bool isOrderChanged = false);
|
bool handleFavoritesStateUpdate(const QString &desktopFilePath, int num, bool isOrderChanged = false);
|
||||||
bool handleTopStateUpdate(const QString &desktopfp, int num, bool isOrderChanged = false);
|
bool handleTopStateUpdate(const QString &desktopFilePath, int num, bool isOrderChanged = false);
|
||||||
bool handleLockStateUpdate(const QString &desktopfp, int num);
|
bool handleLockStateUpdate(const QString &desktopFilePath, int num);
|
||||||
bool createAppInfoResult(const QString &desktopfp, AppInfoResult &result);
|
|
||||||
|
|
||||||
public Q_SLOTS:
|
public Q_SLOTS:
|
||||||
//通过pid查找对应的desktop文件
|
//通过pid查找对应的desktop文件
|
||||||
|
@ -81,25 +70,15 @@ public Q_SLOTS:
|
||||||
void deleteDBItem(const QString &desktopfd);
|
void deleteDBItem(const QString &desktopfd);
|
||||||
|
|
||||||
//对数据库某字段进行update
|
//对数据库某字段进行update
|
||||||
void updateLocaleData(const QString &desktopfp);
|
void updateLocaleData(const QString &desktopFilePath);
|
||||||
void updateLaunchTimes(const QString &desktopfp);
|
void updateLaunchTimes(const QString &desktopFilePath);
|
||||||
void updateFavoritesState(const QString &desktopfp, int num, bool isOrderChanged = false);
|
void updateFavoritesState(const QString &desktopFilePath, int num, bool isOrderChanged = false);
|
||||||
void updateTopState(const QString &desktopfp, int num, bool isOrderChanged = false);
|
void updateTopState(const QString &desktopFilePath, int num, bool isOrderChanged = false);
|
||||||
void udpateLockState(const QString &desktopfp, int num);
|
void udpateLockState(const QString &desktopFilePath, int num);
|
||||||
|
|
||||||
//拖动改变置顶和收藏应用位置
|
//拖动改变置顶和收藏应用位置
|
||||||
bool changeFavoriteAppPos(const QString &desktopfp, int pos);
|
bool changeFavoriteAppPos(const QString &desktopFilePath, int pos);
|
||||||
bool changeTopAppPos(const QString &desktopfp, int pos);
|
bool changeTopAppPos(const QString &desktopFilePath, int pos);
|
||||||
|
|
||||||
//获取数据库中全部信息
|
|
||||||
QVector<AppInfoResult> getAppInfoResults();
|
|
||||||
|
|
||||||
//查询某应用的某个字段的值
|
|
||||||
int getAppLockState(const QString &desktopfp);
|
|
||||||
int getAppTopState(const QString &desktopfp);
|
|
||||||
int getAppLaunchedState(const QString &desktopfp);
|
|
||||||
int getAppFavoriteState(const QString &desktopfp);
|
|
||||||
QString getAppCategory(const QString &desktopfp);
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void run() override;
|
void run() override;
|
||||||
|
@ -114,7 +93,6 @@ private:
|
||||||
//数据库查找指定字段不存在则添加到最后并设置初始值
|
//数据库查找指定字段不存在则添加到最后并设置初始值
|
||||||
bool addItem2BackIfNotExist(QString itemName, QString itemDataType, QVariant defult = QVariant());
|
bool addItem2BackIfNotExist(QString itemName, QString itemDataType, QVariant defult = QVariant());
|
||||||
|
|
||||||
|
|
||||||
//链接数据库
|
//链接数据库
|
||||||
bool openDataBase();
|
bool openDataBase();
|
||||||
//刷新数据库
|
//刷新数据库
|
||||||
|
@ -125,12 +103,6 @@ private:
|
||||||
//创建数据库字段
|
//创建数据库字段
|
||||||
void buildAppInfoDB();
|
void buildAppInfoDB();
|
||||||
|
|
||||||
//暂时弃用
|
|
||||||
void updateAppInfoDB();
|
|
||||||
void getAllDesktopFilePath(QString path);
|
|
||||||
void getFilePathList(QStringList &pathList);
|
|
||||||
void getInstallAppMap(QMap<QString, QStringList> &installAppMap);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static QMutex s_mutex;
|
static QMutex s_mutex;
|
||||||
bool m_localeChanged;
|
bool m_localeChanged;
|
||||||
|
@ -150,6 +122,31 @@ private:
|
||||||
QString m_snapdPath;
|
QString m_snapdPath;
|
||||||
FileSystemWatcher *m_snapdWatcher = nullptr;
|
FileSystemWatcher *m_snapdWatcher = nullptr;
|
||||||
|
|
||||||
|
//数据库当前所有字段
|
||||||
|
QMap<QString, QString> m_namesOfAppinfoTable = {
|
||||||
|
{"DESKTOP_FILE_PATH", "TEXT"},
|
||||||
|
{"MODIFYED_TIME", "TEXT"},
|
||||||
|
{"INSERT_TIME","TEXT"},
|
||||||
|
{"LOCAL_NAME", "TEXT"},
|
||||||
|
{"NAME_EN", "TEXT"},
|
||||||
|
{"NAME_ZH", "TEXT"},
|
||||||
|
{"PINYIN_NAME", "TEXT"},
|
||||||
|
{"FIRST_LETTER_OF_PINYIN", "TEXT"},
|
||||||
|
{"FIRST_LETTER_ALL", "TEXT"},
|
||||||
|
{"ICON", "TEXT"},
|
||||||
|
{"TYPE", "TEXT"},
|
||||||
|
{"CATEGORY", "TEXT"},
|
||||||
|
{"EXEC", "TEXT"},
|
||||||
|
{"COMMENT", "TEXT"},
|
||||||
|
{"MD5", "TEXT"},
|
||||||
|
{"LAUNCH_TIMES", "INT"},
|
||||||
|
{"FAVORITES", "INT"},
|
||||||
|
{"LAUNCHED", "INT"},
|
||||||
|
{"TOP", "INT"},
|
||||||
|
{"LOCK", "INT"},
|
||||||
|
{"DONT_DISPLAY", "INT"}
|
||||||
|
};
|
||||||
|
|
||||||
//应用黑名单
|
//应用黑名单
|
||||||
QStringList m_excludedDesktopfiles = {
|
QStringList m_excludedDesktopfiles = {
|
||||||
"/usr/share/applications/software-properties-livepatch.desktop",
|
"/usr/share/applications/software-properties-livepatch.desktop",
|
||||||
|
@ -199,13 +196,11 @@ private:
|
||||||
"/usr/share/applications/screensavers"
|
"/usr/share/applications/screensavers"
|
||||||
};
|
};
|
||||||
|
|
||||||
//暂时弃用
|
|
||||||
QMap<NameString, QStringList> m_installAppMap;
|
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
//操作数据库
|
//操作数据库
|
||||||
void appDBItemUpdate(const AppInfoResult&);
|
void appDBItemUpdate(const ApplicationInfoMap&);
|
||||||
void appDBItemAdd(const AppInfoResult&);
|
void appDBItemUpdateAll(const QString&);
|
||||||
|
void appDBItemAdd(const QString&);
|
||||||
void appDBItemDelete(const QString&);
|
void appDBItemDelete(const QString&);
|
||||||
void finishHandleAppDB();
|
void finishHandleAppDB();
|
||||||
|
|
||||||
|
|
|
@ -8,22 +8,33 @@ SignalTransformer *SignalTransformer::getTransformer()
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SignalTransformer::handleItemInsert(const AppInfoResult &item)
|
void SignalTransformer::handleItemInsert(const QString &desktopFilePath)
|
||||||
{
|
{
|
||||||
QMutexLocker locker(&s_mutex);
|
QMutexLocker locker(&s_mutex);
|
||||||
m_items2BInsert.append(item);
|
m_items2BInsert.append(desktopFilePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SignalTransformer::handleItemUpdate(const AppInfoResult &item)
|
void SignalTransformer::handleItemUpdate(const ApplicationInfoMap &item)
|
||||||
{
|
{
|
||||||
QMutexLocker locker(&s_mutex);
|
QMutexLocker locker(&s_mutex);
|
||||||
m_items2BUpdate.append(item);
|
for(auto it = item.constBegin(); it != item.constEnd(); it++) {
|
||||||
|
PropertyMap propertyinfo = it.value();
|
||||||
|
for (auto i = propertyinfo.constBegin(); i != propertyinfo.constEnd(); i++) {
|
||||||
|
m_items2BUpdate[it.key()].insert(i.key(), i.value());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SignalTransformer::handleItemDelete(const QString &desktopfp)
|
void SignalTransformer::handleItemUpdateAll(const QString &desktopFilePath)
|
||||||
{
|
{
|
||||||
QMutexLocker locker(&s_mutex);
|
QMutexLocker locker(&s_mutex);
|
||||||
m_items2BDelete.append(desktopfp);
|
m_items2BUpdateAll.append(desktopFilePath);
|
||||||
|
}
|
||||||
|
|
||||||
|
void SignalTransformer::handleItemDelete(const QString &desktopFilePath)
|
||||||
|
{
|
||||||
|
QMutexLocker locker(&s_mutex);
|
||||||
|
m_items2BDelete.append(desktopFilePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SignalTransformer::handleSignalTransform()
|
void SignalTransformer::handleSignalTransform()
|
||||||
|
@ -39,6 +50,11 @@ void SignalTransformer::handleSignalTransform()
|
||||||
m_items2BUpdate.clear();
|
m_items2BUpdate.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!m_items2BUpdateAll.isEmpty()) {
|
||||||
|
Q_EMIT this->appDBItemsUpdateAll(m_items2BUpdateAll);
|
||||||
|
m_items2BUpdateAll.clear();
|
||||||
|
}
|
||||||
|
|
||||||
if (!m_items2BDelete.isEmpty()) {
|
if (!m_items2BDelete.isEmpty()) {
|
||||||
Q_EMIT this->appDBItemsDelete(m_items2BDelete);
|
Q_EMIT this->appDBItemsDelete(m_items2BDelete);
|
||||||
m_items2BDelete.clear();
|
m_items2BDelete.clear();
|
||||||
|
@ -50,6 +66,7 @@ SignalTransformer::SignalTransformer(QObject *parent) : QObject(parent)
|
||||||
connect(AppDBManager::getInstance(), &AppDBManager::appDBItemAdd, this, &SignalTransformer::handleItemInsert);
|
connect(AppDBManager::getInstance(), &AppDBManager::appDBItemAdd, this, &SignalTransformer::handleItemInsert);
|
||||||
connect(AppDBManager::getInstance(), &AppDBManager::appDBItemUpdate, this, &SignalTransformer::handleItemUpdate);
|
connect(AppDBManager::getInstance(), &AppDBManager::appDBItemUpdate, this, &SignalTransformer::handleItemUpdate);
|
||||||
connect(AppDBManager::getInstance(), &AppDBManager::appDBItemDelete, this, &SignalTransformer::handleItemDelete);
|
connect(AppDBManager::getInstance(), &AppDBManager::appDBItemDelete, this, &SignalTransformer::handleItemDelete);
|
||||||
|
connect(AppDBManager::getInstance(), &AppDBManager::appDBItemUpdateAll, this, &SignalTransformer::handleItemUpdateAll);
|
||||||
connect(AppDBManager::getInstance(), &AppDBManager::finishHandleAppDB, this, &SignalTransformer::handleSignalTransform);
|
connect(AppDBManager::getInstance(), &AppDBManager::finishHandleAppDB, this, &SignalTransformer::handleSignalTransform);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,9 +20,10 @@ public:
|
||||||
static QMutex s_mutex;
|
static QMutex s_mutex;
|
||||||
|
|
||||||
public Q_SLOTS:
|
public Q_SLOTS:
|
||||||
void handleItemInsert(const AppInfoResult &item);
|
void handleItemUpdate(const ApplicationInfoMap &item);
|
||||||
void handleItemUpdate(const AppInfoResult &item);
|
void handleItemUpdateAll(const QString &desktopFilePath);
|
||||||
void handleItemDelete(const QString &desktopfp);
|
void handleItemInsert(const QString &desktopFilePath);
|
||||||
|
void handleItemDelete(const QString &desktopFilePath);
|
||||||
void handleSignalTransform();
|
void handleSignalTransform();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -30,14 +31,16 @@ private:
|
||||||
SignalTransformer(const SignalTransformer &) = delete;
|
SignalTransformer(const SignalTransformer &) = delete;
|
||||||
SignalTransformer& operator = (const SignalTransformer&) = delete;
|
SignalTransformer& operator = (const SignalTransformer&) = delete;
|
||||||
|
|
||||||
QVector<AppInfoResult> m_items2BUpdate;
|
ApplicationInfoMap m_items2BUpdate;
|
||||||
QVector<AppInfoResult> m_items2BInsert;
|
QStringList m_items2BUpdateAll;
|
||||||
|
QStringList m_items2BInsert;
|
||||||
QStringList m_items2BDelete;
|
QStringList m_items2BDelete;
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void appDBItemsUpdate(QVector<AppInfoResult>);
|
void appDBItemsUpdateAll(const QStringList&);
|
||||||
void appDBItemsAdd(QVector<AppInfoResult>);
|
void appDBItemsUpdate(const ApplicationInfoMap&);
|
||||||
void appDBItemsDelete(QStringList);
|
void appDBItemsAdd(const QStringList&);
|
||||||
|
void appDBItemsDelete(const QStringList&);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // SIGNALTRANSFORMER_H
|
#endif // SIGNALTRANSFORMER_H
|
||||||
|
|
|
@ -20,11 +20,11 @@ UkuiSearchAppDataService::UkuiSearchAppDataService(int &argc, char *argv[], cons
|
||||||
if (!this->isRunning()) {
|
if (!this->isRunning()) {
|
||||||
qDebug() << "First running, I'm in app-db manager dbus rigister.";
|
qDebug() << "First running, I'm in app-db manager dbus rigister.";
|
||||||
|
|
||||||
qRegisterMetaType<AppInfoResult>("AppInfoResult");
|
qRegisterMetaType<PropertyMap>("PropertyMap");
|
||||||
qRegisterMetaType<QVector<AppInfoResult>>("QVector<AppInfoResult>");
|
qDBusRegisterMetaType<PropertyMap>();
|
||||||
|
|
||||||
qDBusRegisterMetaType<AppInfoResult>();
|
qRegisterMetaType<ApplicationInfoMap>("ApplicationInfoMap");
|
||||||
qDBusRegisterMetaType<QVector<AppInfoResult>>();
|
qDBusRegisterMetaType<ApplicationInfoMap>();
|
||||||
|
|
||||||
AppDBManager::getInstance();
|
AppDBManager::getInstance();
|
||||||
|
|
||||||
|
|
|
@ -59,5 +59,6 @@ DEPENDPATH += $$PWD/../libchinese-segmentation
|
||||||
|
|
||||||
LIBS += -L$$OUT_PWD/../libsearch/ -lukui-search
|
LIBS += -L$$OUT_PWD/../libsearch/ -lukui-search
|
||||||
INCLUDEPATH += $$PWD/../libsearch \
|
INCLUDEPATH += $$PWD/../libsearch \
|
||||||
$$PWD/../libsearch/filesystemwatcher
|
$$PWD/../libsearch/filesystemwatcher \
|
||||||
|
$$PWD/../libsearch/appdata
|
||||||
DEPENDPATH += $$PWD/../libsearch
|
DEPENDPATH += $$PWD/../libsearch
|
||||||
|
|
Loading…
Reference in New Issue