Merge tag 'refs/tags/upstream/4.10.2.1' into packaging/openkylin/nile

4.10.2.1-release
This commit is contained in:
hewenfei 2024-05-25 16:19:44 +08:00
commit 51eaf6c709
10 changed files with 61 additions and 20 deletions

View File

@ -18,6 +18,7 @@ kylin-user-guide.desktop=0
ukui-control-center.desktop=0
peony.desktop=0
engrampa.desktop=0
kylin-aiassistant=0
[Default Favorite Apps]
0=/usr/share/applications/peony.desktop

View File

@ -69,13 +69,14 @@ MouseArea {
}
}
Rectangle {
UkuiItems.StyleBackground {
id: tagPoint
visible: tagLabel.sourceComponent != null ? false : isRecentInstalled
anchors.centerIn: parent
width: 8; height: width
radius: width / 2
color: Platform.Theme.highlight()
useStyleTransparency: false
paletteRole: Platform.Theme.Highlight
}
}
}

View File

@ -29,6 +29,7 @@ MouseArea {
property alias icon: appIcon
property alias text: appName
property alias background: styleBackground
property bool isRecentInstalled: false
hoverEnabled: true
@ -53,15 +54,34 @@ MouseArea {
Layout.alignment: Qt.AlignHCenter
}
UkuiItems.StyleText {
id: appName
RowLayout {
Layout.fillWidth: true
Layout.preferredHeight: contentHeight
Layout.maximumHeight: contentHeight
Layout.preferredHeight: appName.contentHeight
Layout.maximumHeight: appName.contentHeight
Layout.alignment: Qt.AlignHCenter
elide: Text.ElideRight
paletteRole: Platform.Theme.Text
horizontalAlignment: Text.AlignHCenter
UkuiItems.StyleBackground {
id: tagPoint
property int tagSize: isRecentInstalled ? 8 : 0
Layout.alignment: Qt.AlignVCenter
visible: isRecentInstalled
Layout.preferredHeight: tagSize
Layout.preferredWidth: tagSize
radius: width / 2
useStyleTransparency: false
paletteRole: Platform.Theme.Highlight
}
UkuiItems.StyleText {
id: appName
Layout.maximumWidth: styleBackground.width - tagPoint.width
Layout.preferredHeight: contentHeight
Layout.maximumHeight: contentHeight
elide: Text.ElideRight
paletteRole: Platform.Theme.Text
horizontalAlignment: Text.AlignHCenter
}
}
}
}

View File

