[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 () club ! cc ! cmu ! edu>
Date:       2010-05-25 4:10:09
Message-ID: 20100525041009.GA18829 () club ! cc ! cmu ! edu
[Download RAW message or body]

On Mon, May 24, 2010 at 10:56:53AM +0200, Marco Martin wrote:

> What should be modified i think is the size hint of the Icon applet, in 
> workspace, that is explicitly used here
> and should have a sizehint of Panel in vertical/horizontal formfactors and 
> Desktop in Planar

OK.  Attached is a patch against KDE 4.5 trunk, which I've compiled and
tested.

It does two things, (i) reenable the setting of the Panel icon size (the
kcm_icons patch I've submitted previously), and (ii) add sizeHint methods
to MenuLauncherApplet (the simple/old-style kickoff), IconApplet, and
PopupApplet--the last with the intention of fixing LauncherApplet (the
new-style kickoff) and any other popup-based applets that use an icon when
in "small form".

Seems to do the trick on my end.  Your thoughts?

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

diff --git a/kdebase/runtime/kcontrol/icons/icons.cpp \
                b/kdebase/runtime/kcontrol/icons/icons.cpp
--- a/kdebase/runtime/kcontrol/icons/icons.cpp
+++ b/kdebase/runtime/kcontrol/icons/icons.cpp
@@ -409,10 +409,10 @@
         return;
 
     mUsage = index;
-    if ( mUsage == KIconLoader::Panel || mUsage == KIconLoader::LastGroup )
+    if ( mUsage == KIconLoader::LastGroup )
     {
         mpSizeBox->setEnabled(false);
-	mpAnimatedCheck->setEnabled( mUsage == KIconLoader::Panel );
+	mpAnimatedCheck->setEnabled(false);
     }
     else
     {
diff --git a/kdebase/workspace/plasma/desktop/applets/kickoff/simpleapplet/simpleapplet.cpp \
                b/kdebase/workspace/plasma/desktop/applets/kickoff/simpleapplet/simpleapplet.cpp
                
--- a/kdebase/workspace/plasma/desktop/applets/kickoff/simpleapplet/simpleapplet.cpp
+++ b/kdebase/workspace/plasma/desktop/applets/kickoff/simpleapplet/simpleapplet.cpp
@@ -787,4 +787,24 @@
     return d->actions;
 }
 
+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);
+            return QSizeF(iconSize, iconSize);
+        case Plasma::Horizontal:
+        case Plasma::Vertical:
+            iconSize = IconSize(KIconLoader::Panel);
+            return QSizeF(iconSize, iconSize);
+        }
+    }
+
+    return Plasma::Applet::sizeHint(which, constraint);
+}
+
 #include "simpleapplet.moc"
diff --git a/kdebase/workspace/plasma/desktop/applets/kickoff/simpleapplet/simpleapplet.h \
                b/kdebase/workspace/plasma/desktop/applets/kickoff/simpleapplet/simpleapplet.h
                
--- a/kdebase/workspace/plasma/desktop/applets/kickoff/simpleapplet/simpleapplet.h
+++ b/kdebase/workspace/plasma/desktop/applets/kickoff/simpleapplet/simpleapplet.h
@@ -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.
diff --git a/kdebase/workspace/plasma/generic/applets/icon/icon.cpp \
                b/kdebase/workspace/plasma/generic/applets/icon/icon.cpp
--- a/kdebase/workspace/plasma/generic/applets/icon/icon.cpp
+++ b/kdebase/workspace/plasma/generic/applets/icon/icon.cpp
@@ -457,5 +457,25 @@
     }
 }
 
+QSizeF IconApplet::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);
+            return QSizeF(iconSize, iconSize);
+        case Plasma::Horizontal:
+        case Plasma::Vertical:
+            iconSize = IconSize(KIconLoader::Panel);
+            return QSizeF(iconSize, iconSize);
+        }
+    }
+
+    return Plasma::Applet::sizeHint(which, constraint);
+}
+
 #include "icon.moc"
 
diff --git a/kdebase/workspace/plasma/generic/applets/icon/icon.h \
                b/kdebase/workspace/plasma/generic/applets/icon/icon.h
--- a/kdebase/workspace/plasma/generic/applets/icon/icon.h
+++ b/kdebase/workspace/plasma/generic/applets/icon/icon.h
@@ -57,6 +57,7 @@
         void dropEvent(QGraphicsSceneDragDropEvent *event);
         void saveState(KConfigGroup &cg) const;
         void showConfigurationInterface();
+        QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) \
const;  
     private slots:
         void acceptedPropertiesDialog();
diff --git a/kdelibs/plasma/popupapplet.cpp b/kdelibs/plasma/popupapplet.cpp
--- a/kdelibs/plasma/popupapplet.cpp
+++ b/kdelibs/plasma/popupapplet.cpp
@@ -856,6 +856,26 @@
     dialog->move(pos);
 }
 
+QSizeF PopupApplet::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);
+            return QSizeF(iconSize, iconSize);
+        case Plasma::Horizontal:
+        case Plasma::Vertical:
+            iconSize = IconSize(KIconLoader::Panel);
+            return QSizeF(iconSize, iconSize);
+        }
+    }
+
+    return Plasma::Applet::sizeHint(which, constraint);
+}
+
 } // Plasma namespace
 
 #include "popupapplet.moc"
diff --git a/kdelibs/plasma/popupapplet.h b/kdelibs/plasma/popupapplet.h
--- a/kdelibs/plasma/popupapplet.h
+++ b/kdelibs/plasma/popupapplet.h
@@ -150,6 +150,7 @@
     void dragEnterEvent(QGraphicsSceneDragDropEvent *event);
     void dragLeaveEvent(QGraphicsSceneDragDropEvent *event);
     void dropEvent(QGraphicsSceneDragDropEvent *event);
+    QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const;
 
 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