Commit d5d05d14 authored by Friedrich W. H. Kossebau's avatar Friedrich W. H. Kossebau
Browse files

Use new KTitleWidget::icon/iconSize API

parent bb4bab81
......@@ -70,29 +70,28 @@ void KAboutApplicationDialog::Private::init(Options opt)
q->setWindowTitle(i18nc("@title:window", "About %1", aboutData.displayName()));
//Set up the title widget...
QPixmap titlePixmap;
QIcon titleIcon;
if (aboutData.programLogo().canConvert<QPixmap>()) {
titlePixmap = aboutData.programLogo().value<QPixmap>();
titleIcon = QIcon(aboutData.programLogo().value<QPixmap>());
} else if (aboutData.programLogo().canConvert<QImage>()) {
titlePixmap = QPixmap::fromImage(aboutData.programLogo().value<QImage>());
titleIcon = QIcon(QPixmap::fromImage(aboutData.programLogo().value<QImage>()));
} else if (aboutData.programLogo().canConvert<QIcon>()) {
titlePixmap = aboutData.programLogo().value<QIcon>().pixmap(48, 48);
titleIcon = aboutData.programLogo().value<QIcon>();
} else {
QIcon windowIcon = qApp->windowIcon();
titleIcon = qApp->windowIcon();
#if KCOREADDONS_BUILD_DEPRECATED_SINCE(5, 2)
// Legacy support for deprecated KAboutData::programIconName()
QT_WARNING_PUSH
QT_WARNING_DISABLE_CLANG("-Wdeprecated-declarations")
QT_WARNING_DISABLE_GCC("-Wdeprecated-declarations")
if (windowIcon.isNull() && !aboutData.programIconName().isEmpty()) {
windowIcon = QIcon::fromTheme(aboutData.programIconName());
if (titleIcon.isNull() && !aboutData.programIconName().isEmpty()) {
titleIcon = QIcon::fromTheme(aboutData.programIconName());
}
QT_WARNING_POP
#endif
titlePixmap = windowIcon.pixmap(48, 48);
}
QWidget *titleWidget = createTitleWidget(titlePixmap, aboutData.displayName(), aboutData.version(), q);
QWidget *titleWidget = createTitleWidget(titleIcon, aboutData.displayName(), aboutData.version(), q);
//Then the tab bar...
QTabWidget *tabWidget = new QTabWidget;
......
......@@ -44,7 +44,8 @@ KAboutKdeDialog::KAboutKdeDialog(QWidget *parent)
KTitleWidget *titleWidget = new KTitleWidget(this);
titleWidget->setText(i18n("<html><font size=\"5\">KDE - Be Free!</font></html>"));
titleWidget->setPixmap(QIcon::fromTheme(QStringLiteral("kde")).pixmap(48), KTitleWidget::ImageLeft);
titleWidget->setIconSize(QSize(48, 48));
titleWidget->setIcon(QIcon::fromTheme(QStringLiteral("kde")), KTitleWidget::ImageLeft);
QLabel *about = new QLabel;
about->setMargin(10);
......
......@@ -77,7 +77,7 @@ void KAboutPluginDialogPrivate::init(KAboutPluginDialog::Options opt)
//Set up the title widget...
const QIcon pluginIcon = !pluginMetaData.iconName().isEmpty() ? QIcon::fromTheme(pluginMetaData.iconName()) :
qApp->windowIcon();
QWidget *titleWidget = createTitleWidget(pluginIcon.pixmap(48, 48),
QWidget *titleWidget = createTitleWidget(pluginIcon,
pluginMetaData.name(), pluginMetaData.version(), q);
//Then the tab bar...
......
......@@ -31,19 +31,20 @@
#include <KTitleWidget>
#include <KLocalizedString>
// Qt
#include <QPixmap>
#include <QIcon>
#include <QLabel>
#include <QVBoxLayout>
#include <QDialogButtonBox>
QWidget *KAbstractAboutDialogPrivate::createTitleWidget(const QPixmap &pixmap,
QWidget *KAbstractAboutDialogPrivate::createTitleWidget(const QIcon &icon,
const QString &displayName,
const QString &version,
QWidget *parent)
{
KTitleWidget *titleWidget = new KTitleWidget(parent);
titleWidget->setPixmap(pixmap, KTitleWidget::ImageLeft);
titleWidget->setIconSize(QSize(48, 48));
titleWidget->setIcon(icon, KTitleWidget::ImageLeft);
titleWidget->setText(i18n("<html><font size=\"5\">%1</font><br />Version %2</html>", displayName, version));
return titleWidget;
......
......@@ -23,7 +23,7 @@
class QDialog;
class QWidget;
class QPixmap;
class QIcon;
/**
* @internal
......@@ -37,7 +37,7 @@ public:
~KAbstractAboutDialogPrivate() = default;
public:
QWidget *createTitleWidget(const QPixmap &pixmap,
QWidget *createTitleWidget(const QIcon &icon,
const QString &displayName,
const QString &version,
QWidget *parent);
......
......@@ -130,7 +130,8 @@ KBugReport::KBugReport(const KAboutData &aboutData, QWidget *_parent)
KTitleWidget *title = new KTitleWidget(this);
title->setText(i18n("Submit Bug Report"));
title->setPixmap(QIcon::fromTheme(QStringLiteral("tools-report-bug")).pixmap(32));
title->setIconSize(QSize(32, 32));
title->setIcon(QIcon::fromTheme(QStringLiteral("tools-report-bug")));
lay->addWidget(title);
QGridLayout *glay = new QGridLayout();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment