~ubuntu-branches/ubuntu/wily/tora/wily-proposed

« back to all changes in this revision

Viewing changes to src/tolegendchart.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Michael Meskes
  • Date: 2009-04-07 13:16:05 UTC
  • mfrom: (1.2.7 upstream) (3.1.3 sid)
  • Revision ID: james.westby@ubuntu.com-20090407131605-u422yigfv7jgg0l0
Tags: 2.0.0-3
* Cleaned up packaging a little bit.
* Added homepage information to control file.
* Bumped Standards-Version to 3.8.1.
* Released to unstable.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*****
2
 
*
3
 
* TOra - An Oracle Toolkit for DBA's and developers
4
 
* Copyright (C) 2003-2005 Quest Software, Inc
5
 
* Portions Copyright (C) 2005 Other Contributors
6
 
7
 
* This program is free software; you can redistribute it and/or
8
 
* modify it under the terms of the GNU General Public License
9
 
* as published by the Free Software Foundation;  only version 2 of
10
 
* the License is valid for this program.
11
 
12
 
* This program is distributed in the hope that it will be useful,
13
 
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
 
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
 
* GNU General Public License for more details.
16
 
17
 
* You should have received a copy of the GNU General Public License
18
 
* along with this program; if not, write to the Free Software
19
 
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
20
 
*
21
 
*      As a special exception, you have permission to link this program
22
 
*      with the Oracle Client libraries and distribute executables, as long
23
 
*      as you follow the requirements of the GNU GPL in regard to all of the
24
 
*      software in the executable aside from Oracle client libraries.
25
 
*
26
 
*      Specifically you are not permitted to link this program with the
27
 
*      Qt/UNIX, Qt/Windows or Qt Non Commercial products of TrollTech.
28
 
*      And you are not permitted to distribute binaries compiled against
29
 
*      these libraries without written consent from Quest Software, Inc.
30
 
*      Observe that this does not disallow linking to the Qt Free Edition.
31
 
*
32
 
*      You may link this product with any GPL'd Qt library such as Qt/Free
33
 
*
34
 
* All trademarks belong to their respective owners.
35
 
*
36
 
*****/
 
1
 
 
2
/* BEGIN_COMMON_COPYRIGHT_HEADER
 
3
 *
 
4
 * TOra - An Oracle Toolkit for DBA's and developers
 
5
 * 
 
6
 * Shared/mixed copyright is held throughout files in this product
 
7
 * 
 
8
 * Portions Copyright (C) 2000-2001 Underscore AB
 
9
 * Portions Copyright (C) 2003-2005 Quest Software, Inc.
 
10
 * Portions Copyright (C) 2004-2008 Numerous Other Contributors
 
11
 * 
 
12
 * This program is free software; you can redistribute it and/or
 
13
 * modify it under the terms of the GNU General Public License
 
14
 * as published by the Free Software Foundation;  only version 2 of
 
15
 * the License is valid for this program.
 
16
 * 
 
17
 * This program is distributed in the hope that it will be useful,
 
18
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
19
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
20
 * GNU General Public License for more details.
 
21
 * 
 
22
 * You should have received a copy of the GNU General Public License
 
23
 * along with this program; if not, write to the Free Software
 
24
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 
25
 * 
 
26
 *      As a special exception, you have permission to link this program
 
27
 *      with the Oracle Client libraries and distribute executables, as long
 
28
 *      as you follow the requirements of the GNU GPL in regard to all of the
 
29
 *      software in the executable aside from Oracle client libraries.
 
30
 * 
 
31
 *      Specifically you are not permitted to link this program with the
 
32
 *      Qt/UNIX, Qt/Windows or Qt Non Commercial products of TrollTech.
 
33
 *      And you are not permitted to distribute binaries compiled against
 
34
 *      these libraries. 
 
35
 * 
 
36
 *      You may link this product with any GPL'd Qt library.
 
37
 * 
 
38
 * All trademarks belong to their respective owners.
 
39
 *
 
40
 * END_COMMON_COPYRIGHT_HEADER */
37
41
 
38
42
#include "utils.h"
39
43
 
40
44
#include "tolegendchart.h"
41
45
 
42
46
#include <qpainter.h>
43
 
#include <qpaintdevicemetrics.h>
44
 
 
45
 
#include "tolegendchart.moc"
46
 
 
47
 
toLegendChart::toLegendChart(int columns, QWidget *parent, const char *name, WFlags f)
48
 
        : QWidget(parent, name, f)
 
47
//Added by qt3to4:
 
48
#include <QPaintEvent>
 
49
 
 
50
 
 
51
toLegendChart::toLegendChart(int columns, QWidget *parent, const char *name, Qt::WFlags f)
 
52
        : QWidget(parent, f)
49
53
{
 
54
    setObjectName(name);
50
55
    Columns = columns < 1 ? 1 : columns;
51
56
    setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Preferred));
52
57
}
65
70
    update();
66
71
}
67
72
 
68
 
#define FONT_ALIGN AlignLeft|AlignTop|ExpandTabs
 
73
#define FONT_ALIGN Qt::AlignLeft|Qt::AlignTop|Qt::TextExpandTabs
69
74
 
70
75
std::list<int> toLegendChart::sizeHint(int &height, int &items)
71
76
{
165
170
                                       toLegendChart::height(), FONT_ALIGN, Title);
166
171
        p.drawText(0, 2,
167
172
                   toLegendChart::width() - 4,
168
 
                   toLegendChart::height(), AlignHCenter | AlignTop | ExpandTabs, Title);
 
173
                   toLegendChart::height(), Qt::AlignHCenter | Qt::AlignTop, Title);
169
174
        p.restore();
170
175
        p.translate(0, bounds.height() + 2);
171
176
    }
173
178
    int cx = 2;
174
179
    int cy = 4;
175
180
    p.save();
176
 
    p.setBrush(white);
 
181
    p.setBrush(Qt::white);
177
182
    p.drawRect(2, 2, width, height + 4);
178
183
    p.restore();
179
184
    int cur = 0;
196
201
            QBrush brush(toChartBrush(cp));
197
202
            p.setBrush(brush.color());
198
203
            p.drawRect(cx + 2, cy + bounds.height() / 2 - fm.ascent() / 2, 8, fm.ascent());
199
 
            if (brush.style() != QBrush::SolidPattern)
 
204
            if (brush.style() != Qt::SolidPattern)
200
205
            {
201
206
                p.setBrush(QBrush(Qt::white, brush.style()));
202
207
                p.drawRect(cx + 2, cy + bounds.height() / 2 - fm.ascent() / 2, 8, fm.ascent());