Skip to content

Commit

Permalink
Fixes: NB#284386 - [TASK] DLNA indicator on status area
Browse files Browse the repository at this point in the history
Bug: NB#284386 - [TASK] DLNA indicator on status area
RevBy: Saija Saarenpää, Anssi Eteläniemi
  • Loading branch information
Vesa Halttunen committed Oct 26, 2011
1 parent 7b94e8d commit 6ef90c9
Show file tree
Hide file tree
Showing 14 changed files with 171 additions and 1 deletion.
1 change: 1 addition & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
system-ui (1.2.15~1) unstable; urgency=low

* [UNRELEASED]
* Fixes: NB#284386 - [TASK] DLNA indicator on status area

-- Artem Egorkine <[email protected]> Wed, 26 Oct 2011 10:29:20 +0300

Expand Down
4 changes: 3 additions & 1 deletion src/extensions/screenlock/lockscreenstatusareaview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ LockScreenStatusAreaView::LockScreenStatusAreaView(StatusArea *controller) :
alarmIndicator(new AlarmStatusIndicator(contextFrameworkContext, controller)),
notificationStatusIndicator(new NotificationStatusIndicator(controller)),
callForwardingIndicator(new CallForwardingStatusIndicator(contextFrameworkContext, controller)),
dlnaIndicator(new DLNAStatusIndicator(contextFrameworkContext, controller)),
transferStatusIndicator(new TransferStatusIndicator(controller)),
orientationChangeSignalConnected(false)
{
Expand All @@ -64,13 +65,14 @@ LockScreenStatusAreaView::LockScreenStatusAreaView(StatusArea *controller) :
layout->addStretch();
layout->addItem(notificationStatusIndicator);
layout->addItem(transferStatusIndicator);
layout->addItem(callIndicator);
layout->addItem(tetheringIndicator);
layout->addItem(callForwardingIndicator);
layout->addItem(dlnaIndicator);
layout->addItem(shortDistanceNetworkIndicator);
layout->addItem(gpsIndicator);
layout->addItem(presenceIndicator);
layout->addItem(profileIndicator);
layout->addItem(callIndicator);
layout->addItem(alarmIndicator);
controller->setLayout(layout);
}
Expand Down
3 changes: 3 additions & 0 deletions src/extensions/screenlock/lockscreenstatusareaview.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,9 @@ private slots:
//! Call forwarding indicator
StatusIndicator *callForwardingIndicator;

//! DLNA indicator
StatusIndicator *dlnaIndicator;

//! Transfer status indicator
StatusIndicator *transferStatusIndicator;

Expand Down
6 changes: 6 additions & 0 deletions src/systemui/statusarea/statusareaview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ StatusAreaView::StatusAreaView(StatusArea *controller) :
portraitNotificationIndicator(new NotificationStatusIndicator(controller)),
landscapeCallForwardingIndicator(new CallForwardingStatusIndicator(contextFrameworkContext, controller)),
portraitCallForwardingIndicator(new CallForwardingStatusIndicator(contextFrameworkContext, controller)),
landscapeDLNAIndicator(new DLNAStatusIndicator(contextFrameworkContext, controller)),
portraitDLNAIndicator(new DLNAStatusIndicator(contextFrameworkContext, controller)),
landscapeTransferStatusIndicator(new TransferStatusIndicator(controller)),
portraitTransferStatusIndicator(new TransferStatusIndicator(controller)),
landscapeClock(new Clock(controller)),
Expand Down Expand Up @@ -145,6 +147,8 @@ void StatusAreaView::setupTestability()
portraitClock->setParent(portraitWidget);
landscapeCallForwardingIndicator->setParent(landscapeWidget);
portraitCallForwardingIndicator->setParent(portraitWidget);
landscapeDLNAIndicator->setParent(landscapeWidget);
portraitDLNAIndicator->setParent(portraitWidget);
landscapeTransferStatusIndicator->setParent(landscapeWidget);
portraitTransferStatusIndicator->setParent(portraitWidget);
}
Expand Down Expand Up @@ -182,6 +186,7 @@ QGraphicsLinearLayout* StatusAreaView::createLandscapeLayout()
layout->addItem(landscapeCallIndicator);
layout->addItem(landscapeTetheringIndicator);
layout->addItem(landscapeCallForwardingIndicator);
layout->addItem(landscapeDLNAIndicator);
layout->addItem(landscapeShortDistanceNetworkIndicator);
layout->addItem(landscapeGPSIndicator);
layout->addItem(landscapePresenceIndicator);
Expand Down Expand Up @@ -210,6 +215,7 @@ QGraphicsLinearLayout* StatusAreaView::createPortraitLayout()
layout->addItem(portraitCallIndicator);
layout->addItem(portraitTetheringIndicator);
layout->addItem(portraitCallForwardingIndicator);
layout->addItem(portraitDLNAIndicator);
layout->addItem(portraitShortDistanceNetworkIndicator);
layout->addItem(portraitGPSIndicator);
layout->addItem(portraitPresenceIndicator);
Expand Down
4 changes: 4 additions & 0 deletions src/systemui/statusarea/statusareaview.h
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,10 @@ private slots:
StatusIndicator *landscapeCallForwardingIndicator;
StatusIndicator *portraitCallForwardingIndicator;

