diff --git a/applets/CMakeLists.txt b/applets/CMakeLists.txt index 95cd87c21..665ae3494 100644 --- a/applets/CMakeLists.txt +++ b/applets/CMakeLists.txt @@ -1,24 +1,24 @@ plasma_install_package(activitybar org.kde.plasma.activitybar) add_subdirectory(icon) plasma_install_package(analog-clock org.kde.plasma.analogclock) plasma_install_package(mediacontroller org.kde.plasma.mediacontroller) -plasma_install_package(panelspacer org.kde.plasma.panelspacer) plasma_install_package(lock_logout org.kde.plasma.lock_logout) add_subdirectory(appmenu) add_subdirectory(systemmonitor) add_subdirectory(batterymonitor) add_subdirectory(calendar) add_subdirectory(devicenotifier) add_subdirectory(digital-clock) add_subdirectory(kicker) +add_subdirectory(panelspacer) plasma_install_package(clipboard org.kde.plasma.clipboard) if(NOT WIN32) # #notifications # #should compile also on windows? (even if doesn't really make sense) add_subdirectory(notifications) add_subdirectory(systemtray) endif() diff --git a/applets/panelspacer/CMakeLists.txt b/applets/panelspacer/CMakeLists.txt new file mode 100644 index 000000000..41592cbcf --- /dev/null +++ b/applets/panelspacer/CMakeLists.txt @@ -0,0 +1,5 @@ + +plasma_install_package(package org.kde.plasma.panelspacer) + +add_subdirectory(plugin) + diff --git a/applets/panelspacer/Messages.sh b/applets/panelspacer/Messages.sh deleted file mode 100755 index e00fbd3c1..000000000 --- a/applets/panelspacer/Messages.sh +++ /dev/null @@ -1,4 +0,0 @@ -#! /usr/bin/env bash -$EXTRACTRC `find . -name \*.rc -o -name \*.ui -o -name \*.kcfg` >> rc.cpp -$XGETTEXT `find . -name \*.js -o -name \*.qml -o -name \*.cpp` -o $podir/plasma_applet_org.kde.plasma.panelspacer.pot -rm -f rc.cpp diff --git a/applets/panelspacer/contents/ui/main.qml b/applets/panelspacer/contents/ui/main.qml deleted file mode 100644 index b5c0a0358..000000000 --- a/applets/panelspacer/contents/ui/main.qml +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright 2014 Marco Martin - * - * 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 2 of - * the License or (at your option) version 3 or any later version - * accepted by the membership of KDE e.V. (or its successor approved - * by the membership of KDE e.V.), which shall act as a proxy - * defined in Section 14 of version 3 of the license. - * - * 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 - */ - -import QtQuick 2.0 -import QtQuick.Layouts 1.1 -import org.kde.plasma.core 2.0 as PlasmaCore -import org.kde.plasma.plasmoid 2.0 -import org.kde.kquickcontrolsaddons 2.0 as KQuickControlsAddons - -Item { - id: root - - z: 9999 - property bool horizontal: plasmoid.formFactor !== PlasmaCore.Types.Vertical - - Layout.fillWidth: plasmoid.configuration.expanding - Layout.fillHeight: plasmoid.configuration.expanding - - Layout.minimumWidth: 1 - Layout.minimumHeight: 1 - Layout.preferredWidth: horizontal ? plasmoid.configuration.length : 0 - Layout.preferredHeight: horizontal ? 0 : plasmoid.configuration.length - - Plasmoid.preferredRepresentation: Plasmoid.fullRepresentation - - function action_expanding() { - plasmoid.configuration.expanding = plasmoid.action("expanding").checked; - } - Component.onCompleted: { - plasmoid.setAction("expanding", i18n("Set flexible size")); - var action = plasmoid.action("expanding"); - action.checkable = true; - action.checked = plasmoid.configuration.expanding; - - plasmoid.removeAction("configure"); - } -} diff --git a/applets/panelspacer/contents/config/main.xml b/applets/panelspacer/package/contents/config/main.xml similarity index 95% rename from applets/panelspacer/contents/config/main.xml rename to applets/panelspacer/package/contents/config/main.xml index 1f5e3505d..c8e25ac5a 100644 --- a/applets/panelspacer/contents/config/main.xml +++ b/applets/panelspacer/package/contents/config/main.xml @@ -1,18 +1,19 @@ true + -1 diff --git a/applets/panelspacer/package/contents/ui/main.qml b/applets/panelspacer/package/contents/ui/main.qml new file mode 100644 index 000000000..0e06ce570 --- /dev/null +++ b/applets/panelspacer/package/contents/ui/main.qml @@ -0,0 +1,119 @@ +/* + * Copyright 2014 Marco Martin + * + * 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 2 of + * the License or (at your option) version 3 or any later version + * accepted by the membership of KDE e.V. (or its successor approved + * by the membership of KDE e.V.), which shall act as a proxy + * defined in Section 14 of version 3 of the license. + * + * 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 chenterX have received a copy of the GNU General Public License + * along with this program. If not, see + */ + +import QtQuick 2.0 +import QtQuick.Layouts 1.1 +import org.kde.plasma.core 2.0 as PlasmaCore +import org.kde.plasma.plasmoid 2.0 +import org.kde.kirigami 2.10 as Kirigami + +Item { + id: root + + z: 9999 + property bool horizontal: plasmoid.formFactor !== PlasmaCore.Types.Vertical + + Layout.fillWidth: plasmoid.configuration.expanding + Layout.fillHeight: plasmoid.configuration.expanding + + Layout.minimumWidth: 1 + Layout.minimumHeight: 1 + Layout.preferredWidth: horizontal + ? (plasmoid.configuration.expanding ? optimalSpace : plasmoid.configuration.length) + : 0 + Layout.preferredHeight: horizontal + ? 0 + : (plasmoid.configuration.expanding ? plasmoid.nativeInterface.containment.width : plasmoid.configuration.length) + + Plasmoid.preferredRepresentation: Plasmoid.fullRepresentation + + function action_expanding() { + plasmoid.configuration.expanding = plasmoid.action("expanding").checked; + } + Component.onCompleted: { + plasmoid.setAction("expanding", i18n("Set flexible size")); + var action = plasmoid.action("expanding"); + action.checkable = true; + action.checked = plasmoid.configuration.expanding; + + plasmoid.removeAction("configure"); + } + + readonly property Item twinSpacer: plasmoid.nativeInterface.twinSpacer + readonly property Item leftTwin: { + if (!twinSpacer) { + return null; + } + + if (root.horizontal) { + return root.Kirigami.ScenePosition.x < twinSpacer.Kirigami.ScenePosition.x ? root : twinSpacer; + } else { + return root.Kirigami.ScenePosition.y < twinSpacer.Kirigami.ScenePosition.y ? root : twinSpacer; + } + } + readonly property Item rightTwin: { + if (!twinSpacer) { + return null; + } + + if (root.horizontal) { + return root.Kirigami.ScenePosition.x >= twinSpacer.Kirigami.ScenePosition.x ? root : twinSpacer; + } else { + return root.Kirigami.ScenePosition.y >= twinSpacer.Kirigami.ScenePosition.y ? root : twinSpacer; + } + } + + readonly property int containmentLeftSpace: twinSpacer + ? (horizontal ? leftTwin.Kirigami.ScenePosition.x : leftTwin.Kirigami.ScenePosition.y) + : -1 + readonly property int containmentRightSpace: twinSpacer + ? ( horizontal + ? plasmoid.nativeInterface.containment.width - rightTwin.Kirigami.ScenePosition.x - rightTwin.width + : plasmoid.nativeInterface.containment.height - rightTwin.Kirigami.ScenePosition.y - rightTwin.height) + : -1 + readonly property real misalignment: containmentRightSpace - containmentLeftSpace + onWidthChanged: { + if (twinSpacer) { + relayoutTimer.restart(); + } + } + Timer { + id: relayoutTimer + interval: 0 + onTriggered: { + if (!twinSpacer) { + root.optimalSpace = plasmoid.nativeInterface.containment.width; + } + var chenterX = ((leftTwin.Kirigami.ScenePosition.x + leftTwin.width)+(plasmoid.nativeInterface.containment.width - rightTwin.Kirigami.ScenePosition.x))/2 + if (leftTwin == root) { + root.optimalSpace = Math.min(plasmoid.nativeInterface.containment.width, Math.max(0, chenterX - containmentLeftSpace)) + } else { + root.optimalSpace = Math.min(plasmoid.nativeInterface.containment.width, Math.max(0, chenterX - containmentRightSpace)) + } + } + } + property int optimalSpace: plasmoid.nativeInterface.containment.width + + Rectangle { + anchors.fill: parent + color: theme.highlightColor + visible: plasmoid.nativeInterface.containment.editMode + } +} diff --git a/applets/panelspacer/metadata.desktop b/applets/panelspacer/package/metadata.desktop similarity index 99% rename from applets/panelspacer/metadata.desktop rename to applets/panelspacer/package/metadata.desktop index f86867449..c2b1f8f76 100644 --- a/applets/panelspacer/metadata.desktop +++ b/applets/panelspacer/package/metadata.desktop @@ -1,147 +1,148 @@ [Desktop Entry] Name=Panel Spacer Name[ar]=مُباعِد لوحة Name[bg]=Разделител за панела Name[bs]=Panelska razmaknica Name[ca]=Espaiador del plafó Name[ca@valencia]=Espaiador del plafó Name[cs]=Mezera v panelu Name[da]=Panel-afstandsstykke Name[de]=Abstandhalter Name[el]=Κενό πίνακα Name[en_GB]=Panel Spacer Name[eo]=Spacigilo de Panelo Name[es]=Espaciador Name[et]=Paneeliruumi korraldaja Name[eu]=Paneleko bereizlea Name[fi]=Paneelivälilevy Name[fr]=Espaceur de tableau de bord Name[fy]=Paniel spaasje Name[ga]=Scarthóir Painéil Name[gl]=Espazador do panel Name[he]=מרווח לוח Name[hr]=Razmak na traci Name[hu]=Panelelválasztó Name[ia]=Spatiator de pannello Name[id]=Panel Spacer Name[is]=Spjaldabil Name[it]=Spaziatore del pannello Name[ja]=パネルのスペーサー Name[kk]=Панель бос орын бөлгіші Name[km]=ចន្លោះ​បន្ទះ Name[kn]=ಫಲಕ ಸ್ಪೇಸರ್ Name[ko]=패널 공백 Name[lt]=Skydelio skirtukas Name[lv]=Paneļa atdalītājs Name[mai]=पटल स्पेसर Name[mk]=Разграничувач на панели Name[ml]=പാളിയില്‍ ഒഴിഞ്ഞസ്ഥലമിടാന്‍ Name[mr]=पटल स्पेसर Name[nb]=Avstandsholder for panel Name[nds]=Paneel-Platzmaker Name[nl]=Paneelscheider Name[nn]=Panelmellomrom Name[pa]=ਪੈਨਲ ਸਪੇਸਰ Name[pl]=Odstęp w panelu Name[pt]=Espaço do Painel Name[pt_BR]=Espaçador do painel Name[ro]=Spațiator panou Name[ru]=Разделитель Name[si]=පැනල ඉඩතැබීම Name[sk]=Medzera v paneli Name[sl]=Praznina za na pult Name[sr]=панелска размакница Name[sr@ijekavian]=панелска размакница Name[sr@ijekavianlatin]=panelska razmaknica Name[sr@latin]=panelska razmaknica Name[sv]=Panelavskiljare Name[th]=ตัวสร้างพื้นที่ว่าง Name[tr]=Panel Ayırıcı Name[ug]=تاختا ئارىلىقى Name[uk]=Розпірка панелі Name[wa]=Separateu e scriftôr Name[x-test]=xxPanel Spacerxx Name[zh_CN]=面板间距 Name[zh_TW]=面板間隔器 Comment=Reserve empty spaces within the panel. Comment[ar]=يحجز مساحات فارغة في اللوحة. Comment[bg]=Запазване на празни места в панела. Comment[bs]=Rezervišite prazne poteze na panelu. Comment[ca]=Reserva espais buits en el plafó. Comment[ca@valencia]=Reserva espais buits en el plafó. Comment[cs]=Rezervovat prázdné místo v panelu. Comment[da]=Reservér tom plads i panelet. Comment[de]=Reserviert freien Platz in der Kontrollleiste. Comment[el]=Διατήρηση κενού χώρου μέσα στον πίνακα. Comment[en_GB]=Reserve empty spaces within the panel. Comment[eo]=Rezervi malplenan spacon en la panelo. Comment[es]=Reservar espacios vacíos en el panel. Comment[et]=Tühja ruumi reserveerimine paneelil. Comment[eu]=Gorde leku hutsak panel barruan. Comment[fi]=Varaa tyhjiä tiloja paneelin sisälle. Comment[fr]=Réserve des espaces vides dans le tableau de bord Comment[fy]=Romte yn paniel frijhâlde Comment[ga]=Cuir spásanna folmha in áirithe sa phainéal. Comment[gl]=Reserva espazos baleiros no panel. Comment[he]=משמש לשמירת מקום פנוי על הלוח. Comment[hr]=Rezervacija praznog mjesta na traci Comment[hu]=Üres helyet választ le egy panelen belül. Comment[ia]=Reserva spatios vacue intra le pannello. Comment[id]=Cadangan ruang kosong di dalam panel. Comment[is]=Taka frá auð svæði innan spjaldsins. Comment[it]=Lascia dello spazio vuoto nel pannello. Comment[ja]=パネルに空のスペースを確保します Comment[kk]=Панельде бос орын қалдырады. Comment[km]=បម្រុងទុក​ចន្លោះទំនេរ​នៅ​ក្នុង​បន្ទះ ។ Comment[kn]=ಫಲಕದ ಒಳಗೆ ಖಾಲಿ ಜಾಗಗಳನ್ನು ಕಾದಿರಿಸು. Comment[ko]=패널의 빈 공간을 채웁니다. Comment[lt]=Rezervuoti skydelyje tuščią vietą. Comment[lv]=Aizpilda pieejamo tukšo vietu uz paneļa. Comment[mai]=पटलक अंदर रिक्त स्थान खाली राखू. Comment[mk]=Резервира празни места во рамките на панелот Comment[ml]=പാനലിലെ ഒഴിഞ്ഞ ഇടങ്ങള്‍ കരുതിവെയ്ക്കുക. Comment[mr]=पटल मध्ये रिकाम्या जागा आरक्षित करा. Comment[nb]=Reserver tomme rom inni panelet. Comment[nds]=Ruum op't Paneel freehollen Comment[nl]=Reserveer lege ruimte in het paneel. Comment[nn]=Reserver tomme plassar i panelet. Comment[pa]=ਪੈਨਲ ਵਿੱਚ ਖਾਲੀ ਥਾਂ ਬਦਲੋ। Comment[pl]=Rezerwuje wolną przestrzeń na panelu. Comment[pt]=Reserva espaços vazios dentro do painel. Comment[pt_BR]=Reserva espaços vazios no painel. Comment[ro]=Rezervează spații goale în cadrul panoului. Comment[ru]=Занимает свободное место на панели Comment[si]=පැනලය තුල හිස් ඉඩ වෙන් කරන්න Comment[sk]=Rezervuje prázdne miesto v paneli. Comment[sl]=Na pultu rezervira prazen prostor. Comment[sr]=Резервишите празне потезе на панелу. Comment[sr@ijekavian]=Резервишите празне потезе на панелу. Comment[sr@ijekavianlatin]=Rezervišite prazne poteze na panelu. Comment[sr@latin]=Rezervišite prazne poteze na panelu. Comment[sv]=Reservera tomt utrymme inne i panelen. Comment[th]=สร้างพื้นที่ว่างไว้ภายในแถบพาเนล Comment[tr]=Paneldeki boş alanları koruyun. Comment[ug]=تاختادا بوشلۇق قالدۇرىدۇ. Comment[uk]=Створює прогалини на панелі. Comment[wa]=Wårdez des vudes espåces e scriftôr. Comment[x-test]=xxReserve empty spaces within the panel.xx Comment[zh_CN]=在面板中预留空白。 Comment[zh_TW]=在面板內保留空間。 X-KDE-ServiceTypes=Plasma/Applet Type=Service X-Plasma-API=declarativeappletscript X-Plasma-MainScript=ui/main.qml NoDisplay=true X-KDE-PluginInfo-Author=The Plasma Team X-KDE-PluginInfo-Email=plasma-devel@kde.org X-KDE-PluginInfo-Name=org.kde.plasma.panelspacer +X-KDE-Library=org.kde.plasma.panelspacer X-KDE-PluginInfo-Version=1.0 X-KDE-PluginInfo-Website=https://www.kde.org/plasma-desktop X-KDE-PluginInfo-Category=System Information X-KDE-PluginInfo-Depends= X-KDE-PluginInfo-License=GPL-2.0+ X-KDE-PluginInfo-EnabledByDefault=true diff --git a/applets/panelspacer/plugin/CMakeLists.txt b/applets/panelspacer/plugin/CMakeLists.txt new file mode 100644 index 000000000..37350c2f2 --- /dev/null +++ b/applets/panelspacer/plugin/CMakeLists.txt @@ -0,0 +1,15 @@ +kde_enable_exceptions() + +add_definitions(-DTRANSLATION_DOMAIN=\"panelspacer\") + +set(panelspacer_SRCS + panelspacer.cpp) + +add_library(org.kde.plasma.panelspacer MODULE ${panelspacer_SRCS}) + +kcoreaddons_desktop_to_json(org.kde.plasma.panelspacer ../package/metadata.desktop) + +target_link_libraries(org.kde.plasma.panelspacer Qt5::Gui Qt5::Core Qt5::Qml Qt5::Quick KF5::Plasma KF5::PlasmaQuick KF5::I18n) + +install(TARGETS org.kde.plasma.panelspacer DESTINATION ${KDE_INSTALL_PLUGINDIR}/plasma/applets) + diff --git a/applets/panelspacer/plugin/panelspacer.cpp b/applets/panelspacer/plugin/panelspacer.cpp new file mode 100644 index 000000000..34aaf96eb --- /dev/null +++ b/applets/panelspacer/plugin/panelspacer.cpp @@ -0,0 +1,147 @@ +/*************************************************************************** + * Copyright (C) 2020 Marco Martin * + * * + * 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 2 of the License, or * + * (at your option) 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, write to the * + * Free Software Foundation, Inc., * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . * + ***************************************************************************/ + +#include "panelspacer.h" + +#include +#include +#include + +#include +#include +#include + +class SpacersTrackerSingleton +{ +public: + SpacersTracker self; +}; + +Q_GLOBAL_STATIC(SpacersTrackerSingleton, privateSpacersTrackerSelf) + +SpacersTracker::SpacersTracker(QObject *parent) + : QObject(parent) +{ +} + +SpacersTracker::~SpacersTracker() +{ +} + +SpacersTracker *SpacersTracker::self() +{ + return &privateSpacersTrackerSelf()->self; +} + +void SpacersTracker::insertSpacer(Plasma::Containment *containment, PanelSpacer *spacer) +{ + const bool wasTwin = m_spacers[containment].count() == 2; + m_spacers[containment] << (spacer); + const bool isTwin = m_spacers[containment].count() == 2; + + if (isTwin) { + auto *lay1 = m_spacers[containment].first(); + auto *lay2 = m_spacers[containment].last(); + lay1->setTwinSpacer(lay2->property("_plasma_graphicObject").value()); + lay2->setTwinSpacer(lay1->property("_plasma_graphicObject").value()); +qWarning()<<"AAAAAAAAAAAAAAAAAAAA"<property("_plasma_graphicObject").value()<property("_plasma_graphicObject").value(); + } else if (wasTwin) { + for (auto *lay : m_spacers[containment]) { + lay->setTwinSpacer(nullptr); + } + } +} + +void SpacersTracker::removeSpacer(Plasma::Containment *containment, PanelSpacer *spacer) +{ + const bool wasTwin = m_spacers[containment].count() == 2; + m_spacers[containment].removeAll(spacer); + const bool isTwin = m_spacers[containment].count() == 2; + + if (isTwin) { + auto *lay1 = m_spacers[containment].first(); + auto *lay2 = m_spacers[containment].last(); + lay1->setTwinSpacer(lay2->property("_plasma_graphicObject").value()); + lay2->setTwinSpacer(lay1->property("_plasma_graphicObject").value()); + + } else if (wasTwin) { + for (auto *lay : m_spacers[containment]) { + lay->setTwinSpacer(nullptr); + } + } + + if (m_spacers[containment].isEmpty()) { + m_spacers.remove(containment); + } +} + +///////////////////////////////////////////////////////////////////// + +PanelSpacer::PanelSpacer(QObject *parent, const QVariantList &args) + : Plasma::Applet(parent, args) +{ +} + +PanelSpacer::~PanelSpacer() +{ + SpacersTracker::self()->removeSpacer(containment(), this); +} + +void PanelSpacer::init() +{ + +} + +void PanelSpacer::constraintsEvent(Plasma::Types::Constraints constraints) +{ + // At this point we're sure the AppletQuickItem has been created already + if (constraints & Plasma::Types::UiReadyConstraint) { + Q_ASSERT(containment()); + Q_ASSERT(containment()->corona()); + + SpacersTracker::self()->insertSpacer(containment(), this); + } + + Plasma::Applet::constraintsEvent(constraints); +} + +void PanelSpacer::setTwinSpacer(PlasmaQuick::AppletQuickItem *spacer) +{ + if (m_twinSpacer == spacer) { + return; + } + + m_twinSpacer = spacer; + emit twinSpacerChanged(); +} + +PlasmaQuick::AppletQuickItem *PanelSpacer::twinSpacer() const +{ + return m_twinSpacer; +} + +PlasmaQuick::AppletQuickItem *PanelSpacer::containmentGraphicObject() const +{ + return containment()->property("_plasma_graphicObject").value(); +} + + +K_EXPORT_PLASMA_APPLET_WITH_JSON(panelspacer, PanelSpacer, "metadata.json") + +#include "panelspacer.moc" diff --git a/applets/panelspacer/plugin/panelspacer.h b/applets/panelspacer/plugin/panelspacer.h new file mode 100644 index 000000000..8ca987dfd --- /dev/null +++ b/applets/panelspacer/plugin/panelspacer.h @@ -0,0 +1,78 @@ +/*************************************************************************** + * Copyright (C) 2020 Marco Martin * + * + * * + * 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 2 of the License, or * + * (at your option) 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, write to the * + * Free Software Foundation, Inc., * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . * + ***************************************************************************/ + +#pragma once + + +#include + +namespace PlasmaQuick { + class AppletQuickItem; +} + +namespace Plasma { + class Containment; +} + +class PanelSpacer; + +class SpacersTracker : public QObject +{ + Q_OBJECT + +public: + SpacersTracker( QObject *parent = nullptr ); + ~SpacersTracker() override; + + static SpacersTracker *self(); + + void insertSpacer(Plasma::Containment *containment, PanelSpacer *spacer); + void removeSpacer(Plasma::Containment *containment, PanelSpacer *spacer); + +private: + QHash > m_spacers; +}; + +class PanelSpacer : public Plasma::Applet +{ + Q_OBJECT + Q_PROPERTY(PlasmaQuick::AppletQuickItem *twinSpacer READ twinSpacer NOTIFY twinSpacerChanged) + Q_PROPERTY(PlasmaQuick::AppletQuickItem *containment READ containmentGraphicObject CONSTANT) + +public: + PanelSpacer( QObject *parent, const QVariantList &args ); + ~PanelSpacer() override; + + void init() override; + void constraintsEvent(Plasma::Types::Constraints constraints) override; + + void setTwinSpacer(PlasmaQuick::AppletQuickItem *spacer); + PlasmaQuick::AppletQuickItem *twinSpacer() const; + + PlasmaQuick::AppletQuickItem *containmentGraphicObject() const; + +Q_SIGNALS: + void twinSpacerChanged(); + +private: + PlasmaQuick::AppletQuickItem *m_twinSpacer; +}; + +