Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,52 @@ if(Qt${QT_VERSION_MAJOR}_VERSION VERSION_GREATER_EQUAL 6.10)
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS WaylandClientPrivate WaylandCompositorPrivate REQUIRED)
endif()
find_package(Dtk${DTK_VERSION_MAJOR} REQUIRED COMPONENTS Core Gui)
set(ICU_USE_STATIC_LIBS OFF)
find_package(ICU 74.2 REQUIRED COMPONENTS uc i18n io)

get_filename_component(DS_ICU_PREFIX "${ICU_INCLUDE_DIR}" DIRECTORY)
function(ds_resolve_icu_shared_library output_var library_basename)
set(search_roots
"${DS_ICU_PREFIX}/lib"
"${DS_ICU_PREFIX}/lib/*"
"/usr/local/lib"
"/usr/local/lib/*"
"/usr/lib"
"/usr/lib/*"
"/lib"
"/lib/*"
)

foreach(search_root IN LISTS search_roots)
file(GLOB versioned_candidates LIST_DIRECTORIES false "${search_root}/${library_basename}.so.*")
list(SORT versioned_candidates)
list(REVERSE versioned_candidates)

foreach(candidate IN LISTS versioned_candidates)
get_filename_component(resolved_library "${candidate}" REALPATH)
if (EXISTS "${resolved_library}")
set(${output_var} "${resolved_library}" PARENT_SCOPE)
return()
endif()
endforeach()

file(GLOB soname_candidates LIST_DIRECTORIES false "${search_root}/${library_basename}.so")
foreach(candidate IN LISTS soname_candidates)
get_filename_component(resolved_library "${candidate}" REALPATH)
if (EXISTS "${resolved_library}")
set(${output_var} "${resolved_library}" PARENT_SCOPE)
return()
endif()
endforeach()
endforeach()

message(FATAL_ERROR "Could not resolve an existing ICU shared library for ${library_basename}")
endfunction()

ds_resolve_icu_shared_library(DS_ICU_UC_LIBRARY libicuuc)
ds_resolve_icu_shared_library(DS_ICU_I18N_LIBRARY libicui18n)
ds_resolve_icu_shared_library(DS_ICU_IO_LIBRARY libicuio)

Comment on lines +63 to +105
find_package(WaylandProtocols REQUIRED)
find_package(PkgConfig REQUIRED)

Expand Down
89 changes: 89 additions & 0 deletions LICENSES/OFL-1.1.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
SIL OPEN FONT LICENSE

Version 1.1 - 26 February 2007

PREAMBLE

The goals of the Open Font License (OFL) are to stimulate worldwide
development of collaborative font projects, to support the font creation
efforts of academic and linguistic communities, and to provide a free and
open framework in which fonts may be shared and improved in partnership
with others.

The OFL allows the licensed fonts to be used, studied, modified and
redistributed freely as long as they are not sold by themselves. The
fonts, including any derivative works, can be bundled, embedded,
redistributed and/or sold with any software provided that any reserved
names are not used by derivative works. The fonts and derivatives,
however, cannot be released under any other type of license. The
requirement for fonts to remain under this license does not apply to any
document created using the fonts or their derivatives.

DEFINITIONS

"Font Software" refers to the set of files released by the Copyright
Holder(s) under this license and clearly marked as such. This may
include source files, build scripts and documentation.

"Reserved Font Name" refers to any names specified as such after the
copyright statement(s).

"Original Version" refers to the collection of Font Software components as
distributed by the Copyright Holder(s).

"Modified Version" refers to any derivative made by adding to, deleting,
or substituting -- in part or in whole -- any of the components of the
Original Version, by changing formats or by porting the Font Software to a
new environment.

"Author" refers to any designer, engineer, programmer, technical
writer or other person who contributed to the Font Software.

PERMISSION & CONDITIONS

Permission is hereby granted, free of charge, to any person obtaining a
copy of the Font Software, to use, study, copy, merge, embed, modify,
redistribute, and sell modified and unmodified copies of the Font
Software, subject to the following conditions:

1) Neither the Font Software nor any of its individual components, in
Original or Modified Versions, may be sold by itself.

