summaryrefslogtreecommitdiff
path: root/libopie2/opieui/big-screen
Unidiff
Diffstat (limited to 'libopie2/opieui/big-screen') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opieui/big-screen/osplitter.cpp15
-rw-r--r--libopie2/opieui/big-screen/owidgetstack.cpp1
2 files changed, 0 insertions, 16 deletions
diff --git a/libopie2/opieui/big-screen/osplitter.cpp b/libopie2/opieui/big-screen/osplitter.cpp
index f50e7f0..78e919a 100644
--- a/libopie2/opieui/big-screen/osplitter.cpp
+++ b/libopie2/opieui/big-screen/osplitter.cpp
@@ -61,49 +61,48 @@ using namespace Opie::Ui::Internal;
61OSplitter::OSplitter( Orientation orient, QWidget* parent, const char* name, WFlags fl ) 61OSplitter::OSplitter( Orientation orient, QWidget* parent, const char* name, WFlags fl )
62 : QFrame( parent, name, fl ) 62 : QFrame( parent, name, fl )
63{ 63{
64 m_orient = orient; 64 m_orient = orient;
65 m_hbox = 0; 65 m_hbox = 0;
66 m_size_policy = 330; 66 m_size_policy = 330;
67 setFontPropagation( AllChildren ); 67 setFontPropagation( AllChildren );
68 setPalettePropagation( AllChildren ); 68 setPalettePropagation( AllChildren );
69 69
70 /* start by default with the tab widget */ 70 /* start by default with the tab widget */
71 m_tabWidget = 0; 71 m_tabWidget = 0;
72 m_parentTab = 0; 72 m_parentTab = 0;
73 changeTab(); 73 changeTab();
74 74
75} 75}
76 76
77 77
78/** 78/**
79 * Destructor destructs this object and cleans up. All child 79 * Destructor destructs this object and cleans up. All child
80 * widgets will be deleted 80 * widgets will be deleted
81 * @see addWidget 81 * @see addWidget
82 */ 82 */
83OSplitter::~OSplitter() 83OSplitter::~OSplitter()
84{ 84{
85 owarn << "Deleted Splitter" << oendl;
86 m_splitter.setAutoDelete( true ); 85 m_splitter.setAutoDelete( true );
87 m_splitter.clear(); 86 m_splitter.clear();
88 87
89 delete m_hbox; 88 delete m_hbox;
90 delete m_tabWidget; 89 delete m_tabWidget;
91} 90}
92 91
93 92
94/** 93/**
95 * Sets the label for the Splitter. This label will be used 94 * Sets the label for the Splitter. This label will be used
96 * if a parent splitter is arranged as TabWidget but 95 * if a parent splitter is arranged as TabWidget but
97 * this splitter is in fullscreen mode. Then a tab with OSplitter::label() 96 * this splitter is in fullscreen mode. Then a tab with OSplitter::label()
98 * and iconName() gets added. 97 * and iconName() gets added.
99 * 98 *
100 * @param name The name of the Label 99 * @param name The name of the Label
101 */ 100 */
102void OSplitter::setLabel( const QString& name ) 101void OSplitter::setLabel( const QString& name )
103{ 102{
104 m_name = name; 103 m_name = name;
105} 104}
106 105
107/** 106/**
108 * @see setLabel but this is for the icon retrieved by Resource 107 * @see setLabel but this is for the icon retrieved by Resource
109 * 108 *
@@ -189,52 +188,49 @@ void OSplitter::addWidget( OSplitter* split )
189 */ 188 */
190void OSplitter::removeWidget( OSplitter* split) 189void OSplitter::removeWidget( OSplitter* split)
191{ 190{
192 split->setTabWidget( 0 ); 191 split->setTabWidget( 0 );
193 split->reparent( 0, 0, QPoint(0, 0) ); 192 split->reparent( 0, 0, QPoint(0, 0) );
194} 193}
195 194
196/** 195/**
197 * Adds a widget to the Splitter. The widgets gets inserted 196 * Adds a widget to the Splitter. The widgets gets inserted
198 * at the end of either the Box or TabWidget. 197 * at the end of either the Box or TabWidget.
199 * Ownership gets transfered and the widgets gets reparented. 198 * Ownership gets transfered and the widgets gets reparented.
200 * Note: icon and label is only available on small screensizes 199 * Note: icon and label is only available on small screensizes
201 * if size is smaller than the mark 200 * if size is smaller than the mark
202 * Warning: No null checking of the widget is done. Only on debug 201 * Warning: No null checking of the widget is done. Only on debug
203 * a message will be outputtet 202 * a message will be outputtet
204 * 203 *
205 * @param wid The widget which will be added 204 * @param wid The widget which will be added
206 * @param icon The icon of the possible Tab 205 * @param icon The icon of the possible Tab
207 * @param label The label of the possible Tab 206 * @param label The label of the possible Tab
208 */ 207 */
209void OSplitter::addWidget( QWidget* wid, const QString& icon, const QString& label ) 208void OSplitter::addWidget( QWidget* wid, const QString& icon, const QString& label )
210{ 209{
211#ifdef DEBUG 210#ifdef DEBUG
212 if (!wid ) 211 if (!wid )
213 {
214 owarn << "Widget is not valid!" << oendl;
215 return; 212 return;
216 }
217#endif 213#endif
218 OSplitterContainer cont; 214 OSplitterContainer cont;
219 cont.widget = wid; 215 cont.widget = wid;
220 cont.icon =icon; 216 cont.icon =icon;
221 cont.name = label; 217 cont.name = label;
222 218
223 m_container.append( cont ); 219 m_container.append( cont );
224 220
225 /* 221 /*
226 * 222 *
227 */ 223 */
228 if (!m_splitter.isEmpty() && (m_tabWidget || m_parentTab ) ) 224 if (!m_splitter.isEmpty() && (m_tabWidget || m_parentTab ) )
229 setTabWidget( m_parentTab ); 225 setTabWidget( m_parentTab );
230 else 226 else
231 { 227 {
232 if (m_hbox ) 228 if (m_hbox )
233 addToBox( cont ); 229 addToBox( cont );
234 else 230 else
235 addToTab( cont ); 231 addToTab( cont );
236 } 232 }
237} 233}
238 234
239 235
240/** 236/**
@@ -346,68 +342,65 @@ QSize OSplitter::sizeHint()const
346 else 342 else
347 return m_tabWidget->sizeHint(); 343 return m_tabWidget->sizeHint();
348} 344}
349 345
350QSize OSplitter::minimumSizeHint()const 346QSize OSplitter::minimumSizeHint()const
351{ 347{
352 if (m_parentTab ) 348 if (m_parentTab )
353 return QFrame::minimumSizeHint(); 349 return QFrame::minimumSizeHint();
354 if (m_hbox) 350 if (m_hbox)
355 return m_hbox->sizeHint(); 351 return m_hbox->sizeHint();
356 else 352 else
357 return m_tabWidget->sizeHint(); 353 return m_tabWidget->sizeHint();
358} 354}
359#endif 355#endif
360 356
361/** 357/**
362 * @reimplemented for internal reasons 358 * @reimplemented for internal reasons
363 */ 359 */
364void OSplitter::resizeEvent( QResizeEvent* res ) 360void OSplitter::resizeEvent( QResizeEvent* res )
365{ 361{
366 QFrame::resizeEvent( res ); 362 QFrame::resizeEvent( res );
367 /* 363 /*
368 * 364 *
369 */ 365 */
370 // owarn << "Old size was width = " << res->oldSize().width() << " height = " << res->oldSize().height() << "" << oendl;
371 bool mode = true; 366 bool mode = true;
372 owarn << "New size is width = " << res->size().width() << " height = " << res->size().height() << " " << name() << "" << oendl;
373 if ( res->size().width() > m_size_policy && 367 if ( res->size().width() > m_size_policy &&
374 m_orient == Horizontal ) 368 m_orient == Horizontal )
375 { 369 {
376 changeHBox(); 370 changeHBox();
377 mode = false; 371 mode = false;
378 } 372 }
379 else if ( (res->size().width() <= m_size_policy && 373 else if ( (res->size().width() <= m_size_policy &&
380 m_orient == Horizontal ) || 374 m_orient == Horizontal ) ||
381 (res->size().height() <= m_size_policy && 375 (res->size().height() <= m_size_policy &&
382 m_orient == Vertical ) ) 376 m_orient == Vertical ) )
383 { 377 {
384 changeTab(); 378 changeTab();
385 } 379 }
386 else if ( res->size().height() > m_size_policy && 380 else if ( res->size().height() > m_size_policy &&
387 m_orient == Vertical ) 381 m_orient == Vertical )
388 { 382 {
389 owarn << "Changng to vbox " << name() << "" << oendl;
390 changeVBox(); 383 changeVBox();
391 mode = false; 384 mode = false;
392 } 385 }
393 386
394 emit sizeChanged(mode, m_orient ); 387 emit sizeChanged(mode, m_orient );
395} 388}
396 389
397/* 390/*
398 * Adds a container to a tab either the parent tab 391 * Adds a container to a tab either the parent tab
399 * or our own 392 * or our own
400 */ 393 */
401void OSplitter::addToTab( const Opie::Ui::Internal::OSplitterContainer& con ) 394void OSplitter::addToTab( const Opie::Ui::Internal::OSplitterContainer& con )
402{ 395{
403 QWidget *wid = con.widget; 396 QWidget *wid = con.widget;
404 // not needed widgetstack will reparent as well wid.reparent(m_tabWidget, wid->getWFlags(), QPoint(0, 0) ); 397 // not needed widgetstack will reparent as well wid.reparent(m_tabWidget, wid->getWFlags(), QPoint(0, 0) );
405 if (m_parentTab ) 398 if (m_parentTab )
406 m_parentTab->addTab( wid, con.icon, con.name ); 399 m_parentTab->addTab( wid, con.icon, con.name );
407 else 400 else
408 m_tabWidget->addTab( wid, con.icon, con.name ); 401 m_tabWidget->addTab( wid, con.icon, con.name );
409} 402}
410 403
411 404
412/* 405/*
413 * adds a container to the box 406 * adds a container to the box
@@ -424,164 +417,156 @@ void OSplitter::addToBox( const Opie::Ui::Internal::OSplitterContainer& con )
424 */ 417 */
425void OSplitter::removeFromTab( QWidget* wid ) 418void OSplitter::removeFromTab( QWidget* wid )
426{ 419{
427 if (m_parentTab ) 420 if (m_parentTab )
428 m_parentTab->removePage( wid ); 421 m_parentTab->removePage( wid );
429 else 422 else
430 m_tabWidget->removePage( wid ); 423 m_tabWidget->removePage( wid );
431} 424}
432 425
433/* 426/*
434 * switches over to a OTabWidget layout 427 * switches over to a OTabWidget layout
435 * it is recursive 428 * it is recursive
436 */ 429 */
437void OSplitter::changeTab() 430void OSplitter::changeTab()
438{ 431{
439 /* if we're the owner of the tab widget */ 432 /* if we're the owner of the tab widget */
440 if (m_tabWidget ) 433 if (m_tabWidget )
441 { 434 {
442 raise(); 435 raise();
443 show(); 436 show();
444 m_tabWidget->setGeometry( frameRect() ); 437 m_tabWidget->setGeometry( frameRect() );
445 return; 438 return;
446 } 439 }
447 440
448 owarn << " New Tab Widget " << name() << "" << oendl;
449 /* 441 /*
450 * and add all widgets this will reparent them 442 * and add all widgets this will reparent them
451 * delete m_hbox set it to 0 443 * delete m_hbox set it to 0
452 * 444 *
453 */ 445 */
454 OTabWidget *tab; 446 OTabWidget *tab;
455 if ( m_parentTab ) 447 if ( m_parentTab )
456 { 448 {
457 hide(); 449 hide();
458 tab = m_parentTab; 450 tab = m_parentTab;
459 /* expensive but needed cause we're called from setTabWidget and resizeEvent*/ 451 /* expensive but needed cause we're called from setTabWidget and resizeEvent*/
460 if (!m_container.isEmpty() ) 452 if (!m_container.isEmpty() )
461 { 453 {
462 ContainerList::Iterator it = m_container.begin(); 454 ContainerList::Iterator it = m_container.begin();
463 for (; it != m_container.end(); ++it ) 455 for (; it != m_container.end(); ++it )
464 m_parentTab->removePage( (*it).widget ); 456 m_parentTab->removePage( (*it).widget );
465 } 457 }
466 } 458 }
467 else 459 else
468 tab = m_tabWidget = new OTabWidget( this ); 460 tab = m_tabWidget = new OTabWidget( this );
469 461
470 connect(tab, SIGNAL(currentChanged(QWidget*) ), 462 connect(tab, SIGNAL(currentChanged(QWidget*) ),
471 this, SIGNAL(currentChanged(QWidget*) ) ); 463 this, SIGNAL(currentChanged(QWidget*) ) );
472 464
473 for ( ContainerList::Iterator it = m_container.begin(); it != m_container.end(); ++it ) 465 for ( ContainerList::Iterator it = m_container.begin(); it != m_container.end(); ++it )
474 { 466 {
475 owarn << "Widget is " << (*it).name << "" << oendl;
476 addToTab( (*it) ); 467 addToTab( (*it) );
477 } 468 }
478 469
479 for ( OSplitter* split = m_splitter.first(); split; split = m_splitter.next() ) 470 for ( OSplitter* split = m_splitter.first(); split; split = m_splitter.next() )
480 { 471 {
481 split->reparent(this, 0, QPoint(0, 0) ); 472 split->reparent(this, 0, QPoint(0, 0) );
482 split->setTabWidget( tab ); 473 split->setTabWidget( tab );
483 } 474 }
484 475
485 476
486 delete m_hbox; 477 delete m_hbox;
487 m_hbox = 0; 478 m_hbox = 0;
488 if (!m_tabWidget ) 479 if (!m_tabWidget )
489 return; 480 return;
490 481
491 m_tabWidget->setGeometry( frameRect() ); 482 m_tabWidget->setGeometry( frameRect() );
492 m_tabWidget->show(); 483 m_tabWidget->show();
493 484
494} 485}
495 486
496/* 487/*
497 * changes over to a box 488 * changes over to a box
498 * this is recursive as well 489 * this is recursive as well
499 */ 490 */
500void OSplitter::changeHBox() 491void OSplitter::changeHBox()
501{ 492{
502 if (m_hbox ) 493 if (m_hbox )
503 { 494 {
504 m_hbox->setGeometry( frameRect() ); 495 m_hbox->setGeometry( frameRect() );
505 return; 496 return;
506 } 497 }
507 498
508 owarn << "new HBox " << name() << "" << oendl;
509 m_hbox = new QHBox( this ); 499 m_hbox = new QHBox( this );
510 commonChangeBox(); 500 commonChangeBox();
511} 501}
512 502
513void OSplitter::changeVBox() 503void OSplitter::changeVBox()
514{ 504{
515 if (m_hbox ) 505 if (m_hbox )
516 { 506 {
517 m_hbox->setGeometry( frameRect() ); 507 m_hbox->setGeometry( frameRect() );
518 return; 508 return;
519 } 509 }
520 510
521 owarn << "New VBOX " << name() << "" << oendl;
522 m_hbox = new QVBox( this ); 511 m_hbox = new QVBox( this );
523 512
524 commonChangeBox(); 513 commonChangeBox();
525 514
526} 515}
527 516
528/* 517/*
529 * common box code 518 * common box code
530 * first remove and add children 519 * first remove and add children
531 * the other splitters 520 * the other splitters
532 * it is recursive as well due the call to setTabWidget 521 * it is recursive as well due the call to setTabWidget
533 */ 522 */
534void OSplitter::commonChangeBox() 523void OSplitter::commonChangeBox()
535{ 524{
536 owarn << " Name of Splitters is " << name() << "" << oendl;
537
538 for (ContainerList::Iterator it = m_container.begin(); it != m_container.end(); ++it ) 525 for (ContainerList::Iterator it = m_container.begin(); it != m_container.end(); ++it )
539 { 526 {
540 /* only if parent tab.. m_tabWidgets gets deleted and would do that as well */ 527 /* only if parent tab.. m_tabWidgets gets deleted and would do that as well */
541 if (m_parentTab ) 528 if (m_parentTab )
542 removeFromTab( (*it).widget ); 529 removeFromTab( (*it).widget );
543 owarn << "Adding to box " << (*it).name << "" << oendl;
544 addToBox( (*it) ); 530 addToBox( (*it) );
545 } 531 }
546 for ( OSplitter* split = m_splitter.first(); split; split = m_splitter.next() ) 532 for ( OSplitter* split = m_splitter.first(); split; split = m_splitter.next() )
547 { 533 {
548 /* tell them the world had changed */ 534 /* tell them the world had changed */
549 split->setTabWidget( 0 ); 535 split->setTabWidget( 0 );
550 OSplitterContainer con; 536 OSplitterContainer con;
551 con.widget = split; 537 con.widget = split;
552 // con.widget = split->m_tabWidget ? static_cast<QWidget*>(split->m_tabWidget) 538 // con.widget = split->m_tabWidget ? static_cast<QWidget*>(split->m_tabWidget)
553 // : static_cast<QWidget*>(split->m_hbox); 539 // : static_cast<QWidget*>(split->m_hbox);
554 addToBox( con ); 540 addToBox( con );
555 } 541 }
556 542
557 543
558 544
559 if (m_parentTab ) 545 if (m_parentTab )
560 m_parentTab->addTab(m_hbox, iconName(), label() ); 546 m_parentTab->addTab(m_hbox, iconName(), label() );
561 else 547 else
562 { 548 {
563 owarn << " setting Box geometry for " << name() << "" << oendl;
564 m_hbox->setGeometry( frameRect() ); 549 m_hbox->setGeometry( frameRect() );
565 m_hbox->show(); 550 m_hbox->show();
566 delete m_tabWidget; 551 delete m_tabWidget;
567 m_tabWidget = 0; 552 m_tabWidget = 0;
568 show(); // also show this widget 553 show(); // also show this widget
569 } 554 }
570} 555}
571 556
572/* 557/*
573 * sets the tabwidget, removes tabs, and relayouts the widget 558 * sets the tabwidget, removes tabs, and relayouts the widget
574 */ 559 */
575void OSplitter::setTabWidget( OTabWidget* wid) 560void OSplitter::setTabWidget( OTabWidget* wid)
576{ 561{
577 /* clean up cause m_parentTab will not be available for us */ 562 /* clean up cause m_parentTab will not be available for us */
578 if ( m_parentTab ) 563 if ( m_parentTab )
579 { 564 {
580 if (m_hbox ) 565 if (m_hbox )
581 m_parentTab->removePage( m_hbox ); 566 m_parentTab->removePage( m_hbox );
582 else if (!m_container.isEmpty() ) 567 else if (!m_container.isEmpty() )
583 { 568 {
584 ContainerList::Iterator it = m_container.begin(); 569 ContainerList::Iterator it = m_container.begin();
585 for ( ; it != m_container.end(); ++it ) 570 for ( ; it != m_container.end(); ++it )
586 m_parentTab->removePage( (*it).widget ); 571 m_parentTab->removePage( (*it).widget );
587 } 572 }
diff --git a/libopie2/opieui/big-screen/owidgetstack.cpp b/libopie2/opieui/big-screen/owidgetstack.cpp
index 9c9f7ec..b14a643 100644
--- a/libopie2/opieui/big-screen/owidgetstack.cpp
+++ b/libopie2/opieui/big-screen/owidgetstack.cpp
@@ -289,49 +289,48 @@ void OWidgetStack::raiseWidget( QWidget* wid) {
289 * Note that this method does not use visibleWIdget but remembers 289 * Note that this method does not use visibleWIdget but remembers
290 * the last raisedWidget 290 * the last raisedWidget
291 */ 291 */
292void OWidgetStack::hideWidget( int id) { 292void OWidgetStack::hideWidget( int id) {
293 /* hiding our main widget wouldn't be smart */ 293 /* hiding our main widget wouldn't be smart */
294 if ( m_mode == BigScreen && m_last != m_mWidget ) 294 if ( m_mode == BigScreen && m_last != m_mWidget )
295 m_last->hide(); 295 m_last->hide();
296 raiseWidget( id ); 296 raiseWidget( id );
297} 297}
298 298
299/** 299/**
300 * This is overloaded and only differs in the parameters 300 * This is overloaded and only differs in the parameters
301 * it takes. 301 * it takes.
302 */ 302 */
303void OWidgetStack::hideWidget( QWidget* wid) { 303void OWidgetStack::hideWidget( QWidget* wid) {
304 /* still not smart */ 304 /* still not smart */
305 if ( m_mode == BigScreen && m_last != m_mWidget ) 305 if ( m_mode == BigScreen && m_last != m_mWidget )
306 m_last->hide(); 306 m_last->hide();
307 307
308 raiseWidget( wid ); 308 raiseWidget( wid );
309} 309}
310 310
311 311
312bool OWidgetStack::eventFilter( QObject* obj, QEvent* e) { 312bool OWidgetStack::eventFilter( QObject* obj, QEvent* e) {
313 owarn << " " << obj->name() << " " << obj->className() << "" << oendl;
314 if ( e->type() == QEvent::Resize ) { 313 if ( e->type() == QEvent::Resize ) {
315 QResizeEvent *res = static_cast<QResizeEvent*>( e ); 314 QResizeEvent *res = static_cast<QResizeEvent*>( e );
316 QSize size = res->size(); 315 QSize size = res->size();
317 if ( size.width() >= mode_size ) 316 if ( size.width() >= mode_size )
318 switchTop(); 317 switchTop();
319 else 318 else
320 switchStack(); 319 switchStack();
321 } 320 }
322 return false; 321 return false;
323} 322}
324 323
325 324
326/** 325/**
327 * @internal_resons 326 * @internal_resons
328 */ 327 */
329void OWidgetStack::resizeEvent( QResizeEvent* ev ) { 328void OWidgetStack::resizeEvent( QResizeEvent* ev ) {
330 QFrame::resizeEvent( ev ); 329 QFrame::resizeEvent( ev );
331 if (m_mode == SmallScreen ) 330 if (m_mode == SmallScreen )
332 m_stack->setGeometry( frameRect() ); 331 m_stack->setGeometry( frameRect() );
333 else 332 else
334 if (m_mWidget ) 333 if (m_mWidget )
335 m_mWidget->setGeometry( frameRect() ); 334 m_mWidget->setGeometry( frameRect() );
336 335
337} 336}