-
Notifications
You must be signed in to change notification settings - Fork 29
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. Issue: linuxdeepin/developer-center#5810
- Loading branch information
1 parent
a0e18c0
commit 53340d9
Showing
6 changed files
with
150 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,3 +44,7 @@ Copyright: 2010, Marco Martin <[email protected]> | |
2019, David Edmundson <[email protected]> | ||
License: LGPL-2.0-or-later | ||
|
||
# package metadata | ||
Files: */metadata.json | ||
Copyright: None | ||
License: CC0-1.0 |
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,90 @@ | ||
// SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd. | ||
// | ||
// SPDX-License-Identifier: GPL-3.0-or-later | ||
|
||
#include "appsmodel.h" | ||
#include "desktopintegration.h" | ||
#include "favoritedproxymodel.h" | ||
#include "searchfilterproxymodel.h" | ||
#include "categorizedsortproxymodel.h" | ||
#include "multipageproxymodel.h" | ||
#include "launchercontroller.h" | ||
#include "debughelper.h" | ||
|
||
#include "corona.h" | ||
#include "qmlengine.h" | ||
#include "pluginfactory.h" | ||
DS_USE_NAMESPACE | ||
|
||
#include <QDBusConnection> | ||
#include <QGuiApplication> | ||
#include <QQmlApplicationEngine> | ||
#include <QQmlContext> | ||
#include <QQuickStyle> | ||
#include <QCommandLineParser> | ||
#include <DGuiApplicationHelper> | ||
#include <DStandardPaths> | ||
#include <DPathBuf> | ||
#include <launcherappiconprovider.h> | ||
#include <blurhashimageprovider.h> | ||
#include <ksortfilterproxymodel.h> | ||
|
||
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 LanchpadCorona : public DCorona | ||
{ | ||
Q_OBJECT | ||
public: | ||
LanchpadCorona(QObject *parent) | ||
Check warning on line 52 in dde-shell-wrapper/main.cpp GitHub Actions / cppcheck
|
||
: DCorona(parent) | ||
{ | ||
} | ||
virtual void init() override | ||
{ | ||
DGuiApplicationHelper::loadTranslator(QStringLiteral("dde-launchpad"), translationDir(), { QLocale() }); | ||
|
||
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"; | ||
} | ||
|
||
qmlRegisterType<KSortFilterProxyModel>("org.deepin.vendored", 1, 0, "KSortFilterProxyModel"); | ||
qmlRegisterUncreatableType<AppItem>("org.deepin.launchpad", 1, 0, "AppItem", "AppItem should only be created from C++ side"); | ||
qmlRegisterSingletonInstance("org.deepin.launchpad", 1, 0, "AppsModel", &AppsModel::instance()); | ||
qmlRegisterSingletonInstance("org.deepin.launchpad", 1, 0, "FavoritedProxyModel", &FavoritedProxyModel::instance()); | ||
qmlRegisterSingletonInstance("org.deepin.launchpad", 1, 0, "SearchFilterProxyModel", &SearchFilterProxyModel::instance()); | ||
qmlRegisterSingletonInstance("org.deepin.launchpad", 1, 0, "CategorizedSortProxyModel", &CategorizedSortProxyModel::instance()); | ||
qmlRegisterSingletonInstance("org.deepin.launchpad", 1, 0, "MultipageProxyModel", &MultipageProxyModel::instance()); | ||
qmlRegisterSingletonInstance("org.deepin.launchpad", 1, 0, "DesktopIntegration", &DesktopIntegration::instance()); | ||
qmlRegisterSingletonInstance("org.deepin.launchpad", 1, 0, "LauncherController", &LauncherController::instance()); | ||
qmlRegisterSingletonInstance("org.deepin.launchpad", 1, 0, "DebugHelper", &DebugHelper::instance()); | ||
|
||
CategorizedSortProxyModel::instance().setCategoryType(CategorizedSortProxyModel::Alphabetary); | ||
|
||
auto &engine = *DQmlEngine().engine(); | ||
|
||
engine.addImageProvider(QLatin1String("app-icon"), new LauncherAppIconProvider); | ||
engine.addImageProvider(QLatin1String("blurhash"), new BlurhashImageProvider); | ||
|
||
DCorona::init(); | ||
} | ||
}; | ||
|
||
D_APPLET_CLASS(LanchpadCorona) | ||
|
||
#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,9 @@ | ||
// SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd. | ||
// | ||
// SPDX-License-Identifier: LGPL-3.0-or-later | ||
|
||
import "qrc:/qml" as Impl | ||
|
||
Impl.Main { | ||
|
||
} |
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,8 @@ | ||
{ | ||
"Plugin": { | ||
"Version": "1.0", | ||
"Id": "org.deepin.ds.launchpad", | ||
"Url": "main.qml", | ||
"ContainmentType": "Panel" | ||
} | ||
} |
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,36 @@ | ||
# SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd. | ||
# | ||
# SPDX-License-Identifier: CC0-1.0 | ||
|
||
find_package(DDEShell) | ||
if (DDEShell_FOUND) | ||
|
||
add_library(ds-launchpad-wrapper SHARED | ||
${CMAKE_CURRENT_LIST_DIR}/main.cpp | ||
${SOURCE_FILES} | ||
${DBUS_ADAPTER_FILES} | ||
${RESOURCES} | ||
${TRANSLATED_FILES} | ||
) | ||
target_compile_definitions(ds-launchpad-wrapper | ||
PRIVATE | ||
DDE_LAUNCHPAD_VERSION=${CMAKE_PROJECT_VERSION} | ||
) | ||
target_link_libraries(ds-launchpad-wrapper PRIVATE | ||
DDEShell | ||
|
||
Dtk::Core | ||
Dtk::Gui | ||
Qt${QT_MAJOR_VERSION}::Qml | ||
Qt${QT_MAJOR_VERSION}::Quick | ||
Qt${QT_MAJOR_VERSION}::QuickControls2 | ||
|
||
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() |