kdeplasma-addons: prepare bubblemon applet for plasma library changes

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2023-10-21 19:34:25 +03:00
parent cf2654a6de
commit 234a83d61b
2 changed files with 13 additions and 6 deletions

View file

@ -4,6 +4,12 @@ set(bubblemon_SRCS
)
kde4_add_plugin(plasma_applet_bubblemon ${bubblemon_SRCS})
target_link_libraries(plasma_applet_bubblemon KDE4::plasma)
target_link_libraries(plasma_applet_bubblemon
KDE4::plasma
KDE4::solid
)
install(TARGETS plasma_applet_bubblemon DESTINATION ${KDE4_PLUGIN_INSTALL_DIR})
install(
TARGETS plasma_applet_bubblemon
DESTINATION ${KDE4_PLUGIN_INSTALL_DIR}
)

View file

@ -31,6 +31,7 @@
#include <Plasma/Svg>
#include <Plasma/ToolTipManager>
#include <Plasma/ToolTipContent>
#include <Solid/PowerManagement>
#include <KConfigDialog>
#include <KDebug>
@ -220,7 +221,7 @@ Bubble::paintInterface(QPainter *painter, const QStyleOptionGraphicsItem *option
if (m_max>0 && m_val>0) {
float drawValue;
if (m_animated && !shouldConserveResources())
if (m_animated && !Solid::PowerManagement::appShouldConserveResources())
drawValue = m_interpolator->currentFrame();
else
drawValue = m_val;
@ -248,7 +249,7 @@ Bubble::paintInterface(QPainter *painter, const QStyleOptionGraphicsItem *option
}
painter->setClipRect(m_clip);
m_svg->paint(painter, m_svg->elementRect("fill"), "fill");
if (m_bubbleCount>0 && m_animated && !shouldConserveResources()) {
if (m_bubbleCount>0 && m_animated && !Solid::PowerManagement::appShouldConserveResources()) {
painter->setClipPath(m_bubbleClip);
for(int i = 0;i<m_bubbleCount;i++) {
if (m_bubbles.at(i).y()+m_bubbleRect.height()>m_clip.top())
@ -301,7 +302,7 @@ Bubble::drawLabel(QPainter *painter, const QStyleOptionGraphicsItem *option, con
void
Bubble::moveBubbles()
{
if (!boundingRect().isEmpty() && int(m_bubbleRect.height() * m_bubbleCount) > 0 && m_max > 0 && m_animated && !shouldConserveResources()) {
if (!boundingRect().isEmpty() && int(m_bubbleRect.height() * m_bubbleCount) > 0 && m_max > 0 && m_animated && !Solid::PowerManagement::appShouldConserveResources()) {
QRectF rect = boundingRect();
QVector<QPoint>::iterator i;
bool needsUpdate = false;
@ -363,7 +364,7 @@ Bubble::dataUpdated(QString name, Plasma::DataEngine::Data data)
tip.setImage(tipIcon.pixmap(IconSize(KIconLoader::Desktop)));
Plasma::ToolTipManager::self()->setContent(this, tip);
if (m_animated && !shouldConserveResources()) {
if (m_animated && !Solid::PowerManagement::appShouldConserveResources()) {
m_bubbleCount = ((float)m_val/(float)m_max)*20;
/*int bubbleCount;
if (m_max>0)