-rw-r--r-- | libopie/colorpopupmenu.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/libopie/colorpopupmenu.cpp b/libopie/colorpopupmenu.cpp index 0d66fba..03ad233 100644 --- a/libopie/colorpopupmenu.cpp +++ b/libopie/colorpopupmenu.cpp | |||
@@ -59,114 +59,114 @@ void OColorPanelButton::setActive( bool active ) | |||
59 | setFrameStyle( NoFrame ); | 59 | setFrameStyle( NoFrame ); |
60 | } | 60 | } |
61 | } | 61 | } |
62 | 62 | ||
63 | void OColorPanelButton::enterEvent( QEvent* ) | 63 | void OColorPanelButton::enterEvent( QEvent* ) |
64 | { | 64 | { |
65 | if ( !m_active ) { | 65 | if ( !m_active ) { |
66 | setFrameStyle( Panel | Sunken ); | 66 | setFrameStyle( Panel | Sunken ); |
67 | } | 67 | } |
68 | } | 68 | } |
69 | 69 | ||
70 | void OColorPanelButton::leaveEvent( QEvent* ) | 70 | void OColorPanelButton::leaveEvent( QEvent* ) |
71 | { | 71 | { |
72 | if ( !m_active ) { | 72 | if ( !m_active ) { |
73 | setFrameStyle( NoFrame ); | 73 | setFrameStyle( NoFrame ); |
74 | } | 74 | } |
75 | } | 75 | } |
76 | 76 | ||
77 | void OColorPanelButton::paintEvent( QPaintEvent* e ) | 77 | void OColorPanelButton::paintEvent( QPaintEvent* e ) |
78 | { | 78 | { |
79 | QFrame::paintEvent( e ); | 79 | QFrame::paintEvent( e ); |
80 | 80 | ||
81 | QPainter painter; | 81 | QPainter painter; |
82 | painter.begin( this ); | 82 | painter.begin( this ); |
83 | painter.fillRect( 2, 2, 12, 12, m_color ); | 83 | painter.fillRect( 2, 2, 12, 12, m_color ); |
84 | painter.setPen( Qt::black ); | 84 | painter.setPen( Qt::black ); |
85 | painter.drawRect( 2, 2, 12, 12 ); | 85 | painter.drawRect( 2, 2, 12, 12 ); |
86 | painter.end(); | 86 | painter.end(); |
87 | } | 87 | } |
88 | 88 | ||
89 | void OColorPanelButton::mouseReleaseEvent( QMouseEvent* ) | 89 | void OColorPanelButton::mouseReleaseEvent( QMouseEvent* ) |
90 | { | 90 | { |
91 | emit selected( m_color ); | 91 | emit selected( m_color ); |
92 | } | 92 | } |
93 | 93 | ||
94 | OColorPopupMenu::OColorPopupMenu( const QColor& color, QWidget* parent, const char* name ) | 94 | OColorPopupMenu::OColorPopupMenu( const QColor& color, QWidget* parent, const char* name ) |
95 | : QPopupMenu( parent, name ) | 95 | : QPopupMenu( parent, name ) |
96 | { | 96 | { |
97 | m_color = color; | 97 | m_color = color; |
98 | 98 | ||
99 | colorPanel = new QWidget( this ); | 99 | colorPanel = new QWidget( this ); |
100 | 100 | ||
101 | colorLayout = new QGridLayout(colorPanel, 5, 6); | 101 | colorLayout = new QGridLayout(colorPanel, 5, 6); |
102 | 102 | ||
103 | addColor(QColor(255, 255, 255), 0, 1); | 103 | addColor(QColor(255, 255, 255), 0, 1); |
104 | addColor(QColor(192, 192, 192), 0, 2); | 104 | addColor(QColor(192, 192, 192), 0, 2); |
105 | addColor(QColor(128, 128, 128), 0, 3); | 105 | addColor(QColor(128, 128, 128), 0, 3); |
106 | addColor(QColor(64, 64, 64), 0, 4); | 106 | addColor(QColor(64, 64, 64), 0, 4); |
107 | addColor(QColor(0, 0, 0), 0, 5); | 107 | addColor(QColor(0, 0, 0), 0, 5); |
108 | 108 | ||
109 | addColor(QColor(255, 0, 0), 1, 0); | 109 | addColor(QColor(255, 0, 0), 1, 0); |
110 | addColor(QColor(255, 128, 0), 1, 1); | 110 | addColor(QColor(255, 128, 0), 1, 1); |
111 | addColor(QColor(255, 255, 0), 1, 2); | 111 | addColor(QColor(255, 255, 0), 1, 2); |
112 | addColor(QColor(128, 255, 0), 1, 3); | 112 | addColor(QColor(128, 255, 0), 1, 3); |
113 | addColor(QColor(0, 255, 0), 1, 4); | 113 | addColor(QColor(0, 255, 0), 1, 4); |
114 | addColor(QColor(0, 255, 128), 1, 5); | 114 | addColor(QColor(0, 255, 128), 1, 5); |
115 | 115 | ||
116 | addColor(QColor(128, 0, 0), 2, 0); | 116 | addColor(QColor(128, 0, 0), 2, 0); |
117 | addColor(QColor(128, 64, 0), 2, 1); | 117 | addColor(QColor(128, 64, 0), 2, 1); |
118 | addColor(QColor(128, 128, 0), 2, 2); | 118 | addColor(QColor(128, 128, 0), 2, 2); |
119 | addColor(QColor(64, 128, 0), 2, 3); | 119 | addColor(QColor(64, 128, 0), 2, 3); |
120 | addColor(QColor(0, 128, 0), 2, 4); | 120 | addColor(QColor(0, 128, 0), 2, 4); |
121 | addColor(QColor(0, 128, 64), 2, 5); | 121 | addColor(QColor(0, 128, 64), 2, 5); |
122 | 122 | ||
123 | addColor(QColor(0, 255, 255), 3, 0); | 123 | addColor(QColor(0, 255, 255), 3, 0); |
124 | addColor(QColor(0, 128, 255), 3, 1); | 124 | addColor(QColor(0, 128, 255), 3, 1); |
125 | addColor(QColor(0, 0, 255), 3, 2); | 125 | addColor(QColor(0, 0, 255), 3, 2); |
126 | addColor(QColor(128, 0, 255), 3, 3); | 126 | addColor(QColor(128, 0, 255), 3, 3); |
127 | addColor(QColor(255, 0, 255), 3, 4); | 127 | addColor(QColor(255, 0, 255), 3, 4); |
128 | addColor(QColor(255, 0, 128), 3, 5); | 128 | addColor(QColor(255, 0, 128), 3, 5); |
129 | 129 | ||
130 | addColor(QColor(0, 128, 128), 4, 0); | 130 | addColor(QColor(0, 128, 128), 4, 0); |
131 | addColor(QColor(0, 64, 128), 4, 1); | 131 | addColor(QColor(0, 64, 128), 4, 1); |
132 | addColor(QColor(0, 0, 128), 4, 2); | 132 | addColor(QColor(0, 0, 128), 4, 2); |
133 | addColor(QColor(64, 0, 128), 4, 3); | 133 | addColor(QColor(64, 0, 128), 4, 3); |
134 | addColor(QColor(128, 0, 128), 4, 4); | 134 | addColor(QColor(128, 0, 128), 4, 4); |
135 | addColor(QColor(128, 0, 64), 4, 5); | 135 | addColor(QColor(128, 0, 64), 4, 5); |
136 | 136 | ||
137 | insertItem( colorPanel ); | 137 | insertItem( colorPanel ); |
138 | insertSeparator(); | 138 | insertSeparator(); |
139 | insertItem(tr("More"),this,SLOT( moreColorClicked())); | 139 | insertItem(tr("More"),this,SLOT( moreColorClicked())); |
140 | /* | 140 | /* |
141 | QAction* chooseColorAction = new QAction( tr( "More" ), tr( "More..." ), 0, colorPanel, "More" ); | 141 | QAction* chooseColorAction = new QAction( tr( "More" ), tr( "More..." ), 0, colorPanel, "More" ); |
142 | connect( chooseColorAction, SIGNAL( activated() ), this, SLOT( moreColorClicked() ) ); | 142 | connect( chooseColorAction, SIGNAL( activated() ), this, SLOT( moreColorClicked() ) ); |
143 | chooseColorAction->addTo( this ); | 143 | chooseColorAction->addTo( this ); |
144 | */ | 144 | */ |
145 | activateItemAt( 0 ); | 145 | activateItemAt( 0 ); |
146 | } | 146 | } |
147 | 147 | ||
148 | OColorPopupMenu::~OColorPopupMenu() | 148 | OColorPopupMenu::~OColorPopupMenu() |
149 | { | 149 | { |
150 | } | 150 | } |
151 | 151 | ||
152 | void OColorPopupMenu::addColor( const QColor& color, int row, int col ) | 152 | void OColorPopupMenu::addColor( const QColor& color, int row, int col ) |
153 | { | 153 | { |
154 | OColorPanelButton* panelButton = new OColorPanelButton( color, colorPanel ); | 154 | OColorPanelButton* panelButton = new OColorPanelButton( color, colorPanel ); |
155 | connect( panelButton, SIGNAL( selected( const QColor& ) ), this, SLOT( buttonSelected( const QColor& ) ) ); | 155 | connect( panelButton, SIGNAL( selected(const QColor&) ), this, SLOT( buttonSelected(const QColor&) ) ); |
156 | colorLayout->addWidget( panelButton, row, col ); | 156 | colorLayout->addWidget( panelButton, row, col ); |
157 | } | 157 | } |
158 | 158 | ||
159 | void OColorPopupMenu::buttonSelected( const QColor& color ) | 159 | void OColorPopupMenu::buttonSelected( const QColor& color ) |
160 | { | 160 | { |
161 | m_color = color; | 161 | m_color = color; |
162 | emit colorSelected( color ); | 162 | emit colorSelected( color ); |
163 | hide(); | 163 | hide(); |
164 | } | 164 | } |
165 | 165 | ||
166 | void OColorPopupMenu::moreColorClicked() | 166 | void OColorPopupMenu::moreColorClicked() |
167 | { | 167 | { |
168 | QColor color = OColorDialog::getColor( m_color ); | 168 | QColor color = OColorDialog::getColor( m_color ); |
169 | m_color = color; | 169 | m_color = color; |
170 | emit colorSelected( color ); | 170 | emit colorSelected( color ); |
171 | hide(); | 171 | hide(); |
172 | } | 172 | } |