phoneapp/phoneuiqtviewadapter/tsrc/u_carmodetester/main.cpp
changeset 27 2f8f8080a020
child 45 6b911d05207e
equal deleted inserted replaced
22:6bb1b21d2484 27:2f8f8080a020
       
     1 /*
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: 
       
    15 *
       
    16 */
       
    17 #include <QtGui>
       
    18 #include <hbapplication.h>
       
    19 #include <hbmainwindow.h>
       
    20 #include <hbview.h>
       
    21 #include <hbpushbutton.h>
       
    22 #include <hblabel.h>
       
    23 #include <telinformationpskeys.h>
       
    24 #include "cphonepubsubproxy.h"
       
    25 
       
    26 class CarModeTester : public HbWidget
       
    27 {
       
    28     Q_OBJECT
       
    29 
       
    30 public:
       
    31     CarModeTester();
       
    32 
       
    33 private slots:
       
    34     void setCarModeOn();
       
    35     void setCarModeOff();
       
    36 };
       
    37 
       
    38 int main(int argc, char *argv[])
       
    39 {
       
    40     // Initialization
       
    41     HbApplication app(argc, argv);
       
    42 
       
    43     // Main window widget. 
       
    44     // Includes decorators such as signal strength and battery life indicator.
       
    45     HbMainWindow mainWindow;
       
    46 
       
    47     CarModeTester* cmt = new CarModeTester;
       
    48     mainWindow.addView(cmt);
       
    49 
       
    50     // Show widget
       
    51     mainWindow.show();
       
    52 
       
    53     // Enter event loop
       
    54     return app.exec();
       
    55 }
       
    56 
       
    57 CarModeTester::CarModeTester() {
       
    58     HbPushButton* button = new HbPushButton("Set Car Mode ON", this);
       
    59     button->setMaximumHeight(50);
       
    60     connect(button,SIGNAL(clicked()),SLOT(setCarModeOn()));
       
    61 
       
    62     HbPushButton* button2 = new HbPushButton("Set Car Mode OFF", this);
       
    63     button2->setMaximumHeight(50);
       
    64     connect(button2,SIGNAL(clicked()),SLOT(setCarModeOff()));
       
    65 
       
    66     QGraphicsLinearLayout* layout = new QGraphicsLinearLayout(Qt::Vertical);
       
    67     layout->addItem(button);
       
    68     layout->addItem(button2);
       
    69     setLayout(layout);
       
    70 }
       
    71 
       
    72 void CarModeTester::setCarModeOn()
       
    73 {
       
    74     CPhonePubSubProxy::Instance()->ChangePropertyValue(KPSUidTelCarMode, KTelCarMode, EPSCarModeOn);
       
    75 }
       
    76 
       
    77 void CarModeTester::setCarModeOff()
       
    78 {
       
    79     CPhonePubSubProxy::Instance()->ChangePropertyValue(KPSUidTelCarMode, KTelCarMode, EPSCarModeOff);
       
    80 }
       
    81 
       
    82 #include "main.moc"