forked from linuxdeepin/dde-launchpad
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
dde-shell loads org.deepin.ds.launchpad. e.g: ``` export DDE_SHELL_PACKAGE_PATH=/src-path/build/packages export DDE_SHELL_PLUGIN_PATH=/src-path/build/plugins dde-shell -p org.deepin.ds.launchpad ``` Issue: linuxdeepin/developer-center#5810
- Loading branch information
1 parent
2e333e8
commit db38043
Showing
8 changed files
with
169 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. | ||
// | ||
// SPDX-License-Identifier: GPL-3.0-or-later | ||
|
||
#include "categorizedsortproxymodel.h" | ||
#include "launchercontroller.h" | ||
#include "debughelper.h" | ||
|
||
#include <QDBusConnection> | ||
#include <QGuiApplication> | ||
#include <QQmlApplicationEngine> | ||
#include <QQmlContext> | ||
#include <QQuickStyle> | ||
#include <DGuiApplicationHelper> | ||
#include <DStandardPaths> | ||
#include <DPathBuf> | ||
#include <launcherappiconprovider.h> | ||
#include <launcherfoldericonprovider.h> | ||
#include <blurhashimageprovider.h> | ||
|
||
#include "panel.h" | ||
#include "qmlengine.h" | ||
#include "pluginfactory.h" | ||
DS_USE_NAMESPACE | ||
|
||
DCORE_USE_NAMESPACE | ||
DGUI_USE_NAMESPACE | ||
|
||
// we should wait for dtkgui to have a "proper" loadTranslation() to use. | ||
QStringList translationDir() { | ||
QList<QString> translateDirs; | ||
QString appName{"dde-launchpad"}; | ||
//("/home/user/.local/share", "/usr/local/share", "/usr/share") | ||
const QStringList dataDirs(DStandardPaths::standardLocations(QStandardPaths::GenericDataLocation)); | ||
for (const auto &path : dataDirs) { | ||
DPathBuf DPathBuf(path); | ||
translateDirs << (DPathBuf / appName / "translations").toString(); | ||
} | ||
return translateDirs; | ||
} | ||
|
||
class LanchpadPanel : public DPanel | ||
{ | ||
Q_OBJECT | ||
public: | ||
LanchpadPanel(QObject *parent) | ||
: DPanel(parent) | ||
{ | ||
} | ||
virtual bool load() override | ||
{ | ||
DGuiApplicationHelper::loadTranslator(QStringLiteral("dde-launchpad"), translationDir(), { QLocale::system() }); | ||
|
||
QDBusConnection connection = QDBusConnection::sessionBus(); | ||
if (!connection.registerService(QStringLiteral("org.deepin.dde.Launcher1")) || | ||
!connection.registerObject(QStringLiteral("/org/deepin/dde/Launcher1"), &LauncherController::instance())) { | ||
qWarning() << "register dbus service failed"; | ||
return false; | ||
} | ||
|
||
CategorizedSortProxyModel::instance().setCategoryType(CategorizedSortProxyModel::Alphabetary); | ||
|
||
auto &engine = *DQmlEngine().engine(); | ||
|
||
engine.addImageProvider(QLatin1String("app-icon"), new LauncherAppIconProvider); | ||
engine.addImageProvider(QLatin1String("folder-icon"), new LauncherFolderIconProvider); | ||
engine.addImageProvider(QLatin1String("blurhash"), new BlurhashImageProvider); | ||
|
||
return DPanel::load(); | ||
} | ||
virtual bool init() override | ||
{ | ||
return DPanel::init(); | ||
} | ||
}; | ||
|
||
D_APPLET_CLASS(LanchpadPanel) | ||
|
||
#include "main.moc" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. | ||
// | ||
// SPDX-License-Identifier: GPL-3.0-or-later | ||
|
||
import org.deepin.ds 1.0 | ||
import org.deepin.launchpad 1.0 | ||
|
||
ContainmentItem { | ||
id: root | ||
property point windowedPos: Qt.point(0, 0) | ||
Main { | ||
windowedPos: root.windowedPos | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"Plugin": { | ||
"Version": "1.0", | ||
"Id": "org.deepin.ds.launchpad", | ||
"Url": "main.qml", | ||
"ContainmentType": "Panel", | ||
"Category": "DDE" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
# SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. | ||
# | ||
# SPDX-License-Identifier: CC0-1.0 | ||
|
||
find_package(DDEShell) | ||
if (DDEShell_FOUND) | ||
|
||
qt_add_qml_module(ds-launchpad-wrapper | ||
URI org.deepin.launchpad | ||
VERSION 1.0 | ||
RESOURCES qml.qrc | ||
RESOURCE_PREFIX | ||
/qt/qml | ||
QML_FILES | ||
${QML_FILES} | ||
SOURCES ${CMAKE_CURRENT_LIST_DIR}/main.cpp | ||
${SOURCE_FILES} | ||
${DBUS_ADAPTER_FILES} | ||
${RESOURCES} | ||
${TRANSLATED_FILES} | ||
) | ||
|
||
qt_add_translations(ds-launchpad-wrapper | ||
TS_FILES ${TRANSLATION_FILES} | ||
SOURCES ${QML_FILES} ${SOURCE_FILES} ${PROJECT_SOURCE_DIR}/src/models/appitem.cpp | ||
QM_FILES_OUTPUT_VARIABLE TRANSLATED_FILES | ||
) | ||
|
||
target_compile_definitions(ds-launchpad-wrapper | ||
PRIVATE | ||
DDE_LAUNCHPAD_VERSION=${CMAKE_PROJECT_VERSION} | ||
) | ||
target_link_libraries(ds-launchpad-wrapper PRIVATE | ||
Dde::Shell | ||
|
||
${DTK_NS}::Core | ||
${DTK_NS}::Gui | ||
Qt::Qml | ||
Qt::Quick | ||
Qt::QuickControls2 | ||
|
||
launcher-qml-windowed | ||
gio-utils | ||
launcher-utils | ||
launcher-qml-utils | ||
launcher-models | ||
dde-integration-dbus | ||
) | ||
ds_install_package(PACKAGE org.deepin.ds.launchpad TARGET ds-launchpad-wrapper PACKAGE_ROOT_DIR ${CMAKE_CURRENT_LIST_DIR}/package) | ||
|
||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters