summaryrefslogtreecommitdiffstats
path: root/kmymoney2/kstartuplogo.cpp
blob: a0d8ac6fc088a5d1cb56e1a68229c54dc6fc88ca (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
/***************************************************************************
                          kstartuplogo.cpp
                             -------------------
    copyright            : (C) 2000 by Michael Edwardes
    email                : [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.                                   *
 *                                                                         *
 ***************************************************************************/

#include <kdecompat.h>

// ----------------------------------------------------------------------------
// QT Includes

#include <tqapplication.h>
#include <tqpixmap.h>
#include <tqframe.h>
#include <tqpainter.h>

// ----------------------------------------------------------------------------
// KDE Includes

#include <kglobal.h>
#include <klocale.h>
#include <kstandarddirs.h>
#include <kapplication.h>

// ----------------------------------------------------------------------------
// Project Includes

#include "kstartuplogo.h"
#include "kmymoneyglobalsettings.h"

class KStartupSplash::Private
{
  public:
    TQString message;
    TQColor color;
    int align;
};

KStartupSplash::KStartupSplash(const TQPixmap &pixmap, WFlags f) :
  KSplashScreen(pixmap, f),
  d(new Private)
{
}

KStartupSplash::~KStartupSplash()
{
  delete d;
}

void KStartupSplash::message( const TQString &message, int tqalignment, const TQColor &color)
{
  d->message = message;
  d->align = tqalignment;
  d->color = color;
  // the next line causes the base class signal management to happen
  // and also forces a tqrepaint
  KSplashScreen::clear();
}

void KStartupSplash::drawContents( TQPainter *painter )
{
  painter->setPen( d->color );
  TQRect r = rect();
  r.setRect( r.x() + 15, r.y() + r.height() - 28, r.width() - 20, 20 );
  painter->drawText( r, d->align, d->message);
}

KStartupLogo::KStartupLogo() :
  TQObject(0, 0),
  m_splash(0)
{
  // splash screen setting
  if(!KMyMoneyGlobalSettings::showSplash())
    return;

  TQString filename = KGlobal::dirs()->findResource("appdata", "pics/startlogo.png");
  TQPixmap splashPixmap(filename);

  if(!splashPixmap.isNull()) {
    TQPixmap backGround(splashPixmap);
    backGround.fill(KGlobalSettings::highlightColor());
    bitBlt ( &backGround, 0, 0, &splashPixmap, 0, 0, splashPixmap.width(), splashPixmap.height(), TQt::CopyROP );

    KStartupSplash* splash = new KStartupSplash(backGround);
    splash->setFixedSize(backGround.size());

    // FIXME: I added the 'Loading file...' message here, because this was the only
    // existing string we have and I did not want to change the strings. We should
    // change that in the future.
    splash->message(i18n("Loading..."), AlignLeft, white);

    splash->show();
    splash->tqrepaint();
    m_splash = splash;
  }
}

KStartupLogo::~KStartupLogo()
{
    delete m_splash;
}

#include "kstartuplogo.moc"