mirror of
https://github.com/linuxdeepin/dde-dock.git
synced 2025-06-04 17:33:05 +00:00
Support multi-screen
tower: https://tower.im/projects/715dbdd34f694ea08f6de7888b7ffd7d/todos/cd402961d5be429996038cfedf93ed96/ Change-Id: I6d0cd3e0cbf4dbe0e15c93a87135908a53a9300b
This commit is contained in:
parent
293568b692
commit
87fc05cfd8
Notes:
Deepin Code Review
2016-06-14 07:19:47 +00:00
Verified+1: Anonymous Coward #1000004 Verified+1: <yefei@linuxdeepin.com> Code-Review+2: <mr.asianwang@gmail.com> Submitted-by: <mr.asianwang@gmail.com> Submitted-at: Mon, 16 Nov 2015 12:48:36 +0800 Reviewed-on: https://cr.deepin.io/8566 Project: dde/dde-dock Branch: refs/heads/master
@ -69,7 +69,8 @@ HEADERS += \
|
||||
src/widgets/apppreview/apppreviewloader.h \
|
||||
src/widgets/apppreview/apppreviewscontainer.h \
|
||||
src/widgets/apppreview/apppreviewloaderframe.h \
|
||||
src/widgets/previewwindow.h
|
||||
src/widgets/previewwindow.h \
|
||||
src/dbus/dbusdisplay.h
|
||||
|
||||
SOURCES += \
|
||||
libs/xcb_misc.cpp \
|
||||
@ -107,4 +108,5 @@ SOURCES += \
|
||||
src/widgets/apppreview/apppreviewloader.cpp \
|
||||
src/widgets/apppreview/apppreviewscontainer.cpp \
|
||||
src/widgets/apppreview/apppreviewloaderframe.cpp \
|
||||
src/widgets/previewwindow.cpp
|
||||
src/widgets/previewwindow.cpp \
|
||||
src/dbus/dbusdisplay.cpp
|
||||
|
@ -2,7 +2,6 @@
|
||||
#include <QJsonArray>
|
||||
#include <QJsonDocument>
|
||||
#include <QProcess>
|
||||
#include <QApplication>
|
||||
|
||||
#include "pluginitemwrapper.h"
|
||||
#include "../dockmodedata.h"
|
||||
@ -28,6 +27,8 @@ PluginItemWrapper::PluginItemWrapper(DockPluginInterface *plugin,
|
||||
this->adjustSize();
|
||||
|
||||
emit widthChanged();
|
||||
|
||||
m_display = new DBusDisplay(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -58,8 +59,8 @@ void PluginItemWrapper::enterEvent(QEvent *)
|
||||
emit mouseEntered();
|
||||
|
||||
if (hoverable()) {
|
||||
QRect rec = QApplication::desktop()->screenGeometry();
|
||||
showPreview(QPoint(globalX() + width() / 2, rec.height() - DockModeData::instance()->getDockHeight() - DOCK_PREVIEW_MARGIN));
|
||||
DisplayRect rec = m_display->primaryRect();
|
||||
showPreview(QPoint(globalX() + width() / 2, rec.height- DockModeData::instance()->getDockHeight() - DOCK_PREVIEW_MARGIN));
|
||||
}
|
||||
}
|
||||
|
||||
@ -76,8 +77,9 @@ void PluginItemWrapper::mousePressEvent(QMouseEvent * event)
|
||||
hidePreview(true);
|
||||
|
||||
if (event->button() == Qt::RightButton) {
|
||||
QRect rec = QApplication::desktop()->screenGeometry();
|
||||
this->showMenu(QPoint(globalX() + width() / 2, rec.height() - DockModeData::instance()->getDockHeight()));
|
||||
DisplayRect rec = m_display->primaryRect();
|
||||
this->showMenu(QPoint(rec.x + globalX() + width() / 2,
|
||||
rec.y + rec.height - DockModeData::instance()->getDockHeight()));
|
||||
} else if (event->button() == Qt::LeftButton) {
|
||||
QString command = m_plugin->getCommand(m_id);
|
||||
if (!command.isEmpty()) QProcess::startDetached(command);
|
||||
|
@ -5,6 +5,7 @@
|
||||
|
||||
#include "widgets/abstractdockitem.h"
|
||||
#include "interfaces/dockplugininterface.h"
|
||||
#include "dbus/dbusdisplay.h"
|
||||
|
||||
class QMouseEvent;
|
||||
class PluginItemWrapper : public AbstractDockItem
|
||||
@ -29,6 +30,7 @@ protected:
|
||||
// void mouseReleaseEvent(QMouseEvent * event) Q_DECL_OVERRIDE;
|
||||
|
||||
private:
|
||||
DBusDisplay *m_display = NULL;
|
||||
QWidget *m_pluginItemContents = NULL;
|
||||
DockPluginInterface * m_plugin;
|
||||
QString m_id;
|
||||
|
55
dde-dock/src/dbus/dbusdisplay.cpp
Normal file
55
dde-dock/src/dbus/dbusdisplay.cpp
Normal file
@ -0,0 +1,55 @@
|
||||
/*
|
||||
* This file was generated by qdbusxml2cpp version 0.8
|
||||
* Command line was: qdbusxml2cpp -p DBusDisplay -c DBusDisplay com.deepin.daemon.Display.xml
|
||||
*
|
||||
* qdbusxml2cpp is Copyright (C) 2015 Digia Plc and/or its subsidiary(-ies).
|
||||
*
|
||||
* This is an auto-generated file.
|
||||
* This file may have been hand-edited. Look for HAND-EDIT comments
|
||||
* before re-generating it.
|
||||
*/
|
||||
|
||||
#include "dbusdisplay.h"
|
||||
|
||||
/*
|
||||
* Implementation of interface class DBusDisplay
|
||||
*/
|
||||
|
||||
DBusDisplay::DBusDisplay(QObject *parent)
|
||||
: QDBusAbstractInterface(staticServiceName(), staticObjectPath(), staticInterfaceName(), QDBusConnection::sessionBus(), parent)
|
||||
{
|
||||
qDBusRegisterMetaType<BrightnessMap>();
|
||||
qDBusRegisterMetaType<DisplayRect>();
|
||||
|
||||
QDBusConnection::sessionBus().connect(this->service(), this->path(), "org.freedesktop.DBus.Properties", "PropertiesChanged","sa{sv}as", this, SLOT(__propertyChanged__(QDBusMessage)));
|
||||
}
|
||||
|
||||
DBusDisplay::~DBusDisplay()
|
||||
{
|
||||
QDBusConnection::sessionBus().disconnect(service(), path(), "org.freedesktop.DBus.Properties", "PropertiesChanged", "sa{sv}as", this, SLOT(propertyChanged(QDBusMessage)));
|
||||
}
|
||||
|
||||
|
||||
QDBusArgument &operator<<(QDBusArgument &argument, const DisplayRect &rect)
|
||||
{
|
||||
argument.beginStructure();
|
||||
argument << rect.x << rect.y << rect.width << rect.height;
|
||||
argument.endStructure();
|
||||
return argument;
|
||||
}
|
||||
|
||||
const QDBusArgument &operator>>(const QDBusArgument &argument, DisplayRect &rect)
|
||||
{
|
||||
argument.beginStructure();
|
||||
argument >> rect.x >> rect.y >> rect.width >> rect.height;
|
||||
argument.endStructure();
|
||||
return argument;
|
||||
}
|
||||
|
||||
QDebug operator<<(QDebug deg, const DisplayRect &rect)
|
||||
{
|
||||
qDebug() << "x:" << rect.x << "y:" << rect.y << "width:" << rect.width << "height:" << rect.height;
|
||||
|
||||
return deg;
|
||||
}
|
||||
|
229
dde-dock/src/dbus/dbusdisplay.h
Normal file
229
dde-dock/src/dbus/dbusdisplay.h
Normal file
@ -0,0 +1,229 @@
|
||||
/*
|
||||
* This file was generated by qdbusxml2cpp version 0.8
|
||||
* Command line was: qdbusxml2cpp -p displayinterface -c DisplayInterface com.deepin.daemon.Display.xml
|
||||
*
|
||||
* qdbusxml2cpp is Copyright (C) 2015 Digia Plc and/or its subsidiary(-ies).
|
||||
*
|
||||
* This is an auto-generated file.
|
||||
* Do not edit! All changes made to it will be lost.
|
||||
*/
|
||||
|
||||
#ifndef DBUSDISPLAY_H
|
||||
#define DBUSDISPLAY_H
|
||||
|
||||
#include <QtCore/QObject>
|
||||
#include <QtCore/QByteArray>
|
||||
#include <QtCore/QList>
|
||||
#include <QtCore/QMap>
|
||||
#include <QtCore/QString>
|
||||
#include <QtCore/QStringList>
|
||||
#include <QtCore/QVariant>
|
||||
#include <QtDBus/QtDBus>
|
||||
|
||||
typedef QMap<QString, double> BrightnessMap;
|
||||
|
||||
Q_DECLARE_METATYPE(BrightnessMap)
|
||||
|
||||
struct DisplayRect{
|
||||
qint16 x;
|
||||
qint16 y;
|
||||
quint16 width;
|
||||
quint16 height;
|
||||
|
||||
operator QRect() const
|
||||
{
|
||||
return QRect(x, y, width, height);
|
||||
}
|
||||
};
|
||||
|
||||
Q_DECLARE_METATYPE(DisplayRect)
|
||||
|
||||
QDBusArgument &operator<<(QDBusArgument &argument, const DisplayRect &rect);
|
||||
const QDBusArgument &operator>>(const QDBusArgument &argument, DisplayRect &rect);
|
||||
QDebug operator<<(QDebug deg, const DisplayRect &rect);
|
||||
|
||||
/*
|
||||
* Proxy class for interface com.deepin.daemon.Display
|
||||
*/
|
||||
class DBusDisplay: public QDBusAbstractInterface
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
Q_SLOT void __propertyChanged__(const QDBusMessage& msg)
|
||||
{
|
||||
QList<QVariant> arguments = msg.arguments();
|
||||
if (3 != arguments.count())
|
||||
return;
|
||||
QString interfaceName = msg.arguments().at(0).toString();
|
||||
if (interfaceName !="com.deepin.daemon.Display")
|
||||
return;
|
||||
QVariantMap changedProps = qdbus_cast<QVariantMap>(arguments.at(1).value<QDBusArgument>());
|
||||
QStringList keys = changedProps.keys();
|
||||
foreach(const QString &prop, keys) {
|
||||
const QMetaObject* self = metaObject();
|
||||
for (int i=self->propertyOffset(); i < self->propertyCount(); ++i) {
|
||||
QMetaProperty p = self->property(i);
|
||||
if (p.name() == prop) {
|
||||
Q_EMIT p.notifySignal().invoke(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
public:
|
||||
static inline const char *staticInterfaceName()
|
||||
{ return "com.deepin.daemon.Display"; }
|
||||
static inline const char *staticServiceName()
|
||||
{ return "com.deepin.daemon.Display"; }
|
||||
static inline const char *staticObjectPath()
|
||||
{ return "/com/deepin/daemon/Display"; }
|
||||
|
||||
public:
|
||||
DBusDisplay(QObject *parent = 0);
|
||||
|
||||
~DBusDisplay();
|
||||
|
||||
Q_PROPERTY(BrightnessMap Brightness READ brightness NOTIFY BrightnessChanged)
|
||||
inline BrightnessMap brightness() const
|
||||
{ return qvariant_cast< BrightnessMap >(property("Brightness")); }
|
||||
|
||||
Q_PROPERTY(QDBusObjectPath BuiltinOutput READ builtinOutput NOTIFY BuiltinOutputChanged)
|
||||
inline QDBusObjectPath builtinOutput() const
|
||||
{ return qvariant_cast< QDBusObjectPath >(property("BuiltinOutput")); }
|
||||
|
||||
Q_PROPERTY(short DisplayMode READ displayMode NOTIFY DisplayModeChanged)
|
||||
inline short displayMode() const
|
||||
{ return qvariant_cast< short >(property("DisplayMode")); }
|
||||
|
||||
Q_PROPERTY(bool HasChanged READ hasChanged NOTIFY HasChangedChanged)
|
||||
inline bool hasChanged() const
|
||||
{ return qvariant_cast< bool >(property("HasChanged")); }
|
||||
|
||||
Q_PROPERTY(QList<QDBusObjectPath> Monitors READ monitors NOTIFY MonitorsChanged)
|
||||
inline QList<QDBusObjectPath> monitors() const
|
||||
{ return qvariant_cast< QList<QDBusObjectPath> >(property("Monitors")); }
|
||||
|
||||
Q_PROPERTY(QString Primary READ primary NOTIFY PrimaryChanged)
|
||||
inline QString primary() const
|
||||
{ return qvariant_cast< QString >(property("Primary")); }
|
||||
|
||||
Q_PROPERTY(DisplayRect PrimaryRect READ primaryRect NOTIFY PrimaryRectChanged)
|
||||
inline DisplayRect primaryRect() const
|
||||
{ return qvariant_cast< DisplayRect >(property("PrimaryRect")); }
|
||||
|
||||
Q_PROPERTY(ushort ScreenHeight READ screenHeight NOTIFY ScreenHeightChanged)
|
||||
inline ushort screenHeight() const
|
||||
{ return qvariant_cast< ushort >(property("ScreenHeight")); }
|
||||
|
||||
Q_PROPERTY(ushort ScreenWidth READ screenWidth NOTIFY ScreenWidthChanged)
|
||||
inline ushort screenWidth() const
|
||||
{ return qvariant_cast< ushort >(property("ScreenWidth")); }
|
||||
|
||||
public Q_SLOTS: // METHODS
|
||||
inline QDBusPendingReply<> Apply()
|
||||
{
|
||||
QList<QVariant> argumentList;
|
||||
return asyncCallWithArgumentList(QStringLiteral("Apply"), argumentList);
|
||||
}
|
||||
|
||||
inline QDBusPendingReply<> AssociateTouchScreen(const QString &in0, const QString &in1)
|
||||
{
|
||||
QList<QVariant> argumentList;
|
||||
argumentList << QVariant::fromValue(in0) << QVariant::fromValue(in1);
|
||||
return asyncCallWithArgumentList(QStringLiteral("AssociateTouchScreen"), argumentList);
|
||||
}
|
||||
|
||||
inline QDBusPendingReply<> ChangeBrightness(const QString &in0, double in1)
|
||||
{
|
||||
QList<QVariant> argumentList;
|
||||
argumentList << QVariant::fromValue(in0) << QVariant::fromValue(in1);
|
||||
return asyncCallWithArgumentList(QStringLiteral("ChangeBrightness"), argumentList);
|
||||
}
|
||||
|
||||
inline QDBusPendingReply<> JoinMonitor(const QString &in0, const QString &in1)
|
||||
{
|
||||
QList<QVariant> argumentList;
|
||||
argumentList << QVariant::fromValue(in0) << QVariant::fromValue(in1);
|
||||
return asyncCallWithArgumentList(QStringLiteral("JoinMonitor"), argumentList);
|
||||
}
|
||||
|
||||
inline QDBusPendingReply<QString> QueryCurrentPlanName()
|
||||
{
|
||||
QList<QVariant> argumentList;
|
||||
return asyncCallWithArgumentList(QStringLiteral("QueryCurrentPlanName"), argumentList);
|
||||
}
|
||||
|
||||
inline QDBusPendingReply<int> QueryOutputFeature(const QString &in0)
|
||||
{
|
||||
QList<QVariant> argumentList;
|
||||
argumentList << QVariant::fromValue(in0);
|
||||
return asyncCallWithArgumentList(QStringLiteral("QueryOutputFeature"), argumentList);
|
||||
}
|
||||
|
||||
inline QDBusPendingReply<> Reset()
|
||||
{
|
||||
QList<QVariant> argumentList;
|
||||
return asyncCallWithArgumentList(QStringLiteral("Reset"), argumentList);
|
||||
}
|
||||
|
||||
inline QDBusPendingReply<> ResetBrightness(const QString &in0)
|
||||
{
|
||||
QList<QVariant> argumentList;
|
||||
argumentList << QVariant::fromValue(in0);
|
||||
return asyncCallWithArgumentList(QStringLiteral("ResetBrightness"), argumentList);
|
||||
}
|
||||
|
||||
inline QDBusPendingReply<> ResetChanges()
|
||||
{
|
||||
QList<QVariant> argumentList;
|
||||
return asyncCallWithArgumentList(QStringLiteral("ResetChanges"), argumentList);
|
||||
}
|
||||
|
||||
inline QDBusPendingReply<> SaveChanges()
|
||||
{
|
||||
QList<QVariant> argumentList;
|
||||
return asyncCallWithArgumentList(QStringLiteral("SaveChanges"), argumentList);
|
||||
}
|
||||
|
||||
inline QDBusPendingReply<> SetBrightness(const QString &in0, double in1)
|
||||
{
|
||||
QList<QVariant> argumentList;
|
||||
argumentList << QVariant::fromValue(in0) << QVariant::fromValue(in1);
|
||||
return asyncCallWithArgumentList(QStringLiteral("SetBrightness"), argumentList);
|
||||
}
|
||||
|
||||
inline QDBusPendingReply<> SetPrimary(const QString &in0)
|
||||
{
|
||||
QList<QVariant> argumentList;
|
||||
argumentList << QVariant::fromValue(in0);
|
||||
return asyncCallWithArgumentList(QStringLiteral("SetPrimary"), argumentList);
|
||||
}
|
||||
|
||||
inline QDBusPendingReply<> SplitMonitor(const QString &in0)
|
||||
{
|
||||
QList<QVariant> argumentList;
|
||||
argumentList << QVariant::fromValue(in0);
|
||||
return asyncCallWithArgumentList(QStringLiteral("SplitMonitor"), argumentList);
|
||||
}
|
||||
|
||||
inline QDBusPendingReply<> SwitchMode(short in0, const QString &in1)
|
||||
{
|
||||
QList<QVariant> argumentList;
|
||||
argumentList << QVariant::fromValue(in0) << QVariant::fromValue(in1);
|
||||
return asyncCallWithArgumentList(QStringLiteral("SwitchMode"), argumentList);
|
||||
}
|
||||
|
||||
Q_SIGNALS: // SIGNALS
|
||||
//void PrimaryChanged(const QRect &in0);
|
||||
// begin property changed signals
|
||||
void BrightnessChanged();
|
||||
void BuiltinOutputChanged();
|
||||
void DisplayModeChanged();
|
||||
void HasChangedChanged();
|
||||
void MonitorsChanged();
|
||||
void PrimaryChanged();
|
||||
void PrimaryRectChanged();
|
||||
void ScreenHeightChanged();
|
||||
void ScreenWidthChanged();
|
||||
};
|
||||
|
||||
#endif
|
@ -18,6 +18,7 @@ MainWidget::MainWidget(QWidget *parent)
|
||||
connect(m_dmd, &DockModeData::dockModeChanged, this, &MainWidget::onDockModeChanged);
|
||||
|
||||
//For init
|
||||
m_display = new DBusDisplay(this);
|
||||
updatePosition();
|
||||
|
||||
DockUIDbus *dockUIDbus = new DockUIDbus(this);
|
||||
@ -25,12 +26,13 @@ MainWidget::MainWidget(QWidget *parent)
|
||||
|
||||
XcbMisc::instance()->set_window_type(winId(), XcbMisc::Dock);
|
||||
|
||||
connect(QApplication::desktop(), &QDesktopWidget::workAreaResized, [=](int screen) {
|
||||
if (screen == QApplication::desktop()->primaryScreen()) {
|
||||
QRect rect = QApplication::desktop()->screenGeometry(screen);
|
||||
qWarning() << QString("PrimaryScreen(index: %0) size changed %1x%2").arg(screen).arg(rect.width()).arg(rect.height());
|
||||
updatePosition();
|
||||
}
|
||||
connect(m_display, &DBusDisplay::PrimaryChanged, [=] {
|
||||
m_mainPanel->resizeWithContent();
|
||||
updatePosition();
|
||||
});
|
||||
connect(m_display, &DBusDisplay::PrimaryRectChanged, [=] {
|
||||
m_mainPanel->resizeWithContent();
|
||||
updatePosition();
|
||||
});
|
||||
}
|
||||
|
||||
@ -41,17 +43,21 @@ void MainWidget::onDockModeChanged()
|
||||
|
||||
void MainWidget::updatePosition()
|
||||
{
|
||||
QRect rec = QApplication::desktop()->screenGeometry();
|
||||
DisplayRect rec = m_display->primaryRect();
|
||||
|
||||
if (m_hasHidden) {
|
||||
//set height with 0 mean window is hidden,Windows manager will handle it's showing animation
|
||||
this->setFixedSize(m_mainPanel->width(), 1);
|
||||
this->move((rec.width() - width()) / 2, rec.height() - 1);//1 pixel for grab mouse enter event to show panel
|
||||
this->move(rec.x + (rec.width - width()) / 2,
|
||||
rec.y + rec.height - 1);//1 pixel for grab mouse enter event to show panel
|
||||
}
|
||||
else {
|
||||
this->setFixedSize(m_mainPanel->width(), m_dmd->getDockHeight());
|
||||
this->move((rec.width() - width()) / 2, rec.height() - this->height());
|
||||
this->move(rec.x + (rec.width - width()) / 2,
|
||||
rec.y + rec.height - this->height());
|
||||
}
|
||||
|
||||
qDebug() << "Position changed: " << this->geometry();
|
||||
updateXcbStructPartial();
|
||||
}
|
||||
|
||||
@ -107,9 +113,7 @@ void MainWidget::hideDock()
|
||||
|
||||
void MainWidget::onPanelSizeChanged()
|
||||
{
|
||||
QRect rec = QApplication::desktop()->screenGeometry();
|
||||
this->setFixedSize(m_mainPanel->width(), height());
|
||||
this->move((rec.width() - width()) / 2, y());
|
||||
updatePosition();
|
||||
}
|
||||
|
||||
MainWidget::~MainWidget()
|
||||
|
@ -13,6 +13,7 @@
|
||||
#include "dbus/dbusdocksetting.h"
|
||||
#include "controller/dockmodedata.h"
|
||||
#include "panel/panel.h"
|
||||
#include "dbus/dbusdisplay.h"
|
||||
|
||||
const QString DBUS_PATH = "/com/deepin/dde/dock";
|
||||
const QString DBUS_NAME = "com.deepin.dde.dock";
|
||||
@ -36,17 +37,20 @@ private:
|
||||
void hideDock();
|
||||
void onPanelSizeChanged();
|
||||
void onDockModeChanged();
|
||||
void updatePosition();
|
||||
void updateXcbStructPartial();
|
||||
void initHideStateManager();
|
||||
void initDockSetting();
|
||||
|
||||
private slots:
|
||||
void updatePosition();
|
||||
|
||||
private:
|
||||
Panel *m_mainPanel = NULL;
|
||||
bool m_hasHidden = false;
|
||||
DockModeData * m_dmd = DockModeData::instance();
|
||||
DBusHideStateManager *m_dhsm = NULL;
|
||||
DBusDockSetting *m_dds = NULL;
|
||||
DBusDisplay *m_display = NULL;
|
||||
};
|
||||
|
||||
class DockUIDbus : public QDBusAbstractAdaptor {
|
||||
|
@ -122,8 +122,7 @@ void Panel::initPluginManager()
|
||||
m_pluginLayout->removeItem(item);
|
||||
});
|
||||
connect(PanelMenu::instance(), &PanelMenu::settingPlugin, [=]{
|
||||
QRect rec = QApplication::desktop()->screenGeometry();
|
||||
m_pluginManager->onPluginsSetting(rec.height() - height());
|
||||
m_pluginManager->onPluginsSetting(getScreenRect().height - height());
|
||||
});
|
||||
}
|
||||
|
||||
@ -132,7 +131,7 @@ void Panel::initPluginLayout()
|
||||
m_pluginLayout = new DockLayout(this);
|
||||
m_pluginLayout->setSpacing(m_dockModeData->getAppletsItemSpacing());
|
||||
m_pluginLayout->resize(0, m_dockModeData->getItemHeight());
|
||||
connect(m_pluginLayout, &DockLayout::contentsWidthChange, this, &Panel::onLayoutContentsWidthChanged);
|
||||
connect(m_pluginLayout, &DockLayout::contentsWidthChange, this, &Panel::resizeWithContent);
|
||||
}
|
||||
|
||||
void Panel::initAppLayout()
|
||||
@ -145,7 +144,7 @@ void Panel::initAppLayout()
|
||||
|
||||
connect(m_appLayout, &DockLayout::startDrag, this, &Panel::onItemDragStarted);
|
||||
connect(m_appLayout, &DockLayout::itemDropped, this, &Panel::onItemDropped);
|
||||
connect(m_appLayout, &DockLayout::contentsWidthChange, this, &Panel::onLayoutContentsWidthChanged);
|
||||
connect(m_appLayout, &DockLayout::contentsWidthChange, this, &Panel::resizeWithContent);
|
||||
|
||||
//for plugin layout mask
|
||||
connect(m_appLayout, &DockLayout::startDrag, this, &Panel::showPluginLayoutMask);
|
||||
@ -231,7 +230,7 @@ void Panel::onItemDragStarted()
|
||||
m_maskWidget->show();
|
||||
}
|
||||
|
||||
void Panel::onLayoutContentsWidthChanged()
|
||||
void Panel::resizeWithContent()
|
||||
{
|
||||
if (m_dockModeData->getDockMode() == Dock::FashionMode)
|
||||
{
|
||||
@ -250,12 +249,12 @@ void Panel::onLayoutContentsWidthChanged()
|
||||
}
|
||||
else
|
||||
{
|
||||
QRect rec = QApplication::desktop()->screenGeometry();
|
||||
DisplayRect rec = getScreenRect();
|
||||
m_pluginLayout->resize(m_pluginLayout->getContentsWidth(),m_dockModeData->getItemHeight());
|
||||
m_pluginLayout->move(rec.width() - m_pluginLayout->width(),1);
|
||||
m_pluginLayout->move(rec.width - m_pluginLayout->width(),1);
|
||||
|
||||
m_appLayout->move(0,1);
|
||||
m_appLayout->resize(rec.width() - m_pluginLayout->width() ,m_dockModeData->getItemHeight());
|
||||
m_appLayout->resize(rec.width - m_pluginLayout->width() ,m_dockModeData->getItemHeight());
|
||||
|
||||
this->setFixedSize(m_appLayout->width() + m_pluginLayout->width(),m_dockModeData->getDockHeight());
|
||||
|
||||
@ -362,12 +361,12 @@ void Panel::reanchorsLayout(Dock::DockMode mode)
|
||||
}
|
||||
else
|
||||
{
|
||||
QRect rec = QApplication::desktop()->screenGeometry();
|
||||
DisplayRect rec = getScreenRect();
|
||||
m_pluginLayout->resize(m_pluginLayout->getContentsWidth(), m_dockModeData->getItemHeight());
|
||||
m_pluginLayout->move(rec.width() - m_pluginLayout->width(),1);
|
||||
m_pluginLayout->move(rec.width - m_pluginLayout->width(),1);
|
||||
|
||||
m_appLayout->move(0,1);
|
||||
m_appLayout->resize(rec.width() - m_pluginLayout->width() ,m_dockModeData->getItemHeight());
|
||||
m_appLayout->resize(rec.width - m_pluginLayout->width() ,m_dockModeData->getItemHeight());
|
||||
|
||||
this->setFixedSize(m_appLayout->width() + m_pluginLayout->width(), m_dockModeData->getDockHeight());
|
||||
|
||||
@ -461,6 +460,12 @@ void Panel::setY(int value)
|
||||
move(x(), value);
|
||||
}
|
||||
|
||||
DisplayRect Panel::getScreenRect()
|
||||
{
|
||||
DBusDisplay d;
|
||||
return d.primaryRect();
|
||||
}
|
||||
|
||||
Panel::~Panel()
|
||||
{
|
||||
|
||||
|
@ -14,6 +14,7 @@
|
||||
#include "widgets/screenmask.h"
|
||||
#include "widgets/previewwindow.h"
|
||||
#include "widgets/reflectioneffect.h"
|
||||
#include "dbus/dbusdisplay.h"
|
||||
#include "panelmenu.h"
|
||||
|
||||
class LayoutDropMask;
|
||||
@ -33,6 +34,9 @@ public:
|
||||
void showPanelMenu();
|
||||
void loadResources();
|
||||
|
||||
public slots:
|
||||
void resizeWithContent();
|
||||
|
||||
signals:
|
||||
void startShow();
|
||||
void startHide();
|
||||
@ -58,7 +62,6 @@ private:
|
||||
|
||||
void onItemDropped();
|
||||
void onItemDragStarted();
|
||||
void onLayoutContentsWidthChanged();
|
||||
void onAppItemAdd(AbstractDockItem *item, bool delayShow);
|
||||
void onAppItemRemove(const QString &id);
|
||||
void onDockModeChanged(Dock::DockMode newMode, Dock::DockMode);
|
||||
@ -77,6 +80,8 @@ private:
|
||||
void reloadStyleSheet();
|
||||
void setY(int value); //for hide and show animation
|
||||
|
||||
DisplayRect getScreenRect();
|
||||
|
||||
private:
|
||||
PreviewWindow *m_globalPreview = NULL;
|
||||
DBusDockedAppManager *m_ddam = new DBusDockedAppManager(this);
|
||||
|
@ -1,4 +1,5 @@
|
||||
#include "abstractdockitem.h"
|
||||
#include "dbus/dbusdisplay.h"
|
||||
|
||||
ItemTitleLabel::ItemTitleLabel(QWidget *parent) :
|
||||
QLabel(parent)
|
||||
@ -141,7 +142,10 @@ void AbstractDockItem::showPreview(const QPoint &previewPos)
|
||||
return;
|
||||
}
|
||||
|
||||
QPoint pos = previewPos.isNull() ? QPoint(globalX() + width() / 2, globalY() - DOCK_PREVIEW_MARGIN) : previewPos;
|
||||
QPoint pos = previewPos.isNull()
|
||||
? QPoint(globalX() + width() / 2, globalY() - DOCK_PREVIEW_MARGIN)
|
||||
: previewPos;
|
||||
|
||||
if (getApplet() == NULL) {
|
||||
QString title = getTitle();
|
||||
if (!title.isEmpty()) {
|
||||
|
@ -1,9 +1,12 @@
|
||||
#include "screenmask.h"
|
||||
#include "dbus/dbusdisplay.h"
|
||||
|
||||
ScreenMask::ScreenMask(QWidget *parent) : QWidget(parent)
|
||||
{
|
||||
QRect rec = QApplication::desktop()->screenGeometry();
|
||||
this->resize(rec.width(),rec.height());
|
||||
|
||||
DBusDisplay d;
|
||||
DisplayRect rec = d.primaryRect();
|
||||
this->resize(rec.width, rec.height);
|
||||
this->setWindowFlags(Qt::FramelessWindowHint | Qt::Dialog);
|
||||
this->setWindowOpacity(0);
|
||||
|
||||
|
@ -8,7 +8,6 @@
|
||||
#include <QMimeData>
|
||||
#include <QDropEvent>
|
||||
#include <QTransform>
|
||||
#include <QApplication>
|
||||
#include <QDesktopWidget>
|
||||
#include <QDragMoveEvent>
|
||||
#include <QDragEnterEvent>
|
||||
|
Loading…
x
Reference in New Issue
Block a user