Ticket #13133: 20170924_videoprofiles.patch
File 20170924_videoprofiles.patch, 27.8 KB (added by , 7 years ago) |
---|
-
mythtv/libs/libmythtv/videodisplayprofile.cpp
diff --git a/mythtv/libs/libmythtv/videodisplayprofile.cpp b/mythtv/libs/libmythtv/videodisplayprofile.cpp index 1b031e2..c75a3b0 100644
a b using namespace std; 10 10 #include "avformatdecoder.h" 11 11 12 12 13 // options are NNN NNN-MMM 0-MMM -MMM NNN-99999 NNN->NNN >=NNN <MMM <=MMM or blank13 // options are NNN NNN-MMM 0-MMM NNN-99999 >NNN >=NNN <MMM <=MMM or blank 14 14 // If string is blank then assumes a match. 15 15 // If value is 0 or negative assume a match (i.e. value unknown assumes a match) 16 // float values assumed tobe no more than 3 decimals.16 // float values must be no more than 3 decimals. 17 17 18 18 bool ProfileItem::checkRange(QString key, float fvalue, bool *ok) const 19 19 { … … bool ProfileItem::checkRange(QString key, float fvalue, bool *ok) const 22 22 23 23 bool ProfileItem::checkRange(QString key, int ivalue, bool *ok) const 24 24 { 25 return checkRange(key, 0.0 f, ivalue, false, ok);25 return checkRange(key, 0.0, ivalue, false, ok); 26 26 } 27 27 28 28 bool ProfileItem::checkRange(QString key, … … bool ProfileItem::checkRange(QString key, 34 34 ivalue = int(fvalue * 1000.0f); 35 35 QString cmp = Get(QString(key)); 36 36 if (!cmp.isEmpty()) 37 cmp.replace(QLatin1String(" "),QLatin1String(""));38 if (!cmp.isEmpty() && ivalue > 0)39 37 { 40 QRegularExpression regex("^([0-9.]*)([^0-9.]*)([0-9.]*)$"); 41 QRegularExpressionMatch rmatch = regex.match(cmp); 42 43 int value1 = 0; 44 int value2 = 0; 45 QString oper; 46 QString capture1 = rmatch.captured(1); 47 QString capture3; 48 if (!capture1.isEmpty()) 49 { 50 if (isFloat) 51 value1 = int(capture1.toFloat(&isOK) * 1000.0f); 52 else 53 value1 = capture1.toInt(&isOK); 54 } 55 if (isOK) 56 { 57 oper = rmatch.captured(2); 58 capture3 = rmatch.captured(3); 59 if (!capture3.isEmpty()) 60 { 61 if (isFloat) 62 value2 = int(capture3.toFloat(&isOK) * 1000.0f); 63 else 64 value2 = capture3.toInt(&isOK); 65 } 66 } 67 if (isOK) 68 { 69 // Invalid string 70 if (value1 == 0 && value2 == 0 && oper.isEmpty()) 71 isOK=false; 72 } 73 if (isOK) 38 cmp.replace(QLatin1String(" "),QLatin1String("")); 39 QStringList expr = cmp.split("&"); 40 for (int ix = 0; ix < expr.size(); ++ix) 74 41 { 75 // Case NNN 76 if (value1 != 0 && oper.isEmpty() && value2 == 0) 42 if (expr[ix].isEmpty()) 77 43 { 78 value2 = value1; 79 oper = "-"; 80 } 81 // NNN-MMM 0-MMM NNN-99999 NNN- -MMM 82 else if (oper == "-") 83 { 84 // NNN- 85 if (capture3.isEmpty()) 86 value2 = 99999999; 87 // NNN-MMM 88 if (value2 < value1) 89 isOK = false; 44 isOK = false; 45 continue; 90 46 } 91 else if (capture1.isEmpty())47 if (ivalue > 0) 92 48 { 93 // Other operators == > < >= <= 94 // Convert to a range 95 if (oper == "==") 96 value1 = value2; 97 else if (oper == ">") 49 QRegularExpression regex("^([0-9.]*)([^0-9.]*)([0-9.]*)$"); 50 QRegularExpressionMatch rmatch = regex.match(expr[ix]); 51 52 int value1 = 0; 53 int value2 = 0; 54 QString oper; 55 QString capture1 = rmatch.captured(1); 56 QString capture3; 57 if (!capture1.isEmpty()) 98 58 { 99 value1 = value2 + 1; 100 value2 = 99999999; 59 if (isFloat) 60 { 61 int dec=capture1.indexOf('.'); 62 if (dec > -1 && (capture1.length()-dec) > 4) 63 isOK = false; 64 if (isOK) 65 { 66 double double1 = capture1.toDouble(&isOK); 67 if (double1 > 2000000.0 || double1 < 0.0) 68 isOK = false; 69 value1 = int(double1 * 1000.0); 70 } 71 } 72 else 73 value1 = capture1.toInt(&isOK); 101 74 } 102 else if (oper == ">=")75 if (isOK) 103 76 { 104 value1 = value2; 105 value2 = 99999999; 77 oper = rmatch.captured(2); 78 capture3 = rmatch.captured(3); 79 if (!capture3.isEmpty()) 80 { 81 if (isFloat) 82 { 83 int dec=capture3.indexOf('.'); 84 if (dec > -1 && (capture3.length()-dec) > 4) 85 isOK = false; 86 if (isOK) 87 { 88 double double1 = capture3.toDouble(&isOK); 89 if (double1 > 2000000.0 || double1 < 0.0) 90 isOK = false; 91 value2 = int(double1 * 1000.0); 92 } 93 } 94 else 95 value2 = capture3.toInt(&isOK); 96 } 97 } 98 if (isOK) 99 { 100 // Invalid string 101 if (value1 == 0 && value2 == 0 && oper.isEmpty()) 102 isOK=false; 103 } 104 if (isOK) 105 { 106 // Case NNN 107 if (value1 != 0 && oper.isEmpty() && value2 == 0) 108 { 109 value2 = value1; 110 oper = "-"; 111 } 112 // NNN-MMM 0-MMM NNN-99999 NNN- -MMM 113 else if (oper == "-") 114 { 115 // NNN- or -NNN 116 if (capture1.isEmpty() || capture3.isEmpty()) 117 isOK = false; 118 // NNN-MMM 119 if (value2 < value1) 120 isOK = false; 121 } 122 else if (capture1.isEmpty()) 123 { 124 // Other operators == > < >= <= 125 // Convert to a range 126 if (oper == "==") 127 value1 = value2; 128 else if (oper == ">") 129 { 130 value1 = value2 + 1; 131 value2 = 99999999; 132 } 133 else if (oper == ">=") 134 { 135 value1 = value2; 136 value2 = 99999999; 137 } 138 else if (oper == "<") 139 value2 = value2 - 1; 140 else if (oper == "<=") 141 ; 142 else isOK = false; 143 oper = "-"; 144 } 145 } 146 if (isOK) 147 { 148 if (oper == "-") 149 match = match && (ivalue >= value1 && ivalue <= value2); 150 else isOK = false; 106 151 } 107 else if (oper == "<")108 value2 = value2 - 1;109 else if (oper == "<=")110 ;111 else isOK = false;112 oper = "-";113 152 } 114 153 } 115 if (isOK)116 {117 if (oper == "-")118 match = (ivalue >= value1 && ivalue <= value2);119 else isOK = false;120 }121 154 } 122 155 if (ok != Q_NULLPTR) 123 156 *ok = isOK; … … bool ProfileItem::IsMatch(const QSize &size, 133 166 134 167 QString cmp; 135 168 136 // Format is "OPER width height" where OPER is == != > < >= <=137 for (uint i = 0; (i < 2) && match; i++)138 {139 cmp = Get(QString("pref_cmp%1").arg(i));140 if (cmp.isEmpty())141 break;142 143 QStringList clist = cmp.split(" ", QString::SkipEmptyParts);144 if (clist.size() != 3)145 break;146 147 int width = clist[1].toInt();148 int height = clist[2].toInt();149 cmp = clist[0];150 151 if (cmp == "==")152 match &= (size.width() == width) && (size.height() == height);153 else if (cmp == "!=")154 match &= (size.width() != width) && (size.height() != height);155 else if (cmp == "<=")156 match &= (size.width() <= width) && (size.height() <= height);157 else if (cmp == "<")158 match &= (size.width() < width) && (size.height() < height);159 else if (cmp == ">=")160 match &= (size.width() >= width) && (size.height() >= height);161 else if (cmp == ">")162 match &= (size.width() > width) || (size.height() > height);163 else164 match = false;165 }166 // New Style167 169 // cond_width, cond_height, cond_codecs, cond_framerate. 168 // cind_width and cond_height are not used yet170 // These replace old settings pref_cmp0 and pref_cmp1 169 171 match &= checkRange("cond_width",size.width()); 170 172 match &= checkRange("cond_height",size.height()); 171 173 match &= checkRange("cond_framerate",framerate); … … void VideoDisplayProfile::LoadBestPreferences 588 590 pref = (*it).GetAll(); 589 591 590 592 LOG(VB_PLAYBACK, LOG_INFO, LOC + QString("LoadBestPreferences Result " 591 "cmp0:%1, cmp1:%2, prio:%3, w:%4, h:%5, fps:%6," 592 " codecs:%7, decoder:%8, renderer:%9, deint:%10") 593 .arg(GetPreference("pref_cmp0")).arg(GetPreference("pref_cmp1")) 593 "prio:%1, w:%2, h:%3, fps:%4," 594 " codecs:%5, decoder:%6, renderer:%7, deint:%8") 594 595 .arg(GetPreference("pref_priority")).arg(GetPreference("cond_width")) 595 596 .arg(GetPreference("cond_height")).arg(GetPreference("cond_framerate")) 596 597 .arg(GetPreference("cond_codecs")).arg(GetPreference("pref_decoder")) … … bool VideoDisplayProfile::SaveDB(uint groupid, item_list_t &items) 704 705 "VALUES " 705 706 " (:GROUPID, :PROFILEID, :VALUE, :DATA) "); 706 707 708 MSqlQuery sqldelete(MSqlQuery::InitCon()); 709 sqldelete.prepare( 710 "DELETE FROM displayprofiles " 711 "WHERE profilegroupid = :GROUPID AND " 712 " profileid = :PROFILEID AND " 713 " value = :VALUE"); 707 714 708 715 bool ok = true; 709 716 item_list_t::iterator it = items.begin(); … … bool VideoDisplayProfile::SaveDB(uint groupid, item_list_t &items) 768 775 } 769 776 else if (query.next() && (1 == query.value(0).toUInt())) 770 777 { 771 update.bindValue(":GROUPID", groupid); 772 update.bindValue(":PROFILEID", (*it).GetProfileID()); 773 update.bindValue(":VALUE", lit.key()); 774 update.bindValue(":DATA", ((*lit).isNull()) ? "" : (*lit)); 775 if (!update.exec()) 778 if (lit->isEmpty()) 776 779 { 777 MythDB::DBError("save_profile 5", update); 778 ok = false; 779 continue; 780 sqldelete.bindValue(":GROUPID", groupid); 781 sqldelete.bindValue(":PROFILEID", (*it).GetProfileID()); 782 sqldelete.bindValue(":VALUE", lit.key()); 783 if (!sqldelete.exec()) 784 { 785 MythDB::DBError("save_profile 5a", update); 786 ok = false; 787 continue; 788 } 789 } 790 else 791 { 792 update.bindValue(":GROUPID", groupid); 793 update.bindValue(":PROFILEID", (*it).GetProfileID()); 794 update.bindValue(":VALUE", lit.key()); 795 update.bindValue(":DATA", ((*lit).isNull()) ? "" : (*lit)); 796 if (!update.exec()) 797 { 798 MythDB::DBError("save_profile 5b", update); 799 ok = false; 800 continue; 801 } 780 802 } 781 803 } 782 804 else … … void VideoDisplayProfile::DeleteProfiles(const QString &hostname) 1060 1082 //displayprofilegroups pk(name, hostname), uk(profilegroupid) 1061 1083 //displayprofiles k(profilegroupid), k(profileid), value, data 1062 1084 1085 // Old style 1063 1086 void VideoDisplayProfile::CreateProfile( 1064 1087 uint groupid, uint priority, 1065 1088 QString cmp0, uint width0, uint height0, … … void VideoDisplayProfile::CreateProfile( 1068 1091 QString osdrenderer, bool osdfade, 1069 1092 QString deint0, QString deint1, QString filters) 1070 1093 { 1071 MSqlQuery query(MSqlQuery::InitCon()); 1094 QString width; 1095 QString height; 1096 if (!cmp0.isEmpty() 1097 && ! (cmp0 == ">" && width0 == 0 && height0 == 0)) 1098 { 1099 width.append(QString("%1%2").arg(cmp0).arg(width0)); 1100 height.append(QString("%1%2").arg(cmp0).arg(height0)); 1101 if (!cmp1.isEmpty()) 1102 { 1103 width.append("&"); 1104 height.append("&"); 1105 } 1106 } 1107 if (!cmp1.isEmpty() 1108 && ! (cmp1 == ">" && width1 == 0 && height1 == 0)) 1109 { 1110 width.append(QString("%1%2").arg(cmp1).arg(width1)); 1111 height.append(QString("%1%2").arg(cmp1).arg(height1)); 1112 } 1113 CreateProfile( 1114 groupid, priority, 1115 width, height, QString(), 1116 decoder, max_cpus, skiploop, videorenderer, 1117 osdrenderer, osdfade, 1118 deint0, deint1, filters); 1119 } 1072 1120 1073 if (cmp0.isEmpty() && cmp1.isEmpty()) 1074 return; 1121 // New Style 1122 void VideoDisplayProfile::CreateProfile( 1123 uint groupid, uint priority, 1124 QString width, QString height, QString codecs, 1125 QString decoder, uint max_cpus, bool skiploop, QString videorenderer, 1126 QString osdrenderer, bool osdfade, 1127 QString deint0, QString deint1, QString filters) 1128 { 1129 MSqlQuery query(MSqlQuery::InitCon()); 1075 1130 1076 1131 // create new profileid 1077 1132 uint profileid = 1; … … void VideoDisplayProfile::CreateProfile( 1092 1147 QStringList queryValue; 1093 1148 QStringList queryData; 1094 1149 1095 if (!cmp0.isEmpty()) 1096 { 1097 queryValue += "pref_cmp0"; 1098 queryData += QString("%1 %2 %3").arg(cmp0).arg(width0).arg(height0); 1099 } 1150 queryValue += "cond_width"; 1151 queryData += width; 1100 1152 1101 if (!cmp1.isEmpty())1102 {1103 queryValue += QString("pref_cmp%1").arg(cmp0.isEmpty() ? 0 : 1); 1104 queryData += QString("%1 %2 %3").arg(cmp1).arg(width1).arg(height1);1105 }1153 queryValue += "cond_height"; 1154 queryData += height; 1155 1156 queryValue += "cond_codecs"; 1157 queryData += codecs; 1106 1158 1107 1159 queryValue += "pref_decoder"; 1108 1160 queryData += decoder; … … void VideoDisplayProfile::CreateProfile( 1135 1187 QStringList::const_iterator itD = queryData.begin(); 1136 1188 for (; itV != queryValue.end() && itD != queryData.end(); ++itV,++itD) 1137 1189 { 1190 if (itD->isEmpty()) 1191 continue; 1138 1192 query.prepare( 1139 1193 "INSERT INTO displayprofiles " 1140 1194 "VALUES (:GRPID, :PROFID, :VALUE, :DATA)"); 1141 1195 query.bindValue(":GRPID", groupid); 1142 1196 query.bindValue(":PROFID", profileid); 1143 1197 query.bindValue(":VALUE", *itV); 1144 query.bindValue(":DATA", ((*itD).isNull()) ? "" : (*itD));1198 query.bindValue(":DATA", *itD); 1145 1199 if (!query.exec()) 1146 1200 MythDB::DBError("create_profile 3", query); 1147 1201 } -
mythtv/libs/libmythtv/videodisplayprofile.h
diff --git a/mythtv/libs/libmythtv/videodisplayprofile.h b/mythtv/libs/libmythtv/videodisplayprofile.h index a1f00ad..66012cf 100644
a b class MTV_PUBLIC VideoDisplayProfile 151 151 QString osdrenderer, bool osdfade, 152 152 QString deint0, QString deint1, QString filters); 153 153 154 static void CreateProfile( 155 uint groupid, uint priority, 156 QString width, QString height, QString codecs, 157 QString decoder, uint max_cpus, bool skiploop, QString videorenderer, 158 QString osdrenderer, bool osdfade, 159 QString deint0, QString deint1, QString filters); 160 154 161 static void DeleteProfiles(const QString &hostname); 155 162 static void CreateProfiles(const QString &hostname); 156 163 static void CreateNewProfiles(const QString &hostname); -
mythtv/programs/mythfrontend/globalsettings.cpp
diff --git a/mythtv/programs/mythfrontend/globalsettings.cpp b/mythtv/programs/mythfrontend/globalsettings.cpp index df925df..8340bce 100644
a b PlaybackProfileItemConfig::PlaybackProfileItemConfig( 629 629 PlaybackProfileConfig *parent, uint idx, ProfileItem &_item) : 630 630 item(_item), parentConfig(parent), index(idx) 631 631 { 632 GroupSetting *row[2]; 633 634 row[0] = new GroupSetting(); 635 cmp[0] = new TransMythUIComboBoxSetting(); 636 width[0] = new TransMythUISpinBoxSetting(0, 1920, 8, 8); 637 height[0] = new TransMythUISpinBoxSetting(0, 1080, 8, 8); 638 row[1] = new GroupSetting(); 639 cmp[1] = new TransMythUIComboBoxSetting(); 640 width[1] = new TransMythUISpinBoxSetting(0, 1920, 8, 8); 641 height[1] = new TransMythUISpinBoxSetting(0, 1080, 8, 8); 642 // Possible future replacement for above 643 // width_range = new TransTextEditSetting(); 644 // height_range = new TransTextEditSetting(); 632 width_range = new TransTextEditSetting(); 633 height_range = new TransTextEditSetting(); 645 634 codecs = new TransMythUIComboBoxSetting(true); 646 635 framerate = new TransTextEditSetting(); 647 636 decoder = new TransMythUIComboBoxSetting(); … … PlaybackProfileItemConfig::PlaybackProfileItemConfig( 654 643 deint1 = new TransMythUIComboBoxSetting(); 655 644 filters = new TransTextEditSetting(); 656 645 657 for (uint i = 0; i < 2; ++i) 658 { 659 const QString kCMP[6] = { "", "<", "<=", "==", ">=", ">" }; 660 for (uint j = 0; j < 6; ++j) 661 cmp[i]->addSelection(kCMP[j]); 662 663 cmp[i]->setLabel(tr("Match criteria")); 664 width[i]->setLabel(tr("Width")); 665 height[i]->setLabel(tr("Height")); 666 667 row[i]->setLabel(tr("Match criteria")); 668 row[i]->setHelpText(tr("Optional setting to restrict this profile " 669 "to a selected picture size range. If both match criteria are used " 670 "then both must be satisfied for the entry to be selected.")); 671 row[i]->addChild(cmp[i]); 672 row[i]->addChild(width[i]); 673 row[i]->addChild(height[i]); 674 } 646 const QString rangeHelp(tr(" Valid formats for the setting are " 647 "[nnnn - nnnn], [> nnnn], [>= nnnn], [< nnnn], " 648 "[<= nnnn]. Also [nnnn] for an exact match. " 649 "You can also use more than 1 expression with & between.")); 650 const QString rangeHelpDec(tr("Numbers can have up to 3 decimal places.")); 651 width_range->setLabel(tr("Width Range")); 652 width_range->setHelpText(tr("Optional setting to restrict this profile " 653 "to videos with a selected width range. ") + rangeHelp); 654 height_range->setLabel(tr("Height Range")); 655 height_range->setHelpText(tr("Optional setting to restrict this profile " 656 "to videos with a selected height range. ") + rangeHelp); 675 657 codecs->setLabel(tr("Video Formats")); 676 658 codecs->addSelection("","",true); 677 659 codecs->addSelection("mpeg2video"); … … PlaybackProfileItemConfig::PlaybackProfileItemConfig( 686 668 "of available formats with ffmpeg -codecs.")); 687 669 framerate->setLabel(tr("Frame Rate Range")); 688 670 framerate->setHelpText(tr("Optional setting to restrict this profile " 689 "to a range of frame rates. Valid formats for the setting are " 690 "[nn.nnn - nn.nnn], [> nn.nnn], [>= nn.nnn], [< nn.nnn], " 691 "[<= nn.nnn]. Also [nn.nnn] for an exact match.")); 671 "to a range of frame rates. ") + rangeHelp +" "+rangeHelpDec); 692 672 decoder->setLabel(tr("Decoder")); 693 673 max_cpus->setLabel(tr("Max CPUs")); 694 674 skiploop->setLabel(tr("Deblocking filter")); … … PlaybackProfileItemConfig::PlaybackProfileItemConfig( 720 700 tr("Uncheck this if the video studders while the OSD is " 721 701 "fading away.")); 722 702 723 addChild( row[0]);724 addChild( row[1]);703 addChild(width_range); 704 addChild(height_range); 725 705 addChild(codecs); 726 706 addChild(framerate); 727 707 addChild(decoder); … … PlaybackProfileItemConfig::PlaybackProfileItemConfig( 735 715 addChild(deint1); 736 716 addChild(filters); 737 717 718 connect(width_range, SIGNAL(valueChanged(const QString&)), 719 this, SLOT(widthChanged(const QString&))); 720 connect(height_range, SIGNAL(valueChanged(const QString&)), 721 this, SLOT(heightChanged(const QString&))); 722 connect(codecs, SIGNAL(valueChanged(const QString&)), 723 this, SLOT(InitLabel())); 738 724 connect(framerate, SIGNAL(valueChanged(const QString&)), 739 725 this, SLOT(framerateChanged(const QString&))); 740 726 connect(decoder, SIGNAL(valueChanged(const QString&)), … … PlaybackProfileItemConfig::PlaybackProfileItemConfig( 747 733 this, SLOT(deint0Changed(const QString&))); 748 734 connect(deint1, SIGNAL(valueChanged(const QString&)), 749 735 this, SLOT(deint1Changed(const QString&))); 750 751 for (uint i = 0; i < 2; ++i)752 {753 connect(cmp[i], SIGNAL(valueChanged(const QString&)),754 SLOT(InitLabel()));755 connect(height[i], SIGNAL(valueChanged(const QString&)),756 SLOT(InitLabel()));757 connect(width[i], SIGNAL(valueChanged(const QString&)),758 SLOT(InitLabel()));759 }760 736 } 761 737 762 738 uint PlaybackProfileItemConfig::GetIndex(void) const … … uint PlaybackProfileItemConfig::GetIndex(void) const 766 742 767 743 void PlaybackProfileItemConfig::Load(void) 768 744 { 745 QString width_value; 746 QString height_value; 747 // pref_cmp0 and pref_cmp1 are no longer used. This code 748 // is here to convery them to the new settings cond_width 749 // and cond_height 769 750 for (uint i = 0; i < 2; ++i) 770 751 { 771 752 QString pcmp = item.Get(QString("pref_cmp%1").arg(i)); 753 if (pcmp == "> 0 0") 754 continue; 772 755 QStringList clist = pcmp.split(" "); 773 756 774 if (clist.size() == 0) 775 clist<<((i) ? "" : ">"); 776 if (clist.size() == 1) 777 clist<<"0"; 778 if (clist.size() == 2) 779 clist<<"0"; 757 if (clist.size() < 3) 758 continue; 759 if (!width_value.isEmpty()) 760 { 761 width_value.append("&"); 762 height_value.append("&"); 763 } 764 width_value.append(clist[0]+clist[1]); 765 height_value.append(clist[0]+clist[2]); 766 } 780 767 781 cmp[i]->setValue(clist[0]); 782 width[i]->setValue(clist[1]); 783 height[i]->setValue(clist[2]); 768 QString tmp = item.Get("cond_width").trimmed(); 769 if (!tmp.isEmpty()) 770 { 771 if (!width_value.isEmpty()) 772 width_value.append("&"); 773 width_value.append(tmp); 774 } 775 tmp = item.Get("cond_height").trimmed(); 776 if (!tmp.isEmpty()) 777 { 778 if (!height_value.isEmpty()) 779 height_value.append("&"); 780 height_value.append(tmp); 784 781 } 785 782 783 width_range->setValue(width_value); 784 height_range->setValue(height_value); 786 785 codecs->setValue(item.Get("cond_codecs")); 787 786 framerate->setValue(item.Get("cond_framerate")); 788 787 … … void PlaybackProfileItemConfig::Load(void) 839 838 840 839 void PlaybackProfileItemConfig::Save(void) 841 840 { 842 for (uint i = 0; i < 2; ++i) 843 { 844 QString val = QString("pref_cmp%1").arg(i); 845 QString data; 846 if (!cmp[i]->getValue().isEmpty()) 847 { 848 data = QString("%1 %2 %3") 849 .arg(cmp[i]->getValue()) 850 .arg(width[i]->intValue()) 851 .arg(height[i]->intValue()); 852 } 853 item.Set(val, data); 854 } 855 841 item.Set("pref_cmp0", QString()); 842 item.Set("pref_cmp1", QString()); 843 item.Set("cond_width", width_range->getValue()); 844 item.Set("cond_height", height_range->getValue()); 856 845 item.Set("cond_codecs", codecs->getValue()); 857 846 item.Set("cond_framerate", framerate->getValue()); 858 847 item.Set("pref_decoder", decoder->getValue()); … … void PlaybackProfileItemConfig::Save(void) 870 859 item.Set("pref_filters", tmp3); 871 860 } 872 861 862 void PlaybackProfileItemConfig::widthChanged(const QString &val) 863 { 864 bool ok = true; 865 QString oldvalue = item.Get("cond_width"); 866 item.Set("cond_width",val); 867 item.checkRange("cond_width", 640, &ok); 868 if (!ok) 869 { 870 ShowOkPopup(tr("Invalid width specification(%1), discarded").arg(val)); 871 width_range->setValue(oldvalue); 872 } 873 InitLabel(); 874 } 875 876 void PlaybackProfileItemConfig::heightChanged(const QString &val) 877 { 878 bool ok = true; 879 QString oldvalue = item.Get("cond_height"); 880 item.Set("cond_height",val); 881 item.checkRange("cond_height", 480, &ok); 882 if (!ok) 883 { 884 ShowOkPopup(tr("Invalid height specification(%1), discarded").arg(val)); 885 height_range->setValue(oldvalue); 886 } 887 InitLabel(); 888 } 889 873 890 void PlaybackProfileItemConfig::framerateChanged(const QString &val) 874 891 { 875 892 bool ok = true; … … void PlaybackProfileItemConfig::framerateChanged(const QString &val) 881 898 ShowOkPopup(tr("Invalid frame rate specification(%1), discarded").arg(val)); 882 899 framerate->setValue(oldvalue); 883 900 } 901 InitLabel(); 884 902 } 885 903 886 904 void PlaybackProfileItemConfig::decoderChanged(const QString &dec) … … PlaybackProfileConfig::~PlaybackProfileConfig() 1032 1050 void PlaybackProfileItemConfig::InitLabel(void) 1033 1051 { 1034 1052 QString andStr = tr("&", "and"); 1035 QString cmp0 = QString("%1 %2 %3").arg(cmp[0]->getValue())1036 .arg(width[0]->intValue())1037 .arg(height[0]->intValue());1038 QString cmp1 = QString("%1 %2 %3").arg(cmp[1]->getValue())1039 .arg(width[1]->intValue())1040 .arg(height[1]->intValue());1041 1042 1053 QString str; 1043 if (!cmp[0]->getValue().isEmpty() 1044 || !cmp[1]->getValue().isEmpty())1045 {1046 str = PlaybackProfileConfig::tr("if rez") + ' ' + cmp0;1047 if (!cmp[1]->getValue().isEmpty())1048 str += " " + andStr + ' ' + cmp1;1049 }1054 1055 QString width = width_range->getValue(); 1056 if (!width.isEmpty()) 1057 str += " " + tr("width","video formats") + " " + width; 1058 QString height = height_range->getValue(); 1059 if (!height.isEmpty()) 1060 str += " " + tr("height","video formats") + " " + height; 1050 1061 1051 1062 QString codecsval = codecs->getValue(); 1052 1063 if (!codecsval.isEmpty()) -
mythtv/programs/mythfrontend/globalsettings.h
diff --git a/mythtv/programs/mythfrontend/globalsettings.h b/mythtv/programs/mythfrontend/globalsettings.h index e069ec1..39f8fee 100644
a b class PlaybackProfileItemConfig : public GroupSetting 192 192 void IncreasePriority(void); 193 193 194 194 private slots: 195 void widthChanged(const QString &dec); 196 void heightChanged(const QString &dec); 195 197 void framerateChanged(const QString &dec); 196 198 void decoderChanged(const QString &dec); 197 199 void vrenderChanged(const QString &renderer); … … class PlaybackProfileItemConfig : public GroupSetting 203 205 204 206 private: 205 207 ProfileItem &item; 206 TransMythUIComboBoxSetting *cmp[2];207 TransMythUISpinBoxSetting *width[2];208 TransMythUISpinBoxSetting *height[2];209 208 TransTextEditSetting *width_range; 210 209 TransTextEditSetting *height_range; 211 210 MythUIComboBoxSetting *codecs;