~ubuntu-branches/ubuntu/utopic/kdebase-workspace/utopic

« back to all changes in this revision

Viewing changes to systemsettings/icons/CategoryDrawer.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Jonathan Thomas, Jonathan Thomas, Tarun Kumar Mall, Philip Muškovac, Stéphane Graber, James Hunt
  • Date: 2011-06-01 02:09:54 UTC
  • mfrom: (0.1.21 sid)
  • Revision ID: james.westby@ubuntu.com-20110601020954-id2t0x9rwxwrmjn2
Tags: 4:4.6.3-1ubuntu1
[ Jonathan Thomas ]
* Merge with Debian Unstable, remaining changes:
  - Add kdebase-workspace-wallpapers.{links, install}
  - Add kdebase-workspace-data.links
  - kdebase-workspace-data.install: don't add wallpapers that are in
    kdebase-workspace-wallpapers.install
  - Add kdm.{links, upstart}
  - kdm.logrotate: rotate 2 -> rotate 7
  - Make kdm work with upstart in kdm.prerm, kdm.postrm, kdm.postinst
  - debian/control:
    - don't build against libggadget-1.0-dev, libggadget-qt-1.0-dev
      (they are in Universe)
    - Build against libbost1.46-dev instead of libboost-dev
    - Add libxml2-dev, libpolkit-qt-1-dev to build-deps
    - Add python-kde4, python-sip, python-qt4 to build-dependencies
    - Keep bumped our replaces/breaks
    - plasma-netbook replaces plasma-widgets-workspace (<= 4:4.5.2-1ubuntu1)
    - kdebase-workspace-bin suggests plasma-scriptengines instead of
      recommend
    - kdebase-workspace-data depends on oxygen-cursor-theme instead of oxygencursors
    - Keep kdebase-workspace-wallpapers
    - plasma-dataengines-workspace replaces plasma-widget-workspace (<= 4:4.5.2-1ubuntu1)
    - plasma-widgets-workspace depends on akonadi-server and kdepim-runtime
    - plasma-scriptengines not depends on plasma-scriptengine-googlegadgets
    - plasma-scriptengine-ruby depends on libkde4-ruby
    - Don't build plasma-scriptengine-googlegadgets
    - freespacenotifier replaces kdebase-workspace-data (<= 4:4.5.2-1ubuntu1)
      and kdebase-workspace-bin (<= 4:4.5.2-1ubuntu1)
    - kinfocenter replaces kdebase-workspace-bin and systemsettings
    - libplasmagenericshell4 replaces plasma-widgets-workspace (<= 4:4.5.2-1ubuntu1)
  - debian/patches:
    - Use 07_kdmrc_defaults_kubuntu.diff instead of 07_kdmrc_defaults.diff
    - Don't add be_better_at_honouring_user_kdm_theming
    - Don't add use_dejavu_as_default_font
    - Don't add fix_target_link_libraries
    - Keep our patches
* Try a polkit-kde-1 | policykit-gnome-1 or-dependency again to see if policykit-1-gnome
  is a suitable policykit solution a year later.

[ Tarun Kumar Mall ]
* New uptream release
* Bumped kde-sc-dev-latest version to 4.6.3
* Removed patches kubuntu_120_ksysguard_sensors.diff and
  kubuntu_121_kdm_halt_cmd.diff, applied upstream
* Refreshed kubuntu_122_akonadi_calendar_dataengine.diff 

[ Philip Muškovac ]
* drop kubuntu_123_effectframe_glflush.diff, applied upstream
* Refresh symbol files 

[ Stéphane Graber ]
* Updated Vcs fields to point to kubuntu-uploaders instead of
  kubuntu-members

