ukui-search/libsearch/appdata/application-info.h

196 lines
7.2 KiB
C
Raw Normal View History

2023-04-11 10:19:35 +08:00
/*
*
* Copyright (C) 2023, KylinSoft Co., Ltd.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* Authors: iaom <zhangpengfei@kylinos.cn>
*/
#ifndef APPLICATIONINFO_H
#define APPLICATIONINFO_H
#include <QObject>
#include "application-property.h"
namespace UkuiSearch {
class ApplicationInfoPrivate;
class ApplicationInfo : public QObject
{
Q_OBJECT
public:
explicit ApplicationInfo(QObject *parent = nullptr);
~ApplicationInfo();
/**
* @brief ApplicationInfo::getInfo
* @param desktopFile: desktop文件路径
* @param property:
* @return
*/
QVariant getInfo(const QString &desktopFile, ApplicationProperty::Property property);
/**
* @brief ApplicationInfo::getInfo
* @param desktopFile: desktop文件路径
* @param properties:
* @return
*/
ApplicationPropertyMap getInfo(const QString &desktopFile, ApplicationProperties properties);
/**
* @brief ApplicationInfo::getInfo
* @param properties:
* @return
*/
ApplicationInfoMap getInfo(ApplicationProperties properties);
/**
* @brief ApplicationInfo::getInfo
2024-08-19 10:57:18 +08:00
* restrictions的指定应用属性
* @param restrictions:
* @param properties:
* @return ApplicationInfoMap:
*/
ApplicationInfoMap getInfo(ApplicationProperties properties, ApplicationPropertyMap restrictions);
/**
* @brief ApplicationInfo::searchApp
2024-08-19 10:57:18 +08:00
*
* @param properties:
* @param keyword:
* @param restrictions:
* @return ApplicationInfoMap:
*/
ApplicationInfoMap searchApp(ApplicationProperties properties, const QString &keyword, ApplicationPropertyMap restrictions);
ApplicationInfoMap searchApp(ApplicationProperties properties, const QStringList &keywords, ApplicationPropertyMap restrictions);
/**
* @brief AppInfoTable::setAppToFavorites
2024-08-19 10:57:18 +08:00
*
* @param desktopFilePath: desktop文件路径
*/
void setAppToFavorites(const QString &desktopFilePath);
/**
* @brief AppInfoTable::removeAppFromFavorites
2024-08-19 10:57:18 +08:00
*
* @param desktopFilePath: desktop文件路径
*/
void removeAppFromFavorites(const QString &desktopFilePath);
/**
* this function has been deprecated, use setAppToFavorites and removeAppFromFavorites instead
2024-08-19 10:57:18 +08:00
* @brief ApplicationInfo::setFavoritesTo
* set the favorites state of the app to num, you can also use to change the position of the app which is one of the Favorites Apps
* @param desktopFilePath: the desktop file path of app
* @param num: the favorites app's position(from 1). If num is 0, it will remove the app from the favorites apps
*/
[[deprecated]] void setFavoritesOfApp(const QString &desktopFilePath, size_t num);
/**
2024-08-19 10:57:18 +08:00
* @brief ApplicationInfo::setAppToTop
* set the app to top apps(default is at 1)
* @param desktopFilePath: desktop file path of app
*/
[[deprecated]] void setAppToTop(const QString &desktopFilePath);
/**
2024-08-19 10:57:18 +08:00
* @brief ApplicationInfo::setAppTopTo
* set the top state of the app to num, you can also use to change the position of the app which is one of the Top Apps
* @param desktopFilePath: the desktop file path of app
* @param num: the top app's position(from 1). If num is 0, it will remove the app from the top apps
*/
[[deprecated]] void setTopOfApp(const QString &desktopFilePath, size_t num);
2024-08-19 10:57:18 +08:00
/**
* @brief ApplicationInfo::setAppLaunchedState
* ()
* @param desktopFilePath
* @param launched
*/
void setAppLaunchedState(const QString &desktopFilePath, bool launched = true);
/**
* @brief ApplicationInfo::tranPid2DesktopFp
2024-08-19 10:57:18 +08:00
* desktop文件[obsolete]
* @param pid:
* @param desktopFilePath:desktop文件
* @return bool:true;false
*/
[[deprecated]] bool tranPidToDesktopFp(int pid, QString &desktopFilePath);//obsolete
2024-08-19 10:57:18 +08:00
/**
* @brief ApplicationInfo::tranPid2DesktopFp
* desktop文件
* @param pid:
* @param desktopFilePath:desktop文件
* @return bool:true;false
*/
bool tranPidToDesktopFp(uint pid, QString &desktopFilePath);
/**
* @brief ApplicationInfo::desktopFilePathFromName
2024-08-19 10:57:18 +08:00
* desktop文件名 ( .desktop后缀)desktop文件的全路径
* @param desktopFileName: desktop文件名
* @param desktopFilePath: desktop文件全路径
* @return bool:true;false
*/
bool desktopFilePathFromName(const QString &desktopFileName, QString &desktopFilePath);
/**
* @brief ApplicationInfo::tranWinIdToDesktopFilePath
2024-08-19 10:57:18 +08:00
* id找到对应的desktop文件,x环境可用
* @param winId:ID(Only for X)
* @param desktopFilePath:desktop文件全路径
* @return bool:true;false
*/
bool tranWinIdToDesktopFilePath(const QVariant &winId, QString &desktopFilePath);
Q_SIGNALS:
2024-08-19 10:57:18 +08:00
/**
* ,
*/
void DBOpenFailed();
2024-08-19 10:57:18 +08:00
/**
* @brief ApplicationInfo::appDBItems2BUpdate
*
* @param ApplicationInfoMap:
*/
void appDBItems2BUpdate(ApplicationInfoMap);
2024-08-19 10:57:18 +08:00
/**
* @brief ApplicationInfo::appDBItems2BUpdate
*
* @param QStringList: (desktop文件全路径)
*/
void appDBItems2BUpdateAll(QStringList);
2024-08-19 10:57:18 +08:00
/**
* @brief ApplicationInfo::appDBItems2BAdd
*
* @param QStringList: (desktop文件全路径)
*/
void appDBItems2BAdd(QStringList);
2024-08-19 10:57:18 +08:00
/**
* @brief ApplicationInfo::appDBItems2BDelete
*
* @param QStringList: (desktop文件全路径)
*/
void appDBItems2BDelete(QStringList);
private:
ApplicationInfoPrivate *d = nullptr;
};
}
#endif // APPLICATIONINFO_H