From 15318cad33835e4e2dc620d033e43cd930676cdd Mon Sep 17 00:00:00 2001 From: kergoth Date: Fri, 25 Jan 2002 22:14:26 +0000 Subject: Initial revision --- (limited to 'core/launcher/info.cpp') diff --git a/core/launcher/info.cpp b/core/launcher/info.cpp new file mode 100644 index 0000000..609e9e2 --- a/dev/null +++ b/core/launcher/info.cpp @@ -0,0 +1,116 @@ +/********************************************************************** +** Copyright (C) 2000 Trolltech AS. All rights reserved. +** +** This file is part of Qtopia Environment. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#include "info.h" +#include "desktop.h" + +#include +#include + +#include +#include +#include +#include + + +Info *desktopInfo = NULL; + + +Info::Info( Desktop *d ) : Background( d ), needsClear(FALSE), menuHasBeenClicked(FALSE) +{ + QString motd; + /* eg. + = + "" + "" + "

Today    June 15, 2001

Appointments" + "
" + "8:30am Meeting with John
" + "1:10pm Lunch with Sharon" + "
Reminders" + "
" + "#1 Port XMAME to QPE
" + "#2 Flowers for wife" + "
Net channels" + "
" + "LinuxDevices: QPE announcement
" + "Slashdot: GPL Examined" + "
"; + */ + info = new QSimpleRichText(motd, QFont("lucidux_sans",10)); + desktopInfo = this; +} + + +void Info::mouseReleaseEvent( QMouseEvent * ) +{ +} + + +void Info::menuClicked( ) +{ + QPainter p(this); + if ( needsClear ) { + QColor col = colorGroup().color( QColorGroup::Button ).dark( 0 ); + p.fillRect( 5, height() - 24, width() - 5, 20, col ); + needsClear = FALSE; + menuHasBeenClicked = TRUE; + } +} + + +void Info::paintEvent( QPaintEvent *e ) +{ + QPainter p(this); + + BrushStyle styles[] = { Dense1Pattern, Dense2Pattern, Dense3Pattern, + Dense4Pattern, Dense5Pattern, Dense6Pattern }; + + QColor shade = colorGroup().color( QColorGroup::Button ).dark( 110 ); + int blend = width() * 3 / 4; + int step = blend/6; + p.fillRect( 0, 0, width()-blend, 30, shade ); + for ( int i = 0; i < 6; i++ ) { + QBrush brush( shade, styles[i] ); + p.fillRect( width()-blend+i*step, 0, step, 30, brush ); + } + p.setFont( QFont("Helvetica", 24, QFont::Bold) ); + p.setPen( shade.dark( 140 ) ); + p.drawText( 5, 24, "QPE" ); + int pos = 5 + p.fontMetrics().width( "QPE" ); + QFont f("Helvetica", 10, QFont::Bold); + p.setFont( f ); + p.drawText( pos + 5, 24, QString( "Version " ) + QPE_VERSION ); + + if (!menuHasBeenClicked) { + p.drawText( 5, height()-10, QString( "Click on the " ) ); + int pos = 5 + p.fontMetrics().width( "Click on the " ); + p.drawPixmap( pos, height()-10-14, Resource::loadPixmap( "go" ) ); + p.drawText( pos + 16, height()-10, QString( " logo to start." ) ); + needsClear = TRUE; + } + + if ( info ) { + info->setWidth(&p,width()-10); + info->draw(&p, 5, 35, e->region(), colorGroup()); + } +} + + -- cgit v0.9.0.2