summaryrefslogtreecommitdiff
path: root/libopie
Unidiff
Diffstat (limited to 'libopie') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/big-screen/osplitter.cpp7
-rw-r--r--libopie/big-screen/osplitter.h5
2 files changed, 7 insertions, 5 deletions
diff --git a/libopie/big-screen/osplitter.cpp b/libopie/big-screen/osplitter.cpp
index b09bc94..0c9ed6c 100644
--- a/libopie/big-screen/osplitter.cpp
+++ b/libopie/big-screen/osplitter.cpp
@@ -277,89 +277,89 @@ void OSplitter::setCurrentWidget( const QString& label ) {
277 for (it = m_container.begin(); it != m_container.end(); ++it ) { 277 for (it = m_container.begin(); it != m_container.end(); ++it ) {
278 if ( (*it).name == label ) { 278 if ( (*it).name == label ) {
279 setCurrentWidget( (*it).widget ); 279 setCurrentWidget( (*it).widget );
280 break; 280 break;
281 } 281 }
282 } 282 }
283} 283}
284 284
285/** 285/**
286 * This will only work when the TabWidget is active 286 * This will only work when the TabWidget is active
287 * If everything is visible this signal is kindly ignored 287 * If everything is visible this signal is kindly ignored
288 * @see OTabWidget::setCurrentTab(int) 288 * @see OTabWidget::setCurrentTab(int)
289 * 289 *
290 * @param tab The tab to make current 290 * @param tab The tab to make current
291 */ 291 */
292void OSplitter::setCurrentWidget( int tab ) { 292void OSplitter::setCurrentWidget( int tab ) {
293 if (m_tabWidget ) 293 if (m_tabWidget )
294 m_tabWidget->setCurrentTab( tab ); 294 m_tabWidget->setCurrentTab( tab );
295} 295}
296 296
297/** 297/**
298 * return the currently activated widget if in tab widget mode 298 * return the currently activated widget if in tab widget mode
299 * or null because all widgets are visible 299 * or null because all widgets are visible
300 */ 300 */
301QWidget* OSplitter::currentWidget() const{ 301QWidget* OSplitter::currentWidget() const{
302 if (m_tabWidget) 302 if (m_tabWidget)
303 return m_tabWidget->currentWidget(); 303 return m_tabWidget->currentWidget();
304 else if (m_parentTab ) 304 else if (m_parentTab )
305 return m_parentTab->currentWidget(); 305 return m_parentTab->currentWidget();
306 306
307 return 0l; 307 return 0l;
308} 308}
309 309/* wrong */
310 310#if 0
311/** 311/**
312 * @reimplented for internal reasons 312 * @reimplented for internal reasons
313 * returns the sizeHint of one of its sub widgets 313 * returns the sizeHint of one of its sub widgets
314 */ 314 */
315QSize OSplitter::sizeHint()const { 315QSize OSplitter::sizeHint()const {
316 if (m_parentTab ) 316 if (m_parentTab )
317 return QFrame::sizeHint(); 317 return QFrame::sizeHint();
318 318
319 if (m_hbox ) 319 if (m_hbox )
320 return m_hbox->sizeHint(); 320 return m_hbox->sizeHint();
321 else 321 else
322 return m_tabWidget->sizeHint(); 322 return m_tabWidget->sizeHint();
323} 323}
324 324
325QSize OSplitter::minimumSizeHint()const { 325QSize OSplitter::minimumSizeHint()const {
326 if (m_parentTab ) 326 if (m_parentTab )
327 return QFrame::minimumSizeHint(); 327 return QFrame::minimumSizeHint();
328 if (m_hbox) 328 if (m_hbox)
329 return m_hbox->sizeHint(); 329 return m_hbox->sizeHint();
330 else 330 else
331 return m_tabWidget->sizeHint(); 331 return m_tabWidget->sizeHint();
332} 332}
333 333#endif
334 334
335/** 335/**
336 * @reimplemented for internal reasons 336 * @reimplemented for internal reasons
337 */ 337 */
338void OSplitter::resizeEvent( QResizeEvent* res ) { 338void OSplitter::resizeEvent( QResizeEvent* res ) {
339 QFrame::resizeEvent( res ); 339 QFrame::resizeEvent( res );
340 /* 340 /*
341 * 341 *
342 */ 342 */
343// qWarning("Old size was width = %d height = %d", res->oldSize().width(), res->oldSize().height() ); 343// qWarning("Old size was width = %d height = %d", res->oldSize().width(), res->oldSize().height() );
344 bool mode = true; 344 bool mode = true;
345 qWarning("New size is width = %d height = %d %s", res->size().width(), res->size().height(), name() ); 345 qWarning("New size is width = %d height = %d %s", res->size().width(), res->size().height(), name() );
346 if ( res->size().width() > m_size_policy && 346 if ( res->size().width() > m_size_policy &&
347 m_orient == Horizontal ) { 347 m_orient == Horizontal ) {
348 changeHBox(); 348 changeHBox();
349 mode = false; 349 mode = false;
350 }else if ( (res->size().width() <= m_size_policy && 350 }else if ( (res->size().width() <= m_size_policy &&
351 m_orient == Horizontal ) || 351 m_orient == Horizontal ) ||
352 (res->size().height() <= m_size_policy && 352 (res->size().height() <= m_size_policy &&
353 m_orient == Vertical ) ) { 353 m_orient == Vertical ) ) {
354 changeTab(); 354 changeTab();
355 }else if ( res->size().height() > m_size_policy && 355 }else if ( res->size().height() > m_size_policy &&
356 m_orient == Vertical ) { 356 m_orient == Vertical ) {
357 qWarning("Changng to vbox %s", name() ); 357 qWarning("Changng to vbox %s", name() );
358 changeVBox(); 358 changeVBox();
359 mode = false; 359 mode = false;
360 } 360 }
361 361
362 emit sizeChanged(mode, m_orient ); 362 emit sizeChanged(mode, m_orient );
363} 363}
364 364
365/* 365/*
@@ -486,64 +486,65 @@ void OSplitter::changeVBox() {
486 * it is recursive as well due the call to setTabWidget 486 * it is recursive as well due the call to setTabWidget
487 */ 487 */
488void OSplitter::commonChangeBox() { 488void OSplitter::commonChangeBox() {
489 qWarning(" Name of Splitters is %s", name() ); 489 qWarning(" Name of Splitters is %s", name() );
490 490
491 for (ContainerList::Iterator it = m_container.begin(); it != m_container.end(); ++it ) { 491 for (ContainerList::Iterator it = m_container.begin(); it != m_container.end(); ++it ) {
492 /* only if parent tab.. m_tabWidgets gets deleted and would do that as well */ 492 /* only if parent tab.. m_tabWidgets gets deleted and would do that as well */
493 if (m_parentTab ) 493 if (m_parentTab )
494 removeFromTab( (*it).widget ); 494 removeFromTab( (*it).widget );
495 qWarning("Adding to box %s", (*it).name.latin1() ); 495 qWarning("Adding to box %s", (*it).name.latin1() );
496 addToBox( (*it) ); 496 addToBox( (*it) );
497 } 497 }
498 for ( OSplitter* split = m_splitter.first(); split; split = m_splitter.next() ) { 498 for ( OSplitter* split = m_splitter.first(); split; split = m_splitter.next() ) {
499 /* tell them the world had changed */ 499 /* tell them the world had changed */
500 split->setTabWidget( 0 ); 500 split->setTabWidget( 0 );
501 Opie::OSplitterContainer con; 501 Opie::OSplitterContainer con;
502 con.widget = split; 502 con.widget = split;
503// con.widget = split->m_tabWidget ? static_cast<QWidget*>(split->m_tabWidget) 503// con.widget = split->m_tabWidget ? static_cast<QWidget*>(split->m_tabWidget)
504// : static_cast<QWidget*>(split->m_hbox); 504// : static_cast<QWidget*>(split->m_hbox);
505 addToBox( con ); 505 addToBox( con );
506 } 506 }
507 507
508 508
509 509
510 if (m_parentTab ) 510 if (m_parentTab )
511 m_parentTab->addTab(m_hbox, iconName(), label() ); 511 m_parentTab->addTab(m_hbox, iconName(), label() );
512 else { 512 else {
513 qWarning(" setting Box geometry for %s", name() ); 513 qWarning(" setting Box geometry for %s", name() );
514 m_hbox->setGeometry( frameRect() ); 514 m_hbox->setGeometry( frameRect() );
515 m_hbox->show(); 515 m_hbox->show();
516 delete m_tabWidget; 516 delete m_tabWidget;
517 m_tabWidget = 0; 517 m_tabWidget = 0;
518 show(); // also show this widget
518 } 519 }
519} 520}
520 521
521/* 522/*
522 * sets the tabwidget, removes tabs, and relayouts the widget 523 * sets the tabwidget, removes tabs, and relayouts the widget
523 */ 524 */
524void OSplitter::setTabWidget( OTabWidget* wid) { 525void OSplitter::setTabWidget( OTabWidget* wid) {
525 /* clean up cause m_parentTab will not be available for us */ 526 /* clean up cause m_parentTab will not be available for us */
526 if ( m_parentTab ) { 527 if ( m_parentTab ) {
527 if (m_hbox ) 528 if (m_hbox )
528 m_parentTab->removePage( m_hbox ); 529 m_parentTab->removePage( m_hbox );
529 else if (!m_container.isEmpty() ){ 530 else if (!m_container.isEmpty() ){
530 ContainerList::Iterator it = m_container.begin(); 531 ContainerList::Iterator it = m_container.begin();
531 for ( ; it != m_container.end(); ++it ) 532 for ( ; it != m_container.end(); ++it )
532 m_parentTab->removePage( (*it).widget ); 533 m_parentTab->removePage( (*it).widget );
533 } 534 }
534 } 535 }
535 /* the parent Splitter changed so either make us indepent or dep */ 536 /* the parent Splitter changed so either make us indepent or dep */
536 537
537 m_parentTab = wid; 538 m_parentTab = wid;
538 539
539 QWidget *tab = m_tabWidget; 540 QWidget *tab = m_tabWidget;
540 QWidget *box = m_hbox; 541 QWidget *box = m_hbox;
541 m_hbox = 0; m_tabWidget = 0; 542 m_hbox = 0; m_tabWidget = 0;
542 543
543 if ( layoutMode() ) 544 if ( layoutMode() )
544 changeTab(); 545 changeTab();
545 else if (m_orient == Horizontal ) 546 else if (m_orient == Horizontal )
546 changeHBox(); 547 changeHBox();
547 else 548 else
548 changeVBox(); 549 changeVBox();
549 550
diff --git a/libopie/big-screen/osplitter.h b/libopie/big-screen/osplitter.h
index 33a085f..61a247b 100644
--- a/libopie/big-screen/osplitter.h
+++ b/libopie/big-screen/osplitter.h
@@ -62,83 +62,84 @@ class QHBox;
62 * 62 *
63 * @since 1.2 63 * @since 1.2
64 * 64 *
65 * @short a small dynamically changing its layout to store two or more widgets side by side 65 * @short a small dynamically changing its layout to store two or more widgets side by side
66 * @version 0.1 66 * @version 0.1
67 * @author zecke 67 * @author zecke
68 */ 68 */
69class OSplitter : public QFrame{ 69class OSplitter : public QFrame{
70 Q_OBJECT 70 Q_OBJECT
71public: 71public:
72 typedef QValueList<Opie::OSplitterContainer> ContainerList; 72 typedef QValueList<Opie::OSplitterContainer> ContainerList;
73 OSplitter( Qt::Orientation = Horizontal, QWidget *parent = 0, 73 OSplitter( Qt::Orientation = Horizontal, QWidget *parent = 0,
74 const char* name = 0, WFlags fl = 0 ); 74 const char* name = 0, WFlags fl = 0 );
75 ~OSplitter(); 75 ~OSplitter();
76 76
77 void setLabel( const QString& name ); 77 void setLabel( const QString& name );
78 void setIconName( const QString& name ); 78 void setIconName( const QString& name );
79 QString label()const; 79 QString label()const;
80 QString iconName()const; 80 QString iconName()const;
81 81
82 void setSizeChange( int width_height ); 82 void setSizeChange( int width_height );
83 83
84 void addWidget( OSplitter* splitter ); 84 void addWidget( OSplitter* splitter );
85 void addWidget( QWidget* wid, const QString& icon, const QString& label ); 85 void addWidget( QWidget* wid, const QString& icon, const QString& label );
86 void removeWidget( QWidget* ); 86 void removeWidget( QWidget* );
87 void removeWidget( OSplitter* ); 87 void removeWidget( OSplitter* );
88 88
89 void setCurrentWidget( QWidget* ); 89 void setCurrentWidget( QWidget* );
90 void setCurrentWidget( const QString& label ); 90 void setCurrentWidget( const QString& label );
91 void setCurrentWidget( int ); 91 void setCurrentWidget( int );
92 QWidget* currentWidget()const; 92 QWidget* currentWidget()const;
93 93
94
94signals: 95signals:
95 /** 96 /**
96 * Emitted if in tab and comes directly from the tab widget 97 * Emitted if in tab and comes directly from the tab widget
97 * 98 *
98 */ 99 */
99 void currentChanged( QWidget* ); 100 void currentChanged( QWidget* );
100 101
101 /** 102 /**
102 * emitted whenever a border is crossed 103 * emitted whenever a border is crossed
103 * true if in small screen mode 104 * true if in small screen mode
104 * false if in bigscreen 105 * false if in bigscreen
105 * this signal is emitted after the layout switch 106 * this signal is emitted after the layout switch
106 * @param b The layout mode 107 * @param b The layout mode
107 * @param ori The orientation 108 * @param ori The orientation
108 */ 109 */
109 void sizeChanged( bool b, Orientation ori); 110 void sizeChanged( bool b, Orientation ori);
110public: 111public:
111 QSize sizeHint()const; 112// QSize sizeHint()const;
112 QSize minimumSizeHint()const; 113// QSize minimumSizeHint()const;
113 114
114protected: 115protected:
115 void resizeEvent( QResizeEvent* ); 116 void resizeEvent( QResizeEvent* );
116 117
117private: 118private:
118 /* true if OTabMode */ 119 /* true if OTabMode */
119 bool layoutMode()const; 120 bool layoutMode()const;
120// void reparentAll(); 121// void reparentAll();
121 void setTabWidget( OTabWidget*); 122 void setTabWidget( OTabWidget*);
122 void addToTab( const Opie::OSplitterContainer& ); 123 void addToTab( const Opie::OSplitterContainer& );
123 void addToBox( const Opie::OSplitterContainer& ); 124 void addToBox( const Opie::OSplitterContainer& );
124 void removeFromTab( QWidget* ); 125 void removeFromTab( QWidget* );
125 void changeTab(); 126 void changeTab();
126 void changeHBox(); 127 void changeHBox();
127 void changeVBox(); 128 void changeVBox();
128 void commonChangeBox(); 129 void commonChangeBox();
129 QHBox *m_hbox; 130 QHBox *m_hbox;
130 OTabWidget *m_tabWidget; 131 OTabWidget *m_tabWidget;
131 OTabWidget *m_parentTab; 132 OTabWidget *m_parentTab;
132 Orientation m_orient; 133 Orientation m_orient;
133 int m_size_policy; 134 int m_size_policy;
134 135
135 ContainerList m_container; 136 ContainerList m_container;
136 QList<OSplitter> m_splitter; 137 QList<OSplitter> m_splitter;
137 138
138 QString m_icon, m_name; 139 QString m_icon, m_name;
139 140
140 struct Private; 141 struct Private;
141 Private *d; 142 Private *d;
142}; 143};
143 144
144 145