summaryrefslogtreecommitdiff
path: root/core/launcher/info.cpp
Unidiff
Diffstat (limited to 'core/launcher/info.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/launcher/info.cpp116
1 files changed, 116 insertions, 0 deletions
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 @@
1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3**
4** This file is part of Qtopia Environment.
5**
6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file.
10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15**
16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you.
18**
19**********************************************************************/
20
21#include "info.h"
22#include "desktop.h"
23
24#include <qpe/resource.h>
25#include <qpe/version.h>
26
27#include <qlayout.h>
28#include <qimage.h>
29#include <qpainter.h>
30#include <qsimplerichtext.h>
31
32
33Info *desktopInfo = NULL;
34
35
36Info::Info( Desktop *d ) : Background( d ), needsClear(FALSE), menuHasBeenClicked(FALSE)
37{
38 QString motd;
39 /* eg.
40 =
41 "<table width=100% cellspacing=0 cellpadding=2>"
42 "<tr><td bgcolor=#9090ff><h2>Today&nbsp;&nbsp;&nbsp;&nbsp;<small>June 15, 2001</small></h2></td>"
43 "<tr><td bgcolor=#c0c0ff><big><a href=datebook>Appointments</a></big>"
44 "<tr><td bgcolor=#e0e0ff>"
45 "<b>8:30am</b> Meeting with John<br>"
46 "<b>1:10pm</b> Lunch with Sharon"
47 "<tr><td bgcolor=#c0c0ff><big><a href=todo>Reminders</a></big>"
48 "<tr><td bgcolor=#e0e0ff>"
49 "<b>#1</b> Port XMAME to QPE<br>"
50 "<b>#2</b> Flowers for wife"
51 "<tr><td bgcolor=#c0c0ff><big><a href=channels>Net channels</a></big>"
52 "<tr><td bgcolor=#e0e0ff>"
53 "<b>LinuxDevices:</b><a href=http://www.linuxdevices.com> QPE announcement</a><br>"
54 "<b>Slashdot:</b><a href=http://www.slashdot.org> GPL Examined</a>"
55 "</table>";
56 */
57 info = new QSimpleRichText(motd, QFont("lucidux_sans",10));
58 desktopInfo = this;
59}
60
61
62void Info::mouseReleaseEvent( QMouseEvent * )
63{
64}
65
66
67void Info::menuClicked( )
68{
69 QPainter p(this);
70 if ( needsClear ) {
71 QColor col = colorGroup().color( QColorGroup::Button ).dark( 0 );
72 p.fillRect( 5, height() - 24, width() - 5, 20, col );
73 needsClear = FALSE;
74 menuHasBeenClicked = TRUE;
75 }
76}
77
78
79void Info::paintEvent( QPaintEvent *e )
80{
81 QPainter p(this);
82
83 BrushStyle styles[] = { Dense1Pattern, Dense2Pattern, Dense3Pattern,
84 Dense4Pattern, Dense5Pattern, Dense6Pattern };
85
86 QColor shade = colorGroup().color( QColorGroup::Button ).dark( 110 );
87 int blend = width() * 3 / 4;
88 int step = blend/6;
89 p.fillRect( 0, 0, width()-blend, 30, shade );
90 for ( int i = 0; i < 6; i++ ) {
91 QBrush brush( shade, styles[i] );
92 p.fillRect( width()-blend+i*step, 0, step, 30, brush );
93 }
94 p.setFont( QFont("Helvetica", 24, QFont::Bold) );
95 p.setPen( shade.dark( 140 ) );
96 p.drawText( 5, 24, "QPE" );
97 int pos = 5 + p.fontMetrics().width( "QPE" );
98 QFont f("Helvetica", 10, QFont::Bold);
99 p.setFont( f );
100 p.drawText( pos + 5, 24, QString( "Version " ) + QPE_VERSION );
101
102 if (!menuHasBeenClicked) {
103 p.drawText( 5, height()-10, QString( "Click on the " ) );
104 int pos = 5 + p.fontMetrics().width( "Click on the " );
105 p.drawPixmap( pos, height()-10-14, Resource::loadPixmap( "go" ) );
106 p.drawText( pos + 16, height()-10, QString( " logo to start." ) );
107 needsClear = TRUE;
108 }
109
110 if ( info ) {
111 info->setWidth(&p,width()-10);
112 info->draw(&p, 5, 35, e->region(), colorGroup());
113 }
114}
115
116