Fix wireless bargraph menu layout problems

pull/1/head
Timothy Pearson 12 years ago
parent 2b5b314cfd
commit 2df5ea4aaf

@ -33,6 +33,7 @@
#include <tqpixmapcache.h>
#include <tqpainter.h>
#include <tqstyle.h>
#include <tqimage.h>
#include <dcopclient.h>
#include <kdebug.h>
#include <kdialogbase.h>
@ -112,7 +113,7 @@ WirelessNetworkItem::paint (TQPainter *p, const TQColorGroup &/*cg*/, bool highl
int spacer = 0;
pbarStrength->setTotalSteps (100);
pbarStrength->setSizePolicy (TQSizePolicy ((TQSizePolicy::SizeType) 0, (TQSizePolicy::SizeType) 0, 0, 0, pbarStrength->sizePolicy ().hasHeightForWidth ()));
pbarStrength->setFixedHeight (_height - 2);
pbarStrength->setFixedHeight (h - (_border*2));
pbarStrength->setProgress (_net.getStrength());
pbarStrength->setPercentageVisible (false);
@ -125,13 +126,23 @@ WirelessNetworkItem::paint (TQPainter *p, const TQColorGroup &/*cg*/, bool highl
p->drawText (x, y, w, h, AlignLeft | AlignVCenter | DontClip | ShowPrefix, getDisplayText());
if (_net.isEncrypted()) {
TQPixmap pmLock = SmallIcon ("lock", TQIconSet::Automatic);
TQPixmap pmLock = SmallIcon ("lock", h - (_border*2));
if (pmLock.size().height() != (h - (_border*2))) {
TQImage pmLockImg = pmLock.convertToImage();
pmLockImg = pmLockImg.smoothScale(65535, (h - (_border*2)), TQImage::ScaleMin);
pmLock.convertFromImage(pmLockImg);
}
p->drawPixmap (parent->sizeHint ().width () - pbarStrength->width () - _space - pmLock.size ().width () - 6, y + _border, pmLock);
spacer = pmLock.size ().width () + 4;
}
if (_adhoc) {
TQPixmap pmAdHoc = SmallIcon ("system", TQIconSet::Automatic);
TQPixmap pmAdHoc = SmallIcon ("system", h - (_border*2));
if (pmAdHoc.size().height() != (h - (_border*2))) {
TQImage pmAdHocImg = pmAdHoc.convertToImage();
pmAdHocImg = pmAdHocImg.smoothScale(65535, (h - (_border*2)), TQImage::ScaleMin);
pmAdHoc.convertFromImage(pmAdHocImg);
}
p->drawPixmap (parent->sizeHint ().width () - pbarStrength->width () - _space - pmAdHoc.size ().width () - spacer - 6, y + _border, pmAdHoc);
}
@ -166,8 +177,10 @@ WirelessNetworkItem::WirelessNetworkItem (TQWidget* p, TQString dev, WirelessNet
_widgetHeight = SmallIcon (NULL, TQIconSet::Automatic).height ();
// figure out the height of the text
_textHeight = kapp->fontMetrics ().size (AlignLeft | AlignVCenter | DontClip | ShowPrefix, _net.getDisplaySsid()).height ();
// the item is height of the text plus the default frame width
_height = _textHeight + kapp->style ().pixelMetric (TQStyle::PM_DefaultFrameWidth);
/* _height needs to be at least the height of a SmallIcon plus a border of one px (top & bottom)*/
if (_height < _widgetHeight) {
_height = _widgetHeight + 2;

Loading…
Cancel
Save