stifui/qt/src/dlgsetting.cpp
branchRCL_3
changeset 9 404ad6c9bc20
child 12 aefcba28a3e0
equal deleted inserted replaced
8:87e9ebfbe96a 9:404ad6c9bc20
       
     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: QT C++ based Class.
       
    15  * 
       
    16  */
       
    17 
       
    18 #include "dlgsetting.h"
       
    19 #include <QtGui>
       
    20 
       
    21 DlgSetting::DlgSetting(UiSetting* settingObj, QWidget *parent)
       
    22     : QDialog(parent), setting(settingObj)
       
    23     {
       
    24     SetupUI();
       
    25     }
       
    26 
       
    27 void DlgSetting::SetupUI()
       
    28     {
       
    29     this->setContextMenuPolicy(Qt::NoContextMenu);
       
    30     QGridLayout *mainLayout = new QGridLayout(this);
       
    31     this->setLayout(mainLayout);
       
    32     
       
    33     chkShowoutput = new QCheckBox(this);
       
    34     chkShowoutput->setText(tr("Show output in execution."));
       
    35     chkShowoutput->setChecked(setting->ReadSetting("showoutput") == "true");
       
    36     
       
    37     QWidget *toolWidget = new QWidget(this);
       
    38     QGridLayout *toolLayout = new QGridLayout();
       
    39     
       
    40     toolWidget->setLayout(toolLayout);
       
    41     btnOk = new QPushButton(tr("Ok"), toolWidget);
       
    42     btnOk->setFixedSize(100, 30);
       
    43     QObject::connect(btnOk, SIGNAL(clicked()), this,
       
    44             SLOT(on_btnOk_clicked()));
       
    45     btnCancel = new QPushButton(tr("Cancel"), toolWidget);
       
    46     btnCancel->setFixedSize(100, 30);
       
    47     QObject::connect(btnCancel, SIGNAL(clicked()), this,
       
    48             SLOT(on_btnCancel_clicked()));
       
    49     toolLayout->addWidget(btnOk, 0, 0);
       
    50     toolLayout->addWidget(btnCancel, 0, 1);
       
    51 
       
    52     mainLayout->addWidget(chkShowoutput, 0, 0);
       
    53     mainLayout->addWidget(toolWidget, 2, 0);    
       
    54     }
       
    55 
       
    56 void DlgSetting::on_btnOk_clicked()
       
    57     {
       
    58     if(chkShowoutput->checkState() == Qt::Checked)
       
    59         {
       
    60         setting->SetSetting("showoutput", "true");
       
    61         }
       
    62     else
       
    63         {
       
    64         setting->SetSetting("showoutput", "false");    
       
    65         }
       
    66     this->accept();
       
    67     }
       
    68 
       
    69 void DlgSetting::on_btnCancel_clicked()
       
    70     {
       
    71     this->reject();
       
    72     }