remove delayedContainmentInit
This commit is contained in:
parent
7f654acfd2
commit
48561504c8
@ -436,7 +436,6 @@ CoronaPrivate::CoronaPrivate(Corona *corona)
|
|||||||
defaultContainmentPlugin("desktop"),
|
defaultContainmentPlugin("desktop"),
|
||||||
config(0),
|
config(0),
|
||||||
configSyncTimer(new QTimer(corona)),
|
configSyncTimer(new QTimer(corona)),
|
||||||
delayedInitTimer(new QTimer(corona)),
|
|
||||||
actions(corona)
|
actions(corona)
|
||||||
{
|
{
|
||||||
if (QCoreApplication::instance()) {
|
if (QCoreApplication::instance()) {
|
||||||
@ -453,9 +452,6 @@ CoronaPrivate::~CoronaPrivate()
|
|||||||
|
|
||||||
void CoronaPrivate::init()
|
void CoronaPrivate::init()
|
||||||
{
|
{
|
||||||
delayedInitTimer->setInterval(100);
|
|
||||||
delayedInitTimer->setSingleShot(true);
|
|
||||||
QObject::connect(delayedInitTimer, SIGNAL(timeout()), q, SLOT(delayedContainmentInit()));
|
|
||||||
configSyncTimer->setSingleShot(true);
|
configSyncTimer->setSingleShot(true);
|
||||||
QObject::connect(configSyncTimer, SIGNAL(timeout()), q, SLOT(syncConfig()));
|
QObject::connect(configSyncTimer, SIGNAL(timeout()), q, SLOT(syncConfig()));
|
||||||
|
|
||||||
@ -628,8 +624,6 @@ Containment *CoronaPrivate::addContainment(const QString &name, const QVariantLi
|
|||||||
applet->d->isContainment = true;
|
applet->d->isContainment = true;
|
||||||
applet->d->setIsContainment(true, true);
|
applet->d->setIsContainment(true, true);
|
||||||
containments.append(containment);
|
containments.append(containment);
|
||||||
containmentsNeedingInit.append(containment);
|
|
||||||
delayedInitTimer->start();
|
|
||||||
|
|
||||||
QObject::connect(containment, SIGNAL(destroyed(QObject*)),
|
QObject::connect(containment, SIGNAL(destroyed(QObject*)),
|
||||||
q, SLOT(containmentDestroyed(QObject*)));
|
q, SLOT(containmentDestroyed(QObject*)));
|
||||||
@ -640,30 +634,18 @@ Containment *CoronaPrivate::addContainment(const QString &name, const QVariantLi
|
|||||||
QObject::connect(containment, SIGNAL(screenChanged(int,int,Plasma::Containment*)),
|
QObject::connect(containment, SIGNAL(screenChanged(int,int,Plasma::Containment*)),
|
||||||
q, SIGNAL(screenOwnerChanged(int,int,Plasma::Containment*)));
|
q, SIGNAL(screenOwnerChanged(int,int,Plasma::Containment*)));
|
||||||
|
|
||||||
|
containment->init();
|
||||||
|
KConfigGroup cg = containment->config();
|
||||||
|
containment->restore(cg);
|
||||||
|
containment->updateConstraints(Plasma::StartupCompletedConstraint);
|
||||||
|
containment->save(cg);
|
||||||
|
q->requestConfigSync();
|
||||||
|
containment->flushPendingConstraintsEvents();
|
||||||
|
emit q->containmentAdded(containment);
|
||||||
|
|
||||||
return containment;
|
return containment;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CoronaPrivate::delayedContainmentInit()
|
|
||||||
{
|
|
||||||
foreach (QWeakPointer<Containment> c, containmentsNeedingInit) {
|
|
||||||
Containment *containment = c.data();
|
|
||||||
if (!containment) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
containment->init();
|
|
||||||
KConfigGroup cg = containment->config();
|
|
||||||
containment->restore(cg);
|
|
||||||
containment->updateConstraints(Plasma::StartupCompletedConstraint);
|
|
||||||
containment->save(cg);
|
|
||||||
q->requestConfigSync();
|
|
||||||
containment->flushPendingConstraintsEvents();
|
|
||||||
emit q->containmentAdded(containment);
|
|
||||||
}
|
|
||||||
|
|
||||||
containmentsNeedingInit.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
QList<Plasma::Containment *> CoronaPrivate::importLayout(const KConfigGroup &conf, bool mergeConfig)
|
QList<Plasma::Containment *> CoronaPrivate::importLayout(const KConfigGroup &conf, bool mergeConfig)
|
||||||
{
|
{
|
||||||
if (!conf.isValid()) {
|
if (!conf.isValid()) {
|
||||||
|
@ -393,7 +393,6 @@ private:
|
|||||||
Q_PRIVATE_SLOT(d, void syncConfig())
|
Q_PRIVATE_SLOT(d, void syncConfig())
|
||||||
Q_PRIVATE_SLOT(d, void toggleImmutability())
|
Q_PRIVATE_SLOT(d, void toggleImmutability())
|
||||||
Q_PRIVATE_SLOT(d, void showShortcutConfig())
|
Q_PRIVATE_SLOT(d, void showShortcutConfig())
|
||||||
Q_PRIVATE_SLOT(d, void delayedContainmentInit())
|
|
||||||
|
|
||||||
friend class CoronaPrivate;
|
friend class CoronaPrivate;
|
||||||
friend class View;
|
friend class View;
|
||||||
|
@ -46,7 +46,6 @@ public:
|
|||||||
void containmentDestroyed(QObject *obj);
|
void containmentDestroyed(QObject *obj);
|
||||||
void syncConfig();
|
void syncConfig();
|
||||||
Containment *addContainment(const QString &name, const QVariantList &args, uint id);
|
Containment *addContainment(const QString &name, const QVariantList &args, uint id);
|
||||||
void delayedContainmentInit();
|
|
||||||
void offscreenWidgetDestroyed(QObject *);
|
void offscreenWidgetDestroyed(QObject *);
|
||||||
QList<Plasma::Containment *> importLayout(const KConfigGroup &conf, bool mergeConfig);
|
QList<Plasma::Containment *> importLayout(const KConfigGroup &conf, bool mergeConfig);
|
||||||
|
|
||||||
@ -59,9 +58,7 @@ public:
|
|||||||
QString defaultContainmentPlugin;
|
QString defaultContainmentPlugin;
|
||||||
KSharedConfigPtr config;
|
KSharedConfigPtr config;
|
||||||
QTimer *configSyncTimer;
|
QTimer *configSyncTimer;
|
||||||
QTimer *delayedInitTimer;
|
|
||||||
QList<Containment*> containments;
|
QList<Containment*> containments;
|
||||||
QList<QWeakPointer<Containment> > containmentsNeedingInit;
|
|
||||||
QHash<uint, QGraphicsWidget*> offscreenWidgets;
|
QHash<uint, QGraphicsWidget*> offscreenWidgets;
|
||||||
KActionCollection actions;
|
KActionCollection actions;
|
||||||
QMap<Containment::Type, ContainmentActionsPluginsConfig> containmentActionsDefaults;
|
QMap<Containment::Type, ContainmentActionsPluginsConfig> containmentActionsDefaults;
|
||||||
|
@ -473,6 +473,9 @@ void ContainmentInterface::appletAddedForward(Plasma::Applet *applet, const QPoi
|
|||||||
QObject *contGraphicObject = containment()->property("graphicObject").value<QObject *>();
|
QObject *contGraphicObject = containment()->property("graphicObject").value<QObject *>();
|
||||||
|
|
||||||
qDebug() << "Applet added:" << applet << applet->name() << appletGraphicObject;
|
qDebug() << "Applet added:" << applet << applet->name() << appletGraphicObject;
|
||||||
|
foreach(Plasma::Applet *appl, containment()->applets()) {
|
||||||
|
qDebug() << appl << applet->name() << appl->property("graphicObject");
|
||||||
|
}
|
||||||
|
|
||||||
if (applet && contGraphicObject && appletGraphicObject) {
|
if (applet && contGraphicObject && appletGraphicObject) {
|
||||||
appletGraphicObject->setProperty("visible", false);
|
appletGraphicObject->setProperty("visible", false);
|
||||||
|
@ -117,6 +117,11 @@ void DesktopCorona::checkDesktop(/*Activity *activity,*/ bool signalWhenExists,
|
|||||||
}
|
}
|
||||||
|
|
||||||
c->setScreen(screen, desktop);
|
c->setScreen(screen, desktop);
|
||||||
|
if (screen >= 0 || m_views.count() >= screen + 1) {
|
||||||
|
m_views[screen]->setContainment(c);
|
||||||
|
} else {
|
||||||
|
qWarning() << "Invalid screen";
|
||||||
|
}
|
||||||
c->flushPendingConstraintsEvents();
|
c->flushPendingConstraintsEvents();
|
||||||
requestConfigSync();
|
requestConfigSync();
|
||||||
|
|
||||||
|
@ -46,9 +46,6 @@ int main(int argc, char** argv)
|
|||||||
|
|
||||||
QApplication app(argc, argv);
|
QApplication app(argc, argv);
|
||||||
|
|
||||||
//qmlRegisterType<Svg>("org.kde.plasma", 2, 0, "Svg");
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
DesktopCorona *corona = new DesktopCorona();
|
DesktopCorona *corona = new DesktopCorona();
|
||||||
corona->initializeLayout();
|
corona->initializeLayout();
|
||||||
|
@ -29,8 +29,12 @@ Rectangle {
|
|||||||
Connections {
|
Connections {
|
||||||
target: plasmoid
|
target: plasmoid
|
||||||
onAppletAdded: {
|
onAppletAdded: {
|
||||||
|
var container = appletContainerComponent.createObject(root)
|
||||||
|
container.visible = true
|
||||||
print("Applet added: " + applet)
|
print("Applet added: " + applet)
|
||||||
applet.parent = root
|
applet.parent = container
|
||||||
|
container.applet = applet
|
||||||
|
applet.anchors.fill= applet.parent
|
||||||
applet.visible = true
|
applet.visible = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -40,57 +44,56 @@ Rectangle {
|
|||||||
imagePath: "widgets/configuration-icons"
|
imagePath: "widgets/configuration-icons"
|
||||||
}
|
}
|
||||||
|
|
||||||
PlasmaCore.FrameSvgItem {
|
Component {
|
||||||
id: frame
|
id: appletContainerComponent
|
||||||
x: 50
|
PlasmaCore.FrameSvgItem {
|
||||||
y: 50
|
id: frame
|
||||||
width: txt.paintedWidth + 80
|
x: 50
|
||||||
height: txt.paintedHeight + 80 * 2
|
y: 50
|
||||||
property int small: 100
|
width: 150
|
||||||
property int large: parent.width - width - 150
|
height: 150
|
||||||
imagePath: "widgets/background"
|
property alias applet: appletContainer.children
|
||||||
MouseArea {
|
property int small: 100
|
||||||
anchors.fill: parent
|
property int large: parent.width - width - 150
|
||||||
drag.target: parent
|
imagePath: "widgets/background"
|
||||||
onClicked: {
|
MouseArea {
|
||||||
var s = (frame.x == frame.large) ? frame.small : frame.large;
|
anchors.fill: parent
|
||||||
frame.x = s
|
drag.target: parent
|
||||||
frame.height = s
|
onClicked: {
|
||||||
|
var s = (frame.x == frame.large) ? frame.small : frame.large;
|
||||||
|
frame.x = s
|
||||||
|
frame.height = s
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
Behavior on x { PropertyAnimation { easing.type: Easing.OutElastic; duration: 800 } }
|
||||||
Behavior on x { PropertyAnimation { easing.type: Easing.OutElastic; duration: 800 } }
|
//Behavior on y { PropertyAnimation { easing.type: Easing.OutElastic; duration: 800 } }
|
||||||
//Behavior on y { PropertyAnimation { easing.type: Easing.OutElastic; duration: 800 } }
|
Behavior on height { PropertyAnimation { easing.type: Easing.InOutDouble; duration: 300 } }
|
||||||
Behavior on height { PropertyAnimation { easing.type: Easing.InOutDouble; duration: 300 } }
|
|
||||||
|
|
||||||
Column {
|
Item {
|
||||||
anchors.centerIn: parent
|
id: appletContainer
|
||||||
Text {
|
anchors {
|
||||||
id: txt
|
fill: parent
|
||||||
text: "Click or Drag";
|
leftMargin: frame.margins.left
|
||||||
|
rightMargin: parent.margins.right
|
||||||
|
topMargin: parent.margins.top
|
||||||
|
bottomMargin: parent.margins.bottom
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Text {
|
PlasmaCore.SvgItem {
|
||||||
text: plasmoid
|
svg: actionssvg
|
||||||
|
elementId: "rotate"
|
||||||
|
width: 16
|
||||||
|
height: width
|
||||||
|
anchors.margins: frame.margins.left
|
||||||
|
anchors {
|
||||||
|
top: parent.top
|
||||||
|
left: parent.left
|
||||||
|
}
|
||||||
|
//Rectangle { color: "white"; opacity: 0.2; anchors.fill: parent; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
PlasmaCore.SvgItem {
|
|
||||||
svg: actionssvg
|
|
||||||
elementId: "rotate"
|
|
||||||
width: 16
|
|
||||||
height: width
|
|
||||||
anchors.margins: frame.margins.left
|
|
||||||
anchors {
|
|
||||||
top: parent.top
|
|
||||||
left: parent.left
|
|
||||||
}
|
|
||||||
//Rectangle { color: "white"; opacity: 0.2; anchors.fill: parent; }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
// PlasmaCore.SvgItem {
|
|
||||||
// svg: actionssvg
|
|
||||||
// elementId: "rotate"
|
|
||||||
// width: 128
|
|
||||||
// height: width
|
|
||||||
// }
|
|
||||||
PlasmaCore.IconItem {
|
PlasmaCore.IconItem {
|
||||||
source: "accessories-dictionary"
|
source: "accessories-dictionary"
|
||||||
x: 50
|
x: 50
|
||||||
|
Loading…
Reference in New Issue
Block a user