mirror of
https://github.com/linuxdeepin/dde-dock.git
synced 2025-06-04 09:23:03 +00:00
feat: 修改部分函数命名和注释
函数命名变更,部分注释转移到源文件中,方便阅读头文件,去除mock的部分代码文件 Log: Change-Id: I9cbb7d5a21a60c4643efbf78da7c599d85bd0829
This commit is contained in:
parent
a84c837ba1
commit
e2e9211d1c
@ -24,61 +24,15 @@
|
|||||||
#include "launcheritem.h"
|
#include "launcheritem.h"
|
||||||
#include "pluginsitem.h"
|
#include "pluginsitem.h"
|
||||||
#include "traypluginitem.h"
|
#include "traypluginitem.h"
|
||||||
#include "qgsettingsinterfaceimpl.h"
|
#include "utils.h"
|
||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QGSettings>
|
#include <QGSettings>
|
||||||
|
|
||||||
DockItemManager *DockItemManager::INSTANCE = nullptr;
|
DockItemManager *DockItemManager::INSTANCE = nullptr;
|
||||||
|
const QGSettings *DockItemManager::m_appSettings = Utils::ModuleSettingsPtr("app");
|
||||||
static QGSettingsInterface *GSettingsByApp(QGSettingsInterface::Type type)
|
const QGSettings *DockItemManager::m_activeSettings = Utils::ModuleSettingsPtr("activeapp");
|
||||||
{
|
const QGSettings *DockItemManager::m_dockedSettings = Utils::ModuleSettingsPtr("dockapp");
|
||||||
switch (type) {
|
|
||||||
case QGSettingsInterface::Type::ImplType:
|
|
||||||
{
|
|
||||||
static QGSettingsInterfaceImpl settings("com.deepin.dde.dock.module.app");
|
|
||||||
return &settings;
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
{
|
|
||||||
qWarning("Unless you are doing unit testing, you should't see this message");
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static QGSettingsInterface *GSettingsByActiveApp(QGSettingsInterface::Type type)
|
|
||||||
{
|
|
||||||
switch (type) {
|
|
||||||
case QGSettingsInterface::Type::ImplType:
|
|
||||||
{
|
|
||||||
static QGSettingsInterfaceImpl settings("com.deepin.dde.dock.module.activeapp");
|
|
||||||
return &settings;
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
{
|
|
||||||
qWarning("Unless you are doing unit testing, you should't see this message");
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static QGSettingsInterface *GSettingsByDockApp(QGSettingsInterface::Type type)
|
|
||||||
{
|
|
||||||
switch (type) {
|
|
||||||
case QGSettingsInterface::Type::ImplType:
|
|
||||||
{
|
|
||||||
static QGSettingsInterfaceImpl settings("com.deepin.dde.dock.module.dockapp");
|
|
||||||
return &settings;
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
{
|
|
||||||
qWarning("Unless you are doing unit testing, you should't see this message");
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
DockItemManager::DockItemManager(QObject *parent)
|
DockItemManager::DockItemManager(QObject *parent)
|
||||||
: QObject(parent)
|
: QObject(parent)
|
||||||
@ -91,10 +45,7 @@ DockItemManager::DockItemManager(QObject *parent)
|
|||||||
|
|
||||||
// 应用区域
|
// 应用区域
|
||||||
for (auto entry : m_appInter->entries()) {
|
for (auto entry : m_appInter->entries()) {
|
||||||
AppItem *it = new AppItem(GSettingsByApp(QGSettingsInterface::ImplType)
|
AppItem *it = new AppItem(m_appSettings, m_activeSettings, m_dockedSettings, entry);
|
||||||
, GSettingsByActiveApp(QGSettingsInterface::ImplType)
|
|
||||||
, GSettingsByDockApp(QGSettingsInterface::ImplType)
|
|
||||||
, entry);
|
|
||||||
manageItem(it);
|
manageItem(it);
|
||||||
|
|
||||||
connect(it, &AppItem::requestActivateWindow, m_appInter, &DBusDock::ActivateWindow, Qt::QueuedConnection);
|
connect(it, &AppItem::requestActivateWindow, m_appInter, &DBusDock::ActivateWindow, Qt::QueuedConnection);
|
||||||
@ -149,14 +100,8 @@ bool DockItemManager::appIsOnDock(const QString &appDesktop) const
|
|||||||
|
|
||||||
void DockItemManager::startLoadPlugins() const
|
void DockItemManager::startLoadPlugins() const
|
||||||
{
|
{
|
||||||
if (!QGSettings::isSchemaInstalled("com.deepin.dde.dock")) {
|
int delay = Utils::SettingValue("com.deepin.dde.dock", "/com/deepin/dde/dock/", "delay-plugins-time", 0).toInt();
|
||||||
qWarning("com.deepin.dde.dock is not installed");
|
QTimer::singleShot(delay, m_pluginsInter, &DockPluginsController::startLoader);
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
QGSettings gsetting("com.deepin.dde.dock", "/com/deepin/dde/dock/");
|
|
||||||
|
|
||||||
QTimer::singleShot(gsetting.get("delay-plugins-time").toUInt(), m_pluginsInter, &DockPluginsController::startLoader);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DockItemManager::refershItemsIcon()
|
void DockItemManager::refershItemsIcon()
|
||||||
@ -243,10 +188,7 @@ void DockItemManager::appItemAdded(const QDBusObjectPath &path, const int index)
|
|||||||
++insertIndex;
|
++insertIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
AppItem *item = new AppItem(GSettingsByApp(QGSettingsInterface::ImplType)
|
AppItem *item = new AppItem(m_appSettings, m_activeSettings, m_dockedSettings, path);
|
||||||
, GSettingsByActiveApp(QGSettingsInterface::ImplType)
|
|
||||||
, GSettingsByDockApp(QGSettingsInterface::ImplType)
|
|
||||||
, path);
|
|
||||||
|
|
||||||
if (m_appIDist.contains(item->appId())) {
|
if (m_appIDist.contains(item->appId())) {
|
||||||
delete item;
|
delete item;
|
||||||
|
@ -85,6 +85,10 @@ private:
|
|||||||
QList<QString> m_appIDist;
|
QList<QString> m_appIDist;
|
||||||
|
|
||||||
bool m_loadFinished; // 记录所有插件是否加载完成
|
bool m_loadFinished; // 记录所有插件是否加载完成
|
||||||
|
|
||||||
|
static const QGSettings *m_appSettings;
|
||||||
|
static const QGSettings *m_activeSettings;
|
||||||
|
static const QGSettings *m_dockedSettings;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // DOCKITEMMANAGER_H
|
#endif // DOCKITEMMANAGER_H
|
||||||
|
@ -26,7 +26,6 @@
|
|||||||
#include "xcb_misc.h"
|
#include "xcb_misc.h"
|
||||||
#include "appswingeffectbuilder.h"
|
#include "appswingeffectbuilder.h"
|
||||||
#include "appspreviewprovider.h"
|
#include "appspreviewprovider.h"
|
||||||
#include "qgsettingsinterfaceimpl.h"
|
|
||||||
|
|
||||||
#include <X11/X.h>
|
#include <X11/X.h>
|
||||||
#include <X11/Xlib.h>
|
#include <X11/Xlib.h>
|
||||||
@ -40,17 +39,18 @@
|
|||||||
#include <QTimeLine>
|
#include <QTimeLine>
|
||||||
#include <QX11Info>
|
#include <QX11Info>
|
||||||
#include <QGSettings>
|
#include <QGSettings>
|
||||||
|
|
||||||
#include <DGuiApplicationHelper>
|
#include <DGuiApplicationHelper>
|
||||||
|
|
||||||
#define APP_DRAG_THRESHOLD 20
|
#define APP_DRAG_THRESHOLD 20
|
||||||
|
|
||||||
QPoint AppItem::MousePressPos;
|
QPoint AppItem::MousePressPos;
|
||||||
|
|
||||||
AppItem::AppItem(QGSettingsInterface *appSettings, QGSettingsInterface *activeAppSettings, QGSettingsInterface *dockedAppSettings, const QDBusObjectPath &entry, QWidget *parent)
|
AppItem::AppItem(const QGSettings *appSettings, const QGSettings *activeAppSettings, const QGSettings *dockedAppSettings, const QDBusObjectPath &entry, QWidget *parent)
|
||||||
: DockItem(parent)
|
: DockItem(parent)
|
||||||
, m_qgAppInterface(appSettings)
|
, m_appSettings(appSettings)
|
||||||
, m_qgActiveAppInterface(activeAppSettings)
|
, m_activeAppSettings(activeAppSettings)
|
||||||
, m_qgDockedAppInterface(dockedAppSettings)
|
, m_dockedAppSettings(dockedAppSettings)
|
||||||
, m_appNameTips(new TipsWidget(this))
|
, m_appNameTips(new TipsWidget(this))
|
||||||
, m_appPreviewTips(nullptr)
|
, m_appPreviewTips(nullptr)
|
||||||
, m_itemEntryInter(new DockEntryInter("com.deepin.dde.daemon.Dock", entry.path(), QDBusConnection::sessionBus(), this))
|
, m_itemEntryInter(new DockEntryInter("com.deepin.dde.daemon.Dock", entry.path(), QDBusConnection::sessionBus(), this))
|
||||||
@ -106,12 +106,12 @@ AppItem::AppItem(QGSettingsInterface *appSettings, QGSettingsInterface *activeAp
|
|||||||
updateWindowInfos(m_itemEntryInter->windowInfos());
|
updateWindowInfos(m_itemEntryInter->windowInfos());
|
||||||
refreshIcon();
|
refreshIcon();
|
||||||
|
|
||||||
if (m_qgAppInterface && m_qgAppInterface->gsettings())
|
if (m_appSettings)
|
||||||
connect(m_qgAppInterface->gsettings(), &QGSettings::changed, this, &AppItem::onGSettingsChanged);
|
connect(m_appSettings, &QGSettings::changed, this, &AppItem::onGSettingsChanged);
|
||||||
if (m_qgDockedAppInterface && m_qgDockedAppInterface->gsettings())
|
if (m_dockedAppSettings)
|
||||||
connect(m_qgDockedAppInterface->gsettings(), &QGSettings::changed, this, &AppItem::onGSettingsChanged);
|
connect(m_dockedAppSettings, &QGSettings::changed, this, &AppItem::onGSettingsChanged);
|
||||||
if (m_qgActiveAppInterface && m_qgActiveAppInterface->gsettings())
|
if (m_activeAppSettings)
|
||||||
connect(m_qgActiveAppInterface->gsettings(), &QGSettings::changed, this, &AppItem::onGSettingsChanged);
|
connect(m_activeAppSettings, &QGSettings::changed, this, &AppItem::onGSettingsChanged);
|
||||||
|
|
||||||
connect(DGuiApplicationHelper::instance(), &DGuiApplicationHelper::themeTypeChanged, this, &AppItem::onThemeTypeChanged);
|
connect(DGuiApplicationHelper::instance(), &DGuiApplicationHelper::themeTypeChanged, this, &AppItem::onThemeTypeChanged);
|
||||||
|
|
||||||
@ -340,7 +340,6 @@ void AppItem::mousePressEvent(QMouseEvent *e)
|
|||||||
if (checkGSettingsControl()) {
|
if (checkGSettingsControl()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_updateIconGeometryTimer->stop();
|
m_updateIconGeometryTimer->stop();
|
||||||
hidePopup();
|
hidePopup();
|
||||||
|
|
||||||
@ -706,24 +705,24 @@ void AppItem::onGSettingsChanged(const QString &key)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
QGSettingsInterface *setting = m_itemEntryInter->isDocked()
|
const QGSettings *setting = m_itemEntryInter->isDocked()
|
||||||
? m_qgDockedAppInterface
|
? m_dockedAppSettings
|
||||||
: m_qgActiveAppInterface;
|
: m_activeAppSettings;
|
||||||
|
|
||||||
if (setting->keys().contains("enable")) {
|
if (setting && setting->keys().contains("enable")) {
|
||||||
const bool isEnable = m_qgAppInterface->keys().contains("enable") && m_qgAppInterface->get("enable").toBool();
|
const bool isEnable = !m_appSettings || m_appSettings->keys().contains("enable") && m_appSettings->get("enable").toBool();
|
||||||
setVisible(isEnable && setting->get("enable").toBool());
|
setVisible(isEnable && setting->get("enable").toBool());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AppItem::checkGSettingsControl() const
|
bool AppItem::checkGSettingsControl() const
|
||||||
{
|
{
|
||||||
QGSettingsInterface *setting = m_itemEntryInter->isDocked()
|
const QGSettings *setting = m_itemEntryInter->isDocked()
|
||||||
? m_qgDockedAppInterface
|
? m_dockedAppSettings
|
||||||
: m_qgActiveAppInterface;
|
: m_activeAppSettings;
|
||||||
|
|
||||||
return (setting->keys().contains("control") && setting->get("control").toBool()) ||
|
return (setting && setting->keys().contains("control") && setting->get("control").toBool()) ||
|
||||||
(m_qgAppInterface->keys().contains("control") && m_qgAppInterface->get("control").toBool());
|
(m_appSettings && m_appSettings->keys().contains("control") && m_appSettings->get("control").toBool());
|
||||||
}
|
}
|
||||||
|
|
||||||
void AppItem::onThemeTypeChanged(DGuiApplicationHelper::ColorType themeType)
|
void AppItem::onThemeTypeChanged(DGuiApplicationHelper::ColorType themeType)
|
||||||
|
@ -28,7 +28,6 @@
|
|||||||
#include "appdrag.h"
|
#include "appdrag.h"
|
||||||
#include "dbusclientmanager.h"
|
#include "dbusclientmanager.h"
|
||||||
#include "../widgets/tipswidget.h"
|
#include "../widgets/tipswidget.h"
|
||||||
#include "qgsettingsinterface.h"
|
|
||||||
|
|
||||||
#include <QGraphicsView>
|
#include <QGraphicsView>
|
||||||
#include <QGraphicsItem>
|
#include <QGraphicsItem>
|
||||||
@ -38,13 +37,13 @@
|
|||||||
#include <com_deepin_dde_daemon_dock_entry.h>
|
#include <com_deepin_dde_daemon_dock_entry.h>
|
||||||
|
|
||||||
using DockEntryInter = com::deepin::dde::daemon::dock::Entry;
|
using DockEntryInter = com::deepin::dde::daemon::dock::Entry;
|
||||||
|
class QGSettings;
|
||||||
class AppItem : public DockItem
|
class AppItem : public DockItem
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit AppItem(QGSettingsInterface *appSettings, QGSettingsInterface *activeAppSettings, QGSettingsInterface *dockedAppSettings, const QDBusObjectPath &entry, QWidget *parent = nullptr);
|
explicit AppItem(const QGSettings *appSettings, const QGSettings *activeAppSettings, const QGSettings *dockedAppSettings, const QDBusObjectPath &entry, QWidget *parent = nullptr);
|
||||||
~AppItem() override;
|
~AppItem() override;
|
||||||
|
|
||||||
void checkEntry() override;
|
void checkEntry() override;
|
||||||
@ -103,9 +102,10 @@ private slots:
|
|||||||
void onThemeTypeChanged(DGuiApplicationHelper::ColorType themeType);
|
void onThemeTypeChanged(DGuiApplicationHelper::ColorType themeType);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QGSettingsInterface *m_qgAppInterface;
|
const QGSettings *m_appSettings;
|
||||||
QGSettingsInterface *m_qgActiveAppInterface;
|
const QGSettings *m_activeAppSettings;
|
||||||
QGSettingsInterface *m_qgDockedAppInterface;
|
const QGSettings *m_dockedAppSettings;
|
||||||
|
|
||||||
TipsWidget *m_appNameTips;
|
TipsWidget *m_appNameTips;
|
||||||
PreviewContainer *m_appPreviewTips;
|
PreviewContainer *m_appPreviewTips;
|
||||||
DockEntryInter *m_itemEntryInter;
|
DockEntryInter *m_itemEntryInter;
|
||||||
|
@ -20,11 +20,10 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "appdrag.h"
|
#include "appdrag.h"
|
||||||
#include "qgsettingsinterfaceimpl.h"
|
|
||||||
|
|
||||||
AppDrag::AppDrag(QGSettingsInterface *interface, QObject *dragSource)
|
AppDrag::AppDrag(QObject *dragSource)
|
||||||
: QDrag(dragSource)
|
: QDrag(dragSource)
|
||||||
, m_appDragWidget(new AppDragWidget(interface))
|
, m_appDragWidget(new AppDragWidget)
|
||||||
{
|
{
|
||||||
// delete by itself
|
// delete by itself
|
||||||
m_appDragWidget->setVisible(false);
|
m_appDragWidget->setVisible(false);
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
class AppDrag : public QDrag
|
class AppDrag : public QDrag
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit AppDrag(QGSettingsInterface *interface, QObject *dragSource);
|
explicit AppDrag(QObject *dragSource);
|
||||||
virtual ~AppDrag();
|
virtual ~AppDrag();
|
||||||
|
|
||||||
void setPixmap(const QPixmap &);
|
void setPixmap(const QPixmap &);
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
|
|
||||||
#include "../appitem.h"
|
#include "../appitem.h"
|
||||||
#include "appdragwidget.h"
|
#include "appdragwidget.h"
|
||||||
#include "qgsettingsinterface.h"
|
#include "utils.h"
|
||||||
|
|
||||||
class AppGraphicsObject : public QGraphicsObject
|
class AppGraphicsObject : public QGraphicsObject
|
||||||
{
|
{
|
||||||
@ -59,9 +59,8 @@ private:
|
|||||||
QPixmap m_appPixmap;
|
QPixmap m_appPixmap;
|
||||||
};
|
};
|
||||||
|
|
||||||
AppDragWidget::AppDragWidget(QGSettingsInterface *interface, QWidget *parent)
|
AppDragWidget::AppDragWidget(QWidget *parent)
|
||||||
: QGraphicsView(parent)
|
: QGraphicsView(parent)
|
||||||
, m_qgInterface(interface)
|
|
||||||
, m_object(new AppGraphicsObject)
|
, m_object(new AppGraphicsObject)
|
||||||
, m_scene(new QGraphicsScene(this))
|
, m_scene(new QGraphicsScene(this))
|
||||||
, m_followMouseTimer(new QTimer(this))
|
, m_followMouseTimer(new QTimer(this))
|
||||||
@ -72,7 +71,7 @@ AppDragWidget::AppDragWidget(QGSettingsInterface *interface, QWidget *parent)
|
|||||||
, m_goBackAnim(new QPropertyAnimation(this, "pos", this))
|
, m_goBackAnim(new QPropertyAnimation(this, "pos", this))
|
||||||
, m_removeTips(new TipsWidget(this))
|
, m_removeTips(new TipsWidget(this))
|
||||||
, m_popupWindow(nullptr)
|
, m_popupWindow(nullptr)
|
||||||
, m_distanceMultiple(interface->get("distance-multiple").toDouble())
|
, m_distanceMultiple(Utils::SettingValue("com.deepin.dde.dock.distancemultiple", "/com/deepin/dde/dock/distancemultiple/", "distance-multiple", 1.5).toDouble())
|
||||||
{
|
{
|
||||||
m_removeTips->setText(tr("Remove"));
|
m_removeTips->setText(tr("Remove"));
|
||||||
m_removeTips->setObjectName("AppRemoveTips");
|
m_removeTips->setObjectName("AppRemoveTips");
|
||||||
@ -123,9 +122,6 @@ AppDragWidget::~AppDragWidget()
|
|||||||
delete m_popupWindow;
|
delete m_popupWindow;
|
||||||
m_popupWindow=nullptr;
|
m_popupWindow=nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
delete m_qgInterface;
|
|
||||||
m_qgInterface = nullptr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AppDragWidget::mouseMoveEvent(QMouseEvent *event)
|
void AppDragWidget::mouseMoveEvent(QMouseEvent *event)
|
||||||
|
@ -37,13 +37,12 @@
|
|||||||
#include "../widgets/tipswidget.h"
|
#include "../widgets/tipswidget.h"
|
||||||
#include "dockpopupwindow.h"
|
#include "dockpopupwindow.h"
|
||||||
|
|
||||||
class QGSettingsInterface;
|
|
||||||
class AppGraphicsObject;
|
class AppGraphicsObject;
|
||||||
class AppDragWidget : public QGraphicsView
|
class AppDragWidget : public QGraphicsView
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit AppDragWidget(QGSettingsInterface *interface, QWidget *parent = Q_NULLPTR);
|
explicit AppDragWidget(QWidget *parent = Q_NULLPTR);
|
||||||
virtual ~AppDragWidget() override;
|
virtual ~AppDragWidget() override;
|
||||||
|
|
||||||
void setAppPixmap(const QPixmap &pix);
|
void setAppPixmap(const QPixmap &pix);
|
||||||
@ -75,7 +74,6 @@ private:
|
|||||||
bool isRemoveItem();
|
bool isRemoveItem();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QGSettingsInterface *m_qgInterface;
|
|
||||||
AppGraphicsObject *m_object;
|
AppGraphicsObject *m_object;
|
||||||
QGraphicsScene *m_scene;
|
QGraphicsScene *m_scene;
|
||||||
QTimer *m_followMouseTimer;
|
QTimer *m_followMouseTimer;
|
||||||
|
@ -36,7 +36,7 @@ LauncherItem::LauncherItem(QWidget *parent)
|
|||||||
: DockItem(parent)
|
: DockItem(parent)
|
||||||
, m_launcherInter(new LauncherInter("com.deepin.dde.Launcher", "/com/deepin/dde/Launcher", QDBusConnection::sessionBus(), this))
|
, m_launcherInter(new LauncherInter("com.deepin.dde.Launcher", "/com/deepin/dde/Launcher", QDBusConnection::sessionBus(), this))
|
||||||
, m_tips(new TipsWidget(this))
|
, m_tips(new TipsWidget(this))
|
||||||
, m_gsettings(Utils::SettingsPtr("launcher", this))
|
, m_gsettings(Utils::ModuleSettingsPtr("launcher", QByteArray(), this))
|
||||||
{
|
{
|
||||||
m_launcherInter->setSync(true, false);
|
m_launcherInter->setSync(true, false);
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ PluginsItem::PluginsItem(PluginsItemInterface *const pluginInter, const QString
|
|||||||
, m_pluginApi(plginApi)
|
, m_pluginApi(plginApi)
|
||||||
, m_itemKey(itemKey)
|
, m_itemKey(itemKey)
|
||||||
, m_dragging(false)
|
, m_dragging(false)
|
||||||
, m_gsettings(nullptr)
|
, m_gsettings(Utils::ModuleSettingsPtr(pluginInter->pluginName()))
|
||||||
{
|
{
|
||||||
qDebug() << "load plugins item: " << pluginInter->pluginName() << itemKey << m_centralWidget;
|
qDebug() << "load plugins item: " << pluginInter->pluginName() << itemKey << m_centralWidget;
|
||||||
|
|
||||||
@ -62,17 +62,8 @@ PluginsItem::PluginsItem(PluginsItemInterface *const pluginInter, const QString
|
|||||||
setAccessibleName(pluginInter->pluginName());
|
setAccessibleName(pluginInter->pluginName());
|
||||||
setAttribute(Qt::WA_TranslucentBackground);
|
setAttribute(Qt::WA_TranslucentBackground);
|
||||||
|
|
||||||
const QByteArray &schema{
|
if (m_gsettings)
|
||||||
QString("com.deepin.dde.dock.module.%1").arg(pluginInter->pluginName()).toUtf8()
|
connect(m_gsettings, &QGSettings::changed, this, &PluginsItem::onGSettingsChanged);
|
||||||
};
|
|
||||||
if (QGSettings::isSchemaInstalled(schema)) {
|
|
||||||
m_gsettings = new QGSettings(schema);
|
|
||||||
m_gsettings->setParent(this);
|
|
||||||
connect(m_gsettings, &QGSettings::changed, this,
|
|
||||||
&PluginsItem::onGSettingsChanged);
|
|
||||||
} else {
|
|
||||||
m_gsettings = nullptr;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PluginsItem::~PluginsItem()
|
PluginsItem::~PluginsItem()
|
||||||
@ -132,11 +123,11 @@ void PluginsItem::refreshIcon()
|
|||||||
|
|
||||||
void PluginsItem::onGSettingsChanged(const QString &key)
|
void PluginsItem::onGSettingsChanged(const QString &key)
|
||||||
{
|
{
|
||||||
if (key != "enable" || !m_gsettings) {
|
if (key != "enable") {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_gsettings->keys().contains("enable")) {
|
if (m_gsettings && m_gsettings->keys().contains("enable")) {
|
||||||
setVisible(m_gsettings->get("enable").toBool());
|
setVisible(m_gsettings->get("enable").toBool());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -308,16 +299,13 @@ void PluginsItem::mouseClicked()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// request popup applet
|
// request popup applet
|
||||||
QWidget *w = m_pluginInter->itemPopupApplet(m_itemKey);
|
if (QWidget *w = m_pluginInter->itemPopupApplet(m_itemKey))
|
||||||
if (w)
|
|
||||||
showPopupApplet(w);
|
showPopupApplet(w);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PluginsItem::checkGSettingsControl() const
|
bool PluginsItem::checkGSettingsControl() const
|
||||||
{
|
{
|
||||||
return m_gsettings ? m_gsettings->keys().contains("control") &&
|
return m_gsettings ? m_gsettings->keys().contains("control") && m_gsettings->get("control").toBool() : false;
|
||||||
m_gsettings->get("control").toBool()
|
|
||||||
: false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PluginsItem::resizeEvent(QResizeEvent *event)
|
void PluginsItem::resizeEvent(QResizeEvent *event)
|
||||||
|
@ -53,6 +53,8 @@ public:
|
|||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void refreshIcon() override;
|
void refreshIcon() override;
|
||||||
|
|
||||||
|
private slots:
|
||||||
void onGSettingsChanged(const QString &key);
|
void onGSettingsChanged(const QString &key);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@ -84,7 +86,7 @@ private:
|
|||||||
bool m_dragging;
|
bool m_dragging;
|
||||||
|
|
||||||
static QPoint MousePressPoint;
|
static QPoint MousePressPoint;
|
||||||
QGSettings *m_gsettings;
|
const QGSettings *m_gsettings;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // PLUGINSITEM_H
|
#endif // PLUGINSITEM_H
|
||||||
|
@ -20,9 +20,9 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "traypluginitem.h"
|
#include "traypluginitem.h"
|
||||||
|
#include "utils.h"
|
||||||
|
|
||||||
#include <QEvent>
|
#include <QEvent>
|
||||||
#include <QGSettings>
|
|
||||||
|
|
||||||
TrayPluginItem::TrayPluginItem(PluginsItemInterface * const pluginInter, const QString &itemKey, const QString &pluginApi, QWidget *parent)
|
TrayPluginItem::TrayPluginItem(PluginsItemInterface * const pluginInter, const QString &itemKey, const QString &pluginApi, QWidget *parent)
|
||||||
: PluginsItem(pluginInter, itemKey, pluginApi, parent)
|
: PluginsItem(pluginInter, itemKey, pluginApi, parent)
|
||||||
@ -54,11 +54,9 @@ bool TrayPluginItem::eventFilter(QObject *watched, QEvent *e)
|
|||||||
// 当接收到这个属性变化的事件后,重新计算和设置dock的大小
|
// 当接收到这个属性变化的事件后,重新计算和设置dock的大小
|
||||||
|
|
||||||
if (watched == centralWidget()) {
|
if (watched == centralWidget()) {
|
||||||
if (e->type() == QEvent::MouseButtonPress ||
|
if (e->type() == QEvent::MouseButtonPress || e->type() == QEvent::MouseButtonRelease) {
|
||||||
e->type() == QEvent::MouseButtonRelease) {
|
const QGSettings *settings = Utils::ModuleSettingsPtr("systemtray", QByteArray(), this);
|
||||||
QGSettings settings("com.deepin.dde.dock.module.systemtray");
|
if (settings && settings->keys().contains("control") && settings->get("control").toBool()) {
|
||||||
if (settings.keys().contains("control")
|
|
||||||
&& settings.get("control").toBool()) {
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -31,7 +31,6 @@
|
|||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QStandardPaths>
|
#include <QStandardPaths>
|
||||||
#include <QDateTime>
|
#include <QDateTime>
|
||||||
#include <QGSettings>
|
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
|
|
||||||
#include <DApplication>
|
#include <DApplication>
|
||||||
|
@ -1,50 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd.
|
|
||||||
*
|
|
||||||
* Author: fanpengcheng <fanpengcheng@uniontech.com>
|
|
||||||
*
|
|
||||||
* Maintainer: fanpengcheng <fanpengcheng@uniontech.com>
|
|
||||||
*
|
|
||||||
* 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 QGSETTINGSINTERFACE_H
|
|
||||||
#define QGSETTINGSINTERFACE_H
|
|
||||||
|
|
||||||
#include <QVariant>
|
|
||||||
#include <QStringList>
|
|
||||||
|
|
||||||
class QGSettings;
|
|
||||||
class QGSettingsInterface
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
enum Type {
|
|
||||||
ImplType, // 持有真正的QGSettings指针
|
|
||||||
MockType // Mock类
|
|
||||||
};
|
|
||||||
|
|
||||||
virtual ~QGSettingsInterface() {}
|
|
||||||
|
|
||||||
virtual Type type() = 0;
|
|
||||||
virtual QGSettings *gsettings() = 0;
|
|
||||||
virtual QVariant get(const QString &key) const = 0;
|
|
||||||
virtual void set(const QString &key, const QVariant &value) = 0;
|
|
||||||
virtual bool trySet(const QString &key, const QVariant &value) = 0;
|
|
||||||
virtual QStringList keys() const = 0;
|
|
||||||
virtual QVariantList choices(const QString &key) const = 0;
|
|
||||||
virtual void reset(const QString &key) = 0;
|
|
||||||
static bool isSchemaInstalled(const QByteArray &schema_id) {Q_UNUSED(schema_id); return false;}
|
|
||||||
|
|
||||||
};
|
|
||||||
#endif // QGSETTINGSINTERFACE_H
|
|
@ -1,80 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd.
|
|
||||||
*
|
|
||||||
* Author: fanpengcheng <fanpengcheng@uniontech.com>
|
|
||||||
*
|
|
||||||
* Maintainer: fanpengcheng <fanpengcheng@uniontech.com>
|
|
||||||
*
|
|
||||||
* 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 <QGSettings>
|
|
||||||
#include <QVariant>
|
|
||||||
|
|
||||||
#include "qgsettingsinterfaceimpl.h"
|
|
||||||
|
|
||||||
QGSettingsInterfaceImpl::QGSettingsInterfaceImpl(const QByteArray &schema_id, const QByteArray &path, QObject *parent)
|
|
||||||
: m_gsettings(new QGSettings(schema_id, path, parent))
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
QGSettingsInterfaceImpl::~QGSettingsInterfaceImpl()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
QGSettingsInterface::Type QGSettingsInterfaceImpl::type()
|
|
||||||
{
|
|
||||||
return Type::ImplType;
|
|
||||||
}
|
|
||||||
|
|
||||||
QGSettings *QGSettingsInterfaceImpl::gsettings()
|
|
||||||
{
|
|
||||||
return m_gsettings;
|
|
||||||
}
|
|
||||||
|
|
||||||
QVariant QGSettingsInterfaceImpl::get(const QString &key) const
|
|
||||||
{
|
|
||||||
return m_gsettings->get(key);
|
|
||||||
}
|
|
||||||
|
|
||||||
void QGSettingsInterfaceImpl::set(const QString &key, const QVariant &value)
|
|
||||||
{
|
|
||||||
return m_gsettings->set(key, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool QGSettingsInterfaceImpl::trySet(const QString &key, const QVariant &value)
|
|
||||||
{
|
|
||||||
return m_gsettings->trySet(key, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
QStringList QGSettingsInterfaceImpl::keys() const
|
|
||||||
{
|
|
||||||
return m_gsettings->keys();
|
|
||||||
}
|
|
||||||
|
|
||||||
QVariantList QGSettingsInterfaceImpl::choices(const QString &key) const
|
|
||||||
{
|
|
||||||
return m_gsettings->choices(key);
|
|
||||||
}
|
|
||||||
|
|
||||||
void QGSettingsInterfaceImpl::reset(const QString &key)
|
|
||||||
{
|
|
||||||
return m_gsettings->reset(key);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool QGSettingsInterfaceImpl::isSchemaInstalled(const QByteArray &schema_id)
|
|
||||||
{
|
|
||||||
return QGSettings::isSchemaInstalled(schema_id);
|
|
||||||
}
|
|
@ -1,48 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd.
|
|
||||||
*
|
|
||||||
* Author: fanpengcheng <fanpengcheng@uniontech.com>
|
|
||||||
*
|
|
||||||
* Maintainer: fanpengcheng <fanpengcheng@uniontech.com>
|
|
||||||
*
|
|
||||||
* 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 QGSETTINGSINTERFACEIMPL_H
|
|
||||||
#define QGSETTINGSINTERFACEIMPL_H
|
|
||||||
#include <QObject>
|
|
||||||
|
|
||||||
#include "qgsettingsinterface.h"
|
|
||||||
|
|
||||||
class QGSettings;
|
|
||||||
class QGSettingsInterfaceImpl : public QGSettingsInterface
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
QGSettingsInterfaceImpl(const QByteArray &schema_id, const QByteArray &path = QByteArray(), QObject *parent = nullptr);
|
|
||||||
~QGSettingsInterfaceImpl() override;
|
|
||||||
|
|
||||||
virtual Type type() override;
|
|
||||||
virtual QGSettings *gsettings() override;
|
|
||||||
virtual QVariant get(const QString &key) const override;
|
|
||||||
virtual void set(const QString &key, const QVariant &value) override;
|
|
||||||
virtual bool trySet(const QString &key, const QVariant &value) override;
|
|
||||||
virtual QStringList keys() const override;
|
|
||||||
virtual QVariantList choices(const QString &key) const override;
|
|
||||||
virtual void reset(const QString &key) override;
|
|
||||||
static bool isSchemaInstalled(const QByteArray &schema_id);
|
|
||||||
|
|
||||||
private:
|
|
||||||
QGSettings *m_gsettings;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // QGSETTINGSINTERFACEIMPL_H
|
|
@ -28,7 +28,6 @@
|
|||||||
#include "traypluginitem.h"
|
#include "traypluginitem.h"
|
||||||
#include "dockitemmanager.h"
|
#include "dockitemmanager.h"
|
||||||
#include "touchsignalmanager.h"
|
#include "touchsignalmanager.h"
|
||||||
#include "qgsettingsinterfaceimpl.h"
|
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
|
|
||||||
#include <QDrag>
|
#include <QDrag>
|
||||||
@ -623,7 +622,7 @@ bool MainPanelControl::eventFilter(QObject *watched, QEvent *event)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const QGSettings *g_settings = Utils::SettingsPtr("app");
|
static const QGSettings *g_settings = Utils::ModuleSettingsPtr("app");
|
||||||
if (!g_settings || !g_settings->keys().contains("removeable") || g_settings->get("removeable").toBool())
|
if (!g_settings || !g_settings->keys().contains("removeable") || g_settings->get("removeable").toBool())
|
||||||
startDrag(item);
|
startDrag(item);
|
||||||
|
|
||||||
@ -660,7 +659,7 @@ void MainPanelControl::startDrag(DockItem *dockItem)
|
|||||||
|
|
||||||
QDrag *drag = nullptr;
|
QDrag *drag = nullptr;
|
||||||
if (item->itemType() == DockItem::App) {
|
if (item->itemType() == DockItem::App) {
|
||||||
AppDrag *appDrag = new AppDrag(new QGSettingsInterfaceImpl("com.deepin.dde.dock.distancemultiple", "/com/deepin/dde/dock/distancemultiple/"),item);
|
AppDrag *appDrag = new AppDrag(item);
|
||||||
|
|
||||||
m_appDragWidget = appDrag->appDragWidget();
|
m_appDragWidget = appDrag->appDragWidget();
|
||||||
|
|
||||||
|
@ -21,12 +21,13 @@
|
|||||||
|
|
||||||
#include "abstractpluginscontroller.h"
|
#include "abstractpluginscontroller.h"
|
||||||
#include "pluginsiteminterface.h"
|
#include "pluginsiteminterface.h"
|
||||||
#include "DNotifySender"
|
#include "utils.h"
|
||||||
|
|
||||||
|
#include <DNotifySender>
|
||||||
#include <DSysInfo>
|
#include <DSysInfo>
|
||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QGSettings>
|
|
||||||
|
|
||||||
static const QStringList CompatiblePluginApiList {
|
static const QStringList CompatiblePluginApiList {
|
||||||
"1.1.1",
|
"1.1.1",
|
||||||
@ -160,11 +161,8 @@ void AbstractPluginsController::startLoader(PluginLoader *loader)
|
|||||||
});
|
});
|
||||||
connect(loader, &PluginLoader::pluginFounded, this, &AbstractPluginsController::loadPlugin, Qt::QueuedConnection);
|
connect(loader, &PluginLoader::pluginFounded, this, &AbstractPluginsController::loadPlugin, Qt::QueuedConnection);
|
||||||
|
|
||||||
|
int delay = Utils::SettingValue("com.deepin.dde.dock", "/com/deepin/dde/dock/", "delay-plugins-time", 0).toInt();
|
||||||
QGSettings gsetting("com.deepin.dde.dock", "/com/deepin/dde/dock/");
|
QTimer::singleShot(delay, loader, [ = ] { loader->start(QThread::LowestPriority); });
|
||||||
|
|
||||||
QTimer::singleShot(gsetting.get("delay-plugins-time").toUInt(),
|
|
||||||
loader, [ = ] { loader->start(QThread::LowestPriority); });
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AbstractPluginsController::displayModeChanged()
|
void AbstractPluginsController::displayModeChanged()
|
||||||
|
@ -50,7 +50,7 @@ QMenu *MenuWorker::createMenu()
|
|||||||
settingsMenu->setTitle("Settings Menu");
|
settingsMenu->setTitle("Settings Menu");
|
||||||
|
|
||||||
// 模式
|
// 模式
|
||||||
const QGSettings *menuSettings = Utils::SettingsPtr("menu");
|
const QGSettings *menuSettings = Utils::ModuleSettingsPtr("menu");
|
||||||
if (!menuSettings || !menuSettings->keys().contains("modeVisible") || menuSettings->get("modeVisible").toBool()) {
|
if (!menuSettings || !menuSettings->keys().contains("modeVisible") || menuSettings->get("modeVisible").toBool()) {
|
||||||
const DisplayMode displayMode = static_cast<DisplayMode>(m_dockInter->displayMode());
|
const DisplayMode displayMode = static_cast<DisplayMode>(m_dockInter->displayMode());
|
||||||
|
|
||||||
@ -168,7 +168,7 @@ QMenu *MenuWorker::createMenu()
|
|||||||
const QString &display = p->pluginDisplayName();
|
const QString &display = p->pluginDisplayName();
|
||||||
|
|
||||||
// 模块和菜单均需要响应enable配置的变化
|
// 模块和菜单均需要响应enable配置的变化
|
||||||
const QGSettings *setting = Utils::SettingsPtr(name);
|
const QGSettings *setting = Utils::ModuleSettingsPtr(name);
|
||||||
if (setting && setting->keys().contains("enable") && !setting->get("enable").toBool()) {
|
if (setting && setting->keys().contains("enable") && !setting->get("enable").toBool()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -192,7 +192,7 @@ QMenu *MenuWorker::createMenu()
|
|||||||
connect(act, &QAction::triggered, this, [ p ]{p->pluginStateSwitched();});
|
connect(act, &QAction::triggered, this, [ p ]{p->pluginStateSwitched();});
|
||||||
|
|
||||||
// check plugin hide menu.
|
// check plugin hide menu.
|
||||||
const QGSettings *pluginSettings = Utils::SettingsPtr(name);
|
const QGSettings *pluginSettings = Utils::ModuleSettingsPtr(name);
|
||||||
if (pluginSettings && (!pluginSettings->keys().contains("visible") || pluginSettings->get("visible").toBool()))
|
if (pluginSettings && (!pluginSettings->keys().contains("visible") || pluginSettings->get("visible").toBool()))
|
||||||
actions << act;
|
actions << act;
|
||||||
}
|
}
|
||||||
@ -220,7 +220,7 @@ QMenu *MenuWorker::createMenu()
|
|||||||
void MenuWorker::showDockSettingsMenu()
|
void MenuWorker::showDockSettingsMenu()
|
||||||
{
|
{
|
||||||
// 菜单功能被禁用
|
// 菜单功能被禁用
|
||||||
static const QGSettings *setting = Utils::SettingsPtr("menu", this);
|
static const QGSettings *setting = Utils::ModuleSettingsPtr("menu", QByteArray(), this);
|
||||||
if (setting && setting->keys().contains("enable") && !setting->get("enable").toBool()) {
|
if (setting && setting->keys().contains("enable") && !setting->get("enable").toBool()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
|
|
||||||
#include "multiscreenworker.h"
|
#include "multiscreenworker.h"
|
||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
|
#include "utils.h"
|
||||||
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
#include <QScreen>
|
#include <QScreen>
|
||||||
@ -50,8 +51,8 @@ MultiScreenWorker::MultiScreenWorker(QWidget *parent, DWindowManagerHelper *help
|
|||||||
, m_displayInter(new DisplayInter("com.deepin.daemon.Display", "/com/deepin/daemon/Display", QDBusConnection::sessionBus(), this))
|
, m_displayInter(new DisplayInter("com.deepin.daemon.Display", "/com/deepin/daemon/Display", QDBusConnection::sessionBus(), this))
|
||||||
, m_launcherInter(new DBusLuncher("com.deepin.dde.Launcher", "/com/deepin/dde/Launcher", QDBusConnection::sessionBus()))
|
, m_launcherInter(new DBusLuncher("com.deepin.dde.Launcher", "/com/deepin/dde/Launcher", QDBusConnection::sessionBus()))
|
||||||
, m_monitorUpdateTimer(new QTimer(this))
|
, m_monitorUpdateTimer(new QTimer(this))
|
||||||
, m_delayTimer(new QTimer(this))
|
, m_delayWakeTimer(new QTimer(this))
|
||||||
, m_monitorSetting(nullptr)
|
, m_gsettings(Utils::SettingsPtr("com.deepin.dde.dock.mainwindow", "/com/deepin/dde/dock/mainwindow/", this))
|
||||||
, m_ds(m_displayInter->primary())
|
, m_ds(m_displayInter->primary())
|
||||||
, m_monitorRotation(1)
|
, m_monitorRotation(1)
|
||||||
, m_showAniStart(false)
|
, m_showAniStart(false)
|
||||||
@ -80,7 +81,7 @@ void MultiScreenWorker::initShow()
|
|||||||
// 仅在初始化时调用一次
|
// 仅在初始化时调用一次
|
||||||
static bool first = true;
|
static bool first = true;
|
||||||
if (!first)
|
if (!first)
|
||||||
qFatal("this method can only be called once");
|
return;
|
||||||
first = false;
|
first = false;
|
||||||
|
|
||||||
// 这里是为了在调用时让MainWindow更新界面布局方向
|
// 这里是为了在调用时让MainWindow更新界面布局方向
|
||||||
@ -104,6 +105,14 @@ void MultiScreenWorker::initShow()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief dockRect
|
||||||
|
* @param screenName 屏幕名
|
||||||
|
* @param pos 任务栏位置
|
||||||
|
* @param hideMode 模式
|
||||||
|
* @param displayMode 状态
|
||||||
|
* @return 按照给定的数据计算出任务栏所在位置
|
||||||
|
*/
|
||||||
QRect MultiScreenWorker::dockRect(const QString &screenName, const Position &pos, const HideMode &hideMode, const DisplayMode &displayMode)
|
QRect MultiScreenWorker::dockRect(const QString &screenName, const Position &pos, const HideMode &hideMode, const DisplayMode &displayMode)
|
||||||
{
|
{
|
||||||
if (hideMode == HideMode::KeepShowing)
|
if (hideMode == HideMode::KeepShowing)
|
||||||
@ -112,11 +121,24 @@ QRect MultiScreenWorker::dockRect(const QString &screenName, const Position &pos
|
|||||||
return getDockHideGeometry(screenName, pos, displayMode);
|
return getDockHideGeometry(screenName, pos, displayMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief dockRect
|
||||||
|
* @param screenName 屏幕名
|
||||||
|
* @return 按照当前屏幕的当前属性给出任务栏所在区域
|
||||||
|
*/
|
||||||
QRect MultiScreenWorker::dockRect(const QString &screenName)
|
QRect MultiScreenWorker::dockRect(const QString &screenName)
|
||||||
{
|
{
|
||||||
return dockRect(screenName, m_position, m_hideMode, m_displayMode);
|
return dockRect(screenName, m_position, m_hideMode, m_displayMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief realDockRect 给出不计算缩放情况的区域信息(和后端接口保持一致)
|
||||||
|
* @param screenName 屏幕名
|
||||||
|
* @param pos 任务栏位置
|
||||||
|
* @param hideMode 模式
|
||||||
|
* @param displayMode 状态
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
QRect MultiScreenWorker::dockRectWithoutScale(const QString &screenName, const Position &pos, const HideMode &hideMode, const DisplayMode &displayMode)
|
QRect MultiScreenWorker::dockRectWithoutScale(const QString &screenName, const Position &pos, const HideMode &hideMode, const DisplayMode &displayMode)
|
||||||
{
|
{
|
||||||
if (hideMode == HideMode::KeepShowing)
|
if (hideMode == HideMode::KeepShowing)
|
||||||
@ -158,6 +180,10 @@ void MultiScreenWorker::onAutoHideChanged(bool autoHide)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief updateDaemonDockSize
|
||||||
|
* @param dockSize 这里的高度是通过qt获取的,不能使用后端的接口数据
|
||||||
|
*/
|
||||||
void MultiScreenWorker::updateDaemonDockSize(int dockSize)
|
void MultiScreenWorker::updateDaemonDockSize(int dockSize)
|
||||||
{
|
{
|
||||||
m_dockInter->setWindowSize(uint(dockSize));
|
m_dockInter->setWindowSize(uint(dockSize));
|
||||||
@ -228,7 +254,7 @@ void MultiScreenWorker::onExtralRegionMonitorChanged(int x, int y, const QString
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
// 鼠标移动到任务栏界面之外,停止计时器(延时2秒改变任务栏所在屏幕)
|
// 鼠标移动到任务栏界面之外,停止计时器(延时2秒改变任务栏所在屏幕)
|
||||||
m_delayTimer->stop();
|
m_delayWakeTimer->stop();
|
||||||
|
|
||||||
if (m_hideMode == HideMode::KeepShowing
|
if (m_hideMode == HideMode::KeepShowing
|
||||||
|| ((m_hideMode == HideMode::KeepHidden || m_hideMode == HideMode::SmartHide) && m_hideState == HideState::Show)) {
|
|| ((m_hideMode == HideMode::KeepHidden || m_hideMode == HideMode::SmartHide) && m_hideState == HideState::Show)) {
|
||||||
@ -544,6 +570,12 @@ void MultiScreenWorker::onOpacityChanged(const double value)
|
|||||||
emit opacityChanged(quint8(value * 255));
|
emit opacityChanged(quint8(value * 255));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief onRequestUpdateRegionMonitor 更新监听区域信息
|
||||||
|
* 触发时机:屏幕大小,屏幕坐标,屏幕数量,发生变化
|
||||||
|
* 任务栏位置发生变化
|
||||||
|
* 任务栏'模式'发生变化
|
||||||
|
*/
|
||||||
void MultiScreenWorker::onRequestUpdateRegionMonitor()
|
void MultiScreenWorker::onRequestUpdateRegionMonitor()
|
||||||
{
|
{
|
||||||
if (!m_registerKey.isEmpty()) {
|
if (!m_registerKey.isEmpty()) {
|
||||||
@ -955,13 +987,18 @@ void MultiScreenWorker::onRequestDelayShowDock(const QString &screenName)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MainWindow *MultiScreenWorker::parent()
|
||||||
|
{
|
||||||
|
return static_cast<MainWindow *>(m_parent);
|
||||||
|
}
|
||||||
|
|
||||||
void MultiScreenWorker::initMembers()
|
void MultiScreenWorker::initMembers()
|
||||||
{
|
{
|
||||||
m_monitorUpdateTimer->setInterval(100);
|
m_monitorUpdateTimer->setInterval(100);
|
||||||
m_monitorUpdateTimer->setSingleShot(true);
|
m_monitorUpdateTimer->setSingleShot(true);
|
||||||
|
|
||||||
m_delayTimer->setInterval(2000);
|
m_delayWakeTimer->setInterval(2000);
|
||||||
m_delayTimer->setSingleShot(true);
|
m_delayWakeTimer->setSingleShot(true);
|
||||||
|
|
||||||
// init check
|
// init check
|
||||||
checkDaemonDockService();
|
checkDaemonDockService();
|
||||||
@ -971,21 +1008,16 @@ void MultiScreenWorker::initMembers()
|
|||||||
|
|
||||||
void MultiScreenWorker::initGSettingConfig()
|
void MultiScreenWorker::initGSettingConfig()
|
||||||
{
|
{
|
||||||
if (QGSettings::isSchemaInstalled("com.deepin.dde.dock.mainwindow")) {
|
if (m_gsettings && m_gsettings->keys().contains(MonitorsSwitchTime)) {
|
||||||
m_monitorSetting = new QGSettings("com.deepin.dde.dock.mainwindow", "/com/deepin/dde/dock/mainwindow/", this);
|
m_delayWakeTimer->setInterval(m_gsettings->get(MonitorsSwitchTime).toInt());
|
||||||
if (m_monitorSetting->keys().contains(MonitorsSwitchTime)) {
|
|
||||||
m_delayTimer->setInterval(m_monitorSetting->get(MonitorsSwitchTime).toInt());
|
|
||||||
} else {
|
|
||||||
qWarning() << "can not find key:" << MonitorsSwitchTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (m_monitorSetting->keys().contains(OnlyShowPrimary)) {
|
|
||||||
m_mtrInfo.setShowInPrimary(m_monitorSetting->get(OnlyShowPrimary).toBool());
|
|
||||||
} else {
|
|
||||||
qWarning() << "can not find key:" << OnlyShowPrimary;
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
qWarning() << "com.deepin.dde.dock is uninstalled.";
|
qWarning() << "can not find key:" << MonitorsSwitchTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_gsettings && m_gsettings->keys().contains(OnlyShowPrimary)) {
|
||||||
|
m_mtrInfo.setShowInPrimary(m_gsettings->get(OnlyShowPrimary).toBool());
|
||||||
|
} else {
|
||||||
|
qWarning() << "can not find key:" << OnlyShowPrimary;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1027,7 +1059,7 @@ void MultiScreenWorker::initConnection()
|
|||||||
connect(this, &MultiScreenWorker::requestUpdateMonitorInfo, this, &MultiScreenWorker::onRequestUpdateMonitorInfo);
|
connect(this, &MultiScreenWorker::requestUpdateMonitorInfo, this, &MultiScreenWorker::onRequestUpdateMonitorInfo);
|
||||||
connect(this, &MultiScreenWorker::requestDelayShowDock, this, &MultiScreenWorker::onRequestDelayShowDock);
|
connect(this, &MultiScreenWorker::requestDelayShowDock, this, &MultiScreenWorker::onRequestDelayShowDock);
|
||||||
|
|
||||||
connect(m_delayTimer, &QTimer::timeout, this, &MultiScreenWorker::delayShowDock);
|
connect(m_delayWakeTimer, &QTimer::timeout, this, &MultiScreenWorker::delayShowDock);
|
||||||
|
|
||||||
// 更新任务栏内容展示
|
// 更新任务栏内容展示
|
||||||
connect(this, &MultiScreenWorker::requestUpdateLayout, this, [ = ] {
|
connect(this, &MultiScreenWorker::requestUpdateLayout, this, [ = ] {
|
||||||
@ -1060,7 +1092,8 @@ void MultiScreenWorker::initConnection()
|
|||||||
emit requestNotifyWindowManager();
|
emit requestNotifyWindowManager();
|
||||||
});
|
});
|
||||||
|
|
||||||
connect(m_monitorSetting, &QGSettings::changed, this, &MultiScreenWorker::onConfigChange);
|
if (m_gsettings)
|
||||||
|
connect(m_gsettings, &QGSettings::changed, this, &MultiScreenWorker::onGSettingsChange);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MultiScreenWorker::initUI()
|
void MultiScreenWorker::initUI()
|
||||||
@ -1105,6 +1138,10 @@ void MultiScreenWorker::initDBus()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief initDisplayData
|
||||||
|
* 初始化任务栏的所有必要信息,并更新其位置
|
||||||
|
*/
|
||||||
void MultiScreenWorker::initDisplayData()
|
void MultiScreenWorker::initDisplayData()
|
||||||
{
|
{
|
||||||
//1\初始化monitor信息
|
//1\初始化monitor信息
|
||||||
@ -1120,6 +1157,10 @@ void MultiScreenWorker::initDisplayData()
|
|||||||
resetDockScreen();
|
resetDockScreen();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief reInitDisplayData
|
||||||
|
* 重新初始化任务栏的所有必要信息,并更新其位置
|
||||||
|
*/
|
||||||
void MultiScreenWorker::reInitDisplayData()
|
void MultiScreenWorker::reInitDisplayData()
|
||||||
{
|
{
|
||||||
initDBus();
|
initDBus();
|
||||||
@ -1256,6 +1297,13 @@ void MultiScreenWorker::displayAnimation(const QString &screen, AniAction act)
|
|||||||
return displayAnimation(screen, m_position, act);
|
return displayAnimation(screen, m_position, act);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief changeDockPosition 做一个动画操作
|
||||||
|
* @param lastScreen 上次任务栏所在的屏幕
|
||||||
|
* @param deskScreen 任务栏要移动到的屏幕
|
||||||
|
* @param fromPos 任务栏上次的方向
|
||||||
|
* @param toPos 任务栏打算移动到的方向
|
||||||
|
*/
|
||||||
void MultiScreenWorker::changeDockPosition(QString fromScreen, QString toScreen, const Position &fromPos, const Position &toPos)
|
void MultiScreenWorker::changeDockPosition(QString fromScreen, QString toScreen, const Position &fromPos, const Position &toPos)
|
||||||
{
|
{
|
||||||
if (fromScreen == toScreen && fromPos == toPos) {
|
if (fromScreen == toScreen && fromPos == toPos) {
|
||||||
@ -1360,6 +1408,10 @@ void MultiScreenWorker::changeDockPosition(QString fromScreen, QString toScreen,
|
|||||||
group->start(QVariantAnimation::DeleteWhenStopped);
|
group->start(QVariantAnimation::DeleteWhenStopped);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief updateDockScreenName 将任务栏所在屏幕信息进行更新,在任务栏切换屏幕显示后,这里应该被调用
|
||||||
|
* @param screenName 目标屏幕
|
||||||
|
*/
|
||||||
void MultiScreenWorker::updateDockScreenName(const QString &screenName)
|
void MultiScreenWorker::updateDockScreenName(const QString &screenName)
|
||||||
{
|
{
|
||||||
Q_UNUSED(screenName);
|
Q_UNUSED(screenName);
|
||||||
@ -1369,6 +1421,10 @@ void MultiScreenWorker::updateDockScreenName(const QString &screenName)
|
|||||||
qInfo() << "update dock screen: " << m_ds.current();
|
qInfo() << "update dock screen: " << m_ds.current();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief getValidScreen 获取一个当前任务栏可以停靠的屏幕,优先使用主屏
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
QString MultiScreenWorker::getValidScreen(const Position &pos)
|
QString MultiScreenWorker::getValidScreen(const Position &pos)
|
||||||
{
|
{
|
||||||
QList<Monitor *> monitorList = m_mtrInfo.validMonitor();
|
QList<Monitor *> monitorList = m_mtrInfo.validMonitor();
|
||||||
@ -1407,6 +1463,9 @@ QString MultiScreenWorker::getValidScreen(const Position &pos)
|
|||||||
Q_UNREACHABLE();
|
Q_UNREACHABLE();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief resetDockScreen 检查一下当前屏幕所在边缘是够允许任务栏停靠,不允许的情况需要更换下一块屏幕
|
||||||
|
*/
|
||||||
void MultiScreenWorker::resetDockScreen()
|
void MultiScreenWorker::resetDockScreen()
|
||||||
{
|
{
|
||||||
QList<Monitor *> monitorList = m_mtrInfo.validMonitor();
|
QList<Monitor *> monitorList = m_mtrInfo.validMonitor();
|
||||||
@ -1437,6 +1496,10 @@ void MultiScreenWorker::resetDockScreen()
|
|||||||
parent()->panel()->move(0, 0);
|
parent()->panel()->move(0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief checkDaemonDockService
|
||||||
|
* 避免com.deepin.dde.daemon.Dock服务比dock晚启动,导致dock启动后的状态错误
|
||||||
|
*/
|
||||||
void MultiScreenWorker::checkDaemonDockService()
|
void MultiScreenWorker::checkDaemonDockService()
|
||||||
{
|
{
|
||||||
auto connectionInit = [ = ](DBusDock * dockInter) {
|
auto connectionInit = [ = ](DBusDock * dockInter) {
|
||||||
@ -1481,6 +1544,10 @@ void MultiScreenWorker::checkDaemonDockService()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief checkDaemonDisplayService
|
||||||
|
* 避免com.deepin.daemon.Display服务比dock晚启动,导致dock启动后的状态错误
|
||||||
|
*/
|
||||||
void MultiScreenWorker::checkDaemonDisplayService()
|
void MultiScreenWorker::checkDaemonDisplayService()
|
||||||
{
|
{
|
||||||
auto connectionInit = [ = ](DisplayInter *displayInter) {
|
auto connectionInit = [ = ](DisplayInter *displayInter) {
|
||||||
@ -1519,6 +1586,10 @@ void MultiScreenWorker::checkDaemonDisplayService()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief checkDaemonXEventMonitorService
|
||||||
|
* 避免com.deepin.api.XEventMonitor服务比dock晚启动,导致dock启动后的状态错误
|
||||||
|
*/
|
||||||
void MultiScreenWorker::checkXEventMonitorService()
|
void MultiScreenWorker::checkXEventMonitorService()
|
||||||
{
|
{
|
||||||
auto connectionInit = [ = ](XEventMonitor * eventInter, XEventMonitor * extralEventInter, XEventMonitor * touchEventInter) {
|
auto connectionInit = [ = ](XEventMonitor * eventInter, XEventMonitor * extralEventInter, XEventMonitor * touchEventInter) {
|
||||||
@ -1559,11 +1630,6 @@ void MultiScreenWorker::checkXEventMonitorService()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MainWindow *MultiScreenWorker::parent()
|
|
||||||
{
|
|
||||||
return static_cast<MainWindow *>(m_parent);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 获取任务栏显示时的参数。目前多屏情况下缩放保持一致,如果后续缩放规则修改,这里需要重新调整
|
* @brief 获取任务栏显示时的参数。目前多屏情况下缩放保持一致,如果后续缩放规则修改,这里需要重新调整
|
||||||
*
|
*
|
||||||
@ -1822,6 +1888,11 @@ void MultiScreenWorker::onTouchRelease(int type, int x, int y, const QString &ke
|
|||||||
tryToShowDock(x, y);
|
tryToShowDock(x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief tryToShowDock 根据xEvent监控区域信号的x,y坐标处理任务栏唤醒显示
|
||||||
|
* @param eventX 监控信号x坐标
|
||||||
|
* @param eventY 监控信号y坐标
|
||||||
|
*/
|
||||||
void MultiScreenWorker::tryToShowDock(int eventX, int eventY)
|
void MultiScreenWorker::tryToShowDock(int eventX, int eventY)
|
||||||
{
|
{
|
||||||
if (m_draging || m_aniStart) {
|
if (m_draging || m_aniStart) {
|
||||||
@ -1860,9 +1931,9 @@ void MultiScreenWorker::tryToShowDock(int eventX, int eventY)
|
|||||||
|
|
||||||
// 任务栏显示状态,但需要切换屏幕
|
// 任务栏显示状态,但需要切换屏幕
|
||||||
if (toScreen != m_ds.current()) {
|
if (toScreen != m_ds.current()) {
|
||||||
if (!m_delayTimer->isActive()) {
|
if (!m_delayWakeTimer->isActive()) {
|
||||||
m_delayScreen = toScreen;
|
m_delayScreen = toScreen;
|
||||||
m_delayTimer->start();
|
m_delayWakeTimer->start();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// 任务栏隐藏状态,但需要显示
|
// 任务栏隐藏状态,但需要显示
|
||||||
@ -1886,12 +1957,12 @@ void MultiScreenWorker::tryToShowDock(int eventX, int eventY)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MultiScreenWorker::onConfigChange(const QString &changeKey)
|
void MultiScreenWorker::onGSettingsChange(const QString &changeKey)
|
||||||
{
|
{
|
||||||
if (changeKey == MonitorsSwitchTime) {
|
if (changeKey == MonitorsSwitchTime) {
|
||||||
m_delayTimer->setInterval(m_monitorSetting->get(MonitorsSwitchTime).toInt());
|
m_delayWakeTimer->setInterval(m_gsettings ? m_gsettings->get(MonitorsSwitchTime).toInt() : 2000);
|
||||||
} else if (changeKey == OnlyShowPrimary) {
|
} else if (changeKey == OnlyShowPrimary) {
|
||||||
m_mtrInfo.setShowInPrimary(m_monitorSetting->get(OnlyShowPrimary).toBool());
|
m_mtrInfo.setShowInPrimary(m_gsettings && m_gsettings->get(OnlyShowPrimary).toBool());
|
||||||
// 每次切换都更新一下屏幕显示的信息
|
// 每次切换都更新一下屏幕显示的信息
|
||||||
emit requestUpdateMonitorInfo();
|
emit requestUpdateMonitorInfo();
|
||||||
}
|
}
|
||||||
|
@ -222,66 +222,18 @@ public:
|
|||||||
|
|
||||||
void initShow();
|
void initShow();
|
||||||
|
|
||||||
DBusDock *dockInter() {return m_dockInter;}
|
DBusDock *dockInter() { return m_dockInter; }
|
||||||
|
|
||||||
|
inline const QString &lastScreen() { return m_ds.last(); }
|
||||||
|
inline const QString &deskScreen() { return m_ds.current(); }
|
||||||
|
inline const Position &position() { return m_position; }
|
||||||
|
inline const DisplayMode &displayMode() { return m_displayMode; }
|
||||||
|
inline const HideMode &hideMode() { return m_hideMode; }
|
||||||
|
inline const HideState &hideState() { return m_hideState; }
|
||||||
|
inline quint8 opacity() { return m_opacity * 255; }
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief lastScreen
|
|
||||||
* @return 任务栏上次所在的屏幕
|
|
||||||
*/
|
|
||||||
inline const QString &lastScreen() {return m_ds.last();/*return m_lastScreen;*/}
|
|
||||||
/**
|
|
||||||
* @brief deskScreen
|
|
||||||
* @return 任务栏目标屏幕.可以理解为任务栏当前所在屏幕
|
|
||||||
*/
|
|
||||||
inline const QString &deskScreen() {return m_ds.current();/*return m_currentScreen;*/}
|
|
||||||
/**
|
|
||||||
* @brief position
|
|
||||||
* @return 任务栏所在方向(上下左右)
|
|
||||||
*/
|
|
||||||
inline const Position &position() {return m_position;}
|
|
||||||
/**
|
|
||||||
* @brief displayMode
|
|
||||||
* @return 任务栏显示模式(时尚模式,高效模式)
|
|
||||||
*/
|
|
||||||
inline const DisplayMode &displayMode() {return m_displayMode;}
|
|
||||||
/**
|
|
||||||
* @brief hideMode
|
|
||||||
* @return 任务栏状态(一直显示,一直隐藏,智能隐藏)
|
|
||||||
*/
|
|
||||||
inline const HideMode &hideMode() {return m_hideMode;}
|
|
||||||
/**
|
|
||||||
* @brief hideState
|
|
||||||
* @return 任务栏的智能隐藏时的一个状态值(1显示,2隐藏,其他不处理)
|
|
||||||
*/
|
|
||||||
inline const HideState &hideState() {return m_hideState;}
|
|
||||||
/**
|
|
||||||
* @brief opacity
|
|
||||||
* @return 任务栏透明度
|
|
||||||
*/
|
|
||||||
inline quint8 opacity() {return m_opacity * 255;}
|
|
||||||
/**
|
|
||||||
* @brief dockRect
|
|
||||||
* @param screenName 屏幕名
|
|
||||||
* @param pos 任务栏位置
|
|
||||||
* @param hideMode 模式
|
|
||||||
* @param displayMode 状态
|
|
||||||
* @return 按照给定的数据计算出任务栏所在位置
|
|
||||||
*/
|
|
||||||
QRect dockRect(const QString &screenName, const Position &pos, const HideMode &hideMode, const DisplayMode &displayMode);
|
QRect dockRect(const QString &screenName, const Position &pos, const HideMode &hideMode, const DisplayMode &displayMode);
|
||||||
/**
|
|
||||||
* @brief dockRect
|
|
||||||
* @param screenName 屏幕名
|
|
||||||
* @return 按照当前屏幕的当前属性给出任务栏所在区域
|
|
||||||
*/
|
|
||||||
QRect dockRect(const QString &screenName);
|
QRect dockRect(const QString &screenName);
|
||||||
/**
|
|
||||||
* @brief realDockRect 给出不计算缩放情况的区域信息(和后端接口保持一致)
|
|
||||||
* @param screenName 屏幕名
|
|
||||||
* @param pos 任务栏位置
|
|
||||||
* @param hideMode 模式
|
|
||||||
* @param displayMode 状态
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
QRect dockRectWithoutScale(const QString &screenName, const Position &pos, const HideMode &hideMode, const DisplayMode &displayMode);
|
QRect dockRectWithoutScale(const QString &screenName, const Position &pos, const HideMode &hideMode, const DisplayMode &displayMode);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
@ -305,13 +257,8 @@ signals:
|
|||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void onAutoHideChanged(bool autoHide);
|
void onAutoHideChanged(bool autoHide);
|
||||||
/**
|
|
||||||
* @brief updateDaemonDockSize
|
|
||||||
* @param dockSize 这里的高度是通过qt获取的,不能使用后端的接口数据
|
|
||||||
*/
|
|
||||||
void updateDaemonDockSize(int dockSize);
|
void updateDaemonDockSize(int dockSize);
|
||||||
void onDragStateChanged(bool draging);
|
void onDragStateChanged(bool draging);
|
||||||
|
|
||||||
void handleDbusSignal(QDBusMessage);
|
void handleDbusSignal(QDBusMessage);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
@ -341,12 +288,6 @@ private slots:
|
|||||||
void onHideStateChanged();
|
void onHideStateChanged();
|
||||||
void onOpacityChanged(const double value);
|
void onOpacityChanged(const double value);
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief onRequestUpdateRegionMonitor 更新监听区域信息
|
|
||||||
* 触发时机:屏幕大小,屏幕坐标,屏幕数量,发生变化
|
|
||||||
* 任务栏位置发生变化
|
|
||||||
* 任务栏'模式'发生变化
|
|
||||||
*/
|
|
||||||
void onRequestUpdateRegionMonitor();
|
void onRequestUpdateRegionMonitor();
|
||||||
|
|
||||||
// 通知后端任务栏所在位置
|
// 通知后端任务栏所在位置
|
||||||
@ -368,74 +309,32 @@ private slots:
|
|||||||
void onTouchRelease(int type, int x, int y, const QString &key);
|
void onTouchRelease(int type, int x, int y, const QString &key);
|
||||||
|
|
||||||
// gsetting配置改变响应槽
|
// gsetting配置改变响应槽
|
||||||
void onConfigChange(const QString &changeKey);
|
void onGSettingsChange(const QString &changeKey);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
MainWindow *parent();
|
||||||
// 初始化数据信息
|
// 初始化数据信息
|
||||||
void initMembers();
|
void initMembers();
|
||||||
void initGSettingConfig();
|
void initGSettingConfig();
|
||||||
void initDBus();
|
void initDBus();
|
||||||
void initConnection();
|
void initConnection();
|
||||||
void initUI();
|
void initUI();
|
||||||
/**
|
|
||||||
* @brief initDisplayData
|
|
||||||
* 初始化任务栏的所有必要信息,并更新其位置
|
|
||||||
*/
|
|
||||||
void initDisplayData();
|
void initDisplayData();
|
||||||
/**
|
|
||||||
* @brief reInitDisplayData
|
|
||||||
* 重新初始化任务栏的所有必要信息,并更新其位置
|
|
||||||
*/
|
|
||||||
void reInitDisplayData();
|
void reInitDisplayData();
|
||||||
|
|
||||||
void displayAnimation(const QString &screen, const Position &pos, AniAction act);
|
void displayAnimation(const QString &screen, const Position &pos, AniAction act);
|
||||||
|
|
||||||
void displayAnimation(const QString &screen, AniAction act);
|
void displayAnimation(const QString &screen, AniAction act);
|
||||||
/**
|
|
||||||
* @brief tryToShowDock 根据xEvent监控区域信号的x,y坐标处理任务栏唤醒显示
|
|
||||||
* @param eventX 监控信号x坐标
|
|
||||||
* @param eventY 监控信号y坐标
|
|
||||||
*/
|
|
||||||
void tryToShowDock(int eventX, int eventY);
|
|
||||||
/**
|
|
||||||
* @brief changeDockPosition 做一个动画操作
|
|
||||||
* @param lastScreen 上次任务栏所在的屏幕
|
|
||||||
* @param deskScreen 任务栏要移动到的屏幕
|
|
||||||
* @param fromPos 任务栏上次的方向
|
|
||||||
* @param toPos 任务栏打算移动到的方向
|
|
||||||
*/
|
|
||||||
void changeDockPosition(QString lastScreen, QString deskScreen, const Position &fromPos, const Position &toPos);
|
|
||||||
/**
|
|
||||||
* @brief updateDockScreenName 将任务栏所在屏幕信息进行更新,在任务栏切换屏幕显示后,这里应该被调用
|
|
||||||
* @param screenName 目标屏幕
|
|
||||||
*/
|
|
||||||
void updateDockScreenName(const QString &screenName);
|
|
||||||
/**
|
|
||||||
* @brief getValidScreen 获取一个当前任务栏可以停靠的屏幕,优先使用主屏
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
QString getValidScreen(const Position &pos);
|
|
||||||
/**
|
|
||||||
* @brief resetDockScreen 检查一下当前屏幕所在边缘是够允许任务栏停靠,不允许的情况需要更换下一块屏幕
|
|
||||||
*/
|
|
||||||
void resetDockScreen();
|
|
||||||
/**
|
|
||||||
* @brief checkDaemonDockService
|
|
||||||
* 避免com.deepin.dde.daemon.Dock服务比dock晚启动,导致dock启动后的状态错误
|
|
||||||
*/
|
|
||||||
void checkDaemonDockService();
|
|
||||||
/**
|
|
||||||
* @brief checkDaemonDisplayService
|
|
||||||
* 避免com.deepin.daemon.Display服务比dock晚启动,导致dock启动后的状态错误
|
|
||||||
*/
|
|
||||||
void checkDaemonDisplayService();
|
|
||||||
/**
|
|
||||||
* @brief checkDaemonXEventMonitorService
|
|
||||||
* 避免com.deepin.api.XEventMonitor服务比dock晚启动,导致dock启动后的状态错误
|
|
||||||
*/
|
|
||||||
void checkXEventMonitorService();
|
|
||||||
|
|
||||||
MainWindow *parent();
|
void tryToShowDock(int eventX, int eventY);
|
||||||
|
void changeDockPosition(QString lastScreen, QString deskScreen, const Position &fromPos, const Position &toPos);
|
||||||
|
|
||||||
|
void updateDockScreenName(const QString &screenName);
|
||||||
|
QString getValidScreen(const Position &pos);
|
||||||
|
void resetDockScreen();
|
||||||
|
|
||||||
|
void checkDaemonDockService();
|
||||||
|
void checkDaemonDisplayService();
|
||||||
|
void checkXEventMonitorService();
|
||||||
|
|
||||||
QRect getDockShowGeometry(const QString &screenName, const Position &pos, const DisplayMode &displaymode, bool withoutScale = false);
|
QRect getDockShowGeometry(const QString &screenName, const Position &pos, const DisplayMode &displaymode, bool withoutScale = false);
|
||||||
QRect getDockHideGeometry(const QString &screenName, const Position &pos, const DisplayMode &displaymode, bool withoutScale = false);
|
QRect getDockHideGeometry(const QString &screenName, const Position &pos, const DisplayMode &displaymode, bool withoutScale = false);
|
||||||
@ -465,14 +364,12 @@ private:
|
|||||||
|
|
||||||
// update monitor info
|
// update monitor info
|
||||||
QTimer *m_monitorUpdateTimer;
|
QTimer *m_monitorUpdateTimer;
|
||||||
QTimer *m_delayTimer; // sp3需求,切换屏幕显示延时,默认2秒唤起任务栏
|
QTimer *m_delayWakeTimer; // sp3需求,切换屏幕显示延时,默认2秒唤起任务栏
|
||||||
|
|
||||||
QGSettings *m_monitorSetting; // 多屏配置控制
|
const QGSettings *m_gsettings; // 多屏配置控制
|
||||||
|
|
||||||
// 屏幕名称信息
|
DockScreen m_ds; // 屏幕名称信息
|
||||||
DockScreen m_ds;
|
MonitorInfo m_mtrInfo; // 显示器信息
|
||||||
// 显示器信息
|
|
||||||
MonitorInfo m_mtrInfo;
|
|
||||||
|
|
||||||
// 任务栏属性
|
// 任务栏属性
|
||||||
double m_opacity;
|
double m_opacity;
|
||||||
@ -481,10 +378,8 @@ private:
|
|||||||
HideState m_hideState;
|
HideState m_hideState;
|
||||||
DisplayMode m_displayMode;
|
DisplayMode m_displayMode;
|
||||||
|
|
||||||
//当前屏幕的方向
|
int m_monitorRotation; //当前屏幕的方向
|
||||||
int m_monitorRotation;
|
RotationList m_rotations; // 当前屏幕的所有方向,逆时针旋转(向下,向右,向上,向左)
|
||||||
//当前屏幕的所有方向
|
|
||||||
RotationList m_rotations; // 逆时针旋转(向下,向右,向上,向左)
|
|
||||||
|
|
||||||
/***************不和其他流程产生交互,尽量不要动这里的变量***************/
|
/***************不和其他流程产生交互,尽量不要动这里的变量***************/
|
||||||
int m_screenRawHeight;
|
int m_screenRawHeight;
|
||||||
|
@ -25,16 +25,59 @@
|
|||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QScreen>
|
#include <QScreen>
|
||||||
#include <QGSettings>
|
#include <QGSettings>
|
||||||
|
#include <QDebug>
|
||||||
|
|
||||||
namespace Utils {
|
namespace Utils {
|
||||||
|
|
||||||
#define ICBC_CONF_FILE "/etc/deepin/icbc.conf"
|
#define ICBC_CONF_FILE "/etc/deepin/icbc.conf"
|
||||||
|
|
||||||
// 这样命名就是为了强调这是个指针类型
|
/**
|
||||||
inline const QGSettings *SettingsPtr(const QString &module, QObject *parent = nullptr) {
|
* @brief SettingsPtr 根据给定信息返回一个QGSettings指针
|
||||||
return QGSettings::isSchemaInstalled(QString("com.deepin.dde.dock.module." + module).toUtf8())
|
* @param schema_id The id of the schema
|
||||||
? new QGSettings(QString("com.deepin.dde.dock.module." + module).toUtf8(), QByteArray(), parent) // 自动销毁
|
* @param path If non-empty, specifies the path for a relocatable schema
|
||||||
: nullptr;
|
* @param parent 创建指针的付对象
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
inline const QGSettings *SettingsPtr(const QString &schema_id, const QByteArray &path = QByteArray(), QObject *parent = nullptr) {
|
||||||
|
if (QGSettings::isSchemaInstalled(schema_id.toUtf8())) {
|
||||||
|
QGSettings *settings = new QGSettings(schema_id.toUtf8(), path, parent);
|
||||||
|
return settings;
|
||||||
|
}
|
||||||
|
qDebug() << "Cannot find gsettings, schema_id:" << schema_id;
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief SettingsPtr 根据给定信息返回一个QGSettings指针
|
||||||
|
* @param module 传入QGSettings构造函数时,会添加"com.deepin.dde.dock.module."前缀
|
||||||
|
* @param path If non-empty, specifies the path for a relocatable schema
|
||||||
|
* @param parent 创建指针的付对象
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
inline const QGSettings *ModuleSettingsPtr(const QString &module, const QByteArray &path = QByteArray(), QObject *parent = nullptr) {
|
||||||
|
return SettingsPtr("com.deepin.dde.dock.module." + module, path, parent);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief SettingValue 根据给定信息返回获取的值
|
||||||
|
* @param schema_id The id of the schema
|
||||||
|
* @param path If non-empty, specifies the path for a relocatable schema
|
||||||
|
* @param key 对应信息的key值
|
||||||
|
* @param fallback 如果找不到信息,返回此默认值
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
inline const QVariant SettingValue(const QString &schema_id, const QByteArray &path = QByteArray(), const QString &key = QString(), const QVariant &fallback = QVariant()){
|
||||||
|
const QGSettings *settings = SettingsPtr(schema_id, path);
|
||||||
|
if (settings && settings->keys().contains(key)) {
|
||||||
|
QVariant v = settings->get(key);
|
||||||
|
delete settings;
|
||||||
|
return v;
|
||||||
|
} else{
|
||||||
|
qDebug() << "Cannot find gsettings, schema_id:" << schema_id
|
||||||
|
<< " path:" << path << " key:" << key
|
||||||
|
<< "Use fallback value:" << fallback;
|
||||||
|
return fallback;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
inline QPixmap renderSVG(const QString &path, const QSize &size, const qreal devicePixelRatio) {
|
inline QPixmap renderSVG(const QString &path, const QSize &size, const qreal devicePixelRatio) {
|
||||||
@ -53,7 +96,7 @@ inline QPixmap renderSVG(const QString &path, const QSize &size, const qreal dev
|
|||||||
return pixmap;
|
return pixmap;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline QScreen * screenAt(const QPoint &point) {
|
inline QScreen *screenAt(const QPoint &point) {
|
||||||
for (QScreen *screen : qApp->screens()) {
|
for (QScreen *screen : qApp->screens()) {
|
||||||
const QRect r { screen->geometry() };
|
const QRect r { screen->geometry() };
|
||||||
const QRect rect { r.topLeft(), r.size() * screen->devicePixelRatio() };
|
const QRect rect { r.topLeft(), r.size() * screen->devicePixelRatio() };
|
||||||
@ -66,7 +109,7 @@ inline QScreen * screenAt(const QPoint &point) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//!!! 注意:这里传入的QPoint是未计算缩放的
|
//!!! 注意:这里传入的QPoint是未计算缩放的
|
||||||
inline QScreen * screenAtByScaled(const QPoint &point) {
|
inline QScreen *screenAtByScaled(const QPoint &point) {
|
||||||
for (QScreen *screen : qApp->screens()) {
|
for (QScreen *screen : qApp->screens()) {
|
||||||
const QRect r { screen->geometry() };
|
const QRect r { screen->geometry() };
|
||||||
QRect rect { r.topLeft(), r.size() * screen->devicePixelRatio() };
|
QRect rect { r.topLeft(), r.size() * screen->devicePixelRatio() };
|
||||||
|
@ -39,7 +39,6 @@
|
|||||||
#include <QGuiApplication>
|
#include <QGuiApplication>
|
||||||
#include <QX11Info>
|
#include <QX11Info>
|
||||||
#include <qpa/qplatformwindow.h>
|
#include <qpa/qplatformwindow.h>
|
||||||
#include <QGSettings>
|
|
||||||
|
|
||||||
#include <X11/X.h>
|
#include <X11/X.h>
|
||||||
#include <X11/Xutil.h>
|
#include <X11/Xutil.h>
|
||||||
@ -523,8 +522,7 @@ void MainWindow::touchRequestResizeDock()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
QGSettings settings("com.deepin.dde.dock.touch", QByteArray(), this);
|
int resizeHeight = Utils::SettingValue("com.deepin.dde.dock.touch", QByteArray(), "resizeHeight", 7).toInt();
|
||||||
int resizeHeight = settings.get("resizeHeight").toInt();
|
|
||||||
|
|
||||||
QRect touchRect;
|
QRect touchRect;
|
||||||
// 任务栏屏幕 内侧边线 内外resizeHeight距离矩形区域内长按可拖动任务栏高度
|
// 任务栏屏幕 内侧边线 内外resizeHeight距离矩形区域内长按可拖动任务栏高度
|
||||||
|
@ -25,7 +25,6 @@
|
|||||||
#include <DDBusSender>
|
#include <DDBusSender>
|
||||||
|
|
||||||
#include <QJsonDocument>
|
#include <QJsonDocument>
|
||||||
#include <QGSettings>
|
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
|
|
||||||
using namespace dde::network;
|
using namespace dde::network;
|
||||||
|
@ -44,7 +44,7 @@ ShutdownPlugin::ShutdownPlugin(QObject *parent)
|
|||||||
, m_pluginLoaded(false)
|
, m_pluginLoaded(false)
|
||||||
, m_tipsLabel(new TipsWidget)
|
, m_tipsLabel(new TipsWidget)
|
||||||
, m_powerManagerInter(new DBusPowerManager("com.deepin.daemon.PowerManager", "/com/deepin/daemon/PowerManager", QDBusConnection::systemBus(), this))
|
, m_powerManagerInter(new DBusPowerManager("com.deepin.daemon.PowerManager", "/com/deepin/daemon/PowerManager", QDBusConnection::systemBus(), this))
|
||||||
, m_gsettings(new QGSettings("com.deepin.dde.dock.module.shutdown", QByteArray(), this))
|
, m_gsettings(Utils::ModuleSettingsPtr("shutdown", QByteArray(), this))
|
||||||
{
|
{
|
||||||
m_tipsLabel->setVisible(false);
|
m_tipsLabel->setVisible(false);
|
||||||
m_tipsLabel->setAccessibleName("shutdown");
|
m_tipsLabel->setAccessibleName("shutdown");
|
||||||
@ -118,7 +118,7 @@ const QString ShutdownPlugin::itemContextMenu(const QString &itemKey)
|
|||||||
items.reserve(6);
|
items.reserve(6);
|
||||||
|
|
||||||
QMap<QString, QVariant> shutdown;
|
QMap<QString, QVariant> shutdown;
|
||||||
if (m_gsettings->get(GSETTING_SHOW_SHUTDOWN).toBool()) {
|
if (!m_gsettings || (m_gsettings->keys().contains(GSETTING_SHOW_SHUTDOWN) && m_gsettings->get(GSETTING_SHOW_SHUTDOWN).toBool())) {
|
||||||
shutdown["itemId"] = "Shutdown";
|
shutdown["itemId"] = "Shutdown";
|
||||||
shutdown["itemText"] = tr("Shut down");
|
shutdown["itemText"] = tr("Shut down");
|
||||||
shutdown["isActive"] = true;
|
shutdown["isActive"] = true;
|
||||||
@ -140,7 +140,7 @@ const QString ShutdownPlugin::itemContextMenu(const QString &itemKey)
|
|||||||
;
|
;
|
||||||
if (can_sleep) {
|
if (can_sleep) {
|
||||||
QMap<QString, QVariant> suspend;
|
QMap<QString, QVariant> suspend;
|
||||||
if (m_gsettings->get(GSETTING_SHOW_SUSPEND).toBool()) {
|
if (!m_gsettings || (m_gsettings->keys().contains(GSETTING_SHOW_SUSPEND) && m_gsettings->get(GSETTING_SHOW_SUSPEND).toBool())) {
|
||||||
suspend["itemId"] = "Suspend";
|
suspend["itemId"] = "Suspend";
|
||||||
suspend["itemText"] = tr("Suspend");
|
suspend["itemText"] = tr("Suspend");
|
||||||
suspend["isActive"] = true;
|
suspend["isActive"] = true;
|
||||||
@ -153,7 +153,7 @@ const QString ShutdownPlugin::itemContextMenu(const QString &itemKey)
|
|||||||
|
|
||||||
if (can_hibernate) {
|
if (can_hibernate) {
|
||||||
QMap<QString, QVariant> hibernate;
|
QMap<QString, QVariant> hibernate;
|
||||||
if (m_gsettings->get(GSETTING_SHOW_HIBERNATE).toBool()) {
|
if (!m_gsettings || (m_gsettings->keys().contains(GSETTING_SHOW_HIBERNATE) && m_gsettings->get(GSETTING_SHOW_HIBERNATE).toBool())) {
|
||||||
hibernate["itemId"] = "Hibernate";
|
hibernate["itemId"] = "Hibernate";
|
||||||
hibernate["itemText"] = tr("Hibernate");
|
hibernate["itemText"] = tr("Hibernate");
|
||||||
hibernate["isActive"] = true;
|
hibernate["isActive"] = true;
|
||||||
@ -164,7 +164,7 @@ const QString ShutdownPlugin::itemContextMenu(const QString &itemKey)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
QMap<QString, QVariant> lock;
|
QMap<QString, QVariant> lock;
|
||||||
if (m_gsettings->get(GSETTING_SHOW_LOCK).toBool()) {
|
if (!m_gsettings || (m_gsettings->keys().contains(GSETTING_SHOW_LOCK) && m_gsettings->get(GSETTING_SHOW_LOCK).toBool())) {
|
||||||
lock["itemId"] = "Lock";
|
lock["itemId"] = "Lock";
|
||||||
lock["itemText"] = tr("Lock");
|
lock["itemText"] = tr("Lock");
|
||||||
lock["isActive"] = true;
|
lock["isActive"] = true;
|
||||||
|
@ -113,7 +113,7 @@ private:
|
|||||||
ShutdownWidget *m_shutdownWidget;
|
ShutdownWidget *m_shutdownWidget;
|
||||||
Dock::TipsWidget *m_tipsLabel;
|
Dock::TipsWidget *m_tipsLabel;
|
||||||
DBusPowerManager* m_powerManagerInter;
|
DBusPowerManager* m_powerManagerInter;
|
||||||
QGSettings *m_gsettings;
|
const QGSettings *m_gsettings;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // SHUTDOWNPLUGIN_H
|
#endif // SHUTDOWNPLUGIN_H
|
||||||
|
@ -25,14 +25,15 @@
|
|||||||
#include "../widgets/tipswidget.h"
|
#include "../widgets/tipswidget.h"
|
||||||
#include "../frame/util/imageutil.h"
|
#include "../frame/util/imageutil.h"
|
||||||
#include "util/utils.h"
|
#include "util/utils.h"
|
||||||
|
|
||||||
#include <DGuiApplicationHelper>
|
#include <DGuiApplicationHelper>
|
||||||
|
#include <DApplication>
|
||||||
|
#include <DStandardItem>
|
||||||
|
#include <DFontSizeManager>
|
||||||
|
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include <QIcon>
|
#include <QIcon>
|
||||||
#include <QScrollBar>
|
#include <QScrollBar>
|
||||||
#include <DApplication>
|
|
||||||
#include <DStandardItem>
|
|
||||||
#include <DFontSizeManager>
|
|
||||||
|
|
||||||
#define WIDTH 260
|
#define WIDTH 260
|
||||||
#define MAX_HEIGHT 300
|
#define MAX_HEIGHT 300
|
||||||
@ -120,7 +121,7 @@ SoundApplet::SoundApplet(QWidget *parent)
|
|||||||
, m_model(new QStandardItemModel(m_listView))
|
, m_model(new QStandardItemModel(m_listView))
|
||||||
, m_deviceInfo("")
|
, m_deviceInfo("")
|
||||||
, m_lastPort(nullptr)
|
, m_lastPort(nullptr)
|
||||||
, m_gsettings(new QGSettings("com.deepin.dde.dock.module.sound", QByteArray(), this))
|
, m_gsettings(Utils::ModuleSettingsPtr("sound", QByteArray(), this))
|
||||||
|
|
||||||
{
|
{
|
||||||
initUi();
|
initUi();
|
||||||
@ -183,7 +184,7 @@ void SoundApplet::initUi()
|
|||||||
m_volumeSlider->setFixedHeight(SLIDER_HIGHT);
|
m_volumeSlider->setFixedHeight(SLIDER_HIGHT);
|
||||||
m_volumeSlider->setMinimum(0);
|
m_volumeSlider->setMinimum(0);
|
||||||
m_volumeSlider->setMaximum(m_audioInter->maxUIVolume() * 100.0f);
|
m_volumeSlider->setMaximum(m_audioInter->maxUIVolume() * 100.0f);
|
||||||
updateVolumeSliderStatus(m_gsettings->get(GSETTING_SOUND_OUTPUT_SLIDER).toString());
|
updateVolumeSliderStatus(Utils::SettingValue("com.deepin.dde.dock.module.sound", QByteArray(), "Enabled").toString());
|
||||||
connect(m_gsettings, &QGSettings::changed, [ = ] (const QString &key) {
|
connect(m_gsettings, &QGSettings::changed, [ = ] (const QString &key) {
|
||||||
if (key == GSETTING_SOUND_OUTPUT_SLIDER) {
|
if (key == GSETTING_SOUND_OUTPUT_SLIDER) {
|
||||||
updateVolumeSliderStatus(m_gsettings->get(GSETTING_SOUND_OUTPUT_SLIDER).toString());
|
updateVolumeSliderStatus(m_gsettings->get(GSETTING_SOUND_OUTPUT_SLIDER).toString());
|
||||||
@ -559,7 +560,7 @@ void SoundApplet::updateCradsInfo()
|
|||||||
|
|
||||||
void SoundApplet::enableDevice(bool flag)
|
void SoundApplet::enableDevice(bool flag)
|
||||||
{
|
{
|
||||||
QString status = m_gsettings->get(GSETTING_SOUND_OUTPUT_SLIDER).toString();
|
QString status = m_gsettings ? m_gsettings->get(GSETTING_SOUND_OUTPUT_SLIDER).toString() : "Enabled";
|
||||||
if ("Disabled" == status ) {
|
if ("Disabled" == status ) {
|
||||||
m_volumeSlider->setEnabled(false);
|
m_volumeSlider->setEnabled(false);
|
||||||
} else if ("Enabled" == status) {
|
} else if ("Enabled" == status) {
|
||||||
|
@ -156,7 +156,7 @@ private:
|
|||||||
QList<Port *> m_ports;
|
QList<Port *> m_ports;
|
||||||
QString m_deviceInfo;
|
QString m_deviceInfo;
|
||||||
QPointer<Port> m_lastPort;//最后一个因为只有一个设备而被直接移除的设备
|
QPointer<Port> m_lastPort;//最后一个因为只有一个设备而被直接移除的设备
|
||||||
QGSettings *m_gsettings;
|
const QGSettings *m_gsettings;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // SOUNDAPPLET_H
|
#endif // SOUNDAPPLET_H
|
||||||
|
@ -22,7 +22,6 @@
|
|||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
#include <QIcon>
|
#include <QIcon>
|
||||||
#include <QMouseEvent>
|
#include <QMouseEvent>
|
||||||
#include <QGSettings>
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
|
|
||||||
#include <DApplication>
|
#include <DApplication>
|
||||||
|
@ -20,12 +20,12 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "systemtrayitem.h"
|
#include "systemtrayitem.h"
|
||||||
|
#include "utils.h"
|
||||||
|
|
||||||
#include <QProcess>
|
#include <QProcess>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
#include <xcb/xproto.h>
|
#include <xcb/xproto.h>
|
||||||
#include <QGSettings>
|
|
||||||
|
|
||||||
Dock::Position SystemTrayItem::DockPosition = Dock::Position::Top;
|
Dock::Position SystemTrayItem::DockPosition = Dock::Position::Top;
|
||||||
QPointer<DockPopupWindow> SystemTrayItem::PopupWindow = nullptr;
|
QPointer<DockPopupWindow> SystemTrayItem::PopupWindow = nullptr;
|
||||||
@ -39,6 +39,7 @@ SystemTrayItem::SystemTrayItem(PluginsItemInterface *const pluginInter, const QS
|
|||||||
, m_popupTipsDelayTimer(new QTimer(this))
|
, m_popupTipsDelayTimer(new QTimer(this))
|
||||||
, m_popupAdjustDelayTimer(new QTimer(this))
|
, m_popupAdjustDelayTimer(new QTimer(this))
|
||||||
, m_itemKey(itemKey)
|
, m_itemKey(itemKey)
|
||||||
|
, m_gsettings(Utils::ModuleSettingsPtr(pluginInter->pluginName(), QByteArray(), this))
|
||||||
{
|
{
|
||||||
qDebug() << "load tray plugins item: " << m_pluginInter->pluginName() << itemKey << m_centralWidget;
|
qDebug() << "load tray plugins item: " << m_pluginInter->pluginName() << itemKey << m_centralWidget;
|
||||||
|
|
||||||
@ -77,32 +78,16 @@ SystemTrayItem::SystemTrayItem(PluginsItemInterface *const pluginInter, const QS
|
|||||||
connect(m_popupAdjustDelayTimer, &QTimer::timeout, this, &SystemTrayItem::updatePopupPosition, Qt::QueuedConnection);
|
connect(m_popupAdjustDelayTimer, &QTimer::timeout, this, &SystemTrayItem::updatePopupPosition, Qt::QueuedConnection);
|
||||||
connect(&m_contextMenu, &QMenu::triggered, this, &SystemTrayItem::menuActionClicked);
|
connect(&m_contextMenu, &QMenu::triggered, this, &SystemTrayItem::menuActionClicked);
|
||||||
|
|
||||||
|
if (m_gsettings)
|
||||||
|
connect(m_gsettings, &QGSettings::changed, this, &SystemTrayItem::onGSettingsChanged);
|
||||||
|
|
||||||
grabGesture(Qt::TapAndHoldGesture);
|
grabGesture(Qt::TapAndHoldGesture);
|
||||||
|
|
||||||
const QByteArray &schema{
|
|
||||||
QString("com.deepin.dde.dock.module.%1").arg(pluginInter->pluginName()).toUtf8()
|
|
||||||
};
|
|
||||||
|
|
||||||
if (QGSettings::isSchemaInstalled(schema)) {
|
|
||||||
m_gsettings = new QGSettings(schema);
|
|
||||||
m_gsettings->setParent(this);
|
|
||||||
connect(m_gsettings, &QGSettings::changed, this,
|
|
||||||
&SystemTrayItem::onGSettingsChanged);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
m_gsettings = nullptr;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SystemTrayItem::~SystemTrayItem()
|
SystemTrayItem::~SystemTrayItem()
|
||||||
{
|
{
|
||||||
if (m_popupShown)
|
if (m_popupShown)
|
||||||
popupWindowAccept();
|
popupWindowAccept();
|
||||||
|
|
||||||
if(nullptr != m_gsettings){
|
|
||||||
m_gsettings->deleteLater();
|
|
||||||
m_gsettings = nullptr;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QString SystemTrayItem::itemKeyForConfig()
|
QString SystemTrayItem::itemKeyForConfig()
|
||||||
@ -203,7 +188,7 @@ void SystemTrayItem::enterEvent(QEvent *event)
|
|||||||
if (checkGSettingsControl()) {
|
if (checkGSettingsControl()) {
|
||||||
//网络需要显示Tips,需要特殊处理。
|
//网络需要显示Tips,需要特殊处理。
|
||||||
if (m_pluginInter->pluginName() != "network")
|
if (m_pluginInter->pluginName() != "network")
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 触屏不显示hover效果
|
// 触屏不显示hover效果
|
||||||
@ -493,11 +478,11 @@ void SystemTrayItem::updatePopupPosition()
|
|||||||
}
|
}
|
||||||
|
|
||||||
void SystemTrayItem::onGSettingsChanged(const QString &key) {
|
void SystemTrayItem::onGSettingsChanged(const QString &key) {
|
||||||
if (key != "enable" || !m_gsettings) {
|
if (key != "enable") {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_gsettings->keys().contains("enable")) {
|
if (m_gsettings && m_gsettings->keys().contains("enable")) {
|
||||||
const bool visible = m_gsettings->get("enable").toBool();
|
const bool visible = m_gsettings->get("enable").toBool();
|
||||||
setVisible(visible);
|
setVisible(visible);
|
||||||
emit itemVisibleChanged(visible);
|
emit itemVisibleChanged(visible);
|
||||||
@ -506,5 +491,5 @@ void SystemTrayItem::onGSettingsChanged(const QString &key) {
|
|||||||
|
|
||||||
bool SystemTrayItem::checkGSettingsControl() const
|
bool SystemTrayItem::checkGSettingsControl() const
|
||||||
{
|
{
|
||||||
return m_gsettings ? m_gsettings->get("control").toBool() : false;
|
return (m_gsettings && m_gsettings->get("control").toBool());
|
||||||
}
|
}
|
||||||
|
@ -111,7 +111,7 @@ private:
|
|||||||
|
|
||||||
static Dock::Position DockPosition;
|
static Dock::Position DockPosition;
|
||||||
static QPointer<DockPopupWindow> PopupWindow;
|
static QPointer<DockPopupWindow> PopupWindow;
|
||||||
QGSettings* m_gsettings;
|
const QGSettings* m_gsettings;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // SYSTEMTRAYITEM_H
|
#endif // SYSTEMTRAYITEM_H
|
||||||
|
@ -23,12 +23,12 @@
|
|||||||
#include "trayplugin.h"
|
#include "trayplugin.h"
|
||||||
#include "fashiontray/fashiontrayitem.h"
|
#include "fashiontray/fashiontrayitem.h"
|
||||||
#include "snitraywidget.h"
|
#include "snitraywidget.h"
|
||||||
|
#include "utils.h"
|
||||||
|
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QWindow>
|
#include <QWindow>
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
#include <QX11Info>
|
#include <QX11Info>
|
||||||
#include <QGSettings>
|
|
||||||
#include <QtConcurrent>
|
#include <QtConcurrent>
|
||||||
#include <QFuture>
|
#include <QFuture>
|
||||||
#include <QFutureWatcher>
|
#include <QFutureWatcher>
|
||||||
@ -385,10 +385,8 @@ void TrayPlugin::trayXEmbedAdded(const QString &itemKey, quint32 winId)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
QGSettings settings("com.deepin.dde.dock.module.systemtray");
|
if (!Utils::SettingValue("com.deepin.dde.dock.module.systemtray", QByteArray(), "enable", false).toBool())
|
||||||
if (settings.keys().contains("enable") && !settings.get("enable").toBool()) {
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
AbstractTrayWidget *trayWidget = new XEmbedTrayWidget(winId);
|
AbstractTrayWidget *trayWidget = new XEmbedTrayWidget(winId);
|
||||||
if (trayWidget->isValid())
|
if (trayWidget->isValid())
|
||||||
@ -432,10 +430,8 @@ void TrayPlugin::traySNIAdded(const QString &itemKey, const QString &sniServiceP
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QGSettings settings("com.deepin.dde.dock.module.systemtray");
|
if (!Utils::SettingValue("com.deepin.dde.dock.module.systemtray", QByteArray(), "enable", false).toBool())
|
||||||
if (settings.keys().contains("enable") && !settings.get("enable").toBool()) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
|
|
||||||
if (sniServicePath.startsWith("/") || !sniServicePath.contains("/")) {
|
if (sniServicePath.startsWith("/") || !sniServicePath.contains("/")) {
|
||||||
qDebug() << "SNI service path invalid";
|
qDebug() << "SNI service path invalid";
|
||||||
@ -470,10 +466,8 @@ void TrayPlugin::trayIndicatorAdded(const QString &itemKey, const QString &indic
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
QGSettings settings("com.deepin.dde.dock.module.systemtray");
|
if (!Utils::SettingValue("com.deepin.dde.dock.module.systemtray", QByteArray(), "enable", false).toBool())
|
||||||
if (settings.keys().contains("enable") && !settings.get("enable").toBool()) {
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
IndicatorTray *indicatorTray = nullptr;
|
IndicatorTray *indicatorTray = nullptr;
|
||||||
if (!m_indicatorMap.keys().contains(indicatorName)) {
|
if (!m_indicatorMap.keys().contains(indicatorName)) {
|
||||||
|
@ -24,7 +24,6 @@
|
|||||||
#include <gtest/gtest.h>
|
#include <gtest/gtest.h>
|
||||||
|
|
||||||
#include "appdrag.h"
|
#include "appdrag.h"
|
||||||
#include "mock/qgsettingsmock.h"
|
|
||||||
|
|
||||||
class Test_AppDrag : public ::testing::Test
|
class Test_AppDrag : public ::testing::Test
|
||||||
{
|
{
|
||||||
@ -44,10 +43,7 @@ void Test_AppDrag::TearDown()
|
|||||||
TEST_F(Test_AppDrag, drag_test)
|
TEST_F(Test_AppDrag, drag_test)
|
||||||
{
|
{
|
||||||
QWidget *w = new QWidget;
|
QWidget *w = new QWidget;
|
||||||
QGSettingsMock mock;
|
AppDrag *drag = new AppDrag(w);
|
||||||
ON_CALL(mock, get(::testing::_)) .WillByDefault(::testing::Invoke([](const QString& key){return 1.5; }));
|
|
||||||
|
|
||||||
AppDrag *drag = new AppDrag(&mock, w);
|
|
||||||
QPixmap pix(":/res/all_settings_on.png");
|
QPixmap pix(":/res/all_settings_on.png");
|
||||||
drag->setPixmap(pix);
|
drag->setPixmap(pix);
|
||||||
|
|
||||||
|
@ -25,7 +25,6 @@
|
|||||||
|
|
||||||
#define private public
|
#define private public
|
||||||
#include "appdragwidget.h"
|
#include "appdragwidget.h"
|
||||||
#include "mock/qgsettingsmock.h"
|
|
||||||
#undef private
|
#undef private
|
||||||
|
|
||||||
class Test_AppDragWidget : public ::testing::Test
|
class Test_AppDragWidget : public ::testing::Test
|
||||||
@ -45,10 +44,7 @@ void Test_AppDragWidget::TearDown()
|
|||||||
|
|
||||||
TEST_F(Test_AppDragWidget, cuntion_test)
|
TEST_F(Test_AppDragWidget, cuntion_test)
|
||||||
{
|
{
|
||||||
QGSettingsMock *mock = new QGSettingsMock;
|
AppDragWidget *dragWidget = new AppDragWidget;
|
||||||
ON_CALL(*mock, get(::testing::_)) .WillByDefault(::testing::Invoke([](const QString& key){Q_UNUSED(key); return 1.5; }));
|
|
||||||
|
|
||||||
AppDragWidget *dragWidget = new AppDragWidget(mock);
|
|
||||||
|
|
||||||
QPixmap pix(":/res/all_settings_on.png");
|
QPixmap pix(":/res/all_settings_on.png");
|
||||||
dragWidget->setAppPixmap(pix);
|
dragWidget->setAppPixmap(pix);
|
||||||
|
@ -25,12 +25,11 @@
|
|||||||
|
|
||||||
#include <gtest/gtest.h>
|
#include <gtest/gtest.h>
|
||||||
|
|
||||||
|
#include "utils.h"
|
||||||
#define private public
|
#define private public
|
||||||
#include "appitem.h"
|
#include "appitem.h"
|
||||||
#undef private
|
#undef private
|
||||||
|
|
||||||
#include "mock/qgsettingsmock.h"
|
|
||||||
|
|
||||||
using namespace ::testing;
|
using namespace ::testing;
|
||||||
|
|
||||||
class Test_AppItem : public ::testing::Test
|
class Test_AppItem : public ::testing::Test
|
||||||
@ -50,16 +49,14 @@ void Test_AppItem::TearDown()
|
|||||||
|
|
||||||
TEST_F(Test_AppItem, coverage_test)
|
TEST_F(Test_AppItem, coverage_test)
|
||||||
{
|
{
|
||||||
QGSettingsMock mock;
|
const QGSettings *appSettings = Utils::ModuleSettingsPtr("app");
|
||||||
|
const QGSettings *activeSettings = Utils::ModuleSettingsPtr("activeapp");
|
||||||
|
const QGSettings *dockedSettings = Utils::ModuleSettingsPtr("dockapp");
|
||||||
|
|
||||||
ON_CALL(mock, type()).WillByDefault(Return(QGSettingsMock::Type::MockType));
|
AppItem *appItem = new AppItem(appSettings, activeSettings, dockedSettings, QDBusObjectPath("/com/deepin/dde/daemon/Dock/entries/e0T6045b766"));
|
||||||
ON_CALL(mock, keys()).WillByDefault(Return(QStringList() << "enable" << "control"));
|
|
||||||
ON_CALL(mock, get(_)) .WillByDefault(::testing::Invoke([](const QString& key){return true; }));
|
|
||||||
|
|
||||||
AppItem *appItem = new AppItem(&mock, &mock, &mock, QDBusObjectPath("/com/deepin/dde/daemon/Dock/entries/e0T6045b766"));
|
|
||||||
|
|
||||||
// 触发信号测试
|
// 触发信号测试
|
||||||
// emit appItem->m_refershIconTimer->start(10);
|
// emit appItem->m_refershIconTimer->start(10);
|
||||||
QTest::qWait(20);
|
QTest::qWait(20);
|
||||||
|
|
||||||
// FIXME: 测试不到?
|
// FIXME: 测试不到?
|
||||||
@ -97,12 +94,18 @@ TEST_F(Test_AppItem, coverage_test)
|
|||||||
QTest::mousePress(appItem, Qt::LeftButton, Qt::NoModifier);
|
QTest::mousePress(appItem, Qt::LeftButton, Qt::NoModifier);
|
||||||
QTest::mouseRelease(appItem, Qt::LeftButton, Qt::NoModifier);
|
QTest::mouseRelease(appItem, Qt::LeftButton, Qt::NoModifier);
|
||||||
QTest::qWait(400);
|
QTest::qWait(400);
|
||||||
// QTest::mouseClick(appItem, Qt::MiddleButton, Qt::NoModifier);
|
// QTest::mouseClick(appItem, Qt::MiddleButton, Qt::NoModifier);
|
||||||
// QTest::qWait(400);
|
// QTest::qWait(400);
|
||||||
// QTest::mouseClick(appItem, Qt::LeftButton, Qt::NoModifier, QPoint(-1, -1));
|
// QTest::mouseClick(appItem, Qt::LeftButton, Qt::NoModifier, QPoint(-1, -1));
|
||||||
// QTest::qWait(400);
|
// QTest::qWait(400);
|
||||||
// QTest::mouseMove(appItem, appItem->geometry().center());
|
// QTest::mouseMove(appItem, appItem->geometry().center());
|
||||||
|
|
||||||
delete appItem;
|
delete appItem;
|
||||||
appItem = nullptr;
|
appItem = nullptr;
|
||||||
|
delete appSettings;
|
||||||
|
appSettings = nullptr;
|
||||||
|
delete activeSettings;
|
||||||
|
activeSettings = nullptr;
|
||||||
|
delete dockedSettings;
|
||||||
|
dockedSettings = nullptr;
|
||||||
}
|
}
|
||||||
|
@ -26,8 +26,6 @@
|
|||||||
#include <gmock/gmock.h>
|
#include <gmock/gmock.h>
|
||||||
|
|
||||||
#include "dockitem.h"
|
#include "dockitem.h"
|
||||||
#include "mock/qgsettingsmock.h"
|
|
||||||
|
|
||||||
class Test_DockItem : public ::testing::Test
|
class Test_DockItem : public ::testing::Test
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -31,8 +31,6 @@ using namespace ::testing;
|
|||||||
#include "launcheritem.h"
|
#include "launcheritem.h"
|
||||||
#undef private
|
#undef private
|
||||||
|
|
||||||
#include "mock/qgsettingsmock.h"
|
|
||||||
|
|
||||||
class Test_LauncherItem : public ::testing::Test
|
class Test_LauncherItem : public ::testing::Test
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -1,45 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2018 ~ 2028 Uniontech Technology Co., Ltd.
|
|
||||||
*
|
|
||||||
* Author: fanpengcheng <fanpengcheng@uniontech.com>
|
|
||||||
*
|
|
||||||
* Maintainer: fanpengcheng <fanpengcheng@uniontech.com>
|
|
||||||
*
|
|
||||||
* 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 QGSETTINGSMOCK_H
|
|
||||||
#define QGSETTINGSMOCK_H
|
|
||||||
#include "qgsettingsinterface.h"
|
|
||||||
#include <gmock/gmock.h>
|
|
||||||
|
|
||||||
#include <QVariant>
|
|
||||||
#include <QString>
|
|
||||||
|
|
||||||
class QGSettingsMock : public QGSettingsInterface
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
virtual ~QGSettingsMock() {}
|
|
||||||
|
|
||||||
MOCK_METHOD0(type, Type(void));
|
|
||||||
MOCK_METHOD0(gsettings, QGSettings *(void));
|
|
||||||
MOCK_CONST_METHOD1(get, QVariant(const QString &key));
|
|
||||||
MOCK_METHOD2(set, void(const QString &key, const QVariant &value));
|
|
||||||
MOCK_METHOD2(trySet, bool (const QString &key, const QVariant &value));
|
|
||||||
MOCK_CONST_METHOD0(keys, QStringList(void));
|
|
||||||
MOCK_CONST_METHOD1(choices, QVariantList(const QString &key));
|
|
||||||
MOCK_METHOD1(reset, void(const QString &key));
|
|
||||||
|
|
||||||
static bool isSchemaInstalled(const QByteArray &schema_id) {Q_UNUSED(schema_id); return true;}
|
|
||||||
};
|
|
||||||
#endif // QGSETTINGSMOCK_H
|
|
Loading…
x
Reference in New Issue
Block a user