~ubuntu-branches/ubuntu/natty/digikam/natty

« back to all changes in this revision

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

  • Committer: Bazaar Package Importer
  • Author(s): Scott Kitterman
  • Date: 2010-12-21 23:19:11 UTC
  • mfrom: (1.2.33 upstream) (3.1.7 experimental)
  • Revision ID: james.westby@ubuntu.com-20101221231911-z9jip7s5aht1jqn9
Tags: 2:1.7.0-1ubuntu1
* Merge from Debian Experimental. Remaining Ubuntu changes:
  - Export .pot name and copy to plugins in debian/rules
  - Version build-depends on kipi-plugins-dev to ensure build is against the
    same version on all archs
* Drop debian/patches/kubuntu_01_linker.diff, incoporated upstream
* Remove patches directory and unused patches

Show diffs side-by-side

added added

removed removed

Lines of Context:
69
69
};
70
70
 
71
71
DPopupMenu::DPopupMenu(QWidget* parent)
72
 
          : KMenu(parent), d(new DPopupMenuPriv)
 
72
    : KMenu(parent), d(new DPopupMenuPriv)
73
73
{
74
74
    d->fontAppName = KGlobalSettings::generalFont();
75
75
    d->fontVersion = KGlobalSettings::generalFont();
90
90
    delete d;
91
91
}
92
92
 
93
 
void DPopupMenu::renderSidebarGradient(QPainter *p)
 
93
void DPopupMenu::renderSidebarGradient(QPainter* p)
94
94
{
95
95
    p->setRenderHint(QPainter::TextAntialiasing);
96
96
    p->setPen(Qt::white);
98
98
    int frameWidth = style()->pixelMetric(QStyle::PM_MenuPanelWidth, 0, this);
99
99
    QRect drawRect = QStyle::visualRect(layoutDirection(), rect(),
100
100
                                        QRect(frameWidth, frameWidth,
101
 
                                              d->gradientWidth, height() - 2*frameWidth));
 
101
                                                d->gradientWidth, height() - 2*frameWidth));
102
102
    p->setClipRect(drawRect);
103
103
 
104
104
    // ----------------------------------------
112
112
    linearGrad.setColorAt(1, QColor(98, 98, 98));
113
113
 
114
114
    // FIXME: this doesn't seem to work in 0.10.x versions, so I disable it for now
115
 
//    linearGrad.setColorAt(1, calcPixmapColor());
 
115
    //    linearGrad.setColorAt(1, calcPixmapColor());
116
116
 
117
117
    p->fillRect(drawRect, QBrush(linearGrad));
118
118
 
179
179
 
180
180
    if ( (qAbs(h1-h3)+qAbs(s1-s3)+qAbs(v1-v3) < qAbs(h2-h3)+qAbs(s2-s3)+qAbs(v2-v3)) &&
181
181
         ((qAbs(h1-h3)+qAbs(s1-s3)+qAbs(v1-v3) < 32) || (s1 < 32)) && (s2 > s1))
 
182
    {
182
183
        color = inactiveTitle;
 
184
    }
183
185
    else
 
186
    {
184
187
        color = activeTitle;
 
188
    }
185
189
 
186
190
    // limit max/min brightness
187
191
    int r, g, b;
188
192
    color.getRgb(&r, &g, &b);
189
193
    int gray = qGray(r, g, b);
 
194
 
190
195
    if (gray > 180)
191
196
    {
192
197
        r = (r - (gray - 180) < 0 ? 0 : r - (gray - 180));
199
204
        g = (g + (76 - gray) > 255 ? 255 : g + (76 - gray));
200
205
        b = (b + (76 - gray) > 255 ? 255 : b + (76 - gray));
201
206
    }
 
207
 
202
208
    color.setRgb(r, g, b);
203
209
 
204
210
    return color;