86 lines
2.6 KiB
C++
86 lines
2.6 KiB
C++
#include "application-info.h"
|
|
#include "app-info-table.h"
|
|
#include "application-property-helper.h"
|
|
using namespace UkuiSearch;
|
|
namespace UkuiSearch {
|
|
class ApplicationInfoPrivate
|
|
{
|
|
};
|
|
}
|
|
ApplicationInfo::ApplicationInfo(QObject *parent)
|
|
: QObject(parent), d(new ApplicationInfoPrivate)
|
|
{
|
|
connect(AppInfoTable::self(), &AppInfoTable::appDBItems2BUpdate, this, &ApplicationInfo::appDBItems2BUpdate);
|
|
connect(AppInfoTable::self(), &AppInfoTable::appDBItems2BUpdateAll, this, &ApplicationInfo::appDBItems2BUpdateAll);
|
|
connect(AppInfoTable::self(), &AppInfoTable::appDBItems2BAdd, this, &ApplicationInfo::appDBItems2BAdd);
|
|
connect(AppInfoTable::self(), &AppInfoTable::appDBItems2BDelete, this, &ApplicationInfo::appDBItems2BDelete);
|
|
}
|
|
|
|
ApplicationInfo::~ApplicationInfo()
|
|
{
|
|
if(d) {
|
|
delete d;
|
|
d = nullptr;
|
|
}
|
|
}
|
|
|
|
QVariant UkuiSearch::ApplicationInfo::getInfo(const QString &desktopFile, ApplicationProperty::Property property)
|
|
{
|
|
PropertyMap map;
|
|
AppInfoTable::self()->query(map, desktopFile, Properties{property});
|
|
return map.value(property);
|
|
}
|
|
|
|
PropertyMap ApplicationInfo::getInfo(const QString &desktopFile, Properties properties)
|
|
{
|
|
PropertyMap propertyMap;
|
|
AppInfoTable::self()->query(propertyMap, desktopFile, properties);
|
|
return propertyMap;
|
|
}
|
|
|
|
ApplicationInfoMap ApplicationInfo::getInfo(Properties properties)
|
|
{
|
|
ApplicationInfoMap infoMap;
|
|
AppInfoTable::self()->query(infoMap, properties);
|
|
return infoMap;
|
|
}
|
|
|
|
ApplicationInfoMap ApplicationInfo::getInfo(Properties properties, PropertyMap restrictions)
|
|
{
|
|
ApplicationInfoMap infoMap;
|
|
AppInfoTable::self()->query(infoMap, properties, restrictions);
|
|
return infoMap;
|
|
}
|
|
|
|
ApplicationInfoMap ApplicationInfo::searchApp(Properties properties, QString &keyWord)
|
|
{
|
|
ApplicationInfoMap infoMap;
|
|
AppInfoTable::self()->query(infoMap, properties, keyWord);
|
|
return infoMap;
|
|
}
|
|
|
|
void ApplicationInfo::setAppFavoritesState(QString &desktopFilePath, size_t num)
|
|
{
|
|
AppInfoTable::self()->setAppFavoritesState(desktopFilePath, num);
|
|
}
|
|
|
|
void ApplicationInfo::setAppTopState(QString &desktopFilePath, size_t num)
|
|
{
|
|
AppInfoTable::self()->setAppTopState(desktopFilePath, num);
|
|
}
|
|
|
|
bool ApplicationInfo::changeFavoriteAppPos(const QString &desktopFilePath, size_t pos)
|
|
{
|
|
return AppInfoTable::self()->changeFavoriteAppPos(desktopFilePath, pos);
|
|
}
|
|
|
|
bool ApplicationInfo::changeTopAppPos(const QString &desktopFilePath, size_t pos)
|
|
{
|
|
return AppInfoTable::self()->changeTopAppPos(desktopFilePath, pos);
|
|
}
|
|
|
|
bool ApplicationInfo::tranPidToDesktopFp(int pid, QString &desktopFilePath)
|
|
{
|
|
return AppInfoTable::self()->tranPidToDesktopFp(pid, desktopFilePath);
|
|
}
|