fix(libsearch):解决编译问题
This commit is contained in:
parent
4d73bc7c4c
commit
aee23999ac
|
@ -22,79 +22,75 @@
|
||||||
#include <QDBusArgument>
|
#include <QDBusArgument>
|
||||||
#include "application-property.h"
|
#include "application-property.h"
|
||||||
|
|
||||||
namespace UkuiSearch {
|
using namespace UkuiSearch;
|
||||||
|
QDBusArgument &operator << (QDBusArgument &argument, const UkuiSearch::ApplicationProperty::Property &property) {
|
||||||
QDBusArgument &operator << (QDBusArgument &argument, const ApplicationProperty::Property &property) {
|
argument.beginStructure();
|
||||||
argument.beginStructure();
|
argument << static_cast<int>(property);
|
||||||
argument << static_cast<int>(property);
|
argument.endStructure();
|
||||||
argument.endStructure();
|
return argument;
|
||||||
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 ApplicationPropertyMap &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, ApplicationPropertyMap &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<ApplicationPropertyMap>());
|
|
||||||
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;
|
|
||||||
ApplicationPropertyMap value;
|
|
||||||
argument.beginMapEntry();
|
|
||||||
argument >> key >> value;
|
|
||||||
argument.endMapEntry();
|
|
||||||
appInfo.insert(key, value);
|
|
||||||
}
|
|
||||||
argument.endMap();
|
|
||||||
return argument;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const QDBusArgument &operator >> (const QDBusArgument &argument, UkuiSearch::ApplicationProperty::Property &property) {
|
||||||
|
int value;
|
||||||
|
argument.beginStructure();
|
||||||
|
argument >> value;
|
||||||
|
argument.endStructure();
|
||||||
|
property = static_cast<ApplicationProperty::Property>(value);
|
||||||
|
return argument;
|
||||||
|
}
|
||||||
|
|
||||||
|
QDBusArgument &operator << (QDBusArgument &argument, const ApplicationPropertyMap &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, ApplicationPropertyMap &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<ApplicationPropertyMap>());
|
||||||
|
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;
|
||||||
|
ApplicationPropertyMap value;
|
||||||
|
argument.beginMapEntry();
|
||||||
|
argument >> key >> value;
|
||||||
|
argument.endMapEntry();
|
||||||
|
appInfo.insert(key, value);
|
||||||
|
}
|
||||||
|
argument.endMap();
|
||||||
|
return argument;
|
||||||
|
}
|
||||||
#endif // APPINFODBUSARGUMENT_H
|
#endif // APPINFODBUSARGUMENT_H
|
||||||
|
|
|
@ -25,10 +25,11 @@ static AppInfoTable *global_intance = nullptr;
|
||||||
AppInfoTablePrivate::AppInfoTablePrivate(AppInfoTable *parent) : QObject(parent), q(parent), m_database(new QSqlDatabase())
|
AppInfoTablePrivate::AppInfoTablePrivate(AppInfoTable *parent) : QObject(parent), q(parent), m_database(new QSqlDatabase())
|
||||||
{
|
{
|
||||||
//dbus接收数据库信号
|
//dbus接收数据库信号
|
||||||
qRegisterMetaType<ApplicationPropertyMap>("ApplicationPropertyMap");
|
qRegisterMetaType<UkuiSearch::ApplicationProperty::Property>("ApplicationProperty::Property");
|
||||||
|
qRegisterMetaType<UkuiSearch::ApplicationInfoMap>("ApplicationInfoMap");
|
||||||
|
qRegisterMetaType<UkuiSearch::ApplicationPropertyMap>("ApplicationPropertyMap");
|
||||||
|
qDBusRegisterMetaType<UkuiSearch::ApplicationProperty::Property>();
|
||||||
qDBusRegisterMetaType<ApplicationPropertyMap>();
|
qDBusRegisterMetaType<ApplicationPropertyMap>();
|
||||||
|
|
||||||
qRegisterMetaType<ApplicationInfoMap>("ApplicationInfoMap");
|
|
||||||
qDBusRegisterMetaType<ApplicationInfoMap>();
|
qDBusRegisterMetaType<ApplicationInfoMap>();
|
||||||
|
|
||||||
m_signalTransInterface = new QDBusInterface("com.ukui.search.appdb.service",
|
m_signalTransInterface = new QDBusInterface("com.ukui.search.appdb.service",
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
#include <QMap>
|
#include <QMap>
|
||||||
#include <QVector>
|
#include <QVector>
|
||||||
#include <QVariant>
|
#include <QVariant>
|
||||||
|
#include <QDBusArgument>
|
||||||
namespace UkuiSearch {
|
namespace UkuiSearch {
|
||||||
|
|
||||||
namespace ApplicationProperty {
|
namespace ApplicationProperty {
|
||||||
|
@ -61,5 +62,7 @@ typedef QMap<ApplicationProperty::Property, QVariant> ApplicationPropertyMap;
|
||||||
typedef QMap<QString, ApplicationPropertyMap> ApplicationInfoMap; // desktopFile->ApplicationPropertyMap
|
typedef QMap<QString, ApplicationPropertyMap> ApplicationInfoMap; // desktopFile->ApplicationPropertyMap
|
||||||
}
|
}
|
||||||
Q_DECLARE_METATYPE(UkuiSearch::ApplicationProperty::Property)
|
Q_DECLARE_METATYPE(UkuiSearch::ApplicationProperty::Property)
|
||||||
|
Q_DECLARE_METATYPE(UkuiSearch::ApplicationPropertyMap)
|
||||||
Q_DECLARE_METATYPE(UkuiSearch::ApplicationInfoMap)
|
Q_DECLARE_METATYPE(UkuiSearch::ApplicationInfoMap)
|
||||||
|
Q_DECLARE_METATYPE(UkuiSearch::ApplicationProperties)
|
||||||
#endif // APPLICATIONPROPERTY_H
|
#endif // APPLICATIONPROPERTY_H
|
||||||
|
|
|
@ -35,6 +35,7 @@ namespace UkuiSearch {
|
||||||
|
|
||||||
class FileContentSearchTask : public SearchTaskPluginIface
|
class FileContentSearchTask : public SearchTaskPluginIface
|
||||||
{
|
{
|
||||||
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit FileContentSearchTask(QObject *parent = nullptr);
|
explicit FileContentSearchTask(QObject *parent = nullptr);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue