~ubuntu-branches/ubuntu/jaunty/digikam/jaunty

« back to all changes in this revision

Viewing changes to libs/widgets/common/dlogoaction.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Luka Renko
  • Date: 2009-01-21 21:55:15 UTC
  • mfrom: (1.2.18 upstream)
  • Revision ID: james.westby@ubuntu.com-20090121215515-lry0s2pdep289o3u
Tags: 2:0.10.0~rc1-0ubuntu1
* New upstream release (release candididate 1)
* rules:
  - Simplify by including standard class/kde4.mk
* control:
  - Build-Depends on quilt (default patch system of kde4.mk)
  - Bump Standards-Version to 3.8.0
  - Bump debhelper dependancy to 7
  - Add ${misc:Depends} to make lintian happy
* {digikam|showfoto}.install:
  - Update icon paths
  - Do not package oxygen and apps icons: provided by kde-icons-oxygen
* patches/01-kubuntu-fix-armel.patch:
  - Fix cut&paste bug in the patch

Show diffs side-by-side

added added

removed removed

Lines of Context:
6
6
 * Date        : 2007-27-08
7
7
 * Description : a tool bar action object to display animated logo
8
8
 *
9
 
 * Copyright (C) 2007-2008 by Gilles Caulier <caulier dot gilles at gmail dot com>
 
9
 * Copyright (C) 2007-2009 by Gilles Caulier <caulier dot gilles at gmail dot com>
10
10
 *
11
11
 * This program is free software; you can redistribute it
12
12
 * and/or modify it under the terms of the GNU General
44
44
#include <kapplication.h>
45
45
#include <ktoolinvocation.h>
46
46
#include <kstandarddirs.h>
 
47
#include <kglobalsettings.h>
47
48
#include <klocale.h>
48
49
 
49
50
// Local includes.
63
64
        timer        = 0;
64
65
        urlLabel     = 0;
65
66
        angle        = 0;
 
67
 
 
68
        // NOTE: rotation of logo is adapted to an exported PNG file generated from
 
69
        // digikam/data/pics/banner-digikam.svgz and digikam/data/pics/banner-showfoto.svgz
 
70
        // using height of 33 pixels.
 
71
        logoCenter   = QPoint(125, 16);
 
72
        logoRect     = QRect(109, 0, 33, 33);
66
73
    }
67
74
 
68
75
    bool       alignOnright;
71
78
 
72
79
    QTimer    *timer;
73
80
 
 
81
    QPoint     logoCenter;
 
82
    QRect      logoRect;
 
83
 
74
84
    QPixmap    bannerPix;
75
85
    QPixmap    logoPix;
76
86
    QPixmap    animPix;
82
92
           : KAction(parent), d(new DLogoActionPriv)
83
93
{
84
94
    setText("digikam.org");
85
 
    setIcon(KIcon("digikam"));
 
95
    if (KGlobal::mainComponent().aboutData()->appName() == QString("digikam"))
 
96
    {
 
97
        setIcon(KIcon("digikam"));
 
98
        d->bannerPix = QPixmap(KStandardDirs::locate("data", "digikam/data/banner-digikam.png"));
 
99
    }
 
100
    else
 
101
    {
 
102
        setIcon(KIcon("showfoto"));
 
103
        d->bannerPix = QPixmap(KStandardDirs::locate("data", "showfoto/data/banner-showfoto.png"));
 
104
    }
86
105
 
87
 
    d->bannerPix    = QPixmap(KStandardDirs::locate("data", "digikam/data/banner-digikam.png"));
88
 
    d->logoPix      = d->bannerPix.copy(d->bannerPix.width()-33, 0, 33, 33);
 
106
    d->logoPix      = d->bannerPix.copy(d->logoRect);
89
107
    d->alignOnright = alignOnright;
90
 
    d->timer        = new QTimer();
 
108
    d->timer        = new QTimer(this);
91
109
 
92
110
    connect(d->timer, SIGNAL(timeout()),
93
111
            this, SLOT(slotTimeout()));
108
126
{
109
127
    d->angle = 0;
110
128
    d->timer->stop();
111
 
    d->urlLabel->setPixmap(d->bannerPix);
 
129
    if (d->urlLabel)
 
130
        d->urlLabel->setPixmap(d->bannerPix);
112
131
}
113
132
 
114
133
bool DLogoAction::running() const
123
142
 
124
143
    QPainter p(&d->animPix);
125
144
    p.setRenderHint(QPainter::SmoothPixmapTransform);
126
 
    p.setClipRect(d->bannerPix.width()-33, 0, 33, 33);
127
 
    p.translate(d->bannerPix.width()-16, 16);
 
145
    p.setClipRect(d->logoRect);
 
146
    p.translate(d->logoCenter);
128
147
    p.rotate(d->angle);
129
 
    p.drawPixmap(-16, -16, d->logoPix);
 
148
    p.drawPixmap(-d->logoCenter.y(), -d->logoCenter.y(), d->logoPix);
130
149
    p.end();
131
150
 
132
 
    d->urlLabel->setPixmap(d->animPix);
 
151
    if (d->urlLabel)
 
152
        d->urlLabel->setPixmap(d->animPix);
133
153
}
134
154
 
135
155
QWidget* DLogoAction::createWidget(QWidget * parent)