Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

ntptabwidget.cpp

Go to the documentation of this file.
00001 /*
00002                              This file is part of the Opie Project
00003 
00004                              Copyright (C) Opie Team <opie-devel@handhelds.org>
00005               =.
00006             .=l.
00007            .>+-=
00008  _;:,     .>    :=|.         This program is free software; you can
00009 .> <`_,   >  .   <=          redistribute it and/or  modify it under
00010 :`=1 )Y*s>-.--   :           the terms of the GNU Library General Public
00011 .="- .-=="i,     .._         License as published by the Free Software
00012  - .   .-<_>     .<>         Foundation; either version 2 of the License,
00013      ._= =}       :          or (at your option) any later version.
00014     .%`+i>       _;_.
00015     .i_,=:_.      -<s.       This program is distributed in the hope that
00016      +  .  -:.       =       it will be useful,  but WITHOUT ANY WARRANTY;
00017     : ..    .:,     . . .    without even the implied warranty of
00018     =_        +     =;=|`    MERCHANTABILITY or FITNESS FOR A
00019   _.=:.       :    :=>`:     PARTICULAR PURPOSE. See the GNU
00020 ..}^=.=       =       ;      Library General Public License for more
00021 ++=   -.     .`     .:       details.
00022 :     =  ...= . :.=-
00023  -.   .:....=;==+<;          You should have received a copy of the GNU
00024   -_. . .   )=.  =           Library General Public License along with
00025     --        :-=`           this library; see the file COPYING.LIB.
00026                              If not, write to the Free Software Foundation,
00027                              Inc., 59 Temple Place - Suite 330,
00028                              Boston, MA 02111-1307, USA.
00029 */
00030 
00031 #include "ntptabwidget.h"
00032 
00033 #include <opie2/oresource.h>
00034 
00035 #include <qpe/applnk.h>
00036 
00037 #include <qlabel.h>
00038 #include <qlayout.h>
00039 #include <qmultilineedit.h>
00040 #include <qpushbutton.h>
00041 #include <qscrollview.h>
00042 
00043 NTPTabWidget::NTPTabWidget( QWidget *parent )
00044         : QWidget( parent, 0x0, 0 )
00045 {
00046         QVBoxLayout *tmpvb = new QVBoxLayout( this );
00047         QScrollView *sv = new QScrollView( this );
00048         tmpvb->addWidget( sv, 0, 0 );
00049         sv->setResizePolicy( QScrollView::AutoOneFit );
00050         sv->setFrameStyle( QFrame::NoFrame );
00051         QWidget *container = new QWidget( sv->viewport() );
00052         sv->addChild( container );
00053 
00054         QGridLayout *layout = new QGridLayout( container );
00055         layout->setMargin( 2 );
00056         layout->setSpacing( 4 );
00057 
00058         // Start time
00059         layout->addWidget( new QLabel( tr( "Start time" ), container ), 0, 0 );
00060         lblStartTime = new QLabel( tr( "n/a" ), container );
00061         layout->addWidget( lblStartTime, 0, 1 );
00062 
00063         // Time shift
00064         layout->addWidget( new QLabel( tr( "Time shift" ), container ), 1, 0 );
00065         lblTimeShift = new QLabel( tr( "n/a" ), container );
00066         layout->addWidget( lblTimeShift, 1, 1 );
00067 
00068         // New time
00069         layout->addWidget( new QLabel( tr( "New time" ), container ), 2, 0 );
00070         lblNewTime = new QLabel( tr( "n/a" ), container );
00071         layout->addWidget( lblNewTime, 2, 1 );
00072 
00073         // NTP output display
00074         mleNtpOutput = new QMultiLineEdit( container );
00075         QFont font(  mleNtpOutput->font() );
00076         font.setPointSize( font.pointSize() - 2 );
00077         mleNtpOutput->setFont( font );
00078         mleNtpOutput->setWordWrap( QMultiLineEdit::WidgetWidth );
00079         layout->addMultiCellWidget( mleNtpOutput, 3, 3, 0, 1 );
00080 
00081         // Set NTP time button
00082     m_ntpBtn = new QPushButton( Opie::Core::OResource::loadPixmap( "netsystemtime/ntptab", Opie::Core::OResource::SmallIcon ),
00083                                 tr( "Get time from the network" ), container );
00084     m_ntpBtn->setMinimumHeight( AppLnk::smallIconSize()+4 );
00085         connect( m_ntpBtn, SIGNAL(clicked()), this, SIGNAL(getNTPTime()) );
00086         layout->addMultiCellWidget( m_ntpBtn, 4, 4, 0, 1 );
00087 }
00088 
00089 NTPTabWidget::~NTPTabWidget()
00090 {
00091 }
00092 
00093 void NTPTabWidget::setStartTime( const QString &str )
00094 {
00095         lblStartTime->setText( str );
00096 }
00097 
00098 void NTPTabWidget::setTimeShift( const QString &str )
00099 {
00100         lblTimeShift->setText( str );
00101 }
00102 
00103 void NTPTabWidget::setNewTime( const QString &str )
00104 {
00105         lblNewTime->setText( str );
00106 }
00107 
00108 void NTPTabWidget::addNtpOutput( const QString &str )
00109 {
00110         mleNtpOutput->append( str );
00111         mleNtpOutput->setCursorPosition( mleNtpOutput->numLines() + 1, 0, FALSE );
00112 }
00113 
00114 void NTPTabWidget::setNTPBtnEnabled( bool enabled )
00115 {
00116     m_ntpBtn->setEnabled( enabled );
00117 }

Generated on Sat Nov 5 16:17:48 2005 for OPIE by  doxygen 1.4.2