diff --git a/plugins/extensions/resourcemanager/CMakeLists.txt b/plugins/extensions/resourcemanager/CMakeLists.txt index f14274b2c6..40ec9cf3b4 100644 --- a/plugins/extensions/resourcemanager/CMakeLists.txt +++ b/plugins/extensions/resourcemanager/CMakeLists.txt @@ -1,44 +1,45 @@ find_package(KF5NewStuffCore ${KF5_DEP_VERSION} CONFIG REQUIRED) set_package_properties(KF5NewStuffCore PROPERTIES DESCRIPTION "The KNewStuff library implements collaborative data sharing for applications." URL "https://api.kde.org/frameworks/knewstuff/html/index.html" TYPE REQUIRED PURPOSE "Required to implement sharing functionality with share.krita.org and krita") find_package(KF5Attica ${KF5_DEP_VERSION} CONFIG REQUIRED) set_package_properties(KF5Attica PROPERTIES DESCRIPTION "A Qt library that implements the Open Collaboration Services API" PURPOSE "Support for KF5NewStuffCore to get the contents." URL "https://projects.kde.org/attica" TYPE REQUIRED ) set(kritaresourcemanager_SOURCES resourcemanager.cpp dlg_create_bundle.cpp dlg_bundle_manager.cpp widgetquestionlistener.cpp entrydetailsdialog.cpp itemsgridviewdelegate.cpp itemsviewbasedelegate.cpp itemsviewdelegate.cpp itemsview.cpp imagepreviewwidget.cpp dlg_content_downloader.cpp content_dowloader_dialog.cpp + progressindicator.cpp ) ki18n_wrap_ui(kritaresourcemanager_SOURCES wdgdlgcreatebundle.ui wdgdlgbundlemanager.ui wdgdlgcontentdownloader.ui ) install( FILES data/kritaresourcebundles.knsrc DESTINATION ${CONFIG_INSTALL_DIR} ) add_library(kritaresourcemanager MODULE ${kritaresourcemanager_SOURCES}) target_link_libraries(kritaresourcemanager kritawidgets kritaui kritalibpaintop KF5::NewStuffCore) install(TARGETS kritaresourcemanager DESTINATION ${KRITA_PLUGIN_INSTALL_DIR}) install(FILES resourcemanager.xmlgui DESTINATION ${DATA_INSTALL_DIR}/kritaplugins) diff --git a/plugins/extensions/resourcemanager/progressindicator.cpp b/plugins/extensions/resourcemanager/progressindicator.cpp new file mode 100644 index 0000000000..dd62434476 --- /dev/null +++ b/plugins/extensions/resourcemanager/progressindicator.cpp @@ -0,0 +1,52 @@ +#include "progressindicator_p.h" + +#include "kjob.h" + +#include +#include +#include +#include + +#include +#include + +ProgressIndicator::ProgressIndicator(QWidget *parent) + : QFrame(parent) + , m_busyPixmap(QIcon::fromTheme(QStringLiteral("process-working"))) + , m_errorPixmap(QIcon::fromTheme(QStringLiteral("dialog-error"))) +{ + setFrameStyle(QFrame::NoFrame); + QHBoxLayout *hbox = new QHBoxLayout(this); + hbox->setMargin(0); + + //busy widget + + busyWidget = new KPixmapSequenceWidget(this); + busyWidget->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed)); + + busyWidget->setVisible(false); + hbox->addWidget(busyWidget); + + m_statusLabel = new QLabel(); + hbox->addWidget(m_statusLabel); +} + +void ProgressIndicator::busy(const QString &message) +{ + m_statusLabel->setText(message); + busyWidget->setVisible(true); + busyWidget->setSequence(m_busyPixmap); +} + +void ProgressIndicator::error(const QString &message) +{ + m_statusLabel->setText(message); + busyWidget->setVisible(true); + busyWidget->setSequence(m_errorPixmap); +} + +void ProgressIndicator::idle(const QString &message) +{ + m_statusLabel->setText(message); + busyWidget->setVisible(false); +} diff --git a/plugins/extensions/resourcemanager/progressindicator_p.h b/plugins/extensions/resourcemanager/progressindicator_p.h new file mode 100644 index 0000000000..1251b8a4b7 --- /dev/null +++ b/plugins/extensions/resourcemanager/progressindicator_p.h @@ -0,0 +1,32 @@ +#ifndef PROGRESSINDICATOR_P_H +#define PROGRESSINDICATOR_P_H + +#include +#include + +class QVBoxLayout; +class QLabel; +class QString; +class KPixmapSequenceWidget; + +class ProgressIndicator : public QFrame +{ + Q_OBJECT +public: + explicit ProgressIndicator(QWidget *parent); + +public Q_SLOTS: + void busy(const QString &message); + void error(const QString &message); + void idle(const QString &message); + +private: + QLabel *m_statusLabel; + KPixmapSequenceWidget *busyWidget; + + KPixmapSequence *m_busyPixmap; + KPixmapSequence *m_errorPixmap; + +}; + +#endif // PROGRESSINDICATOR_P_H