qtmobileextensions/examples/utilsex/utilsexwindow.cpp
branchRCL_3
changeset 9 5d007b20cfd0
equal deleted inserted replaced
8:885c2596c964 9:5d007b20cfd0
       
     1 /*
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 *
       
     5 * This program is free software: you can redistribute it and/or modify
       
     6 * it under the terms of the GNU Lesser General Public License as published by
       
     7 * the Free Software Foundation, version 2.1 of the License.
       
     8 * 
       
     9 * This program is distributed in the hope that it will be useful,
       
    10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
       
    11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
       
    12 * GNU Lesser General Public License for more details.
       
    13 *
       
    14 * You should have received a copy of the GNU Lesser General Public License
       
    15 * along with this program.  If not, 
       
    16 * see "http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html/".
       
    17 *
       
    18 * Description:
       
    19 *
       
    20 */
       
    21 
       
    22  #include <QInputDialog>
       
    23 #include "utilsexwindow.h"
       
    24 #include "xqutils.h"
       
    25 
       
    26 UtilsExWindow::UtilsExWindow(QWidget* parent)
       
    27     : QMainWindow(parent)
       
    28 {
       
    29     setupUi(this);
       
    30     
       
    31     m_utils = new XQUtils(this);
       
    32     m_timer = new QTimer(this);
       
    33     
       
    34     
       
    35     QString imagesPath = XQUtils::imagesPath();
       
    36     
       
    37     useResetInactivityTime();
       
    38     setuUiComponents();
       
    39 }
       
    40 
       
    41 UtilsExWindow::~UtilsExWindow()
       
    42 {
       
    43 }
       
    44 
       
    45 void UtilsExWindow::useResetInactivityTime()
       
    46 {
       
    47     m_timer->setInterval(1000);
       
    48     m_timer->start();
       
    49     connect(m_timer, SIGNAL(timeout()), m_utils, SLOT(resetInactivityTime()));
       
    50 }
       
    51 
       
    52 void UtilsExWindow::setuUiComponents()
       
    53 {
       
    54     startLitButton->hide();
       
    55     connect(stopLitButton, SIGNAL(clicked()), m_timer, SLOT(stop()));
       
    56     connect(stopLitButton, SIGNAL(clicked()), stopLitButton, SLOT(hide()));
       
    57     connect(startLitButton, SIGNAL(clicked()), m_timer, SLOT(start()));
       
    58     connect(startLitButton, SIGNAL(clicked()), startLitButton, SLOT(hide()));
       
    59     connect(startLitButton, SIGNAL(clicked()), stopLitButton, SLOT(show()));
       
    60     connect(startLitButton, SIGNAL(clicked()), stopLitButton, SLOT(setFocus()));
       
    61     connect(stopLitButton, SIGNAL(clicked()), startLitButton, SLOT(show()));
       
    62     connect(stopLitButton, SIGNAL(clicked()), startLitButton, SLOT(setFocus()));
       
    63     
       
    64     m_exitAction = new QAction(tr("Exit"), this);
       
    65     menuBar()->addAction(m_exitAction);
       
    66     connect(m_exitAction, SIGNAL(triggered()), this, SLOT(close()));
       
    67 }