Ticket #4631: 4631-v1.patch

File 4631-v1.patch, 10.1 KB (added by danielk, 16 years ago)

Creates new profiles "High Quality", "Normal", & "Slim" -- plus adds QObject::tr() for the default profile names.

  • libs/libmythtv/dbcheck.cpp

     
    1010#include "mythdbcon.h"
    1111#include "datadirect.h" // for DataDirectProcessor::FixProgramIDs
    1212#include "dbutil.h"
     13#include "videodisplayprofile.h" // for "1214"
    1314
    1415#define MINIMUM_DBMS_VERSION 5
    1516
    1617/// This is the DB schema version expected by the running MythTV instance.
    17 const QString currentDatabaseVersion = "1213";
     18const QString currentDatabaseVersion = "1214";
    1819
    1920static bool UpdateDBVersionNumber(const QString &newnumber);
    2021static bool performActualUpdate(const QString updates[], QString version,
     
    35793580        return false;
    35803581    }
    35813582
     3583    if (dbver == "1213")
     3584    {
     3585        VERBOSE(VB_IMPORTANT, "In 1213 upg");
     3586        MSqlQuery query(MSqlQuery::InitCon());
     3587        query.prepare("SELECT hostname "
     3588                      "FROM displayprofilegroups "
     3589                      "GROUP BY hostname");
     3590        bool ok = query.exec();
     3591        while (ok && query.next())
     3592        {
     3593            QString host = query.value(0).toString();
     3594            QStringList profiles = VideoDisplayProfile::GetProfiles(host);
     3595            if (profiles.contains("High Quality") &&
     3596                profiles.contains("Normal") &&
     3597                profiles.contains("Slim"))
     3598            {
     3599                continue;
     3600            }
     3601
     3602            VideoDisplayProfile::CreateNewProfiles(host);
     3603            profiles = VideoDisplayProfile::GetProfiles(host);
     3604            QString profile = VideoDisplayProfile::GetDefaultProfileName(host);
     3605
     3606            VERBOSE(VB_IMPORTANT, QString("In 1213 upg(%1): p %2")
     3607                    .arg(host).arg(profile));
     3608
     3609            if (profiles.contains("Normal") &&
     3610                (profile=="CPU++" || profile=="CPU+" || profile=="CPU--"))
     3611            {
     3612                VideoDisplayProfile::SetDefaultProfileName("Normal", host);
     3613            }
     3614        }
     3615
     3616        const QString updates[] = { "" };
     3617        if (!performActualUpdate(updates, "1214", dbver))
     3618            return false;
     3619    }
     3620
     3621
    35823622//"ALTER TABLE cardinput DROP COLUMN preference;" in 0.22
    35833623//"ALTER TABLE channel DROP COLUMN atscsrcid;" in 0.22
    35843624//"ALTER TABLE recordedmarkup DROP COLUMN offset;" in 0.22
  • libs/libmythtv/videodisplayprofile.h

     
    131131
    132132    static void        DeleteProfiles(const QString &hostname);
    133133    static void        CreateProfiles(const QString &hostname);
     134    static void        CreateOldProfiles(const QString &hostname);
     135    static void        CreateNewProfiles(const QString &hostname);
    134136
    135137    static QStringList GetVideoRenderers(const QString &decoder);
    136138    static QString     GetVideoRendererHelp(const QString &renderer);
  • libs/libmythtv/videodisplayprofile.cpp

     
    902902bool VideoDisplayProfile::DeleteProfileGroup(
    903903    const QString &groupname, const QString &hostname)
    904904{
     905    bool ok = true;
    905906    MSqlQuery query(MSqlQuery::InitCon());
     907    MSqlQuery query2(MSqlQuery::InitCon());
     908
    906909    query.prepare(
     910        "SELECT profilegroupid "
     911        "FROM displayprofilegroups "
     912        "WHERE name     = :NAME AND "
     913        "      hostname = :HOST ");
     914
     915    query.bindValue(":NAME", groupname);
     916    query.bindValue(":HOST", hostname);
     917
     918    if (!query.exec() || !query.isActive())
     919    {
     920        MythContext::DBError("delete_profile_group 1", query);
     921        ok = false;
     922    }
     923    else
     924    {
     925        while (query.next())
     926        {
     927            query2.prepare("DELETE FROM displayprofiles "
     928                           "WHERE profilegroupid = :PROFID");
     929            query2.bindValue(":PROFID", query.value(0).toUInt());
     930            if (!query2.exec())
     931            {
     932                MythContext::DBError("delete_profile_group 2", query2);
     933                ok = false;
     934            }
     935        }
     936    }
     937
     938    query.prepare(
    907939        "DELETE FROM displayprofilegroups "
    908940        "WHERE name     = :NAME AND "
    909941        "      hostname = :HOST");
     
    913945
    914946    if (!query.exec())
    915947    {
    916         MythContext::DBError("delete_profile_group", query);
    917         return false;
     948        MythContext::DBError("delete_profile_group 3", query);
     949        ok = false;
    918950    }
    919951
    920     return true;
     952    return ok;
    921953}
    922954
    923 void VideoDisplayProfile::CreateProfiles(const QString &hostname)
     955void VideoDisplayProfile::CreateOldProfiles(const QString &hostname)
    924956{
    925     DeleteProfiles(hostname);
    926 
     957    (void) QObject::tr("CPU++", "Sample: No hardware assist");
     958    DeleteProfileGroup("CPU++", hostname);
    927959    uint groupid = CreateProfileGroup("CPU++", hostname);
    928960    CreateProfile(groupid, 1, ">", 0, 0, "", 0, 0,
    929961                  "ffmpeg", 1, "xv-blit", "softblend", true,
     
    932964                  "ffmpeg", 1, "quartz-blit", "softblend", true,
    933965                  "linearblend", "linearblend", "");
    934966
     967    (void) QObject::tr("CPU+", "Sample: Hardware assist HD only");
     968    DeleteProfileGroup("CPU+", hostname);
    935969    groupid = CreateProfileGroup("CPU+", hostname);
    936970    CreateProfile(groupid, 1, "<=", 720, 576, ">", 0, 0,
    937971                  "ffmpeg", 1, "xv-blit", "softblend", true,
     
    949983                  "libmpeg2", 1, "xv-blit", "chromakey", false,
    950984                  "bobdeint", "onefield", "");
    951985
     986    (void) QObject::tr("CPU--", "Sample: Hardware assist all");
     987    DeleteProfileGroup("CPU--", hostname);
    952988    groupid = CreateProfileGroup("CPU--", hostname);
    953989    CreateProfile(groupid, 1, "<=", 720, 576, ">", 0, 0,
    954990                  "ivtv", 1, "ivtv", "ivtv", true,
     
    9671003                  "none", "none", "");
    9681004}
    9691005
     1006void VideoDisplayProfile::CreateNewProfiles(const QString &hostname)
     1007{
     1008    (void) QObject::tr("High Quality", "Sample: high quality");
     1009    DeleteProfileGroup("High Quality", hostname);
     1010    uint groupid = CreateProfileGroup("High Quality", hostname);
     1011    CreateProfile(groupid, 1, ">=", 1920, 1080, "", 0, 0,
     1012                  "ffmpeg", 2, "xv-blit", "softblend", true,
     1013                  "linearblend", "linearblend", "");
     1014    CreateProfile(groupid, 2, ">", 0, 0, "", 0, 0,
     1015                  "ffmpeg", 1, "xv-blit", "softblend", true,
     1016                  "yadifdoubleprocessdeint", "yadifdeint", "");
     1017    CreateProfile(groupid, 3, ">=", 1920, 1080, "", 0, 0,
     1018                  "ffmpeg", 2, "quartz-blit", "softblend", true,
     1019                  "linearblend", "linearblend", "");
     1020    CreateProfile(groupid, 4, ">", 0, 0, "", 0, 0,
     1021                  "ffmpeg", 1, "quartz-blit", "softblend", true,
     1022                  "yadifdoubleprocessdeint", "yadifdeint", "");
     1023
     1024    (void) QObject::tr("Normal", "Sample: average quality");
     1025    DeleteProfileGroup("Normal", hostname);
     1026    groupid = CreateProfileGroup("Normal", hostname);
     1027    CreateProfile(groupid, 1, ">=", 1280, 720, "", 0, 0,
     1028                  "ffmpeg", 1, "xv-blit", "softblend", false,
     1029                  "linearblend", "linearblend", "");
     1030    CreateProfile(groupid, 2, ">", 0, 0, "", 0, 0,
     1031                  "ffmpeg", 1, "xv-blit", "softblend", true,
     1032                  "greedyhdoubleprocessdeint", "kerneldeint", "");
     1033    CreateProfile(groupid, 3, ">=", 1280, 720, "", 0, 0,
     1034                  "ffmpeg", 1, "quartz-blit", "softblend", false,
     1035                  "linearblend", "linearblend", "");
     1036    CreateProfile(groupid, 4, ">", 0, 0, "", 0, 0,
     1037                  "ffmpeg", 1, "quartz-blit", "softblend", true,
     1038                  "greedyhdoubleprocessdeint", "kerneldeint", "");
     1039
     1040    (void) QObject::tr("Normal", "Sample: low CPU usage");
     1041    DeleteProfileGroup("Slim", hostname);
     1042    groupid = CreateProfileGroup("Slim", hostname);
     1043    CreateProfile(groupid, 1, ">=", 1280, 720, "", 0, 0,
     1044                  "ffmpeg", 1, "xv-blit", "softblend", false,
     1045                  "onefield", "onefield", "");
     1046    CreateProfile(groupid, 2, ">", 0, 0, "", 0, 0,
     1047                  "ffmpeg", 1, "xv-blit", "softblend", true,
     1048                  "linearblend", "linearblend", "");
     1049    CreateProfile(groupid, 3, ">=", 1280, 720, "", 0, 0,
     1050                  "ffmpeg", 1, "quartz-blit", "softblend", false,
     1051                  "onefield", "onefield", "");
     1052    CreateProfile(groupid, 4, ">", 0, 0, "", 0, 0,
     1053                  "ffmpeg", 1, "quartz-blit", "softblend", true,
     1054                  "linearblend", "linearblend", "");
     1055}
     1056
     1057void VideoDisplayProfile::CreateProfiles(const QString &hostname)
     1058{
     1059    CreateOldProfiles(hostname);
     1060    CreateNewProfiles(hostname);
     1061}
     1062
    9701063QStringList VideoDisplayProfile::GetVideoRenderers(const QString &decoder)
    9711064{
    9721065    QMutexLocker locker(&safe_lock);
  • programs/mythfrontend/globalsettings.cpp

     
    13611361    if (profiles.empty())
    13621362        return;
    13631363
     1364    if (!profiles.contains("Normal") &&
     1365        !profiles.contains("High Quality") &&
     1366        !profiles.contains("Slim"))
     1367    {
     1368        VideoDisplayProfile::CreateNewProfiles(host);
     1369        profiles = VideoDisplayProfile::GetProfiles(host);
     1370    }
     1371
    13641372    QString profile = VideoDisplayProfile::GetDefaultProfileName(host);
    13651373    if (!profiles.contains(profile))
    13661374    {
    1367         profile = profiles[0];
     1375        profile = (profiles.contains("Normal")) ? "Normal" : profiles[0];
    13681376        VideoDisplayProfile::SetDefaultProfileName(profile, host);
    13691377    }
    13701378
     
    13721380    grouptrigger->setLabel(QObject::tr("Current Video Playback Profile"));
    13731381    QStringList::const_iterator it;
    13741382    for (it = profiles.begin(); it != profiles.end(); it++)
    1375         grouptrigger->addSelection(*it);
     1383        grouptrigger->addSelection(QObject::tr(*it), *it);
    13761384
    13771385    HorizontalConfigurationGroup *grp =
    13781386        new HorizontalConfigurationGroup(false, false, true, true);