Hello, to follow up on a message i sent some time ago, I started to convert the battery applet to make it use KIcon. =)
For now the theme is still needed, as just the battery itself is kicon-based, and the AC adaptor is still SVG based. I think that at small sizes it really is a significant improvement on clarity and looks. For now it's slightly smaller, but we can work a little more on small sizes of oxygen if this is not enough (these icons are not used anywhere else). At big sizes it's a bit blurred for now, but I don't think many people use it at sizes bigger than 64x64 anyways. We have icons generated up to 256x256. Attaching the small patch and two screenshots showing the after and before. If I have the ack I will also change the ac animation (changing it to an IMO more professional fade) and the whole painting of the applet to use KIcon instead of the svg, where applicable. Bye, -Riccardo -- Pace Peace Paix Paz Frieden Pax Pokój Friður Fred Béke 和平 Hasiti Lapé Hetep Malu Mир Wolakota Santiphap Irini Peoch שלום Shanti Vrede Baris Rój Mír Taika Rongo Sulh Mir Py'guapy 평화
From 67df7f624e6fcb096521bbdb2748b12e13c3e37d Mon Sep 17 00:00:00 2001 From: Riccardo Iaconelli <ricca...@kde.org> Date: Sun, 14 Feb 2010 15:25:47 +0100 Subject: [PATCH] first modifications to convert the battery applet to KIcon Signed-off-by: Riccardo Iaconelli <ricca...@kde.org> --- plasma/generic/applets/battery/battery.cpp | 33 ++++++++++----------------- 1 files changed, 12 insertions(+), 21 deletions(-) diff --git a/plasma/generic/applets/battery/battery.cpp b/plasma/generic/applets/battery/battery.cpp index c9c8035..5144f61 100644 --- a/plasma/generic/applets/battery/battery.cpp +++ b/plasma/generic/applets/battery/battery.cpp @@ -795,38 +795,29 @@ void Battery::paintBattery(QPainter *p, const QRect &contentsRect, const int bat { int minSize = qMin(contentsRect.height(), contentsRect.width()); QRect contentsSquare = QRect(contentsRect.x() + (contentsRect.width() - minSize) / 2, contentsRect.y() + (contentsRect.height() - minSize) / 2, minSize, minSize); - - if (m_theme->hasElement("Battery")) { - m_theme->paint(p, contentsSquare, "Battery"); - } QString fill_element; if (plugState) { if (batteryPercent > 95) { - fill_element = "Fill100"; + fill_element = "battery-100"; } else if (batteryPercent > 80) { - fill_element = "Fill80"; + fill_element = "battery-080"; } else if (batteryPercent > 50) { - fill_element = "Fill60"; + fill_element = "battery-060"; } else if (batteryPercent > 20) { - fill_element = "Fill40"; + fill_element = "battery-040"; } else if (batteryPercent > 10) { - fill_element = "Fill20"; - } // Don't show a fillbar below 11% charged - } else { - fill_element = "Unavailable"; - } - //kDebug() << "plugState:" << plugState; - - // Now let's find out which fillstate to show - if (!fill_element.isEmpty()) { - if (m_theme->hasElement(fill_element)) { - m_theme->paint(p, contentsSquare, fill_element); + fill_element = "battery-020"; } else { - kDebug() << fill_element << " does not exist in svg"; + fill_element = "battery-000"; } + } else { + fill_element = "Unavailable"; } - + + KIcon battery(fill_element); + battery.paint(p, contentsSquare); + m_theme->paint(p, scaleRectF(m_acAlpha, contentsSquare), "AcAdapter"); if (plugState && m_theme->hasElement("Overlay")) { -- 1.6.6.1
<<attachment: battery-kicon.png>>
<<attachment: battery-svg.png>>
_______________________________________________ Plasma-devel mailing list Plasma-devel@kde.org https://mail.kde.org/mailman/listinfo/plasma-devel