-rw-r--r-- | libopie2/opieui/big-screen/owidgetstack.cpp | 2 | ||||
-rw-r--r-- | libopie2/opieui/ofontselector.cpp | 1 | ||||
-rw-r--r-- | libopie2/opieui/olistview.cpp | 20 | ||||
-rw-r--r-- | libopie2/opieui/oselector.cpp | 2 | ||||
-rw-r--r-- | libopie2/opieui/owait.cpp | 1 |
5 files changed, 17 insertions, 9 deletions
diff --git a/libopie2/opieui/big-screen/owidgetstack.cpp b/libopie2/opieui/big-screen/owidgetstack.cpp index de7f83f..9c9f7ec 100644 --- a/libopie2/opieui/big-screen/owidgetstack.cpp +++ b/libopie2/opieui/big-screen/owidgetstack.cpp | |||
@@ -417,25 +417,25 @@ void OWidgetStack::switchTop() { | |||
417 | m_mWidget->setGeometry( frameRect() ); | 417 | m_mWidget->setGeometry( frameRect() ); |
418 | return; | 418 | return; |
419 | }else if (!m_stack) | 419 | }else if (!m_stack) |
420 | return; | 420 | return; |
421 | 421 | ||
422 | if (!m_list.isEmpty() ) { | 422 | if (!m_list.isEmpty() ) { |
423 | QMap<int, QWidget*>::Iterator it = m_list.begin(); | 423 | QMap<int, QWidget*>::Iterator it = m_list.begin(); |
424 | for ( ; it != m_list.end(); ++it ) { | 424 | for ( ; it != m_list.end(); ++it ) { |
425 | /* better than reparenting twice */ | 425 | /* better than reparenting twice */ |
426 | if ( it.data() == m_mWidget ) { | 426 | if ( it.data() == m_mWidget ) { |
427 | m_mWidget->reparent(this, 0, frameRect().topLeft() ); | 427 | m_mWidget->reparent(this, 0, frameRect().topLeft() ); |
428 | m_mWidget->setGeometry( frameRect() ); | 428 | m_mWidget->setGeometry( frameRect() ); |
429 | m_mWidget->show(); | 429 | m_mWidget->show(); |
430 | }else | 430 | }else |
431 | /* ### FIXME we need to place the widget better */ | 431 | /* ### FIXME we need to place the widget better */ |
432 | it.data()->reparent(0, WType_TopLevel, QPoint(10, 10) ); | 432 | it.data()->reparent(0, WType_TopLevel, QPoint(10, 10) ); |
433 | } | 433 | } |
434 | } | 434 | } |
435 | 435 | ||
436 | delete m_stack; | 436 | delete m_stack; |
437 | m_stack = 0; | 437 | m_stack = 0; |
438 | } | 438 | } |
439 | 439 | ||
440 | } | 440 | } |
441 | } \ No newline at end of file | 441 | } |
diff --git a/libopie2/opieui/ofontselector.cpp b/libopie2/opieui/ofontselector.cpp index 6763ee6..4870cd9 100644 --- a/libopie2/opieui/ofontselector.cpp +++ b/libopie2/opieui/ofontselector.cpp | |||
@@ -172,48 +172,49 @@ OFontSelector::~OFontSelector() | |||
172 | { | 172 | { |
173 | delete d; | 173 | delete d; |
174 | } | 174 | } |
175 | 175 | ||
176 | /** | 176 | /** |
177 | * This methods tries to set the font | 177 | * This methods tries to set the font |
178 | * @param f The wishes font | 178 | * @param f The wishes font |
179 | * @return success or failure | 179 | * @return success or failure |
180 | */ | 180 | */ |
181 | bool OFontSelector::setSelectedFont ( const QFont &f ) | 181 | bool OFontSelector::setSelectedFont ( const QFont &f ) |
182 | { | 182 | { |
183 | return setSelectedFont ( f. family(), d->m_fdb. styleString ( f ), f. pointSize(), QFont::encodingName ( f. charSet())); | 183 | return setSelectedFont ( f. family(), d->m_fdb. styleString ( f ), f. pointSize(), QFont::encodingName ( f. charSet())); |
184 | } | 184 | } |
185 | 185 | ||
186 | 186 | ||
187 | /** | 187 | /** |
188 | * This is an overloaded method @see setSelectedFont | 188 | * This is an overloaded method @see setSelectedFont |
189 | * @param familyStr The family of the font | 189 | * @param familyStr The family of the font |
190 | * @param styleStr The style of the font | 190 | * @param styleStr The style of the font |
191 | * @param sizeVal The size of font | 191 | * @param sizeVal The size of font |
192 | * @param charset The charset to be used. Will be deprecated by QT3 | 192 | * @param charset The charset to be used. Will be deprecated by QT3 |
193 | */ | 193 | */ |
194 | bool OFontSelector::setSelectedFont( const QString &familyStr, const QString &styleStr, int sizeVal, const QString & charset ) | 194 | bool OFontSelector::setSelectedFont( const QString &familyStr, const QString &styleStr, int sizeVal, const QString & charset ) |
195 | { | 195 | { |
196 | Q_CONST_UNUSED( charset ) | ||
196 | QString sizeStr = QString::number ( sizeVal ); | 197 | QString sizeStr = QString::number ( sizeVal ); |
197 | 198 | ||
198 | QListBoxItem *family = d->m_font_family_list->findItem ( familyStr ); | 199 | QListBoxItem *family = d->m_font_family_list->findItem ( familyStr ); |
199 | if ( !family ) | 200 | if ( !family ) |
200 | family = d->m_font_family_list->findItem ( "Helvetica" ); | 201 | family = d->m_font_family_list->findItem ( "Helvetica" ); |
201 | if ( !family ) | 202 | if ( !family ) |
202 | family = d->m_font_family_list->firstItem(); | 203 | family = d->m_font_family_list->firstItem(); |
203 | d->m_font_family_list->setCurrentItem ( family ); | 204 | d->m_font_family_list->setCurrentItem ( family ); |
204 | fontFamilyClicked ( d->m_font_family_list->index ( family )); | 205 | fontFamilyClicked ( d->m_font_family_list->index ( family )); |
205 | 206 | ||
206 | int style = findItemCB ( d->m_font_style_list, styleStr ); | 207 | int style = findItemCB ( d->m_font_style_list, styleStr ); |
207 | if ( style < 0 ) | 208 | if ( style < 0 ) |
208 | style = findItemCB ( d->m_font_style_list, "Regular" ); | 209 | style = findItemCB ( d->m_font_style_list, "Regular" ); |
209 | if ( style < 0 && d->m_font_style_list->count() > 0 ) | 210 | if ( style < 0 && d->m_font_style_list->count() > 0 ) |
210 | style = 0; | 211 | style = 0; |
211 | d->m_font_style_list->setCurrentItem ( style ); | 212 | d->m_font_style_list->setCurrentItem ( style ); |
212 | fontStyleClicked ( style ); | 213 | fontStyleClicked ( style ); |
213 | 214 | ||
214 | int size = findItemCB ( d->m_font_size_list, sizeStr ); | 215 | int size = findItemCB ( d->m_font_size_list, sizeStr ); |
215 | if ( size < 0 ) | 216 | if ( size < 0 ) |
216 | size = findItemCB ( d->m_font_size_list, "10" ); | 217 | size = findItemCB ( d->m_font_size_list, "10" ); |
217 | if ( size < 0 && d->m_font_size_list->count() > 0 ) | 218 | if ( size < 0 && d->m_font_size_list->count() > 0 ) |
218 | size = 0; | 219 | size = 0; |
219 | d->m_font_size_list->setCurrentItem ( size ); | 220 | d->m_font_size_list->setCurrentItem ( size ); |
diff --git a/libopie2/opieui/olistview.cpp b/libopie2/opieui/olistview.cpp index b90c786..67b4b83 100644 --- a/libopie2/opieui/olistview.cpp +++ b/libopie2/opieui/olistview.cpp | |||
@@ -166,98 +166,100 @@ void OListView::serializeTo( QDataStream& s ) const | |||
166 | for ( int i = 0; i < items; ++i ) | 166 | for ( int i = 0; i < items; ++i ) |
167 | { | 167 | { |
168 | s << *static_cast<OListViewItem*>( item ); | 168 | s << *static_cast<OListViewItem*>( item ); |
169 | item = item->nextSibling(); | 169 | item = item->nextSibling(); |
170 | } | 170 | } |
171 | 171 | ||
172 | odebug << "OListview stored." << oendl; | 172 | odebug << "OListview stored." << oendl; |
173 | } | 173 | } |
174 | 174 | ||
175 | void OListView::serializeFrom( QDataStream& s ) | 175 | void OListView::serializeFrom( QDataStream& s ) |
176 | { | 176 | { |
177 | #warning Caution... the binary format is still under construction... | 177 | #warning Caution... the binary format is still under construction... |
178 | odebug << "loading OListView..." << oendl; | 178 | odebug << "loading OListView..." << oendl; |
179 | 179 | ||
180 | int cols; | 180 | int cols; |
181 | s >> cols; | 181 | s >> cols; |
182 | odebug << "read number of columns = " << cols << oendl; | 182 | odebug << "read number of columns = " << cols << oendl; |
183 | 183 | ||
184 | while ( columns() < cols ) addColumn( QString::null ); | 184 | while ( columns() < cols ) addColumn( QString::null ); |
185 | 185 | ||
186 | for ( int i = 0; i < cols; ++i ) | 186 | for ( int i = 0; i < cols; ++i ) |
187 | { | 187 | { |
188 | QString coltext; | 188 | QString coltext; |
189 | s >> coltext; | 189 | s >> coltext; |
190 | odebug << "read text '" << coltext << "' for column " << i << "" << oendl; | 190 | odebug << "read text '" << coltext << "' for column " << i << "" << oendl; |
191 | setColumnText( i, coltext ); | 191 | setColumnText( i, coltext ); |
192 | } | 192 | } |
193 | 193 | ||
194 | int items; | 194 | int items; |
195 | s >> items; | 195 | s >> items; |
196 | odebug << "read number of items = " << items << oendl; | 196 | odebug << "read number of items = " << items << oendl; |
197 | 197 | ||
198 | for ( int i = 0; i < items; ++i ) | 198 | for ( int i = 0; i < items; ++i ) |
199 | { | 199 | { |
200 | OListViewItem* item = childFactory(); | 200 | OListViewItem* item = childFactory(); |
201 | s >> *item; | 201 | s >> *item; |
202 | } | 202 | } |
203 | 203 | ||
204 | odebug << "OListView loaded." << oendl; | 204 | odebug << "OListView loaded." << oendl; |
205 | 205 | ||
206 | } | 206 | } |
207 | 207 | ||
208 | 208 | ||
209 | void OListView::expand() | 209 | void OListView::expand() |
210 | { | 210 | { |
211 | odebug << "OListView::expand" << oendl; | 211 | odebug << "OListView::expand" << oendl; |
212 | 212 | ||
213 | QListViewItemIterator it( this ); | 213 | QListViewItemIterator it( this ); |
214 | while ( it.current() ) { | 214 | while ( it.current() ) { |
215 | it.current()->setOpen( true ); | 215 | it.current()->setOpen( true ); |
216 | ++it; | 216 | ++it; |
217 | } | 217 | } |
218 | } | 218 | } |
219 | 219 | ||
220 | 220 | ||
221 | void OListView::collapse() | 221 | void OListView::collapse() |
222 | { | 222 | { |
223 | odebug << "OListView::collapse" << oendl; | 223 | odebug << "OListView::collapse" << oendl; |
224 | QListViewItemIterator it( this ); | 224 | QListViewItemIterator it( this ); |
225 | while ( it.current() ) { | 225 | while ( it.current() ) { |
226 | it.current()->setOpen( false ); | 226 | it.current()->setOpen( false ); |
227 | ++it; | 227 | ++it; |
228 | } | 228 | } |
229 | } | 229 | } |
230 | 230 | ||
231 | 231 | ||
232 | QDataStream& operator<<( QDataStream& s, const OListView& lv ) | 232 | QDataStream& operator<<( QDataStream& s, const OListView& lv ) |
233 | { | 233 | { |
234 | lv.serializeTo( s ); | 234 | lv.serializeTo( s ); |
235 | return s; | ||
235 | } | 236 | } |
236 | 237 | ||
237 | QDataStream& operator>>( QDataStream& s, OListView& lv ) | 238 | QDataStream& operator>>( QDataStream& s, OListView& lv ) |
238 | { | 239 | { |
239 | lv.serializeFrom( s ); | 240 | lv.serializeFrom( s ); |
241 | return s; | ||
240 | } | 242 | } |
241 | #endif // QT_NO_DATASTREAM | 243 | #endif // QT_NO_DATASTREAM |
242 | 244 | ||
243 | /*====================================================================================== | 245 | /*====================================================================================== |
244 | * OListViewItem | 246 | * OListViewItem |
245 | *======================================================================================*/ | 247 | *======================================================================================*/ |
246 | 248 | ||
247 | OListViewItem::OListViewItem(QListView *parent) | 249 | OListViewItem::OListViewItem(QListView *parent) |
248 | : QListViewItem(parent) | 250 | : QListViewItem(parent) |
249 | { | 251 | { |
250 | init(); | 252 | init(); |
251 | } | 253 | } |
252 | 254 | ||
253 | 255 | ||
254 | OListViewItem::OListViewItem(QListViewItem *parent) | 256 | OListViewItem::OListViewItem(QListViewItem *parent) |
255 | : QListViewItem(parent) | 257 | : QListViewItem(parent) |
256 | { | 258 | { |
257 | init(); | 259 | init(); |
258 | } | 260 | } |
259 | 261 | ||
260 | 262 | ||
261 | OListViewItem::OListViewItem(QListView *parent, QListViewItem *after) | 263 | OListViewItem::OListViewItem(QListView *parent, QListViewItem *after) |
262 | : QListViewItem(parent, after) | 264 | : QListViewItem(parent, after) |
263 | { | 265 | { |
@@ -421,75 +423,77 @@ void OListViewItem::serializeTo( QDataStream& s ) const | |||
421 | } | 423 | } |
422 | 424 | ||
423 | // store number of items and the items itself | 425 | // store number of items and the items itself |
424 | s << items; | 426 | s << items; |
425 | item = firstChild(); | 427 | item = firstChild(); |
426 | for ( int i = 0; i < items; ++i ) | 428 | for ( int i = 0; i < items; ++i ) |
427 | { | 429 | { |
428 | s << *static_cast<OListViewItem*>( item ); | 430 | s << *static_cast<OListViewItem*>( item ); |
429 | item = item->nextSibling(); | 431 | item = item->nextSibling(); |
430 | } | 432 | } |
431 | 433 | ||
432 | odebug << "OListviewItem stored." << oendl; | 434 | odebug << "OListviewItem stored." << oendl; |
433 | } | 435 | } |
434 | 436 | ||
435 | 437 | ||
436 | void OListViewItem::serializeFrom( QDataStream& s ) | 438 | void OListViewItem::serializeFrom( QDataStream& s ) |
437 | { | 439 | { |
438 | #warning Caution... the binary format is still under construction... | 440 | #warning Caution... the binary format is still under construction... |
439 | odebug << "loading OListViewItem..." << oendl; | 441 | odebug << "loading OListViewItem..." << oendl; |
440 | 442 | ||
441 | for ( int i = 0; i < listView()->columns(); ++i ) | 443 | for ( int i = 0; i < listView()->columns(); ++i ) |
442 | { | 444 | { |
443 | QString coltext; | 445 | QString coltext; |
444 | s >> coltext; | 446 | s >> coltext; |
445 | odebug << "read text '" << coltext << "' for column " << i << "" << oendl; | 447 | odebug << "read text '" << coltext << "' for column " << i << "" << oendl; |
446 | setText( i, coltext ); | 448 | setText( i, coltext ); |
447 | } | 449 | } |
448 | 450 | ||
449 | int items; | 451 | int items; |
450 | s >> items; | 452 | s >> items; |
451 | odebug << "read number of items = " << items << "" << oendl; | 453 | odebug << "read number of items = " << items << "" << oendl; |
452 | 454 | ||
453 | for ( int i = 0; i < items; ++i ) | 455 | for ( int i = 0; i < items; ++i ) |
454 | { | 456 | { |
455 | OListViewItem* item = childFactory(); | 457 | OListViewItem* item = childFactory(); |
456 | s >> (*item); | 458 | s >> (*item); |
457 | } | 459 | } |
458 | 460 | ||
459 | odebug << "OListViewItem loaded." << oendl; | 461 | odebug << "OListViewItem loaded." << oendl; |
460 | } | 462 | } |
461 | 463 | ||
462 | 464 | ||
463 | QDataStream& operator<<( QDataStream& s, const OListViewItem& lvi ) | 465 | QDataStream& operator<<( QDataStream& s, const OListViewItem& lvi ) |
464 | { | 466 | { |
465 | lvi.serializeTo( s ); | 467 | lvi.serializeTo( s ); |
468 | return s; | ||
466 | } | 469 | } |
467 | 470 | ||
468 | 471 | ||
469 | QDataStream& operator>>( QDataStream& s, OListViewItem& lvi ) | 472 | QDataStream& operator>>( QDataStream& s, OListViewItem& lvi ) |
470 | { | 473 | { |
471 | lvi.serializeFrom( s ); | 474 | lvi.serializeFrom( s ); |
475 | return s; | ||
472 | } | 476 | } |
473 | #endif // QT_NO_DATASTREAM | 477 | #endif // QT_NO_DATASTREAM |
474 | 478 | ||
475 | 479 | ||
476 | /*====================================================================================== | 480 | /*====================================================================================== |
477 | * OCheckListItem | 481 | * OCheckListItem |
478 | *======================================================================================*/ | 482 | *======================================================================================*/ |
479 | 483 | ||
480 | OCheckListItem::OCheckListItem( QCheckListItem* parent, const QString& text, Type t ) | 484 | OCheckListItem::OCheckListItem( QCheckListItem* parent, const QString& text, Type t ) |
481 | :QCheckListItem( parent, text, t ) | 485 | :QCheckListItem( parent, text, t ) |
482 | { | 486 | { |
483 | init(); | 487 | init(); |
484 | } | 488 | } |
485 | 489 | ||
486 | 490 | ||
487 | OCheckListItem::OCheckListItem( QListViewItem* parent, const QString& text, Type t) | 491 | OCheckListItem::OCheckListItem( QListViewItem* parent, const QString& text, Type t) |
488 | :QCheckListItem( parent, text, t ) | 492 | :QCheckListItem( parent, text, t ) |
489 | { | 493 | { |
490 | init(); | 494 | init(); |
491 | } | 495 | } |
492 | 496 | ||
493 | 497 | ||
494 | OCheckListItem::OCheckListItem( QListView* parent, const QString& text, Type t ) | 498 | OCheckListItem::OCheckListItem( QListView* parent, const QString& text, Type t ) |
495 | :QCheckListItem( parent, text, t ) | 499 | :QCheckListItem( parent, text, t ) |
@@ -594,82 +598,82 @@ void OCheckListItem::paintCell(QPainter *p, const QColorGroup &cg, int column, i | |||
594 | p->setPen( pen ); | 598 | p->setPen( pen ); |
595 | p->drawLine( width-1, 0, width-1, height() ); | 599 | p->drawLine( width-1, 0, width-1, height() ); |
596 | } | 600 | } |
597 | 601 | ||
598 | 602 | ||
599 | /*====================================================================================== | 603 | /*====================================================================================== |
600 | * ONamedListView | 604 | * ONamedListView |
601 | *======================================================================================*/ | 605 | *======================================================================================*/ |
602 | 606 | ||
603 | ONamedListView::ONamedListView( QWidget *parent, const char *name ) | 607 | ONamedListView::ONamedListView( QWidget *parent, const char *name ) |
604 | :OListView( parent, name ) | 608 | :OListView( parent, name ) |
605 | { | 609 | { |
606 | } | 610 | } |
607 | 611 | ||
608 | 612 | ||
609 | ONamedListView::~ONamedListView() | 613 | ONamedListView::~ONamedListView() |
610 | { | 614 | { |
611 | } | 615 | } |
612 | 616 | ||
613 | 617 | ||
614 | void ONamedListView::addColumns( const QStringList& columns ) | 618 | void ONamedListView::addColumns( const QStringList& columns ) |
615 | { | 619 | { |
616 | for ( QStringList::ConstIterator it = columns.begin(); it != columns.end(); ++it ) | 620 | for ( QStringList::ConstIterator it = columns.begin(); it != columns.end(); ++it ) |
617 | { | 621 | { |
618 | odebug << "adding column " << *it << "" << oendl; | 622 | odebug << "adding column " << *it << "" << oendl; |
619 | addColumn( *it ); | 623 | addColumn( *it ); |
620 | } | 624 | } |
621 | } | 625 | } |
622 | 626 | ||
623 | 627 | ||
624 | int ONamedListView::findColumn( const QString& text ) const | 628 | int ONamedListView::findColumn( const QString& text ) const |
625 | { | 629 | { |
626 | //FIXME: If used excessively, this will slow down performance of updates | 630 | //FIXME: If used excessively, this will slow down performance of updates |
627 | //FIXME: because of the linear search over all column texts. | 631 | //FIXME: because of the linear search over all column texts. |
628 | //FIXME: I will optimize later by using a hash map. | 632 | //FIXME: I will optimize later by using a hash map. |
629 | for ( int i = 0; i < columns(); ++i ) | 633 | for ( int i = 0; i < columns(); ++i ) |
630 | if ( columnText( i ) == text ) | 634 | if ( columnText( i ) == text ) |
631 | return i; | 635 | return i; |
632 | return -1; | 636 | return -1; |
633 | } | 637 | } |
634 | 638 | ||
635 | 639 | ||
636 | ONamedListViewItem* ONamedListView::find( int column, const QString& text, int recurse ) const | 640 | ONamedListViewItem* ONamedListView::find( int column, const QString& text, int recurse ) const |
637 | { | 641 | { |
638 | return find( (ONamedListViewItem*) firstChild(), column, text, recurse ); | 642 | return find( (ONamedListViewItem*) firstChild(), column, text, recurse ); |
639 | } | 643 | } |
640 | 644 | ||
641 | 645 | ||
642 | ONamedListViewItem* ONamedListView::find( ONamedListViewItem* item, int column, const QString& text, int recurse ) const | 646 | ONamedListViewItem* ONamedListView::find( ONamedListViewItem* item, int column, const QString& text, int recurse ) const |
643 | { | 647 | { |
644 | ONamedListViewItem* result; | 648 | ONamedListViewItem* result; |
645 | while ( item && item->text( column ) != text ) | 649 | while ( item && item->text( column ) != text ) |
646 | { | 650 | { |
647 | odebug << "checked " << item->text( column ) << "" << oendl; | 651 | odebug << "checked " << item->text( column ) << "" << oendl; |
648 | 652 | ||
649 | if ( recurse < 0 || recurse > 0 ) | 653 | if ( recurse < 0 || recurse > 0 ) |
650 | { | 654 | { |
651 | odebug << "recursion is " << recurse << " - recursing into..." << oendl; | 655 | odebug << "recursion is " << recurse << " - recursing into..." << oendl; |
652 | result = find( (ONamedListViewItem*) item->firstChild(), column, text, recurse-1 ); | 656 | result = find( (ONamedListViewItem*) item->firstChild(), column, text, recurse-1 ); |
653 | if ( result ) return result; | 657 | if ( result ) return result; |
654 | } | 658 | } |
655 | 659 | ||
656 | 660 | ||
657 | item = (ONamedListViewItem*) item->itemBelow(); | 661 | item = (ONamedListViewItem*) item->itemBelow(); |
658 | } | 662 | } |
659 | if ( item && item->text( column ) == text ) | 663 | if ( item && item->text( column ) == text ) |
660 | return item; | 664 | return item; |
661 | else | 665 | else |
662 | return 0; | 666 | return 0; |
663 | } | 667 | } |
664 | 668 | ||
665 | 669 | ||
666 | ONamedListViewItem* ONamedListView::find( const QString& column, const QString& text, int recurse ) const | 670 | ONamedListViewItem* ONamedListView::find( const QString& column, const QString& text, int recurse ) const |
667 | { | 671 | { |
668 | int col = findColumn( column ); | 672 | int col = findColumn( column ); |
669 | if ( col != -1 ) | 673 | if ( col != -1 ) |
670 | return find( (ONamedListViewItem*) firstChild(), col, text, recurse ); | 674 | return find( (ONamedListViewItem*) firstChild(), col, text, recurse ); |
671 | else | 675 | else |
672 | return 0; | 676 | return 0; |
673 | } | 677 | } |
674 | 678 | ||
675 | 679 | ||
@@ -704,61 +708,61 @@ ONamedListViewItem::ONamedListViewItem( QListViewItem* parent, const QStringList | |||
704 | ONamedListViewItem::ONamedListViewItem( QListView* parent, QListViewItem* after, const QStringList& texts ) | 708 | ONamedListViewItem::ONamedListViewItem( QListView* parent, QListViewItem* after, const QStringList& texts ) |
705 | :OListViewItem( parent, after ) | 709 | :OListViewItem( parent, after ) |
706 | { | 710 | { |
707 | setText( texts ); | 711 | setText( texts ); |
708 | } | 712 | } |
709 | 713 | ||
710 | 714 | ||
711 | ONamedListViewItem::ONamedListViewItem( QListViewItem* parent, QListViewItem* after, const QStringList& texts ) | 715 | ONamedListViewItem::ONamedListViewItem( QListViewItem* parent, QListViewItem* after, const QStringList& texts ) |
712 | :OListViewItem( parent, after ) | 716 | :OListViewItem( parent, after ) |
713 | { | 717 | { |
714 | setText( texts ); | 718 | setText( texts ); |
715 | } | 719 | } |
716 | 720 | ||
717 | 721 | ||
718 | ONamedListViewItem::~ONamedListViewItem() | 722 | ONamedListViewItem::~ONamedListViewItem() |
719 | { | 723 | { |
720 | } | 724 | } |
721 | 725 | ||
722 | 726 | ||
723 | void ONamedListViewItem::setText( const QStringList& texts ) | 727 | void ONamedListViewItem::setText( const QStringList& texts ) |
724 | { | 728 | { |
725 | int col = 0; | 729 | int col = 0; |
726 | for ( QStringList::ConstIterator it = texts.begin(); it != texts.end(); ++it ) | 730 | for ( QStringList::ConstIterator it = texts.begin(); it != texts.end(); ++it ) |
727 | { | 731 | { |
728 | odebug << "setting column " << col << " = text " << *it << "" << oendl; | 732 | odebug << "setting column " << col << " = text " << *it << "" << oendl; |
729 | OListViewItem::setText( col++, *it ); | 733 | OListViewItem::setText( col++, *it ); |
730 | } | 734 | } |
731 | 735 | ||
732 | } | 736 | } |
733 | 737 | ||
734 | 738 | ||
735 | void ONamedListViewItem::setText( const QString& column, const QString& text ) | 739 | void ONamedListViewItem::setText( const QString& column, const QString& text ) |
736 | { | 740 | { |
737 | //FIXME: If used excessively, this will slow down performance of updates | 741 | //FIXME: If used excessively, this will slow down performance of updates |
738 | //FIXME: because of the linear search over all column texts. | 742 | //FIXME: because of the linear search over all column texts. |
739 | //FIXME: I will optimize later by using a hash map. | 743 | //FIXME: I will optimize later by using a hash map. |
740 | int col = ( (ONamedListView*) listView() )->findColumn( column ); | 744 | int col = ( (ONamedListView*) listView() )->findColumn( column ); |
741 | if ( col != -1 ) | 745 | if ( col != -1 ) |
742 | OListViewItem::setText( col, text ); | 746 | OListViewItem::setText( col, text ); |
743 | else | 747 | else |
744 | owarn << "ONamedListViewItem::setText(): Warning! Columntext '" << column << "' not found." << oendl; | 748 | owarn << "ONamedListViewItem::setText(): Warning! Columntext '" << column << "' not found." << oendl; |
745 | } | 749 | } |
746 | 750 | ||
747 | 751 | ||
748 | ONamedListViewItem* ONamedListViewItem::find( int column, const QString& text, int recurse ) const | 752 | ONamedListViewItem* ONamedListViewItem::find( int column, const QString& text, int recurse ) const |
749 | { | 753 | { |
750 | return ( (ONamedListView*) listView() )->find( (ONamedListViewItem*) firstChild(), column, text, recurse ); | 754 | return ( (ONamedListView*) listView() )->find( (ONamedListViewItem*) firstChild(), column, text, recurse ); |
751 | } | 755 | } |
752 | 756 | ||
753 | 757 | ||
754 | ONamedListViewItem* ONamedListViewItem::find( const QString& column, const QString& text, int recurse ) const | 758 | ONamedListViewItem* ONamedListViewItem::find( const QString& column, const QString& text, int recurse ) const |
755 | { | 759 | { |
756 | int col = ( (ONamedListView*) listView() )->findColumn( column ); | 760 | int col = ( (ONamedListView*) listView() )->findColumn( column ); |
757 | if ( col != -1 ) | 761 | if ( col != -1 ) |
758 | return ( (ONamedListView*) listView() )->find( (ONamedListViewItem*) firstChild(), col, text, recurse ); | 762 | return ( (ONamedListView*) listView() )->find( (ONamedListViewItem*) firstChild(), col, text, recurse ); |
759 | else | 763 | else |
760 | return 0; | 764 | return 0; |
761 | } | 765 | } |
762 | 766 | ||
763 | } | 767 | } |
764 | } | 768 | } |
diff --git a/libopie2/opieui/oselector.cpp b/libopie2/opieui/oselector.cpp index 5f6f10f..05543c5 100644 --- a/libopie2/opieui/oselector.cpp +++ b/libopie2/opieui/oselector.cpp | |||
@@ -125,48 +125,50 @@ void OXYSelector::mousePressEvent( QMouseEvent *e ) | |||
125 | valuesFromPosition( e->pos().x() - 2, e->pos().y() - 2, xVal, yVal ); | 125 | valuesFromPosition( e->pos().x() - 2, e->pos().y() - 2, xVal, yVal ); |
126 | setValues( xVal, yVal ); | 126 | setValues( xVal, yVal ); |
127 | 127 | ||
128 | emit valueChanged( xPos, yPos ); | 128 | emit valueChanged( xPos, yPos ); |
129 | } | 129 | } |
130 | 130 | ||
131 | void OXYSelector::mouseMoveEvent( QMouseEvent *e ) | 131 | void OXYSelector::mouseMoveEvent( QMouseEvent *e ) |
132 | { | 132 | { |
133 | int xVal, yVal; | 133 | int xVal, yVal; |
134 | valuesFromPosition( e->pos().x() - 2, e->pos().y() - 2, xVal, yVal ); | 134 | valuesFromPosition( e->pos().x() - 2, e->pos().y() - 2, xVal, yVal ); |
135 | setValues( xVal, yVal ); | 135 | setValues( xVal, yVal ); |
136 | 136 | ||
137 | emit valueChanged( xPos, yPos ); | 137 | emit valueChanged( xPos, yPos ); |
138 | } | 138 | } |
139 | 139 | ||
140 | void OXYSelector::wheelEvent( QWheelEvent *e ) | 140 | void OXYSelector::wheelEvent( QWheelEvent *e ) |
141 | { | 141 | { |
142 | #if QT_VERSION > 290 | 142 | #if QT_VERSION > 290 |
143 | if ( e->orientation() == Qt::Horizontal ) | 143 | if ( e->orientation() == Qt::Horizontal ) |
144 | setValues( xValue() + e->delta()/120, yValue() ); | 144 | setValues( xValue() + e->delta()/120, yValue() ); |
145 | else | 145 | else |
146 | setValues( xValue(), yValue() + e->delta()/120 ); | 146 | setValues( xValue(), yValue() + e->delta()/120 ); |
147 | 147 | ||
148 | emit valueChanged( xPos, yPos ); | 148 | emit valueChanged( xPos, yPos ); |
149 | #else | ||
150 | Q_UNUSED( e ) | ||
149 | #endif | 151 | #endif |
150 | } | 152 | } |
151 | 153 | ||
152 | void OXYSelector::valuesFromPosition( int x, int y, int &xVal, int &yVal ) const | 154 | void OXYSelector::valuesFromPosition( int x, int y, int &xVal, int &yVal ) const |
153 | { | 155 | { |
154 | xVal = ( (maxX-minX) * (x-2) ) / ( width()-4 ); | 156 | xVal = ( (maxX-minX) * (x-2) ) / ( width()-4 ); |
155 | yVal = maxY - ( ( (maxY-minY) * (y-2) ) / ( height()-4 ) ); | 157 | yVal = maxY - ( ( (maxY-minY) * (y-2) ) / ( height()-4 ) ); |
156 | 158 | ||
157 | if ( xVal > maxX ) | 159 | if ( xVal > maxX ) |
158 | xVal = maxX; | 160 | xVal = maxX; |
159 | else if ( xVal < minX ) | 161 | else if ( xVal < minX ) |
160 | xVal = minX; | 162 | xVal = minX; |
161 | 163 | ||
162 | if ( yVal > maxY ) | 164 | if ( yVal > maxY ) |
163 | yVal = maxY; | 165 | yVal = maxY; |
164 | else if ( yVal < minY ) | 166 | else if ( yVal < minY ) |
165 | yVal = minY; | 167 | yVal = minY; |
166 | } | 168 | } |
167 | 169 | ||
168 | void OXYSelector::setPosition( int xp, int yp ) | 170 | void OXYSelector::setPosition( int xp, int yp ) |
169 | { | 171 | { |
170 | if ( xp < 2 ) | 172 | if ( xp < 2 ) |
171 | xp = 2; | 173 | xp = 2; |
172 | else if ( xp > width() - 2 ) | 174 | else if ( xp > width() - 2 ) |
diff --git a/libopie2/opieui/owait.cpp b/libopie2/opieui/owait.cpp index 9519888..ec1f25a 100644 --- a/libopie2/opieui/owait.cpp +++ b/libopie2/opieui/owait.cpp | |||
@@ -34,48 +34,49 @@ | |||
34 | #include <qpe/qpeapplication.h> | 34 | #include <qpe/qpeapplication.h> |
35 | #include <qpe/resource.h> | 35 | #include <qpe/resource.h> |
36 | 36 | ||
37 | /* QT */ | 37 | /* QT */ |
38 | #include <qlayout.h> | 38 | #include <qlayout.h> |
39 | #include <qpainter.h> | 39 | #include <qpainter.h> |
40 | 40 | ||
41 | using namespace Opie::Ui; | 41 | using namespace Opie::Ui; |
42 | 42 | ||
43 | static int frame = 0; | 43 | static int frame = 0; |
44 | 44 | ||
45 | /** | 45 | /** |
46 | * This will construct a modal dialog. | 46 | * This will construct a modal dialog. |
47 | * | 47 | * |
48 | * The default timer length is 10. | 48 | * The default timer length is 10. |
49 | * | 49 | * |
50 | * @param parent The parent of the widget | 50 | * @param parent The parent of the widget |
51 | * @param msg The name of the object | 51 | * @param msg The name of the object |
52 | * @param dispIcon Display Icon? | 52 | * @param dispIcon Display Icon? |
53 | */ | 53 | */ |
54 | OWait::OWait( QWidget *parent, const char* msg, bool dispIcon ) | 54 | OWait::OWait( QWidget *parent, const char* msg, bool dispIcon ) |
55 | :QDialog( parent, msg, TRUE, WStyle_Customize ) | 55 | :QDialog( parent, msg, TRUE, WStyle_Customize ) |
56 | { | 56 | { |
57 | 57 | ||
58 | Q_UNUSED( dispIcon ) | ||
58 | 59 | ||
59 | QHBoxLayout * hbox = new QHBoxLayout( this ); | 60 | QHBoxLayout * hbox = new QHBoxLayout( this ); |
60 | 61 | ||
61 | m_lb = new QLabel( this ); | 62 | m_lb = new QLabel( this ); |
62 | m_lb->setBackgroundMode ( NoBackground ); | 63 | m_lb->setBackgroundMode ( NoBackground ); |
63 | 64 | ||
64 | hbox->addWidget( m_lb ); | 65 | hbox->addWidget( m_lb ); |
65 | hbox->activate(); | 66 | hbox->activate(); |
66 | 67 | ||
67 | m_pix = Resource::loadPixmap( "BigBusy" ); | 68 | m_pix = Resource::loadPixmap( "BigBusy" ); |
68 | m_aniSize = m_pix.height(); | 69 | m_aniSize = m_pix.height(); |
69 | resize( m_aniSize, m_aniSize ); | 70 | resize( m_aniSize, m_aniSize ); |
70 | 71 | ||
71 | m_timerLength = 10; | 72 | m_timerLength = 10; |
72 | 73 | ||
73 | m_waitTimer = new QTimer( this ); | 74 | m_waitTimer = new QTimer( this ); |
74 | connect( m_waitTimer, SIGNAL( timeout() ), this, SLOT( hide() ) ); | 75 | connect( m_waitTimer, SIGNAL( timeout() ), this, SLOT( hide() ) ); |
75 | } | 76 | } |
76 | 77 | ||
77 | void OWait::timerEvent( QTimerEvent * ) | 78 | void OWait::timerEvent( QTimerEvent * ) |
78 | { | 79 | { |
79 | frame = ( ++frame ) % 4; | 80 | frame = ( ++frame ) % 4; |
80 | repaint(); | 81 | repaint(); |
81 | } | 82 | } |