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

List:       kde-panel-devel
Subject:    Re: Panel icon sizing bug in 4.4
From:       Mike Kasick <mkasick-pd () club ! cc ! cmu ! edu>
Date:       2010-06-02 0:51:28
Message-ID: 20100602005128.GA15533 () club ! cc ! cmu ! edu
[Download RAW message or body]

On Tue, May 25, 2010 at 12:38:44PM -0700, Aaron J. Seigo wrote:

> there was one commit per set of files changed; so one for PopupApplet in 
> libplasma, one for kickoff, one for lancelot (iirc?) and one for the control 
> panel.

I tested these out, they work great!

One more issue: the "simple" Application Launcher Menu (which I prefer to
kickoff) needs to be fixed too.  Attached is a patch based on the Icon
applet changes that fixes the MenuLauncher applet too.

Thanks!

["simpleapplet.diff" (text/x-diff)]

Index: workspace/plasma/desktop/applets/kickoff/simpleapplet/simpleapplet.cpp
===================================================================
--- workspace/plasma/desktop/applets/kickoff/simpleapplet/simpleapplet.cpp	(revision 1130567)
+++ workspace/plasma/desktop/applets/kickoff/simpleapplet/simpleapplet.cpp	(working copy)
@@ -44,6 +44,7 @@
 #include <KCModuleInfo>
 #include <KComboBox>
 #include <KConfigDialog>
+#include <KGlobalSettings>
 #include <KIcon>
 #include <KIconButton>
 #include <KIconLoader>
@@ -371,6 +372,9 @@
     }
 
     constraintsEvent(Plasma::ImmutableConstraint);
+
+    connect(KGlobalSettings::self(), SIGNAL(iconChanged(int)),
+        this, SLOT(iconSizeChanged(int)));
 }
 
 void MenuLauncherApplet::constraintsEvent(Plasma::Constraints constraints)
@@ -787,4 +791,34 @@
     return d->actions;
 }
 
+void MenuLauncherApplet::iconSizeChanged(int group)
+{
+    if (group == KIconLoader::Desktop || group == KIconLoader::Panel) {
+        updateGeometry();
+    }
+}
+
+QSizeF MenuLauncherApplet::sizeHint(Qt::SizeHint which, const QSizeF & constraint) const
+{
+    if (which == Qt::PreferredSize) {
+        int iconSize;
+
+        switch (formFactor()) {
+            case Plasma::Planar:
+            case Plasma::MediaCenter:
+                iconSize = IconSize(KIconLoader::Desktop);
+                break;
+
+            case Plasma::Horizontal:
+            case Plasma::Vertical:
+                iconSize = IconSize(KIconLoader::Panel);
+                break;
+        }
+
+        return QSizeF(iconSize, iconSize);
+    }
+
+    return Plasma::Applet::sizeHint(which, constraint);
+}
+
 #include "simpleapplet.moc"
Index: workspace/plasma/desktop/applets/kickoff/simpleapplet/simpleapplet.h
===================================================================
--- workspace/plasma/desktop/applets/kickoff/simpleapplet/simpleapplet.h	(revision 1130567)
+++ workspace/plasma/desktop/applets/kickoff/simpleapplet/simpleapplet.h	(working copy)
@@ -125,6 +125,7 @@
      * Create a configuration dialog.
      */
     void createConfigurationInterface(KConfigDialog *parent);
+    QSizeF sizeHint(Qt::SizeHint which, const QSizeF & constraint = QSizeF()) const;
 
 private Q_SLOTS:
 	/// Configuration-dialog accepted.
@@ -133,6 +134,7 @@
     void toggleMenu(bool pressed = true);
     /// An action within the menu got triggered.
     void actionTriggered(QAction *action);
+    void iconSizeChanged(int group);
 
 private:
     class Private;


_______________________________________________
Plasma-devel mailing list
Plasma-devel@kde.org
https://mail.kde.org/mailman/listinfo/plasma-devel


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

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