2) Original or Modified Versions of the Font Software may be bundled,
redistributed and/or sold with any software, provided that each copy
contains the above copyright notice and this license. These can be
included either as stand-alone text files, human-readable headers or in
the appropriate machine-readable metadata fields within text or binary
files as long as those fields can be easily viewed by the user.

3) No Modified Version of the Font Software may use the Reserved Font
Name(s) unless explicit written permission is granted by the corresponding
Copyright Holder. This restriction only applies to the primary font name
as presented to the users.

4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
Software shall not be used to promote, endorse or advertise any Modified
Version, except to acknowledge the contribution(s) of the Copyright
Holder(s) and the Author(s) or with their explicit written permission.

5) The Font Software, modified or unmodified, in part or in whole, must
be distributed entirely under this license, and must not be distributed
under any other license. The requirement for fonts to remain under this
license does not apply to any document created using the Font Software.

TERMINATION

This license becomes null and void if any of the above conditions are not
met.

DISCLAIMER

THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER
DEALINGS IN THE FONT SOFTWARE.
6 changes: 6 additions & 0 deletions REUSE.toml
Original file line number Diff line number Diff line change
Expand Up @@ -92,3 +92,9 @@ path = "toolGenerate/**/**"
precedence = "aggregate"
SPDX-FileCopyrightText = "None"
SPDX-License-Identifier = "CC0-1.0"

[[annotations]]
path = "shell/fonts/ElmsSans-Regular.ttf"
precedence = "aggregate"
SPDX-FileCopyrightText = "2025 The Elms Sans Project Authors"
SPDX-License-Identifier = "OFL-1.1"
52 changes: 47 additions & 5 deletions applets/dde-appearance/appearanceapplet.cpp
Original file line number Diff line number Diff line change
@@ -1,19 +1,30 @@
// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd.
// SPDX-FileCopyrightText: 2024-2026 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: GPL-3.0-or-later

#include "appearanceapplet.h"

#include "pluginfactory.h"

Check warning on line 7 in applets/dde-appearance/appearanceapplet.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: "pluginfactory.h" not found.

#include <QDBusError>

Check warning on line 9 in applets/dde-appearance/appearanceapplet.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <QDBusError> not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <QDBusMessage>

Check warning on line 10 in applets/dde-appearance/appearanceapplet.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <QDBusMessage> not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <QDBusReply>

Check warning on line 11 in applets/dde-appearance/appearanceapplet.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <QDBusReply> not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <QDBusVariant>

Check warning on line 12 in applets/dde-appearance/appearanceapplet.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <QDBusVariant> not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <QDebug>

Check warning on line 13 in applets/dde-appearance/appearanceapplet.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <QDebug> not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <QDBusServiceWatcher>

Check warning on line 14 in applets/dde-appearance/appearanceapplet.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <QDBusServiceWatcher> not found. Please note: Cppcheck does not need standard library headers to get proper results.

DCORE_USE_NAMESPACE
DS_BEGIN_NAMESPACE
namespace dde {

namespace {
bool isOpacityChangeType(const QString &type)
{
return type.compare(QStringLiteral("opacity"), Qt::CaseInsensitive) == 0
|| type.compare(QStringLiteral("windowopacity"), Qt::CaseInsensitive) == 0;
}
}

AppearanceApplet::AppearanceApplet(QObject *parent)
: DApplet(parent)
{
Expand All @@ -39,11 +50,11 @@

qreal AppearanceApplet::opacity() const
{
if (!m_interface)
if (m_opacity < 0)
return -1;

// The minimum opacity is 0.2
return std::max(0.2, m_interface->opacity());
return std::max(0.2, m_opacity);
}

void AppearanceApplet::initDBusProxy()
Expand All @@ -59,11 +70,42 @@
return;
}

m_interface->setSync(false);
QObject::connect(m_interface.data(), &org::deepin::dde::Appearance1::OpacityChanged, this, &AppearanceApplet::opacityChanged);
QObject::connect(m_interface.data(), &org::deepin::dde::Appearance1::Changed, this,
[this](const QString &type, const QString &) {
if (isOpacityChangeType(type)) {
refreshOpacity();
Q_EMIT opacityChanged();
}
});
QObject::connect(m_interface.data(), &org::deepin::dde::Appearance1::Refreshed, this,
[this](const QString &type) {
if (isOpacityChangeType(type)) {
refreshOpacity();
Q_EMIT opacityChanged();
}
});
refreshOpacity();
Q_EMIT opacityChanged();
}

void AppearanceApplet::refreshOpacity()
{
QDBusMessage message = QDBusMessage::createMethodCall(QStringLiteral("org.deepin.dde.Appearance1"),
QStringLiteral("/org/deepin/dde/Appearance1"),
QStringLiteral("org.freedesktop.DBus.Properties"),
QStringLiteral("Get"));
message << QStringLiteral("org.deepin.dde.Appearance1") << QStringLiteral("Opacity");

QDBusReply<QDBusVariant> reply = QDBusConnection::sessionBus().call(message);
if (!reply.isValid()) {
qWarning() << "Failed to get Appearance opacity, error:" << reply.error();
m_opacity = -1;
return;
}

m_opacity = reply.value().variant().toReal();
}

D_APPLET_CLASS(AppearanceApplet)
}
DS_END_NAMESPACE
Expand Down
4 changes: 3 additions & 1 deletion applets/dde-appearance/appearanceapplet.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd.
// SPDX-FileCopyrightText: 2024-2026 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: GPL-3.0-or-later

Expand All @@ -24,8 +24,10 @@ class AppearanceApplet : public DApplet
void opacityChanged();
private:
void initDBusProxy();
void refreshOpacity();
private:
QScopedPointer<org::deepin::dde::Appearance1> m_interface;
qreal m_opacity = -1;
};

}
Expand Down
31 changes: 24 additions & 7 deletions applets/dde-apps/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,34 +1,51 @@
# SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd.
# SPDX-FileCopyrightText: 2024-2026 UnionTech Software Technology Co., Ltd.
#
# SPDX-License-Identifier: GPL-3.0-or-later

find_package(Qt${QT_VERSION_MAJOR} ${REQUIRED_QT_VERSION} REQUIRED COMPONENTS DBus)
find_package(DDEApplicationManager REQUIRED)
find_package(yaml-cpp REQUIRED)

set(DDE_APPS_DBUS_API_FALLBACK_DIR "${PROJECT_SOURCE_DIR}/panels/dock/taskmanager/api/amdbus")
set(DDE_APPS_APPLICATION_XML "${DDE_APPLICATION_MANAGER_DBUS_API_DIR}/org.desktopspec.ApplicationManager1.Application.xml")
set(DDE_APPS_APPLICATION_MANAGER_XML "${DDE_APPLICATION_MANAGER_DBUS_API_DIR}/org.desktopspec.ApplicationManager1.xml")
set(DDE_APPS_OBJECT_MANAGER_XML "${DDE_APPLICATION_MANAGER_DBUS_API_DIR}/org.desktopspec.ObjectManager1.xml")

if (NOT EXISTS "${DDE_APPS_APPLICATION_XML}")
set(DDE_APPS_APPLICATION_XML "${DDE_APPS_DBUS_API_FALLBACK_DIR}/org.desktopspec.ApplicationManager1.Application.xml")
endif()

if (NOT EXISTS "${DDE_APPS_APPLICATION_MANAGER_XML}")
set(DDE_APPS_APPLICATION_MANAGER_XML "${DDE_APPS_DBUS_API_FALLBACK_DIR}/org.desktopspec.ApplicationManager1.xml")
endif()

if (NOT EXISTS "${DDE_APPS_OBJECT_MANAGER_XML}")
set(DDE_APPS_OBJECT_MANAGER_XML "${DDE_APPS_DBUS_API_FALLBACK_DIR}/org.desktopspec.ObjectManager1.xml")
endif()

set_source_files_properties(
${DDE_APPLICATION_MANAGER_DBUS_API_DIR}/org.desktopspec.ApplicationManager1.Application.xml
${DDE_APPS_APPLICATION_XML}
PROPERTIES INCLUDE api/types/am.h
CLASSNAME Application
)

