diff options
| author | Aleix Pol <aleixpol@kde.org> | 2015-09-18 15:06:10 (GMT) |
|---|---|---|
| committer | Aleix Pol <aleixpol@kde.org> | 2015-09-18 15:06:10 (GMT) |
| commit | d95fb2b7e933714e4c90b41e7a3779138f781c26 (patch) | |
| tree | 58340e74eb90ba76da7e39da9780a4069199ff98 | |
| parent | 9def6b206670d92af609c1a9506be6f73aca4129 (diff) | |
Make more artwork available from the Dummy backend
| -rw-r--r-- | libmuon/backends/DummyBackend/DummyBackend.cpp | 22 | ||||
| -rw-r--r-- | libmuon/backends/DummyBackend/DummyResource.cpp | 13 | ||||
| -rw-r--r-- | libmuon/backends/DummyBackend/DummyResource.h | 2 | ||||
| -rw-r--r-- | libmuon/backends/DummyBackend/DummyTransaction.cpp | 4 |
4 files changed, 24 insertions, 17 deletions
diff --git a/libmuon/backends/DummyBackend/DummyBackend.cpp b/libmuon/backends/DummyBackend/DummyBackend.cpp index f3b0ff4..4d8ba98 100644 --- a/libmuon/backends/DummyBackend/DummyBackend.cpp +++ b/libmuon/backends/DummyBackend/DummyBackend.cpp @@ -70,17 +70,17 @@ void DummyBackend::setMetaData(const QString& path) randomAction->setPriority(QAction::LowPriority); connect(randomAction, &QAction::triggered, this, [](){ qDebug() << "random action triggered"; }); - QAction* importantAction = new QAction(this); - importantAction->setIcon(QIcon::fromTheme("kalarm")); - importantAction->setText(QStringLiteral("Amaze!")); - importantAction->setWhatsThis(QStringLiteral("Wo Wo I'm so important")); - importantAction->setPriority(QAction::HighPriority); - connect(importantAction, &QAction::triggered, this, [importantAction](){ - importantAction->setEnabled(false); - qDebug() << "important action triggered"; - }); - - m_messageActions = QList<QAction*>() << updateAction << randomAction << importantAction; +// QAction* importantAction = new QAction(this); +// importantAction->setIcon(QIcon::fromTheme("kalarm")); +// importantAction->setText(QStringLiteral("Amaze!")); +// importantAction->setWhatsThis(QStringLiteral("Wo Wo I'm so important")); +// importantAction->setPriority(QAction::HighPriority); +// connect(importantAction, &QAction::triggered, this, [importantAction](){ +// importantAction->setEnabled(false); +// qDebug() << "important action triggered"; +// }); + + m_messageActions = QList<QAction*>() << updateAction << randomAction /*<< importantAction*/; SourcesModel::global()->addSourcesBackend(new DummySourcesBackend(this)); } diff --git a/libmuon/backends/DummyBackend/DummyResource.cpp b/libmuon/backends/DummyBackend/DummyResource.cpp index 13b2595..4b528ef 100644 --- a/libmuon/backends/DummyBackend/DummyResource.cpp +++ b/libmuon/backends/DummyBackend/DummyResource.cpp @@ -25,6 +25,8 @@ #include <QStringList> #include <QTimer> +static QVector<QString> s_icons = { "kdevelop", "kalgebra", "kmail", "akregator", "korganizer" }; + DummyResource::DummyResource(QString name, bool isTechnical, AbstractResourcesBackend* parent) : AbstractResource(parent) , m_name(std::move(name)) @@ -32,8 +34,11 @@ DummyResource::DummyResource(QString name, bool isTechnical, AbstractResourcesB , m_addons({ PackageState("a", "aaaaaa", false), PackageState("b", "aaaaaa", false), PackageState("c", "aaaaaa", false)}) , m_isTechnical(isTechnical) { - if(KRandom::random() % 2) - m_screenshot = QUrl("http://www.kde.org/stuff/clipart/klogo-official-oxygen-128x128.png"); + if(KRandom::random() % 2) { + m_screenshot = QUrl("http://screenshots.debian.net/screenshots/d/dolphin/9383_large.png"); + m_screenshotThumbnail = QUrl("http://screenshots.debian.net/screenshots/d/dolphin/9383_small.png"); + } + m_iconName = s_icons[KRandom::random() % s_icons.size()]; // if((KRandom::random() % 100) == 0) { // enableStateChanges(); @@ -85,7 +90,7 @@ QUrl DummyResource::homepage() QString DummyResource::icon() const { - return isTechnical() ? "kalarm" : "kmail"; + return isTechnical() ? "kalarm" : m_iconName; } QString DummyResource::installedVersion() const @@ -133,7 +138,7 @@ QUrl DummyResource::screenshotUrl() QUrl DummyResource::thumbnailUrl() { - return m_screenshot; + return m_screenshotThumbnail; } QString DummyResource::section() diff --git a/libmuon/backends/DummyBackend/DummyResource.h b/libmuon/backends/DummyBackend/DummyResource.h index c1df229..eb1e152 100644 --- a/libmuon/backends/DummyBackend/DummyResource.h +++ b/libmuon/backends/DummyBackend/DummyResource.h @@ -63,6 +63,8 @@ public: QString m_name; AbstractResource::State m_state; QUrl m_screenshot; + QUrl m_screenshotThumbnail; + QString m_iconName; QList<PackageState> m_addons; bool m_isTechnical; }; diff --git a/libmuon/backends/DummyBackend/DummyTransaction.cpp b/libmuon/backends/DummyBackend/DummyTransaction.cpp index e1626db..42a8612 100644 --- a/libmuon/backends/DummyBackend/DummyTransaction.cpp +++ b/libmuon/backends/DummyBackend/DummyTransaction.cpp @@ -43,8 +43,8 @@ DummyTransaction::DummyTransaction(DummyResource* app, const AddonList& addons, void DummyTransaction::iterateTransaction() { if(progress()<100) { - setProgress(progress()+10); - QTimer::singleShot(/*KRandom::random()%*/20, this, SLOT(iterateTransaction())); + setProgress(progress()+(KRandom::random()%30)); + QTimer::singleShot(/*KRandom::random()%*/200, this, SLOT(iterateTransaction())); } else finishTransaction(); } |
