From 43d00bc74cc9dd01ea179b5d3e7e36228a716d8d Mon Sep 17 00:00:00 2001 From: Nicolas Fella Date: Sat, 30 Apr 2022 16:03:39 +0200 Subject: [PATCH] Port away from KIconLoader Use icon names instead of pixmaps where possible Query sizes from QStyle --- core/filemodel.cpp | 2 +- core/job.cpp | 6 ++--- core/job.h | 4 +-- core/kget.cpp | 2 +- core/transfer.cpp | 17 ++++++------ core/transfer.h | 11 ++++---- core/transferhandler.h | 4 +-- core/transfertreemodel.cpp | 2 +- dbus/dbustransferwrapper.cpp | 6 ++++- tests/schedulertest.cpp | 2 +- .../bittorrent/advanceddetails/fileview.cpp | 1 - transfer-plugins/bittorrent/bttransfer.cpp | 27 +++++++++---------- .../contentfetch/contentfetch.cpp | 13 +++++---- transfer-plugins/kio/transferKio.cpp | 3 +-- .../metalink/abstractmetalink.cpp | 1 - transfer-plugins/metalink/metalink.cpp | 3 +-- transfer-plugins/metalink/metalinkhttp.cpp | 1 - transfer-plugins/metalink/metalinkxml.cpp | 3 +-- transfer-plugins/mmsthreads/mmstransfer.cpp | 11 +++----- .../multisegmentkio/transfermultisegkio.cpp | 1 - ui/history/transferhistoryitemdelegate.cpp | 2 -- ui/signaturedlg.cpp | 4 +-- ui/transferdetails.cpp | 3 ++- 23 files changed, 59 insertions(+), 70 deletions(-) diff --git a/core/filemodel.cpp b/core/filemodel.cpp index 04d4c238..fe7da5ef 100644 --- a/core/filemodel.cpp +++ b/core/filemodel.cpp @@ -376,7 +376,7 @@ QVariant FileModel::data(const QModelIndex &index, int role) const } else { - return Transfer::statusPixmap(status); + return QIcon::fromTheme(Transfer::statusIconName(status)); } } } else { diff --git a/core/job.cpp b/core/job.cpp index d2c400d6..35ccef61 100644 --- a/core/job.cpp +++ b/core/job.cpp @@ -38,7 +38,7 @@ void Job::setStatus(Status jobStatus) if (m_status == Aborted) { m_error.id = -1; m_error.text.clear(); - m_error.pixmap = QPixmap(); + m_error.iconName = QString(); m_error.type = AutomaticRetry; } m_status = jobStatus; @@ -62,12 +62,12 @@ void Job::setPolicy(Policy jobPolicy) m_scheduler->jobChangedEvent(this, m_policy); } -void Job::setError(const QString &text, const QPixmap &pixmap, ErrorType type, int errorId) +void Job::setError(const QString &text, const QString &iconName, ErrorType type, int errorId) { setStatus(Job::Aborted); m_error.id = errorId; m_error.text = text; - m_error.pixmap = pixmap; + m_error.iconName = iconName; m_error.type = type; } diff --git a/core/job.h b/core/job.h index 366bc582..55391531 100644 --- a/core/job.h +++ b/core/job.h @@ -73,7 +73,7 @@ class KGET_EXPORT Job : public QObject struct Error { int id; QString text; - QPixmap pixmap; + QString iconName; ErrorType type; }; Job(Scheduler * scheduler, JobQueue * parent); @@ -88,7 +88,7 @@ class KGET_EXPORT Job : public QObject //Job properties void setStatus(Status jobStatus); void setPolicy(Policy jobPolicy); - void setError(const QString &text, const QPixmap &pixmap, ErrorType type = AutomaticRetry, int errorId = -1); + void setError(const QString &text, const QString &iconName, ErrorType type = AutomaticRetry, int errorId = -1); Status status() const {return m_status;} Status startStatus() const { return m_startStatus;} diff --git a/core/kget.cpp b/core/kget.cpp index 3d2a9504..32149ef3 100644 --- a/core/kget.cpp +++ b/core/kget.cpp @@ -1384,7 +1384,7 @@ void GenericObserver::transfersChangedEvent(QMapstatus() == Job::Aborted && transfer->error().type != Job::AutomaticRetry) { KNotification * notification = KNotification::event("error", i18n("Error"), i18n("

