Skip to content

Commit

Permalink
Fixes: NB#274279 - 'Current state: Charging only' (§qtn_usb_charging§…
Browse files Browse the repository at this point in the history
…) alignment and font are incorrect in the USB mode selection dialog

RevBy: Vesa Halttunen
  • Loading branch information
Saija Saarenpää committed Oct 5, 2011
1 parent 0aa502e commit 8258ace
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 9 deletions.
1 change: 1 addition & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ system-ui (1.2.6~1) unstable; urgency=low

* [UNRELEASED]
* Fixes: NB#283768 - Media Sharing status menu item should be loaded to status menu.
* Fixes: NB#274279 - 'Current state: Charging only' (§qtn_usb_charging§) alignment and font are incorrect in the USB mode selection dialog

-- Vesa Halttunen <[email protected]> Mon, 03 Oct 2011 16:06:22 +0300

Expand Down
42 changes: 35 additions & 7 deletions src/systemui/usbui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@
#include <MGConfItem>
#include <QTimer>
#include <QDateTime>
#include <MStylableWidget>
#include <MContainer>
#include <MImageWidget>

#ifdef HAVE_QMSYSTEM
#include <qmlocks.h>
Expand All @@ -44,7 +47,7 @@ UsbUi::UsbUi(QObject *parent) : MDialog(),
#endif
developerMode(new MGConfItem("/Meego/System/DeveloperMode", this)),
layout(new QGraphicsLinearLayout(Qt::Vertical)),
chargingLabel(new MLabel),
chargingLabel(new MLabel()),
massStorageItem(new MBasicListItem(MBasicListItem::SingleTitle)),
oviSuiteItem(new MBasicListItem(MBasicListItem::SingleTitle)),
sdkItem(new MBasicListItem(MBasicListItem::SingleTitle))
Expand All @@ -54,19 +57,44 @@ UsbUi::UsbUi(QObject *parent) : MDialog(),
setSystem(true);
setButtonBoxVisible(false);

chargingLabel->setStyleName("CommonBodyTextInverted");
chargingLabel->setAlignment(Qt::AlignCenter);
layout->addItem(chargingLabel);
layout->setContentsMargins(0, 0, 0, 0);
layout->setSpacing(0);

massStorageItem->setStyleName("CommonBasicListItemInverted");
MStylableWidget* topSpacer = new MStylableWidget;
topSpacer->setStyleName("CommonSpacer");
layout->addItem(topSpacer);

MContainer* frame = new MContainer;
frame->setHeaderVisible(false);
frame->setStyleName("CommonTextFrameInverted");

chargingLabel->setStyleName("CommonSingleTitleInverted");
chargingLabel->setTextElide(true);

MImageWidget* icon = new MImageWidget("icon-m-common-usb");
icon->setStyleName("CommonSmallMainIcon");

QGraphicsLinearLayout* currentStateLayout = new QGraphicsLinearLayout(Qt::Horizontal, frame->centralWidget());
currentStateLayout->setContentsMargins(0, 0, 0, 0);
currentStateLayout->setSpacing(0);
currentStateLayout->addItem(icon);
currentStateLayout->setAlignment(icon, Qt::AlignCenter);
currentStateLayout->addItem(chargingLabel);
layout->addItem(frame);

MStylableWidget* bottomSpacer = new MStylableWidget;
bottomSpacer->setStyleName("CommonSpacer");
layout->addItem(bottomSpacer);

massStorageItem->setStyleName("CommonSmallPanelInverted");
connect(massStorageItem, SIGNAL(clicked()), this, SLOT(setMassStorageMode()));
layout->addItem(massStorageItem);

oviSuiteItem->setStyleName("CommonBasicListItemInverted");
oviSuiteItem->setStyleName("CommonSmallPanelInverted");
connect(oviSuiteItem, SIGNAL(clicked()), this, SLOT(setOviSuiteMode()));
layout->addItem(oviSuiteItem);

sdkItem->setStyleName("CommonBasicListItemInverted");
sdkItem->setStyleName("CommonSmallPanelInverted");
connect(sdkItem, SIGNAL(clicked()), this, SLOT(setSDKMode()));
connect(developerMode, SIGNAL(valueChanged()), this, SLOT(updateSDKItemVisibility()));
updateSDKItemVisibility();
Expand Down
6 changes: 4 additions & 2 deletions tests/ut_usbui/ut_usbui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -243,12 +243,14 @@ void Ut_UsbUi::testSDKItemVisibleOnlyWhenDeveloperModeEnabled()

mGConfItemValue = QVariant(true);
m_subject = new UsbUi;
QCOMPARE(m_subject->layout->count(), 4);
// Current state items (3) + 3 list items
QCOMPARE(m_subject->layout->count(), 6);
QCOMPARE(m_subject->sdkItem->parentLayoutItem(), m_subject->layout);

mGConfItemValue = QVariant(false);
m_subject->updateSDKItemVisibility();
QCOMPARE(m_subject->layout->count(), 3);
// Current state items (3) + 2 list items
QCOMPARE(m_subject->layout->count(), 5);
QCOMPARE(m_subject->sdkItem->parentLayoutItem(), (QGraphicsLayoutItem *)NULL);
}

Expand Down

0 comments on commit 8258ace

Please sign in to comment.