custom loader and applet

This commit is contained in:
Marco Martin 2014-07-14 11:04:48 +02:00
parent 719590dea3
commit eac81fe1bf
2 changed files with 41 additions and 11 deletions

View File

@ -22,11 +22,21 @@
#include <QStandardPaths>
#include <QApplication>
/*virtual Plasma::Applet *SimpleLoader::internalLoadApplet(const QString &name, uint appletId = 0,
const QVariantList &args = QVariantList())
Plasma::Applet *SimpleLoader::internalLoadApplet(const QString &name, uint appletId,
const QVariantList &args)
{
returh new Plasma::Applet();
}*/
return new SimpleApplet();
}
SimpleCorona::SimpleCorona(QObject *parent)
: Plasma::Corona(parent)
{
Plasma::PluginLoader::setPluginLoader(new SimpleLoader);
}
SimpleCorona::~SimpleCorona()
{}
QRect SimpleCorona::screenGeometry(int screen) const
{
@ -34,6 +44,14 @@ QRect SimpleCorona::screenGeometry(int screen) const
return QRect(100*screen, 100, 100, 100);
}
SimpleApplet::SimpleApplet(QObject *parent , const QString &serviceId, uint appletId)
: Plasma::Applet(parent, serviceId, appletId)
{
updateConstraints(Plasma::Types::UiReadyConstraint);
}
static void runKBuildSycoca()
{
QProcess proc;
@ -86,9 +104,9 @@ void CoronaTest::restore()
void CoronaTest::startupCompletion()
{
//startup completion signals
QEXPECT_FAIL("", "TODO: complete startup", Continue);
//QEXPECT_FAIL("", "TODO: complete startup", Continue);
QVERIFY(m_corona->isStartupCompleted());
QEXPECT_FAIL("", "TODO: complete uiReady signals", Continue);
//QEXPECT_FAIL("", "TODO: complete uiReady signals", Continue);
QVERIFY(m_corona->containments().first()->isUiReady());
//TODO: applet creation and deletion

View File

@ -22,21 +22,33 @@
#include <QtTest/QtTest>
#include "plasma/corona.h"
#include "plasma/pluginloader.h"
/*class SimpleLoader : public Plasma::PluginLoader
class SimpleLoader : public Plasma::PluginLoader
{
Q_OBJECT
protected:
virtual Applet *internalLoadApplet(const QString &name, uint appletId = 0,
virtual Plasma::Applet *internalLoadApplet(const QString &name, uint appletId = 0,
const QVariantList &args = QVariantList());
};*/
};
class SimpleCorona : public Plasma::Corona
{
Q_OBJECT
public:
explicit SimpleCorona(QObject * parent = 0);
~SimpleCorona();
QRect screenGeometry(int) const;
};
class SimpleApplet : public Plasma::Applet
{
Q_OBJECT
public:
explicit SimpleApplet(QObject *parent = 0, const QString &serviceId = QString(), uint appletId = 0);
};
class CoronaTest : public QObject