Apply the astyle-kdelibs script
This commit is contained in:
parent
c2aa81e2d4
commit
72ba7b4146
@ -206,7 +206,5 @@ void ConfigLoaderTest::ulongLongDefaultValue()
|
|||||||
QVERIFY(typeItem->isEqual(Q_UINT64_C(9223372036854775806)));
|
QVERIFY(typeItem->isEqual(Q_UINT64_C(9223372036854775806)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QTEST_MAIN(ConfigLoaderTest)
|
QTEST_MAIN(ConfigLoaderTest)
|
||||||
|
|
||||||
|
|
||||||
|
@ -45,7 +45,6 @@
|
|||||||
#include <QtCore/QList>
|
#include <QtCore/QList>
|
||||||
#include <QtCore/QTimer>
|
#include <QtCore/QTimer>
|
||||||
|
|
||||||
|
|
||||||
DynamicTreeModel::DynamicTreeModel(QObject *parent)
|
DynamicTreeModel::DynamicTreeModel(QObject *parent)
|
||||||
: QAbstractItemModel(parent),
|
: QAbstractItemModel(parent),
|
||||||
nextId(1)
|
nextId(1)
|
||||||
@ -57,9 +56,9 @@ QModelIndex DynamicTreeModel::index(int row, int column, const QModelIndex &pare
|
|||||||
// if (column != 0)
|
// if (column != 0)
|
||||||
// return QModelIndex();
|
// return QModelIndex();
|
||||||
|
|
||||||
|
if (column < 0 || row < 0) {
|
||||||
if ( column < 0 || row < 0 )
|
|
||||||
return QModelIndex();
|
return QModelIndex();
|
||||||
|
}
|
||||||
|
|
||||||
QList<QList<qint64> > childIdColumns = m_childItems.value(parent.internalId());
|
QList<QList<qint64> > childIdColumns = m_childItems.value(parent.internalId());
|
||||||
|
|
||||||
@ -71,16 +70,19 @@ QModelIndex DynamicTreeModel::index(int row, int column, const QModelIndex &pare
|
|||||||
Q_ASSERT(parent.row() < parentSiblings.size());
|
Q_ASSERT(parent.row() < parentSiblings.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (childIdColumns.size() == 0)
|
if (childIdColumns.size() == 0) {
|
||||||
return QModelIndex();
|
return QModelIndex();
|
||||||
|
}
|
||||||
|
|
||||||
if (column >= childIdColumns.size())
|
if (column >= childIdColumns.size()) {
|
||||||
return QModelIndex();
|
return QModelIndex();
|
||||||
|
}
|
||||||
|
|
||||||
QList<qint64> rowIds = childIdColumns.at(column);
|
QList<qint64> rowIds = childIdColumns.at(column);
|
||||||
|
|
||||||
if ( row >= rowIds.size())
|
if (row >= rowIds.size()) {
|
||||||
return QModelIndex();
|
return QModelIndex();
|
||||||
|
}
|
||||||
|
|
||||||
qint64 id = rowIds.at(row);
|
qint64 id = rowIds.at(row);
|
||||||
|
|
||||||
@ -90,19 +92,17 @@ QModelIndex DynamicTreeModel::index(int row, int column, const QModelIndex &pare
|
|||||||
|
|
||||||
qint64 DynamicTreeModel::findParentId(qint64 searchId) const
|
qint64 DynamicTreeModel::findParentId(qint64 searchId) const
|
||||||
{
|
{
|
||||||
if (searchId <= 0)
|
if (searchId <= 0) {
|
||||||
return -1;
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
QHashIterator<qint64, QList<QList<qint64> > > i(m_childItems);
|
QHashIterator<qint64, QList<QList<qint64> > > i(m_childItems);
|
||||||
while (i.hasNext())
|
while (i.hasNext()) {
|
||||||
{
|
|
||||||
i.next();
|
i.next();
|
||||||
QListIterator<QList<qint64> > j(i.value());
|
QListIterator<QList<qint64> > j(i.value());
|
||||||
while (j.hasNext())
|
while (j.hasNext()) {
|
||||||
{
|
|
||||||
QList<qint64> l = j.next();
|
QList<qint64> l = j.next();
|
||||||
if (l.contains(searchId))
|
if (l.contains(searchId)) {
|
||||||
{
|
|
||||||
return i.key();
|
return i.key();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -112,18 +112,21 @@ qint64 DynamicTreeModel::findParentId(qint64 searchId) const
|
|||||||
|
|
||||||
QModelIndex DynamicTreeModel::parent(const QModelIndex &index) const
|
QModelIndex DynamicTreeModel::parent(const QModelIndex &index) const
|
||||||
{
|
{
|
||||||
if (!index.isValid())
|
if (!index.isValid()) {
|
||||||
return QModelIndex();
|
return QModelIndex();
|
||||||
|
}
|
||||||
|
|
||||||
qint64 searchId = index.internalId();
|
qint64 searchId = index.internalId();
|
||||||
qint64 parentId = findParentId(searchId);
|
qint64 parentId = findParentId(searchId);
|
||||||
// Will never happen for valid index, but what the hey...
|
// Will never happen for valid index, but what the hey...
|
||||||
if (parentId <= 0)
|
if (parentId <= 0) {
|
||||||
return QModelIndex();
|
return QModelIndex();
|
||||||
|
}
|
||||||
|
|
||||||
qint64 grandParentId = findParentId(parentId);
|
qint64 grandParentId = findParentId(parentId);
|
||||||
if (grandParentId < 0)
|
if (grandParentId < 0) {
|
||||||
grandParentId = 0;
|
grandParentId = 0;
|
||||||
|
}
|
||||||
|
|
||||||
int column = 0;
|
int column = 0;
|
||||||
QList<qint64> childList = m_childItems.value(grandParentId).at(column);
|
QList<qint64> childList = m_childItems.value(grandParentId).at(column);
|
||||||
@ -138,11 +141,13 @@ int DynamicTreeModel::rowCount(const QModelIndex &index ) const
|
|||||||
{
|
{
|
||||||
QList<QList<qint64> > cols = m_childItems.value(index.internalId());
|
QList<QList<qint64> > cols = m_childItems.value(index.internalId());
|
||||||
|
|
||||||
if (cols.size() == 0 )
|
if (cols.size() == 0) {
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (index.column() > 0)
|
if (index.column() > 0) {
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
return cols.at(0).size();
|
return cols.at(0).size();
|
||||||
}
|
}
|
||||||
@ -155,11 +160,11 @@ int DynamicTreeModel::columnCount(const QModelIndex &index ) const
|
|||||||
|
|
||||||
QVariant DynamicTreeModel::data(const QModelIndex &index, int role) const
|
QVariant DynamicTreeModel::data(const QModelIndex &index, int role) const
|
||||||
{
|
{
|
||||||
if (!index.isValid())
|
if (!index.isValid()) {
|
||||||
return QVariant();
|
return QVariant();
|
||||||
|
}
|
||||||
|
|
||||||
if (Qt::DisplayRole == role)
|
if (Qt::DisplayRole == role) {
|
||||||
{
|
|
||||||
return m_items.value(index.internalId());
|
return m_items.value(index.internalId());
|
||||||
}
|
}
|
||||||
return QVariant();
|
return QVariant();
|
||||||
@ -174,7 +179,6 @@ void DynamicTreeModel::clear()
|
|||||||
endResetModel();
|
endResetModel();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ModelChangeCommand::ModelChangeCommand(DynamicTreeModel *model, QObject *parent)
|
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)
|
||||||
{
|
{
|
||||||
@ -186,8 +190,7 @@ QModelIndex ModelChangeCommand::findIndex(QList<int> rows)
|
|||||||
const int col = 0;
|
const int col = 0;
|
||||||
QModelIndex parent = QModelIndex();
|
QModelIndex parent = QModelIndex();
|
||||||
QListIterator<int> i(rows);
|
QListIterator<int> i(rows);
|
||||||
while (i.hasNext())
|
while (i.hasNext()) {
|
||||||
{
|
|
||||||
parent = m_model->index(i.next(), col, parent);
|
parent = m_model->index(i.next(), col, parent);
|
||||||
Q_ASSERT(parent.isValid());
|
Q_ASSERT(parent.isValid());
|
||||||
}
|
}
|
||||||
@ -205,12 +208,9 @@ void ModelInsertCommand::doCommand()
|
|||||||
QModelIndex parent = findIndex(m_rowNumbers);
|
QModelIndex parent = findIndex(m_rowNumbers);
|
||||||
m_model->beginInsertRows(parent, m_startRow, m_endRow);
|
m_model->beginInsertRows(parent, m_startRow, m_endRow);
|
||||||
qint64 parentId = parent.internalId();
|
qint64 parentId = parent.internalId();
|
||||||
for (int row = m_startRow; row <= m_endRow; row++)
|
for (int row = m_startRow; row <= m_endRow; row++) {
|
||||||
{
|
for (int col = 0; col < m_numCols; col++) {
|
||||||
for(int col = 0; col < m_numCols; col++ )
|
if (m_model->m_childItems[parentId].size() <= col) {
|
||||||
{
|
|
||||||
if (m_model->m_childItems[parentId].size() <= col)
|
|
||||||
{
|
|
||||||
m_model->m_childItems[parentId].append(QList<qint64>());
|
m_model->m_childItems[parentId].append(QList<qint64>());
|
||||||
}
|
}
|
||||||
// QString name = QUuid::createUuid().toString();
|
// QString name = QUuid::createUuid().toString();
|
||||||
@ -225,7 +225,6 @@ void ModelInsertCommand::doCommand()
|
|||||||
m_model->endInsertRows();
|
m_model->endInsertRows();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ModelMoveCommand::ModelMoveCommand(DynamicTreeModel *model, QObject *parent)
|
ModelMoveCommand::ModelMoveCommand(DynamicTreeModel *model, QObject *parent)
|
||||||
: ModelChangeCommand(model, parent)
|
: ModelChangeCommand(model, parent)
|
||||||
{
|
{
|
||||||
@ -241,32 +240,28 @@ void ModelMoveCommand::doCommand()
|
|||||||
QModelIndex srcParent = findIndex(m_rowNumbers);
|
QModelIndex srcParent = findIndex(m_rowNumbers);
|
||||||
QModelIndex destParent = findIndex(m_destRowNumbers);
|
QModelIndex destParent = findIndex(m_destRowNumbers);
|
||||||
|
|
||||||
if (!emitPreSignal(srcParent, m_startRow, m_endRow, destParent, m_destRow))
|
if (!emitPreSignal(srcParent, m_startRow, m_endRow, destParent, m_destRow)) {
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int column = 0; column < m_numCols; ++column)
|
for (int column = 0; column < m_numCols; ++column) {
|
||||||
{
|
|
||||||
QList<qint64> l = m_model->m_childItems.value(srcParent.internalId())[column].mid(m_startRow, m_endRow - m_startRow + 1);
|
QList<qint64> l = m_model->m_childItems.value(srcParent.internalId())[column].mid(m_startRow, m_endRow - m_startRow + 1);
|
||||||
|
|
||||||
for (int i = m_startRow; i <= m_endRow ; i++)
|
for (int i = m_startRow; i <= m_endRow; i++) {
|
||||||
{
|
|
||||||
m_model->m_childItems[srcParent.internalId()][column].removeAt(m_startRow);
|
m_model->m_childItems[srcParent.internalId()][column].removeAt(m_startRow);
|
||||||
}
|
}
|
||||||
int d;
|
int d;
|
||||||
if (m_destRow < m_startRow)
|
if (m_destRow < m_startRow) {
|
||||||
d = m_destRow;
|
d = m_destRow;
|
||||||
else
|
} else {
|
||||||
{
|
if (srcParent == destParent) {
|
||||||
if (srcParent == destParent)
|
|
||||||
d = m_destRow - (m_endRow - m_startRow + 1);
|
d = m_destRow - (m_endRow - m_startRow + 1);
|
||||||
else
|
} else {
|
||||||
d = m_destRow - (m_endRow - m_startRow) + 1;
|
d = m_destRow - (m_endRow - m_startRow) + 1;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
foreach(const qint64 id, l)
|
foreach (const qint64 id, l) {
|
||||||
{
|
|
||||||
m_model->m_childItems[destParent.internalId()][column].insert(d++, id);
|
m_model->m_childItems[destParent.internalId()][column].insert(d++, id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -47,7 +47,6 @@
|
|||||||
#include <QtCore/QHash>
|
#include <QtCore/QHash>
|
||||||
#include <QtCore/QList>
|
#include <QtCore/QList>
|
||||||
|
|
||||||
|
|
||||||
class DynamicTreeModel : public QAbstractItemModel
|
class DynamicTreeModel : public QAbstractItemModel
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@ -77,7 +76,10 @@ private:
|
|||||||
QHash<qint64, QString> m_items;
|
QHash<qint64, QString> m_items;
|
||||||
QHash<qint64, QList<QList<qint64> > > m_childItems;
|
QHash<qint64, QList<QList<qint64> > > m_childItems;
|
||||||
qint64 nextId;
|
qint64 nextId;
|
||||||
qint64 newId() { return nextId++; };
|
qint64 newId()
|
||||||
|
{
|
||||||
|
return nextId++;
|
||||||
|
};
|
||||||
|
|
||||||
QModelIndex m_nextParentIndex;
|
QModelIndex m_nextParentIndex;
|
||||||
int m_nextRow;
|
int m_nextRow;
|
||||||
@ -92,7 +94,6 @@ private:
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class ModelChangeCommand : public QObject
|
class ModelChangeCommand : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@ -102,15 +103,27 @@ public:
|
|||||||
|
|
||||||
virtual ~ModelChangeCommand() {}
|
virtual ~ModelChangeCommand() {}
|
||||||
|
|
||||||
void setAncestorRowNumbers(QList<int> rowNumbers) { m_rowNumbers = rowNumbers; }
|
void setAncestorRowNumbers(QList<int> rowNumbers)
|
||||||
|
{
|
||||||
|
m_rowNumbers = rowNumbers;
|
||||||
|
}
|
||||||
|
|
||||||
QModelIndex findIndex(QList<int> rows);
|
QModelIndex findIndex(QList<int> rows);
|
||||||
|
|
||||||
void setStartRow(int row) { m_startRow = row; }
|
void setStartRow(int row)
|
||||||
|
{
|
||||||
|
m_startRow = row;
|
||||||
|
}
|
||||||
|
|
||||||
void setEndRow(int row) { m_endRow = row; }
|
void setEndRow(int row)
|
||||||
|
{
|
||||||
|
m_endRow = row;
|
||||||
|
}
|
||||||
|
|
||||||
void setNumCols(int cols) { m_numCols = cols; }
|
void setNumCols(int cols)
|
||||||
|
{
|
||||||
|
m_numCols = cols;
|
||||||
|
}
|
||||||
|
|
||||||
virtual void doCommand() = 0;
|
virtual void doCommand() = 0;
|
||||||
|
|
||||||
@ -137,7 +150,6 @@ public:
|
|||||||
virtual void doCommand();
|
virtual void doCommand();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class ModelMoveCommand : public ModelChangeCommand
|
class ModelMoveCommand : public ModelChangeCommand
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@ -152,9 +164,15 @@ public:
|
|||||||
|
|
||||||
virtual void emitPostSignal();
|
virtual void emitPostSignal();
|
||||||
|
|
||||||
void setDestAncestors( QList<int> rows ) { m_destRowNumbers = rows; }
|
void setDestAncestors(QList<int> rows)
|
||||||
|
{
|
||||||
|
m_destRowNumbers = rows;
|
||||||
|
}
|
||||||
|
|
||||||
void setDestRow(int row) { m_destRow = row; }
|
void setDestRow(int row)
|
||||||
|
{
|
||||||
|
m_destRow = row;
|
||||||
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
QList<int> m_destRowNumbers;
|
QList<int> m_destRowNumbers;
|
||||||
@ -193,5 +211,4 @@ public:
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -39,7 +39,6 @@
|
|||||||
**
|
**
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
#include <QtGui/QtGui>
|
#include <QtGui/QtGui>
|
||||||
|
|
||||||
#include "modeltest.h"
|
#include "modeltest.h"
|
||||||
@ -101,8 +100,9 @@ ModelTest::ModelTest ( QAbstractItemModel *_model, QObject *parent ) : QObject (
|
|||||||
|
|
||||||
void ModelTest::runAllTests()
|
void ModelTest::runAllTests()
|
||||||
{
|
{
|
||||||
if ( fetchingMore )
|
if (fetchingMore) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
nonDestructiveBasicTest();
|
nonDestructiveBasicTest();
|
||||||
rowCount();
|
rowCount();
|
||||||
columnCount();
|
columnCount();
|
||||||
@ -159,17 +159,19 @@ void ModelTest::rowCount()
|
|||||||
QModelIndex topIndex = model->index(0, 0, QModelIndex());
|
QModelIndex topIndex = model->index(0, 0, QModelIndex());
|
||||||
int rows = model->rowCount(topIndex);
|
int rows = model->rowCount(topIndex);
|
||||||
Q_ASSERT(rows >= 0);
|
Q_ASSERT(rows >= 0);
|
||||||
if ( rows > 0 )
|
if (rows > 0) {
|
||||||
Q_ASSERT(model->hasChildren(topIndex) == true);
|
Q_ASSERT(model->hasChildren(topIndex) == true);
|
||||||
|
}
|
||||||
|
|
||||||
QModelIndex secondLevelIndex = model->index(0, 0, topIndex);
|
QModelIndex secondLevelIndex = model->index(0, 0, topIndex);
|
||||||
if (secondLevelIndex.isValid()) { // not the top level
|
if (secondLevelIndex.isValid()) { // not the top level
|
||||||
// check a row count where parent is valid
|
// check a row count where parent is valid
|
||||||
rows = model->rowCount(secondLevelIndex);
|
rows = model->rowCount(secondLevelIndex);
|
||||||
Q_ASSERT(rows >= 0);
|
Q_ASSERT(rows >= 0);
|
||||||
if ( rows > 0 )
|
if (rows > 0) {
|
||||||
Q_ASSERT(model->hasChildren(secondLevelIndex) == true);
|
Q_ASSERT(model->hasChildren(secondLevelIndex) == true);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// The models rowCount() is tested more extensively in checkChildren(),
|
// The models rowCount() is tested more extensively in checkChildren(),
|
||||||
// but this catches the big mistakes
|
// but this catches the big mistakes
|
||||||
@ -186,8 +188,9 @@ void ModelTest::columnCount()
|
|||||||
|
|
||||||
// check a column count where parent is valid
|
// check a column count where parent is valid
|
||||||
QModelIndex childIndex = model->index(0, 0, topIndex);
|
QModelIndex childIndex = model->index(0, 0, topIndex);
|
||||||
if ( childIndex.isValid() )
|
if (childIndex.isValid()) {
|
||||||
Q_ASSERT(model->columnCount(childIndex) >= 0);
|
Q_ASSERT(model->columnCount(childIndex) >= 0);
|
||||||
|
}
|
||||||
|
|
||||||
// columnCount() is tested more extensively in checkChildren(),
|
// columnCount() is tested more extensively in checkChildren(),
|
||||||
// but this catches the big mistakes
|
// but this catches the big mistakes
|
||||||
@ -211,8 +214,9 @@ void ModelTest::hasIndex()
|
|||||||
Q_ASSERT(model->hasIndex(rows, columns) == false);
|
Q_ASSERT(model->hasIndex(rows, columns) == false);
|
||||||
Q_ASSERT(model->hasIndex(rows + 1, columns + 1) == false);
|
Q_ASSERT(model->hasIndex(rows + 1, columns + 1) == false);
|
||||||
|
|
||||||
if ( rows > 0 )
|
if (rows > 0) {
|
||||||
Q_ASSERT(model->hasIndex(0, 0) == true);
|
Q_ASSERT(model->hasIndex(0, 0) == true);
|
||||||
|
}
|
||||||
|
|
||||||
// hasIndex() is tested more extensively in checkChildren(),
|
// hasIndex() is tested more extensively in checkChildren(),
|
||||||
// but this catches the big mistakes
|
// but this catches the big mistakes
|
||||||
@ -232,8 +236,9 @@ void ModelTest::index()
|
|||||||
int rows = model->rowCount();
|
int rows = model->rowCount();
|
||||||
int columns = model->columnCount();
|
int columns = model->columnCount();
|
||||||
|
|
||||||
if ( rows == 0 )
|
if (rows == 0) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Catch off by one errors
|
// Catch off by one errors
|
||||||
Q_ASSERT(model->index(rows, columns) == QModelIndex());
|
Q_ASSERT(model->index(rows, columns) == QModelIndex());
|
||||||
@ -258,8 +263,9 @@ void ModelTest::parent()
|
|||||||
// when asked for the parent of an invalid index.
|
// when asked for the parent of an invalid index.
|
||||||
Q_ASSERT(model->parent(QModelIndex()) == QModelIndex());
|
Q_ASSERT(model->parent(QModelIndex()) == QModelIndex());
|
||||||
|
|
||||||
if ( model->rowCount() == 0 )
|
if (model->rowCount() == 0) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Column 0 | Column 1 |
|
// Column 0 | Column 1 |
|
||||||
// QModelIndex() | |
|
// QModelIndex() | |
|
||||||
@ -311,8 +317,9 @@ void ModelTest::checkChildren ( const QModelIndex &parent, int currentDepth )
|
|||||||
{
|
{
|
||||||
// First just try walking back up the tree.
|
// First just try walking back up the tree.
|
||||||
QModelIndex p = parent;
|
QModelIndex p = parent;
|
||||||
while ( p.isValid() )
|
while (p.isValid()) {
|
||||||
p = p.parent();
|
p = p.parent();
|
||||||
|
}
|
||||||
|
|
||||||
// For models that are dynamically populated
|
// For models that are dynamically populated
|
||||||
if (model->canFetchMore(parent)) {
|
if (model->canFetchMore(parent)) {
|
||||||
@ -324,14 +331,16 @@ void ModelTest::checkChildren ( const QModelIndex &parent, int currentDepth )
|
|||||||
int rows = model->rowCount(parent);
|
int rows = model->rowCount(parent);
|
||||||
int columns = model->columnCount(parent);
|
int columns = model->columnCount(parent);
|
||||||
|
|
||||||
if ( rows > 0 )
|
if (rows > 0) {
|
||||||
Q_ASSERT(model->hasChildren(parent));
|
Q_ASSERT(model->hasChildren(parent));
|
||||||
|
}
|
||||||
|
|
||||||
// Some further testing against rows(), columns(), and hasChildren()
|
// Some further testing against rows(), columns(), and hasChildren()
|
||||||
Q_ASSERT(rows >= 0);
|
Q_ASSERT(rows >= 0);
|
||||||
Q_ASSERT(columns >= 0);
|
Q_ASSERT(columns >= 0);
|
||||||
if ( rows > 0 )
|
if (rows > 0) {
|
||||||
Q_ASSERT(model->hasChildren(parent) == true);
|
Q_ASSERT(model->hasChildren(parent) == true);
|
||||||
|
}
|
||||||
|
|
||||||
//qDebug() << "parent:" << model->data(parent).toString() << "rows:" << rows
|
//qDebug() << "parent:" << model->data(parent).toString() << "rows:" << rows
|
||||||
// << "columns:" << columns << "parent column:" << parent.column();
|
// << "columns:" << columns << "parent column:" << parent.column();
|
||||||
@ -404,8 +413,9 @@ void ModelTest::data()
|
|||||||
// Invalid index should return an invalid qvariant
|
// Invalid index should return an invalid qvariant
|
||||||
Q_ASSERT(!model->data(QModelIndex()).isValid());
|
Q_ASSERT(!model->data(QModelIndex()).isValid());
|
||||||
|
|
||||||
if ( model->rowCount() == 0 )
|
if (model->rowCount() == 0) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// A valid index should have a valid QVariant data
|
// A valid index should have a valid QVariant data
|
||||||
Q_ASSERT(model->index(0, 0).isValid());
|
Q_ASSERT(model->index(0, 0).isValid());
|
||||||
@ -509,8 +519,9 @@ void ModelTest::rowsInserted ( const QModelIndex & parent, int start, int end )
|
|||||||
|
|
||||||
if (c.next != model->data(model->index(end + 1, 0, c.parent))) {
|
if (c.next != model->data(model->index(end + 1, 0, c.parent))) {
|
||||||
qDebug() << start << end;
|
qDebug() << start << end;
|
||||||
for (int i=0; i < model->rowCount(); ++i)
|
for (int i = 0; i < model->rowCount(); ++i) {
|
||||||
qDebug() << model->index(i, 0).data().toString();
|
qDebug() << model->index(i, 0).data().toString();
|
||||||
|
}
|
||||||
qDebug() << c.next << model->data(model->index(end + 1, 0, c.parent));
|
qDebug() << c.next << model->data(model->index(end + 1, 0, c.parent));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -519,9 +530,10 @@ void ModelTest::rowsInserted ( const QModelIndex & parent, int start, int end )
|
|||||||
|
|
||||||
void ModelTest::layoutAboutToBeChanged()
|
void ModelTest::layoutAboutToBeChanged()
|
||||||
{
|
{
|
||||||
for ( int i = 0; i < qBound ( 0, model->rowCount(), 100 ); ++i )
|
for (int i = 0; i < qBound(0, model->rowCount(), 100); ++i) {
|
||||||
changing.append(QPersistentModelIndex(model->index(i, 0)));
|
changing.append(QPersistentModelIndex(model->index(i, 0)));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void ModelTest::layoutChanged()
|
void ModelTest::layoutChanged()
|
||||||
{
|
{
|
||||||
@ -563,4 +575,3 @@ void ModelTest::rowsRemoved ( const QModelIndex & parent, int start, int end )
|
|||||||
Q_ASSERT(c.next == model->data(model->index(start, 0, c.parent)));
|
Q_ASSERT(c.next == model->data(model->index(start, 0, c.parent)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -39,7 +39,6 @@
|
|||||||
**
|
**
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
#ifndef MODELTEST_H
|
#ifndef MODELTEST_H
|
||||||
#define MODELTEST_H
|
#define MODELTEST_H
|
||||||
|
|
||||||
|
@ -42,7 +42,6 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
void PackageStructureTest::initTestCase()
|
void PackageStructureTest::initTestCase()
|
||||||
{
|
{
|
||||||
m_packagePath = QFINDTESTDATA("data/testpackage");
|
m_packagePath = QFINDTESTDATA("data/testpackage");
|
||||||
@ -181,4 +180,3 @@ void PackageStructureTest::mimeTypes()
|
|||||||
|
|
||||||
QTEST_MAIN(PackageStructureTest)
|
QTEST_MAIN(PackageStructureTest)
|
||||||
|
|
||||||
|
|
||||||
|
@ -90,7 +90,6 @@ void PlasmoidPackageTest::createTestPackage(const QString &packageName)
|
|||||||
file.flush();
|
file.flush();
|
||||||
file.close();
|
file.close();
|
||||||
|
|
||||||
|
|
||||||
qDebug() << "THIS IS A PLASMOID SCRIPT THING";
|
qDebug() << "THIS IS A PLASMOID SCRIPT THING";
|
||||||
// Now we have a minimal plasmoid package which is valid. Let's add some
|
// Now we have a minimal plasmoid package which is valid. Let's add some
|
||||||
// files to it for test purposes.
|
// files to it for test purposes.
|
||||||
@ -293,12 +292,10 @@ void PlasmoidPackageTest::packageInstalled(KJob* j)
|
|||||||
connect(jj, SIGNAL(finished(KJob*)), SLOT(packageInstalled(KJob*)));
|
connect(jj, SIGNAL(finished(KJob*)), SLOT(packageInstalled(KJob*)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PlasmoidPackageTest::packageUninstalled(KJob *j)
|
void PlasmoidPackageTest::packageUninstalled(KJob *j)
|
||||||
{
|
{
|
||||||
qDebug() << "!!!!!!!!!!!!!!!!!!!!! package uninstalled";
|
qDebug() << "!!!!!!!!!!!!!!!!!!!!! package uninstalled";
|
||||||
QVERIFY(j->error() == KJob::NoError);
|
QVERIFY(j->error() == KJob::NoError);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QTEST_MAIN(PlasmoidPackageTest)
|
QTEST_MAIN(PlasmoidPackageTest)
|
||||||
|
@ -75,6 +75,5 @@ void PluginTest::loadDataEngine()
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#include "moc_pluginloadertest.cpp"
|
#include "moc_pluginloadertest.cpp"
|
||||||
|
|
||||||
|
@ -34,7 +34,6 @@ private Q_SLOTS:
|
|||||||
void retrieve();
|
void retrieve();
|
||||||
void deleteEntry();
|
void deleteEntry();
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QVariantMap m_data;
|
QVariantMap m_data;
|
||||||
};
|
};
|
||||||
|
@ -23,7 +23,10 @@
|
|||||||
#include <KDE/KDialog>
|
#include <KDE/KDialog>
|
||||||
|
|
||||||
class QModelIndex;
|
class QModelIndex;
|
||||||
namespace Ui { class AppletSelector; }
|
namespace Ui
|
||||||
|
{
|
||||||
|
class AppletSelector;
|
||||||
|
}
|
||||||
|
|
||||||
class AppletSelector : public KDialog
|
class AppletSelector : public KDialog
|
||||||
{
|
{
|
||||||
|
@ -27,7 +27,6 @@
|
|||||||
#include <KStandardAction>
|
#include <KStandardAction>
|
||||||
#include <KActionCollection>
|
#include <KActionCollection>
|
||||||
|
|
||||||
|
|
||||||
#include <Plasma/Containment>
|
#include <Plasma/Containment>
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
|
@ -19,7 +19,6 @@
|
|||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
|
|
||||||
#include "calendar.h"
|
#include "calendar.h"
|
||||||
|
|
||||||
Calendar::Calendar(QObject *parent)
|
Calendar::Calendar(QObject *parent)
|
||||||
@ -62,8 +61,9 @@ int Calendar::types() const
|
|||||||
|
|
||||||
void Calendar::setTypes(int types)
|
void Calendar::setTypes(int types)
|
||||||
{
|
{
|
||||||
if (m_types == types)
|
if (m_types == types) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// m_types = static_cast<Types>(types);
|
// m_types = static_cast<Types>(types);
|
||||||
// updateTypes();
|
// updateTypes();
|
||||||
@ -182,7 +182,6 @@ void Calendar::updateData()
|
|||||||
|
|
||||||
QDate firstDay(m_startDate.year(), m_startDate.month(), 1);
|
QDate firstDay(m_startDate.year(), m_startDate.month(), 1);
|
||||||
|
|
||||||
|
|
||||||
// If the first day is the same as the starting day then we add a complete row before it.
|
// If the first day is the same as the starting day then we add a complete row before it.
|
||||||
if (m_firstDayOfWeek < firstDay.dayOfWeek()) {
|
if (m_firstDayOfWeek < firstDay.dayOfWeek()) {
|
||||||
daysBeforeCurrentMonth = firstDay.dayOfWeek() - m_firstDayOfWeek;
|
daysBeforeCurrentMonth = firstDay.dayOfWeek() - m_firstDayOfWeek;
|
||||||
@ -245,7 +244,6 @@ void Calendar::updateData()
|
|||||||
m_weekList << QDate(data.yearNumber, data.monthNumber, data.dayNumber).weekNumber();
|
m_weekList << QDate(data.yearNumber, data.monthNumber, data.dayNumber).weekNumber();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
m_daysModel->update();
|
m_daysModel->update();
|
||||||
|
|
||||||
// qDebug() << "---------------------------------------------------------------";
|
// qDebug() << "---------------------------------------------------------------";
|
||||||
|
@ -27,7 +27,6 @@
|
|||||||
#include "daydata.h"
|
#include "daydata.h"
|
||||||
#include "daysmodel.h"
|
#include "daysmodel.h"
|
||||||
|
|
||||||
|
|
||||||
class Calendar : public QObject
|
class Calendar : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@ -124,7 +123,6 @@ public:
|
|||||||
};
|
};
|
||||||
Q_DECLARE_FLAGS(Types, Type)
|
Q_DECLARE_FLAGS(Types, Type)
|
||||||
|
|
||||||
|
|
||||||
explicit Calendar(QObject *parent = 0);
|
explicit Calendar(QObject *parent = 0);
|
||||||
|
|
||||||
// Start date
|
// Start date
|
||||||
@ -158,7 +156,6 @@ public:
|
|||||||
QAbstractListModel *daysModel() const;
|
QAbstractListModel *daysModel() const;
|
||||||
QList<int> weeksModel() const;
|
QList<int> weeksModel() const;
|
||||||
|
|
||||||
|
|
||||||
// QML invokables
|
// QML invokables
|
||||||
Q_INVOKABLE void nextMonth();
|
Q_INVOKABLE void nextMonth();
|
||||||
Q_INVOKABLE void previousMonth();
|
Q_INVOKABLE void previousMonth();
|
||||||
|
@ -19,8 +19,6 @@
|
|||||||
|
|
||||||
#include "calendardata.h"
|
#include "calendardata.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
CalendarData::CalendarData(QObject *parent)
|
CalendarData::CalendarData(QObject *parent)
|
||||||
: QObject(parent)
|
: QObject(parent)
|
||||||
, m_types(Holiday | Event | Todo | Journal)
|
, m_types(Holiday | Event | Todo | Journal)
|
||||||
@ -43,8 +41,6 @@ CalendarData::CalendarData(QObject *parent)
|
|||||||
// updateTypes();
|
// updateTypes();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
QDate CalendarData::startDate() const
|
QDate CalendarData::startDate() const
|
||||||
{
|
{
|
||||||
return m_startDate;
|
return m_startDate;
|
||||||
@ -52,8 +48,9 @@ QDate CalendarData::startDate() const
|
|||||||
|
|
||||||
void CalendarData::setStartDate(const QDate &dateTime)
|
void CalendarData::setStartDate(const QDate &dateTime)
|
||||||
{
|
{
|
||||||
if (m_startDate == dateTime)
|
if (m_startDate == dateTime) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
m_startDate = dateTime;
|
m_startDate = dateTime;
|
||||||
// m_filteredList->setStartDate(m_startDate);
|
// m_filteredList->setStartDate(m_startDate);
|
||||||
@ -67,8 +64,9 @@ QDate CalendarData::endDate() const
|
|||||||
|
|
||||||
void CalendarData::setEndDate(const QDate &dateTime)
|
void CalendarData::setEndDate(const QDate &dateTime)
|
||||||
{
|
{
|
||||||
if (m_endDate == dateTime)
|
if (m_endDate == dateTime) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
m_endDate = dateTime;
|
m_endDate = dateTime;
|
||||||
// m_filteredList->setEndDate(m_endDate);
|
// m_filteredList->setEndDate(m_endDate);
|
||||||
|
@ -24,9 +24,6 @@
|
|||||||
#include <QFlags>
|
#include <QFlags>
|
||||||
#include <QDate>
|
#include <QDate>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class QAbstractItemModel;
|
class QAbstractItemModel;
|
||||||
|
|
||||||
class CalendarData : public QObject
|
class CalendarData : public QObject
|
||||||
|
@ -24,9 +24,6 @@
|
|||||||
#include <QAbstractItemModel>
|
#include <QAbstractItemModel>
|
||||||
#include <QAbstractListModel>
|
#include <QAbstractListModel>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void CalendarPlugin::registerTypes(const char *uri)
|
void CalendarPlugin::registerTypes(const char *uri)
|
||||||
{
|
{
|
||||||
Q_ASSERT(uri == QLatin1String("org.kde.plasma.calendar"));
|
Q_ASSERT(uri == QLatin1String("org.kde.plasma.calendar"));
|
||||||
|
@ -20,8 +20,6 @@
|
|||||||
#ifndef CALENDARPLUGIN_H
|
#ifndef CALENDARPLUGIN_H
|
||||||
#define CALENDARPLUGIN_H
|
#define CALENDARPLUGIN_H
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#include <QQmlExtensionPlugin>
|
#include <QQmlExtensionPlugin>
|
||||||
|
|
||||||
class QQmlEngine;
|
class QQmlEngine;
|
||||||
|
@ -16,5 +16,4 @@ public:
|
|||||||
int yearNumber;
|
int yearNumber;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif // DAYDATA_H
|
#endif // DAYDATA_H
|
||||||
|
@ -46,7 +46,6 @@
|
|||||||
|
|
||||||
// #include "dataenginebindings_p.h"
|
// #include "dataenginebindings_p.h"
|
||||||
|
|
||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
void CoreBindingsPlugin::initializeEngine(QQmlEngine *engine, const char *uri)
|
void CoreBindingsPlugin::initializeEngine(QQmlEngine *engine, const char *uri)
|
||||||
@ -61,7 +60,6 @@ void CoreBindingsPlugin::initializeEngine(QQmlEngine *engine, const char *uri)
|
|||||||
Units *units = new Units(context);
|
Units *units = new Units(context);
|
||||||
context->setContextProperty("units", units);
|
context->setContextProperty("units", units);
|
||||||
|
|
||||||
|
|
||||||
if (!engine->rootContext()->contextObject()) {
|
if (!engine->rootContext()->contextObject()) {
|
||||||
KDeclarative::KDeclarative kdeclarative;
|
KDeclarative::KDeclarative kdeclarative;
|
||||||
kdeclarative.setDeclarativeEngine(engine);
|
kdeclarative.setDeclarativeEngine(engine);
|
||||||
@ -107,6 +105,5 @@ void CoreBindingsPlugin::registerTypes(const char *uri)
|
|||||||
qmlRegisterType<Plasma::WindowThumbnail>(uri, 2, 0, "WindowThumbnail");
|
qmlRegisterType<Plasma::WindowThumbnail>(uri, 2, 0, "WindowThumbnail");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#include "corebindingsplugin.moc"
|
#include "corebindingsplugin.moc"
|
||||||
|
|
||||||
|
@ -38,5 +38,4 @@ public:
|
|||||||
void registerTypes(const char *uri);
|
void registerTypes(const char *uri);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -32,9 +32,9 @@ SortFilterModel::SortFilterModel(QObject* parent)
|
|||||||
{
|
{
|
||||||
setObjectName("SortFilterModel");
|
setObjectName("SortFilterModel");
|
||||||
setDynamicSortFilter(true);
|
setDynamicSortFilter(true);
|
||||||
connect(this, SIGNAL(rowsInserted(const QModelIndex &, int, int)),
|
connect(this, SIGNAL(rowsInserted(QModelIndex,int,int)),
|
||||||
this, SIGNAL(countChanged()));
|
this, SIGNAL(countChanged()));
|
||||||
connect(this, SIGNAL(rowsRemoved(const QModelIndex &, int, int)),
|
connect(this, SIGNAL(rowsRemoved(QModelIndex,int,int)),
|
||||||
this, SIGNAL(countChanged()));
|
this, SIGNAL(countChanged()));
|
||||||
connect(this, SIGNAL(modelReset()),
|
connect(this, SIGNAL(modelReset()),
|
||||||
this, SIGNAL(countChanged()));
|
this, SIGNAL(countChanged()));
|
||||||
@ -176,9 +176,9 @@ DataModel::DataModel(QObject* parent)
|
|||||||
++m_maxRoleId;
|
++m_maxRoleId;
|
||||||
|
|
||||||
setObjectName("DataModel");
|
setObjectName("DataModel");
|
||||||
connect(this, SIGNAL(rowsInserted(const QModelIndex &, int, int)),
|
connect(this, SIGNAL(rowsInserted(QModelIndex,int,int)),
|
||||||
this, SIGNAL(countChanged()));
|
this, SIGNAL(countChanged()));
|
||||||
connect(this, SIGNAL(rowsRemoved(const QModelIndex &, int, int)),
|
connect(this, SIGNAL(rowsRemoved(QModelIndex,int,int)),
|
||||||
this, SIGNAL(countChanged()));
|
this, SIGNAL(countChanged()));
|
||||||
connect(this, SIGNAL(modelReset()),
|
connect(this, SIGNAL(modelReset()),
|
||||||
this, SIGNAL(countChanged()));
|
this, SIGNAL(countChanged()));
|
||||||
|
@ -34,7 +34,6 @@ namespace Plasma
|
|||||||
class DataSource;
|
class DataSource;
|
||||||
class DataModel;
|
class DataModel;
|
||||||
|
|
||||||
|
|
||||||
class SortFilterModel : public QSortFilterProxyModel
|
class SortFilterModel : public QSortFilterProxyModel
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@ -87,7 +86,10 @@ public:
|
|||||||
|
|
||||||
void setSortOrder(const Qt::SortOrder order);
|
void setSortOrder(const Qt::SortOrder order);
|
||||||
|
|
||||||
int count() const {return QSortFilterProxyModel::rowCount();}
|
int count() const
|
||||||
|
{
|
||||||
|
return QSortFilterProxyModel::rowCount();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the item at index in the list model.
|
* Returns the item at index in the list model.
|
||||||
@ -175,7 +177,10 @@ public:
|
|||||||
int rowCount(const QModelIndex &parent = QModelIndex()) const;
|
int rowCount(const QModelIndex &parent = QModelIndex()) const;
|
||||||
int columnCount(const QModelIndex &parent = QModelIndex()) const;
|
int columnCount(const QModelIndex &parent = QModelIndex()) const;
|
||||||
|
|
||||||
int count() const {return countItems();}
|
int count() const
|
||||||
|
{
|
||||||
|
return countItems();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the item at index in the list model.
|
* Returns the item at index in the list model.
|
||||||
|
@ -128,12 +128,12 @@ void DataSource::setupData()
|
|||||||
* recommendations engine.
|
* recommendations engine.
|
||||||
*/
|
*/
|
||||||
m_dataEngine = engine;
|
m_dataEngine = engine;
|
||||||
connect(m_dataEngine, SIGNAL(sourceAdded(const QString&)), this, SIGNAL(sourcesChanged()), Qt::QueuedConnection);
|
connect(m_dataEngine, SIGNAL(sourceAdded(QString)), this, SIGNAL(sourcesChanged()), Qt::QueuedConnection);
|
||||||
connect(m_dataEngine, SIGNAL(sourceRemoved(const QString&)), this, SIGNAL(sourcesChanged()));
|
connect(m_dataEngine, SIGNAL(sourceRemoved(QString)), this, SIGNAL(sourcesChanged()));
|
||||||
|
|
||||||
connect(m_dataEngine, SIGNAL(sourceAdded(const QString&)), this, SIGNAL(sourceAdded(const QString&)), Qt::QueuedConnection);
|
connect(m_dataEngine, SIGNAL(sourceAdded(QString)), this, SIGNAL(sourceAdded(QString)), Qt::QueuedConnection);
|
||||||
connect(m_dataEngine, SIGNAL(sourceRemoved(const QString&)), this, SLOT(removeSource(const QString&)));
|
connect(m_dataEngine, SIGNAL(sourceRemoved(QString)), this, SLOT(removeSource(QString)));
|
||||||
connect(m_dataEngine, SIGNAL(sourceRemoved(const QString&)), this, SIGNAL(sourceRemoved(const QString&)));
|
connect(m_dataEngine, SIGNAL(sourceRemoved(QString)), this, SIGNAL(sourceRemoved(QString)));
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (const QString &source, m_connectedSources) {
|
foreach (const QString &source, m_connectedSources) {
|
||||||
|
@ -30,10 +30,8 @@
|
|||||||
#include <Plasma/DataEngineConsumer>
|
#include <Plasma/DataEngineConsumer>
|
||||||
#include <Plasma/DataEngine>
|
#include <Plasma/DataEngine>
|
||||||
|
|
||||||
|
|
||||||
class QQmlPropertyMap;
|
class QQmlPropertyMap;
|
||||||
|
|
||||||
|
|
||||||
namespace Plasma
|
namespace Plasma
|
||||||
{
|
{
|
||||||
class DataEngine;
|
class DataEngine;
|
||||||
@ -57,13 +55,19 @@ public:
|
|||||||
* true if the connection to the Plasma DataEngine is valid
|
* true if the connection to the Plasma DataEngine is valid
|
||||||
*/
|
*/
|
||||||
Q_PROPERTY(bool valid READ valid)
|
Q_PROPERTY(bool valid READ valid)
|
||||||
bool valid() const {return m_dataEngine && m_dataEngine->isValid();}
|
bool valid() const
|
||||||
|
{
|
||||||
|
return m_dataEngine && m_dataEngine->isValid();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Polling interval in milliseconds when the data will be fetched again. If 0 no polling will be done.
|
* Polling interval in milliseconds when the data will be fetched again. If 0 no polling will be done.
|
||||||
*/
|
*/
|
||||||
Q_PROPERTY(int interval READ interval WRITE setInterval NOTIFY intervalChanged)
|
Q_PROPERTY(int interval READ interval WRITE setInterval NOTIFY intervalChanged)
|
||||||
int interval() const {return m_interval;}
|
int interval() const
|
||||||
|
{
|
||||||
|
return m_interval;
|
||||||
|
}
|
||||||
void setInterval(const int interval);
|
void setInterval(const int interval);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -71,28 +75,44 @@ public:
|
|||||||
*/
|
*/
|
||||||
Q_PROPERTY(QString dataEngine READ engine WRITE setEngine NOTIFY engineChanged)
|
Q_PROPERTY(QString dataEngine READ engine WRITE setEngine NOTIFY engineChanged)
|
||||||
Q_PROPERTY(QString engine READ engine WRITE setEngine NOTIFY engineChanged)
|
Q_PROPERTY(QString engine READ engine WRITE setEngine NOTIFY engineChanged)
|
||||||
QString engine() const {return m_engine;}
|
QString engine() const
|
||||||
|
{
|
||||||
|
return m_engine;
|
||||||
|
}
|
||||||
void setEngine(const QString &e);
|
void setEngine(const QString &e);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* String array of all the source names connected to the DataEngine
|
* String array of all the source names connected to the DataEngine
|
||||||
*/
|
*/
|
||||||
Q_PROPERTY(QStringList connectedSources READ connectedSources WRITE setConnectedSources NOTIFY connectedSourcesChanged)
|
Q_PROPERTY(QStringList connectedSources READ connectedSources WRITE setConnectedSources NOTIFY connectedSourcesChanged)
|
||||||
QStringList connectedSources() const {return m_connectedSources;}
|
QStringList connectedSources() const
|
||||||
|
{
|
||||||
|
return m_connectedSources;
|
||||||
|
}
|
||||||
void setConnectedSources(const QStringList &s);
|
void setConnectedSources(const QStringList &s);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read only string array of all the sources available from the DataEngine (connected or not)
|
* Read only string array of all the sources available from the DataEngine (connected or not)
|
||||||
*/
|
*/
|
||||||
Q_PROPERTY(QStringList sources READ sources NOTIFY sourcesChanged)
|
Q_PROPERTY(QStringList sources READ sources NOTIFY sourcesChanged)
|
||||||
QStringList sources() const {if (m_dataEngine) return m_dataEngine->sources(); else return QStringList();}
|
QStringList sources() const
|
||||||
|
{
|
||||||
|
if (m_dataEngine) {
|
||||||
|
return m_dataEngine->sources();
|
||||||
|
} else {
|
||||||
|
return QStringList();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* All the data fetched by this dataengine.
|
* All the data fetched by this dataengine.
|
||||||
* This is a map of maps. At the first level, there are the source names, at the second, they keys set by the DataEngine
|
* This is a map of maps. At the first level, there are the source names, at the second, they keys set by the DataEngine
|
||||||
*/
|
*/
|
||||||
Q_PROPERTY(QQmlPropertyMap *data READ data CONSTANT);
|
Q_PROPERTY(QQmlPropertyMap *data READ data CONSTANT);
|
||||||
QQmlPropertyMap *data() const {return m_data;}
|
QQmlPropertyMap *data() const
|
||||||
|
{
|
||||||
|
return m_data;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* All the models associated to this DataEngine, indexed by source.
|
* All the models associated to this DataEngine, indexed by source.
|
||||||
@ -100,7 +120,10 @@ public:
|
|||||||
* The user has to be connected to its source, so the source name has to be present in the connectedSources property.
|
* The user has to be connected to its source, so the source name has to be present in the connectedSources property.
|
||||||
*/
|
*/
|
||||||
Q_PROPERTY(QQmlPropertyMap *models READ models CONSTANT);
|
Q_PROPERTY(QQmlPropertyMap *models READ models CONSTANT);
|
||||||
QQmlPropertyMap *models() const {return m_models;}
|
QQmlPropertyMap *models() const
|
||||||
|
{
|
||||||
|
return m_models;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @returns a Plasma::Service given a source name
|
* @returns a Plasma::Service given a source name
|
||||||
|
@ -107,7 +107,6 @@ FrameSvgItem::FrameSvgItem(QQuickItem *parent)
|
|||||||
connect(&m_units, &Units::devicePixelRatioChanged, this, &FrameSvgItem::updateDevicePixelRatio);
|
connect(&m_units, &Units::devicePixelRatioChanged, this, &FrameSvgItem::updateDevicePixelRatio);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
FrameSvgItem::~FrameSvgItem()
|
FrameSvgItem::~FrameSvgItem()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -145,7 +144,6 @@ QString FrameSvgItem::imagePath() const
|
|||||||
return m_frameSvg->imagePath();
|
return m_frameSvg->imagePath();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void FrameSvgItem::setPrefix(const QString &prefix)
|
void FrameSvgItem::setPrefix(const QString &prefix)
|
||||||
{
|
{
|
||||||
if (m_prefix == prefix) {
|
if (m_prefix == prefix) {
|
||||||
@ -190,8 +188,9 @@ FrameSvgItemMargins *FrameSvgItem::fixedMargins() const
|
|||||||
|
|
||||||
void FrameSvgItem::setEnabledBorders(const Plasma::FrameSvg::EnabledBorders borders)
|
void FrameSvgItem::setEnabledBorders(const Plasma::FrameSvg::EnabledBorders borders)
|
||||||
{
|
{
|
||||||
if (m_frameSvg->enabledBorders() == borders)
|
if (m_frameSvg->enabledBorders() == borders) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
m_frameSvg->setEnabledBorders(borders);
|
m_frameSvg->setEnabledBorders(borders);
|
||||||
emit enabledBordersChanged();
|
emit enabledBordersChanged();
|
||||||
@ -303,7 +302,6 @@ void FrameSvgItem::componentComplete()
|
|||||||
m_textureChanged = true;
|
m_textureChanged = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void FrameSvgItem::updateDevicePixelRatio()
|
void FrameSvgItem::updateDevicePixelRatio()
|
||||||
{
|
{
|
||||||
//devicepixelratio is always set integer in the svg, so needs at least 192dpi to double up.
|
//devicepixelratio is always set integer in the svg, so needs at least 192dpi to double up.
|
||||||
|
@ -27,7 +27,8 @@
|
|||||||
|
|
||||||
#include "units.h"
|
#include "units.h"
|
||||||
|
|
||||||
namespace Plasma {
|
namespace Plasma
|
||||||
|
{
|
||||||
|
|
||||||
class FrameSvg;
|
class FrameSvg;
|
||||||
|
|
||||||
|
@ -29,7 +29,6 @@
|
|||||||
|
|
||||||
#include <plasma/svg.h>
|
#include <plasma/svg.h>
|
||||||
|
|
||||||
|
|
||||||
QPixmap transition(const QPixmap &from, const QPixmap &to, qreal amount)
|
QPixmap transition(const QPixmap &from, const QPixmap &to, qreal amount)
|
||||||
{
|
{
|
||||||
if (from.isNull() && to.isNull()) {
|
if (from.isNull() && to.isNull()) {
|
||||||
@ -183,7 +182,6 @@ IconItem::IconItem(QQuickItem *parent)
|
|||||||
connect(KIconLoader::global(), SIGNAL(iconLoaderSettingsChanged()),
|
connect(KIconLoader::global(), SIGNAL(iconLoaderSettingsChanged()),
|
||||||
this, SIGNAL(implicitHeightChanged()));
|
this, SIGNAL(implicitHeightChanged()));
|
||||||
|
|
||||||
|
|
||||||
connect(this, SIGNAL(enabledChanged()),
|
connect(this, SIGNAL(enabledChanged()),
|
||||||
&m_loadPixmapTimer, SLOT(start()));
|
&m_loadPixmapTimer, SLOT(start()));
|
||||||
|
|
||||||
@ -192,7 +190,6 @@ IconItem::IconItem(QQuickItem *parent)
|
|||||||
setImplicitHeight(KIconLoader::global()->currentSize(KIconLoader::Dialog));
|
setImplicitHeight(KIconLoader::global()->currentSize(KIconLoader::Dialog));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
IconItem::~IconItem()
|
IconItem::~IconItem()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,8 @@
|
|||||||
|
|
||||||
class QPropertyAnimation;
|
class QPropertyAnimation;
|
||||||
|
|
||||||
namespace Plasma {
|
namespace Plasma
|
||||||
|
{
|
||||||
class Svg;
|
class Svg;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,8 +19,6 @@
|
|||||||
|
|
||||||
#include "serviceoperationstatus.h"
|
#include "serviceoperationstatus.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
ServiceOperationStatus::ServiceOperationStatus(QObject *parent)
|
ServiceOperationStatus::ServiceOperationStatus(QObject *parent)
|
||||||
: QObject(parent),
|
: QObject(parent),
|
||||||
m_enabled(false)
|
m_enabled(false)
|
||||||
|
@ -23,7 +23,8 @@
|
|||||||
|
|
||||||
#include "plasma/service.h"
|
#include "plasma/service.h"
|
||||||
|
|
||||||
namespace Plasma {
|
namespace Plasma
|
||||||
|
{
|
||||||
class Service;
|
class Service;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -73,5 +74,4 @@ private:
|
|||||||
bool m_enabled;
|
bool m_enabled;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -43,7 +43,6 @@ SvgItem::SvgItem(QQuickItem *parent)
|
|||||||
connect(&m_units, &Units::devicePixelRatioChanged, this, &SvgItem::updateDevicePixelRatio);
|
connect(&m_units, &Units::devicePixelRatioChanged, this, &SvgItem::updateDevicePixelRatio);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
SvgItem::~SvgItem()
|
SvgItem::~SvgItem()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -85,7 +84,6 @@ QSizeF SvgItem::naturalSize() const
|
|||||||
return m_svg.data()->size();
|
return m_svg.data()->size();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SvgItem::setSvg(Plasma::Svg *svg)
|
void SvgItem::setSvg(Plasma::Svg *svg)
|
||||||
{
|
{
|
||||||
if (m_svg) {
|
if (m_svg) {
|
||||||
@ -100,7 +98,6 @@ void SvgItem::setSvg(Plasma::Svg *svg)
|
|||||||
connect(svg, SIGNAL(sizeChanged()), this, SIGNAL(naturalSizeChanged()));
|
connect(svg, SIGNAL(sizeChanged()), this, SIGNAL(naturalSizeChanged()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (implicitWidth() <= 0) {
|
if (implicitWidth() <= 0) {
|
||||||
setImplicitWidth(naturalSize().width());
|
setImplicitWidth(naturalSize().width());
|
||||||
}
|
}
|
||||||
|
@ -24,7 +24,8 @@
|
|||||||
|
|
||||||
#include "units.h"
|
#include "units.h"
|
||||||
|
|
||||||
namespace Plasma {
|
namespace Plasma
|
||||||
|
{
|
||||||
|
|
||||||
class Svg;
|
class Svg;
|
||||||
|
|
||||||
|
@ -22,7 +22,8 @@
|
|||||||
|
|
||||||
#include <QSGSimpleTextureNode>
|
#include <QSGSimpleTextureNode>
|
||||||
|
|
||||||
namespace Plasma {
|
namespace Plasma
|
||||||
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class wraps QSGSimpleTextureNode
|
* This class wraps QSGSimpleTextureNode
|
||||||
@ -37,7 +38,8 @@ class SVGTextureNode : public QSGSimpleTextureNode
|
|||||||
* Set the current texture
|
* Set the current texture
|
||||||
* the object takes ownership of the texture
|
* the object takes ownership of the texture
|
||||||
*/
|
*/
|
||||||
void setTexture(QSGTexture *texture) {
|
void setTexture(QSGTexture *texture)
|
||||||
|
{
|
||||||
m_texture.reset(texture);
|
m_texture.reset(texture);
|
||||||
QSGSimpleTextureNode::setTexture(texture);
|
QSGSimpleTextureNode::setTexture(texture);
|
||||||
}
|
}
|
||||||
|
@ -194,7 +194,6 @@ void Units::updateSpacing()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int Units::longDuration() const
|
int Units::longDuration() const
|
||||||
{
|
{
|
||||||
return m_longDuration;
|
return m_longDuration;
|
||||||
|
@ -41,7 +41,8 @@ typedef GLvoid(*glEGLImageTargetTexture2DOES_func)(GLenum, GLeglImageOES);
|
|||||||
#endif // HAVE_EGL
|
#endif // HAVE_EGL
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace Plasma {
|
namespace Plasma
|
||||||
|
{
|
||||||
|
|
||||||
WindowTextureNode::WindowTextureNode()
|
WindowTextureNode::WindowTextureNode()
|
||||||
: QSGSimpleTextureNode()
|
: QSGSimpleTextureNode()
|
||||||
@ -402,10 +403,11 @@ bool WindowThumbnail::loadGLXTexture()
|
|||||||
|
|
||||||
XVisualInfo *vi = glXGetVisualFromFBConfig(d, fbConfigs[0]);
|
XVisualInfo *vi = glXGetVisualFromFBConfig(d, fbConfigs[0]);
|
||||||
int textureFormat;
|
int textureFormat;
|
||||||
if (window()->openglContext()->format().hasAlpha())
|
if (window()->openglContext()->format().hasAlpha()) {
|
||||||
textureFormat = bindRgba ? GLX_TEXTURE_FORMAT_RGBA_EXT : GLX_TEXTURE_FORMAT_RGB_EXT;
|
textureFormat = bindRgba ? GLX_TEXTURE_FORMAT_RGBA_EXT : GLX_TEXTURE_FORMAT_RGB_EXT;
|
||||||
else
|
} else {
|
||||||
textureFormat = bindRgb ? GLX_TEXTURE_FORMAT_RGB_EXT : GLX_TEXTURE_FORMAT_RGBA_EXT;
|
textureFormat = bindRgb ? GLX_TEXTURE_FORMAT_RGB_EXT : GLX_TEXTURE_FORMAT_RGBA_EXT;
|
||||||
|
}
|
||||||
XFree(vi);
|
XFree(vi);
|
||||||
|
|
||||||
// we assume that Texture_2D is supported as we have a QtQuick OpenGL context
|
// we assume that Texture_2D is supported as we have a QtQuick OpenGL context
|
||||||
|
@ -37,7 +37,8 @@
|
|||||||
#endif // HAVE_XCB_COMPOSITE
|
#endif // HAVE_XCB_COMPOSITE
|
||||||
class KWindowInfo;
|
class KWindowInfo;
|
||||||
|
|
||||||
namespace Plasma {
|
namespace Plasma
|
||||||
|
{
|
||||||
|
|
||||||
class WindowTextureNode;
|
class WindowTextureNode;
|
||||||
|
|
||||||
|
@ -19,6 +19,4 @@
|
|||||||
|
|
||||||
#include "enums.h"
|
#include "enums.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#include "moc_enums.cpp"
|
#include "moc_enums.cpp"
|
||||||
|
@ -22,7 +22,6 @@
|
|||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
|
||||||
|
|
||||||
class DialogStatus : public QObject
|
class DialogStatus : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@ -66,5 +65,4 @@ public:
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif // ENUMS_H
|
#endif // ENUMS_H
|
||||||
|
@ -138,6 +138,5 @@ void FullScreenSheet::open()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#include "fullscreensheet.moc"
|
#include "fullscreensheet.moc"
|
||||||
|
|
||||||
|
@ -41,7 +41,6 @@
|
|||||||
#include <Plasma/Corona>
|
#include <Plasma/Corona>
|
||||||
#include <Plasma/WindowEffects>
|
#include <Plasma/WindowEffects>
|
||||||
|
|
||||||
|
|
||||||
uint FullScreenWindow::s_numItems = 0;
|
uint FullScreenWindow::s_numItems = 0;
|
||||||
|
|
||||||
class Background : public QWidget
|
class Background : public QWidget
|
||||||
@ -235,7 +234,6 @@ void FullScreenWindow::syncViewToMainItem()
|
|||||||
|
|
||||||
m_view->setScene(scene);
|
m_view->setScene(scene);
|
||||||
|
|
||||||
|
|
||||||
QRectF itemGeometry(QPointF(m_mainItem.data()->x(), m_mainItem.data()->y()),
|
QRectF itemGeometry(QPointF(m_mainItem.data()->x(), m_mainItem.data()->y()),
|
||||||
QSizeF(m_mainItem.data()->boundingRect().size()));
|
QSizeF(m_mainItem.data()->boundingRect().size()));
|
||||||
if (m_declarativeItemContainer) {
|
if (m_declarativeItemContainer) {
|
||||||
@ -297,7 +295,6 @@ QGraphicsView *FullScreenWindow::view() const
|
|||||||
return m_view;
|
return m_view;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QDeclarativeListProperty<QGraphicsObject> FullScreenWindow::title()
|
QDeclarativeListProperty<QGraphicsObject> FullScreenWindow::title()
|
||||||
{
|
{
|
||||||
if (m_rootObject) {
|
if (m_rootObject) {
|
||||||
@ -334,7 +331,6 @@ DialogStatus::Status FullScreenWindow::status() const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void FullScreenWindow::statusHasChanged()
|
void FullScreenWindow::statusHasChanged()
|
||||||
{
|
{
|
||||||
if (status() == DialogStatus::Closed) {
|
if (status() == DialogStatus::Closed) {
|
||||||
@ -373,9 +369,6 @@ void FullScreenWindow::close()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
bool FullScreenWindow::eventFilter(QObject *watched, QEvent *event)
|
bool FullScreenWindow::eventFilter(QObject *watched, QEvent *event)
|
||||||
{
|
{
|
||||||
if (watched == m_mainItem.data() &&
|
if (watched == m_mainItem.data() &&
|
||||||
@ -388,7 +381,5 @@ bool FullScreenWindow::eventFilter(QObject *watched, QEvent *event)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#include "fullscreenwindow.moc"
|
#include "fullscreenwindow.moc"
|
||||||
|
|
||||||
|
@ -43,7 +43,6 @@ class FullScreenWindow : public QDeclarativeItem
|
|||||||
Q_PROPERTY(QDeclarativeListProperty<QGraphicsObject> buttons READ buttons DESIGNABLE false)
|
Q_PROPERTY(QDeclarativeListProperty<QGraphicsObject> buttons READ buttons DESIGNABLE false)
|
||||||
Q_PROPERTY(DialogStatus::Status status READ status NOTIFY statusChanged)
|
Q_PROPERTY(DialogStatus::Status status READ status NOTIFY statusChanged)
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
FullScreenWindow(QDeclarativeItem *parent = 0);
|
FullScreenWindow(QDeclarativeItem *parent = 0);
|
||||||
~FullScreenWindow();
|
~FullScreenWindow();
|
||||||
@ -73,7 +72,6 @@ Q_SIGNALS:
|
|||||||
void clickedOutside();
|
void clickedOutside();
|
||||||
void statusChanged();
|
void statusChanged();
|
||||||
|
|
||||||
|
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
void syncViewToMainItem();
|
void syncViewToMainItem();
|
||||||
void syncMainItemToView();
|
void syncMainItemToView();
|
||||||
|
@ -73,8 +73,6 @@ void EngineBookKeeping::engineDestroyed(QObject *deleted)
|
|||||||
m_engines.remove(static_cast<QQmlEngine *>(deleted));
|
m_engines.remove(static_cast<QQmlEngine *>(deleted));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void PlasmaComponentsPlugin::initializeEngine(QQmlEngine *engine, const char *uri)
|
void PlasmaComponentsPlugin::initializeEngine(QQmlEngine *engine, const char *uri)
|
||||||
{
|
{
|
||||||
QQmlExtensionPlugin::initializeEngine(engine, uri);
|
QQmlExtensionPlugin::initializeEngine(engine, uri);
|
||||||
@ -101,6 +99,5 @@ void PlasmaComponentsPlugin::registerTypes(const char *uri)
|
|||||||
qmlRegisterUncreatableType<PageStatus>(uri, 2, 0, "PageStatus", "");
|
qmlRegisterUncreatableType<PageStatus>(uri, 2, 0, "PageStatus", "");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#include "moc_plasmacomponentsplugin.cpp"
|
#include "moc_plasmacomponentsplugin.cpp"
|
||||||
|
|
||||||
|
@ -200,7 +200,6 @@ void QMenuProxy::open(int x, int y)
|
|||||||
emit statusChanged();
|
emit statusChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void QMenuProxy::close()
|
void QMenuProxy::close()
|
||||||
{
|
{
|
||||||
m_menu->hide();
|
m_menu->hide();
|
||||||
|
@ -20,7 +20,6 @@
|
|||||||
|
|
||||||
#include "qmenuitem.h"
|
#include "qmenuitem.h"
|
||||||
|
|
||||||
|
|
||||||
QMenuItem::QMenuItem(QQuickItem *parent)
|
QMenuItem::QMenuItem(QQuickItem *parent)
|
||||||
: QQuickItem(parent),
|
: QQuickItem(parent),
|
||||||
m_action(0)
|
m_action(0)
|
||||||
|
@ -104,14 +104,16 @@ qreal QRangeModelPrivate::publicPosition(qreal position) const
|
|||||||
const qreal positionValueRatio = valueRange ? (max - min) / valueRange : 0;
|
const qreal positionValueRatio = valueRange ? (max - min) / valueRange : 0;
|
||||||
const qreal positionStep = stepSize * positionValueRatio;
|
const qreal positionStep = stepSize * positionValueRatio;
|
||||||
|
|
||||||
if (positionStep == 0)
|
if (positionStep == 0) {
|
||||||
return (min < max) ? qBound(min, position, max) : qBound(max, position, min);
|
return (min < max) ? qBound(min, position, max) : qBound(max, position, min);
|
||||||
|
}
|
||||||
|
|
||||||
const int stepSizeMultiplier = (position - min) / positionStep;
|
const int stepSizeMultiplier = (position - min) / positionStep;
|
||||||
|
|
||||||
// Test whether value is below minimum range
|
// Test whether value is below minimum range
|
||||||
if (stepSizeMultiplier < 0)
|
if (stepSizeMultiplier < 0) {
|
||||||
return min;
|
return min;
|
||||||
|
}
|
||||||
|
|
||||||
qreal leftEdge = (stepSizeMultiplier * positionStep) + min;
|
qreal leftEdge = (stepSizeMultiplier * positionStep) + min;
|
||||||
qreal rightEdge = ((stepSizeMultiplier + 1) * positionStep) + min;
|
qreal rightEdge = ((stepSizeMultiplier + 1) * positionStep) + min;
|
||||||
@ -124,8 +126,9 @@ qreal QRangeModelPrivate::publicPosition(qreal position) const
|
|||||||
rightEdge = qMax(rightEdge, max);
|
rightEdge = qMax(rightEdge, max);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (qAbs(leftEdge - position) <= qAbs(rightEdge - position))
|
if (qAbs(leftEdge - position) <= qAbs(rightEdge - position)) {
|
||||||
return leftEdge;
|
return leftEdge;
|
||||||
|
}
|
||||||
return rightEdge;
|
return rightEdge;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -143,14 +146,16 @@ qreal QRangeModelPrivate::publicValue(qreal value) const
|
|||||||
// QML bindings; a position that is initially invalid because it lays
|
// QML bindings; a position that is initially invalid because it lays
|
||||||
// outside the range, might become valid later if the range changes.
|
// outside the range, might become valid later if the range changes.
|
||||||
|
|
||||||
if (stepSize == 0)
|
if (stepSize == 0) {
|
||||||
return qBound(minimum, value, maximum);
|
return qBound(minimum, value, maximum);
|
||||||
|
}
|
||||||
|
|
||||||
const int stepSizeMultiplier = (value - minimum) / stepSize;
|
const int stepSizeMultiplier = (value - minimum) / stepSize;
|
||||||
|
|
||||||
// Test whether value is below minimum range
|
// Test whether value is below minimum range
|
||||||
if (stepSizeMultiplier < 0)
|
if (stepSizeMultiplier < 0) {
|
||||||
return minimum;
|
return minimum;
|
||||||
|
}
|
||||||
|
|
||||||
const qreal leftEdge = qMin(maximum, (stepSizeMultiplier * stepSize) + minimum);
|
const qreal leftEdge = qMin(maximum, (stepSizeMultiplier * stepSize) + minimum);
|
||||||
const qreal rightEdge = qMin(maximum, ((stepSizeMultiplier + 1) * stepSize) + minimum);
|
const qreal rightEdge = qMin(maximum, ((stepSizeMultiplier + 1) * stepSize) + minimum);
|
||||||
@ -172,11 +177,13 @@ void QRangeModelPrivate::emitValueAndPositionIfChanged(const qreal oldValue, con
|
|||||||
// unchanged. This will be the case when operating with values outside range:
|
// unchanged. This will be the case when operating with values outside range:
|
||||||
const qreal newValue = q->value();
|
const qreal newValue = q->value();
|
||||||
const qreal newPosition = q->position();
|
const qreal newPosition = q->position();
|
||||||
if (!qFuzzyCompare(newValue, oldValue))
|
if (!qFuzzyCompare(newValue, oldValue)) {
|
||||||
emit q->valueChanged(newValue);
|
emit q->valueChanged(newValue);
|
||||||
if (!qFuzzyCompare(newPosition, oldPosition))
|
}
|
||||||
|
if (!qFuzzyCompare(newPosition, oldPosition)) {
|
||||||
emit q->positionChanged(newPosition);
|
emit q->positionChanged(newPosition);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Constructs a QRangeModel with \a parent
|
Constructs a QRangeModel with \a parent
|
||||||
@ -224,8 +231,9 @@ void QRangeModel::setPositionRange(qreal min, qreal max)
|
|||||||
bool emitPosAtMinChanged = !qFuzzyCompare(min, d->posatmin);
|
bool emitPosAtMinChanged = !qFuzzyCompare(min, d->posatmin);
|
||||||
bool emitPosAtMaxChanged = !qFuzzyCompare(max, d->posatmax);
|
bool emitPosAtMaxChanged = !qFuzzyCompare(max, d->posatmax);
|
||||||
|
|
||||||
if (!(emitPosAtMinChanged || emitPosAtMaxChanged))
|
if (!(emitPosAtMinChanged || emitPosAtMaxChanged)) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const qreal oldPosition = position();
|
const qreal oldPosition = position();
|
||||||
d->posatmin = min;
|
d->posatmin = min;
|
||||||
@ -239,10 +247,12 @@ void QRangeModel::setPositionRange(qreal min, qreal max)
|
|||||||
// the positionChanged signal.
|
// the positionChanged signal.
|
||||||
d->pos = d->equivalentPosition(d->value);
|
d->pos = d->equivalentPosition(d->value);
|
||||||
|
|
||||||
if (emitPosAtMinChanged)
|
if (emitPosAtMinChanged) {
|
||||||
emit positionAtMinimumChanged(d->posatmin);
|
emit positionAtMinimumChanged(d->posatmin);
|
||||||
if (emitPosAtMaxChanged)
|
}
|
||||||
|
if (emitPosAtMaxChanged) {
|
||||||
emit positionAtMaximumChanged(d->posatmax);
|
emit positionAtMaximumChanged(d->posatmax);
|
||||||
|
}
|
||||||
|
|
||||||
d->emitValueAndPositionIfChanged(value(), oldPosition);
|
d->emitValueAndPositionIfChanged(value(), oldPosition);
|
||||||
}
|
}
|
||||||
@ -259,8 +269,9 @@ void QRangeModel::setRange(qreal min, qreal max)
|
|||||||
bool emitMinimumChanged = !qFuzzyCompare(min, d->minimum);
|
bool emitMinimumChanged = !qFuzzyCompare(min, d->minimum);
|
||||||
bool emitMaximumChanged = !qFuzzyCompare(max, d->maximum);
|
bool emitMaximumChanged = !qFuzzyCompare(max, d->maximum);
|
||||||
|
|
||||||
if (!(emitMinimumChanged || emitMaximumChanged))
|
if (!(emitMinimumChanged || emitMaximumChanged)) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const qreal oldValue = value();
|
const qreal oldValue = value();
|
||||||
const qreal oldPosition = position();
|
const qreal oldPosition = position();
|
||||||
@ -271,10 +282,12 @@ void QRangeModel::setRange(qreal min, qreal max)
|
|||||||
// Update internal position if it was changed. It can occurs if internal value changes, due to range update
|
// Update internal position if it was changed. It can occurs if internal value changes, due to range update
|
||||||
d->pos = d->equivalentPosition(d->value);
|
d->pos = d->equivalentPosition(d->value);
|
||||||
|
|
||||||
if (emitMinimumChanged)
|
if (emitMinimumChanged) {
|
||||||
emit minimumChanged(d->minimum);
|
emit minimumChanged(d->minimum);
|
||||||
if (emitMaximumChanged)
|
}
|
||||||
|
if (emitMaximumChanged) {
|
||||||
emit maximumChanged(d->maximum);
|
emit maximumChanged(d->maximum);
|
||||||
|
}
|
||||||
|
|
||||||
d->emitValueAndPositionIfChanged(oldValue, oldPosition);
|
d->emitValueAndPositionIfChanged(oldValue, oldPosition);
|
||||||
}
|
}
|
||||||
@ -332,8 +345,9 @@ void QRangeModel::setStepSize(qreal stepSize)
|
|||||||
Q_D(QRangeModel);
|
Q_D(QRangeModel);
|
||||||
|
|
||||||
stepSize = qMax(qreal(0.0), stepSize);
|
stepSize = qMax(qreal(0.0), stepSize);
|
||||||
if (qFuzzyCompare(stepSize, d->stepSize))
|
if (qFuzzyCompare(stepSize, d->stepSize)) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const qreal oldValue = value();
|
const qreal oldValue = value();
|
||||||
const qreal oldPosition = position();
|
const qreal oldPosition = position();
|
||||||
@ -386,8 +400,9 @@ void QRangeModel::setPosition(qreal newPosition)
|
|||||||
{
|
{
|
||||||
Q_D(QRangeModel);
|
Q_D(QRangeModel);
|
||||||
|
|
||||||
if (qFuzzyCompare(newPosition, d->pos))
|
if (qFuzzyCompare(newPosition, d->pos)) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const qreal oldPosition = position();
|
const qreal oldPosition = position();
|
||||||
const qreal oldValue = value();
|
const qreal oldValue = value();
|
||||||
@ -473,8 +488,9 @@ void QRangeModel::setValue(qreal newValue)
|
|||||||
{
|
{
|
||||||
Q_D(QRangeModel);
|
Q_D(QRangeModel);
|
||||||
|
|
||||||
if (qFuzzyCompare(newValue, d->value))
|
if (qFuzzyCompare(newValue, d->value)) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const qreal oldValue = value();
|
const qreal oldValue = value();
|
||||||
const qreal oldPosition = position();
|
const qreal oldPosition = position();
|
||||||
@ -497,8 +513,9 @@ void QRangeModel::setValue(qreal newValue)
|
|||||||
void QRangeModel::setInverted(bool inverted)
|
void QRangeModel::setInverted(bool inverted)
|
||||||
{
|
{
|
||||||
Q_D(QRangeModel);
|
Q_D(QRangeModel);
|
||||||
if (inverted == d->inverted)
|
if (inverted == d->inverted) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
d->inverted = inverted;
|
d->inverted = inverted;
|
||||||
emit invertedChanged(d->inverted);
|
emit invertedChanged(d->inverted);
|
||||||
|
@ -59,29 +59,35 @@ public:
|
|||||||
|
|
||||||
QRangeModel *q_ptr;
|
QRangeModel *q_ptr;
|
||||||
|
|
||||||
inline qreal effectivePosAtMin() const {
|
inline qreal effectivePosAtMin() const
|
||||||
|
{
|
||||||
return inverted ? posatmax : posatmin;
|
return inverted ? posatmax : posatmin;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline qreal effectivePosAtMax() const {
|
inline qreal effectivePosAtMax() const
|
||||||
|
{
|
||||||
return inverted ? posatmin : posatmax;
|
return inverted ? posatmin : posatmax;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline qreal equivalentPosition(qreal value) const {
|
inline qreal equivalentPosition(qreal value) const
|
||||||
|
{
|
||||||
// Return absolute position from absolute value
|
// Return absolute position from absolute value
|
||||||
const qreal valueRange = maximum - minimum;
|
const qreal valueRange = maximum - minimum;
|
||||||
if (valueRange == 0)
|
if (valueRange == 0) {
|
||||||
return effectivePosAtMin();
|
return effectivePosAtMin();
|
||||||
|
}
|
||||||
|
|
||||||
const qreal scale = (effectivePosAtMax() - effectivePosAtMin()) / valueRange;
|
const qreal scale = (effectivePosAtMax() - effectivePosAtMin()) / valueRange;
|
||||||
return (value - minimum) * scale + effectivePosAtMin();
|
return (value - minimum) * scale + effectivePosAtMin();
|
||||||
}
|
}
|
||||||
|
|
||||||
inline qreal equivalentValue(qreal pos) const {
|
inline qreal equivalentValue(qreal pos) const
|
||||||
|
{
|
||||||
// Return absolute value from absolute position
|
// Return absolute value from absolute position
|
||||||
const qreal posRange = effectivePosAtMax() - effectivePosAtMin();
|
const qreal posRange = effectivePosAtMax() - effectivePosAtMin();
|
||||||
if (posRange == 0)
|
if (posRange == 0) {
|
||||||
return minimum;
|
return minimum;
|
||||||
|
}
|
||||||
|
|
||||||
const qreal scale = (maximum - minimum) / posRange;
|
const qreal scale = (maximum - minimum) / posRange;
|
||||||
return (pos - effectivePosAtMin()) * scale + minimum;
|
return (pos - effectivePosAtMin()) * scale + minimum;
|
||||||
|
@ -25,7 +25,6 @@
|
|||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
|
|
||||||
FallbackComponent::FallbackComponent(QObject *parent)
|
FallbackComponent::FallbackComponent(QObject *parent)
|
||||||
: QObject(parent)
|
: QObject(parent)
|
||||||
{
|
{
|
||||||
|
@ -20,7 +20,6 @@
|
|||||||
#ifndef FALLBACKCOMPONENT_H
|
#ifndef FALLBACKCOMPONENT_H
|
||||||
#define FALLBACKCOMPONENT_H
|
#define FALLBACKCOMPONENT_H
|
||||||
|
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QCache>
|
#include <QCache>
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
@ -60,11 +59,9 @@ public:
|
|||||||
QString basePath() const;
|
QString basePath() const;
|
||||||
void setBasePath(const QString &basePath);
|
void setBasePath(const QString &basePath);
|
||||||
|
|
||||||
|
|
||||||
QStringList candidates() const;
|
QStringList candidates() const;
|
||||||
void setCandidates(const QStringList &candidates);
|
void setCandidates(const QStringList &candidates);
|
||||||
|
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void basePathChanged();
|
void basePathChanged();
|
||||||
void candidatesChanged();
|
void candidatesChanged();
|
||||||
|
@ -26,7 +26,6 @@
|
|||||||
#include <QtQml>
|
#include <QtQml>
|
||||||
#include <QQmlEngine>
|
#include <QQmlEngine>
|
||||||
|
|
||||||
|
|
||||||
// #include <KSharedConfig>
|
// #include <KSharedConfig>
|
||||||
// #include <KConfigGroup>
|
// #include <KConfigGroup>
|
||||||
|
|
||||||
@ -43,6 +42,5 @@ void PlasmaExtraComponentsPlugin::registerTypes(const char *uri)
|
|||||||
qmlRegisterType<FallbackComponent>(uri, 2, 0, "FallbackComponent");
|
qmlRegisterType<FallbackComponent>(uri, 2, 0, "FallbackComponent");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#include "plasmaextracomponentsplugin.moc"
|
#include "plasmaextracomponentsplugin.moc"
|
||||||
|
|
||||||
|
@ -26,7 +26,6 @@
|
|||||||
#include <KActivities/ResourceInstance>
|
#include <KActivities/ResourceInstance>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
|
|
||||||
ResourceInstance::ResourceInstance(QQuickItem *parent)
|
ResourceInstance::ResourceInstance(QQuickItem *parent)
|
||||||
: QQuickItem(parent)
|
: QQuickItem(parent)
|
||||||
{
|
{
|
||||||
@ -129,7 +128,6 @@ void ResourceInstance::notifyFocusedIn()
|
|||||||
m_resourceInstance->notifyFocusedIn();
|
m_resourceInstance->notifyFocusedIn();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ResourceInstance::notifyFocusedOut()
|
void ResourceInstance::notifyFocusedOut()
|
||||||
{
|
{
|
||||||
//ensure the resource instance exists
|
//ensure the resource instance exists
|
||||||
|
@ -22,7 +22,8 @@
|
|||||||
#include <QQuickItem>
|
#include <QQuickItem>
|
||||||
#include <QUrl>
|
#include <QUrl>
|
||||||
|
|
||||||
namespace KActivities {
|
namespace KActivities
|
||||||
|
{
|
||||||
class ResourceInstance;
|
class ResourceInstance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -87,11 +87,12 @@ void Application::setRunning(bool run)
|
|||||||
qDebug() << "running?" << run;
|
qDebug() << "running?" << run;
|
||||||
d->running = run;
|
d->running = run;
|
||||||
|
|
||||||
if (run)
|
if (run) {
|
||||||
start();
|
start();
|
||||||
else
|
} else {
|
||||||
terminate();
|
terminate();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Application::start()
|
void Application::start()
|
||||||
{
|
{
|
||||||
|
@ -36,7 +36,8 @@
|
|||||||
* }
|
* }
|
||||||
* </code>
|
* </code>
|
||||||
*/
|
*/
|
||||||
class Application: public QObject {
|
class Application: public QObject
|
||||||
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -24,7 +24,8 @@
|
|||||||
|
|
||||||
#include <QProcess>
|
#include <QProcess>
|
||||||
|
|
||||||
class Application::Private: public QObject {
|
class Application::Private: public QObject
|
||||||
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
Private(Application *);
|
Private(Application *);
|
||||||
|
@ -31,7 +31,8 @@
|
|||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
class IconDialog::Private {
|
class IconDialog::Private
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
utils::SharedSingleton<KIconDialog> dialog;
|
utils::SharedSingleton<KIconDialog> dialog;
|
||||||
|
@ -39,7 +39,8 @@
|
|||||||
* icon = iconDialog.openDialog()
|
* icon = iconDialog.openDialog()
|
||||||
* </code>
|
* </code>
|
||||||
*/
|
*/
|
||||||
class IconDialog: public QObject {
|
class IconDialog: public QObject
|
||||||
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -24,7 +24,8 @@
|
|||||||
#include "application.h"
|
#include "application.h"
|
||||||
#include "icondialog.h"
|
#include "icondialog.h"
|
||||||
|
|
||||||
class PlatformComponentsPlugin: public QQmlExtensionPlugin {
|
class PlatformComponentsPlugin: public QQmlExtensionPlugin
|
||||||
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_PLUGIN_METADATA(IID "org.kde.plasma.platformcomponents")
|
Q_PLUGIN_METADATA(IID "org.kde.plasma.platformcomponents")
|
||||||
|
|
||||||
@ -35,8 +36,7 @@ public:
|
|||||||
qDebug() << "instantiated plugin object";
|
qDebug() << "instantiated plugin object";
|
||||||
}
|
}
|
||||||
|
|
||||||
void registerTypes(const char * uri) Q_DECL_OVERRIDE
|
void registerTypes(const char *uri) Q_DECL_OVERRIDE {
|
||||||
{
|
|
||||||
qDebug() << "plugin loaded, registering types " << uri;
|
qDebug() << "plugin loaded, registering types " << uri;
|
||||||
|
|
||||||
Q_ASSERT(QLatin1String(uri) == QLatin1String("org.kde.plasma.platformcomponents"));
|
Q_ASSERT(QLatin1String(uri) == QLatin1String("org.kde.plasma.platformcomponents"));
|
||||||
|
@ -22,10 +22,12 @@
|
|||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
namespace utils {
|
namespace utils
|
||||||
|
{
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
class d_ptr {
|
class d_ptr
|
||||||
|
{
|
||||||
private:
|
private:
|
||||||
std::unique_ptr<T> d;
|
std::unique_ptr<T> d;
|
||||||
|
|
||||||
|
@ -22,7 +22,8 @@
|
|||||||
|
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
namespace utils {
|
namespace utils
|
||||||
|
{
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
d_ptr<T>::d_ptr() : d(new T())
|
d_ptr<T>::d_ptr() : d(new T())
|
||||||
|
@ -22,10 +22,12 @@
|
|||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
namespace utils {
|
namespace utils
|
||||||
|
{
|
||||||
|
|
||||||
template <typename Target>
|
template <typename Target>
|
||||||
class SharedSingleton {
|
class SharedSingleton
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
static std::shared_ptr<Target> instance()
|
static std::shared_ptr<Target> instance()
|
||||||
{
|
{
|
||||||
|
@ -85,5 +85,4 @@ void PlasmaKPartView::updateGeometry()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#include "plasmakpartview.moc"
|
#include "plasmakpartview.moc"
|
||||||
|
@ -58,8 +58,6 @@
|
|||||||
return __ret__; \
|
return __ret__; \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#define ADD_METHOD(__p__, __f__) \
|
#define ADD_METHOD(__p__, __f__) \
|
||||||
__p__.setProperty(#__f__, __p__.engine()->newFunction(__f__))
|
__p__.setProperty(#__f__, __p__.engine()->newFunction(__f__))
|
||||||
|
|
||||||
@ -77,7 +75,6 @@ do { \
|
|||||||
#define ADD_ENUM_VALUE(__c__, __ns__, __v__) \
|
#define ADD_ENUM_VALUE(__c__, __ns__, __v__) \
|
||||||
__c__.setProperty(#__v__, QScriptValue(__c__.engine(), __ns__::__v__))
|
__c__.setProperty(#__v__, QScriptValue(__c__.engine(), __ns__::__v__))
|
||||||
|
|
||||||
|
|
||||||
#define BEGIN_DECLARE_METHOD(Class, __mtd__) \
|
#define BEGIN_DECLARE_METHOD(Class, __mtd__) \
|
||||||
static QScriptValue __mtd__(QScriptContext *ctx, QScriptEngine *eng) \
|
static QScriptValue __mtd__(QScriptContext *ctx, QScriptEngine *eng) \
|
||||||
{ \
|
{ \
|
||||||
@ -86,7 +83,6 @@ static QScriptValue __mtd__(QScriptContext *ctx, QScriptEngine *eng) \
|
|||||||
#define END_DECLARE_METHOD \
|
#define END_DECLARE_METHOD \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#define DECLARE_GET_METHOD(Class, __get__) \
|
#define DECLARE_GET_METHOD(Class, __get__) \
|
||||||
BEGIN_DECLARE_METHOD(Class, __get__) { \
|
BEGIN_DECLARE_METHOD(Class, __get__) { \
|
||||||
return qScriptValueFromValue(eng, self->__get__()); \
|
return qScriptValueFromValue(eng, self->__get__()); \
|
||||||
@ -102,8 +98,6 @@ BEGIN_DECLARE_METHOD(Class, __set__) { \
|
|||||||
DECLARE_GET_METHOD(Class, /*T,*/ __get__) \
|
DECLARE_GET_METHOD(Class, /*T,*/ __get__) \
|
||||||
DECLARE_SET_METHOD(Class, T, __set__)
|
DECLARE_SET_METHOD(Class, T, __set__)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#define DECLARE_SIMPLE_GET_METHOD(Class, __get__) \
|
#define DECLARE_SIMPLE_GET_METHOD(Class, __get__) \
|
||||||
BEGIN_DECLARE_METHOD(Class, __get__) { \
|
BEGIN_DECLARE_METHOD(Class, __get__) { \
|
||||||
return QScriptValue(eng, self->__get__()); \
|
return QScriptValue(eng, self->__get__()); \
|
||||||
@ -162,7 +156,6 @@ BEGIN_DECLARE_METHOD(Class, __get__) { \
|
|||||||
DECLARE_QOBJECT_GET_METHOD(Class, __get__) \
|
DECLARE_QOBJECT_GET_METHOD(Class, __get__) \
|
||||||
DECLARE_QOBJECT_SET_METHOD(Class, __set__)
|
DECLARE_QOBJECT_SET_METHOD(Class, __set__)
|
||||||
|
|
||||||
|
|
||||||
#define DECLARE_VOID_METHOD(Class, __fun__) \
|
#define DECLARE_VOID_METHOD(Class, __fun__) \
|
||||||
BEGIN_DECLARE_METHOD(Class, __fun__) { \
|
BEGIN_DECLARE_METHOD(Class, __fun__) { \
|
||||||
self->__fun__(); \
|
self->__fun__(); \
|
||||||
@ -198,7 +191,6 @@ BEGIN_DECLARE_METHOD(Class, __fun__) { \
|
|||||||
return QScriptValue(eng, self->__fun__(qscriptvalue_cast<ArgType>(ctx->argument(0)))); \
|
return QScriptValue(eng, self->__fun__(qscriptvalue_cast<ArgType>(ctx->argument(0)))); \
|
||||||
} END_DECLARE_METHOD
|
} END_DECLARE_METHOD
|
||||||
|
|
||||||
|
|
||||||
#define DECLARE_POINTER_METATYPE(T) \
|
#define DECLARE_POINTER_METATYPE(T) \
|
||||||
Q_DECLARE_METATYPE(T*) \
|
Q_DECLARE_METATYPE(T*) \
|
||||||
Q_DECLARE_METATYPE(QScript::Pointer<T>::wrapped_pointer_type)
|
Q_DECLARE_METATYPE(QScript::Pointer<T>::wrapped_pointer_type)
|
||||||
@ -219,9 +211,10 @@ public:
|
|||||||
|
|
||||||
~Pointer()
|
~Pointer()
|
||||||
{
|
{
|
||||||
if (!(m_flags & UserOwnership))
|
if (!(m_flags & UserOwnership)) {
|
||||||
delete m_value;
|
delete m_value;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
operator T *()
|
operator T *()
|
||||||
{
|
{
|
||||||
@ -240,8 +233,9 @@ public:
|
|||||||
|
|
||||||
static QScriptValue toScriptValue(QScriptEngine *engine, T *const &source)
|
static QScriptValue toScriptValue(QScriptEngine *engine, T *const &source)
|
||||||
{
|
{
|
||||||
if (!source)
|
if (!source) {
|
||||||
return engine->nullValue();
|
return engine->nullValue();
|
||||||
|
}
|
||||||
return engine->newVariant(qVariantFromValue(source));
|
return engine->newVariant(qVariantFromValue(source));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -284,11 +278,17 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
uint flags() const
|
uint flags() const
|
||||||
{ return m_flags; }
|
{
|
||||||
|
return m_flags;
|
||||||
|
}
|
||||||
void setFlags(uint flags)
|
void setFlags(uint flags)
|
||||||
{ m_flags = flags; }
|
{
|
||||||
|
m_flags = flags;
|
||||||
|
}
|
||||||
void unsetFlags(uint flags)
|
void unsetFlags(uint flags)
|
||||||
{ m_flags &= ~flags; }
|
{
|
||||||
|
m_flags &= ~flags;
|
||||||
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
Pointer(T *value, uint flags)
|
Pointer(T *value, uint flags)
|
||||||
@ -323,20 +323,22 @@ inline void maybeReleaseOwnership(const QScriptValue &value)
|
|||||||
if (value.isVariant()) {
|
if (value.isVariant()) {
|
||||||
QVariant var = value.toVariant();
|
QVariant var = value.toVariant();
|
||||||
QByteArray name = QMetaType::typeName(var.userType());
|
QByteArray name = QMetaType::typeName(var.userType());
|
||||||
if (name.startsWith("QScript::Pointer<"))
|
if (name.startsWith("QScript::Pointer<")) {
|
||||||
(*reinterpret_cast<Pointer<void *>::wrapped_pointer_type *>(var.data()))->setFlags(UserOwnership);
|
(*reinterpret_cast<Pointer<void *>::wrapped_pointer_type *>(var.data()))->setFlags(UserOwnership);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
inline void maybeTakeOwnership(const QScriptValue &value)
|
inline void maybeTakeOwnership(const QScriptValue &value)
|
||||||
{
|
{
|
||||||
if (value.isVariant()) {
|
if (value.isVariant()) {
|
||||||
QVariant var = value.toVariant();
|
QVariant var = value.toVariant();
|
||||||
QByteArray name = QMetaType::typeName(var.userType());
|
QByteArray name = QMetaType::typeName(var.userType());
|
||||||
if (name.startsWith("QScript::Pointer<"))
|
if (name.startsWith("QScript::Pointer<")) {
|
||||||
(*reinterpret_cast<Pointer<void *>::wrapped_pointer_type *>(var.data()))->unsetFlags(UserOwnership);
|
(*reinterpret_cast<Pointer<void *>::wrapped_pointer_type *>(var.data()))->unsetFlags(UserOwnership);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
inline QScriptValue wrapPointer(QScriptEngine *eng, T *ptr, uint flags = 0)
|
inline QScriptValue wrapPointer(QScriptEngine *eng, T *ptr, uint flags = 0)
|
||||||
@ -348,7 +350,8 @@ inline QScriptValue wrapPointer(QScriptEngine *eng, T *ptr, uint flags = 0)
|
|||||||
|
|
||||||
#ifdef QGRAPHICSITEM_H
|
#ifdef QGRAPHICSITEM_H
|
||||||
|
|
||||||
namespace QScript {
|
namespace QScript
|
||||||
|
{
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
inline QScriptValue wrapGVPointer(QScriptEngine *eng, T *item)
|
inline QScriptValue wrapGVPointer(QScriptEngine *eng, T *item)
|
||||||
|
@ -24,8 +24,7 @@ Q_DECLARE_METATYPE(QRectF)
|
|||||||
|
|
||||||
static QScriptValue ctor(QScriptContext *ctx, QScriptEngine *eng)
|
static QScriptValue ctor(QScriptContext *ctx, QScriptEngine *eng)
|
||||||
{
|
{
|
||||||
if (ctx->argumentCount() == 4)
|
if (ctx->argumentCount() == 4) {
|
||||||
{
|
|
||||||
qreal x = ctx->argument(0).toNumber();
|
qreal x = ctx->argument(0).toNumber();
|
||||||
qreal y = ctx->argument(1).toNumber();
|
qreal y = ctx->argument(1).toNumber();
|
||||||
qreal width = ctx->argument(2).toNumber();
|
qreal width = ctx->argument(2).toNumber();
|
||||||
@ -158,7 +157,6 @@ static QScriptValue moveRight(QScriptContext *ctx, QScriptEngine *)
|
|||||||
return QScriptValue();
|
return QScriptValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static QScriptValue moveTo(QScriptContext *ctx, QScriptEngine *)
|
static QScriptValue moveTo(QScriptContext *ctx, QScriptEngine *)
|
||||||
{
|
{
|
||||||
DECLARE_SELF(QRectF, moveTo);
|
DECLARE_SELF(QRectF, moveTo);
|
||||||
|
@ -56,7 +56,6 @@
|
|||||||
#include "private/associatedapplicationmanager_p.h"
|
#include "private/associatedapplicationmanager_p.h"
|
||||||
#include "private/containment_p.h"
|
#include "private/containment_p.h"
|
||||||
|
|
||||||
|
|
||||||
namespace Plasma
|
namespace Plasma
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -612,7 +611,6 @@ QKeySequence Applet::globalShortcut() const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return QKeySequence();
|
return QKeySequence();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,7 +47,6 @@ class Containment;
|
|||||||
class DataEngine;
|
class DataEngine;
|
||||||
class Package;
|
class Package;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class Applet plasma/applet.h <Plasma/Applet>
|
* @class Applet plasma/applet.h <Plasma/Applet>
|
||||||
*
|
*
|
||||||
@ -239,7 +238,6 @@ class PLASMA_EXPORT Applet : public QObject
|
|||||||
*/
|
*/
|
||||||
void updateConstraints(Plasma::Types::Constraints constraints = Plasma::Types::AllConstraints);
|
void updateConstraints(Plasma::Types::Constraints constraints = Plasma::Types::AllConstraints);
|
||||||
|
|
||||||
|
|
||||||
//METADATA
|
//METADATA
|
||||||
/**
|
/**
|
||||||
* @return metadata information about this plugin
|
* @return metadata information about this plugin
|
||||||
@ -293,7 +291,6 @@ class PLASMA_EXPORT Applet : public QObject
|
|||||||
*/
|
*/
|
||||||
void setIcon(const QString &icon);
|
void setIcon(const QString &icon);
|
||||||
|
|
||||||
|
|
||||||
//ACTIONS
|
//ACTIONS
|
||||||
/**
|
/**
|
||||||
* Returns a list of context-related QAction instances.
|
* Returns a list of context-related QAction instances.
|
||||||
@ -406,7 +403,6 @@ class PLASMA_EXPORT Applet : public QObject
|
|||||||
*/
|
*/
|
||||||
void activated();
|
void activated();
|
||||||
|
|
||||||
|
|
||||||
//TODO: fix usage in containment, port to QObject::destroyed
|
//TODO: fix usage in containment, port to QObject::destroyed
|
||||||
/**
|
/**
|
||||||
* Emitted when the applet is deleted
|
* Emitted when the applet is deleted
|
||||||
@ -466,7 +462,6 @@ class PLASMA_EXPORT Applet : public QObject
|
|||||||
*/
|
*/
|
||||||
virtual void configChanged();
|
virtual void configChanged();
|
||||||
|
|
||||||
|
|
||||||
//UTILS
|
//UTILS
|
||||||
/**
|
/**
|
||||||
* Sends all pending constraints updates to the applet. Will usually
|
* Sends all pending constraints updates to the applet. Will usually
|
||||||
@ -486,7 +481,6 @@ class PLASMA_EXPORT Applet : public QObject
|
|||||||
**/
|
**/
|
||||||
virtual void init();
|
virtual void init();
|
||||||
|
|
||||||
|
|
||||||
//ASSOCIATED APPLICATION
|
//ASSOCIATED APPLICATION
|
||||||
/**
|
/**
|
||||||
* Open the application associated to this applet, if it's not set
|
* Open the application associated to this applet, if it's not set
|
||||||
@ -498,7 +492,6 @@ class PLASMA_EXPORT Applet : public QObject
|
|||||||
*/
|
*/
|
||||||
void runAssociatedApplication();
|
void runAssociatedApplication();
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
//CONSTRUCTORS
|
//CONSTRUCTORS
|
||||||
/**
|
/**
|
||||||
@ -576,7 +569,6 @@ class PLASMA_EXPORT Applet : public QObject
|
|||||||
*/
|
*/
|
||||||
void timerEvent(QTimerEvent *event);
|
void timerEvent(QTimerEvent *event);
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/**
|
/**
|
||||||
* @internal This constructor is to be used with the Package loading system.
|
* @internal This constructor is to be used with the Package loading system.
|
||||||
|
@ -181,7 +181,6 @@ void Containment::restore(KConfigGroup &group)
|
|||||||
KConfigGroup cfg = KConfigGroup(corona()->config(), "ActionPlugins");
|
KConfigGroup cfg = KConfigGroup(corona()->config(), "ActionPlugins");
|
||||||
cfg = KConfigGroup(&cfg, QString::number(containmentType()));
|
cfg = KConfigGroup(&cfg, QString::number(containmentType()));
|
||||||
|
|
||||||
|
|
||||||
//qDebug() << cfg.keyList();
|
//qDebug() << cfg.keyList();
|
||||||
if (cfg.exists()) {
|
if (cfg.exists()) {
|
||||||
foreach (const QString &key, cfg.keyList()) {
|
foreach (const QString &key, cfg.keyList()) {
|
||||||
@ -565,6 +564,4 @@ void Containment::reactToScreenChange()
|
|||||||
|
|
||||||
} // Plasma namespace
|
} // Plasma namespace
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#include "moc_containment.cpp"
|
#include "moc_containment.cpp"
|
||||||
|
@ -30,7 +30,6 @@
|
|||||||
|
|
||||||
#include <plasma/applet.h>
|
#include <plasma/applet.h>
|
||||||
|
|
||||||
|
|
||||||
namespace Plasma
|
namespace Plasma
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -197,7 +196,6 @@ class PLASMA_EXPORT Containment : public Applet
|
|||||||
*/
|
*/
|
||||||
QHash<QString, ContainmentActions *> &containmentActions();
|
QHash<QString, ContainmentActions *> &containmentActions();
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @returns true when the ui of this containment is fully loaded, as well the ui of every applet in it
|
* @returns true when the ui of this containment is fully loaded, as well the ui of every applet in it
|
||||||
*/
|
*/
|
||||||
@ -310,8 +308,6 @@ Q_SIGNALS:
|
|||||||
*/
|
*/
|
||||||
virtual void restoreContents(KConfigGroup &group);
|
virtual void restoreContents(KConfigGroup &group);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/**
|
/**
|
||||||
* @internal This constructor is to be used with the Package loading system.
|
* @internal This constructor is to be used with the Package loading system.
|
||||||
|
@ -121,8 +121,7 @@ QString ContainmentActions::eventToString(QEvent *event)
|
|||||||
switch (event->type()) {
|
switch (event->type()) {
|
||||||
case QEvent::MouseButtonPress:
|
case QEvent::MouseButtonPress:
|
||||||
case QEvent::MouseButtonRelease:
|
case QEvent::MouseButtonRelease:
|
||||||
case QEvent::MouseButtonDblClick:
|
case QEvent::MouseButtonDblClick: {
|
||||||
{
|
|
||||||
QMouseEvent *e = static_cast<QMouseEvent *>(event);
|
QMouseEvent *e = static_cast<QMouseEvent *>(event);
|
||||||
int m = QObject::staticQtMetaObject.indexOfEnumerator("MouseButtons");
|
int m = QObject::staticQtMetaObject.indexOfEnumerator("MouseButtons");
|
||||||
QMetaEnum mouse = QObject::staticQtMetaObject.enumerator(m);
|
QMetaEnum mouse = QObject::staticQtMetaObject.enumerator(m);
|
||||||
@ -130,8 +129,7 @@ QString ContainmentActions::eventToString(QEvent *event)
|
|||||||
modifiers = e->modifiers();
|
modifiers = e->modifiers();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case QEvent::Wheel:
|
case QEvent::Wheel: {
|
||||||
{
|
|
||||||
QWheelEvent *e = static_cast<QWheelEvent *>(event);
|
QWheelEvent *e = static_cast<QWheelEvent *>(event);
|
||||||
int o = QObject::staticQtMetaObject.indexOfEnumerator("Orientations");
|
int o = QObject::staticQtMetaObject.indexOfEnumerator("Orientations");
|
||||||
QMetaEnum orient = QObject::staticQtMetaObject.enumerator(o);
|
QMetaEnum orient = QObject::staticQtMetaObject.enumerator(o);
|
||||||
@ -140,8 +138,7 @@ QString ContainmentActions::eventToString(QEvent *event)
|
|||||||
modifiers = e->modifiers();
|
modifiers = e->modifiers();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case QEvent::ContextMenu:
|
case QEvent::ContextMenu: {
|
||||||
{
|
|
||||||
int m = QObject::staticQtMetaObject.indexOfEnumerator("MouseButtons");
|
int m = QObject::staticQtMetaObject.indexOfEnumerator("MouseButtons");
|
||||||
QMetaEnum mouse = QObject::staticQtMetaObject.enumerator(m);
|
QMetaEnum mouse = QObject::staticQtMetaObject.enumerator(m);
|
||||||
trigger = mouse.valueToKey(Qt::RightButton);
|
trigger = mouse.valueToKey(Qt::RightButton);
|
||||||
@ -167,5 +164,4 @@ void ContainmentActions::setContainment(Containment *newContainment)
|
|||||||
|
|
||||||
} // Plasma namespace
|
} // Plasma namespace
|
||||||
|
|
||||||
|
|
||||||
#include "moc_containmentactions.cpp"
|
#include "moc_containmentactions.cpp"
|
||||||
|
@ -217,7 +217,6 @@ int Corona::screenForContainment(const Containment* containment) const
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int Corona::numScreens() const
|
int Corona::numScreens() const
|
||||||
{
|
{
|
||||||
return 1;
|
return 1;
|
||||||
@ -552,6 +551,4 @@ QList<Plasma::Containment *> CoronaPrivate::importLayout(const KConfigGroup &con
|
|||||||
|
|
||||||
} // namespace Plasma
|
} // namespace Plasma
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#include "moc_corona.cpp"
|
#include "moc_corona.cpp"
|
||||||
|
@ -204,8 +204,7 @@ DataEngine* DataContainer::getDataEngine()
|
|||||||
{
|
{
|
||||||
QObject *o = this;
|
QObject *o = this;
|
||||||
DataEngine *de = NULL;
|
DataEngine *de = NULL;
|
||||||
while (de == NULL)
|
while (de == NULL) {
|
||||||
{
|
|
||||||
o = dynamic_cast<QObject *>(o->parent());
|
o = dynamic_cast<QObject *>(o->parent());
|
||||||
if (o == NULL) {
|
if (o == NULL) {
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -397,6 +396,4 @@ void DataContainer::timerEvent(QTimerEvent * event)
|
|||||||
|
|
||||||
} // Plasma namespace
|
} // Plasma namespace
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#include "moc_datacontainer.cpp"
|
#include "moc_datacontainer.cpp"
|
||||||
|
@ -637,5 +637,4 @@ void DataEnginePrivate::scheduleSourcesUpdated()
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#include "moc_dataengine.cpp"
|
#include "moc_dataengine.cpp"
|
||||||
|
@ -111,4 +111,3 @@ DataEngine *DataEngineConsumer::dataEngine(const QString &name)
|
|||||||
|
|
||||||
#include "private/moc_dataengineconsumer_p.cpp"
|
#include "private/moc_dataengineconsumer_p.cpp"
|
||||||
|
|
||||||
|
|
||||||
|
@ -75,4 +75,3 @@ private:
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
@ -38,7 +38,6 @@
|
|||||||
namespace Plasma
|
namespace Plasma
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
QHash<QString, FrameData *> FrameSvgPrivate::s_sharedFrames;
|
QHash<QString, FrameData *> FrameSvgPrivate::s_sharedFrames;
|
||||||
|
|
||||||
// Any attempt to generate a frame whose width or height is larger than this
|
// Any attempt to generate a frame whose width or height is larger than this
|
||||||
@ -797,7 +796,6 @@ void FrameSvgPrivate::generateFrameBackground(FrameData *frame)
|
|||||||
const int topOffset = 0;
|
const int topOffset = 0;
|
||||||
const int leftOffset = 0;
|
const int leftOffset = 0;
|
||||||
|
|
||||||
|
|
||||||
if (!size.isValid()) {
|
if (!size.isValid()) {
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
// qDebug() << "Invalid frame size" << size;
|
// qDebug() << "Invalid frame size" << size;
|
||||||
@ -1025,7 +1023,6 @@ void FrameSvgPrivate::updateSizes() const
|
|||||||
frame->fixedTopMargin = frame->fixedTopHeight;
|
frame->fixedTopMargin = frame->fixedTopHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//The same, but its size depends from the margin being enabled
|
//The same, but its size depends from the margin being enabled
|
||||||
if (frame->enabledBorders & FrameSvg::TopBorder) {
|
if (frame->enabledBorders & FrameSvg::TopBorder) {
|
||||||
frame->topHeight = q->elementSize(prefix % "top").height();
|
frame->topHeight = q->elementSize(prefix % "top").height();
|
||||||
@ -1167,5 +1164,4 @@ int FrameData::refcount() const
|
|||||||
|
|
||||||
} // Plasma namespace
|
} // Plasma namespace
|
||||||
|
|
||||||
|
|
||||||
#include "moc_framesvg.cpp"
|
#include "moc_framesvg.cpp"
|
||||||
|
@ -62,6 +62,4 @@ KJob* PackageStructure::uninstall(Package *package, const QString &packageRoot)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#include "moc_packagestructure.cpp"
|
#include "moc_packagestructure.cpp"
|
||||||
|
@ -301,8 +301,6 @@ PLASMA_EXPORT Types::Direction locationToInverseDirection(Types::Location locati
|
|||||||
|
|
||||||
} // Plasma namespace
|
} // Plasma namespace
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Q_DECLARE_OPERATORS_FOR_FLAGS(Plasma::Types::Constraints)
|
Q_DECLARE_OPERATORS_FOR_FLAGS(Plasma::Types::Constraints)
|
||||||
Q_DECLARE_OPERATORS_FOR_FLAGS(Plasma::Types::Flip)
|
Q_DECLARE_OPERATORS_FOR_FLAGS(Plasma::Types::Flip)
|
||||||
Q_DECLARE_OPERATORS_FOR_FLAGS(Plasma::Types::ComponentTypes)
|
Q_DECLARE_OPERATORS_FOR_FLAGS(Plasma::Types::ComponentTypes)
|
||||||
|
@ -42,7 +42,8 @@
|
|||||||
#include "private/service_p.h" // for NullService
|
#include "private/service_p.h" // for NullService
|
||||||
#include "private/storage_p.h"
|
#include "private/storage_p.h"
|
||||||
|
|
||||||
namespace Plasma {
|
namespace Plasma
|
||||||
|
{
|
||||||
|
|
||||||
static PluginLoader *s_pluginLoader = 0;
|
static PluginLoader *s_pluginLoader = 0;
|
||||||
|
|
||||||
@ -109,8 +110,6 @@ QString PluginLoaderPrivate::parentAppConstraint(const QString &parentApp)
|
|||||||
return QString("[X-KDE-ParentApp] == '%1'").arg(parentApp);
|
return QString("[X-KDE-ParentApp] == '%1'").arg(parentApp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
PluginLoader::PluginLoader()
|
PluginLoader::PluginLoader()
|
||||||
: d(new PluginLoaderPrivate)
|
: d(new PluginLoaderPrivate)
|
||||||
{
|
{
|
||||||
@ -220,7 +219,6 @@ Applet *PluginLoader::loadApplet(const QString &name, uint appletId, const QVari
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QString error;
|
QString error;
|
||||||
applet = offer->createInstance<Plasma::Applet>(0, allArgs, &error);
|
applet = offer->createInstance<Plasma::Applet>(0, allArgs, &error);
|
||||||
|
|
||||||
@ -618,7 +616,6 @@ KPluginInfo::List PluginLoader::listContainments(const QString &category,
|
|||||||
return listContainmentsOfType(QString(), category, parentApp);
|
return listContainmentsOfType(QString(), category, parentApp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
KPluginInfo::List PluginLoader::listContainmentsOfType(const QString &type,
|
KPluginInfo::List PluginLoader::listContainmentsOfType(const QString &type,
|
||||||
const QString &category,
|
const QString &category,
|
||||||
const QString &parentApp)
|
const QString &parentApp)
|
||||||
@ -683,7 +680,6 @@ QStringList PluginLoader::listContainmentTypes()
|
|||||||
return types.toList();
|
return types.toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
KPluginInfo::List PluginLoader::listDataEngineInfo(const QString &parentApp)
|
KPluginInfo::List PluginLoader::listDataEngineInfo(const QString &parentApp)
|
||||||
{
|
{
|
||||||
KPluginInfo::List list;
|
KPluginInfo::List list;
|
||||||
|
@ -24,7 +24,8 @@
|
|||||||
#include <plasma/plasma.h>
|
#include <plasma/plasma.h>
|
||||||
#include <kplugininfo.h>
|
#include <kplugininfo.h>
|
||||||
|
|
||||||
namespace Plasma {
|
namespace Plasma
|
||||||
|
{
|
||||||
|
|
||||||
class Applet;
|
class Applet;
|
||||||
class Containment;
|
class Containment;
|
||||||
|
@ -70,7 +70,6 @@ class AssociatedApplicationManagerSingleton
|
|||||||
|
|
||||||
Q_GLOBAL_STATIC(AssociatedApplicationManagerSingleton, privateAssociatedApplicationManagerSelf)
|
Q_GLOBAL_STATIC(AssociatedApplicationManagerSingleton, privateAssociatedApplicationManagerSelf)
|
||||||
|
|
||||||
|
|
||||||
AssociatedApplicationManager::AssociatedApplicationManager(QObject *parent)
|
AssociatedApplicationManager::AssociatedApplicationManager(QObject *parent)
|
||||||
: QObject(parent),
|
: QObject(parent),
|
||||||
d(new AssociatedApplicationManagerPrivate())
|
d(new AssociatedApplicationManagerPrivate())
|
||||||
@ -144,7 +143,6 @@ bool AssociatedApplicationManager::appletHasValidAssociatedApplication(const Pla
|
|||||||
return (d->applicationNames.contains(applet) || d->urlLists.contains(applet));
|
return (d->applicationNames.contains(applet) || d->urlLists.contains(applet));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
} // namespace Plasma
|
} // namespace Plasma
|
||||||
|
|
||||||
#include <moc_associatedapplicationmanager_p.cpp>
|
#include <moc_associatedapplicationmanager_p.cpp>
|
||||||
|
@ -198,7 +198,6 @@ class ConfigLoaderPrivate
|
|||||||
return saveDefaults;
|
return saveDefaults;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QList<bool *> bools;
|
QList<bool *> bools;
|
||||||
QList<QString *> strings;
|
QList<QString *> strings;
|
||||||
QList<QStringList *> stringlists;
|
QList<QStringList *> stringlists;
|
||||||
|
@ -22,7 +22,6 @@
|
|||||||
|
|
||||||
#include "private/containment_p.h"
|
#include "private/containment_p.h"
|
||||||
|
|
||||||
|
|
||||||
#include <kactioncollection.h>
|
#include <kactioncollection.h>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <kiconloader.h>
|
#include <kiconloader.h>
|
||||||
@ -37,7 +36,6 @@
|
|||||||
|
|
||||||
#include "private/applet_p.h"
|
#include "private/applet_p.h"
|
||||||
|
|
||||||
|
|
||||||
namespace Plasma
|
namespace Plasma
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -29,7 +29,6 @@
|
|||||||
#include "corona.h"
|
#include "corona.h"
|
||||||
#include "containmentactions.h"
|
#include "containmentactions.h"
|
||||||
|
|
||||||
|
|
||||||
class KJob;
|
class KJob;
|
||||||
|
|
||||||
namespace KIO
|
namespace KIO
|
||||||
|
@ -20,7 +20,6 @@
|
|||||||
#ifndef PLASMA_CONTAINMENTACTIONSPRIVATE_H
|
#ifndef PLASMA_CONTAINMENTACTIONSPRIVATE_H
|
||||||
#define PLASMA_CONTAINMENTACTIONSPRIVATE_H
|
#define PLASMA_CONTAINMENTACTIONSPRIVATE_H
|
||||||
|
|
||||||
|
|
||||||
namespace Plasma
|
namespace Plasma
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -166,6 +166,4 @@ void SignalRelay::timerEvent(QTimerEvent *event)
|
|||||||
|
|
||||||
} // Plasma namespace
|
} // Plasma namespace
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#include "moc_datacontainer_p.cpp"
|
#include "moc_datacontainer_p.cpp"
|
||||||
|
@ -212,5 +212,4 @@ void DataEngineManager::timerEvent(QTimerEvent *)
|
|||||||
|
|
||||||
} // namespace Plasma
|
} // namespace Plasma
|
||||||
|
|
||||||
|
|
||||||
#include "moc_dataenginemanager_p.cpp"
|
#include "moc_dataenginemanager_p.cpp"
|
||||||
|
@ -74,7 +74,6 @@ class PLASMA_EXPORT DataEngineManager: public QObject
|
|||||||
*/
|
*/
|
||||||
void unloadEngine(const QString &name);
|
void unloadEngine(const QString &name);
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/**
|
/**
|
||||||
* Reimplemented from QObject
|
* Reimplemented from QObject
|
||||||
|
@ -62,12 +62,14 @@ void EffectWatcher::init(const QString &property)
|
|||||||
bool EffectWatcher::nativeEventFilter(const QByteArray &eventType, void *message, long *result)
|
bool EffectWatcher::nativeEventFilter(const QByteArray &eventType, void *message, long *result)
|
||||||
{
|
{
|
||||||
Q_UNUSED(result);
|
Q_UNUSED(result);
|
||||||
if (eventType != "xcb_generic_event_t")
|
if (eventType != "xcb_generic_event_t") {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
xcb_generic_event_t *event = reinterpret_cast<xcb_generic_event_t *>(message);
|
xcb_generic_event_t *event = reinterpret_cast<xcb_generic_event_t *>(message);
|
||||||
uint response_type = event->response_type & ~0x80;
|
uint response_type = event->response_type & ~0x80;
|
||||||
if (response_type != XCB_PROPERTY_NOTIFY || m_property == XCB_ATOM_NONE)
|
if (response_type != XCB_PROPERTY_NOTIFY || m_property == XCB_ATOM_NONE) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
xcb_property_notify_event_t *prop_event = reinterpret_cast<xcb_property_notify_event_t *>(event);
|
xcb_property_notify_event_t *prop_event = reinterpret_cast<xcb_property_notify_event_t *>(event);
|
||||||
if (prop_event->atom == m_property) {
|
if (prop_event->atom == m_property) {
|
||||||
|
@ -25,7 +25,8 @@
|
|||||||
|
|
||||||
namespace Plasma
|
namespace Plasma
|
||||||
{
|
{
|
||||||
class PackageJobPrivate {
|
class PackageJobPrivate
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
PackageJobThread *thread;
|
PackageJobThread *thread;
|
||||||
QString installPath;
|
QString installPath;
|
||||||
@ -36,10 +37,10 @@ PackageJob::PackageJob(const QString &servicePrefix, QObject* parent) :
|
|||||||
{
|
{
|
||||||
d = new PackageJobPrivate;
|
d = new PackageJobPrivate;
|
||||||
d->thread = new PackageJobThread(servicePrefix, this);
|
d->thread = new PackageJobThread(servicePrefix, this);
|
||||||
connect(d->thread, SIGNAL(finished(bool, const QString&)),
|
connect(d->thread, SIGNAL(finished(bool,QString)),
|
||||||
SLOT(slotFinished(bool, const QString&)), Qt::QueuedConnection);
|
SLOT(slotFinished(bool,QString)), Qt::QueuedConnection);
|
||||||
connect(d->thread, SIGNAL(installPathChanged(const QString&)),
|
connect(d->thread, SIGNAL(installPathChanged(QString)),
|
||||||
SIGNAL(installPathChanged(const QString&)), Qt::QueuedConnection);
|
SIGNAL(installPathChanged(QString)), Qt::QueuedConnection);
|
||||||
}
|
}
|
||||||
|
|
||||||
PackageJob::~PackageJob()
|
PackageJob::~PackageJob()
|
||||||
|
@ -22,7 +22,6 @@
|
|||||||
|
|
||||||
#include "kjob.h"
|
#include "kjob.h"
|
||||||
|
|
||||||
|
|
||||||
namespace Plasma
|
namespace Plasma
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -20,7 +20,6 @@
|
|||||||
|
|
||||||
#include "private/packagejobthread_p.h"
|
#include "private/packagejobthread_p.h"
|
||||||
|
|
||||||
|
|
||||||
#include "package.h"
|
#include "package.h"
|
||||||
#include "config-plasma.h"
|
#include "config-plasma.h"
|
||||||
|
|
||||||
@ -86,8 +85,9 @@ bool copyFolder(QString sourcePath, QString targetPath)
|
|||||||
bool removeFolder(QString folderPath)
|
bool removeFolder(QString folderPath)
|
||||||
{
|
{
|
||||||
QDir folder(folderPath);
|
QDir folder(folderPath);
|
||||||
if(!folder.exists())
|
if (!folder.exists()) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
foreach (const QString &fileName, folder.entryList(QDir::Files)) {
|
foreach (const QString &fileName, folder.entryList(QDir::Files)) {
|
||||||
if (!QFile::remove(folderPath + QDir::separator() + fileName)) {
|
if (!QFile::remove(folderPath + QDir::separator() + fileName)) {
|
||||||
@ -106,16 +106,14 @@ bool removeFolder(QString folderPath)
|
|||||||
return folder.rmdir(folderName);
|
return folder.rmdir(folderName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class PackageJobThreadPrivate
|
||||||
class PackageJobThreadPrivate {
|
{
|
||||||
public:
|
public:
|
||||||
QString installPath;
|
QString installPath;
|
||||||
QString errorMessage;
|
QString errorMessage;
|
||||||
QString servicePrefix;
|
QString servicePrefix;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
PackageJobThread::PackageJobThread(const QString &servicePrefix, QObject *parent) :
|
PackageJobThread::PackageJobThread(const QString &servicePrefix, QObject *parent) :
|
||||||
QThread(parent)
|
QThread(parent)
|
||||||
{
|
{
|
||||||
@ -336,7 +334,8 @@ bool PackageJobThread::uninstallPackage(const QString& packagePath)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
QString pkg;
|
QString pkg;
|
||||||
{ // FIXME: remove, pass in packageroot, type and pluginName separately?
|
{
|
||||||
|
// FIXME: remove, pass in packageroot, type and pluginName separately?
|
||||||
QString _path = packagePath;
|
QString _path = packagePath;
|
||||||
QStringList ps = packagePath.split('/');
|
QStringList ps = packagePath.split('/');
|
||||||
int ix = ps.count() - 1;
|
int ix = ps.count() - 1;
|
||||||
@ -367,8 +366,6 @@ bool PackageJobThread::uninstallPackage(const QString& packagePath)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
} // namespace Plasma
|
} // namespace Plasma
|
||||||
|
|
||||||
#include "moc_packagejobthread_p.cpp"
|
#include "moc_packagejobthread_p.cpp"
|
||||||
|
@ -275,7 +275,6 @@ void ShellPackage::initPackage(Plasma::Package *package)
|
|||||||
//Widget explorer
|
//Widget explorer
|
||||||
package->addFileDefinition("widgetexplorer", "explorer/WidgetExplorer.qml", i18n("Widgets explorer UI"));
|
package->addFileDefinition("widgetexplorer", "explorer/WidgetExplorer.qml", i18n("Widgets explorer UI"));
|
||||||
|
|
||||||
|
|
||||||
//package->setRequired("mainscript", true);
|
//package->setRequired("mainscript", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -78,7 +78,6 @@ public:
|
|||||||
void initPackage(Plasma::Package *package);
|
void initPackage(Plasma::Package *package);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
} // namespace Plasma
|
} // namespace Plasma
|
||||||
|
|
||||||
#endif // LIBS_PLASMA_PACKAGES_P_H
|
#endif // LIBS_PLASMA_PACKAGES_P_H
|
||||||
|
@ -38,7 +38,6 @@
|
|||||||
#include "dataengine.h"
|
#include "dataengine.h"
|
||||||
#include "storagethread_p.h"
|
#include "storagethread_p.h"
|
||||||
|
|
||||||
|
|
||||||
StorageJob::StorageJob(const QString &destination,
|
StorageJob::StorageJob(const QString &destination,
|
||||||
const QString &operation,
|
const QString &operation,
|
||||||
const QVariantMap ¶meters,
|
const QVariantMap ¶meters,
|
||||||
@ -71,7 +70,6 @@ QString StorageJob::clientName() const
|
|||||||
return m_clientName;
|
return m_clientName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void StorageJob::start()
|
void StorageJob::start()
|
||||||
{
|
{
|
||||||
//FIXME: QHASH
|
//FIXME: QHASH
|
||||||
|
@ -72,5 +72,4 @@ private:
|
|||||||
QString m_clientName;
|
QString m_clientName;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif //PLASMA_STORAGE_H
|
#endif //PLASMA_STORAGE_H
|
||||||
|
@ -30,7 +30,6 @@
|
|||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <qstandardpaths.h>
|
#include <qstandardpaths.h>
|
||||||
|
|
||||||
|
|
||||||
namespace Plasma
|
namespace Plasma
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -20,7 +20,6 @@
|
|||||||
#ifndef STORAGETHREAD_H
|
#ifndef STORAGETHREAD_H
|
||||||
#define STORAGETHREAD_H
|
#define STORAGETHREAD_H
|
||||||
|
|
||||||
|
|
||||||
#include <QThread>
|
#include <QThread>
|
||||||
#include <QSqlDatabase>
|
#include <QSqlDatabase>
|
||||||
#include <QWeakPointer>
|
#include <QWeakPointer>
|
||||||
|
@ -46,7 +46,6 @@ QAtomicInt ThemePrivate::globalThemeRefCount = QAtomicInt();
|
|||||||
QHash<QString, ThemePrivate *> ThemePrivate::themes = QHash<QString, ThemePrivate *>();
|
QHash<QString, ThemePrivate *> ThemePrivate::themes = QHash<QString, ThemePrivate *>();
|
||||||
QHash<QString, QAtomicInt> ThemePrivate::themesRefCount = QHash<QString, QAtomicInt>();
|
QHash<QString, QAtomicInt> ThemePrivate::themesRefCount = QHash<QString, QAtomicInt>();
|
||||||
|
|
||||||
|
|
||||||
ThemePrivate::ThemePrivate(QObject *parent)
|
ThemePrivate::ThemePrivate(QObject *parent)
|
||||||
: QObject(parent),
|
: QObject(parent),
|
||||||
colorScheme(QPalette::Active, KColorScheme::Window, KSharedConfigPtr(0)),
|
colorScheme(QPalette::Active, KColorScheme::Window, KSharedConfigPtr(0)),
|
||||||
@ -129,7 +128,6 @@ KConfigGroup &ThemePrivate::config()
|
|||||||
return cfg;
|
return cfg;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool ThemePrivate::useCache()
|
bool ThemePrivate::useCache()
|
||||||
{
|
{
|
||||||
bool cachesTooOld = false;
|
bool cachesTooOld = false;
|
||||||
@ -150,7 +148,6 @@ bool ThemePrivate::useCache()
|
|||||||
}
|
}
|
||||||
themeMetadataPath = QStandardPaths::locate(QStandardPaths::GenericDataLocation, QLatin1Literal("desktoptheme/") % themeName % QLatin1Literal("/metadata.desktop"));
|
themeMetadataPath = QStandardPaths::locate(QStandardPaths::GenericDataLocation, QLatin1Literal("desktoptheme/") % themeName % QLatin1Literal("/metadata.desktop"));
|
||||||
|
|
||||||
|
|
||||||
if (isRegularTheme) {
|
if (isRegularTheme) {
|
||||||
const QString cacheFileBase = cacheFile + QStringLiteral("*.kcache");
|
const QString cacheFileBase = cacheFile + QStringLiteral("*.kcache");
|
||||||
|
|
||||||
|
@ -139,5 +139,4 @@ void AppletScript::setContainmentType(Plasma::Types::ContainmentType type)
|
|||||||
|
|
||||||
} // Plasma namespace
|
} // Plasma namespace
|
||||||
|
|
||||||
|
|
||||||
#include "moc_appletscript.cpp"
|
#include "moc_appletscript.cpp"
|
||||||
|
@ -197,5 +197,4 @@ void DataEngineScript::forceImmediateUpdateOfAllVisualizations()
|
|||||||
|
|
||||||
} // Plasma namespace
|
} // Plasma namespace
|
||||||
|
|
||||||
|
|
||||||
#include "moc_dataenginescript.cpp"
|
#include "moc_dataenginescript.cpp"
|
||||||
|
@ -319,6 +319,4 @@ void Service::registerOperationsScheme()
|
|||||||
|
|
||||||
} // namespace Plasma
|
} // namespace Plasma
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#include "moc_service.cpp"
|
#include "moc_service.cpp"
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user