Ticket #3334: importicons-libmyth-09102007.diff
File importicons-libmyth-09102007.diff, 6.2 KB (added by , 16 years ago) |
---|
-
libs/libmyth/mythdialogs.cpp
624 624 return popup.ExecPopup(); 625 625 } 626 626 627 MythProgressDialog::MythProgressDialog(const QString &message, int totalSteps) 627 MythProgressDialog::MythProgressDialog(const QString &message, int totalSteps, 628 bool cancelButton, const QObject *target, const char *slot) 628 629 : MythDialog(gContext->GetMainWindow(), "progress", false) 629 630 { 630 631 int screenwidth, screenheight; … … 652 653 vbox->setFrameShadow(QFrame::Raised); 653 654 vbox->setMargin((int)(15 * wmult)); 654 655 655 QLabel *msglabel = new QLabel(vbox);656 msglabel = new QLabel(vbox); 656 657 msglabel->setBackgroundOrigin(ParentOrigin); 657 658 msglabel->setText(message); 659 vbox->setStretchFactor(msglabel, 5); 658 660 659 progress = new QProgressBar(totalSteps, vbox); 661 QHBox *hbox = new QHBox(vbox); 662 hbox->setSpacing(5); 663 664 progress = new QProgressBar(totalSteps, hbox); 660 665 progress->setBackgroundOrigin(ParentOrigin); 661 progress->setProgress(0);662 666 667 if (cancelButton && slot && target) 668 { 669 MythPushButton *button = new MythPushButton("Cancel", hbox, 0); 670 button->setFocus(); 671 connect(button, SIGNAL(pressed()), target, slot); 672 } 673 663 674 setTotalSteps(totalSteps); 664 675 665 676 if (class LCD * lcddev = LCD::Get()) … … 707 718 } 708 719 } 709 720 721 void MythProgressDialog::setLabel(QString newlabel) 722 { 723 msglabel->setText(newlabel); 724 } 725 710 726 void MythProgressDialog::keyPressEvent(QKeyEvent *e) 711 727 { 712 728 bool handled = false; … … 728 744 void MythProgressDialog::setTotalSteps(int totalSteps) 729 745 { 730 746 m_totalSteps = totalSteps; 747 progress->setTotalSteps(totalSteps); 731 748 steps = totalSteps / 1000; 732 749 if (steps == 0) 733 750 steps = 1; 734 751 } 735 752 736 MythBusyDialog::MythBusyDialog(const QString &title) 737 : MythProgressDialog(title, 0), timer(NULL) 753 MythProgressDialog::~MythProgressDialog() 738 754 { 755 if (LCD *lcddev = LCD::Get()) 756 lcddev->switchToTime(); 739 757 } 740 758 759 760 MythBusyDialog::MythBusyDialog(const QString &title, 761 bool cancelButton, const QObject *target, const char *slot) 762 : MythProgressDialog(title, 0, 763 cancelButton, target, slot), 764 timer(NULL) 765 { 766 } 767 741 768 MythBusyDialog::~MythBusyDialog() 742 769 { 743 770 if (timer) -
libs/libmyth/settings.h
412 412 void setSelectionMode(MythListBox::SelectionMode mode); 413 413 void setCurrentItem(int i) { if (widget) widget->setCurrentItem(i); } 414 414 void setCurrentItem(const QString& str) { if (widget) widget->setCurrentItem(str); } 415 int currentItem() { if (widget) return widget->currentItem(); 416 else return -1; } 417 uint count() { if (widget) return widget->count(); 418 else return 0; } 415 419 416 420 virtual void setEnabled(bool b); 417 421 … … 671 675 allow_single_step, special_value_text) { } 672 676 }; 673 677 678 class MPUBLIC TransListBoxSetting : 679 public ListBoxSetting, public TransientStorage 680 { 681 public: 682 TransListBoxSetting() : ListBoxSetting(this), TransientStorage() { } 683 }; 684 685 674 686 /////////////////////////////////////////////////////////////////////////////// 675 687 676 688 class MPUBLIC HostSlider : public SliderSetting, public HostDBStorage -
libs/libmyth/mythdialogs.h
189 189 */ 190 190 class MPUBLIC MythProgressDialog: public MythDialog 191 191 { 192 Q_OBJECT 192 193 public: 193 194 /** Create a progress bar dialog. 194 195 195 196 \param message the title string to appear in the progress dialog. 196 197 \param totalSteps the total number of steps 198 \param cancelButton display cancel button 199 \param target target for pressed signal 200 \param slot slot for pressed signal 197 201 */ 198 MythProgressDialog(const QString& message, int totalSteps); 202 MythProgressDialog(const QString& message, int totalSteps = 0, 203 bool cancelButton = false, 204 const QObject * target = NULL, 205 const char * slot = NULL); 206 207 ~MythProgressDialog(); 199 208 209 200 210 /* \brief Close the dialog. 201 211 202 212 This will close the dialog and return the LCD to the Time screen 203 213 */ 204 214 void Close(void); 215 216 void keyPressEvent(QKeyEvent *); 217 218 public slots: 205 219 /* \brief Update the progress bar. 206 220 207 221 This will move the progress bar the percentage-completed as … … 211 225 The LCD is updated as well. 212 226 */ 213 227 void setProgress(int curprogress); 228 void setLabel(QString newlabel); 229 230 signals: 231 void pressed(); 214 232 215 void keyPressEvent(QKeyEvent *);216 217 233 protected: 218 234 QProgressBar *progress; 235 QLabel *msglabel; 219 236 220 237 private: 221 238 void setTotalSteps(int totalSteps); … … 240 257 the widget to indicate progress every 100msec; 241 258 242 259 \param title the title to appear in the progress bar dialog 260 \cancelButton display cancel button 261 \param target target for pressed signal 262 \param slot slot for pressed signal 243 263 */ 244 MythBusyDialog(const QString &title); 264 MythBusyDialog(const QString &title, 265 bool cancelButton = false, 266 const QObject * target = NULL, 267 const char * slot = NULL); 245 268 246 269 ~MythBusyDialog(); 247 270 -
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(); } 380 int count() { return QListBox::count(); } 378 381 379 382 protected: 380 383 void focusInEvent(QFocusEvent *e);