Commit 505c43c5 authored by Nicolas Fella's avatar Nicolas Fella
Browse files

Don't create pixmaps for loglevel icons

Summary: We can pass QIcon in all places. Depends on D26347 to be able to see any icons

Test Plan: Still have icons on the left side of the log list

Reviewers: #plasma, mart

Reviewed By: #plasma, mart

Subscribers: anthonyfieroni, apol

Maniphest Tasks: T12306

Differential Revision: https://phabricator.kde.org/D26350
parent 048bcdc3
......@@ -76,7 +76,7 @@ void DetailDialog::updateDetails()
return;
}
icon->setPixmap(item->logLine()->logLevel()->icon());
icon->setPixmap(item->logLine()->logLevel()->icon().pixmap(style()->pixelMetric(QStyle::PM_LargeIconSize)));
header->setText(item->logLine()->formattedText());
......
......@@ -29,11 +29,9 @@ public:
int id;
QString name;
QString icon;
QColor color;
QPixmap pixmap;
QIcon icon;
};
LogLevel::LogLevel(int id, const QString &nm, const QString &ic, const QColor &col, QObject *parent)
......@@ -41,9 +39,8 @@ LogLevel::LogLevel(int id, const QString &nm, const QString &ic, const QColor &c
{
d->id = id;
d->name = nm;
d->icon = ic;
d->color = col;
d->pixmap = QIcon::fromTheme(ic).pixmap(KIconLoader::SizeSmall);
d->icon = QIcon::fromTheme(ic);
}
LogLevel::~LogLevel()
......@@ -61,17 +58,12 @@ QString LogLevel::name() const
return d->name;
}
QString LogLevel::icon() const
{
return d->icon;
}
QColor LogLevel::color() const
{
return d->color;
}
QPixmap LogLevel::pixmap() const
QIcon LogLevel::icon() const
{
return d->pixmap;
return d->icon;
}
......@@ -38,11 +38,9 @@ public:
int id() const;
QString name() const;
QString icon() const;
QColor color() const;
QPixmap pixmap() const;
QIcon icon() const;
private:
LogLevelPrivate *const d;
......
......@@ -57,7 +57,7 @@ void LogModeItemBuilder::prepareItem(LogViewWidgetItem *item) const
i++;
}
item->setIcon(0, line->logLevel()->pixmap());
item->setIcon(0, line->logLevel()->icon());
}
QString LogModeItemBuilder::createFormattedText(LogLine *line) const
......
......@@ -144,21 +144,21 @@ void LoggerDialog::buildMaps()
// Fill the priority icon map
d->priorityIcons[Globals::instance().debugLogLevel()->name()]
= Globals::instance().debugLogLevel()->icon();
= Globals::instance().debugLogLevel()->icon().name();
d->priorityIcons[Globals::instance().informationLogLevel()->name()]
= Globals::instance().informationLogLevel()->icon();
= Globals::instance().informationLogLevel()->icon().name();
d->priorityIcons[Globals::instance().noticeLogLevel()->name()]
= Globals::instance().noticeLogLevel()->icon();
= Globals::instance().noticeLogLevel()->icon().name();
d->priorityIcons[Globals::instance().warningLogLevel()->name()]
= Globals::instance().warningLogLevel()->icon();
= Globals::instance().warningLogLevel()->icon().name();
d->priorityIcons[Globals::instance().errorLogLevel()->name()]
= Globals::instance().errorLogLevel()->icon();
= Globals::instance().errorLogLevel()->icon().name();
d->priorityIcons[Globals::instance().criticalLogLevel()->name()]
= Globals::instance().criticalLogLevel()->icon();
= Globals::instance().criticalLogLevel()->icon().name();
d->priorityIcons[Globals::instance().alertLogLevel()->name()]
= Globals::instance().alertLogLevel()->icon();
= Globals::instance().alertLogLevel()->icon().name();
d->priorityIcons[Globals::instance().emergencyLogLevel()->name()]
= Globals::instance().emergencyLogLevel()->icon();
= Globals::instance().emergencyLogLevel()->icon().name();
}
void LoggerDialog::textChanged()
......
......@@ -85,7 +85,7 @@ LogLevelFileList::~LogLevelFileList()
void LogLevelFileList::insertItem(LogLevel *level, const QString &itemText, bool missing)
{
QListWidgetItem *item = new QListWidgetItem(QIcon(level->pixmap()), itemText, fileList);
QListWidgetItem *item = new QListWidgetItem(level->icon(), itemText, fileList);
if (missing)
item->setForeground(Qt::red);
item->setData(LogLevelFileList::LogLevelRole, level->id());
......@@ -120,7 +120,7 @@ void LogLevelFileList::changeItemType()
QListWidget *logLevels = logLevelSelectionDialog.logLevels();
foreach (LogLevel *level, Globals::instance().logLevels()) {
logLevels->addItem(new QListWidgetItem(QIcon(level->pixmap()), level->name()));
logLevels->addItem(new QListWidgetItem(level->icon(), level->name()));
}
int choice = logLevelSelectionDialog.exec();
......
......@@ -55,7 +55,7 @@ public:
i++;
}
item->setIcon(0, line->logLevel()->pixmap());
item->setIcon(0, line->logLevel()->icon());
}
QString createToolTipText(LogLine *line) const override
......
......@@ -55,7 +55,7 @@ public:
i++;
}
item->setIcon(0, QIcon(line->logLevel()->pixmap()));
item->setIcon(0, line->logLevel()->icon());
}
QString createToolTipText(LogLine *line) const override
......
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