Run clang-format on all cpp/h files
NO_CHANGELOG
This commit is contained in:
parent
cce6198bb9
commit
c0274df69a
|
@ -13,8 +13,8 @@
|
|||
|
||||
#include <KConfigLoader>
|
||||
|
||||
#include <QQmlEngine>
|
||||
#include <QQmlComponent>
|
||||
#include <QQmlEngine>
|
||||
|
||||
void ConfigModelTest::configSchemeFromPackage()
|
||||
{
|
||||
|
@ -108,4 +108,3 @@ void ConfigModelTest::notEmptySourceWithApplet()
|
|||
}
|
||||
|
||||
QTEST_MAIN(ConfigModelTest)
|
||||
|
||||
|
|
|
@ -21,6 +21,4 @@ private Q_SLOTS:
|
|||
void configSchemeFromPackage();
|
||||
void emptySourceWithApplet();
|
||||
void notEmptySourceWithApplet();
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -5,16 +5,15 @@
|
|||
*/
|
||||
|
||||
#include "coronatest.h"
|
||||
#include <KSycoca>
|
||||
#include <KActionCollection>
|
||||
#include <QStandardPaths>
|
||||
#include <KSycoca>
|
||||
#include <QAction>
|
||||
#include <QApplication>
|
||||
#include <QSignalSpy>
|
||||
#include <QRandomGenerator>
|
||||
#include <QProcess>
|
||||
Plasma::Applet *SimpleLoader::internalLoadApplet(const QString &name, uint appletId,
|
||||
const QVariantList &args)
|
||||
#include <QRandomGenerator>
|
||||
#include <QSignalSpy>
|
||||
#include <QStandardPaths>
|
||||
Plasma::Applet *SimpleLoader::internalLoadApplet(const QString &name, uint appletId, const QVariantList &args)
|
||||
{
|
||||
Q_UNUSED(args)
|
||||
if (name == QLatin1String("simpleapplet")) {
|
||||
|
@ -35,8 +34,8 @@ SimpleCorona::SimpleCorona(QObject *parent)
|
|||
}
|
||||
|
||||
SimpleCorona::~SimpleCorona()
|
||||
{}
|
||||
|
||||
{
|
||||
}
|
||||
|
||||
QRect SimpleCorona::screenGeometry(int screen) const
|
||||
{
|
||||
|
@ -64,7 +63,6 @@ SimpleApplet::SimpleApplet(QObject *parent , const QString &serviceId, uint appl
|
|||
});
|
||||
}
|
||||
|
||||
|
||||
SimpleContainment::SimpleContainment(QObject *parent, const QString &serviceId, uint appletId)
|
||||
: Plasma::Containment(parent, serviceId, appletId)
|
||||
{
|
||||
|
@ -100,7 +98,6 @@ static void runKBuildSycoca()
|
|||
QCOMPARE(proc.exitStatus(), QProcess::NormalExit);
|
||||
}
|
||||
|
||||
|
||||
void CoronaTest::initTestCase()
|
||||
{
|
||||
if (!KSycoca::isAvailable()) {
|
||||
|
@ -140,11 +137,8 @@ void CoronaTest::restore()
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
void CoronaTest::checkOrder()
|
||||
{
|
||||
QCOMPARE(m_corona->containments().count(), 3);
|
||||
|
@ -244,4 +238,3 @@ void CoronaTest::immutability()
|
|||
}
|
||||
|
||||
QTEST_MAIN(CoronaTest)
|
||||
|
||||
|
|
|
@ -16,11 +16,9 @@
|
|||
class SimpleLoader : public Plasma::PluginLoader
|
||||
{
|
||||
protected:
|
||||
virtual Plasma::Applet *internalLoadApplet(const QString &name, uint appletId = 0,
|
||||
const QVariantList &args = QVariantList()) override;
|
||||
virtual Plasma::Applet *internalLoadApplet(const QString &name, uint appletId = 0, const QVariantList &args = QVariantList()) override;
|
||||
};
|
||||
|
||||
|
||||
class SimpleCorona : public Plasma::Corona
|
||||
{
|
||||
Q_OBJECT
|
||||
|
@ -39,6 +37,7 @@ class SimpleApplet : public Plasma::Applet
|
|||
|
||||
public:
|
||||
explicit SimpleApplet(QObject *parent = nullptr, const QString &serviceId = QString(), uint appletId = 0);
|
||||
|
||||
private:
|
||||
QTimer m_timer;
|
||||
};
|
||||
|
@ -49,6 +48,7 @@ class SimpleContainment : public Plasma::Containment
|
|||
|
||||
public:
|
||||
explicit SimpleContainment(QObject *parent = nullptr, const QString &serviceId = QString(), uint appletId = 0);
|
||||
|
||||
private:
|
||||
QTimer m_timer;
|
||||
};
|
||||
|
@ -82,4 +82,3 @@ private:
|
|||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -6,14 +6,12 @@
|
|||
#ifndef DIALOGNATIVETEST_H
|
||||
#define DIALOGNATIVETEST_H
|
||||
|
||||
#include <QTest>
|
||||
#include <QQuickView>
|
||||
#include <QQuickItem>
|
||||
#include <QQuickView>
|
||||
#include <QTest>
|
||||
|
||||
#include "plasmaquick/dialog.h"
|
||||
|
||||
|
||||
|
||||
class DialogNativeTest : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
@ -37,4 +35,3 @@ private:
|
|||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -8,12 +8,11 @@
|
|||
|
||||
#include <plasma.h>
|
||||
|
||||
#include <QQmlEngine>
|
||||
#include <QQmlContext>
|
||||
#include <QQmlEngine>
|
||||
|
||||
#include <QSignalSpy>
|
||||
|
||||
|
||||
// this test checks that we don't set visible to true until after we set the window flags
|
||||
void DialogQmlTest::loadAndShow()
|
||||
{
|
||||
|
@ -41,7 +40,6 @@ void DialogQmlTest::loadAndShow()
|
|||
// the bug still appears without this, but we need to delay it in this test
|
||||
// so we can connect to the visibleChanged signal
|
||||
|
||||
|
||||
QQmlComponent component(&engine);
|
||||
|
||||
QSignalSpy spy(&component, SIGNAL(statusChanged(QQmlComponent::Status)));
|
||||
|
@ -70,6 +68,4 @@ void DialogQmlTest::loadAndShow()
|
|||
delete dialog;
|
||||
}
|
||||
|
||||
|
||||
|
||||
QTEST_MAIN(DialogQmlTest)
|
||||
|
|
|
@ -10,18 +10,15 @@
|
|||
|
||||
#include "plasmaquick/dialog.h"
|
||||
|
||||
|
||||
|
||||
class DialogQmlTest : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
private Q_SLOTS:
|
||||
void loadAndShow();
|
||||
|
||||
private:
|
||||
bool m_dialogShown;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
*/
|
||||
|
||||
#include "dialogstatetest.h"
|
||||
#include <QSignalSpy>
|
||||
#include <KWindowSystem>
|
||||
#include <QSignalSpy>
|
||||
|
||||
void DialogStateTest::initTestCase()
|
||||
{
|
||||
|
|
|
@ -28,4 +28,3 @@ private:
|
|||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -12,8 +12,8 @@
|
|||
#include <QTimer>
|
||||
|
||||
DynamicTreeModel::DynamicTreeModel(QObject *parent)
|
||||
: QAbstractItemModel(parent),
|
||||
nextId(1)
|
||||
: QAbstractItemModel(parent)
|
||||
, nextId(1)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -53,7 +53,6 @@ QModelIndex DynamicTreeModel::index(int row, int column, const QModelIndex &pare
|
|||
qint64 id = rowIds.at(row);
|
||||
|
||||
return createIndex(row, column, reinterpret_cast<void *>(id));
|
||||
|
||||
}
|
||||
|
||||
qint64 DynamicTreeModel::findParentId(qint64 searchId) const
|
||||
|
@ -100,7 +99,6 @@ QModelIndex DynamicTreeModel::parent(const QModelIndex &index) const
|
|||
int row = childList.indexOf(parentId);
|
||||
|
||||
return createIndex(row, column, reinterpret_cast<void *>(parentId));
|
||||
|
||||
}
|
||||
|
||||
int DynamicTreeModel::rowCount(const QModelIndex &index) const
|
||||
|
@ -146,9 +144,12 @@ void DynamicTreeModel::clear()
|
|||
}
|
||||
|
||||
ModelChangeCommand::ModelChangeCommand(DynamicTreeModel *model, QObject *parent)
|
||||
: QObject(parent), m_model(model), m_numCols(1), m_startRow(-1), m_endRow(-1)
|
||||
: QObject(parent)
|
||||
, m_model(model)
|
||||
, m_numCols(1)
|
||||
, m_startRow(-1)
|
||||
, m_endRow(-1)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
QModelIndex ModelChangeCommand::findIndex(QList<int> rows)
|
||||
|
@ -166,7 +167,6 @@ QModelIndex ModelChangeCommand::findIndex(QList<int> rows)
|
|||
ModelInsertCommand::ModelInsertCommand(DynamicTreeModel *model, QObject *parent)
|
||||
: ModelChangeCommand(model, parent)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void ModelInsertCommand::doCommand()
|
||||
|
@ -185,7 +185,6 @@ void ModelInsertCommand::doCommand()
|
|||
|
||||
m_model->m_items.insert(id, name);
|
||||
m_model->m_childItems[parentId][col].insert(row, id);
|
||||
|
||||
}
|
||||
}
|
||||
m_model->endInsertRows();
|
||||
|
@ -194,7 +193,6 @@ void ModelInsertCommand::doCommand()
|
|||
ModelMoveCommand::ModelMoveCommand(DynamicTreeModel *model, QObject *parent)
|
||||
: ModelChangeCommand(model, parent)
|
||||
{
|
||||
|
||||
}
|
||||
bool ModelMoveCommand::emitPreSignal(const QModelIndex &srcParent, int srcStart, int srcEnd, const QModelIndex &destParent, int destRow)
|
||||
{
|
||||
|
@ -243,12 +241,10 @@ void ModelMoveCommand::emitPostSignal()
|
|||
ModelResetCommand::ModelResetCommand(DynamicTreeModel *model, QObject *parent)
|
||||
: ModelMoveCommand(model, parent)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
ModelResetCommand::~ModelResetCommand()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
bool ModelResetCommand::emitPreSignal(const QModelIndex &srcParent, int srcStart, int srcEnd, const QModelIndex &destParent, int destRow)
|
||||
|
@ -270,12 +266,10 @@ void ModelResetCommand::emitPostSignal()
|
|||
ModelResetCommandFixed::ModelResetCommandFixed(DynamicTreeModel *model, QObject *parent)
|
||||
: ModelMoveCommand(model, parent)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
ModelResetCommandFixed::~ModelResetCommandFixed()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
bool ModelResetCommandFixed::emitPreSignal(const QModelIndex &srcParent, int srcStart, int srcEnd, const QModelIndex &destParent, int destRow)
|
||||
|
@ -294,4 +288,3 @@ void ModelResetCommandFixed::emitPostSignal()
|
|||
{
|
||||
m_model->endResetModel();
|
||||
}
|
||||
|
||||
|
|
|
@ -59,17 +59,17 @@ private:
|
|||
friend class ModelMoveCommand;
|
||||
friend class ModelResetCommand;
|
||||
friend class ModelResetCommandFixed;
|
||||
|
||||
};
|
||||
|
||||
class ModelChangeCommand : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
||||
explicit ModelChangeCommand(DynamicTreeModel *model, QObject *parent = nullptr);
|
||||
|
||||
virtual ~ModelChangeCommand() {}
|
||||
virtual ~ModelChangeCommand()
|
||||
{
|
||||
}
|
||||
|
||||
void setAncestorRowNumbers(QList<int> rowNumbers)
|
||||
{
|
||||
|
@ -101,7 +101,6 @@ protected:
|
|||
int m_numCols;
|
||||
int m_startRow;
|
||||
int m_endRow;
|
||||
|
||||
};
|
||||
|
||||
typedef QList<ModelChangeCommand *> ModelChangeCommandList;
|
||||
|
@ -111,9 +110,10 @@ class ModelInsertCommand : public ModelChangeCommand
|
|||
Q_OBJECT
|
||||
|
||||
public:
|
||||
|
||||
explicit ModelInsertCommand(DynamicTreeModel *model, QObject *parent = nullptr);
|
||||
virtual ~ModelInsertCommand() {}
|
||||
virtual ~ModelInsertCommand()
|
||||
{
|
||||
}
|
||||
|
||||
virtual void doCommand();
|
||||
};
|
||||
|
@ -124,7 +124,9 @@ class ModelMoveCommand : public ModelChangeCommand
|
|||
public:
|
||||
ModelMoveCommand(DynamicTreeModel *model, QObject *parent);
|
||||
|
||||
virtual ~ModelMoveCommand() {}
|
||||
virtual ~ModelMoveCommand()
|
||||
{
|
||||
}
|
||||
|
||||
virtual bool emitPreSignal(const QModelIndex &srcParent, int srcStart, int srcEnd, const QModelIndex &destParent, int destRow);
|
||||
|
||||
|
@ -160,7 +162,6 @@ public:
|
|||
|
||||
virtual bool emitPreSignal(const QModelIndex &srcParent, int srcStart, int srcEnd, const QModelIndex &destParent, int destRow);
|
||||
virtual void emitPostSignal();
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -176,7 +177,6 @@ public:
|
|||
|
||||
virtual bool emitPreSignal(const QModelIndex &srcParent, int srcStart, int srcEnd, const QModelIndex &destParent, int destRow);
|
||||
virtual void emitPostSignal();
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -7,8 +7,6 @@
|
|||
#include "framesvgtest.h"
|
||||
#include <QStandardPaths>
|
||||
|
||||
|
||||
|
||||
void FrameSvgTest::initTestCase()
|
||||
{
|
||||
QStandardPaths::setTestModeEnabled(true);
|
||||
|
|
|
@ -8,11 +8,8 @@
|
|||
|
||||
#include <QTest>
|
||||
|
||||
|
||||
#include "plasma/framesvg.h"
|
||||
|
||||
|
||||
|
||||
class FrameSvgTest : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
@ -33,4 +30,3 @@ private:
|
|||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -7,18 +7,18 @@
|
|||
#include "iconitemtest.h"
|
||||
|
||||
#include <QIcon>
|
||||
#include <QQmlEngine>
|
||||
#include <QQmlContext>
|
||||
#include <QQmlComponent>
|
||||
#include <QQmlContext>
|
||||
#include <QQmlEngine>
|
||||
#include <QQuickItemGrabResult>
|
||||
#include <QSignalSpy>
|
||||
|
||||
#include <KIconLoader>
|
||||
#include <KIconEngine>
|
||||
#include <KIconLoader>
|
||||
#include <KIconTheme>
|
||||
|
||||
#include "plasma/theme.h"
|
||||
#include "plasma/svg.h"
|
||||
#include "plasma/theme.h"
|
||||
|
||||
#include "utils.h"
|
||||
|
||||
|
@ -533,4 +533,3 @@ void IconItemTest::roundToIconSize()
|
|||
}
|
||||
|
||||
QTEST_MAIN(IconItemTest)
|
||||
|
||||
|
|
|
@ -54,4 +54,3 @@ private:
|
|||
|
||||
QQuickView *m_view;
|
||||
};
|
||||
|
||||
|
|
|
@ -7,11 +7,11 @@
|
|||
#include "plasmoidpackagetest.h"
|
||||
#include "../config-plasma.h"
|
||||
|
||||
#include <KJob>
|
||||
#include <QDir>
|
||||
#include <QFile>
|
||||
#include <kzip.h>
|
||||
#include <KJob>
|
||||
#include <QStandardPaths>
|
||||
#include <kzip.h>
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
|
|
|
@ -40,4 +40,3 @@ private:
|
|||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -6,15 +6,15 @@
|
|||
|
||||
#include "pluginloadertest.h"
|
||||
|
||||
#include <qtest.h>
|
||||
#include <QDebug>
|
||||
#include <QSignalSpy>
|
||||
#include <qtest.h>
|
||||
|
||||
#include <KPluginInfo>
|
||||
#include <KPluginMetaData>
|
||||
|
||||
#include <plasma/pluginloader.h>
|
||||
#include <plasma/dataengineconsumer.h>
|
||||
#include <plasma/pluginloader.h>
|
||||
|
||||
QTEST_MAIN(PluginTest)
|
||||
|
||||
|
@ -55,12 +55,12 @@ void PluginTest::listContainmentsOfType()
|
|||
const KPluginInfo::List plugins = Plasma::PluginLoader::listContainmentsOfType(QStringLiteral("Desktop"));
|
||||
qDebug() << "Desktop Containments: " << plugins.count();
|
||||
QVERIFY(plugins.count() > 0 || m_buildonly);
|
||||
|
||||
}
|
||||
|
||||
static const auto source = QStringLiteral("Europe/Sofia");
|
||||
|
||||
void EngineTest::dataUpdated(const QString &s, const Plasma::DataEngine::Data &data) {
|
||||
void EngineTest::dataUpdated(const QString &s, const Plasma::DataEngine::Data &data)
|
||||
{
|
||||
QVERIFY(source == s);
|
||||
QVERIFY(data["Timezone"] == source);
|
||||
}
|
||||
|
@ -92,4 +92,3 @@ void PluginTest::loadDataEngine()
|
|||
}
|
||||
|
||||
#include "moc_pluginloadertest.cpp"
|
||||
|
||||
|
|
|
@ -32,7 +32,9 @@ class EngineTest : public QObject
|
|||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
EngineTest() {}
|
||||
EngineTest()
|
||||
{
|
||||
}
|
||||
|
||||
public Q_SLOTS:
|
||||
void dataUpdated(const QString &name, const Plasma::DataEngine::Data &data);
|
||||
|
|
|
@ -10,9 +10,9 @@
|
|||
// KDE
|
||||
|
||||
// Qt
|
||||
#include <QSignalSpy>
|
||||
#include <QStandardItemModel>
|
||||
#include <QStringListModel>
|
||||
#include <QSignalSpy>
|
||||
#include <QTest>
|
||||
|
||||
using namespace Plasma;
|
||||
|
@ -102,4 +102,3 @@ void SortFilterModelTest::mapRowFromSource()
|
|||
QCOMPARE(filterModel.mapRowFromSource(2), 1);
|
||||
QCOMPARE(filterModel.mapRowFromSource(-1), -1);
|
||||
}
|
||||
|
||||
|
|
|
@ -6,9 +6,9 @@
|
|||
|
||||
#include "themetest.h"
|
||||
#include "../src/plasma/private/svg_p.h"
|
||||
#include <QStandardPaths>
|
||||
#include <QApplication>
|
||||
#include <QSignalSpy>
|
||||
#include <QStandardPaths>
|
||||
|
||||
#include <KIconLoader>
|
||||
#include <KIconTheme>
|
||||
|
@ -23,8 +23,7 @@
|
|||
QString cacheIdHash(const Plasma::SvgPrivate::CacheId &id)
|
||||
{
|
||||
static const uint seed = 0x9e3779b9;
|
||||
std::array<uint, 10> parts = {
|
||||
::qHash(id.width),
|
||||
std::array<uint, 10> parts = {::qHash(id.width),
|
||||
::qHash(id.height),
|
||||
::qHash(id.elementName),
|
||||
::qHash(id.filePath),
|
||||
|
@ -33,16 +32,14 @@ QString cacheIdHash(const Plasma::SvgPrivate::CacheId &id)
|
|||
::qHash(id.scaleFactor),
|
||||
::qHash(id.colorGroup),
|
||||
::qHash(id.extraFlags),
|
||||
::qHash(id.lastModified)
|
||||
};
|
||||
::qHash(id.lastModified)};
|
||||
return QString::number(qHashRange(parts.begin(), parts.end(), seed));
|
||||
}
|
||||
|
||||
void ThemeTest::initTestCase()
|
||||
{
|
||||
// make our theme in search path
|
||||
qputenv("XDG_DATA_DIRS",
|
||||
qgetenv("XDG_DATA_DIRS") + ":" + QFINDTESTDATA("data").toLocal8Bit());
|
||||
qputenv("XDG_DATA_DIRS", qgetenv("XDG_DATA_DIRS") + ":" + QFINDTESTDATA("data").toLocal8Bit());
|
||||
|
||||
// set default icon theme to test-theme
|
||||
QStandardPaths::setTestModeEnabled(true);
|
||||
|
@ -92,7 +89,16 @@ void ThemeTest::loadSvgIcon()
|
|||
|
||||
QFileInfo info(iconPath);
|
||||
|
||||
QString cacheId = cacheIdHash(Plasma::SvgPrivate::CacheId{48, 48, iconPath, QString(), m_svg->status(), m_svg->devicePixelRatio(), m_svg->scaleFactor(), m_svg->colorGroup(), 0, static_cast<uint>(info.lastModified().toSecsSinceEpoch())});
|
||||
QString cacheId = cacheIdHash(Plasma::SvgPrivate::CacheId{48,
|
||||
48,
|
||||
iconPath,
|
||||
QString(),
|
||||
m_svg->status(),
|
||||
m_svg->devicePixelRatio(),
|
||||
m_svg->scaleFactor(),
|
||||
m_svg->colorGroup(),
|
||||
0,
|
||||
static_cast<uint>(info.lastModified().toSecsSinceEpoch())});
|
||||
|
||||
QPixmap result;
|
||||
QVERIFY(m_svg->theme()->findInCache(cacheId, result, info.lastModified().toSecsSinceEpoch()));
|
||||
|
@ -115,97 +121,53 @@ void ThemeTest::loadSvgIcon()
|
|||
|
||||
void ThemeTest::testColors()
|
||||
{
|
||||
QCOMPARE(m_theme->color(Plasma::Theme::TextColor,
|
||||
Plasma::Theme::NormalColorGroup), QColor(49,54,59));
|
||||
QCOMPARE(m_theme->color(Plasma::Theme::BackgroundColor,
|
||||
Plasma::Theme::NormalColorGroup), QColor(239,240,241));
|
||||
QCOMPARE(m_theme->color(Plasma::Theme::HighlightColor,
|
||||
Plasma::Theme::NormalColorGroup), QColor(61,174,230));
|
||||
QCOMPARE(m_theme->color(Plasma::Theme::HoverColor,
|
||||
Plasma::Theme::NormalColorGroup), QColor(61,174,230));
|
||||
QCOMPARE(m_theme->color(Plasma::Theme::FocusColor,
|
||||
Plasma::Theme::NormalColorGroup), QColor(30,146,255));
|
||||
QCOMPARE(m_theme->color(Plasma::Theme::LinkColor,
|
||||
Plasma::Theme::NormalColorGroup), QColor(61,174,230));
|
||||
QCOMPARE(m_theme->color(Plasma::Theme::VisitedLinkColor,
|
||||
Plasma::Theme::NormalColorGroup), QColor(61,174,230));
|
||||
QCOMPARE(m_theme->color(Plasma::Theme::HighlightedTextColor,
|
||||
Plasma::Theme::NormalColorGroup), QColor(252,252,252));
|
||||
QCOMPARE(m_theme->color(Plasma::Theme::PositiveTextColor,
|
||||
Plasma::Theme::NormalColorGroup), QColor(17,209,22));
|
||||
QCOMPARE(m_theme->color(Plasma::Theme::NeutralTextColor,
|
||||
Plasma::Theme::NormalColorGroup), QColor(201,206,59));
|
||||
QCOMPARE(m_theme->color(Plasma::Theme::NegativeTextColor,
|
||||
Plasma::Theme::NormalColorGroup), QColor(237,21,21));
|
||||
QCOMPARE(m_theme->color(Plasma::Theme::TextColor, Plasma::Theme::NormalColorGroup), QColor(49, 54, 59));
|
||||
QCOMPARE(m_theme->color(Plasma::Theme::BackgroundColor, Plasma::Theme::NormalColorGroup), QColor(239, 240, 241));
|
||||
QCOMPARE(m_theme->color(Plasma::Theme::HighlightColor, Plasma::Theme::NormalColorGroup), QColor(61, 174, 230));
|
||||
QCOMPARE(m_theme->color(Plasma::Theme::HoverColor, Plasma::Theme::NormalColorGroup), QColor(61, 174, 230));
|
||||
QCOMPARE(m_theme->color(Plasma::Theme::FocusColor, Plasma::Theme::NormalColorGroup), QColor(30, 146, 255));
|
||||
QCOMPARE(m_theme->color(Plasma::Theme::LinkColor, Plasma::Theme::NormalColorGroup), QColor(61, 174, 230));
|
||||
QCOMPARE(m_theme->color(Plasma::Theme::VisitedLinkColor, Plasma::Theme::NormalColorGroup), QColor(61, 174, 230));
|
||||
QCOMPARE(m_theme->color(Plasma::Theme::HighlightedTextColor, Plasma::Theme::NormalColorGroup), QColor(252, 252, 252));
|
||||
QCOMPARE(m_theme->color(Plasma::Theme::PositiveTextColor, Plasma::Theme::NormalColorGroup), QColor(17, 209, 22));
|
||||
QCOMPARE(m_theme->color(Plasma::Theme::NeutralTextColor, Plasma::Theme::NormalColorGroup), QColor(201, 206, 59));
|
||||
QCOMPARE(m_theme->color(Plasma::Theme::NegativeTextColor, Plasma::Theme::NormalColorGroup), QColor(237, 21, 21));
|
||||
|
||||
QCOMPARE(m_theme->color(Plasma::Theme::TextColor,
|
||||
Plasma::Theme::ButtonColorGroup), QColor(49,54,59));
|
||||
QCOMPARE(m_theme->color(Plasma::Theme::BackgroundColor,
|
||||
Plasma::Theme::ButtonColorGroup), QColor(239,240,241));
|
||||
QCOMPARE(m_theme->color(Plasma::Theme::HighlightColor,
|
||||
Plasma::Theme::ButtonColorGroup), QColor(61,174,230));
|
||||
QCOMPARE(m_theme->color(Plasma::Theme::HoverColor,
|
||||
Plasma::Theme::ButtonColorGroup), QColor(61,174,230));
|
||||
QCOMPARE(m_theme->color(Plasma::Theme::FocusColor,
|
||||
Plasma::Theme::ButtonColorGroup), QColor(30,146,255));
|
||||
QCOMPARE(m_theme->color(Plasma::Theme::LinkColor,
|
||||
Plasma::Theme::ButtonColorGroup), QColor(61,174,230));
|
||||
QCOMPARE(m_theme->color(Plasma::Theme::VisitedLinkColor,
|
||||
Plasma::Theme::ButtonColorGroup), QColor(61,174,230));
|
||||
QCOMPARE(m_theme->color(Plasma::Theme::HighlightedTextColor,
|
||||
Plasma::Theme::ButtonColorGroup), QColor(252,252,252));
|
||||
QCOMPARE(m_theme->color(Plasma::Theme::PositiveTextColor,
|
||||
Plasma::Theme::ButtonColorGroup), QColor(17,209,23));
|
||||
QCOMPARE(m_theme->color(Plasma::Theme::NeutralTextColor,
|
||||
Plasma::Theme::ButtonColorGroup), QColor(201,206,60));
|
||||
QCOMPARE(m_theme->color(Plasma::Theme::NegativeTextColor,
|
||||
Plasma::Theme::ButtonColorGroup), QColor(237,21,22));
|
||||
QCOMPARE(m_theme->color(Plasma::Theme::TextColor, Plasma::Theme::ButtonColorGroup), QColor(49, 54, 59));
|
||||
QCOMPARE(m_theme->color(Plasma::Theme::BackgroundColor, Plasma::Theme::ButtonColorGroup), QColor(239, 240, 241));
|
||||
QCOMPARE(m_theme->color(Plasma::Theme::HighlightColor, Plasma::Theme::ButtonColorGroup), QColor(61, 174, 230));
|
||||
QCOMPARE(m_theme->color(Plasma::Theme::HoverColor, Plasma::Theme::ButtonColorGroup), QColor(61, 174, 230));
|
||||
QCOMPARE(m_theme->color(Plasma::Theme::FocusColor, Plasma::Theme::ButtonColorGroup), QColor(30, 146, 255));
|
||||
QCOMPARE(m_theme->color(Plasma::Theme::LinkColor, Plasma::Theme::ButtonColorGroup), QColor(61, 174, 230));
|
||||
QCOMPARE(m_theme->color(Plasma::Theme::VisitedLinkColor, Plasma::Theme::ButtonColorGroup), QColor(61, 174, 230));
|
||||
QCOMPARE(m_theme->color(Plasma::Theme::HighlightedTextColor, Plasma::Theme::ButtonColorGroup), QColor(252, 252, 252));
|
||||
QCOMPARE(m_theme->color(Plasma::Theme::PositiveTextColor, Plasma::Theme::ButtonColorGroup), QColor(17, 209, 23));
|
||||
QCOMPARE(m_theme->color(Plasma::Theme::NeutralTextColor, Plasma::Theme::ButtonColorGroup), QColor(201, 206, 60));
|
||||
QCOMPARE(m_theme->color(Plasma::Theme::NegativeTextColor, Plasma::Theme::ButtonColorGroup), QColor(237, 21, 22));
|
||||
|
||||
QCOMPARE(m_theme->color(Plasma::Theme::TextColor,
|
||||
Plasma::Theme::ViewColorGroup), QColor(49,54,59));
|
||||
QCOMPARE(m_theme->color(Plasma::Theme::BackgroundColor,
|
||||
Plasma::Theme::ViewColorGroup), QColor(252,252,252));
|
||||
QCOMPARE(m_theme->color(Plasma::Theme::HighlightColor,
|
||||
Plasma::Theme::ViewColorGroup), QColor(61,174,230));
|
||||
QCOMPARE(m_theme->color(Plasma::Theme::HoverColor,
|
||||
Plasma::Theme::ViewColorGroup), QColor(61,174,230));
|
||||
QCOMPARE(m_theme->color(Plasma::Theme::FocusColor,
|
||||
Plasma::Theme::ViewColorGroup), QColor(30,146,255));
|
||||
QCOMPARE(m_theme->color(Plasma::Theme::LinkColor,
|
||||
Plasma::Theme::ViewColorGroup), QColor(61,174,230));
|
||||
QCOMPARE(m_theme->color(Plasma::Theme::VisitedLinkColor,
|
||||
Plasma::Theme::ViewColorGroup), QColor(61,174,230));
|
||||
QCOMPARE(m_theme->color(Plasma::Theme::HighlightedTextColor,
|
||||
Plasma::Theme::ViewColorGroup), QColor(252,252,252));
|
||||
QCOMPARE(m_theme->color(Plasma::Theme::PositiveTextColor,
|
||||
Plasma::Theme::ViewColorGroup), QColor(17,209,24));
|
||||
QCOMPARE(m_theme->color(Plasma::Theme::NeutralTextColor,
|
||||
Plasma::Theme::ViewColorGroup), QColor(201,206,61));
|
||||
QCOMPARE(m_theme->color(Plasma::Theme::NegativeTextColor,
|
||||
Plasma::Theme::ViewColorGroup), QColor(237,21,23));
|
||||
QCOMPARE(m_theme->color(Plasma::Theme::TextColor, Plasma::Theme::ViewColorGroup), QColor(49, 54, 59));
|
||||
QCOMPARE(m_theme->color(Plasma::Theme::BackgroundColor, Plasma::Theme::ViewColorGroup), QColor(252, 252, 252));
|
||||
QCOMPARE(m_theme->color(Plasma::Theme::HighlightColor, Plasma::Theme::ViewColorGroup), QColor(61, 174, 230));
|
||||
QCOMPARE(m_theme->color(Plasma::Theme::HoverColor, Plasma::Theme::ViewColorGroup), QColor(61, 174, 230));
|
||||
QCOMPARE(m_theme->color(Plasma::Theme::FocusColor, Plasma::Theme::ViewColorGroup), QColor(30, 146, 255));
|
||||
QCOMPARE(m_theme->color(Plasma::Theme::LinkColor, Plasma::Theme::ViewColorGroup), QColor(61, 174, 230));
|
||||
QCOMPARE(m_theme->color(Plasma::Theme::VisitedLinkColor, Plasma::Theme::ViewColorGroup), QColor(61, 174, 230));
|
||||
QCOMPARE(m_theme->color(Plasma::Theme::HighlightedTextColor, Plasma::Theme::ViewColorGroup), QColor(252, 252, 252));
|
||||
QCOMPARE(m_theme->color(Plasma::Theme::PositiveTextColor, Plasma::Theme::ViewColorGroup), QColor(17, 209, 24));
|
||||
QCOMPARE(m_theme->color(Plasma::Theme::NeutralTextColor, Plasma::Theme::ViewColorGroup), QColor(201, 206, 61));
|
||||
QCOMPARE(m_theme->color(Plasma::Theme::NegativeTextColor, Plasma::Theme::ViewColorGroup), QColor(237, 21, 23));
|
||||
|
||||
QCOMPARE(m_theme->color(Plasma::Theme::TextColor,
|
||||
Plasma::Theme::ComplementaryColorGroup), QColor(239,240,241));
|
||||
QCOMPARE(m_theme->color(Plasma::Theme::BackgroundColor,
|
||||
Plasma::Theme::ComplementaryColorGroup), QColor(49,54,59));
|
||||
QCOMPARE(m_theme->color(Plasma::Theme::HighlightColor,
|
||||
Plasma::Theme::ComplementaryColorGroup), QColor(61,174,230));
|
||||
QCOMPARE(m_theme->color(Plasma::Theme::HoverColor,
|
||||
Plasma::Theme::ComplementaryColorGroup), QColor(71,174,230));
|
||||
QCOMPARE(m_theme->color(Plasma::Theme::FocusColor,
|
||||
Plasma::Theme::ComplementaryColorGroup), QColor(40,146,255));
|
||||
QCOMPARE(m_theme->color(Plasma::Theme::LinkColor,
|
||||
Plasma::Theme::ComplementaryColorGroup), QColor(71,174,230));
|
||||
QCOMPARE(m_theme->color(Plasma::Theme::VisitedLinkColor,
|
||||
Plasma::Theme::ComplementaryColorGroup), QColor(71,174,230));
|
||||
QCOMPARE(m_theme->color(Plasma::Theme::HighlightedTextColor,
|
||||
Plasma::Theme::ComplementaryColorGroup), QColor(252,252,252));
|
||||
QCOMPARE(m_theme->color(Plasma::Theme::PositiveTextColor,
|
||||
Plasma::Theme::ComplementaryColorGroup), QColor(17,209,25));
|
||||
QCOMPARE(m_theme->color(Plasma::Theme::NeutralTextColor,
|
||||
Plasma::Theme::ComplementaryColorGroup), QColor(201,206,62));
|
||||
QCOMPARE(m_theme->color(Plasma::Theme::NegativeTextColor,
|
||||
Plasma::Theme::ComplementaryColorGroup), QColor(237,21,24));
|
||||
QCOMPARE(m_theme->color(Plasma::Theme::TextColor, Plasma::Theme::ComplementaryColorGroup), QColor(239, 240, 241));
|
||||
QCOMPARE(m_theme->color(Plasma::Theme::BackgroundColor, Plasma::Theme::ComplementaryColorGroup), QColor(49, 54, 59));
|
||||
QCOMPARE(m_theme->color(Plasma::Theme::HighlightColor, Plasma::Theme::ComplementaryColorGroup), QColor(61, 174, 230));
|
||||
QCOMPARE(m_theme->color(Plasma::Theme::HoverColor, Plasma::Theme::ComplementaryColorGroup), QColor(71, 174, 230));
|
||||
QCOMPARE(m_theme->color(Plasma::Theme::FocusColor, Plasma::Theme::ComplementaryColorGroup), QColor(40, 146, 255));
|
||||
QCOMPARE(m_theme->color(Plasma::Theme::LinkColor, Plasma::Theme::ComplementaryColorGroup), QColor(71, 174, 230));
|
||||
QCOMPARE(m_theme->color(Plasma::Theme::VisitedLinkColor, Plasma::Theme::ComplementaryColorGroup), QColor(71, 174, 230));
|
||||
QCOMPARE(m_theme->color(Plasma::Theme::HighlightedTextColor, Plasma::Theme::ComplementaryColorGroup), QColor(252, 252, 252));
|
||||
QCOMPARE(m_theme->color(Plasma::Theme::PositiveTextColor, Plasma::Theme::ComplementaryColorGroup), QColor(17, 209, 25));
|
||||
QCOMPARE(m_theme->color(Plasma::Theme::NeutralTextColor, Plasma::Theme::ComplementaryColorGroup), QColor(201, 206, 62));
|
||||
QCOMPARE(m_theme->color(Plasma::Theme::NegativeTextColor, Plasma::Theme::ComplementaryColorGroup), QColor(237, 21, 24));
|
||||
}
|
||||
|
||||
void ThemeTest::testCompositingChange()
|
||||
|
@ -250,4 +212,3 @@ void ThemeTest::testCompositingChange()
|
|||
}
|
||||
|
||||
QTEST_MAIN(ThemeTest)
|
||||
|
||||
|
|
|
@ -8,8 +8,8 @@
|
|||
|
||||
#include <QTest>
|
||||
|
||||
#include "plasma/theme.h"
|
||||
#include "plasma/svg.h"
|
||||
#include "plasma/theme.h"
|
||||
|
||||
class ThemeTest : public QObject
|
||||
{
|
||||
|
@ -30,4 +30,3 @@ private:
|
|||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -6,14 +6,15 @@
|
|||
#ifndef UTILS_H
|
||||
#define UTILS_H
|
||||
|
||||
#include <QString>
|
||||
#include <QDir>
|
||||
#include <QStandardPaths>
|
||||
#include <QString>
|
||||
#include <QTest>
|
||||
|
||||
namespace Plasma {
|
||||
namespace TestUtils {
|
||||
|
||||
namespace Plasma
|
||||
{
|
||||
namespace TestUtils
|
||||
{
|
||||
static void copyPath(const QString &src, const QString &dst)
|
||||
{
|
||||
QDir dir(src);
|
||||
|
@ -51,7 +52,6 @@ static void installPlasmaTheme(const QString &theme = QStringLiteral("breeze"))
|
|||
if (!colorsFile.isEmpty()) {
|
||||
QFile::copy(colorsFile, themePath.filePath("colors"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} // TestUtils
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <QUrl>
|
||||
#include <QDebug>
|
||||
#include <QUrl>
|
||||
|
||||
#include "customDataContainersEngine.h"
|
||||
|
||||
|
@ -68,4 +68,3 @@ K_EXPORT_PLASMA_DATAENGINE_WITH_JSON(org.kde.examples.customDataContainers, Data
|
|||
|
||||
// include the moc file so the build system makes it for us
|
||||
#include "customDataContainersEngine.moc"
|
||||
|
||||
|
|
|
@ -9,8 +9,8 @@
|
|||
#include <kio/job.h>
|
||||
|
||||
HttpContainer::HttpContainer(const QUrl &url, QObject *parent)
|
||||
: Plasma::DataContainer(parent),
|
||||
m_url(url)
|
||||
: Plasma::DataContainer(parent)
|
||||
, m_url(url)
|
||||
{
|
||||
// Since we are grabbing data over the network, we request a
|
||||
// backing store. This way, if the network is down or on first start
|
||||
|
@ -29,8 +29,7 @@ void HttpContainer::fetchUrl(bool reload)
|
|||
m_data.clear();
|
||||
|
||||
KIO::TransferJob *job = KIO::get(m_url, reload ? KIO::Reload : KIO::NoReload, KIO::HideProgressInfo);
|
||||
connect(job, SIGNAL(data(KIO::Job*,QByteArray)),
|
||||
this, SLOT(data(KIO::Job*,QByteArray)));
|
||||
connect(job, SIGNAL(data(KIO::Job *, QByteArray)), this, SLOT(data(KIO::Job *, QByteArray)));
|
||||
connect(job, SIGNAL(finished(KJob *)), this, SLOT(fetchFinished(KJob *)));
|
||||
|
||||
if (m_job) {
|
||||
|
@ -76,5 +75,3 @@ void HttpContainer::fetchFinished(KJob *job)
|
|||
m_data.clear();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -6,12 +6,12 @@
|
|||
|
||||
#include "dataenginetracker.h"
|
||||
|
||||
#include <QTime>
|
||||
#include <QDebug>
|
||||
#include <QTime>
|
||||
|
||||
DataEngineTracker::DataEngineTracker(Plasma::DataEngine *engine, QObject *parent)
|
||||
: QObject(parent),
|
||||
m_engine(engine)
|
||||
: QObject(parent)
|
||||
, m_engine(engine)
|
||||
{
|
||||
connect(engine, SIGNAL(sourceAdded(QString)), this, SLOT(sourceAdded(QString)));
|
||||
connect(engine, SIGNAL(sourceRemoved(QString)), this, SLOT(sourceRemoved(QString)));
|
||||
|
@ -40,4 +40,3 @@ void DataEngineTracker::sourceRemoved(const QString &source)
|
|||
}
|
||||
|
||||
#include <dataenginetracker.moc>
|
||||
|
||||
|
|
|
@ -28,4 +28,3 @@ private:
|
|||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -28,7 +28,6 @@ SimpleEngine::SimpleEngine(QObject *parent, const QVariantList &args)
|
|||
|
||||
void SimpleEngine::init()
|
||||
{
|
||||
|
||||
// So now we will set up some sources.
|
||||
// Each DataEngine will, generally, be loaded once. Each DataEngine
|
||||
// can provide multiple sets of data keyed by a string, called "Sources".
|
||||
|
@ -59,4 +58,3 @@ K_EXPORT_PLASMA_DATAENGINE_WITH_JSON(org.kde.examples.simpleEngine, SimpleEngine
|
|||
|
||||
// include the moc file so the build system makes it for us
|
||||
#include "simpleEngine.moc"
|
||||
|
||||
|
|
|
@ -94,4 +94,3 @@ K_EXPORT_PLASMA_DATAENGINE_WITH_JSON(org.kde.examples.sourcesOnRequest, SourcesO
|
|||
|
||||
// include the moc file so the build system makes it for us
|
||||
#include "sourcesOnRequest.moc"
|
||||
|
||||
|
|
|
@ -5,9 +5,9 @@
|
|||
*/
|
||||
|
||||
#include "customcorona.h"
|
||||
#include <QDebug>
|
||||
#include <QAction>
|
||||
#include <KActionCollection>
|
||||
#include <QAction>
|
||||
#include <QDebug>
|
||||
|
||||
#include <KPackage/Package>
|
||||
#include <KPackage/PackageLoader>
|
||||
|
@ -21,7 +21,11 @@ CustomCorona::CustomCorona(QObject *parent)
|
|||
package.setPath(QStringLiteral("org.kde.plasma.desktop"));
|
||||
setKPackage(package);
|
||||
|
||||
qmlRegisterUncreatableType<PlasmaQuick::ContainmentView>("org.kde.plasma.shell", 2, 0, "Desktop", QStringLiteral("It is not possible to create objects of type Desktop"));
|
||||
qmlRegisterUncreatableType<PlasmaQuick::ContainmentView>("org.kde.plasma.shell",
|
||||
2,
|
||||
0,
|
||||
"Desktop",
|
||||
QStringLiteral("It is not possible to create objects of type Desktop"));
|
||||
|
||||
m_view = new PlasmaQuick::ContainmentView(this);
|
||||
m_view->setSource(package.fileUrl("views", QStringLiteral("Desktop.qml")));
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
*/
|
||||
|
||||
#include <QApplication>
|
||||
#include <QCommandLineParser>
|
||||
#include <QCommandLineOption>
|
||||
#include <QCommandLineParser>
|
||||
|
||||
#include <KDBusService>
|
||||
#include <KLocalizedString>
|
||||
|
|
|
@ -6,9 +6,8 @@
|
|||
|
||||
#include "test.h"
|
||||
|
||||
|
||||
#include <QDebug>
|
||||
#include <KActionCollection>
|
||||
#include <QDebug>
|
||||
|
||||
#include <Plasma/Containment>
|
||||
|
||||
|
|
|
@ -8,8 +8,8 @@
|
|||
#define CONTEXTTEST_HEADER
|
||||
|
||||
#include "ui_config.h"
|
||||
#include <plasma/containmentactions.h>
|
||||
#include <QString>
|
||||
#include <plasma/containmentactions.h>
|
||||
|
||||
class ContextTest : public Plasma::ContainmentActions
|
||||
{
|
||||
|
|
|
@ -259,7 +259,6 @@ void Calendar::updateData()
|
|||
day.monthNumber = m_displayedDate.month();
|
||||
day.yearNumber = m_displayedDate.year();
|
||||
m_dayList << day;
|
||||
|
||||
}
|
||||
|
||||
if (daysAfterCurrentMonth > 0) {
|
||||
|
|
|
@ -8,10 +8,10 @@
|
|||
#ifndef CALENDAR_H
|
||||
#define CALENDAR_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QDate>
|
||||
#include <QAbstractListModel>
|
||||
#include <QDate>
|
||||
#include <QJsonArray>
|
||||
#include <QObject>
|
||||
|
||||
#include "daydata.h"
|
||||
#include "daysmodel.h"
|
||||
|
@ -112,7 +112,6 @@ class Calendar : public QObject
|
|||
*/
|
||||
Q_PROPERTY(QAbstractListModel *daysModel READ daysModel CONSTANT)
|
||||
|
||||
|
||||
public:
|
||||
enum Type {
|
||||
Holiday = 1,
|
||||
|
|
|
@ -74,4 +74,3 @@ bool CalendarData::loading() const
|
|||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -7,9 +7,9 @@
|
|||
#ifndef CALENDARDATA_H
|
||||
#define CALENDARDATA_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QFlags>
|
||||
#include <QDate>
|
||||
#include <QFlags>
|
||||
#include <QObject>
|
||||
|
||||
class QAbstractItemModel;
|
||||
|
||||
|
|
|
@ -5,14 +5,14 @@
|
|||
*/
|
||||
|
||||
#include "calendarplugin.h"
|
||||
#include "calendardata.h"
|
||||
#include "calendar.h"
|
||||
#include "calendardata.h"
|
||||
#include "eventdatadecorator.h"
|
||||
#include "eventpluginsmanager.h"
|
||||
|
||||
#include <QtQml>
|
||||
#include <QQmlEngine>
|
||||
#include <QAbstractListModel>
|
||||
#include <QQmlEngine>
|
||||
#include <QtQml>
|
||||
|
||||
static QObject *event_plugins_manager_provider(QQmlEngine *engine, QJSEngine *scriptEngine)
|
||||
{
|
||||
|
@ -30,6 +30,5 @@ void CalendarPlugin::registerTypes(const char *uri)
|
|||
qmlRegisterAnonymousType<QAbstractItemModel>(uri, 1);
|
||||
qmlRegisterAnonymousType<QAbstractListModel>(uri, 1);
|
||||
qmlRegisterSingletonType<EventPluginsManager>(uri, 2, 0, "EventPluginsManager", event_plugins_manager_provider);
|
||||
qmlRegisterUncreatableType<EventDataDecorator>(uri, 2, 0, "EventDataDecorator",
|
||||
QStringLiteral("Unabel to create EventDataDecorator from QML"));
|
||||
qmlRegisterUncreatableType<EventDataDecorator>(uri, 2, 0, "EventDataDecorator", QStringLiteral("Unabel to create EventDataDecorator from QML"));
|
||||
}
|
||||
|
|
|
@ -9,18 +9,17 @@
|
|||
#include "eventdatadecorator.h"
|
||||
#include "eventpluginsmanager.h"
|
||||
|
||||
#include <QDebug>
|
||||
#include <QByteArray>
|
||||
#include <QDebug>
|
||||
#include <QDir>
|
||||
#include <QMetaObject>
|
||||
|
||||
DaysModel::DaysModel(QObject *parent) :
|
||||
QAbstractListModel(parent),
|
||||
m_pluginsManager(nullptr),
|
||||
m_lastRequestedEventsStartDate(QDate()),
|
||||
m_agendaNeedsUpdate(false)
|
||||
DaysModel::DaysModel(QObject *parent)
|
||||
: QAbstractListModel(parent)
|
||||
, m_pluginsManager(nullptr)
|
||||
, m_lastRequestedEventsStartDate(QDate())
|
||||
, m_agendaNeedsUpdate(false)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
DaysModel::~DaysModel()
|
||||
|
@ -50,7 +49,6 @@ int DaysModel::rowCount(const QModelIndex &parent) const
|
|||
QVariant DaysModel::data(const QModelIndex &index, int role) const
|
||||
{
|
||||
if (index.isValid()) {
|
||||
|
||||
const DayData ¤tData = m_data->at(index.row());
|
||||
const QDate currentDate(currentData.yearNumber, currentData.monthNumber, currentData.dayNumber);
|
||||
|
||||
|
@ -105,8 +103,7 @@ void DaysModel::onDataReady(const QMultiHash<QDate, CalendarEvents::EventData> &
|
|||
}
|
||||
|
||||
// only the containsEventItems roles may have changed
|
||||
Q_EMIT dataChanged(index(0, 0), index(m_data->count() - 1, 0),
|
||||
{containsEventItems, containsMajorEventItems, containsMinorEventItems});
|
||||
Q_EMIT dataChanged(index(0, 0), index(m_data->count() - 1, 0), {containsEventItems, containsMajorEventItems, containsMinorEventItems});
|
||||
|
||||
Q_EMIT agendaUpdated(QDate::currentDate());
|
||||
}
|
||||
|
@ -131,8 +128,7 @@ void DaysModel::onEventModified(const CalendarEvents::EventData &data)
|
|||
for (const QDate date : qAsConst(updatesList)) {
|
||||
const QModelIndex changedIndex = indexForDate(date);
|
||||
if (changedIndex.isValid()) {
|
||||
Q_EMIT dataChanged(changedIndex, changedIndex,
|
||||
{containsEventItems, containsMajorEventItems, containsMinorEventItems});
|
||||
Q_EMIT dataChanged(changedIndex, changedIndex, {containsEventItems, containsMajorEventItems, containsMinorEventItems});
|
||||
}
|
||||
Q_EMIT agendaUpdated(date);
|
||||
}
|
||||
|
@ -158,8 +154,7 @@ void DaysModel::onEventRemoved(const QString &uid)
|
|||
for (const QDate date : qAsConst(updatesList)) {
|
||||
const QModelIndex changedIndex = indexForDate(date);
|
||||
if (changedIndex.isValid()) {
|
||||
Q_EMIT dataChanged(changedIndex, changedIndex,
|
||||
{containsEventItems, containsMajorEventItems, containsMinorEventItems});
|
||||
Q_EMIT dataChanged(changedIndex, changedIndex, {containsEventItems, containsMajorEventItems, containsMinorEventItems});
|
||||
}
|
||||
Q_EMIT agendaUpdated(date);
|
||||
}
|
||||
|
@ -244,27 +239,21 @@ void DaysModel::setPluginsManager(QObject *manager)
|
|||
|
||||
m_pluginsManager = m;
|
||||
|
||||
connect(m_pluginsManager, &EventPluginsManager::dataReady,
|
||||
this, &DaysModel::onDataReady);
|
||||
connect(m_pluginsManager, &EventPluginsManager::eventModified,
|
||||
this, &DaysModel::onEventModified);
|
||||
connect(m_pluginsManager, &EventPluginsManager::eventRemoved,
|
||||
this, &DaysModel::onEventRemoved);
|
||||
connect(m_pluginsManager, &EventPluginsManager::pluginsChanged,
|
||||
this, &DaysModel::update);
|
||||
connect(m_pluginsManager, &EventPluginsManager::dataReady, this, &DaysModel::onDataReady);
|
||||
connect(m_pluginsManager, &EventPluginsManager::eventModified, this, &DaysModel::onEventModified);
|
||||
connect(m_pluginsManager, &EventPluginsManager::eventRemoved, this, &DaysModel::onEventRemoved);
|
||||
connect(m_pluginsManager, &EventPluginsManager::pluginsChanged, this, &DaysModel::update);
|
||||
|
||||
QMetaObject::invokeMethod(this, "update", Qt::QueuedConnection);
|
||||
}
|
||||
|
||||
QHash<int, QByteArray> DaysModel::roleNames() const
|
||||
{
|
||||
return {
|
||||
{isCurrent, "isCurrent"},
|
||||
return {{isCurrent, "isCurrent"},
|
||||
{containsEventItems, "containsEventItems"},
|
||||
{containsMajorEventItems, "containsMajorEventItems"},
|
||||
{containsMinorEventItems, "containsMinorEventItems"},
|
||||
{dayNumber, "dayNumber"},
|
||||
{monthNumber, "monthNumber"},
|
||||
{yearNumber, "yearNumber"}
|
||||
};
|
||||
{yearNumber, "yearNumber"}};
|
||||
}
|
||||
|
|
|
@ -9,8 +9,8 @@
|
|||
#include <KLocalizedString>
|
||||
|
||||
EventDataDecorator::EventDataDecorator(const CalendarEvents::EventData &data, QObject *parent)
|
||||
: QObject(parent),
|
||||
m_data(data)
|
||||
: QObject(parent)
|
||||
, m_data(data)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
#ifndef EVENTDATADECORATOR_H
|
||||
#define EVENTDATADECORATOR_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QDateTime>
|
||||
#include <QObject>
|
||||
#include <QString>
|
||||
|
||||
#include <CalendarEvents/CalendarEventsPlugin>
|
||||
|
|
|
@ -8,12 +8,12 @@
|
|||
|
||||
#include <CalendarEvents/CalendarEventsPlugin>
|
||||
|
||||
#include <QCoreApplication>
|
||||
#include <QAbstractListModel>
|
||||
#include <QCoreApplication>
|
||||
#include <QDebug>
|
||||
#include <QDir>
|
||||
#include <QJsonObject>
|
||||
#include <QPluginLoader>
|
||||
#include <QDir>
|
||||
#include <QDebug>
|
||||
|
||||
#include <KPluginLoader>
|
||||
#include <KPluginMetaData>
|
||||
|
@ -22,7 +22,8 @@ class EventPluginsModel : public QAbstractListModel
|
|||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
EventPluginsModel(EventPluginsManager *manager) : QAbstractListModel(manager)
|
||||
EventPluginsModel(EventPluginsManager *manager)
|
||||
: QAbstractListModel(manager)
|
||||
{
|
||||
m_manager = manager;
|
||||
m_roles = QAbstractListModel::roleNames();
|
||||
|
@ -70,8 +71,7 @@ public:
|
|||
return metadata.desc;
|
||||
case Qt::DecorationRole:
|
||||
return metadata.icon;
|
||||
case Qt::UserRole:
|
||||
{
|
||||
case Qt::UserRole: {
|
||||
// The currentPlugin path contains the full path including
|
||||
// the plugin filename, so it needs to be cut off from the last '/'
|
||||
const QStringRef pathRef = currentPlugin.leftRef(currentPlugin.lastIndexOf(QLatin1Char('/')));
|
||||
|
@ -85,7 +85,6 @@ public:
|
|||
}
|
||||
|
||||
return QVariant();
|
||||
|
||||
}
|
||||
|
||||
bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override
|
||||
|
@ -123,18 +122,12 @@ private:
|
|||
EventPluginsManager::EventPluginsManager(QObject *parent)
|
||||
: QObject(parent)
|
||||
{
|
||||
auto plugins = KPluginLoader::findPlugins(
|
||||
QStringLiteral("plasmacalendarplugins"),
|
||||
[](const KPluginMetaData &md) {
|
||||
auto plugins = KPluginLoader::findPlugins(QStringLiteral("plasmacalendarplugins"), [](const KPluginMetaData &md) {
|
||||
return md.serviceTypes().contains(QLatin1String("PlasmaCalendar/Plugin"));
|
||||
});
|
||||
for (const KPluginMetaData &plugin : qAsConst(plugins)) {
|
||||
m_availablePlugins.insert(plugin.fileName(),
|
||||
{ plugin.name(),
|
||||
plugin.description(),
|
||||
plugin.iconName(),
|
||||
plugin.value(QStringLiteral("X-KDE-PlasmaCalendar-ConfigUi"))
|
||||
});
|
||||
{plugin.name(), plugin.description(), plugin.iconName(), plugin.value(QStringLiteral("X-KDE-PlasmaCalendar-ConfigUi"))});
|
||||
}
|
||||
|
||||
// Fallback for legacy pre-KPlugin plugins so we can still load them
|
||||
|
@ -163,8 +156,7 @@ EventPluginsManager::EventPluginsManager(QObject *parent)
|
|||
{md.value(QStringLiteral("Name")).toString(),
|
||||
md.value(QStringLiteral("Description")).toString(),
|
||||
md.value(QStringLiteral("Icon")).toString(),
|
||||
md.value(QStringLiteral("ConfigUi")).toString()
|
||||
});
|
||||
md.value(QStringLiteral("ConfigUi")).toString()});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -236,12 +228,9 @@ void EventPluginsManager::loadPlugin(const QString &absolutePath)
|
|||
m_plugins << eventsPlugin;
|
||||
|
||||
// Connect the relay signals
|
||||
connect(eventsPlugin, &CalendarEvents::CalendarEventsPlugin::dataReady,
|
||||
this, &EventPluginsManager::dataReady);
|
||||
connect(eventsPlugin, &CalendarEvents::CalendarEventsPlugin::eventModified,
|
||||
this, &EventPluginsManager::eventModified);
|
||||
connect(eventsPlugin, &CalendarEvents::CalendarEventsPlugin::eventRemoved,
|
||||
this, &EventPluginsManager::eventRemoved);
|
||||
connect(eventsPlugin, &CalendarEvents::CalendarEventsPlugin::dataReady, this, &EventPluginsManager::dataReady);
|
||||
connect(eventsPlugin, &CalendarEvents::CalendarEventsPlugin::eventModified, this, &EventPluginsManager::eventModified);
|
||||
connect(eventsPlugin, &CalendarEvents::CalendarEventsPlugin::eventRemoved, this, &EventPluginsManager::eventRemoved);
|
||||
} else {
|
||||
// not our/valid plugin, so unload it
|
||||
loader.unload();
|
||||
|
|
|
@ -7,11 +7,12 @@
|
|||
#ifndef EVENTPLUGINSMANAGER_H
|
||||
#define EVENTPLUGINSMANAGER_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QMap>
|
||||
#include <QObject>
|
||||
#include <QStringList>
|
||||
|
||||
namespace CalendarEvents {
|
||||
namespace CalendarEvents
|
||||
{
|
||||
class CalendarEventsPlugin;
|
||||
class EventData;
|
||||
}
|
||||
|
@ -67,4 +68,3 @@ private:
|
|||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -8,9 +8,9 @@
|
|||
|
||||
#include "colorscope.h"
|
||||
|
||||
#include <QColor>
|
||||
#include <QQmlContext>
|
||||
#include <QQmlEngine>
|
||||
#include <QColor>
|
||||
#include <QQuickWindow>
|
||||
|
||||
#include <PlasmaQuick/AppletQuickItem>
|
||||
|
@ -20,11 +20,11 @@ QHash<QObject *, ColorScope *> ColorScope::s_attachedScopes = QHash<QObject *, C
|
|||
QWeakPointer<Plasma::Theme> ColorScope::s_theme;
|
||||
|
||||
ColorScope::ColorScope(QQuickItem *parent, QObject *parentObject)
|
||||
: QQuickItem(parent),
|
||||
m_inherit(false),
|
||||
m_group(Plasma::Theme::NormalColorGroup),
|
||||
m_parent(parentObject),
|
||||
m_actualGroup(Plasma::Theme::NormalColorGroup)
|
||||
: QQuickItem(parent)
|
||||
, m_inherit(false)
|
||||
, m_group(Plasma::Theme::NormalColorGroup)
|
||||
, m_parent(parentObject)
|
||||
, m_actualGroup(Plasma::Theme::NormalColorGroup)
|
||||
{
|
||||
m_theme = s_theme.toStrongRef();
|
||||
if (!m_theme) {
|
||||
|
@ -38,20 +38,17 @@ ColorScope::ColorScope(QQuickItem *parent, QObject *parentObject)
|
|||
connect(this, &ColorScope::colorGroupChanged, this, &ColorScope::colorsChanged);
|
||||
|
||||
if (parentObject && qobject_cast<QQuickItem *>(parentObject)) {
|
||||
connect(static_cast<QQuickItem *>(parentObject), &QQuickItem::windowChanged,
|
||||
this, [this]() {
|
||||
connect(static_cast<QQuickItem *>(parentObject), &QQuickItem::windowChanged, this, [this]() {
|
||||
findParentScope();
|
||||
checkColorGroupChanged();
|
||||
});
|
||||
|
||||
connect(static_cast<QQuickItem *>(parentObject), &QQuickItem::parentChanged,
|
||||
this, [this]() {
|
||||
connect(static_cast<QQuickItem *>(parentObject), &QQuickItem::parentChanged, this, [this]() {
|
||||
findParentScope();
|
||||
checkColorGroupChanged();
|
||||
});
|
||||
} else if (parent) {
|
||||
connect(parent, &QQuickItem::parentChanged,
|
||||
this, &ColorScope::checkColorGroupChanged);
|
||||
connect(parent, &QQuickItem::parentChanged, this, &ColorScope::checkColorGroupChanged);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -83,15 +80,13 @@ void ColorScope::setParentScope(ColorScope* parentScope)
|
|||
return;
|
||||
|
||||
if (m_parentScope) {
|
||||
disconnect(m_parentScope.data(), &ColorScope::colorGroupChanged,
|
||||
this, &ColorScope::checkColorGroupChanged);
|
||||
disconnect(m_parentScope.data(), &ColorScope::colorGroupChanged, this, &ColorScope::checkColorGroupChanged);
|
||||
}
|
||||
|
||||
m_parentScope = parentScope;
|
||||
|
||||
if (parentScope) {
|
||||
connect(parentScope, &ColorScope::colorGroupChanged,
|
||||
this, &ColorScope::checkColorGroupChanged);
|
||||
connect(parentScope, &ColorScope::colorGroupChanged, this, &ColorScope::checkColorGroupChanged);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -7,12 +7,12 @@
|
|||
#ifndef COLORSCOPE_H
|
||||
#define COLORSCOPE_H
|
||||
|
||||
#include <QQuickItem>
|
||||
#include <QPointer>
|
||||
#include <QSharedPointer>
|
||||
#include <QVariant>
|
||||
#include <Plasma/Plasma>
|
||||
#include <Plasma/Theme>
|
||||
#include <QPointer>
|
||||
#include <QQuickItem>
|
||||
#include <QSharedPointer>
|
||||
#include <QVariant>
|
||||
|
||||
class QQuickItem;
|
||||
|
||||
|
@ -126,7 +126,6 @@ private:
|
|||
|
||||
static QWeakPointer<Plasma::Theme> s_theme;
|
||||
QSharedPointer<Plasma::Theme> m_theme;
|
||||
|
||||
};
|
||||
|
||||
QML_DECLARE_TYPEINFO(ColorScope, QML_HAS_ATTACHED_PROPERTIES)
|
||||
|
|
|
@ -18,16 +18,16 @@
|
|||
#include <plasma/framesvg.h>
|
||||
#include <plasma/svg.h>
|
||||
|
||||
#include "datasource.h"
|
||||
#include "colorscope.h"
|
||||
#include "datamodel.h"
|
||||
#include "datasource.h"
|
||||
#include "dialog.h"
|
||||
#include "framesvgitem.h"
|
||||
#include "iconitem.h"
|
||||
#include "quicktheme.h"
|
||||
#include "serviceoperationstatus.h"
|
||||
#include "svgitem.h"
|
||||
#include "theme.h"
|
||||
#include "dialog.h"
|
||||
#include "iconitem.h"
|
||||
#include "serviceoperationstatus.h"
|
||||
#include "colorscope.h"
|
||||
#include "quicktheme.h"
|
||||
|
||||
#include "tooltip.h"
|
||||
#include "units.h"
|
||||
|
@ -74,7 +74,9 @@ void CoreBindingsPlugin::registerTypes(const char *uri)
|
|||
qmlRegisterType<Plasma::FrameSvgItem>(uri, 2, 0, "FrameSvgItem");
|
||||
|
||||
// qmlRegisterType<ThemeProxy>(uri, 2, 0, "Theme");
|
||||
qmlRegisterSingletonType<Plasma::QuickTheme>(uri, 2, 0, "Theme", [](QQmlEngine* engine, QJSEngine*) -> QObject* { return new Plasma::QuickTheme(engine); });
|
||||
qmlRegisterSingletonType<Plasma::QuickTheme>(uri, 2, 0, "Theme", [](QQmlEngine *engine, QJSEngine *) -> QObject * {
|
||||
return new Plasma::QuickTheme(engine);
|
||||
});
|
||||
qmlRegisterType<ColorScope>(uri, 2, 0, "ColorScope");
|
||||
|
||||
qmlRegisterType<Plasma::DataSource>(uri, 2, 0, "DataSource");
|
||||
|
@ -117,5 +119,3 @@ QT_WARNING_POP
|
|||
|
||||
qmlRegisterType<Plasma::WindowThumbnail>(uri, 2, 0, "WindowThumbnail");
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -13,18 +13,14 @@
|
|||
|
||||
namespace Plasma
|
||||
{
|
||||
|
||||
SortFilterModel::SortFilterModel(QObject *parent)
|
||||
: QSortFilterProxyModel(parent)
|
||||
{
|
||||
setObjectName(QStringLiteral("SortFilterModel"));
|
||||
setDynamicSortFilter(true);
|
||||
connect(this, &QAbstractItemModel::rowsInserted,
|
||||
this, &SortFilterModel::countChanged);
|
||||
connect(this, &QAbstractItemModel::rowsRemoved,
|
||||
this, &SortFilterModel::countChanged);
|
||||
connect(this, &QAbstractItemModel::modelReset,
|
||||
this, &SortFilterModel::countChanged);
|
||||
connect(this, &QAbstractItemModel::rowsInserted, this, &SortFilterModel::countChanged);
|
||||
connect(this, &QAbstractItemModel::rowsRemoved, this, &SortFilterModel::countChanged);
|
||||
connect(this, &QAbstractItemModel::modelReset, this, &SortFilterModel::countChanged);
|
||||
connect(this, &SortFilterModel::countChanged, this, &SortFilterModel::syncRoleNames);
|
||||
}
|
||||
|
||||
|
@ -222,9 +218,9 @@ int SortFilterModel::mapRowFromSource(int row) const
|
|||
}
|
||||
|
||||
DataModel::DataModel(QObject *parent)
|
||||
: QAbstractItemModel(parent),
|
||||
m_dataSource(nullptr),
|
||||
m_maxRoleId(Qt::UserRole + 1)
|
||||
: QAbstractItemModel(parent)
|
||||
, m_dataSource(nullptr)
|
||||
, m_maxRoleId(Qt::UserRole + 1)
|
||||
{
|
||||
// There is one reserved role name: DataEngineSource
|
||||
m_roleNames[m_maxRoleId] = QByteArrayLiteral("DataEngineSource");
|
||||
|
@ -232,12 +228,9 @@ DataModel::DataModel(QObject *parent)
|
|||
++m_maxRoleId;
|
||||
|
||||
setObjectName(QStringLiteral("DataModel"));
|
||||
connect(this, &QAbstractItemModel::rowsInserted,
|
||||
this, &DataModel::countChanged);
|
||||
connect(this, &QAbstractItemModel::rowsRemoved,
|
||||
this, &DataModel::countChanged);
|
||||
connect(this, &QAbstractItemModel::modelReset,
|
||||
this, &DataModel::countChanged);
|
||||
connect(this, &QAbstractItemModel::rowsInserted, this, &DataModel::countChanged);
|
||||
connect(this, &QAbstractItemModel::rowsRemoved, this, &DataModel::countChanged);
|
||||
connect(this, &QAbstractItemModel::modelReset, this, &DataModel::countChanged);
|
||||
}
|
||||
|
||||
DataModel::~DataModel()
|
||||
|
@ -271,8 +264,7 @@ void DataModel::dataUpdated(const QString &sourceName, const QVariantMap &data)
|
|||
setItems(QString(), list);
|
||||
} else {
|
||||
// a key that matches the one we want exists and is a list of DataEngine::Data
|
||||
if (data.contains(m_keyRoleFilter) &&
|
||||
data.value(m_keyRoleFilter).canConvert<QVariantList>()) {
|
||||
if (data.contains(m_keyRoleFilter) && data.value(m_keyRoleFilter).canConvert<QVariantList>()) {
|
||||
setItems(sourceName, data.value(m_keyRoleFilter).value<QVariantList>());
|
||||
} else if (m_keyRoleFilterRE.isValid()) {
|
||||
// try to match the key we want with a regular expression if set
|
||||
|
@ -310,12 +302,9 @@ void DataModel::setDataSource(QObject *object)
|
|||
dataUpdated(key, m_dataSource->data()->value(key).value<Plasma::DataEngine::Data>());
|
||||
}
|
||||
|
||||
connect(m_dataSource, &DataSource::newData,
|
||||
this, &DataModel::dataUpdated);
|
||||
connect(m_dataSource, &DataSource::sourceRemoved,
|
||||
this, &DataModel::removeSource);
|
||||
connect(m_dataSource, &DataSource::sourceDisconnected,
|
||||
this, &DataModel::removeSource);
|
||||
connect(m_dataSource, &DataSource::newData, this, &DataModel::dataUpdated);
|
||||
connect(m_dataSource, &DataSource::sourceRemoved, this, &DataModel::removeSource);
|
||||
connect(m_dataSource, &DataSource::sourceDisconnected, this, &DataModel::removeSource);
|
||||
}
|
||||
|
||||
QObject *DataModel::dataSource() const
|
||||
|
@ -434,8 +423,7 @@ void DataModel::setItems(const QString &sourceName, const QVariantList &list)
|
|||
} else if (delta < 0) {
|
||||
endRemoveRows();
|
||||
}
|
||||
Q_EMIT dataChanged(createIndex(sourceIndex, 0),
|
||||
createIndex(sourceIndex + qMin(list.length(), oldLength), 0));
|
||||
Q_EMIT dataChanged(createIndex(sourceIndex, 0), createIndex(sourceIndex + qMin(list.length(), oldLength), 0));
|
||||
}
|
||||
|
||||
QHash<int, QByteArray> DataModel::roleNames() const
|
||||
|
@ -484,8 +472,7 @@ void DataModel::removeSource(const QString &sourceName)
|
|||
|
||||
QVariant DataModel::data(const QModelIndex &index, int role) const
|
||||
{
|
||||
if (!index.isValid() || index.column() > 0 ||
|
||||
index.row() < 0 || index.row() >= countItems()) {
|
||||
if (!index.isValid() || index.column() > 0 || index.row() < 0 || index.row() >= countItems()) {
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
|
@ -572,4 +559,3 @@ QVariantMap DataModel::get(int row) const
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -18,7 +18,6 @@ class QTimer;
|
|||
|
||||
namespace Plasma
|
||||
{
|
||||
|
||||
class DataSource;
|
||||
class DataModel;
|
||||
|
||||
|
@ -167,8 +166,8 @@ class DataModel : public QAbstractItemModel
|
|||
Q_PROPERTY(QString keyRoleFilter READ keyRoleFilter WRITE setKeyRoleFilter)
|
||||
|
||||
/**
|
||||
* it's a regular expression. If the DataSource is connected to more than one source, only inserts data from sources matching this filter expression in the model.
|
||||
* If we want to have a source watch all sources beginning with say "name:", the required regexp would be sourceFilter: "name:.*"
|
||||
* it's a regular expression. If the DataSource is connected to more than one source, only inserts data from sources matching this filter expression in the
|
||||
* model. If we want to have a source watch all sources beginning with say "name:", the required regexp would be sourceFilter: "name:.*"
|
||||
*/
|
||||
Q_PROPERTY(QString sourceFilter READ sourceFilter WRITE setSourceFilter)
|
||||
|
||||
|
@ -198,10 +197,8 @@ public:
|
|||
|
||||
// Reimplemented
|
||||
QVariant data(const QModelIndex &index, int role) const override;
|
||||
QVariant headerData(int section, Qt::Orientation orientation,
|
||||
int role = Qt::DisplayRole) const override;
|
||||
QModelIndex index(int row, int column,
|
||||
const QModelIndex &parent = QModelIndex()) const override;
|
||||
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
|
||||
QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const override;
|
||||
QModelIndex parent(const QModelIndex &child) const override;
|
||||
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||
int columnCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||
|
|
|
@ -12,10 +12,10 @@
|
|||
namespace Plasma
|
||||
{
|
||||
DataSource::DataSource(QObject *parent)
|
||||
: QObject(parent),
|
||||
m_ready(false),
|
||||
m_interval(0),
|
||||
m_intervalAlignment(Plasma::Types::NoAlignment)
|
||||
: QObject(parent)
|
||||
, m_ready(false)
|
||||
, m_interval(0)
|
||||
, m_intervalAlignment(Plasma::Types::NoAlignment)
|
||||
{
|
||||
m_models = new QQmlPropertyMap(this);
|
||||
m_data = new QQmlPropertyMap(this);
|
||||
|
@ -24,7 +24,6 @@ DataSource::DataSource(QObject *parent)
|
|||
|
||||
void DataSource::classBegin()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void DataSource::componentComplete()
|
||||
|
|
|
@ -11,13 +11,13 @@
|
|||
#define DATASOURCE_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QQmlParserStatus>
|
||||
#include <QQmlPropertyMap>
|
||||
#include <QScopedPointer>
|
||||
#include <QtQml>
|
||||
#include <QQmlPropertyMap>
|
||||
#include <QQmlParserStatus>
|
||||
|
||||
#include <Plasma/DataEngineConsumer>
|
||||
#include <Plasma/DataEngine>
|
||||
#include <Plasma/DataEngineConsumer>
|
||||
|
||||
class QQmlPropertyMap;
|
||||
|
||||
|
|
|
@ -6,12 +6,11 @@
|
|||
|
||||
#include "fadingnode_p.h"
|
||||
|
||||
#include <QSGSimpleMaterialShader>
|
||||
#include <QOpenGLContext>
|
||||
#include <QOpenGLFunctions>
|
||||
#include <QSGSimpleMaterialShader>
|
||||
|
||||
struct FadingMaterialState
|
||||
{
|
||||
struct FadingMaterialState {
|
||||
QSGTexture *source = nullptr;
|
||||
QSGTexture *target = nullptr;
|
||||
qreal progress;
|
||||
|
@ -27,6 +26,7 @@ public:
|
|||
QList<QByteArray> attributes() const override;
|
||||
|
||||
void initialize() override;
|
||||
|
||||
private:
|
||||
QOpenGLFunctions *glFuncs = nullptr;
|
||||
int m_progressId = 0;
|
||||
|
@ -34,7 +34,6 @@ private:
|
|||
int m_targetRectId = 0;
|
||||
};
|
||||
|
||||
|
||||
FadingMaterialShader::FadingMaterialShader()
|
||||
{
|
||||
setShaderSourceFile(QOpenGLShader::Fragment, QStringLiteral(":/plasma-framework/shaders/fadingmaterial.frag"));
|
||||
|
@ -86,10 +85,9 @@ void FadingMaterialShader::initialize()
|
|||
m_targetRectId = program()->uniformLocation("u_target_rect");
|
||||
}
|
||||
|
||||
|
||||
FadingNode::FadingNode(QSGTexture *source, QSGTexture *target):
|
||||
m_source(source),
|
||||
m_target(target)
|
||||
FadingNode::FadingNode(QSGTexture *source, QSGTexture *target)
|
||||
: m_source(source)
|
||||
, m_target(target)
|
||||
{
|
||||
QSGSimpleMaterial<FadingMaterialState> *m = FadingMaterialShader::createMaterial();
|
||||
m->setFlag(QSGMaterial::Blending);
|
||||
|
|
|
@ -7,9 +7,9 @@
|
|||
#ifndef FADINGNODE_H
|
||||
#define FADINGNODE_H
|
||||
|
||||
#include <QRectF>
|
||||
#include <QSGGeometryNode>
|
||||
#include <QSGTexture>
|
||||
#include <QRectF>
|
||||
|
||||
/**
|
||||
* This node fades between two textures using a shader
|
||||
|
@ -29,6 +29,7 @@ public:
|
|||
*/
|
||||
void setProgress(qreal progress);
|
||||
void setRect(const QRectF &bounds);
|
||||
|
||||
private:
|
||||
QScopedPointer<QSGTexture> m_source;
|
||||
QScopedPointer<QSGTexture> m_target;
|
||||
|
|
|
@ -8,23 +8,22 @@
|
|||
#include "framesvgitem.h"
|
||||
|
||||
#include <QQuickWindow>
|
||||
#include <QSGTexture>
|
||||
#include <QSGGeometry>
|
||||
#include <QSGTexture>
|
||||
|
||||
#include <QDebug>
|
||||
#include <QPainter>
|
||||
|
||||
#include <plasma/private/framesvg_p.h>
|
||||
#include <plasma/private/framesvg_helpers.h>
|
||||
#include <plasma/private/framesvg_p.h>
|
||||
|
||||
#include <QuickAddons/ManagedTextureNode>
|
||||
#include <QuickAddons/ImageTexturesCache>
|
||||
#include <QuickAddons/ManagedTextureNode>
|
||||
|
||||
#include <cmath> //floor()
|
||||
|
||||
namespace Plasma
|
||||
{
|
||||
|
||||
Q_GLOBAL_STATIC(ImageTexturesCache, s_cache)
|
||||
|
||||
class FrameNode : public QSGNode
|
||||
|
@ -165,10 +164,10 @@ private:
|
|||
};
|
||||
|
||||
FrameSvgItemMargins::FrameSvgItemMargins(Plasma::FrameSvg *frameSvg, QObject *parent)
|
||||
: QObject(parent),
|
||||
m_frameSvg(frameSvg),
|
||||
m_fixed(false),
|
||||
m_inset(false)
|
||||
: QObject(parent)
|
||||
, m_frameSvg(frameSvg)
|
||||
, m_fixed(false)
|
||||
, m_inset(false)
|
||||
{
|
||||
// qDebug() << "margins at: " << left() << top() << right() << bottom();
|
||||
}
|
||||
|
@ -270,13 +269,13 @@ bool FrameSvgItemMargins::isInset() const
|
|||
}
|
||||
|
||||
FrameSvgItem::FrameSvgItem(QQuickItem *parent)
|
||||
: QQuickItem(parent),
|
||||
m_margins(nullptr),
|
||||
m_fixedMargins(nullptr),
|
||||
m_insetMargins(nullptr),
|
||||
m_textureChanged(false),
|
||||
m_sizeChanged(false),
|
||||
m_fastPath(true)
|
||||
: QQuickItem(parent)
|
||||
, m_margins(nullptr)
|
||||
, m_fixedMargins(nullptr)
|
||||
, m_insetMargins(nullptr)
|
||||
, m_textureChanged(false)
|
||||
, m_sizeChanged(false)
|
||||
, m_fastPath(true)
|
||||
{
|
||||
m_frameSvg = new Plasma::FrameSvg(this);
|
||||
setFlag(ItemHasContents, true);
|
||||
|
@ -294,8 +293,10 @@ class CheckMarginsChange
|
|||
{
|
||||
public:
|
||||
CheckMarginsChange(QVector<qreal> &oldMargins, FrameSvgItemMargins *marginsObject)
|
||||
: m_oldMargins(oldMargins), m_marginsObject(marginsObject)
|
||||
{}
|
||||
: m_oldMargins(oldMargins)
|
||||
, m_marginsObject(marginsObject)
|
||||
{
|
||||
}
|
||||
|
||||
~CheckMarginsChange()
|
||||
{
|
||||
|
@ -478,14 +479,12 @@ bool FrameSvgItem::hasElementPrefix(const QString &prefix) const
|
|||
return m_frameSvg->hasElementPrefix(prefix);
|
||||
}
|
||||
|
||||
|
||||
QRegion FrameSvgItem::mask() const
|
||||
{
|
||||
return m_frameSvg->mask();
|
||||
}
|
||||
|
||||
void FrameSvgItem::geometryChanged(const QRectF &newGeometry,
|
||||
const QRectF &oldGeometry)
|
||||
void FrameSvgItem::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry)
|
||||
{
|
||||
const bool isComponentComplete = this->isComponentComplete();
|
||||
if (isComponentComplete) {
|
||||
|
@ -525,8 +524,8 @@ void FrameSvgItem::doUpdate()
|
|||
|
||||
QString prefix = m_frameSvg->actualPrefix();
|
||||
bool hasOverlay = !prefix.startsWith(QLatin1String("mask-")) && m_frameSvg->hasElement(prefix % QLatin1String("overlay"));
|
||||
bool hasComposeOverBorder = m_frameSvg->hasElement(prefix % QLatin1String("hint-compose-over-border")) &&
|
||||
m_frameSvg->hasElement(QLatin1String("mask-") % prefix % QLatin1String("center"));
|
||||
bool hasComposeOverBorder = m_frameSvg->hasElement(prefix % QLatin1String("hint-compose-over-border"))
|
||||
&& m_frameSvg->hasElement(QLatin1String("mask-") % prefix % QLatin1String("center"));
|
||||
m_fastPath = !hasOverlay && !hasComposeOverBorder;
|
||||
|
||||
// software rendering (at time of writing Qt5.10) doesn't seem to like our tiling/stretching in the 9-tiles.
|
||||
|
@ -549,8 +548,7 @@ Plasma::FrameSvg *FrameSvgItem::frameSvg() const
|
|||
|
||||
QSGNode *FrameSvgItem::updatePaintNode(QSGNode *oldNode, QQuickItem::UpdatePaintNodeData *)
|
||||
{
|
||||
if (!window() || !m_frameSvg ||
|
||||
(!m_frameSvg->hasElementPrefix(m_frameSvg->actualPrefix()) && !m_frameSvg->hasElementPrefix(m_frameSvg->prefix()))) {
|
||||
if (!window() || !m_frameSvg || (!m_frameSvg->hasElementPrefix(m_frameSvg->actualPrefix()) && !m_frameSvg->hasElementPrefix(m_frameSvg->prefix()))) {
|
||||
delete oldNode;
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -567,10 +565,10 @@ QSGNode *FrameSvgItem::updatePaintNode(QSGNode *oldNode, QQuickItem::UpdatePaint
|
|||
QString prefix = m_frameSvg->actualPrefix();
|
||||
oldNode = new FrameNode(prefix, m_frameSvg);
|
||||
|
||||
bool tileCenter = (m_frameSvg->hasElement(QStringLiteral("hint-tile-center"))
|
||||
|| m_frameSvg->hasElement(prefix % QLatin1String("hint-tile-center")));
|
||||
bool stretchBorders = (m_frameSvg->hasElement(QStringLiteral("hint-stretch-borders"))
|
||||
|| m_frameSvg->hasElement(prefix % QLatin1String("hint-stretch-borders")));
|
||||
bool tileCenter =
|
||||
(m_frameSvg->hasElement(QStringLiteral("hint-tile-center")) || m_frameSvg->hasElement(prefix % QLatin1String("hint-tile-center")));
|
||||
bool stretchBorders =
|
||||
(m_frameSvg->hasElement(QStringLiteral("hint-stretch-borders")) || m_frameSvg->hasElement(prefix % QLatin1String("hint-stretch-borders")));
|
||||
FrameItemNode::FitMode borderFitMode = stretchBorders ? FrameItemNode::Stretch : FrameItemNode::Tile;
|
||||
FrameItemNode::FitMode centerFitMode = tileCenter ? FrameItemNode::Tile : FrameItemNode::Stretch;
|
||||
|
||||
|
@ -679,7 +677,6 @@ void FrameSvgItem::updateDevicePixelRatio()
|
|||
|
||||
void FrameSvgItem::applyPrefixes()
|
||||
{
|
||||
|
||||
if (m_frameSvg->imagePath().isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
@ -721,4 +718,3 @@ void FrameSvgItem::itemChange(QQuickItem::ItemChange change, const QQuickItem::I
|
|||
}
|
||||
|
||||
} // Plasma namespace
|
||||
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
#ifndef FRAMESVGITEM_P
|
||||
#define FRAMESVGITEM_P
|
||||
|
||||
#include <QQuickItem>
|
||||
#include <QQmlParserStatus>
|
||||
#include <QQuickItem>
|
||||
|
||||
#include <Plasma/FrameSvg>
|
||||
|
||||
|
@ -16,7 +16,6 @@
|
|||
|
||||
namespace Plasma
|
||||
{
|
||||
|
||||
class FrameSvg;
|
||||
|
||||
/**
|
||||
|
@ -58,7 +57,6 @@ class FrameSvgItemMargins : public QObject
|
|||
*/
|
||||
Q_PROPERTY(qreal vertical READ vertical NOTIFY marginsChanged)
|
||||
|
||||
|
||||
public:
|
||||
FrameSvgItemMargins(Plasma::FrameSvg *frameSvg, QObject *parent = nullptr);
|
||||
|
||||
|
@ -90,7 +88,6 @@ private:
|
|||
bool m_inset;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @class FrameSvgItem
|
||||
*
|
||||
|
@ -222,8 +219,7 @@ public:
|
|||
void setStatus(Plasma::Svg::Status status);
|
||||
Plasma::Svg::Status status() const;
|
||||
|
||||
void geometryChanged(const QRectF &newGeometry,
|
||||
const QRectF &oldGeometry) override;
|
||||
void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) override;
|
||||
|
||||
QRegion mask() const;
|
||||
|
||||
|
|
|
@ -11,23 +11,28 @@
|
|||
#include <QPainter>
|
||||
#include <QPalette>
|
||||
#include <QPropertyAnimation>
|
||||
#include <QSGSimpleTextureNode>
|
||||
#include <QQuickWindow>
|
||||
#include <QSGSimpleTextureNode>
|
||||
|
||||
#include <KIconLoader>
|
||||
#include <KIconEffect>
|
||||
#include <KIconLoader>
|
||||
#include <KIconTheme>
|
||||
|
||||
#include "fadingnode_p.h"
|
||||
#include <QuickAddons/ManagedTextureNode>
|
||||
#include "theme.h"
|
||||
#include "units.h"
|
||||
#include <QuickAddons/ManagedTextureNode>
|
||||
|
||||
class IconItemSource
|
||||
{
|
||||
public:
|
||||
explicit IconItemSource(IconItem *iconItem) : m_iconItem(iconItem) {}
|
||||
virtual ~IconItemSource() {}
|
||||
explicit IconItemSource(IconItem *iconItem)
|
||||
: m_iconItem(iconItem)
|
||||
{
|
||||
}
|
||||
virtual ~IconItemSource()
|
||||
{
|
||||
}
|
||||
|
||||
virtual bool isValid() const = 0;
|
||||
virtual const QSize size() const = 0;
|
||||
|
@ -45,7 +50,10 @@ protected:
|
|||
class NullSource : public IconItemSource
|
||||
{
|
||||
public:
|
||||
explicit NullSource(IconItem *iconItem) : IconItemSource(iconItem) {}
|
||||
explicit NullSource(IconItem *iconItem)
|
||||
: IconItemSource(iconItem)
|
||||
{
|
||||
}
|
||||
|
||||
bool isValid() const override
|
||||
{
|
||||
|
@ -67,7 +75,8 @@ public:
|
|||
class QIconSource : public IconItemSource
|
||||
{
|
||||
public:
|
||||
explicit QIconSource(const QIcon &icon, IconItem *iconItem) : IconItemSource(iconItem)
|
||||
explicit QIconSource(const QIcon &icon, IconItem *iconItem)
|
||||
: IconItemSource(iconItem)
|
||||
{
|
||||
m_icon = icon;
|
||||
}
|
||||
|
@ -97,7 +106,8 @@ private:
|
|||
class QImageSource : public IconItemSource
|
||||
{
|
||||
public:
|
||||
explicit QImageSource(const QImage &imageIcon, IconItem *iconItem) : IconItemSource(iconItem)
|
||||
explicit QImageSource(const QImage &imageIcon, IconItem *iconItem)
|
||||
: IconItemSource(iconItem)
|
||||
{
|
||||
m_imageIcon = imageIcon;
|
||||
}
|
||||
|
@ -130,7 +140,8 @@ private:
|
|||
class SvgSource : public IconItemSource
|
||||
{
|
||||
public:
|
||||
explicit SvgSource(const QString &sourceString, IconItem* iconItem) : IconItemSource(iconItem)
|
||||
explicit SvgSource(const QString &sourceString, IconItem *iconItem)
|
||||
: IconItemSource(iconItem)
|
||||
{
|
||||
m_svgIcon = new Plasma::Svg(iconItem);
|
||||
m_svgIcon->setColorGroup(iconItem->colorGroup());
|
||||
|
@ -181,7 +192,8 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
~SvgSource() {
|
||||
~SvgSource()
|
||||
{
|
||||
if (m_svgIcon) {
|
||||
QObject::disconnect(m_iconItem, nullptr, m_svgIcon, nullptr);
|
||||
}
|
||||
|
@ -248,35 +260,32 @@ private:
|
|||
};
|
||||
|
||||
IconItem::IconItem(QQuickItem *parent)
|
||||
: QQuickItem(parent),
|
||||
m_iconItemSource(new NullSource(this)),
|
||||
m_status(Plasma::Svg::Normal),
|
||||
m_active(false),
|
||||
m_animated(true),
|
||||
m_usesPlasmaTheme(true),
|
||||
m_roundToIconSize(true),
|
||||
m_textureChanged(false),
|
||||
m_sizeChanged(false),
|
||||
m_allowNextAnimation(false),
|
||||
m_blockNextAnimation(false),
|
||||
m_implicitHeightSetByUser(false),
|
||||
m_implicitWidthSetByUser(false),
|
||||
m_colorGroup(Plasma::Theme::NormalColorGroup),
|
||||
m_animValue(0)
|
||||
: QQuickItem(parent)
|
||||
, m_iconItemSource(new NullSource(this))
|
||||
, m_status(Plasma::Svg::Normal)
|
||||
, m_active(false)
|
||||
, m_animated(true)
|
||||
, m_usesPlasmaTheme(true)
|
||||
, m_roundToIconSize(true)
|
||||
, m_textureChanged(false)
|
||||
, m_sizeChanged(false)
|
||||
, m_allowNextAnimation(false)
|
||||
, m_blockNextAnimation(false)
|
||||
, m_implicitHeightSetByUser(false)
|
||||
, m_implicitWidthSetByUser(false)
|
||||
, m_colorGroup(Plasma::Theme::NormalColorGroup)
|
||||
, m_animValue(0)
|
||||
{
|
||||
m_animation = new QPropertyAnimation(this);
|
||||
connect(m_animation, &QPropertyAnimation::valueChanged,
|
||||
this, &IconItem::valueChanged);
|
||||
connect(m_animation, &QPropertyAnimation::finished,
|
||||
this, &IconItem::animationFinished);
|
||||
connect(m_animation, &QPropertyAnimation::valueChanged, this, &IconItem::valueChanged);
|
||||
connect(m_animation, &QPropertyAnimation::finished, this, &IconItem::animationFinished);
|
||||
m_animation->setTargetObject(this);
|
||||
m_animation->setEasingCurve(QEasingCurve::InOutQuad);
|
||||
m_animation->setDuration(250); // FIXME from theme
|
||||
|
||||
setFlag(ItemHasContents, true);
|
||||
|
||||
connect(KIconLoader::global(), &KIconLoader::iconLoaderSettingsChanged,
|
||||
this, &IconItem::updateImplicitSize);
|
||||
connect(KIconLoader::global(), &KIconLoader::iconLoaderSettingsChanged, this, &IconItem::updateImplicitSize);
|
||||
|
||||
connect(this, &IconItem::implicitWidthChanged, this, &IconItem::implicitWidthChanged2);
|
||||
connect(this, &IconItem::implicitHeightChanged, this, &IconItem::implicitHeightChanged2);
|
||||
|
@ -346,9 +355,7 @@ void IconItem::setSource(const QVariant &source)
|
|||
}
|
||||
|
||||
if (!localFile.isEmpty()) {
|
||||
if (sourceString.endsWith(QLatin1String(".svg")) ||
|
||||
sourceString.endsWith(QLatin1String(".svgz")) ||
|
||||
sourceString.endsWith(QLatin1String(".ico"))) {
|
||||
if (sourceString.endsWith(QLatin1String(".svg")) || sourceString.endsWith(QLatin1String(".svgz")) || sourceString.endsWith(QLatin1String(".ico"))) {
|
||||
QIcon icon = QIcon(localFile);
|
||||
m_iconItemSource.reset(new QIconSource(icon, this));
|
||||
} else {
|
||||
|
@ -412,7 +419,6 @@ Plasma::Theme::ColorGroup IconItem::colorGroup() const
|
|||
return m_colorGroup;
|
||||
}
|
||||
|
||||
|
||||
void IconItem::setOverlays(const QStringList &overlays)
|
||||
{
|
||||
if (overlays == m_overlays) {
|
||||
|
@ -428,7 +434,6 @@ QStringList IconItem::overlays() const
|
|||
return m_overlays;
|
||||
}
|
||||
|
||||
|
||||
bool IconItem::isActive() const
|
||||
{
|
||||
return m_active;
|
||||
|
@ -775,14 +780,12 @@ void IconItem::itemChange(ItemChange change, const ItemChangeData &value)
|
|||
connect(m_window.data(), &QWindow::visibleChanged, this, &IconItem::windowVisibleChanged);
|
||||
}
|
||||
schedulePixmapUpdate();
|
||||
|
||||
}
|
||||
|
||||
QQuickItem::itemChange(change, value);
|
||||
}
|
||||
|
||||
void IconItem::geometryChanged(const QRectF &newGeometry,
|
||||
const QRectF &oldGeometry)
|
||||
void IconItem::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry)
|
||||
{
|
||||
if (newGeometry.size() != oldGeometry.size()) {
|
||||
m_sizeChanged = true;
|
||||
|
|
|
@ -9,11 +9,11 @@
|
|||
#define ICONITEM_H
|
||||
|
||||
#include <QIcon>
|
||||
#include <QQuickItem>
|
||||
#include <QPixmap>
|
||||
#include <QPointer>
|
||||
#include <QVariant>
|
||||
#include <QQuickItem>
|
||||
#include <QTimer>
|
||||
#include <QVariant>
|
||||
|
||||
#include <plasma/svg.h>
|
||||
|
||||
|
@ -148,8 +148,7 @@ public:
|
|||
QSGNode *updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *updatePaintNodeData) override;
|
||||
|
||||
void itemChange(ItemChange change, const ItemChangeData &value) override;
|
||||
void geometryChanged(const QRectF &newGeometry,
|
||||
const QRectF &oldGeometry) override;
|
||||
void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) override;
|
||||
|
||||
void componentComplete() override;
|
||||
|
||||
|
|
|
@ -6,11 +6,8 @@
|
|||
|
||||
#include "quicktheme.h"
|
||||
|
||||
|
||||
|
||||
namespace Plasma
|
||||
{
|
||||
|
||||
QuickTheme::QuickTheme(QObject *parent)
|
||||
: Theme(parent)
|
||||
{
|
||||
|
@ -191,7 +188,6 @@ QColor QuickTheme::complementaryNegativeTextColor() const
|
|||
return Plasma::Theme::color(Plasma::Theme::TextColor, Plasma::Theme::ComplementaryColorGroup);
|
||||
}
|
||||
|
||||
|
||||
QColor QuickTheme::headerTextColor() const
|
||||
{
|
||||
return Plasma::Theme::color(Plasma::Theme::TextColor, Plasma::Theme::HeaderColorGroup);
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
|
||||
namespace Plasma
|
||||
{
|
||||
|
||||
/**
|
||||
* @class QuickTheme plasma/theme.h <Plasma/Theme>
|
||||
*
|
||||
|
@ -85,8 +84,6 @@ public:
|
|||
explicit QuickTheme(QObject *parent = nullptr);
|
||||
~QuickTheme();
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @return The theme's colorscheme's text color
|
||||
* @since 5.0
|
||||
|
@ -291,7 +288,6 @@ public:
|
|||
*/
|
||||
QColor complementaryNegativeTextColor() const;
|
||||
|
||||
|
||||
/**
|
||||
* @return The theme's colorscheme's text color of "header" areas
|
||||
* @since 5.0
|
||||
|
@ -347,4 +343,3 @@ Q_SIGNALS:
|
|||
} // Plasma namespace
|
||||
|
||||
#endif // multiple inclusion guard
|
||||
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
#include "serviceoperationstatus.h"
|
||||
|
||||
ServiceOperationStatus::ServiceOperationStatus(QObject *parent)
|
||||
: QObject(parent),
|
||||
m_enabled(false)
|
||||
: QObject(parent)
|
||||
, m_enabled(false)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -26,8 +26,7 @@ void ServiceOperationStatus::setService(Plasma::Service *service)
|
|||
disconnect(m_service.data(), nullptr, this, nullptr);
|
||||
}
|
||||
if (service) {
|
||||
connect(service, &Plasma::Service::operationEnabledChanged,
|
||||
this, &ServiceOperationStatus::updateStatus);
|
||||
connect(service, &Plasma::Service::operationEnabledChanged, this, &ServiceOperationStatus::updateStatus);
|
||||
}
|
||||
|
||||
m_service = service;
|
||||
|
@ -84,4 +83,3 @@ void ServiceOperationStatus::updateStatus()
|
|||
Q_EMIT enabledChanged();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -7,10 +7,10 @@
|
|||
|
||||
#include "svgitem.h"
|
||||
|
||||
#include <QQuickWindow>
|
||||
#include <QSGTexture>
|
||||
#include <QRectF>
|
||||
#include <QDebug>
|
||||
#include <QQuickWindow>
|
||||
#include <QRectF>
|
||||
#include <QSGTexture>
|
||||
|
||||
#include "plasma/svg.h"
|
||||
|
||||
|
@ -20,10 +20,9 @@
|
|||
|
||||
namespace Plasma
|
||||
{
|
||||
|
||||
SvgItem::SvgItem(QQuickItem *parent)
|
||||
: QQuickItem(parent),
|
||||
m_textureChanged(false)
|
||||
: QQuickItem(parent)
|
||||
, m_textureChanged(false)
|
||||
{
|
||||
setFlag(QQuickItem::ItemHasContents, true);
|
||||
connect(&Units::instance(), &Units::devicePixelRatioChanged, this, &SvgItem::updateDevicePixelRatio);
|
||||
|
@ -199,4 +198,3 @@ void SvgItem::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeomet
|
|||
}
|
||||
|
||||
} // Plasma namespace
|
||||
|
||||
|
|
|
@ -7,14 +7,13 @@
|
|||
#ifndef SVGITEM_P
|
||||
#define SVGITEM_P
|
||||
|
||||
#include <QQuickItem>
|
||||
#include <QImage>
|
||||
#include <QQuickItem>
|
||||
|
||||
#include "units.h"
|
||||
|
||||
namespace Plasma
|
||||
{
|
||||
|
||||
class Svg;
|
||||
|
||||
/**
|
||||
|
|
|
@ -9,26 +9,26 @@
|
|||
#include "tooltip.h"
|
||||
#include "tooltipdialog.h"
|
||||
|
||||
#include <QQmlEngine>
|
||||
#include <QDebug>
|
||||
#include <QQmlEngine>
|
||||
|
||||
#include "framesvgitem.h"
|
||||
#include <KWindowEffects>
|
||||
#include <KDirWatch>
|
||||
#include <KWindowEffects>
|
||||
|
||||
ToolTipDialog *ToolTip::s_dialog = nullptr;
|
||||
int ToolTip::s_dialogUsers = 0;
|
||||
|
||||
ToolTip::ToolTip(QQuickItem *parent)
|
||||
: QQuickItem(parent),
|
||||
m_tooltipsEnabledGlobally(false),
|
||||
m_containsMouse(false),
|
||||
m_location(Plasma::Types::Floating),
|
||||
m_textFormat(Qt::AutoText),
|
||||
m_active(true),
|
||||
m_interactive(false),
|
||||
m_timeout(4000),
|
||||
m_usingDialog(false)
|
||||
: QQuickItem(parent)
|
||||
, m_tooltipsEnabledGlobally(false)
|
||||
, m_containsMouse(false)
|
||||
, m_location(Plasma::Types::Floating)
|
||||
, m_textFormat(Qt::AutoText)
|
||||
, m_active(true)
|
||||
, m_interactive(false)
|
||||
, m_timeout(4000)
|
||||
, m_usingDialog(false)
|
||||
{
|
||||
setAcceptHoverEvents(true);
|
||||
setFiltersChildMouseEvents(true);
|
||||
|
|
|
@ -9,10 +9,10 @@
|
|||
#ifndef TOOLTIPOBJECT_H
|
||||
#define TOOLTIPOBJECT_H
|
||||
|
||||
#include <QQuickItem>
|
||||
#include <QPointer>
|
||||
#include <QVariant>
|
||||
#include <Plasma/Plasma>
|
||||
#include <QPointer>
|
||||
#include <QQuickItem>
|
||||
#include <QVariant>
|
||||
|
||||
class QQuickItem;
|
||||
class ToolTipDialog;
|
||||
|
@ -107,7 +107,8 @@ class ToolTip : public QQuickItem
|
|||
|
||||
/**
|
||||
* if interactive is false (default), the tooltip will automatically hide
|
||||
* itself as soon as the mouse leaves the tooltiparea, if is true, if the mouse leaves tooltiparea and goes over the tooltip itself, the tooltip won't hide, so it will be possible to interact with tooltip contents
|
||||
* itself as soon as the mouse leaves the tooltiparea, if is true, if the mouse leaves tooltiparea and goes over the tooltip itself, the tooltip won't hide,
|
||||
* so it will be possible to interact with tooltip contents
|
||||
*/
|
||||
Q_PROPERTY(bool interactive MEMBER m_interactive WRITE setInteractive NOTIFY interactiveChanged)
|
||||
|
||||
|
|
|
@ -6,20 +6,20 @@
|
|||
|
||||
#include "tooltipdialog.h"
|
||||
|
||||
#include <QQmlEngine>
|
||||
#include <QQuickItem>
|
||||
#include <QDebug>
|
||||
#include <QPlatformSurfaceEvent>
|
||||
#include <QQmlEngine>
|
||||
#include <QQuickItem>
|
||||
|
||||
#include <kdeclarative/qmlobjectsharedengine.h>
|
||||
#include <KWindowSystem>
|
||||
#include <kdeclarative/qmlobjectsharedengine.h>
|
||||
|
||||
ToolTipDialog::ToolTipDialog(QQuickItem *parent)
|
||||
: Dialog(parent),
|
||||
m_qmlObject(nullptr),
|
||||
m_hideTimeout(4000),
|
||||
m_interactive(false),
|
||||
m_owner(nullptr)
|
||||
: Dialog(parent)
|
||||
, m_qmlObject(nullptr)
|
||||
, m_hideTimeout(4000)
|
||||
, m_interactive(false)
|
||||
, m_owner(nullptr)
|
||||
{
|
||||
setLocation(Plasma::Types::Floating);
|
||||
setType(Dialog::WindowType::Tooltip);
|
||||
|
|
|
@ -9,8 +9,8 @@
|
|||
|
||||
#include "dialog.h"
|
||||
|
||||
#include <QTimer>
|
||||
#include <QQuickWindow>
|
||||
#include <QTimer>
|
||||
#include <QVariant>
|
||||
|
||||
class QQuickItem;
|
||||
|
|
|
@ -8,20 +8,19 @@
|
|||
|
||||
#include "units.h"
|
||||
|
||||
#include <QGuiApplication>
|
||||
#include <QDebug>
|
||||
#include <QtGlobal>
|
||||
#include <QFontMetrics>
|
||||
#include <QGuiApplication>
|
||||
#include <QQuickItem>
|
||||
#include <QQuickWindow>
|
||||
#include <QScreen>
|
||||
#include <QFontMetrics>
|
||||
#include <QtGlobal>
|
||||
#include <cmath>
|
||||
|
||||
#include <KIconLoader>
|
||||
|
||||
const int defaultLongDuration = 200;
|
||||
|
||||
|
||||
SharedAppFilter::SharedAppFilter(QObject *parent)
|
||||
: QObject(parent)
|
||||
{
|
||||
|
@ -29,7 +28,8 @@ SharedAppFilter::SharedAppFilter(QObject *parent)
|
|||
}
|
||||
|
||||
SharedAppFilter::~SharedAppFilter()
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
bool SharedAppFilter::eventFilter(QObject *watched, QEvent *event)
|
||||
{
|
||||
|
@ -44,12 +44,12 @@ bool SharedAppFilter::eventFilter(QObject *watched, QEvent *event)
|
|||
SharedAppFilter *Units::s_sharedAppFilter = nullptr;
|
||||
|
||||
Units::Units(QObject *parent)
|
||||
: QObject(parent),
|
||||
m_gridUnit(-1),
|
||||
m_devicePixelRatio(-1),
|
||||
m_smallSpacing(-1),
|
||||
m_largeSpacing(-1),
|
||||
m_longDuration(defaultLongDuration) // default base value for animations
|
||||
: QObject(parent)
|
||||
, m_gridUnit(-1)
|
||||
, m_devicePixelRatio(-1)
|
||||
, m_smallSpacing(-1)
|
||||
, m_largeSpacing(-1)
|
||||
, m_longDuration(defaultLongDuration) // default base value for animations
|
||||
{
|
||||
if (!s_sharedAppFilter) {
|
||||
s_sharedAppFilter = new SharedAppFilter();
|
||||
|
@ -64,8 +64,7 @@ Units::Units(QObject *parent)
|
|||
QObject::connect(s_sharedAppFilter, &SharedAppFilter::fontChanged, this, &Units::updateSpacing);
|
||||
|
||||
m_animationSpeedWatcher = KConfigWatcher::create(KSharedConfig::openConfig());
|
||||
connect(m_animationSpeedWatcher.data(), &KConfigWatcher::configChanged, this,
|
||||
[this](const KConfigGroup &group, const QByteArrayList &names) {
|
||||
connect(m_animationSpeedWatcher.data(), &KConfigWatcher::configChanged, this, [this](const KConfigGroup &group, const QByteArrayList &names) {
|
||||
if (group.name() == QLatin1String("KDE") && names.contains(QByteArrayLiteral("AnimationDurationFactor"))) {
|
||||
updateAnimationSpeed();
|
||||
}
|
||||
|
@ -75,7 +74,6 @@ Units::Units(QObject *parent)
|
|||
|
||||
Units::~Units()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
Units &Units::instance()
|
||||
|
@ -105,7 +103,6 @@ void Units::updateAnimationSpeed()
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
void Units::iconLoaderSettingsChanged()
|
||||
{
|
||||
m_iconSizes->insert(QStringLiteral("desktop"), devicePixelIconSize(KIconLoader::global()->currentSize(KIconLoader::Desktop)));
|
||||
|
@ -272,4 +269,3 @@ int Units::veryLongDuration() const
|
|||
}
|
||||
|
||||
#include "moc_units.cpp"
|
||||
|
||||
|
|
|
@ -249,4 +249,3 @@ private:
|
|||
};
|
||||
|
||||
#endif // UNITS_H
|
||||
|
||||
|
|
|
@ -19,8 +19,7 @@
|
|||
#include <xcb/composite.h>
|
||||
#if HAVE_GLX
|
||||
#include <GL/glx.h>
|
||||
typedef void (*glXBindTexImageEXT_func)(Display *dpy, GLXDrawable drawable,
|
||||
int buffer, const int *attrib_list);
|
||||
typedef void (*glXBindTexImageEXT_func)(Display *dpy, GLXDrawable drawable, int buffer, const int *attrib_list);
|
||||
typedef void (*glXReleaseTexImageEXT_func)(Display *dpy, GLXDrawable drawable, int buffer);
|
||||
#endif
|
||||
#if HAVE_EGL
|
||||
|
@ -34,17 +33,14 @@ typedef GLvoid(*glEGLImageTargetTexture2DOES_func)(GLenum, GLeglImageOES);
|
|||
|
||||
namespace Plasma
|
||||
{
|
||||
|
||||
#if HAVE_XCB_COMPOSITE
|
||||
#if HAVE_GLX
|
||||
class DiscardGlxPixmapRunnable : public QRunnable {
|
||||
class DiscardGlxPixmapRunnable : public QRunnable
|
||||
{
|
||||
public:
|
||||
DiscardGlxPixmapRunnable(
|
||||
uint,
|
||||
QFunctionPointer,
|
||||
xcb_pixmap_t
|
||||
);
|
||||
DiscardGlxPixmapRunnable(uint, QFunctionPointer, xcb_pixmap_t);
|
||||
void run() override;
|
||||
|
||||
private:
|
||||
uint m_texture;
|
||||
QFunctionPointer m_releaseTexImage;
|
||||
|
@ -52,11 +48,12 @@ private:
|
|||
};
|
||||
|
||||
DiscardGlxPixmapRunnable::DiscardGlxPixmapRunnable(uint texture, QFunctionPointer deleteFunction, xcb_pixmap_t pixmap)
|
||||
: QRunnable(),
|
||||
m_texture(texture),
|
||||
m_releaseTexImage(deleteFunction),
|
||||
m_glxPixmap(pixmap)
|
||||
{}
|
||||
: QRunnable()
|
||||
, m_texture(texture)
|
||||
, m_releaseTexImage(deleteFunction)
|
||||
, m_glxPixmap(pixmap)
|
||||
{
|
||||
}
|
||||
|
||||
void DiscardGlxPixmapRunnable::run()
|
||||
{
|
||||
|
@ -70,14 +67,12 @@ void DiscardGlxPixmapRunnable::run()
|
|||
#endif // HAVE_GLX
|
||||
|
||||
#if HAVE_EGL
|
||||
class DiscardEglPixmapRunnable : public QRunnable {
|
||||
class DiscardEglPixmapRunnable : public QRunnable
|
||||
{
|
||||
public:
|
||||
DiscardEglPixmapRunnable(
|
||||
uint,
|
||||
QFunctionPointer,
|
||||
EGLImageKHR
|
||||
);
|
||||
DiscardEglPixmapRunnable(uint, QFunctionPointer, EGLImageKHR);
|
||||
void run() override;
|
||||
|
||||
private:
|
||||
uint m_texture;
|
||||
QFunctionPointer m_eglDestroyImageKHR;
|
||||
|
@ -85,11 +80,12 @@ private:
|
|||
};
|
||||
|
||||
DiscardEglPixmapRunnable::DiscardEglPixmapRunnable(uint texture, QFunctionPointer deleteFunction, EGLImageKHR image)
|
||||
: QRunnable(),
|
||||
m_texture(texture),
|
||||
m_eglDestroyImageKHR(deleteFunction),
|
||||
m_image(image)
|
||||
{}
|
||||
: QRunnable()
|
||||
, m_texture(texture)
|
||||
, m_eglDestroyImageKHR(deleteFunction)
|
||||
, m_image(image)
|
||||
{
|
||||
}
|
||||
|
||||
void DiscardEglPixmapRunnable::run()
|
||||
{
|
||||
|
@ -231,10 +227,7 @@ void WindowThumbnail::releaseResources()
|
|||
// but the pointer is held by the WindowThumbnail which is in the main thread
|
||||
#if HAVE_GLX
|
||||
if (m_glxPixmap != XCB_PIXMAP_NONE) {
|
||||
window()->scheduleRenderJob(new DiscardGlxPixmapRunnable(m_texture,
|
||||
m_releaseTexImage,
|
||||
m_glxPixmap),
|
||||
m_renderStage);
|
||||
window()->scheduleRenderJob(new DiscardGlxPixmapRunnable(m_texture, m_releaseTexImage, m_glxPixmap), m_renderStage);
|
||||
|
||||
m_glxPixmap = XCB_PIXMAP_NONE;
|
||||
m_texture = 0;
|
||||
|
@ -242,10 +235,7 @@ void WindowThumbnail::releaseResources()
|
|||
#endif
|
||||
#if HAVE_EGL
|
||||
if (m_image != EGL_NO_IMAGE_KHR) {
|
||||
window()->scheduleRenderJob(new DiscardEglPixmapRunnable(m_texture,
|
||||
m_eglDestroyImageKHR,
|
||||
m_image),
|
||||
m_renderStage);
|
||||
window()->scheduleRenderJob(new DiscardEglPixmapRunnable(m_texture, m_eglDestroyImageKHR, m_image), m_renderStage);
|
||||
|
||||
m_image = EGL_NO_IMAGE_KHR;
|
||||
m_texture = 0;
|
||||
|
@ -254,8 +244,6 @@ void WindowThumbnail::releaseResources()
|
|||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
uint32_t WindowThumbnail::winId() const
|
||||
{
|
||||
return m_winId;
|
||||
|
@ -434,13 +422,9 @@ bool WindowThumbnail::xcbWindowToTextureEGL(WindowTextureNode *textureNode)
|
|||
xcb_connection_t *c = QX11Info::connection();
|
||||
auto geometryCookie = xcb_get_geometry_unchecked(c, m_pixmap);
|
||||
|
||||
const EGLint attribs[] = {
|
||||
EGL_IMAGE_PRESERVED_KHR, EGL_TRUE,
|
||||
EGL_NONE
|
||||
};
|
||||
m_image = ((eglCreateImageKHR_func)(m_eglCreateImageKHR))(eglGetCurrentDisplay(), EGL_NO_CONTEXT,
|
||||
EGL_NATIVE_PIXMAP_KHR,
|
||||
(EGLClientBuffer)m_pixmap, attribs);
|
||||
const EGLint attribs[] = {EGL_IMAGE_PRESERVED_KHR, EGL_TRUE, EGL_NONE};
|
||||
m_image = ((eglCreateImageKHR_func)(
|
||||
m_eglCreateImageKHR))(eglGetCurrentDisplay(), EGL_NO_CONTEXT, EGL_NATIVE_PIXMAP_KHR, (EGLClientBuffer)m_pixmap, attribs);
|
||||
|
||||
if (m_image == EGL_NO_IMAGE_KHR) {
|
||||
qDebug() << "failed to create egl image";
|
||||
|
@ -471,9 +455,8 @@ void WindowThumbnail::resolveEGLFunctions()
|
|||
}
|
||||
auto *context = window()->openglContext();
|
||||
QList<QByteArray> extensions = QByteArray(eglQueryString(display, EGL_EXTENSIONS)).split(' ');
|
||||
if (extensions.contains(QByteArrayLiteral("EGL_KHR_image")) ||
|
||||
(extensions.contains(QByteArrayLiteral("EGL_KHR_image_base")) &&
|
||||
extensions.contains(QByteArrayLiteral("EGL_KHR_image_pixmap")))) {
|
||||
if (extensions.contains(QByteArrayLiteral("EGL_KHR_image"))
|
||||
|| (extensions.contains(QByteArrayLiteral("EGL_KHR_image_base")) && extensions.contains(QByteArrayLiteral("EGL_KHR_image_pixmap")))) {
|
||||
if (context->hasExtension(QByteArrayLiteral("GL_OES_EGL_image"))) {
|
||||
qDebug() << "Have EGL texture from pixmap";
|
||||
m_eglCreateImageKHR = context->getProcAddress(QByteArrayLiteral("eglCreateImageKHR"));
|
||||
|
@ -572,20 +555,18 @@ void WindowThumbnail::bindGLXTexture()
|
|||
resetDamaged();
|
||||
}
|
||||
|
||||
struct FbConfigInfo
|
||||
{
|
||||
struct FbConfigInfo {
|
||||
GLXFBConfig fbConfig;
|
||||
int textureFormat;
|
||||
};
|
||||
|
||||
struct GlxGlobalData
|
||||
struct GlxGlobalData {
|
||||
GlxGlobalData()
|
||||
{
|
||||
GlxGlobalData() {
|
||||
xcb_connection_t *const conn = QX11Info::connection();
|
||||
|
||||
// Fetch the render pict formats
|
||||
reply = xcb_render_query_pict_formats_reply(conn,
|
||||
xcb_render_query_pict_formats_unchecked(conn), nullptr);
|
||||
reply = xcb_render_query_pict_formats_reply(conn, xcb_render_query_pict_formats_unchecked(conn), nullptr);
|
||||
|
||||
// Init the visual ID -> format ID hash table
|
||||
for (auto screens = xcb_render_query_pict_formats_screens_iterator(reply); screens.rem; xcb_render_pictscreen_next(&screens)) {
|
||||
|
@ -621,7 +602,8 @@ struct GlxGlobalData
|
|||
}
|
||||
}
|
||||
|
||||
~GlxGlobalData() {
|
||||
~GlxGlobalData()
|
||||
{
|
||||
qDeleteAll(visualFbConfigHash);
|
||||
std::free(reply);
|
||||
}
|
||||
|
@ -672,22 +654,33 @@ FbConfigInfo *getConfig(xcb_visualid_t visual)
|
|||
|
||||
const auto rgb_sizes = std::tie(red_bits, green_bits, blue_bits);
|
||||
|
||||
const int attribs[] = {
|
||||
GLX_RENDER_TYPE, GLX_RGBA_BIT,
|
||||
GLX_DRAWABLE_TYPE, GLX_WINDOW_BIT | GLX_PIXMAP_BIT,
|
||||
GLX_X_VISUAL_TYPE, GLX_TRUE_COLOR,
|
||||
GLX_X_RENDERABLE, True,
|
||||
GLX_CONFIG_CAVEAT, int(GLX_DONT_CARE), // The ARGB32 visual is marked non-conformant in Catalyst
|
||||
GLX_FRAMEBUFFER_SRGB_CAPABLE_EXT, int(GLX_DONT_CARE),
|
||||
GLX_BUFFER_SIZE, red_bits + green_bits + blue_bits + alpha_bits,
|
||||
GLX_RED_SIZE, red_bits,
|
||||
GLX_GREEN_SIZE, green_bits,
|
||||
GLX_BLUE_SIZE, blue_bits,
|
||||
GLX_ALPHA_SIZE, alpha_bits,
|
||||
GLX_STENCIL_SIZE, 0,
|
||||
GLX_DEPTH_SIZE, 0,
|
||||
0
|
||||
};
|
||||
const int attribs[] = {GLX_RENDER_TYPE,
|
||||
GLX_RGBA_BIT,
|
||||
GLX_DRAWABLE_TYPE,
|
||||
GLX_WINDOW_BIT | GLX_PIXMAP_BIT,
|
||||
GLX_X_VISUAL_TYPE,
|
||||
GLX_TRUE_COLOR,
|
||||
GLX_X_RENDERABLE,
|
||||
True,
|
||||
GLX_CONFIG_CAVEAT,
|
||||
int(GLX_DONT_CARE), // The ARGB32 visual is marked non-conformant in Catalyst
|
||||
GLX_FRAMEBUFFER_SRGB_CAPABLE_EXT,
|
||||
int(GLX_DONT_CARE),
|
||||
GLX_BUFFER_SIZE,
|
||||
red_bits + green_bits + blue_bits + alpha_bits,
|
||||
GLX_RED_SIZE,
|
||||
red_bits,
|
||||
GLX_GREEN_SIZE,
|
||||
green_bits,
|
||||
GLX_BLUE_SIZE,
|
||||
blue_bits,
|
||||
GLX_ALPHA_SIZE,
|
||||
alpha_bits,
|
||||
GLX_STENCIL_SIZE,
|
||||
0,
|
||||
GLX_DEPTH_SIZE,
|
||||
0,
|
||||
0};
|
||||
|
||||
if (QByteArray((char *)glGetString(GL_RENDERER)).contains("llvmpipe")) {
|
||||
return nullptr;
|
||||
|
@ -772,7 +765,6 @@ FbConfigInfo *getConfig(xcb_visualid_t visual)
|
|||
info->textureFormat = candidate.format;
|
||||
}
|
||||
|
||||
|
||||
return info;
|
||||
}
|
||||
|
||||
|
@ -801,12 +793,7 @@ bool WindowThumbnail::loadGLXTexture()
|
|||
|
||||
glGenTextures(1, &m_texture);
|
||||
|
||||
const int attrs[] = {
|
||||
GLX_TEXTURE_FORMAT_EXT, info->textureFormat,
|
||||
GLX_MIPMAP_TEXTURE_EXT, false,
|
||||
GLX_TEXTURE_TARGET_EXT, GLX_TEXTURE_2D_EXT,
|
||||
XCB_NONE
|
||||
};
|
||||
const int attrs[] = {GLX_TEXTURE_FORMAT_EXT, info->textureFormat, GLX_MIPMAP_TEXTURE_EXT, false, GLX_TEXTURE_TARGET_EXT, GLX_TEXTURE_2D_EXT, XCB_NONE};
|
||||
|
||||
m_glxPixmap = glXCreatePixmap(QX11Info::display(), info->fbConfig, m_pixmap, attrs);
|
||||
|
||||
|
@ -891,8 +878,6 @@ bool WindowThumbnail::startRedirecting()
|
|||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
void WindowThumbnail::setThumbnailAvailable(bool thumbnailAvailable)
|
||||
{
|
||||
if (m_thumbnailAvailable != thumbnailAvailable) {
|
||||
|
|
|
@ -12,9 +12,9 @@
|
|||
|
||||
// Qt
|
||||
#include <QAbstractNativeEventFilter>
|
||||
#include <QSGSimpleTextureNode>
|
||||
#include <QQuickItem>
|
||||
#include <QPointer>
|
||||
#include <QQuickItem>
|
||||
#include <QSGSimpleTextureNode>
|
||||
#include <QWindow>
|
||||
// xcb
|
||||
#if HAVE_XCB_COMPOSITE
|
||||
|
@ -32,7 +32,6 @@ class KWindowInfo;
|
|||
|
||||
namespace Plasma
|
||||
{
|
||||
|
||||
class WindowTextureNode;
|
||||
|
||||
/**
|
||||
|
@ -152,6 +151,7 @@ public:
|
|||
WindowTextureNode();
|
||||
virtual ~WindowTextureNode();
|
||||
void reset(QSGTexture *texture);
|
||||
|
||||
private:
|
||||
QScopedPointer<QSGTexture> m_texture;
|
||||
};
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
|
||||
#include "plasmacomponentsplugin.h"
|
||||
|
||||
#include <QQmlEngine>
|
||||
#include <QQmlContext>
|
||||
#include <QQmlEngine>
|
||||
#include <QQuickItem>
|
||||
|
||||
#include "qrangemodel.h"
|
||||
|
@ -50,8 +50,7 @@ QQmlEngine *EngineBookKeeping::engine() const
|
|||
|
||||
void EngineBookKeeping::insertEngine(QQmlEngine *engine)
|
||||
{
|
||||
connect(engine, &QObject::destroyed,
|
||||
this, &EngineBookKeeping::engineDestroyed);
|
||||
connect(engine, &QObject::destroyed, this, &EngineBookKeeping::engineDestroyed);
|
||||
m_engines.insert(engine);
|
||||
}
|
||||
|
||||
|
@ -81,4 +80,3 @@ void PlasmaComponentsPlugin::registerTypes(const char *uri)
|
|||
}
|
||||
|
||||
#include "moc_plasmacomponentsplugin.cpp"
|
||||
|
||||
|
|
|
@ -8,8 +8,8 @@
|
|||
|
||||
#include <QApplication>
|
||||
#include <QDebug>
|
||||
#include <QQuickWindow>
|
||||
#include <QQuickItem>
|
||||
#include <QQuickWindow>
|
||||
#include <QScreen>
|
||||
#include <QTimer>
|
||||
#include <QVersionNumber>
|
||||
|
@ -18,10 +18,10 @@
|
|||
|
||||
#include "plasmacomponentsplugin.h"
|
||||
QMenuProxy::QMenuProxy(QObject *parent)
|
||||
: QObject(parent),
|
||||
m_menu(nullptr),
|
||||
m_status(DialogStatus::Closed),
|
||||
m_placement(Plasma::Types::LeftPosedTopAlignedPopup)
|
||||
: QObject(parent)
|
||||
, m_menu(nullptr)
|
||||
, m_status(DialogStatus::Closed)
|
||||
, m_placement(Plasma::Types::LeftPosedTopAlignedPopup)
|
||||
{
|
||||
if (qobject_cast<QApplication *>(QCoreApplication::instance())) {
|
||||
m_menu = new QMenu(nullptr);
|
||||
|
@ -275,7 +275,6 @@ void QMenuProxy::itemTriggered(QAction *action)
|
|||
Q_EMIT triggeredIndex(i);
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -469,5 +468,3 @@ void QMenuProxy::close()
|
|||
{
|
||||
m_menu->hide();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -7,13 +7,13 @@
|
|||
#ifndef QMENU_PROXY_H
|
||||
#define QMENU_PROXY_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QMenu>
|
||||
#include <QPointer>
|
||||
#include <QQmlListProperty>
|
||||
#include "qmenuitem.h"
|
||||
#include "enums.h"
|
||||
#include "plasma.h"
|
||||
#include "qmenuitem.h"
|
||||
#include <QMenu>
|
||||
#include <QObject>
|
||||
#include <QPointer>
|
||||
#include <QQmlListProperty>
|
||||
|
||||
class QDeclarativeItem;
|
||||
|
||||
|
@ -66,7 +66,8 @@ class QMenuProxy : public QObject
|
|||
Q_PROPERTY(QWindow *transientParent READ transientParent WRITE setTransientParent NOTIFY transientParentChanged)
|
||||
|
||||
/**
|
||||
* the visualParent is used to position the menu. it can be an item on the scene, like a button (that will open the menu on clicked) or another menuitem (in this case this will be a submenu)
|
||||
* the visualParent is used to position the menu. it can be an item on the scene, like a button (that will open the menu on clicked) or another menuitem (in
|
||||
* this case this will be a submenu)
|
||||
*/
|
||||
Q_PROPERTY(QObject *visualParent READ visualParent WRITE setVisualParent NOTIFY visualParentChanged())
|
||||
Q_PROPERTY(DialogStatus::Status status READ status NOTIFY statusChanged)
|
||||
|
@ -182,4 +183,3 @@ private:
|
|||
};
|
||||
|
||||
#endif // QMENU_PROXY_H
|
||||
|
||||
|
|
|
@ -8,9 +8,9 @@
|
|||
#include "qmenuitem.h"
|
||||
|
||||
QMenuItem::QMenuItem(QQuickItem *parent)
|
||||
: QQuickItem(parent),
|
||||
m_action(nullptr),
|
||||
m_section(false)
|
||||
: QQuickItem(parent)
|
||||
, m_action(nullptr)
|
||||
, m_section(false)
|
||||
{
|
||||
setAction(new QAction(this));
|
||||
}
|
||||
|
@ -141,6 +141,3 @@ void QMenuItem::updateAction()
|
|||
m_action->setVisible(isVisible());
|
||||
m_action->setEnabled(isEnabled());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -73,4 +73,3 @@ private:
|
|||
};
|
||||
|
||||
#endif // QMENUITEM_H
|
||||
|
||||
|
|
|
@ -33,7 +33,6 @@
|
|||
|
||||
namespace Plasma
|
||||
{
|
||||
|
||||
QRangeModelPrivate::QRangeModelPrivate(QRangeModel *qq)
|
||||
: q_ptr(qq)
|
||||
{
|
||||
|
@ -157,7 +156,8 @@ void QRangeModelPrivate::emitValueAndPositionIfChanged(const qreal oldValue, con
|
|||
*/
|
||||
|
||||
QRangeModel::QRangeModel(QObject *parent)
|
||||
: QObject(parent), d_ptr(new QRangeModelPrivate(this))
|
||||
: QObject(parent)
|
||||
, d_ptr(new QRangeModelPrivate(this))
|
||||
{
|
||||
Q_D(QRangeModel);
|
||||
d->init();
|
||||
|
@ -169,7 +169,8 @@ QRangeModel::QRangeModel(QObject *parent)
|
|||
*/
|
||||
|
||||
QRangeModel::QRangeModel(QRangeModelPrivate &dd, QObject *parent)
|
||||
: QObject(parent), d_ptr(&dd)
|
||||
: QObject(parent)
|
||||
, d_ptr(&dd)
|
||||
{
|
||||
Q_D(QRangeModel);
|
||||
d->init();
|
||||
|
@ -518,4 +519,3 @@ void QRangeModel::toMaximum()
|
|||
}
|
||||
|
||||
} // Plasma namespace
|
||||
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
|
||||
namespace Plasma
|
||||
{
|
||||
|
||||
class QRangeModelPrivate;
|
||||
|
||||
class QRangeModel : public QObject
|
||||
|
@ -86,7 +85,6 @@ protected:
|
|||
private:
|
||||
Q_DISABLE_COPY(QRangeModel)
|
||||
Q_DECLARE_PRIVATE(QRangeModel)
|
||||
|
||||
};
|
||||
|
||||
} // Plasma namespace
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
|
||||
namespace Plasma
|
||||
{
|
||||
|
||||
class QRangeModelPrivate
|
||||
{
|
||||
Q_DECLARE_PUBLIC(QRangeModel)
|
||||
|
|
|
@ -30,4 +30,3 @@ QImage AppBackgroundProvider::requestImage(const QString &id, QSize *size, const
|
|||
Q_UNUSED(requestedSize)
|
||||
return QImage(m_theme->backgroundPath(id % QStringLiteral(".png")));
|
||||
}
|
||||
|
||||
|
|
|
@ -21,11 +21,11 @@ class Theme;
|
|||
*/
|
||||
class AppBackgroundProvider : public QQuickImageProvider
|
||||
{
|
||||
|
||||
public:
|
||||
AppBackgroundProvider();
|
||||
~AppBackgroundProvider() override;
|
||||
QImage requestImage(const QString &id, QSize *size, const QSize &requestedSize) override;
|
||||
|
||||
private:
|
||||
Plasma::Theme *m_theme;
|
||||
};
|
||||
|
|
|
@ -61,7 +61,6 @@ QString FallbackComponent::filePath(const QString &key)
|
|||
if (tmpPath.isAbsolute()) {
|
||||
resolved = m_basePath + path + key;
|
||||
} else {
|
||||
|
||||
resolved = QStandardPaths::locate(QStandardPaths::GenericDataLocation, m_basePath + QLatin1Char('/') + path + key);
|
||||
}
|
||||
|
||||
|
@ -73,4 +72,3 @@ QString FallbackComponent::filePath(const QString &key)
|
|||
|
||||
return resolved;
|
||||
}
|
||||
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
#ifndef FALLBACKCOMPONENT_H
|
||||
#define FALLBACKCOMPONENT_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QCache>
|
||||
#include <QObject>
|
||||
#include <QStringList>
|
||||
|
||||
/**
|
||||
|
|
|
@ -9,8 +9,8 @@
|
|||
#include "appbackgroundprovider_p.h"
|
||||
#include "fallbackcomponent.h"
|
||||
|
||||
#include <QtQml>
|
||||
#include <QQmlEngine>
|
||||
#include <QtQml>
|
||||
|
||||
// #include <KSharedConfig>
|
||||
// #include <KConfigGroup>
|
||||
|
@ -26,5 +26,3 @@ void PlasmaExtraComponentsPlugin::registerTypes(const char *uri)
|
|||
Q_ASSERT(uri == QByteArray("org.kde.plasma.extras"));
|
||||
qmlRegisterType<FallbackComponent>(uri, 2, 0, "FallbackComponent");
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -9,21 +9,15 @@
|
|||
|
||||
#include "utils/d_ptr_implementation.h"
|
||||
|
||||
#include <QDebug>
|
||||
#include <QCoreApplication>
|
||||
#include <QDebug>
|
||||
|
||||
Application::Private::Private(Application *parent)
|
||||
: running(false)
|
||||
, q(parent)
|
||||
{
|
||||
connect(
|
||||
&process, &QProcess::stateChanged,
|
||||
this, &Private::stateChanged
|
||||
);
|
||||
connect(
|
||||
&process, SIGNAL(error(QProcess::ProcessError)),
|
||||
this, SLOT(errorFound(QProcess::ProcessError))
|
||||
);
|
||||
connect(&process, &QProcess::stateChanged, this, &Private::stateChanged);
|
||||
connect(&process, SIGNAL(error(QProcess::ProcessError)), this, SLOT(errorFound(QProcess::ProcessError)));
|
||||
process.setProcessChannelMode(QProcess::MergedChannels);
|
||||
}
|
||||
|
||||
|
@ -41,7 +35,8 @@ void Application::Private::errorFound(QProcess::ProcessError err)
|
|||
}
|
||||
|
||||
Application::Application(QObject *parent)
|
||||
: QObject(parent), d(this)
|
||||
: QObject(parent)
|
||||
, d(this)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -107,4 +102,3 @@ void Application::terminate()
|
|||
{
|
||||
d->process.terminate();
|
||||
}
|
||||
|
||||
|
|
|
@ -62,4 +62,3 @@ private:
|
|||
};
|
||||
|
||||
#endif /* APPLICATION_H */
|
||||
|
||||
|
|
|
@ -30,4 +30,3 @@ private:
|
|||
};
|
||||
|
||||
#endif /* APPLICATION_P_H */
|
||||
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
class IconDialog::Private
|
||||
{
|
||||
public:
|
||||
|
||||
utils::SharedSingleton<KIconDialog> dialog;
|
||||
};
|
||||
|
||||
|
@ -56,4 +55,3 @@ void IconDialog::closeDialog()
|
|||
IconDialog::~IconDialog()
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -44,4 +44,3 @@ private:
|
|||
};
|
||||
|
||||
#endif /* ICONDIALOG_H */
|
||||
|
||||
|
|
|
@ -4,9 +4,9 @@
|
|||
SPDX-License-Identifier: GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#include <QtQml>
|
||||
#include <QQmlExtensionPlugin>
|
||||
#include <QDebug>
|
||||
#include <QQmlExtensionPlugin>
|
||||
#include <QtQml>
|
||||
|
||||
#include "application.h"
|
||||
#include "icondialog.h"
|
||||
|
@ -22,14 +22,13 @@ public:
|
|||
{
|
||||
}
|
||||
|
||||
void registerTypes(const char *uri) override {
|
||||
void registerTypes(const char *uri) override
|
||||
{
|
||||
Q_ASSERT(QLatin1String(uri) == QLatin1String("org.kde.plasma.platformcomponents"));
|
||||
|
||||
qmlRegisterType<Application>(uri, 2, 0, "Application");
|
||||
qmlRegisterType<IconDialog>(uri, 2, 0, "IconDialog");
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
#include "platformextensionplugin.moc"
|
||||
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
|
||||
namespace utils
|
||||
{
|
||||
|
||||
template<typename T>
|
||||
class d_ptr
|
||||
{
|
||||
|
@ -32,7 +31,7 @@ public:
|
|||
#define D_PTR \
|
||||
class Private; \
|
||||
friend class Private; \
|
||||
const ::utils::d_ptr<Private> d \
|
||||
const ::utils::d_ptr<Private> d
|
||||
|
||||
} // namespace utils
|
||||
|
||||
|
|
|
@ -11,9 +11,9 @@
|
|||
|
||||
namespace utils
|
||||
{
|
||||
|
||||
template<typename T>
|
||||
d_ptr<T>::d_ptr() : d(new T())
|
||||
d_ptr<T>::d_ptr()
|
||||
: d(new T())
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -38,4 +38,3 @@ T *d_ptr<T>::operator->() const
|
|||
} // namespace utils
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
|
||||
namespace utils
|
||||
{
|
||||
|
||||
template<typename Target>
|
||||
class SharedSingleton
|
||||
{
|
||||
|
@ -45,4 +44,3 @@ std::weak_ptr<Target> SharedSingleton<Target>::s_instance;
|
|||
} // namespace utils
|
||||
|
||||
#endif /* SHARED_SINGLETON_P_H */
|
||||
|
||||
|
|
|
@ -15,38 +15,37 @@
|
|||
#include <cmath>
|
||||
#include <limits>
|
||||
|
||||
#include <QAbstractButton>
|
||||
#include <QFile>
|
||||
#include <QList>
|
||||
#include <QAbstractButton>
|
||||
#include <QMessageBox>
|
||||
#include <QMetaEnum>
|
||||
|
||||
#include <KActionCollection>
|
||||
#include <KAuthorized>
|
||||
#include <KColorScheme>
|
||||
#include <KConfigLoader>
|
||||
#include <KDesktopFile>
|
||||
#include <QDebug>
|
||||
#include <KGlobalAccel>
|
||||
#include <KLocalizedString>
|
||||
#include <KService>
|
||||
#include <KConfigLoader>
|
||||
#include <KWindowSystem>
|
||||
#include <QDebug>
|
||||
|
||||
#include "containment.h"
|
||||
#include "corona.h"
|
||||
#include "package.h"
|
||||
#include "plasma.h"
|
||||
#include "scripting/appletscript.h"
|
||||
#include "pluginloader.h"
|
||||
#include "scripting/appletscript.h"
|
||||
|
||||
#include "debug_p.h"
|
||||
#include "private/associatedapplicationmanager_p.h"
|
||||
#include "private/containment_p.h"
|
||||
#include "private/package_p.h"
|
||||
#include "debug_p.h"
|
||||
|
||||
namespace Plasma
|
||||
{
|
||||
|
||||
static KPluginMetaData appletMetadataForDirectory(const QString &path)
|
||||
{
|
||||
return QFile::exists(path + QLatin1String("/metadata.json"))
|
||||
|
@ -55,8 +54,8 @@ static KPluginMetaData appletMetadataForDirectory(const QString &path)
|
|||
}
|
||||
|
||||
Applet::Applet(const KPluginMetaData &info, QObject *parent, uint appletId)
|
||||
: QObject(parent),
|
||||
d(new AppletPrivate(info, appletId, this))
|
||||
: QObject(parent)
|
||||
, d(new AppletPrivate(info, appletId, this))
|
||||
{
|
||||
qCDebug(LOG_PLASMA) << " From KPluginMetaData, valid? " << info.isValid();
|
||||
// WARNING: do not access config() OR globalConfig() in this method!
|
||||
|
@ -71,8 +70,8 @@ Applet::Applet(const KPluginInfo &info, QObject *parent, uint appletId)
|
|||
}
|
||||
|
||||
Applet::Applet(QObject *parent, const QString &serviceID, uint appletId)
|
||||
: QObject(parent),
|
||||
d(new AppletPrivate(KPluginMetaData(serviceID), appletId, this))
|
||||
: QObject(parent)
|
||||
, d(new AppletPrivate(KPluginMetaData(serviceID), appletId, this))
|
||||
{
|
||||
// WARNING: do not access config() OR globalConfig() in this method!
|
||||
// that requires a scene, which is not available at this point
|
||||
|
@ -81,8 +80,8 @@ Applet::Applet(QObject *parent, const QString &serviceID, uint appletId)
|
|||
}
|
||||
|
||||
Applet::Applet(QObject *parentObject, const QVariantList &args)
|
||||
: QObject(nullptr),
|
||||
d(new AppletPrivate(KPluginMetaData(), args.count() > 2 ? args[2].toInt() : 0, this))
|
||||
: QObject(nullptr)
|
||||
, d(new AppletPrivate(KPluginMetaData(), args.count() > 2 ? args[2].toInt() : 0, this))
|
||||
{
|
||||
setParent(parentObject);
|
||||
if (!args.isEmpty()) {
|
||||
|
@ -113,8 +112,8 @@ Applet::Applet(QObject *parentObject, const QVariantList &args)
|
|||
}
|
||||
|
||||
Applet::Applet(const QString &packagePath, uint appletId)
|
||||
: QObject(nullptr),
|
||||
d(new AppletPrivate(appletMetadataForDirectory(packagePath), appletId, this))
|
||||
: QObject(nullptr)
|
||||
, d(new AppletPrivate(appletMetadataForDirectory(packagePath), appletId, this))
|
||||
{
|
||||
d->init(packagePath);
|
||||
d->setupPackage();
|
||||
|
@ -180,7 +179,6 @@ void Applet::save(KConfigGroup &g) const
|
|||
|
||||
void Applet::restore(KConfigGroup &group)
|
||||
{
|
||||
|
||||
setImmutability((Types::ImmutabilityType)group.readEntry("immutability", (int)Types::Mutable));
|
||||
|
||||
KConfigGroup shortcutConfig(&group, "Shortcuts");
|
||||
|
@ -202,9 +200,8 @@ void Applet::restore(KConfigGroup &group)
|
|||
// TODO: implement; the shortcut will need to be registered with the containment
|
||||
/*
|
||||
#include "accessmanager.h"
|
||||
#include "authorizationmanager.h"
|
||||
#include "private/plasmoidservice_p.h"
|
||||
#include "authorizationmanager.h"
|
||||
#include "authorizationmanager.h"
|
||||
shortcutText = shortcutConfig.readEntryUntranslated("local", QString());
|
||||
if (!shortcutText.isEmpty()) {
|
||||
//TODO: implement; the shortcut
|
||||
|
@ -424,8 +421,7 @@ void Applet::setBackgroundHints(Plasma::Types::BackgroundHints hint)
|
|||
|
||||
Plasma::Types::BackgroundHints Applet::effectiveBackgroundHints() const
|
||||
{
|
||||
if (d->userBackgroundHintsInitialized
|
||||
&& (d->backgroundHints & Plasma::Types::ConfigurableBackground)) {
|
||||
if (d->userBackgroundHintsInitialized && (d->backgroundHints & Plasma::Types::ConfigurableBackground)) {
|
||||
return d->userBackgroundHints;
|
||||
} else {
|
||||
return d->backgroundHints;
|
||||
|
@ -458,7 +454,6 @@ void Applet::setUserBackgroundHints(Plasma::Types::BackgroundHints hint)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
KPluginInfo Applet::pluginInfo() const
|
||||
{
|
||||
return KPluginInfo(d->appletDescription);
|
||||
|
@ -611,7 +606,6 @@ void Applet::flushPendingConstraintsEvents()
|
|||
|
||||
QAction *configAction = d->actions->action(QStringLiteral("configure"));
|
||||
if (configAction) {
|
||||
|
||||
if (d->hasConfigurationInterface) {
|
||||
bool canConfig = unlocked || KAuthorized::authorize(QStringLiteral("plasma/allow_configure_when_locked"));
|
||||
configAction->setVisible(canConfig);
|
||||
|
@ -742,8 +736,7 @@ void Applet::setGlobalShortcut(const QKeySequence &shortcut)
|
|||
d->activationAction->setText(i18n("Activate %1 Widget", title()));
|
||||
d->activationAction->setObjectName(QStringLiteral("activate widget %1").arg(id())); // NO I18N
|
||||
connect(d->activationAction, &QAction::triggered, this, &Applet::activated);
|
||||
connect(d->activationAction, SIGNAL(changed()),
|
||||
this, SLOT(globalShortcutChanged()));
|
||||
connect(d->activationAction, SIGNAL(changed()), this, SLOT(globalShortcutChanged()));
|
||||
} else if (d->activationAction->shortcut() == shortcut) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -9,16 +9,16 @@
|
|||
#ifndef PLASMA_APPLET_H
|
||||
#define PLASMA_APPLET_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QKeySequence>
|
||||
#include <QObject>
|
||||
#include <QUrl>
|
||||
|
||||
#include <KConfigGroup>
|
||||
#include <KPluginInfo>
|
||||
|
||||
#include <plasma/framesvg.h>
|
||||
#include <plasma/plasma.h>
|
||||
#include <plasma/version.h>
|
||||
#include <plasma/framesvg.h>
|
||||
|
||||
#include <KPackage/Package>
|
||||
|
||||
|
@ -27,7 +27,6 @@ class KConfigLoader;
|
|||
|
||||
namespace Plasma
|
||||
{
|
||||
|
||||
class AppletPrivate;
|
||||
class Containment;
|
||||
class DataEngine;
|
||||
|
@ -406,7 +405,8 @@ public:
|
|||
void setUserBackgroundHints(Plasma::Types::BackgroundHints hint);
|
||||
|
||||
/**
|
||||
* The effective background hints the applet will have: it will follow userBackgroundHints only if backgroundHints has the Plasma::Types::ConfigurableBackground flag set
|
||||
* The effective background hints the applet will have: it will follow userBackgroundHints only if backgroundHints has the
|
||||
* Plasma::Types::ConfigurableBackground flag set
|
||||
* @since 5.65
|
||||
*/
|
||||
Plasma::Types::BackgroundHints effectiveBackgroundHints() const;
|
||||
|
|
|
@ -13,23 +13,23 @@
|
|||
#include "config-plasma.h"
|
||||
|
||||
#include <QClipboard>
|
||||
#include <QContextMenuEvent>
|
||||
#include <QDebug>
|
||||
#include <QFile>
|
||||
#include <QContextMenuEvent>
|
||||
#include <QMimeData>
|
||||
#include <QMimeDatabase>
|
||||
#include <QPainter>
|
||||
#include <QTemporaryFile>
|
||||
#include <QMimeDatabase>
|
||||
|
||||
#include <KAuthorized>
|
||||
#include <KLocalizedString>
|
||||
#include <KConfigSkeleton>
|
||||
#include <KConfigLoader>
|
||||
#include <KConfigSkeleton>
|
||||
#include <KLocalizedString>
|
||||
|
||||
#include "containmentactions.h"
|
||||
#include "corona.h"
|
||||
#include "pluginloader.h"
|
||||
#include "debug_p.h"
|
||||
#include "pluginloader.h"
|
||||
|
||||
#include "private/applet_p.h"
|
||||
|
||||
|
@ -37,12 +37,9 @@
|
|||
|
||||
namespace Plasma
|
||||
{
|
||||
|
||||
Containment::Containment(QObject *parent,
|
||||
const QString &serviceId,
|
||||
uint containmentId)
|
||||
: Applet(parent, serviceId, containmentId),
|
||||
d(new ContainmentPrivate(this))
|
||||
Containment::Containment(QObject *parent, const QString &serviceId, uint containmentId)
|
||||
: Applet(parent, serviceId, containmentId)
|
||||
, d(new ContainmentPrivate(this))
|
||||
{
|
||||
// WARNING: do not access config() OR globalConfig() in this method!
|
||||
// that requires a scene, which is not available at this point
|
||||
|
@ -51,8 +48,8 @@ Containment::Containment(QObject *parent,
|
|||
}
|
||||
|
||||
Containment::Containment(QObject *parent, const QVariantList &args)
|
||||
: Applet(parent, args),
|
||||
d(new ContainmentPrivate(this))
|
||||
: Applet(parent, args)
|
||||
, d(new ContainmentPrivate(this))
|
||||
{
|
||||
// WARNING: do not access config() OR globalConfig() in this method!
|
||||
// that requires a scene, which is not available at this point
|
||||
|
@ -60,8 +57,8 @@ Containment::Containment(QObject *parent, const QVariantList &args)
|
|||
}
|
||||
|
||||
Containment::Containment(const KPluginMetaData &md, uint appletId)
|
||||
: Applet(md, nullptr, appletId),
|
||||
d(new ContainmentPrivate(this))
|
||||
: Applet(md, nullptr, appletId)
|
||||
, d(new ContainmentPrivate(this))
|
||||
{
|
||||
// WARNING: do not access config() OR globalConfig() in this method!
|
||||
// that requires a scene, which is not available at this point
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
|
||||
namespace Plasma
|
||||
{
|
||||
|
||||
class DataEngine;
|
||||
class Package;
|
||||
class Corona;
|
||||
|
@ -56,9 +55,7 @@ public:
|
|||
* @param containmentId a unique id used to differentiate between multiple
|
||||
* instances of the same Applet type
|
||||
*/
|
||||
explicit Containment(QObject *parent = nullptr,
|
||||
const QString &serviceId = QString(),
|
||||
uint containmentId = 0);
|
||||
explicit Containment(QObject *parent = nullptr, const QString &serviceId = QString(), uint containmentId = 0);
|
||||
|
||||
/**
|
||||
* This constructor is to be used with the plugin loading systems
|
||||
|
|
|
@ -7,22 +7,21 @@
|
|||
#include "containmentactions.h"
|
||||
#include "containment.h"
|
||||
|
||||
#include "private/containmentactions_p.h"
|
||||
#include "private/containment_p.h"
|
||||
#include "private/containmentactions_p.h"
|
||||
|
||||
#include <QContextMenuEvent>
|
||||
#include <QMetaEnum>
|
||||
#include <QMouseEvent>
|
||||
#include <QWheelEvent>
|
||||
#include <QContextMenuEvent>
|
||||
|
||||
#include <QDebug>
|
||||
#include <KLocalizedString>
|
||||
#include <QDebug>
|
||||
|
||||
#include "version.h"
|
||||
|
||||
namespace Plasma
|
||||
{
|
||||
|
||||
ContainmentActions::ContainmentActions(QObject *parentObject)
|
||||
: d(new ContainmentActionsPrivate({}, this))
|
||||
{
|
||||
|
|
|
@ -19,7 +19,6 @@ class KPluginMetaData;
|
|||
|
||||
namespace Plasma
|
||||
{
|
||||
|
||||
class DataEngine;
|
||||
class Containment;
|
||||
class ContainmentActionsPrivate;
|
||||
|
|
|
@ -13,32 +13,31 @@
|
|||
#include <QGuiApplication>
|
||||
#include <QMimeData>
|
||||
#include <QPainter>
|
||||
#include <QTimer>
|
||||
#include <QScreen>
|
||||
#include <QTimer>
|
||||
|
||||
#include <cmath>
|
||||
|
||||
#include <QDebug>
|
||||
#include <KLocalizedString>
|
||||
#include <KWindowSystem>
|
||||
#include <QDebug>
|
||||
|
||||
#include "containment.h"
|
||||
#include "pluginloader.h"
|
||||
#include "debug_p.h"
|
||||
#include "packagestructure.h"
|
||||
#include "pluginloader.h"
|
||||
#include "private/applet_p.h"
|
||||
#include "private/containment_p.h"
|
||||
#include "private/package_p.h"
|
||||
#include "private/timetracker.h"
|
||||
#include "debug_p.h"
|
||||
|
||||
using namespace Plasma;
|
||||
|
||||
namespace Plasma
|
||||
{
|
||||
|
||||
Corona::Corona(QObject *parent)
|
||||
: QObject(parent),
|
||||
d(new CoronaPrivate(this))
|
||||
: QObject(parent)
|
||||
, d(new CoronaPrivate(this))
|
||||
{
|
||||
#ifndef NDEBUG
|
||||
// qCDebug(LOG_PLASMA) << "!!{} STARTUP TIME" << QTime().msecsTo(QTime::currentTime()) << "Corona ctor start";
|
||||
|
@ -181,9 +180,8 @@ QList<Plasma::Containment *> Corona::importLayout(const KConfigGroup &conf)
|
|||
Containment *Corona::containmentForScreen(int screen) const
|
||||
{
|
||||
for (Containment *containment : qAsConst(d->containments)) {
|
||||
if (containment->screen() == screen &&
|
||||
(containment->containmentType() == Plasma::Types::DesktopContainment ||
|
||||
containment->containmentType() == Plasma::Types::CustomContainment)) {
|
||||
if (containment->screen() == screen
|
||||
&& (containment->containmentType() == Plasma::Types::DesktopContainment || containment->containmentType() == Plasma::Types::CustomContainment)) {
|
||||
return containment;
|
||||
}
|
||||
}
|
||||
|
@ -191,23 +189,18 @@ Containment *Corona::containmentForScreen(int screen) const
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
Containment *Corona::containmentForScreen(int screen,
|
||||
const QString &defaultPluginIfNonExistent, const QVariantList &defaultArgs)
|
||||
Containment *Corona::containmentForScreen(int screen, const QString &defaultPluginIfNonExistent, const QVariantList &defaultArgs)
|
||||
{
|
||||
return containmentForScreen(screen, QString(), defaultPluginIfNonExistent, defaultArgs);
|
||||
}
|
||||
|
||||
Containment *Corona::containmentForScreen(int screen,
|
||||
const QString &activity,
|
||||
const QString &defaultPluginIfNonExistent, const QVariantList &defaultArgs)
|
||||
Containment *Corona::containmentForScreen(int screen, const QString &activity, const QString &defaultPluginIfNonExistent, const QVariantList &defaultArgs)
|
||||
{
|
||||
Containment *containment = nullptr;
|
||||
|
||||
for (Containment *cont : qAsConst(d->containments)) {
|
||||
if (cont->lastScreen() == screen &&
|
||||
(cont->activity().isEmpty() || cont->activity() == activity) &&
|
||||
(cont->containmentType() == Plasma::Types::DesktopContainment ||
|
||||
cont->containmentType() == Plasma::Types::CustomContainment)) {
|
||||
if (cont->lastScreen() == screen && (cont->activity().isEmpty() || cont->activity() == activity)
|
||||
&& (cont->containmentType() == Plasma::Types::DesktopContainment || cont->containmentType() == Plasma::Types::CustomContainment)) {
|
||||
containment = cont;
|
||||
}
|
||||
}
|
||||
|
@ -237,12 +230,10 @@ QList<Containment *> Corona::containmentsForActivity(const QString &activity)
|
|||
return conts;
|
||||
}
|
||||
|
||||
std::copy_if(d->containments.begin(),
|
||||
d->containments.end(),
|
||||
std::back_inserter(conts),
|
||||
[activity](Containment *cont) { return cont->activity() == activity &&
|
||||
(cont->containmentType() == Plasma::Types::DesktopContainment ||
|
||||
cont->containmentType() == Plasma::Types::CustomContainment);} );
|
||||
std::copy_if(d->containments.begin(), d->containments.end(), std::back_inserter(conts), [activity](Containment *cont) {
|
||||
return cont->activity() == activity
|
||||
&& (cont->containmentType() == Plasma::Types::DesktopContainment || cont->containmentType() == Plasma::Types::CustomContainment);
|
||||
});
|
||||
|
||||
return conts;
|
||||
}
|
||||
|
@ -255,12 +246,10 @@ QList<Containment *> Corona::containmentsForScreen(int screen)
|
|||
return conts;
|
||||
}
|
||||
|
||||
std::copy_if(d->containments.begin(),
|
||||
d->containments.end(),
|
||||
std::back_inserter(conts),
|
||||
[screen](Containment *cont) { return cont->lastScreen() == screen &&
|
||||
(cont->containmentType() == Plasma::Types::DesktopContainment ||
|
||||
cont->containmentType() == Plasma::Types::CustomContainment);} );
|
||||
std::copy_if(d->containments.begin(), d->containments.end(), std::back_inserter(conts), [screen](Containment *cont) {
|
||||
return cont->lastScreen() == screen
|
||||
&& (cont->containmentType() == Plasma::Types::DesktopContainment || cont->containmentType() == Plasma::Types::CustomContainment);
|
||||
});
|
||||
|
||||
return conts;
|
||||
}
|
||||
|
@ -421,13 +410,11 @@ bool Corona::isEditMode() const
|
|||
QList<Plasma::Types::Location> Corona::freeEdges(int screen) const
|
||||
{
|
||||
QList<Plasma::Types::Location> freeEdges;
|
||||
freeEdges << Plasma::Types::TopEdge << Plasma::Types::BottomEdge
|
||||
<< Plasma::Types::LeftEdge << Plasma::Types::RightEdge;
|
||||
freeEdges << Plasma::Types::TopEdge << Plasma::Types::BottomEdge << Plasma::Types::LeftEdge << Plasma::Types::RightEdge;
|
||||
|
||||
const auto containments = this->containments();
|
||||
for (Containment *containment : containments) {
|
||||
if (containment->screen() == screen &&
|
||||
freeEdges.contains(containment->location())) {
|
||||
if (containment->screen() == screen && freeEdges.contains(containment->location())) {
|
||||
freeEdges.removeAll(containment->location());
|
||||
}
|
||||
}
|
||||
|
@ -441,12 +428,12 @@ KActionCollection *Corona::actions() const
|
|||
}
|
||||
|
||||
CoronaPrivate::CoronaPrivate(Corona *corona)
|
||||
: q(corona),
|
||||
immutability(Types::Mutable),
|
||||
config(nullptr),
|
||||
configSyncTimer(new QTimer(corona)),
|
||||
actions(corona),
|
||||
containmentsStarting(0)
|
||||
: q(corona)
|
||||
, immutability(Types::Mutable)
|
||||
, config(nullptr)
|
||||
, configSyncTimer(new QTimer(corona))
|
||||
, actions(corona)
|
||||
, containmentsStarting(0)
|
||||
{
|
||||
// TODO: make Package path configurable
|
||||
|
||||
|
@ -607,12 +594,9 @@ Containment *CoronaPrivate::addContainment(const QString &name, const QVariantLi
|
|||
});
|
||||
containments.insert(position, containment);
|
||||
|
||||
QObject::connect(containment, SIGNAL(destroyed(QObject*)),
|
||||
q, SLOT(containmentDestroyed(QObject*)));
|
||||
QObject::connect(containment, &Applet::configNeedsSaving,
|
||||
q, &Corona::requestConfigSync);
|
||||
QObject::connect(containment, &Containment::screenChanged,
|
||||
q, &Corona::screenOwnerChanged);
|
||||
QObject::connect(containment, SIGNAL(destroyed(QObject *)), q, SLOT(containmentDestroyed(QObject *)));
|
||||
QObject::connect(containment, &Applet::configNeedsSaving, q, &Corona::requestConfigSync);
|
||||
QObject::connect(containment, &Containment::screenChanged, q, &Corona::screenOwnerChanged);
|
||||
|
||||
if (!delayedInit) {
|
||||
containment->init();
|
||||
|
@ -673,7 +657,8 @@ QList<Plasma::Containment *> CoronaPrivate::importLayout(const KConfigGroup &con
|
|||
|
||||
// qCDebug(LOG_PLASMA) << "got a containment in the config, trying to make a" << containmentConfig.readEntry("plugin", QString()) << "from" << group;
|
||||
#ifndef NDEBUG
|
||||
// qCDebug(LOG_PLASMA) << "!!{} STARTUP TIME" << QTime().msecsTo(QTime::currentTime()) << "Adding Containment" << containmentConfig.readEntry("plugin", QString());
|
||||
// qCDebug(LOG_PLASMA) << "!!{} STARTUP TIME" << QTime().msecsTo(QTime::currentTime()) << "Adding Containment" << containmentConfig.readEntry("plugin",
|
||||
// QString());
|
||||
#endif
|
||||
Containment *c = addContainment(containmentConfig.readEntry("plugin", QString()), QVariantList(), cid, -1);
|
||||
if (!c) {
|
||||
|
@ -701,7 +686,9 @@ void CoronaPrivate::notifyContainmentsReady()
|
|||
for (Containment *containment : qAsConst(containments)) {
|
||||
if (!containment->isUiReady() && containment->screen() >= 0) {
|
||||
++containmentsStarting;
|
||||
QObject::connect(containment, &Plasma::Containment::uiReadyChanged, q, [this](bool ready) { containmentReady(ready); } );
|
||||
QObject::connect(containment, &Plasma::Containment::uiReadyChanged, q, [this](bool ready) {
|
||||
containmentReady(ready);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -17,7 +17,6 @@ class QAction;
|
|||
|
||||
namespace Plasma
|
||||
{
|
||||
|
||||
class CoronaPrivate;
|
||||
|
||||
/**
|
||||
|
@ -125,10 +124,8 @@ public:
|
|||
* @param defaultArgs optional arguments to pass in when creating a Containment if needed
|
||||
* @since 5.45
|
||||
*/
|
||||
Containment *containmentForScreen(int screen,
|
||||
const QString &activity,
|
||||
const QString &defaultPluginIfNonExistent,
|
||||
const QVariantList &defaultArgs = QVariantList());
|
||||
Containment *
|
||||
containmentForScreen(int screen, const QString &activity, const QString &defaultPluginIfNonExistent, const QVariantList &defaultArgs = QVariantList());
|
||||
|
||||
// TODO KF6: add activity here, can't be done now as the overload would get confused
|
||||
#if PLASMA_ENABLE_DEPRECATED_SINCE(5, 46)
|
||||
|
@ -154,9 +151,7 @@ public:
|
|||
* @deprecated Since 5.46, use containmentForScreen(int, const QString &, const QString &, const QVariantList &)
|
||||
*/
|
||||
PLASMA_DEPRECATED_VERSION(5, 46, "Use Corona::containmentForScreen(int, const QString &, const QString &, const QVariantList &)")
|
||||
Containment *containmentForScreen(int screen,
|
||||
const QString &defaultPluginIfNonExistent,
|
||||
const QVariantList &defaultArgs = QVariantList());
|
||||
Containment *containmentForScreen(int screen, const QString &defaultPluginIfNonExistent, const QVariantList &defaultArgs = QVariantList());
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
@ -429,8 +424,8 @@ protected:
|
|||
* or successfully loaded.
|
||||
* @see addContainment
|
||||
**/
|
||||
Containment *createContainmentDelayed(const QString &name,
|
||||
const QVariantList &args = QVariantList());
|
||||
Containment *createContainmentDelayed(const QString &name, const QVariantList &args = QVariantList());
|
||||
|
||||
private:
|
||||
CoronaPrivate *const d;
|
||||
|
||||
|
@ -446,4 +441,3 @@ private:
|
|||
} // namespace Plasma
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -7,20 +7,18 @@
|
|||
#include "private/datacontainer_p.h"
|
||||
#include "private/storage_p.h"
|
||||
|
||||
#include <QDebug>
|
||||
#include <QAbstractItemModel>
|
||||
#include <QDebug>
|
||||
#include <QRandomGenerator>
|
||||
|
||||
#include "plasma.h"
|
||||
#include "debug_p.h"
|
||||
|
||||
#include "plasma.h"
|
||||
|
||||
namespace Plasma
|
||||
{
|
||||
|
||||
DataContainer::DataContainer(QObject *parent)
|
||||
: QObject(parent),
|
||||
d(new DataContainerPrivate(this))
|
||||
: QObject(parent)
|
||||
, d(new DataContainerPrivate(this))
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -93,8 +91,7 @@ bool DataContainer::visualizationIsConnected(QObject *visualization) const
|
|||
return d->relayObjects.contains(visualization);
|
||||
}
|
||||
|
||||
void DataContainer::connectVisualization(QObject *visualization, uint pollingInterval,
|
||||
Plasma::Types::IntervalAlignment alignment)
|
||||
void DataContainer::connectVisualization(QObject *visualization, uint pollingInterval, Plasma::Types::IntervalAlignment alignment)
|
||||
{
|
||||
// qCDebug(LOG_PLASMA) << "connecting visualization" <<this<< visualization << "at interval of"
|
||||
// << pollingInterval << "to" << objectName();
|
||||
|
@ -119,13 +116,14 @@ void DataContainer::connectVisualization(QObject *visualization, uint pollingInt
|
|||
delete relay;
|
||||
} else {
|
||||
if (visualization->metaObject()->indexOfSlot("dataUpdated(QString,Plasma::DataEngine::Data)") >= 0) {
|
||||
disconnect(relay, SIGNAL(dataUpdated(QString,Plasma::DataEngine::Data)),
|
||||
visualization, SLOT(dataUpdated(QString,Plasma::DataEngine::Data)));
|
||||
disconnect(relay,
|
||||
SIGNAL(dataUpdated(QString, Plasma::DataEngine::Data)),
|
||||
visualization,
|
||||
SLOT(dataUpdated(QString, Plasma::DataEngine::Data)));
|
||||
}
|
||||
// modelChanged is always emitted by the dataSource since there is no polling there
|
||||
if (visualization->metaObject()->indexOfSlot("modelChanged(QString,QAbstractItemModel*)") >= 0) {
|
||||
disconnect(this, SIGNAL(modelChanged(QString,QAbstractItemModel*)),
|
||||
visualization, SLOT(modelChanged(QString,QAbstractItemModel*)));
|
||||
disconnect(this, SIGNAL(modelChanged(QString, QAbstractItemModel *)), visualization, SLOT(modelChanged(QString, QAbstractItemModel *)));
|
||||
}
|
||||
// relay->isUnused();
|
||||
}
|
||||
|
@ -137,29 +135,24 @@ void DataContainer::connectVisualization(QObject *visualization, uint pollingInt
|
|||
return;
|
||||
} else {
|
||||
if (visualization->metaObject()->indexOfSlot("dataUpdated(QString,Plasma::DataEngine::Data)") >= 0) {
|
||||
disconnect(this, SIGNAL(dataUpdated(QString,Plasma::DataEngine::Data)),
|
||||
visualization, SLOT(dataUpdated(QString,Plasma::DataEngine::Data)));
|
||||
disconnect(this, SIGNAL(dataUpdated(QString, Plasma::DataEngine::Data)), visualization, SLOT(dataUpdated(QString, Plasma::DataEngine::Data)));
|
||||
}
|
||||
if (visualization->metaObject()->indexOfSlot("modelChanged(QString,QAbstractItemModel*)") >= 0) {
|
||||
disconnect(this, SIGNAL(modelChanged(QString,QAbstractItemModel*)),
|
||||
visualization, SLOT(modelChanged(QString,QAbstractItemModel*)));
|
||||
disconnect(this, SIGNAL(modelChanged(QString, QAbstractItemModel *)), visualization, SLOT(modelChanged(QString, QAbstractItemModel *)));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
connect(visualization, &QObject::destroyed,
|
||||
this, &DataContainer::disconnectVisualization); //, Qt::QueuedConnection);
|
||||
connect(visualization, &QObject::destroyed, this, &DataContainer::disconnectVisualization); //, Qt::QueuedConnection);
|
||||
}
|
||||
|
||||
if (pollingInterval < 1) {
|
||||
// qCDebug(LOG_PLASMA) << " connecting directly";
|
||||
d->relayObjects[visualization] = nullptr;
|
||||
if (visualization->metaObject()->indexOfSlot("dataUpdated(QString,Plasma::DataEngine::Data)") >= 0) {
|
||||
connect(this, SIGNAL(dataUpdated(QString,Plasma::DataEngine::Data)),
|
||||
visualization, SLOT(dataUpdated(QString,Plasma::DataEngine::Data)));
|
||||
connect(this, SIGNAL(dataUpdated(QString, Plasma::DataEngine::Data)), visualization, SLOT(dataUpdated(QString, Plasma::DataEngine::Data)));
|
||||
}
|
||||
if (visualization->metaObject()->indexOfSlot("modelChanged(QString,QAbstractItemModel*)") >= 0) {
|
||||
connect(this, SIGNAL(modelChanged(QString,QAbstractItemModel*)),
|
||||
visualization, SLOT(modelChanged(QString,QAbstractItemModel*)));
|
||||
connect(this, SIGNAL(modelChanged(QString, QAbstractItemModel *)), visualization, SLOT(modelChanged(QString, QAbstractItemModel *)));
|
||||
}
|
||||
} else {
|
||||
// qCDebug(LOG_PLASMA) << " connecting to a relay";
|
||||
|
@ -167,16 +160,13 @@ void DataContainer::connectVisualization(QObject *visualization, uint pollingInt
|
|||
// if it is the first visualization, then the source will already have been populated
|
||||
// engine's sourceRequested method
|
||||
bool immediateUpdate = connected || d->relayObjects.count() > 1;
|
||||
SignalRelay *relay = d->signalRelay(this, visualization, pollingInterval,
|
||||
alignment, immediateUpdate);
|
||||
SignalRelay *relay = d->signalRelay(this, visualization, pollingInterval, alignment, immediateUpdate);
|
||||
if (visualization->metaObject()->indexOfSlot("dataUpdated(QString,Plasma::DataEngine::Data)") >= 0) {
|
||||
connect(relay, SIGNAL(dataUpdated(QString,Plasma::DataEngine::Data)),
|
||||
visualization, SLOT(dataUpdated(QString,Plasma::DataEngine::Data)));
|
||||
connect(relay, SIGNAL(dataUpdated(QString, Plasma::DataEngine::Data)), visualization, SLOT(dataUpdated(QString, Plasma::DataEngine::Data)));
|
||||
}
|
||||
// modelChanged is always emitted by the dataSource since there is no polling there
|
||||
if (visualization->metaObject()->indexOfSlot("modelChanged(QString,QAbstractItemModel*)") >= 0) {
|
||||
connect(this, SIGNAL(modelChanged(QString,QAbstractItemModel*)),
|
||||
visualization, SLOT(modelChanged(QString,QAbstractItemModel*)));
|
||||
connect(this, SIGNAL(modelChanged(QString, QAbstractItemModel *)), visualization, SLOT(modelChanged(QString, QAbstractItemModel *)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -266,8 +256,7 @@ void DataContainerPrivate::retrieve()
|
|||
QVariantMap retrieveGroup = storage->operationDescription(QStringLiteral("retrieve"));
|
||||
retrieveGroup[QStringLiteral("group")] = q->objectName();
|
||||
ServiceJob *retrieveJob = storage->startOperationCall(retrieveGroup);
|
||||
QObject::connect(retrieveJob, SIGNAL(result(KJob*)), q,
|
||||
SLOT(populateFromStoredData(KJob*)));
|
||||
QObject::connect(retrieveJob, SIGNAL(result(KJob *)), q, SLOT(populateFromStoredData(KJob *)));
|
||||
}
|
||||
|
||||
void DataContainerPrivate::populateFromStoredData(KJob *job)
|
||||
|
@ -298,18 +287,15 @@ void DataContainerPrivate::populateFromStoredData(KJob *job)
|
|||
void DataContainer::disconnectVisualization(QObject *visualization)
|
||||
{
|
||||
QMap<QObject *, SignalRelay *>::iterator objIt = d->relayObjects.find(visualization);
|
||||
disconnect(visualization, &QObject::destroyed,
|
||||
this, &DataContainer::disconnectVisualization); //, Qt::QueuedConnection);
|
||||
disconnect(visualization, &QObject::destroyed, this, &DataContainer::disconnectVisualization); //, Qt::QueuedConnection);
|
||||
|
||||
if (objIt == d->relayObjects.end() || !objIt.value()) {
|
||||
// it is connected directly to the DataContainer itself
|
||||
if (visualization->metaObject()->indexOfSlot("dataUpdated(QString,Plasma::DataEngine::Data)") >= 0) {
|
||||
disconnect(this, SIGNAL(dataUpdated(QString,Plasma::DataEngine::Data)),
|
||||
visualization, SLOT(dataUpdated(QString,Plasma::DataEngine::Data)));
|
||||
disconnect(this, SIGNAL(dataUpdated(QString, Plasma::DataEngine::Data)), visualization, SLOT(dataUpdated(QString, Plasma::DataEngine::Data)));
|
||||
}
|
||||
if (visualization->metaObject()->indexOfSlot("modelChanged(QString,QAbstractItemModel*)") >= 0) {
|
||||
disconnect(this, SIGNAL(modelChanged(QString,QAbstractItemModel*)),
|
||||
visualization, SLOT(modelChanged(QString,QAbstractItemModel*)));
|
||||
disconnect(this, SIGNAL(modelChanged(QString, QAbstractItemModel *)), visualization, SLOT(modelChanged(QString, QAbstractItemModel *)));
|
||||
}
|
||||
} else {
|
||||
SignalRelay *relay = objIt.value();
|
||||
|
@ -319,13 +305,11 @@ void DataContainer::disconnectVisualization(QObject *visualization)
|
|||
delete relay;
|
||||
} else {
|
||||
if (visualization->metaObject()->indexOfSlot("dataUpdated(QString,Plasma::DataEngine::Data)") >= 0) {
|
||||
disconnect(relay, SIGNAL(dataUpdated(QString,Plasma::DataEngine::Data)),
|
||||
visualization, SLOT(dataUpdated(QString,Plasma::DataEngine::Data)));
|
||||
disconnect(relay, SIGNAL(dataUpdated(QString, Plasma::DataEngine::Data)), visualization, SLOT(dataUpdated(QString, Plasma::DataEngine::Data)));
|
||||
}
|
||||
// modelChanged is always emitted by the dataSource since there is no polling there
|
||||
if (visualization->metaObject()->indexOfSlot("modelChanged(QString,QAbstractItemModel*)") >= 0) {
|
||||
disconnect(this, SIGNAL(modelChanged(QString,QAbstractItemModel*)),
|
||||
visualization, SLOT(modelChanged(QString,QAbstractItemModel*)));
|
||||
disconnect(this, SIGNAL(modelChanged(QString, QAbstractItemModel *)), visualization, SLOT(modelChanged(QString, QAbstractItemModel *)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -374,8 +358,7 @@ void DataContainer::setNeedsUpdate(bool update)
|
|||
|
||||
bool DataContainer::isUsed() const
|
||||
{
|
||||
return !d->relays.isEmpty() ||
|
||||
receivers(SIGNAL(dataUpdated(QString,Plasma::DataEngine::Data))) > 0;
|
||||
return !d->relays.isEmpty() || receivers(SIGNAL(dataUpdated(QString, Plasma::DataEngine::Data))) > 0;
|
||||
}
|
||||
|
||||
void DataContainerPrivate::checkUsage()
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user