There has been an error in the following transfer:

%1

" "

The error message is:

%2

", transfer->source().toString(), transfer->error().text), - transfer->error().pixmap, KGet::m_mainWindow, KNotification::CloseOnTimeout); + transfer->error().iconName, KGet::m_mainWindow, KNotification::CloseOnTimeout); if (transfer->error().type == Job::ManualSolve) { m_notifications.insert(notification, transfer); notification->setActions(QStringList() << i18n("Resolve")); diff --git a/core/transfer.cpp b/core/transfer.cpp index 46c0ba31..a352241d 100644 --- a/core/transfer.cpp +++ b/core/transfer.cpp @@ -17,7 +17,6 @@ #include "core/plugin/transferfactory.h" #include "core/scheduler.h" -#include #include #include @@ -231,7 +230,7 @@ void Transfer::load(const QDomElement *element) { if (!element) { - setStatus(status(), i18nc("transfer state: stopped", "Stopped"), SmallIcon("process-stop")); + setStatus(status(), i18nc("transfer state: stopped", "Stopped"), "process-stop"); setStartStatus(status()); return; } @@ -250,7 +249,7 @@ void Transfer::load(const QDomElement *element) setStartStatus(Job::Finished); setStatus(startStatus()); } else { - setStatus(status(), i18nc("transfer state: stopped", "Stopped"), SmallIcon("process-stop")); + setStatus(status(), i18nc("transfer state: stopped", "Stopped"), "process-stop"); setStartStatus(status()); } setUploadLimit(e.attribute("UploadLimit").toInt(), Transfer::VisibleSpeedLimit); @@ -275,7 +274,7 @@ void Transfer::load(const QDomElement *element) } } -void Transfer::setStatus(Job::Status jobStatus, const QString &text, const QPixmap &pix) +void Transfer::setStatus(Job::Status jobStatus, const QString &text, const QString &pix) { const bool statusChanged = (status() != jobStatus); QString statusText = text; @@ -285,9 +284,9 @@ void Transfer::setStatus(Job::Status jobStatus, const QString &text, const QPixm //always prefer pix, if it is set if (!pix.isNull()) { - m_statusPixmap = pix; - } else if (statusChanged || m_statusPixmap.isNull()) { - m_statusPixmap = SmallIcon(STATUSICONS[jobStatus]); + m_statusIconName = pix; + } else if (statusChanged || m_statusIconName.isNull()) { + m_statusIconName = STATUSICONS[jobStatus]; } m_statusText = statusText; @@ -327,7 +326,7 @@ QString Transfer::statusText(Job::Status status) return i18nc(STATUSTEXTS[status].context, STATUSTEXTS[status].name); } -QPixmap Transfer::statusPixmap(Job::Status status) +QString Transfer::statusIconName(Job::Status status) { - return SmallIcon(STATUSICONS[status]); + return STATUSICONS[status]; } diff --git a/core/transfer.h b/core/transfer.h index bdd92fca..814e99ec 100644 --- a/core/transfer.h +++ b/core/transfer.h @@ -15,7 +15,6 @@ #include "job.h" #include "kget_export.h" -#include #include #include @@ -169,10 +168,10 @@ class KGET_EXPORT Transfer : public Job KIO::filesize_t downloadedSize() const {return m_downloadedSize;} KIO::filesize_t uploadedSize() const {return m_uploadedSize;} QString statusText() const {return m_statusText;} - QPixmap statusPixmap() const {return (error().pixmap.isNull() ? m_statusPixmap : error().pixmap);} + QString statusIconName() const {return (error().iconName.isEmpty() ? m_statusIconName : error().iconName);} static QString statusText(Job::Status status); - static QPixmap statusPixmap(Job::Status status); + static QString statusIconName(Job::Status status); int percent() const {return m_percent;} int downloadSpeed() const {return m_downloadSpeed;} @@ -319,9 +318,9 @@ class KGET_EXPORT Transfer : public Job protected: /** * Sets the Job status to jobStatus, the status text to text and - * the status pixmap to pix. + * the status icon to iconName. */ - void setStatus(Job::Status jobStatus, const QString &text = QString(), const QPixmap &pix = QPixmap()); + void setStatus(Job::Status jobStatus, const QString &text = QString(), const QString &iconName = QString()); /** * Sets the capabilities and automatically emits capabilitiesChanged @@ -367,7 +366,7 @@ class KGET_EXPORT Transfer : public Job double m_ratio; QString m_statusText; - QPixmap m_statusPixmap; + QString m_statusIconName; QTime m_runningTime; TransferHandler * m_handler; diff --git a/core/transferhandler.h b/core/transferhandler.h index 4b9d505f..3e54d312 100644 --- a/core/transferhandler.h +++ b/core/transferhandler.h @@ -212,9 +212,9 @@ class KGET_EXPORT TransferHandler : public Handler QString statusText() const {return m_transfer->statusText();} /** - * @return a pixmap associated with the current transfer status + * @return an icon name associated with the current transfer status */ - QPixmap statusPixmap() const {return m_transfer->statusPixmap();} + QString statusIconName() const {return m_transfer->statusIconName();} /** * @returns the data associated to this Transfer item. This is diff --git a/core/transfertreemodel.cpp b/core/transfertreemodel.cpp index 2d9b9b88..cdbaf4de 100644 --- a/core/transfertreemodel.cpp +++ b/core/transfertreemodel.cpp @@ -114,7 +114,7 @@ QVariant TransferModelItem::data(int role) const return m_mimeType; } case 1: - return m_transferHandler->statusPixmap(); + return QIcon::fromTheme(m_transferHandler->statusIconName()); } } if (role == Qt::TextAlignmentRole) diff --git a/dbus/dbustransferwrapper.cpp b/dbus/dbustransferwrapper.cpp index bb91efd7..a0564f6f 100644 --- a/dbus/dbustransferwrapper.cpp +++ b/dbus/dbustransferwrapper.cpp @@ -12,6 +12,9 @@ #include "transfergrouphandler.h" #include "verifier.h" +#include +#include + DBusTransferWrapper::DBusTransferWrapper(TransferHandler *parent) : QObject(parent), m_transfer(parent) @@ -141,7 +144,8 @@ QString DBusTransferWrapper::statusText() const QDBusVariant DBusTransferWrapper::statusPixmap() const { - return QDBusVariant(QVariant::fromValue(m_transfer->statusPixmap())); + const QPixmap pix = QIcon::fromTheme(m_transfer->statusIconName()).pixmap(qApp->style()->pixelMetric(QStyle::PixelMetric::PM_SmallIconSize)); + return QDBusVariant(QVariant::fromValue(pix)); } void DBusTransferWrapper::slotTransferChanged(TransferHandler *transfer, TransferHandler::ChangesFlags changeFlags) diff --git a/tests/schedulertest.cpp b/tests/schedulertest.cpp index 9fc3f18b..5f2dd5d7 100644 --- a/tests/schedulertest.cpp +++ b/tests/schedulertest.cpp @@ -415,7 +415,7 @@ void SchedulerTest::testJobErrorType() auto *job = new TestJob(&scheduler, queue); job->setPolicy(policy); - job->setError(QString(), QPixmap(), errorType); + job->setError(QString(), QString(), errorType); queue->appendPub(job); QCOMPARE(job->status(), finalStatus); diff --git a/transfer-plugins/bittorrent/advanceddetails/fileview.cpp b/transfer-plugins/bittorrent/advanceddetails/fileview.cpp index 79c00eee..29d0317a 100644 --- a/transfer-plugins/bittorrent/advanceddetails/fileview.cpp +++ b/transfer-plugins/bittorrent/advanceddetails/fileview.cpp @@ -27,7 +27,6 @@ #include #include -#include #include #include #include diff --git a/transfer-plugins/bittorrent/bttransfer.cpp b/transfer-plugins/bittorrent/bttransfer.cpp index e88c17e4..6fc72053 100644 --- a/transfer-plugins/bittorrent/bttransfer.cpp +++ b/transfer-plugins/bittorrent/bttransfer.cpp @@ -34,7 +34,6 @@ #include "kget_debug.h" #include -#include #include #include @@ -137,7 +136,7 @@ void BTTransfer::start() m_tmpTorrentFile = tmpDirName + m_dest.fileName(); auto *download = new Download(m_source, QUrl::fromLocalFile(m_tmpTorrentFile)); - setStatus(Job::Stopped, i18n("Downloading Torrent File...."), SmallIcon("document-save")); + setStatus(Job::Stopped, i18n("Downloading Torrent File...."), "document-save"); setTransferChange(Tc_Status, true); //m_source = tmpDirName + m_source.fileName(); @@ -167,7 +166,7 @@ bool BTTransfer::setDirectory(const QUrl &newDirectory) m_dest = m_dest.adjusted(QUrl::StripTrailingSlash); m_dest.setPath(m_dest.path() + '/' + (torrent->getStats().torrent_name)); - setStatus(Job::Stopped, i18nc("changing the destination of the file", "Changing destination"), SmallIcon("media-playback-pause")); + setStatus(Job::Stopped, i18nc("changing the destination of the file", "Changing destination"), "media-playback-pause"); setTransferChange(Tc_Status, true); return true; } @@ -181,7 +180,7 @@ void BTTransfer::newDestResult() disconnect(torrent, &bt::TorrentInterface::aboutToBeStarted, this, &BTTransfer::newDestResult); m_movingFile = false; - setStatus(Job::Running, i18nc("transfer state: downloading", "Downloading...."), SmallIcon("media-playback-start")); + setStatus(Job::Running, i18nc("transfer state: downloading", "Downloading...."), "media-playback-start"); setTransferChange(Tc_FileName | Tc_Status, true); } @@ -223,7 +222,7 @@ void BTTransfer::load(const QDomElement *element) if ((m_totalSize == m_downloadedSize) && (m_totalSize != 0)) { - setStatus(Job::Stopped, i18nc("transfer state: finished", "Finished"), SmallIcon("dialog-ok")); + setStatus(Job::Stopped, i18nc("transfer state: finished", "Finished"), "dialog-ok"); } } @@ -285,7 +284,7 @@ void BTTransfer::startTorrent() if (chunksTotal() == chunksDownloaded()/* && !m_downloadFinished*/) { slotDownloadFinished(torrent); } else { - setStatus(Job::Running, i18nc("transfer state: downloading", "Downloading...."), SmallIcon("media-playback-start")); + setStatus(Job::Running, i18nc("transfer state: downloading", "Downloading...."), "media-playback-start"); } m_totalSize = torrent->getStats().total_bytes_to_download; setTransferChange(Tc_Status | Tc_TrackersList | Tc_TotalSize, true); @@ -302,11 +301,11 @@ void BTTransfer::stopTorrent() if (m_downloadFinished) { - setStatus(Job::Stopped, i18nc("transfer state: finished", "Finished"), SmallIcon("dialog-ok")); + setStatus(Job::Stopped, i18nc("transfer state: finished", "Finished"), "dialog-ok"); } else { - setStatus(Job::Stopped, i18nc("transfer state: stopped", "Stopped"), SmallIcon("process-stop")); + setStatus(Job::Stopped, i18nc("transfer state: stopped", "Stopped"), "process-stop"); } setTransferChange(Tc_Status, true); @@ -420,12 +419,12 @@ void BTTransfer::btTransferInit(const QUrl &src, const QByteArray &data) QFile file(m_source.toLocalFile()); if (!file.open(QIODevice::ReadOnly)) { - setError(i18n("Torrent file does not exist"), SmallIcon("dialog-cancel"), Job::NotSolveable); + setError(i18n("Torrent file does not exist"), "dialog-cancel", Job::NotSolveable); setTransferChange(Tc_Status, true); return; } - setStatus(Job::Stopped, i18n("Analyzing torrent...."), SmallIcon("document-preview")); // jpetso says: you should probably use the "process-working" icon here (from the animations category), but that's a multi-frame PNG so it's hard for me to test + setStatus(Job::Stopped, i18n("Analyzing torrent...."), "document-preview"); // jpetso says: you should probably use the "process-working" icon here (from the animations category), but that's a multi-frame PNG so it's hard for me to test setTransferChange(Tc_Status, true); bt::InitLog(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) + QStringLiteral("/torrentlog.log"), false, false);//initialize the torrent-log @@ -437,7 +436,7 @@ void BTTransfer::btTransferInit(const QUrl &src, const QByteArray &data) i++; if (i == 10) { - setError(i18n("Cannot initialize port..."), SmallIcon("dialog-cancel")); + setError(i18n("Cannot initialize port..."), "dialog-cancel"); setTransferChange(Tc_Status); return; } @@ -486,7 +485,7 @@ void BTTransfer::btTransferInit(const QUrl &src, const QByteArray &data) m_ready = false; torrent->deleteLater(); torrent = nullptr; - setError(err.toString(), SmallIcon("dialog-cancel"), Job::NotSolveable); + setError(err.toString(), "dialog-cancel", Job::NotSolveable); setTransferChange(Tc_Status); return; } @@ -498,7 +497,7 @@ void BTTransfer::slotStoppedByError(const bt::TorrentInterface* &error, const QS { Q_UNUSED(error) stop(); - setError(errormsg, SmallIcon("dialog-cancel"), Job::NotSolveable); + setError(errormsg, "dialog-cancel", Job::NotSolveable); setTransferChange(Tc_Status); } @@ -508,7 +507,7 @@ void BTTransfer::slotDownloadFinished(bt::TorrentInterface* ti) Q_UNUSED(ti) m_downloadFinished = true; //timer.stop(); - setStatus(Job::FinishedKeepAlive, i18nc("Transfer status: seeding", "Seeding...."), SmallIcon("media-playback-start")); + setStatus(Job::FinishedKeepAlive, i18nc("Transfer status: seeding", "Seeding...."), "media-playback-start"); setTransferChange(Tc_Status, true); } diff --git a/transfer-plugins/contentfetch/contentfetch.cpp b/transfer-plugins/contentfetch/contentfetch.cpp index 8f2ec65c..d8b2b3ad 100644 --- a/transfer-plugins/contentfetch/contentfetch.cpp +++ b/transfer-plugins/contentfetch/contentfetch.cpp @@ -14,7 +14,6 @@ #include "script.h" #include -#include #include #include #include @@ -49,7 +48,7 @@ void ContentFetch::deinit() void ContentFetch::start() { qCDebug(KGET_DEBUG) << "ContentFetch::start"; - setStatus(Job::Running, i18nc("Transfer state: processing script", "Processing script...."), SmallIcon("media-playback-start")); + setStatus(Job::Running, i18nc("Transfer state: processing script", "Processing script...."), "media-playback-start"); setTransferChange(Tc_Status, true); m_p_script->setFile(m_scriptFile); m_p_script->start(); @@ -66,7 +65,7 @@ void ContentFetch::stop() // kill -9 the script m_p_script->terminate(); // delete m_p_script to avoid crash? - setStatus(Job::Stopped, i18nc("transfer state: stopped", "Stopped"), SmallIcon("process-stop")); + setStatus(Job::Stopped, i18nc("transfer state: stopped", "Stopped"), "process-stop"); setTransferChange(Tc_Status, true); } @@ -80,7 +79,7 @@ void ContentFetch::slotAddTransfer(const QString &url, const QString &filename) void ContentFetch::slotFinish() { m_percent = 100; - setStatus(Job::Finished, i18nc("Transfer State: Finished", "Finished"), SmallIcon("dialog-ok")); + setStatus(Job::Finished, i18nc("Transfer State: Finished", "Finished"), "dialog-ok"); setTransferChange(Tc_Status|Tc_Percent, true); //delete m_p_script; } @@ -89,18 +88,18 @@ void ContentFetch::slotAbort(const QString &error) { if (error.isEmpty()) { - setStatus(Job::Aborted, i18nc("Transfer State: Aborted", "Aborted"), SmallIcon("process-stop")); + setStatus(Job::Aborted, i18nc("Transfer State: Aborted", "Aborted"), "process-stop"); } else { - setStatus(Job::Aborted, error, SmallIcon("process-stop")); + setStatus(Job::Aborted, error, "process-stop"); } setTransferChange(Tc_Status, true); } void ContentFetch::slotSetTextStatus(const QString& text) { - setStatus(Job::Running, text, SmallIcon("media-playback-start")); + setStatus(Job::Running, text, "media-playback-start"); setTransferChange(Tc_Status, true); } diff --git a/transfer-plugins/kio/transferKio.cpp b/transfer-plugins/kio/transferKio.cpp index 4d1dd393..3a2f4d9d 100644 --- a/transfer-plugins/kio/transferKio.cpp +++ b/transfer-plugins/kio/transferKio.cpp @@ -23,7 +23,6 @@ #include "kget_debug.h" #include -#include #include #include #include @@ -98,7 +97,7 @@ void TransferKio::start() createJob(); qCDebug(KGET_DEBUG) << "TransferKio::start"; - setStatus(Job::Running, i18nc("transfer state: connecting", "Connecting...."), SmallIcon("network-connect")); // should be "network-connecting", but that doesn't exist for KDE 4.0 yet + setStatus(Job::Running, i18nc("transfer state: connecting", "Connecting...."), "network-connect"); // should be "network-connecting", but that doesn't exist for KDE 4.0 yet setTransferChange(Tc_Status, true); } } diff --git a/transfer-plugins/metalink/abstractmetalink.cpp b/transfer-plugins/metalink/abstractmetalink.cpp index ea727feb..d6bc91b1 100644 --- a/transfer-plugins/metalink/abstractmetalink.cpp +++ b/transfer-plugins/metalink/abstractmetalink.cpp @@ -23,7 +23,6 @@ #include "core/signature.h" #include "kget_debug.h" -#include #include #include #include diff --git a/transfer-plugins/metalink/metalink.cpp b/transfer-plugins/metalink/metalink.cpp index 22b627a5..94764400 100644 --- a/transfer-plugins/metalink/metalink.cpp +++ b/transfer-plugins/metalink/metalink.cpp @@ -26,7 +26,6 @@ #include #include -#include #include #include #include @@ -78,7 +77,7 @@ void Metalink::downloadMetalink() { m_metalinkJustDownloaded = true; - setStatus(Job::Stopped, i18n("Downloading Metalink File...."), SmallIcon("document-save")); + setStatus(Job::Stopped, i18n("Downloading Metalink File...."), "document-save"); setTransferChange(Tc_Status, true); // make sure that the DataLocation directory exists (earlier this used to be handled by KStandardDirs) if (!QFileInfo::exists(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation))) { diff --git a/transfer-plugins/metalink/metalinkhttp.cpp b/transfer-plugins/metalink/metalinkhttp.cpp index 7c3cd944..5ebdcc46 100644 --- a/transfer-plugins/metalink/metalinkhttp.cpp +++ b/transfer-plugins/metalink/metalinkhttp.cpp @@ -26,7 +26,6 @@ #include "kget_debug.h" -#include #include #include #include diff --git a/transfer-plugins/metalink/metalinkxml.cpp b/transfer-plugins/metalink/metalinkxml.cpp index 197e2f08..65f8da9a 100644 --- a/transfer-plugins/metalink/metalinkxml.cpp +++ b/transfer-plugins/metalink/metalinkxml.cpp @@ -29,7 +29,6 @@ #include #include -#include #include #include #include @@ -75,7 +74,7 @@ void MetalinkXml::downloadMetalink() { m_metalinkJustDownloaded = true; - setStatus(Job::Running, i18n("Downloading Metalink File...."), SmallIcon("document-save")); + setStatus(Job::Running, i18n("Downloading Metalink File...."), "document-save"); setTransferChange(Tc_Status, true); // make sure that the DataLocation directory exists (earlier this used to be handled by KStandardDirs) if (!QFileInfo::exists(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation))) { diff --git a/transfer-plugins/mmsthreads/mmstransfer.cpp b/transfer-plugins/mmsthreads/mmstransfer.cpp index b6b42824..5ef28f41 100755 --- a/transfer-plugins/mmsthreads/mmstransfer.cpp +++ b/transfer-plugins/mmsthreads/mmstransfer.cpp @@ -57,8 +57,7 @@ void MmsTransfer::start() return; } - setStatus(Job::Running, i18nc("transfer state: running", "Running...."), - QIcon::fromTheme("media-playback-start").pixmap(16)); + setStatus(Job::Running, i18nc("transfer state: running", "Running...."), "media-playback-start"); m_mmsdownload = new MmsDownload(m_source.toString(), m_dest.toLocalFile(), m_fileTemp, m_amountThreads); connect(m_mmsdownload, SIGNAL(finished()), this, SLOT(slotResult())); @@ -92,8 +91,7 @@ void MmsTransfer::stop() } } - setStatus(Job::Stopped, i18nc("transfer state: stopped", "Stopped"), - QIcon::fromTheme("process-stop").pixmap(16)); + setStatus(Job::Stopped, i18nc("transfer state: stopped", "Stopped"), "process-stop"); m_downloadSpeed = 0; setTransferChange(Tc_Status | Tc_DownloadSpeed, true); } @@ -124,8 +122,7 @@ void MmsTransfer::slotResult() * the temporary file where is saved the status of all threads that download the file. */ if (m_downloadedSize == m_totalSize && m_totalSize != 0) { - setStatus(Job::Finished, i18nc("Transfer State:Finished","Finished"), - QIcon::fromTheme("dialog-ok").pixmap(16)); + setStatus(Job::Finished, i18nc("Transfer State:Finished","Finished"), "dialog-ok"); m_percent = 100; m_downloadSpeed = 0; setTransferChange(Tc_Status | Tc_Percent | Tc_DownloadSpeed, true); @@ -171,7 +168,7 @@ void MmsTransfer::slotProcessedSizeAndPercent(qulonglong size) void MmsTransfer::slotBrokenUrl() { - setError(i18n("Download failed, could not access this URL."), QIcon::fromTheme("dialog-cancel").pixmap(16), + setError(i18n("Download failed, could not access this URL."), "dialog-cancel", Job::NotSolveable); setTransferChange(Tc_Status, true); } diff --git a/transfer-plugins/multisegmentkio/transfermultisegkio.cpp b/transfer-plugins/multisegmentkio/transfermultisegkio.cpp index 02d98ebd..f3d61ef0 100644 --- a/transfer-plugins/multisegmentkio/transfermultisegkio.cpp +++ b/transfer-plugins/multisegmentkio/transfermultisegkio.cpp @@ -27,7 +27,6 @@ #include "kget_debug.h" -#include #include #include #include diff --git a/ui/history/transferhistoryitemdelegate.cpp b/ui/history/transferhistoryitemdelegate.cpp index 8feb5771..17d91b9b 100644 --- a/ui/history/transferhistoryitemdelegate.cpp +++ b/ui/history/transferhistoryitemdelegate.cpp @@ -26,8 +26,6 @@ #include #include -#include -#include #include #include #include diff --git a/ui/signaturedlg.cpp b/ui/signaturedlg.cpp index fc1df35f..f7dc1f47 100644 --- a/ui/signaturedlg.cpp +++ b/ui/signaturedlg.cpp @@ -34,10 +34,10 @@ #endif #include +#include #include #include -#include const QStringList SignatureDlg::OWNERTRUST = QStringList() << i18nc("trust level", "Unknown") << i18nc("trust level", "Undefined") << i18nc("trust level", "Never") << i18nc("trust level", "Marginal") << i18nc("trust level", "Full") << i18nc("trust level", "Ultimate"); @@ -171,7 +171,7 @@ void SignatureDlg::updateData() ui.keyGroup->setVisible(!signature.isEmpty()); - const int iconSize = KIconLoader::global()->currentSize(KIconLoader::Small); + const int iconSize = style()->pixelMetric(QStyle::PixelMetric::PM_SmallIconSize); #ifdef HAVE_QGPGME if (!fingerprintString.isEmpty()) { diff --git a/ui/transferdetails.cpp b/ui/transferdetails.cpp index 2905bcd8..6fac110d 100644 --- a/ui/transferdetails.cpp +++ b/ui/transferdetails.cpp @@ -19,6 +19,7 @@ #include #include +#include TransferDetails::TransferDetails(TransferHandler * transfer) : QWidget(nullptr), @@ -64,7 +65,7 @@ void TransferDetails::slotTransferChanged(TransferHandler * transfer, TransferHa Q_UNUSED(transfer) if(flags & Transfer::Tc_Status) { - frm.statusPixmapContentLabel->setPixmap(m_transfer->statusPixmap()); + frm.statusPixmapContentLabel->setPixmap(QIcon::fromTheme(m_transfer->statusIconName()).pixmap(style()->pixelMetric(QStyle::PixelMetric::PM_SmallIconSize))); frm.statusTextContentLabel->setText(m_transfer->statusText()); if (m_transfer->status() == Job::Finished) { -- GitLab