create config uis always from the same point
This commit is contained in:
parent
f6765fda8c
commit
b0b03f4a8f
@ -269,8 +269,6 @@ void DesktopCorona::handleContainmentAdded(Plasma::Containment* c)
|
|||||||
{
|
{
|
||||||
connect(c, &Plasma::Containment::showAddWidgetsInterface,
|
connect(c, &Plasma::Containment::showAddWidgetsInterface,
|
||||||
this, &DesktopCorona::showWidgetExplorer);
|
this, &DesktopCorona::showWidgetExplorer);
|
||||||
connect(c, &Plasma::Containment::configureRequested,
|
|
||||||
this, &DesktopCorona::showConfigurationInterface);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DesktopCorona::showWidgetExplorer()
|
void DesktopCorona::showWidgetExplorer()
|
||||||
@ -304,28 +302,5 @@ void DesktopCorona::printScriptMessage(const QString &message)
|
|||||||
qDebug() << message;
|
qDebug() << message;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DesktopCorona::showConfigurationInterface(Plasma::Applet *applet)
|
|
||||||
{
|
|
||||||
if (m_configView) {
|
|
||||||
m_configView.data()->hide();
|
|
||||||
m_configView.data()->deleteLater();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!applet || !applet->containment()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Plasma::Containment *cont = qobject_cast<Plasma::Containment *>(applet);
|
|
||||||
|
|
||||||
if (cont) {
|
|
||||||
m_configView = new ContainmentConfigView(cont);
|
|
||||||
} else {
|
|
||||||
m_configView = new ConfigView(applet);
|
|
||||||
}
|
|
||||||
m_configView.data()->init();
|
|
||||||
|
|
||||||
m_configView.data()->show();
|
|
||||||
}
|
|
||||||
|
|
||||||
#include "desktopcorona.moc"
|
#include "desktopcorona.moc"
|
||||||
|
|
||||||
|
@ -85,8 +85,6 @@ protected Q_SLOTS:
|
|||||||
void printScriptError(const QString &error);
|
void printScriptError(const QString &error);
|
||||||
void printScriptMessage(const QString &message);
|
void printScriptMessage(const QString &message);
|
||||||
|
|
||||||
void showConfigurationInterface(Plasma::Applet *applet);
|
|
||||||
|
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
void handleContainmentAdded(Plasma::Containment *c);
|
void handleContainmentAdded(Plasma::Containment *c);
|
||||||
void showWidgetExplorer();
|
void showWidgetExplorer();
|
||||||
@ -97,7 +95,6 @@ private:
|
|||||||
WidgetExplorerView *m_widgetExplorerView;
|
WidgetExplorerView *m_widgetExplorerView;
|
||||||
QHash<Plasma::Containment *, PanelView *> m_panelViews;
|
QHash<Plasma::Containment *, PanelView *> m_panelViews;
|
||||||
KConfigGroup m_desktopDefaultsConfig;
|
KConfigGroup m_desktopDefaultsConfig;
|
||||||
QWeakPointer<ConfigView> m_configView;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
#define PANELCONFIGVIEW_H
|
#define PANELCONFIGVIEW_H
|
||||||
|
|
||||||
#include "configview.h"
|
#include "configview.h"
|
||||||
|
|
||||||
#include <QQuickItem>
|
#include <QQuickItem>
|
||||||
#include <QQuickView>
|
#include <QQuickView>
|
||||||
#include <QJSValue>
|
#include <QJSValue>
|
||||||
|
@ -17,6 +17,10 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "view.h"
|
#include "view.h"
|
||||||
|
#include "containmentconfigview.h"
|
||||||
|
#include "panelconfigview.h"
|
||||||
|
#include "panelview.h"
|
||||||
|
|
||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QQuickItem>
|
#include <QQuickItem>
|
||||||
@ -99,6 +103,8 @@ void View::setContainment(Plasma::Containment *cont)
|
|||||||
this, &View::locationChanged);
|
this, &View::locationChanged);
|
||||||
connect(cont, &Plasma::Containment::formFactorChanged,
|
connect(cont, &Plasma::Containment::formFactorChanged,
|
||||||
this, &View::formFactorChanged);
|
this, &View::formFactorChanged);
|
||||||
|
connect(cont, &Plasma::Containment::configureRequested,
|
||||||
|
this, &View::showConfigurationInterface);
|
||||||
} else {
|
} else {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -152,4 +158,30 @@ QRectF View::screenGeometry()
|
|||||||
return screen()->geometry();
|
return screen()->geometry();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void View::showConfigurationInterface(Plasma::Applet *applet)
|
||||||
|
{
|
||||||
|
if (m_configView) {
|
||||||
|
m_configView.data()->hide();
|
||||||
|
m_configView.data()->deleteLater();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!applet || !applet->containment()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Plasma::Containment *cont = qobject_cast<Plasma::Containment *>(applet);
|
||||||
|
PanelView *pv = qobject_cast< PanelView* >(this);
|
||||||
|
|
||||||
|
if (cont && pv) {
|
||||||
|
m_configView = new PanelConfigView(cont, pv);
|
||||||
|
} else if (cont) {
|
||||||
|
m_configView = new ContainmentConfigView(cont);
|
||||||
|
} else {
|
||||||
|
m_configView = new ConfigView(applet);
|
||||||
|
}
|
||||||
|
m_configView.data()->init();
|
||||||
|
|
||||||
|
m_configView.data()->show();
|
||||||
|
}
|
||||||
|
|
||||||
#include "moc_view.cpp"
|
#include "moc_view.cpp"
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
#include "plasma/corona.h"
|
#include "plasma/corona.h"
|
||||||
#include "plasma/containment.h"
|
#include "plasma/containment.h"
|
||||||
|
|
||||||
|
#include "configview.h"
|
||||||
|
|
||||||
class View : public QQuickView
|
class View : public QQuickView
|
||||||
{
|
{
|
||||||
@ -54,6 +55,9 @@ public:
|
|||||||
|
|
||||||
QRectF screenGeometry();
|
QRectF screenGeometry();
|
||||||
|
|
||||||
|
protected Q_SLOTS:
|
||||||
|
void showConfigurationInterface(Plasma::Applet *applet);
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void locationChanged(Plasma::Location location);
|
void locationChanged(Plasma::Location location);
|
||||||
void formFactorChanged(Plasma::FormFactor formFactor);
|
void formFactorChanged(Plasma::FormFactor formFactor);
|
||||||
@ -63,6 +67,7 @@ Q_SIGNALS:
|
|||||||
private:
|
private:
|
||||||
Plasma::Corona *m_corona;
|
Plasma::Corona *m_corona;
|
||||||
QWeakPointer<Plasma::Containment> m_containment;
|
QWeakPointer<Plasma::Containment> m_containment;
|
||||||
|
QWeakPointer<ConfigView> m_configView;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // VIEW_H
|
#endif // VIEW_H
|
||||||
|
Loading…
Reference in New Issue
Block a user