mirror of
https://github.com/linuxdeepin/dde-dock.git
synced 2025-05-29 04:46:10 +00:00
chore: V23接口改造适配
V23接口改造适配 Log: V23接口改造适配 Influence: 无 Task: https://pms.uniontech.com/task-view-207483.html Change-Id: Ide530c023ea41f86fad2e8001ec67f1afaa897ab
This commit is contained in:
parent
3d89a3d474
commit
2d958dd670
3
.project
3
.project
@ -2,6 +2,5 @@
|
||||
"type": "homebrew" | "opensource",
|
||||
"3rdparty: ["*.xml"],
|
||||
"ignore": ["CHANGELOG.md", "./debian", "README.md", "./cmake", "technology-overview.md", "CMakeLists.txt", "CMakeLists.txt.user", "./plugins/plugin-guide", "./.tx", "*.qrc", "*.svg", "*.png", "*.qm", "*.ts"],
|
||||
"license": ["LICENSE"],
|
||||
"importantFile": ["gschema/com.deepin.dde.dock.module.gschema.xml", "interfaces/constants.h", "interfaces/pluginproxyinterface.h", "interfaces/pluginsiteminterface.h"]
|
||||
"license": ["LICENSE"]
|
||||
}
|
||||
|
@ -75,8 +75,6 @@ endfunction(generation_dbus_interface)
|
||||
|
||||
file(GLOB INTERFACES "interfaces/*.h")
|
||||
|
||||
add_compile_definitions(USE_AM)
|
||||
|
||||
#因为单元测试需要直接测试源代码,而主程序代码中include的单元使用了相对路径
|
||||
#单元测试的CMakeLists和主程序的CMakeLists路径不同,编译单元测试时会提示找不到文件
|
||||
#因此设置搜索路径
|
||||
|
@ -55,17 +55,11 @@ DockItemManager::DockItemManager(QObject *parent)
|
||||
connect(it, &AppItem::requestActivateWindow, m_appInter, &DockInter::ActivateWindow, Qt::QueuedConnection);
|
||||
connect(it, &AppItem::requestPreviewWindow, m_appInter, &DockInter::PreviewWindow);
|
||||
connect(it, &AppItem::requestCancelPreview, m_appInter, &DockInter::CancelPreviewWindow);
|
||||
|
||||
#ifdef USE_AM
|
||||
connect(it, &AppItem::windowCountChanged, this, &DockItemManager::onAppWindowCountChanged);
|
||||
#endif
|
||||
|
||||
connect(this, &DockItemManager::requestUpdateDockItem, it, &AppItem::requestUpdateEntryGeometries);
|
||||
|
||||
m_itemList.append(it);
|
||||
#ifdef USE_AM
|
||||
updateMultiItems(it);
|
||||
#endif
|
||||
}
|
||||
|
||||
// 托盘区域和插件区域 由DockPluginsController获取
|
||||
@ -86,9 +80,7 @@ DockItemManager::DockItemManager(QObject *parent)
|
||||
connect(m_appInter, &DockInter::EntryAdded, this, &DockItemManager::appItemAdded);
|
||||
connect(m_appInter, &DockInter::EntryRemoved, this, static_cast<void (DockItemManager::*)(const QString &)>(&DockItemManager::appItemRemoved), Qt::QueuedConnection);
|
||||
connect(m_appInter, &DockInter::ServiceRestarted, this, &DockItemManager::reloadAppItems);
|
||||
#ifdef USE_AM
|
||||
connect(m_appInter, &DockInter::ShowMultiWindowChanged, this, &DockItemManager::onShowMultiWindowChanged);
|
||||
#endif
|
||||
|
||||
DApplication *app = qobject_cast<DApplication *>(qApp);
|
||||
if (app) {
|
||||
@ -225,9 +217,7 @@ void DockItemManager::appItemAdded(const QDBusObjectPath &path, const int index)
|
||||
connect(item, &AppItem::requestActivateWindow, m_appInter, &DockInter::ActivateWindow, Qt::QueuedConnection);
|
||||
connect(item, &AppItem::requestPreviewWindow, m_appInter, &DockInter::PreviewWindow);
|
||||
connect(item, &AppItem::requestCancelPreview, m_appInter, &DockInter::CancelPreviewWindow);
|
||||
#ifdef USE_AM
|
||||
connect(item, &AppItem::windowCountChanged, this, &DockItemManager::onAppWindowCountChanged);
|
||||
#endif
|
||||
connect(this, &DockItemManager::requestUpdateDockItem, item, &AppItem::requestUpdateEntryGeometries);
|
||||
|
||||
m_itemList.insert(insertIndex, item);
|
||||
@ -239,10 +229,8 @@ void DockItemManager::appItemAdded(const QDBusObjectPath &path, const int index)
|
||||
|
||||
// 插入dockItem
|
||||
emit itemInserted(itemIndex, item);
|
||||
#ifdef USE_AM
|
||||
// 向后插入多开窗口
|
||||
updateMultiItems(item, true);
|
||||
#endif
|
||||
}
|
||||
|
||||
void DockItemManager::appItemRemoved(const QString &appId)
|
||||
@ -385,7 +373,6 @@ void DockItemManager::onPluginLoadFinished()
|
||||
m_loadFinished = true;
|
||||
}
|
||||
|
||||
#ifdef USE_AM
|
||||
void DockItemManager::onAppWindowCountChanged()
|
||||
{
|
||||
AppItem *appItem = static_cast<AppItem *>(sender());
|
||||
@ -496,4 +483,3 @@ void DockItemManager::onShowMultiWindowChanged()
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -67,10 +67,8 @@ private Q_SLOTS:
|
||||
void onPluginItemRemoved(PluginsItemInterface *itemInter);
|
||||
void onPluginUpdate(PluginsItemInterface *itemInter);
|
||||
|
||||
#ifdef USE_AM
|
||||
void onAppWindowCountChanged();
|
||||
void onShowMultiWindowChanged();
|
||||
#endif
|
||||
|
||||
private:
|
||||
explicit DockItemManager(QObject *parent = nullptr);
|
||||
@ -82,11 +80,9 @@ private:
|
||||
void manageItem(DockItem *item);
|
||||
void pluginItemInserted(PluginsItem *item);
|
||||
|
||||
#ifdef USE_AM
|
||||
void updateMultiItems(AppItem *appItem, bool emitSignal = false);
|
||||
bool multiWindowExist(quint32 winId) const;
|
||||
bool needRemoveMultiWindow(AppMultiItem *multiItem) const;
|
||||
#endif
|
||||
|
||||
private:
|
||||
DockInter *m_appInter;
|
||||
|
@ -42,9 +42,6 @@ void RecentAppHelper::setDisplayMode(Dock::DisplayMode displayMode)
|
||||
{
|
||||
bool lastVisible = dockAppIsVisible();
|
||||
m_displayMode = displayMode;
|
||||
#ifndef USE_AM
|
||||
resetDockItems();
|
||||
#endif
|
||||
updateRecentVisible();
|
||||
updateDockAppVisible(lastVisible);
|
||||
}
|
||||
@ -52,35 +49,7 @@ void RecentAppHelper::setDisplayMode(Dock::DisplayMode displayMode)
|
||||
// 当在应用区域调整位置的时候,需要重新设置索引
|
||||
void RecentAppHelper::resetAppInfo()
|
||||
{
|
||||
#ifndef USE_AM
|
||||
// 获取应用区域和最近打开区域的app图标
|
||||
QList<AppItem *> appDockItem = appItems(m_appWidget);
|
||||
|
||||
// 获取应用区域图标在原来列表中的位置
|
||||
QList<int> dockIndex;
|
||||
for (DockItem *appItem : appDockItem)
|
||||
dockIndex << m_sequentDockItems.indexOf(appItem);
|
||||
|
||||
// 按照从小到大排序
|
||||
std::sort(dockIndex.begin(), dockIndex.end(), [ = ](int index1, int index2) { return index1 < index2; });
|
||||
QMap<DockItem *, int> dockItemIndex;
|
||||
for (int i = 0; i < appDockItem.size(); i++) {
|
||||
DockItem *item = appDockItem[i];
|
||||
dockItemIndex[item] = dockIndex[i];
|
||||
}
|
||||
|
||||
// 替换原来的位置
|
||||
for (DockItem *appItem : appDockItem) {
|
||||
int index = -1;
|
||||
if (dockItemIndex.contains(appItem))
|
||||
index = dockItemIndex.value(appItem);
|
||||
|
||||
if (index >= 0)
|
||||
m_sequentDockItems[index] = appItem;
|
||||
else
|
||||
m_sequentDockItems << appItem;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void RecentAppHelper::addAppItem(int index, DockItem *dockItem)
|
||||
@ -96,21 +65,7 @@ void RecentAppHelper::addAppItem(int index, DockItem *dockItem)
|
||||
|
||||
AppItem *appItem = qobject_cast<AppItem *>(dockItem);
|
||||
|
||||
#ifdef USE_AM
|
||||
connect(appItem, &AppItem::modeChanged, this, &RecentAppHelper::onModeChanged);
|
||||
#else
|
||||
connect(dockItem, &QWidget::destroyed, this, [ this, dockItem ] {
|
||||
if (m_sequentDockItems.contains(dockItem))
|
||||
m_sequentDockItems.removeOne(dockItem);
|
||||
});
|
||||
connect(appItem, &AppItem::isDockChanged, this, &RecentAppHelper::onItemChanged);
|
||||
|
||||
// 如果索引值大于0,说明它是插入到固定位置的,否则,则认为它是顺序排列的
|
||||
if (index >= 0 && index < m_sequentDockItems.size())
|
||||
m_sequentDockItems.insert(index, dockItem);
|
||||
else
|
||||
m_sequentDockItems << dockItem;
|
||||
#endif
|
||||
}
|
||||
|
||||
void RecentAppHelper::removeAppItem(DockItem *dockItem)
|
||||
@ -119,10 +74,6 @@ void RecentAppHelper::removeAppItem(DockItem *dockItem)
|
||||
removeRecentAreaItem(dockItem);
|
||||
else
|
||||
removeAppAreaItem(dockItem);
|
||||
#ifndef USE_AM
|
||||
AppItem *appItem = qobject_cast<AppItem *>(dockItem);
|
||||
disconnect(appItem, &AppItem::isDockChanged, this, &RecentAppHelper::onItemChanged);
|
||||
#endif
|
||||
}
|
||||
|
||||
bool RecentAppHelper::recentIsVisible() const
|
||||
@ -159,7 +110,6 @@ bool RecentAppHelper::eventFilter(QObject *watched, QEvent *event)
|
||||
return QObject::eventFilter(watched, event);
|
||||
}
|
||||
|
||||
#ifdef USE_AM
|
||||
void RecentAppHelper::onModeChanged(int mode)
|
||||
{
|
||||
AppItem *appItem = qobject_cast<AppItem *>(sender());
|
||||
@ -182,32 +132,14 @@ void RecentAppHelper::onModeChanged(int mode)
|
||||
}
|
||||
updateRecentVisible();
|
||||
}
|
||||
#else
|
||||
void RecentAppHelper::onItemChanged()
|
||||
{
|
||||
bool lastVisible = dockAppIsVisible();
|
||||
resetDockItems();
|
||||
updateRecentVisible();
|
||||
updateDockAppVisible(lastVisible);
|
||||
}
|
||||
#endif
|
||||
|
||||
bool RecentAppHelper::appInRecent(DockItem *item) const
|
||||
{
|
||||
#ifdef USE_AM
|
||||
AppItem *appItem = qobject_cast<AppItem *>(item);
|
||||
if (!appItem)
|
||||
return false;
|
||||
|
||||
return (appItem->mode() == ENTRY_RECENT);
|
||||
#else
|
||||
// 先判断当前是否为时尚模式,只有时尚模式下才支持最近打开的应用
|
||||
if (m_displayMode != Dock::DisplayMode::Fashion)
|
||||
return false;
|
||||
// 只有当应用没有固定到任务栏上才认为它是最新打开的应用
|
||||
AppItem *appItem = qobject_cast<AppItem *>(item);
|
||||
return (appItem && !appItem->isDocked());
|
||||
#endif
|
||||
}
|
||||
|
||||
void RecentAppHelper::addAppAreaItem(int index, DockItem *wdg)
|
||||
@ -265,112 +197,6 @@ void RecentAppHelper::removeAppAreaItem(DockItem *wdg)
|
||||
updateDockAppVisible(lastVisible);
|
||||
}
|
||||
|
||||
#ifndef USE_AM
|
||||
QList<DockItem *> RecentAppHelper::dockItemToAppArea() const
|
||||
{
|
||||
QList<DockItem *> dockItems;
|
||||
if (m_displayMode == Dock::DisplayMode::Efficient) {
|
||||
// 由特效模式变成高效模式,将所有的最近打开的应用移动到左侧的应用区域
|
||||
for (int i = 0; i < m_recentWidget->layout()->count(); i++) {
|
||||
DockItem *appItem = qobject_cast<DockItem *>(m_recentWidget->layout()->itemAt(i)->widget());
|
||||
if (!appItem)
|
||||
continue;
|
||||
|
||||
dockItems << appItem;
|
||||
}
|
||||
} else {
|
||||
// 如果是特效模式下,则查找所有已驻留的应用,将其移动到应用区域
|
||||
for (int i = 0; i < m_recentWidget->layout()->count(); i++) {
|
||||
DockItem *appItem = qobject_cast<DockItem *>(m_recentWidget->layout()->itemAt(i)->widget());
|
||||
if (!appItem || appInRecent(appItem))
|
||||
continue;
|
||||
|
||||
dockItems << appItem;
|
||||
}
|
||||
}
|
||||
|
||||
return dockItems;
|
||||
}
|
||||
|
||||
void RecentAppHelper::resetDockItems()
|
||||
{
|
||||
// 先将所有的最近打开的区域移动到应用区域
|
||||
QList<DockItem *> recentAppItems = dockItemToAppArea();
|
||||
|
||||
// 从最近使用应用中移除
|
||||
for (DockItem *appItem : recentAppItems)
|
||||
m_recentWidget->layout()->removeWidget(appItem);
|
||||
|
||||
// 将这些图标添加到应用区域
|
||||
QBoxLayout *boxLayout = static_cast<QBoxLayout *>(m_appWidget->layout());
|
||||
for (DockItem *appItem : recentAppItems) {
|
||||
int index = getDockItemIndex(appItem, false);
|
||||
if (index >= 0)
|
||||
boxLayout->insertWidget(index, appItem);
|
||||
else
|
||||
boxLayout->addWidget(appItem);
|
||||
}
|
||||
|
||||
if (m_displayMode == Dock::DisplayMode::Fashion) {
|
||||
// 由高效模式变成特效模式后,将左侧未驻留的应用移动到右侧的最近打开应用中
|
||||
QList<DockItem *> unDockItems;
|
||||
for (int i = 0; i < m_appWidget->layout()->count() ; i++) {
|
||||
DockItem *appItem = qobject_cast<DockItem *>(m_appWidget->layout()->itemAt(i)->widget());
|
||||
if (!appInRecent(appItem))
|
||||
continue;
|
||||
|
||||
unDockItems << appItem;
|
||||
}
|
||||
|
||||
// 从应用区域中删除未驻留的应用
|
||||
for (DockItem *appItem : unDockItems)
|
||||
m_appWidget->layout()->removeWidget(appItem);
|
||||
|
||||
// 将这些图标添加到最近打开区域
|
||||
QBoxLayout *recentLayout = static_cast<QBoxLayout *>(m_recentWidget->layout());
|
||||
for (DockItem *appItem : unDockItems) {
|
||||
int index = getDockItemIndex(appItem, true);
|
||||
if (index >= 0)
|
||||
recentLayout->insertWidget(index, appItem);
|
||||
else
|
||||
recentLayout->addWidget(appItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int RecentAppHelper::getDockItemIndex(DockItem *dockItem, bool isRecent) const
|
||||
{
|
||||
// 当从最近区域移动到应用区域的时候,重新计算插入索引值
|
||||
if (!m_sequentDockItems.contains(dockItem))
|
||||
return -1;
|
||||
|
||||
QList<DockItem *> sequeDockItems = m_sequentDockItems;
|
||||
if (isRecent) {
|
||||
// 如果是最近打开区域,需要按照时间从小到大排列(先打开的排在前面)
|
||||
std::sort(sequeDockItems.begin(), sequeDockItems.end(), [](DockItem *item1, DockItem *item2) {
|
||||
AppItem *appItem1 = qobject_cast<AppItem *>(item1);
|
||||
AppItem *appItem2 = qobject_cast<AppItem *>(item2);
|
||||
if (!appItem1 || !appItem2)
|
||||
return false;
|
||||
|
||||
return appItem1->appOpenMSecs() < appItem2->appOpenMSecs();
|
||||
});
|
||||
}
|
||||
|
||||
int index = sequeDockItems.indexOf(dockItem);
|
||||
// 查找所有在应用区域的图标
|
||||
QList<AppItem *> dockApps = appItems(isRecent ? m_recentWidget : m_appWidget);
|
||||
for (int i = index + 1; i < sequeDockItems.size(); i++) {
|
||||
DockItem *item = sequeDockItems[i];
|
||||
int itemIndex = dockApps.indexOf(static_cast<AppItem *>(item));
|
||||
if (itemIndex >= 0)
|
||||
return itemIndex;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
|
||||
int RecentAppHelper::getEntryIndex(DockItem *dockItem, QWidget *widget) const
|
||||
{
|
||||
AppItem *appItem = qobject_cast<AppItem *>(dockItem);
|
||||
|
@ -66,27 +66,16 @@ private:
|
||||
void removeRecentAreaItem(DockItem *wdg);
|
||||
void removeAppAreaItem(DockItem *wdg);
|
||||
|
||||
#ifndef USE_AM
|
||||
QList<DockItem *> dockItemToAppArea() const;
|
||||
void resetDockItems();
|
||||
int getDockItemIndex(DockItem *dockItem, bool isRecent) const;
|
||||
#endif
|
||||
int getEntryIndex(DockItem *dockItem, QWidget *widget) const;
|
||||
|
||||
QList<AppItem *> appItems(QWidget *widget) const;
|
||||
|
||||
private Q_SLOTS:
|
||||
#ifdef USE_AM
|
||||
void onModeChanged(int mode);
|
||||
#else
|
||||
void onItemChanged();
|
||||
#endif
|
||||
|
||||
private:
|
||||
QWidget *m_appWidget;
|
||||
QWidget *m_recentWidget;
|
||||
#ifndef USE_AM
|
||||
QList<DockItem *> m_sequentDockItems;
|
||||
#endif
|
||||
Dock::DisplayMode m_displayMode;
|
||||
DockInter *m_dockInter;
|
||||
};
|
||||
|
@ -1,28 +0,0 @@
|
||||
/*
|
||||
* This file was generated by qdbusxml2cpp version 0.8
|
||||
* Command line was: qdbusxml2cpp -c DBusClientManager -p dbusclientmanager dde-dock-ClientManager.xml
|
||||
*
|
||||
* qdbusxml2cpp is Copyright (C) 2015 Digia Plc and/or its subsidiary(-ies).
|
||||
*
|
||||
* This is an auto-generated file.
|
||||
* This file may have been hand-edited. Look for HAND-EDIT comments
|
||||
* before re-generating it.
|
||||
*/
|
||||
|
||||
#include "dbusclientmanager.h"
|
||||
|
||||
/*
|
||||
* Implementation of interface class DBusClientManager
|
||||
*/
|
||||
|
||||
DBusClientManager::DBusClientManager(QObject *parent)
|
||||
: QDBusAbstractInterface("com.deepin.daemon.Dock", "/dde/dock/ClientManager", staticInterfaceName(), QDBusConnection::sessionBus(), parent)
|
||||
{
|
||||
QDBusConnection::sessionBus().connect(this->service(), this->path(), "org.freedesktop.DBus.Properties", "PropertiesChanged","sa{sv}as", this, SLOT(__propertyChanged__(QDBusMessage)));
|
||||
}
|
||||
|
||||
DBusClientManager::~DBusClientManager()
|
||||
{
|
||||
QDBusConnection::sessionBus().disconnect(service(), path(), "org.freedesktop.DBus.Properties", "PropertiesChanged", "sa{sv}as", this, SLOT(propertyChanged(QDBusMessage)));
|
||||
}
|
||||
|
@ -1,89 +0,0 @@
|
||||
/*
|
||||
* This file was generated by qdbusxml2cpp version 0.8
|
||||
* Command line was: qdbusxml2cpp -c DBusClientManager -p dbusclientmanager dde-dock-ClientManager.xml
|
||||
*
|
||||
* qdbusxml2cpp is Copyright (C) 2015 Digia Plc and/or its subsidiary(-ies).
|
||||
*
|
||||
* This is an auto-generated file.
|
||||
* Do not edit! All changes made to it will be lost.
|
||||
*/
|
||||
|
||||
#ifndef DBUSCLIENTMANAGER_H_1465195317
|
||||
#define DBUSCLIENTMANAGER_H_1465195317
|
||||
|
||||
#include <QtCore/QObject>
|
||||
#include <QtCore/QByteArray>
|
||||
#include <QtCore/QList>
|
||||
#include <QtCore/QMap>
|
||||
#include <QtCore/QString>
|
||||
#include <QtCore/QStringList>
|
||||
#include <QtCore/QVariant>
|
||||
#include <QtDBus/QtDBus>
|
||||
|
||||
/*
|
||||
* Proxy class for interface dde.dock.ClientManager
|
||||
*/
|
||||
class DBusClientManager: public QDBusAbstractInterface
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
Q_SLOT void __propertyChanged__(const QDBusMessage& msg)
|
||||
{
|
||||
QList<QVariant> arguments = msg.arguments();
|
||||
if (3 != arguments.count())
|
||||
return;
|
||||
QString interfaceName = msg.arguments().at(0).toString();
|
||||
if (interfaceName !="dde.dock.ClientManager")
|
||||
return;
|
||||
QVariantMap changedProps = qdbus_cast<QVariantMap>(arguments.at(1).value<QDBusArgument>());
|
||||
foreach(const QString &prop, changedProps.keys()) {
|
||||
const QMetaObject* self = metaObject();
|
||||
for (int i=self->propertyOffset(); i < self->propertyCount(); ++i) {
|
||||
QMetaProperty p = self->property(i);
|
||||
if (p.name() == prop) {
|
||||
Q_EMIT p.notifySignal().invoke(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
public:
|
||||
static inline const char *staticInterfaceName()
|
||||
{ return "dde.dock.ClientManager"; }
|
||||
|
||||
public:
|
||||
explicit DBusClientManager(QObject *parent = 0);
|
||||
|
||||
~DBusClientManager();
|
||||
|
||||
public Q_SLOTS: // METHODS
|
||||
inline QDBusPendingReply<bool> ActivateWindow(uint in0)
|
||||
{
|
||||
QList<QVariant> argumentList;
|
||||
argumentList << QVariant::fromValue(in0);
|
||||
return asyncCallWithArgumentList(QStringLiteral("ActivateWindow"), argumentList);
|
||||
}
|
||||
|
||||
inline QDBusPendingReply<bool> CloseWindow(uint in0)
|
||||
{
|
||||
QList<QVariant> argumentList;
|
||||
argumentList << QVariant::fromValue(in0);
|
||||
return asyncCallWithArgumentList(QStringLiteral("CloseWindow"), argumentList);
|
||||
}
|
||||
|
||||
inline QDBusPendingReply<uint> CurrentActiveWindow()
|
||||
{
|
||||
QList<QVariant> argumentList;
|
||||
return asyncCallWithArgumentList(QStringLiteral("CurrentActiveWindow"), argumentList);
|
||||
}
|
||||
|
||||
Q_SIGNALS: // SIGNALS
|
||||
void ActiveWindowChanged(uint activeWinId);
|
||||
// begin property changed signals
|
||||
};
|
||||
|
||||
namespace dde {
|
||||
namespace dock {
|
||||
typedef ::DBusClientManager ClientManager;
|
||||
}
|
||||
}
|
||||
#endif
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file was generated by qdbusxml2cpp version 0.8
|
||||
* Command line was: qdbusxml2cpp -p DBusDisplay -c DBusDisplay com.deepin.daemon.Display.xml
|
||||
* Command line was: qdbusxml2cpp -p DBusDisplay -c DBusDisplay org.deepin.dde.Display1.xml
|
||||
*
|
||||
* qdbusxml2cpp is Copyright (C) 2015 Digia Plc and/or its subsidiary(-ies).
|
||||
*
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file was generated by qdbusxml2cpp version 0.8
|
||||
* Command line was: qdbusxml2cpp -p DBusDisplay -c DBusDisplay com.deepin.daemon.Display.xml
|
||||
* Command line was: qdbusxml2cpp -p DBusDisplay -c DBusDisplay org.deepin.dde.Display1.xml
|
||||
*
|
||||
* qdbusxml2cpp is Copyright (C) 2015 Digia Plc and/or its subsidiary(-ies).
|
||||
*
|
||||
@ -44,7 +44,7 @@ const QDBusArgument &operator>>(const QDBusArgument &argument, DisplayRect &rect
|
||||
QDebug operator<<(QDebug deg, const DisplayRect &rect);
|
||||
|
||||
/*
|
||||
* Proxy class for interface com.deepin.daemon.Display
|
||||
* Proxy class for interface org.deepin.dde.Display1
|
||||
*/
|
||||
class DBusDisplay: public QDBusAbstractInterface
|
||||
{
|
||||
@ -56,7 +56,7 @@ class DBusDisplay: public QDBusAbstractInterface
|
||||
if (3 != arguments.count())
|
||||
return;
|
||||
QString interfaceName = msg.arguments().at(0).toString();
|
||||
if (interfaceName !="com.deepin.daemon.Display")
|
||||
if (interfaceName !="org.deepin.dde.Display1")
|
||||
return;
|
||||
QVariantMap changedProps = qdbus_cast<QVariantMap>(arguments.at(1).value<QDBusArgument>());
|
||||
QStringList keys = changedProps.keys();
|
||||
@ -72,11 +72,11 @@ class DBusDisplay: public QDBusAbstractInterface
|
||||
}
|
||||
public:
|
||||
static inline const char *staticInterfaceName()
|
||||
{ return "com.deepin.daemon.Display"; }
|
||||
{ return "org.deepin.dde.Display1"; }
|
||||
static inline const char *staticServiceName()
|
||||
{ return "com.deepin.daemon.Display"; }
|
||||
{ return "org.deepin.dde.Display1"; }
|
||||
static inline const char *staticObjectPath()
|
||||
{ return "/com/deepin/daemon/Display"; }
|
||||
{ return "/org/deepin/dde/Display1"; }
|
||||
|
||||
public:
|
||||
explicit DBusDisplay(QObject *parent = 0);
|
||||
|
@ -28,7 +28,7 @@
|
||||
#include <QDBusArgument>
|
||||
|
||||
/*
|
||||
* Adaptor class for interface com.deepin.dde.Dock
|
||||
* Adaptor class for interface org.deepin.dde.Dock1
|
||||
*/
|
||||
class QGSettings;
|
||||
class WindowManager;
|
||||
@ -60,9 +60,9 @@ void registerPluginInfoMetaType();
|
||||
class DBusDockAdaptors: public QDBusAbstractAdaptor
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_CLASSINFO("D-Bus Interface", "com.deepin.dde.Dock")
|
||||
Q_CLASSINFO("D-Bus Interface", "org.deepin.dde.Dock1")
|
||||
Q_CLASSINFO("D-Bus Introspection", ""
|
||||
" <interface name=\"com.deepin.dde.Dock\">\n"
|
||||
" <interface name=\"org.deepin.dde.Dock1\">\n"
|
||||
" <property access=\"read\" type=\"(iiii)\" name=\"geometry\"/>\n"
|
||||
" <property access=\"readwrite\" type=\"b\" name=\"showInPrimary\"/>\n"
|
||||
" <method name=\"callShow\"/>"
|
||||
|
@ -21,9 +21,8 @@
|
||||
|
||||
#include "dockinterface.h"
|
||||
|
||||
#include "com_deepin_dde_daemon_dock.h"
|
||||
#include "org_deepin_dde_daemon_dock1.h"
|
||||
|
||||
#ifdef USE_AM
|
||||
// 因为 types/dockrect.h 文件中定义了DockRect类,而在此处也定义了DockRect,
|
||||
// 所以在此处先加上DOCKRECT_H宏(types/dockrect.h文件中定义的宏)来禁止包含types/dockrect.h头文件
|
||||
// 否则会出现重复定义的错误
|
||||
@ -61,7 +60,7 @@ public:
|
||||
|
||||
// 窗管中提供的ActiveWindow接口,MinimizeWindow目前还在开发过程中,因此,关于这两个接口暂时使用v23的后端接口
|
||||
// 等窗管完成了这几个接口后,删除此处v20的接口,改成v23提供的新接口即可
|
||||
using DockInter = com::deepin::dde::daemon::Dock;
|
||||
using DockInter = org::deepin::dde::daemon::Dock1;
|
||||
/**
|
||||
* @brief 任务栏的部分DBUS接口是通过窗管获取的,由于AM后端并未提供窗管的相关接口,因此,
|
||||
* 此处先将窗管的接口集成进来,作为私有类,只提供任务栏接口使用
|
||||
@ -106,7 +105,7 @@ private:
|
||||
|
||||
WM::WM(const QString &service, const QString &path, const QDBusConnection &connection, QObject *parent)
|
||||
: QDBusAbstractInterface(service, path, staticInterfaceName(), connection, parent)
|
||||
, m_dockInter(new DockInter("com.deepin.dde.daemon.Dock", "/com/deepin/dde/daemon/Dock", QDBusConnection::sessionBus(), this))
|
||||
, m_dockInter(new DockInter("org.deepin.dde.daemon.Dock1", "/org/deepin/dde/daemon/Dock1", QDBusConnection::sessionBus(), this))
|
||||
{
|
||||
}
|
||||
|
||||
@ -337,6 +336,4 @@ void Dde_Dock::onPendingCallFinished(QDBusPendingCallWatcher *w)
|
||||
|
||||
const auto args = d_ptr->m_waittingCalls.take(callName);
|
||||
CallQueued(callName, args);
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
@ -22,8 +22,6 @@
|
||||
#ifndef DOCK_INTERFACE
|
||||
#define DOCK_INTERFACE
|
||||
|
||||
#ifdef USE_AM
|
||||
|
||||
#include "types/dockrect.h"
|
||||
|
||||
#include <QObject>
|
||||
@ -36,7 +34,7 @@
|
||||
#include <QtDBus>
|
||||
|
||||
/*
|
||||
* Proxy class for interface com.deepin.dde.daemon.Dock
|
||||
* Proxy class for interface org.deepin.dde.daemon.Dock1
|
||||
*/
|
||||
class DockPrivate;
|
||||
class WM;
|
||||
@ -336,6 +334,5 @@ namespace org {
|
||||
}
|
||||
}
|
||||
|
||||
#endif // USE_AM
|
||||
|
||||
#endif // DOCK_INTERFACE
|
||||
|
@ -24,9 +24,6 @@
|
||||
/*
|
||||
* Implementation of interface class __Entry
|
||||
*/
|
||||
|
||||
#ifdef USE_AM
|
||||
|
||||
void registerWindowListMetaType()
|
||||
{
|
||||
qRegisterMetaType<WindowList>();
|
||||
@ -296,5 +293,3 @@ void Dock_Entry::onPendingCallFinished(QDBusPendingCallWatcher *w)
|
||||
const auto args = d_ptr->m_waittingCalls.take(callName);
|
||||
CallQueued(callName, args);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -22,8 +22,6 @@
|
||||
#ifndef DOCK_ENTRY_H
|
||||
#define DOCK_ENTRY_H
|
||||
|
||||
#ifdef USE_AM
|
||||
|
||||
#define WINDOWLIST_H
|
||||
#define WINDOWINFOLIST_H
|
||||
|
||||
@ -65,7 +63,7 @@ void registerWindowInfoMetaType();
|
||||
void registerWindowInfoMapMetaType();
|
||||
|
||||
/*
|
||||
* Proxy class for interface com.deepin.dde.daemon.Dock.Entry
|
||||
* Proxy class for interface org.deepin.dde.daemon.Dock1.Entry
|
||||
*/
|
||||
class EntryPrivate;
|
||||
|
||||
@ -281,6 +279,4 @@ namespace org {
|
||||
}
|
||||
}
|
||||
|
||||
#endif // USE_AM
|
||||
|
||||
#endif // DOCK_ENTRY_H
|
||||
|
@ -1,4 +1,4 @@
|
||||
<interface name="com.deepin.dde.daemon.Dock">
|
||||
<interface name="org.deepin.dde.daemon.Dock1">
|
||||
<method name="ActivateWindow">
|
||||
<arg type="u" direction="in"></arg>
|
||||
</method>
|
@ -1,4 +1,4 @@
|
||||
<interface name="org.deepin.daemon.Audio1.Sink">
|
||||
<interface name="org.deepin.dde.Audio1.Sink">
|
||||
<method name="GetMeter">
|
||||
<arg type="o" direction="out"/>
|
||||
</method>
|
@ -1,4 +1,4 @@
|
||||
<interface name="org.deepin.daemon.Audio1">
|
||||
<interface name="org.deepin.dde.Audio1">
|
||||
<method name="Reset"/>
|
||||
<method name="SetDefaultSink">
|
||||
<arg type="s" direction="in"/>
|
@ -1,4 +1,4 @@
|
||||
<interface name="com.deepin.daemon.Display">
|
||||
<interface name="org.deepin.dde.Display1">
|
||||
<method name="ApplyChanges"></method>
|
||||
<method name="AssociateTouch">
|
||||
<arg type="s" direction="in"></arg>
|
@ -1,4 +1,4 @@
|
||||
<interface name="com.deepin.daemon.Gesture1">
|
||||
<interface name="org.deepin.dde.Gesture1">
|
||||
<signal name="TouchSinglePressTimeout">
|
||||
<arg name="time" type="i"></arg>
|
||||
<arg name="scalex" type="d"></arg>
|
@ -1,4 +1,4 @@
|
||||
<interface name="org.deepin.daemon.Timedate1">
|
||||
<interface name="org.deepin.dde.Timedate1">
|
||||
<signal name="TimeUpdate">
|
||||
</signal>
|
||||
<method name="AddUserTimezone">
|
@ -1,4 +1,4 @@
|
||||
<interface name="org.deepin.api.XEventMonitor1">
|
||||
<interface name="org.deepin.dde.XEventMonitor1">
|
||||
<method name="RegisterArea">
|
||||
<arg type="i" direction="in"/>
|
||||
<arg type="i" direction="in"/>
|
@ -1,4 +1,4 @@
|
||||
<interface name="com.deepin.dde.daemon.Dock">
|
||||
<interface name="org.deepin.dde.daemon.Dock1">
|
||||
<method name="ActivateWindow">
|
||||
<arg type="u" direction="in"/>
|
||||
</method>
|
@ -26,9 +26,9 @@
|
||||
|
||||
#include "singleton.h"
|
||||
#include "constants.h"
|
||||
#include "org_deepin_daemon_display.h"
|
||||
#include "org_deepin_dde_display1.h"
|
||||
|
||||
using DisplayInter = com::deepin::daemon::Display;
|
||||
using DisplayInter = org::deepin::dde::Display1;
|
||||
using namespace Dock;
|
||||
|
||||
class QScreen;
|
||||
|
@ -97,11 +97,7 @@ AppItem::AppItem(DockInter *dockInter, const QGSettings *appSettings, const QGSe
|
||||
connect(m_itemEntryInter, &DockEntryInter::IsActiveChanged, this, static_cast<void (AppItem::*)()>(&AppItem::update));
|
||||
connect(m_itemEntryInter, &DockEntryInter::WindowInfosChanged, this, &AppItem::updateWindowInfos, Qt::QueuedConnection);
|
||||
connect(m_itemEntryInter, &DockEntryInter::IconChanged, this, &AppItem::refreshIcon);
|
||||
#ifdef USE_AM
|
||||
connect(m_itemEntryInter, &DockEntryInter::ModeChanged, this, &AppItem::modeChanged);
|
||||
#else
|
||||
connect(m_itemEntryInter, &DockEntryInter::IsDockedChanged, this, &AppItem::isDockChanged);
|
||||
#endif
|
||||
connect(m_updateIconGeometryTimer, &QTimer::timeout, this, &AppItem::updateWindowIconGeometries, Qt::QueuedConnection);
|
||||
connect(m_retryObtainIconTimer, &QTimer::timeout, this, &AppItem::refreshIcon, Qt::QueuedConnection);
|
||||
|
||||
@ -216,13 +212,11 @@ bool AppItem::splitWindowOnScreen(ScreenSpliter::SplitDirection direction)
|
||||
return m_screenSpliter->split(direction);
|
||||
}
|
||||
|
||||
#ifdef USE_AM
|
||||
int AppItem::mode() const
|
||||
{
|
||||
return m_itemEntryInter->mode();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
DockEntryInter *AppItem::itemEntryInter() const
|
||||
{
|
||||
@ -296,9 +290,7 @@ void AppItem::paintEvent(QPaintEvent *e)
|
||||
path.addRoundedRect(backgroundRect, 8, 8);
|
||||
|
||||
// 在没有开启窗口多开的情况下,显示背景色
|
||||
#ifdef USE_AM
|
||||
if (!m_dockInter->showMultiWindow()) {
|
||||
#endif
|
||||
if (m_active) {
|
||||
QColor color = Qt::black;
|
||||
color.setAlpha(255 * 0.8);
|
||||
@ -312,9 +304,7 @@ void AppItem::paintEvent(QPaintEvent *e)
|
||||
painter.fillPath(path, color);
|
||||
}
|
||||
}
|
||||
#ifdef USE_AM
|
||||
}
|
||||
#endif
|
||||
} else {
|
||||
if (!m_windowInfos.isEmpty()) {
|
||||
QPoint p;
|
||||
@ -407,21 +397,17 @@ void AppItem::mouseReleaseEvent(QMouseEvent *e)
|
||||
qDebug() << "app item clicked, name:" << m_itemEntryInter->name()
|
||||
<< "id:" << m_itemEntryInter->id() << "my-id:" << m_id << "icon:" << m_itemEntryInter->icon();
|
||||
|
||||
#ifdef USE_AM
|
||||
if (m_dockInter->showMultiWindow()) {
|
||||
// 如果开启了多窗口显示,则直接新建一个窗口
|
||||
m_itemEntryInter->NewInstance(QX11Info::getTimestamp());
|
||||
} else {
|
||||
#endif
|
||||
// 如果没有开启新窗口显示,则
|
||||
m_itemEntryInter->Activate(QX11Info::getTimestamp());
|
||||
// play launch effect
|
||||
if (m_windowInfos.isEmpty() && DGuiApplicationHelper::isSpecialEffectsEnvironment())
|
||||
playSwingEffect();
|
||||
}
|
||||
#ifdef USE_AM
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void AppItem::mousePressEvent(QMouseEvent *e)
|
||||
|
@ -26,7 +26,6 @@
|
||||
#include "dockitem.h"
|
||||
#include "previewcontainer.h"
|
||||
#include "appdrag.h"
|
||||
#include "dbusclientmanager.h"
|
||||
#include "../widgets/tipswidget.h"
|
||||
#include "dbusutil.h"
|
||||
|
||||
@ -59,9 +58,7 @@ public:
|
||||
void startSplit(const QRect &rect);
|
||||
bool supportSplitWindow();
|
||||
bool splitWindowOnScreen(ScreenSpliter::SplitDirection direction);
|
||||
#ifdef USE_AM
|
||||
int mode() const;
|
||||
#endif
|
||||
DockEntryInter *itemEntryInter() const;
|
||||
inline ItemType itemType() const override { return App; }
|
||||
QPixmap appIcon(){ return m_appIcon; }
|
||||
@ -80,11 +77,7 @@ signals:
|
||||
|
||||
void requestUpdateEntryGeometries() const;
|
||||
void windowCountChanged() const;
|
||||
#ifdef USE_AM
|
||||
void modeChanged(int) const;
|
||||
#else
|
||||
void isDockChanged(bool) const;
|
||||
#endif
|
||||
|
||||
private:
|
||||
void moveEvent(QMoveEvent *e) override;
|
||||
|
@ -90,9 +90,7 @@ void AppMultiItem::initConnection()
|
||||
|
||||
void AppMultiItem::onOpen()
|
||||
{
|
||||
#ifdef USE_AM
|
||||
m_entryInter->ActiveWindow(m_winId);
|
||||
#endif
|
||||
}
|
||||
|
||||
void AppMultiItem::onCurrentWindowChanged(uint32_t value)
|
||||
@ -152,9 +150,7 @@ void AppMultiItem::paintEvent(QPaintEvent *)
|
||||
void AppMultiItem::mouseReleaseEvent(QMouseEvent *event)
|
||||
{
|
||||
if (event->button() == Qt::LeftButton) {
|
||||
#ifdef USE_AM
|
||||
m_entryInter->ActiveWindow(m_winId);
|
||||
#endif
|
||||
} else {
|
||||
QPoint currentPoint = QCursor::pos();
|
||||
m_menu->exec(currentPoint);
|
||||
|
@ -24,13 +24,13 @@
|
||||
#include "utils.h"
|
||||
#include "displaymanager.h"
|
||||
|
||||
#include "org_deepin_api_xeventmonitor.h"
|
||||
#include "org_deepin_dde_xeventmonitor1.h"
|
||||
|
||||
#define SPLIT_NONE 0
|
||||
#define SPLIT_LEFT 1
|
||||
#define SPLIT_RIGHT 2
|
||||
|
||||
using XEventMonitor = ::org::deepin::api::XEventMonitor1;
|
||||
using XEventMonitor = ::org::deepin::dde::XEventMonitor1;
|
||||
|
||||
AppDragWidget::AppDragWidget(QWidget *parent)
|
||||
: QGraphicsView(parent)
|
||||
|
@ -241,8 +241,8 @@ int main(int argc, char *argv[])
|
||||
// 注册任务栏的DBus服务
|
||||
DBusDockAdaptors adaptor(&windowManager);
|
||||
|
||||
QDBusConnection::sessionBus().registerService("com.deepin.dde.Dock");
|
||||
QDBusConnection::sessionBus().registerObject("/com/deepin/dde/Dock", "com.deepin.dde.Dock", &windowManager);
|
||||
QDBusConnection::sessionBus().registerService("org.deepin.dde.Dock1");
|
||||
QDBusConnection::sessionBus().registerObject("/org/deepin/dde/Dock1", "org.deepin.dde.Dock1", &windowManager);
|
||||
|
||||
// 当任务栏以-r参数启动时,设置CANSHOW未false,之后调用launch不显示任务栏
|
||||
qApp->setProperty("CANSHOW", !parser.isSet(runOption));
|
||||
|
@ -21,20 +21,14 @@
|
||||
#ifndef DBUSUTIL_H
|
||||
#define DBUSUTIL_H
|
||||
|
||||
#ifdef USE_AM
|
||||
#include "dockinterface.h"
|
||||
#include "entryinterface.h"
|
||||
#else
|
||||
#include <com_deepin_dde_daemon_dock.h>
|
||||
#include <com_deepin_dde_daemon_dock_entry.h>
|
||||
#endif
|
||||
|
||||
#ifdef USE_AM
|
||||
using DockInter = org::deepin::dde::daemon::DdeDock;
|
||||
using DockEntryInter = org::deepin::dde::daemon::dock::DockEntry;
|
||||
|
||||
const QString xEventMonitorService = "org.deepin.api.XEventMonitor1";
|
||||
const QString xEventMonitorPath = "/org/deepin/api/XEventMonitor1";
|
||||
const QString xEventMonitorService = "org.deepin.dde.XEventMonitor1";
|
||||
const QString xEventMonitorPath = "/org/deepin/dde/XEventMonitor1";
|
||||
|
||||
const QString launcherService = "org.deepin.dde.Launcher1";
|
||||
const QString launcherPath = "/org/deepin/dde/Launcher1";
|
||||
@ -44,53 +38,22 @@ const QString controllCenterService = "org.deepin.dde.ControlCenter1";
|
||||
const QString controllCenterPath = "/org/deepin/dde/ControlCenter1";
|
||||
const QString controllCenterInterface = "org.deepin.dde.ControlCenter1";
|
||||
|
||||
const QString notificationService = "com.deepin.dde.Notification";
|
||||
const QString notificationPath = "/com/deepin/dde/Notification";
|
||||
const QString notificationInterface = "com.deepin.dde.Notification";
|
||||
const QString notificationService = "org.deepin.dde.Notification1";
|
||||
const QString notificationPath = "/org/deepin/dde/Notification1";
|
||||
const QString notificationInterface = "org.deepin.dde.Notification1";
|
||||
|
||||
const QString sessionManagerService = "com.deepin.SessionManager";
|
||||
const QString sessionManagerPath = "/com/deepin/SessionManager";
|
||||
const QString sessionManagerInterface = "com.deepin.SessionManager";
|
||||
#else
|
||||
using DockInter = com::deepin::dde::daemon::Dock;
|
||||
using DockEntryInter = com::deepin::dde::daemon::dock::Entry;
|
||||
|
||||
const QString xEventMonitorService = "com.deepin.api.XEventMonitor";
|
||||
const QString xEventMonitorPath = "/com/deepin/api/XEventMonitor";
|
||||
|
||||
const QString launcherService = "com.deepin.dde.Launcher";
|
||||
const QString launcherPath = "/com/deepin/dde/Launcher";
|
||||
const QString launcherInterface = "com.deepin.dde.Launcher";
|
||||
|
||||
const QString controllCenterService = "com.deepin.dde.ControlCenter";
|
||||
const QString controllCenterPath = "/com/deepin/dde/ControlCenter";
|
||||
const QString controllCenterInterface = "com.deepin.dde.ControlCenter";
|
||||
|
||||
const QString notificationService = "com.deepin.dde.Notification";
|
||||
const QString notificationPath = "/com/deepin/dde/Notification";
|
||||
const QString notificationInterface = "com.deepin.dde.Notification";
|
||||
|
||||
const QString sessionManagerService = "com.deepin.SessionManager";
|
||||
const QString sessionManagerPath = "/com/deepin/SessionManager";
|
||||
const QString sessionManagerInterface = "com.deepin.SessionManager";
|
||||
#endif
|
||||
const QString sessionManagerService = "org.deepin.dde.SessionManager1";
|
||||
const QString sessionManagerPath = "/org/deepin/dde/SessionManager1";
|
||||
const QString sessionManagerInterface = "org.deepin.dde.SessionManager1";
|
||||
|
||||
inline const QString dockServiceName()
|
||||
{
|
||||
#ifdef USE_AM
|
||||
return QString("org.deepin.dde.daemon.Dock1");
|
||||
#else
|
||||
return QString("com.deepin.dde.daemon.Dock");
|
||||
#endif
|
||||
}
|
||||
|
||||
inline const QString dockServicePath()
|
||||
{
|
||||
#ifdef USE_AM
|
||||
return QString("/org/deepin/dde/daemon/Dock1");
|
||||
#else
|
||||
return QString("/com/deepin/dde/daemon/Dock");
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif // DBUSUTIL_H
|
||||
|
@ -22,7 +22,7 @@
|
||||
#ifndef DOCKPOPUPWINDOW_H
|
||||
#define DOCKPOPUPWINDOW_H
|
||||
|
||||
#include "org_deepin_api_xeventmonitor.h"
|
||||
#include "org_deepin_dde_xeventmonitor1.h"
|
||||
|
||||
#include <darrowrectangle.h>
|
||||
#include <dregionmonitor.h>
|
||||
@ -31,7 +31,7 @@
|
||||
DWIDGET_USE_NAMESPACE
|
||||
DGUI_USE_NAMESPACE
|
||||
|
||||
using XEventMonitor = ::org::deepin::api::XEventMonitor1;
|
||||
using XEventMonitor = org::deepin::dde::XEventMonitor1;
|
||||
|
||||
class DockPopupWindow : public Dtk::Widget::DArrowRectangle
|
||||
{
|
||||
|
@ -155,21 +155,12 @@ void MenuWorker::createMenu(QMenu *settingsMenu)
|
||||
|
||||
void MenuWorker::onDockSettingsTriggered()
|
||||
{
|
||||
#ifdef USE_AM
|
||||
DDBusSender().service(controllCenterService)
|
||||
.path(controllCenterPath)
|
||||
.interface(controllCenterInterface)
|
||||
.method("ShowPage")
|
||||
.arg(QString("personalization/desktop/dock"))
|
||||
.call();
|
||||
#else
|
||||
DDBusSender().service(controllCenterService)
|
||||
.path("controllCenterPath")
|
||||
.interface(controllCenterInterface)
|
||||
.method("ShowPage")
|
||||
.arg(QString("personalization/dock"))
|
||||
.call();
|
||||
#endif
|
||||
}
|
||||
|
||||
void MenuWorker::exec()
|
||||
|
@ -113,35 +113,6 @@ void MultiScreenWorker::onAutoHideChanged(const bool autoHide)
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef USE_AM
|
||||
void MultiScreenWorker::handleDbusSignal(QDBusMessage msg)
|
||||
{
|
||||
QList<QVariant> arguments = msg.arguments();
|
||||
// 参数固定长度
|
||||
if (3 != arguments.count())
|
||||
return;
|
||||
|
||||
// 返回的数据中,这一部分对应的是数据发送方的interfacename,可判断是否是自己需要的服务
|
||||
QString interfaceName = msg.arguments().at(0).toString();
|
||||
if (interfaceName != DockInter::staticInterfaceName())
|
||||
return;
|
||||
|
||||
QVariantMap changedProps = qdbus_cast<QVariantMap>(arguments.at(1).value<QDBusArgument>());
|
||||
QStringList keys = changedProps.keys();
|
||||
foreach (const QString &prop, keys) {
|
||||
if (prop == "Position") {
|
||||
onPositionChanged(changedProps.value(prop).toInt());
|
||||
} else if (prop == "DisplayMode") {
|
||||
onDisplayModeChanged(changedProps.value(prop).toInt());
|
||||
} else if (prop == "HideMode") {
|
||||
onHideModeChanged(changedProps.value(prop).toInt());
|
||||
} else if (prop == "HideState") {
|
||||
onHideStateChanged(changedProps.value(prop).toInt());
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void MultiScreenWorker::onRegionMonitorChanged(int x, int y, const QString &key)
|
||||
{
|
||||
if (m_registerKey != key || testState(MousePress))
|
||||
@ -601,18 +572,10 @@ void MultiScreenWorker::initConnection()
|
||||
|
||||
connect(m_launcherInter, static_cast<void (DBusLuncher::*)(bool) const>(&DBusLuncher::VisibleChanged), this, [ = ](bool value) { setStates(LauncherDisplay, value); });
|
||||
|
||||
#ifdef USE_AM
|
||||
connect(m_dockInter, &DockInter::PositionChanged, this, &MultiScreenWorker::onPositionChanged);
|
||||
connect(m_dockInter, &DockInter::DisplayModeChanged, this, &MultiScreenWorker::onDisplayModeChanged);
|
||||
connect(m_dockInter, &DockInter::HideModeChanged, this, &MultiScreenWorker::onHideModeChanged);
|
||||
connect(m_dockInter, &DockInter::HideStateChanged, this, &MultiScreenWorker::onHideStateChanged);
|
||||
#else
|
||||
QDBusConnection::sessionBus().connect(dockServiceName(), dockServicePath(),
|
||||
"org.freedesktop.DBus.Properties",
|
||||
"PropertiesChanged",
|
||||
"sa{sv}as",
|
||||
this, SLOT(handleDbusSignal(QDBusMessage)));
|
||||
#endif
|
||||
|
||||
connect(this, &MultiScreenWorker::requestUpdatePosition, this, &MultiScreenWorker::onRequestUpdatePosition);
|
||||
connect(this, &MultiScreenWorker::requestUpdateMonitorInfo, this, &MultiScreenWorker::onRequestUpdateMonitorInfo);
|
||||
@ -734,7 +697,7 @@ void MultiScreenWorker::resetDockScreen()
|
||||
|
||||
/**
|
||||
* @brief checkDaemonDockService
|
||||
* 避免com.deepin.dde.daemon.Dock服务比dock晚启动,导致dock启动后的状态错误
|
||||
* org.deepin.dde.daemon.Dock1服务比dock晚启动,导致dock启动后的状态错误
|
||||
*/
|
||||
void MultiScreenWorker::checkDaemonDockService()
|
||||
{
|
||||
@ -828,7 +791,7 @@ bool MultiScreenWorker::isCursorOut(int x, int y)
|
||||
|
||||
/**
|
||||
* @brief checkDaemonXEventMonitorService
|
||||
* 避免com.deepin.api.XEventMonitor服务比dock晚启动,导致dock启动后的状态错误
|
||||
* org.deepin.dde.XEventMonitor1服务比dock晚启动,导致dock启动后的状态错误
|
||||
*/
|
||||
void MultiScreenWorker::checkXEventMonitorService()
|
||||
{
|
||||
|
@ -28,8 +28,8 @@
|
||||
#include "xcb_misc.h"
|
||||
#include "dbusutil.h"
|
||||
|
||||
#include "org_deepin_api_xeventmonitor.h"
|
||||
#include "org_deepin_dde_launcher.h"
|
||||
#include "org_deepin_dde_xeventmonitor1.h"
|
||||
#include "org_deepin_dde_launcher1.h"
|
||||
|
||||
#include <DWindowManagerHelper>
|
||||
|
||||
@ -53,7 +53,7 @@ DGUI_USE_NAMESPACE
|
||||
#define DRAG_AREA_SIZE (5)
|
||||
#define DOCKSPACE (WINDOWMARGIN * 2)
|
||||
|
||||
using XEventMonitor = ::org::deepin::api::XEventMonitor1;
|
||||
using XEventMonitor = ::org::deepin::dde::XEventMonitor1;
|
||||
using DBusLuncher = ::org::deepin::dde::Launcher1;
|
||||
|
||||
using namespace Dock;
|
||||
@ -129,10 +129,6 @@ public slots:
|
||||
void onAutoHideChanged(const bool autoHide);
|
||||
void onRequestUpdateRegionMonitor();
|
||||
|
||||
#ifndef USE_AM
|
||||
void handleDbusSignal(QDBusMessage);
|
||||
#endif
|
||||
|
||||
private slots:
|
||||
// Region Monitor
|
||||
void onRegionMonitorChanged(int x, int y, const QString &key);
|
||||
|
@ -11,7 +11,7 @@ TouchSignalManager *TouchSignalManager::m_touchManager = nullptr;
|
||||
|
||||
TouchSignalManager::TouchSignalManager(QObject *parent)
|
||||
: QObject(parent)
|
||||
, m_gestureInter(new Gesture("com.deepin.daemon.Gesture", "/com/deepin/daemon/Gesture", QDBusConnection::systemBus(), this))
|
||||
, m_gestureInter(new Gesture("org.deepin.dde.Gesture1", "/org/deepin/dde/Gesture1", QDBusConnection::systemBus(), this))
|
||||
, m_dragIconPressed(false)
|
||||
{
|
||||
// 处理后端触屏信号
|
||||
|
@ -22,11 +22,11 @@
|
||||
#ifndef TOUCHSIGNALMANAGER_H
|
||||
#define TOUCHSIGNALMANAGER_H
|
||||
|
||||
#include "org_deepin_daemon_gesture.h"
|
||||
#include "org_deepin_dde_gesture1.h"
|
||||
|
||||
#include <QObject>
|
||||
|
||||
using Gesture = com::deepin::daemon::Gesture1;
|
||||
using Gesture = org::deepin::dde::Gesture1;
|
||||
|
||||
class TouchSignalManager : public QObject
|
||||
{
|
||||
|
@ -44,7 +44,7 @@ static QMap<int, QString> timeFormat{{0, "h:mm"}, {1, "hh:mm"}};
|
||||
|
||||
DateTimeDisplayer::DateTimeDisplayer(bool showMultiRow, QWidget *parent)
|
||||
: QWidget (parent)
|
||||
, m_timedateInter(new Timedate("org.deepin.daemon.Timedate1", "/org/deepin/daemon/Timedate1", QDBusConnection::sessionBus(), this))
|
||||
, m_timedateInter(new Timedate("org.deepin.dde.Timedate1", "/org/deepin/dde/Timedate1", QDBusConnection::sessionBus(), this))
|
||||
, m_position(Dock::Position::Bottom)
|
||||
, m_dateFont(DFontSizeManager::instance()->t10())
|
||||
, m_tipsWidget(new Dock::TipsWidget(this))
|
||||
@ -156,9 +156,9 @@ void DateTimeDisplayer::mouseReleaseEvent(QMouseEvent *event)
|
||||
{
|
||||
Q_UNUSED(event);
|
||||
|
||||
DDBusSender().service("org.deepin.dde.Widgets")
|
||||
DDBusSender().service("org.deepin.dde.Widgets1")
|
||||
.path("/")
|
||||
.interface("org.deepin.dde.Widgets")
|
||||
.interface("org.deepin.dde.Widgets1")
|
||||
.method("Toggle").call();
|
||||
}
|
||||
|
||||
|
@ -23,7 +23,7 @@
|
||||
|
||||
#include "constants.h"
|
||||
|
||||
#include "org_deepin_daemon_timedate.h"
|
||||
#include "org_deepin_dde_timedate1.h"
|
||||
|
||||
#include <QWidget>
|
||||
#include <QFont>
|
||||
@ -33,7 +33,7 @@ namespace Dock { class TipsWidget; }
|
||||
class DockPopupWindow;
|
||||
class QMenu;
|
||||
|
||||
using Timedate = org::deepin::daemon::Timedate1;
|
||||
using Timedate = org::deepin::dde::Timedate1;
|
||||
|
||||
class DateTimeDisplayer : public QWidget
|
||||
{
|
||||
|
@ -319,10 +319,9 @@ void MainPanelControl::dockRecentApp(DockItem *dockItem)
|
||||
return;
|
||||
|
||||
// 如果控制中心设置不开启最近应用,则不让其驻留
|
||||
#ifdef USE_AM
|
||||
if (!m_dockInter->showRecent())
|
||||
return;
|
||||
#endif
|
||||
|
||||
// 如果控制中心开启了最近应用并且当前应用是未驻留应用,则可以驻留
|
||||
if (!appItem->isDocked())
|
||||
appItem->requestDock();
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file was generated by qdbusxml2cpp version 0.8
|
||||
* Command line was: qdbusxml2cpp -c DBusTrayManager -p dbustraymanager org.deepin.dde.TrayManager.xml
|
||||
* Command line was: qdbusxml2cpp -c DBusTrayManager -p dbustraymanager org.deepin.dde.TrayManager1.xml
|
||||
*
|
||||
* qdbusxml2cpp is Copyright (C) 2015 Digia Plc and/or its subsidiary(-ies).
|
||||
*
|
||||
|
@ -57,8 +57,8 @@ IndicatorTrayItem::IndicatorTrayItem(const QString &indicatorName, QWidget *pare
|
||||
setLayout(layout);
|
||||
|
||||
// register dbus
|
||||
auto path = QString("/com/deepin/dde/Dock/Indicator/") + m_indicatorName;
|
||||
auto interface = QString("com.deepin.dde.Dock.Indicator.") + m_indicatorName;
|
||||
auto path = QString("/org/deepin/dde/Dock1/Indicator/") + m_indicatorName;
|
||||
auto interface = QString("org.deepin.dde.Dock1.Indicator.") + m_indicatorName;
|
||||
auto sessionBus = QDBusConnection::sessionBus();
|
||||
sessionBus.registerObject(path,
|
||||
interface,
|
||||
|
@ -24,7 +24,7 @@
|
||||
#include "constants.h"
|
||||
#include "dbusutil.h"
|
||||
|
||||
#include "org_deepin_daemon_timedate.h"
|
||||
#include "org_deepin_dde_timedate1.h"
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
@ -33,7 +33,7 @@ namespace Dtk { namespace Gui { class DRegionMonitor; };
|
||||
|
||||
using namespace Dtk::Widget;
|
||||
|
||||
using Timedate = org::deepin::daemon::Timedate1;
|
||||
using Timedate = org::deepin::dde::Timedate1;
|
||||
|
||||
class QuickPluginWindow;
|
||||
class QBoxLayout;
|
||||
|
@ -115,7 +115,7 @@ void WindowManager::sendNotifications()
|
||||
QStringList actionButton;
|
||||
actionButton << "reload" << tr("Exit Safe Mode");
|
||||
QVariantMap hints;
|
||||
hints["x-deepin-action-reload"] = QString("dbus-send,--session,--dest=com.deepin.dde.Dock,--print-reply,/com/deepin/dde/Dock,com.deepin.dde.Dock.ReloadPlugins");
|
||||
hints["x-deepin-action-reload"] = QString("dbus-send,--session,--dest=org.deepin.dde.Dock1,--print-reply,/org/deepin/dde/Dock1,org.deepin.dde.Dock1.ReloadPlugins");
|
||||
// 在进入安全模式时,执行此DBUS耗时25S左右,导致任务栏显示阻塞,所以使用线程调用
|
||||
QtConcurrent::run(QThreadPool::globalInstance(), [ = ] {
|
||||
DDBusSender()
|
||||
@ -655,7 +655,7 @@ void WindowManager::onChangeDockPosition(QString fromScreen, QString toScreen, c
|
||||
void WindowManager::onRequestUpdateFrontendGeometry()
|
||||
{
|
||||
QRect rect = getDockGeometry(true);
|
||||
// 向com.deepin.dde.daemon.Dock的SetFrontendWindowRect接口设置区域时,此区域的高度或宽度不能为0,否则会导致其HideState属性循环切换,造成任务栏循环显示或隐藏
|
||||
// org.deepin.dde.daemon.Dock1的SetFrontendWindowRect接口设置区域时,此区域的高度或宽度不能为0,否则会导致其HideState属性循环切换,造成任务栏循环显示或隐藏
|
||||
if (rect.width() == 0 || rect.height() == 0)
|
||||
return;
|
||||
|
||||
|
@ -70,11 +70,7 @@ enum DisplayMode {
|
||||
enum HideMode {
|
||||
KeepShowing = 0,
|
||||
KeepHidden = 1,
|
||||
#ifdef USE_AM
|
||||
SmartHide = 2,
|
||||
#else
|
||||
SmartHide = 3,
|
||||
#endif
|
||||
SmartHide = 2
|
||||
};
|
||||
|
||||
#define PROP_POSITION "Position"
|
||||
|
@ -1,5 +1,4 @@
|
||||
#add_subdirectory("datetime")
|
||||
#add_subdirectory("disk-mount")
|
||||
add_subdirectory("shutdown")
|
||||
add_subdirectory("power")
|
||||
add_subdirectory("sound")
|
||||
|
@ -43,8 +43,8 @@ AirplaneModeItem::AirplaneModeItem(QWidget *parent)
|
||||
: QWidget(parent)
|
||||
, m_tipsLabel(new Dock::TipsWidget(this))
|
||||
, m_applet(new AirplaneModeApplet(this))
|
||||
, m_airplaneModeInter(new DBusAirplaneMode("org.deepin.daemon.AirplaneMode1",
|
||||
"/org/deepin/daemon/AirplaneMode1",
|
||||
, m_airplaneModeInter(new DBusAirplaneMode("org.deepin.dde.AirplaneMode1",
|
||||
"/org/deepin/dde/AirplaneMode1",
|
||||
QDBusConnection::systemBus(),
|
||||
this))
|
||||
{
|
||||
@ -113,7 +113,6 @@ void AirplaneModeItem::invokeMenuItem(const QString menuId, const bool checked)
|
||||
if (menuId == SHIFT)
|
||||
m_airplaneModeInter->Enable(!m_airplaneModeInter->enabled());
|
||||
else if (menuId == SETTINGS)
|
||||
#ifdef USE_AM
|
||||
DDBusSender()
|
||||
.service("org.deepin.dde.ControlCenter1")
|
||||
.interface("org.deepin.dde.ControlCenter1")
|
||||
@ -122,16 +121,6 @@ void AirplaneModeItem::invokeMenuItem(const QString menuId, const bool checked)
|
||||
.arg(QString("network"))
|
||||
.arg(QString("Airplane Mode"))
|
||||
.call();
|
||||
#else
|
||||
DDBusSender()
|
||||
.service("com.deepin.dde.ControlCenter")
|
||||
.interface("com.deepin.dde.ControlCenter")
|
||||
.path("/com/deepin/dde/ControlCenter")
|
||||
.method(QString("ShowPage"))
|
||||
.arg(QString("network"))
|
||||
.arg(QString("Airplane Mode"))
|
||||
.call();
|
||||
#endif
|
||||
*/
|
||||
}
|
||||
|
||||
|
@ -23,11 +23,11 @@
|
||||
#ifndef AIRPLANEMODEITEM_H
|
||||
#define AIRPLANEMODEITEM_H
|
||||
|
||||
#include "org_deepin_daemon_airplanemode.h"
|
||||
#include "org_deepin_dde_airplanemode1.h"
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
using DBusAirplaneMode = org::deepin::daemon::AirplaneMode1;
|
||||
using DBusAirplaneMode = org::deepin::dde::AirplaneMode1;
|
||||
|
||||
namespace Dock {
|
||||
class TipsWidget;
|
||||
|
@ -1,4 +1,4 @@
|
||||
<interface name="org.deepin.daemon.AirplaneMode1">
|
||||
<interface name="org.deepin.dde.AirplaneMode1">
|
||||
<method name="DumpState" />
|
||||
<method name="Enable">
|
||||
<arg name="enabled" type="b" direction="in"></arg>
|
@ -1,4 +1,4 @@
|
||||
{
|
||||
"api": "2.0.0",
|
||||
"depends-daemon-dbus-service": "org.deepin.daemon.Bluetooth1"
|
||||
"depends-daemon-dbus-service": "org.deepin.dde.Bluetooth1"
|
||||
}
|
||||
|
@ -119,7 +119,6 @@ void BluetoothItem::invokeMenuItem(const QString menuId, const bool checked)
|
||||
if (menuId == SHIFT) {
|
||||
m_applet->setAdapterPowered(!m_adapterPowered);
|
||||
} else if (menuId == SETTINGS) {
|
||||
#ifdef USE_AM
|
||||
DDBusSender()
|
||||
.service("org.deepin.dde.ControlCenter1")
|
||||
.interface("org.deepin.dde.ControlCenter1")
|
||||
@ -127,15 +126,6 @@ void BluetoothItem::invokeMenuItem(const QString menuId, const bool checked)
|
||||
.method(QString("ShowPage"))
|
||||
.arg(QString("bluetooth"))
|
||||
.call();
|
||||
#else
|
||||
DDBusSender()
|
||||
.service("com.deepin.dde.ControlCenter")
|
||||
.interface("com.deepin.dde.ControlCenter")
|
||||
.path("/com/deepin/dde/ControlCenter")
|
||||
.method(QString("ShowPage"))
|
||||
.arg(QString("bluetooth"))
|
||||
.call();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -31,8 +31,8 @@
|
||||
|
||||
AdaptersManager::AdaptersManager(QObject *parent)
|
||||
: QObject(parent)
|
||||
, m_bluetoothInter(new DBusBluetooth("org.deepin.daemon.Bluetooth1",
|
||||
"/org/deepin/daemon/Bluetooth1",
|
||||
, m_bluetoothInter(new DBusBluetooth("org.deepin.dde.Bluetooth1",
|
||||
"/org/deepin/dde/Bluetooth1",
|
||||
QDBusConnection::sessionBus(),
|
||||
this))
|
||||
{
|
||||
@ -65,9 +65,9 @@ AdaptersManager::AdaptersManager(QObject *parent)
|
||||
});
|
||||
#endif
|
||||
|
||||
QDBusInterface inter("org.deepin.daemon.Bluetooth1",
|
||||
"/org/deepin/daemon/Bluetooth1",
|
||||
"org.deepin.daemon.Bluetooth1",
|
||||
QDBusInterface inter("org.deepin.dde.Bluetooth1",
|
||||
"/org/deepin/dde/Bluetooth1",
|
||||
"org.deepin.dde.Bluetooth1",
|
||||
QDBusConnection::sessionBus());
|
||||
QDBusReply<QString> reply = inter.call(QDBus::Block, "GetAdapters");
|
||||
const QString replyStr = reply.value();
|
||||
|
@ -23,8 +23,8 @@
|
||||
#ifndef ADAPTERSMANAGER_H
|
||||
#define ADAPTERSMANAGER_H
|
||||
|
||||
#include "org_deepin_daemon_bluetooth.h"
|
||||
using DBusBluetooth = org::deepin::daemon::Bluetooth1;
|
||||
#include "org_deepin_dde_bluetooth1.h"
|
||||
using DBusBluetooth = org::deepin::dde::Bluetooth1;
|
||||
|
||||
class Adapter;
|
||||
class Device;
|
||||
|
@ -150,7 +150,7 @@ BluetoothAdapterItem::BluetoothAdapterItem(Adapter *adapter, QWidget *parent)
|
||||
, m_itemDelegate(new DStyledItemDelegate(m_deviceListview))
|
||||
, m_deviceModel(new QStandardItemModel(m_deviceListview))
|
||||
, m_refreshBtn(new RefreshButton(this))
|
||||
, m_bluetoothInter(new DBusBluetooth("org.deepin.daemon.Bluetooth1", "/org/deepin/daemon/Bluetooth1", QDBusConnection::sessionBus(), this))
|
||||
, m_bluetoothInter(new DBusBluetooth("org.deepin.dde.Bluetooth1", "/org/deepin/dde/Bluetooth1", QDBusConnection::sessionBus(), this))
|
||||
, m_showUnnamedDevices(false)
|
||||
, m_seperator(new HorizontalSeperator(this))
|
||||
{
|
||||
|
@ -32,9 +32,9 @@
|
||||
#include <DStyleHelper>
|
||||
#include <DApplicationHelper>
|
||||
|
||||
#include "org_deepin_daemon_bluetooth.h"
|
||||
#include "org_deepin_dde_bluetooth1.h"
|
||||
|
||||
using DBusBluetooth = org::deepin::daemon::Bluetooth1;
|
||||
using DBusBluetooth = org::deepin::dde::Bluetooth1;
|
||||
|
||||
DWIDGET_USE_NAMESPACE
|
||||
|
||||
|
@ -121,7 +121,7 @@ BluetoothApplet::BluetoothApplet(AdaptersManager *adapterManager, QWidget *paren
|
||||
, m_mainLayout(new QVBoxLayout(this))
|
||||
, m_contentLayout(new QVBoxLayout(m_contentWidget))
|
||||
, m_seperator(new HorizontalSeperator(this))
|
||||
, m_airPlaneModeInter(new DBusAirplaneMode("org.deepin.daemon.AirplaneMode1", "/org/deepin/daemon/AirplaneMode1", QDBusConnection::systemBus(), this))
|
||||
, m_airPlaneModeInter(new DBusAirplaneMode("org.deepin.dde.AirplaneMode1", "/org/deepin/dde/AirplaneMode1", QDBusConnection::systemBus(), this))
|
||||
, m_airplaneModeEnable(false)
|
||||
{
|
||||
initUi();
|
||||
@ -283,7 +283,6 @@ void BluetoothApplet::initConnect()
|
||||
connect(m_adaptersManager, &AdaptersManager::adapterIncreased, this, &BluetoothApplet::onAdapterAdded);
|
||||
connect(m_adaptersManager, &AdaptersManager::adapterDecreased, this, &BluetoothApplet::onAdapterRemoved);
|
||||
connect(m_settingLabel, &SettingLabel::clicked, this, [ = ] {
|
||||
#ifdef USE_AM
|
||||
DDBusSender()
|
||||
.service("org.deepin.dde.ControlCenter1")
|
||||
.interface("org.deepin.dde.ControlCenter1")
|
||||
@ -291,15 +290,6 @@ void BluetoothApplet::initConnect()
|
||||
.method(QString("ShowPage"))
|
||||
.arg(QString("bluetooth"))
|
||||
.call();
|
||||
#else
|
||||
DDBusSender()
|
||||
.service("com.deepin.dde.ControlCenter")
|
||||
.interface("com.deepin.dde.ControlCenter")
|
||||
.path("/com/deepin/dde/ControlCenter")
|
||||
.method(QString("ShowPage"))
|
||||
.arg(QString("bluetooth"))
|
||||
.call();
|
||||
#endif
|
||||
});
|
||||
connect(DApplicationHelper::instance(), &DApplicationHelper::themeTypeChanged, this, &BluetoothApplet::updateIconTheme);
|
||||
connect(m_airPlaneModeInter, &DBusAirplaneMode::EnabledChanged, this, &BluetoothApplet::setAirplaneModeEnabled);
|
||||
|
@ -29,7 +29,7 @@
|
||||
|
||||
#include <dtkwidget_global.h>
|
||||
|
||||
#include "org_deepin_daemon_airplanemode.h"
|
||||
#include "org_deepin_dde_airplanemode1.h"
|
||||
|
||||
class QVBoxLayout;
|
||||
class QHBoxLayout;
|
||||
@ -48,7 +48,7 @@ DWIDGET_END_NAMESPACE
|
||||
|
||||
DWIDGET_USE_NAMESPACE
|
||||
|
||||
using DBusAirplaneMode = org::deepin::daemon::AirplaneMode1;
|
||||
using DBusAirplaneMode = org::deepin::dde::AirplaneMode1;
|
||||
|
||||
class SettingLabel : public QWidget
|
||||
{
|
||||
|
@ -1,4 +1,4 @@
|
||||
<interface name="org.deepin.daemon.AirplaneMode1">
|
||||
<interface name="org.deepin.dde.AirplaneMode1">
|
||||
<method name="DumpState" />
|
||||
<method name="Enable">
|
||||
<arg name="enabled" type="b" direction="in"></arg>
|
@ -1,4 +1,4 @@
|
||||
<interface name="org.deepin.daemon.Bluetooth1">
|
||||
<interface name="org.deepin.dde.Bluetooth1">
|
||||
<method name="CancelTransferSession">
|
||||
<arg name="sessionPath" type="o" direction="in"></arg>
|
||||
</method>
|
@ -1,4 +1,4 @@
|
||||
{
|
||||
"api": "2.0.0",
|
||||
"depends-daemon-dbus-service": "org.deepin.daemon.Timedate1"
|
||||
"depends-daemon-dbus-service": "org.deepin.dde.Timedate1"
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ DatetimePlugin::DatetimePlugin(QObject *parent)
|
||||
, m_pluginLoaded(false)
|
||||
{
|
||||
QDBusConnection sessionBus = QDBusConnection::sessionBus();
|
||||
sessionBus.connect("org.deepin.daemon.Timedate1", "/org/deepin/daemon/Timedate1", "org.freedesktop.DBus.Properties", "PropertiesChanged", this, SLOT(propertiesChanged()));
|
||||
sessionBus.connect("org.deepin.dde.Timedate1", "/org/deepin/dde/Timedate1", "org.freedesktop.DBus.Properties", "PropertiesChanged", this, SLOT(propertiesChanged()));
|
||||
}
|
||||
|
||||
PluginsItemInterface::PluginSizePolicy DatetimePlugin::pluginSizePolicy() const
|
||||
@ -149,7 +149,7 @@ const QString DatetimePlugin::itemCommand(const QString &itemKey)
|
||||
{
|
||||
Q_UNUSED(itemKey);
|
||||
|
||||
return "dbus-send --print-reply --dest=org.deepin.dde.Widgets / org.deepin.dde.Widgets.Toggle";
|
||||
return "dbus-send --print-reply --dest=org.deepin.dde.Widgets1 /org/deepin/dde/Widgets1 org.deepin.dde.Widgets1.Toggle";
|
||||
}
|
||||
|
||||
const QString DatetimePlugin::itemContextMenu(const QString &itemKey)
|
||||
@ -190,7 +190,6 @@ void DatetimePlugin::invokedMenuItem(const QString &itemKey, const QString &menu
|
||||
Q_UNUSED(checked)
|
||||
|
||||
if (menuId == "open") {
|
||||
#ifdef USE_AM
|
||||
DDBusSender()
|
||||
.service("org.deepin.dde.ControlCenter1")
|
||||
.interface("org.deepin.dde.ControlCenter1")
|
||||
@ -198,15 +197,6 @@ void DatetimePlugin::invokedMenuItem(const QString &itemKey, const QString &menu
|
||||
.method(QString("ShowPage"))
|
||||
.arg(QString("datetime"))
|
||||
.call();
|
||||
#else
|
||||
DDBusSender()
|
||||
.service("com.deepin.dde.ControlCenter")
|
||||
.interface("com.deepin.dde.ControlCenter")
|
||||
.path("/com/deepin/dde/ControlCenter")
|
||||
.method(QString("ShowPage"))
|
||||
.arg(QString("datetime"))
|
||||
.call();
|
||||
#endif
|
||||
} else {
|
||||
const bool value = timedateInterface()->property(TIME_FORMAT_KEY).toBool();
|
||||
timedateInterface()->setProperty(TIME_FORMAT_KEY, !value);
|
||||
@ -268,11 +258,11 @@ void DatetimePlugin::propertiesChanged()
|
||||
QDBusInterface* DatetimePlugin::timedateInterface()
|
||||
{
|
||||
if (!m_interface) {
|
||||
if (QDBusConnection::sessionBus().interface()->isServiceRegistered("org.deepin.daemon.Timedate1")) {
|
||||
m_interface = new QDBusInterface("org.deepin.daemon.Timedate1", "/org/deepin/daemon/Timedate1", "org.deepin.daemon.Timedate1", QDBusConnection::sessionBus(), this);
|
||||
if (QDBusConnection::sessionBus().interface()->isServiceRegistered("org.deepin.dde.Timedate1")) {
|
||||
m_interface = new QDBusInterface("org.deepin.dde.Timedate1", "/org/deepin/dde/Timedate1", "org.deepin.dde.Timedate1", QDBusConnection::sessionBus(), this);
|
||||
} else {
|
||||
const QString path = QString("/org/deepin/daemon/Accounts/User%1").arg(QString::number(getuid()));
|
||||
QDBusInterface * systemInterface = new QDBusInterface("org.deepin.daemon.Accounts1", path, "org.deepin.daemon.Accounts.User",
|
||||
const QString path = QString("/org/deepin/dde/Accounts1/User%1").arg(QString::number(getuid()));
|
||||
QDBusInterface * systemInterface = new QDBusInterface("org.deepin.dde.Accounts1", path, "org.deepin.dde.Accounts1.User",
|
||||
QDBusConnection::systemBus(), this);
|
||||
return systemInterface;
|
||||
}
|
||||
|
@ -40,7 +40,7 @@ DatetimeWidget::DatetimeWidget(QWidget *parent)
|
||||
: QWidget(parent)
|
||||
, m_24HourFormat(false)
|
||||
, m_timeOffset(false)
|
||||
, m_timedateInter(new Timedate("org.deepin.daemon.Timedate1", "/org/deepin/daemon/Timedate1", QDBusConnection::sessionBus(), this))
|
||||
, m_timedateInter(new Timedate("org.deepin.dde.Timedate1", "/org/deepin/dde/Timedate1", QDBusConnection::sessionBus(), this))
|
||||
, m_shortDateFormat("yyyy-MM-dd")
|
||||
, m_shortTimeFormat("hh:mm")
|
||||
{
|
||||
|
@ -22,11 +22,11 @@
|
||||
#ifndef DATETIMEWIDGET_H
|
||||
#define DATETIMEWIDGET_H
|
||||
|
||||
#include "org_deepin_daemon_timedate.h"
|
||||
#include "org_deepin_dde_timedate1.h"
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
using Timedate = org::deepin::daemon::Timedate1;
|
||||
using Timedate = org::deepin::dde::Timedate1;
|
||||
|
||||
class DatetimeWidget : public QWidget
|
||||
{
|
||||
|
@ -1,4 +1,4 @@
|
||||
<interface name="org.deepin.daemon.Timedate1">
|
||||
<interface name="org.deepin.dde.Timedate1">
|
||||
<signal name="TimeUpdate">
|
||||
</signal>
|
||||
<method name="AddUserTimezone">
|
@ -1,26 +0,0 @@
|
||||
|
||||
set(PLUGIN_NAME "disk-mount")
|
||||
|
||||
project(${PLUGIN_NAME})
|
||||
|
||||
# Sources files
|
||||
file(GLOB SRCS "*.h" "*.cpp")
|
||||
|
||||
find_package(PkgConfig REQUIRED)
|
||||
find_package(Qt5Widgets REQUIRED)
|
||||
find_package(Qt5Svg REQUIRED)
|
||||
find_package(Qt5DBus REQUIRED)
|
||||
find_package(DtkWidget REQUIRED)
|
||||
|
||||
add_definitions("${QT_DEFINITIONS} -DQT_PLUGIN")
|
||||
add_library(${PLUGIN_NAME} SHARED ${SRCS} resources.qrc)
|
||||
set_target_properties(${PLUGIN_NAME} PROPERTIES LIBRARY_OUTPUT_DIRECTORY ../)
|
||||
target_include_directories(${PLUGIN_NAME} PUBLIC ${DtkWidget_INCLUDE_DIRS} ../../interfaces)
|
||||
target_link_libraries(${PLUGIN_NAME} PRIVATE
|
||||
${DtkWidget_LIBRARIES}
|
||||
${Qt5Widgets_LIBRARIES}
|
||||
${Qt5Svg_LIBRARIES}
|
||||
${Qt5DBus_LIBRARIES}
|
||||
)
|
||||
|
||||
install(TARGETS ${PLUGIN_NAME} LIBRARY DESTINATION lib/dde-dock/plugins)
|
@ -1,31 +0,0 @@
|
||||
<interface name="com.deepin.daemon.DiskMount">
|
||||
<method name="Eject">
|
||||
<arg type="s" direction="in"></arg>
|
||||
</method>
|
||||
<method name="ListDisk">
|
||||
<arg type="a(ssssssbbtt)" direction="out"></arg>
|
||||
<annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="DiskInfoList"/>
|
||||
</method>
|
||||
<method name="Mount">
|
||||
<arg type="s" direction="in"></arg>
|
||||
</method>
|
||||
<method name="QueryDisk">
|
||||
<arg type="s" direction="in"></arg>
|
||||
<arg type="(ssssssbbtt)" direction="out"></arg>
|
||||
<annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="DiskInfo"/>
|
||||
</method>
|
||||
<method name="Unmount">
|
||||
<arg type="s" direction="in"></arg>
|
||||
</method>
|
||||
<signal name="Changed">
|
||||
<arg type="i"></arg>
|
||||
<arg type="s"></arg>
|
||||
</signal>
|
||||
<signal name="Error">
|
||||
<arg type="s"></arg>
|
||||
<arg type="s"></arg>
|
||||
</signal>
|
||||
<property name="DiskList" type="a(ssssssbbtt)" access="read">
|
||||
<annotation name="org.qtproject.QtDBus.QtTypeName" value="DiskInfoList"/>
|
||||
</property>
|
||||
</interface>
|
@ -1,30 +0,0 @@
|
||||
/*
|
||||
* This file was generated by qdbusxml2cpp version 0.8
|
||||
* Command line was: qdbusxml2cpp -c DBusDiskMount -p dbusdiskmount com.deepin.daemon.DiskMount.xml
|
||||
*
|
||||
* qdbusxml2cpp is Copyright (C) 2015 Digia Plc and/or its subsidiary(-ies).
|
||||
*
|
||||
* This is an auto-generated file.
|
||||
* This file may have been hand-edited. Look for HAND-EDIT comments
|
||||
* before re-generating it.
|
||||
*/
|
||||
|
||||
#include "dbusdiskmount.h"
|
||||
|
||||
/*
|
||||
* Implementation of interface class DBusDiskMount
|
||||
*/
|
||||
|
||||
DBusDiskMount::DBusDiskMount(QObject *parent)
|
||||
: QDBusAbstractInterface("com.deepin.daemon.DiskMount", "/com/deepin/daemon/DiskMount", staticInterfaceName(), QDBusConnection::sessionBus(), parent)
|
||||
{
|
||||
DiskInfo::registerMetaType();
|
||||
|
||||
QDBusConnection::sessionBus().connect(this->service(), this->path(), "org.freedesktop.DBus.Properties", "PropertiesChanged","sa{sv}as", this, SLOT(__propertyChanged__(QDBusMessage)));
|
||||
}
|
||||
|
||||
DBusDiskMount::~DBusDiskMount()
|
||||
{
|
||||
QDBusConnection::sessionBus().disconnect(service(), path(), "org.freedesktop.DBus.Properties", "PropertiesChanged", "sa{sv}as", this, SLOT(propertyChanged(QDBusMessage)));
|
||||
}
|
||||
|
@ -1,113 +0,0 @@
|
||||
/*
|
||||
* This file was generated by qdbusxml2cpp version 0.8
|
||||
* Command line was: qdbusxml2cpp -c DBusDiskMount -p dbusdiskmount com.deepin.daemon.DiskMount.xml
|
||||
*
|
||||
* qdbusxml2cpp is Copyright (C) 2015 Digia Plc and/or its subsidiary(-ies).
|
||||
*
|
||||
* This is an auto-generated file.
|
||||
* Do not edit! All changes made to it will be lost.
|
||||
*/
|
||||
|
||||
#ifndef DBUSDISKMOUNT_H_1468893654
|
||||
#define DBUSDISKMOUNT_H_1468893654
|
||||
|
||||
#include <QtCore/QObject>
|
||||
#include <QtCore/QByteArray>
|
||||
#include <QtCore/QList>
|
||||
#include <QtCore/QMap>
|
||||
#include <QtCore/QString>
|
||||
#include <QtCore/QStringList>
|
||||
#include <QtCore/QVariant>
|
||||
#include <QtDBus/QtDBus>
|
||||
|
||||
#include "variant/diskinfo.h"
|
||||
|
||||
/*
|
||||
* Proxy class for interface com.deepin.daemon.DiskMount
|
||||
*/
|
||||
class DBusDiskMount: public QDBusAbstractInterface
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
Q_SLOT void __propertyChanged__(const QDBusMessage& msg)
|
||||
{
|
||||
QList<QVariant> arguments = msg.arguments();
|
||||
if (3 != arguments.count())
|
||||
return;
|
||||
QString interfaceName = msg.arguments().at(0).toString();
|
||||
if (interfaceName !="com.deepin.daemon.DiskMount")
|
||||
return;
|
||||
QVariantMap changedProps = qdbus_cast<QVariantMap>(arguments.at(1).value<QDBusArgument>());
|
||||
foreach(const QString &prop, changedProps.keys()) {
|
||||
const QMetaObject* self = metaObject();
|
||||
for (int i=self->propertyOffset(); i < self->propertyCount(); ++i) {
|
||||
QMetaProperty p = self->property(i);
|
||||
if (p.name() == prop) {
|
||||
Q_EMIT p.notifySignal().invoke(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
public:
|
||||
static inline const char *staticInterfaceName()
|
||||
{ return "com.deepin.daemon.DiskMount"; }
|
||||
|
||||
public:
|
||||
explicit DBusDiskMount(QObject *parent = 0);
|
||||
|
||||
~DBusDiskMount();
|
||||
|
||||
Q_PROPERTY(DiskInfoList DiskList READ diskList NOTIFY DiskListChanged)
|
||||
inline DiskInfoList diskList() const
|
||||
{ return qvariant_cast< DiskInfoList >(property("DiskList")); }
|
||||
|
||||
public Q_SLOTS: // METHODS
|
||||
inline QDBusPendingReply<> Eject(const QString &in0)
|
||||
{
|
||||
QList<QVariant> argumentList;
|
||||
argumentList << QVariant::fromValue(in0);
|
||||
return asyncCallWithArgumentList(QStringLiteral("Eject"), argumentList);
|
||||
}
|
||||
|
||||
inline QDBusPendingReply<DiskInfoList> ListDisk()
|
||||
{
|
||||
QList<QVariant> argumentList;
|
||||
return asyncCallWithArgumentList(QStringLiteral("ListDisk"), argumentList);
|
||||
}
|
||||
|
||||
inline QDBusPendingReply<> Mount(const QString &in0)
|
||||
{
|
||||
QList<QVariant> argumentList;
|
||||
argumentList << QVariant::fromValue(in0);
|
||||
return asyncCallWithArgumentList(QStringLiteral("Mount"), argumentList);
|
||||
}
|
||||
|
||||
inline QDBusPendingReply<DiskInfo> QueryDisk(const QString &in0)
|
||||
{
|
||||
QList<QVariant> argumentList;
|
||||
argumentList << QVariant::fromValue(in0);
|
||||
return asyncCallWithArgumentList(QStringLiteral("QueryDisk"), argumentList);
|
||||
}
|
||||
|
||||
inline QDBusPendingReply<> Unmount(const QString &diskId)
|
||||
{
|
||||
QList<QVariant> argumentList;
|
||||
argumentList << QVariant::fromValue(diskId);
|
||||
return asyncCallWithArgumentList(QStringLiteral("Unmount"), argumentList);
|
||||
}
|
||||
|
||||
Q_SIGNALS: // SIGNALS
|
||||
void Changed(int in0, const QString &in1);
|
||||
void Error(const QString &uuid, const QString &info);
|
||||
// begin property changed signals
|
||||
void DiskListChanged();
|
||||
};
|
||||
|
||||
namespace com {
|
||||
namespace deepin {
|
||||
namespace daemon {
|
||||
typedef ::DBusDiskMount DiskMount;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
@ -1,86 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd.
|
||||
*
|
||||
* Author: sbw <sbw@sbw.so>
|
||||
*
|
||||
* Maintainer: sbw <sbw@sbw.so>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "diskinfo.h"
|
||||
|
||||
DiskInfo::DiskInfo()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void DiskInfo::registerMetaType()
|
||||
{
|
||||
qRegisterMetaType<DiskInfo>("DiskInfo");
|
||||
qDBusRegisterMetaType<DiskInfo>();
|
||||
|
||||
qRegisterMetaType<DiskInfoList>("DiskInfoList");
|
||||
qDBusRegisterMetaType<DiskInfoList>();
|
||||
}
|
||||
|
||||
QDebug operator<<(QDebug debug, const DiskInfo &info)
|
||||
{
|
||||
debug << info.m_id << info.m_name << info.m_type << info.m_path << info.m_mountPoint << info.m_icon;
|
||||
debug << '\t' << info.m_unmountable << '\t' << info.m_ejectable;
|
||||
debug << '\t' << info.m_usedSize << '\t' << info.m_totalSize;
|
||||
debug << endl;
|
||||
|
||||
return debug;
|
||||
}
|
||||
|
||||
const QDataStream &operator>>(QDataStream &args, DiskInfo &info)
|
||||
{
|
||||
args >> info.m_id >> info.m_name >> info.m_type >> info.m_path >> info.m_mountPoint >> info.m_icon;
|
||||
args >> info.m_unmountable >> info.m_ejectable;
|
||||
args >> info.m_usedSize >> info.m_totalSize;
|
||||
|
||||
return args;
|
||||
}
|
||||
|
||||
const QDBusArgument &operator>>(const QDBusArgument &args, DiskInfo &info)
|
||||
{
|
||||
args.beginStructure();
|
||||
args >> info.m_id >> info.m_name >> info.m_type >> info.m_path >> info.m_mountPoint >> info.m_icon;
|
||||
args >> info.m_unmountable >> info.m_ejectable;
|
||||
args >> info.m_usedSize >> info.m_totalSize;
|
||||
args.endStructure();
|
||||
|
||||
return args;
|
||||
}
|
||||
|
||||
QDataStream &operator<<(QDataStream &args, const DiskInfo &info)
|
||||
{
|
||||
args << info.m_id << info.m_name << info.m_type << info.m_path << info.m_mountPoint << info.m_icon;
|
||||
args << info.m_unmountable << info.m_ejectable;
|
||||
args << info.m_usedSize << info.m_totalSize;
|
||||
|
||||
return args;
|
||||
}
|
||||
|
||||
QDBusArgument &operator<<(QDBusArgument &args, const DiskInfo &info)
|
||||
{
|
||||
args.beginStructure();
|
||||
args << info.m_id << info.m_name << info.m_type << info.m_path << info.m_mountPoint << info.m_icon;
|
||||
args << info.m_unmountable << info.m_ejectable;
|
||||
args << info.m_usedSize << info.m_totalSize;
|
||||
args.endStructure();
|
||||
|
||||
return args;
|
||||
}
|
@ -1,61 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd.
|
||||
*
|
||||
* Author: sbw <sbw@sbw.so>
|
||||
*
|
||||
* Maintainer: sbw <sbw@sbw.so>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef DISKINFO_H
|
||||
#define DISKINFO_H
|
||||
|
||||
#include <QString>
|
||||
#include <QDataStream>
|
||||
#include <QDebug>
|
||||
|
||||
class DiskInfo
|
||||
{
|
||||
public:
|
||||
DiskInfo();
|
||||
static void registerMetaType();
|
||||
|
||||
friend QDebug operator<<(QDebug debug, const DiskInfo &info);
|
||||
friend QDBusArgument &operator<<(QDBusArgument &args, const DiskInfo &info);
|
||||
friend QDataStream &operator<<(QDataStream &args, const DiskInfo &info);
|
||||
friend const QDBusArgument &operator>>(const QDBusArgument &args, DiskInfo &info);
|
||||
friend const QDataStream &operator>>(QDataStream &args, DiskInfo &info);
|
||||
|
||||
public:
|
||||
QString m_id;
|
||||
QString m_name;
|
||||
QString m_type;
|
||||
QString m_path;
|
||||
QString m_mountPoint;
|
||||
QString m_icon;
|
||||
|
||||
bool m_unmountable;
|
||||
bool m_ejectable;
|
||||
|
||||
quint64 m_usedSize;
|
||||
quint64 m_totalSize;
|
||||
};
|
||||
|
||||
typedef QList<DiskInfo> DiskInfoList;
|
||||
|
||||
Q_DECLARE_METATYPE(DiskInfo)
|
||||
Q_DECLARE_METATYPE(DiskInfoList)
|
||||
|
||||
#endif // DISKINFO_H
|
@ -1,3 +0,0 @@
|
||||
{
|
||||
"api": "2.0.0"
|
||||
}
|
@ -1,132 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd.
|
||||
*
|
||||
* Author: sbw <sbw@sbw.so>
|
||||
*
|
||||
* Maintainer: sbw <sbw@sbw.so>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "diskcontrolitem.h"
|
||||
|
||||
#include <QVBoxLayout>
|
||||
#include <QIcon>
|
||||
|
||||
DWIDGET_USE_NAMESPACE
|
||||
|
||||
DiskControlItem::DiskControlItem(const DiskInfo &info, QWidget *parent)
|
||||
: QFrame(parent),
|
||||
|
||||
m_unknowIcon(":/icons/resources/unknown.svg"),
|
||||
|
||||
m_diskIcon(new QLabel),
|
||||
m_diskName(new QLabel),
|
||||
m_diskCapacity(new QLabel),
|
||||
m_capacityValueBar(new QProgressBar),
|
||||
m_unmountButton(new DImageButton)
|
||||
{
|
||||
// QIcon::setThemeName("deepin");
|
||||
|
||||
m_diskName->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
|
||||
m_diskName->setStyleSheet("color:white;");
|
||||
|
||||
m_diskCapacity->setStyleSheet("color:rgba(255, 255, 255, .6);");
|
||||
|
||||
m_capacityValueBar->setTextVisible(false);
|
||||
m_capacityValueBar->setFixedHeight(2);
|
||||
m_capacityValueBar->setStyleSheet("QProgressBar {"
|
||||
"border:none;"
|
||||
"background-color:rgba(255, 255, 255, .1);"
|
||||
"}"
|
||||
"QProgressBar::chunk {"
|
||||
"background-color:rgba(255, 255, 255, .8);"
|
||||
"}");
|
||||
|
||||
m_unmountButton->setNormalPic(":/icons/resources/unmount-normal.png");
|
||||
m_unmountButton->setHoverPic(":/icons/resources/unmount-hover.png");
|
||||
m_unmountButton->setPressPic(":/icons/resources/unmount-press.png");
|
||||
m_unmountButton->setStyleSheet("margin-top:12px;");
|
||||
|
||||
QVBoxLayout *infoLayout = new QVBoxLayout;
|
||||
infoLayout->addWidget(m_diskName);
|
||||
infoLayout->addWidget(m_diskCapacity);
|
||||
infoLayout->setSpacing(0);
|
||||
infoLayout->setContentsMargins(3, 6, 0, 8);
|
||||
|
||||
QHBoxLayout *unmountLayout = new QHBoxLayout;
|
||||
unmountLayout->addLayout(infoLayout);
|
||||
unmountLayout->addWidget(m_unmountButton);
|
||||
unmountLayout->setSpacing(0);
|
||||
unmountLayout->setMargin(0);
|
||||
|
||||
QVBoxLayout *progressLayout = new QVBoxLayout;
|
||||
progressLayout->addLayout(unmountLayout);
|
||||
progressLayout->addWidget(m_capacityValueBar);
|
||||
progressLayout->setSpacing(0);
|
||||
progressLayout->setContentsMargins(10, 0, 0, 5);
|
||||
|
||||
QHBoxLayout *centralLayout = new QHBoxLayout;
|
||||
centralLayout->addWidget(m_diskIcon);
|
||||
centralLayout->addLayout(progressLayout);
|
||||
centralLayout->setSpacing(0);
|
||||
centralLayout->setContentsMargins(0, 0, 5, 0);
|
||||
|
||||
setLayout(centralLayout);
|
||||
setObjectName("DiskItem");
|
||||
setStyleSheet("QFrame #DiskItem:hover {"
|
||||
"background-color:rgba(255, 255, 255, .1);"
|
||||
"border-radius:4px;"
|
||||
"}");
|
||||
|
||||
connect(m_unmountButton, &DImageButton::clicked, [this] {emit requestUnmount(m_info.m_id);});
|
||||
|
||||
updateInfo(info);
|
||||
}
|
||||
|
||||
void DiskControlItem::updateInfo(const DiskInfo &info)
|
||||
{
|
||||
m_info = info;
|
||||
|
||||
m_diskIcon->setPixmap(QIcon::fromTheme(info.m_icon, m_unknowIcon).pixmap(48, 48));
|
||||
if (!info.m_name.isEmpty())
|
||||
m_diskName->setText(info.m_name);
|
||||
else
|
||||
m_diskName->setText(tr("Unknown device"));
|
||||
if (info.m_totalSize)
|
||||
m_diskCapacity->setText(QString("%1/%2").arg(formatDiskSize(info.m_usedSize)).arg(formatDiskSize(info.m_totalSize)));
|
||||
else if (info.m_name.isEmpty())
|
||||
m_diskCapacity->clear();
|
||||
else
|
||||
m_diskCapacity->setText(tr("Unknown volume"));
|
||||
m_capacityValueBar->setMinimum(0);
|
||||
m_capacityValueBar->setMaximum(std::max(1ull, info.m_totalSize));
|
||||
m_capacityValueBar->setValue(info.m_usedSize);
|
||||
}
|
||||
|
||||
const QString DiskControlItem::formatDiskSize(const quint64 size) const
|
||||
{
|
||||
const quint64 mSize = 1000;
|
||||
const quint64 gSize = mSize * 1000;
|
||||
const quint64 tSize = gSize * 1000;
|
||||
|
||||
if (size >= tSize)
|
||||
return QString::number(double(size) / tSize, 'f', 2) + 'T';
|
||||
else if (size >= gSize)
|
||||
return QString::number(double(size) / gSize, 'f', 2) + "G";
|
||||
else if (size >= mSize)
|
||||
return QString::number(double(size) / mSize, 'f', 1) + "M";
|
||||
else
|
||||
return QString::number(size) + "K";
|
||||
}
|
@ -1,59 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd.
|
||||
*
|
||||
* Author: sbw <sbw@sbw.so>
|
||||
*
|
||||
* Maintainer: sbw <sbw@sbw.so>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef DISKCONTROLITEM_H
|
||||
#define DISKCONTROLITEM_H
|
||||
|
||||
#include "dbus/dbusdiskmount.h"
|
||||
|
||||
#include <dimagebutton.h>
|
||||
|
||||
#include <QWidget>
|
||||
#include <QLabel>
|
||||
#include <QProgressBar>
|
||||
#include <QIcon>
|
||||
|
||||
class DiskControlItem : public QFrame
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit DiskControlItem(const DiskInfo &info, QWidget *parent = 0);
|
||||
|
||||
signals:
|
||||
void requestUnmount(const QString &diskId) const;
|
||||
|
||||
private slots:
|
||||
void updateInfo(const DiskInfo &info);
|
||||
const QString formatDiskSize(const quint64 size) const;
|
||||
|
||||
private:
|
||||
DiskInfo m_info;
|
||||
QIcon m_unknowIcon;
|
||||
|
||||
QLabel *m_diskIcon;
|
||||
QLabel *m_diskName;
|
||||
QLabel *m_diskCapacity;
|
||||
QProgressBar *m_capacityValueBar;
|
||||
Dtk::Widget::DImageButton *m_unmountButton;
|
||||
};
|
||||
|
||||
#endif // DISKCONTROLITEM_H
|
@ -1,100 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd.
|
||||
*
|
||||
* Author: sbw <sbw@sbw.so>
|
||||
*
|
||||
* Maintainer: sbw <sbw@sbw.so>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "diskcontrolwidget.h"
|
||||
#include "diskcontrolitem.h"
|
||||
|
||||
#define WIDTH 300
|
||||
|
||||
DiskControlWidget::DiskControlWidget(QWidget *parent)
|
||||
: QScrollArea(parent),
|
||||
|
||||
m_centralLayout(new QVBoxLayout),
|
||||
m_centralWidget(new QWidget),
|
||||
|
||||
m_diskInter(new DBusDiskMount(this))
|
||||
{
|
||||
m_centralWidget->setLayout(m_centralLayout);
|
||||
m_centralWidget->setFixedWidth(WIDTH);
|
||||
|
||||
setWidget(m_centralWidget);
|
||||
setFixedWidth(WIDTH);
|
||||
setFrameStyle(QFrame::NoFrame);
|
||||
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||
setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||
setStyleSheet("background-color:transparent;");
|
||||
|
||||
connect(m_diskInter, &DBusDiskMount::DiskListChanged, this, &DiskControlWidget::diskListChanged);
|
||||
connect(m_diskInter, &DBusDiskMount::Error, this, &DiskControlWidget::unmountFinished);
|
||||
|
||||
QMetaObject::invokeMethod(this, "diskListChanged", Qt::QueuedConnection);
|
||||
}
|
||||
|
||||
void DiskControlWidget::unmountAll()
|
||||
{
|
||||
for (auto disk : m_diskInfoList)
|
||||
unmountDisk(disk.m_id);
|
||||
}
|
||||
|
||||
void DiskControlWidget::diskListChanged()
|
||||
{
|
||||
DiskInfoList diskList = m_diskInter->diskList();
|
||||
|
||||
while (QLayoutItem *item = m_centralLayout->takeAt(0))
|
||||
{
|
||||
delete item->widget();
|
||||
delete item;
|
||||
}
|
||||
|
||||
int mountedCount = 0;
|
||||
for (auto info : diskList)
|
||||
{
|
||||
if (info.m_mountPoint.isEmpty())
|
||||
continue;
|
||||
else
|
||||
++mountedCount;
|
||||
|
||||
DiskControlItem *item = new DiskControlItem(info, this);
|
||||
|
||||
connect(item, &DiskControlItem::requestUnmount, this, &DiskControlWidget::unmountDisk);
|
||||
|
||||
m_centralLayout->addWidget(item);
|
||||
m_diskInfoList.append(info);
|
||||
}
|
||||
|
||||
emit diskCountChanged(mountedCount);
|
||||
|
||||
const int contentHeight = mountedCount * 70;
|
||||
const int maxHeight = std::min(contentHeight, 70 * 6);
|
||||
|
||||
m_centralWidget->setFixedHeight(contentHeight);
|
||||
setFixedHeight(maxHeight);
|
||||
}
|
||||
|
||||
void DiskControlWidget::unmountDisk(const QString &diskId) const
|
||||
{
|
||||
m_diskInter->Unmount(diskId);
|
||||
}
|
||||
|
||||
void DiskControlWidget::unmountFinished(const QString &uuid, const QString &info)
|
||||
{
|
||||
qDebug() << uuid << info;
|
||||
}
|
@ -1,55 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd.
|
||||
*
|
||||
* Author: sbw <sbw@sbw.so>
|
||||
*
|
||||
* Maintainer: sbw <sbw@sbw.so>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef DISKCONTROLWIDGET_H
|
||||
#define DISKCONTROLWIDGET_H
|
||||
|
||||
#include "dbus/dbusdiskmount.h"
|
||||
|
||||
#include <QScrollArea>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
class DiskControlWidget : public QScrollArea
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit DiskControlWidget(QWidget *parent = 0);
|
||||
|
||||
void unmountAll();
|
||||
|
||||
signals:
|
||||
void diskCountChanged(const int count) const;
|
||||
|
||||
private slots:
|
||||
void diskListChanged();
|
||||
void unmountDisk(const QString &diskId) const;
|
||||
void unmountFinished(const QString &uuid, const QString &info);
|
||||
|
||||
private:
|
||||
QVBoxLayout *m_centralLayout;
|
||||
QWidget *m_centralWidget;
|
||||
DBusDiskMount *m_diskInter;
|
||||
|
||||
DiskInfoList m_diskInfoList;
|
||||
};
|
||||
|
||||
#endif // DISKCONTROLWIDGET_H
|
@ -1,144 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd.
|
||||
*
|
||||
* Author: sbw <sbw@sbw.so>
|
||||
*
|
||||
* Maintainer: sbw <sbw@sbw.so>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "diskmountplugin.h"
|
||||
|
||||
#define OPEN "open"
|
||||
#define UNMOUNT_ALL "unmount_all"
|
||||
|
||||
DiskMountPlugin::DiskMountPlugin(QObject *parent)
|
||||
: QObject(parent),
|
||||
|
||||
m_pluginAdded(false),
|
||||
|
||||
m_tipsLabel(new QLabel),
|
||||
m_diskPluginItem(new DiskPluginItem),
|
||||
m_diskControlApplet(nullptr)
|
||||
{
|
||||
m_diskPluginItem->setVisible(false);
|
||||
|
||||
m_tipsLabel->setObjectName("diskmount");
|
||||
m_tipsLabel->setVisible(false);
|
||||
m_tipsLabel->setText(tr("Disk"));
|
||||
m_tipsLabel->setStyleSheet("color:white;"
|
||||
"padding:5px 10px;");
|
||||
|
||||
connect(m_diskPluginItem, &DiskPluginItem::requestContextMenu, [this] {m_proxyInter->requestContextMenu(this, QString());});
|
||||
}
|
||||
|
||||
const QString DiskMountPlugin::pluginName() const
|
||||
{
|
||||
return "disk-mount";
|
||||
}
|
||||
|
||||
void DiskMountPlugin::init(PluginProxyInterface *proxyInter)
|
||||
{
|
||||
m_proxyInter = proxyInter;
|
||||
|
||||
initCompoments();
|
||||
m_diskPluginItem->setDockDisplayMode(displayMode());
|
||||
}
|
||||
|
||||
QWidget *DiskMountPlugin::itemWidget(const QString &itemKey)
|
||||
{
|
||||
Q_UNUSED(itemKey);
|
||||
|
||||
return m_diskPluginItem;
|
||||
}
|
||||
|
||||
QWidget *DiskMountPlugin::itemTipsWidget(const QString &itemKey)
|
||||
{
|
||||
Q_UNUSED(itemKey);
|
||||
|
||||
return m_tipsLabel;
|
||||
}
|
||||
|
||||
QWidget *DiskMountPlugin::itemPopupApplet(const QString &itemKey)
|
||||
{
|
||||
Q_UNUSED(itemKey);
|
||||
|
||||
return m_diskControlApplet;
|
||||
}
|
||||
|
||||
const QString DiskMountPlugin::itemContextMenu(const QString &itemKey)
|
||||
{
|
||||
Q_UNUSED(itemKey);
|
||||
|
||||
QList<QVariant> items;
|
||||
items.reserve(2);
|
||||
|
||||
QMap<QString, QVariant> open;
|
||||
open["itemId"] = OPEN;
|
||||
open["itemText"] = tr("Open");
|
||||
open["isActive"] = true;
|
||||
items.push_back(open);
|
||||
|
||||
QMap<QString, QVariant> unmountAll;
|
||||
unmountAll["itemId"] = UNMOUNT_ALL;
|
||||
unmountAll["itemText"] = tr("Unmount all");
|
||||
unmountAll["isActive"] = true;
|
||||
items.push_back(unmountAll);
|
||||
|
||||
QMap<QString, QVariant> menu;
|
||||
menu["items"] = items;
|
||||
menu["checkableMenu"] = false;
|
||||
menu["singleCheck"] = false;
|
||||
|
||||
return QJsonDocument::fromVariant(menu).toJson();
|
||||
}
|
||||
|
||||
void DiskMountPlugin::invokedMenuItem(const QString &itemKey, const QString &menuId, const bool checked)
|
||||
{
|
||||
Q_UNUSED(itemKey)
|
||||
Q_UNUSED(checked)
|
||||
|
||||
if (menuId == OPEN)
|
||||
QProcess::startDetached("gvfs-open", QStringList() << "computer://");
|
||||
else if (menuId == UNMOUNT_ALL)
|
||||
m_diskControlApplet->unmountAll();
|
||||
}
|
||||
|
||||
void DiskMountPlugin::initCompoments()
|
||||
{
|
||||
m_diskControlApplet = new DiskControlWidget;
|
||||
m_diskControlApplet->setObjectName("dist-mount");
|
||||
m_diskControlApplet->setVisible(false);
|
||||
|
||||
connect(m_diskControlApplet, &DiskControlWidget::diskCountChanged, this, &DiskMountPlugin::diskCountChanged);
|
||||
}
|
||||
|
||||
void DiskMountPlugin::displayModeChanged(const Dock::DisplayMode mode)
|
||||
{
|
||||
m_diskPluginItem->setDockDisplayMode(mode);
|
||||
}
|
||||
|
||||
void DiskMountPlugin::diskCountChanged(const int count)
|
||||
{
|
||||
if (m_pluginAdded == bool(count))
|
||||
return;
|
||||
|
||||
m_pluginAdded = bool(count);
|
||||
|
||||
if (m_pluginAdded)
|
||||
m_proxyInter->itemAdded(this, QString());
|
||||
else
|
||||
m_proxyInter->itemRemoved(this, QString());
|
||||
}
|
@ -1,66 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd.
|
||||
*
|
||||
* Author: sbw <sbw@sbw.so>
|
||||
*
|
||||
* Maintainer: sbw <sbw@sbw.so>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef DISKMOUNTPLUGIN_H
|
||||
#define DISKMOUNTPLUGIN_H
|
||||
|
||||
#include <QLabel>
|
||||
|
||||
#include "pluginsiteminterface.h"
|
||||
#include "diskcontrolwidget.h"
|
||||
#include "diskpluginitem.h"
|
||||
|
||||
class DiskMountPlugin : public QObject, PluginsItemInterface
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_INTERFACES(PluginsItemInterface)
|
||||
Q_PLUGIN_METADATA(IID "com.deepin.dock.PluginsItemInterface" FILE "disk-mount.json")
|
||||
|
||||
public:
|
||||
explicit DiskMountPlugin(QObject *parent = 0);
|
||||
|
||||
const QString pluginName() const;
|
||||
void init(PluginProxyInterface *proxyInter);
|
||||
|
||||
QWidget *itemWidget(const QString &itemKey);
|
||||
QWidget *itemTipsWidget(const QString &itemKey);
|
||||
QWidget *itemPopupApplet(const QString &itemKey);
|
||||
|
||||
const QString itemContextMenu(const QString &itemKey);
|
||||
void invokedMenuItem(const QString &itemKey, const QString &menuId, const bool checked);
|
||||
|
||||
private:
|
||||
void initCompoments();
|
||||
|
||||
void displayModeChanged(const Dock::DisplayMode mode);
|
||||
|
||||
private slots:
|
||||
void diskCountChanged(const int count);
|
||||
|
||||
private:
|
||||
bool m_pluginAdded;
|
||||
|
||||
QLabel *m_tipsLabel;
|
||||
DiskPluginItem *m_diskPluginItem;
|
||||
DiskControlWidget *m_diskControlApplet;
|
||||
};
|
||||
|
||||
#endif // DISKMOUNTPLUGIN_H
|
@ -1,91 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd.
|
||||
*
|
||||
* Author: sbw <sbw@sbw.so>
|
||||
*
|
||||
* Maintainer: sbw <sbw@sbw.so>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "diskpluginitem.h"
|
||||
#include "imageutil.h"
|
||||
|
||||
#include <QPainter>
|
||||
#include <QDebug>
|
||||
#include <QMouseEvent>
|
||||
#include <QIcon>
|
||||
|
||||
DiskPluginItem::DiskPluginItem(QWidget *parent)
|
||||
: QWidget(parent),
|
||||
m_displayMode(Dock::Efficient)
|
||||
{
|
||||
// QIcon::setThemeName("deepin");
|
||||
}
|
||||
|
||||
void DiskPluginItem::setDockDisplayMode(const Dock::DisplayMode mode)
|
||||
{
|
||||
m_displayMode = mode;
|
||||
|
||||
updateIcon();
|
||||
}
|
||||
|
||||
void DiskPluginItem::paintEvent(QPaintEvent *e)
|
||||
{
|
||||
QWidget::paintEvent(e);
|
||||
|
||||
QPainter painter(this);
|
||||
const QRectF &rf = QRectF(rect());
|
||||
const QRectF &rfp = QRectF(m_icon.rect());
|
||||
painter.drawPixmap(rf.center() - rfp.center(), m_icon);
|
||||
}
|
||||
|
||||
void DiskPluginItem::resizeEvent(QResizeEvent *e)
|
||||
{
|
||||
QWidget::resizeEvent(e);
|
||||
|
||||
updateIcon();
|
||||
}
|
||||
|
||||
void DiskPluginItem::mousePressEvent(QMouseEvent *e)
|
||||
{
|
||||
if (e->button() != Qt::RightButton)
|
||||
return QWidget::mousePressEvent(e);
|
||||
|
||||
const QPoint p(e->pos() - rect().center());
|
||||
if (p.manhattanLength() < std::min(width(), height()) * 0.8 * 0.5)
|
||||
{
|
||||
emit requestContextMenu();
|
||||
return;
|
||||
}
|
||||
|
||||
QWidget::mousePressEvent(e);
|
||||
}
|
||||
|
||||
QSize DiskPluginItem::sizeHint() const
|
||||
{
|
||||
return QSize(26, 26);
|
||||
}
|
||||
|
||||
void DiskPluginItem::updateIcon()
|
||||
{
|
||||
if (m_displayMode == Dock::Efficient)
|
||||
// m_icon = ImageUtil::loadSvg(":/icons/resources/icon-small.svg", 16);
|
||||
m_icon = QIcon::fromTheme("drive-removable-dock-symbolic").pixmap(16, 16);
|
||||
else
|
||||
// m_icon = ImageUtil::loadSvg(":/icons/resources/icon.svg", std::min(width(), height()) * 0.8);
|
||||
m_icon = QIcon::fromTheme("drive-removable-dock").pixmap(std::min(width(), height()) * 0.8, std::min(width(), height()) * 0.8);
|
||||
|
||||
update();
|
||||
}
|
@ -1,58 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd.
|
||||
*
|
||||
* Author: sbw <sbw@sbw.so>
|
||||
*
|
||||
* Maintainer: sbw <sbw@sbw.so>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef DISKPLUGINITEM_H
|
||||
#define DISKPLUGINITEM_H
|
||||
|
||||
#include "constants.h"
|
||||
|
||||
#include <QWidget>
|
||||
#include <QPixmap>
|
||||
|
||||
class DiskPluginItem : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit DiskPluginItem(QWidget *parent = 0);
|
||||
|
||||
signals:
|
||||
void requestContextMenu() const;
|
||||
|
||||
public slots:
|
||||
void setDockDisplayMode(const Dock::DisplayMode mode);
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *e);
|
||||
void resizeEvent(QResizeEvent *e);
|
||||
void mousePressEvent(QMouseEvent *e);
|
||||
QSize sizeHint() const;
|
||||
|
||||
private:
|
||||
void updateIcon();
|
||||
|
||||
private:
|
||||
Dock::DisplayMode m_displayMode;
|
||||
|
||||
QPixmap m_icon;
|
||||
};
|
||||
|
||||
#endif // DISKPLUGINITEM_H
|
@ -1,38 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd.
|
||||
*
|
||||
* Author: sbw <sbw@sbw.so>
|
||||
*
|
||||
* Maintainer: sbw <sbw@sbw.so>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "imageutil.h"
|
||||
|
||||
#include <QPainter>
|
||||
|
||||
const QPixmap ImageUtil::loadSvg(const QString &path, const int size)
|
||||
{
|
||||
QPixmap pixmap(size, size);
|
||||
QSvgRenderer renderer(path);
|
||||
pixmap.fill(Qt::transparent);
|
||||
|
||||
QPainter painter;
|
||||
painter.begin(&pixmap);
|
||||
renderer.render(&painter);
|
||||
painter.end();
|
||||
|
||||
return pixmap;
|
||||
}
|
@ -1,34 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd.
|
||||
*
|
||||
* Author: sbw <sbw@sbw.so>
|
||||
*
|
||||
* Maintainer: sbw <sbw@sbw.so>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef IMAGEUTIL_H
|
||||
#define IMAGEUTIL_H
|
||||
|
||||
#include <QPixmap>
|
||||
#include <QSvgRenderer>
|
||||
|
||||
class ImageUtil
|
||||
{
|
||||
public:
|
||||
static const QPixmap loadSvg(const QString &path, const int size);
|
||||
};
|
||||
|
||||
#endif // IMAGEUTIL_H
|
@ -1,10 +0,0 @@
|
||||
<RCC>
|
||||
<qresource prefix="/icons">
|
||||
<file>resources/icon-small.svg</file>
|
||||
<file>resources/icon.svg</file>
|
||||
<file>resources/unmount-press.png</file>
|
||||
<file>resources/unmount-normal.png</file>
|
||||
<file>resources/unmount-hover.png</file>
|
||||
<file>resources/unknown.svg</file>
|
||||
</qresource>
|
||||
</RCC>
|
@ -1,13 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg width="16px" height="16px" viewBox="0 0 16 16" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<!-- Generator: Sketch 3.8.3 (29802) - http://www.bohemiancoding.com/sketch -->
|
||||
<title>drive_harddisk_usb_symbolic_active_16px</title>
|
||||
<desc>Created with Sketch.</desc>
|
||||
<defs></defs>
|
||||
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
||||
<g id="drive_harddisk_usb_symbolic_active_16px">
|
||||
<rect id="Rectangle-1" x="0" y="0" width="16" height="16"></rect>
|
||||
<path d="M4.65225822,10.640635 C4.64809326,10.6446576 4.01426838,11.2786248 4.01426838,11.2786248 C3.71579984,11.1016038 3.36739161,11 2.99533109,11 C1.88961947,11 0.995808339,11.8946651 0.995808339,13.0009554 C0.995808339,14.1057285 1.89001311,15 2.99533109,15 C4.09938509,15 4.99580834,14.1050847 4.99580834,13.0009554 C4.99580834,12.6307652 4.89536061,12.2841544 4.72027406,11.9868327 L5.15337486,11.5537319 L8.87873219,12.4850713 C9.0491197,12.5276681 9.22936322,12.4777436 9.35355339,12.3535534 L11.1436317,10.563475 L11.6482656,11.0681089 C11.8449165,11.2647598 12.1626667,11.2658436 12.3604014,11.0681089 L14.061411,9.36709926 C14.2580619,9.17044838 14.2591457,8.85269813 14.061411,8.65496342 L12.3604014,6.95395382 C12.1637505,6.75730293 11.8460003,6.75621911 11.6482656,6.95395382 L9.94725597,8.65496342 C9.75060509,8.8516143 9.74952126,9.16936455 9.94725597,9.36709926 L10.436525,9.85636826 L8.86015634,11.4496509 L5.97799599,10.7291108 L6.34531786,10.3617889 C6.35087195,10.3564862 12,4.70710678 12,4.70710678 L13.1464466,5.85355339 C13.4377906,6.14489741 13.9367059,5.9785923 13.9949747,5.57071068 L14.4949747,2.07071068 C14.5421152,1.74072751 14.2592725,1.4578848 13.9292893,1.50502525 L10.4292893,2.00502525 C10.0214077,2.06329406 9.85510259,2.56220937 10.1464466,2.85355339 L11.2928932,4 L6.16865662,9.1242366 C6.16865662,9.1242366 5.01461645,6.69249033 5.09514798,6.6119588 C5.3907725,6.31633428 5.98202154,5.72508524 5.98202154,5.72508524 C6.27906451,5.89981527 6.62537235,6 6.99533109,6 C8.09938509,6 8.99580834,5.10508467 8.99580834,4.00095541 C8.99580834,2.89530981 8.09977906,2 6.99533109,2 C5.88961947,2 4.99580834,2.89466509 4.99580834,4.00095541 C4.99580834,4.37289182 5.09715939,4.72096955 5.27379599,5.01909722 L4.14644661,6.14644661 C4.00187701,6.29101621 3.95988978,6.50903834 4.04042748,6.69695965 L5.40707931,9.88581391 L4.65225822,10.640635 Z" id="Combined-Shape" fill="#FFFFFF"></path>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
Before Width: | Height: | Size: 2.5 KiB |
@ -1,28 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg width="48px" height="48px" viewBox="0 0 48 48" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<!-- Generator: Sketch 3.8.3 (29802) - http://www.bohemiancoding.com/sketch -->
|
||||
<title>磁盘挂载-48px</title>
|
||||
<desc>Created with Sketch.</desc>
|
||||
<defs>
|
||||
<path d="M21,42 C32.5979797,42 42,32.5979797 42,21 C42,9.40202025 32.5979797,0 21,0 C9.40202025,0 0,9.40202025 0,21 C0,32.5979797 9.40202025,42 21,42 Z" id="path-1"></path>
|
||||
<filter x="-50%" y="-50%" width="200%" height="200%" filterUnits="objectBoundingBox" id="filter-2">
|
||||
<feOffset dx="0" dy="1" in="SourceAlpha" result="shadowOffsetOuter1"></feOffset>
|
||||
<feGaussianBlur stdDeviation="1" in="shadowOffsetOuter1" result="shadowBlurOuter1"></feGaussianBlur>
|
||||
<feColorMatrix values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.2 0" type="matrix" in="shadowBlurOuter1"></feColorMatrix>
|
||||
</filter>
|
||||
</defs>
|
||||
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
||||
<g id="磁盘挂载-48px">
|
||||
<rect id="Rectangle-33" opacity="0.623717351" x="0" y="0" width="48" height="48"></rect>
|
||||
<g id="Group-18" transform="translate(3.000000, 3.000000)">
|
||||
<g id="Oval-31">
|
||||
<use fill="black" fill-opacity="1" filter="url(#filter-2)" xlink:href="#path-1"></use>
|
||||
<use fill="#FF6932" fill-rule="evenodd" xlink:href="#path-1"></use>
|
||||
</g>
|
||||
<path d="M27.2564016,0.947743843 C25.2802948,0.331841898 23.1789003,0 21,0 C9.40202025,0 0,9.40202025 0,21 C0,25.6657423 1.52159116,29.9760978 4.09562199,33.4619153 L27.2564016,0.947743843 L27.2564016,0.947743843 Z" id="Combined-Shape" fill="#FFF357" opacity="0.29973181"></path>
|
||||
<path d="M14.7998047,0.947743843 C16.7759115,0.331841898 18.877306,0 21.0562063,0 C32.6541861,0 42.0562063,9.40202025 42.0562063,21 C42.0562063,25.6657423 40.5346152,29.9760978 37.9605843,33.4619153 L14.7998047,0.947743843 L14.7998047,0.947743843 Z" id="Combined-Shape" fill="#FFF357" opacity="0.29973181"></path>
|
||||
<path d="M21.0534566,9.80754157 L29.6091717,21.5854251 C30.5822675,22.9249986 30.0336876,24.0109375 28.3719359,24.0109375 L13.7444081,24.0109374 C12.0880058,24.0109374 11.5369797,22.9200048 12.5055618,21.5854251 L21.0534566,9.80754157 Z M11,28 C11,27.4477153 11.4553056,27 11.9918031,27 L30.0081969,27 C30.5559546,27 31,27.4438648 31,28 C31,28.5522847 30.5446944,29 30.0081969,29 L11.9918031,29 C11.4440454,29 11,28.5561352 11,28 Z" id="Combined-Shape" fill="#FFFFFF"></path>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
Before Width: | Height: | Size: 2.7 KiB |
@ -1,40 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg width="48px" height="48px" viewBox="0 0 48 48" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<!-- Generator: Sketch 39.1 (31720) - http://www.bohemiancoding.com/sketch -->
|
||||
<title>drive-unknown</title>
|
||||
<desc>Created with Sketch.</desc>
|
||||
<defs>
|
||||
<filter x="-50%" y="-50%" width="200%" height="200%" filterUnits="objectBoundingBox" id="filter-1">
|
||||
<feOffset dx="0" dy="1" in="SourceAlpha" result="shadowOffsetOuter1"></feOffset>
|
||||
<feGaussianBlur stdDeviation="1" in="shadowOffsetOuter1" result="shadowBlurOuter1"></feGaussianBlur>
|
||||
<feColorMatrix values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.3 0" type="matrix" in="shadowBlurOuter1" result="shadowMatrixOuter1"></feColorMatrix>
|
||||
<feMerge>
|
||||
<feMergeNode in="shadowMatrixOuter1"></feMergeNode>
|
||||
<feMergeNode in="SourceGraphic"></feMergeNode>
|
||||
</feMerge>
|
||||
</filter>
|
||||
<linearGradient x1="50%" y1="0.410554847%" x2="50%" y2="100%" id="linearGradient-2">
|
||||
<stop stop-color="#9DDA00" offset="0%"></stop>
|
||||
<stop stop-color="#73C300" offset="100%"></stop>
|
||||
</linearGradient>
|
||||
</defs>
|
||||
<g id="UI图标" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
||||
<g id="drive-unknown">
|
||||
<g id="Group-3" filter="url(#filter-1)" transform="translate(7.000000, 4.000000)">
|
||||
<rect id="Rectangle-1" fill="url(#linearGradient-2)" x="0" y="0" width="34" height="35" rx="1"></rect>
|
||||
<path d="M17.1411765,9 C15.8235294,9 14.7882353,9.42304585 14.0541176,10.3075963 C13.3764706,11.1152293 13.0188235,12.1536145 13,13.4612108 L14.1294118,13.4612108 C14.1482353,12.4612843 14.3741176,11.6536513 14.8258824,11.0575412 C15.3341176,10.3652843 16.0870588,10.0383853 17.0847059,10.0383853 C17.9694118,10.0383853 18.6658824,10.2691376 19.1552941,10.7691008 C19.6070588,11.2498348 19.8517647,11.9036329 19.8517647,12.7304952 C19.8517647,13.307376 19.6447059,13.845798 19.2682353,14.3649906 C19.1176471,14.5572842 18.8164706,14.8649539 18.3835294,15.2879997 C17.48,16.0956327 16.9152941,16.8071189 16.6517647,17.3839996 C16.4258824,17.8455042 16.3129412,18.3646968 16.3129412,18.9223482 L16.3129412,19.4799995 L17.4611765,19.4799995 L17.4611765,18.9223482 C17.4611765,18.3839262 17.5929412,17.8839629 17.8564706,17.4416877 C18.0447059,17.0955593 18.3647059,16.7302015 18.8164706,16.3456144 C19.5882353,15.6148988 20.0776471,15.1341649 20.3035294,14.8649539 C20.7552941,14.2303851 21,13.4996695 21,12.6920365 C21,11.5767338 20.6611765,10.6921834 19.9835294,10.0383853 C19.2870588,9.34612843 18.3458824,9 17.1411765,9 L17.1411765,9 Z M16.9221053,21.0769231 C16.6568421,21.0769231 16.4294737,21.1538462 16.2589474,21.3461538 C16.0505263,21.5192308 15.9557895,21.75 15.9557895,22.0384615 C15.9557895,22.3076923 16.0505263,22.5192308 16.2589474,22.7115385 C16.4294737,22.9038462 16.6568421,23 16.9221053,23 C17.1873684,23 17.4147368,22.9038462 17.6042105,22.7307692 C17.7936842,22.5384615 17.8884211,22.3076923 17.8884211,22.0384615 C17.8884211,21.75 17.7936842,21.5192308 17.6042105,21.3461538 C17.4147368,21.1538462 17.1873684,21.0769231 16.9221053,21.0769231 L16.9221053,21.0769231 Z" id="?" fill="#FFFFFF"></path>
|
||||
<rect id="Rectangle-3" fill="#FFFFFF" x="0" y="30" width="34" height="6"></rect>
|
||||
<rect id="Rectangle-1" fill="#DCDDDD" x="0" y="34" width="34" height="6" rx="1"></rect>
|
||||
<g id="Group" transform="translate(19.000000, 35.000000)" fill="#75C500">
|
||||
<rect id="Rectangle-path" x="10.987" y="0.996" width="1" height="2"></rect>
|
||||
<rect id="Rectangle-path" x="8.987" y="0.996" width="1" height="2"></rect>
|
||||
<rect id="Rectangle-path" x="6.987" y="0.996" width="1" height="2"></rect>
|
||||
<rect id="Rectangle-path" x="4.987" y="0.996" width="1" height="2"></rect>
|
||||
<rect id="Rectangle-path" x="2.987" y="0.996" width="1" height="2"></rect>
|
||||
<rect id="Rectangle-path" x="0.987" y="0.996" width="1" height="2"></rect>
|
||||
</g>
|
||||
<path d="M5,38 C5.55228475,38 6,37.5522847 6,37 C6,36.4477153 5.55228475,36 5,36 C4.44771525,36 4,36.4477153 4,37 C4,37.5522847 4.44771525,38 5,38 Z" id="Oval" fill="#75C600"></path>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
Before Width: | Height: | Size: 4.4 KiB |
Binary file not shown.
Before Width: | Height: | Size: 449 B |
Binary file not shown.
Before Width: | Height: | Size: 497 B |
Binary file not shown.
Before Width: | Height: | Size: 493 B |
@ -32,9 +32,9 @@
|
||||
#include <QApplication>
|
||||
#include <QScreen>
|
||||
|
||||
static const QString serviceName("com.deepin.daemon.Display");
|
||||
static const QString servicePath("/com/deepin/daemon/Display");
|
||||
static const QString serviceInterface("com.deepin.daemon.Display");
|
||||
static const QString serviceName("org.deepin.dde.Display1");
|
||||
static const QString servicePath("/org/deepin/dde/Display1");
|
||||
static const QString serviceInterface("org.deepin.dde.Display1");
|
||||
static const QString propertiesInterface("org.freedesktop.DBus.Properties");
|
||||
|
||||
BrightnessModel::BrightnessModel(QObject *parent)
|
||||
|
@ -32,9 +32,9 @@
|
||||
DGUI_USE_NAMESPACE
|
||||
DCORE_USE_NAMESPACE
|
||||
|
||||
static const QString CollaborationService = "com.deepin.Cooperation";
|
||||
static const QString CollaborationPath = "/com/deepin/Cooperation";
|
||||
static const QString CollaborationInterface = "com.deepin.Cooperation";
|
||||
static const QString CollaborationService = "org.deepin.dde.Cooperation1";
|
||||
static const QString CollaborationPath = "/org/deepin/dde/Cooperation1";
|
||||
static const QString CollaborationInterface = "org.deepin.dde.Cooperation1";
|
||||
static const QString ColPropertiesInterface = "org.freedesktop.DBus.Properties";
|
||||
|
||||
CollaborationDevModel::CollaborationDevModel(QObject *parent)
|
||||
|
@ -25,10 +25,10 @@
|
||||
|
||||
DBusAdaptors::DBusAdaptors(QObject *parent)
|
||||
: QDBusAbstractAdaptor(parent),
|
||||
m_keyboard(new Keyboard("com.deepin.daemon.InputDevices",
|
||||
"/com/deepin/daemon/InputDevice/Keyboard",
|
||||
m_keyboard(new Keyboard("org.deepin.dde.InputDevices1",
|
||||
"/org/deepin/dde/InputDevice1/Keyboard",
|
||||
QDBusConnection::sessionBus(), this)),
|
||||
m_menu(new QMenu()),
|
||||
m_menu(new QMenu()),
|
||||
m_gsettings(Utils::ModuleSettingsPtr("keyboard", QByteArray(), this))
|
||||
{
|
||||
m_keyboard->setSync(false);
|
||||
@ -173,7 +173,6 @@ void DBusAdaptors::refreshMenuSelection()
|
||||
void DBusAdaptors::handleActionTriggered(QAction *action)
|
||||
{
|
||||
if (action == m_addLayoutAction) {
|
||||
#ifdef USE_AM
|
||||
DDBusSender()
|
||||
.service("org.deepin.dde.ControlCenter1")
|
||||
.interface("org.deepin.dde.ControlCenter1")
|
||||
@ -182,16 +181,6 @@ void DBusAdaptors::handleActionTriggered(QAction *action)
|
||||
.arg(QString("keyboard"))
|
||||
.arg(QString("Keyboard Layout/Add Keyboard Layout"))
|
||||
.call();
|
||||
#else
|
||||
DDBusSender()
|
||||
.service("com.deepin.dde.ControlCenter")
|
||||
.interface("com.deepin.dde.ControlCenter")
|
||||
.path("/com/deepin/dde/ControlCenter")
|
||||
.method("ShowPage")
|
||||
.arg(QString("keyboard"))
|
||||
.arg(QString("Keyboard Layout/Add Keyboard Layout"))
|
||||
.call();
|
||||
#endif
|
||||
}
|
||||
|
||||
const QString layout = action->objectName();
|
||||
|
@ -22,17 +22,17 @@
|
||||
|
||||
#include <QMenu>
|
||||
#include <QtDBus/QtDBus>
|
||||
#include "org_deepin_daemon_inputdevice_keyboard.h"
|
||||
#include "org_deepin_dde_inputdevice1_keyboard.h"
|
||||
|
||||
using Keyboard = org::deepin::daemon::inputdevice::Keyboard1;
|
||||
using Keyboard = org::deepin::dde::inputdevice1::Keyboard1;
|
||||
class QGSettings;
|
||||
|
||||
class DBusAdaptors : public QDBusAbstractAdaptor
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_CLASSINFO("D-Bus Interface", "com.deepin.dde.Keyboard")
|
||||
Q_CLASSINFO("D-Bus Interface", "org.deepin.dde.Dock1.KeyboardLayout")
|
||||
// Q_CLASSINFO("D-Bus Introspection", ""
|
||||
// " <interface name=\"com.deepin.dde.Keyboard\">\n"
|
||||
// " <interface name=\"org.deepin.dde.Dock1.KeyboardLayout\">\n"
|
||||
// " <property access=\"read\" type=\"s\" name=\"layout\"/>\n"
|
||||
// " <signal name=\"layoutChanged\">"
|
||||
// " <arg name=\"layout\" type=\"s\"/>"
|
||||
|
@ -1,5 +1,5 @@
|
||||
<node>
|
||||
<interface name="org.deepin.daemon.InputDevice.Keyboard1">
|
||||
<interface name="org.deepin.dde.InputDevice1.Keyboard1">
|
||||
<method name="AddLayoutOption">
|
||||
<arg type="s" direction="in"></arg>
|
||||
</method>
|
@ -44,7 +44,7 @@ void KeyboardPlugin::init(PluginProxyInterface *proxyInter)
|
||||
m_proxyInter = proxyInter;
|
||||
if (!m_dbusAdaptors) {
|
||||
|
||||
QString serverName = "com.deepin.daemon.InputDevices";
|
||||
QString serverName = "org.deepin.dde.InputDevices1";
|
||||
QDBusConnectionInterface *ifc = QDBusConnection::sessionBus().interface();
|
||||
|
||||
if (!ifc->isServiceRegistered(serverName)) {
|
||||
@ -60,8 +60,8 @@ void KeyboardPlugin::init(PluginProxyInterface *proxyInter)
|
||||
m_dbusAdaptors = new DBusAdaptors(this);
|
||||
}
|
||||
|
||||
QDBusConnection::sessionBus().registerService("com.deepin.dde.Keyboard");
|
||||
QDBusConnection::sessionBus().registerObject("/com/deepin/dde/Keyboard", "com.deepin.dde.Keyboard", this);
|
||||
QDBusConnection::sessionBus().registerService("org.deepin.dde.Dock1.KeyboardLayout");
|
||||
QDBusConnection::sessionBus().registerObject("/org/deepin/dde/Dock1/KeyboardLayout", "org.deepin.dde.Dock1.KeyboardLayout", this);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,17 +1,17 @@
|
||||
{
|
||||
"data": {
|
||||
"text": {
|
||||
"dbus_service": "com.deepin.dde.Keyboard",
|
||||
"dbus_path": "/com/deepin/dde/Keyboard",
|
||||
"dbus_interface": "com.deepin.dde.Keyboard",
|
||||
"dbus_service": "org.deepin.dde.Dock1.KeyboardLayout",
|
||||
"dbus_path": "/org/deepin/dde/Dock1/KeyboardLayout",
|
||||
"dbus_interface": "org.deepin.dde.Dock1.KeyboardLayout",
|
||||
"dbus_properties": "layout"
|
||||
}
|
||||
},
|
||||
"action": {
|
||||
"trigger": {
|
||||
"dbus_service": "com.deepin.dde.Keyboard",
|
||||
"dbus_path": "/com/deepin/dde/Keyboard",
|
||||
"dbus_interface": "com.deepin.dde.Keyboard",
|
||||
"dbus_service": "org.deepin.dde.Dock1.KeyboardLayout",
|
||||
"dbus_path": "/org/deepin/dde/Dock1/KeyboardLayout",
|
||||
"dbus_interface": "org.deepin.dde.Dock1.KeyboardLayout",
|
||||
"dbus_method": "onClicked"
|
||||
}
|
||||
}
|
||||
|
@ -22,8 +22,8 @@
|
||||
#include "onboardplugin.h"
|
||||
#include "../widgets/tipswidget.h"
|
||||
|
||||
#include "org_deepin_dde_daemon_dock.h"
|
||||
#include "org_deepin_dde_daemon_dock_entry.h"
|
||||
#include "org_deepin_dde_daemon_dock1.h"
|
||||
#include "org_deepin_dde_daemon_dock1_entry.h"
|
||||
|
||||
#include <DGuiApplicationHelper>
|
||||
|
||||
|
@ -28,5 +28,5 @@ target_link_libraries(${PLUGIN_NAME} PRIVATE
|
||||
install(TARGETS ${PLUGIN_NAME} LIBRARY DESTINATION lib/dde-dock/plugins)
|
||||
|
||||
# policy kit
|
||||
install(FILES com.deepin.dde.dock.overlay.policy
|
||||
install(FILES org.deepin.dde.dock.overlay.policy
|
||||
DESTINATION share/polkit-1/actions/)
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user