[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [networkmanagement] applet: remove some fixed pixelsizes to make it usable on high-res display
From: Michael Zanetti <michael_zanetti () gmx ! net>
Date: 2012-11-04 11:24:18
Message-ID: 20121104112418.C86F2A6091 () git ! kde ! org
[Download RAW message or body]
Git commit 803a33eebfcc4c48924fe7bc6d3ac8f73becefb0 by Michael Zanetti.
Committed on 20/10/2012 at 00:27.
Pushed by mzanetti into branch 'master'.
remove some fixed pixelsizes to make it usable on high-res display
M +6 -5 applet/activatableitem.cpp
M +6 -4 applet/interfacedetailswidget.cpp
M +6 -6 applet/interfaceitem.cpp
M +10 -9 applet/nmpopup.cpp
M +3 -1 applet/wirelessinterfaceitem.cpp
M +4 -5 applet/wirelessnetworkitem.cpp
http://commits.kde.org/networkmanagement/803a33eebfcc4c48924fe7bc6d3ac8f73becefb0
diff --git a/applet/activatableitem.cpp b/applet/activatableitem.cpp
index 1198fd2..62a653c 100644
--- a/applet/activatableitem.cpp
+++ b/applet/activatableitem.cpp
@@ -31,6 +31,7 @@ along with this program. If not, see \
<http://www.gnu.org/licenses/>. #include <KIcon>
#include <KNotification>
#include <KGlobalSettings>
+#include <KIconLoader>
#include <Plasma/Animation>
#include <Plasma/PushButton>
@@ -40,8 +41,8 @@ along with this program. If not, see \
<http://www.gnu.org/licenses/>. #include "../libs/service/events.h"
K_GLOBAL_STATIC_WITH_ARGS(KComponentData, s_networkManagementComponentData, \
("networkmanagement", "networkmanagement", \
KComponentData::SkipMainComponentRegistration))
-static const int m_iconSize = 48;
-int rowHeight = qMax(30, QFontMetrics(KGlobalSettings::generalFont()).height()+10);
+static const int m_iconSize = IconSize(KIconLoader::Desktop);
+int rowHeight = QFontMetrics(KGlobalSettings::generalFont()).height() + \
QFontMetrics(KGlobalSettings::generalFont()).xHeight() * 2; int \
maxConnectionNameWidth = \
QFontMetrics(KGlobalSettings::generalFont()).width("12345678901234567890123");
ActivatableItem::ActivatableItem(RemoteActivatable *remote, QGraphicsItem * parent) \
: Plasma::IconWidget(parent), @@ -75,8 +76,8 @@ \
ActivatableItem::ActivatableItem(RemoteActivatable *remote, QGraphicsItem * pare
// disconnect button
m_disconnectButton = new Plasma::IconWidget(this);
- m_disconnectButton->setMaximumHeight(16);
- m_disconnectButton->setMaximumWidth(16);
+ m_disconnectButton->setMaximumHeight(IconSize(KIconLoader::Small));
+ m_disconnectButton->setMaximumWidth(IconSize(KIconLoader::Small));
//m_disconnectButton->setIcon(KIcon("network-disconnect"));
//m_disconnectButton->setIcon(KIcon("call-stop"));
m_disconnectButton->setIcon(KIcon("user-offline"));
@@ -131,7 +132,7 @@ void ActivatableItem::notifyNetworkingState()
} else if (!NetworkManager::isWirelessEnabled() &&
m_activatable &&
m_activatable->activatableType() == \
Knm::Activatable::WirelessInterfaceConnection) {
- KNotification::event(Event::RfOff, i18nc("@info:status Notification for \
radio kill switch turned off", "Wireless hardware disabled"), \
KIcon("network-wireless").pixmap(QSize(m_iconSize,m_iconSize)), 0, \
KNotification::CloseOnTimeout, *s_networkManagementComponentData)->sendEvent(); + \
KNotification::event(Event::RfOff, i18nc("@info:status Notification for radio kill \
switch turned off", "Wireless hardware disabled"), \
KIcon("network-wireless").pixmap(QSize(m_iconSize, m_iconSize)), 0, \
KNotification::CloseOnTimeout, *s_networkManagementComponentData)->sendEvent(); }
}
diff --git a/applet/interfacedetailswidget.cpp b/applet/interfacedetailswidget.cpp
index 9635559..5b27971 100644
--- a/applet/interfacedetailswidget.cpp
+++ b/applet/interfacedetailswidget.cpp
@@ -163,8 +163,9 @@ InterfaceDetailsWidget::InterfaceDetailsWidget(QGraphicsItem * \
parent) : QGraphi
m_disconnectButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
m_disconnectButton->setIcon(KIcon("user-offline"));
m_disconnectButton->setText(i18nc("disconnect button in interface details \
window", "Disconnect"));
- m_disconnectButton->setMinimumHeight(28);
- m_disconnectButton->setMaximumHeight(28);
+ int disconnectButtonHeight = QFontMetrics(m_disconnectButton->font()).height() + \
QFontMetrics(m_disconnectButton->font()).xHeight() * 2; + \
m_disconnectButton->setMinimumHeight(disconnectButtonHeight); + \
m_disconnectButton->setMaximumHeight(disconnectButtonHeight); #endif
connect(m_disconnectButton, SIGNAL(clicked()), this, \
SLOT(emitDisconnectInterfaceRequest())); @@ -173,8 +174,9 @@ \
InterfaceDetailsWidget::InterfaceDetailsWidget(QGraphicsItem * parent) : QGraphi
// add pushbutton for "back" action
m_backButton = new Plasma::PushButton(this);
- m_backButton->setMaximumHeight(22);
- m_backButton->setMaximumWidth(22);
+ int backButtonHeight = QFontMetrics(KGlobalSettings::generalFont()).height() + \
QFontMetrics(KGlobalSettings::generalFont()).xHeight(); + \
m_backButton->setMaximumHeight(backButtonHeight); + \
m_backButton->setMaximumWidth(backButtonHeight); \
m_backButton->setIcon(KIcon("go-previous")); m_backButton->setToolTip(i18n("Go \
Back")); m_backButton->setZValue(100);
diff --git a/applet/interfaceitem.cpp b/applet/interfaceitem.cpp
index 356c285..115f9e7 100644
--- a/applet/interfaceitem.cpp
+++ b/applet/interfaceitem.cpp
@@ -72,7 +72,7 @@ InterfaceItem::InterfaceItem(NetworkManager::Device * iface, \
RemoteActivatableLi setTextBackgroundColor(QColor(Qt::transparent));
QString tt = i18nc("tooltip on the LHS widgets", "Click here for interface \
details");
- m_pixmapSize = QSize(48, 48);
+ m_pixmapSize = QSize(IconSize(KIconLoader::Dialog), \
IconSize(KIconLoader::Dialog)); setSizePolicy(QSizePolicy::Minimum, \
QSizePolicy::Minimum);
m_layout = new QGraphicsGridLayout(this);
@@ -125,10 +125,10 @@ InterfaceItem::InterfaceItem(NetworkManager::Device * iface, \
RemoteActivatableLi
// security
m_connectionInfoIcon = new Plasma::Label(this);
- m_connectionInfoIcon->setMinimumHeight(16);
- m_connectionInfoIcon->setMinimumWidth(16);
- m_connectionInfoIcon->setMaximumHeight(16);
- m_connectionInfoIcon->nativeWidget()->setPixmap(KIcon("security-low").pixmap(16, \
16)); + m_connectionInfoIcon->setMinimumHeight(IconSize(KIconLoader::Small));
+ m_connectionInfoIcon->setMinimumWidth(IconSize(KIconLoader::Small));
+ m_connectionInfoIcon->setMaximumHeight(IconSize(KIconLoader::Small));
+ m_connectionInfoIcon->nativeWidget()->setPixmap(KIcon("security-low").pixmap(IconSize(KIconLoader::Small), \
IconSize(KIconLoader::Small)));
m_connectionInfoIcon->hide(); // hide by default, we'll enable it later
m_layout->addItem(m_connectionInfoIcon, 1, 2, 1, 1, Qt::AlignRight); // check...
@@ -424,7 +424,7 @@ QPixmap InterfaceItem::interfacePixmap(const QString &icon) {
//QPixmap pmap = KIcon(icon).pixmap(QSize(KIconLoader::SizeMedium, \
KIconLoader::SizeMedium)); if (m_hasDefaultRoute && !pmap.isNull()) {
QPainter p(&pmap);
- p.drawPixmap(QRect(2,2,18,18), KIcon(overlayIcon).pixmap(QSize(18,18)));
+ p.drawPixmap(QRect(2,2,IconSize(KIconLoader::Small),IconSize(KIconLoader::Small)), \
KIcon(overlayIcon).pixmap(QSize(IconSize(KIconLoader::Small),IconSize(KIconLoader::Small))));
}
return pmap;
}
diff --git a/applet/nmpopup.cpp b/applet/nmpopup.cpp
index a8dfd54..0b44a9a 100644
--- a/applet/nmpopup.cpp
+++ b/applet/nmpopup.cpp
@@ -102,8 +102,8 @@ void NMPopup::init()
m_leftWidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
m_leftLabel = new Plasma::Label(m_leftWidget);
- m_leftLabel->setMaximumHeight(24);
- m_leftLabel->setMinimumHeight(24);
+ m_leftLabel->setMaximumHeight(QFontMetrics(m_leftLabel->font()).height() + \
QFontMetrics(m_leftLabel->font()).xHeight() * 2); + \
m_leftLabel->setMinimumHeight(m_leftLabel->maximumHeight());
m_leftLabel->setText(i18nc("title on the LHS of the plasmoid", \
"<h3>Interfaces</h3>"));
m_leftLayout = new QGraphicsGridLayout;
@@ -182,10 +182,12 @@ void NMPopup::init()
connect(m_connectionsTabBar, SIGNAL(currentChanged(int)), \
SLOT(currentInnerTabChanged(int))); /*** Inner TabBar: end ***/
+ int rowHeight = QFontMetrics(KGlobalSettings::generalFont()).height() + \
QFontMetrics(KGlobalSettings::generalFont()).xHeight() * 2; +
//m_tab1Layout->setRowMaximumHeight(rowMain, rowHeight);
m_tab1Layout->addItem(m_connectionsTabBar, rowMain++, 0, 1, 2, Qt::AlignCenter);
m_tab1Layout->addItem(connectionsFrame, rowMain++, 0, 1, 2, Qt::AlignCenter);
- m_tab1Layout->setRowFixedHeight(0, \
QFontMetrics(KGlobalSettings::generalFont()).height()*2.2); + \
m_tab1Layout->setRowFixedHeight(0, rowHeight);
// flight-mode checkbox
/* m_networkingCheckBox = new Plasma::CheckBox(this);
@@ -241,8 +243,8 @@ void NMPopup::init()
//m_advancedSettingsButton->setSizePolicy(QSizePolicy::Fixed, \
QSizePolicy::Fixed); m_advancedSettingsButton->setIcon(KIcon("configure"));
m_advancedSettingsButton->setText(i18nc("settings button in applet's popup \
window", "Settings..."));
- m_advancedSettingsButton->setMinimumHeight(28);
- m_advancedSettingsButton->setMaximumHeight(28);
+ m_advancedSettingsButton->setMinimumHeight(rowHeight);
+ m_advancedSettingsButton->setMaximumHeight(rowHeight);
connect(m_advancedSettingsButton, SIGNAL(clicked()), this, \
SLOT(manageConnections())); m_tab1Layout->addItem(m_advancedSettingsButton, rowMain, \
0);
@@ -254,8 +256,8 @@ void NMPopup::init()
//m_showInterfacesButton->setIcon(KIcon("run-build"));
m_showInterfacesButton->setIcon(KIcon("format-list-unordered"));
m_showInterfacesButton->setText(i18nc("show interface list in applet's popup \
window", "Show Interfaces"));
- m_showInterfacesButton->setMinimumHeight(28);
- m_showInterfacesButton->setMaximumHeight(28);
+ m_showInterfacesButton->setMinimumHeight(rowHeight);
+ m_showInterfacesButton->setMaximumHeight(rowHeight);
connect(m_showInterfacesButton, SIGNAL(clicked()), this, \
SLOT(toggleInterfaceList()));
m_tab1Layout->addItem(m_showInterfacesButton, rowMain++, 1, 1, 1, \
Qt::AlignRight);
@@ -890,5 +892,4 @@ void NMPopup::currentInnerTabChanged(int index)
}
//m_connectToAnotherNetwork->update();
}
-// vim: sw=4 sts=4 et tw=100
-
+// vim: sw=4 sts=4 et tw=100
\ No newline at end of file
diff --git a/applet/wirelessinterfaceitem.cpp b/applet/wirelessinterfaceitem.cpp
index 8f71b20..cb3bff1 100644
--- a/applet/wirelessinterfaceitem.cpp
+++ b/applet/wirelessinterfaceitem.cpp
@@ -33,6 +33,8 @@ along with this program. If not, see \
<http://www.gnu.org/licenses/>. #include <QtNetworkManager/ipv4config.h>
#include <QtNetworkManager/manager.h>
+#include <KIconLoader>
+
WirelessInterfaceItem::WirelessInterfaceItem(NetworkManager::WirelessDevice * iface, \
RemoteActivatableList* activatables, InterfaceItem::NameDisplayMode mode, \
QGraphicsWidget* parent) : InterfaceItem(iface, activatables, mode, parent)
{
@@ -82,7 +84,7 @@ void WirelessInterfaceItem::setConnectionInfo()
m_wirelessStatus->init(wremote);
}
if (!m_wirelessStatus->securityIcon().isEmpty()) {
- \
m_connectionInfoIcon->nativeWidget()->setPixmap(KIcon(m_wirelessStatus->securityIcon()).pixmap(16, \
16)); + \
m_connectionInfoIcon->nativeWidget()->setPixmap(KIcon(m_wirelessStatus->securityIcon()).pixmap(IconSize(KIconLoader::Small), \
IconSize(KIconLoader::Small)));
\
m_connectionInfoIcon->setToolTip(m_wirelessStatus->securityTooltip()); \
m_connectionInfoIcon->show();
diff --git a/applet/wirelessnetworkitem.cpp b/applet/wirelessnetworkitem.cpp
index 6489f5d..23a4a53 100644
--- a/applet/wirelessnetworkitem.cpp
+++ b/applet/wirelessnetworkitem.cpp
@@ -122,22 +122,21 @@ void WirelessNetworkItem::setupItem()
m_strengthMeter->setValue(m_wirelessStatus->strength());
m_strengthMeter->setToolTip(i18n("Strength: %1%", \
m_wirelessStatus->strength())); \
m_strengthMeter->setMeterType(Plasma::Meter::BarMeterHorizontal);
- m_strengthMeter->setPreferredSize(QSizeF(60, 12));
- m_strengthMeter->setMaximumHeight(12);
+ m_strengthMeter->setPreferredSize(QSizeF(IconSize(KIconLoader::Small) * 4, \
QFontMetrics(m_connectButton->font()).height())); + \
m_strengthMeter->setMaximumHeight(QFontMetrics(m_connectButton->font()).height());
m_strengthMeter->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
m_layout->addItem(m_strengthMeter, 0, 2, 1, 1, Qt::AlignVCenter | \
Qt::AlignRight); }
else
{
widget = new QGraphicsWidget(this);
- widget->setPreferredSize(QSizeF(60, 12));
- widget->setMaximumHeight(12);
+ widget->setPreferredSize(QSizeF(IconSize(KIconLoader::Small) * 4, 12));
widget->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
m_layout->addItem(widget, 0, 2, 1, 1, Qt::AlignVCenter | Qt::AlignRight);
}
m_securityIcon = new Plasma::Label(this);
- m_securityIcon->nativeWidget()->setPixmap(KIcon(m_wirelessStatus->securityIcon()).pixmap(22,22));
+ m_securityIcon->nativeWidget()->setPixmap(KIcon(m_wirelessStatus->securityIcon()).pixmap(IconSize(KIconLoader::Small) \
* 1.2,IconSize(KIconLoader::Small) * 1.2)); \
m_securityIcon->setToolTip(m_wirelessStatus->securityTooltip());
m_layout->addItem(m_securityIcon, 0, 3, 1, 1, Qt::AlignVCenter | \
Qt::AlignRight);
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic