~ubuntu-branches/debian/lenny/italc/lenny

« back to all changes in this revision

Viewing changes to ica/src/demo_client.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Patrick Winnertz
  • Date: 2008-06-17 13:46:54 UTC
  • mfrom: (1.2.1 upstream) (4.1.1 gutsy)
  • Revision ID: james.westby@ubuntu.com-20080617134654-cl0gi4u524cv1ici
Tags: 1:1.0.9~rc3-1
* Package new upstream version
  - upstream ported the code to qt4.4 (Closes: #481974)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * demo_client.cpp - client for demo-server
 
3
 *
 
4
 * Copyright (c) 2006-2008 Tobias Doerffel <tobydox/at/users/dot/sf/dot/net>
 
5
 *
 
6
 * This file is part of iTALC - http://italc.sourceforge.net
 
7
 *
 
8
 * This program is free software; you can redistribute it and/or
 
9
 * modify it under the terms of the GNU General Public
 
10
 * License as published by the Free Software Foundation; either
 
11
 * version 2 of the License, or (at your option) any later version.
 
12
 *
 
13
 * This program is distributed in the hope that it will be useful,
 
14
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
15
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
16
 * General Public License for more details.
 
17
 *
 
18
 * You should have received a copy of the GNU General Public
 
19
 * License along with this program (see COPYING); if not, write to the
 
20
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 
21
 * Boston, MA 02111-1307, USA.
 
22
 *
 
23
 */
 
24
 
 
25
 
 
26
#include <QtGui/QIcon>
 
27
#include <QtGui/QLayout>
 
28
#include <QtGui/QApplication>
 
29
#include <QtGui/QDesktopWidget>
 
30
 
 
31
#include "demo_client.h"
 
32
#include "vncview.h"
 
33
#include "lock_widget.h"
 
34
#include "local_system.h"
 
35
 
 
36
 
 
37
demoClient::demoClient( const QString & _host, bool _fullscreen ) :
 
38
        QObject(),
 
39
        m_toplevel( _fullscreen ?
 
40
                        new lockWidget( lockWidget::NoBackground )
 
41
                        :
 
42
                        new QWidget() )
 
43
{
 
44
        m_toplevel->setWindowTitle( tr( "iTALC Demo" ) );
 
45
        m_toplevel->setWindowIcon( QPixmap( ":/resources/display.png" ) );
 
46
        m_toplevel->setAttribute( Qt::WA_DeleteOnClose, TRUE );
 
47
        m_toplevel->resize( QApplication::desktop()->availableGeometry( m_toplevel ).size() );
 
48
 
 
49
        QVBoxLayout * toplevel_layout = new QVBoxLayout;
 
50
        toplevel_layout->setMargin( 0 );
 
51
        toplevel_layout->setSpacing( 0 );
 
52
        toplevel_layout->addWidget( new vncView( _host, m_toplevel, TRUE ) );
 
53
 
 
54
        m_toplevel->setLayout( toplevel_layout );
 
55
 
 
56
        connect( m_toplevel, SIGNAL( destroyed( QObject * ) ),
 
57
                        this, SLOT( viewDestroyed( QObject * ) ) );
 
58
        if( !_fullscreen )
 
59
        {
 
60
                m_toplevel->showMaximized();
 
61
                localSystem::activateWindow( m_toplevel );
 
62
 
 
63
        }
 
64
}
 
65
 
 
66
 
 
67
 
 
68
 
 
69
demoClient::~demoClient()
 
70
{
 
71
        delete m_toplevel;
 
72
}
 
73
 
 
74
 
 
75
 
 
76
 
 
77
void demoClient::viewDestroyed( QObject * _obj )
 
78
{
 
79
        if( m_toplevel == _obj )
 
80
        {
 
81
                m_toplevel = NULL;
 
82
        }
 
83
        deleteLater();
 
84
}
 
85
 
 
86
 
 
87
 
 
88
#include "demo_client.moc"