You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
106 lines
3.2 KiB
106 lines
3.2 KiB
6 years ago
|
Description: Allow plugin's "static" configration change
|
||
|
This is patch 1/4 adding autoexpansion support to the spacer plugin.
|
||
|
Author: Palo Kisa <palo.kisa@gmail.com>
|
||
|
Origin: upstream
|
||
|
Bug: https://github.com/lxqt/lxqt/issues/1038
|
||
|
Applied-Upstream: commit:6fbe184
|
||
|
Last-Update: 2018-08-16
|
||
|
--- a/panel/ilxqtpanel.h
|
||
|
+++ b/panel/ilxqtpanel.h
|
||
|
@@ -110,6 +110,16 @@ public:
|
||
|
*
|
||
|
*/
|
||
|
virtual void willShowWindow(QWidget * w) = 0;
|
||
|
+
|
||
|
+ /*!
|
||
|
+ * \brief By calling this function, a plugin notifies the panel about change of it's "static"
|
||
|
+ * configuration
|
||
|
+ *
|
||
|
+ * \param plugin the changed plugin
|
||
|
+ *
|
||
|
+ * \sa ILXQtPanelPlugin::isSeparate(), ILXQtPanelPlugin::isExpandable
|
||
|
+ */
|
||
|
+ virtual void pluginFlagsChanged(const ILXQtPanelPlugin * plugin) = 0;
|
||
|
};
|
||
|
|
||
|
#endif // ILXQTPANEL_H
|
||
|
--- a/panel/ilxqtpanelplugin.h
|
||
|
+++ b/panel/ilxqtpanelplugin.h
|
||
|
@@ -196,6 +196,17 @@ public:
|
||
|
mPanel->willShowWindow(w);
|
||
|
}
|
||
|
|
||
|
+ /*!
|
||
|
+ * \brief By calling this function, a plugin notifies the panel about change of it's "static"
|
||
|
+ * configuration
|
||
|
+ *
|
||
|
+ * \sa isSeparate(), isExpandable
|
||
|
+ */
|
||
|
+ inline void pluginFlagsChanged()
|
||
|
+ {
|
||
|
+ mPanel->pluginFlagsChanged(this);
|
||
|
+ }
|
||
|
+
|
||
|
virtual bool isSeparate() const { return false; }
|
||
|
virtual bool isExpandable() const { return false; }
|
||
|
private:
|
||
|
--- a/panel/lxqtpanel.cpp
|
||
|
+++ b/panel/lxqtpanel.cpp
|
||
|
@@ -1225,6 +1225,14 @@ void LXQtPanel::willShowWindow(QWidget *
|
||
|
/************************************************
|
||
|
|
||
|
************************************************/
|
||
|
+void LXQtPanel::pluginFlagsChanged(const ILXQtPanelPlugin * /*plugin*/)
|
||
|
+{
|
||
|
+ mLayout->rebuild();
|
||
|
+}
|
||
|
+
|
||
|
+/************************************************
|
||
|
+
|
||
|
+ ************************************************/
|
||
|
QString LXQtPanel::qssPosition() const
|
||
|
{
|
||
|
return positionToStr(position());
|
||
|
--- a/panel/lxqtpanel.h
|
||
|
+++ b/panel/lxqtpanel.h
|
||
|
@@ -146,6 +146,7 @@ public:
|
||
|
QRect calculatePopupWindowPos(QPoint const & absolutePos, QSize const & windowSize) const override;
|
||
|
QRect calculatePopupWindowPos(const ILXQtPanelPlugin *plugin, const QSize &windowSize) const override;
|
||
|
void willShowWindow(QWidget * w) override;
|
||
|
+ void pluginFlagsChanged(const ILXQtPanelPlugin * plugin) override;
|
||
|
// ........ end of ILXQtPanel overrides
|
||
|
|
||
|
/**
|
||
|
--- a/panel/lxqtpanellayout.cpp
|
||
|
+++ b/panel/lxqtpanellayout.cpp
|
||
|
@@ -946,6 +946,16 @@ void LXQtPanelLayout::setLineCount(int v
|
||
|
/************************************************
|
||
|
|
||
|
************************************************/
|
||
|
+void LXQtPanelLayout::rebuild()
|
||
|
+{
|
||
|
+ mLeftGrid->rebuild();
|
||
|
+ mRightGrid->rebuild();
|
||
|
+}
|
||
|
+
|
||
|
+
|
||
|
+/************************************************
|
||
|
+
|
||
|
+ ************************************************/
|
||
|
int LXQtPanelLayout::lineSize() const
|
||
|
{
|
||
|
return mLeftGrid->lineSize();
|
||
|
--- a/panel/lxqtpanellayout.h
|
||
|
+++ b/panel/lxqtpanellayout.h
|
||
|
@@ -73,6 +73,10 @@ public:
|
||
|
ILXQtPanel::Position position() const { return mPosition; }
|
||
|
void setPosition(ILXQtPanel::Position value);
|
||
|
|
||
|
+ /*! \brief Force the layout to re-read items/plugins "static" configuration
|
||
|
+ */
|
||
|
+ void rebuild();
|
||
|
+
|
||
|
static bool itemIsSeparate(QLayoutItem *item);
|
||
|
signals:
|
||
|
void pluginMoved(Plugin * plugin);
|