[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdebase/workspace/plasma/applets/system-monitor
From:       Petri Damstén <petri.damsten () kdemail ! net>
Date:       2009-09-08 17:08:10
Message-ID: 1252429690.842565.17916.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 1021259 by pdamsten:

Don't show top bar if height is too small.
BUG: 198389

 M  +18 -0     applet.cpp  
 M  +1 -0      applet.h  


--- trunk/KDE/kdebase/workspace/plasma/applets/system-monitor/applet.cpp #1021258:1021259
@@ -21,6 +21,7 @@
 #include <Plasma/Containment>
 #include <Plasma/Frame>
 #include <Plasma/IconWidget>
+#include <Plasma/SignalPlotter>
 #include <KIcon>
 #include <KDebug>
 #include <QGraphicsLinearLayout>
@@ -84,6 +85,7 @@
         }
     } else if (constraints & Plasma::SizeConstraint) {
         checkGeometry();
+        checkPlotters();
         Detail detail;
         if (size().width() > 250 && size().height() / m_items.count() > 150) {
             detail = High;
@@ -187,6 +189,22 @@
     setDetail(m_detail);
 }
 
+void Applet::checkPlotters()
+{
+    if (m_plotters.isEmpty()) {
+        return;
+    }
+    Plasma::SignalPlotter *plotter = m_plotters.values()[0];
+    QFontMetrics metrics(plotter->font());
+    bool showTopBar = (metrics.height() < plotter->size().height() / 3);
+    kDebug() << metrics.height() << plotter->size().height();
+    foreach (plotter, m_plotters) {
+        if (showTopBar != plotter->showTopBar()) {
+            plotter->setShowTopBar(showTopBar);
+        }
+    }
+}
+
 void Applet::checkGeometry()
 {
     if (m_mode != Panel) {
--- trunk/KDE/kdebase/workspace/plasma/applets/system-monitor/applet.h #1021258:1021259
@@ -61,6 +61,7 @@
         void connectSource(const QString& source);
         void disconnectSources();
         void checkGeometry();
+        void checkPlotters();
         QGraphicsLinearLayout* mainLayout();
         void setTitle(const QString& title, bool spacer = false);
         uint interval() { return m_interval; };
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic