![]() |
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 <QGraphicsLinearLayout> 00020 #include "lockscreenview.h" 00021 #include <MGConfItem> 00022 #include <MViewCreator> 00023 #include "lockscreen.h" 00024 00025 const QString GCONF_BG_LANDSCAPE = "/desktop/meego/background/landscape/picture_filename"; 00026 const QString GCONF_BG_PORTRAIT = "/desktop/meego/background/portrait/picture_filename"; 00027 00028 LockScreenView::LockScreenView(MSceneWindow* controller) : MSceneWindowView(controller), 00029 layout(new QGraphicsLinearLayout(Qt::Vertical)), 00030 lockScreenHeader(new MWidgetController), 00031 controller(controller), 00032 gconfBgLandscape(new MGConfItem(GCONF_BG_LANDSCAPE, this)), 00033 gconfBgPortrait(new MGConfItem(GCONF_BG_PORTRAIT, this)), 00034 landscapePixmap(new QPixmap), 00035 portraitPixmap(new QPixmap) 00036 { 00037 // Set the main layout 00038 layout->setContentsMargins(0, 0, 0, 0); 00039 layout->setSpacing(0); 00040 controller->setLayout(layout); 00041 00042 // Create a header for the lock screen 00043 lockScreenHeader->setViewType("lockScreenHeader"); 00044 layout->addItem(lockScreenHeader); 00045 00046 connect(gconfBgLandscape, SIGNAL(valueChanged()), this, SLOT(reloadLandscapeBackground())); 00047 connect(gconfBgPortrait, SIGNAL(valueChanged()), this, SLOT(reloadPortraitBackground())); 00048 00049 // Load the backgrounds if any... 00050 reloadLandscapeBackground(); 00051 reloadPortraitBackground(); 00052 } 00053 00054 LockScreenView::~LockScreenView() 00055 { 00056 delete gconfBgLandscape; 00057 delete gconfBgPortrait; 00058 delete landscapePixmap; 00059 delete portraitPixmap; 00060 delete lockScreenHeader; 00061 } 00062 00063 void LockScreenView::paint (QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *) 00064 { 00065 QPixmap *pixmap = (geometry().height() > geometry().width()) ? portraitPixmap : landscapePixmap; 00066 00067 painter->drawPixmap(0, 0, pixmap->width(), pixmap->height(), *pixmap); 00068 } 00069 00070 void LockScreenView::reloadLandscapeBackground () 00071 { 00072 QString filename = gconfBgLandscape->value().toString(); 00073 if (!filename.isEmpty()) { 00074 landscapePixmap->load(filename); 00075 } 00076 } 00077 00078 void LockScreenView::reloadPortraitBackground () 00079 { 00080 QString filename = gconfBgPortrait->value().toString(); 00081 if (!filename.isEmpty()) { 00082 portraitPixmap->load (filename); 00083 } 00084 } 00085 00086 M_REGISTER_VIEW_NEW(LockScreenView, LockScreen)
| Copyright © 2010 Nokia Corporation | Generated on Thu Nov 4 2010 18:19:34 Doxygen 1.7.1 |
MeeGo Touch |
