activityfw/testapplications/apptostart/lunchwidget.cpp
changeset 117 c63ee96dbe5f
equal deleted inserted replaced
115:3ab5c078b490 117:c63ee96dbe5f
       
     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 "lunchwidget.h"
       
    18 #include <hbapplication>
       
    19 #include <QStringList>
       
    20 
       
    21 
       
    22 #define hbApp qobject_cast<HbApplication*>(qApp)
       
    23 
       
    24 lunchwidget::lunchwidget(QGraphicsItem *parent)
       
    25     : HbWidget(parent)
       
    26 {
       
    27 
       
    28     mResultLabel = new HbLabel;        
       
    29     mResultLabel2 = new HbLabel;        
       
    30     mCountLabel = new HbLabel;   
       
    31     QStringList list = hbApp->arguments();
       
    32     int count = list.count();
       
    33     if ( count <= 1 ) {
       
    34         mResultLabel->setPlainText("arg1: None");
       
    35         mResultLabel2->setPlainText("arg2: None");
       
    36     }
       
    37     else if( count == 2 ) {
       
    38         QString arg = list.at(1);
       
    39         mResultLabel->setPlainText( tr("arg1: ") + arg );
       
    40         mResultLabel2->setPlainText( "arg2: None" );
       
    41         }
       
    42    else {
       
    43         QString arg1 = list.at(1);
       
    44         mResultLabel->setPlainText( tr("arg1: ") + arg1 );
       
    45         QString arg2 = list.at(2);
       
    46         mResultLabel2->setPlainText( tr("arg2: ") + arg2 );
       
    47         }     
       
    48         
       
    49     QString countstring;
       
    50     countstring.setNum(count);
       
    51     countstring = tr("arg count: ") + countstring;
       
    52     mCountLabel->setPlainText(countstring);
       
    53         
       
    54     mGridLayout = new QGraphicsGridLayout();
       
    55     mGridLayout->addItem(mResultLabel, 0, 0, 1, 1);
       
    56     mGridLayout->addItem(mResultLabel2, 1, 0, 1, 1);
       
    57     mGridLayout->addItem(mCountLabel, 2, 0, 1, 1);
       
    58     setLayout(mGridLayout);
       
    59     
       
    60 
       
    61 }
       
    62 
       
    63 lunchwidget::~lunchwidget()
       
    64 {
       
    65 }
       
    66 
       
    67 void lunchwidget::lunch()
       
    68 {
       
    69 
       
    70 }
       
    71