Use enums from KIconLoader
Instead of using hardcore numbers, it would be great to use the enums provided by KIconLoader whenever we use sizes for icons. Made the change for the obvious ones replacing "16" by KIconLoader::SizeSmall, "22" by KIconLoader::SizeSmallMedium and "32" by KIconLoader::SizeMedium. svn path=/trunk/KDE/kdelibs/; revision=926544
This commit is contained in:
parent
828ac46bd4
commit
cae61ee4ca
@ -1533,8 +1533,8 @@ ToolBox *ContainmentPrivate::createToolBox()
|
|||||||
switch (type) {
|
switch (type) {
|
||||||
case Containment::PanelContainment:
|
case Containment::PanelContainment:
|
||||||
toolBox = new PanelToolBox(q);
|
toolBox = new PanelToolBox(q);
|
||||||
toolBox->setSize(22);
|
toolBox->setSize(KIconLoader::SizeSmallMedium);
|
||||||
toolBox->setIconSize(QSize(16, 16));
|
toolBox->setIconSize(QSize(KIconLoader::SizeSmall, KIconLoader::SizeSmall));
|
||||||
if (q->immutability() != Mutable) {
|
if (q->immutability() != Mutable) {
|
||||||
toolBox->hide();
|
toolBox->hide();
|
||||||
}
|
}
|
||||||
|
@ -33,6 +33,7 @@
|
|||||||
|
|
||||||
#include <kdebug.h>
|
#include <kdebug.h>
|
||||||
#include <kicon.h>
|
#include <kicon.h>
|
||||||
|
#include <kiconloader.h>
|
||||||
|
|
||||||
#include "applet.h"
|
#include "applet.h"
|
||||||
#include "containment.h"
|
#include "containment.h"
|
||||||
@ -704,7 +705,7 @@ void ExtenderItemPrivate::themeChanged()
|
|||||||
//icon height.
|
//icon height.
|
||||||
dragger->resize();
|
dragger->resize();
|
||||||
QSizeF size = dragger->elementSize("hint-preferred-icon-size");
|
QSizeF size = dragger->elementSize("hint-preferred-icon-size");
|
||||||
size = size.expandedTo(QSizeF(16,16));
|
size = size.expandedTo(QSizeF(KIconLoader::SizeSmall,KIconLoader::SizeSmall));
|
||||||
|
|
||||||
Plasma::Theme *theme = Plasma::Theme::defaultTheme();
|
Plasma::Theme *theme = Plasma::Theme::defaultTheme();
|
||||||
QFont font = theme->font(Plasma::Theme::DefaultFont);
|
QFont font = theme->font(Plasma::Theme::DefaultFont);
|
||||||
|
@ -57,7 +57,7 @@ AppletHandle::AppletHandle(Containment *parent, Applet *applet, const QPointF &h
|
|||||||
m_pressedButton(NoButton),
|
m_pressedButton(NoButton),
|
||||||
m_containment(parent),
|
m_containment(parent),
|
||||||
m_applet(applet),
|
m_applet(applet),
|
||||||
m_iconSize(16),
|
m_iconSize(KIconLoader::SizeSmall),
|
||||||
m_opacity(0.0),
|
m_opacity(0.0),
|
||||||
m_anim(FadeIn),
|
m_anim(FadeIn),
|
||||||
m_animId(0),
|
m_animId(0),
|
||||||
@ -653,10 +653,10 @@ void AppletHandle::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
|
|||||||
QSizeF min = m_applet->minimumSize();
|
QSizeF min = m_applet->minimumSize();
|
||||||
QSizeF max = m_applet->maximumSize();
|
QSizeF max = m_applet->maximumSize();
|
||||||
// If the applet doesn't have a minimum size, calculate based on a
|
// If the applet doesn't have a minimum size, calculate based on a
|
||||||
// minimum content area size of 16x16
|
// minimum content area size of 16x16 (KIconLoader::SizeSmall)
|
||||||
if (min.isEmpty()) {
|
if (min.isEmpty()) {
|
||||||
min = m_applet->boundingRect().size() - m_applet->boundingRect().size();
|
min = m_applet->boundingRect().size() - m_applet->boundingRect().size();
|
||||||
min += QSizeF(16, 16);
|
min += QSizeF(KIconLoader::SizeSmall, KIconLoader::SizeSmall);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_pressedButton == RotateButton) {
|
if (m_pressedButton == RotateButton) {
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
|
|
||||||
#include <kcolorscheme.h>
|
#include <kcolorscheme.h>
|
||||||
#include <kdebug.h>
|
#include <kdebug.h>
|
||||||
|
#include <kiconloader.h>
|
||||||
|
|
||||||
#include <plasma/theme.h>
|
#include <plasma/theme.h>
|
||||||
#include <plasma/paintutils.h>
|
#include <plasma/paintutils.h>
|
||||||
@ -363,7 +364,7 @@ void DesktopToolBox::showToolBox()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// put tools 5px from icon edge
|
// put tools 5px from icon edge
|
||||||
const int iconWidth = 32;
|
const int iconWidth = KIconLoader::SizeMedium;
|
||||||
int x;
|
int x;
|
||||||
int y;
|
int y;
|
||||||
switch (corner()) {
|
switch (corner()) {
|
||||||
@ -503,7 +504,8 @@ void DesktopToolBox::showToolBox()
|
|||||||
}
|
}
|
||||||
|
|
||||||
Plasma::IconWidget *icon = qgraphicsitem_cast<Plasma::IconWidget *>(tool);
|
Plasma::IconWidget *icon = qgraphicsitem_cast<Plasma::IconWidget *>(tool);
|
||||||
icon->resize(maxWidth, icon->sizeFromIconSize(22).height());
|
const int iconHeight = icon->sizeFromIconSize(KIconLoader::SizeSmallMedium).height();
|
||||||
|
icon->resize(maxWidth, iconHeight);
|
||||||
|
|
||||||
if (tool->isEnabled()) {
|
if (tool->isEnabled()) {
|
||||||
if (isToolbar()) {
|
if (isToolbar()) {
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
|
|
||||||
#include <kcolorscheme.h>
|
#include <kcolorscheme.h>
|
||||||
#include <kconfiggroup.h>
|
#include <kconfiggroup.h>
|
||||||
|
#include <kiconloader.h>
|
||||||
#include <kdebug.h>
|
#include <kdebug.h>
|
||||||
|
|
||||||
#include "corona.h"
|
#include "corona.h"
|
||||||
@ -44,7 +45,7 @@ public:
|
|||||||
ToolBoxPrivate(Containment *c)
|
ToolBoxPrivate(Containment *c)
|
||||||
: containment(c),
|
: containment(c),
|
||||||
size(50),
|
size(50),
|
||||||
iconSize(32, 32),
|
iconSize(KIconLoader::SizeMedium, KIconLoader::SizeMedium),
|
||||||
corner(ToolBox::TopRight),
|
corner(ToolBox::TopRight),
|
||||||
hidden(false),
|
hidden(false),
|
||||||
showing(false),
|
showing(false),
|
||||||
@ -115,7 +116,7 @@ void ToolBox::addTool(QAction *action)
|
|||||||
tool->setAction(action);
|
tool->setAction(action);
|
||||||
tool->setDrawBackground(true);
|
tool->setDrawBackground(true);
|
||||||
tool->setOrientation(Qt::Horizontal);
|
tool->setOrientation(Qt::Horizontal);
|
||||||
tool->resize(tool->sizeFromIconSize(22));
|
tool->resize(tool->sizeFromIconSize(KIconLoader::SizeSmallMedium));
|
||||||
|
|
||||||
tool->hide();
|
tool->hide();
|
||||||
const int height = static_cast<int>(tool->boundingRect().height());
|
const int height = static_cast<int>(tool->boundingRect().height());
|
||||||
|
@ -37,6 +37,7 @@
|
|||||||
#include <klocale.h>
|
#include <klocale.h>
|
||||||
#include <kapplication.h>
|
#include <kapplication.h>
|
||||||
#include <kstandarddirs.h>
|
#include <kstandarddirs.h>
|
||||||
|
#include <kiconloader.h>
|
||||||
|
|
||||||
#include <plasma/svg.h>
|
#include <plasma/svg.h>
|
||||||
#include <plasma/theme.h>
|
#include <plasma/theme.h>
|
||||||
@ -124,7 +125,7 @@ SignalPlotter::SignalPlotter(QGraphicsItem *parent)
|
|||||||
d->showThinFrame = true;
|
d->showThinFrame = true;
|
||||||
|
|
||||||
// Anything smaller than this does not make sense.
|
// Anything smaller than this does not make sense.
|
||||||
setMinimumSize(QSizeF(16, 16));
|
setMinimumSize(QSizeF(KIconLoader::SizeSmall, KIconLoader::SizeSmall));
|
||||||
|
|
||||||
d->showVerticalLines = true;
|
d->showVerticalLines = true;
|
||||||
d->verticalLinesDistance = 30;
|
d->verticalLinesDistance = 30;
|
||||||
|
Loading…
Reference in New Issue
Block a user