Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions debian/dde-shell.install
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ usr/share/dde-shell/org.deepin.ds.osd*/
usr/lib/*/dde-shell/org.deepin.ds.dock*
usr/share/dde-shell/org.deepin.ds.dock*/
usr/lib/*/qt6/qml/org/deepin/ds/dock/*
usr/lib/*/qt6/qml/org/deepin/ds/dockshell/*
usr/lib/*/dde-shell/org.deepin.ds.notification*
usr/share/dde-shell/org.deepin.ds.notification*/
usr/lib/*/dde-shell/org.deepin.ds.dde-appearance*
Expand Down
1 change: 1 addition & 0 deletions debian/libdde-shell.install
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
usr/lib/*/libdde-shell.so.*
usr/lib/*/libdock-shell.so.*
usr/lib/*/qt6/qml/org/deepin/ds/*.so
usr/lib/*/qt6/qml/org/deepin/ds/qmldir
29 changes: 24 additions & 5 deletions panels/dock/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,11 @@ endif(BUILD_WITH_X11)
ds_install_package(PACKAGE org.deepin.ds.dock TARGET dockpanel)
ds_handle_package_translation(PACKAGE org.deepin.ds.dock)

# # dock shell
if ((${CMAKE_BUILD_TYPE} MATCHES "Debug"))
add_subdirectory(dock-shell-example)
endif ()

# sub plugins
add_subdirectory(clipboarditem)
add_subdirectory(workspaceitem)
Expand All @@ -93,14 +98,20 @@ add_subdirectory(dockplugin)

# dock qml element(include Dock.xx defines and DockCompositor)
file(
GLOB dock_plugin_sources
GLOB dock_plugin_headers
constants.h
ddockapplet.h
)
file(
GLOB dock_plugin_sources
# dockfilterproxymodel.cpp
# dockfilterproxymodel.h
dockpluginmanagerextension_p.h
dockpluginmanagerextension.cpp
dockpluginmanagerintegration_p.h
dockpluginmanagerintegration.cpp
private/ddockapplet_p.h
ddockapplet.cpp
)

