Ticket #10092: mythfrontendsetup-08-02-2012.diff
| File mythfrontendsetup-08-02-2012.diff, 105.8 KB (added by , 15 years ago) |
|---|
-
mythtv/programs/mythfrontend/globalsettings.cpp
diff --git a/mythtv/programs/mythfrontend/globalsettings.cpp b/mythtv/programs/mythfrontend/globalsettings.cpp index 7e6fad3..aa01e7a 100644
a b static HostCheckBox *ExactSeeking() 167 167 return gc; 168 168 } 169 169 170 static GlobalComboBox *CommercialSkipMethod()170 static GlobalComboBoxSetting *CommercialSkipMethod() 171 171 { 172 GlobalComboBox *bc = new GlobalComboBox("CommercialSkipMethod");172 GlobalComboBoxSetting *bc = new GlobalComboBoxSetting("CommercialSkipMethod"); 173 173 bc->setLabel(QObject::tr("Commercial detection method")); 174 174 bc->setHelpText(QObject::tr( 175 175 "This determines the method used by MythTV to " … … static GlobalComboBox *CommercialSkipMethod() 182 182 return bc; 183 183 } 184 184 185 static GlobalCheckBox *CommFlagFast()185 static GlobalCheckBoxSetting *CommFlagFast() 186 186 { 187 GlobalCheckBox *gc = new GlobalCheckBox("CommFlagFast");187 GlobalCheckBoxSetting *gc = new GlobalCheckBoxSetting("CommFlagFast"); 188 188 gc->setLabel(QObject::tr("Enable experimental speedup of commercial detection")); 189 189 gc->setValue(false); 190 190 gc->setHelpText(QObject::tr("If enabled, experimental commercial detection " … … static HostComboBox *AutoCommercialSkip() 206 206 return gc; 207 207 } 208 208 209 static GlobalCheckBox *AutoMetadataLookup()209 static GlobalCheckBoxSetting *AutoMetadataLookup() 210 210 { 211 GlobalCheckBox *bc = new GlobalCheckBox("AutoMetadataLookup");211 GlobalCheckBoxSetting *bc = new GlobalCheckBoxSetting("AutoMetadataLookup"); 212 212 bc->setLabel(QObject::tr("Run metadata lookup")); 213 213 bc->setValue(true); 214 214 bc->setHelpText(QObject::tr("This is the default value used for the " … … static GlobalCheckBox *AutoMetadataLookup() 217 217 return bc; 218 218 } 219 219 220 static GlobalCheckBox *AutoCommercialFlag()220 static GlobalCheckBoxSetting *AutoCommercialFlag() 221 221 { 222 GlobalCheckBox *bc = new GlobalCheckBox("AutoCommercialFlag");222 GlobalCheckBoxSetting *bc = new GlobalCheckBoxSetting("AutoCommercialFlag"); 223 223 bc->setLabel(QObject::tr("Run commercial detection")); 224 224 bc->setValue(true); 225 225 bc->setHelpText(QObject::tr("This is the default value used for the " … … static GlobalCheckBox *AutoCommercialFlag() 228 228 return bc; 229 229 } 230 230 231 static GlobalCheckBox *AutoTranscode()231 static GlobalCheckBoxSetting *AutoTranscode() 232 232 { 233 GlobalCheckBox *bc = new GlobalCheckBox("AutoTranscode");233 GlobalCheckBoxSetting *bc = new GlobalCheckBoxSetting("AutoTranscode"); 234 234 bc->setLabel(QObject::tr("Run transcoder")); 235 235 bc->setValue(false); 236 236 bc->setHelpText(QObject::tr("This is the default value used for the " … … static GlobalCheckBox *AutoTranscode() 239 239 return bc; 240 240 } 241 241 242 static GlobalComboBox *DefaultTranscoder() 242 /*TODO This function is borrowed from RecordingProfile::fillSelections and sligthly modified 243 I will need to change the original to use a pure abstract class instead of SelectSetting 244 */ 245 void RecordingProfile_fillSelections(MythUIComboBoxSetting *setting, int group, 246 bool foldautodetect) 243 247 { 244 GlobalComboBox *bc = new GlobalComboBox("DefaultTranscoder"); 248 if (!group) 249 { 250 for (uint i = 0; !availProfiles[i].isEmpty(); i++) 251 setting->addSelection(availProfiles[i], availProfiles[i]); 252 return; 253 } 254 255 MSqlQuery result(MSqlQuery::InitCon()); 256 result.prepare( 257 "SELECT name, id " 258 "FROM recordingprofiles " 259 "WHERE profilegroup = :GROUP " 260 "ORDER BY id"); 261 result.bindValue(":GROUP", group); 262 263 if (!result.exec()) 264 { 265 MythDB::DBError("RecordingProfile::fillSelections 1", result); 266 return; 267 } 268 else if (!result.next()) 269 { 270 return; 271 } 272 273 if (group == RecordingProfile::TranscoderGroup && foldautodetect) 274 { 275 QString id = QString::number(RecordingProfile::TranscoderAutodetect); 276 setting->addSelection(QObject::tr("Autodetect"), id); 277 } 278 279 do 280 { 281 QString name = result.value(0).toString(); 282 QString id = result.value(1).toString(); 283 284 if (group == RecordingProfile::TranscoderGroup) 285 { 286 if (name == "RTjpeg/MPEG4" || name == "MPEG2") 287 { 288 if (!foldautodetect) 289 { 290 setting->addSelection( 291 QObject::tr("Autodetect from %1").arg(name), id); 292 } 293 } 294 else 295 { 296 setting->addSelection(name, id); 297 } 298 continue; 299 } 300 301 setting->addSelection(name, id); 302 } 303 while (result.next()); 304 } 305 306 static GlobalComboBoxSetting *DefaultTranscoder() 307 { 308 GlobalComboBoxSetting *bc = new GlobalComboBoxSetting("DefaultTranscoder"); 245 309 bc->setLabel(QObject::tr("Default transcoder")); 246 RecordingProfile ::fillSelections(bc, RecordingProfile::TranscoderGroup,310 RecordingProfile_fillSelections(bc, RecordingProfile::TranscoderGroup, 247 311 true); 312 248 313 bc->setHelpText(QObject::tr("This is the default value used for the " 249 314 "transcoder setting when a new scheduled " 250 315 "recording is created.")); 251 316 return bc; 252 317 } 253 318 254 static GlobalSpinBox *DeferAutoTranscodeDays()319 static GlobalSpinBoxSetting *DeferAutoTranscodeDays() 255 320 { 256 GlobalSpinBox *gs = new GlobalSpinBox("DeferAutoTranscodeDays", 0, 365, 1);321 GlobalSpinBoxSetting *gs = new GlobalSpinBoxSetting("DeferAutoTranscodeDays", 0, 365, 1); 257 322 gs->setLabel(QObject::tr("Deferral days for auto transcode jobs")); 258 323 gs->setHelpText(QObject::tr("If non-zero, automatic transcode jobs will " 259 324 "be scheduled to run this many days after a recording " … … static GlobalSpinBox *DeferAutoTranscodeDays() 262 327 return gs; 263 328 } 264 329 265 static GlobalCheckBox *AutoRunUserJob(uint job_num)330 static GlobalCheckBoxSetting *AutoRunUserJob(uint job_num) 266 331 { 267 332 QString dbStr = QString("AutoRunUserJob%1").arg(job_num); 268 333 QString label = QObject::tr("Run user job #%1") 269 334 .arg(job_num); 270 GlobalCheckBox *bc = new GlobalCheckBox(dbStr);335 GlobalCheckBoxSetting *bc = new GlobalCheckBoxSetting(dbStr); 271 336 bc->setLabel(label); 272 337 bc->setValue(false); 273 338 bc->setHelpText(QObject::tr("This is the default value used for the " … … static GlobalCheckBox *AutoRunUserJob(uint job_num) 278 343 return bc; 279 344 } 280 345 281 static GlobalCheckBox *AggressiveCommDetect()346 static GlobalCheckBoxSetting *AggressiveCommDetect() 282 347 { 283 GlobalCheckBox *bc = new GlobalCheckBox("AggressiveCommDetect");348 GlobalCheckBoxSetting *bc = new GlobalCheckBoxSetting("AggressiveCommDetect"); 284 349 bc->setLabel(QObject::tr("Strict commercial detection")); 285 350 bc->setValue(true); 286 351 bc->setHelpText(QObject::tr("Enable stricter commercial detection code. " … … static GlobalSpinBox *MergeShortCommBreaks() 334 399 return bs; 335 400 } 336 401 337 static GlobalSpinBox *AutoExpireExtraSpace()402 static GlobalSpinBoxSetting *AutoExpireExtraSpace() 338 403 { 339 GlobalSpinBox *bs = new GlobalSpinBox("AutoExpireExtraSpace", 0, 200, 1);404 GlobalSpinBoxSetting *bs = new GlobalSpinBoxSetting("AutoExpireExtraSpace", 0, 200, 1); 340 405 bs->setLabel(QObject::tr("Extra disk space (GB)")); 341 406 bs->setHelpText(QObject::tr("Extra disk space (in gigabytes) beyond what " 342 407 "MythTV requires that you want to keep free on the " … … static GlobalSpinBox *AutoExpireExtraSpace() 345 410 return bs; 346 411 }; 347 412 348 static GlobalCheckBox *AutoExpireInsteadOfDelete() 349 { 350 GlobalCheckBox *cb = new GlobalCheckBox("AutoExpireInsteadOfDelete"); 351 cb->setLabel(QObject::tr("Auto-Expire instead of delete recording")); 352 cb->setValue(false); 353 cb->setHelpText(QObject::tr("If enabled, move deleted recordings to the " 354 "'Deleted' recgroup and turn on autoexpire " 355 "instead of deleting immediately.")); 356 return cb; 357 } 358 359 static GlobalSpinBox *DeletedMaxAge() 413 static GlobalSpinBoxSetting *DeletedMaxAge() 360 414 { 361 GlobalSpinBox *bs = new GlobalSpinBox("DeletedMaxAge", 0, 365, 1);415 GlobalSpinBoxSetting *bs = new GlobalSpinBoxSetting("DeletedMaxAge", 0, 365, 1); 362 416 bs->setLabel(QObject::tr("Deleted max age (days)")); 363 417 bs->setHelpText(QObject::tr("When set to a number greater than zero, " 364 418 "Auto-Expire will force expiration of Deleted recordings " … … static GlobalSpinBox *DeletedMaxAge() 367 421 return bs; 368 422 }; 369 423 370 static GlobalCheckBox *DeletedFifoOrder()424 static GlobalCheckBoxSetting *DeletedFifoOrder() 371 425 { 372 GlobalCheckBox *cb = new GlobalCheckBox("DeletedFifoOrder");426 GlobalCheckBoxSetting *cb = new GlobalCheckBoxSetting("DeletedFifoOrder"); 373 427 cb->setLabel(QObject::tr("Expire in deleted order")); 374 428 cb->setValue(false); 375 429 cb->setHelpText(QObject::tr( … … static GlobalCheckBox *DeletedFifoOrder() 378 432 return cb; 379 433 }; 380 434 381 class DeletedExpireOptions : public TriggeredConfigurationGroup 435 static GlobalCheckBoxSetting *AutoExpireInsteadOfDelete() 436 { 437 GlobalCheckBoxSetting *cb = new GlobalCheckBoxSetting("AutoExpireInsteadOfDelete"); 438 cb->setLabel(QObject::tr("Auto-Expire instead of delete recording")); 439 cb->setValue(false); 440 cb->setHelpText(QObject::tr("If enabled, move deleted recordings to the " 441 "'Deleted' recgroup and turn on autoexpire " 442 "instead of deleting immediately.")); 443 444 cb->addTargetedChild("1",DeletedFifoOrder()); 445 cb->addTargetedChild("1",DeletedMaxAge()); 446 return cb; 447 } 448 /* 449 450 static DeletedExpireOptions : public TriggeredConfigurationGroup 382 451 { 383 452 public: 384 453 DeletedExpireOptions() : … … class DeletedExpireOptions : public TriggeredConfigurationGroup 399 468 addTarget("0", new HorizontalConfigurationGroup(true)); 400 469 }; 401 470 }; 471 */ 402 472 403 static GlobalComboBox *AutoExpireMethod()473 static GlobalComboBoxSetting *AutoExpireMethod() 404 474 { 405 GlobalComboBox *bc = new GlobalComboBox("AutoExpireMethod");475 GlobalComboBoxSetting *bc = new GlobalComboBoxSetting("AutoExpireMethod"); 406 476 bc->setLabel(QObject::tr("Auto-Expire method")); 407 477 bc->addSelection(QObject::tr("Oldest show first"), "1"); 408 478 bc->addSelection(QObject::tr("Lowest priority first"), "2"); … … static GlobalComboBox *AutoExpireMethod() 414 484 return bc; 415 485 } 416 486 417 static GlobalCheckBox *AutoExpireWatchedPriority()487 static GlobalCheckBoxSetting *AutoExpireWatchedPriority() 418 488 { 419 GlobalCheckBox *bc = new GlobalCheckBox("AutoExpireWatchedPriority");489 GlobalCheckBoxSetting *bc = new GlobalCheckBoxSetting("AutoExpireWatchedPriority"); 420 490 bc->setLabel(QObject::tr("Watched before unwatched")); 421 491 bc->setValue(false); 422 492 bc->setHelpText(QObject::tr("If enabled, programs that have been marked as " … … static GlobalCheckBox *AutoExpireWatchedPriority() 425 495 return bc; 426 496 } 427 497 428 static GlobalSpinBox *AutoExpireDayPriority()498 static GlobalSpinBoxSetting *AutoExpireDayPriority() 429 499 { 430 GlobalSpinBox *bs = new GlobalSpinBox("AutoExpireDayPriority", 1, 400, 1);500 GlobalSpinBoxSetting *bs = new GlobalSpinBoxSetting("AutoExpireDayPriority", 1, 400, 1); 431 501 bs->setLabel(QObject::tr("Priority weight")); 432 502 bs->setHelpText(QObject::tr("The number of days bonus a program gets for " 433 503 "each priority point. This is only used when the Weighted " … … static GlobalSpinBox *AutoExpireDayPriority() 436 506 return bs; 437 507 }; 438 508 439 static GlobalCheckBox *AutoExpireDefault()509 static GlobalCheckBoxSetting *AutoExpireDefault() 440 510 { 441 GlobalCheckBox *bc = new GlobalCheckBox("AutoExpireDefault");511 GlobalCheckBoxSetting *bc = new GlobalCheckBoxSetting("AutoExpireDefault"); 442 512 bc->setLabel(QObject::tr("Auto-Expire default")); 443 513 bc->setValue(true); 444 514 bc->setHelpText(QObject::tr("If enabled, any new recording schedules " … … static GlobalCheckBox *AutoExpireDefault() 447 517 return bc; 448 518 } 449 519 450 static GlobalSpinBox *AutoExpireLiveTVMaxAge()520 static GlobalSpinBoxSetting *AutoExpireLiveTVMaxAge() 451 521 { 452 GlobalSpinBox *bs = new GlobalSpinBox("AutoExpireLiveTVMaxAge", 1, 365, 1);522 GlobalSpinBoxSetting *bs = new GlobalSpinBoxSetting("AutoExpireLiveTVMaxAge", 1, 365, 1); 453 523 bs->setLabel(QObject::tr("Live TV max age (days)")); 454 524 bs->setHelpText(QObject::tr("Auto-Expire will force expiration of Live " 455 525 "TV recordings when they are this many days old. Live TV " 456 526 "recordings may also be expired early if necessary to " 457 527 "free up disk space.")); 458 bs->setValue( 1);528 bs->setValue((int)1); 459 529 return bs; 460 530 }; 461 531 … … static GlobalSpinBox *MinRecordDiskThreshold() 474 544 } 475 545 #endif 476 546 477 static GlobalCheckBox *RerecordWatched()547 static GlobalCheckBoxSetting *RerecordWatched() 478 548 { 479 GlobalCheckBox *bc = new GlobalCheckBox("RerecordWatched");549 GlobalCheckBoxSetting *bc = new GlobalCheckBoxSetting("RerecordWatched"); 480 550 bc->setLabel(QObject::tr("Re-record watched")); 481 551 bc->setValue(false); 482 552 bc->setHelpText(QObject::tr("If enabled, programs that have been marked as " … … static GlobalCheckBox *RerecordWatched() 485 555 return bc; 486 556 } 487 557 488 static GlobalSpinBox *RecordPreRoll()558 static GlobalSpinBoxSetting *RecordPreRoll() 489 559 { 490 GlobalSpinBox *bs = new GlobalSpinBox("RecordPreRoll", 0, 600, 60, true);560 GlobalSpinBoxSetting *bs = new GlobalSpinBoxSetting("RecordPreRoll", 0, 600, 60, true); 491 561 bs->setLabel(QObject::tr("Time to record before start of show " 492 562 "(secs)")); 493 563 bs->setHelpText(QObject::tr("This global setting allows the recorder " … … static GlobalSpinBox *RecordPreRoll() 498 568 return bs; 499 569 } 500 570 501 static GlobalSpinBox *RecordOverTime()571 static GlobalSpinBoxSetting *RecordOverTime() 502 572 { 503 GlobalSpinBox *bs = new GlobalSpinBox("RecordOverTime", 0, 1800, 60, true);573 GlobalSpinBoxSetting *bs = new GlobalSpinBoxSetting("RecordOverTime", 0, 1800, 60, true); 504 574 bs->setLabel(QObject::tr("Time to record past end of show (secs)")); 505 575 bs->setValue(0); 506 576 bs->setHelpText(QObject::tr("This global setting allows the recorder " … … static GlobalSpinBox *RecordOverTime() 510 580 return bs; 511 581 } 512 582 513 static GlobalComboBox *OverTimeCategory()583 static GlobalComboBoxSetting *OverTimeCategory() 514 584 { 515 GlobalComboBox *gc = new GlobalComboBox("OverTimeCategory");585 GlobalComboBoxSetting *gc = new GlobalComboBoxSetting("OverTimeCategory"); 516 586 gc->setLabel(QObject::tr("Category of shows to be extended")); 517 587 gc->setHelpText(QObject::tr("For a special category (e.g. " 518 588 "\"Sports event\"), request that shows be autoextended. " 519 589 "Only works if a show's category can be determined.")); 520 590 521 591 MSqlQuery query(MSqlQuery::InitCon()); 592 //TODO We should not have any SQL here 522 593 query.prepare("SELECT DISTINCT category FROM program GROUP BY category;"); 523 594 524 595 gc->addSelection("", ""); 596 525 597 if (query.exec()) 526 598 { 527 599 while (query.next()) … … static GlobalComboBox *OverTimeCategory() 535 607 return gc; 536 608 } 537 609 538 static GlobalSpinBox *CategoryOverTime()610 static GlobalSpinBoxSetting *CategoryOverTime() 539 611 { 540 GlobalSpinBox *bs = new GlobalSpinBox("CategoryOverTime",612 GlobalSpinBoxSetting *bs = new GlobalSpinBoxSetting("CategoryOverTime", 541 613 0, 180, 60, true); 542 614 bs->setLabel(QObject::tr("Record past end of show (mins)")); 543 615 bs->setValue(30); … … static GlobalSpinBox *CategoryOverTime() 548 620 return bs; 549 621 } 550 622 551 static VerticalConfigurationGroup*CategoryOverTimeSettings()623 static GroupSetting *CategoryOverTimeSettings() 552 624 { 553 VerticalConfigurationGroup *vcg = 554 new VerticalConfigurationGroup(false, false); 555 625 GroupSetting *vcg = new GroupSetting(); 556 626 vcg->setLabel(QObject::tr("Category record over-time")); 557 vcg->setUseLabel(true);558 627 vcg->addChild(OverTimeCategory()); 559 628 vcg->addChild(CategoryOverTime()); 560 629 return vcg; … … static HostComboBox MUNUSED *DecodeVBIFormat() 1348 1417 return gc; 1349 1418 } 1350 1419 1351 static HostSpinBox *OSDCC708TextZoomPercentage(void)1420 static HostSpinBoxSetting *OSDCC708TextZoomPercentage(void) 1352 1421 { 1353 HostSpinBox *gs = new HostSpinBox("OSDCC708TextZoom", 50, 200, 5);1422 HostSpinBoxSetting *gs = new HostSpinBoxSetting("OSDCC708TextZoom", 50, 200, 5); 1354 1423 gs->setLabel(QObject::tr("Subtitle text zoom percentage")); 1355 1424 gs->setValue(100); 1356 1425 gs->setHelpText(QObject::tr("Use this to enlarge or shrink text based subtitles.")); … … static HostSpinBox *OSDCC708TextZoomPercentage(void) 1358 1427 return gs; 1359 1428 } 1360 1429 1361 static HostComboBox *SubtitleFont()1430 static HostComboBoxSetting *SubtitleFont() 1362 1431 { 1363 HostComboBox *hcb = new HostComboBox("OSDSubFont");1432 HostComboBoxSetting *hcb = new HostComboBoxSetting("OSDSubFont"); 1364 1433 QFontDatabase db; 1365 1434 QStringList fonts = db.families(); 1366 1435 QStringList hide = db.families(QFontDatabase::Symbol); … … static HostComboBox *SubtitleFont() 1375 1444 return hcb; 1376 1445 } 1377 1446 1378 static HostComboBox *SubtitleCodec()1447 static HostComboBoxSetting *SubtitleCodec() 1379 1448 { 1380 HostComboBox *gc = new HostComboBox("SubtitleCodec");1449 HostComboBoxSetting *gc = new HostComboBoxSetting("SubtitleCodec"); 1381 1450 1382 1451 gc->setLabel(QObject::tr("Subtitle Codec")); 1383 1452 QList<QByteArray> list = QTextCodec::availableCodecs(); … … static HostComboBox *SubtitleCodec() 1390 1459 return gc; 1391 1460 } 1392 1461 1393 static HostComboBox *ChannelOrdering()1462 static HostComboBoxSetting *ChannelOrdering() 1394 1463 { 1395 HostComboBox *gc = new HostComboBox("ChannelOrdering");1464 HostComboBoxSetting *gc = new HostComboBoxSetting("ChannelOrdering"); 1396 1465 gc->setLabel(QObject::tr("Channel ordering")); 1397 1466 gc->addSelection(QObject::tr("channel number"), "channum"); 1398 1467 gc->addSelection(QObject::tr("callsign"), "callsign"); … … static HostSpinBox *YScanDisplacement() 1439 1508 return gs; 1440 1509 }; 1441 1510 1442 static HostCheckBox *CCBackground()1511 static HostCheckBoxSetting *CCBackground() 1443 1512 { 1444 HostCheckBox *gc = new HostCheckBox("CCBackground");1513 HostCheckBoxSetting *gc = new HostCheckBoxSetting("CCBackground"); 1445 1514 gc->setLabel(QObject::tr("Black background for closed captioning")); 1446 1515 gc->setValue(false); 1447 1516 gc->setHelpText(QObject::tr( … … static HostCheckBox *CCBackground() 1451 1520 return gc; 1452 1521 } 1453 1522 1454 static HostCheckBox *DefaultCCMode()1523 static HostCheckBoxSetting *DefaultCCMode() 1455 1524 { 1456 HostCheckBox *gc = new HostCheckBox("DefaultCCMode");1525 HostCheckBoxSetting *gc = new HostCheckBoxSetting("DefaultCCMode"); 1457 1526 gc->setLabel(QObject::tr("Always display closed captioning or subtitles")); 1458 1527 gc->setValue(false); 1459 1528 gc->setHelpText(QObject::tr( … … static HostCheckBox *DefaultCCMode() 1464 1533 return gc; 1465 1534 } 1466 1535 1467 static HostCheckBox *PreferCC708()1536 static HostCheckBoxSetting *PreferCC708() 1468 1537 { 1469 HostCheckBox *gc = new HostCheckBox("Prefer708Captions");1538 HostCheckBoxSetting *gc = new HostCheckBoxSetting("Prefer708Captions"); 1470 1539 gc->setLabel(QObject::tr("Prefer EIA-708 over EIA-608 captions")); 1471 1540 gc->setValue(true); 1472 1541 gc->setHelpText( … … static HostCheckBox *PreferCC708() 1477 1546 return gc; 1478 1547 } 1479 1548 1480 static HostCheckBox *EnableMHEG()1549 static HostCheckBoxSetting *EnableMHEG() 1481 1550 { 1482 HostCheckBox *gc = new HostCheckBox("EnableMHEG");1551 HostCheckBoxSetting *gc = new HostCheckBoxSetting("EnableMHEG"); 1483 1552 gc->setLabel(QObject::tr("Enable interactive TV")); 1484 1553 gc->setValue(false); 1485 1554 gc->setHelpText(QObject::tr( … … static HostCheckBox *EnableMHEG() 1489 1558 return gc; 1490 1559 } 1491 1560 1492 static HostCheckBox *PersistentBrowseMode()1561 static HostCheckBoxSetting *PersistentBrowseMode() 1493 1562 { 1494 HostCheckBox *gc = new HostCheckBox("PersistentBrowseMode");1563 HostCheckBoxSetting *gc = new HostCheckBoxSetting("PersistentBrowseMode"); 1495 1564 gc->setLabel(QObject::tr("Always use browse mode in Live TV")); 1496 1565 gc->setValue(true); 1497 1566 gc->setHelpText( … … static HostCheckBox *PersistentBrowseMode() 1501 1570 return gc; 1502 1571 } 1503 1572 1504 static HostCheckBox *BrowseAllTuners()1573 static HostCheckBoxSetting *BrowseAllTuners() 1505 1574 { 1506 HostCheckBox *gc = new HostCheckBox("BrowseAllTuners");1575 HostCheckBoxSetting *gc = new HostCheckBoxSetting("BrowseAllTuners"); 1507 1576 gc->setLabel(QObject::tr("Browse all channels")); 1508 1577 gc->setValue(false); 1509 1578 gc->setHelpText( … … static HostSpinBox *LiveTVIdleTimeout() 1643 1712 // return gc; 1644 1713 // } 1645 1714 1646 static HostCheckBox *UseVirtualKeyboard()1715 static HostCheckBoxSetting *UseVirtualKeyboard() 1647 1716 { 1648 HostCheckBox *gc = new HostCheckBox("UseVirtualKeyboard");1717 HostCheckBoxSetting *gc = new HostCheckBoxSetting("UseVirtualKeyboard"); 1649 1718 gc->setLabel(QObject::tr("Use line edit virtual keyboards")); 1650 1719 gc->setValue(true); 1651 1720 gc->setHelpText(QObject::tr("If enabled, you can use a virtual keyboard " … … static HostCheckBox *UseVirtualKeyboard() 1654 1723 return gc; 1655 1724 } 1656 1725 1657 static HostComboBox *OverrideExitMenu()1726 static HostComboBoxSetting *OverrideExitMenu() 1658 1727 { 1659 HostComboBox *gc = new HostComboBox("OverrideExitMenu");1728 HostComboBoxSetting *gc = new HostComboBoxSetting("OverrideExitMenu"); 1660 1729 gc->setLabel(QObject::tr("Customize exit menu options")); 1661 1730 gc->addSelection(QObject::tr("Default"), "0"); 1662 1731 gc->addSelection(QObject::tr("Show quit"), "1"); … … static HostComboBox *OverrideExitMenu() 1671 1740 return gc; 1672 1741 } 1673 1742 1674 static Host LineEdit*RebootCommand()1743 static HostTextEditSetting *RebootCommand() 1675 1744 { 1676 Host LineEdit *ge = new HostLineEdit("RebootCommand");1745 HostTextEditSetting *ge = new HostTextEditSetting("RebootCommand"); 1677 1746 ge->setLabel(QObject::tr("Reboot command")); 1678 1747 ge->setValue(""); 1679 1748 ge->setHelpText(QObject::tr("Optional. Script to run if you select " … … static HostLineEdit *RebootCommand() 1683 1752 return ge; 1684 1753 } 1685 1754 1686 static Host LineEdit*HaltCommand()1755 static HostTextEditSetting *HaltCommand() 1687 1756 { 1688 Host LineEdit *ge = new HostLineEdit("HaltCommand");1757 HostTextEditSetting *ge = new HostTextEditSetting("HaltCommand"); 1689 1758 ge->setLabel(QObject::tr("Halt command")); 1690 1759 ge->setValue(""); 1691 1760 ge->setHelpText(QObject::tr("Optional. Script to run if you select " … … static HostLineEdit *HaltCommand() 1695 1764 return ge; 1696 1765 } 1697 1766 1698 static Host LineEdit*LircDaemonDevice()1767 static HostTextEditSetting *LircDaemonDevice() 1699 1768 { 1700 Host LineEdit *ge = new HostLineEdit("LircSocket");1769 HostTextEditSetting *ge = new HostTextEditSetting("LircSocket"); 1701 1770 ge->setLabel(QObject::tr("LIRC daemon socket")); 1702 1771 1703 1772 /* lircd socket moved from /dev/ to /var/run/lirc/ in lirc 0.8.6 */ … … static HostLineEdit *LircDaemonDevice() 1712 1781 return ge; 1713 1782 } 1714 1783 1715 static Host LineEdit*ScreenShotPath()1784 static HostTextEditSetting *ScreenShotPath() 1716 1785 { 1717 Host LineEdit *ge = new HostLineEdit("ScreenShotPath");1786 HostTextEditSetting *ge = new HostTextEditSetting("ScreenShotPath"); 1718 1787 ge->setLabel(QObject::tr("Screen shot path")); 1719 1788 ge->setValue("/tmp/"); 1720 1789 ge->setHelpText(QObject::tr("Path to screenshot storage location. Should be writable by the frontend")); 1721 1790 return ge; 1722 1791 } 1723 1792 1724 static Host LineEdit*SetupPinCode()1793 static HostTextEditSetting *SetupPinCode() 1725 1794 { 1726 Host LineEdit *ge = new HostLineEdit("SetupPinCode");1795 HostTextEditSetting *ge = new HostTextEditSetting("SetupPinCode"); 1727 1796 ge->setLabel(QObject::tr("Setup PIN code")); 1728 1797 ge->setHelpText(QObject::tr("This PIN is used to control access to the " 1729 1798 "setup menus. If you want to use this feature, then " … … static HostLineEdit *SetupPinCode() 1732 1801 return ge; 1733 1802 } 1734 1803 1735 static HostCheckBox *SetupPinCodeRequired()1804 static HostCheckBoxSetting *SetupPinCodeRequired() 1736 1805 { 1737 HostCheckBox *gc = new HostCheckBox("SetupPinCodeRequired");1806 HostCheckBoxSetting *gc = new HostCheckBoxSetting("SetupPinCodeRequired"); 1738 1807 gc->setLabel(QObject::tr("Require setup PIN") + " "); 1739 1808 gc->setValue(false); 1740 1809 gc->setHelpText(QObject::tr("If enabled, you will not be able to return " … … static HostComboBox *MythTimeFormat() 2219 2288 return gc; 2220 2289 } 2221 2290 2222 static HostComboBox *ChannelFormat()2291 static HostComboBoxSetting *ChannelFormat() 2223 2292 { 2224 HostComboBox *gc = new HostComboBox("ChannelFormat");2293 HostComboBoxSetting *gc = new HostComboBoxSetting("ChannelFormat"); 2225 2294 gc->setLabel(QObject::tr("Channel format")); 2226 2295 gc->addSelection(QObject::tr("number"), "<num>"); 2227 2296 gc->addSelection(QObject::tr("number callsign"), "<num> <sign>"); … … static HostComboBox *ChannelFormat() 2233 2302 return gc; 2234 2303 } 2235 2304 2236 static HostComboBox *LongChannelFormat()2305 static HostComboBoxSetting *LongChannelFormat() 2237 2306 { 2238 HostComboBox *gc = new HostComboBox("LongChannelFormat");2307 HostComboBoxSetting *gc = new HostComboBoxSetting("LongChannelFormat"); 2239 2308 gc->setLabel(QObject::tr("Long channel format")); 2240 2309 gc->addSelection(QObject::tr("number"), "<num>"); 2241 2310 gc->addSelection(QObject::tr("number callsign"), "<num> <sign>"); … … static HostComboBox *LongChannelFormat() 2247 2316 return gc; 2248 2317 } 2249 2318 2250 static GlobalCheckBox *LiveTVPriority()2319 static GlobalCheckBoxSetting *LiveTVPriority() 2251 2320 { 2252 GlobalCheckBox *bc = new GlobalCheckBox("LiveTVPriority");2321 GlobalCheckBoxSetting *bc = new GlobalCheckBoxSetting("LiveTVPriority"); 2253 2322 bc->setLabel(QObject::tr("Allow Live TV to move scheduled shows")); 2254 2323 bc->setValue(false); 2255 2324 bc->setHelpText(QObject::tr("If enabled, scheduled recordings will " … … static GlobalCheckBox *LiveTVPriority() 2258 2327 return bc; 2259 2328 } 2260 2329 2261 static HostCheckBox *ChannelGroupRememberLast()2262 {2263 HostCheckBox *gc = new HostCheckBox("ChannelGroupRememberLast");2264 gc->setLabel(QObject::tr("Remember last channel group"));2265 gc->setHelpText(QObject::tr("If enabled, the EPG will initially display "2266 "only the channels from the last channel group selected. Pressing "2267 "\"4\" will toggle channel group."));2268 gc->setValue(false);2269 return gc;2270 }2271 2330 2272 static HostComboBox *ChannelGroupDefault() 2331 2332 static HostComboBoxSetting *ChannelGroupDefault() 2273 2333 { 2274 HostComboBox *gc = new HostComboBox("ChannelGroupDefault");2334 HostComboBoxSetting *gc = new HostComboBoxSetting("ChannelGroupDefault"); 2275 2335 gc->setLabel(QObject::tr("Default channel group")); 2276 2336 2277 2337 ChannelGroupList changrplist; … … static HostComboBox *ChannelGroupDefault() 2291 2351 return gc; 2292 2352 } 2293 2353 2294 static HostCheckBox *BrowseChannelGroup()2354 static HostCheckBoxSetting *ChannelGroupRememberLast() 2295 2355 { 2296 HostCheckBox *gc = new HostCheckBox("BrowseChannelGroup"); 2356 HostCheckBoxSetting *gc = new HostCheckBoxSetting("ChannelGroupRememberLast"); 2357 gc->setLabel(QObject::tr("Remember last channel group")); 2358 gc->setHelpText(QObject::tr("If enabled, the EPG will initially display " 2359 "only the channels from the last channel group selected. Pressing " 2360 "\"4\" will toggle channel group.")); 2361 gc->setValue(false); 2362 gc->addTargetedChild("0", ChannelGroupDefault()); 2363 return gc; 2364 } 2365 2366 static HostCheckBoxSetting *BrowseChannelGroup() 2367 { 2368 HostCheckBoxSetting *gc = new HostCheckBoxSetting("BrowseChannelGroup"); 2297 2369 gc->setLabel(QObject::tr("Browse/change channels from Channel Group")); 2298 2370 gc->setHelpText(QObject::tr("If enabled, Live TV will browse or change " 2299 2371 "channels from the selected channel group. The \"All " … … static HostCheckBox *BrowseChannelGroup() 2303 2375 return gc; 2304 2376 } 2305 2377 2306 // Channel Group Settings2307 class ChannelGroupSettings : public TriggeredConfigurationGroup2308 {2309 public:2310 ChannelGroupSettings() : TriggeredConfigurationGroup(false, true, false, false)2311 {2312 setLabel(QObject::tr("Remember last channel group"));2313 setUseLabel(false);2314 2315 Setting* RememberChanGrpEnabled = ChannelGroupRememberLast();2316 addChild(RememberChanGrpEnabled);2317 setTrigger(RememberChanGrpEnabled);2318 2319 ConfigurationGroup* settings = new VerticalConfigurationGroup(false,false);2320 settings->addChild(ChannelGroupDefault());2321 addTarget("0", settings);2322 2323 // show nothing if RememberChanGrpEnabled is on2324 addTarget("1", new VerticalConfigurationGroup(true,false));2325 };2326 };2327 2328 2378 // General RecPriorities settings 2329 2379 2330 2380 static GlobalCheckBox *GRSchedMoveHigher() … … static GlobalSpinBox *GROverrideRecordRecPriority() 2563 2613 return bs; 2564 2614 } 2565 2615 2566 static Host LineEdit*DefaultTVChannel()2616 static HostTextEditSetting *DefaultTVChannel() 2567 2617 { 2568 Host LineEdit *ge = new HostLineEdit("DefaultTVChannel");2618 HostTextEditSetting *ge = new HostTextEditSetting("DefaultTVChannel"); 2569 2619 ge->setLabel(QObject::tr("Guide starts at channel")); 2570 2620 ge->setValue("3"); 2571 2621 ge->setHelpText(QObject::tr("The program guide starts on this channel if " … … static HostLineEdit *DefaultTVChannel() 2573 2623 return ge; 2574 2624 } 2575 2625 2576 static HostSpinBox *EPGRecThreshold()2626 static HostSpinBoxSetting *EPGRecThreshold() 2577 2627 { 2578 HostSpinBox *gs = new HostSpinBox("SelChangeRecThreshold", 1, 600, 1);2628 HostSpinBoxSetting *gs = new HostSpinBoxSetting("SelChangeRecThreshold", 1, 600, 1); 2579 2629 gs->setLabel(QObject::tr("Record threshold")); 2580 2630 gs->setValue(16); 2581 2631 gs->setHelpText(QObject::tr("Pressing SELECT on a show that is at least " … … static GlobalComboBox *ISO639PreferredLanguage(uint i) 2648 2698 return gc; 2649 2699 } 2650 2700 2651 static HostCheckBox *NetworkControlEnabled()2652 {2653 HostCheckBox *gc = new HostCheckBox("NetworkControlEnabled");2654 gc->setLabel(QObject::tr("Enable Network Remote Control interface"));2655 gc->setHelpText(QObject::tr("This enables support for controlling "2656 "mythfrontend over the network."));2657 gc->setValue(false);2658 return gc;2659 }2660 2701 2661 static HostSpinBox *NetworkControlPort()2702 static HostSpinBoxSetting *NetworkControlPort() 2662 2703 { 2663 HostSpinBox *gs = new HostSpinBox("NetworkControlPort", 1025, 65535, 1);2704 HostSpinBoxSetting *gs = new HostSpinBoxSetting("NetworkControlPort", 1025, 65535, 1); 2664 2705 gs->setLabel(QObject::tr("Network Remote Control port")); 2665 2706 gs->setValue(6546); 2666 2707 gs->setHelpText(QObject::tr("This specifies what port the network remote " … … static HostSpinBox *NetworkControlPort() 2668 2709 return gs; 2669 2710 } 2670 2711 2671 static Host LineEdit*UDPNotifyPort()2712 static HostTextEditSetting *UDPNotifyPort() 2672 2713 { 2673 Host LineEdit *ge = new HostLineEdit("UDPNotifyPort");2714 HostTextEditSetting *ge = new HostTextEditSetting("UDPNotifyPort"); 2674 2715 ge->setLabel(QObject::tr("UDP notify port")); 2675 2716 ge->setValue("6948"); 2676 2717 ge->setHelpText(QObject::tr("MythTV will listen for " … … static HostLineEdit *UDPNotifyPort() 2680 2721 return ge; 2681 2722 } 2682 2723 2724 static HostCheckBoxSetting *NetworkControlEnabled() 2725 { 2726 HostCheckBoxSetting *gc = new HostCheckBoxSetting("NetworkControlEnabled"); 2727 gc->setLabel(QObject::tr("Enable Network Remote Control interface")); 2728 gc->setHelpText(QObject::tr("This enables support for controlling " 2729 "mythfrontend over the network.")); 2730 gc->setValue(false); 2731 2732 gc->addTargetedChild("1",NetworkControlPort()); 2733 gc->addTargetedChild("1",UDPNotifyPort()); 2734 return gc; 2735 } 2736 2683 2737 static HostCheckBox *RealtimePriority() 2684 2738 { 2685 2739 HostCheckBox *gc = new HostCheckBox("RealtimePriority"); … … static HostCheckBox *RealtimePriority() 2692 2746 return gc; 2693 2747 } 2694 2748 2695 static Host CheckBox *EnableMediaMon()2749 static HostTextEditSetting *IgnoreMedia() 2696 2750 { 2697 HostCheckBox *gc = new HostCheckBox("MonitorDrives"); 2698 gc->setLabel(QObject::tr("Monitor CD/DVD") + 2699 QObject::tr(" (and other removable devices)")); 2700 gc->setHelpText(QObject::tr("This enables support for monitoring " 2701 "your CD/DVD drives for new disks and launching " 2702 "the proper plugin to handle them.")); 2703 gc->setValue(false); 2704 return gc; 2705 } 2706 2707 static HostLineEdit *IgnoreMedia() 2708 { 2709 HostLineEdit *ge = new HostLineEdit("IgnoreDevices"); 2751 HostTextEditSetting *ge = new HostTextEditSetting("IgnoreDevices"); 2710 2752 ge->setLabel(QObject::tr("Ignore devices")); 2711 2753 ge->setValue(""); 2712 2754 ge->setHelpText(QObject::tr("If there are any devices that you do not want " … … static HostLineEdit *IgnoreMedia() 2715 2757 return ge; 2716 2758 } 2717 2759 2718 class MythMediaSettings : public TriggeredConfigurationGroup 2760 static HostCheckBoxSetting *EnableMediaMon() 2719 2761 { 2720 public: 2721 MythMediaSettings() : 2722 TriggeredConfigurationGroup(false, false, true, true) 2723 { 2724 setLabel(QObject::tr("MythMediaMonitor")); 2725 setUseLabel(false); 2726 2727 Setting* enabled = EnableMediaMon(); 2728 addChild(enabled); 2729 setTrigger(enabled); 2730 2731 ConfigurationGroup* settings = new VerticalConfigurationGroup(false); 2732 settings->addChild(IgnoreMedia()); 2733 addTarget("1", settings); 2734 2735 // show nothing if fillEnabled is off 2736 addTarget("0", new VerticalConfigurationGroup(true)); 2737 }; 2738 }; 2739 2762 HostCheckBoxSetting *gc = new HostCheckBoxSetting("MonitorDrives"); 2763 gc->setLabel(QObject::tr("Monitor CD/DVD") + 2764 QObject::tr(" (and other removable devices)")); 2765 gc->setHelpText(QObject::tr("This enables support for monitoring " 2766 "your CD/DVD drives for new disks and launching " 2767 "the proper plugin to handle them.")); 2768 gc->setValue(false); 2769 gc->addTargetedChild("1", IgnoreMedia()); 2770 return gc; 2771 } 2740 2772 2741 2773 static HostComboBox *DisplayGroupTitleSort() 2742 2774 { … … class MacDesktopSettings : public TriggeredConfigurationGroup 3245 3277 }; 3246 3278 #endif 3247 3279 3248 static HostCheckBox *WatchTVGuide()3280 static HostCheckBoxSetting *WatchTVGuide() 3249 3281 { 3250 HostCheckBox *gc = new HostCheckBox("WatchTVGuide");3282 HostCheckBoxSetting *gc = new HostCheckBoxSetting("WatchTVGuide"); 3251 3283 gc->setLabel(QObject::tr("Show the program guide when starting Live TV")); 3252 3284 gc->setHelpText(QObject::tr("This starts the program guide immediately " 3253 3285 "upon starting to watch Live TV.")); … … static HostCheckBox *WatchTVGuide() 3255 3287 return gc; 3256 3288 } 3257 3289 3290 3291 /* This code is a duplication the clas DatabaseSettings. As it it also use bymythbackend I rewrote here for the time being */ 3292 3293 class DatabaseGroupSetting : public GroupSetting 3294 { 3295 public: 3296 DatabaseGroupSetting(const QString &DBhostOverride = QString::null):GroupSetting() 3297 { 3298 m_DBhostOverride = DBhostOverride; 3299 3300 setLabel(QObject::tr("Database Configuration")); 3301 3302 MSqlQuery query(MSqlQuery::InitCon()); 3303 if (query.isConnected()) 3304 setHelpText(QObject::tr("All database settings take effect when " 3305 "you restart this program.")); 3306 else 3307 setHelpText(QObject::tr("MythTV could not connect to the database. " 3308 "Please verify your database settings " 3309 "below.")); 3310 3311 dbHostName = new TransTextEditSetting(); 3312 dbHostName->setLabel(QObject::tr("Hostname")); 3313 dbHostName->setHelpText(QObject::tr("The host name or IP address of " 3314 "the machine hosting the database. " 3315 "This information is required.")); 3316 addChild(dbHostName); 3317 3318 dbHostPing = new TransMythUICheckBoxSetting(); 3319 dbHostPing->setLabel(QObject::tr("Ping test server?")); 3320 dbHostPing->setHelpText(QObject::tr("Test basic host connectivity using " 3321 "the ping command. Turn off if your " 3322 "host or network don't support ping " 3323 "(ICMP ECHO) packets")); 3324 addChild(dbHostPing); 3325 3326 dbPort = new TransTextEditSetting(); 3327 dbPort->setLabel(QObject::tr("Port")); 3328 dbPort->setHelpText(QObject::tr("The port number the database is running " 3329 "on. Leave blank if using the default " 3330 "port (3306).")); 3331 addChild(dbPort); 3332 3333 dbName = new TransTextEditSetting(); 3334 dbName->setLabel(QObject::tr("Database name")); 3335 dbName->setHelpText(QObject::tr("The name of the database. " 3336 "This information is required.")); 3337 addChild(dbName); 3338 3339 dbUserName = new TransTextEditSetting(); 3340 dbUserName->setLabel(QObject::tr("User")); 3341 dbUserName->setHelpText(QObject::tr("The user name to use while " 3342 "connecting to the database. " 3343 "This information is required.")); 3344 addChild(dbUserName); 3345 3346 dbPassword = new TransTextEditSetting(); 3347 dbPassword->setLabel(QObject::tr("Password")); 3348 dbPassword->setHelpText(QObject::tr("The password to use while " 3349 "connecting to the database. " 3350 "This information is required.")); 3351 addChild(dbPassword); 3352 3353 localEnabled = new TransMythUICheckBoxSetting(); 3354 localEnabled->setLabel(QObject::tr("Use custom identifier for frontend " 3355 "preferences")); 3356 localEnabled->setHelpText(QObject::tr("If this frontend's host name " 3357 "changes often, check this box " 3358 "and provide a network-unique " 3359 "name to identify it. " 3360 "If unchecked, the frontend " 3361 "machine's local host name will " 3362 "be used to save preferences in " 3363 "the database.")); 3364 addChild(localEnabled); 3365 3366 3367 localHostName = new TransTextEditSetting(); 3368 localHostName->setLabel(QObject::tr("Custom identifier")); 3369 localHostName->setHelpText(QObject::tr("An identifier to use while " 3370 "saving the settings for this " 3371 "frontend.")); 3372 localEnabled->addTargetedChild("1", localHostName); 3373 3374 3375 wolEnabled = new TransMythUICheckBoxSetting(); 3376 wolEnabled->setLabel(QObject::tr("Enable database server wakeup")); 3377 wolEnabled->setHelpText(QObject::tr("If enabled, the frontend will use " 3378 "database wakeup parameters to " 3379 "reconnect to the database server.")); 3380 addChild(wolEnabled); 3381 3382 wolReconnect = new TransMythUISpinBoxSetting(0, 60, 1, true); 3383 wolReconnect->setLabel(QObject::tr("Reconnect time")); 3384 wolReconnect->setHelpText(QObject::tr("The time in seconds to wait for " 3385 "the server to wake up.")); 3386 wolEnabled->addTargetedChild("1",wolReconnect); 3387 3388 wolRetry = new TransMythUISpinBoxSetting(1, 10, 1, true); 3389 wolRetry->setLabel(QObject::tr("Retry attempts")); 3390 wolRetry->setHelpText(QObject::tr("The number of retries to wake the " 3391 "server before the frontend gives " 3392 "up.")); 3393 wolEnabled->addTargetedChild("1",wolRetry); 3394 3395 wolCommand = new TransTextEditSetting(); 3396 wolCommand->setLabel(QObject::tr("Wake command")); 3397 wolCommand->setHelpText(QObject::tr("The command executed on this " 3398 "frontend to wake up the database " 3399 "server (eg. sudo /etc/init.d/mysql " 3400 "restart).")); 3401 wolEnabled->addTargetedChild("1",wolCommand); 3402 } 3403 3404 void Load(void) 3405 { 3406 3407 DatabaseParams params = gContext->GetDatabaseParams(); 3408 3409 if (params.dbHostName.isEmpty() || 3410 params.dbUserName.isEmpty() || 3411 params.dbPassword.isEmpty() || 3412 params.dbName.isEmpty()) 3413 setHelpText(getHelpText() + "\n" + 3414 QObject::tr("Required fields are" 3415 " marked with an asterisk (*).")); 3416 3417 if (params.dbHostName.isEmpty()) 3418 { 3419 dbHostName->setLabel("* " + dbHostName->getLabel()); 3420 dbHostName->setValue(m_DBhostOverride); 3421 } 3422 else 3423 dbHostName->setValue(params.dbHostName); 3424 3425 dbHostPing->setValue(params.dbHostPing); 3426 3427 if (params.dbPort) 3428 dbPort->setValue(QString::number(params.dbPort)); 3429 3430 dbUserName->setValue(params.dbUserName); 3431 if (params.dbUserName.isEmpty()) 3432 dbUserName->setLabel("* " + dbUserName->getLabel()); 3433 dbPassword->setValue(params.dbPassword); 3434 if (params.dbPassword.isEmpty()) 3435 dbPassword->setLabel("* " + dbPassword->getLabel()); 3436 dbName->setValue(params.dbName); 3437 if (params.dbName.isEmpty()) 3438 dbName->setLabel("* " + dbName->getLabel()); 3439 3440 localEnabled->setValue(params.localEnabled); 3441 localHostName->setValue(params.localHostName); 3442 3443 wolEnabled->setValue(params.wolEnabled); 3444 wolReconnect->setValue(params.wolReconnect); 3445 wolRetry->setValue(params.wolRetry); 3446 wolCommand->setValue(params.wolCommand); 3447 //TODO set all the children's m_haveChanged to false 3448 }; 3449 void Save(void) 3450 { 3451 DatabaseParams params = gContext->GetDatabaseParams(); 3452 3453 params.dbHostName = dbHostName->getValue(); 3454 params.dbHostPing = dbHostPing->boolValue(); 3455 params.dbPort = dbPort->getValue().toInt(); 3456 params.dbUserName = dbUserName->getValue(); 3457 params.dbPassword = dbPassword->getValue(); 3458 params.dbName = dbName->getValue(); 3459 params.dbType = "QMYSQL"; 3460 3461 params.localEnabled = localEnabled->boolValue(); 3462 params.localHostName = localHostName->getValue(); 3463 3464 params.wolEnabled = wolEnabled->boolValue(); 3465 params.wolReconnect = wolReconnect->intValue(); 3466 params.wolRetry = wolRetry->intValue(); 3467 params.wolCommand = wolCommand->getValue(); 3468 3469 gContext->SaveDatabaseParams(params); 3470 //TODO set all the children's m_haveChanged to false 3471 }; 3472 3473 protected: 3474 TransTextEditSetting *dbHostName; 3475 TransMythUICheckBoxSetting *dbHostPing; 3476 TransTextEditSetting *dbPort; 3477 TransTextEditSetting *dbName; 3478 TransTextEditSetting *dbUserName; 3479 TransTextEditSetting *dbPassword; 3480 TransMythUICheckBoxSetting *localEnabled; 3481 TransTextEditSetting *localHostName; 3482 TransMythUICheckBoxSetting *wolEnabled; 3483 TransMythUISpinBoxSetting *wolReconnect; 3484 TransMythUISpinBoxSetting *wolRetry; 3485 TransTextEditSetting *wolCommand; 3486 3487 QString m_DBhostOverride; 3488 }; 3489 3490 /* end of duplicated code form DatabaseSettings */ 3491 3258 3492 MainGeneralSettings::MainGeneralSettings() 3259 3493 { 3260 DatabaseSettings::addDatabaseSettings(this); 3494 //DatabaseSettings::addDatabaseSettings(this); 3495 setLabel(QObject::tr("Main Settings")); 3261 3496 3262 VerticalConfigurationGroup *pin = 3263 new VerticalConfigurationGroup(false, true, false, false); 3497 addChild(new DatabaseGroupSetting()); 3498 3499 GroupSetting *pin = new GroupSetting(); 3264 3500 pin->setLabel(QObject::tr("Settings Access")); 3265 3501 pin->addChild(SetupPinCodeRequired()); 3266 3502 pin->addChild(SetupPinCode()); 3267 3503 addChild(pin); 3268 3504 3269 VerticalConfigurationGroup *general = 3270 new VerticalConfigurationGroup(false, true, false, false); 3505 GroupSetting *general = new GroupSetting(); 3271 3506 general->setLabel(QObject::tr("General")); 3272 3507 general->addChild(UseVirtualKeyboard()); 3273 3508 general->addChild(ScreenShotPath()); 3274 3509 addChild(general); 3275 3510 3276 VerticalConfigurationGroup *media = 3277 new VerticalConfigurationGroup(false, true, false, false); 3511 GroupSetting *media = new GroupSetting(); 3278 3512 media->setLabel(QObject::tr("Media Monitor")); 3279 MythMediaSettings *mediaMon = new MythMediaSettings(); 3280 media->addChild(mediaMon); 3513 media->addChild(EnableMediaMon()); 3281 3514 addChild(media); 3282 3515 3283 VerticalConfigurationGroup *shutdownSettings = 3284 new VerticalConfigurationGroup(true, true, false, false); 3516 GroupSetting *shutdownSettings = new GroupSetting(); 3285 3517 shutdownSettings->setLabel(QObject::tr("Shutdown/Reboot Settings")); 3286 3518 shutdownSettings->addChild(OverrideExitMenu()); 3287 3519 shutdownSettings->addChild(HaltCommand()); 3288 3520 shutdownSettings->addChild(RebootCommand()); 3289 3521 addChild(shutdownSettings); 3290 3522 3291 VerticalConfigurationGroup *remotecontrol = 3292 new VerticalConfigurationGroup(false, true, false, false); 3523 GroupSetting *remotecontrol = new GroupSetting(); 3293 3524 remotecontrol->setLabel(QObject::tr("Remote Control")); 3294 3525 remotecontrol->addChild(LircDaemonDevice()); 3295 3526 remotecontrol->addChild(NetworkControlEnabled()); 3296 remotecontrol->addChild(NetworkControlPort());3297 remotecontrol->addChild(UDPNotifyPort());3298 3527 addChild(remotecontrol); 3299 3528 } 3300 3529 … … PlaybackSettings::PlaybackSettings() 3440 3669 3441 3670 OSDSettings::OSDSettings() 3442 3671 { 3443 VerticalConfigurationGroup* osd = new VerticalConfigurationGroup(false); 3444 osd->setLabel(QObject::tr("On-screen Display")); 3672 setLabel(QObject::tr("On-screen Display")); 3445 3673 3446 osd->addChild(EnableMHEG()); 3447 osd->addChild(PersistentBrowseMode()); 3448 osd->addChild(BrowseAllTuners()); 3449 osd->addChild(CCBackground()); 3450 osd->addChild(DefaultCCMode()); 3451 osd->addChild(PreferCC708()); 3452 osd->addChild(SubtitleFont()); 3453 osd->addChild(OSDCC708TextZoomPercentage()); 3454 osd->addChild(SubtitleCodec()); 3455 addChild(osd); 3674 addChild(EnableMHEG()); 3675 addChild(PersistentBrowseMode()); 3676 addChild(BrowseAllTuners()); 3677 addChild(CCBackground()); 3678 addChild(DefaultCCMode()); 3679 addChild(PreferCC708()); 3680 addChild(SubtitleFont()); 3681 addChild(OSDCC708TextZoomPercentage()); 3682 addChild(SubtitleCodec()); 3456 3683 3457 3684 //VerticalConfigurationGroup *cc = new VerticalConfigurationGroup(false); 3458 3685 //cc->setLabel(QObject::tr("Closed Captions")); … … OSDSettings::OSDSettings() 3467 3694 3468 3695 GeneralSettings::GeneralSettings() 3469 3696 { 3470 VerticalConfigurationGroup* general = new VerticalConfigurationGroup(false);3697 GroupSetting* general = new GroupSetting(); 3471 3698 general->setLabel(QObject::tr("General (Basic)")); 3472 3699 general->addChild(ChannelOrdering()); 3473 3700 general->addChild(ChannelFormat()); 3474 3701 general->addChild(LongChannelFormat()); 3702 //LiveTVPriority (backend setting) should probably not be mixed with frontend settings 3475 3703 general->addChild(LiveTVPriority()); 3476 3704 addChild(general); 3477 3705 3478 VerticalConfigurationGroup* autoexp = new VerticalConfigurationGroup(false);3706 GroupSetting* autoexp = new GroupSetting(); 3479 3707 autoexp->setLabel(QObject::tr("General (Auto-Expire)")); 3480 3708 autoexp->addChild(AutoExpireMethod()); 3481 3482 VerticalConfigurationGroup *expgrp0 = 3483 new VerticalConfigurationGroup(false, false, true, true); 3484 expgrp0->addChild(AutoExpireDefault()); 3485 expgrp0->addChild(RerecordWatched()); 3486 expgrp0->addChild(AutoExpireWatchedPriority()); 3487 3488 VerticalConfigurationGroup *expgrp1 = 3489 new VerticalConfigurationGroup(false, false, true, true); 3490 expgrp1->addChild(AutoExpireLiveTVMaxAge()); 3491 expgrp1->addChild(AutoExpireDayPriority()); 3492 expgrp1->addChild(AutoExpireExtraSpace()); 3493 3494 HorizontalConfigurationGroup *expgrp = 3495 new HorizontalConfigurationGroup(false, false, true, true); 3496 expgrp->addChild(expgrp0); 3497 expgrp->addChild(expgrp1); 3498 3499 autoexp->addChild(expgrp); 3500 autoexp->addChild(new DeletedExpireOptions()); 3501 3709 autoexp->addChild(AutoExpireDefault()); 3710 autoexp->addChild(RerecordWatched()); 3711 autoexp->addChild(AutoExpireWatchedPriority()); 3712 autoexp->addChild(AutoExpireLiveTVMaxAge()); 3713 autoexp->addChild(AutoExpireDayPriority()); 3714 autoexp->addChild(AutoExpireExtraSpace()); 3715 autoexp->addChild(AutoExpireInsteadOfDelete()); 3502 3716 addChild(autoexp); 3503 3717 3504 VerticalConfigurationGroup* jobs = new VerticalConfigurationGroup(false);3718 GroupSetting* jobs = new GroupSetting(); 3505 3719 jobs->setLabel(QObject::tr("General (Jobs)")); 3506 3720 jobs->addChild(CommercialSkipMethod()); 3507 3721 jobs->addChild(CommFlagFast()); … … GeneralSettings::GeneralSettings() 3509 3723 jobs->addChild(DefaultTranscoder()); 3510 3724 jobs->addChild(DeferAutoTranscodeDays()); 3511 3725 3512 VerticalConfigurationGroup* autogrp0 = 3513 new VerticalConfigurationGroup(false, false, true, true); 3514 autogrp0->addChild(AutoMetadataLookup()); 3515 autogrp0->addChild(AutoCommercialFlag()); 3516 autogrp0->addChild(AutoTranscode()); 3517 3518 VerticalConfigurationGroup* autogrp1 = 3519 new VerticalConfigurationGroup(false, false, true, true); 3520 autogrp0->addChild(AutoRunUserJob(1)); 3521 autogrp1->addChild(AutoRunUserJob(2)); 3522 autogrp1->addChild(AutoRunUserJob(3)); 3523 autogrp1->addChild(AutoRunUserJob(4)); 3524 3525 HorizontalConfigurationGroup *autogrp = 3526 new HorizontalConfigurationGroup(true, true, false, true); 3726 GroupSetting *autogrp = new GroupSetting(); 3527 3727 autogrp->setLabel( 3528 3728 QObject::tr("Default Job Queue Settings for New Scheduled Recordings")); 3529 autogrp->addChild(autogrp0); 3530 autogrp->addChild(autogrp1); 3729 autogrp->addChild(AutoMetadataLookup()); 3730 autogrp->addChild(AutoCommercialFlag()); 3731 autogrp->addChild(AutoTranscode()); 3732 autogrp->addChild(AutoRunUserJob(1)); 3733 autogrp->addChild(AutoRunUserJob(2)); 3734 autogrp->addChild(AutoRunUserJob(3)); 3735 autogrp->addChild(AutoRunUserJob(4)); 3736 3531 3737 jobs->addChild(autogrp); 3532 3738 3533 3739 addChild(jobs); 3534 3740 3535 VerticalConfigurationGroup* general2 = new VerticalConfigurationGroup(false);3741 GroupSetting* general2 = new GroupSetting(); 3536 3742 general2->setLabel(QObject::tr("General (Advanced)")); 3537 3743 general2->addChild(RecordPreRoll()); 3538 3744 general2->addChild(RecordOverTime()); 3539 3745 general2->addChild(CategoryOverTimeSettings()); 3540 3746 addChild(general2); 3541 3747 3542 VerticalConfigurationGroup* changrp = new VerticalConfigurationGroup(false);3748 GroupSetting* changrp = new GroupSetting(); 3543 3749 changrp->setLabel(QObject::tr("General (Channel Groups)")); 3544 ChannelGroupSettings *changroupsettings = new ChannelGroupSettings(); 3545 changrp->addChild(changroupsettings); 3750 changrp->addChild(ChannelGroupRememberLast()); 3546 3751 changrp->addChild(BrowseChannelGroup()); 3547 3752 addChild(changrp); 3548 3753 } 3549 3754 3550 3755 EPGSettings::EPGSettings() 3551 3756 { 3552 VerticalConfigurationGroup* epg = new VerticalConfigurationGroup(false); 3553 epg->setLabel(QObject::tr("Program Guide") + " 1/1"); 3554 epg->addChild(WatchTVGuide()); 3555 epg->addChild(DefaultTVChannel()); 3556 epg->addChild(EPGRecThreshold()); 3557 addChild(epg); 3757 setLabel(QObject::tr("Program Guide")); 3758 addChild(WatchTVGuide()); 3759 addChild(DefaultTVChannel()); 3760 addChild(EPGRecThreshold()); 3558 3761 } 3559 3762 3560 3763 GeneralRecPrioritiesSettings::GeneralRecPrioritiesSettings() -
mythtv/programs/mythfrontend/globalsettings.h
diff --git a/mythtv/programs/mythfrontend/globalsettings.h b/mythtv/programs/mythfrontend/globalsettings.h index 93e774a..efdd110 100644
a b 7 7 #include "settings.h" 8 8 #include "mythcontext.h" 9 9 #include "videodisplayprofile.h" 10 #include "standardsettings.h" 10 11 11 12 #include <QMutex> 12 13 … … class PlaybackSettings : public ConfigurationWizard 18 19 PlaybackSettings(); 19 20 }; 20 21 21 class OSDSettings: virtual public ConfigurationWizard 22 //TODO check the purpose of virtual here 23 //class OSDSettings: virtual public ConfigurationWizard 24 class OSDSettings: public GroupSetting 22 25 { 23 26 public: 24 27 OSDSettings(); 25 28 }; 26 29 27 class GeneralSettings : public ConfigurationWizard30 class GeneralSettings : public GroupSetting 28 31 { 29 32 public: 30 33 GeneralSettings(); 31 34 }; 32 35 33 class EPGSettings : public ConfigurationWizard36 class EPGSettings : public GroupSetting 34 37 { 35 38 public: 36 39 EPGSettings(); … … class AppearanceSettings : public ConfigurationWizard 42 45 AppearanceSettings(); 43 46 }; 44 47 45 class MainGeneralSettings : public ConfigurationWizard48 class MainGeneralSettings : public GroupSetting 46 49 { 47 50 public: 48 51 MainGeneralSettings(); -
mythtv/programs/mythfrontend/main.cpp
diff --git a/mythtv/programs/mythfrontend/main.cpp b/mythtv/programs/mythfrontend/main.cpp index 259e020..173ddec 100644
a b 1 #include <unistd.h>2 1 #include <fcntl.h> 3 2 #include <signal.h> 4 3 #include <cerrno> … … using namespace std; 74 73 #include "themechooser.h" 75 74 #include "mythversion.h" 76 75 #include "taskqueue.h" 76 #include "standardsettings.h" 77 77 78 78 // Video 79 79 #include "cleanup.h" … … namespace 138 138 139 139 if (passwordValid) 140 140 { 141 VideoGeneralSettings settings; 142 settings.exec(); 141 MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); 142 StandardSettingDialog *ssd = new StandardSettingDialog(mainStack, "videogeneralsettings"); 143 144 if (ssd->Create()) 145 { 146 ssd->loadSettings(new VideoGeneralSettings()); 147 mainStack->AddScreen(ssd); 148 } 149 else 150 delete ssd; 143 151 } 144 152 else 145 153 { … … static void TVMenuCallback(void *data, QString &selection) 898 906 } 899 907 else if (sel == "settings general") 900 908 { 901 GeneralSettings settings; 902 settings.exec(); 909 MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); 910 StandardSettingDialog *ssd = new StandardSettingDialog(mainStack, "videogeneralsettings"); 911 912 if (ssd->Create()) 913 { 914 ssd->loadSettings(new GeneralSettings()); 915 mainStack->AddScreen(ssd); 916 } 917 else 918 delete ssd; 903 919 } 904 920 else if (sel == "settings audiogeneral") 905 921 { … … static void TVMenuCallback(void *data, QString &selection) 908 924 } 909 925 else if (sel == "settings maingeneral") 910 926 { 911 MainGeneralSettings mainsettings; 912 mainsettings.exec(); 913 QStringList strlist( QString("REFRESH_BACKEND") ); 914 gCoreContext->SendReceiveStringList(strlist); 927 MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); 928 StandardSettingDialog *ssd = new StandardSettingDialog(mainStack, "videogeneralsettings"); 929 930 if (ssd->Create()) 931 { 932 ssd->loadSettings(new MainGeneralSettings()); 933 mainStack->AddScreen(ssd); 934 } 935 else 936 delete ssd; 937 /*TODO QStringList strlist( QString("REFRESH_BACKEND") ); 938 gCoreContext->SendReceiveStringList(strlist);*/ 915 939 } 916 940 else if (sel == "settings playback") 917 941 { … … static void TVMenuCallback(void *data, QString &selection) 920 944 } 921 945 else if (sel == "settings osd") 922 946 { 923 OSDSettings settings; 924 settings.exec(); 947 MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); 948 StandardSettingDialog *ssd = new StandardSettingDialog(mainStack, "videogeneralsettings"); 949 950 if (ssd->Create()) 951 { 952 ssd->loadSettings(new OSDSettings()); 953 mainStack->AddScreen(ssd); 954 } 955 else 956 delete ssd; 925 957 } 926 958 else if (sel == "settings epg") 927 959 { 928 EPGSettings settings; 929 settings.exec(); 960 MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); 961 StandardSettingDialog *ssd = new StandardSettingDialog(mainStack, "videogeneralsettings"); 962 963 if (ssd->Create()) 964 { 965 ssd->loadSettings(new EPGSettings()); 966 mainStack->AddScreen(ssd); 967 } 968 else 969 delete ssd; 930 970 } 931 971 else if (sel == "settings channelgroups") 932 972 { -
mythtv/programs/mythfrontend/mythfrontend.pro
diff --git a/mythtv/programs/mythfrontend/mythfrontend.pro b/mythtv/programs/mythfrontend/mythfrontend.pro index 7c71469..dde9b2d 100644
a b HEADERS += videoplayercommand.h videopopups.h 39 39 HEADERS += videofilter.h videolist.h 40 40 HEADERS += videoplayersettings.h videodlg.h 41 41 HEADERS += videoglobalsettings.h upnpscanner.h 42 HEADERS += commandlineparser.h 42 HEADERS += commandlineparser.h standardsettings.h 43 43 44 44 SOURCES += main.cpp playbackbox.cpp viewscheduled.cpp audiogeneralsettings.cpp 45 45 SOURCES += globalsettings.cpp manualschedule.cpp programrecpriority.cpp … … SOURCES += videoplayercommand.cpp videopopups.cpp 60 60 SOURCES += videofilter.cpp videolist.cpp 61 61 SOURCES += videoplayersettings.cpp videodlg.cpp 62 62 SOURCES += videoglobalsettings.cpp upnpscanner.cpp 63 SOURCES += commandlineparser.cpp 63 SOURCES += commandlineparser.cpp standardsettings.cpp 64 64 65 65 HEADERS += serviceHosts/frontendServiceHost.h 66 66 HEADERS += services/frontend.h -
new file mythtv/programs/mythfrontend/standardsettings.cpp
diff --git a/mythtv/programs/mythfrontend/standardsettings.cpp b/mythtv/programs/mythfrontend/standardsettings.cpp new file mode 100755 index 0000000..d4e61a3
- + 1 #include "standardsettings.h" 2 #include <QCoreApplication> 3 4 #include <mythcontext.h> 5 #include <mythmainwindow.h> 6 #include <mythdialogbox.h> 7 #include <mythuispinbox.h> 8 #include <mythuitext.h> 9 #include <mythuibutton.h> 10 #include "mythlogging.h" 11 12 13 MythUIButtonListItem * NewConfigurable::createButton(MythUIButtonList * list) 14 { 15 MythUIButtonListItem *item = new MythUIButtonListItem(list, label); 16 updateButton(item); 17 return item; 18 } 19 20 StandardSetting::StandardSetting(Storage *_storage) : 21 NewConfigurable(_storage), 22 m_haveChanged(false), 23 m_parent(0) 24 25 { 26 } 27 28 StandardSetting::~StandardSetting() 29 { 30 QList<StandardSetting *>::const_iterator i; 31 for (i = m_children.constBegin(); i != m_children.constEnd(); ++i) 32 delete *i; 33 m_children.clear(); 34 35 QMap<QString, QList<StandardSetting *> >::const_iterator iMap; 36 for (iMap = m_targets.constBegin(); iMap != m_targets.constEnd(); ++iMap) 37 { 38 for (i = (*iMap).constBegin(); i != (*iMap).constEnd(); ++i) 39 delete *i; 40 } 41 m_targets.clear(); 42 } 43 44 void StandardSetting::setParent(StandardSetting *parent) 45 { 46 m_parent = parent; 47 } 48 49 StandardSetting * StandardSetting::getParent() 50 { 51 return m_parent; 52 } 53 54 void StandardSetting::addChild(StandardSetting *child) 55 { 56 if (!child)return; 57 m_children.append(child); 58 child->setParent(this); 59 } 60 61 void StandardSetting::updateButton(MythUIButtonListItem *item) 62 { 63 item->SetText(label); 64 item->SetText(settingValue,"value"); 65 item->setDrawArrow (haveSubSettings()); 66 item->SetData(qVariantFromValue(this)); 67 68 } 69 70 void StandardSetting::addTargetedChild(const QString &value, StandardSetting * setting) 71 { 72 m_targets[value].append(setting); 73 setting->setParent(this); 74 } 75 76 77 QList<StandardSetting *> *StandardSetting::getSubSettings() 78 { 79 if (settingValue.isEmpty()) 80 return &m_children; 81 else if (m_targets.contains(settingValue)) 82 return &m_targets[settingValue]; 83 return NULL; 84 } 85 86 bool StandardSetting::haveSubSettings() 87 { 88 QList<StandardSetting *> * subSettings=getSubSettings(); 89 return (subSettings!=NULL && subSettings->size()>0); 90 } 91 92 void StandardSetting::setValue(const QString &newValue) 93 { 94 settingValue = newValue; 95 emit valueChanged(settingValue); 96 } 97 98 bool StandardSetting::haveChanged() 99 { 100 if (m_haveChanged) return true; 101 102 //we check only the relevant children 103 QList<StandardSetting *> *children = getSubSettings(); 104 if (children==NULL) return false; 105 QList<StandardSetting *>::const_iterator i; 106 bool haveChanged = false; 107 for (i = children->constBegin(); !haveChanged && i != children->constEnd(); ++i) 108 haveChanged=(*i)->haveChanged(); 109 110 return haveChanged; 111 } 112 113 void StandardSetting::Load(void) 114 { 115 116 /* Storage *s = GetStorage(); 117 if (s)s->Load();*/ 118 119 m_haveChanged=false; 120 121 LoadChildren(); 122 } 123 124 void StandardSetting::LoadChildren(void) 125 { 126 QList<StandardSetting *>::const_iterator i; 127 for (i = m_children.constBegin(); i != m_children.constEnd(); ++i) 128 (*i)->Load(); 129 130 QMap<QString, QList<StandardSetting *> >::const_iterator iMap; 131 for (iMap = m_targets.constBegin(); iMap != m_targets.constEnd(); ++iMap) 132 { 133 for (i = (*iMap).constBegin(); i != (*iMap).constEnd(); ++i) 134 (*i)->Load(); 135 } 136 137 } 138 void StandardSetting::Save(void) 139 { 140 /* 141 Storage *s = GetStorage(); 142 if (s)s->Save();*/ 143 144 m_haveChanged=false; 145 146 SaveChildren(); 147 } 148 149 void StandardSetting::SaveChildren(void) 150 { 151 //we save only the relevant children 152 QList<StandardSetting *> *children = getSubSettings(); 153 if (children==NULL) return; 154 QList<StandardSetting *>::const_iterator i; 155 for (i = children->constBegin(); i != children->constEnd(); ++i) 156 (*i)->Save(); 157 } 158 159 /******************************************************************************* 160 Group Setting 161 ********************************************************************************/ 162 GroupSetting::GroupSetting(): 163 StandardSetting(this), TransientStorage() 164 { 165 } 166 167 bool GroupSetting::edit(MythScreenType * screen) 168 { 169 DialogCompletionEvent *dce = 170 new DialogCompletionEvent("leveldown", 0, "", ""); 171 QCoreApplication::postEvent(screen, dce); 172 return true; 173 } 174 175 176 /******************************************************************************* 177 Text Setting 178 ********************************************************************************/ 179 180 MythUITextEditSetting::MythUITextEditSetting(Storage *_storage): 181 StandardSetting(_storage) 182 { 183 } 184 185 bool MythUITextEditSetting::edit(MythScreenType * screen) 186 { 187 188 MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); 189 190 MythTextInputDialog *settingdialog = 191 new MythTextInputDialog(popupStack, 192 getLabel(),FilterNone, false,settingValue); 193 194 if (settingdialog->Create()) 195 { 196 settingdialog->SetReturnEvent(screen, "editsetting"); 197 popupStack->AddScreen(settingdialog); 198 return true; 199 } 200 return false; 201 }; 202 203 void MythUITextEditSetting::resultEdit(DialogCompletionEvent *dce, MythUIButtonListItem *item) 204 { 205 if (settingValue!=dce->GetResultText()) 206 { 207 setValue(dce->GetResultText()); 208 m_haveChanged=true; 209 this->updateButton(item); 210 } 211 } 212 213 /******************************************************************************* 214 ComboBoxSetting 215 ********************************************************************************/ 216 217 MythUIComboBoxSetting::MythUIComboBoxSetting(Storage *_storage): 218 StandardSetting(_storage) 219 { 220 } 221 222 MythUIComboBoxSetting::~MythUIComboBoxSetting() 223 { 224 m_labels.clear(); 225 m_values.clear(); 226 } 227 228 void MythUIComboBoxSetting::setValue(int value) 229 { 230 if (value>=0 && value < m_values.size()) 231 //Why does the polymorphism does not work here 232 StandardSetting::setValue(m_values.at(value)); 233 } 234 235 void MythUIComboBoxSetting::addSelection(const QString &label, QString value, 236 bool select) 237 { 238 value = (value.isEmpty()) ? label : value; 239 m_labels.push_back(label); 240 m_values.push_back(value); 241 242 if (select || !m_isSet) 243 { 244 //Why does the polymorphism does not work here 245 StandardSetting::setValue(value); 246 if (!m_isSet) m_isSet = true; 247 } 248 } 249 250 void MythUIComboBoxSetting::updateButton(MythUIButtonListItem *item) 251 { 252 item->SetText(label); 253 int indexValue = m_values.indexOf(settingValue); 254 if (indexValue >=0) 255 item->SetText(m_labels.value(indexValue),"value"); 256 else 257 item->SetText("","value"); 258 item->setDrawArrow (haveSubSettings()); 259 item->SetData(qVariantFromValue((StandardSetting*)this)); 260 261 } 262 263 bool MythUIComboBoxSetting::edit(MythScreenType * screen) 264 { 265 MythScreenStack *popupStack = 266 GetMythMainWindow()->GetStack("popup stack"); 267 268 MythDialogBox * m_menuPopup = 269 new MythDialogBox(getLabel(), popupStack, "optionmenu"); 270 271 if (m_menuPopup->Create()) 272 popupStack->AddScreen(m_menuPopup); 273 274 m_menuPopup->SetReturnEvent(screen, "editsetting"); 275 276 for (int i = 0; i < m_labels.size() && m_values.size(); ++i) 277 { 278 QString value = m_values.at(i); 279 m_menuPopup->AddButton(m_labels.at(i),value,false,value==settingValue); 280 } 281 282 return true; 283 } 284 285 void MythUIComboBoxSetting::resultEdit(DialogCompletionEvent *dce, MythUIButtonListItem *item) 286 { 287 if (dce->GetResult()!=-1 && settingValue!=dce->GetData().toString()) 288 { 289 //Why does the polymorphism does not work here 290 StandardSetting::setValue(dce->GetData().toString()); 291 m_haveChanged=true; 292 updateButton(item); 293 } 294 } 295 296 297 /******************************************************************************* 298 SpinBox Setting 299 ********************************************************************************/ 300 301 MythUISpinBoxSetting::MythUISpinBoxSetting(Storage *_storage, int min, int max, int step, bool allow_single_step): 302 StandardSetting(_storage), 303 m_min(min), 304 m_max(max), 305 m_step(step), 306 m_allow_single_step(allow_single_step) 307 { 308 } 309 310 void MythUISpinBoxSetting::setValue(int value) 311 { 312 StandardSetting::setValue(QString::number(value)); 313 } 314 315 int MythUISpinBoxSetting::intValue() 316 { 317 return settingValue.toInt(); 318 } 319 320 bool MythUISpinBoxSetting::edit(MythScreenType * screen) 321 { 322 //TODO use a correct dialog with a spin box 323 MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); 324 325 MythTextInputDialog *settingdialog = 326 new MythTextInputDialog(popupStack, 327 getLabel(),FilterNone, false,settingValue); 328 329 330 if (settingdialog->Create()) 331 { 332 settingdialog->SetReturnEvent(screen, "editsetting"); 333 popupStack->AddScreen(settingdialog); 334 return true; 335 } 336 return false; 337 }; 338 339 void MythUISpinBoxSetting::resultEdit(DialogCompletionEvent *dce, MythUIButtonListItem *item) 340 { 341 if (settingValue!=dce->GetResultText()) 342 { 343 bool ok; 344 int value = dce->GetResultText().toInt(&ok); 345 ok = ok && (value>=m_min) && (value<=m_max); 346 if (ok && !m_allow_single_step && m_step>0) 347 { 348 ok = ((value-m_min)%m_step)==0; 349 } 350 if (ok) //TODO give user some feedback 351 { 352 StandardSetting::setValue(dce->GetResultText()); 353 m_haveChanged=true; 354 this->updateButton(item); 355 } 356 } 357 } 358 359 /******************************************************************************* 360 MythUICheckBoxSetting 361 ********************************************************************************/ 362 363 MythUICheckBoxSetting::MythUICheckBoxSetting(Storage *_storage): 364 StandardSetting(_storage) 365 { 366 } 367 368 bool MythUICheckBoxSetting::boolValue() 369 { 370 return settingValue=="1"; 371 } 372 373 374 void MythUICheckBoxSetting::setValue(bool value) 375 { 376 //Why does the polymorphism does not work here 377 StandardSetting::setValue(value?"1":"0"); 378 } 379 380 void MythUICheckBoxSetting::updateButton(MythUIButtonListItem *item) 381 { 382 item->SetText(label); 383 item->setCheckable (true); 384 if (settingValue=="1") 385 item->setChecked(MythUIButtonListItem::FullChecked); 386 else 387 item->setChecked(MythUIButtonListItem::NotChecked); 388 item->setDrawArrow(haveSubSettings()); 389 item->SetData(qVariantFromValue((StandardSetting*)this)); 390 391 } 392 393 bool MythUICheckBoxSetting::edit(MythScreenType * screen) 394 { 395 DialogCompletionEvent *dce = 396 new DialogCompletionEvent("editsetting", 0, "", ""); 397 QCoreApplication::postEvent(screen, dce); 398 return true; 399 400 } 401 402 void MythUICheckBoxSetting::resultEdit(DialogCompletionEvent *dce, 403 MythUIButtonListItem *item) 404 { 405 setValue(!boolValue()); 406 m_haveChanged=true; 407 updateButton(item); 408 } 409 410 /******************************************************************************* 411 Standard setting dialog 412 ********************************************************************************/ 413 414 StandardSettingDialog::StandardSettingDialog(MythScreenStack *parent, const char *name) : 415 MythScreenType(parent, name), 416 m_buttonList(0), 417 m_title(0), 418 m_groupHelp(0), 419 m_selectedSettingHelp(0), 420 m_menuPopup(0), 421 m_settingsTree(0), 422 m_currentGroupSetting(0) 423 { 424 } 425 426 StandardSettingDialog::~StandardSettingDialog() 427 { 428 LOG(VB_GENERAL, LOG_ERR, "StandardSettingDialog::~StandardSettingDialog()"); 429 if (m_settingsTree!=0) 430 m_settingsTree->deleteLater(); 431 } 432 433 bool StandardSettingDialog::Create(void) 434 { 435 if (!LoadWindowFromXML("standardsetting-ui.xml", "settingssetup", this)) 436 return false; 437 438 bool error=false; 439 UIUtilE::Assign(this, m_title, "title",&error); 440 UIUtilW::Assign(this, m_groupHelp, "grouphelp",&error); 441 UIUtilE::Assign(this, m_buttonList,"settingslist",&error); 442 443 UIUtilW::Assign(this, m_selectedSettingHelp, "selectedsettinghelp"); 444 445 connect(m_buttonList,SIGNAL(itemSelected(MythUIButtonListItem*)), 446 this,SLOT(settingSelected(MythUIButtonListItem*))); 447 connect(m_buttonList,SIGNAL(itemClicked(MythUIButtonListItem*)), 448 this,SLOT(settingClicked(MythUIButtonListItem*))); 449 450 if (error) 451 { 452 LOG(VB_GENERAL, LOG_ERR, "error."); 453 return false; 454 } 455 BuildFocusList(); 456 457 return true; 458 } 459 460 void StandardSettingDialog::settingSelected(MythUIButtonListItem *item) 461 { 462 if (!item)return; 463 464 StandardSetting * setting = qVariantValue<StandardSetting*>(item->GetData()); 465 if (setting) 466 { 467 if (m_selectedSettingHelp) 468 m_selectedSettingHelp->SetText(setting->getHelpText()); 469 } 470 } 471 472 void StandardSettingDialog::settingClicked(MythUIButtonListItem *item) 473 { 474 StandardSetting* setting = item->GetData().value<StandardSetting*>(); 475 if (setting) 476 { 477 setting->edit(this); 478 } 479 } 480 481 void StandardSettingDialog::customEvent(QEvent *event) 482 { 483 if (event->type() == DialogCompletionEvent::kEventType) 484 { 485 DialogCompletionEvent *dce = (DialogCompletionEvent*)(event); 486 QString resultid = dce->GetId(); 487 488 if (resultid == "leveldown") 489 { 490 //a GroupSetting have been clicked 491 LevelDown(); 492 } 493 else if (resultid == "editsetting") 494 { 495 MythUIButtonListItem * item = m_buttonList->GetItemCurrent(); 496 if (item) 497 { 498 StandardSetting * ss = item->GetData().value<StandardSetting*>(); 499 if (ss) 500 { 501 ss->resultEdit(dce, item); 502 ss->updateButton(item); 503 } 504 } 505 } 506 else if (resultid == "exit") 507 { 508 int buttonnum = dce->GetResult(); 509 if (buttonnum == 0) 510 { 511 Save(); 512 MythScreenType::Close(); 513 } 514 else if (buttonnum == 1) 515 MythScreenType::Close(); 516 } 517 } 518 } 519 520 void StandardSettingDialog::loadSettings(GroupSetting * groupSettings) 521 { 522 523 m_settingsTree=groupSettings; 524 if (m_settingsTree) 525 m_settingsTree->Load(); 526 527 setCurrentGroupSetting(m_settingsTree); 528 } 529 530 void StandardSettingDialog::setCurrentGroupSetting(StandardSetting * groupSettings, 531 StandardSetting * selectedSetting ) 532 { 533 if (!groupSettings) return; 534 535 m_currentGroupSetting=groupSettings; 536 m_buttonList->Reset(); 537 538 m_title->SetText(m_currentGroupSetting->getLabel()); 539 if (m_groupHelp) m_groupHelp->SetText(m_currentGroupSetting->getHelpText()); 540 if (!m_currentGroupSetting->haveSubSettings())return; 541 QList<StandardSetting *> * settings = m_currentGroupSetting->getSubSettings(); 542 if (settings==NULL ) return; 543 QList<StandardSetting *>::const_iterator i; 544 MythUIButtonListItem *selectedItem=0; 545 for (i = settings->constBegin(); i != settings->constEnd(); ++i) 546 { 547 if (selectedSetting == (*i)) 548 selectedItem =(*i)->createButton(m_buttonList); 549 else 550 (*i)->createButton(m_buttonList); 551 } 552 if (selectedItem) 553 m_buttonList->SetItemCurrent(selectedItem); 554 settingSelected(m_buttonList->GetItemCurrent()); 555 556 } 557 558 void StandardSettingDialog::Save() 559 { 560 if (m_settingsTree) 561 m_settingsTree->Save(); 562 } 563 564 void StandardSettingDialog::LevelUp() 565 { 566 if (!m_currentGroupSetting) return; 567 if (m_currentGroupSetting->getParent()) 568 { 569 setCurrentGroupSetting(m_currentGroupSetting->getParent(), 570 m_currentGroupSetting); 571 } 572 } 573 574 void StandardSettingDialog::LevelDown() 575 { 576 MythUIButtonListItem * item = m_buttonList->GetItemCurrent(); 577 if (item) 578 { 579 StandardSetting * ss = item->GetData().value<StandardSetting*>(); 580 if (ss && ss->haveSubSettings()) 581 setCurrentGroupSetting(ss); 582 } 583 } 584 585 void StandardSettingDialog::Close(void) 586 { 587 if (m_settingsTree->haveChanged()) 588 { 589 QString label = tr("Exit ?"); 590 591 MythScreenStack *popupStack = 592 GetMythMainWindow()->GetStack("popup stack"); 593 594 MythDialogBox * m_menuPopup = 595 new MythDialogBox(label, popupStack, "exitmenu"); 596 597 if (m_menuPopup->Create()) 598 popupStack->AddScreen(m_menuPopup); 599 600 m_menuPopup->SetReturnEvent(this, "exit"); 601 602 m_menuPopup->AddButton(tr("Save then Exit")); 603 m_menuPopup->AddButton(tr("Exit without saving changes")); 604 m_menuPopup->AddButton(tr("Cancel")); 605 } 606 else 607 MythScreenType::Close(); 608 } 609 610 611 bool StandardSettingDialog::keyPressEvent(QKeyEvent *e) 612 { 613 QStringList actions; 614 bool handled = m_buttonList->keyPressEvent(e); 615 if (handled) return true; 616 handled = GetMythMainWindow()->TranslateKeyPress("Global", e, actions); 617 618 for (int i = 0; i < actions.size() && !handled; i++) 619 { 620 QString action = actions[i]; 621 handled = true; 622 623 if (action == "LEFT") 624 { 625 LevelUp(); 626 } 627 else if (action == "RIGHT") 628 LevelDown(); 629 else 630 handled = MythScreenType::keyPressEvent(e); 631 } 632 633 return handled; 634 } 635 636 637 638 639 -
new file mythtv/programs/mythfrontend/standardsettings.h
diff --git a/mythtv/programs/mythfrontend/standardsettings.h b/mythtv/programs/mythfrontend/standardsettings.h new file mode 100755 index 0000000..83aaba3
- + 1 #ifndef STANDARDSETTINGS_H_ 2 #define STANDARDSETTINGS_H_ 3 4 #include "mythuibuttonlist.h" 5 #include <mythdialogbox.h> 6 #include <mythuibuttontree.h> 7 #include <mythgenerictree.h> 8 #include <QMap> 9 #include "settings.h" 10 11 #include "mythlogging.h" 12 13 class StandardSetting; 14 15 class MPUBLIC NewConfigurable : public QObject 16 { 17 Q_OBJECT 18 19 public: 20 MythUIButtonListItem * createButton(MythUIButtonList * list); 21 22 virtual void updateButton(MythUIButtonListItem *item)=0; 23 /* 24 virtual QWidget* configWidget(ConfigurationGroup *cg, QWidget* parent, 25 const char* widgetName = 0); 26 virtual void widgetInvalid(QObject*) { }*/ 27 28 // A name for looking up the setting 29 /*void setName(QString str) { 30 configName = str; 31 if (label == QString::null) 32 setLabel(str); 33 }; 34 QString getName(void) const { return configName; }; 35 virtual StandardSetting* byName(const QString &name) = 0;*/ 36 37 // A label displayed to the user 38 virtual void setLabel(QString str) { label = str; } 39 QString getLabel(void) const { return label; } 40 41 virtual void setHelpText(const QString &str) 42 { helptext = str; } 43 QString getHelpText(void) const { return helptext; } 44 45 /* void setVisible(bool b) { visible = b; }; 46 bool isVisible(void) const { return visible; }; 47 48 virtual void setEnabled(bool b) { enabled = b; } 49 bool isEnabled() { return enabled; }*/ 50 51 Storage *GetStorage(void) { return storage; } 52 53 public slots: 54 /*virtual void enableOnSet(const QString &val); 55 virtual void enableOnUnset(const QString &val); 56 virtual void widgetDeleted(QObject *obj);*/ 57 58 protected: 59 NewConfigurable(Storage *_storage) : 60 /*enabled(true), */storage(_storage), 61 /*configName(""), */label(""), helptext("")/*, visible(true)*/ { } 62 virtual ~NewConfigurable() { } 63 64 protected: 65 /*bool enabled;*/ 66 Storage *storage; 67 /*QString configName;*/ 68 QString label; 69 QString helptext; 70 /*bool visible;*/ 71 }; 72 73 //Copy of Setting class 74 class MPUBLIC StandardSetting : public NewConfigurable, public StorageUser 75 { 76 Q_OBJECT 77 78 public: 79 // Gets 80 virtual QString getValue(void) const 81 {return settingValue;} 82 83 virtual void updateButton(MythUIButtonListItem *item); 84 85 // non-const Gets 86 /*virtual StandardSetting *byName(const QString &name) 87 { return (name == configName) ? this : NULL; }*/ 88 89 // StorageUser 90 void SetDBValue(const QString &val) { setValue(val); } 91 QString GetDBValue(void) const { return getValue(); } 92 93 //added by xavier 94 //subsettings 95 void addChild(StandardSetting *child); 96 virtual QList<StandardSetting *> *getSubSettings(); 97 virtual bool haveSubSettings(); 98 99 StandardSetting * getParent(); 100 virtual bool edit(MythScreenType * screen)=0; 101 virtual void resultEdit(DialogCompletionEvent *dce, MythUIButtonListItem *item)=0; 102 //must be a better way 103 virtual void Load(void); 104 virtual void Save(void); 105 106 107 void addTargetedChild(const QString &value, StandardSetting * setting); 108 bool haveChanged(); 109 //added by xavier end 110 public slots: 111 virtual void setValue(const QString &newValue); 112 113 signals: 114 void valueChanged(const QString&); 115 116 protected: 117 StandardSetting(Storage *_storage); 118 virtual ~StandardSetting(); 119 120 protected: 121 void setParent(StandardSetting *parent); 122 QString settingValue; 123 void LoadChildren(void); 124 void SaveChildren(void); 125 bool m_haveChanged; 126 private: 127 //added by xavier 128 StandardSetting * m_parent; 129 130 QList<StandardSetting *> m_children; 131 QMap<QString, QList<StandardSetting *> > m_targets; 132 //added by xavier end 133 }; 134 135 Q_DECLARE_METATYPE(StandardSetting *); 136 137 138 /******************************************************************************* 139 * TextEdit Setting * 140 *******************************************************************************/ 141 142 143 class MPUBLIC MythUITextEditSetting : public StandardSetting 144 { 145 public: 146 virtual void resultEdit(DialogCompletionEvent *dce, MythUIButtonListItem *item); 147 virtual bool edit(MythScreenType * screen); 148 protected: 149 MythUITextEditSetting (Storage *_storage); 150 151 }; 152 153 154 class MPUBLIC TransTextEditSetting: public MythUITextEditSetting, public TransientStorage 155 { 156 public: 157 TransTextEditSetting() : 158 MythUITextEditSetting(this), TransientStorage() { } 159 160 //Don't want to have to do that but cannont think of a work around 161 virtual void Load(){MythUITextEditSetting::Load();} 162 virtual void Save(){MythUITextEditSetting::Save();} 163 }; 164 165 166 class MPUBLIC HostTextEditSetting: public MythUITextEditSetting, public HostDBStorage 167 { 168 public: 169 HostTextEditSetting(const QString &name) : 170 MythUITextEditSetting(this), HostDBStorage(this, name) { } 171 172 //Don't want to have to do that but cannont think of a work around 173 virtual void Load(){MythUITextEditSetting::Load();HostDBStorage::Load();} 174 virtual void Save(){MythUITextEditSetting::Save();HostDBStorage::Save();} 175 }; 176 177 178 /******************************************************************************* 179 * ComboBox Setting * 180 *******************************************************************************/ 181 182 class MPUBLIC MythUIComboBoxSetting : public StandardSetting 183 { 184 public: 185 void setValue(int value); 186 virtual void resultEdit(DialogCompletionEvent *dce, MythUIButtonListItem *item); 187 virtual bool edit(MythScreenType * screen); 188 void addSelection(const QString &label, QString value = QString::null, bool select = false); 189 virtual void updateButton(MythUIButtonListItem *item); 190 protected: 191 MythUIComboBoxSetting (Storage *_storage); 192 ~MythUIComboBoxSetting(); 193 private: 194 QVector<QString> m_labels; 195 QVector<QString> m_values; 196 bool m_isSet; 197 198 }; 199 200 class MPUBLIC HostComboBoxSetting: public MythUIComboBoxSetting, public HostDBStorage 201 { 202 public: 203 HostComboBoxSetting(const QString &name) : 204 MythUIComboBoxSetting(this), HostDBStorage(this, name) { } 205 206 //Don't want to have to do that but cannot think of a work around 207 virtual void Load(){MythUIComboBoxSetting::Load();HostDBStorage::Load();} 208 virtual void Save(){MythUIComboBoxSetting::Save();HostDBStorage::Save();} 209 }; 210 211 212 class MPUBLIC GlobalComboBoxSetting: public MythUIComboBoxSetting, public GlobalDBStorage 213 { 214 public: 215 GlobalComboBoxSetting(const QString &name) : 216 MythUIComboBoxSetting(this), GlobalDBStorage(this, name) { } 217 218 //Don't want to have to do that but cannot think of a work around 219 virtual void Load(){MythUIComboBoxSetting::Load();GlobalDBStorage::Load();} 220 virtual void Save(){MythUIComboBoxSetting::Save();GlobalDBStorage::Save();} 221 }; 222 223 /******************************************************************************* 224 * SpinBox Setting * 225 *******************************************************************************/ 226 227 228 class MPUBLIC MythUISpinBoxSetting : public StandardSetting 229 { 230 public: 231 void setValue(int value); 232 int intValue(); 233 virtual void resultEdit(DialogCompletionEvent *dce, MythUIButtonListItem *item); 234 virtual bool edit(MythScreenType * screen); 235 protected: 236 MythUISpinBoxSetting (Storage *_storage, int min, int max, int step, bool allow_single_step); 237 private: 238 int m_min; 239 int m_max; 240 int m_step; 241 bool m_allow_single_step; 242 243 }; 244 245 class MPUBLIC TransMythUISpinBoxSetting: public MythUISpinBoxSetting, public TransientStorage 246 { 247 public: 248 TransMythUISpinBoxSetting(int min, int max, int step, bool allow_single_step=false) : 249 MythUISpinBoxSetting(this, min, max, step, allow_single_step), TransientStorage() { } 250 251 //Don't want to have to do that but cannont think of a work around 252 virtual void Load(){MythUISpinBoxSetting::Load();} 253 virtual void Save(){MythUISpinBoxSetting::Save();} 254 }; 255 256 class MPUBLIC HostSpinBoxSetting: public MythUISpinBoxSetting, public HostDBStorage 257 { 258 public: 259 HostSpinBoxSetting(const QString &name, int min, int max, int step, bool allow_single_step=false) : 260 MythUISpinBoxSetting(this, min, max, step, allow_single_step), HostDBStorage(this, name) { } 261 262 //Don't want to have to do that but cannont think of a work around 263 virtual void Load(){MythUISpinBoxSetting::Load();HostDBStorage::Load();} 264 virtual void Save(){MythUISpinBoxSetting::Save();HostDBStorage::Save();} 265 }; 266 267 class MPUBLIC GlobalSpinBoxSetting: public MythUISpinBoxSetting, public GlobalDBStorage 268 { 269 public: 270 GlobalSpinBoxSetting(const QString &name, int min, int max, int step, bool allow_single_step=false) : 271 MythUISpinBoxSetting(this, min, max, step, allow_single_step), GlobalDBStorage(this, name) { } 272 273 //Don't want to have to do that but cannont think of a work around 274 virtual void Load(){MythUISpinBoxSetting::Load();GlobalDBStorage::Load();} 275 virtual void Save(){MythUISpinBoxSetting::Save();GlobalDBStorage::Save();} 276 }; 277 278 /******************************************************************************* 279 * CheckBox Setting * 280 *******************************************************************************/ 281 282 class MPUBLIC MythUICheckBoxSetting : public StandardSetting 283 { 284 public: 285 virtual void resultEdit(DialogCompletionEvent *dce, MythUIButtonListItem *item); 286 virtual bool edit(MythScreenType * screen); 287 virtual void updateButton(MythUIButtonListItem *item); 288 void setValue(bool value); 289 bool boolValue(); 290 protected: 291 MythUICheckBoxSetting (Storage *_storage); 292 293 }; 294 295 class MPUBLIC TransMythUICheckBoxSetting: public MythUICheckBoxSetting, public TransientStorage 296 { 297 public: 298 TransMythUICheckBoxSetting() : 299 MythUICheckBoxSetting(this), TransientStorage() { } 300 //Don't want to have to do that but cannont think of a work around 301 /*virtual void Load(){MythUICheckBoxSetting::Load();HostDBStorage::Load();} 302 virtual void Save(){MythUICheckBoxSetting::Save();HostDBStorage::Save();}*/ 303 }; 304 305 class MPUBLIC HostCheckBoxSetting: public MythUICheckBoxSetting, public HostDBStorage 306 { 307 public: 308 HostCheckBoxSetting(const QString &name, bool rw = true) : 309 MythUICheckBoxSetting(this), HostDBStorage(this, name) { } 310 //Don't want to have to do that but cannont think of a work around 311 virtual void Load(){MythUICheckBoxSetting::Load();HostDBStorage::Load();} 312 virtual void Save(){MythUICheckBoxSetting::Save();HostDBStorage::Save();} 313 }; 314 315 class MPUBLIC GlobalCheckBoxSetting: public MythUICheckBoxSetting, public GlobalDBStorage 316 { 317 public: 318 GlobalCheckBoxSetting(const QString &name, bool rw = true) : 319 MythUICheckBoxSetting(this), GlobalDBStorage(this, name) { } 320 //Don't want to have to do that but cannont think of a work around 321 virtual void Load(){MythUICheckBoxSetting::Load();GlobalDBStorage::Load();} 322 virtual void Save(){MythUICheckBoxSetting::Save();GlobalDBStorage::Save();} 323 }; 324 325 /******************************************************************************* 326 * Group Setting * 327 *******************************************************************************/ 328 329 class GroupSetting : public StandardSetting, public TransientStorage 330 { 331 public: 332 GroupSetting();/*:StandardSetting(this), NoStorage(){};*/ 333 334 virtual void Load(void){StandardSetting::Load();}; 335 virtual void Save(void){StandardSetting::Save();}; 336 virtual bool edit(MythScreenType * screen); 337 virtual void resultEdit(DialogCompletionEvent *dce, MythUIButtonListItem *item){}; 338 }; 339 340 /******************************************************************************* 341 * Standard Dialog Setting * 342 *******************************************************************************/ 343 344 class StandardSettingDialog : public MythScreenType 345 { 346 Q_OBJECT 347 348 public: 349 350 StandardSettingDialog(MythScreenStack *parent, const char *name); 351 virtual ~StandardSettingDialog(); 352 bool Create(void); 353 void loadSettings(GroupSetting * groupSettings); 354 virtual void customEvent(QEvent *event); 355 virtual bool keyPressEvent(QKeyEvent *); 356 public slots: 357 void Close(void); 358 protected: 359 360 MythUIButtonList *m_buttonList; 361 private slots: 362 void settingSelected(MythUIButtonListItem *item); 363 void settingClicked(MythUIButtonListItem *item); 364 private: 365 void LevelUp(); 366 void LevelDown(); 367 void setCurrentGroupSetting(StandardSetting * groupSettings,StandardSetting * selectedSetting=0); 368 void Save(); 369 MythUIText *m_title; 370 MythUIText *m_groupHelp; 371 MythUIText *m_selectedSettingHelp; 372 MythDialogBox *m_menuPopup; 373 GroupSetting *m_settingsTree; 374 StandardSetting *m_currentGroupSetting; 375 bool m_loaded; 376 }; 377 378 379 380 #endif -
mythtv/programs/mythfrontend/videoglobalsettings.cpp
diff --git a/mythtv/programs/mythfrontend/videoglobalsettings.cpp b/mythtv/programs/mythfrontend/videoglobalsettings.cpp index 0365bfc..55bd18d 100644
a b 9 9 #include "videodlg.h" 10 10 #include "videoglobalsettings.h" 11 11 12 #include "mythlogging.h" 13 12 14 namespace 13 15 { 14 16 // General Settings 15 HostComboBox *VideoDefaultParentalLevel()17 HostComboBoxSetting *VideoDefaultParentalLevel() 16 18 { 17 HostComboBox *gc = new HostComboBox("VideoDefaultParentalLevel");19 HostComboBoxSetting *gc = new HostComboBoxSetting("VideoDefaultParentalLevel"); 18 20 gc->setLabel(QObject::tr("Starting Parental Level")); 19 21 gc->addSelection(QObject::tr("4 - Highest"), 20 22 QString::number(ParentalLevel::plHigh)); … … const char *password_clue = 33 35 QT_TRANSLATE_NOOP("QObject", "Setting this value to all numbers will make your life " 34 36 "much easier."); 35 37 36 Host LineEdit*VideoAdminPassword()38 HostTextEditSetting *VideoAdminPassword() 37 39 { 38 Host LineEdit *gc = new HostLineEdit("VideoAdminPassword");40 HostTextEditSetting *gc = new HostTextEditSetting("VideoAdminPassword"); 39 41 gc->setLabel(QObject::tr("Parental Level 4 PIN")); 40 42 gc->setHelpText(QString("%1 %2") 41 43 .arg(QObject::tr("This PIN is used to enter Parental Control " … … HostLineEdit *VideoAdminPassword() 44 46 return gc; 45 47 } 46 48 47 Host LineEdit*VideoAdminPasswordThree()49 HostTextEditSetting *VideoAdminPasswordThree() 48 50 { 49 Host LineEdit *gc = new HostLineEdit("VideoAdminPasswordThree");51 HostTextEditSetting *gc = new HostTextEditSetting("VideoAdminPasswordThree"); 50 52 gc->setLabel(QObject::tr("Parental Level 3 PIN")); 51 53 gc->setHelpText(QString("%1 %2") 52 54 .arg(QObject::tr("This PIN is used to enter Parental Control Level 3.")) … … HostLineEdit *VideoAdminPasswordThree() 54 56 return gc; 55 57 } 56 58 57 Host LineEdit*VideoAdminPasswordTwo()59 HostTextEditSetting *VideoAdminPasswordTwo() 58 60 { 59 Host LineEdit *gc = new HostLineEdit("VideoAdminPasswordTwo");61 HostTextEditSetting *gc = new HostTextEditSetting("VideoAdminPasswordTwo"); 60 62 gc->setLabel(QObject::tr("Parental Level 2 PIN")); 61 63 gc->setHelpText(QString("%1 %2") 62 64 .arg(QObject::tr("This PIN is used to enter Parental Control Level 2.")) … … HostLineEdit *VideoAdminPasswordTwo() 64 66 return gc; 65 67 } 66 68 67 HostCheckBox *VideoAggressivePC()69 HostCheckBoxSetting *VideoAggressivePC() 68 70 { 69 HostCheckBox *gc = new HostCheckBox("VideoAggressivePC");71 HostCheckBoxSetting *gc = new HostCheckBoxSetting("VideoAggressivePC"); 70 72 gc->setLabel(QObject::tr("Aggressive Parental Control")); 71 73 gc->setValue(false); 72 74 gc->setHelpText(QObject::tr("If set, you will not be able to return " … … HostCheckBox *VideoAggressivePC() 76 78 return gc; 77 79 } 78 80 79 Host LineEdit*VideoStartupDirectory()81 HostTextEditSetting *VideoStartupDirectory() 80 82 { 81 Host LineEdit *gc = new HostLineEdit("VideoStartupDir");83 HostTextEditSetting *gc = new HostTextEditSetting("VideoStartupDir"); 82 84 gc->setLabel(QObject::tr("Directories that hold videos")); 83 85 gc->setValue(DEFAULT_VIDEOSTARTUP_DIR); 84 86 gc->setHelpText(QObject::tr("Multiple directories can be separated by ':'. " … … HostLineEdit *VideoStartupDirectory() 87 89 return gc; 88 90 } 89 91 90 Host LineEdit*VideoArtworkDirectory()92 HostTextEditSetting *VideoArtworkDirectory() 91 93 { 92 Host LineEdit *gc = new HostLineEdit("VideoArtworkDir");94 HostTextEditSetting *gc = new HostTextEditSetting("VideoArtworkDir"); 93 95 gc->setLabel(QObject::tr("Directory that holds movie posters")); 94 96 gc->setValue(GetConfDir() + "/Video/Artwork"); 95 97 gc->setHelpText(QObject::tr("This directory must exist, and the user " … … HostLineEdit *VideoArtworkDirectory() 98 100 return gc; 99 101 } 100 102 101 Host LineEdit*VideoScreenshotDirectory()103 HostTextEditSetting *VideoScreenshotDirectory() 102 104 { 103 Host LineEdit *gc = new HostLineEdit("mythvideo.screenshotDir");105 HostTextEditSetting *gc = new HostTextEditSetting("mythvideo.screenshotDir"); 104 106 gc->setLabel(QObject::tr("Directory that holds movie screenshots")); 105 107 gc->setValue(GetConfDir() + "/Video/Screenshots"); 106 108 gc->setHelpText(QObject::tr("This directory must exist, and the user " … … HostLineEdit *VideoScreenshotDirectory() 109 111 return gc; 110 112 } 111 113 112 Host LineEdit*VideoBannerDirectory()114 HostTextEditSetting *VideoBannerDirectory() 113 115 { 114 Host LineEdit *gc = new HostLineEdit("mythvideo.bannerDir");116 HostTextEditSetting *gc = new HostTextEditSetting("mythvideo.bannerDir"); 115 117 gc->setLabel(QObject::tr("Directory that holds movie/TV Banners")); 116 118 gc->setValue(GetConfDir() + "/Video/Banners"); 117 119 gc->setHelpText(QObject::tr("This directory must exist, and the user " … … HostLineEdit *VideoBannerDirectory() 120 122 return gc; 121 123 } 122 124 123 Host LineEdit*VideoFanartDirectory()125 HostTextEditSetting *VideoFanartDirectory() 124 126 { 125 Host LineEdit *gc = new HostLineEdit("mythvideo.fanartDir");127 HostTextEditSetting *gc = new HostTextEditSetting("mythvideo.fanartDir"); 126 128 gc->setLabel(QObject::tr("Directory that holds movie fanart")); 127 129 gc->setValue(GetConfDir() + "/Video/Fanart"); 128 130 gc->setHelpText(QObject::tr("This directory must exist, and the user " … … HostLineEdit *VideoFanartDirectory() 131 133 return gc; 132 134 } 133 135 134 Host LineEdit*TrailerDirectory()136 HostTextEditSetting *TrailerDirectory() 135 137 { 136 Host LineEdit *gc = new HostLineEdit("mythvideo.TrailersDir");138 HostTextEditSetting *gc = new HostTextEditSetting("mythvideo.TrailersDir"); 137 139 gc->setLabel(QObject::tr("Directory that holds movie trailers")); 138 140 gc->setValue(GetConfDir() + "/Video/Trailers"); 139 141 gc->setHelpText(QObject::tr("This directory must exist, and the user " … … HostLineEdit *TrailerDirectory() 148 150 149 151 // General Settings 150 152 151 HostComboBox *SetOnInsertDVD()153 HostComboBoxSetting *SetOnInsertDVD() 152 154 { 153 HostComboBox *gc = new HostComboBox("DVDOnInsertDVD");155 HostComboBoxSetting *gc = new HostComboBoxSetting("DVDOnInsertDVD"); 154 156 gc->setLabel(QObject::tr("On DVD insertion")); 155 157 gc->addSelection(QObject::tr("Display mythdvd menu"),"1"); 156 158 gc->addSelection(QObject::tr("Do nothing"),"0"); … … HostComboBox *SetOnInsertDVD() 160 162 return gc; 161 163 } 162 164 163 HostCheckBox *VideoTreeRemember()165 HostCheckBoxSetting *VideoTreeRemember() 164 166 { 165 HostCheckBox *gc = new HostCheckBox("mythvideo.VideoTreeRemember");167 HostCheckBoxSetting *gc = new HostCheckBoxSetting("mythvideo.VideoTreeRemember"); 166 168 gc->setLabel(QObject::tr("Video Tree remembers last selected position")); 167 169 gc->setValue(false); 168 170 gc->setHelpText(QObject::tr("If set, the current position in the Video " … … HostCheckBox *VideoTreeRemember() 170 172 return gc; 171 173 } 172 174 173 struct ConfigPage174 {175 typedef std::vector<ConfigurationGroup *> PageList;176 177 protected:178 ConfigPage(PageList &pl) : m_pl(pl)179 {180 }181 182 void Add(ConfigurationGroup *page)183 {184 m_pl.push_back(page);185 }186 187 private:188 ConfigPage(const ConfigPage &);189 ConfigPage &operator=(const ConfigPage &);190 191 private:192 PageList &m_pl;193 };194 195 struct VConfigPage : public ConfigPage196 {197 VConfigPage(PageList &pl, bool luselabel = true, bool luseframe = true,198 bool lzeroMargin = false, bool lzeroSpace = false) :199 ConfigPage(pl)200 {201 m_vc_page = new VerticalConfigurationGroup(luselabel, luseframe,202 lzeroMargin, lzeroSpace);203 Add(m_vc_page);204 }205 175 206 VerticalConfigurationGroup *operator->()207 {208 return m_vc_page;209 }210 176 211 private:212 VerticalConfigurationGroup *m_vc_page;213 };214 177 215 class RatingsToPL : public TriggeredConfigurationGroup 178 HostCheckBoxSetting *RatingsToPL() 216 179 { 217 public: 218 RatingsToPL() : TriggeredConfigurationGroup(false) 180 HostCheckBoxSetting *r2pl = 181 new HostCheckBoxSetting("mythvideo.ParentalLevelFromRating"); 182 r2pl->setLabel(QObject::tr("Enable automatic Parental Level from " 183 "rating")); 184 r2pl->setValue(false); 185 r2pl->setHelpText(QObject::tr("If enabled, searches will automatically " 186 "set the Parental Level to the one " 187 "matching the rating below.")); 188 189 typedef std::map<ParentalLevel::Level, QString> r2pl_map; 190 r2pl_map r2pl_defaults; 191 r2pl_defaults.insert(r2pl_map::value_type(ParentalLevel::plLowest, 192 QObject::tr("G", "PL 1 default search string."))); 193 r2pl_defaults.insert(r2pl_map::value_type(ParentalLevel::plLow, 194 QObject::tr("PG", "PL 2 default search string."))); 195 r2pl_defaults.insert(r2pl_map::value_type(ParentalLevel::plMedium, 196 QObject::tr("PG-13", "PL3 default search string."))); 197 r2pl_defaults.insert(r2pl_map::value_type(ParentalLevel::plHigh, 198 QObject::tr("R:NC-17", "PL4 default search string."))); 199 200 for (ParentalLevel pl(ParentalLevel::plLowest); 201 pl.GetLevel() <= ParentalLevel::plHigh && pl.good(); ++pl) 219 202 { 220 HostCheckBox *r2pl = 221 new HostCheckBox("mythvideo.ParentalLevelFromRating"); 222 r2pl->setLabel(QObject::tr("Enable automatic Parental Level from " 223 "rating")); 224 r2pl->setValue(false); 225 r2pl->setHelpText(QObject::tr("If enabled, searches will automatically " 226 "set the Parental Level to the one " 227 "matching the rating below.")); 228 addChild(r2pl); 229 setTrigger(r2pl); 230 231 typedef std::map<ParentalLevel::Level, QString> r2pl_map; 232 r2pl_map r2pl_defaults; 233 r2pl_defaults.insert(r2pl_map::value_type(ParentalLevel::plLowest, 234 tr("G", "PL 1 default search string."))); 235 r2pl_defaults.insert(r2pl_map::value_type(ParentalLevel::plLow, 236 tr("PG", "PL 2 default search string."))); 237 r2pl_defaults.insert(r2pl_map::value_type(ParentalLevel::plMedium, 238 tr("PG-13", "PL3 default search string."))); 239 r2pl_defaults.insert(r2pl_map::value_type(ParentalLevel::plHigh, 240 tr("R:NC-17", "PL4 default search string."))); 241 242 VerticalConfigurationGroup *vcg = new VerticalConfigurationGroup(true); 243 244 for (ParentalLevel pl(ParentalLevel::plLowest); 245 pl.GetLevel() <= ParentalLevel::plHigh && pl.good(); ++pl) 203 HostTextEditSetting *hle = new HostTextEditSetting(QString("mythvideo.AutoR2PL%1") 204 .arg(pl.GetLevel())); 205 hle->setLabel(QObject::tr("Level %1").arg(pl.GetLevel())); 206 hle->setHelpText(QObject::tr("Ratings containing these strings " 207 "(separated by :) will be assigned " 208 "to Parental Level %1.") 209 .arg(pl.GetLevel())); 210 211 r2pl_map::const_iterator def_setting = 212 r2pl_defaults.find(pl.GetLevel()); 213 if (def_setting != r2pl_defaults.end()) 246 214 { 247 HostLineEdit *hle = new HostLineEdit(QString("mythvideo.AutoR2PL%1") 248 .arg(pl.GetLevel())); 249 hle->setLabel(QObject::tr("Level %1").arg(pl.GetLevel())); 250 hle->setHelpText(QObject::tr("Ratings containing these strings " 251 "(separated by :) will be assigned " 252 "to Parental Level %1.") 253 .arg(pl.GetLevel())); 254 255 r2pl_map::const_iterator def_setting = 256 r2pl_defaults.find(pl.GetLevel()); 257 if (def_setting != r2pl_defaults.end()) 258 { 259 hle->setValue(def_setting->second); 260 } 261 262 vcg->addChild(hle); 215 hle->setValue(def_setting->second); 263 216 } 264 217 265 addTarget("0", new VerticalConfigurationGroup(true)); 266 addTarget("1", vcg); 218 r2pl->addTargetedChild("1", hle); 267 219 } 268 };269 220 270 } // namespace 221 return r2pl; 222 } 223 224 } 271 225 272 226 VideoGeneralSettings::VideoGeneralSettings() 227 :GroupSetting() 273 228 { 274 ConfigPage::PageList pages;275 276 VConfigPage page1(pages, false);277 page1->addChild(VideoStartupDirectory());278 page1->addChild(TrailerDirectory()); 279 page1->addChild(VideoArtworkDirectory());280 page1->addChild(VideoScreenshotDirectory());281 page1->addChild(VideoBannerDirectory());282 page1->addChild(VideoFanartDirectory());283 284 VConfigPage page2(pages, false);285 page2->addChild(SetOnInsertDVD()); 286 page2->addChild(VideoTreeRemember());287 288 // page 3 289 VerticalConfigurationGroup*pctrl =290 new VerticalConfigurationGroup(true, false);229 setLabel(QObject::tr("General settings")); 230 231 setHelpText(QObject::tr("TODO add a descrition for this group of settings")); 232 233 234 addChild(VideoStartupDirectory()); 235 addChild(TrailerDirectory()); 236 addChild(VideoArtworkDirectory()); 237 addChild(VideoScreenshotDirectory()); 238 addChild(VideoBannerDirectory()); 239 addChild(VideoFanartDirectory()); 240 241 addChild(SetOnInsertDVD()); 242 addChild(VideoTreeRemember()); 243 244 GroupSetting *pctrl = 245 new GroupSetting(); 291 246 pctrl->setLabel(QObject::tr("Parental Control Settings")); 247 248 pctrl->setHelpText(QObject::tr("TODO add a description for this group of setting")); 292 249 pctrl->addChild(VideoDefaultParentalLevel()); 293 250 pctrl->addChild(VideoAdminPassword()); 294 251 pctrl->addChild(VideoAdminPasswordThree()); 295 252 pctrl->addChild(VideoAdminPasswordTwo()); 296 253 pctrl->addChild(VideoAggressivePC()); 297 VConfigPage page3(pages, false);298 page3->addChild(pctrl);299 254 300 VConfigPage page4(pages, false); 301 page4->addChild(new RatingsToPL()); 255 addChild(pctrl); 256 257 addChild(RatingsToPL()); 302 258 303 int page_num = 1;304 for (ConfigPage::PageList::const_iterator p = pages.begin();305 p != pages.end(); ++p, ++page_num)306 {307 (*p)->setLabel(QObject::tr("General Settings (%1/%2)").arg(page_num)308 .arg(pages.size()));309 addChild(*p);310 }311 259 } 260 -
mythtv/programs/mythfrontend/videoglobalsettings.h
diff --git a/mythtv/programs/mythfrontend/videoglobalsettings.h b/mythtv/programs/mythfrontend/videoglobalsettings.h index 9f621e6..de155db 100644
a b 3 3 4 4 #include "settings.h" 5 5 6 class VideoGeneralSettings : public ConfigurationWizard 6 #include "standardsettings.h" 7 8 class VideoGeneralSettings : public GroupSetting 7 9 { 8 10 public: 9 11 VideoGeneralSettings(); -
new file mythtv/themes/default-wide/standardsetting-ui.xml
diff --git a/mythtv/themes/default-wide/standardsetting-ui.xml b/mythtv/themes/default-wide/standardsetting-ui.xml new file mode 100644 index 0000000..f683cfe
- + 1 <?xml version="1.0" encoding="utf-8"?> 2 <!DOCTYPE mythuitheme SYSTEM "http://www.mythtv.org/schema/mythuitheme.dtd"> 3 4 <!-- theme.xml for the MythCenter theme - by Jeroen Brosens --> 5 <mythuitheme> 6 <window name="settingssetup"> 7 8 <textarea name="title" from="basetextarea"> 9 <area>30,15,100%-30,30</area> 10 <font>baselarge</font> 11 <align>hcenter</align> 12 </textarea> 13 14 <shape name="GroupHelpBackground"> 15 <area>15,80,100%-15,80</area> 16 <type>roundbox</type> 17 <cornerradius>10</cornerradius> 18 <fill color="#FFFFFF" alpha="30" /> 19 </shape> 20 21 <!-- optionnal, display the help for the current group of settings --> 22 <textarea name="grouphelp" from="basetextarea"> 23 <area>30,90-120,100%-30,60</area> 24 <font>basesmall</font> 25 <align>lefthcenter</align> 26 <multiline>yes</multiline> 27 </textarea> 28 29 <buttonlist name="settingslist" from="basebuttonlist"> 30 <area>100,200,100%-100,100%-160</area> 31 <layout>vertical</layout> 32 <spacing>4</spacing> 33 <wrapstyle>selection</wrapstyle> 34 <statetype name="buttonitem"> 35 <area>0,0,100%,25</area> 36 <state name="active"> 37 <area>0,0,100%,30</area> 38 <shape name="buttonbackground"> 39 <area>0,0,100%,100%</area> 40 <fill style="gradient"> 41 <gradient start="#505050" end="#000000" alpha="200" direction="vertical" /> 42 </fill> 43 </shape> 44 <textarea name="buttontext"> 45 <area>5,0,50%-10,30</area> 46 <font>basesmall</font> 47 <cutdown>yes</cutdown> 48 <align>left,vcenter</align> 49 </textarea> 50 <textarea name="value"> 51 <area>50%+5,0,100%-40,30</area> 52 <font>basesmall</font> 53 <cutdown>yes</cutdown> 54 <align>right,vcenter</align> 55 </textarea> 56 <imagetype name="buttonarrow"> 57 <position>100%-23,7</position> 58 <filename>lb-arrow.png</filename> 59 </imagetype> 60 </state> 61 <state name="selectedactive" from="active"> 62 <shape name="buttonbackground"> 63 <fill style="gradient"> 64 <gradient start="#52CA38" end="#349838" alpha="255" /> 65 </fill> 66 </shape> 67 </state> 68 <state name="selectedinactive" from="active"> 69 </state> 70 </statetype> 71 </buttonlist> 72 73 <shape name="HelpBackground"> 74 <!--area>15,600,100%-30,100</area--> 75 <area>15,100%-140,100%-15,80</area> 76 <type>roundbox</type> 77 <cornerradius>10</cornerradius> 78 <fill color="#000000" alpha="30" /> 79 </shape> 80 81 <!-- optionnal, display the help for the currently selected setting --> 82 <textarea name="selectedsettinghelp" from="basetextarea"> 83 <area>30,100%-120,100%-30,60</area> 84 <font>basesmall</font> 85 <multiline>yes</multiline> 86 </textarea> 87 </window> 88 </mythuitheme>
