Ticket #2594: multiselect_mythtv_r12743.patch
File multiselect_mythtv_r12743.patch, 52.3 KB (added by , 17 years ago) |
---|
-
libs/libmythtv/channeleditor.cpp
251 251 src->addChild(source); 252 252 src->addChild(del); 253 253 254 sort->set Value(sort->getValueIndex(list->getSortMode()));255 source->set Value(source->getValueIndex(list->getSourceID()));254 sort->setCurrentValue(list->getSortMode()); 255 source->setCurrentValue(list->getSourceID()); 256 256 hide->setValue(list->getHideMode()); 257 257 258 258 addChild(sort); -
libs/libmythtv/playgroup.cpp
254 254 255 255 void PlayGroupEditor::doDelete(void) 256 256 { 257 QString name = listbox->getValue(); 257 QString name = listbox->getSelectionValues().first(); 258 258 259 if (name.isEmpty() || name == "Default") 259 260 return; 260 261 … … 274 275 if (!query.exec()) 275 276 MythContext::DBError("PlayGroupEditor::doDelete", query); 276 277 277 int lastIndex = listbox->get ValueIndex(name);278 int lastIndex = listbox->getSelectionIndices().first(); 278 279 lastValue = ""; 279 280 load(); 280 listbox->set Value(lastIndex);281 listbox->setCurrent(lastIndex); 281 282 } 282 283 283 284 listbox->setFocus(); … … 298 299 299 300 listbox->addSelection(tr("(Create new group)"), ""); 300 301 301 listbox->set Value(lastValue);302 listbox->setCurrentValue(lastValue); 302 303 } 303 304 304 305 int PlayGroupEditor::exec(void) -
libs/libmythtv/scanwizardhelpers.h
763 763 764 764 void SetDefaultATSCFormat(const QString &d) 765 765 { 766 int val = atsc_format->getValueIndex(d); 767 atsc_format->setValue(val); 766 atsc_format->setCurrentValue(d); 768 767 } 769 768 770 769 protected: … … 821 820 822 821 void SetDefaultATSCFormat(const QString &d) 823 822 { 824 int val = atsc_format->getValueIndex(d); 825 atsc_format->setValue(val); 823 atsc_format->setCurrentValue(d); 826 824 } 827 825 828 826 void SetSourceID(uint sourceid) … … 868 866 869 867 void SetDefaultATSCFormat(const QString &d) 870 868 { 871 int val = atsc_format->getValueIndex(d); 872 atsc_format->setValue(val); 869 atsc_format->setCurrentValue(d); 873 870 } 874 871 875 872 private: -
libs/libmythtv/storagegroup.cpp
434 434 if (!query.exec()) 435 435 MythContext::DBError("StorageGroupEditor::doDelete", query); 436 436 437 int lastIndex = listbox->get ValueIndex(name);437 int lastIndex = listbox->getSelectionIndices().first(); 438 438 lastValue = ""; 439 439 load(); 440 listbox->set Value(lastIndex);440 listbox->setCurrent(lastIndex); 441 441 } 442 442 443 443 listbox->setFocus(); … … 470 470 471 471 listbox->addSelection(tr("(Add New Directory)"), ""); 472 472 473 listbox->set Value(lastValue);473 listbox->setCurrentValue(lastValue); 474 474 } 475 475 476 476 int StorageGroupEditor::exec() { … … 561 561 if (!query.exec()) 562 562 MythContext::DBError("StorageGroupListEditor::doDelete", query); 563 563 564 int lastIndex = listbox->get ValueIndex(name);564 int lastIndex = listbox->getSelectionIndices().first(); 565 565 lastValue = ""; 566 566 load(); 567 listbox->set Value(lastIndex);567 listbox->setCurrent(lastIndex); 568 568 } 569 569 570 570 listbox->setFocus(); … … 657 657 } 658 658 } 659 659 660 listbox->set Value(lastValue);660 listbox->setCurrentValue(lastValue); 661 661 } 662 662 663 663 int StorageGroupListEditor::exec() { -
libs/libmythtv/videosource.cpp
101 101 102 102 if (initial_sourceid) 103 103 { 104 if (cnt) 105 setValue(sel); 104 setCurrent(sel); 106 105 setEnabled(false); 107 106 } 108 107 } … … 199 198 200 199 void TransFreqTableSelector::load(void) 201 200 { 202 int idx = getValueIndex(gContext->GetSetting("FreqTable")); 203 if (idx >= 0) 204 setValue(idx); 201 setCurrentValue(gContext->GetSetting("FreqTable")); 205 202 206 203 if (!sourceid) 207 204 return; … … 227 224 if (!loaded_freq_table.isEmpty() && 228 225 (loaded_freq_table.lower() != "default")) 229 226 { 230 int idx = getValueIndex(loaded_freq_table); 231 if (idx >= 0) 232 setValue(idx); 227 setCurrentValue(loaded_freq_table); 233 228 } 234 229 } 235 230 } … … 997 992 998 993 #ifdef USING_FIREWIRE 999 994 AVCInfo info = guid->GetAVCInfo(_guid); 1000 QString model = FirewireDevice::GetModelName(info.vendorid, info.modelid); 1001 setValue(max(getValueIndex(model), 0)); 995 setCurrentValue(FirewireDevice::GetModelName(info.vendorid, info.modelid)); 1002 996 #endif // USING_FIREWIRE 1003 997 } 1004 998 … … 1849 1843 1850 1844 QString CardInput::getSourceName(void) const 1851 1845 { 1852 return sourceid->getSelectionLabel ();1846 return sourceid->getSelectionLabels().first(); 1853 1847 } 1854 1848 1855 1849 void CardInput::SetChildCardID(uint ccid) … … 1974 1968 else 1975 1969 { // create new input connection 1976 1970 load(); 1977 cardid->set Value(QString::number(_cardid));1971 cardid->setCurrentLabel(QString::number(_cardid)); 1978 1972 inputname->setValue(_inputname); 1979 1973 } 1980 1974 } -
libs/libmythtv/diseqcsettings.cpp
55 55 56 56 virtual void load(void) 57 57 { 58 QString tmp = QString::number((uint) m_device.GetDeviceType()); 59 setValue(getValueIndex(tmp)); 58 setCurrentValue(QString::number((uint) m_device.GetDeviceType())); 60 59 } 61 60 62 61 virtual void save(void) … … 163 162 164 163 virtual void load(void) 165 164 { 166 set Value(getValueIndex(QString::number((uint) m_switch.GetType())));165 setCurrentValue(QString::number((uint) m_switch.GetType())); 167 166 } 168 167 169 168 virtual void save(void) … … 266 265 267 266 virtual void load(void) 268 267 { 269 set Value(getValueIndex(QString::number((uint)m_rotor.GetType())));268 setCurrentValue(QString::number((uint)m_rotor.GetType())); 270 269 } 271 270 272 271 virtual void save(void) … … 434 433 435 434 void RotorPosMap::PopulateList(void) 436 435 { 437 int old_sel = get ValueIndex(getValue());436 int old_sel = getSelectionIndices().first(); 438 437 clearSelections(); 439 438 uint num_pos = 64; 440 439 for (uint pos = 1; pos < num_pos; pos++) … … 447 446 addSelection(DeviceTree::tr("Position #%1 (%2)").arg(pos).arg(posval), 448 447 QString::number(pos)); 449 448 } 450 setCurrent Item(old_sel);449 setCurrent(old_sel); 451 450 } 452 451 453 452 //////////////////////////////////////// RotorPosConfig … … 597 596 598 597 virtual void load(void) 599 598 { 600 set Value(FindPreset(m_lnb));599 setCurrent(FindPreset(m_lnb)); 601 600 } 602 601 603 602 virtual void save(void) … … 635 634 636 635 virtual void load(void) 637 636 { 638 set Value(getValueIndex(QString::number((uint) m_lnb.GetType())));637 setCurrentValue(QString::number((uint) m_lnb.GetType())); 639 638 } 640 639 641 640 virtual void save(void) … … 814 813 } 815 814 else 816 815 { 817 m_type->setValue(m_type->getValueIndex( 818 QString::number((uint)preset.type))); 816 m_type->setCurrentValue(QString::number((uint)preset.type)); 819 817 m_lof_switch->setValue(QString::number(preset.lof_sw / 1000)); 820 818 m_lof_lo->setValue(QString::number(preset.lof_lo / 1000)); 821 819 m_lof_hi->setValue(QString::number(preset.lof_hi / 1000)); … … 1044 1042 1045 1043 void DeviceTree::PopulateTree(void) 1046 1044 { 1047 int old_sel = get ValueIndex(getValue());1045 int old_sel = getSelectionIndices().first(); 1048 1046 clearSelections(); 1049 1047 PopulateTree(m_tree.Root()); 1050 setCurrent Item(old_sel);1048 setCurrent(old_sel); 1051 1049 } 1052 1050 1053 1051 void DeviceTree::PopulateTree(DiSEqCDevDevice *node, … … 1121 1119 virtual void load(void) 1122 1120 { 1123 1121 double value = m_settings.GetValue(m_node.GetDeviceID()); 1124 set Value((uint)value);1122 setCurrent((uint)value); 1125 1123 } 1126 1124 1127 1125 virtual void save(void) … … 1161 1159 addSelection(AngleToString(*it), QString::number(*it)); 1162 1160 1163 1161 double angle = m_settings.GetValue(m_node.GetDeviceID()); 1164 set Value(getValueIndex(QString::number(angle)));1162 setCurrentValue(QString::number(angle)); 1165 1163 } 1166 1164 1167 1165 virtual void save(void) … … 1211 1209 QString hemi = QString::null; 1212 1210 double eval = AngleToEdit(val, hemi); 1213 1211 numeric->setValue(QString::number(eval)); 1214 hemisphere->set Value(hemisphere->getValueIndex(hemi));1212 hemisphere->setCurrentValue(hemi); 1215 1213 } 1216 1214 1217 1215 virtual void save(void) -
libs/libmythtv/channelsettings.cpp
68 68 { 69 69 uint which = sourceid_to_index[default_sourceid]; 70 70 if (which) 71 set Value(which);71 setCurrent(which); 72 72 } 73 73 } 74 74 -
libs/libmythtv/scheduledrecording.cpp
631 631 case kChannelRecord: 632 632 label = QString("%1 on channel %2") 633 633 .arg(sr.title->getValue()) 634 .arg(sr.channel->getSelectionLabel ());634 .arg(sr.channel->getSelectionLabels().first()); 635 635 break; 636 636 case kWeekslotRecord: 637 637 weekly = QDate(sr.startDate->dateValue()).toString("dddd")+"s "; 638 638 case kTimeslotRecord: 639 639 label = QString("%1 on channel %2 (%3%4 - %5)") 640 640 .arg(sr.title->getValue()) 641 .arg(sr.channel->getSelectionLabel ())641 .arg(sr.channel->getSelectionLabels().first()) 642 642 .arg(weekly) 643 643 .arg(sr.startTime->timeValue().toString()) 644 644 .arg(sr.endTime->timeValue().toString()); … … 648 648 case kDontRecord: 649 649 label = QString("%1 on channel %2 (%3 %4 - %5)") 650 650 .arg(sr.title->getValue()) 651 .arg(sr.channel->getSelectionLabel ())651 .arg(sr.channel->getSelectionLabels().first()) 652 652 .arg(sr.startDate->dateValue().toString()) 653 653 .arg(sr.startTime->timeValue().toString()) 654 654 .arg(sr.endTime->timeValue().toString()); … … 803 803 title->setValue(""); 804 804 subtitle->setValue(""); 805 805 description->setValue(""); 806 channel->setValue(""); 806 channel->setCurrent(0); 807 channel->setState(0, false); 807 808 station->setValue(""); 808 809 startDate->setValue(date); 809 810 startTime->setValue(time); … … 871 872 title->setValue(proginfo->title); 872 873 subtitle->setValue(proginfo->subtitle); 873 874 description->setValue(proginfo->description); 874 channel->set Value(proginfo->chanid);875 channel->setCurrentValue(proginfo->chanid); 875 876 station->setValue(proginfo->chansign); 876 877 startDate->setValue(proginfo->startts.date()); 877 878 startTime->setValue(proginfo->startts.time()); -
libs/libmythtv/recordingprofile.cpp
183 183 ((allow_layer1) ? "Layer I" : val); 184 184 } 185 185 186 if (getValue() != val) 187 { 188 int which = getValueIndex(val); 189 if (which >= 0) 190 setValue(which); 191 } 186 setCurrentValue(val); 192 187 } 193 188 194 189 private: … … 205 200 CodecParamStorage(this, parent, "mpeg2audbitratel1") 206 201 { 207 202 setLabel(QObject::tr("Bitrate")); 208 203 209 204 addSelection("32 kbps", "32"); 210 205 addSelection("64 kbps", "64"); 211 206 addSelection("96 kbps", "96"); … … 220 215 addSelection("384 kbps", "384"); 221 216 addSelection("416 kbps", "416"); 222 217 addSelection("448 kbps", "448"); 223 set Value(13);218 setCurrent(13); 224 219 setHelpText(QObject::tr("Sets the audio bitrate")); 225 220 }; 226 221 }; … … 233 228 CodecParamStorage(this, parent, "mpeg2audbitratel2") 234 229 { 235 230 setLabel(QObject::tr("Bitrate")); 236 231 237 232 addSelection("32 kbps", "32"); 238 233 addSelection("48 kbps", "48"); 239 234 addSelection("56 kbps", "56"); … … 248 243 addSelection("256 kbps", "256"); 249 244 addSelection("320 kbps", "320"); 250 245 addSelection("384 kbps", "384"); 251 set Value(13);246 setCurrent(13); 252 247 setHelpText(QObject::tr("Sets the audio bitrate")); 253 248 }; 254 249 }; … … 276 271 addSelection("224 kbps", "224"); 277 272 addSelection("256 kbps", "256"); 278 273 addSelection("320 kbps", "320"); 279 set Value(10);274 setCurrent(10); 280 275 setHelpText(QObject::tr("Sets the audio bitrate")); 281 276 }; 282 277 }; … … 319 314 addTarget(layers[2], new MPEG2audBitrateL3(parent)); 320 315 321 316 uint desired_layer = max(min(3U, default_layer), 1U) - 1; 322 int which = audType->getValueIndex(layers[desired_layer]); 323 if (which >= 0) 324 audType->setValue(which); 317 audType->setCurrentValue(layers[desired_layer]); 325 318 }; 326 319 }; 327 320 … … 337 330 addSelection(QObject::tr("SAP Language"), "1"); 338 331 addSelection(QObject::tr("Dual"), "2"); 339 332 340 set Value(0);333 setCurrent(0); 341 334 setHelpText(QObject::tr( 342 335 "Chooses the language(s) to record when " 343 336 "two languages are broadcast. Only Layer II " … … 652 645 CodecParamStorage(this, parent, "mpeg2streamtype") 653 646 { 654 647 setLabel(QObject::tr("Stream Type")); 655 648 656 649 addSelection("MPEG-2 PS"); 657 650 addSelection("MPEG-2 TS"); 658 651 addSelection("MPEG-1 VCD"); … … 662 655 addSelection("DVD"); 663 656 addSelection("DVD-Special 1"); 664 657 addSelection("DVD-Special 2"); 665 set Value(0);658 setCurrent(0); 666 659 setHelpText(QObject::tr("Sets the type of stream generated by " 667 660 "your PVR.")); 668 661 }; … … 676 669 CodecParamStorage(this, parent, "mpeg2aspectratio") 677 670 { 678 671 setLabel(QObject::tr("Aspect Ratio")); 679 672 680 673 addSelection(QObject::tr("Square"), "Square"); 681 674 addSelection("4:3"); 682 675 addSelection("16:9"); 683 676 addSelection("2.21:1"); 684 set Value(1);677 setCurrent(1); 685 678 setHelpText(QObject::tr("Sets the aspect ratio of stream generated " 686 679 "by your PVR.")); 687 680 }; … … 711 704 addSelection("1"); 712 705 addSelection("2"); 713 706 addSelection("4"); 714 set Value(2);707 setCurrent(2); 715 708 }; 716 709 }; 717 710 … … 726 719 addSelection("1"); 727 720 addSelection("2"); 728 721 addSelection("4"); 729 set Value(2);722 setCurrent(2); 730 723 }; 731 724 }; 732 725 … … 907 900 addSelection(QObject::tr("Normal"), "all"); 908 901 addSelection(QObject::tr("TV Only"), "tv"); 909 902 addSelection(QObject::tr("Audio Only"), "audio"); 910 set Value(0);903 setCurrent(0); 911 904 }; 912 905 }; 913 906 -
libs/libmythtv/scanwizardhelpers.cpp
294 294 } 295 295 296 296 if (cnt) 297 set Value(which);297 setCurrent(which); 298 298 } 299 299 300 300 void InputSelector::SetSourceID(const QString &_sourceid) … … 770 770 return scanConfig->GetATSCFormat(dfl); 771 771 } 772 772 773 LogList::LogList() : ListBoxSetting(this ), n(0)773 LogList::LogList() : ListBoxSetting(this, MythListBox::NoSelection), n(0) 774 774 { 775 setSelectionMode(MythListBox::NoSelection);776 775 } 777 776 778 777 void LogList::updateText(const QString& status) 779 778 { 780 779 addSelection(status,QString::number(n)); 781 setCurrentItem(n); 782 n++; 780 setCurrent(n++); 783 781 } -
libs/libmyth/settings.cpp
505 505 return widget; 506 506 } 507 507 508 void SelectSetting::addSelection(const QString& label, QString value, bool select) { 508 void SelectSetting::addSelection(const QString& label, QString value, bool state) 509 { 509 510 if (value == QString::null) 510 511 value = label; 511 512 bool found = false;513 for(unsigned i = 0 ; i < values.size() ; ++i)514 if ((values[i] == value) &&515 (labels[i] == label)) {516 found = true;517 break;518 }519 512 520 if (!found) 513 int index = values.findIndex(value); 514 515 if (index == -1) 521 516 { 522 labels.push_back(label); 523 values.push_back(value); 524 525 emit selectionAdded(label, value); 526 527 if (select || !isSet) 528 setValue(value); 517 labels.append(label); 518 values.append(value); 519 states.append(state); 520 521 emit selectionAdded(label, value, state); 522 523 if (state) 524 { 525 selectionIndices.append(states.count() - 1); 526 selectionLabels.append(label); 527 selectionValues.append(value); 528 updateValue(); 529 } 529 530 } 531 else 532 { 533 setState(index, state); 534 } 530 535 } 531 536 532 537 void SelectSetting::fillSelectionsFromDir(const QDir& dir, bool absPath) { … … 544 549 addSelection(fi->fileName()); 545 550 } 546 551 547 void SelectSetting::clearSelections(void) { 552 void SelectSetting::clearSelections() 553 { 548 554 labels.clear(); 549 555 values.clear(); 550 isSet = false; 556 states.clear(); 557 selectionIndices.clear(); 558 selectionLabels.clear(); 559 selectionValues.clear(); 560 updateValue(); 551 561 emit selectionsCleared(); 552 562 } 553 563 554 void SelectSetting::setValue(const QString& newValue) { 555 bool found = false; 556 for(unsigned i = 0 ; i < values.size() ; ++i) 557 if (values[i] == newValue) { 558 current = i; 559 found = true; 560 isSet = true; 561 break; 564 void SelectSetting::setCurrent(uint which) 565 { 566 if (which < labels.count()) 567 { 568 for(uint i = 0 ; i < states.size() ; ++i) 569 states[i] = false; 570 selectionIndices.clear(); 571 selectionLabels.clear(); 572 selectionValues.clear(); 573 selectionIndices.append(which); 574 selectionLabels.append(labels[which]); 575 selectionValues.append(values[which]); 576 states[which] = true; 577 updateValue(); 578 } 579 else 580 { 581 VERBOSE(VB_IMPORTANT, QString("SelectSetting(%1)::setCurrent(%2) - invalid value") 582 .arg(getName()) 583 .arg(which)); 584 } 585 } 586 587 void SelectSetting::setCurrentLabel(const QString& label) 588 { 589 int index = labels.findIndex(label); 590 591 if (index == -1) 592 { 593 if (expand) 594 { 595 for(uint j = 0 ; j < states.size() ; ++j) 596 states[j] = false; 597 selectionIndices.clear(); 598 selectionLabels.clear(); 599 selectionValues.clear(); 600 601 addSelection(label, label, true); 562 602 } 563 if (found) 564 Setting::setValue(newValue); 603 else 604 { 605 VERBOSE(VB_IMPORTANT, QString("SelectSetting(%1)::setCurrentLabel(%2) - invalid label") 606 .arg(getName()) 607 .arg(label)); 608 } 609 } 565 610 else 566 addSelection(newValue, newValue, true); 611 { 612 setCurrent(index); 613 } 567 614 } 568 615 569 void SelectSetting::set Value(int which)616 void SelectSetting::setCurrentValue(const QString& value) 570 617 { 571 if ((unsigned)which > values.size()-1 || which < 0) { 572 VERBOSE(VB_IMPORTANT, 573 "SelectSetting::setValue(): invalid index " << which); 574 return; 618 int index = values.findIndex(value); 619 620 if (index == -1) 621 { 622 if (expand) 623 { 624 for(uint j = 0 ; j < states.size() ; ++j) 625 states[j] = false; 626 selectionIndices.clear(); 627 selectionLabels.clear(); 628 selectionValues.clear(); 629 630 addSelection(value, value, true); 631 } 632 else 633 { 634 VERBOSE(VB_IMPORTANT, QString("SelectSetting(%1)::setCurrent(%2) - invalid value") 635 .arg(getName()) 636 .arg(value)); 637 } 575 638 } 576 current = which; 577 isSet = true; 578 Setting::setValue(values[current]); 639 else 640 { 641 setCurrent(index); 642 } 579 643 } 580 644 645 void SelectSetting::setState(uint which, bool state) 646 { 647 if (which < labels.count()) 648 { 649 if (states[which] != state) 650 { 651 states[which] = state; 652 if (!states[which]) 653 { 654 selectionIndices.remove(which); 655 selectionLabels.remove(labels[which]); 656 selectionValues.remove(values[which]); 657 } 658 else 659 { 660 selectionIndices.append(which); 661 selectionLabels.append(labels[which]); 662 selectionValues.append(values[which]); 663 } 664 updateValue(); 665 } 666 } 667 else 668 { 669 VERBOSE(VB_IMPORTANT, QString("SelectSetting(%1)::setState(%2, %3) - invalid value") 670 .arg(getName()) 671 .arg(which) 672 .arg(state)); 673 } 674 } 675 676 void SelectSetting::setStateLabel(const QString& label, bool state) 677 { 678 int index = labels.findIndex(label); 679 680 if (index == -1) 681 { 682 if (expand) 683 { 684 addSelection(label, label, true); 685 } 686 else 687 { 688 VERBOSE(VB_IMPORTANT, QString("SelectSetting(%1)::setStateLabel(%2, %3) - invalid label") 689 .arg(getName()) 690 .arg(label) 691 .arg(state)); 692 } 693 } 694 else 695 { 696 setState(index, state); 697 } 698 } 699 700 void SelectSetting::setStateValue(const QString& value, bool state) 701 { 702 int index = values.findIndex(value); 703 704 if (index == -1) 705 { 706 if (expand) 707 { 708 addSelection(value, value, true); 709 } 710 else 711 { 712 VERBOSE(VB_IMPORTANT, QString("SelectSetting(%1)::setStateValue(%2, %3) - invalid value") 713 .arg(getName()) 714 .arg(value) 715 .arg(state)); 716 } 717 } 718 else 719 { 720 setState(index, state); 721 } 722 } 723 724 void SelectSetting::setValue(const QString& newValue) 725 { 726 for(uint i = 0 ; i < states.size() ; ++i) 727 states[i] = false; 728 selectionIndices.clear(); 729 selectionLabels.clear(); 730 selectionValues.clear(); 731 732 selectionValues = QStringList::split(';', newValue); 733 734 for (QStringList::iterator iter = selectionValues.begin(); iter != selectionValues.end(); iter++) 735 { 736 int index = values.findIndex(*iter); 737 738 if (index == -1) 739 { 740 if (expand) 741 { 742 labels.append(*iter); 743 values.append(*iter); 744 states.append(true); 745 746 emit selectionAdded(*iter, *iter, true); 747 748 selectionIndices.append(states.count() - 1); 749 selectionLabels.append(*iter); 750 } 751 else 752 { 753 VERBOSE(VB_IMPORTANT, 754 "SelectSetting(" << getName() << ")::setValue(" << *iter << "): invalid value "); 755 iter = selectionValues.erase(iter); 756 iter--; 757 } 758 } 759 else 760 { 761 selectionIndices.append(index); 762 selectionLabels.append(labels[index]); 763 states[index] = true; 764 } 765 } 766 767 updateValue(); 768 } 769 770 void SelectSetting::updateValue() 771 { 772 QString newValue(""); 773 for (QStringList::const_iterator iter = selectionValues.begin(); iter != selectionValues.end(); iter++) 774 { 775 if (!newValue.isEmpty()) 776 newValue.append(';'); 777 newValue.append(*iter); 778 } 779 Setting::setValue(newValue); 780 emit selectionChanged(); 781 } 782 581 783 QWidget* LabelSetting::configWidget(ConfigurationGroup *cg, QWidget* parent, 582 784 const char* widgetName) { 583 785 (void)cg; … … 779 981 } 780 982 781 983 QLabel* value = new QLabel(widget); 782 value->setText( labels[current]);984 value->setText(getValue()); 783 985 value->setBackgroundOrigin(QWidget::WindowOrigin); 784 986 785 987 connect(this, SIGNAL(valueChanged(const QString&)), … … 788 990 return widget; 789 991 } 790 992 993 ComboBoxSetting::ComboBoxSetting(Storage *_storage, bool _rw, int _step) : 994 SelectSetting(_storage, _rw), 995 rw(_rw), 996 widget(NULL), 997 step(_step) 998 { 999 connect(this, SIGNAL(selectionAdded(const QString&, const QString&, bool)), 1000 this, SLOT(selectionAdded(const QString&, const QString&, bool))); 1001 connect(this, SIGNAL(selectionChanged()), 1002 this, SLOT(selectionChanged())); 1003 } 1004 791 1005 QWidget* ComboBoxSetting::configWidget(ConfigurationGroup *cg, QWidget* parent, 792 1006 const char* widgetName) { 793 1007 QHBox* box; … … 816 1030 box->setStretchFactor(widget, 1); 817 1031 818 1032 for(unsigned int i = 0 ; i < labels.size() ; ++i) 1033 { 819 1034 widget->insertItem(labels[i]); 1035 if (states[i]) 1036 widget->setCurrentItem(i); 1037 } 820 1038 821 if (isSet) 822 widget->setCurrentItem(current); 1039 setState(widget->currentItem(), true); 823 1040 824 1041 if (1 < step) 825 1042 widget->setStep(step); 826 1043 827 if (rw) 828 connect(widget, SIGNAL(highlighted(const QString &)), 829 this, SLOT(setValue(const QString &))); 830 else 831 connect(widget, SIGNAL(highlighted(int)), 832 this, SLOT(setValue(int))); 833 1044 connect(widget, SIGNAL(highlighted(const QString &)), 1045 this, SLOT(setCurrentLabel(const QString &))); 834 1046 connect(widget, SIGNAL(destroyed()), 835 1047 this, SLOT(widgetDestroyed())); 836 1048 connect(this, SIGNAL(selectionsCleared()), … … 863 1075 } 864 1076 } 865 1077 866 void ComboBoxSetting::se tValue(QString newValue)1078 void ComboBoxSetting::selectionAdded(const QString& label, const QString&, bool) 867 1079 { 868 if ( !rw)1080 if (widget) 869 1081 { 870 VERBOSE(VB_IMPORTANT, "ComboBoxSetting::setValue(QString): " 871 "BUG: attempted to set value of read-only ComboBox"); 872 return; 1082 widget->insertItem(label); 873 1083 } 874 Setting::setValue(newValue); 875 if (widget) 876 widget->setCurrentItem(current); 877 }; 1084 } 878 1085 879 void ComboBoxSetting::se tValue(int which)1086 void ComboBoxSetting::selectionChanged() 880 1087 { 881 1088 if (widget) 882 widget->setCurrentItem(which); 883 SelectSetting::setValue(which); 884 }; 1089 { 1090 widget->setCurrentItem(getSelectionIndices().first()); 1091 } 1092 } 885 1093 886 1094 void HostRefreshRateComboBox::ChangeResolution(const QString& resolution) 887 1095 { 888 1096 clearSelections(); 889 1097 890 1098 const vector<short> list = GetRefreshRates(resolution); 891 1099 addSelection(QObject::tr("Any"), "0"); 892 1100 int hz50 = -1, hz60 = -1; 893 1101 for (uint i=0; i<list.size(); ++i) 894 { 1102 { 895 1103 QString sel = QString::number(list[i]); 896 1104 addSelection(sel+" Hz", sel); 897 1105 hz50 = (50 == list[i]) ? i : hz50; 898 1106 hz60 = (60 == list[i]) ? i : hz60; 899 1107 } 900 901 setValue(0); 1108 902 1109 if ("640x480" == resolution || "720x480" == resolution) 903 setValue(hz60+1); 904 if ("640x576" == resolution || "720x576" == resolution) 905 setValue(hz50+1); 906 1110 setCurrent(hz60 + 1); 1111 else if ("640x576" == resolution || "720x576" == resolution) 1112 setCurrent(hz50 + 1); 1113 else 1114 setCurrent(0); 1115 907 1116 setEnabled(list.size()); 908 1117 } 909 1118 … … 983 1192 QRadioButton* button = new QRadioButton(widget, NULL); 984 1193 button->setBackgroundOrigin(QWidget::WindowOrigin); 985 1194 button->setText(labels[i]); 986 if ( isSet && i == current)1195 if (states[i]) 987 1196 button->setDown(true); 988 1197 } 989 1198 1199 setState(widget->selectedId(), true); 1200 990 1201 cg = cg; 991 1202 992 1203 return widget; … … 1280 1491 save(table); 1281 1492 } 1282 1493 1283 void ListBoxSetting::setEnabled(bool b) 1494 1495 ListBoxSetting::ListBoxSetting(Storage *_storage, MythListBox::SelectionMode mode) : 1496 SelectSetting(_storage), 1497 selectionMode(mode), 1498 widget(NULL) 1284 1499 { 1285 Configurable::setEnabled(b); 1286 if (widget) 1287 widget->setEnabled(b); 1500 connect(this, SIGNAL(selectionAdded(const QString&, const QString&, bool)), 1501 this, SLOT(selectionAdded(const QString&, const QString&, bool))); 1502 connect(this, SIGNAL(selectionChanged()), 1503 this, SLOT(selectionChanged())); 1288 1504 } 1289 1505 1290 1506 void ListBoxSetting::addSelection( … … 1309 1525 1310 1526 widget = new MythListBox(box); 1311 1527 widget->setBackgroundOrigin(QWidget::WindowOrigin); 1528 widget->setSelectionMode(selectionMode); 1312 1529 widget->setHelpText(getHelpText()); 1313 1530 1314 for(u nsignedint i = 0 ; i < labels.size() ; ++i) {1531 for(uint i = 0 ; i < labels.size() ; ++i) { 1315 1532 widget->insertItem(labels[i]); 1316 if (isSet && current == i) 1317 widget->setCurrentItem(i); 1533 widget->setSelected(i, states[i]); 1318 1534 } 1319 1535 1320 1536 connect(widget, SIGNAL(destroyed()), … … 1329 1545 this, SIGNAL(editButtonPressed(int))); 1330 1546 connect(widget, SIGNAL(deleteButtonPressed(int)), 1331 1547 this, SIGNAL(deleteButtonPressed(int))); 1332 connect(this, SIGNAL(valueChanged(const QString&)), 1333 widget, SLOT(setCurrentItem(const QString&))); 1334 connect(widget, SIGNAL(highlighted(int)), 1335 this, SLOT(setValueByIndex(int))); 1548 connect(widget, SIGNAL(selectionChanged()), 1549 this, SLOT(updateSelection())); 1336 1550 1337 1551 if (cg) 1338 1552 connect(widget, SIGNAL(changeHelpText(QString)), cg, 1339 1553 SIGNAL(changeHelpText(QString))); 1340 1554 1341 1555 widget->setFocus(); 1342 widget->setSelectionMode(selectionMode);1343 1556 1344 1557 return box; 1345 1558 } 1346 1559 1347 void ListBoxSetting::set SelectionMode(MythListBox::SelectionMode mode)1560 void ListBoxSetting::setEnabled(bool b) 1348 1561 { 1349 selectionMode = mode;1350 if (widget)1351 widget->setSelectionMode(selectionMode);1562 Configurable::setEnabled(b); 1563 if (widget) 1564 widget->setEnabled(b); 1352 1565 } 1353 1566 1354 void ListBoxSetting::se tValueByIndex(int index)1567 void ListBoxSetting::selectionAdded(const QString& label, const QString&, bool) 1355 1568 { 1356 if (((uint)index) < values.size()) 1357 setValue(values[index]); 1569 if (widget) 1570 { 1571 widget->insertItem(label); 1572 } 1358 1573 } 1359 1574 1360 void ImageSelectSetting::addImageSelection(const QString& label, 1361 QImage* image, 1362 QString value, 1363 bool select) { 1364 images.push_back(image); 1365 addSelection(label, value, select); 1575 void ListBoxSetting::selectionChanged() 1576 { 1577 if (widget) 1578 for (uint i = 0; i < states[i]; ++i) 1579 widget->setSelected(i, states[i]); 1366 1580 } 1367 1581 1368 ImageSelectSetting::~ImageSelectSetting() { 1369 while (images.size() > 0){1370 delete images.back();1371 images.pop_back();1372 }1582 void ListBoxSetting::updateSelection() 1583 { 1584 if (widget) 1585 for (uint i = 0; i < widget->count(); ++i) 1586 setState(i, widget->item(i)->isSelected()); 1373 1587 } 1374 1588 1375 void ImageSelectSetting::imageSet(int num) 1589 1590 ImageSelectSetting::ImageSelectSetting(Storage *_storage) : 1591 ComboBoxSetting(_storage), 1592 imagelabel(NULL) 1376 1593 { 1377 if (num >= (int)images.size()) 1378 return; 1379 1380 if (!images[current]) 1381 return; 1382 1383 QImage temp = *(images[current]); 1384 temp = temp.smoothScale((int)(184 * m_hmult), (int)(138 * m_hmult), 1385 QImage::ScaleMin); 1386 1387 QPixmap tmppix(temp); 1388 imagelabel->setPixmap(tmppix); 1594 images.setAutoDelete(true); 1389 1595 } 1390 1596 1391 1597 QWidget* ImageSelectSetting::configWidget(ConfigurationGroup *cg, … … 1396 1602 1397 1603 gContext->GetScreenSettings(width, m_wmult, height, m_hmult); 1398 1604 1399 QHBox* box; 1400 if (labelAboveWidget) 1401 { 1402 box = dynamic_cast<QHBox*>(new QVBox(parent, widgetName)); 1403 box->setSizePolicy(QSizePolicy(QSizePolicy::Minimum, 1404 QSizePolicy::Maximum)); 1405 } 1406 else 1407 box = new QHBox(parent, widgetName); 1408 1605 QHBox* box = new QHBox(parent, widgetName); 1409 1606 box->setBackgroundOrigin(QWidget::WindowOrigin); 1607 box->setSpacing(100); 1410 1608 1411 if (getLabel() != "") 1412 { 1413 QLabel* label = new QLabel(box); 1414 label->setText(getLabel() + ":"); 1415 label->setBackgroundOrigin(QWidget::WindowOrigin); 1416 } 1609 ComboBoxSetting::configWidget(cg, box); 1417 1610 1418 MythComboBox *widget = new MythComboBox(false, box);1419 widget->setBackgroundOrigin(QWidget::WindowOrigin);1420 1421 QLabel *testlabel = new QLabel(box);1422 testlabel->setText(" ");1423 testlabel->setBackgroundOrigin(QWidget::WindowOrigin);1424 1425 1611 imagelabel = new QLabel(box); 1426 1612 imagelabel->setBackgroundOrigin(QWidget::WindowOrigin); 1427 1613 1428 for (unsigned int i = 0 ; i < images.size() ; ++i) 1429 widget->insertItem(labels[i]); 1614 selectionChanged(); 1430 1615 1431 if (isSet) 1432 widget->setCurrentItem(current); 1433 else 1434 current = 0; 1616 connect(widget, SIGNAL(highlighted(int)), this, SLOT(imageSet(int))); 1435 1617 1436 if (images.size() != 0 && current < images.size() && images[current]) 1437 { 1438 QImage temp = *(images[current]); 1439 temp = temp.smoothScale((int)(184 * m_hmult), (int)(138 * m_hmult), 1440 QImage::ScaleMin); 1441 1442 QPixmap tmppix(temp); 1443 imagelabel->setPixmap(tmppix); 1618 return box; 1619 } 1620 1621 void ImageSelectSetting::addSelection(const QString& label, 1622 QImage* image, 1623 QString value, 1624 bool select) 1625 { 1626 if (labels.find(label) == labels.end()) 1627 { 1628 images.append(image); 1629 SelectSetting::addSelection(label, value, select); 1444 1630 } 1445 else 1631 } 1632 1633 void ImageSelectSetting::imageSet(int num) 1634 { 1635 if (imagelabel) 1446 1636 { 1447 1637 QPixmap tmppix((int)(184 * m_hmult), (int)(138 * m_hmult)); 1448 tmppix.fill(black);1449 1638 1639 if (num < (int)images.count() && images.at(num)) 1640 tmppix = images.at(num)->smoothScale((int)(184 * m_hmult), 1641 (int)(138 * m_hmult), 1642 QImage::ScaleMin); 1643 else 1644 tmppix.fill(black); 1645 1450 1646 imagelabel->setPixmap(tmppix); 1451 1647 } 1648 } 1452 1649 1453 connect(widget, SIGNAL(highlighted(int)), this, SLOT(setValue(int))); 1454 connect(widget, SIGNAL(highlighted(int)), this, SLOT(imageSet(int))); 1650 void ImageSelectSetting::selectionChanged() 1651 { 1652 imageSet(getSelectionIndices().first()); 1653 ComboBoxSetting::selectionChanged(); 1654 } 1455 1655 1456 connect(this, SIGNAL(selectionsCleared()),1457 widget, SLOT(clear()));1458 1656 1459 if (cg)1460 connect(widget, SIGNAL(changeHelpText(QString)), cg,1461 SIGNAL(changeHelpText(QString)));1462 1463 return box;1464 }1465 1466 1657 HostnameSetting::HostnameSetting(Storage *storage) : Setting(storage) 1467 1658 { 1468 1659 setVisible(false); -
libs/libmyth/dbsettings.cpp
74 74 VerticalConfigurationGroup(false, true, false, false) 75 75 { 76 76 setLabel(QObject::tr("Database Configuration") + " 1/2"); 77 77 78 78 info = new TransLabelSetting(); 79 79 80 80 MSqlQuery query(MSqlQuery::InitCon()); … … 86 86 "Please verify your database settings " 87 87 "below.")); 88 88 addChild(info); 89 89 90 90 dbHostName = new TransLineEditSetting(true); 91 91 dbHostName->setLabel(QObject::tr("Host name")); 92 92 dbHostName->setHelpText(QObject::tr("The host name or IP address of " … … 100 100 "on, if it's not the default database " 101 101 "port.")); 102 102 addChild(dbPort); 103 103 104 104 dbName = new TransLineEditSetting(true); 105 105 dbName->setLabel(QObject::tr("Database")); 106 106 dbName->setHelpText(QObject::tr("The name of the database. " … … 113 113 "connecting to the database. " 114 114 "This information is required.")); 115 115 addChild(dbUserName); 116 116 117 117 dbPassword = new TransLineEditSetting(true); 118 118 dbPassword->setLabel(QObject::tr("Password")); 119 119 dbPassword->setHelpText(QObject::tr("The password to use while " 120 120 "connecting to the database. " 121 121 "This information is required.")); 122 122 addChild(dbPassword); 123 123 124 124 dbType = new TransComboBoxSetting(false); 125 125 dbType->setLabel(QObject::tr("Database type")); 126 126 dbType->addSelection(QObject::tr("MySQL"), "QMYSQL3"); 127 127 //dbType->addSelection(QObject::tr("PostgreSQL"), "QPSQL7"); 128 dbType->set Value(0);128 dbType->setCurrent(0); 129 129 dbType->setHelpText(QObject::tr("The database implementation used " 130 130 "for your server.")); 131 131 addChild(dbType); … … 203 203 void MythDbSettings1::load() 204 204 { 205 205 DatabaseParams params = gContext->GetDatabaseParams(); 206 206 207 207 if (params.dbHostName.isEmpty() || 208 208 params.dbUserName.isEmpty() || 209 209 params.dbPassword.isEmpty() || 210 210 params.dbName.isEmpty()) 211 211 info->setValue(info->getValue() + "\nRequired fields are marked " 212 212 "with an asterisk (*)."); 213 213 214 214 dbHostName->setValue(params.dbHostName); 215 215 if (params.dbHostName.isEmpty()) 216 216 dbHostName->setLabel("* " + dbHostName->getLabel()); … … 227 227 dbName->setValue(params.dbName); 228 228 if (params.dbName.isEmpty()) 229 229 dbName->setLabel("* " + dbName->getLabel()); 230 230 231 231 if (params.dbType == "QMYSQL3") 232 dbType->set Value(0);232 dbType->setCurrent(0); 233 233 else if (params.dbType == "QPSQL7") 234 dbType->set Value(1);234 dbType->setCurrent(1); 235 235 } 236 236 237 237 void MythDbSettings2::load() -
libs/libmyth/mythwidgets.cpp
1273 1273 void MythListBox::polish(void) 1274 1274 { 1275 1275 QListBox::polish(); 1276 1276 1277 1277 QPalette pal = palette(); 1278 1278 QColorGroup::ColorRole role = QColorGroup::Highlight; 1279 1279 pal.setColor(QPalette::Active, role, pal.active().button()); 1280 1280 pal.setColor(QPalette::Inactive, role, pal.active().button()); 1281 1281 pal.setColor(QPalette::Disabled, role, pal.active().button()); 1282 1282 1283 1283 setPalette(pal); 1284 1284 } 1285 1285 … … 1318 1318 } 1319 1319 } 1320 1320 else 1321 { 1321 { 1322 1322 if (text(i).lower() == matchText.lower()) 1323 1323 { 1324 1324 setCurrentItem(i); 1325 1325 break; 1326 1326 } 1327 } 1327 } 1328 1328 } 1329 } 1329 } 1330 1330 } 1331 1331 1332 1332 void MythListBox::keyPressEvent(QKeyEvent* e) … … 1351 1351 handled = true; 1352 1352 continue; 1353 1353 } 1354 1354 1355 1355 key = Key_Up; 1356 1356 } 1357 1357 else if (action == "DOWN") … … 1363 1363 handled = true; 1364 1364 continue; 1365 1365 } 1366 1366 1367 1367 key = Key_Down; 1368 1368 } 1369 1369 else if (action == "LEFT") 1370 1370 { 1371 focusNextPrevChild(false); 1371 if (selectionMode() == Multi) 1372 toggleCurrentItem(); 1372 1373 handled = true; 1373 1374 continue; 1374 1375 } 1375 1376 else if (action == "RIGHT") 1376 1377 { 1377 focusNextPrevChild(true); 1378 if (selectionMode() == Multi) 1379 toggleCurrentItem(); 1378 1380 handled = true; 1379 1381 continue; 1380 1382 } … … 1406 1408 1407 1409 void MythListBox::focusOutEvent(QFocusEvent *e) 1408 1410 { 1411 if (selectionMode() == Single) 1412 setSelected(currentItem(), false); 1413 1409 1414 QPalette pal = palette(); 1410 1415 QColorGroup::ColorRole role = QColorGroup::Highlight; 1411 1416 pal.setColor(QPalette::Active, role, pal.active().button()); 1412 1417 pal.setColor(QPalette::Inactive, role, pal.active().button()); 1413 1418 pal.setColor(QPalette::Disabled, role, pal.active().button()); 1414 1419 1415 1420 setPalette(pal); 1416 1421 QListBox::focusOutEvent(e); 1417 1422 } … … 1419 1424 void MythListBox::focusInEvent(QFocusEvent *e) 1420 1425 { 1421 1426 this->unsetPalette(); 1422 1427 1423 1428 emit changeHelpText(helptext); 1424 1429 QListBox::focusInEvent(e); 1430 1431 if (selectionMode() == Single) 1432 setSelected(currentItem(), true); 1425 1433 } 1426 1434 1427 1435 /* vim: set expandtab tabstop=4 shiftwidth=4: */ -
libs/libmyth/settings.h
287 287 { 288 288 Q_OBJECT 289 289 290 291 SelectSetting(Storage *_storage ) :292 Setting(_storage), current(0), isSet(false) { }290 protected: 291 SelectSetting(Storage *_storage, bool _expand = false) : 292 Setting(_storage), expand(_expand) { }; 293 293 294 294 public: 295 295 virtual void addSelection(const QString& label, 296 QString value =QString::null,297 bool s elect=false);296 QString value = QString::null, 297 bool state = false); 298 298 299 virtual void clearSelections(void); 299 virtual const QValueList<uint> getSelectionIndices() const {return selectionIndices;} 300 virtual const QStringList& getSelectionLabels() const {return selectionLabels;} 301 virtual const QStringList& getSelectionValues() const {return selectionValues;} 300 302 303 virtual void clearSelections(); 304 301 305 virtual void fillSelectionsFromDir(const QDir& dir, bool absPath=true); 302 306 303 307 signals: 304 void selectionAdded(const QString& label, QString value); 305 void selectionsCleared(void); 308 void selectionAdded(const QString& label, const QString& value, bool state); 309 void selectionChanged(); 310 void selectionsCleared(); 306 311 307 312 public slots: 313 virtual void setCurrent(uint which); 314 virtual void setCurrentLabel(const QString& label); 315 virtual void setCurrentValue(const QString& value); 316 virtual void setState(uint which, bool state); 317 virtual void setStateLabel(const QString& label, bool state); 318 virtual void setStateValue(const QString& value, bool state); 308 319 320 private slots: 309 321 virtual void setValue(const QString& newValue); 310 virtual void setValue(int which);311 322 312 virtual QString getSelectionLabel(void) const { 313 if (!isSet) 314 return QString::null; 315 return labels[current]; 316 }; 323 protected: 324 virtual void updateValue(); 317 325 318 virtual int getValueIndex(QString value) {319 selectionList::iterator iter = values.begin();320 int ret = 0;321 while (iter != values.end()) {322 if (*iter == value) {323 return ret;324 } else {325 ret++;326 iter++;327 }328 }329 return 0;330 };331 332 326 protected: 333 typedef vector<QString> selectionList; 334 selectionList labels; 335 selectionList values; 336 unsigned current; 337 bool isSet; 327 bool expand; // whether to expand selections via 'set' calls 328 QStringList labels; // strings that are displayed 329 QStringList values; // strings that are used internally 330 QValueList<bool> states; // states of possible selections 331 QValueList<uint> selectionIndices; // indices of currently selected items 332 QStringList selectionLabels; // labels of currently selected items 333 QStringList selectionValues; // values of currently selected items 338 334 }; 339 335 340 336 class MPUBLIC SelectLabelSetting : public SelectSetting … … 350 346 class MPUBLIC ComboBoxSetting: public SelectSetting { 351 347 Q_OBJECT 352 348 353 protected:354 ComboBoxSetting(Storage *_storage, bool _rw = false, int _step = 1) :355 SelectSetting(_storage), rw(_rw), widget(NULL), step(_step) { }356 357 349 public: 358 virtual void setValue(QString newValue); 359 virtual void setValue(int which); 350 ComboBoxSetting(Storage *_storage, bool _rw = false, int _step = 1); 360 351 352 public: 361 353 virtual QWidget* configWidget(ConfigurationGroup *cg, QWidget* parent, 362 354 const char* widgetName = 0); 363 355 … … 366 358 virtual void setEnabled(bool b); 367 359 virtual void setVisible(bool b); 368 360 369 public slots:370 void addSelection(const QString& label,371 QString value=QString::null,372 bool select=false) {373 if (widget != NULL)374 widget->insertItem(label);375 SelectSetting::addSelection(label, value, select);376 };377 361 protected slots: 362 virtual void selectionAdded(const QString& label, const QString&, bool state); 363 virtual void selectionChanged(); 378 364 void widgetDestroyed() { widget=NULL; }; 379 365 380 pr ivate:366 protected: 381 367 bool rw; 382 368 MythComboBox *widget; 383 384 protected:385 369 int step; 386 370 }; 387 371 388 372 class MPUBLIC ListBoxSetting: public SelectSetting { 389 373 Q_OBJECT 374 390 375 public: 391 ListBoxSetting(Storage *_storage) : 392 SelectSetting(_storage), widget(NULL), 393 selectionMode(MythListBox::Single) { } 376 ListBoxSetting(Storage *_storage, MythListBox::SelectionMode mode = MythListBox::Single); 394 377 378 public: 395 379 virtual QWidget* configWidget(ConfigurationGroup *cg, QWidget* parent, 396 380 const char* widgetName = 0); 397 381 398 382 void setFocus() { if (widget) widget->setFocus(); } 399 void setSelectionMode(MythListBox::SelectionMode mode);400 void setCurrentItem(int i) { if (widget) widget->setCurrentItem(i); }401 void setCurrentItem(const QString& str) { if (widget) widget->setCurrentItem(str); }402 383 403 384 virtual void setEnabled(bool b); 404 385 … … 414 395 bool select = false); 415 396 416 397 protected slots: 417 void setValueByIndex(int index); 398 virtual void selectionAdded(const QString& label, const QString&, bool state); 399 virtual void selectionChanged(); 400 virtual void updateSelection(); 401 418 402 void widgetDestroyed() { widget=NULL; }; 403 419 404 protected: 420 MythListBox* widget;421 405 MythListBox::SelectionMode selectionMode; 406 MythListBox* widget; 422 407 }; 423 408 424 409 class MPUBLIC RadioSetting : public SelectSetting … … 429 414 const char* widgetName = 0); 430 415 }; 431 416 432 class MPUBLIC ImageSelectSetting: public SelectSetting {417 class MPUBLIC ImageSelectSetting: public ComboBoxSetting { 433 418 Q_OBJECT 419 420 protected: 421 ImageSelectSetting(Storage *_storage); 422 434 423 public: 435 ImageSelectSetting(Storage *_storage) : SelectSetting(_storage) { }436 virtual ~ImageSelectSetting();437 424 virtual QWidget* configWidget(ConfigurationGroup *cg, QWidget* parent, 438 425 const char* widgetName = 0); 439 426 440 virtual void addImageSelection(const QString& label, 441 QImage* image, 442 QString value=QString::null, 443 bool select=false); 427 virtual void addSelection(const QString& label, 428 QImage* image, 429 QString value = QString::null, 430 bool select = false); 431 private: 432 virtual void addSelection(const QString&, QString, bool) {} 433 444 434 protected slots: 435 virtual void selectionChanged(); 445 436 void imageSet(int); 446 437 447 438 protected: 448 vector<QImage*> images;449 QLabel *imagelabel;439 QPtrList<QImage> images; 440 QLabel* imagelabel; 450 441 float m_hmult, m_wmult; 451 442 }; 452 443 … … 738 729 LineEditSetting(this, rw), HostDBStorage(this, name) { } 739 730 }; 740 731 732 class MPUBLIC HostListBox: public ListBoxSetting, public HostDBStorage 733 { 734 public: 735 HostListBox(const QString &name, MythListBox::SelectionMode mode = MythListBox::Single) : 736 ListBoxSetting(this, mode), HostDBStorage(this, name) { } 737 }; 738 741 739 class MPUBLIC HostImageSelect : public ImageSelectSetting, public HostDBStorage 742 740 { 743 741 public: -
libs/libmyth/mythwidgets.h
367 367 void focusInEvent(QFocusEvent *e); 368 368 }; 369 369 370 class MPUBLIC MythListBox: public QListBox { 370 class MPUBLIC MythListBox: public QListBox 371 { 371 372 Q_OBJECT 372 373 public: 373 374 MythListBox(QWidget* parent); -
programs/mythfrontend/globalsettings.cpp
541 541 "shows to delete first. LiveTV recordings " 542 542 "will always expire before normal " 543 543 "recordings.")); 544 bc->set Value(1);544 bc->setCurrent(1); 545 545 return bc; 546 546 } 547 547 … … 700 700 for (int i = 0; i < 4; i++) 701 701 gc->addSelection(str[i], QString::number(i)); 702 702 703 gc->set Value(1);703 gc->setCurrent(1); 704 704 gc->setHelpText(help); 705 705 706 706 return gc; … … 1469 1469 gc->addSelection(QString::number(i), QString::number(i)); 1470 1470 gc->addSelection(QObject::tr("All"), QString::number(-1)); 1471 1471 gc->setLabel(QObject::tr("Xinerama screen")); 1472 gc->set Value(0);1472 gc->setCurrent(0); 1473 1473 gc->setHelpText(QObject::tr("Run on the specified screen or " 1474 1474 "spanning all screens.")); 1475 1475 return gc; … … 1648 1648 DisplayResScreen dscr(w, h, -1, -1, -1.0, 0); 1649 1649 short rate = -1; 1650 1650 int i = DisplayResScreen::FindBestMatch(scr, dscr, rate); 1651 gc->set Value((i >= 0) ? i : scr.size()-1);1651 gc->setCurrent((i >= 0) ? i : scr.size()-1); 1652 1652 } 1653 1653 1654 1654 return gc; … … 1948 1948 continue; 1949 1949 } 1950 1950 1951 add ImageSelection(theme->fileName(), previewImage);1951 addSelection(theme->fileName(), previewImage); 1952 1952 } 1953 1953 1954 set Value("G.A.N.T.");1954 setCurrent(0); 1955 1955 } 1956 1956 1957 1957 class StyleSetting: public HostComboBox { … … 1992 1992 gc->addSelection(QObject::tr("callsign"), "<sign>"); 1993 1993 gc->addSelection(QObject::tr("name"), "<name>"); 1994 1994 gc->setHelpText(QObject::tr("Your preferred channel format.")); 1995 gc->set Value(1);1995 gc->setCurrent(1); 1996 1996 return gc; 1997 1997 } 1998 1998 … … 2006 2006 gc->addSelection(QObject::tr("callsign"), "<sign>"); 2007 2007 gc->addSelection(QObject::tr("name"), "<name>"); 2008 2008 gc->setHelpText(QObject::tr("Your preferred long channel format.")); 2009 gc->set Value(2);2009 gc->setCurrent(2); 2010 2010 return gc; 2011 2011 } 2012 2012 -
programs/mythfrontend/main.cpp
511 511 themename = themelist[rand() % themelist.size()]; 512 512 513 513 ThemeSelector Theme; 514 Theme.set Value(themename);514 Theme.setCurrentValue(themename); 515 515 Theme.save(); 516 516 517 517 return themename; -
programs/mythtv-setup/backendsettings.cpp
218 218 GlobalComboBox *gc = new GlobalComboBox("EITTimeOffset"); 219 219 gc->setLabel(QObject::tr("Time offset for EIT listings")); 220 220 init_time_offsets(gc); 221 gc->set Value(1);221 gc->setCurrent(1); 222 222 QString helptext = QObject::tr( 223 223 "Adjust the relative timezone of the EIT EPG data. " 224 224 "'Auto' converts the EIT time to local time using your "