summaryrefslogtreecommitdiffstats
path: root/src/k3bsplash.cpp
blob: 5966eed05afe566864b97f359431e5c0a6a43f9a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
/* 
 *
 * $Id: k3bsplash.cpp 619556 2007-01-03 17:38:12Z trueg $
 * Copyright (C) 2003 Sebastian Trueg <[email protected]>
 *
 * This file is part of the K3b project.
 * Copyright (C) 1998-2007 Sebastian Trueg <[email protected]>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 * See the file "COPYING" for the exact licensing terms.
 */

#include "k3bsplash.h"

#include <k3bthememanager.h>
#include <k3bapplication.h>

#include <tqapplication.h>
#include <tqlabel.h>
#include <tqpixmap.h>
#include <tqevent.h>
#include <tqstring.h>
#include <tqfontmetrics.h>
#include <tqpainter.h>

#include <kstandarddirs.h>
#include <kapplication.h>
#include <kaboutdata.h>


K3bSplash::K3bSplash( TQWidget* parent, const char* name )
  : TQVBox( parent, name, 
	   WStyle_Customize|
	   WDestructiveClose|
	   /*	   WStyle_Splash|*/
	   WX11BypassWM|
	   WStyle_NoBorder|
	   WStyle_StaysOnTop )
{
  setMargin( 0 );
  setSpacing( 0 );

  TQLabel* copyrightLabel = new TQLabel( kapp->aboutData()->copyrightStatement(), this );
  copyrightLabel->setMargin( 5 );
  copyrightLabel->setPaletteBackgroundColor( black );
  copyrightLabel->setPaletteForegroundColor( white );
  copyrightLabel->tqsetAlignment( AlignRight );

  TQLabel* picLabel = new TQLabel( this );
  if( K3bTheme* theme = k3bappcore->themeManager()->currentTheme() ) {
    picLabel->setPaletteBackgroundColor( theme->backgroundColor() );
    picLabel->setPixmap( theme->pixmap( K3bTheme::SPLASH ) );
  }

  m_infoBox = new TQLabel( this );
  m_infoBox->setMargin( 5 );
  m_infoBox->setPaletteBackgroundColor( black );
  m_infoBox->setPaletteForegroundColor( white );

  // Set tqgeometry, with support for Xinerama systems
  TQRect r;
  r.setSize(tqsizeHint());
  int ps = TQApplication::desktop()->primaryScreen();
  r.moveCenter( TQApplication::desktop()->screenGeometry(ps).center() );
  setGeometry(r);
}


K3bSplash::~K3bSplash()
{
}


void K3bSplash::mousePressEvent( TQMouseEvent* )
{
  close();
}


void K3bSplash::show()
{
  TQVBox::show();
  // make sure the splash screen is shown immediately
  tqApp->processEvents();
}


void K3bSplash::addInfo( const TQString& s )
{
  m_infoBox->setText( s );

  tqApp->processEvents();
}


// void K3bSplash::paintEvent( TQPaintEvent* e )
// {
//   // first let the window paint the background and the child widget
//   TQWidget::paintEvent( e );

//   // now create the text we want to display
//   // find the lower left corner and paint it on top of the pixmap
//   TQPainter p( this );
//   p.setPen( TQt::blue );

//   TQFontMetrics fm = p.fontMetrics();

//   TQString line1 = TQString( "K3b version %1" ).tqarg(VERSION);
//   TQString line2( "(c) 2001 by Sebastian Trueg" );
//   TQString line3( "licenced under the GPL" );

//   TQRect rect1 = fm.boundingRect( line1 );
//   TQRect rect2 = fm.boundingRect( line2 );
//   TQRect rect3 = fm.boundingRect( line3 );

//   int textH = rect1.height() + rect2.height() + rect3.height() + 2 * fm.leading() + 2 + rect2.height() /*hack because the boundingRect method seems not to work properly! :-(*/;
//   int textW = TQMAX( rect1.width(), TQMAX( rect2.width(), rect3.width() ) ) + 2;

//   int startX = 10;
//   int startY = height() - 10 - textH;

//   p.drawText( startX, startY, textW, textH, 0, TQString("%1\n%2\n%3").tqarg(line1).tqarg(line2).tqarg(line3) );
// }


#include "k3bsplash.moc"