//! DLNA status indicator
StatusIndicator *landscapeDLNAIndicator;
StatusIndicator *portraitDLNAIndicator;

//! Transfer status indicator
StatusIndicator *landscapeTransferStatusIndicator;
StatusIndicator *portraitTransferStatusIndicator;
Expand Down
17 changes: 17 additions & 0 deletions src/systemui/statusarea/statusindicator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -786,3 +786,20 @@ void NotificationStatusIndicator::setIconID(const QString &iconID)
setStyleNameAndUpdate(metaObject()->className());
}
}

DLNAStatusIndicator::DLNAStatusIndicator(ApplicationContext &context, QGraphicsItem *parent) :
StatusIndicator(parent),
dlnaEnabled(createContextItem(context, "/com/nokia/dlna/dlnaEnabled"))
{
connect(dlnaEnabled, SIGNAL(contentsChanged()), this, SLOT(dlnaEnabledChanged()));
dlnaEnabledChanged();
}

DLNAStatusIndicator::~DLNAStatusIndicator()
{
}

void DLNAStatusIndicator::dlnaEnabledChanged()
{
setStyleNameAndUpdate(QString(metaObject()->className()) + (dlnaEnabled->value().toBool() ? "Set" : ""));
}
26 changes: 26 additions & 0 deletions src/systemui/statusarea/statusindicator.h
Original file line number Diff line number Diff line change
Expand Up @@ -612,4 +612,30 @@ public slots:
void setIconID(const QString &iconID);
};

/*!
* A status indicator for showing whether DLNA sharing is enabled.
*/
class DLNAStatusIndicator : public StatusIndicator
{
Q_OBJECT
M_CONTROLLER(DLNAStatusIndicator)

public:
/*!
* Constructs a DLNAStatusIndicator.
*
* \param context the application context to get status information from
* \param parent parent MWidget
*/
explicit DLNAStatusIndicator(ApplicationContext &context, QGraphicsItem *parent = NULL);

virtual ~DLNAStatusIndicator();

private slots:
void dlnaEnabledChanged();

private:
ContextItem *dlnaEnabled;
};

#endif // STATUSINDICATOR_H
5 changes: 5 additions & 0 deletions src/systemui/statusarea/statusindicatormodel.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,4 +108,9 @@ class TransferStatusIndicatorModel : public StatusIndicatorModel
M_MODEL(TransferStatusIndicatorModel)
};

class DLNAStatusIndicatorModel : public StatusIndicatorModel
{
M_MODEL(DLNAStatusIndicatorModel)
};

#endif /* STATUSINDICATORMODEL_H_ */
76 changes: 76 additions & 0 deletions tests/stubs/dlnastatusindicator_stub.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
/****************************************************************************
**
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation ([email protected])
**
** This file is part of systemui.
**
** If you have questions regarding the use of this file, please contact
** Nokia at [email protected].
**
** This library is free software; you can redistribute it and/or
** modify it under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation
** and appearing in the file LICENSE.LGPL included in the packaging
** of this file.
**
****************************************************************************/
#ifndef DLNASTATUSINDICATOR_STUB
#define DLNASTATUSINDICATOR_STUB

#include "statusindicator_stub.h"
#include <stubbase.h>


// 1. DECLARE STUB
// FIXME - stubgen is not yet finished
class DLNAStatusIndicatorStub : public StubBase
{
public:
virtual void DLNAStatusIndicatorConstructor(ApplicationContext &context, QGraphicsItem *parent);
virtual void DLNAStatusIndicatorDestructor();
virtual void dlnaEnabledChanged();
};

