fix(notification-ukcc-plugin): 修改启动时导致设置卡顿的问题
This commit is contained in:
parent
58fd71fec7
commit
2c560d0a29
|
@ -26,8 +26,17 @@
|
|||
#include <QApplication>
|
||||
#include <QTranslator>
|
||||
#include <QtConcurrent/QtConcurrent>
|
||||
#include <mutex>
|
||||
|
||||
#define THEME_QT_SCHEMA "org.ukui.style"
|
||||
static std::once_flag flag;
|
||||
static UkuiSearch::ApplicationInfo *s_appInfo = nullptr;
|
||||
UkuiSearch::ApplicationInfo *appInfo() {
|
||||
std::call_once(flag, [ & ] {
|
||||
s_appInfo = new UkuiSearch::ApplicationInfo();
|
||||
});
|
||||
return s_appInfo;
|
||||
}
|
||||
|
||||
class ToolButton : public QToolButton
|
||||
{
|
||||
|
@ -59,9 +68,6 @@ Notice::Notice()
|
|||
if (!m_globalSettings) {
|
||||
m_globalSettings = new UkuiNotification::NotificationGlobalSettings();
|
||||
}
|
||||
if (!m_appInfo) {
|
||||
m_appInfo = new UkuiSearch::ApplicationInfo();
|
||||
}
|
||||
|
||||
m_pluginWidget = new QWidget;
|
||||
m_pluginWidget->setAttribute(Qt::WA_DeleteOnClose);
|
||||
|
@ -79,11 +85,6 @@ Notice::~Notice()
|
|||
delete m_globalSettings;
|
||||
m_globalSettings = nullptr;
|
||||
}
|
||||
if (m_appInfo) {
|
||||
delete m_appInfo;
|
||||
m_appInfo = nullptr;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
QString Notice::plugini18nName()
|
||||
|
@ -473,7 +474,7 @@ void Notice::initListUI()
|
|||
connect(this, &Notice::appDataInfo, this, &Notice::addItemUi, Qt::QueuedConnection);
|
||||
|
||||
QtConcurrent::run([=](){
|
||||
const UkuiSearch::ApplicationInfoMap& appInfoMap = m_appInfo->getInfo(properties, restrictions);
|
||||
const UkuiSearch::ApplicationInfoMap& appInfoMap = appInfo()->getInfo(properties, restrictions);
|
||||
Q_EMIT appDataInfo(appInfoMap);
|
||||
});
|
||||
|
||||
|
@ -487,7 +488,7 @@ void Notice::initListUI()
|
|||
};
|
||||
|
||||
QtConcurrent::run([=](){
|
||||
UkuiSearch::ApplicationPropertyMap dataMap = m_appInfo->getInfo(desktopEntry, properties);
|
||||
UkuiSearch::ApplicationPropertyMap dataMap = appInfo()->getInfo(desktopEntry, properties);
|
||||
UkuiSearch::ApplicationInfoMap appInfoMap = {{desktopEntry, dataMap}};
|
||||
Q_EMIT appDataInfo(appInfoMap);
|
||||
});
|
||||
|
|
|
@ -110,8 +110,6 @@ private:
|
|||
QVBoxLayout *m_appListVerticalLayout = nullptr;
|
||||
|
||||
UkuiNotification::NotificationGlobalSettings *m_globalSettings = nullptr;
|
||||
|
||||
UkuiSearch::ApplicationInfo *m_appInfo = nullptr;
|
||||
};
|
||||
|
||||
#endif // NOTIFICATION_UKCC_PLUGIN_H
|
||||
|
|
Loading…
Reference in New Issue