Skip to content

Commit

Permalink
Revert "Recording profile optimisations (part one)."
Browse files Browse the repository at this point in the history
This reverts commit 6dd9b789206174e9632c0fbb7c965e9de4d7e74c.

Something's not working exactly as it should.
  • Loading branch information
stuartm committed Dec 10, 2010
1 parent e02136a commit e33d164
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 54 deletions.
93 changes: 40 additions & 53 deletions mythtv/libs/libmythtv/recordingprofile.cpp
Expand Up @@ -1268,7 +1268,35 @@ void RecordingProfile::loadByID(int profileId)
isEncoder = CardUtil::IsEncoder(type);
}

CompleteLoad(profileId, type);
if (isEncoder)
{
QString tvFormat = gCoreContext->GetSetting("TVFormat");
if (type.toUpper() != "HDPVR")
addChild(new ImageSize(*this, tvFormat, profileName));

videoSettings = new VideoCompressionSettings(*this, profileName);
addChild(videoSettings);

audioSettings = new AudioCompressionSettings(*this, profileName);
addChild(audioSettings);

if (!profileName.isEmpty() && profileName.left(11) == "Transcoders")
{
connect(tr_resize, SIGNAL(valueChanged (bool)),
this, SLOT( ResizeTranscode(bool)));
connect(tr_lossless, SIGNAL(valueChanged (bool)),
this, SLOT( SetLosslessTranscode(bool)));
connect(tr_filters, SIGNAL(valueChanged(const QString&)),
this, SLOT(FiltersChanged(const QString&)));
}
}
else if (type.toUpper() == "DVB")
{
addChild(new RecordingType(*this));
}

id->setValue(profileId);
Load();
}

void RecordingProfile::FiltersChanged(const QString &val)
Expand All @@ -1291,7 +1319,7 @@ void RecordingProfile::FiltersChanged(const QString &val)
bool RecordingProfile::loadByType(const QString &name, const QString &cardtype)
{
QString hostname = gCoreContext->GetHostName().toLower();
uint profileId = 0;
uint recid = 0;

MSqlQuery result(MSqlQuery::InitCon());
result.prepare(
Expand All @@ -1312,22 +1340,20 @@ bool RecordingProfile::loadByType(const QString &name, const QString &cardtype)

while (result.next())
{
if ((result.value(1).toString().toLower() == hostname) ||
(result.value(2).toInt() == 1))
{
profileId = result.value(0).toUInt();

if (result.value(1).toString().toLower() == hostname)
{
recid = result.value(0).toUInt();
break;
}
else if (result.value(2).toInt() == 1)
{
recid = result.value(0).toUInt();
}
}

if (profileId)
if (recid)
{
if (profileName.isEmpty())
profileName = name;
isEncoder = CardUtil::IsEncoder(cardtype);
CompleteLoad(profileId, cardtype);
loadByID(recid);
return true;
}

Expand All @@ -1338,7 +1364,7 @@ bool RecordingProfile::loadByGroup(const QString &name, const QString &group)
{
MSqlQuery result(MSqlQuery::InitCon());
result.prepare(
"SELECT recordingprofiles.id, cardtype "
"SELECT recordingprofiles.id "
"FROM recordingprofiles, profilegroups "
"WHERE recordingprofiles.profilegroup = profilegroups.id AND "
" profilegroups.name = :GROUPNAME AND "
Expand All @@ -1354,52 +1380,13 @@ bool RecordingProfile::loadByGroup(const QString &name, const QString &group)

if (result.next())
{
uint profileId = result.value(0).toUInt();
QString type = result.value(1).toString();

if (profileName.isEmpty())
profileName = name;
isEncoder = CardUtil::IsEncoder(type);
CompleteLoad(profileId, type);
loadByID(result.value(0).toUInt());
return true;
}

return false;
}

void RecordingProfile::CompleteLoad(int profileId, QString type)
{
if (isEncoder)
{
QString tvFormat = gCoreContext->GetSetting("TVFormat");
if (type.toUpper() != "HDPVR")
addChild(new ImageSize(*this, tvFormat, profileName));

videoSettings = new VideoCompressionSettings(*this, profileName);
addChild(videoSettings);

audioSettings = new AudioCompressionSettings(*this, profileName);
addChild(audioSettings);

if (!profileName.isEmpty() && profileName.left(11) == "Transcoders")
{
connect(tr_resize, SIGNAL(valueChanged (bool)),
this, SLOT( ResizeTranscode(bool)));
connect(tr_lossless, SIGNAL(valueChanged (bool)),
this, SLOT( SetLosslessTranscode(bool)));
connect(tr_filters, SIGNAL(valueChanged(const QString&)),
this, SLOT(FiltersChanged(const QString&)));
}
}
else if (type.toUpper() == "DVB")
{
addChild(new RecordingType(*this));
}

id->setValue(profileId);
Load();
}

void RecordingProfile::setCodecTypes()
{
if (videoSettings)
Expand Down
1 change: 0 additions & 1 deletion mythtv/libs/libmythtv/recordingprofile.h
Expand Up @@ -88,7 +88,6 @@ class MPUBLIC RecordingProfile : public QObject, public ConfigurationWizard
virtual void loadByID(int id);
virtual bool loadByType(const QString &name, const QString &cardtype);
virtual bool loadByGroup(const QString &name, const QString &group);
virtual void CompleteLoad(int profileId, QString type);
virtual DialogCode exec(void);

// sets
Expand Down

0 comments on commit e33d164

Please sign in to comment.