Ticket #3334: importicons-libmyth-29092007.diff
File importicons-libmyth-29092007.diff, 6.0 KB (added by , 17 years ago) |
---|
-
libs/libmyth/mythdialogs.cpp
614 614 return popup.ExecPopup(); 615 615 } 616 616 617 MythProgressDialog::MythProgressDialog(const QString &message, int totalSteps) 617 MythProgressDialog::MythProgressDialog(const QString &message, int totalSteps, 618 bool cancelButton, const QObject *target, const char *slot) 618 619 : MythDialog(gContext->GetMainWindow(), "progress", false) 619 620 { 620 621 int screenwidth, screenheight; … … 642 643 vbox->setFrameShadow(QFrame::Raised); 643 644 vbox->setMargin((int)(15 * wmult)); 644 645 645 QLabel *msglabel = new QLabel(vbox);646 msglabel = new QLabel(vbox); 646 647 msglabel->setBackgroundOrigin(ParentOrigin); 647 648 msglabel->setText(message); 649 vbox->setStretchFactor(msglabel, 5); 648 650 649 progress = new QProgressBar(totalSteps, vbox); 651 QHBox *hbox = new QHBox(vbox); 652 hbox->setSpacing(5); 653 654 progress = new QProgressBar(totalSteps, hbox); 650 655 progress->setBackgroundOrigin(ParentOrigin); 651 progress->setProgress(0);652 656 657 if (cancelButton && slot && target) 658 { 659 MythPushButton *button = new MythPushButton("Cancel", hbox, 0); 660 connect(button, SIGNAL(pressed()), target, slot); 661 } 662 653 663 setTotalSteps(totalSteps); 654 664 655 665 if (class LCD * lcddev = LCD::Get()) … … 697 707 } 698 708 } 699 709 710 void MythProgressDialog::setLabel(QString newlabel) 711 { 712 msglabel->setText(newlabel); 713 } 714 700 715 void MythProgressDialog::keyPressEvent(QKeyEvent *e) 701 716 { 702 717 bool handled = false; … … 718 733 void MythProgressDialog::setTotalSteps(int totalSteps) 719 734 { 720 735 m_totalSteps = totalSteps; 736 progress->setTotalSteps(totalSteps); 721 737 steps = totalSteps / 1000; 722 738 if (steps == 0) 723 739 steps = 1; 724 740 } 725 741 726 MythBusyDialog::MythBusyDialog(const QString &title) 727 : MythProgressDialog(title, 0), timer(NULL) 742 MythProgressDialog::~MythProgressDialog() 728 743 { 744 if (LCD *lcddev = LCD::Get()) 745 lcddev->switchToTime(); 729 746 } 730 747 748 749 MythBusyDialog::MythBusyDialog(const QString &title, 750 bool cancelButton, const QObject *target, const char *slot) 751 : MythProgressDialog(title, 0, 752 cancelButton, target, slot), 753 timer(NULL) 754 { 755 } 756 731 757 MythBusyDialog::~MythBusyDialog() 732 758 { 733 759 if (timer) -
libs/libmyth/settings.h
409 409 void setSelectionMode(MythListBox::SelectionMode mode); 410 410 void setCurrentItem(int i) { if (widget) widget->setCurrentItem(i); } 411 411 void setCurrentItem(const QString& str) { if (widget) widget->setCurrentItem(str); } 412 int currentItem() { if (widget) return widget->currentItem(); 413 else return -1; } 412 414 413 415 virtual void setEnabled(bool b); 414 416 … … 668 670 allow_single_step, special_value_text) { } 669 671 }; 670 672 673 class MPUBLIC TransListBoxSetting : 674 public ListBoxSetting, public TransientStorage 675 { 676 public: 677 TransListBoxSetting() : ListBoxSetting(this), TransientStorage() { } 678 }; 679 680 671 681 /////////////////////////////////////////////////////////////////////////////// 672 682 673 683 class MPUBLIC HostSlider : public SliderSetting, public HostDBStorage -
libs/libmyth/mythdialogs.h
187 187 */ 188 188 class MPUBLIC MythProgressDialog: public MythDialog 189 189 { 190 Q_OBJECT 190 191 public: 191 192 /** Create a progress bar dialog. 192 193 193 194 \param message the title string to appear in the progress dialog. 194 195 \param totalSteps the total number of steps 196 \param cancelButton display cancel button 197 \param target target for pressed signal 198 \param slot slot for pressed signal 195 199 */ 196 MythProgressDialog(const QString& message, int totalSteps); 200 MythProgressDialog(const QString& message, int totalSteps = 0, 201 bool cancelButton = false, 202 const QObject * target = NULL, 203 const char * slot = NULL); 204 205 ~MythProgressDialog(); 197 206 207 198 208 /* \brief Close the dialog. 199 209 200 210 This will close the dialog and return the LCD to the Time screen 201 211 */ 202 212 void Close(void); 213 214 void keyPressEvent(QKeyEvent *); 215 216 public slots: 203 217 /* \brief Update the progress bar. 204 218 205 219 This will move the progress bar the percentage-completed as … … 209 223 The LCD is updated as well. 210 224 */ 211 225 void setProgress(int curprogress); 226 void setLabel(QString newlabel); 227 228 signals: 229 void pressed(); 212 230 213 void keyPressEvent(QKeyEvent *);214 215 231 protected: 216 232 QProgressBar *progress; 233 QLabel *msglabel; 217 234 218 235 private: 219 236 void setTotalSteps(int totalSteps); … … 238 255 the widget to indicate progress every 100msec; 239 256 240 257 \param title the title to appear in the progress bar dialog 258 \cancelButton display cancel button 259 \param target target for pressed signal 260 \param slot slot for pressed signal 241 261 */ 242 MythBusyDialog(const QString &title); 262 MythBusyDialog(const QString &title, 263 bool cancelButton = false, 264 const QObject * target = NULL, 265 const char * slot = NULL); 243 266 244 267 ~MythBusyDialog(); 245 268 -
libs/libmyth/mythwidgets.h
375 375 virtual void keyPressEvent(QKeyEvent* e); 376 376 377 377 void setHelpText(QString help) { helptext = help; } 378 379 int currentItem() { return QListBox::currentItem(); } 378 380 379 381 protected: 380 382 void focusInEvent(QFocusEvent *e);