@ -90,6 +90,7 @@ ListView {
text.text: model.name
icon.source: model.icon
isRecentInstalled: model.recentInstall
onClicked: (event) => {
if (event.button === Qt.LeftButton) {

View File

@ -56,7 +56,7 @@ private Q_SLOTS:
private:
static void addInfoToApp(const QMap<UkuiSearch::ApplicationProperty::Property, QVariant> &info, DataEntity &app);
bool isFiltered(const UkuiSearch::ApplicationPropertyMap &appInfo) const;
bool isFilterAccepted(const UkuiSearch::ApplicationPropertyMap &appInfo) const;
private:
AppDatabaseInterface *q {nullptr};
@ -126,12 +126,12 @@ void AppDatabaseWorkerPrivate::addInfoToApp(const UkuiSearch::ApplicationPropert
app.setLaunched(info.value(UkuiSearch::ApplicationProperty::Property::Launched).toInt());
}
bool AppDatabaseWorkerPrivate::isFiltered(const UkuiSearch::ApplicationPropertyMap &appInfo) const
bool AppDatabaseWorkerPrivate::isFilterAccepted(const UkuiSearch::ApplicationPropertyMap &appInfo) const
{
QMapIterator<UkuiSearch::ApplicationProperty::Property, QVariant> iterator(filter);
while (iterator.hasNext()) {
iterator.next();
if (appInfo.value(iterator.key()) == iterator.value()) {
if (appInfo.value(iterator.key()) != iterator.value()) {
return false;
}
@ -170,7 +170,7 @@ void AppDatabaseWorkerPrivate::onAppDatabaseAdded(const QStringList &infos)
DataEntityVector apps;
for (const QString &appid : infos) {
const UkuiSearch::ApplicationPropertyMap appInfo = appDatabase->getInfo(appid, properties);
if (isFiltered(appInfo)) {
if (!isFilterAccepted(appInfo)) {
continue;
}

View File

@ -19,6 +19,7 @@
*/
#include "basic-app-model.h"
#include "user-config.h"
#include <QDebug>
@ -119,8 +120,15 @@ const AppDatabaseInterface *BasicAppModel::databaseInterface() const
void BasicAppModel::onAppAdded(const DataEntityVector &apps)
{
beginInsertRows(QModelIndex(), m_apps.size(), m_apps.size() + apps.size() - 1);
m_apps.append(apps);
DataEntityVector appItems;
for (auto const & app : apps) {
if (indexOfApp(app.id()) < 0) {
appItems.append(app);
}
}
if (appItems.isEmpty()) return;
beginInsertRows(QModelIndex(), m_apps.size(), m_apps.size() + appItems.size() - 1);
m_apps.append(appItems);
endInsertRows();
}
@ -149,6 +157,7 @@ void BasicAppModel::onAppUpdated(const QVector<QPair<DataEntity, QVector<int> >
void BasicAppModel::onAppDeleted(const QStringList &apps)
{
for (const auto &appid : apps) {
UserConfig::instance()->removePreInstalledApp(appid);
int index = indexOfApp(appid);
if (index < 0) {
continue;

View File

@ -20,6 +20,7 @@
#include "recently-installed-model.h"
#include "basic-app-model.h"
#include "user-config.h"
#include <QDebug>
#include <QTimer>
@ -44,6 +45,10 @@ RecentlyInstalledModel::RecentlyInstalledModel(QObject *parent) : QSortFilterPro
bool RecentlyInstalledModel::filterAcceptsRow(int source_row, const QModelIndex &source_parent) const
{
QModelIndex sourceIndex = sourceModel()->index(source_row, 0, source_parent);
// 是否为预装应用
if (UserConfig::instance()->isPreInstalledApps(sourceIndex.data(DataEntity::Id).toString())) {
return false;
}
// 是否打开过
if (sourceIndex.data(DataEntity::IsLaunched).toInt() != 0) {
return false;

View File

@ -111,8 +111,11 @@ bool UserConfig::isPreInstalledApps(const QString &appid) const
void UserConfig::removePreInstalledApp(const QString &appid)
{
QMutexLocker mutexLocker(&m_mutex);
m_preInstalledApps.remove(appid);
{
QMutexLocker mutexLocker(&m_mutex);
m_preInstalledApps.remove(appid);
}
sync();
}
void UserConfig::readConfigFile()

View File

@ -239,7 +239,7 @@ void MenuWindow::init()
//setWindowState(Qt::WindowMaximized);
setFlags(flags() | Qt::Window | Qt::FramelessWindowHint);
m_windowProxy = new UkuiQuick::WindowProxy(this);
m_windowProxy = new UkuiQuick::WindowProxy2(this);
m_windowProxy->setWindowType(UkuiQuick::WindowType::SystemWindow);
// 访问窗口api
@ -297,7 +297,8 @@ void MenuWindow::updateGeometry()
updateCurrentScreenGeometry();
setMinimumSize(m_fullScreenGeometry.size());
setMaximumSize(m_fullScreenGeometry.size());
m_windowProxy->setGeometry(m_fullScreenGeometry);
setGeometry(m_fullScreenGeometry);
m_windowProxy->setPosition(m_fullScreenGeometry.topLeft());
updateGeometryOfMask();
WindowHelper::setRegion(this, m_maskGeometry.x(), m_maskGeometry.y(), m_maskGeometry.width(), m_maskGeometry.height(), 16);

View File

@ -136,7 +136,7 @@ private:
QRect m_normalGeometry = QRect(0,0,0,0);
QRect m_fullScreenGeometry = QRect(0,0,0,0);
QGSettings *m_setting {nullptr};
UkuiQuick::WindowProxy *m_windowProxy {nullptr};
UkuiQuick::WindowProxy2 *m_windowProxy {nullptr};
};
} // UkuiMenu