set_source_files_properties(
${DDE_APPLICATION_MANAGER_DBUS_API_DIR}/org.desktopspec.ApplicationManager1.xml
${DDE_APPS_APPLICATION_MANAGER_XML}
PROPERTIES INCLUDE api/types/am.h
CLASSNAME ApplicationManager
)

set_source_files_properties(
${DDE_APPLICATION_MANAGER_DBUS_API_DIR}/org.desktopspec.ObjectManager1.xml
${DDE_APPS_OBJECT_MANAGER_XML}
PROPERTIES INCLUDE api/types/am.h
CLASSNAME ObjectManager
)

qt_add_dbus_interfaces(
DBUS_INTERFACES
${DDE_APPLICATION_MANAGER_DBUS_API_DIR}/org.desktopspec.ApplicationManager1.Application.xml
${DDE_APPLICATION_MANAGER_DBUS_API_DIR}/org.desktopspec.ApplicationManager1.xml
${DDE_APPLICATION_MANAGER_DBUS_API_DIR}/org.desktopspec.ObjectManager1.xml
${DDE_APPS_APPLICATION_XML}
${DDE_APPS_APPLICATION_MANAGER_XML}
${DDE_APPS_OBJECT_MANAGER_XML}
)


Expand Down
41 changes: 31 additions & 10 deletions applets/dde-apps/appgroup.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd.
// SPDX-FileCopyrightText: 2024-2026 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: GPL-3.0-or-later

Expand All @@ -14,12 +14,15 @@

namespace apps {
AppGroup::AppGroup(const QString &groupId, const QString &name, const QList<QStringList> &appIDs)
: AppItem(groupId, AppItemModel::FolderItemType)
, m_itemsPage(new ItemsPage(name, groupId == QStringLiteral("internal/folder/0") ? (4 * 8) : (3 * 4)))
: AppItem(normalizeGroupId(groupId), AppItemModel::FolderItemType)
, m_itemsPage(new ItemsPage(name, parseGroupId(groupId) == 0 ? (4 * 8) : (3 * 4)))
{
setItemsPerPage(m_itemsPage->maxItemCountPerPage());
setAppName(m_itemsPage->name());
// folder id is a part of its groupId: "internal/folder/{folderId}"
QObject::connect(m_itemsPage, &ItemsPage::nameChanged, m_itemsPage, [this]() {
setAppName(m_itemsPage->name());
});
// folder id is the numeric suffix of the normalized launcher group id.
setFolderId(parseGroupId(groupId));

for (const QStringList &items : appIDs) {
Expand Down Expand Up @@ -49,19 +52,38 @@

bool AppGroup::idIsFolder(const QString & id)
{
return id.startsWith(QStringLiteral("internal/folder/"));
bool isNumericId = false;
id.toInt(&isNumericId);

Check warning on line 56 in applets/dde-apps/appgroup.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Return value of function id.toInt() is not used.

return isNumericId ||
id.startsWith(QStringLiteral("internal/folder/")) ||
id.startsWith(QStringLiteral("internal/folders/")) ||
id.startsWith(QStringLiteral("internal/group/"));
}

QString AppGroup::normalizeGroupId(const QString &id)
{
bool isNumericId = false;
const int numericId = id.toInt(&isNumericId);
if (isNumericId) {
return groupIdFromNumber(numericId);
}

if (!idIsFolder(id)) {
return id;
}

return QStringLiteral("internal/folders/%1").arg(parseGroupId(id));
}

QString AppGroup::groupIdFromNumber(int groupId)
{
return QStringLiteral("internal/folder/%1").arg(groupId);
return QStringLiteral("internal/folders/%1").arg(groupId);
}

int AppGroup::parseGroupId(const QString & id)
{
using namespace std::string_view_literals;
constexpr size_t len = "internal/folder/"sv.size();
return QStringView{id}.mid(len + 1).toInt();
return id.section(QLatin1Char('/'), -1).toInt();
}

void AppGroup::setItemsPerPage(int number)
Expand All @@ -75,4 +97,3 @@
}

}

Loading
Loading