Ticket #3334: #3334 libmyth-importicons-18122007.patch
File #3334 libmyth-importicons-18122007.patch, 5.7 KB (added by , 16 years ago) |
---|
-
libs/libmyth/mythdialogs.cpp
767 767 return ret; 768 768 } 769 769 770 MythProgressDialog::MythProgressDialog(const QString &message, int totalSteps) 770 MythProgressDialog::MythProgressDialog(const QString &message, int totalSteps, 771 bool cancelButton, const QObject *target, const char *slot) 771 772 : MythDialog(gContext->GetMainWindow(), "progress", false) 772 773 { 773 774 int screenwidth, screenheight; … … 795 796 vbox->setFrameShadow(QFrame::Raised); 796 797 vbox->setMargin((int)(15 * wmult)); 797 798 798 QLabel *msglabel = new QLabel(vbox);799 msglabel = new QLabel(vbox); 799 800 msglabel->setBackgroundOrigin(ParentOrigin); 800 801 msglabel->setText(message); 802 vbox->setStretchFactor(msglabel, 5); 801 803 802 progress = new QProgressBar(totalSteps, vbox); 804 QHBox *hbox = new QHBox(vbox); 805 hbox->setSpacing(5); 806 807 progress = new QProgressBar(totalSteps, hbox); 803 808 progress->setBackgroundOrigin(ParentOrigin); 804 progress->setProgress(0);805 809 810 if (cancelButton && slot && target) 811 { 812 MythPushButton *button = new MythPushButton("Cancel", hbox, 0); 813 button->setFocus(); 814 connect(button, SIGNAL(pressed()), target, slot); 815 } 816 806 817 setTotalSteps(totalSteps); 807 818 808 819 if (class LCD * lcddev = LCD::Get()) … … 870 881 } 871 882 } 872 883 884 void MythProgressDialog::setLabel(QString newlabel) 885 { 886 msglabel->setText(newlabel); 887 } 888 873 889 void MythProgressDialog::keyPressEvent(QKeyEvent *e) 874 890 { 875 891 bool handled = false; … … 891 907 void MythProgressDialog::setTotalSteps(int totalSteps) 892 908 { 893 909 m_totalSteps = totalSteps; 910 progress->setTotalSteps(totalSteps); 894 911 steps = totalSteps / 1000; 895 912 if (steps == 0) 896 913 steps = 1; 897 914 } 898 915 899 MythBusyDialog::MythBusyDialog(const QString &title) 900 : MythProgressDialog(title, 0), timer(NULL) 916 MythBusyDialog::MythBusyDialog(const QString &title, 917 bool cancelButton, const QObject *target, const char *slot) 918 : MythProgressDialog(title, 0, 919 cancelButton, target, slot), 920 timer(NULL) 901 921 { 902 922 } 903 923 -
libs/libmyth/settings.h
368 368 void setSelectionMode(MythListBox::SelectionMode mode); 369 369 void setCurrentItem(int i) { if (widget) widget->setCurrentItem(i); } 370 370 void setCurrentItem(const QString& str) { if (widget) widget->setCurrentItem(str); } 371 int currentItem() { if (widget) return widget->currentItem(); 372 else return -1; } 371 373 372 374 virtual void setEnabled(bool b); 373 375 … … 644 646 allow_single_step, special_value_text) { } 645 647 }; 646 648 649 class MPUBLIC TransListBoxSetting : 650 public ListBoxSetting, public TransientStorage 651 { 652 public: 653 TransListBoxSetting() : ListBoxSetting(this), TransientStorage() { } 654 }; 655 656 647 657 /////////////////////////////////////////////////////////////////////////////// 648 658 649 659 class MPUBLIC HostSlider : public SliderSetting, public HostDBStorage -
libs/libmyth/mythdialogs.h
233 233 */ 234 234 class MPUBLIC MythProgressDialog: public MythDialog 235 235 { 236 Q_OBJECT 236 237 public: 237 238 /** Create a progress bar dialog. 238 239 239 240 \param message the title string to appear in the progress dialog. 240 241 \param totalSteps the total number of steps 241 */ 242 MythProgressDialog(const QString& message, int totalSteps); 242 \param cancelButton display cancel button 243 \param target target for pressed signal 244 \param slot slot for pressed signal 245 */ 246 MythProgressDialog(const QString& message, int totalSteps = 0, 247 bool cancelButton = false, 248 const QObject * target = NULL, 249 const char * slot = NULL); 243 250 244 251 /* \brief Close the dialog. 245 252 … … 255 262 The LCD is updated as well. 256 263 */ 257 264 void setProgress(int curprogress); 258 265 266 void setLabel(QString newlabel); 267 259 268 void keyPressEvent(QKeyEvent *); 260 269 261 270 virtual void deleteLater(void); 271 272 signals: 273 void pressed(); 262 274 263 275 protected: 264 276 void Teardown(void); 265 277 ~MythProgressDialog(); // use deleteLater() instead for thread safety 266 278 QProgressBar *progress; 279 QLabel *msglabel; 267 280 268 281 private: 269 282 void setTotalSteps(int totalSteps); … … 288 301 the widget to indicate progress every 100msec; 289 302 290 303 \param title the title to appear in the progress bar dialog 291 */ 292 MythBusyDialog(const QString &title); 304 \cancelButton display cancel button 305 \param target target for pressed signal 306 \param slot slot for pressed signal 307 */ 308 MythBusyDialog(const QString &title, 309 bool cancelButton = false, 310 const QObject * target = NULL, 311 const char * slot = NULL); 293 312 294 313 /** \brief Setup a timer to 'move' the spinner 295 314 -
libs/libmyth/mythwidgets.h
387 387 388 388 void setHelpText(const QString&); 389 389 390 int currentItem() { return QListBox::currentItem(); } 391 390 392 protected: 391 393 void focusInEvent(QFocusEvent *e); 392 394 void focusOutEvent(QFocusEvent *e);