[ James Hunt ]
* Updated kdm.conf to fix kdm in single user mode (LP: #436936)

Show diffs side-by-side

added added

removed removed

Lines of Context:
47
47
    font.setBold(true);
48
48
    const QFontMetrics fontMetrics = QFontMetrics(font);
49
49
    const int height = categoryHeight(index, option);
 
50
    const bool leftToRight = painter->layoutDirection() == Qt::LeftToRight;
50
51
 
51
52
    //BEGIN: decoration gradient
52
53
    {
53
54
        QPainterPath path(optRect.bottomLeft());
 
55
 
54
56
        path.lineTo(QPoint(optRect.topLeft().x(), optRect.topLeft().y() - 3));
55
57
        const QPointF topLeft(optRect.topLeft());
56
58
        QRectF arc(topLeft, QSizeF(4, 4));
64
66
 
65
67
        window.setAlphaF(0.4);
66
68
 
67
 
        QLinearGradient decoGradient1(optRect.topLeft(), optRect.bottomLeft());
 
69
        QLinearGradient decoGradient1;
 
70
        if (leftToRight) {
 
71
            decoGradient1.setStart(optRect.topLeft());
 
72
            decoGradient1.setFinalStop(optRect.bottomLeft());
 
73
        } else {
 
74
            decoGradient1.setStart(optRect.topRight());
 
75
            decoGradient1.setFinalStop(optRect.bottomRight());
 
76
        }
68
77
        decoGradient1.setColorAt(0, window);
69
78
        decoGradient1.setColorAt(1, Qt::transparent);
70
79
 
71
 
        QLinearGradient decoGradient2(optRect.topLeft(), optRect.topRight());
 
80
        QLinearGradient decoGradient2;
 
81
        if (leftToRight) {
 
82
            decoGradient2.setStart(optRect.topLeft());
 
83
            decoGradient2.setFinalStop(optRect.topRight());
 
84
        } else {
 
85
            decoGradient2.setStart(optRect.topRight());
 
86
            decoGradient2.setFinalStop(optRect.topLeft());
 
87
        }
72
88
        decoGradient2.setColorAt(0, Qt::transparent);
73
89
        decoGradient2.setColorAt(1, base);
74
90
 
79
95
 
80
96
    {
81
97
        QRect newOptRect(optRect);
82
 
        newOptRect.setLeft(newOptRect.left() + 1);
83
 
        newOptRect.setTop(newOptRect.top() + 1);
 
98
 
 
99
        if (leftToRight) {
 
100
            newOptRect.translate(1, 1);
 
101
        } else {
 
102
            newOptRect.translate(-1, 1);
 
103
        }
84
104
 
85
105
        //BEGIN: inner top left corner
86
106
        {
87
107
            painter->save();
88
108
            painter->setPen(option.palette.base().color());
89
 
            const QPointF topLeft(newOptRect.topLeft());
90
 
            QRectF arc(topLeft, QSizeF(4, 4));
91
 
            arc.translate(0.5, 0.5);
92
 
            painter->drawArc(arc, 1440, 1440);
 
109
            QRectF arc;
 
110
            if (leftToRight) {
 
111
                const QPointF topLeft(newOptRect.topLeft());
 
112
                arc = QRectF(topLeft, QSizeF(4, 4));
 
113
                arc.translate(0.5, 0.5);
 
114
                painter->drawArc(arc, 1440, 1440);
 
115
            } else {
 
116
                QPointF topRight(newOptRect.topRight());
 
117
                topRight.rx() -= 4;
 
118
                arc = QRectF(topRight, QSizeF(4, 4));
 
119
                arc.translate(-0.5, 0.5);
 
120
                painter->drawArc(arc, 0, 1440);
 
121
            }
93
122
            painter->restore();
94
123
        }
95
124
        //END: inner top left corner
96
125
 
97
126
        //BEGIN: inner left vertical line
98
127
        {
99
 
            QPoint start(newOptRect.topLeft());
 
128
            QPoint start;
 
129
            QPoint verticalGradBottom;
 
130
            if (leftToRight) {
 
131
                start = newOptRect.topLeft();
 
132
                verticalGradBottom = newOptRect.topLeft();
 
133
            } else {
 
134
                start = newOptRect.topRight();
 
135
                verticalGradBottom = newOptRect.topRight();
 
136
            }
100
137
            start.ry() += 3;
101
 
            QPoint verticalGradBottom(newOptRect.topLeft());
102
138
            verticalGradBottom.ry() += newOptRect.height() - 3;
103
139
            QLinearGradient gradient(start, verticalGradBottom);
104
140
            gradient.setColorAt(0, option.palette.base().color());
109
145
 
110
146
        //BEGIN: inner horizontal line
111
147
        {
112
 
            QPoint start(newOptRect.topLeft());
113
 
            start.rx() += 3;
114
 
            QPoint horizontalGradTop(newOptRect.topLeft());
115
 
            horizontalGradTop.rx() += newOptRect.width() - 3;
 
148
            QPoint start;
 
149
            QPoint horizontalGradTop;
 
150
            if (leftToRight) {
 
151
                start = newOptRect.topLeft();
 
152
                horizontalGradTop = newOptRect.topLeft();
 
153
                start.rx() += 3;
 
154
                horizontalGradTop.rx() += newOptRect.width() - 3;
 
155
            } else {
 
156
                start = newOptRect.topRight();
 
157
                horizontalGradTop = newOptRect.topRight();
 
158
                start.rx() -= 3;
 
159
                horizontalGradTop.rx() -= newOptRect.width() - 3;
 
160
            }
116
161
            QLinearGradient gradient(start, horizontalGradTop);
117
162
            gradient.setColorAt(0, option.palette.base().color());
118
163
            gradient.setColorAt(1, Qt::transparent);
119
 
            painter->fillRect(QRect(start, QSize(newOptRect.width() - 3, 1)), gradient);
 
164
            QSize rectSize;
 
165
            if (leftToRight) {
 
166
                rectSize = QSize(newOptRect.width() - 3, 1);
 
167
            } else {
 
168
                rectSize = QSize(-newOptRect.width() + 3, 1);
 
169
            }
 
170
            painter->fillRect(QRect(start, rectSize), gradient);
120
171
        }
121
172
        //END: inner horizontal line
122
173
    }
128
179
    {
129
180
        painter->save();
130
181
        painter->setPen(outlineColor);
131
 
        const QPointF topLeft(optRect.topLeft());
132
 
        QRectF arc(topLeft, QSizeF(4, 4));
133
 
        arc.translate(0.5, 0.5);
134
 
        painter->drawArc(arc, 1440, 1440);
 
182
        QRectF arc;
 
183
        if (leftToRight) {
 
184
            const QPointF topLeft(optRect.topLeft());
 
185
            arc = QRectF(topLeft, QSizeF(4, 4));
 
186
            arc.translate(0.5, 0.5);
 
187
            painter->drawArc(arc, 1440, 1440);
 
188
        } else {
 
189
            QPointF topRight(optRect.topRight());
 
190
            topRight.rx() -= 4;
 
191
            arc = QRectF(topRight, QSizeF(4, 4));
 
192
            arc.translate(-0.5, 0.5);
 
193
            painter->drawArc(arc, 0, 1440);
 
194
        }
135
195
        painter->restore();
136
196
    }
137
197
    //END: top left corner
138
198
 
139
199
    //BEGIN: left vertical line
140
200
    {
141
 
        QPoint start(optRect.topLeft());
 
201
        QPoint start;
 
202
        QPoint verticalGradBottom;
 
203
        if (leftToRight) {
 
204
            start = optRect.topLeft();
 
205
            verticalGradBottom = optRect.topLeft();
 
206
        } else {
 
207
            start = optRect.topRight();
 
208
            verticalGradBottom = optRect.topRight();
 
209
        }
142
210
        start.ry() += 3;
143
 
        QPoint verticalGradBottom(optRect.topLeft());
144
211
        verticalGradBottom.ry() += optRect.height() - 3;
145
212
        QLinearGradient gradient(start, verticalGradBottom);
146
213
        gradient.setColorAt(0, outlineColor);
151
218
 
152
219
    //BEGIN: horizontal line
153
220
    {
154
 
        QPoint start(optRect.topLeft());
155
 
        start.rx() += 3;
156
 
        QPoint horizontalGradTop(optRect.topLeft());
157
 
        horizontalGradTop.rx() += optRect.width() - 3;
 
221
        QPoint start;
 
222
        QPoint horizontalGradTop;
 
223
        if (leftToRight) {
 
224
            start = optRect.topLeft();
 
225
            horizontalGradTop = optRect.topLeft();
 
226
            start.rx() += 3;
 
227
            horizontalGradTop.rx() += optRect.width() - 3;
 
228
        } else {
 
229
            start = optRect.topRight();
 
230
            horizontalGradTop = optRect.topRight();
 
231
            start.rx() -= 3;
 
232
            horizontalGradTop.rx() -= optRect.width() - 3;
 
233
        }
158
234
        QLinearGradient gradient(start, horizontalGradTop);
159
235
        gradient.setColorAt(0, outlineColor);
160
236
        gradient.setColorAt(1, option.palette.base().color());
161
 
        painter->fillRect(QRect(start, QSize(optRect.width() - 3, 1)), gradient);
 
237
        QSize rectSize;
 
238
        if (leftToRight) {
 
239
            rectSize = QSize(optRect.width() - 3, 1);
 
240
        } else {
 
241
            rectSize = QSize(-optRect.width() + 3, 1);
 
242
        }
 
243
        painter->fillRect(QRect(start, rectSize), gradient);
162
244
    }
163
245
    //END: horizontal line
164
246
 
165
247
    //BEGIN: draw text
166
248
    {
167
249
        const QString category = index.model()->data(index, KCategorizedSortFilterProxyModel::CategoryDisplayRole).toString();
168
 
        QRect textRect = QRect(option.rect.topLeft(), QSize(option.rect.width(), height));
 
250
        QRect textRect = QRect(option.rect.topLeft(), QSize(option.rect.width() - 2 - 3 - 3, height));
169
251
        textRect.setTop(textRect.top() + 2 + 3 /* corner */);
170
252
        textRect.setLeft(textRect.left() + 2 + 3 /* corner */ + 3 /* a bit of margin */);
171
253
        painter->save();