Ticket #4128: 4128-v1.patch
| File 4128-v1.patch, 14.1 KB (added by , 18 years ago) |
|---|
-
libs/libmyth/settings.cpp
187 187 return widget; 188 188 } 189 189 190 void VerticalConfigurationGroup::widgetInvalid(QObject *obj) 191 { 192 widget = (widget == obj) ? NULL : widget; 193 } 194 195 void VerticalConfigurationGroup::deleteLater(void) 196 { 197 for (uint i = 0; i < childwidget.size() && i < children.size(); i++) 198 { 199 if (children[i] && childwidget[i]) 200 children[i]->widgetInvalid(childwidget[i]); 201 } 202 childwidget.clear(); 203 ConfigurationGroup::deleteLater(); 204 } 205 190 206 bool VerticalConfigurationGroup::replaceChild( 191 207 Configurable *old_child, Configurable *new_child) 192 208 { … … 207 223 if (childwidget[i]) 208 224 { 209 225 layout->remove(childwidget[i]); 226 old_child->widgetInvalid(childwidget[i]); 210 227 childwidget[i]->deleteLater(); 211 228 childwidget[i] = NULL; 212 229 } 213 230 231 bool was_visible = old_child->isVisible(); 232 bool was_enabled = old_child->isEnabled(); 233 214 234 old_child->deleteLater(); 215 235 216 if ( children[i]->isVisible())236 if (was_visible) 217 237 { 218 childwidget[i] = children[i]->configWidget(confgrp, widget, NULL);238 childwidget[i] = new_child->configWidget(confgrp, widget, NULL); 219 239 layout->add(childwidget[i]); 220 children[i]->setEnabled(children[i]->isEnabled());240 new_child->setEnabled(was_enabled); 221 241 childwidget[i]->resize(1,1); 222 242 childwidget[i]->show(); 223 243 } … … 353 373 return widget; 354 374 } 355 375 376 StackedConfigurationGroup::~StackedConfigurationGroup() 377 { 378 for (uint i = 0; i < childwidget.size() && i < children.size(); i++) 379 { 380 if (children[i] && childwidget[i]) 381 children[i]->widgetInvalid(childwidget[i]); 382 } 383 childwidget.clear(); 384 ConfigurationGroup::deleteLater(); 385 } 386 387 void StackedConfigurationGroup::deleteLater(void) 388 { 389 for (uint i = 0; i < childwidget.size() && i < children.size(); i++) 390 { 391 if (children[i] && childwidget[i]) 392 children[i]->widgetInvalid(childwidget[i]); 393 } 394 childwidget.clear(); 395 ConfigurationGroup::deleteLater(); 396 } 397 356 398 QWidget* StackedConfigurationGroup::configWidget(ConfigurationGroup *cg, 357 399 QWidget* parent, 358 400 const char* widgetName) … … 401 443 } 402 444 } 403 445 446 void StackedConfigurationGroup::widgetInvalid(QObject *obj) 447 { 448 widget = (widget == obj) ? NULL : widget; 449 } 450 404 451 void StackedConfigurationGroup::removeChild(Configurable *child) 405 452 { 406 453 childList::iterator it = find(children.begin(), children.end(), child); … … 418 465 childwidget.erase(cit); 419 466 420 467 if (widget && cw) 468 { 469 child->widgetInvalid(cw); 421 470 widget->removeWidget(cw); 471 } 422 472 } 423 473 424 474 QWidget* TabbedConfigurationGroup::configWidget(ConfigurationGroup *cg, … … 626 676 return widget; 627 677 } 628 678 679 void TriggeredConfigurationGroup::widgetInvalid(QObject *obj) 680 { 681 widget = (widget == obj) ? NULL : widget; 682 } 683 629 684 int SelectSetting::findSelection(const QString &label, QString value) const 630 685 { 631 686 value = (value.isEmpty()) ? label : value; … … 1081 1136 connect(widget, SIGNAL(highlighted(int)), 1082 1137 this, SLOT(setValue(int))); 1083 1138 1084 connect(widget, SIGNAL(destroyed()),1085 this, SLOT(widgetDestroyed()));1086 1139 connect(this, SIGNAL(selectionsCleared()), 1087 1140 widget, SLOT(clear())); 1088 1141 … … 1093 1146 return box; 1094 1147 } 1095 1148 1149 void ComboBoxSetting::widgetInvalid(QObject *obj) 1150 { 1151 widget = (widget == obj) ? NULL : widget; 1152 } 1153 1096 1154 void ComboBoxSetting::setEnabled(bool b) 1097 1155 { 1098 1156 Configurable::setEnabled(b); … … 1302 1360 return widget; 1303 1361 } 1304 1362 1363 void CheckBoxSetting::widgetInvalid(QObject *obj) 1364 { 1365 widget = (widget == obj) ? NULL : widget; 1366 } 1367 1305 1368 void CheckBoxSetting::setEnabled(bool fEnabled) 1306 1369 { 1307 1370 BooleanSetting::setEnabled(fEnabled); … … 1337 1400 MythDialog::keyPressEvent(e); 1338 1401 } 1339 1402 1403 ConfigurationDialog::~ConfigurationDialog() 1404 { 1405 for (uint i = 0; (i < childwidget.size()) && (i < cfgChildren.size()); i++) 1406 { 1407 if (cfgChildren[i] && childwidget[i]) 1408 cfgChildren[i]->widgetInvalid(childwidget[i]); 1409 } 1410 childwidget.clear(); 1411 cfgGrp->deleteLater(); 1412 } 1413 1340 1414 MythDialog* ConfigurationDialog::dialogWidget(MythMainWindow *parent, 1341 1415 const char *widgetName) 1342 1416 { … … 1349 1423 QVBoxLayout *layout = new QVBoxLayout(dialog, (int)(20 * hmult)); 1350 1424 1351 1425 ChildList::iterator it = cfgChildren.begin(); 1352 for (; it != cfgChildren.end(); ++it) 1426 childwidget.clear(); 1427 childwidget.resize(cfgChildren.size()); 1428 for (uint i = 0; it != cfgChildren.end(); ++it, ++i) 1353 1429 { 1354 1430 if ((*it)->isVisible()) 1355 layout->addWidget((*it)->configWidget(cfgGrp, dialog)); 1431 { 1432 childwidget[i] = (*it)->configWidget(cfgGrp, dialog); 1433 layout->addWidget(childwidget[i]); 1434 } 1356 1435 } 1357 1436 1358 1437 return dialog; … … 1373 1452 if ((QDialog::Accepted == ret) && saveOnAccept) 1374 1453 save(); 1375 1454 1455 for (uint i = 0; (i < childwidget.size()) && (i < cfgChildren.size()); i++) 1456 { 1457 if (cfgChildren[i] && childwidget[i]) 1458 cfgChildren[i]->widgetInvalid(childwidget[i]); 1459 } 1460 childwidget.clear(); 1461 1376 1462 dialog->deleteLater(); 1377 1463 dialog = NULL; 1378 1464 … … 1442 1528 } 1443 1529 } 1444 1530 1531 JumpConfigurationWizard::~JumpConfigurationWizard() 1532 { 1533 for (uint i = 0; i < childwidget.size() && i < cfgChildren.size(); i++) 1534 { 1535 if (cfgChildren[i] && childwidget[i]) 1536 cfgChildren[i]->widgetInvalid(childwidget[i]); 1537 } 1538 childwidget.clear(); 1539 } 1540 1541 void JumpConfigurationWizard::deleteLater(void) 1542 { 1543 for (uint i = 0; i < childwidget.size() && i < cfgChildren.size(); i++) 1544 { 1545 if (cfgChildren[i] && childwidget[i]) 1546 cfgChildren[i]->widgetInvalid(childwidget[i]); 1547 } 1548 childwidget.clear(); 1549 QObject::deleteLater(); 1550 } 1551 1445 1552 MythDialog *JumpConfigurationWizard::dialogWidget(MythMainWindow *parent, 1446 1553 const char *widgetName) 1447 1554 { … … 1451 1558 QObject::connect(cfgGrp, SIGNAL(changeHelpText(QString)), 1452 1559 wizard, SLOT( setHelpText( QString))); 1453 1560 1454 child Widgets.clear();1561 childwidget.clear(); 1455 1562 QStringList labels, helptext; 1456 1563 for (uint i = 0; i < cfgChildren.size(); i++) 1457 1564 { 1458 1565 if (cfgChildren[i]->isVisible()) 1459 1566 { 1460 child Widgets.push_back(cfgChildren[i]->configWidget(cfgGrp, parent));1567 childwidget.push_back(cfgChildren[i]->configWidget(cfgGrp, parent)); 1461 1568 labels.push_back(cfgChildren[i]->getLabel()); 1462 1569 helptext.push_back(cfgChildren[i]->getHelpText()); 1463 1570 } … … 1470 1577 connect(jumppane, SIGNAL(pressed( QString)), 1471 1578 this, SLOT( showPage(QString))); 1472 1579 1473 for (uint i = 0; i < child Widgets.size(); i++)1580 for (uint i = 0; i < childwidget.size(); i++) 1474 1581 { 1475 wizard->addPage(child Widgets[i], labels[i]);1476 wizard->setFinishEnabled(child Widgets[i], true);1582 wizard->addPage(childwidget[i], labels[i]); 1583 wizard->setFinishEnabled(childwidget[i], true); 1477 1584 } 1478 1585 1479 1586 return wizard; … … 1482 1589 void JumpConfigurationWizard::showPage(QString page) 1483 1590 { 1484 1591 uint pagenum = page.toUInt(); 1485 if (pagenum >= child Widgets.size() || !dialog)1592 if (pagenum >= childwidget.size() || !dialog) 1486 1593 return; 1487 ((MythJumpWizard*)(dialog))->showPage(child Widgets[pagenum]);1594 ((MythJumpWizard*)(dialog))->showPage(childwidget[pagenum]); 1488 1595 } 1489 1596 1490 1597 void SimpleDBStorage::load() … … 1594 1701 1595 1702 void ListBoxSetting::clearSelections(void) 1596 1703 { 1704 VERBOSE(VB_IMPORTANT, "clearSelections(void) widget: " 1705 <<bxwidget<<":"<<widget); 1597 1706 SelectSetting::clearSelections(); 1598 1707 if (widget) 1599 1708 widget->clear(); … … 1612 1721 1613 1722 QWidget* ListBoxSetting::configWidget(ConfigurationGroup *cg, QWidget* parent, 1614 1723 const char* widgetName) { 1724 if (bxwidget) 1725 VERBOSE(VB_IMPORTANT, "configWidget called while there " 1726 "is an existing widget: "<<bxwidget); 1727 1615 1728 QWidget* box = new QVBox(parent, widgetName); 1616 1729 box->setBackgroundOrigin(QWidget::WindowOrigin); 1617 1730 1731 VERBOSE(VB_IMPORTANT, "configWidget->"<<box); 1732 1618 1733 if (getLabel() != "") 1619 1734 { 1620 1735 QLabel* label = new QLabel(box); … … 1622 1737 label->setBackgroundOrigin(QWidget::WindowOrigin); 1623 1738 } 1624 1739 1740 bxwidget = box; 1625 1741 widget = new MythListBox(box); 1626 1742 widget->setBackgroundOrigin(QWidget::WindowOrigin); 1627 1743 widget->setHelpText(getHelpText()); … … 1654 1770 widget->setFocus(); 1655 1771 widget->setSelectionMode(selectionMode); 1656 1772 1657 return b ox;1773 return bxwidget; 1658 1774 } 1659 1775 1776 void ListBoxSetting::widgetInvalid(QObject *obj) 1777 { 1778 VERBOSE(VB_IMPORTANT, "widgetInvalid("<<obj<<") == " 1779 <<bxwidget<<":"<<widget<<"?"); 1780 if (bxwidget == obj) 1781 { 1782 widget = NULL; 1783 bxwidget = NULL; 1784 } 1785 } 1786 1660 1787 void ListBoxSetting::setSelectionMode(MythListBox::SelectionMode mode) 1661 1788 { 1662 1789 selectionMode = mode; -
libs/libmyth/mythcontext.h
209 209 210 210 /// Update this whenever the plug-in API changes. 211 211 /// Including changes in the libmythtv class methods used by plug-ins. 212 #define MYTH_BINARY_VERSION "0.21.2007110 4-1"212 #define MYTH_BINARY_VERSION "0.21.20071105-2" 213 213 214 214 /** \brief Increment this whenever the MythTV network protocol changes. 215 215 * -
libs/libmyth/settings.h
135 135 136 136 Storage *GetStorage(void) { return storage; } 137 137 138 virtual void widgetInvalid(QObject*) { } 139 138 140 public slots: 139 141 virtual void enableOnSet(const QString &val); 140 142 virtual void enableOnUnset(const QString &val); … … 380 382 virtual void setEnabled(bool b); 381 383 virtual void setVisible(bool b); 382 384 385 virtual void widgetInvalid(QObject *obj); 386 383 387 public slots: 384 388 void addSelection(const QString &label, 385 389 QString value = QString::null, … … 387 391 bool removeSelection(const QString &label, 388 392 QString value = QString::null); 389 393 390 protected slots:391 void widgetDestroyed() { widget=NULL; };392 393 394 private: 394 395 bool rw; 395 396 MythComboBox *widget; … … 402 403 Q_OBJECT 403 404 public: 404 405 ListBoxSetting(Storage *_storage) : 405 SelectSetting(_storage), widget(NULL),406 SelectSetting(_storage), bxwidget(NULL), widget(NULL), 406 407 selectionMode(MythListBox::Single) { } 407 408 408 409 virtual QWidget* configWidget(ConfigurationGroup *cg, QWidget* parent, … … 417 418 418 419 virtual void clearSelections(void); 419 420 421 virtual void widgetInvalid(QObject *obj); 422 420 423 signals: 421 424 void accepted(int); 422 425 void menuButtonPressed(int); … … 428 431 QString value = QString::null, 429 432 bool select = false); 430 433 431 protected slots:432 434 void setValueByIndex(int index); 433 435 protected: 436 QWidget* bxwidget; 434 437 MythListBox* widget; 435 438 MythListBox::SelectionMode selectionMode; 436 439 }; … … 493 496 virtual QWidget* configWidget(ConfigurationGroup *cg, QWidget* parent, 494 497 const char* widgetName = 0); 495 498 virtual void setEnabled(bool b); 499 500 virtual void widgetInvalid(QObject*); 501 496 502 protected: 497 503 MythCheckBox *widget; 498 504 }; … … 894 900 { 895 901 } 896 902 903 virtual void deleteLater(void); 904 897 905 virtual QWidget *configWidget(ConfigurationGroup *cg, 898 906 QWidget *parent, 899 907 const char *widgetName); … … 901 909 bool replaceChild(Configurable *old_child, Configurable *new_child); 902 910 void repaint(void); 903 911 912 virtual void widgetInvalid(QObject *obj); 913 904 914 protected: 905 915 /// You need to call deleteLater to delete QObject 906 916 virtual ~VerticalConfigurationGroup() { } … … 967 977 { 968 978 } 969 979 980 virtual void deleteLater(void); 981 970 982 virtual QWidget* configWidget(ConfigurationGroup *cg, QWidget* parent, 971 983 const char* widgetName = 0); 972 984 … … 979 991 980 992 void addChild(Configurable*); 981 993 void removeChild(Configurable*); 994 virtual void widgetInvalid(QObject *obj); 982 995 983 996 signals: 984 997 void raiseWidget(int); 985 998 986 999 protected: 987 1000 /// You need to call deleteLater to delete QObject 988 virtual ~StackedConfigurationGroup() { }1001 virtual ~StackedConfigurationGroup(); 989 1002 990 1003 protected: 991 1004 vector<QWidget*> childwidget; … … 1034 1047 1035 1048 void repaint(void); 1036 1049 1050 virtual void widgetInvalid(QObject *obj); 1051 1037 1052 // Sets 1038 1053 1039 1054 void SetVertical(bool vert); … … 1163 1178 { 1164 1179 public: 1165 1180 ConfigurationDialog() : dialog(NULL), cfgGrp(new ConfigurationGroup()) { } 1166 virtual ~ConfigurationDialog() { cfgGrp->deleteLater(); }1181 virtual ~ConfigurationDialog(); 1167 1182 1168 1183 // Make a modal dialog containing configWidget 1169 1184 virtual MythDialog *dialogWidget(MythMainWindow *parent, … … 1187 1202 typedef vector<Configurable*> ChildList; 1188 1203 1189 1204 ChildList cfgChildren; 1205 vector<QWidget*> childwidget; 1190 1206 MythDialog *dialog; 1191 1207 ConfigurationGroup *cfgGrp; 1192 1208 }; … … 1216 1232 virtual MythDialog *dialogWidget(MythMainWindow *parent, 1217 1233 const char *widgetName); 1218 1234 1235 virtual void deleteLater(void); 1236 1219 1237 protected slots: 1220 1238 void showPage(QString); 1221 1239 1222 1240 protected: 1223 1241 /// You need to call deleteLater to delete QObject 1224 virtual ~JumpConfigurationWizard() { } 1225 1226 protected: 1227 vector<QWidget*> childWidgets; 1242 virtual ~JumpConfigurationWizard(); 1228 1243 }; 1229 1244 1230 1245 class MPUBLIC JumpPane : public VerticalConfigurationGroup
