Ticket #5596: 5596-v15.patch
File 5596-v15.patch, 106.6 KB (added by , 15 years ago) |
---|
-
mythplugins/mytharchive/mytharchive/editmetadata.cpp
117 117 description_edit->createEdit(this); 118 118 MythRemoteLineEdit *edit 119 119 = (MythRemoteLineEdit *) description_edit->getEdit(); 120 if (edit)121 edit->setWordWrap(Q3TextEdit::WidgetWidth);122 120 connect(description_edit, SIGNAL(loosingFocus()), 123 121 this, SLOT(editLostFocus())); 124 122 } -
mythplugins/mythzoneminder/mythzoneminder/zmevents.cpp
607 607 608 608 QLabel *splitter = popup->addLabel(" ", MythPopupBox::Small); 609 609 splitter->setLineWidth(2); 610 splitter->setFrameShape(Q 3Frame::HLine);611 splitter->setFrameShadow(Q 3Frame::Sunken);610 splitter->setFrameShape(QLabel::HLine); 611 splitter->setFrameShadow(QLabel::Sunken); 612 612 splitter->setMinimumHeight((int) (25 * hmult)); 613 613 splitter->setMaximumHeight((int) (25 * hmult)); 614 614 -
mythtv/libs/libmythtv/progdetails.h
26 26 private: 27 27 void wireUpTheme(void); 28 28 29 UI RichTextType*m_richText;29 UITextType *m_richText; 30 30 UITextButtonType *m_okButton; 31 31 32 32 QString m_details; -
mythtv/libs/libmythtv/progdetails.cpp
13 13 14 14 ProgDetails::ProgDetails(MythMainWindow *parent, 15 15 QString windowName, 16 QString details) 17 :MythThemedDialog(parent, windowName)16 QString details) : 17 MythThemedDialog(parent, windowName) 18 18 { 19 19 m_details = details; 20 20 … … 24 24 if (m_richText) 25 25 { 26 26 m_richText->SetText(m_details); 27 m_richText->SetBackground(&my_background);27 // m_richText->SetBackground(&my_background); 28 28 } 29 29 } 30 30 … … 98 98 reject(); 99 99 else if (action == "UP") 100 100 { 101 /* 101 102 if (getCurrentFocusWidget() == m_richText) 102 103 m_richText->ScrollUp(); 103 104 else 105 */ 104 106 nextPrevWidgetFocus(false); 105 107 } 106 108 else if (action == "DOWN") 107 109 { 110 /* 108 111 if (getCurrentFocusWidget() == m_richText) 109 112 m_richText->ScrollDown(); 110 113 else 114 */ 111 115 nextPrevWidgetFocus(true); 112 116 } 113 117 else if (action == "LEFT") … … 120 124 } 121 125 else if (action == "PAGEUP") 122 126 { 127 /* 123 128 if (getCurrentFocusWidget() == m_richText) 124 129 m_richText->ScrollPageUp(); 125 130 else 131 */ 126 132 nextPrevWidgetFocus(false); 127 133 } 128 134 else if (action == "PAGEDOWN") 129 135 { 136 /* 130 137 if (getCurrentFocusWidget() == m_richText) 131 138 m_richText->ScrollPageDown(); 132 139 else 140 */ 133 141 nextPrevWidgetFocus(true); 134 142 } 135 143 … … 148 156 connect(m_okButton, SIGNAL(pushed()), this, SLOT(accept())); 149 157 } 150 158 151 m_richText = getUI RichTextType("richtext");159 m_richText = getUITextType("richtext"); 152 160 153 161 buildFocusList(); 154 162 } -
mythtv/libs/libmyth/settings.cpp
7 7 8 8 // Qt widgets 9 9 #include <QLineEdit> 10 #include <q3hbox.h>11 #include <q3vbox.h>12 10 #include <QLabel> 13 11 #include <QSlider> 14 12 #include <QLCDNumber> 15 13 #include <QButtonGroup> 16 14 #include <QRadioButton> 15 #include <QProgressBar> 17 16 18 17 // Qt utils 19 18 #include <QFile> … … 168 167 QFileInfo &fi = *it; 169 168 170 169 if (absPath) 171 addSelection( fi.abs FilePath() );170 addSelection( fi.absoluteFilePath() ); 172 171 else 173 172 addSelection( fi.fileName() ); 174 173 } … … 250 249 const char* widgetName) { 251 250 (void)cg; 252 251 253 QWidget * widget = new Q3HBox(parent, widgetName);254 widget->set BackgroundOrigin(QWidget::WindowOrigin);252 QWidget *widget = new QWidget(parent); 253 widget->setObjectName(widgetName); 255 254 255 QHBoxLayout *layout = new QHBoxLayout(); 256 256 257 if (getLabel() != "") 257 258 { 258 QLabel * label = new QLabel(widget);259 QLabel *label = new QLabel(); 259 260 label->setText(getLabel() + ": "); 260 la bel->setBackgroundOrigin(QWidget::WindowOrigin);261 layout->addWidget(label); 261 262 } 262 263 263 QLabel * value = new QLabel(widget);264 QLabel *value = new QLabel(); 264 265 value->setText(getValue()); 265 value->setBackgroundOrigin(QWidget::WindowOrigin);266 layout->addWidget(value); 266 267 267 268 connect(this, SIGNAL(valueChanged(const QString&)), 268 269 value, SLOT(setText(const QString&))); 269 270 271 widget->setLayout(layout); 272 270 273 return widget; 271 274 } 272 275 273 276 QWidget* LineEditSetting::configWidget(ConfigurationGroup *cg, QWidget* parent, 274 const char *widgetName) { 275 Q3HBox *widget; 277 const char *widgetName) 278 { 279 QWidget *widget = new QWidget(parent); 280 widget->setObjectName(widgetName); 276 281 282 QBoxLayout *layout = NULL; 277 283 if (labelAboveWidget) 278 284 { 279 widget = dynamic_cast<Q3HBox*>(new Q3VBox(parent, widgetName));285 layout = new QVBoxLayout(); 280 286 widget->setSizePolicy(QSizePolicy(QSizePolicy::Minimum, 281 287 QSizePolicy::Maximum)); 282 288 } 283 289 else 284 widget = new Q3HBox(parent, widgetName); 285 widget->setBackgroundOrigin(QWidget::WindowOrigin); 290 layout = new QHBoxLayout(); 286 291 287 292 if (getLabel() != "") 288 293 { 289 QLabel * label = new QLabel(widget);294 QLabel *label = new QLabel(); 290 295 label->setText(getLabel() + ": "); 291 la bel->setBackgroundOrigin(QWidget::WindowOrigin);296 layout->addWidget(label); 292 297 } 293 298 294 299 bxwidget = widget; 295 300 connect(bxwidget, SIGNAL(destroyed(QObject*)), 296 301 this, SLOT(widgetDeleted(QObject*))); 297 302 298 edit = new MythLineEdit(settingValue, widget,299 303 edit = new MythLineEdit(settingValue, NULL, 304 QString(widgetName) + "-edit"); 300 305 edit->setHelpText(getHelpText()); 301 edit->setBackgroundOrigin(QWidget::WindowOrigin);302 306 edit->setText( getValue() ); 307 layout->addWidget(edit); 303 308 304 309 connect(this, SIGNAL(valueChanged(const QString&)), 305 310 edit, SLOT(setText(const QString&))); … … 313 318 setRW(rw); 314 319 SetPasswordEcho(password_echo); 315 320 316 return bxwidget; 321 widget->setLayout(layout); 322 323 return widget; 317 324 } 318 325 319 326 void LineEditSetting::widgetInvalid(QObject *obj) … … 366 373 } 367 374 368 375 QWidget* SliderSetting::configWidget(ConfigurationGroup *cg, QWidget* parent, 369 const char* widgetName) { 370 Q3HBox* widget; 371 if (labelAboveWidget) 376 const char* widgetName) 377 { 378 QWidget *widget = new QWidget(parent); 379 widget->setObjectName(widgetName); 380 381 QBoxLayout *layout = NULL; 382 if (labelAboveWidget) 372 383 { 373 widget = dynamic_cast<Q3HBox*>(new Q3VBox(parent, widgetName));384 layout = new QVBoxLayout(); 374 385 widget->setSizePolicy(QSizePolicy(QSizePolicy::Minimum, 375 386 QSizePolicy::Maximum)); 376 } 387 } 377 388 else 378 widget = new Q3HBox(parent, widgetName);389 layout = new QHBoxLayout(); 379 390 380 widget->setBackgroundOrigin(QWidget::WindowOrigin);381 382 391 if (getLabel() != "") 383 392 { 384 QLabel* label = new QLabel(widget, QString(widgetName) + "-label"); 393 QLabel *label = new QLabel(); 394 label->setObjectName(QString(widgetName) + "-label"); 385 395 label->setText(getLabel() + ": "); 386 la bel->setBackgroundOrigin(QWidget::WindowOrigin);396 layout->addWidget(label); 387 397 } 388 398 389 MythSlider * slider = new MythSlider(widget,390 399 MythSlider *slider = new MythSlider( 400 NULL, QString(widgetName) + "-slider"); 391 401 slider->setHelpText(getHelpText()); 392 402 slider->setMinValue(min); 393 403 slider->setMaxValue(max); 394 404 slider->setOrientation( Qt::Horizontal ); 395 405 slider->setLineStep(step); 396 406 slider->setValue(intValue()); 397 slider->setBackgroundOrigin(QWidget::WindowOrigin);407 layout->addWidget(slider); 398 408 399 QLCDNumber * lcd = new QLCDNumber(widget, QString(widgetName) + "-lcd");409 QLCDNumber *lcd = new QLCDNumber(NULL, QString(widgetName) + "-lcd"); 400 410 lcd->setMode(QLCDNumber::DEC); 401 411 lcd->setSegmentStyle(QLCDNumber::Flat); 402 412 lcd->display(intValue()); 413 layout->addWidget(lcd); 403 414 404 415 connect(slider, SIGNAL(valueChanged(int)), lcd, SLOT(display(int))); 405 416 connect(slider, SIGNAL(valueChanged(int)), this, SLOT(setValue(int))); … … 409 420 connect(slider, SIGNAL(changeHelpText(QString)), cg, 410 421 SIGNAL(changeHelpText(QString))); 411 422 423 widget->setLayout(layout); 424 412 425 return widget; 413 426 } 414 427 … … 428 441 } 429 442 430 443 QWidget* SpinBoxSetting::configWidget(ConfigurationGroup *cg, QWidget* parent, 431 const char* widgetName) { 432 Q3HBox* box; 433 if (labelAboveWidget) 444 const char* widgetName) 445 { 446 QWidget *widget = new QWidget(parent); 447 widget->setObjectName(widgetName); 448 449 QBoxLayout *layout = NULL; 450 if (labelAboveWidget) 434 451 { 435 box = dynamic_cast<Q3HBox*>(new Q3VBox(parent, widgetName));436 box->setSizePolicy(QSizePolicy(QSizePolicy::Minimum,437 QSizePolicy::Maximum));438 } 452 layout = new QVBoxLayout(); 453 widget->setSizePolicy(QSizePolicy(QSizePolicy::Minimum, 454 QSizePolicy::Maximum)); 455 } 439 456 else 440 box = new Q3HBox(parent, widgetName); 441 box->setBackgroundOrigin(QWidget::WindowOrigin); 457 layout = new QHBoxLayout(); 442 458 443 459 if (getLabel() != "") 444 460 { 445 QLabel* label = new QLabel(box); 446 label->setBackgroundOrigin(QWidget::WindowOrigin); 461 QLabel *label = new QLabel(); 447 462 label->setText(getLabel() + ": "); 463 layout->addWidget(label); 448 464 } 449 465 450 bxwidget = box;466 bxwidget = widget; 451 467 connect(bxwidget, SIGNAL(destroyed(QObject*)), 452 468 this, SLOT(widgetDeleted(QObject*))); 453 469 454 spinbox = new MythSpinBox( box, QString(widgetName) + "MythSpinBox", sstep);470 spinbox = new MythSpinBox(NULL, QString(widgetName) + "MythSpinBox", sstep); 455 471 spinbox->setHelpText(getHelpText()); 456 spinbox->setBackgroundOrigin(QWidget::WindowOrigin);457 472 spinbox->setMinValue(min); 458 473 spinbox->setMaxValue(max); 474 layout->addWidget(spinbox); 475 459 476 // only set step size if greater than default (1), otherwise 460 477 // this will screw up the single-step/jump behavior of the MythSpinBox 461 478 if (1 < step) … … 470 487 connect(spinbox, SIGNAL(changeHelpText(QString)), cg, 471 488 SIGNAL(changeHelpText(QString))); 472 489 473 return bxwidget; 490 widget->setLayout(layout); 491 492 return widget; 474 493 } 475 494 476 495 void SpinBoxSetting::widgetInvalid(QObject *obj) … … 531 550 532 551 QWidget* SelectLabelSetting::configWidget(ConfigurationGroup *cg, 533 552 QWidget* parent, 534 const char* widgetName) { 553 const char* widgetName) 554 { 535 555 (void)cg; 536 556 537 Q3HBox* widget; 538 if (labelAboveWidget) 557 QWidget *widget = new QWidget(parent); 558 widget->setObjectName(widgetName); 559 560 QBoxLayout *layout = NULL; 561 if (labelAboveWidget) 539 562 { 540 widget = dynamic_cast<Q3HBox*>(new Q3VBox(parent, widgetName));563 layout = new QVBoxLayout(); 541 564 widget->setSizePolicy(QSizePolicy(QSizePolicy::Minimum, 542 565 QSizePolicy::Maximum)); 543 } 566 } 544 567 else 545 widget = new Q3HBox(parent, widgetName);568 layout = new QHBoxLayout(); 546 569 547 widget->setBackgroundOrigin(QWidget::WindowOrigin);548 549 570 if (getLabel() != "") 550 571 { 551 QLabel * label = new QLabel(widget);572 QLabel *label = new QLabel(); 552 573 label->setText(getLabel() + ": "); 553 la bel->setBackgroundOrigin(QWidget::WindowOrigin);574 layout->addWidget(label); 554 575 } 555 576 556 QLabel* value = new QLabel(widget); 577 578 QLabel *value = new QLabel(); 557 579 value->setText(labels[current]); 558 value->setBackgroundOrigin(QWidget::WindowOrigin);580 layout->addWidget(value); 559 581 560 582 connect(this, SIGNAL(valueChanged(const QString&)), 561 583 value, SLOT(setText(const QString&))); 562 584 585 widget->setLayout(layout); 586 563 587 return widget; 564 588 } 565 589 566 590 QWidget* ComboBoxSetting::configWidget(ConfigurationGroup *cg, QWidget* parent, 567 const char* widgetName) { 568 Q3HBox* box; 569 if (labelAboveWidget) 591 const char* widgetName) 592 { 593 QWidget *widget = new QWidget(parent); 594 widget->setObjectName(widgetName); 595 596 QBoxLayout *layout = NULL; 597 if (labelAboveWidget) 570 598 { 571 box = dynamic_cast<Q3HBox*>(new Q3VBox(parent, widgetName));572 box->setSizePolicy(QSizePolicy(QSizePolicy::Minimum,573 QSizePolicy::Maximum));574 } 599 layout = new QVBoxLayout(); 600 widget->setSizePolicy(QSizePolicy(QSizePolicy::Minimum, 601 QSizePolicy::Maximum)); 602 } 575 603 else 576 box = new Q3HBox(parent, widgetName);604 layout = new QHBoxLayout(); 577 605 578 box->setBackgroundOrigin(QWidget::WindowOrigin);579 580 606 if (getLabel() != "") 581 607 { 582 QLabel * label = new QLabel(box);608 QLabel *label = new QLabel(); 583 609 label->setText(getLabel() + ": "); 584 label->setBackgroundOrigin(QWidget::WindowOrigin); 585 box->setStretchFactor(label, 0); 610 layout->addWidget(label); 586 611 } 587 612 588 bxwidget = box;613 bxwidget = widget; 589 614 connect(bxwidget, SIGNAL(destroyed(QObject*)), 590 615 this, SLOT(widgetDeleted(QObject*))); 591 616 592 widget = new MythComboBox(rw, box); 593 widget->setHelpText(getHelpText()); 594 widget->setBackgroundOrigin(QWidget::WindowOrigin); 595 box->setStretchFactor(widget, 1); 617 cbwidget = new MythComboBox(rw); 618 cbwidget->setHelpText(getHelpText()); 596 619 597 620 for(unsigned int i = 0 ; i < labels.size() ; ++i) 598 widget->insertItem(labels[i]);621 cbwidget->insertItem(labels[i]); 599 622 600 623 if (isSet) 601 widget->setCurrentItem(current);624 cbwidget->setCurrentItem(current); 602 625 603 626 if (1 < step) 604 widget->setStep(step);627 cbwidget->setStep(step); 605 628 606 629 if (rw) 607 630 { 608 connect( widget, SIGNAL(highlighted(const QString &)),631 connect(cbwidget, SIGNAL(highlighted(const QString &)), 609 632 this, SLOT(setValue(const QString &))); 610 connect( widget, SIGNAL(activated(const QString &)),633 connect(cbwidget, SIGNAL(activated(const QString &)), 611 634 this, SLOT(setValue(const QString &))); 612 connect( widget, SIGNAL(editTextChanged(const QString &)),635 connect(cbwidget, SIGNAL(editTextChanged(const QString &)), 613 636 this, SLOT(setValue(const QString &))); 614 637 } 615 638 else 616 639 { 617 connect( widget, SIGNAL(highlighted(int)),640 connect(cbwidget, SIGNAL(highlighted(int)), 618 641 this, SLOT(setValue(int))); 619 connect( widget, SIGNAL(activated(int)),642 connect(cbwidget, SIGNAL(activated(int)), 620 643 this, SLOT(setValue(int))); 621 644 } 622 645 623 646 connect(this, SIGNAL(selectionsCleared()), 624 widget, SLOT(clear()));647 cbwidget, SLOT(clear())); 625 648 626 649 if (cg) 627 connect( widget, SIGNAL(changeHelpText(QString)), cg,650 connect(cbwidget, SIGNAL(changeHelpText(QString)), cg, 628 651 SIGNAL(changeHelpText(QString))); 629 652 630 return bxwidget; 653 layout->addWidget(cbwidget); 654 layout->setStretchFactor(cbwidget, 1); 655 656 widget->setLayout(layout); 657 658 return widget; 631 659 } 632 660 633 661 void ComboBoxSetting::widgetInvalid(QObject *obj) … … 635 663 if (bxwidget == obj) 636 664 { 637 665 bxwidget = NULL; 638 widget= NULL;666 cbwidget = NULL; 639 667 } 640 668 } 641 669 642 670 void ComboBoxSetting::setEnabled(bool b) 643 671 { 644 672 Configurable::setEnabled(b); 645 if ( widget)646 widget->setEnabled(b);673 if (cbwidget) 674 cbwidget->setEnabled(b); 647 675 } 648 676 649 677 void ComboBoxSetting::setVisible(bool b) 650 678 { 651 679 Configurable::setVisible(b); 652 if ( widget)680 if (cbwidget) 653 681 { 654 //QWidget *parent = widget->parentWidget();655 682 if (b) 656 widget->show();683 cbwidget->show(); 657 684 else 658 widget->hide();685 cbwidget->hide(); 659 686 } 660 687 } 661 688 … … 673 700 if (rw) 674 701 { 675 702 Setting::setValue(newValue); 676 if ( widget)677 widget->setCurrentItem(current);703 if (cbwidget) 704 cbwidget->setCurrentItem(current); 678 705 } 679 706 }; 680 707 681 708 void ComboBoxSetting::setValue(int which) 682 709 { 683 if ( widget)684 widget->setCurrentItem(which);710 if (cbwidget) 711 cbwidget->setCurrentItem(which); 685 712 SelectSetting::setValue(which); 686 713 }; 687 714 688 715 void ComboBoxSetting::addSelection( 689 716 const QString &label, QString value, bool select) 690 717 { 691 if ((findSelection(label, value) < 0) && widget)718 if ((findSelection(label, value) < 0) && cbwidget) 692 719 { 693 widget->insertItem(label);720 cbwidget->insertItem(label); 694 721 } 695 722 696 723 SelectSetting::addSelection(label, value, select); 697 724 698 if ( widget && isSet)699 widget->setCurrentItem(current);725 if (cbwidget && isSet) 726 cbwidget->setCurrentItem(current); 700 727 } 701 728 702 729 bool ComboBoxSetting::removeSelection(const QString &label, QString value) 703 730 { 704 731 SelectSetting::removeSelection(label, value); 705 if (! widget)732 if (!cbwidget) 706 733 return true; 707 734 708 for (uint i = 0; ((int) i) < widget->count(); i++)735 for (uint i = 0; ((int) i) < cbwidget->count(); i++) 709 736 { 710 if ( widget->text(i) == label)737 if (cbwidget->text(i) == label) 711 738 { 712 widget->removeItem(i);739 cbwidget->removeItem(i); 713 740 if (isSet) 714 widget->setCurrentItem(current);741 cbwidget->setCurrentItem(current); 715 742 return true; 716 743 } 717 744 } … … 721 748 722 749 void ComboBoxSetting::setHelpText(const QString &str) 723 750 { 724 if ( widget)725 widget->setHelpText(str);751 if (cbwidget) 752 cbwidget->setHelpText(str); 726 753 SelectSetting::setHelpText(str); 727 754 } 728 755 … … 803 830 Setting::setValue(newValue.toString(Qt::ISODate)); 804 831 } 805 832 806 QWidget *RadioSetting::configWidget(ConfigurationGroup *cg, QWidget* parent,807 const char* widgetName) {808 Q3ButtonGroup* widget = new Q3ButtonGroup(parent, widgetName); 809 widget->setBackgroundOrigin(QWidget::WindowOrigin);833 QWidget *RadioSetting::configWidget(ConfigurationGroup *cg, QWidget* parent, 834 const char* widgetName) 835 { 836 QGroupBox* widget = new QGroupBox(parent, widgetName); 810 837 widget->setTitle(getLabel()); 811 838 812 839 for( unsigned i = 0 ; i < labels.size() ; ++i ) { 813 840 QRadioButton* button = new QRadioButton(widget, NULL); 814 button->setBackgroundOrigin(QWidget::WindowOrigin);815 841 button->setText(labels[i]); 816 842 if (isSet && i == current) 817 843 button->setDown(true); … … 829 855 this, SLOT(widgetDeleted(QObject*))); 830 856 831 857 widget->setHelpText(getHelpText()); 832 widget->setBackgroundOrigin(QWidget::WindowOrigin);833 858 widget->setText(getLabel()); 834 859 widget->setChecked(boolValue()); 835 860 … … 1095 1120 1096 1121 GetMythUI()->GetScreenSettings(width, m_wmult, height, m_hmult); 1097 1122 1098 Q3HBox* box; 1099 if (labelAboveWidget) 1123 QWidget *widget = new QWidget(parent); 1124 widget->setObjectName(widgetName); 1125 1126 QBoxLayout *layout = NULL; 1127 if (labelAboveWidget) 1100 1128 { 1101 box = dynamic_cast<Q3HBox*>(new Q3VBox(parent, widgetName));1102 box->setSizePolicy(QSizePolicy(QSizePolicy::Minimum,1103 QSizePolicy::Maximum));1104 } 1129 layout = new QVBoxLayout(); 1130 widget->setSizePolicy(QSizePolicy(QSizePolicy::Minimum, 1131 QSizePolicy::Maximum)); 1132 } 1105 1133 else 1106 box = new Q3HBox(parent, widgetName);1134 layout = new QHBoxLayout(); 1107 1135 1108 box->setBackgroundOrigin(QWidget::WindowOrigin);1109 1110 1136 if (getLabel() != "") 1111 1137 { 1112 QLabel * label = new QLabel(box);1138 QLabel *label = new QLabel(); 1113 1139 label->setText(getLabel() + ":"); 1114 la bel->setBackgroundOrigin(QWidget::WindowOrigin);1140 layout->addWidget(label); 1115 1141 } 1116 1142 1117 MythComboBox *widget = new MythComboBox(false, box); 1118 widget->setBackgroundOrigin(QWidget::WindowOrigin); 1119 combo = widget; 1143 combo = new MythComboBox(false); 1144 layout->addWidget(combo); 1120 1145 1121 QLabel *testlabel = new QLabel( box);1146 QLabel *testlabel = new QLabel(); 1122 1147 testlabel->setText(" "); 1123 testlabel->setBackgroundOrigin(QWidget::WindowOrigin);1148 layout->addWidget(testlabel); 1124 1149 1125 bxwidget = box;1150 bxwidget = widget; 1126 1151 connect(bxwidget, SIGNAL(destroyed(QObject*)), 1127 1152 this, SLOT(widgetDeleted(QObject*))); 1128 1153 1129 imagelabel = new QLabel( box);1130 imagelabel->setBackgroundOrigin(QWidget::WindowOrigin);1154 imagelabel = new QLabel(); 1155 layout->addWidget(imagelabel); 1131 1156 1132 1157 for (unsigned int i = 0 ; i < images.size() ; ++i) 1133 widget->insertItem(labels[i]);1158 combo->insertItem(labels[i]); 1134 1159 1135 1160 if (isSet) 1136 widget->setCurrentItem(current);1161 combo->setCurrentItem(current); 1137 1162 else 1138 1163 current = 0; 1139 1164 … … 1154 1179 imagelabel->setPixmap(tmppix); 1155 1180 } 1156 1181 1157 connect( widget, SIGNAL(highlighted(int)), this, SLOT(setValue(int)));1158 connect( widget, SIGNAL(highlighted(int)), this, SLOT(imageSet(int)));1159 connect( widget, SIGNAL(activated(int)), this, SLOT(setValue(int)));1160 connect( widget, SIGNAL(activated(int)), this, SLOT(imageSet(int)));1182 connect(combo, SIGNAL(highlighted(int)), this, SLOT(setValue(int))); 1183 connect(combo, SIGNAL(highlighted(int)), this, SLOT(imageSet(int))); 1184 connect(combo, SIGNAL(activated(int)), this, SLOT(setValue(int))); 1185 connect(combo, SIGNAL(activated(int)), this, SLOT(imageSet(int))); 1161 1186 1162 1187 connect(this, SIGNAL(selectionsCleared()), 1163 widget, SLOT(clear()));1188 combo, SLOT(clear())); 1164 1189 1165 1190 if (cg) 1166 connect( widget, SIGNAL(changeHelpText(QString)), cg,1191 connect(combo, SIGNAL(changeHelpText(QString)), cg, 1167 1192 SIGNAL(changeHelpText(QString))); 1168 1193 1169 1194 return bxwidget; … … 1255 1280 QWidget* ProgressSetting::configWidget(ConfigurationGroup* cg, QWidget* parent, 1256 1281 const char* widgetName) { 1257 1282 (void)cg; 1283 QWidget *widget = new QWidget(parent); 1284 widget->setObjectName(widgetName); 1285 QBoxLayout *layout = new QHBoxLayout(); 1258 1286 1259 Q3HBox* widget = new Q3HBox(parent,widgetName);1260 widget->setBackgroundOrigin(QWidget::WindowOrigin);1261 1262 1287 if (getLabel() != "") 1263 1288 { 1264 QLabel* label = new QLabel(getLabel() + " :", widget, widgetName); 1265 label->setBackgroundOrigin(QWidget::WindowOrigin); 1289 QLabel* label = new QLabel(); 1290 label->setObjectName(QString(widgetName) + "_label"); 1291 label->setText(getLabel() + ": "); 1292 layout->addWidget(label); 1266 1293 } 1267 1294 1268 Q3ProgressBar* progress = new Q3ProgressBar(totalSteps, widget, widgetName); 1269 progress->setBackgroundOrigin(QWidget::WindowOrigin); 1295 QProgressBar *progress = new QProgressBar(NULL); 1296 progress->setObjectName(widgetName); 1297 progress->setRange(0,totalSteps); 1298 layout->addWidget(progress); 1270 1299 1271 connect(this, SIGNAL(valueChanged(int)), progress, SLOT(setProgress(int))); 1272 progress->setProgress(intValue()); 1300 connect(this, SIGNAL(valueChanged(int)), progress, SLOT(setValue(int))); 1301 progress->setValue(intValue()); 1302 1303 widget->setLayout(layout); 1304 1273 1305 return widget; 1274 1306 } -
mythtv/libs/libmyth/mythwizard.cpp
41 41 #include "qpushbutton.h" 42 42 #include "qcursor.h" 43 43 #include "qlabel.h" 44 #include "q3widgetstack.h"45 44 #include "qapplication.h" 46 45 #include "qpainter.h" 47 #include <Q3HBoxLayout>48 46 #include <QChildEvent> 49 #include <Q3Frame>50 47 #include <QKeyEvent> 51 48 #include <QEvent> 52 #include <Q3VBoxLayout>53 49 50 #include <q3widgetstack.h> 51 #include <QGroupBox> 52 #include <QBoxLayout> 53 54 54 #include "mythcontext.h" 55 55 56 56 class MythWizardPrivate … … 70 70 bool appropriate; 71 71 }; 72 72 73 Q 3VBoxLayout * v;73 QVBoxLayout * v; 74 74 Page * current; 75 75 Q3WidgetStack * ws; 76 76 QList<Page*> pages; … … 80 80 MythPushButton * finishButton; 81 81 MythPushButton * cancelButton; 82 82 83 Q 3GroupBox *helpgroup;83 QGroupBox *helpgroup; 84 84 QLabel *help; 85 85 86 Q 3Frame * hbar1, * hbar2;86 QFrame * hbar1, * hbar2; 87 87 88 88 Page * page( const QWidget * w ) 89 89 { … … 421 421 return d->cancelButton; 422 422 } 423 423 424 void MythWizard::layOutButtonRow( Q 3HBoxLayout * layout )424 void MythWizard::layOutButtonRow( QHBoxLayout * layout ) 425 425 { 426 426 bool hasEarlyFinish = FALSE; 427 427 … … 432 432 i--; 433 433 } 434 434 435 Q3BoxLayout * h = new Q3BoxLayout( Q3BoxLayout::LeftToRight ); 435 QHBoxLayout *h = new QHBoxLayout(); 436 h->setSpacing(QBoxLayout::LeftToRight); 436 437 layout->addLayout( h ); 437 438 438 439 h->addWidget( d->cancelButton ); … … 477 478 } 478 479 } 479 480 480 void MythWizard::layOutTitleRow( Q 3HBoxLayout * layout, const QString & title )481 void MythWizard::layOutTitleRow( QHBoxLayout * layout, const QString & title ) 481 482 { 482 483 d->title->setText( title ); 483 484 layout->addWidget( d->title, 10 ); … … 486 487 void MythWizard::layOut() 487 488 { 488 489 delete d->v; 489 d->v = new Q 3VBoxLayout( this, 6, 0, "top-level layout" );490 d->v = new QVBoxLayout( this, 6, 0, "top-level layout" ); 490 491 491 Q 3HBoxLayout * l;492 l = new Q 3HBoxLayout( 6 );492 QHBoxLayout * l; 493 l = new QHBoxLayout( 6 ); 493 494 d->v->addLayout( l, 0 ); 494 495 layOutTitleRow( l, d->current ? d->current->t : QString::null ); 495 496 496 497 if ( ! d->hbar1 ) { 497 d->hbar1 = new Q 3Frame( this, "<hr>", 0 );498 d->hbar1 = new QFrame( this, "<hr>", 0 ); 498 499 d->hbar1->setBackgroundOrigin(QWidget::WindowOrigin); 499 d->hbar1->setFrameStyle( Q3Frame::Sunken + Q3Frame::HLine);500 d->hbar1->setFrameStyle(QFrame::Sunken | QFrame::HLine); 500 501 d->hbar1->setFixedHeight( 12 ); 501 502 } 502 503 … … 506 507 507 508 if (!d->helpgroup) 508 509 { 509 d->helpgroup = new Q 3GroupBox(this, "help-group-box");510 d->helpgroup = new QGroupBox(this, "help-group-box"); 510 511 d->helpgroup->setBackgroundOrigin(QWidget::WindowOrigin); 511 512 512 513 d->help = new QLabel(d->helpgroup, "help text"); … … 519 520 d->help->setMaximumHeight((int)(80 * hmult)); 520 521 d->help->setMinimumHeight((int)(80 * hmult)); 521 522 522 Q 3VBoxLayout *helplayout = new Q3VBoxLayout(d->helpgroup, 10);523 QVBoxLayout *helplayout = new QVBoxLayout(d->helpgroup, 10); 523 524 helplayout->add(d->help); 524 525 } 525 526 else … … 530 531 d->v->addWidget(d->helpgroup); 531 532 532 533 if ( ! d->hbar2 ) { 533 d->hbar2 = new Q 3Frame( this, "<hr>", 0 );534 d->hbar2 = new QFrame( this, "<hr>", 0 ); 534 535 d->hbar2->setBackgroundOrigin(QWidget::WindowOrigin); 535 d->hbar2->setFrameStyle( Q3Frame::Sunken + Q3Frame::HLine);536 d->hbar2->setFrameStyle(QFrame::Sunken | QFrame::HLine); 536 537 d->hbar2->setFixedHeight( 12 ); 537 538 } 538 539 d->v->addWidget( d->hbar2 ); 539 540 540 l = new Q 3HBoxLayout( 6 );541 l = new QHBoxLayout( 6 ); 541 542 d->v->addLayout( l ); 542 543 layOutButtonRow( l ); 543 544 d->v->activate(); -
mythtv/libs/libmyth/uitypes.h
172 172 void SetTextOffset(QPoint to) { m_textoffset = to; } 173 173 void SetIconOffset(QPoint ic) { m_iconoffset = ic; } 174 174 void SetIconSize(QPoint is) { m_iconsize = is; } 175 void ResetImage(int loc) { iconData[loc] .resize(0,0); }175 void ResetImage(int loc) { iconData[loc] = QPixmap(0,0); } 176 176 int GetSize() { return m_iconsize.x(); } 177 177 178 178 private: … … 745 745 746 746 }; 747 747 748 class MPUBLIC UIRichTextType : public UIType749 {750 Q_OBJECT751 752 public:753 UIRichTextType(const QString &, fontProp *, const QString &, int,754 QRect displayrect, QRect textrect);755 ~UIRichTextType();756 757 QString Name() { return m_name; }758 759 void SetText(const QString &text);760 QString GetText() { return m_message; }761 762 QRect DisplayArea() { return m_displayArea; }763 void SetDisplayArea(const QRect &rect) { m_displayArea = rect; }764 void SetShowScrollArrows(bool bShowArrows)765 { m_showScrollArrows = bShowArrows; }766 767 QRect TextArea() { return m_textArea; }768 void SetTextArea(const QRect &rect) { m_textArea = rect; }769 770 void SetImageUpArrowReg(QPixmap img, QPoint loc)771 { m_upArrowReg = img; m_upArrowRegPos = loc; }772 void SetImageDnArrowReg(QPixmap img, QPoint loc)773 { m_dnArrowReg = img; m_dnArrowRegPos = loc; }774 void SetImageUpArrowSel(QPixmap img, QPoint loc)775 { m_upArrowSel = img; m_upArrowSelPos = loc; }776 void SetImageDnArrowSel(QPixmap img, QPoint loc)777 { m_dnArrowSel = img; m_dnArrowSelPos = loc; }778 779 void SetBackground(QPixmap *background);780 void SetBackgroundImages(QString bgImageReg, QString bgImageSel);781 782 virtual void calculateScreenArea();783 784 virtual void Draw(QPainter *, int, int);785 public slots:786 void ScrollDown(void);787 void ScrollUp(void);788 void ScrollPageDown(void);789 void ScrollPageUp(void);790 791 virtual bool takeFocus();792 virtual void looseFocus();793 794 protected:795 void refreshImage();796 void updateBackground();797 void loadBackgroundImg(bool &changed);798 799 QRect m_displayArea;800 QRect m_textArea;801 802 int m_yPos; // current scroll position803 int m_textHeight; // total height of rendered text804 805 QString m_message;806 QString m_bgImageReg;807 QString m_bgImageSel;808 809 fontProp *m_font;810 811 QPixmap *m_background; // clipped image of the window background812 QPixmap *m_compBackground;// composite of the window background + the813 // widget background image814 QPixmap *m_image; // the completed image including the rich text815 816 QString m_backgroundFile; //< current source of background image817 QImage *m_backgroundImage; //< current widget background image)818 819 bool m_showScrollArrows;820 bool m_showUpArrow;821 bool m_showDnArrow;822 823 QPoint m_upArrowRegPos;824 QPoint m_dnArrowRegPos;825 QPoint m_upArrowSelPos;826 QPoint m_dnArrowSelPos;827 828 QPixmap m_upArrowReg;829 QPixmap m_dnArrowReg;830 QPixmap m_upArrowSel;831 QPixmap m_dnArrowSel;832 };833 834 748 class MPUBLIC UIRemoteEditType : public UIType 835 749 { 836 750 Q_OBJECT -
mythtv/libs/libmyth/mythmedia.cpp
62 62 m_Status = MEDIASTAT_UNKNOWN; 63 63 m_MediaType = MEDIATYPE_UNKNOWN; 64 64 65 QFileInfo fi(DevicePath); 66 if (fi.isSymLink()) 67 m_RealDevice = m_DevicePath.section('/', 0, -2) + "/" + fi.readLink(); 68 else 69 m_RealDevice = QString::null; 65 m_RealDevice = QString::null; 66 67 QFileInfo fi(m_DevicePath); 68 QString link = QString:: null; 69 for (uint i = 0; (i < 256) && fi.isSymLink() && 70 !(link = fi.readLink()).isEmpty(); i++) 71 { 72 if (link[0] == '/') // absolute link 73 m_RealDevice = link; 74 else // relative link.. 75 m_RealDevice = fi.absoluteDir().absolutePath() + "/" + link; 76 fi = QFileInfo(m_RealDevice); 77 } 70 78 } 71 79 72 80 bool MythMediaDevice::openDevice() … … 75 83 if (isDeviceOpen()) 76 84 return true; 77 85 78 m_DeviceHandle = open(m_DevicePath, O_RDONLY | O_NONBLOCK); 86 QByteArray dev = m_DevicePath.toLocal8Bit(); 87 m_DeviceHandle = open(dev.constData(), O_RDONLY | O_NONBLOCK); 79 88 80 89 return isDeviceOpen(); 81 90 } … … 246 255 247 256 if (fi.isDir()) 248 257 { 249 ScanMediaType(fi.abs FilePath(), cnt);258 ScanMediaType(fi.absoluteFilePath(), cnt); 250 259 continue; 251 260 } 252 261 253 const QString ext = fi. extension(false);262 const QString ext = fi.suffix(); 254 263 if (!ext.isEmpty()) 255 264 cnt[ext.toLower()]++; 256 265 } … … 377 386 QString link = QString::null; 378 387 379 388 // If the device name in the mounts file is a symlink, follow it.. 380 if (fi.isSymLink() && !(link = fi.readLink()).isEmpty()) 389 for (uint i = 0; (i < 256) && fi.isSymLink() && 390 !(link = fi.readLink()).isEmpty(); i++) 381 391 { 382 392 if (link[0] == '/') // absolute link 383 393 deviceNames.push_back(link); 384 394 else // relative link.. 385 deviceNames.push_back(fi.dir(true).absPath() + "/" + link); 395 { 396 deviceNames.push_back( 397 fi.absoluteDir().absolutePath() + "/" + link); 398 } 399 fi = QFileInfo(deviceNames.back()); 386 400 } 387 401 388 402 -
mythtv/libs/libmyth/settings.h
326 326 protected: 327 327 ComboBoxSetting(Storage *_storage, bool _rw = false, int _step = 1) : 328 328 SelectSetting(_storage), rw(_rw), 329 bxwidget(NULL), widget(NULL), step(_step) { }329 bxwidget(NULL), cbwidget(NULL), step(_step) { } 330 330 331 331 public: 332 332 virtual void setValue(QString newValue); … … 336 336 const char* widgetName = 0); 337 337 virtual void widgetInvalid(QObject *obj); 338 338 339 void setFocus() { if ( widget)widget->setFocus(); }339 void setFocus() { if (cbwidget) cbwidget->setFocus(); } 340 340 341 341 virtual void setEnabled(bool b); 342 342 virtual void setVisible(bool b); … … 353 353 private: 354 354 bool rw; 355 355 QWidget *bxwidget; 356 MythComboBox * widget;356 MythComboBox *cbwidget; 357 357 358 358 protected: 359 359 int step; -
mythtv/libs/libmyth/mythwizard.h
42 42 #include "mythdialogs.h" 43 43 44 44 #include <QEvent> 45 #include <Q3HBoxLayout>46 45 #include <QKeyEvent> 47 46 48 47 class MythWizardPrivate; 48 class QHBoxLayout; 49 49 50 50 class MPUBLIC MythWizard : public MythDialog 51 51 { … … 104 104 void selected(const QString&); 105 105 106 106 protected: 107 virtual void layOutButtonRow(Q 3HBoxLayout *);108 virtual void layOutTitleRow(Q 3HBoxLayout *, const QString &);107 virtual void layOutButtonRow(QHBoxLayout *); 108 virtual void layOutTitleRow(QHBoxLayout *, const QString &); 109 109 110 110 void setBackEnabled(bool); 111 111 void setNextEnabled(bool); -
mythtv/libs/libmyth/mythconfigdialogs.cpp
6 6 7 7 #include "mythuihelper.h" 8 8 9 #include <q3hbox.h> 9 #include <QWidget> 10 #include <QHBoxLayout> 10 11 11 12 static void clear_widgets(vector<Configurable*> &children, 12 13 vector<QWidget*> &childwidget) … … 49 50 const char* widgetName) 50 51 { 51 52 dialog = new ConfigPopupDialogWidget(parent, widgetName); 52 dialog->setBackgroundOrigin(QWidget::WindowOrigin);53 53 54 54 if (getLabel() != "") 55 55 { 56 Q3HBox* box = new Q3HBox(dialog); 57 box->setBackgroundOrigin(QWidget::WindowOrigin); 58 box->setSizePolicy(QSizePolicy(QSizePolicy::Minimum, 59 QSizePolicy::Maximum)); 60 61 label = new QLabel(box); 56 label = new QLabel; 62 57 label->setText(getLabel()); 63 label->setBackgroundOrigin(QWidget::WindowOrigin);64 58 label->setAlignment(Qt::AlignHCenter); 65 59 label->setSizePolicy(QSizePolicy(QSizePolicy::Minimum, 66 60 QSizePolicy::Maximum)); 67 61 62 QHBoxLayout *layout = new QHBoxLayout; 63 layout->addWidget(label); 64 65 QWidget *box = new QWidget(dialog); 66 box->setSizePolicy(QSizePolicy(QSizePolicy::Minimum, 67 QSizePolicy::Maximum)); 68 box->setLayout(layout); 69 68 70 dialog->addWidget(box); 69 71 } 70 72 … … 142 144 143 145 GetMythUI()->GetScreenSettings(wmult, hmult); 144 146 145 QVBoxLayout *layout = new QVBoxLayout(dialog, (int)(20 * hmult)); 147 QVBoxLayout *layout = new QVBoxLayout(dialog); 148 layout->setSpacing((int)(20 * hmult)); 146 149 147 150 ChildList::iterator it = cfgChildren.begin(); 148 151 childwidget.clear(); -
mythtv/libs/libmyth/mythdialogs.cpp
6 6 #include <QCursor> 7 7 #include <QDialog> 8 8 #include <QDir> 9 #include <q3vbox.h>10 9 #include <QApplication> 11 10 #include <QLayout> 12 11 #include <QRegExp> 13 #include <q3accel.h>14 12 #include <QImageReader> 15 #include <QEventLoop>16 13 #include <QLabel> 17 14 #include <QPixmap> 18 15 #include <QKeyEvent> 19 #include <Q3VBoxLayout>20 16 #include <QFrame> 21 17 #include <QPaintEvent> 22 18 #include <QPainter> … … 429 425 widget->setFont(font()); 430 426 } 431 427 432 if (widget-> isA("QLabel"))428 if (widget->metaObject()->className() == QString("QLabel")) 433 429 { 434 widget->setBackgroundOrigin(ParentOrigin); 435 widget->setPaletteForegroundColor(popupForegroundColor); 430 QPalette palette; 431 palette.setColor(widget->foregroundRole(), popupForegroundColor); 432 widget->setPalette(palette); 436 433 } 437 434 438 435 vbox->addWidget(widget); … … 455 452 // Get a char from within the string to determine direction. 456 453 if (caption.length()) 457 454 text_dir = caption[0].direction(); 458 int align = (QChar::DirAL == text_dir) ?459 Qt:: WordBreak | Qt::AlignRight : Qt::WordBreak |Qt::AlignLeft;455 Qt::Alignment align = (QChar::DirAL == text_dir) ? 456 Qt::AlignRight : Qt::AlignLeft; 460 457 label->setAlignment(align); 458 label->setWordWrap(true); 461 459 } 462 460 463 461 label->setWordWrap(true); … … 508 506 } 509 507 } 510 508 511 polish();509 ensurePolished(); 512 510 513 511 int x = 0, y = 0, maxw = 0, poph = 0; 514 512 … … 520 518 521 519 if (objs->isWidgetType()) 522 520 { 523 QString objname = objs-> name();521 QString objname = objs->objectName(); 524 522 if (objname != "nopopsize") 525 523 { 526 524 // little extra padding for these guys 527 if (objs->isA("MythListBox")) 525 if (objs->metaObject()->className() == 526 QString("MythListBox")) 527 { 528 528 poph += (int)(25 * hmult); 529 } 529 530 530 531 QWidget *widget = (QWidget *)objs; 531 532 poph += widget->height(); … … 646 647 if (objs->isWidgetType()) 647 648 { 648 649 QWidget *widget = (QWidget *)objs; 649 if (widget->isA("MythPushButton")) 650 if (widget->metaObject()->className() == 651 QString("MythPushButton")) 650 652 { 651 653 if (widget->hasFocus()) 652 654 { … … 674 676 if (objs->isWidgetType()) 675 677 { 676 678 QWidget *widget = (QWidget *)objs; 677 if (widget->isA("MythPushButton")) 679 if (widget->metaObject()->className() == 680 QString("MythPushButton")) 678 681 { 679 682 MythPushButton *button = dynamic_cast<MythPushButton*>(widget); 680 683 if (button && button->isDown()) … … 855 858 setGeometry(xoff, yoff, screenwidth - xoff * 2, yoff); 856 859 setFixedSize(QSize(screenwidth - xoff * 2, yoff)); 857 860 858 Q3VBoxLayout *lay = new Q3VBoxLayout(this, 0); 861 msglabel = new QLabel(); 862 msglabel->setText(message); 859 863 860 Q 3VBox *vbox = new Q3VBox(this);861 lay->addWidget(vbox);864 QVBoxLayout *vlayout = new QVBoxLayout(); 865 vlayout->addWidget(msglabel); 862 866 863 vbox->setLineWidth(3); 864 vbox->setMidLineWidth(3); 865 vbox->setFrameShape(Q3Frame::Panel); 866 vbox->setFrameShadow(Q3Frame::Raised); 867 vbox->setMargin((int)(15 * wmult)); 867 progress = new QProgressBar(); 868 progress->setRange(0, totalSteps); 868 869 869 msglabel = new QLabel(vbox); 870 msglabel->setBackgroundOrigin(ParentOrigin); 871 msglabel->setText(message); 872 vbox->setStretchFactor(msglabel, 5); 870 QHBoxLayout *hlayout = new QHBoxLayout(); 871 hlayout->addWidget(progress); 873 872 874 Q3HBox *hbox = new Q3HBox(vbox);875 hbox->setSpacing(5);876 877 progress = new Q3ProgressBar(totalSteps, hbox);878 progress->setBackgroundOrigin(ParentOrigin);879 880 873 if (cancelButton && slot && target) 881 874 { 882 MythPushButton *button = new MythPushButton("Cancel", hbox, 0); 875 MythPushButton *button = new MythPushButton( 876 NULL, QObject::tr("Cancel")); 883 877 button->setFocus(); 878 hlayout->addWidget(button); 884 879 connect(button, SIGNAL(pressed()), target, slot); 885 880 } 886 881 … … 895 890 lcddev->switchToGeneric(textItems); 896 891 } 897 892 893 hlayout->setSpacing(5); 894 895 vlayout->setMargin((int)(15 * wmult)); 896 vlayout->setStretchFactor(msglabel, 5); 897 898 QWidget *hbox = new QWidget(); 899 hbox->setLayout(hlayout); 900 hlayout->addWidget(hbox); 901 902 QFrame *vbox = new QFrame(this); 903 vbox->setObjectName(objectName() + "_vbox"); 904 vbox->setLineWidth(3); 905 vbox->setMidLineWidth(3); 906 vbox->setFrameShape(QFrame::Panel); 907 vbox->setFrameShadow(QFrame::Raised); 908 vbox->setLayout(vlayout); 909 910 QVBoxLayout *lay = new QVBoxLayout(); 911 lay->addWidget(vbox); 912 setLayout(lay); 913 898 914 show(); 899 915 900 916 qApp->processEvents(); … … 924 940 925 941 void MythProgressDialog::setProgress(int curprogress) 926 942 { 927 progress->set Progress(curprogress);943 progress->setValue(curprogress); 928 944 if (curprogress % steps == 0) 929 945 { 930 946 qApp->processEvents(); … … 962 978 void MythProgressDialog::setTotalSteps(int totalSteps) 963 979 { 964 980 m_totalSteps = totalSteps; 965 progress->set TotalSteps(totalSteps);981 progress->setRange(0, totalSteps); 966 982 steps = totalSteps / 1000; 967 983 if (steps == 0) 968 984 steps = 1; … … 974 990 cancelButton, target, slot), 975 991 timer(NULL) 976 992 { 993 setObjectName("MythBusyDialog"); 977 994 } 978 995 979 996 MythBusyDialog::~MythBusyDialog() … … 1022 1039 1023 1040 void MythBusyDialog::setProgress(void) 1024 1041 { 1025 progress->set Progress(progress->progress() + 10);1042 progress->setValue(progress->value() + 10); 1026 1043 qApp->processEvents(); 1027 1044 if (LCD *lcddev = LCD::Get()) 1028 1045 lcddev->setGenericBusy(); … … 1408 1425 if (redrawRect.width() > 0 && redrawRect.height() > 0) 1409 1426 ReallyUpdateForeground(redrawRect); 1410 1427 1411 bitBlt(this, e->rect().left(), e->rect().top(), 1412 &my_foreground, e->rect().left(), e->rect().top(), 1413 e->rect().width(), e->rect().height()); 1428 QPainter p(this); 1429 p.drawPixmap(e->rect().topLeft(), my_foreground, e->rect()); 1414 1430 1415 1431 MythDialog::paintEvent(e); 1416 1432 } … … 1597 1613 return GetUIType<UITextType>(this, name); 1598 1614 } 1599 1615 1600 UIRichTextType* MythThemedDialog::getUIRichTextType(const QString &name)1601 {1602 return GetUIType<UIRichTextType>(this, name);1603 }1604 1605 1616 UIRemoteEditType* MythThemedDialog::getUIRemoteEditType(const QString &name) 1606 1617 { 1607 1618 return GetUIType<UIRemoteEditType>(this, name); … … 1845 1856 { 1846 1857 if (editor) 1847 1858 { 1848 editor-> setText(text);1849 editor-> setCursorPosition(0, editor->text().length());1859 editor->clear(); 1860 editor->insertPlainText(text); 1850 1861 } 1851 1862 } 1852 1863 … … 2162 2173 2163 2174 if (fi.isDir()) 2164 2175 { 2165 buildFileList(fi.abs FilePath());2176 buildFileList(fi.absoluteFilePath()); 2166 2177 } 2167 2178 else 2168 2179 { 2169 r.setPattern("^" + fi. extension() + "$");2170 r.setCaseSensitiv e(false);2171 QStringList result = imageExtensions. grep(r);2180 r.setPattern("^" + fi.completeSuffix() + "$"); 2181 r.setCaseSensitivity(Qt::CaseInsensitive); 2182 QStringList result = imageExtensions.filter(r); 2172 2183 if (!result.isEmpty()) 2173 2184 { 2174 image_files.append(fi.abs FilePath());2185 image_files.append(fi.absoluteFilePath()); 2175 2186 } 2176 2187 else 2177 2188 { 2178 r.setPattern("^" + fi. extension());2179 r.setCaseSensitiv e(false);2180 QStringList other_result = imageExtensions. grep(r);2189 r.setPattern("^" + fi.completeSuffix()); 2190 r.setCaseSensitivity(Qt::CaseInsensitive); 2191 QStringList other_result = imageExtensions.filter(r); 2181 2192 if (!result.isEmpty()) 2182 2193 { 2183 image_files.append(fi.abs FilePath());2194 image_files.append(fi.absoluteFilePath()); 2184 2195 } 2185 2196 } 2186 2197 } -
mythtv/libs/libmyth/mythmediamonitor.cpp
221 221 222 222 if (device->eject(false) != MEDIAERR_OK) 223 223 { 224 QString msg = "Unable to open or close the empty drive %1.\n\n"; 225 msg += "You may have to use the eject button under its tray."; 226 ShowOkPopup(tr(msg).arg(dev)); 224 QString msg = QObject::tr( 225 "Unable to open or close the empty drive %1.\n\n" 226 "You may have to use the eject button under its tray."); 227 ShowOkPopup(msg.arg(dev)); 227 228 } 228 229 229 230 return; … … 306 307 { 307 308 QString target = fi->readLink(); 308 309 309 if (m_IgnoreList. grep(target).isEmpty())310 if (m_IgnoreList.filter(target).isEmpty()) 310 311 { 311 312 VERBOSE(VB_MEDIA, "Also ignoring " + target + 312 313 " (symlinked from " + *dev + ")."); -
mythtv/libs/libmyth/mythwidgets.cpp
5 5 #include <QPainter> 6 6 #include <QCursor> 7 7 #include <QApplication> 8 #include <q3vbox.h>9 8 #include <QLayout> 10 9 #include <QKeyEvent> 11 10 #include <QHideEvent> … … 34 33 } 35 34 36 35 MythComboBox::MythComboBox(bool rw, QWidget *parent, const char *name) : 37 QComboBox( rw, parent, name),36 QComboBox(parent), 38 37 popup(NULL), helptext(QString::null), AcceptOnSelect(false), 39 38 useVirtualKeyboard(true), allowVirtualKeyboard(rw), 40 39 popupPosition(VK_POSBELOWEDIT), step(1) 41 40 { 41 setObjectName(name); 42 setEditable(rw); 42 43 useVirtualKeyboard = gContext->GetNumSetting("UseVirtualKeyboard", 1); 43 44 } 44 45 … … 82 83 { 83 84 bool handled = false, updated = false; 84 85 QStringList actions; 85 if ((!popup || !popup->isShown()) &&86 if ((!popup || popup->isHidden()) && 86 87 (gContext->TranslateKeyPress("qt", e, actions, !allowVirtualKeyboard))) 87 88 { 88 89 for (int i = 0; i < actions.size() && !handled; i++) … … 154 155 } 155 156 if (!handled) 156 157 { 157 if ( editable())158 if (isEditable()) 158 159 QComboBox::keyPressEvent(e); 159 160 else 160 161 e->ignore(); … … 166 167 emit changeHelpText(helptext); 167 168 emit gotFocus(); 168 169 169 QColor highlight = colorGroup().highlight();170 QColor highlight = palette().color(QPalette::Highlight); 170 171 171 this->setPaletteBackgroundColor(highlight); 172 QPalette palette; 173 palette.setColor(backgroundRole(), highlight); 174 setPalette(palette); 172 175 173 176 if (lineEdit()) 174 lineEdit()->setPalette BackgroundColor(highlight);177 lineEdit()->setPalette(palette); 175 178 176 179 QComboBox::focusInEvent(e); 177 180 } 178 181 179 182 void MythComboBox::focusOutEvent(QFocusEvent *e) 180 183 { 181 this->unsetPalette();184 setPalette(QPalette()); 182 185 183 186 if (lineEdit()) 184 187 { 185 lineEdit()-> unsetPalette();188 lineEdit()->setPalette(QPalette()); 186 189 187 190 // commit change if the user was editting an entry 188 191 QString curText = currentText(); … … 190 193 bool foundItem = false; 191 194 192 195 for(i = 0; i < count(); i++) 193 if (curText == text(i))196 if (curText == itemText(i)) 194 197 foundItem = true; 195 198 196 199 if (!foundItem) … … 241 244 { 242 245 emit changeHelpText(helptext); 243 246 244 QColor highlight = colorGroup().highlight(); 247 QColor highlight = palette().color(QPalette::Highlight); 248 QPalette palette; 249 palette.setColor(backgroundRole(), highlight); 250 setPalette(palette); 245 251 246 this->setPaletteBackgroundColor(highlight);247 252 QCheckBox::focusInEvent(e); 248 253 } 249 254 250 255 void MythCheckBox::focusOutEvent(QFocusEvent *e) 251 256 { 252 this->unsetPalette();257 setPalette(QPalette()); 253 258 QCheckBox::focusOutEvent(e); 254 259 } 255 260 … … 291 296 { 292 297 emit changeHelpText(helptext); 293 298 294 QColor highlight = colorGroup().highlight();299 QColor highlight = palette().color(QPalette::Highlight); 295 300 296 this->setPaletteBackgroundColor(highlight); 301 QPalette palette; 302 palette.setColor(backgroundRole(), highlight); 303 setPalette(palette); 304 297 305 QRadioButton::focusInEvent(e); 298 306 } 299 307 300 308 void MythRadioButton::focusOutEvent(QFocusEvent *e) 301 309 { 302 this->unsetPalette();310 setPalette(QPalette()); 303 311 QRadioButton::focusOutEvent(e); 304 312 } 305 313 … … 350 358 { 351 359 emit changeHelpText(helptext); 352 360 353 QColor highlight = colorGroup().highlight();361 QColor highlight = palette().color(QPalette::Highlight); 354 362 355 this->setPaletteBackgroundColor(highlight); 363 QPalette palette; 364 palette.setColor(backgroundRole(), highlight); 365 setPalette(palette); 366 356 367 QSpinBox::focusInEvent(e); 357 368 } 358 369 359 370 void MythSpinBox::focusOutEvent(QFocusEvent *e) 360 371 { 361 this->unsetPalette();372 setPalette(QPalette()); 362 373 QSpinBox::focusOutEvent(e); 363 374 } 364 375 … … 378 389 else if (action == "DOWN") 379 390 focusNextPrevChild(true); 380 391 else if (action == "LEFT") 381 setValue(value() - lineStep());392 setValue(value() - singleStep()); 382 393 else if (action == "RIGHT") 383 setValue(value() + lineStep());394 setValue(value() + singleStep()); 384 395 else if (action == "SELECT") 385 396 handled = true; 386 397 else … … 404 415 { 405 416 emit changeHelpText(helptext); 406 417 407 QColor highlight = colorGroup().highlight();418 QColor highlight = palette().color(QPalette::Highlight); 408 419 409 this->setPaletteBackgroundColor(highlight); 420 QPalette palette; 421 palette.setColor(backgroundRole(), highlight); 422 setPalette(palette); 423 410 424 QSlider::focusInEvent(e); 411 425 } 412 426 413 427 void MythSlider::focusOutEvent(QFocusEvent *e) 414 428 { 415 this->unsetPalette();429 setPalette(QPalette()); 416 430 QSlider::focusOutEvent(e); 417 431 } 418 432 419 MythLineEdit::MythLineEdit(QWidget *parent, const char * widgetName) :420 QLineEdit(parent , widgetName),433 MythLineEdit::MythLineEdit(QWidget *parent, const char *name) : 434 QLineEdit(parent), 421 435 popup(NULL), helptext(QString::null), rw(true), 422 436 useVirtualKeyboard(true), 423 437 allowVirtualKeyboard(true), 424 438 popupPosition(VK_POSBELOWEDIT) 425 439 { 440 setObjectName(name); 426 441 useVirtualKeyboard = gContext->GetNumSetting("UseVirtualKeyboard", 1); 427 442 } 428 443 429 444 MythLineEdit::MythLineEdit( 430 const QString &contents, QWidget *parent, const char * widgetName) :431 QLineEdit(contents, parent , widgetName),445 const QString &contents, QWidget *parent, const char *name) : 446 QLineEdit(contents, parent), 432 447 popup(NULL), helptext(QString::null), rw(true), 433 448 useVirtualKeyboard(true), 434 449 allowVirtualKeyboard(true), 435 450 popupPosition(VK_POSBELOWEDIT) 436 451 { 452 setObjectName(name); 437 453 useVirtualKeyboard = gContext->GetNumSetting("UseVirtualKeyboard", 1); 438 454 } 439 455 … … 468 484 { 469 485 bool handled = false; 470 486 QStringList actions; 471 if ((!popup || !popup->isShown()) &&487 if ((!popup || popup->isHidden()) && 472 488 gContext->TranslateKeyPress("qt", e, actions, false)) 473 489 { 474 490 for (int i = 0; i < actions.size() && !handled; i++) … … 531 547 { 532 548 emit changeHelpText(helptext); 533 549 534 QColor highlight = colorGroup().highlight();550 QColor highlight = palette().color(QPalette::Highlight); 535 551 536 this->setPaletteBackgroundColor(highlight); 552 QPalette palette; 553 palette.setColor(backgroundRole(), highlight); 554 setPalette(palette); 555 537 556 QLineEdit::focusInEvent(e); 538 557 } 539 558 540 559 void MythLineEdit::focusOutEvent(QFocusEvent *e) 541 560 { 542 this->unsetPalette();543 if (popup && popup->isShown() && !popup->hasFocus())561 setPalette(QPalette()); 562 if (popup && !popup->isHidden() && !popup->hasFocus()) 544 563 popup->hide(); 545 564 QLineEdit::focusOutEvent(e); 546 565 } 547 566 548 567 void MythLineEdit::hideEvent(QHideEvent *e) 549 568 { 550 if (popup && popup->isShown())569 if (popup && !popup->isHidden()) 551 570 popup->hide(); 552 571 QLineEdit::hideEvent(e); 553 572 } … … 557 576 QLineEdit::mouseDoubleClickEvent(e); 558 577 } 559 578 560 MythRemoteLineEdit::MythRemoteLineEdit(QWidget * parent, const char * name)561 : Q3TextEdit(parent, name)579 MythRemoteLineEdit::MythRemoteLineEdit(QWidget * parent, const char *name) : 580 QTextEdit(parent) 562 581 { 582 setObjectName(name); 563 583 my_font = NULL; 564 584 m_lines = 1; 565 585 this->Init(); 566 586 } 567 587 568 588 MythRemoteLineEdit::MythRemoteLineEdit(const QString & contents, 569 QWidget * parent, const char * name)570 : Q3TextEdit(parent, name)589 QWidget * parent, const char *name) : 590 QTextEdit(parent) 571 591 { 592 setObjectName(name); 572 593 my_font = NULL; 573 594 m_lines = 1; 574 595 this->Init(); … … 576 597 } 577 598 578 599 MythRemoteLineEdit::MythRemoteLineEdit(QFont *a_font, QWidget * parent, 579 const char * name)580 : Q3TextEdit(parent, name)600 const char *name) : 601 QTextEdit(parent) 581 602 { 603 setObjectName(name); 582 604 my_font = a_font; 583 605 m_lines = 1; 584 606 this->Init(); 585 607 } 586 608 587 609 MythRemoteLineEdit::MythRemoteLineEdit(int lines, QWidget * parent, 588 const char * name)589 : Q3TextEdit(parent, name)610 const char *name) : 611 QTextEdit(parent) 590 612 { 613 setObjectName(name); 591 614 my_font = NULL; 592 615 m_lines = lines; 593 616 this->Init(); … … 602 625 current_choice = ""; 603 626 current_set = ""; 604 627 605 // We need to start out in PlainText format606 // and only toggle RichText on if we are in607 // the middle of a character cycle. That's608 // the only way to do all this in a way which609 // works across most 3.x.x versions of Qt.610 setTextFormat(Qt::PlainText);611 612 628 cycle_time = 3000; 613 629 614 pre_cycle_text_upto = ""; 615 pre_cycle_text_from = ""; 616 pre_cycle_para = 0; 617 pre_cycle_pos = 0; 630 pre_cycle_text_before_cursor = ""; 631 pre_cycle_text_after_cursor = ""; 618 632 619 col_unselected.setRgb(100, 100, 100); 620 col_selected.setRgb(0, 255, 255); 621 col_special.setRgb(255, 0, 0); 633 setCharacterColors( 634 QColor(100, 100, 100), QColor(0, 255, 255), QColor(255, 0, 0)); 622 635 623 assignHexColors();624 625 636 // Try and make sure it doesn't ever change 626 setWordWrap(Q3TextEdit::NoWrap); 627 Q3ScrollView::setVScrollBarMode(Q3ScrollView::AlwaysOff); 628 Q3ScrollView::setHScrollBarMode(Q3ScrollView::AlwaysOff); 637 setWordWrapMode(QTextOption::NoWrap); 629 638 630 639 if (my_font) 631 640 setFont(*my_font); … … 642 651 popupPosition = VK_POSBELOWEDIT; 643 652 } 644 653 654 655 void MythRemoteLineEdit::setCharacterColors( 656 QColor unselected, QColor selected, QColor special) 657 { 658 col_unselected = unselected; 659 hex_unselected = QString("%1%2%3") 660 .arg(col_unselected.red(), 2, 16, QLatin1Char('0')) 661 .arg(col_unselected.green(), 2, 16, QLatin1Char('0')) 662 .arg(col_unselected.blue(), 2, 16, QLatin1Char('0')); 663 664 col_selected = selected; 665 hex_selected = QString("%1%2%3") 666 .arg(col_selected.red(), 2, 16, QLatin1Char('0')) 667 .arg(col_selected.green(), 2, 16, QLatin1Char('0')) 668 .arg(col_selected.blue(), 2, 16, QLatin1Char('0')); 669 670 col_special = special; 671 hex_special = QString("%1%2%3") 672 .arg(col_special.red(), 2, 16, QLatin1Char('0')) 673 .arg(col_special.green(), 2, 16, QLatin1Char('0')) 674 .arg(col_special.blue(), 2, 16, QLatin1Char('0')); 675 } 676 645 677 void MythRemoteLineEdit::startCycle(QString current_choice, QString set) 646 678 { 647 int end_paragraph;648 int end_position;649 int dummy;650 int dummy_two;651 652 679 if (active_cycle) 653 680 { 654 cerr << "libmyth: MythRemoteLineEdit was asked to start a cycle when a cycle was already active." << endl; 681 VERBOSE(VB_IMPORTANT, "MythRemoteLineEdit, Programmer Error: " 682 "startCycle() called, but edit is already in a cycle."); 683 return; 655 684 } 656 else657 {658 cycle_timer->start(cycle_time, true);659 active_cycle = true;660 // Amazingly, Qt (version < 3.1.1) only lets us pull661 // text out in segments by fiddling around662 // with selecting it. Oh well.663 getCursorPosition(&pre_cycle_para, &pre_cycle_pos);664 selectAll(true);665 getSelection(&dummy, &dummy_two, &end_paragraph, &end_position);666 setSelection(pre_cycle_para, pre_cycle_pos, end_paragraph, end_position, 0);667 pre_cycle_text_from = selectedText();668 setSelection(0, 0, pre_cycle_para, pre_cycle_pos, 0);669 pre_cycle_text_upto = selectedText();670 selectAll(false);671 setCursorPosition(pre_cycle_para, pre_cycle_pos);672 updateCycle(current_choice, set); // Show the user their options673 }674 }675 685 676 void MythRemoteLineEdit::setCharacterColors(QColor unselected, QColor selected, 677 QColor special) 678 { 679 col_unselected = unselected; 680 col_selected = selected; 681 col_special = special; 682 assignHexColors(); 686 cycle_timer->start(cycle_time, true); 687 active_cycle = true; 688 689 QTextCursor pre_cycle_cursor = textCursor(); 690 691 QTextCursor upto_cursor_sel = pre_cycle_cursor; 692 upto_cursor_sel.movePosition( 693 QTextCursor::NoMove, QTextCursor::MoveAnchor); 694 upto_cursor_sel.movePosition( 695 QTextCursor::Start, QTextCursor::KeepAnchor); 696 pre_cycle_text_before_cursor = upto_cursor_sel.selectedText(); 697 698 QTextCursor from_cursor_sel = pre_cycle_cursor; 699 from_cursor_sel.movePosition( 700 QTextCursor::NoMove, QTextCursor::MoveAnchor); 701 from_cursor_sel.movePosition( 702 QTextCursor::End, QTextCursor::KeepAnchor); 703 pre_cycle_text_after_cursor = from_cursor_sel.selectedText(); 704 705 pre_cycle_pos = pre_cycle_text_before_cursor.length(); 706 707 updateCycle(current_choice, set); // Show the user their options 683 708 } 684 709 685 710 void MythRemoteLineEdit::updateCycle(QString current_choice, QString set) … … 722 747 int length = set.length(); 723 748 if (index < 0 || index > length) 724 749 { 725 cerr << "libmyth: MythRemoteLineEdit passed a choice of \"" << (const char *)current_choice << "\" which is not in set \"" << (const char *)set << "\"" << endl; 750 VERBOSE(VB_IMPORTANT, 751 "MythRemoteLineEdit passed a choice of \"" 752 << current_choice << "\" which is not in set \"" 753 << set << "\""); 726 754 setText("????"); 727 755 return; 728 756 } … … 731 759 set.replace(index, current_choice.length(), bString); 732 760 } 733 761 734 QString esc_upto = pre_cycle_text_ upto;735 QString esc_from = pre_cycle_text_ from;762 QString esc_upto = pre_cycle_text_before_cursor; 763 QString esc_from = pre_cycle_text_after_cursor; 736 764 737 765 esc_upto.replace("<", "<").replace(">", ">").replace("\n", "<br>"); 738 766 esc_from.replace("<", "<").replace(">", ">").replace("\n", "<br>"); … … 744 772 aString += set; 745 773 aString += "]</FONT>"; 746 774 aString += esc_from; 747 setTextFormat(Qt::RichText); 748 setText(aString); 749 setCursorPosition(pre_cycle_para, pre_cycle_pos + set.length()); 775 setHtml(aString); 776 777 QTextCursor tmp = textCursor(); 778 tmp.movePosition(QTextCursor::Start, QTextCursor::MoveAnchor); 779 tmp.movePosition(QTextCursor::Right, QTextCursor::MoveAnchor, 780 pre_cycle_pos + set.length()); 781 setTextCursor(tmp); 750 782 update(); 751 setCursorPosition(pre_cycle_para, pre_cycle_pos);752 783 753 // If current selection is delete, 754 // select the character that may well 755 // get deleted 756 757 if (current_choice == "X" && pre_cycle_pos > 0) 784 if (current_choice == "X" && !pre_cycle_text_before_cursor.isEmpty()) 758 785 { 759 setSelection(pre_cycle_para, pre_cycle_pos - 1, pre_cycle_para, pre_cycle_pos, 0); 786 // If current selection is delete, select the character to be deleted 787 QTextCursor tmp = textCursor(); 788 tmp.movePosition(QTextCursor::Start, QTextCursor::MoveAnchor); 789 tmp.movePosition(QTextCursor::Right, QTextCursor::MoveAnchor, 790 pre_cycle_pos - 1); 791 tmp.movePosition(QTextCursor::Right, QTextCursor::KeepAnchor); 792 setTextCursor(tmp); 760 793 } 794 else 795 { 796 // Restore original cursor location 797 QTextCursor tmp = textCursor(); 798 tmp.movePosition(QTextCursor::Start, QTextCursor::MoveAnchor); 799 tmp.movePosition(QTextCursor::Right, QTextCursor::MoveAnchor, 800 pre_cycle_pos); 801 setTextCursor(tmp); 802 } 761 803 } 762 804 763 void MythRemoteLineEdit:: assignHexColors()805 void MythRemoteLineEdit::endCycle(bool select) 764 806 { 765 char text[1024]; 807 if (!active_cycle) 808 return; 766 809 767 sprintf(text, "%.2X%.2X%.2X", col_unselected.red(), col_unselected.green(), col_unselected.blue());768 hex_unselected = text;810 QString tmpString = ""; 811 int pos = pre_cycle_pos; 769 812 770 sprintf(text, "%.2X%.2X%.2X", col_selected.red(), col_selected.green(), col_selected.blue()); 771 hex_selected = text; 772 773 sprintf(text, "%.2X%.2X%.2X", col_special.red(), col_special.green(), col_special.blue()); 774 hex_special = text; 775 } 776 777 void MythRemoteLineEdit::endCycle() 778 { 779 QString aString; 780 781 if (active_cycle) 813 // The timer ran out or the user pressed a key 814 // outside of the current set of choices 815 if (!select) 782 816 { 783 // The timer ran out or the user pressed a key 784 // outside of the current set of choices 785 if (current_choice == "_") // Space 817 tmpString = pre_cycle_text_before_cursor; 818 } 819 else if (current_choice == "X") // destructive backspace 820 { 821 if (!pre_cycle_text_before_cursor.isEmpty()) 786 822 { 787 aString = pre_cycle_text_upto;788 aString += " ";789 aString += pre_cycle_text_from;823 tmpString = pre_cycle_text_before_cursor.left( 824 pre_cycle_text_before_cursor.length() - 1); 825 pos--; 790 826 } 791 else if (current_choice == "X") // destructive backspace792 {793 // Deal with special case in a way794 // that all 3.x.x versions of Qt795 // can handle827 } 828 else 829 { 830 current_choice = (current_choice == "_") ? " " : current_choice; 831 current_choice = (shift) ? current_choice.toUpper() : current_choice; 796 832 797 if (pre_cycle_text_upto.length() > 0) 798 { 799 aString = pre_cycle_text_upto.left(pre_cycle_text_upto.length() - 1); 800 } 801 else 802 { 803 aString = ""; 804 } 805 aString += pre_cycle_text_from; 806 pre_cycle_pos--; 807 } 808 else if (shift) 809 { 810 aString = pre_cycle_text_upto; 811 aString += current_choice.toUpper(); 812 aString += pre_cycle_text_from; 813 } 814 else 815 { 816 aString = pre_cycle_text_upto; 817 aString += current_choice; 818 aString += pre_cycle_text_from; 819 } 833 tmpString = pre_cycle_text_before_cursor; 834 tmpString += current_choice; 835 pos++; 836 } 820 837 821 setTextFormat(Qt::PlainText); 822 setText(aString); 823 setCursorPosition(pre_cycle_para, pre_cycle_pos + 1); 824 active_cycle = false; 825 current_choice = ""; 826 current_set = ""; 827 } 828 emit(textChanged(this->text())); 838 tmpString += pre_cycle_text_after_cursor; 839 840 setPlainText(tmpString); 841 842 QTextCursor tmpCursor = textCursor(); 843 tmpCursor.movePosition(QTextCursor::Start, QTextCursor::MoveAnchor); 844 tmpCursor.movePosition(QTextCursor::Right, QTextCursor::MoveAnchor, pos); 845 setTextCursor(tmpCursor); 846 847 active_cycle = false; 848 current_choice = ""; 849 current_set = ""; 850 pre_cycle_text_before_cursor = ""; 851 pre_cycle_text_after_cursor = ""; 852 853 if (select) 854 emit textChanged(toPlainText()); 829 855 } 830 856 831 void MythRemoteLineEdit::setText(const QString &text)857 void MythRemoteLineEdit::setText(const QString &text) 832 858 { 833 int para, pos; 834 835 // Isaac had this in the original version 836 // of MythLineEdit, and I'm sure he had 837 // a reason ... 838 getCursorPosition(¶, &pos); 839 Q3TextEdit::setText(text); 840 setCursorPosition(para, pos); 859 QTextEdit::clear(); 860 QTextEdit::insertPlainText(text); 841 861 } 842 862 843 863 QString MythRemoteLineEdit::text(void) 844 864 { 845 return Q 3TextEdit::text();865 return QTextEdit::toPlainText(); 846 866 } 847 867 848 868 void MythRemoteLineEdit::keyPressEvent(QKeyEvent *e) … … 850 870 bool handled = false; 851 871 QStringList actions; 852 872 853 if ((!popup || !popup->isShown()) &&873 if ((!popup || popup->isHidden()) && 854 874 gContext->TranslateKeyPress("qt", e, actions, false)) 855 875 { 856 876 for (int i = 0; i < actions.size() && !handled; i++) … … 883 903 if (useVirtualKeyboard) 884 904 popupVirtualKeyboard(); 885 905 } 906 else if ((action == "ESCAPE") && active_cycle) 907 { 908 endCycle(false); 909 } 886 910 else 887 911 handled = false; 888 912 } … … 891 915 if (handled) 892 916 return; 893 917 894 if (popup && popup->isShown())918 if (popup && !popup->isHidden()) 895 919 { 896 920 endCycle(); 897 Q 3TextEdit::keyPressEvent(e);898 emit textChanged(t his->text());921 QTextEdit::keyPressEvent(e); 922 emit textChanged(toPlainText()); 899 923 return; 900 924 } 901 925 … … 976 1000 if (!handled) 977 1001 { 978 1002 endCycle(); 979 Q 3TextEdit::keyPressEvent(e);980 emit textChanged(t his->text());1003 QTextEdit::keyPressEvent(e); 1004 emit textChanged(toPlainText()); 981 1005 } 982 1006 } 983 1007 … … 985 1009 { 986 1010 if (desired_interval < 0.5 || desired_interval > 10.0) 987 1011 { 988 cerr << "libmyth: Did not accept key cycle interval of " << desired_interval << " seconds" << endl; 1012 VERBOSE(VB_IMPORTANT, QString("MythRemoteLineEdit, Programmer Error, ")+ 1013 QString("cycle interval of %1 milliseconds ") 1014 .arg((int) (desired_interval * 1000)) + 1015 "\n\t\t\tis outside of the allowed range of " 1016 "500 to 10,000 milliseconds"); 1017 return; 989 1018 } 990 else 991 { 992 cycle_time = (int) (desired_interval * 1000.0); 993 } 1019 1020 cycle_time = (int) (desired_interval * 1000); 994 1021 } 995 1022 996 1023 void MythRemoteLineEdit::cycleKeys(QString cycle_list) … … 1002 1029 if (cycle_list == current_set) 1003 1030 { 1004 1031 // Regular movement through existing set 1005 cycle_timer-> changeInterval(cycle_time);1032 cycle_timer->start(cycle_time); 1006 1033 index = current_set.indexOf(current_choice); 1007 1034 int length = current_set.length(); 1008 1035 if (index + 1 >= length) … … 1019 1046 endCycle(); 1020 1047 current_choice = cycle_list.left(1); 1021 1048 current_set = cycle_list; 1022 cycle_timer-> changeInterval(cycle_time);1049 cycle_timer->start(cycle_time); 1023 1050 startCycle(current_choice, current_set); 1024 1051 } 1025 1052 } … … 1069 1096 emit changeHelpText(helptext); 1070 1097 emit gotFocus(); //perhaps we need to save a playlist? 1071 1098 1072 QColor highlight = colorGroup().highlight();1099 QColor highlight = palette().color(QPalette::Highlight); 1073 1100 1074 this->setPaletteBackgroundColor(highlight); 1101 QPalette palette; 1102 palette.setColor(backgroundRole(), highlight); 1103 setPalette(palette); 1075 1104 1076 Q 3TextEdit::focusInEvent(e);1105 QTextEdit::focusInEvent(e); 1077 1106 } 1078 1107 1079 1108 void MythRemoteLineEdit::focusOutEvent(QFocusEvent *e) 1080 1109 { 1081 this->unsetPalette();1110 setPalette(QPalette()); 1082 1111 1083 if (popup && popup->isShown() && !popup->hasFocus())1112 if (popup && !popup->isHidden() && !popup->hasFocus()) 1084 1113 popup->hide(); 1085 1114 1086 1115 emit lostFocus(); 1087 Q 3TextEdit::focusOutEvent(e);1116 QTextEdit::focusOutEvent(e); 1088 1117 } 1089 1118 1090 1119 MythRemoteLineEdit::~MythRemoteLineEdit() … … 1095 1124 void MythRemoteLineEdit::deleteLater(void) 1096 1125 { 1097 1126 Teardown(); 1098 Q 3TextEdit::deleteLater();1127 QTextEdit::deleteLater(); 1099 1128 } 1100 1129 1101 1130 void MythRemoteLineEdit::Teardown(void) … … 1123 1152 1124 1153 void MythRemoteLineEdit::insert(QString text) 1125 1154 { 1126 Q 3TextEdit::insert(text);1127 emit textChanged(t his->text());1155 QTextEdit::insert(text); 1156 emit textChanged(toPlainText()); 1128 1157 } 1129 1158 1130 1159 void MythRemoteLineEdit::del() 1131 1160 { 1132 doKeyboardAction(Q 3TextEdit::ActionDelete);1133 emit textChanged(t his->text());1161 doKeyboardAction(QTextEdit::ActionDelete); 1162 emit textChanged(toPlainText()); 1134 1163 } 1135 1164 1136 1165 void MythRemoteLineEdit::backspace() 1137 1166 { 1138 doKeyboardAction(Q 3TextEdit::ActionBackspace);1139 emit textChanged(t his->text());1167 doKeyboardAction(QTextEdit::ActionBackspace); 1168 emit textChanged(toPlainText()); 1140 1169 } 1141 1170 1142 1171 MythPushButton::MythPushButton(const QString &ontext, const QString &offtext, 1143 1172 QWidget *parent, bool isOn, bool aa) 1144 1173 : QPushButton(ontext, parent) 1145 1174 { 1146 setBackgroundOrigin(WindowOrigin);1147 1175 arrowAccel = aa; 1148 1176 1149 1177 onText = ontext; 1150 1178 offText = offtext; 1151 1179 1152 set ToggleButton(true);1180 setCheckable(true); 1153 1181 1154 1182 if (isOn) 1155 1183 setText(onText); 1156 1184 else 1157 1185 setText(offText); 1158 1186 1159 set On(isOn);1187 setChecked(isOn); 1160 1188 } 1161 1189 1162 1190 void MythPushButton::setHelpText(const QString &help) … … 1182 1210 QString action = actions[i]; 1183 1211 if (action == "SELECT") 1184 1212 { 1185 if (is ToggleButton())1213 if (isCheckable()) 1186 1214 toggleText(); 1187 1215 setDown(true); 1188 1216 emit pressed(); … … 1197 1225 } 1198 1226 else if (action == "RIGHT") 1199 1227 { 1200 if (is ToggleButton())1228 if (isCheckable()) 1201 1229 toggleText(); 1202 1230 setDown(true); 1203 1231 emit pressed(); … … 1232 1260 1233 1261 void MythPushButton::toggleText(void) 1234 1262 { 1235 if (!is ToggleButton())1263 if (!isCheckable()) 1236 1264 return; 1237 1265 1238 if (is On())1266 if (isChecked()) 1239 1267 setText(offText); 1240 1268 else 1241 1269 setText(onText); … … 1245 1273 { 1246 1274 emit changeHelpText(helptext); 1247 1275 1248 QColor highlight = colorGroup().highlight(); 1276 QColor highlight = palette().color(QPalette::Highlight); 1277 QPalette palette; 1278 palette.setColor(backgroundRole(), highlight); 1279 setPalette(palette); 1249 1280 1250 this->setPaletteBackgroundColor(highlight);1251 1281 QPushButton::focusInEvent(e); 1252 1282 } 1253 1283 1254 1284 void MythPushButton::focusOutEvent(QFocusEvent *e) 1255 1285 { 1256 this->unsetPalette();1286 setPalette(QPalette()); 1257 1287 QPushButton::focusOutEvent(e); 1258 1288 } 1259 1289 -
mythtv/libs/libmyth/dialogbox.cpp
9 9 #undef DialogBox 10 10 #endif 11 11 12 #include <QButtonGroup> 13 #include <QBoxLayout> 14 12 15 DialogBox::DialogBox(MythMainWindow *parent, const QString &text, 13 16 const char *checkboxtext, 14 17 const char *name) 15 18 : MythDialog(parent, name) 16 19 { 17 20 QLabel *maintext = new QLabel(text, this); 18 maintext->set BackgroundOrigin(WindowOrigin);19 maintext->set Alignment(Qt::WordBreak | Qt::AlignLeft | Qt::AlignTop);21 maintext->setAlignment(Qt::AlignLeft | Qt::AlignTop); 22 maintext->setWordWrap(true); 20 23 21 box = new Q3VBoxLayout(this, (int)(60 * wmult), (int)(0 * hmult)); 22 24 box = new QVBoxLayout(this); 25 box->setContentsMargins((int)(60 * wmult),(int)(60 * wmult), 26 (int)(60 * wmult),(int)(60 * wmult)); 27 box->setSpacing(0); 23 28 box->addWidget(maintext, 1); 24 29 25 30 checkbox = NULL; 26 31 if (checkboxtext) 27 32 { 28 33 checkbox = new MythCheckBox(this); 29 checkbox->setText(checkboxtext); 30 checkbox->setBackgroundOrigin(WindowOrigin); 34 checkbox->setText(checkboxtext); 31 35 box->addWidget(checkbox, 0); 32 36 } 33 37 34 buttongroup = new Q 3ButtonGroup(0);38 buttongroup = new QButtonGroup(); 35 39 36 40 if (checkbox) 37 buttongroup->insert(checkbox); 38 connect(buttongroup, SIGNAL(clicked(int)), this, SLOT(buttonPressed(int))); 41 buttongroup->addButton(checkbox); 42 connect(buttongroup, SIGNAL(buttonClicked(int)), 43 this, SLOT( buttonPressed(int))); 39 44 } 40 45 41 46 void DialogBox::AddButton(const QString &title) 42 47 { 43 48 MythPushButton *button = new MythPushButton(title, this); 44 49 45 if (buttongroup-> count() == 0||46 (checkbox && buttongroup-> count() == 1))50 if (buttongroup->buttons().empty() || 51 (checkbox && buttongroup->buttons().size() == 1)) 47 52 { 48 53 button->setFocus(); 49 54 } 50 55 51 buttongroup-> insert(button);56 buttongroup->addButton(button); 52 57 53 58 box->addWidget(button, 0); 54 59 } 55 60 56 61 void DialogBox::buttonPressed(int which) 57 62 { 58 if (buttongroup-> find(which) != checkbox)63 if (buttongroup->button(which) != checkbox) 59 64 AcceptItem(which); 60 65 } -
mythtv/libs/libmyth/mythconfiggroups.h
3 3 #ifndef MYTH_CONFIG_GROUPS_H 4 4 #define MYTH_CONFIG_GROUPS_H 5 5 6 #include <QVBoxLayout> 7 #include <QGroupBox> 8 6 9 // MythTV headers 7 10 #include "mythexp.h" 8 11 #include "mythstorage.h" … … 87 90 88 91 private: 89 92 vector<QWidget*> childwidget; 90 Q 3GroupBox *widget;93 QGroupBox *widget; 91 94 ConfigurationGroup *confgrp; 92 95 QVBoxLayout *layout; 93 96 }; -
mythtv/libs/libmyth/mythdialogs.h
5 5 #include <QLabel> 6 6 #include <QAbstractButton> 7 7 #include <QObject> 8 #include <Q3VBoxLayout>9 #include <Q3ProgressBar>10 8 #include <QFrame> 11 9 #include <QVector> 12 10 #include <QList> … … 20 18 class UIType; 21 19 class UIManagedTreeListType; 22 20 class UITextType; 23 class UIRichTextType;24 21 class UIPushButtonType; 25 22 class UITextButtonType; 26 23 class UIRemoteEditType; … … 42 39 class MythListBox; 43 40 struct fontProp; 44 41 class MythMainWindow; 42 class QVBoxLayout; 43 class QProgressBar; 45 44 46 45 #include "libmythui/mythmainwindow.h" 47 46 … … 273 272 274 273 protected: 275 274 ~MythProgressDialog(); // use deleteLater() instead for thread safety 276 Q 3ProgressBar *progress;275 QProgressBar *progress; 277 276 QLabel *msglabel; 278 277 279 278 private: … … 366 365 367 366 UIManagedTreeListType *getUIManagedTreeListType(const QString &name); 368 367 UITextType *getUITextType(const QString &name); 369 UIRichTextType *getUIRichTextType(const QString &name);370 368 UIPushButtonType *getUIPushButtonType(const QString &name); 371 369 UITextButtonType *getUITextButtonType(const QString &name); 372 370 UIRemoteEditType *getUIRemoteEditType(const QString &name); -
mythtv/libs/libmyth/xmlparse.cpp
1730 1730 return; 1731 1731 } 1732 1732 1733 UI RichTextType *text = new UIRichTextType(name, testfont, value, draworder,1734 1733 UITextType *text = new UITextType(name, testfont, value, draworder, 1734 area, textArea); 1735 1735 text->SetScreen(wmult, hmult); 1736 1736 if (context != -1) 1737 1737 { … … 1742 1742 1743 1743 if (upArrowReg) 1744 1744 { 1745 text->SetImageUpArrowReg(*upArrowReg, upArrowRegPos);1745 //text->SetImageUpArrowReg(*upArrowReg, upArrowRegPos); 1746 1746 delete upArrowReg; 1747 1747 } 1748 1748 if (upArrowSel) 1749 1749 { 1750 text->SetImageUpArrowSel(*upArrowSel, upArrowSelPos);1750 //text->SetImageUpArrowSel(*upArrowSel, upArrowSelPos); 1751 1751 delete upArrowSel; 1752 1752 } 1753 1753 if (dnArrowReg) 1754 1754 { 1755 text->SetImageDnArrowReg(*dnArrowReg, dnArrowRegPos);1755 //text->SetImageDnArrowReg(*dnArrowReg, dnArrowRegPos); 1756 1756 delete dnArrowReg; 1757 1757 } 1758 1758 if (dnArrowSel) 1759 1759 { 1760 text->SetImageDnArrowSel(*dnArrowSel, dnArrowSelPos);1760 //text->SetImageDnArrowSel(*dnArrowSel, dnArrowSelPos); 1761 1761 delete dnArrowSel; 1762 1762 } 1763 1763 1764 text->SetShowScrollArrows(bShowArrows);1765 text->SetBackgroundImages(bgImageReg, bgImageSel);1764 //text->SetShowScrollArrows(bShowArrows); 1765 //text->SetBackgroundImages(bgImageReg, bgImageSel); 1766 1766 text->SetParent(container); 1767 1767 text->calculateScreenArea(); 1768 1768 container->AddType(text); -
mythtv/libs/libmyth/managedlist.h
324 324 class MPUBLIC BoolManagedListItem : public SelectManagedListItem 325 325 { 326 326 Q_OBJECT 327 327 328 public: 328 329 BoolManagedListItem(bool initialValue, 329 330 ManagedListGroup *pGroup=NULL, … … 347 348 bool boolValue() const { return (bool)valueText.toInt(); } 348 349 349 350 350 351 351 public slots: 352 352 virtual void cursorLeft(bool) { if (enabled) setValue(!boolValue()); } 353 353 virtual void cursorRight(bool) { if (enabled) setValue(!boolValue()); } -
mythtv/libs/libmyth/uitypes.cpp
393 393 394 394 void UIBarType::SetIcon(int num, QPixmap myIcon) 395 395 { 396 QImage sourceImg = myIcon. convertToImage();396 QImage sourceImg = myIcon.toImage(); 397 397 if (!sourceImg.isNull()) 398 398 { 399 399 QImage scalerImg; … … 402 402 (int)(m_iconsize.y()), 403 403 Qt::IgnoreAspectRatio, 404 404 Qt::SmoothTransformation); 405 iconData[num] .convertFromImage(scalerImg);405 iconData[num] = QPixmap::fromImage(scalerImg); 406 406 } 407 407 else 408 iconData[num] .resize(0, 0);408 iconData[num] = QPixmap(0, 0); 409 409 } 410 410 411 411 void UIBarType::LoadImage(int loc, QString myFile) … … 681 681 { 682 682 int breakin = 2; 683 683 QRect area = data->drawArea; 684 area.ad dCoords(breakin, breakin, -breakin, -breakin);684 area.adjust(breakin, breakin, -breakin, -breakin); 685 685 686 686 dr->setBrush(QBrush(Qt::NoBrush)); 687 687 dr->setPen(QPen(selcolor, 2)); … … 701 701 { 702 702 int breakin = 1; 703 703 QRect area = data->drawArea; 704 area.ad dCoords(breakin, breakin, -breakin, -breakin);704 area.adjust(breakin, breakin, -breakin, -breakin); 705 705 706 706 int recTypeOffset = 0; 707 707 … … 736 736 { 737 737 int breakin = 1; 738 738 QRect area = data->drawArea; 739 area.ad dCoords(breakin, breakin, -breakin, -breakin);739 area.adjust(breakin, breakin, -breakin, -breakin); 740 740 741 741 if (filltype == Alpha) 742 742 { … … 779 779 if (area.right() < prog_past_col) 780 780 { 781 781 fillColor = fillColor.dark(); 782 area.ad dCoords(breakin, breakin, -breakin, -breakin);782 area.adjust(breakin, breakin, -breakin, -breakin); 783 783 } 784 784 else 785 785 { … … 788 788 int second = area.width() - first; 789 789 overArea = area; 790 790 overArea.setWidth(first); 791 area. moveBy(first, 0);791 area.translate(first, 0); 792 792 area.setWidth(second); 793 793 794 area.ad dCoords(0, breakin, -breakin, -breakin);795 overArea.ad dCoords(breakin, breakin, 0, -breakin);794 area.adjust(0, breakin, -breakin, -breakin); 795 overArea.adjust(breakin, breakin, 0, -breakin); 796 796 } 797 797 } 798 798 else 799 area.ad dCoords(breakin, breakin, -breakin, -breakin);799 area.adjust(breakin, breakin, -breakin, -breakin); 800 800 801 801 if (area.width() <= 1) 802 802 area.setWidth(2); … … 808 808 QPixmap orig(area.width(), area.height()); 809 809 orig.fill(window, screenloc.x() + area.left(), 810 810 screenloc.y() + area.top()); 811 QImage tmpimg = orig. convertToImage();811 QImage tmpimg = orig.toImage(); 812 812 813 813 alphaBlender.blendImage(tmpimg, fillColor); 814 814 dr->drawImage(area.left(), area.top(), tmpimg); … … 818 818 orig = QPixmap(overArea.width(), overArea.height()); 819 819 orig.fill(window, screenloc.x() + overArea.left(), 820 820 screenloc.y() + overArea.top()); 821 tmpimg = orig. convertToImage();821 tmpimg = orig.toImage(); 822 822 823 823 alphaBlender.blendImage(tmpimg, overColor); 824 824 dr->drawImage(overArea.left(), overArea.top(), tmpimg); … … 852 852 msg += " (" + data->category + ")"; 853 853 854 854 QRect area = data->drawArea; 855 area.ad dCoords(textoffset.x(), textoffset.y(),856 855 area.adjust(textoffset.x(), textoffset.y(), 856 -textoffset.x(), -textoffset.y()); 857 857 858 858 if (data->arrow == 1 || data->arrow == 3) 859 859 area.setLeft(area.left() + arrowImages[0].width()); … … 1345 1345 m_downarrow.width(), m_downarrow.height()); 1346 1346 r = r.unite(r2); 1347 1347 1348 r. moveBy(m_parent->GetAreaRect().left(),1349 m_parent->GetAreaRect().top());1348 r.translate(m_parent->GetAreaRect().left(), 1349 m_parent->GetAreaRect().top()); 1350 1350 screen_area = r; 1351 1351 } 1352 1352 … … 1537 1537 1538 1538 if (m_parent) 1539 1539 { 1540 r. moveBy(m_parent->GetAreaRect().left(),1541 m_parent->GetAreaRect().top());1540 r.translate(m_parent->GetAreaRect().left(), 1541 m_parent->GetAreaRect().top()); 1542 1542 1543 1543 // 1544 1544 // Tell someone who cares … … 1692 1692 } 1693 1693 if (m_parent) 1694 1694 { 1695 r. moveBy(m_parent->GetAreaRect().left(),1696 m_parent->GetAreaRect().top());1695 r.translate(m_parent->GetAreaRect().left(), 1696 m_parent->GetAreaRect().top()); 1697 1697 1698 1698 // 1699 1699 // Tell someone who cares … … 2128 2128 if (showCheck) 2129 2129 { 2130 2130 QRect cr(checkRect); 2131 cr. moveBy(textRect.x(), textRect.y());2131 cr.translate(textRect.x(), textRect.y()); 2132 2132 if (item->selected) 2133 2133 p->drawPixmap(cr, *checkFullPixmap); 2134 2134 else … … 2262 2262 void UIImageGridType::calculateScreenArea(void) 2263 2263 { 2264 2264 QRect r = displayRect; 2265 r. moveBy(m_parent->GetAreaRect().left(),2266 m_parent->GetAreaRect().top());2265 r.translate(m_parent->GetAreaRect().left(), 2266 m_parent->GetAreaRect().top()); 2267 2267 screen_area = r; 2268 2268 } 2269 2269 … … 2396 2396 void UITextType::calculateScreenArea() 2397 2397 { 2398 2398 QRect r = m_displaysize; 2399 r. moveBy(m_parent->GetAreaRect().left(),2400 m_parent->GetAreaRect().top());2399 r.translate(m_parent->GetAreaRect().left(), 2400 m_parent->GetAreaRect().top()); 2401 2401 screen_area = r; 2402 2402 } 2403 2403 2404 2404 // ****************************************************************** 2405 2405 2406 UIRichTextType::UIRichTextType(const QString &name, fontProp *font,2407 const QString &text, int dorder, QRect displayrect,2408 QRect textrect)2409 : UIType(name)2410 {2411 2412 m_name = name;2413 takes_focus = true;2414 2415 if (Q3StyleSheet::mightBeRichText(text))2416 m_message = text;2417 else2418 m_message = Q3StyleSheet::convertFromPlainText(text, Q3StyleSheetItem::WhiteSpaceNormal);2419 2420 m_font = font;2421 m_displayArea = displayrect;2422 m_yPos = 0;2423 m_textArea = textrect;2424 m_order = dorder;2425 m_image = new QPixmap(m_displayArea.width(), m_displayArea.height());2426 m_background = new QPixmap(m_displayArea.width(), m_displayArea.height() );2427 m_compBackground = new QPixmap(m_displayArea.width(), m_displayArea.height() );2428 m_backgroundImage = NULL;2429 m_backgroundFile = "";2430 2431 m_bgImageReg = m_bgImageSel = "";2432 m_showScrollArrows = true;2433 }2434 2435 UIRichTextType::~UIRichTextType()2436 {2437 if (m_image)2438 delete m_image;2439 2440 if (m_background)2441 delete m_background;2442 2443 if (m_backgroundImage)2444 delete m_backgroundImage;2445 2446 if (m_compBackground)2447 delete m_compBackground;2448 }2449 2450 void UIRichTextType::SetText(const QString &text)2451 {2452 if (Q3StyleSheet::mightBeRichText(text))2453 m_message = text;2454 else2455 m_message = Q3StyleSheet::convertFromPlainText(text, Q3StyleSheetItem::WhiteSpaceNormal);2456 2457 m_yPos = 0;2458 m_showUpArrow = false;2459 refreshImage();2460 }2461 2462 void UIRichTextType::SetBackgroundImages(QString bgImageReg, QString bgImageSel)2463 {2464 m_bgImageReg = bgImageReg;2465 m_bgImageSel = bgImageSel;2466 2467 bool needreload = false;2468 loadBackgroundImg(needreload);2469 if (needreload) updateBackground();2470 }2471 2472 void UIRichTextType::SetBackground(QPixmap *background)2473 {2474 copyBlt(m_background, 0, 0, background, m_displayArea.x(), m_displayArea.y(),2475 m_displayArea.width(), m_displayArea.height());2476 2477 updateBackground();2478 }2479 2480 void UIRichTextType::loadBackgroundImg(bool &changed)2481 {2482 QString file = "";2483 changed = false;2484 2485 file = isFocused() ? m_bgImageSel : m_bgImageReg;2486 2487 // paint our background image over the window background2488 if (file != "")2489 {2490 if (file != m_backgroundFile)2491 {2492 if (m_backgroundImage)2493 delete m_backgroundImage;2494 2495 m_backgroundImage = GetMythUI()->LoadScaleImage(file, true);2496 m_backgroundFile = file;2497 changed = true;2498 }2499 }2500 }2501 2502 void UIRichTextType::updateBackground(void)2503 {2504 // paint our background image over the window background2505 QPainter p(m_compBackground);2506 if (m_background) p.drawPixmap(QPoint(0, 0), *m_background);2507 if (m_backgroundImage)2508 p.drawImage(QPoint(0, 0), *m_backgroundImage);2509 refreshImage();2510 }2511 2512 void UIRichTextType::refreshImage()2513 {2514 if (!m_background)2515 return;2516 2517 QRect clipRect(0, 0, m_textArea.width(), m_textArea.height());2518 2519 QPainter p(m_image);2520 QBrush brush;2521 2522 brush.setPixmap(*m_compBackground);2523 p.fillRect(0, 0, m_displayArea.width(), m_displayArea.height() , brush);2524 p.translate(m_textArea.x() - m_displayArea.x() , m_textArea.y() - m_displayArea.y());2525 Q3SimpleRichText richText(m_message, m_font->face);2526 richText.setWidth(m_textArea.width());2527 richText.draw(&p, 0, -m_yPos, clipRect, gContext->GetMainWindow()->colorGroup(), 0);2528 m_textHeight = richText.height();2529 2530 // do we need to show scroll arrows2531 if (m_showScrollArrows)2532 {2533 if (m_textHeight <= m_textArea.height())2534 {2535 m_showUpArrow = false;2536 m_showDnArrow = false;2537 }2538 else2539 {2540 m_showUpArrow = (m_yPos > 0);2541 m_showDnArrow = (m_yPos != m_textHeight - m_textArea.height());2542 }2543 }2544 2545 refresh();2546 }2547 2548 void UIRichTextType::Draw(QPainter *dr, int drawlayer, int context)2549 {2550 if (hidden)2551 return;2552 2553 if ((m_context == context || m_context == -1) && drawlayer == m_order)2554 {2555 // draw text image2556 dr->drawPixmap(m_displayArea, *m_image);2557 2558 // draw scroll arrows2559 if (m_showScrollArrows)2560 {2561 if (m_showUpArrow)2562 dr->drawPixmap(m_upArrowSelPos, m_upArrowSel);2563 else2564 dr->drawPixmap(m_upArrowRegPos, m_upArrowReg);2565 2566 if (m_showDnArrow)2567 dr->drawPixmap(m_dnArrowSelPos, m_dnArrowSel);2568 else2569 dr->drawPixmap(m_dnArrowRegPos, m_dnArrowReg);2570 }2571 }2572 }2573 2574 void UIRichTextType::calculateScreenArea()2575 {2576 QRect r = m_displayArea;2577 r.moveBy(m_parent->GetAreaRect().left(),2578 m_parent->GetAreaRect().top());2579 screen_area = r;2580 }2581 2582 void UIRichTextType::ScrollUp()2583 {2584 if (m_textHeight <= m_textArea.height())2585 return;2586 2587 m_yPos -= m_textArea.height() / 10;2588 if (m_yPos < 0)2589 m_yPos = 0;2590 2591 refreshImage();2592 }2593 2594 void UIRichTextType::ScrollDown()2595 {2596 if (m_textHeight <= m_textArea.height())2597 return;2598 2599 m_yPos += m_textArea.height() / 10;2600 2601 if (m_yPos > m_textHeight - m_textArea.height())2602 m_yPos = m_textHeight - m_textArea.height();2603 2604 refreshImage();2605 }2606 2607 void UIRichTextType::ScrollPageUp()2608 {2609 if (m_textHeight <= m_textArea.height())2610 return;2611 2612 m_yPos -= m_textArea.height();2613 if (m_yPos < 0)2614 m_yPos = 0;2615 2616 refreshImage();2617 }2618 2619 void UIRichTextType::ScrollPageDown()2620 {2621 if (m_textHeight <= m_textArea.height())2622 return;2623 2624 m_yPos += m_textArea.height();2625 if (m_yPos > m_textHeight - m_textArea.height())2626 m_yPos = m_textHeight - m_textArea.height();2627 2628 refreshImage();2629 }2630 2631 bool UIRichTextType::takeFocus()2632 {2633 bool res = UIType::takeFocus();2634 bool needreload = false;2635 loadBackgroundImg(needreload);2636 if (needreload) updateBackground();2637 2638 return res;2639 }2640 2641 void UIRichTextType::looseFocus()2642 {2643 UIType::looseFocus();2644 bool needreload = false;2645 loadBackgroundImg(needreload);2646 if (needreload) updateBackground();2647 }2648 2649 // ******************************************************************2650 2651 2406 UIRemoteEditType::UIRemoteEditType(const QString &name, fontProp *font, 2652 2407 const QString &text, int dorder, QRect displayrect) 2653 2408 : UIType(name) … … 2771 2526 void UIRemoteEditType::calculateScreenArea() 2772 2527 { 2773 2528 QRect r = m_displaysize; 2774 r. moveBy(m_parent->GetAreaRect().left(),2775 m_parent->GetAreaRect().top());2529 r.translate(m_parent->GetAreaRect().left(), 2530 m_parent->GetAreaRect().top()); 2776 2531 screen_area = r; 2777 2532 } 2778 2533 … … 2788 2543 { 2789 2544 if (edit) 2790 2545 { 2791 edit->setCursorPosition(0, edit->text().length()); 2546 QTextCursor tmp = edit->textCursor(); 2547 tmp.movePosition(QTextCursor::End); 2548 edit->setTextCursor(tmp); 2792 2549 edit->setFocus(); 2793 2550 } 2794 2551 … … 2885 2642 m_location.y(), 2886 2643 m_container.width(), 2887 2644 m_container.height()); 2888 r. moveBy(m_parent->GetAreaRect().left(),2889 m_parent->GetAreaRect().top());2645 r.translate(m_parent->GetAreaRect().left(), 2646 m_parent->GetAreaRect().top()); 2890 2647 screen_area = r; 2891 2648 } 2892 2649 … … 4362 4119 for ( it = bin_corners.begin(); it != bin_corners.end(); ++it ) 4363 4120 { 4364 4121 QRect r = (*it); 4365 r. moveBy(m_parent->GetAreaRect().left(),4366 m_parent->GetAreaRect().top());4122 r.translate(m_parent->GetAreaRect().left(), 4123 m_parent->GetAreaRect().top()); 4367 4124 ++i; 4368 4125 screen_corners[i] = r; 4369 4126 } … … 4798 4555 void UISelectorType::calculateScreenArea() 4799 4556 { 4800 4557 QRect r = m_area; 4801 r. moveBy(m_parent->GetAreaRect().left(),4802 m_parent->GetAreaRect().top());4558 r.translate(m_parent->GetAreaRect().left(), 4559 m_parent->GetAreaRect().top()); 4803 4560 screen_area = r; 4804 4561 } 4805 4562 … … 4906 4663 void UIBlackHoleType::calculateScreenArea() 4907 4664 { 4908 4665 QRect r = area; 4909 r. moveBy(m_parent->GetAreaRect().left(),4910 m_parent->GetAreaRect().top());4666 r.translate(m_parent->GetAreaRect().left(), 4667 m_parent->GetAreaRect().top()); 4911 4668 screen_area = r; 4912 4669 } 4913 4670 … … 5135 4892 int height = m_normalImg->height(); 5136 4893 5137 4894 QRect r = QRect(m_pos.x(), m_pos.y(), width, height); 5138 r. moveBy(m_parent->GetAreaRect().left(),5139 m_parent->GetAreaRect().top());4895 r.translate(m_parent->GetAreaRect().left(), 4896 m_parent->GetAreaRect().top()); 5140 4897 screen_area = r; 5141 4898 m_area = r; 5142 4899 } … … 5341 5098 void UIKeyboardType::calculateScreenArea() 5342 5099 { 5343 5100 QRect r = m_area; 5344 r. moveBy(m_parent->GetAreaRect().left(),5345 m_parent->GetAreaRect().top());5101 r.translate(m_parent->GetAreaRect().left(), 5102 m_parent->GetAreaRect().top()); 5346 5103 screen_area = r; 5347 5104 } 5348 5105 … … 5358 5115 } 5359 5116 else if (m_parentEdit->inherits("QTextEdit")) 5360 5117 { 5361 Q 3TextEdit *par = (Q3TextEdit *)m_parentEdit;5362 par->moveCursor(Q 3TextEdit::MoveBackward, false);5118 QTextEdit *par = (QTextEdit *)m_parentEdit; 5119 par->moveCursor(QTextEdit::MoveBackward, false); 5363 5120 } 5364 5121 else 5365 5122 { … … 5380 5137 } 5381 5138 else if (m_parentEdit->inherits("QTextEdit")) 5382 5139 { 5383 Q 3TextEdit *par = (Q3TextEdit *)m_parentEdit;5384 par->moveCursor(Q 3TextEdit::MoveForward, false);5140 QTextEdit *par = (QTextEdit *)m_parentEdit; 5141 par->moveCursor(QTextEdit::MoveForward, false); 5385 5142 } 5386 5143 else 5387 5144 { -
mythtv/libs/libmyth/mythconfiggroups.cpp
2 2 3 3 #include <q3widgetstack.h> 4 4 #include <q3tabdialog.h> 5 #include <QGroupBox> 5 6 6 7 #include "mythconfiggroups.h" 7 8 #include "mythcontext.h" … … 28 29 // Pre-calculate the margin and spacing that all sub-classes will use: 29 30 30 31 if (lzeroMargin) 31 margin = 4 ;32 margin = 4 * 0.5; 32 33 else 33 34 { 34 35 float wmult = 0, hmult = 0; … … 36 37 GetMythUI()->GetScreenSettings(wmult, hmult); 37 38 38 39 if (luselabel) 39 margin = (int)(28 * hmult );40 margin = (int)(28 * hmult * 0.5); 40 41 else 41 margin = (int)(10 * hmult );42 margin = (int)(10 * hmult * 0.5); 42 43 } 43 44 44 space = (lzeroSpace) ? 4 : -1;45 space = (lzeroSpace) ? 4 * 0.5 : -1; 45 46 } 46 47 47 48 ConfigurationGroup::~ConfigurationGroup() … … 107 108 (*it)->GetStorage()->Save(destination); 108 109 } 109 110 110 QWidget* VerticalConfigurationGroup::configWidget(ConfigurationGroup *cg, 111 QWidget* parent, 112 const char* widgetName) 111 QWidget *VerticalConfigurationGroup::configWidget( 112 ConfigurationGroup *cg, 113 QWidget *parent, 114 const char *widgetName) 113 115 { 114 widget = new Q3GroupBox(parent, widgetName);115 connect(widget, SIGNAL(destroyed(QObject*)),116 this, SLOT(widgetDeleted(QObject*)));116 layout = new QVBoxLayout(); 117 layout->setMargin(margin); 118 layout->setSpacing((space<0) ? margin : space); 117 119 118 widget->setBackgroundOrigin(QWidget::WindowOrigin);119 120 if (!useframe)121 widget->setFrameShape(Q3GroupBox::NoFrame);122 123 layout = new QVBoxLayout(widget, margin, space);124 125 if (uselabel)126 widget->setTitle(getLabel());127 128 120 childwidget.resize(children.size()); 129 121 for (uint i = 0; i < children.size(); i++) 130 122 { 131 123 if (children[i] && children[i]->isVisible()) 132 124 { 133 childwidget[i] = children[i]->configWidget(cg, widget, NULL);134 layout->add (childwidget[i]);125 childwidget[i] = children[i]->configWidget(cg, NULL, NULL); 126 layout->addWidget(childwidget[i]); 135 127 children[i]->setEnabled(children[i]->isEnabled()); 136 128 } 137 129 } … … 143 135 confgrp = cg; 144 136 } 145 137 138 QWidget *widget = NULL; 139 if (uselabel) 140 { 141 QGroupBox *groupbox = new QGroupBox(parent); 142 groupbox->setObjectName(QString("VCG(%1)_groupbox").arg(widgetName)); 143 groupbox->setTitle(getLabel()); 144 widget = groupbox; 145 } 146 else if (useframe) 147 { 148 QFrame *frame = new QFrame(parent); 149 frame->setFrameStyle(QFrame::Box); 150 frame->setObjectName(QString("VCG(%1)_frame").arg(widgetName)); 151 widget = frame; 152 } 153 else 154 { 155 widget = new QWidget(parent); 156 widget->setObjectName(QString("VCG(%1)_widget").arg(widgetName)); 157 } 158 159 widget->setLayout(layout); 160 connect(widget, SIGNAL(destroyed(QObject*)), 161 this, SLOT(widgetDeleted(QObject*))); 146 162 return widget; 147 163 } 148 164 … … 177 193 if (childwidget[i]) 178 194 { 179 195 old_child->widgetInvalid(childwidget[i]); 180 layout->remove (childwidget[i]);196 layout->removeWidget(childwidget[i]); 181 197 childwidget[i]->deleteLater(); 182 198 childwidget[i] = NULL; 183 199 } … … 190 206 if (was_visible) 191 207 { 192 208 childwidget[i] = new_child->configWidget(confgrp, widget, NULL); 193 layout->add (childwidget[i]);209 layout->addWidget(childwidget[i]); 194 210 new_child->setEnabled(was_enabled); 195 211 childwidget[i]->resize(1,1); 196 212 childwidget[i]->show(); … … 208 224 widget->repaint(); 209 225 } 210 226 211 QWidget* HorizontalConfigurationGroup::configWidget(ConfigurationGroup *cg, 212 QWidget* parent, 213 const char* widgetName) 227 QWidget *HorizontalConfigurationGroup::configWidget( 228 ConfigurationGroup *cg, 229 QWidget *parent, 230 const char *widgetName) 214 231 { 215 Q3GroupBox* widget = new Q3GroupBox(parent, widgetName); 216 widget->setBackgroundOrigin(QWidget::WindowOrigin); 232 QHBoxLayout *layout = new QHBoxLayout(); 233 layout->setMargin(margin); 234 layout->setSpacing((space<0) ? margin : space); 217 235 218 if (!useframe) 219 widget->setFrameShape(Q3GroupBox::NoFrame); 220 221 QHBoxLayout *layout = new QHBoxLayout(widget, margin, space); 222 223 if (uselabel) 236 for (uint i = 0 ; i < children.size() ; ++i) 224 237 { 225 // This makes weird and bad things happen in qt -mdz 2002/12/28 226 //widget->setInsideMargin(20); 227 widget->setTitle(getLabel()); 228 } 229 230 for(unsigned i = 0 ; i < children.size() ; ++i) 231 if (children[i]->isVisible()) 238 if (children[i] && children[i]->isVisible()) 232 239 { 233 QWidget *child = children[i]->configWidget(cg, widget, NULL);234 layout->add (child);240 QWidget *child = children[i]->configWidget(cg, NULL, NULL); 241 layout->addWidget(child); 235 242 children[i]->setEnabled(children[i]->isEnabled()); 236 243 } 244 } 237 245 238 246 if (cg) 239 247 { 240 connect(this, SIGNAL(changeHelpText(QString)), cg,241 SIGNAL(changeHelpText(QString)));248 connect(this, SIGNAL(changeHelpText(QString)), 249 cg, SIGNAL(changeHelpText(QString))); 242 250 } 243 251 252 QWidget *widget = NULL; 253 if (uselabel) 254 { 255 QGroupBox *groupbox = new QGroupBox(parent); 256 groupbox->setObjectName(QString("HCG(%1)_groupbox").arg(widgetName)); 257 groupbox->setTitle(getLabel()); 258 widget = groupbox; 259 } 260 else if (useframe) 261 { 262 QFrame *frame = new QFrame(parent); 263 frame->setFrameStyle(QFrame::Box); 264 frame->setObjectName(QString("HCG(%1)_frame").arg(widgetName)); 265 widget = frame; 266 } 267 else 268 { 269 widget = new QWidget(parent); 270 widget->setObjectName(QString("HCG(%1)_widget").arg(widgetName)); 271 } 272 273 widget->setLayout(layout); 244 274 return widget; 245 275 } 246 276 247 QWidget* GridConfigurationGroup::configWidget(ConfigurationGroup *cg, 248 QWidget* parent, 249 const char* widgetName) 277 QWidget* GridConfigurationGroup::configWidget( 278 ConfigurationGroup *cg, 279 QWidget *parent, 280 const char *widgetName) 250 281 { 251 Q3GroupBox* widget = new Q3GroupBox(parent, widgetName); 252 widget->setBackgroundOrigin(QWidget::WindowOrigin); 282 //int rows = (children.size()+columns-1) / columns; 283 QGridLayout *layout = new QGridLayout(); 284 layout->setMargin(margin); 285 layout->setSpacing(space < 0 ? margin : space); 253 286 254 if (!useframe) 255 widget->setFrameShape(Q3GroupBox::NoFrame); 256 257 QGridLayout *layout = NULL; 258 259 int rows = (children.size()+columns-1) / columns; 260 261 layout = new QGridLayout(widget, rows, columns, margin, space); 262 263 if (uselabel) 287 for (uint i = 0; i < children.size(); i++) 264 288 { 265 // This makes weird and bad things happen in qt -mdz 2002/12/28 266 //widget->setInsideMargin(20); 267 widget->setTitle(getLabel()); 268 } 269 270 for (unsigned i = 0 ; i < children.size() ; ++i) 271 if (children[i]->isVisible()) 289 if (children[i] && children[i]->isVisible()) 272 290 { 273 QWidget *child = children[i]->configWidget(cg, widget, NULL);291 QWidget *child = children[i]->configWidget(cg, NULL, NULL); 274 292 layout->addWidget(child, i / columns, i % columns); 275 293 children[i]->setEnabled(children[i]->isEnabled()); 276 294 } 295 } 277 296 278 297 if (cg) 279 298 { 280 connect(this, SIGNAL(changeHelpText(QString)), cg,281 SIGNAL(changeHelpText(QString)));299 connect(this, SIGNAL(changeHelpText(QString)), 300 cg, SIGNAL(changeHelpText(QString))); 282 301 } 283 302 303 QWidget *widget = NULL; 304 if (uselabel) 305 { 306 QGroupBox *groupbox = new QGroupBox(parent); 307 groupbox->setObjectName(QString("GCG(%1)_groupbox").arg(widgetName)); 308 groupbox->setTitle(getLabel()); 309 widget = groupbox; 310 } 311 else if (useframe) 312 { 313 QFrame *frame = new QFrame(parent); 314 frame->setFrameStyle(QFrame::Box); 315 frame->setObjectName(QString("GCG(%1)_frame").arg(widgetName)); 316 widget = frame; 317 } 318 else 319 { 320 widget = new QWidget(parent); 321 widget->setObjectName(QString("GCG(%1)_widget").arg(widgetName)); 322 } 323 324 widget->setLayout(layout); 325 284 326 return widget; 285 327 } 286 328 … … 304 346 connect(widget, SIGNAL(destroyed(QObject*)), 305 347 this, SLOT(widgetDeleted(QObject*))); 306 348 307 widget->setBackgroundOrigin(QWidget::WindowOrigin);349 //widget->setBackgroundOrigin(QWidget::WindowOrigin); 308 350 309 351 for (uint i = 0 ; i < children.size() ; ++i) 310 352 { … … 627 669 const char* widgetName) 628 670 { 629 671 Q3TabDialog* widget = new Q3TabDialog(parent, widgetName); 630 widget->setBackgroundOrigin(QWidget::WindowOrigin);672 //widget->setBackgroundOrigin(QWidget::WindowOrigin); 631 673 632 674 for(unsigned i = 0 ; i < children.size() ; ++i) 633 675 if (children[i]->isVisible()) -
mythtv/libs/libmyth/dialogbox.h
3 3 4 4 #include <QObject> 5 5 #include <QCheckBox> 6 #include <Q3ButtonGroup>7 #include <Q3VBoxLayout>8 6 9 7 #include "mythdialogs.h" 10 8 #include "compat.h" // to undef DialogBox 9 class QVBoxLayout; 10 class QButtonGroup; 11 11 12 12 class MPUBLIC DialogBox : public MythDialog 13 13 { … … 28 28 ~DialogBox() {} // use deleteLater() for thread safety 29 29 30 30 private: 31 Q 3VBoxLayout *box;32 Q 3ButtonGroup *buttongroup;31 QVBoxLayout *box; 32 QButtonGroup *buttongroup; 33 33 34 34 QCheckBox *checkbox; 35 35 }; -
mythtv/libs/libmyth/mythwidgets.h
5 5 #include <QSpinBox> 6 6 #include <QSlider> 7 7 #include <QLineEdit> 8 #include <q3textedit.h>9 8 #include <QPushButton> 10 9 #include <QToolButton> 11 10 #include <QDialog> 12 #include <q3header.h>13 #include <q3buttongroup.h>14 11 #include <QCheckBox> 15 12 #include <QRadioButton> 16 13 #include <QImage> … … 63 60 64 61 public slots: 65 62 virtual void deleteLater(void); 66 void insertItem(const QString& item) { 67 QComboBox::insertItem(item); 68 }; 63 void insertItem(const QString &item) 64 { 65 QComboBox::insertItem(count()+1, item); 66 } 69 67 70 68 protected: 71 69 void Teardown(void); … … 194 192 * A LineEdit that does special things when you press number keys 195 193 * (enter letters with multiple presses, just like a phone keypad) 196 194 */ 197 class MPUBLIC MythRemoteLineEdit : public Q 3TextEdit195 class MPUBLIC MythRemoteLineEdit : public QTextEdit 198 196 { 199 197 Q_OBJECT 200 198 … … 243 241 private slots: 244 242 void startCycle(QString current_choice, QString set); 245 243 void updateCycle(QString current_choice, QString set); 246 void endCycle(); 244 void endCycle(bool select); 245 void endCycle(void) { endCycle(true); } 247 246 248 247 private: 249 248 QFont *my_font; 250 249 void Init(void); 251 250 void cycleKeys(QString cycleList); 252 251 void toggleShift(void); 253 void assignHexColors();254 252 255 253 bool shift; 256 254 QTimer *cycle_timer; … … 260 258 int cycle_time; 261 259 QString helptext; 262 260 263 int pre_cycle_para; 264 int pre_cycle_pos; 265 QString pre_cycle_text_upto; 266 QString pre_cycle_text_from; 261 int pre_cycle_pos; 262 QString pre_cycle_text_before_cursor; 263 QString pre_cycle_text_after_cursor; 267 264 268 265 QColor col_unselected; 269 266 QColor col_selected;