// 2. IMPLEMENT STUB
void DLNAStatusIndicatorStub::DLNAStatusIndicatorConstructor(ApplicationContext &context, QGraphicsItem *parent)
{
Q_UNUSED(context);
Q_UNUSED(parent);

}
void DLNAStatusIndicatorStub::DLNAStatusIndicatorDestructor()
{

}
void DLNAStatusIndicatorStub::dlnaEnabledChanged()
{
stubMethodEntered("dlnaEnabledChanged");
}



// 3. CREATE A STUB INSTANCE
DLNAStatusIndicatorStub gDefaultDLNAStatusIndicatorStub;
DLNAStatusIndicatorStub *gDLNAStatusIndicatorStub = &gDefaultDLNAStatusIndicatorStub;


// 4. CREATE A PROXY WHICH CALLS THE STUB
DLNAStatusIndicator::DLNAStatusIndicator(ApplicationContext &context, QGraphicsItem *parent)
{
gDLNAStatusIndicatorStub->DLNAStatusIndicatorConstructor(context, parent);
}

DLNAStatusIndicator::~DLNAStatusIndicator()
{
gDLNAStatusIndicatorStub->DLNAStatusIndicatorDestructor();
}

void DLNAStatusIndicator::dlnaEnabledChanged()
{
gDLNAStatusIndicatorStub->dlnaEnabledChanged();
}


#endif
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
#include "callforwardingstatusindicator_stub.h"
#include "notificationstatusindicator_stub.h"
#include "transferstatusindicator_stub.h"
#include "dlnastatusindicator_stub.h"
#include "screenlockextension_stub.h"
#include "x11wrapper.h"
#include "notificationsink_stub.h"
Expand Down
1 change: 1 addition & 0 deletions tests/ut_statusareaview/ut_statusareaview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
#include "tetheringstatusindicator_stub.h"
#include "profilestatusindicator_stub.h"
#include "callforwardingstatusindicator_stub.h"
#include "dlnastatusindicator_stub.h"
#include "notificationarea_stub.h"
#include "notificationstatusindicator_stub.h"
#include "notificationsink_stub.h"
Expand Down
11 changes: 11 additions & 0 deletions tests/ut_statusindicator/ut_statusindicator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -833,4 +833,15 @@ void Ut_StatusIndicator::testNotification()
QCOMPARE(m_subject->styleName().contains("Disabled"), QBool(true));
}

void Ut_StatusIndicator::testDLNA()
{
m_subject = new DLNAStatusIndicator(*testContext);

testContextItems["/com/nokia/dlna/dlnaEnabled"]->setValue(QVariant(false));
QCOMPARE(m_subject->styleName(), QString("DLNAStatusIndicator"));

testContextItems["/com/nokia/dlna/dlnaEnabled"]->setValue(QVariant(true));
QCOMPARE(m_subject->styleName(), QString("DLNAStatusIndicatorSet"));
}

QTEST_APPLESS_MAIN(Ut_StatusIndicator)
1 change: 1 addition & 0 deletions tests/ut_statusindicator/ut_statusindicator.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ private slots:
void testTransferStatusStateChange();
void testCallForwarding();
void testNotification();
void testDLNA();
};

#endif //_UT_STATUSINDICATOR_
16 changes: 16 additions & 0 deletions themes/style/statusarea.css
Original file line number Diff line number Diff line change
Expand Up @@ -672,3 +672,19 @@ StatusIndicatorIconStyle#CallForwardingStatusIndicatorSet {
minimum-size: -1 -1;
maximum-size: -1 -1;
}

StatusIndicatorIconStyle#DLNAStatusIndicator {
/* The list of IDs of the images to be shown in the status indicator separated by spaces */
image-list: "";
preferred-size: 0 -1;
minimum-size: 0 -1;
maximum-size: 0 -1;
}

StatusIndicatorIconStyle#DLNAStatusIndicatorSet {
/* The list of IDs of the images to be shown in the status indicator separated by spaces */
image-list: "icon-s-status-dlna-server";
preferred-size: -1 -1;
minimum-size: -1 -1;
maximum-size: -1 -1;
}

0 comments on commit 6ef90c9

Please sign in to comment.