![]() |
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 #include "unlockarea.h" 00020 00021 #include <QTime> 00022 #include <QDateTime> 00023 00024 #include <QGraphicsLinearLayout> 00025 00026 #include <MLabel> 00027 #include <MImageWidget> 00028 00029 UnlockArea::UnlockArea(QGraphicsItem *parent) : 00030 MStylableWidget(parent), 00031 m_enabled(false), 00032 m_active(false) 00033 { 00034 QGraphicsLinearLayout *layout = 00035 new QGraphicsLinearLayout (Qt::Vertical); 00036 00037 setObjectName ("LockLandArea"); 00038 00039 // Create the unlock icon 00040 MImageWidget *unlock_icon; 00041 00042 unlock_icon = new MImageWidget; 00043 unlock_icon->setImage ("icon-m-common-unlocked", QSize (32, 32)); 00044 unlock_icon->setZoomFactor (1.0); 00045 unlock_icon->setObjectName ("LockScreenUnlockIcon"); 00046 00047 m_unlock_icon = new MWidget; 00048 QGraphicsLinearLayout *icon_layout = 00049 new QGraphicsLinearLayout (Qt::Horizontal); 00050 icon_layout->addStretch (); 00051 icon_layout->addItem (unlock_icon); 00052 icon_layout->addStretch (); 00053 m_unlock_icon->setLayout (icon_layout); 00054 00055 // Add the unlock icon centered 00056 layout->addStretch (); 00057 layout->addItem (m_unlock_icon); 00058 layout->addStretch (); 00059 00060 setLayout (layout); 00061 00062 updateState (); 00063 } 00064 00065 UnlockArea::~UnlockArea () 00066 { 00067 // Free the resources here... 00068 } 00069 00070 void 00071 UnlockArea::setActive (bool active) 00072 { 00073 if (m_enabled == false) 00074 return; /* no-op when disabled... */ 00075 00076 if (m_active == active) 00077 return; 00078 00079 m_active = active; 00080 00081 updateState (); 00082 } 00083 00084 void 00085 UnlockArea::setEnabled (bool enabled) 00086 { 00087 if (m_enabled == enabled) 00088 return; 00089 00090 m_enabled = enabled; 00091 // Set active to false when enable val. has been changed... 00092 m_active = false; 00093 00094 updateState (); 00095 } 00096 00097 void 00098 UnlockArea::updateState () 00099 { 00100 if (m_enabled == false) 00101 { 00102 setObjectName ("LockLandArea"); 00103 } 00104 else if (m_active == true) 00105 { 00106 setObjectName ("LockLandAreaActive"); 00107 } 00108 else 00109 { 00110 setObjectName ("LockLandAreaDragged"); 00111 } 00112 00113 m_unlock_icon->setVisible (m_enabled); 00114 m_unlock_icon->update (); 00115 00116 // After object-name change a screen-refresh is needed: 00117 update (); 00118 } 00119
| Copyright © 2010 Nokia Corporation | Generated on Thu Nov 4 2010 18:19:34 Doxygen 1.7.1 |
MeeGo Touch |
