![]() |
Home · All Namespaces · All Classes |
00001 /**************************************************************************** 00002 ** 00003 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 00004 ** All rights reserved. 00005 ** Contact: Nokia Corporation (directui@nokia.com) 00006 ** 00007 ** This file is part of systemui. 00008 ** 00009 ** If you have questions regarding the use of this file, please contact 00010 ** Nokia at directui@nokia.com. 00011 ** 00012 ** This library is free software; you can redistribute it and/or 00013 ** modify it under the terms of the GNU Lesser General Public 00014 ** License version 2.1 as published by the Free Software Foundation 00015 ** and appearing in the file LICENSE.LGPL included in the packaging 00016 ** of this file. 00017 ** 00018 ****************************************************************************/ 00019 00020 #include "lockscreenstatusareaview.h" 00021 #include "statusarea.h" 00022 #include "statusindicator.h" 00023 #include "contextframeworkcontext.h" 00024 #include "x11wrapper.h" 00025 #include "notificationstatusindicator.h" 00026 #include <QGraphicsLinearLayout> 00027 #include <QX11Info> 00028 #include <MViewCreator> 00029 #include <MSceneManager> 00030 00031 LockScreenStatusAreaView::LockScreenStatusAreaView(StatusArea *controller) : 00032 MWidgetView(controller), 00033 controller(controller), 00034 phoneNetworkIndicator(new PhoneNetworkStatusIndicator(contextFrameworkContext, controller)), 00035 batteryIndicator(new BatteryStatusIndicator(contextFrameworkContext, controller)), 00036 phoneSignalStrengthIndicator(new PhoneNetworkSignalStrengthStatusIndicator(contextFrameworkContext, controller)), 00037 phoneNetworkTypeIndicator(new PhoneNetworkTypeStatusIndicator(contextFrameworkContext, controller)), 00038 internetConnectionIndicator(new InternetConnectionStatusIndicator(contextFrameworkContext, controller)), 00039 bluetoothIndicator(new BluetoothStatusIndicator(contextFrameworkContext, controller)), 00040 gpsIndicator(new GPSStatusIndicator(contextFrameworkContext, controller)), 00041 presenceIndicator(new PresenceStatusIndicator(contextFrameworkContext, controller)), 00042 profileIndicator(new ProfileStatusIndicator(contextFrameworkContext, controller)), 00043 callIndicator(new CallStatusIndicator(contextFrameworkContext, controller)), 00044 alarmIndicator(new AlarmStatusIndicator(contextFrameworkContext, controller)), 00045 notifierIndicator(new NotificationStatusIndicator(¬ifierNotificationSink, controller)), 00046 transferStatusIndicator(new TransferStatusIndicator(controller)), 00047 orientationChangeSignalConnected(false) 00048 { 00049 // Connect related phone network indicators 00050 connect(phoneNetworkTypeIndicator, SIGNAL(networkAvailabilityChanged(bool)), phoneSignalStrengthIndicator, SLOT(setDisplay(bool))); 00051 00052 // Put indicators into the layout 00053 QGraphicsLinearLayout *layout = new QGraphicsLinearLayout(Qt::Horizontal); 00054 layout->setContentsMargins(0, 0, 0, 0); 00055 layout->setSpacing(0); 00056 layout->addItem(batteryIndicator); 00057 layout->addItem(phoneSignalStrengthIndicator); 00058 layout->addItem(phoneNetworkTypeIndicator); 00059 layout->addItem(phoneNetworkIndicator); 00060 layout->addStretch(); 00061 layout->addItem(notifierIndicator); 00062 layout->addItem(transferStatusIndicator); 00063 layout->addItem(internetConnectionIndicator); 00064 layout->addItem(bluetoothIndicator); 00065 layout->addItem(gpsIndicator); 00066 layout->addItem(presenceIndicator); 00067 layout->addItem(profileIndicator); 00068 layout->addItem(callIndicator); 00069 layout->addItem(alarmIndicator); 00070 controller->setLayout(layout); 00071 } 00072 00073 LockScreenStatusAreaView::~LockScreenStatusAreaView() 00074 { 00075 } 00076 00077 void LockScreenStatusAreaView::setGeometry(const QRectF &rect) 00078 { 00079 MWidgetView::setGeometry(rect); 00080 00081 if (!orientationChangeSignalConnected && controller->sceneManager() != NULL) { 00082 // Update the status bar geometry property when the orientation change animation finishes. 00083 // This connection can not be made in the constructor because the scene manager does not exist at that point. In setGeometry() the manager definitely exists. 00084 connect(controller->sceneManager(), SIGNAL(orientationChangeFinished(M::Orientation)), this, SLOT(updateStatusBarGeometryProperty())); 00085 orientationChangeSignalConnected = true; 00086 00087 // Do the initial update of the status bar geometry property 00088 updateStatusBarGeometryProperty(); 00089 } 00090 } 00091 00092 void LockScreenStatusAreaView::updateStatusBarGeometryProperty() 00093 { 00094 if (controller->scene() != NULL) { 00095 Display *display = QX11Info::display(); 00096 Atom atom = X11Wrapper::XInternAtom(display, "_MEEGOTOUCH_MSTATUSBAR_GEOMETRY", False); 00097 long data[4]; 00098 00099 foreach (QGraphicsView *view, controller->scene()->views()) { 00100 // Set the _MEEGOTOUCH_MSTATUSBAR_GEOMETRY property into each view (window) the StatusArea belongs to 00101 QRectF statusBarGeometry = controller->mapRectToScene(QRectF(QPointF(), controller->geometry().size())); 00102 if (statusBarGeometry != updatedStatusBarGeometry && statusBarGeometry.x() >= 0 && statusBarGeometry.y() >= 0) { 00103 data[0] = statusBarGeometry.x(); 00104 data[1] = statusBarGeometry.y(); 00105 data[2] = statusBarGeometry.width(); 00106 data[3] = statusBarGeometry.height(); 00107 X11Wrapper::XChangeProperty(display, view->winId(), atom, XA_CARDINAL, 32, PropModeReplace, (unsigned char*)data, 4); 00108 00109 updatedStatusBarGeometry = statusBarGeometry; 00110 } 00111 } 00112 } 00113 } 00114 00115 M_REGISTER_VIEW_NEW(LockScreenStatusAreaView, StatusArea)
| Copyright © 2010 Nokia Corporation | Generated on Thu Nov 4 2010 18:19:34 Doxygen 1.7.1 |
MeeGo Touch |
