author | drw <drw> | 2002-12-05 17:13:45 (UTC) |
---|---|---|
committer | drw <drw> | 2002-12-05 17:13:45 (UTC) |
commit | 675ab68194cc25793a18fd9e495958a90aaf0173 (patch) (unidiff) | |
tree | e2599a7dbef3184f015593f0b7ffe533c45a5ba5 | |
parent | 1eb333726ccf7c608b9f987aac1a04d37d35936c (diff) | |
download | opie-675ab68194cc25793a18fd9e495958a90aaf0173.zip opie-675ab68194cc25793a18fd9e495958a90aaf0173.tar.gz opie-675ab68194cc25793a18fd9e495958a90aaf0173.tar.bz2 |
Modified OColorButton to pass color to color dialog. Impacts appearance, launcher settings and liquid settings.
-rw-r--r-- | core/settings/launcher/tabdialog.cpp | 64 | ||||
-rw-r--r-- | libopie/ocolorbutton.cpp | 20 | ||||
-rw-r--r-- | libopie/ocolorbutton.h | 14 | ||||
-rw-r--r-- | noncore/settings/appearance2/editScheme.cpp | 7 | ||||
-rw-r--r-- | noncore/styles/liquid/liquidset.cpp | 20 |
5 files changed, 61 insertions, 64 deletions
diff --git a/core/settings/launcher/tabdialog.cpp b/core/settings/launcher/tabdialog.cpp index 5981d0b..4c9942f 100644 --- a/core/settings/launcher/tabdialog.cpp +++ b/core/settings/launcher/tabdialog.cpp | |||
@@ -74,65 +74,65 @@ public: | |||
74 | private: | 74 | private: |
75 | QPixmap m_large, m_small; | 75 | QPixmap m_large, m_small; |
76 | }; | 76 | }; |
77 | 77 | ||
78 | class SampleView : public QIconView { | 78 | class SampleView : public QIconView { |
79 | public: | 79 | public: |
80 | SampleView ( QWidget *parent = 0, const char *name = 0 ) : QIconView ( parent, name ) | 80 | SampleView ( QWidget *parent = 0, const char *name = 0 ) : QIconView ( parent, name ) |
81 | { | 81 | { |
82 | setItemsMovable ( false ); | 82 | setItemsMovable ( false ); |
83 | setAutoArrange ( true ); | 83 | setAutoArrange ( true ); |
84 | setSorting ( true ); | 84 | setSorting ( true ); |
85 | setFrameStyle ( QFrame::NoFrame ); | 85 | setFrameStyle ( QFrame::NoFrame ); |
86 | setSpacing ( 4 ); | 86 | setSpacing ( 4 ); |
87 | setMargin ( 0 ); | 87 | setMargin ( 0 ); |
88 | setSelectionMode ( QIconView::NoSelection ); | 88 | setSelectionMode ( QIconView::NoSelection ); |
89 | setBackgroundMode ( PaletteBase ); | 89 | setBackgroundMode ( PaletteBase ); |
90 | setViewMode ( TabConfig::Icon ); | 90 | setViewMode ( TabConfig::Icon ); |
91 | calculateGrid ( Bottom ); | 91 | calculateGrid ( Bottom ); |
92 | 92 | ||
93 | 93 | ||
94 | new SampleItem ( this, tr( "Sample 1" ), Resource::loadPixmap ( "DateBook" )); | 94 | new SampleItem ( this, tr( "Sample 1" ), Resource::loadPixmap ( "DateBook" )); |
95 | new SampleItem ( this, tr( "Sample 2" ), Resource::loadPixmap ( "Calibrate" )); | 95 | new SampleItem ( this, tr( "Sample 2" ), Resource::loadPixmap ( "Calibrate" )); |
96 | new SampleItem ( this, tr( "Sample 3" ), Resource::loadPixmap ( "UnknownDocument" )); | 96 | new SampleItem ( this, tr( "Sample 3" ), Resource::loadPixmap ( "UnknownDocument" )); |
97 | 97 | ||
98 | setBackgroundType ( TabConfig::Ruled, QString::null ); | 98 | setBackgroundType ( TabConfig::Ruled, QString::null ); |
99 | 99 | ||
100 | setMaximumHeight ( firstItem ( )-> height ( ) + 16 ); | 100 | setMaximumHeight ( firstItem ( )-> height ( ) + 16 ); |
101 | } | 101 | } |
102 | 102 | ||
103 | void setViewMode ( TabConfig::ViewMode m ) | 103 | void setViewMode ( TabConfig::ViewMode m ) |
104 | { | 104 | { |
105 | viewport ( )-> setUpdatesEnabled ( false ); | 105 | viewport ( )-> setUpdatesEnabled ( false ); |
106 | 106 | ||
107 | switch ( m ) { | 107 | switch ( m ) { |
108 | case TabConfig::List: | 108 | case TabConfig::List: |
109 | setItemTextPos( QIconView::Right ); | 109 | setItemTextPos( QIconView::Right ); |
110 | break; | 110 | break; |
111 | case TabConfig::Icon: | 111 | case TabConfig::Icon: |
112 | setItemTextPos( QIconView::Bottom ); | 112 | setItemTextPos( QIconView::Bottom ); |
113 | break; | 113 | break; |
114 | } | 114 | } |
115 | // hideOrShowItems ( false ); | 115 | // hideOrShowItems ( false ); |
116 | 116 | ||
117 | for ( QIconViewItem *it = firstItem ( ); it; it = it-> nextItem ( )) | 117 | for ( QIconViewItem *it = firstItem ( ); it; it = it-> nextItem ( )) |
118 | ((SampleItem *) it )-> sizeChange ( ); | 118 | ((SampleItem *) it )-> sizeChange ( ); |
119 | arrangeItemsInGrid ( true ); | 119 | arrangeItemsInGrid ( true ); |
120 | viewport ( )-> setUpdatesEnabled ( true ); | 120 | viewport ( )-> setUpdatesEnabled ( true ); |
121 | update ( ); | 121 | update ( ); |
122 | } | 122 | } |
123 | 123 | ||
124 | 124 | ||
125 | void setBackgroundType( TabConfig::BackgroundType t, const QString &val ) | 125 | void setBackgroundType( TabConfig::BackgroundType t, const QString &val ) |
126 | { | 126 | { |
127 | switch ( t ) { | 127 | switch ( t ) { |
128 | case TabConfig::Ruled: { | 128 | case TabConfig::Ruled: { |
129 | QPixmap bg ( width ( ), 9 ); | 129 | QPixmap bg ( width ( ), 9 ); |
130 | QPainter painter ( &bg ); | 130 | QPainter painter ( &bg ); |
131 | for ( int i = 0; i < 3; i++ ) { | 131 | for ( int i = 0; i < 3; i++ ) { |
132 | painter. setPen ( white ); | 132 | painter. setPen ( white ); |
133 | painter. drawLine ( 0, i*3, width()-1, i*3 ); | 133 | painter. drawLine ( 0, i*3, width()-1, i*3 ); |
134 | painter. drawLine ( 0, i*3+1, width()-1, i*3+1 ); | 134 | painter. drawLine ( 0, i*3+1, width()-1, i*3+1 ); |
135 | painter. setPen ( colorGroup().background().light(105) ); | 135 | painter. setPen ( colorGroup().background().light(105) ); |
136 | painter. drawLine ( 0, i*3+2, width()-1, i*3+2 ); | 136 | painter. drawLine ( 0, i*3+2, width()-1, i*3+2 ); |
137 | } | 137 | } |
138 | painter.end ( ); | 138 | painter.end ( ); |
@@ -153,307 +153,307 @@ public: | |||
153 | qDebug( "Loading image: %s", val.latin1() ); | 153 | qDebug( "Loading image: %s", val.latin1() ); |
154 | QPixmap bg ( Resource::loadPixmap ( "wallpaper/" + val )); | 154 | QPixmap bg ( Resource::loadPixmap ( "wallpaper/" + val )); |
155 | if ( bg. isNull ( )) { | 155 | if ( bg. isNull ( )) { |
156 | QImageIO imgio; | 156 | QImageIO imgio; |
157 | imgio. setFileName ( val ); | 157 | imgio. setFileName ( val ); |
158 | QSize ds = qApp-> desktop ( )-> size ( ); | 158 | QSize ds = qApp-> desktop ( )-> size ( ); |
159 | QString param ( "Scale( %1, %2, ScaleMin )" ); // No tr | 159 | QString param ( "Scale( %1, %2, ScaleMin )" ); // No tr |
160 | imgio. setParameters ( param. arg ( ds. width ( )). arg ( ds. height ( )). latin1 ( )); | 160 | imgio. setParameters ( param. arg ( ds. width ( )). arg ( ds. height ( )). latin1 ( )); |
161 | imgio. read ( ); | 161 | imgio. read ( ); |
162 | bg = imgio. image ( ); | 162 | bg = imgio. image ( ); |
163 | } | 163 | } |
164 | setBackgroundPixmap ( bg ); | 164 | setBackgroundPixmap ( bg ); |
165 | break; | 165 | break; |
166 | } | 166 | } |
167 | } | 167 | } |
168 | m_bgtype = t; | 168 | m_bgtype = t; |
169 | viewport ( )-> update ( ); | 169 | viewport ( )-> update ( ); |
170 | } | 170 | } |
171 | 171 | ||
172 | void setTextColor ( const QColor &tc ) | 172 | void setTextColor ( const QColor &tc ) |
173 | { | 173 | { |
174 | m_textcolor = tc; | 174 | m_textcolor = tc; |
175 | QColorGroup cg = colorGroup ( ); | 175 | QColorGroup cg = colorGroup ( ); |
176 | cg. setColor ( QColorGroup::Text, tc ); | 176 | cg. setColor ( QColorGroup::Text, tc ); |
177 | setPalette ( QPalette ( cg, cg, cg )); | 177 | setPalette ( QPalette ( cg, cg, cg )); |
178 | viewport ( )-> update ( ); | 178 | viewport ( )-> update ( ); |
179 | } | 179 | } |
180 | 180 | ||
181 | void setViewFont ( const QFont &f ) | 181 | void setViewFont ( const QFont &f ) |
182 | { | 182 | { |
183 | setFont ( f ); | 183 | setFont ( f ); |
184 | } | 184 | } |
185 | 185 | ||
186 | void setItemTextPos ( ItemTextPos pos ) | 186 | void setItemTextPos ( ItemTextPos pos ) |
187 | { | 187 | { |
188 | calculateGrid ( pos ); | 188 | calculateGrid ( pos ); |
189 | QIconView::setItemTextPos( pos ); | 189 | QIconView::setItemTextPos( pos ); |
190 | } | 190 | } |
191 | 191 | ||
192 | void calculateGrid ( ItemTextPos pos ) | 192 | void calculateGrid ( ItemTextPos pos ) |
193 | { | 193 | { |
194 | int dw = QApplication::desktop ( )-> width ( ); | 194 | int dw = QApplication::desktop ( )-> width ( ); |
195 | int viewerWidth = dw - style ( ).scrollBarExtent ( ). width ( ); | 195 | int viewerWidth = dw - style ( ).scrollBarExtent ( ). width ( ); |
196 | if ( pos == Bottom ) { | 196 | if ( pos == Bottom ) { |
197 | int cols = 3; | 197 | int cols = 3; |
198 | if ( viewerWidth <= 200 ) | 198 | if ( viewerWidth <= 200 ) |
199 | cols = 2; | 199 | cols = 2; |
200 | else if ( viewerWidth >= 400 ) | 200 | else if ( viewerWidth >= 400 ) |
201 | cols = viewerWidth/96; | 201 | cols = viewerWidth/96; |
202 | setSpacing ( 4 ); | 202 | setSpacing ( 4 ); |
203 | setGridX (( viewerWidth - ( cols + 1 ) * spacing ( )) / cols ); | 203 | setGridX (( viewerWidth - ( cols + 1 ) * spacing ( )) / cols ); |
204 | setGridY ( fontMetrics ( ). height ( ) * 2 + 24 ); | 204 | setGridY ( fontMetrics ( ). height ( ) * 2 + 24 ); |
205 | } | 205 | } |
206 | else { | 206 | else { |
207 | int cols = 2; | 207 | int cols = 2; |
208 | if ( viewerWidth < 150 ) | 208 | if ( viewerWidth < 150 ) |
209 | cols = 1; | 209 | cols = 1; |
210 | else if ( viewerWidth >= 400 ) | 210 | else if ( viewerWidth >= 400 ) |
211 | cols = viewerWidth / 150; | 211 | cols = viewerWidth / 150; |
212 | setSpacing ( 2 ); | 212 | setSpacing ( 2 ); |
213 | setGridX (( viewerWidth - ( cols + 1 ) * spacing ( )) / cols ); | 213 | setGridX (( viewerWidth - ( cols + 1 ) * spacing ( )) / cols ); |
214 | setGridY ( fontMetrics ( ). height ( ) + 2 ); | 214 | setGridY ( fontMetrics ( ). height ( ) + 2 ); |
215 | } | 215 | } |
216 | } | 216 | } |
217 | 217 | ||
218 | void paletteChange( const QPalette &p ) | 218 | void paletteChange( const QPalette &p ) |
219 | { | 219 | { |
220 | static bool excllock = false; | 220 | static bool excllock = false; |
221 | 221 | ||
222 | if ( excllock ) | 222 | if ( excllock ) |
223 | return; | 223 | return; |
224 | excllock = true; | 224 | excllock = true; |
225 | 225 | ||
226 | unsetPalette ( ); | 226 | unsetPalette ( ); |
227 | QIconView::paletteChange ( p ); | 227 | QIconView::paletteChange ( p ); |
228 | if ( m_bgtype == TabConfig::Ruled ) | 228 | if ( m_bgtype == TabConfig::Ruled ) |
229 | setBackgroundType ( TabConfig::Ruled, QString::null ); | 229 | setBackgroundType ( TabConfig::Ruled, QString::null ); |
230 | QColorGroup cg = colorGroup ( ); | 230 | QColorGroup cg = colorGroup ( ); |
231 | cg.setColor ( QColorGroup::Text, m_textcolor ); | 231 | cg.setColor ( QColorGroup::Text, m_textcolor ); |
232 | setPalette ( QPalette ( cg, cg, cg )); | 232 | setPalette ( QPalette ( cg, cg, cg )); |
233 | 233 | ||
234 | excllock = false; | 234 | excllock = false; |
235 | } | 235 | } |
236 | 236 | ||
237 | void setBackgroundPixmap ( const QPixmap &pm ) | 237 | void setBackgroundPixmap ( const QPixmap &pm ) |
238 | { | 238 | { |
239 | m_bgpix = pm; | 239 | m_bgpix = pm; |
240 | } | 240 | } |
241 | 241 | ||
242 | void setBackgroundColor ( const QColor &c ) | 242 | void setBackgroundColor ( const QColor &c ) |
243 | { | 243 | { |
244 | m_bgcolor = c; | 244 | m_bgcolor = c; |
245 | } | 245 | } |
246 | 246 | ||
247 | void drawBackground ( QPainter *p, const QRect &r ) | 247 | void drawBackground ( QPainter *p, const QRect &r ) |
248 | { | 248 | { |
249 | if ( !m_bgpix. isNull ( )) { | 249 | if ( !m_bgpix. isNull ( )) { |
250 | p-> drawTiledPixmap ( r, m_bgpix, QPoint (( r. x ( ) + contentsX ( )) % m_bgpix. width ( ), | 250 | p-> drawTiledPixmap ( r, m_bgpix, QPoint (( r. x ( ) + contentsX ( )) % m_bgpix. width ( ), |
251 | ( r. y ( ) + contentsY ( )) % m_bgpix. height ( ))); | 251 | ( r. y ( ) + contentsY ( )) % m_bgpix. height ( ))); |
252 | } | 252 | } |
253 | else | 253 | else |
254 | p-> fillRect ( r, m_bgcolor ); | 254 | p-> fillRect ( r, m_bgcolor ); |
255 | } | 255 | } |
256 | 256 | ||
257 | private: | 257 | private: |
258 | QColor m_textcolor; | 258 | QColor m_textcolor; |
259 | QColor m_bgcolor; | 259 | QColor m_bgcolor; |
260 | QPixmap m_bgpix; | 260 | QPixmap m_bgpix; |
261 | TabConfig::BackgroundType m_bgtype; | 261 | TabConfig::BackgroundType m_bgtype; |
262 | }; | 262 | }; |
263 | 263 | ||
264 | 264 | ||
265 | 265 | ||
266 | TabDialog::TabDialog ( const QPixmap *tabicon, const QString &tabname, TabConfig &tc, QWidget *parent, const char *dname, bool modal, WFlags fl ) | 266 | TabDialog::TabDialog ( const QPixmap *tabicon, const QString &tabname, TabConfig &tc, QWidget *parent, const char *dname, bool modal, WFlags fl ) |
267 | : QDialog ( parent, dname, modal, fl | WStyle_ContextHelp ), m_tc ( tc ) | 267 | : QDialog ( parent, dname, modal, fl | WStyle_ContextHelp ), m_tc ( tc ) |
268 | { | 268 | { |
269 | setCaption ( tr( "Edit Tab" )); | 269 | setCaption ( tr( "Edit Tab" )); |
270 | 270 | ||
271 | QVBoxLayout *lay = new QVBoxLayout ( this, 3, 3 ); | 271 | QVBoxLayout *lay = new QVBoxLayout ( this, 3, 3 ); |
272 | 272 | ||
273 | OTabWidget *tw = new OTabWidget ( this, "tabwidget", OTabWidget::Global, OTabWidget::Bottom ); | 273 | OTabWidget *tw = new OTabWidget ( this, "tabwidget", OTabWidget::Global, OTabWidget::Bottom ); |
274 | QWidget *bgtab; | 274 | QWidget *bgtab; |
275 | 275 | ||
276 | tw-> addTab ( bgtab = createBgTab ( tw ), "appearance/backgroundtabicon.png", tr( "Background" )); | 276 | tw-> addTab ( bgtab = createBgTab ( tw ), "appearance/backgroundtabicon.png", tr( "Background" )); |
277 | tw-> addTab ( createFontTab ( tw ), "appearance/fonttabicon.png", tr( "Font" )); | 277 | tw-> addTab ( createFontTab ( tw ), "appearance/fonttabicon.png", tr( "Font" )); |
278 | tw-> addTab ( createIconTab ( tw ), "appearance/colorstabicon.png", tr( "Icons" ) ); | 278 | tw-> addTab ( createIconTab ( tw ), "appearance/colorstabicon.png", tr( "Icons" ) ); |
279 | 279 | ||
280 | tw-> setCurrentTab ( bgtab ); | 280 | tw-> setCurrentTab ( bgtab ); |
281 | 281 | ||
282 | QWidget *sample = new QVBox ( this ); | 282 | QWidget *sample = new QVBox ( this ); |
283 | QTabBar *tb = new QTabBar ( sample ); | 283 | QTabBar *tb = new QTabBar ( sample ); |
284 | QString name ( tr( "Previewing %1" ). arg ( tabname )); | 284 | QString name ( tr( "Previewing %1" ). arg ( tabname )); |
285 | 285 | ||
286 | tb-> addTab ( tabicon ? new QTab ( *tabicon, name ) : new QTab ( name )); | 286 | tb-> addTab ( tabicon ? new QTab ( *tabicon, name ) : new QTab ( name )); |
287 | 287 | ||
288 | m_sample = new SampleView ( sample ); | 288 | m_sample = new SampleView ( sample ); |
289 | 289 | ||
290 | lay-> addWidget ( tw, 10 ); | 290 | lay-> addWidget ( tw, 10 ); |
291 | lay-> addWidget ( sample, 1 ); | 291 | lay-> addWidget ( sample, 1 ); |
292 | 292 | ||
293 | m_iconsize-> setButton ( tc. m_view ); | 293 | m_iconsize-> setButton ( tc. m_view ); |
294 | iconSizeClicked ( tc. m_view ); | 294 | iconSizeClicked ( tc. m_view ); |
295 | m_iconcolor-> setColor ( QColor ( m_tc. m_text_color )); | 295 | //m_iconcolor-> setColor ( QColor ( m_tc. m_text_color )); |
296 | iconColorClicked ( m_iconcolor-> color ( )); | 296 | iconColorClicked ( m_iconcolor-> color ( )); |
297 | m_bgtype-> setButton ( tc. m_bg_type ); | 297 | m_bgtype-> setButton ( tc. m_bg_type ); |
298 | m_solidcolor-> setColor ( QColor ( tc. m_bg_color )); | 298 | //m_solidcolor-> setColor ( QColor ( tc. m_bg_color )); |
299 | m_bgimage = tc. m_bg_image; | 299 | m_bgimage = tc. m_bg_image; |
300 | bgTypeClicked ( tc. m_bg_type ); | 300 | bgTypeClicked ( tc. m_bg_type ); |
301 | m_fontuse-> setChecked ( tc. m_font_use ); | 301 | m_fontuse-> setChecked ( tc. m_font_use ); |
302 | m_fontselect-> setSelectedFont ( QFont ( tc. m_font_family, tc. m_font_size, tc. m_font_weight, tc. m_font_italic )); | 302 | m_fontselect-> setSelectedFont ( QFont ( tc. m_font_family, tc. m_font_size, tc. m_font_weight, tc. m_font_italic )); |
303 | m_fontselect-> setEnabled ( m_fontuse-> isChecked ( )); | 303 | m_fontselect-> setEnabled ( m_fontuse-> isChecked ( )); |
304 | fontClicked ( m_fontselect-> selectedFont ( )); | 304 | fontClicked ( m_fontselect-> selectedFont ( )); |
305 | 305 | ||
306 | QWhatsThis::add ( sample, tr( "This is a rough preview of what the currently selected Tab will look like." )); | 306 | QWhatsThis::add ( sample, tr( "This is a rough preview of what the currently selected Tab will look like." )); |
307 | } | 307 | } |
308 | 308 | ||
309 | 309 | ||
310 | TabDialog::~TabDialog ( ) | 310 | TabDialog::~TabDialog ( ) |
311 | { | 311 | { |
312 | } | 312 | } |
313 | 313 | ||
314 | QWidget *TabDialog::createFontTab ( QWidget *parent ) | 314 | QWidget *TabDialog::createFontTab ( QWidget *parent ) |
315 | { | 315 | { |
316 | QWidget *tab = new QWidget ( parent, "FontTab" ); | 316 | QWidget *tab = new QWidget ( parent, "FontTab" ); |
317 | QVBoxLayout *vertLayout = new QVBoxLayout ( tab, 3, 3 ); | 317 | QVBoxLayout *vertLayout = new QVBoxLayout ( tab, 3, 3 ); |
318 | 318 | ||
319 | m_fontuse = new QCheckBox ( tr( "Use a custom font" ), tab ); | 319 | m_fontuse = new QCheckBox ( tr( "Use a custom font" ), tab ); |
320 | vertLayout-> addWidget ( m_fontuse ); | 320 | vertLayout-> addWidget ( m_fontuse ); |
321 | 321 | ||
322 | m_fontselect = new OFontSelector ( false, tab, "fontsel" ); | 322 | m_fontselect = new OFontSelector ( false, tab, "fontsel" ); |
323 | vertLayout-> addWidget ( m_fontselect ); | 323 | vertLayout-> addWidget ( m_fontselect ); |
324 | 324 | ||
325 | connect ( m_fontuse, SIGNAL( toggled ( bool )), m_fontselect, SLOT( setEnabled ( bool ))); | 325 | connect ( m_fontuse, SIGNAL( toggled ( bool )), m_fontselect, SLOT( setEnabled ( bool ))); |
326 | connect( m_fontselect, SIGNAL( fontSelected ( const QFont & )), | 326 | connect( m_fontselect, SIGNAL( fontSelected ( const QFont & )), |
327 | this, SLOT( fontClicked ( const QFont & ))); | 327 | this, SLOT( fontClicked ( const QFont & ))); |
328 | 328 | ||
329 | return tab; | 329 | return tab; |
330 | } | 330 | } |
331 | 331 | ||
332 | QWidget *TabDialog::createBgTab ( QWidget *parent ) | 332 | QWidget *TabDialog::createBgTab ( QWidget *parent ) |
333 | { | 333 | { |
334 | QWidget *tab = new QWidget( parent, "BgTab" ); | 334 | QWidget *tab = new QWidget( parent, "BgTab" ); |
335 | QVBoxLayout *vertLayout = new QVBoxLayout( tab, 3, 3 ); | 335 | QVBoxLayout *vertLayout = new QVBoxLayout( tab, 3, 3 ); |
336 | 336 | ||
337 | QGridLayout* gridLayout = new QGridLayout ( vertLayout ); | 337 | QGridLayout* gridLayout = new QGridLayout ( vertLayout ); |
338 | gridLayout-> setColStretch ( 1, 10 ); | 338 | gridLayout-> setColStretch ( 1, 10 ); |
339 | 339 | ||
340 | QLabel* label = new QLabel( tr( "Type:" ), tab ); | 340 | QLabel* label = new QLabel( tr( "Type:" ), tab ); |
341 | gridLayout-> addWidget ( label, 0, 0 ); | 341 | gridLayout-> addWidget ( label, 0, 0 ); |
342 | m_bgtype = new QButtonGroup( tab, "buttongroup" ); | 342 | m_bgtype = new QButtonGroup( tab, "buttongroup" ); |
343 | m_bgtype-> hide ( ); | 343 | m_bgtype-> hide ( ); |
344 | m_bgtype-> setExclusive ( true ); | 344 | m_bgtype-> setExclusive ( true ); |
345 | 345 | ||
346 | QRadioButton *rb; | 346 | QRadioButton *rb; |
347 | rb = new QRadioButton( tr( "Ruled" ), tab, "ruled" ); | 347 | rb = new QRadioButton( tr( "Ruled" ), tab, "ruled" ); |
348 | m_bgtype-> insert ( rb, TabConfig::Ruled ); | 348 | m_bgtype-> insert ( rb, TabConfig::Ruled ); |
349 | gridLayout-> addWidget( rb, 0, 1 ); | 349 | gridLayout-> addWidget( rb, 0, 1 ); |
350 | 350 | ||
351 | QHBoxLayout *hb = new QHBoxLayout ( ); | 351 | QHBoxLayout *hb = new QHBoxLayout ( ); |
352 | hb-> setSpacing ( 3 ); | 352 | hb-> setSpacing ( 3 ); |
353 | 353 | ||
354 | rb = new QRadioButton( tr( "Solid color" ), tab, "solid" ); | 354 | rb = new QRadioButton( tr( "Solid color" ), tab, "solid" ); |
355 | m_bgtype-> insert ( rb, TabConfig::SolidColor ); | 355 | m_bgtype-> insert ( rb, TabConfig::SolidColor ); |
356 | hb-> addWidget ( rb ); | 356 | hb-> addWidget ( rb ); |
357 | hb-> addSpacing ( 10 ); | 357 | hb-> addSpacing ( 10 ); |
358 | 358 | ||
359 | m_solidcolor = new OColorButton ( tab ); | 359 | m_solidcolor = new OColorButton ( tab, QColor ( m_tc. m_bg_color ) ); |
360 | connect ( m_solidcolor, SIGNAL( colorSelected ( const QColor & )), this, SLOT( bgColorClicked ( const QColor & ))); | 360 | connect ( m_solidcolor, SIGNAL( colorSelected ( const QColor & )), this, SLOT( bgColorClicked ( const QColor & ))); |
361 | hb-> addWidget ( m_solidcolor ); | 361 | hb-> addWidget ( m_solidcolor ); |
362 | hb-> addStretch ( 10 ); | 362 | hb-> addStretch ( 10 ); |
363 | 363 | ||
364 | gridLayout-> addLayout ( hb, 1, 1 ); | 364 | gridLayout-> addLayout ( hb, 1, 1 ); |
365 | 365 | ||
366 | hb = new QHBoxLayout ( ); | 366 | hb = new QHBoxLayout ( ); |
367 | hb-> setSpacing ( 3 ); | 367 | hb-> setSpacing ( 3 ); |
368 | 368 | ||
369 | rb = new QRadioButton( tr( "Image" ), tab, "image" ); | 369 | rb = new QRadioButton( tr( "Image" ), tab, "image" ); |
370 | m_bgtype-> insert ( rb, TabConfig::Image ); | 370 | m_bgtype-> insert ( rb, TabConfig::Image ); |
371 | hb-> addWidget( rb ); | 371 | hb-> addWidget( rb ); |
372 | hb-> addSpacing ( 10 ); | 372 | hb-> addSpacing ( 10 ); |
373 | 373 | ||
374 | m_imagebrowse = new QPushButton ( tr( "Select..." ), tab ); | 374 | m_imagebrowse = new QPushButton ( tr( "Select..." ), tab ); |
375 | connect ( m_imagebrowse, SIGNAL( clicked ( )), this, SLOT( bgImageClicked ( ))); | 375 | connect ( m_imagebrowse, SIGNAL( clicked ( )), this, SLOT( bgImageClicked ( ))); |
376 | hb-> addWidget ( m_imagebrowse ); | 376 | hb-> addWidget ( m_imagebrowse ); |
377 | hb-> addStretch ( 10 ); | 377 | hb-> addStretch ( 10 ); |
378 | 378 | ||
379 | gridLayout-> addLayout ( hb, 2, 1 ); | 379 | gridLayout-> addLayout ( hb, 2, 1 ); |
380 | 380 | ||
381 | QPushButton *p = new QPushButton ( tr( "Default" ), tab ); | 381 | QPushButton *p = new QPushButton ( tr( "Default" ), tab ); |
382 | connect ( p, SIGNAL( clicked ( )), this, SLOT( bgDefaultClicked ( ))); | 382 | connect ( p, SIGNAL( clicked ( )), this, SLOT( bgDefaultClicked ( ))); |
383 | gridLayout-> addWidget ( p, 3, 1 ); | 383 | gridLayout-> addWidget ( p, 3, 1 ); |
384 | 384 | ||
385 | connect ( m_bgtype, SIGNAL( clicked ( int )), this, SLOT( bgTypeClicked ( int ))); | 385 | connect ( m_bgtype, SIGNAL( clicked ( int )), this, SLOT( bgTypeClicked ( int ))); |
386 | 386 | ||
387 | vertLayout-> addStretch ( 10 ); | 387 | vertLayout-> addStretch ( 10 ); |
388 | 388 | ||
389 | return tab; | 389 | return tab; |
390 | } | 390 | } |
391 | 391 | ||
392 | QWidget *TabDialog::createIconTab ( QWidget *parent ) | 392 | QWidget *TabDialog::createIconTab ( QWidget *parent ) |
393 | { | 393 | { |
394 | QWidget *tab = new QWidget( parent, "IconTab" ); | 394 | QWidget *tab = new QWidget( parent, "IconTab" ); |
395 | QVBoxLayout *vertLayout = new QVBoxLayout( tab, 3, 3 ); | 395 | QVBoxLayout *vertLayout = new QVBoxLayout( tab, 3, 3 ); |
396 | 396 | ||
397 | QGridLayout* gridLayout = new QGridLayout ( vertLayout ); | 397 | QGridLayout* gridLayout = new QGridLayout ( vertLayout ); |
398 | gridLayout-> setColStretch ( 1, 10 ); | 398 | gridLayout-> setColStretch ( 1, 10 ); |
399 | 399 | ||
400 | QLabel* label = new QLabel( tr( "Size:" ), tab ); | 400 | QLabel* label = new QLabel( tr( "Size:" ), tab ); |
401 | gridLayout-> addWidget ( label, 0, 0 ); | 401 | gridLayout-> addWidget ( label, 0, 0 ); |
402 | m_iconsize = new QButtonGroup( tab, "buttongroup" ); | 402 | m_iconsize = new QButtonGroup( tab, "buttongroup" ); |
403 | m_iconsize-> hide ( ); | 403 | m_iconsize-> hide ( ); |
404 | m_iconsize-> setExclusive ( true ); | 404 | m_iconsize-> setExclusive ( true ); |
405 | 405 | ||
406 | QRadioButton *rb; | 406 | QRadioButton *rb; |
407 | rb = new QRadioButton( tr( "Small" ), tab, "iconsmall" ); | 407 | rb = new QRadioButton( tr( "Small" ), tab, "iconsmall" ); |
408 | m_iconsize-> insert ( rb, TabConfig::List ); | 408 | m_iconsize-> insert ( rb, TabConfig::List ); |
409 | gridLayout-> addWidget( rb, 0, 1 ); | 409 | gridLayout-> addWidget( rb, 0, 1 ); |
410 | 410 | ||
411 | rb = new QRadioButton( tr( "Large" ), tab, "iconlarge" ); | 411 | rb = new QRadioButton( tr( "Large" ), tab, "iconlarge" ); |
412 | m_iconsize-> insert ( rb, TabConfig::Icon ); | 412 | m_iconsize-> insert ( rb, TabConfig::Icon ); |
413 | gridLayout-> addWidget( rb, 1, 1 ); | 413 | gridLayout-> addWidget( rb, 1, 1 ); |
414 | 414 | ||
415 | connect ( m_iconsize, SIGNAL( clicked ( int )), this, SLOT( iconSizeClicked ( int ))); | 415 | connect ( m_iconsize, SIGNAL( clicked ( int )), this, SLOT( iconSizeClicked ( int ))); |
416 | 416 | ||
417 | //vertLayout-> addSpacing ( 8 ); | 417 | //vertLayout-> addSpacing ( 8 ); |
418 | 418 | ||
419 | //gridLayout = new QGridLayout ( vertLayout ); | 419 | //gridLayout = new QGridLayout ( vertLayout ); |
420 | gridLayout-> addRowSpacing ( 2, 8 ); | 420 | gridLayout-> addRowSpacing ( 2, 8 ); |
421 | 421 | ||
422 | label = new QLabel ( tr( "Color:" ), tab ); | 422 | label = new QLabel ( tr( "Color:" ), tab ); |
423 | gridLayout-> addWidget ( label, 3, 0 ); | 423 | gridLayout-> addWidget ( label, 3, 0 ); |
424 | 424 | ||
425 | m_iconcolor = new OColorButton ( tab ); | 425 | m_iconcolor = new OColorButton ( tab, QColor ( m_tc. m_text_color ) ); |
426 | connect ( m_iconcolor, SIGNAL( colorSelected ( const QColor & )), this, SLOT( iconColorClicked ( const QColor & ))); | 426 | connect ( m_iconcolor, SIGNAL( colorSelected ( const QColor & )), this, SLOT( iconColorClicked ( const QColor & ))); |
427 | gridLayout-> addWidget ( m_iconcolor, 3, 1, AlignLeft ); | 427 | gridLayout-> addWidget ( m_iconcolor, 3, 1, AlignLeft ); |
428 | 428 | ||
429 | vertLayout-> addStretch ( 10 ); | 429 | vertLayout-> addStretch ( 10 ); |
430 | 430 | ||
431 | return tab; | 431 | return tab; |
432 | } | 432 | } |
433 | 433 | ||
434 | 434 | ||
435 | void TabDialog::iconSizeClicked ( int s ) | 435 | void TabDialog::iconSizeClicked ( int s ) |
436 | { | 436 | { |
437 | m_sample-> setViewMode ((TabConfig::ViewMode) s ); | 437 | m_sample-> setViewMode ((TabConfig::ViewMode) s ); |
438 | } | 438 | } |
439 | 439 | ||
440 | void TabDialog::fontClicked ( const QFont &f ) | 440 | void TabDialog::fontClicked ( const QFont &f ) |
441 | { | 441 | { |
442 | m_sample-> setViewFont ( f ); | 442 | m_sample-> setViewFont ( f ); |
443 | } | 443 | } |
444 | 444 | ||
445 | void TabDialog::bgTypeClicked ( int t ) | 445 | void TabDialog::bgTypeClicked ( int t ) |
446 | { | 446 | { |
447 | QString s; | 447 | QString s; |
448 | 448 | ||
449 | if ( m_bgtype-> id ( m_bgtype-> selected ( )) != t ) | 449 | if ( m_bgtype-> id ( m_bgtype-> selected ( )) != t ) |
450 | m_bgtype-> setButton ( t ); | 450 | m_bgtype-> setButton ( t ); |
451 | 451 | ||
452 | m_solidcolor-> setEnabled ( t == TabConfig::SolidColor ); | 452 | m_solidcolor-> setEnabled ( t == TabConfig::SolidColor ); |
453 | m_imagebrowse-> setEnabled ( t == TabConfig::Image ); | 453 | m_imagebrowse-> setEnabled ( t == TabConfig::Image ); |
454 | 454 | ||
455 | if ( t == TabConfig::SolidColor ) | 455 | if ( t == TabConfig::SolidColor ) |
456 | s = m_solidcolor-> color ( ). name ( ); | 456 | s = m_solidcolor-> color ( ). name ( ); |
457 | else if ( t == TabConfig::Image ) | 457 | else if ( t == TabConfig::Image ) |
458 | s = Resource::findPixmap ( m_bgimage ); | 458 | s = Resource::findPixmap ( m_bgimage ); |
459 | 459 | ||
diff --git a/libopie/ocolorbutton.cpp b/libopie/ocolorbutton.cpp index 4734c0c..ddb6c4f 100644 --- a/libopie/ocolorbutton.cpp +++ b/libopie/ocolorbutton.cpp | |||
@@ -2,88 +2,88 @@ | |||
2 | =. This file is part of the OPIE Project | 2 | =. This file is part of the OPIE Project |
3 | .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> | 3 | .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> |
4 | .>+-= | 4 | .>+-= |
5 | _;:, .> :=|. This library is free software; you can | 5 | _;:, .> :=|. This library is free software; you can |
6 | .> <`_, > . <= redistribute it and/or modify it under | 6 | .> <`_, > . <= redistribute it and/or modify it under |
7 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | 7 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
8 | .="- .-=="i, .._ License as published by the Free Software | 8 | .="- .-=="i, .._ License as published by the Free Software |
9 | - . .-<_> .<> Foundation; either version 2 of the License, | 9 | - . .-<_> .<> Foundation; either version 2 of the License, |
10 | ._= =} : or (at your option) any later version. | 10 | ._= =} : or (at your option) any later version. |
11 | .%`+i> _;_. | 11 | .%`+i> _;_. |
12 | .i_,=:_. -<s. This library is distributed in the hope that | 12 | .i_,=:_. -<s. This library is distributed in the hope that |
13 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 13 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
14 | : .. .:, . . . without even the implied warranty of | 14 | : .. .:, . . . without even the implied warranty of |
15 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 15 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
16 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 16 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
17 | ..}^=.= = ; Library General Public License for more | 17 | ..}^=.= = ; Library General Public License for more |
18 | ++= -. .` .: details. | 18 | ++= -. .` .: details. |
19 | : = ...= . :.=- | 19 | : = ...= . :.=- |
20 | -. .:....=;==+<; You should have received a copy of the GNU | 20 | -. .:....=;==+<; You should have received a copy of the GNU |
21 | -_. . . )=. = Library General Public License along with | 21 | -_. . . )=. = Library General Public License along with |
22 | -- :-=` this library; see the file COPYING.LIB. | 22 | -- :-=` this library; see the file COPYING.LIB. |
23 | If not, write to the Free Software Foundation, | 23 | If not, write to the Free Software Foundation, |
24 | Inc., 59 Temple Place - Suite 330, | 24 | Inc., 59 Temple Place - Suite 330, |
25 | Boston, MA 02111-1307, USA. | 25 | Boston, MA 02111-1307, USA. |
26 | 26 | ||
27 | */ | 27 | */ |
28 | 28 | ||
29 | #include <opie/colorpopupmenu.h> | 29 | #include <opie/colorpopupmenu.h> |
30 | #include <opie/ocolorbutton.h> | 30 | #include <opie/ocolorbutton.h> |
31 | #include <qcolor.h> | 31 | #include <qcolor.h> |
32 | #include <qpixmap.h> | 32 | #include <qpixmap.h> |
33 | #include <qimage.h> | 33 | #include <qimage.h> |
34 | 34 | ||
35 | #include <qpe/resource.h> | 35 | #include <qpe/resource.h> |
36 | 36 | ||
37 | class OColorButtonPrivate { | 37 | class OColorButtonPrivate { |
38 | public: | 38 | public: |
39 | QPopupMenu *m_menu; | 39 | QPopupMenu *m_menu; |
40 | QColor m_color; | 40 | QColor m_color; |
41 | }; | 41 | }; |
42 | 42 | ||
43 | OColorButton::OColorButton ( QWidget *parent, const char *name ) | 43 | OColorButton::OColorButton ( QWidget *parent, const QColor &color, const char *name ) |
44 | : QPushButton ( parent, name ) | 44 | : QPushButton ( parent, name ) |
45 | { | 45 | { |
46 | d = new OColorButtonPrivate; | 46 | d = new OColorButtonPrivate; |
47 | 47 | ||
48 | d-> m_menu = new ColorPopupMenu ( black, 0, 0 ); | 48 | d-> m_menu = new ColorPopupMenu ( color, 0, 0 ); |
49 | setPopup ( d-> m_menu ); | 49 | setPopup ( d-> m_menu ); |
50 | //setPopupDelay ( 0 ); | 50 | //setPopupDelay ( 0 ); |
51 | connect ( d-> m_menu, SIGNAL( colorSelected ( const QColor & )), this, SLOT( updateColor ( const QColor & ))); | 51 | connect ( d-> m_menu, SIGNAL( colorSelected ( const QColor & )), this, SLOT( updateColor ( const QColor & ))); |
52 | 52 | ||
53 | updateColor ( black ); | 53 | updateColor ( color ); |
54 | 54 | ||
55 | QSize s = sizeHint ( ) + QSize ( 12, 0 ); | 55 | QSize s = sizeHint ( ) + QSize ( 12, 0 ); |
56 | setMinimumSize ( s ); | 56 | setMinimumSize ( s ); |
57 | setMaximumSize ( s. width ( ) * 2, s. height ( )); | 57 | setMaximumSize ( s. width ( ) * 2, s. height ( )); |
58 | } | 58 | } |
59 | 59 | ||
60 | OColorButton::~OColorButton ( ) | 60 | OColorButton::~OColorButton ( ) |
61 | { | 61 | { |
62 | delete d; | 62 | delete d; |
63 | } | 63 | } |
64 | 64 | ||
65 | QColor OColorButton::color ( ) const | 65 | QColor OColorButton::color ( ) const |
66 | { | 66 | { |
67 | return d-> m_color; | 67 | return d-> m_color; |
68 | } | 68 | } |
69 | 69 | ||
70 | void OColorButton::setColor ( const QColor &c ) | 70 | void OColorButton::setColor ( const QColor &c ) |
71 | { | 71 | { |
72 | updateColor ( c ); | 72 | updateColor ( c ); |
73 | } | 73 | } |
74 | 74 | ||
75 | void OColorButton::updateColor ( const QColor &c ) | 75 | void OColorButton::updateColor ( const QColor &c ) |
76 | { | 76 | { |
77 | d-> m_color = c; | 77 | d-> m_color = c; |
78 | 78 | ||
79 | QImage img ( 16, 16, 32 ); | 79 | QImage img ( 16, 16, 32 ); |
80 | img. fill ( 0 ); | 80 | img. fill ( 0 ); |
81 | 81 | ||
82 | int r, g, b; | 82 | int r, g, b; |
83 | c. rgb ( &r, &g, &b ); | 83 | c. rgb ( &r, &g, &b ); |
84 | 84 | ||
85 | int w = img. width ( ); | 85 | int w = img. width ( ); |
86 | int h = img. height ( ); | 86 | int h = img. height ( ); |
87 | 87 | ||
88 | int dx = w * 20 / 100; // 15% | 88 | int dx = w * 20 / 100; // 15% |
89 | int dy = h * 20 / 100; | 89 | int dy = h * 20 / 100; |
diff --git a/libopie/ocolorbutton.h b/libopie/ocolorbutton.h index ec04833..fe40fae 100644 --- a/libopie/ocolorbutton.h +++ b/libopie/ocolorbutton.h | |||
@@ -1,59 +1,59 @@ | |||
1 | /* | 1 | /* |
2 | =. This file is part of the OPIE Project | 2 | =. This file is part of the OPIE Project |
3 | .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> | 3 | .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> |
4 | .>+-= | 4 | .>+-= |
5 | _;:, .> :=|. This library is free software; you can | 5 | _;:, .> :=|. This library is free software; you can |
6 | .> <`_, > . <= redistribute it and/or modify it under | 6 | .> <`_, > . <= redistribute it and/or modify it under |
7 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | 7 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
8 | .="- .-=="i, .._ License as published by the Free Software | 8 | .="- .-=="i, .._ License as published by the Free Software |
9 | - . .-<_> .<> Foundation; either version 2 of the License, | 9 | - . .-<_> .<> Foundation; either version 2 of the License, |
10 | ._= =} : or (at your option) any later version. | 10 | ._= =} : or (at your option) any later version. |
11 | .%`+i> _;_. | 11 | .%`+i> _;_. |
12 | .i_,=:_. -<s. This library is distributed in the hope that | 12 | .i_,=:_. -<s. This library is distributed in the hope that |
13 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 13 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
14 | : .. .:, . . . without even the implied warranty of | 14 | : .. .:, . . . without even the implied warranty of |
15 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 15 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
16 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 16 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
17 | ..}^=.= = ; Library General Public License for more | 17 | ..}^=.= = ; Library General Public License for more |
18 | ++= -. .` .: details. | 18 | ++= -. .` .: details. |
19 | : = ...= . :.=- | 19 | : = ...= . :.=- |
20 | -. .:....=;==+<; You should have received a copy of the GNU | 20 | -. .:....=;==+<; You should have received a copy of the GNU |
21 | -_. . . )=. = Library General Public License along with | 21 | -_. . . )=. = Library General Public License along with |
22 | -- :-=` this library; see the file COPYING.LIB. | 22 | -- :-=` this library; see the file COPYING.LIB. |
23 | If not, write to the Free Software Foundation, | 23 | If not, write to the Free Software Foundation, |
24 | Inc., 59 Temple Place - Suite 330, | 24 | Inc., 59 Temple Place - Suite 330, |
25 | Boston, MA 02111-1307, USA. | 25 | Boston, MA 02111-1307, USA. |
26 | 26 | ||
27 | */ | 27 | */ |
28 | 28 | ||
29 | #ifndef __OPIE_OCOLORBUTTON_H__ | 29 | #ifndef __OPIE_OCOLORBUTTON_H__ |
30 | #define __OPIE_OCOLORBUTTON_H__ | 30 | #define __OPIE_OCOLORBUTTON_H__ |
31 | 31 | ||
32 | #include <qpushbutton.h> | 32 | #include <qpushbutton.h> |
33 | 33 | ||
34 | class OColorButtonPrivate; | 34 | class OColorButtonPrivate; |
35 | class QColor; | 35 | class QColor; |
36 | 36 | ||
37 | class OColorButton : public QPushButton { | 37 | class OColorButton : public QPushButton { |
38 | Q_OBJECT | 38 | Q_OBJECT |
39 | public: | 39 | public: |
40 | OColorButton ( QWidget *parent = 0, const char *name = 0 ); | 40 | OColorButton ( QWidget *parent = 0, const QColor & = black, const char *name = 0 ); |
41 | virtual ~OColorButton ( ); | 41 | virtual ~OColorButton ( ); |
42 | 42 | ||
43 | QColor color ( ) const; | 43 | QColor color ( ) const; |
44 | 44 | ||
45 | signals: | 45 | signals: |
46 | void colorSelected ( const QColor & ); | 46 | void colorSelected ( const QColor & ); |
47 | 47 | ||
48 | public slots: | 48 | public slots: |
49 | virtual void setColor ( const QColor & ); | 49 | virtual void setColor ( const QColor & ); |
50 | 50 | ||
51 | protected slots: | 51 | protected slots: |
52 | virtual void updateColor ( const QColor & ); | 52 | virtual void updateColor ( const QColor & ); |
53 | 53 | ||
54 | private: | 54 | private: |
55 | OColorButtonPrivate *d; | 55 | OColorButtonPrivate *d; |
56 | }; | 56 | }; |
57 | 57 | ||
58 | #endif | 58 | #endif |
59 | 59 | ||
diff --git a/noncore/settings/appearance2/editScheme.cpp b/noncore/settings/appearance2/editScheme.cpp index c2e5355..eefeccc 100644 --- a/noncore/settings/appearance2/editScheme.cpp +++ b/noncore/settings/appearance2/editScheme.cpp | |||
@@ -17,57 +17,56 @@ | |||
17 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General | 17 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General |
18 | ..}^=.= = ; Public License for more details. | 18 | ..}^=.= = ; Public License for more details. |
19 | ++= -. .` .: | 19 | ++= -. .` .: |
20 | : = ...= . :.=- You should have received a copy of the GNU | 20 | : = ...= . :.=- You should have received a copy of the GNU |
21 | -. .:....=;==+<; General Public License along with this file; | 21 | -. .:....=;==+<; General Public License along with this file; |
22 | -_. . . )=. = see the file COPYING. If not, write to the | 22 | -_. . . )=. = see the file COPYING. If not, write to the |
23 | -- :-=` Free Software Foundation, Inc., | 23 | -- :-=` Free Software Foundation, Inc., |
24 | 59 Temple Place - Suite 330, | 24 | 59 Temple Place - Suite 330, |
25 | Boston, MA 02111-1307, USA. | 25 | Boston, MA 02111-1307, USA. |
26 | 26 | ||
27 | */ | 27 | */ |
28 | 28 | ||
29 | #include "editScheme.h" | 29 | #include "editScheme.h" |
30 | 30 | ||
31 | #include <opie/ocolorbutton.h> | 31 | #include <opie/ocolorbutton.h> |
32 | 32 | ||
33 | #include <qaction.h> | 33 | #include <qaction.h> |
34 | #include <qlabel.h> | 34 | #include <qlabel.h> |
35 | #include <qlayout.h> | 35 | #include <qlayout.h> |
36 | #include <qpopupmenu.h> | 36 | #include <qpopupmenu.h> |
37 | #include <qscrollview.h> | 37 | #include <qscrollview.h> |
38 | #include <qtoolbutton.h> | 38 | #include <qtoolbutton.h> |
39 | 39 | ||
40 | EditScheme::EditScheme ( int cnt, const QString *labels, QColor *colors, QWidget* parent, const char* name, bool modal, WFlags fl ) | 40 | EditScheme::EditScheme ( int cnt, const QString *labels, QColor *colors, QWidget* parent, const char* name, bool modal, WFlags fl ) |
41 | : QDialog ( parent, name, modal, fl ) | 41 | : QDialog ( parent, name, modal, fl ) |
42 | { | 42 | { |
43 | setCaption ( tr( "Edit scheme" ) ); | 43 | setCaption ( tr( "Edit scheme" ) ); |
44 | QGridLayout *layout = new QGridLayout ( this, 0, 0, 4, 4 ); | 44 | QGridLayout *layout = new QGridLayout ( this, 0, 0, 4, 4 ); |
45 | 45 | ||
46 | m_count = cnt; | 46 | m_count = cnt; |
47 | m_buttons = new OColorButton * [cnt]; | 47 | m_buttons = new OColorButton * [cnt]; |
48 | m_colors = colors; | 48 | m_colors = colors; |
49 | 49 | ||
50 | for ( int i = 0; i < cnt; i++ ) | 50 | for ( int i = 0; i < cnt; i++ ) |
51 | { | 51 | { |
52 | QLabel *l = new QLabel ( labels [i], this ); | 52 | QLabel *l = new QLabel ( labels [i], this ); |
53 | layout-> addWidget ( l, i, 0 ); | 53 | layout-> addWidget ( l, i, 0 ); |
54 | 54 | ||
55 | m_buttons [i] = new OColorButton ( this ); | 55 | m_buttons [i] = new OColorButton ( this, colors [i] ); |
56 | m_buttons [i]-> setColor ( colors [i] ); | ||
57 | layout-> addWidget ( m_buttons [i], i, 1 ); | 56 | layout-> addWidget ( m_buttons [i], i, 1 ); |
58 | } | 57 | } |
59 | } | 58 | } |
60 | 59 | ||
61 | EditScheme::~EditScheme ( ) | 60 | EditScheme::~EditScheme ( ) |
62 | { | 61 | { |
63 | delete [] m_buttons; | 62 | delete [] m_buttons; |
64 | } | 63 | } |
65 | 64 | ||
66 | void EditScheme::accept ( ) | 65 | void EditScheme::accept ( ) |
67 | { | 66 | { |
68 | for ( int i = 0; i < m_count; i++ ) | 67 | for ( int i = 0; i < m_count; i++ ) |
69 | m_colors [i] = m_buttons [i]-> color ( ); | 68 | m_colors [i] = m_buttons [i]-> color ( ); |
70 | 69 | ||
71 | QDialog::accept ( ); | 70 | QDialog::accept ( ); |
72 | } | 71 | } |
73 | 72 | ||
diff --git a/noncore/styles/liquid/liquidset.cpp b/noncore/styles/liquid/liquidset.cpp index 255456c..7747da7 100644 --- a/noncore/styles/liquid/liquidset.cpp +++ b/noncore/styles/liquid/liquidset.cpp | |||
@@ -13,117 +13,115 @@ | |||
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | 20 | ||
21 | 21 | ||
22 | 22 | ||
23 | #include "liquidset.h" | 23 | #include "liquidset.h" |
24 | #include "liquid.h" | 24 | #include "liquid.h" |
25 | 25 | ||
26 | #include <qpe/qpeapplication.h> | 26 | #include <qpe/qpeapplication.h> |
27 | #include <qpe/global.h> | 27 | #include <qpe/global.h> |
28 | 28 | ||
29 | #include <qslider.h> | 29 | #include <qslider.h> |
30 | #include <qcombobox.h> | 30 | #include <qcombobox.h> |
31 | #include <qradiobutton.h> | 31 | #include <qradiobutton.h> |
32 | #include <qcheckbox.h> | 32 | #include <qcheckbox.h> |
33 | #include <qlabel.h> | 33 | #include <qlabel.h> |
34 | #include <qlayout.h> | 34 | #include <qlayout.h> |
35 | 35 | ||
36 | #include <qpe/config.h> | 36 | #include <qpe/config.h> |
37 | 37 | ||
38 | #include <opie/ocolorbutton.h> | 38 | #include <opie/ocolorbutton.h> |
39 | 39 | ||
40 | 40 | ||
41 | LiquidSettings::LiquidSettings ( QWidget* parent, const char *name, WFlags fl ) | 41 | LiquidSettings::LiquidSettings ( QWidget* parent, const char *name, WFlags fl ) |
42 | : QWidget ( parent, name, fl ) | 42 | : QWidget ( parent, name, fl ) |
43 | { | 43 | { |
44 | setCaption ( tr( "Liquid Style" ) ); | 44 | setCaption ( tr( "Liquid Style" ) ); |
45 | 45 | ||
46 | Config config ( "qpe" ); | 46 | Config config ( "qpe" ); |
47 | config. setGroup ( "Liquid-Style" ); | 47 | config. setGroup ( "Liquid-Style" ); |
48 | 48 | ||
49 | m_type = config. readNumEntry ( "Type", TransStippleBg ); | 49 | m_type = config. readNumEntry ( "Type", TransStippleBg ); |
50 | QColor mcol = QColor ( config. readEntry ( "Color", QApplication::palette ( ). active ( ). button ( ). name ( ))); | 50 | QColor mcol = QColor ( config. readEntry ( "Color", QApplication::palette ( ). active ( ). button ( ). name ( ))); |
51 | QColor tcol = QColor ( config. readEntry ( "TextColor", QApplication::palette ( ). active ( ). text ( ). name ( ))); | 51 | QColor tcol = QColor ( config. readEntry ( "TextColor", QApplication::palette ( ). active ( ). text ( ). name ( ))); |
52 | int opacity = config. readNumEntry ( "Opacity", 10 ); | 52 | int opacity = config. readNumEntry ( "Opacity", 10 ); |
53 | m_shadow = config. readBoolEntry ( "ShadowText", true ); | 53 | m_shadow = config. readBoolEntry ( "ShadowText", true ); |
54 | int contrast = config. readNumEntry ( "StippleContrast", 5 ); | 54 | int contrast = config. readNumEntry ( "StippleContrast", 5 ); |
55 | m_flat = config. readBoolEntry ( "FlatToolButtons", false ); | 55 | m_flat = config. readBoolEntry ( "FlatToolButtons", false ); |
56 | 56 | ||
57 | QVBoxLayout *vbox = new QVBoxLayout ( this ); | 57 | QVBoxLayout *vbox = new QVBoxLayout ( this ); |
58 | vbox-> setSpacing ( 3 ); | 58 | vbox-> setSpacing ( 3 ); |
59 | vbox-> setMargin ( 4 ); | 59 | vbox-> setMargin ( 4 ); |
60 | 60 | ||
61 | QComboBox *cb = new QComboBox ( this ); | 61 | QComboBox *cb = new QComboBox ( this ); |
62 | cb-> insertItem ( tr( "No translucency" ), None ); | 62 | cb-> insertItem ( tr( "No translucency" ), None ); |
63 | cb-> insertItem ( tr( "Stippled, background color" ), StippledBg ); | 63 | cb-> insertItem ( tr( "Stippled, background color" ), StippledBg ); |
64 | cb-> insertItem ( tr( "Stippled, button color" ), StippledBtn ); | 64 | cb-> insertItem ( tr( "Stippled, button color" ), StippledBtn ); |
65 | cb-> insertItem ( tr( "Translucent stippled, background color" ), TransStippleBg ); | 65 | cb-> insertItem ( tr( "Translucent stippled, background color" ), TransStippleBg ); |
66 | cb-> insertItem ( tr( "Translucent stippled, button color" ), TransStippleBtn ); | 66 | cb-> insertItem ( tr( "Translucent stippled, button color" ), TransStippleBtn ); |
67 | cb-> insertItem ( tr( "Custom translucency" ), Custom ); | 67 | cb-> insertItem ( tr( "Custom translucency" ), Custom ); |
68 | 68 | ||
69 | cb-> setCurrentItem ( m_type ); | 69 | cb-> setCurrentItem ( m_type ); |
70 | vbox-> addWidget ( cb ); | 70 | vbox-> addWidget ( cb ); |
71 | 71 | ||
72 | 72 | ||
73 | QGridLayout *grid = new QGridLayout ( vbox ); | 73 | QGridLayout *grid = new QGridLayout ( vbox ); |
74 | grid-> addColSpacing ( 0, 16 ); | 74 | grid-> addColSpacing ( 0, 16 ); |
75 | grid-> addColSpacing ( 3, 8 ); | 75 | grid-> addColSpacing ( 3, 8 ); |
76 | 76 | ||
77 | grid-> addWidget ( m_menulbl = new QLabel ( tr( "Menu color" ), this ), 0, 1 ); | 77 | grid-> addWidget ( m_menulbl = new QLabel ( tr( "Menu color" ), this ), 0, 1 ); |
78 | grid-> addWidget ( m_textlbl = new QLabel ( tr( "Text color" ), this ), 0, 4 ); | 78 | grid-> addWidget ( m_textlbl = new QLabel ( tr( "Text color" ), this ), 0, 4 ); |
79 | grid-> addWidget ( m_opaclbl = new QLabel ( tr( "Opacity" ), this ), 1, 1 ); | 79 | grid-> addWidget ( m_opaclbl = new QLabel ( tr( "Opacity" ), this ), 1, 1 ); |
80 | 80 | ||
81 | m_menubtn = new OColorButton ( this ); | 81 | m_menubtn = new OColorButton ( this, mcol ); |
82 | m_menubtn-> setColor ( mcol ); | ||
83 | grid-> addWidget ( m_menubtn, 0, 2 ); | 82 | grid-> addWidget ( m_menubtn, 0, 2 ); |
84 | 83 | ||
85 | m_textbtn = new OColorButton ( this ); | 84 | m_textbtn = new OColorButton ( this, tcol ); |
86 | m_textbtn-> setColor ( tcol ); | ||
87 | grid-> addWidget ( m_textbtn, 0, 5 ); | 85 | grid-> addWidget ( m_textbtn, 0, 5 ); |
88 | 86 | ||
89 | m_opacsld = new QSlider ( Horizontal, this ); | 87 | m_opacsld = new QSlider ( Horizontal, this ); |
90 | m_opacsld-> setRange ( -20, 20 ); | 88 | m_opacsld-> setRange ( -20, 20 ); |
91 | m_opacsld-> setSteps ( 1, 1 ); | 89 | m_opacsld-> setSteps ( 1, 1 ); |
92 | m_opacsld-> setValue ( opacity ); | 90 | m_opacsld-> setValue ( opacity ); |
93 | m_opacsld-> setTickmarks ( QSlider::Below ); | 91 | m_opacsld-> setTickmarks ( QSlider::Below ); |
94 | grid-> addMultiCellWidget ( m_opacsld, 1, 1, 2, 5 ); | 92 | grid-> addMultiCellWidget ( m_opacsld, 1, 1, 2, 5 ); |
95 | 93 | ||
96 | vbox-> addSpacing ( 4 ); | 94 | vbox-> addSpacing ( 4 ); |
97 | 95 | ||
98 | QCheckBox *shadow = new QCheckBox ( tr( "Use shadowed menu text" ), this ); | 96 | QCheckBox *shadow = new QCheckBox ( tr( "Use shadowed menu text" ), this ); |
99 | shadow-> setChecked ( m_shadow ); | 97 | shadow-> setChecked ( m_shadow ); |
100 | vbox-> addWidget ( shadow ); | 98 | vbox-> addWidget ( shadow ); |
101 | 99 | ||
102 | vbox-> addSpacing ( 4 ); | 100 | vbox-> addSpacing ( 4 ); |
103 | 101 | ||
104 | QCheckBox *flattb = new QCheckBox ( tr( "Make toolbar buttons appear flat" ), this ); | 102 | QCheckBox *flattb = new QCheckBox ( tr( "Make toolbar buttons appear flat" ), this ); |
105 | flattb-> setChecked ( m_flat ); | 103 | flattb-> setChecked ( m_flat ); |
106 | vbox-> addWidget ( flattb ); | 104 | vbox-> addWidget ( flattb ); |
107 | 105 | ||
108 | vbox-> addSpacing ( 4 ); | 106 | vbox-> addSpacing ( 4 ); |
109 | 107 | ||
110 | QHBoxLayout *hbox = new QHBoxLayout ( vbox ); | 108 | QHBoxLayout *hbox = new QHBoxLayout ( vbox ); |
111 | 109 | ||
112 | hbox-> addWidget ( new QLabel ( tr( "Stipple contrast" ), this )); | 110 | hbox-> addWidget ( new QLabel ( tr( "Stipple contrast" ), this )); |
113 | 111 | ||
114 | m_contsld = new QSlider ( Horizontal, this ); | 112 | m_contsld = new QSlider ( Horizontal, this ); |
115 | m_contsld-> setRange ( 0, 10 ); | 113 | m_contsld-> setRange ( 0, 10 ); |
116 | m_contsld-> setSteps ( 1, 1 ); | 114 | m_contsld-> setSteps ( 1, 1 ); |
117 | m_contsld-> setValue ( contrast ); | 115 | m_contsld-> setValue ( contrast ); |
118 | m_contsld-> setTickmarks ( QSlider::Below ); | 116 | m_contsld-> setTickmarks ( QSlider::Below ); |
119 | hbox-> addWidget ( m_contsld, 10 ); | 117 | hbox-> addWidget ( m_contsld, 10 ); |
120 | 118 | ||
121 | vbox-> addStretch ( 10 ); | 119 | vbox-> addStretch ( 10 ); |
122 | 120 | ||
123 | changeType ( m_type ); | 121 | changeType ( m_type ); |
124 | 122 | ||
125 | connect ( cb, SIGNAL( highlighted ( int ) ), this, SLOT( changeType ( int ) ) ); | 123 | connect ( cb, SIGNAL( highlighted ( int ) ), this, SLOT( changeType ( int ) ) ); |
126 | connect ( shadow, SIGNAL( toggled ( bool ) ), this, SLOT( changeShadow ( bool ) ) ); | 124 | connect ( shadow, SIGNAL( toggled ( bool ) ), this, SLOT( changeShadow ( bool ) ) ); |
127 | connect ( flattb, SIGNAL( toggled ( bool ) ), this, SLOT( changeFlat ( bool ) ) ); | 125 | connect ( flattb, SIGNAL( toggled ( bool ) ), this, SLOT( changeFlat ( bool ) ) ); |
128 | } | 126 | } |
129 | 127 | ||