Ticket #8778: recprofile.diff
File recprofile.diff, 5.7 KB (added by , 14 years ago) |
---|
-
mythtv/libs/libmythtv/recordingprofile.cpp
1267 1267 isEncoder = CardUtil::IsEncoder(type); 1268 1268 } 1269 1269 1270 if (isEncoder) 1271 { 1272 QString tvFormat = gCoreContext->GetSetting("TVFormat"); 1273 if (type.toUpper() != "HDPVR") 1274 addChild(new ImageSize(*this, tvFormat, profileName)); 1275 1276 videoSettings = new VideoCompressionSettings(*this, profileName); 1277 addChild(videoSettings); 1278 1279 audioSettings = new AudioCompressionSettings(*this, profileName); 1280 addChild(audioSettings); 1281 1282 if (!profileName.isEmpty() && profileName.left(11) == "Transcoders") 1283 { 1284 connect(tr_resize, SIGNAL(valueChanged (bool)), 1285 this, SLOT( ResizeTranscode(bool))); 1286 connect(tr_lossless, SIGNAL(valueChanged (bool)), 1287 this, SLOT( SetLosslessTranscode(bool))); 1288 connect(tr_filters, SIGNAL(valueChanged(const QString&)), 1289 this, SLOT(FiltersChanged(const QString&))); 1270 CompleteLoad(profileId, type); 1290 1271 } 1291 }1292 else if (type.toUpper() == "DVB")1293 {1294 addChild(new RecordingType(*this));1295 }1296 1272 1297 id->setValue(profileId);1298 Load();1299 }1300 1273 1301 void RecordingProfile::FiltersChanged(const QString &val)1302 {1303 if (!tr_filters || !tr_lossless)1304 return;1305 1306 // If there are filters, we can not do lossless transcoding1307 if (!val.trimmed().isEmpty())1308 {1309 tr_lossless->setValue(false);1310 tr_lossless->setEnabled(false);1311 }1312 else1313 {1314 tr_lossless->setEnabled(true);1315 }1316 }1317 1318 1274 bool RecordingProfile::loadByType(const QString &name, const QString &cardtype) 1319 1275 { 1320 1276 QString hostname = gCoreContext->GetHostName().toLower(); 1321 uint recid = 0;1277 uint profileId = 0; 1322 1278 1323 1279 MSqlQuery result(MSqlQuery::InitCon()); 1324 1280 result.prepare( … … 1339 1295 1340 1296 while (result.next()) 1341 1297 { 1298 if ((result.value(1).toString().toLower() == hostname) || 1299 (result.value(2).toInt() == 1)) 1300 { 1301 profileId = result.value(0).toUInt(); 1302 1342 1303 if (result.value(1).toString().toLower() == hostname) 1343 {1344 recid = result.value(0).toUInt();1345 1304 break; 1346 1305 } 1347 else if (result.value(2).toInt() == 1)1348 {1349 recid = result.value(0).toUInt();1350 1306 } 1351 }1352 1307 1353 if ( recid)1308 if (profileId) 1354 1309 { 1355 loadByID(recid); 1310 if (profileName.isEmpty()) 1311 profileName = name; 1312 isEncoder = CardUtil::IsEncoder(cardtype); 1313 CompleteLoad(profileId, cardtype); 1356 1314 return true; 1357 1315 } 1358 1316 … … 1363 1321 { 1364 1322 MSqlQuery result(MSqlQuery::InitCon()); 1365 1323 result.prepare( 1366 "SELECT recordingprofiles.id "1324 "SELECT recordingprofiles.id, cardtype " 1367 1325 "FROM recordingprofiles, profilegroups " 1368 1326 "WHERE recordingprofiles.profilegroup = profilegroups.id AND " 1369 1327 " profilegroups.name = :GROUPNAME AND " … … 1379 1337 1380 1338 if (result.next()) 1381 1339 { 1382 loadByID(result.value(0).toUInt()); 1340 uint profileId = result.value(0).toUInt(); 1341 QString type = result.value(1).toString(); 1342 1343 if (profileName.isEmpty()) 1344 profileName = name; 1345 isEncoder = CardUtil::IsEncoder(type); 1346 CompleteLoad(profileId, type); 1383 1347 return true; 1384 1348 } 1385 1349 1386 1350 return false; 1387 1351 } 1388 1352 1353 void RecordingProfile::CompleteLoad(int profileId, QString type) 1354 { 1355 if (isEncoder) 1356 { 1357 QString tvFormat = gCoreContext->GetSetting("TVFormat"); 1358 if (type.toUpper() != "HDPVR") 1359 addChild(new ImageSize(*this, tvFormat, profileName)); 1360 1361 videoSettings = new VideoCompressionSettings(*this, profileName); 1362 addChild(videoSettings); 1363 1364 audioSettings = new AudioCompressionSettings(*this, profileName); 1365 addChild(audioSettings); 1366 1367 if (!profileName.isEmpty() && profileName.left(11) == "Transcoders") 1368 { 1369 connect(tr_resize, SIGNAL(valueChanged (bool)), 1370 this, SLOT( ResizeTranscode(bool))); 1371 connect(tr_lossless, SIGNAL(valueChanged (bool)), 1372 this, SLOT( SetLosslessTranscode(bool))); 1373 connect(tr_filters, SIGNAL(valueChanged(const QString&)), 1374 this, SLOT(FiltersChanged(const QString&))); 1375 } 1376 } 1377 else if (type.toUpper() == "DVB") 1378 { 1379 addChild(new RecordingType(*this)); 1380 } 1381 1382 id->setValue(profileId); 1383 Load(); 1384 } 1385 1386 void RecordingProfile::FiltersChanged(const QString &val) 1387 { 1388 if (!tr_filters || !tr_lossless) 1389 return; 1390 1391 // If there are filters, we can not do lossless transcoding 1392 if (!val.trimmed().isEmpty()) 1393 { 1394 tr_lossless->setValue(false); 1395 tr_lossless->setEnabled(false); 1396 } 1397 else 1398 { 1399 tr_lossless->setEnabled(true); 1400 } 1401 } 1402 1389 1403 void RecordingProfile::setCodecTypes() 1390 1404 { 1391 1405 if (videoSettings) -
mythtv/libs/libmythtv/recordingprofile.h
88 88 virtual void loadByID(int id); 89 89 virtual bool loadByType(const QString &name, const QString &cardtype); 90 90 virtual bool loadByGroup(const QString &name, const QString &group); 91 virtual void CompleteLoad(int profileId, QString type); 91 92 virtual DialogCode exec(void); 92 93 93 94 // sets