set_source_files_properties(DockCompositor.qml PROPERTIES
Expand All @@ -117,12 +128,12 @@ set_source_files_properties(DockPalette.qml PROPERTIES

qt_policy(SET QTP0001 OLD)
qt_add_qml_module(dock-plugin
PLUGIN_TARGET dock-plugin
PLUGIN_TARGET dock-qml-plugin
URI "org.deepin.ds.dock"
VERSION "1.0"
SHARED
SOURCES ${dock_plugin_sources}
QML_FILES DockCompositor.qml OverflowContainer.qml MenuHelper.qml DockPalette.qml
SOURCES ${dock_plugin_headers} ${dock_plugin_sources}
QML_FILES DockCompositor.qml OverflowContainer.qml MenuHelper.qml DockPalette.qml DockItem.qml
OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/plugins/org/deepin/ds/dock/
)

Expand All @@ -137,6 +148,7 @@ target_link_libraries(dock-plugin PUBLIC
Qt${QT_VERSION_MAJOR}::Qml
Qt${QT_VERSION_MAJOR}::Widgets
Qt${QT_VERSION_MAJOR}::WaylandCompositor
dde-shell-frame
PRIVATE
PkgConfig::WaylandClient
Qt${QT_VERSION_MAJOR}::WaylandCompositorPrivate
Expand All @@ -147,6 +159,13 @@ target_include_directories(dock-plugin
$<TARGET_PROPERTY:dde-shell-frame,INTERFACE_INCLUDE_DIRECTORIES>
)

install(DIRECTORY "${PROJECT_BINARY_DIR}/plugins/org/deepin/ds/dock/" DESTINATION "${QML_INSTALL_DIR}/org/deepin/ds/dock/")
target_include_directories(dock-plugin INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}>
$<INSTALL_INTERFACE:${INCLUDE_INSTALL_DIR}/dockshell>
)

install(FILES ${dock_plugin_headers} DESTINATION "${INCLUDE_INSTALL_DIR}/dockshell")
install(DIRECTORY "${PROJECT_BINARY_DIR}/plugins/org/deepin/ds/dock" DESTINATION "${QML_INSTALL_DIR}/org/deepin/ds/dock/")
dtk_add_config_meta_files(APPID org.deepin.ds.dock FILES dconfig/org.deepin.ds.dock.json)
dtk_add_config_meta_files(APPID org.deepin.ds.dock FILES dconfig/org.deepin.ds.dock.power.json)
63 changes: 63 additions & 0 deletions panels/dock/DockItem.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: GPL-3.0-or-later

import QtQuick 2.15
import QtQuick.Controls 2.15

import org.deepin.ds 1.0
import org.deepin.dtk 1.0 as D
import org.deepin.dtk.private 1.0 as DP
import org.deepin.ds.dock 1.0

AppletItem {
id: root
property int dockOrder
property bool shouldVisible
property alias toolButtonColor: backgroundButton.color1
property alias toolButtonBorderColor: backgroundButton.outsideBorderColor
property alias toolTip: toolTip.text
property alias icon: button.icon.name

signal clicked

PanelToolTip {
id: toolTip
}
D.ToolButton {
id: button
anchors.centerIn: parent
width: 30
height: 30
icon.width: 16
icon.height: 16

display: D.IconLabel.IconOnly
onClicked: {
toolTip.close()
root.clicked()
}

onHoveredChanged: {
if (toolTip.text === "")
return

if (hovered) {
var point = Applet.rootObject.mapToItem(null, Applet.rootObject.width / 2, 0)
toolTip.toolTipX = point.x
toolTip.toolTipY = point.y
toolTip.open()
} else {
toolTip.close()
}
}

background: DP.ButtonPanel {
id: backgroundButton

button: button
color2: color1
insideBorderColor: null
}
}
}
109 changes: 109 additions & 0 deletions panels/dock/ddockapplet.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
// SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: GPL-3.0-or-later

#include "ddockapplet.h"
#include "private/ddockapplet_p.h"

#include <QLoggingCategory>

DS_BEGIN_NAMESPACE

DCORE_USE_NAMESPACE

Q_DECLARE_LOGGING_CATEGORY(dsLog)

DDockAppletPrivate::DDockAppletPrivate(DDockApplet *qq)
: DAppletPrivate(qq)
{

}

DDockAppletPrivate::~DDockAppletPrivate()
{

}

DDockApplet::DDockApplet(QObject *parent)
: DDockApplet(*new DDockAppletPrivate(this), parent)
{

}

DDockApplet::DDockApplet(DDockAppletPrivate &dd, QObject *parent)
: DApplet(dd, parent)
{

}

DDockApplet::~DDockApplet()
{
qDebug(dsLog) << "Destroyed DDockApplet:" << pluginId() << id();
}

/*!
A unique name that identifies the plug-in. The default implementation is `pluginId`.
*/
QString DDockApplet::name() const
{
return DApplet::pluginId();
}

/*!
A name that displays a name that matches the current locale
*/
/**
* @brief DDockApplet::displayName
* @return
*/

/**
* @brief DDockApplet::itemKey
* @return
*/

/**
* @brief DDockApplet::settingKey
* @return
*/

/*!
A dci icon for display
*/
QString DDockApplet::icon() const
{
D_DC(DDockApplet);

return d->icon;
}

void DDockApplet::setIcon(const QString &icon)
{
D_D(DDockApplet);

d->icon = icon;
Q_EMIT iconChanged(icon);
}

/*!
Whether the plug-in is displayed on the panel
*/
bool DDockApplet::visible() const
{
D_DC(DDockApplet);

return d->visible;
}

void DDockApplet::setVisible(bool visible)
{
D_D(DDockApplet);

if (d->visible == visible)
return;

d->visible = visible;
Q_EMIT visibleChanged(visible);
}

DS_END_NAMESPACE
56 changes: 56 additions & 0 deletions panels/dock/ddockapplet.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
// SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: GPL-3.0-or-later

#pragma once

#include "applet.h"
#include "dsglobal.h"

#include <DObject>
#include <DDciIcon>

#include <QVariant>

DGUI_USE_NAMESPACE
DS_BEGIN_NAMESPACE
/**
* @brief You Can Used As Dock Plugins Sub Class
*/
class DDockAppletPrivate;
class DS_SHARE DDockApplet : public DApplet
{
Q_OBJECT
Q_PROPERTY(QString name READ name CONSTANT FINAL)
Q_PROPERTY(QString displayName READ displayName CONSTANT FINAL)
Q_PROPERTY(QString itemKey READ itemKey CONSTANT FINAL)
Q_PROPERTY(QString settingKey READ settingKey CONSTANT FINAL)
Q_PROPERTY(QString icon READ icon NOTIFY iconChanged FINAL)
Q_PROPERTY(bool visible READ visible WRITE setVisible NOTIFY visibleChanged FINAL);

D_DECLARE_PRIVATE(DDockApplet);

public:
explicit DDockApplet(QObject *parent = nullptr);
virtual ~DDockApplet() override;

virtual QString name() const;
virtual QString displayName() const = 0;
virtual QString itemKey() const = 0;
virtual QString settingKey() const = 0;

QString icon() const;
void setIcon(const QString &icon);

bool visible() const;
void setVisible(bool visible);

Q_SIGNALS:
void iconChanged(const QString &);
void visibleChanged(bool);

protected:
explicit DDockApplet(DDockAppletPrivate &dd, QObject *parent = nullptr);
};

DS_END_NAMESPACE
14 changes: 14 additions & 0 deletions panels/dock/dock-shell-example/CMakeLists.txt
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

add_library(dock-shell-example SHARED
item.cpp
item.h
)

target_link_libraries(dock-shell-example PRIVATE
dock-plugin
)

ds_install_package(PACKAGE org.deepin.ds.dock.dock-shell-example TARGET dock-shell-example)
50 changes: 50 additions & 0 deletions panels/dock/dock-shell-example/item.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: GPL-3.0-or-later

#include "item.h"
#include "pluginfactory.h"

#include <DDBusSender>
#include <DDciIcon>
#include <DGuiApplicationHelper>

#include <QGuiApplication>
#include <QBuffer>

DGUI_USE_NAMESPACE

namespace dock {

Item::Item(QObject *parent)
: DDockApplet(parent)
{
// for debug
setVisible(true);
}

void Item::activate()
{
qDebug() << "item clicked";
}

QString Item::displayName() const
{
return "dock-shell-example";
}

QString Item::itemKey() const
{
return "dock-shell-example";
}

QString Item::settingKey() const
{
return "dock-shell-example";
}

D_APPLET_CLASS(Item)
}


#include "item.moc"
Loading