~ubuntu-branches/debian/sid/smplayer/sid

« back to all changes in this revision

Viewing changes to src/selectcolorbutton.cpp

  • Committer: Package Import Robot
  • Author(s): Maia Kozheva
  • Date: 2012-04-14 12:01:57 UTC
  • mto: (21.1.1 experimental) (1.3.1)
  • mto: This revision was merged to the branch mainline in revision 21.
  • Revision ID: package-import@ubuntu.com-20120414120157-wb5m0kcc8uoth8p7
Tags: upstream-0.8.0
ImportĀ upstreamĀ versionĀ 0.8.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
#include "selectcolorbutton.h"
20
20
#include "colorutils.h"
21
21
#include <QColorDialog>
22
 
 
23
 
#ifdef Q_OS_WIN
24
22
#include <QApplication>
25
23
#include <QStyle>
26
 
#endif
27
24
 
28
25
SelectColorButton::SelectColorButton( QWidget * parent ) 
29
26
        : QPushButton(parent)
30
27
{
31
28
        connect(this, SIGNAL(clicked()), this, SLOT(selectColor()));
32
 
        
33
 
#ifdef Q_OS_WIN
 
29
 
34
30
        ignore_change_event = false;
35
 
#endif
36
31
}
37
32
 
38
33
SelectColorButton::~SelectColorButton() {
41
36
void SelectColorButton::setColor(QColor c) {
42
37
        _color = c;
43
38
 
44
 
#ifdef Q_OS_WIN
45
39
        QString current_style = qApp->style()->objectName();
46
40
        qDebug("SelectColorButton::setColor: current style name: %s", current_style.toUtf8().constData());
47
41
 
48
42
        ignore_change_event = true;
49
 
        
50
 
        if ((current_style.startsWith("windowsxp")) || (current_style.startsWith("windowsvista"))) {
51
 
                setStyleSheet( "border-width: 1px; border-style: solid; border-color: #000000; background: #" + ColorUtils::colorToRRGGBB(_color.rgb()) + ";");
52
 
        } else {
53
 
                setStyleSheet("");
54
 
                ColorUtils::setBackgroundColor( this, _color );
55
 
        }
56
 
                
 
43
 
 
44
        setStyleSheet(
 
45
                QString("QPushButton { background-color: #%1; border-style: outset; "
 
46
                "border-width: 2px; border-radius: 5px; "
 
47
                "border-color: grey; padding: 3px; min-width: 4ex; min-height: 1.2ex; } "
 
48
                "QPushButton:pressed { border-style: inset; }"
 
49
                ).arg(ColorUtils::colorToRRGGBB(_color.rgb())) );
 
50
 
57
51
        ignore_change_event = false;
58
 
#else
59
 
        //setAutoFillBackground(true);
60
 
        ColorUtils::setBackgroundColor( this, _color );
61
 
#endif
62
52
}
63
53
 
64
54
void SelectColorButton::selectColor() {
68
58
        }
69
59
}
70
60
 
71
 
#ifdef Q_OS_WIN
72
61
void SelectColorButton::changeEvent(QEvent *e) {
73
62
 
74
63
        QPushButton::changeEvent(e);
78
67
        }
79
68
 
80
69
}
81
 
#endif
82
70
 
83
71
#include "moc_selectcolorbutton.cpp"