mirror of
https://github.com/KDE/latte-dock.git
synced 2024-12-25 09:33:51 +03:00
orchestrate View config windows showing properly
This commit is contained in:
parent
ba87b3b32b
commit
1740c0be91
@ -63,7 +63,6 @@ void CanvasConfigView::init()
|
|||||||
auto source = QUrl::fromLocalFile(m_latteView->containment()->corona()->kPackage().filePath(tempFilePath));
|
auto source = QUrl::fromLocalFile(m_latteView->containment()->corona()->kPackage().filePath(tempFilePath));
|
||||||
setSource(source);
|
setSource(source);
|
||||||
syncGeometry();
|
syncGeometry();
|
||||||
syncSlideEffect();
|
|
||||||
|
|
||||||
if (m_parent && KWindowSystem::isPlatformX11()) {
|
if (m_parent && KWindowSystem::isPlatformX11()) {
|
||||||
m_parent->requestActivate();
|
m_parent->requestActivate();
|
||||||
@ -81,8 +80,6 @@ void CanvasConfigView::initParentView(Latte::View *view)
|
|||||||
|
|
||||||
updateEnabledBorders();
|
updateEnabledBorders();
|
||||||
syncGeometry();
|
syncGeometry();
|
||||||
|
|
||||||
show();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CanvasConfigView::syncGeometry()
|
void CanvasConfigView::syncGeometry()
|
||||||
@ -144,7 +141,6 @@ void CanvasConfigView::showEvent(QShowEvent *ev)
|
|||||||
}
|
}
|
||||||
|
|
||||||
syncGeometry();
|
syncGeometry();
|
||||||
syncSlideEffect();
|
|
||||||
|
|
||||||
//! show Canvas on top of all other panels/docks and show
|
//! show Canvas on top of all other panels/docks and show
|
||||||
//! its parent view on top afterwards
|
//! its parent view on top afterwards
|
||||||
|
@ -50,6 +50,11 @@
|
|||||||
// Plasma
|
// Plasma
|
||||||
#include <Plasma/Package>
|
#include <Plasma/Package>
|
||||||
|
|
||||||
|
#define CANVASWINDOWINTERVAL 50
|
||||||
|
#define PRIMARYWINDOWINTERVAL 250
|
||||||
|
#define SECONDARYWINDOWINTERVAL 250
|
||||||
|
#define SLIDEOUTINTERVAL 400
|
||||||
|
|
||||||
namespace Latte {
|
namespace Latte {
|
||||||
namespace ViewPart {
|
namespace ViewPart {
|
||||||
|
|
||||||
@ -110,7 +115,6 @@ void PrimaryConfigView::init()
|
|||||||
auto source = QUrl::fromLocalFile(m_latteView->containment()->corona()->kPackage().filePath(tempFilePath));
|
auto source = QUrl::fromLocalFile(m_latteView->containment()->corona()->kPackage().filePath(tempFilePath));
|
||||||
setSource(source);
|
setSource(source);
|
||||||
syncGeometry();
|
syncGeometry();
|
||||||
syncSlideEffect();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PrimaryConfigView::setOnActivities(QStringList activities)
|
void PrimaryConfigView::setOnActivities(QStringList activities)
|
||||||
@ -139,12 +143,30 @@ void PrimaryConfigView::requestActivate()
|
|||||||
SubConfigView::requestActivate();
|
SubConfigView::requestActivate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PrimaryConfigView::showPrimaryWindow()
|
||||||
|
{
|
||||||
|
if (isVisible()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
showAfter(PRIMARYWINDOWINTERVAL);
|
||||||
|
showCanvasWindow();
|
||||||
|
showSecondaryWindow();
|
||||||
|
}
|
||||||
|
|
||||||
|
void PrimaryConfigView::hidePrimaryWindow()
|
||||||
|
{
|
||||||
|
hide();
|
||||||
|
}
|
||||||
|
|
||||||
void PrimaryConfigView::showCanvasWindow()
|
void PrimaryConfigView::showCanvasWindow()
|
||||||
{
|
{
|
||||||
if (!m_canvasConfigView) {
|
if (!m_canvasConfigView) {
|
||||||
m_canvasConfigView = new CanvasConfigView(m_latteView, this);
|
m_canvasConfigView = new CanvasConfigView(m_latteView, this);
|
||||||
} else if (m_canvasConfigView && !m_canvasConfigView->isVisible()){
|
}
|
||||||
m_canvasConfigView->show();
|
|
||||||
|
if (m_canvasConfigView && !m_canvasConfigView->isVisible()){
|
||||||
|
m_canvasConfigView->showAfter(CANVASWINDOWINTERVAL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -156,11 +178,19 @@ void PrimaryConfigView::hideCanvasWindow()
|
|||||||
}
|
}
|
||||||
|
|
||||||
void PrimaryConfigView::showSecondaryWindow()
|
void PrimaryConfigView::showSecondaryWindow()
|
||||||
{
|
{
|
||||||
|
bool isValidShowing{m_latteView->formFactor() == Plasma::Types::Horizontal && inAdvancedMode()};
|
||||||
|
|
||||||
|
if (!isValidShowing) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!m_secConfigView) {
|
if (!m_secConfigView) {
|
||||||
m_secConfigView = new SecondaryConfigView(m_latteView, this);
|
m_secConfigView = new SecondaryConfigView(m_latteView, this);
|
||||||
} else if (m_secConfigView && !m_secConfigView->isVisible()){
|
}
|
||||||
m_secConfigView->show();
|
|
||||||
|
if (m_secConfigView && !m_secConfigView->isVisible()){
|
||||||
|
m_secConfigView->showAfter(SECONDARYWINDOWINTERVAL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -180,11 +210,14 @@ void PrimaryConfigView::setParentView(Latte::View *view)
|
|||||||
if (m_latteView) {
|
if (m_latteView) {
|
||||||
hideConfigWindow();
|
hideConfigWindow();
|
||||||
|
|
||||||
QTimer::singleShot(700, [this, view]() {
|
//!slide-out delay
|
||||||
|
QTimer::singleShot(SLIDEOUTINTERVAL, [this, view]() {
|
||||||
initParentView(view);
|
initParentView(view);
|
||||||
|
showPrimaryWindow();
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
initParentView(view);
|
initParentView(view);
|
||||||
|
showPrimaryWindow();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -214,9 +247,6 @@ void PrimaryConfigView::initParentView(Latte::View *view)
|
|||||||
updateAvailableScreenGeometry();
|
updateAvailableScreenGeometry();
|
||||||
syncGeometry();
|
syncGeometry();
|
||||||
|
|
||||||
show();
|
|
||||||
showCanvasWindow();
|
|
||||||
|
|
||||||
setIsReady(true);
|
setIsReady(true);
|
||||||
|
|
||||||
if (m_canvasConfigView) {
|
if (m_canvasConfigView) {
|
||||||
@ -349,7 +379,6 @@ void PrimaryConfigView::showEvent(QShowEvent *ev)
|
|||||||
m_corona->wm()->setViewExtraFlags(this, false, Latte::Types::NormalWindow);
|
m_corona->wm()->setViewExtraFlags(this, false, Latte::Types::NormalWindow);
|
||||||
|
|
||||||
syncGeometry();
|
syncGeometry();
|
||||||
syncSlideEffect();
|
|
||||||
|
|
||||||
if (m_latteView && m_latteView->containment()) {
|
if (m_latteView && m_latteView->containment()) {
|
||||||
m_latteView->containment()->setUserConfiguring(true);
|
m_latteView->containment()->setUserConfiguring(true);
|
||||||
|
@ -99,6 +99,9 @@ public:
|
|||||||
void setParentView(Latte::View *view) override;
|
void setParentView(Latte::View *view) override;
|
||||||
void setOnActivities(QStringList activities);
|
void setOnActivities(QStringList activities);
|
||||||
|
|
||||||
|
void showPrimaryWindow();
|
||||||
|
void hidePrimaryWindow();
|
||||||
|
|
||||||
void requestActivate() override;
|
void requestActivate() override;
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
@ -77,7 +77,6 @@ void SecondaryConfigView::init()
|
|||||||
auto source = QUrl::fromLocalFile(m_latteView->containment()->corona()->kPackage().filePath(tempFilePath));
|
auto source = QUrl::fromLocalFile(m_latteView->containment()->corona()->kPackage().filePath(tempFilePath));
|
||||||
setSource(source);
|
setSource(source);
|
||||||
syncGeometry();
|
syncGeometry();
|
||||||
syncSlideEffect();
|
|
||||||
|
|
||||||
if (m_parent && KWindowSystem::isPlatformX11()) {
|
if (m_parent && KWindowSystem::isPlatformX11()) {
|
||||||
m_parent->requestActivate();
|
m_parent->requestActivate();
|
||||||
@ -90,15 +89,11 @@ QRect SecondaryConfigView::geometryWhenVisible() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
void SecondaryConfigView::initParentView(Latte::View *view)
|
void SecondaryConfigView::initParentView(Latte::View *view)
|
||||||
{
|
{
|
||||||
SubConfigView::initParentView(view);
|
SubConfigView::initParentView(view);
|
||||||
|
|
||||||
updateEnabledBorders();
|
updateEnabledBorders();
|
||||||
syncGeometry();
|
syncGeometry();
|
||||||
|
|
||||||
if (m_latteView->formFactor() == Plasma::Types::Horizontal && m_parent->inAdvancedMode()) {
|
|
||||||
show();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SecondaryConfigView::syncGeometry()
|
void SecondaryConfigView::syncGeometry()
|
||||||
@ -195,7 +190,6 @@ void SecondaryConfigView::showEvent(QShowEvent *ev)
|
|||||||
m_corona->wm()->setViewExtraFlags(this, false, Latte::Types::NormalWindow);
|
m_corona->wm()->setViewExtraFlags(this, false, Latte::Types::NormalWindow);
|
||||||
|
|
||||||
syncGeometry();
|
syncGeometry();
|
||||||
syncSlideEffect();
|
|
||||||
|
|
||||||
m_screenSyncTimer.start();
|
m_screenSyncTimer.start();
|
||||||
QTimer::singleShot(400, this, &SecondaryConfigView::syncGeometry);
|
QTimer::singleShot(400, this, &SecondaryConfigView::syncGeometry);
|
||||||
|
@ -82,7 +82,14 @@ SubConfigView::SubConfigView(Latte::View *view, const QString &title, const bool
|
|||||||
}
|
}
|
||||||
|
|
||||||
syncGeometry();
|
syncGeometry();
|
||||||
|
});
|
||||||
|
|
||||||
|
m_showTimer.setSingleShot(true);
|
||||||
|
m_showTimer.setInterval(0);
|
||||||
|
|
||||||
|
connections << connect(&m_showTimer, &QTimer::timeout, this, [this]() {
|
||||||
syncSlideEffect();
|
syncSlideEffect();
|
||||||
|
show();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -181,6 +188,17 @@ void SubConfigView::requestActivate()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SubConfigView::showAfter(int msecs)
|
||||||
|
{
|
||||||
|
if (isVisible()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_showTimer.setInterval(msecs);
|
||||||
|
m_showTimer.start();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
void SubConfigView::syncSlideEffect()
|
void SubConfigView::syncSlideEffect()
|
||||||
{
|
{
|
||||||
if (!m_latteView || !m_latteView->containment()) {
|
if (!m_latteView || !m_latteView->containment()) {
|
||||||
|
@ -65,6 +65,7 @@ public:
|
|||||||
|
|
||||||
Latte::View *parentView() const;
|
Latte::View *parentView() const;
|
||||||
virtual void setParentView(Latte::View *view);
|
virtual void setParentView(Latte::View *view);
|
||||||
|
virtual void showAfter(int msecs = 0);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
virtual void syncGeometry() = 0;
|
virtual void syncGeometry() = 0;
|
||||||
@ -83,9 +84,6 @@ protected:
|
|||||||
|
|
||||||
Qt::WindowFlags wFlags() const;
|
Qt::WindowFlags wFlags() const;
|
||||||
|
|
||||||
private slots:
|
|
||||||
void updateWaylandId();
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool m_isNormalWindow{true};
|
bool m_isNormalWindow{true};
|
||||||
QTimer m_screenSyncTimer;
|
QTimer m_screenSyncTimer;
|
||||||
@ -100,12 +98,17 @@ protected:
|
|||||||
Latte::Corona *m_corona{nullptr};
|
Latte::Corona *m_corona{nullptr};
|
||||||
KWayland::Client::PlasmaShellSurface *m_shellSurface{nullptr};
|
KWayland::Client::PlasmaShellSurface *m_shellSurface{nullptr};
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void updateWaylandId();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void setupWaylandIntegration();
|
void setupWaylandIntegration();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QString m_validTitle;
|
QString m_validTitle;
|
||||||
|
|
||||||
|
QTimer m_showTimer;
|
||||||
|
|
||||||
Latte::WindowSystem::WindowId m_waylandWindowId;
|
Latte::WindowSystem::WindowId m_waylandWindowId;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -457,9 +457,9 @@ void View::showConfigurationInterface(Plasma::Applet *applet)
|
|||||||
|
|
||||||
if (m_primaryConfigView && c && c->isContainment() && c == this->containment()) {
|
if (m_primaryConfigView && c && c->isContainment() && c == this->containment()) {
|
||||||
if (m_primaryConfigView->isVisible()) {
|
if (m_primaryConfigView->isVisible()) {
|
||||||
m_primaryConfigView->hide();
|
m_primaryConfigView->hidePrimaryWindow();
|
||||||
} else {
|
} else {
|
||||||
m_primaryConfigView->show();
|
m_primaryConfigView->showPrimaryWindow();
|
||||||
applyActivitiesToWindows();
|
applyActivitiesToWindows();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user