summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGilles Caulier <[email protected]>2014-12-04 10:22:34 +0100
committerGilles Caulier <[email protected]>2014-12-04 10:22:34 +0100
commit9bee3c23cfe255e9d1b60ded3142347ab65ef313 (patch)
tree056f5666c44eeca506d9a2959558e65707ce50d1
parent5eeda9ac745471263bc90a10724d0e2ddfaed01d (diff)
port ++
-rw-r--r--src/configwidget.cpp33
-rw-r--r--src/configwidget.h1
2 files changed, 15 insertions, 19 deletions
diff --git a/src/configwidget.cpp b/src/configwidget.cpp
index c281e55..956b6e8 100644
--- a/src/configwidget.cpp
+++ b/src/configwidget.cpp
@@ -35,12 +35,11 @@
#include <QLabel>
#include <QFontMetrics>
#include <QHBoxLayout>
+#include <QBuffer>
+#include <QStandardPaths>
// KDE includes
-#include <ktoolinvocation.h>
-#include <kstandarddirs.h>
-#include <kurllabel.h>
#include <klocalizedstring.h>
// Local includes
@@ -86,7 +85,7 @@ public:
QGridLayout* grid;
QWidget* hbox;
- KUrlLabel* kipiLogoLabel;
+ QLabel* kipiLogoLabel;
PluginListView* pluginsList;
};
@@ -147,14 +146,20 @@ ConfigWidget::ConfigWidget(QWidget* const parent)
d->libkipiVersion->setAlignment(Qt::AlignRight);
hboxLay->setStretchFactor(space, 10);
- d->kipiLogoLabel = new KUrlLabel(panel);
- d->kipiLogoLabel->setText(QString());
- d->kipiLogoLabel->setUrl("https://projects.kde.org/projects/extragear/graphics/kipi-plugins");
-
+ d->kipiLogoLabel = new QLabel(panel);
+ d->kipiLogoLabel->setTextFormat(Qt::RichText);
+ d->kipiLogoLabel->setTextInteractionFlags(Qt::TextBrowserInteraction);
+ d->kipiLogoLabel->setOpenExternalLinks(true);
QFontMetrics fm(d->kipipluginsVersion->font());
QRect r = fm.boundingRect("XX");
- QPixmap pix(KStandardDirs::locate("data", "kipi/data/kipi-plugins_logo.png"));
- d->kipiLogoLabel->setPixmap(pix.scaledToHeight(r.height()*3, Qt::SmoothTransformation));
+ QByteArray byteArray;
+ QBuffer buffer(&byteArray);
+ QImage img = QImage(QStandardPaths::locate(QStandardPaths::GenericDataLocation, "kipi/data/kipi-plugins_logo.png"))
+ .scaledToHeight(r.height()*3, Qt::SmoothTransformation);
+ img.save(&buffer, "PNG");
+ d->kipiLogoLabel->setText(QString("<a href=\"https://projects.kde.org/projects/extragear/graphics/kipi-plugins\">%1</a>")
+ .arg(QString("<img src=\"data:image/png;base64,%1\">")
+ .arg(QString::fromLatin1(byteArray.toBase64().data()))));
d->grid->addWidget(d->pluginsNumber, 0, 1, 1, 1);
d->grid->addWidget(d->pluginsNumberActivated, 0, 2, 1, 1);
@@ -189,9 +194,6 @@ ConfigWidget::ConfigWidget(QWidget* const parent)
connect(d->pluginsList, &PluginListView::signalSearchResult,
this, &ConfigWidget::signalSearchResult);
- connect(d->kipiLogoLabel, static_cast<void (KUrlLabel::*)(const QString &)>(&KUrlLabel::leftClickedUrl),
- this, &ConfigWidget::slotProcessUrl);
-
// --------------------------------------------------------
d->updateInfo();
@@ -202,11 +204,6 @@ ConfigWidget::~ConfigWidget()
delete d;
}
-void ConfigWidget::slotProcessUrl(const QString& url)
-{
- KToolInvocation::self()->invokeBrowser(url);
-}
-
void ConfigWidget::setFilterWidget(QWidget* const wdg)
{
d->grid->addWidget(wdg, 0, 0, 1, 1);
diff --git a/src/configwidget.h b/src/configwidget.h
index a83c16e..9e34dc8 100644
--- a/src/configwidget.h
+++ b/src/configwidget.h
@@ -78,7 +78,6 @@ private Q_SLOTS:
void slotCheckAll();
void slotClearList();
void slotItemClicked();
- void slotProcessUrl(const QString&);
private: