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