Ticket #8088: 8088_playgroups_v15.patch

File 8088_playgroups_v15.patch, 113.5 KB (added by Jim Stichnoth <stichnot@…>, 9 years ago)
  • libs/libmythtv/videoout_vdpau.h

    Cannot display: file marked as a binary type.
    svn:mime-type = application/octet-stream
     
    2020{
    2121  public:
    2222    static void GetRenderOptions(render_opts &opts);
    23     VideoOutputVDPAU(MythCodecID codec_id);
     23    VideoOutputVDPAU(PlaySettings *settings, MythCodecID codec_id);
    2424    ~VideoOutputVDPAU();
    2525    bool Init(int width, int height, float aspect, WId winid,
    2626              int winx, int winy, int winw, int winh, WId embedid = 0);
     
    5353                                    const QSize &video_dim);
    5454    static MythCodecID GetBestSupportedCodec(uint width, uint height,
    5555                                             uint stream_type,
    56                                              bool no_acceleration);
     56                                             bool no_acceleration,
     57                                             PlaySettings *settings);
    5758    DisplayInfo  GetDisplayInfo(void);
    5859    virtual bool IsPIPSupported(void) const { return true; }
    5960    virtual bool IsPBPSupported(void) const { return false; }
  • libs/libmythtv/NuppelVideoPlayer.cpp

     
    6161#include "mythpainter.h"
    6262#include "mythimage.h"
    6363#include "mythuiimage.h"
     64#include "playsettings.h"
    6465
    6566extern "C" {
    6667#include "vbitext/vbi.h"
     
    243244      output_jmeter(NULL)
    244245{
    245246    playerThread = QThread::currentThread();
    246     // Playback (output) zoom control
    247     detect_letter_box = new DetectLetterbox(this);
    248247
    249     vbimode = VBIMode::Parse(gCoreContext->GetSetting("VbiFormat"));
    250     decode_extra_audio = gCoreContext->GetNumSetting("DecodeExtraAudio", 0);
    251     itvEnabled         = gCoreContext->GetNumSetting("EnableMHEG", 0);
    252     db_prefer708       = gCoreContext->GetNumSetting("Prefer708Captions", 1);
    253 
    254248    bzero(&tc_lastval, sizeof(tc_lastval));
    255249    bzero(&tc_wrap,    sizeof(tc_wrap));
    256250
     
    481475
    482476    if (using_null_videoout)
    483477    {
    484         videoOutput = new VideoOutputNull();
     478        videoOutput = new VideoOutputNull(GetPlaySettings());
    485479        if (!videoOutput->Init(video_disp_dim.width(), video_disp_dim.height(),
    486480                               video_aspect, 0, 0, 0, 0, 0, 0))
    487481        {
     
    531525                pipState,
    532526                video_disp_dim, video_aspect,
    533527                widget->winId(), display_rect, (video_frame_rate * play_speed),
    534                 0 /*embedid*/);
     528                0 /*embedid*/, GetPlaySettings());
    535529        }
    536530
    537531        if (!videoOutput)
     
    620614
    621615void NuppelVideoPlayer::ReinitVideo(void)
    622616{
    623     if (!videoOutput->IsPreferredRenderer(video_disp_dim))
     617    if (!videoOutput->IsPreferredRenderer(video_disp_dim, GetPlaySettings()))
    624618    {
    625619        VERBOSE(VB_PLAYBACK, LOC + QString("Need to switch video renderer."));
    626620        SetErrored(QObject::tr("Need to switch video renderer."));
     
    19331927        }
    19341928#endif // USING_MHEG
    19351929
    1936         SetCaptionsEnabled(gCoreContext->GetNumSetting("DefaultCCMode"), false);
     1930        SetCaptionsEnabled(GetPlaySettings()->GetNumSetting("DefaultCCMode", 0),
     1931                           false);
    19371932    }
    19381933
    19391934    SetPlaying(true);
     
    19811976        m_double_process = videoOutput->IsExtraProcessingRequired();
    19821977
    19831978        videosync = VideoSync::BestMethod(
    1984             videoOutput, fr_int, rf_int, m_double_framerate);
     1979            videoOutput, GetPlaySettings(),
     1980            fr_int, rf_int, m_double_framerate);
    19851981
    19861982        // Make sure video sync can do it
    19871983        if (videosync != NULL && m_double_framerate)
     
    23452341    if (bookmarkseek > 30)
    23462342    {
    23472343        DoFastForward(bookmarkseek, true, false);
    2348         if (gCoreContext->GetNumSetting("ClearSavedPosition", 1) &&
     2344        if (GetPlaySettings()->GetNumSetting("ClearSavedPosition", 1) &&
    23492345            !player_ctx->IsPIP())
    23502346        {
    23512347            ClearBookmark(false);
     
    25492545    {
    25502546        if (jumpto == totalFrames)
    25512547        {
    2552             if (!(gCoreContext->GetNumSetting("EndOfRecordingExitPrompt") == 1
     2548            if (!(GetPlaySettings()->GetNumSetting("EndOfRecordingExitPrompt", 0) == 1
    25532549                  && !player_ctx->IsPIP() &&
    25542550                  player_ctx->GetState() == kState_WatchingPreRecorded))
    25552551            {
     
    28122808        return kPIP_END;
    28132809
    28142810    if (pip_players.isEmpty())
    2815         return (PIPLocation)gCoreContext->GetNumSetting("PIPLocation", kPIPTopLeft);
     2811        return (PIPLocation)GetPlaySettings()->GetNumSetting("PIPLocation",
     2812                                                             kPIPTopLeft);
    28162813
    28172814    // order of preference, could be stored in db if we want it configurable
    28182815    PIPLocation ols[] =
     
    33183315    exactseeks   = frame_exact_seek;
    33193316    player_ctx   = ctx;
    33203317    livetv       = ctx->tvchain;
     3318
     3319    vbimode = VBIMode::Parse(GetPlaySettings()->GetSetting("VbiFormat", ""));
     3320
     3321    // Playback (output) zoom control
     3322    detect_letter_box = new DetectLetterbox(this);
     3323
     3324    decode_extra_audio = GetPlaySettings()->GetNumSetting("DecodeExtraAudio", 0);
     3325    itvEnabled = GetPlaySettings()->GetNumSetting("EnableMHEG", 0);
     3326    db_prefer708 = GetPlaySettings()->GetNumSetting("Prefer708Captions", 1);
    33213327}
    33223328
    33233329bool NuppelVideoPlayer::EnableEdit(void)
  • libs/libmythtv/subtitlereader.h

     
    3333
    3434    TextSubtitles* GetTextSubtitles(void) { return &m_TextSubtitles; }
    3535    bool HasTextSubtitles(void);
    36     bool LoadExternalSubtitles(const QString &videoFile);
     36    bool LoadExternalSubtitles(const QString &videoFile, PlaySettings *settings);
    3737
    3838  private:
    3939    AVSubtitles   m_AVSubtitles;
  • libs/libmythtv/videooutwindow.cpp

     
    2929
    3030#include "videooutwindow.h"
    3131#include "osd.h"
     32#include "playsettings.h"
    3233#include "NuppelVideoPlayer.h"
    3334#include "videodisplayprofile.h"
    3435#include "decoderbase.h"
     
    5354const float VideoOutWindow::kManualZoomMinVerticalZoom   = 0.5f;
    5455const int   VideoOutWindow::kManualZoomMaxMove           = 50;
    5556
    56 VideoOutWindow::VideoOutWindow() :
     57VideoOutWindow::VideoOutWindow(PlaySettings *_settings) :
    5758    // DB settings
    5859    db_move(0, 0), db_scale_horiz(0.0f), db_scale_vert(0.0f),
    5960    db_pip_size(26),
     
    8485
    8586    // Various state variables
    8687    embedding(false), needrepaint(false),
    87     allowpreviewepg(true), pip_state(kPIPOff)
     88    allowpreviewepg(true), pip_state(kPIPOff),
     89
     90    settings(_settings)
    8891{
    8992    db_pip_size = gCoreContext->GetNumSetting("PIPSize", 26);
    9093
    91     db_move = QPoint(gCoreContext->GetNumSetting("xScanDisplacement", 0),
    92                      gCoreContext->GetNumSetting("yScanDisplacement", 0));
     94    db_move = QPoint(settings->GetNumSetting("xScanDisplacement", 0),
     95                     settings->GetNumSetting("yScanDisplacement", 0));
    9396    db_use_gui_size = gCoreContext->GetNumSetting("GuiSizeForTV", 0);
    9497
    9598    QDesktopWidget *desktop = NULL;
     
    612615    if (change)
    613616    {
    614617        db_scale_vert =
    615             gCoreContext->GetNumSetting("VertScanPercentage", 0) * 0.01f;
     618            settings->GetNumSetting("VertScanPercentage", 0) * 0.01f;
    616619        db_scale_horiz =
    617             gCoreContext->GetNumSetting("HorizScanPercentage", 0) * 0.01f;
     620            settings->GetNumSetting("HorizScanPercentage", 0) * 0.01f;
    618621        db_scaling_allowed = true;
    619622    }
    620623    else
  • libs/libmythtv/videoout_d3d.cpp

     
    5050    opts.priorities->insert("direct3d", 55);
    5151}
    5252
    53 VideoOutputD3D::VideoOutputD3D(void)
    54   : VideoOutput(),        m_lock(QMutex::Recursive),
     53VideoOutputD3D::VideoOutputD3D(PlaySettigns *settings)
     54  : VideoOutput(settings), m_lock(QMutex::Recursive),
    5555    m_hWnd(NULL),          m_render(NULL),
    5656    m_video(NULL),
    5757    m_render_valid(false), m_render_reset(false), m_pip_active(NULL),
  • libs/libmythtv/DetectLetterbox.cpp

     
    55#include "NuppelVideoPlayer.h"
    66#include "videoouttypes.h"
    77#include "mythcorecontext.h"
     8#include "playsettings.h"
    89
    910DetectLetterbox::DetectLetterbox(NuppelVideoPlayer* const nvp)
    1011{
    11     int dbAdjustFill = gCoreContext->GetNumSetting("AdjustFill", 0);
     12    int dbAdjustFill = nvp->GetPlaySettings()->GetNumSetting("AdjustFill", 0);
    1213    isDetectLetterbox = dbAdjustFill >= kAdjustFill_AutoDetect_DefaultOff;
    1314    firstFrameChecked = 0;
    1415    detectLetterboxDefaultMode = (AdjustFillMode) max((int) kAdjustFill_Off,
     
    1819    detectLetterboxPossibleFullFrame = -1;
    1920    detectLetterboxConsecutiveCounter = 0;
    2021    detectLetterboxDetectedMode = nvp->GetAdjustFill();
    21     detectLetterboxLimit = gCoreContext->GetNumSetting("DetectLeterboxLimit", 75);
     22    detectLetterboxLimit =
     23        nvp->GetPlaySettings()->GetNumSetting("DetectLeterboxLimit", 75);
    2224    nupple_video_player = nvp;
    2325}
    2426
  • libs/libmythtv/videoout_opengl.cpp

     
    3737    opts.priorities->insert("opengl", 65);
    3838}
    3939
    40 VideoOutputOpenGL::VideoOutputOpenGL(void)
    41     : VideoOutput(),
     40VideoOutputOpenGL::VideoOutputOpenGL(PlaySettings *settings)
     41    : VideoOutput(settings),
    4242    gl_context_lock(QMutex::Recursive),
    4343    gl_context(NULL), gl_videochain(NULL), gl_pipchain_active(NULL),
    4444    gl_parent_win(0), gl_embed_win(0), gl_painter(NULL)
  • libs/libmythtv/videoout_quartz.cpp

     
    6464#include "videodisplayprofile.h"
    6565#include "videoout_dvdv.h"
    6666
     67class PlaySettings;
     68
    6769#define LOC     QString("VideoOutputQuartz::")
    6870#define LOC_ERR QString("VideoOutputQuartz Error: ")
    6971
     
    11271129/** \class VideoOutputQuartz
    11281130 *  \brief Implementation of Quartz (Mac OS X windowing system) video output
    11291131 */
    1130 VideoOutputQuartz::VideoOutputQuartz(
     1132VideoOutputQuartz::VideoOutputQuartz(PlaySettings *settings
    11311133    MythCodecID _myth_codec_id, void *codec_priv) :
    1132     VideoOutput(), Started(false), data(new QuartzData()),
     1134    VideoOutput(settings), Started(false), data(new QuartzData()),
    11331135    myth_codec_id(_myth_codec_id)
    11341136{
    11351137    init(&pauseFrame, FMT_YV12, NULL, 0, 0, 0, 0);
     
    18661868MythCodecID VideoOutputQuartz::GetBestSupportedCodec(
    18671869    uint width, uint height,
    18681870    uint osd_width, uint osd_height,
    1869     uint stream_type, uint fourcc)
     1871    uint stream_type, uint fourcc, PlaySettings *settings)
    18701872{
    18711873    (void) osd_width;
    18721874    (void) osd_height;
    18731875
    1874     VideoDisplayProfile vdp;
     1876    VideoDisplayProfile vdp(settings);
    18751877    vdp.SetInput(QSize(width, height));
    18761878    QString dec = vdp.GetDecoder();
    18771879    if ((dec == "libmpeg2") || (dec == "ffmpeg"))
  • libs/libmythtv/avformatdecoder.cpp

     
    3030#include "BDRingBuffer.h"
    3131#include "videodisplayprofile.h"
    3232#include "mythuihelper.h"
     33#include "playsettings.h"
    3334
    3435#include "lcddevice.h"
    3536
     
    525526
    526527    cc608_build_parity_table(cc608_parity_table);
    527528
    528     if (gCoreContext->GetNumSetting("CCBackground", 0))
     529    if (GetNVP()->GetPlaySettings()->GetNumSetting("CCBackground", 0))
    529530        CC708Window::forceWhiteOnBlackText = true;
    530531
    531532    no_dts_hack = false;
     
    14261427    if (selectedStream)
    14271428    {
    14281429        directrendering = true;
    1429         if (!gCoreContext->GetNumSetting("DecodeExtraAudio", 0) &&
     1430        if (!GetNVP()->GetPlaySettings()->GetNumSetting("DecodeExtraAudio", 0) &&
    14301431            !CODEC_IS_HWACCEL(codec))
    14311432        {
    14321433            SetLowBuffers(false);
     
    19081909
    19091910                if (!is_db_ignored)
    19101911                {
    1911                     VideoDisplayProfile vdp;
     1912                    VideoDisplayProfile vdp(GetNVP()->GetPlaySettings());
    19121913                    vdp.SetInput(QSize(width, height));
    19131914                    dec = vdp.GetDecoder();
    19141915                    thread_count = vdp.GetMaxCPUs();
     
    19361937                    MythCodecID vdpau_mcid;
    19371938                    vdpau_mcid = VideoOutputVDPAU::GetBestSupportedCodec(
    19381939                        width, height,
    1939                         mpeg_version(enc->codec_id), no_hardware_decoders);
     1940                        mpeg_version(enc->codec_id), no_hardware_decoders,
     1941                        GetNVP()->GetPlaySettings());
    19401942
    19411943                    if (vdpau_mcid >= video_codec_id)
    19421944                    {
     
    19681970                        /* mpeg type    */ mpeg_version(enc->codec_id),
    19691971                        /* xvmc pix fmt */ xvmc_pixel_format(enc->pix_fmt),
    19701972                        /* test surface */ codec_is_std(video_codec_id),
    1971                         /* force_xv     */ force_xv);
     1973                        /* force_xv     */ force_xv,
     1974                        GetNVP()->GetPlaySettings());
    19721975
    19731976                    if (mcid >= video_codec_id)
    19741977                    {
     
    20012004                        /* osd dim      */ 0, 0,
    20022005                        /* mpeg type    */ mpeg_version(enc->codec_id),
    20032006                        /* pixel format */
    2004                         (PIX_FMT_YUV420P == enc->pix_fmt) ? FOURCC_I420 : 0);
     2007                        (PIX_FMT_YUV420P == enc->pix_fmt) ? FOURCC_I420 : 0,
     2008                        GetNVP()->GetPlaySettings());
    20052009
    20062010                    if (quartz_mcid >= video_codec_id)
    20072011                    {
  • libs/libmythtv/playgroup.cpp

     
    11#include "mythdb.h"
    22#include "playgroup.h"
    33#include "programinfo.h"
     4#include "playsettings.h"
    45
    56// A parameter associated with the profile itself
    67class PlayGroupDBStorage : public SimpleDBStorage
     
    210211    return res;
    211212}
    212213
    213 PlayGroupEditor::PlayGroupEditor(void) :
    214     listbox(new ListBoxSetting(this)), lastValue("Default")
     214PlayGroupEditor::PlayGroupEditor(SettingsLookup *funcArray, int funcArraySize) :
     215    listbox(new ListBoxSetting(this)), lastValue("Default"),
     216    getSettings(funcArray), getSettingsSize(funcArraySize)
    215217{
    216218    listbox->setLabel(tr("Playback Groups"));
    217219    addChild(listbox);
     
    242244    }
    243245
    244246    PlayGroup group(name);
     247    PlaySettings *psettings = new PlaySettings(name);
     248    for (int i=0; i<getSettingsSize; i++)
     249        getSettings[i](psettings, &group);
    245250    if (group.exec() == QDialog::Accepted || !created)
    246251        lastValue = name;
    247252    else
     
    276281        query.bindValue(":NAME", name);
    277282        if (!query.exec())
    278283            MythDB::DBError("PlayGroupEditor::doDelete", query);
     284        PlaySettings::deleteGroup(name);
    279285
    280286        int lastIndex = listbox->getValueIndex(name);
    281287        lastValue = "";
  • libs/libmythtv/videoout_opengl.h

     
    1010{
    1111  public:
    1212    static void GetRenderOptions(render_opts &opts, QStringList &cpudeints);
    13     VideoOutputOpenGL();
     13    VideoOutputOpenGL(PlaySettings *settings);
    1414   ~VideoOutputOpenGL();
    1515
    1616    bool Init(int width, int height, float aspect, WId winid,
  • libs/libmythtv/tv_play.h

     
    5656class OSDListTreeItemEnteredEvent;
    5757class OSDListTreeItemSelectedEvent;
    5858struct osdInfo;
     59class PlaySettings;
    5960
    6061typedef QMap<QString,InfoMap>    DDValueMap;
    6162typedef QMap<QString,DDValueMap> DDKeyMap;
     
    179180        unsigned long seconds;
    180181    };
    181182
    182     TV(void);
     183    TV(PlaySettings *settings);
    183184   ~TV();
    184185
    185     void InitFromDB(void);
     186    void InitFromDB(PlaySettings *settings);
    186187    bool Init(bool createWindow = true);
    187188
    188189    // User input processing commands
     
    205206
    206207    // Recording commands
    207208    int  PlayFromRecorder(int recordernum);
    208     int  Playback(const ProgramInfo &rcinfo);
     209    int  Playback(const ProgramInfo &rcinfo, PlaySettings *settings);
    209210
    210211    // Commands used by frontend playback box
    211212    QString GetRecordingGroup(int player_idx) const;
  • libs/libmythtv/playgroup.h

     
    77#include "mythwidgets.h"
    88
    99class ProgramInfo;
     10class PlaySettings;
    1011
    1112class MPUBLIC PlayGroup: public ConfigurationWizard
    1213{
     
    2930    Q_OBJECT
    3031
    3132  public:
    32     PlayGroupEditor(void);
     33    typedef ConfigurationWizard *(*SettingsLookup)(PlaySettings *settings,
     34                                                   ConfigurationWizard *base);
     35    PlayGroupEditor(SettingsLookup *funcArray, int funcArraySize);
    3336    virtual DialogCode exec(void);
    3437    virtual void Load(void);
    3538    virtual void Save(void) { }
     
    4447  protected:
    4548    ListBoxSetting *listbox;
    4649    QString         lastValue;
     50    SettingsLookup *getSettings;
     51    int             getSettingsSize;
    4752};
    4853
    4954#endif
  • libs/libmythtv/dbcheck.cpp

     
    35613561
    35623562            VideoDisplayProfile::CreateNewProfiles(host);
    35633563            profiles = VideoDisplayProfile::GetProfiles(host);
    3564             QString profile = VideoDisplayProfile::GetDefaultProfileName(host);
     3564            QString profile =
     3565                VideoDisplayProfile::GetDefaultProfileName(host, NULL);
    35653566
    35663567            if (profiles.contains("Normal") &&
    35673568                (profile=="CPU++" || profile=="CPU+" || profile=="CPU--"))
     
    57995800"  jump int(11) NOT NULL default '0',"
    58005801"  PRIMARY KEY  (`name`)"
    58015802");",
     5803"CREATE TABLE playgroupsettings ("
     5804"  playgroupname varchar(64) NOT NULL,"
     5805"  `value` varchar(128) NOT NULL,"
     5806"  `data` text,"
     5807"  overridden tinyint(1) NOT NULL,"
     5808"  PRIMARY KEY (playgroupname, `value`)"
     5809");",
    58025810"CREATE TABLE powerpriority ("
    58035811"  priorityname varchar(64) collate utf8_bin NOT NULL,"
    58045812"  recpriority int(10) NOT NULL default '0',"
  • libs/libmythtv/videoout_vdpau.cpp

     
    4848    opts.deints->insert("vdpau", deints);
    4949}
    5050
    51 VideoOutputVDPAU::VideoOutputVDPAU(MythCodecID codec_id)
    52   : VideoOutput(),
     51VideoOutputVDPAU::VideoOutputVDPAU(PlaySettings *settings, MythCodecID codec_id)
     52  : VideoOutput(settings),
    5353    m_codec_id(codec_id),    m_win(0),         m_render(NULL),
    5454    m_buffer_size(NUM_VDPAU_BUFFERS),          m_pause_surface(0),
    5555    m_need_deintrefs(false), m_video_mixer(0), m_mixer_features(kVDPFeatNone),
     
    871871
    872872MythCodecID VideoOutputVDPAU::GetBestSupportedCodec(
    873873    uint width,       uint height,
    874     uint stream_type, bool no_acceleration)
     874    uint stream_type, bool no_acceleration, PlaySettings *settings)
    875875{
    876876    bool use_cpu = no_acceleration;
    877     VideoDisplayProfile vdp;
     877    VideoDisplayProfile vdp(settings);
    878878    vdp.SetInput(QSize(width, height));
    879879    QString dec = vdp.GetDecoder();
    880880
  • libs/libmythtv/videoout_directfb.cpp

     
    274274    opts.priorities->insert("directfb", 60);
    275275}
    276276
    277 VideoOutputDirectfb::VideoOutputDirectfb(void)
    278     : VideoOutput(), XJ_started(false), widget(NULL),
     277VideoOutputDirectfb::VideoOutputDirectfb(PlaySettings *settings)
     278    : VideoOutput(settings), XJ_started(false), widget(NULL),
    279279      data(new DirectfbData())
    280280{
    281281    init(&pauseFrame, FMT_YV12, NULL, 0, 0, 0, 0);
  • libs/libmythtv/videoout_d3d.h

     
    1212{
    1313  public:
    1414    static void GetRenderOptions(render_opts &opts, QStringList &cpudeints);
    15     VideoOutputD3D();
     15    VideoOutputD3D(PlaySettings *settings);
    1616   ~VideoOutputD3D();
    1717
    1818    bool Init(int width, int height, float aspect, WId winid,
  • libs/libmythtv/playercontext.cpp

     
    1717#include "storagegroup.h"
    1818#include "mythcorecontext.h"
    1919#include "videometadatautil.h"
     20#include "DetectLetterbox.h"
     21#include "playsettings.h"
    2022
    2123#define LOC QString("playCtx: ")
    2224#define LOC_ERR QString("playCtx, Error: ")
     
    404406                              WId embedwinid, const QRect *embedbounds,
    405407                              bool muted)
    406408{
    407     int exact_seeking = gCoreContext->GetNumSetting("ExactSeeking", 0);
     409    int exact_seeking = settings->GetNumSetting("ExactSeeking", 0);
    408410
    409411    if (HasNVP())
    410412    {
     
    447449    {
    448450        QString subfn = buffer->GetSubtitleFilename();
    449451        if (!subfn.isEmpty() && _nvp->GetSubReader())
    450             _nvp->GetSubReader()->LoadExternalSubtitles(subfn);
     452            _nvp->GetSubReader()->LoadExternalSubtitles(subfn, settings);
    451453    }
    452454
    453455    if ((embedwinid > 0) && embedbounds)
     
    888890/**
    889891 * \brief assign programinfo to the context
    890892 */
    891 void PlayerContext::SetPlayingInfo(const ProgramInfo *info)
     893void PlayerContext::SetPlayingInfo(const ProgramInfo *info,
     894                                   PlaySettings *_settings)
    892895{
    893896    bool ignoreDB = gCoreContext->IsDatabaseIgnored();
    894897
     
    900903            playingInfo->MarkAsInUse(false, recUsage);
    901904        delete playingInfo;
    902905        playingInfo = NULL;
     906        // XXX delete settings?
    903907    }
    904908
    905909    if (info)
     
    908912        if (!ignoreDB)
    909913            playingInfo->MarkAsInUse(true, recUsage);
    910914        playingLen = playingInfo->GetSecondsInRecording();
     915        settings = (_settings ? _settings :
     916                    new PlaySettings(playingInfo->GetPlaybackGroup()));
    911917    }
    912918}
    913919
  • libs/libmythtv/NuppelVideoPlayer.h

     
    213213    QString   GetXDS(const QString &key) const;
    214214    PIPLocation GetNextPIPLocation(void) const;
    215215
     216    PlaySettings *GetPlaySettings(void) const {
     217        return player_ctx ? player_ctx->settings : NULL;
     218    }
     219
    216220    // Bool Gets
    217221    bool    GetRawAudioState(void) const;
    218222    bool    GetLimitKeyRepeat(void) const     { return limitKeyRepeat; }
  • libs/libmythtv/subtitlereader.cpp

     
    5656        av_free(subtitle.rects);
    5757}
    5858
    59 bool SubtitleReader::LoadExternalSubtitles(const QString &subtitleFileName)
     59bool SubtitleReader::LoadExternalSubtitles(const QString &subtitleFileName,
     60                                           PlaySettings *settings)
    6061{
    6162    m_TextSubtitles.Clear();
    62     return TextSubtitleParser::LoadSubtitles(subtitleFileName, m_TextSubtitles);
     63    return TextSubtitleParser::LoadSubtitles(subtitleFileName, m_TextSubtitles,
     64                                             settings);
    6365}
    6466
    6567bool SubtitleReader::HasTextSubtitles(void)
  • libs/libmythtv/textsubtitleparser.h

     
    1717// Qt headers
    1818#include <QStringList>
    1919
     20class PlaySettings;
     21
    2022class text_subtitle_t
    2123{
    2224  public:
     
    7981class TextSubtitleParser
    8082{
    8183  public:
    82     static bool LoadSubtitles(QString fileName, TextSubtitles &target);
     84    static bool LoadSubtitles(QString fileName, TextSubtitles &target,
     85                              PlaySettings *settings);
    8386};
    8487
    8588#endif
  • libs/libmythtv/vsync.cpp

     
    3434
    3535#include "mythcontext.h"
    3636#include "mythmainwindow.h"
     37#include "playsettings.h"
    3738
    3839#ifdef USING_XV
    3940#include "videoout_xv.h"
     
    7879 *  \brief Returns the most sophisticated video sync method available.
    7980 */
    8081VideoSync *VideoSync::BestMethod(VideoOutput *video_output,
     82                                 PlaySettings *settings,
    8183                                 uint frame_interval, uint refresh_interval,
    8284                                 bool halve_frame_interval)
    8385{
     
    102104#ifndef _WIN32
    103105    TESTVIDEOSYNC(DRMVideoSync);
    104106#ifdef USING_OPENGL_VSYNC
    105     if (gCoreContext->GetNumSetting("UseOpenGLVSync", 1) &&
     107    if (settings->GetNumSetting("UseOpenGLVSync", 1) &&
    106108       (getenv("NO_OPENGL_VSYNC") == NULL))
    107109    {
    108110        TESTVIDEOSYNC(OpenGLVideoSync);
  • libs/libmythtv/tv_play.cpp

     
    5959#include "mythsystemevent.h"
    6060#include "videometadatautil.h"
    6161#include "mythdialogbox.h"
     62#include "playsettings.h"
    6263
    6364#if ! HAVE_ROUND
    6465#define round(x) ((int) ((x) + 0.5))
     
    209210    bool startInGuide = flags & kStartTVInGuide;
    210211    bool inPlaylist = flags & kStartTVInPlayList;
    211212    bool initByNetworkCommand = flags & kStartTVByNetworkCommand;
    212     TV *tv = new TV();
    213213    bool quitAll = false;
    214214    bool showDialogs = true;
    215215    bool playCompleted = false;
     
    223223        curProgram->SetIgnoreBookmark(flags & kStartTVIgnoreBookmark);
    224224    }
    225225
     226    PlaySettings settings(curProgram ? curProgram->GetPlaybackGroup() : "Default");
     227    TV *tv = new TV(&settings);
     228
    226229    // Initialize TV
    227230    if (!tv->Init())
    228231    {
     
    253256        if (curProgram)
    254257        {
    255258            VERBOSE(VB_PLAYBACK, LOC + "tv->Playback() -- begin");
    256             if (!tv->Playback(*curProgram))
     259            if (!tv->Playback(*curProgram, &settings))
    257260            {
    258261                quitAll = true;
    259262            }
     
    838841class TVInitRunnable : public QRunnable
    839842{
    840843  public:
    841     TVInitRunnable(TV *ourTV) : tv(ourTV) {}
    842     virtual void run(void) { tv->InitFromDB(); }
     844    TVInitRunnable(TV *ourTV, PlaySettings *ourSettings) :
     845        tv(ourTV), settings(ourSettings) {}
     846    virtual void run(void) { tv->InitFromDB(settings); }
    843847    TV *tv;
     848    PlaySettings *settings;
    844849};
    845850
    846851/** \fn TV::TV(void)
    847852 *  \sa Init(void)
    848853 */
    849 TV::TV(void)
     854TV::TV(PlaySettings *settings)
    850855    : // Configuration variables from database
    851856      baseFilters(""),
    852857      db_channel_format("<num> <sign>"),
     
    946951    playerActive = 0;
    947952    playerLock.unlock();
    948953
    949     QThreadPool::globalInstance()->start(new TVInitRunnable(this), 99);
     954    QThreadPool::globalInstance()->start(new TVInitRunnable(this, settings), 99);
    950955
    951956    VERBOSE(VB_PLAYBACK, LOC + "ctor -- end");
    952957}
    953958
    954 void TV::InitFromDB(void)
     959void TV::InitFromDB(PlaySettings *settings)
    955960{
    956961    QMap<QString,QString> kv;
    957962    kv["LiveTVIdleTimeout"]        = "0";
     
    9971002        kv[QString("FFRewSpeed%1").arg(i)] = QString::number(ff_rew_def[i]);
    9981003
    9991004    MythDB::getMythDB()->GetSettings(kv);
     1005    settings->AddToMap(kv);
    10001006
    10011007    // convert from minutes to ms.
    10021008    db_idle_timeout        = kv["LiveTVIdleTimeout"].toInt() * 60 * 1000;
     
    17331739    askAllowLock.unlock();
    17341740}
    17351741
    1736 int TV::Playback(const ProgramInfo &rcinfo)
     1742int TV::Playback(const ProgramInfo &rcinfo, PlaySettings *settings)
    17371743{
    17381744    wantsToQuit   = false;
    17391745    jumpToProgram = false;
     
    17471753        return 0;
    17481754    }
    17491755
    1750     mctx->SetPlayingInfo(&rcinfo);
     1756    mctx->SetPlayingInfo(&rcinfo, settings);
    17511757    mctx->SetInitialTVState(false);
    17521758    ScheduleStateChange(mctx);
    17531759
     
    18301836
    18311837    if (fileexists)
    18321838    {
    1833         Playback(pginfo);
     1839        PlaySettings settings("Default");
     1840        Playback(pginfo, &settings);
    18341841        retval = 1;
    18351842    }
    18361843
     
    21712178            QString msg = tr("%1 Settings")
    21722179                    .arg(tv_i18n(ctx->playingInfo->GetPlaybackGroup()));
    21732180            ctx->UnlockPlayingInfo(__FILE__, __LINE__);
    2174             if (count > 0)
     2181            if (count > 0 &&
     2182                ctx->playingInfo->GetPlaybackGroup() != "Default" &&
     2183                ctx->playingInfo->GetPlaybackGroup() != "Videos")
    21752184                SetOSDMessage(ctx, msg);
    21762185            ITVRestart(ctx, false);
    21772186        }
  • libs/libmythtv/videodisplayprofile.h

     
    1313
    1414#include "mythcontext.h"
    1515
     16class PlaySettings;
     17
    1618typedef QMap<QString,QString>     pref_map_t;
    1719typedef QMap<QString,QStringList> safe_map_t;
    1820typedef QStringList               safe_list_t;
     
    8082class MPUBLIC VideoDisplayProfile
    8183{
    8284  public:
    83     VideoDisplayProfile();
     85    VideoDisplayProfile(PlaySettings *settings);
    8486    ~VideoDisplayProfile();
    8587
    8688    void SetInput(const QSize &size);
     
    124126    static QString     GetDecoderName(const QString &decoder);
    125127    static QString     GetDecoderHelp(QString decoder = QString::null);
    126128
    127     static QString     GetDefaultProfileName(const QString &hostname);
     129    static QString     GetDefaultProfileName(const QString &hostname,
     130                                             PlaySettings *settings);
    128131    static void        SetDefaultProfileName(const QString &profilename,
    129132                                             const QString &hostname);
    130133    static uint        GetProfileGroupID(const QString &profilename,
  • libs/libmythtv/videoout_null.cpp

     
    2727    opts.priorities->insert("null", 10);
    2828}
    2929
    30 VideoOutputNull::VideoOutputNull(void) :
    31     VideoOutput(), global_lock(QMutex::Recursive)
     30VideoOutputNull::VideoOutputNull(PlaySettings *settings) :
     31    VideoOutput(settings), global_lock(QMutex::Recursive)
    3232{
    3333    VERBOSE(VB_PLAYBACK, "VideoOutputNull()");
    3434    memset(&av_pause_frame, 0, sizeof(av_pause_frame));
  • libs/libmythtv/videooutbase.cpp

     
    77#include "NuppelVideoPlayer.h"
    88#include "videodisplayprofile.h"
    99#include "decoderbase.h"
     10#include "playsettings.h"
    1011
    1112#include "mythcorecontext.h"
    1213#include "mythverbose.h"
     
    109110        PIPState pipState,
    110111        const QSize   &video_dim, float        video_aspect,
    111112        WId            win_id,    const QRect &display_rect,
    112         float          video_prate,     WId    embed_id)
     113        float          video_prate,     WId    embed_id,
     114        PlaySettings *settings)
    113115{
    114116    (void) codec_priv;
    115117
     
    154156    QString renderer = QString::null;
    155157    if (renderers.size() > 0)
    156158    {
    157         VideoDisplayProfile vprof;
     159        VideoDisplayProfile vprof(settings);
    158160        vprof.SetInput(video_dim);
    159161
    160162        QString tmp = vprof.GetVideoRenderer();
     
    182184
    183185#ifdef USING_DIRECTFB
    184186        if (renderer == "directfb")
    185             vo = new VideoOutputDirectfb();
     187            vo = new VideoOutputDirectfb(settings);
    186188#endif // USING_DIRECTFB
    187189
    188190#ifdef USING_MINGW
    189191        if (renderer == "direct3d")
    190             vo = new VideoOutputD3D();
     192            vo = new VideoOutputD3D(settings);
    191193#endif // USING_MINGW
    192194
    193195#ifdef Q_OS_MACX
    194196        if (osxlist.contains(renderer))
    195             vo = new VideoOutputQuartz(codec_id, codec_priv);
     197            vo = new VideoOutputQuartz(settings, codec_id, codec_priv);
    196198#endif // Q_OS_MACX
    197199
    198200#ifdef USING_OPENGL_VIDEO
    199201        if (renderer == "opengl")
    200             vo = new VideoOutputOpenGL();
     202            vo = new VideoOutputOpenGL(settings);
    201203#endif // USING_OPENGL_VIDEO
    202204
    203205#ifdef USING_VDPAU
    204206        if (renderer == "vdpau")
    205             vo = new VideoOutputVDPAU(codec_id);
     207            vo = new VideoOutputVDPAU(settings, codec_id);
    206208#endif // USING_VDPAU
    207209
    208210#ifdef USING_XV
    209211        if (xvlist.contains(renderer))
    210             vo = new VideoOutputXv(codec_id);
     212            vo = new VideoOutputXv(settings, codec_id);
    211213#endif // USING_XV
    212214
    213215        if (vo)
     
    304306 * \brief This constructor for VideoOutput must be followed by an
    305307 *        Init(int,int,float,WId,int,int,int,int,WId) call.
    306308 */
    307 VideoOutput::VideoOutput() :
     309VideoOutput::VideoOutput(PlaySettings *_settings) :
    308310    // DB Settings
    309311    db_display_dim(0,0),
    310312    db_aspectoverride(kAspect_Off),     db_adjustfill(kAdjustFill_Off),
     
    341343    monitor_sz(640,480),                monitor_dim(400,300),
    342344
    343345    // OSD
    344     osd_painter(NULL),                  osd_image(NULL)
     346    osd_painter(NULL),                  osd_image(NULL),
     347    settings(_settings)
    345348
    346349{
    347350    bzero(&pip_tmp_image, sizeof(pip_tmp_image));
    348     db_display_dim = QSize(gCoreContext->GetNumSetting("DisplaySizeWidth",  0),
    349                            gCoreContext->GetNumSetting("DisplaySizeHeight", 0));
     351    db_display_dim = QSize(settings->GetNumSetting("DisplaySizeWidth",  0),
     352                           settings->GetNumSetting("DisplaySizeHeight", 0));
    350353
    351354    db_pict_attr[kPictureAttribute_Brightness] =
    352         gCoreContext->GetNumSetting("PlaybackBrightness", 50);
     355        settings->GetNumSetting("PlaybackBrightness", 50);
    353356    db_pict_attr[kPictureAttribute_Contrast] =
    354         gCoreContext->GetNumSetting("PlaybackContrast",   50);
     357        settings->GetNumSetting("PlaybackContrast",   50);
    355358    db_pict_attr[kPictureAttribute_Colour] =
    356         gCoreContext->GetNumSetting("PlaybackColour",     50);
     359        settings->GetNumSetting("PlaybackColour",     50);
    357360    db_pict_attr[kPictureAttribute_Hue] =
    358         gCoreContext->GetNumSetting("PlaybackHue",         0);
     361        settings->GetNumSetting("PlaybackHue",         0);
    359362
    360363    db_aspectoverride = (AspectOverrideMode)
    361         gCoreContext->GetNumSetting("AspectOverride",      0);
     364        settings->GetNumSetting("AspectOverride",      0);
    362365    db_adjustfill = (AdjustFillMode)
    363         gCoreContext->GetNumSetting("AdjustFill",          0);
     366        settings->GetNumSetting("AdjustFill",          0);
    364367    db_letterbox_colour = (LetterBoxColour)
    365         gCoreContext->GetNumSetting("LetterboxColour",     0);
     368        settings->GetNumSetting("LetterboxColour",     0);
    366369    db_use_picture_controls =
    367         gCoreContext->GetNumSetting("UseOutputPictureControls", 0);
     370        settings->GetNumSetting("UseOutputPictureControls", 0);
    368371
    369372    if (!gCoreContext->IsDatabaseIgnored())
    370         db_vdisp_profile = new VideoDisplayProfile();
     373        db_vdisp_profile = new VideoDisplayProfile(settings);
    371374
    372     windows.push_back(VideoOutWindow());
     375    windows.push_back(VideoOutWindow(settings));
    373376}
    374377
    375378/**
     
    443446    return QString::null;
    444447}
    445448
    446 bool VideoOutput::IsPreferredRenderer(QSize video_size)
     449bool VideoOutput::IsPreferredRenderer(QSize video_size, PlaySettings *settings)
    447450{
    448451    if (!db_vdisp_profile || (video_size == windows[0].GetVideoDispDim()))
    449452        return true;
    450453
    451     VideoDisplayProfile vdisp;
     454    VideoDisplayProfile vdisp(settings);
    452455    vdisp.SetInput(video_size);
    453456    QString new_rend = vdisp.GetVideoRenderer();
    454457    if (new_rend.isEmpty())
  • libs/libmythtv/videooutwindow.h

     
    1616#include "videoouttypes.h"
    1717
    1818class NuppelVideoPlayer;
     19class PlaySettings;
    1920
    2021class VideoOutWindow
    2122{
    2223  public:
    23     VideoOutWindow();
     24    VideoOutWindow(PlaySettings *settings);
    2425
    2526    bool Init(const QSize &new_video_dim, float aspect,
    2627              const QRect &new_display_visible_rect,
     
    162163    bool     allowpreviewepg;
    163164    PIPState pip_state;
    164165
     166    PlaySettings *settings;
     167
    165168    // Constants
    166169    static const float kManualZoomMaxHorizontalZoom;
    167170    static const float kManualZoomMaxVerticalZoom;
  • libs/libmythtv/videoout_directfb.h

     
    1212{
    1313  public:
    1414    static void GetRenderOptions(render_opts &opts, QStringList &cpudeints);
    15     VideoOutputDirectfb();
     15    VideoOutputDirectfb(PlaySettings *settings);
    1616    ~VideoOutputDirectfb();
    1717
    1818    bool Init(int width, int height, float aspect, WId winid,
  • libs/libmythtv/playercontext.h

     
    2828class LiveTVChain;
    2929class MythDialog;
    3030class QPainter;
     31class PlaySettings;
    3132
    3233struct osdInfo
    3334{
     
    112113    void SetRecorder(RemoteEncoder *rec);
    113114    void SetTVChain(LiveTVChain *chain);
    114115    void SetRingBuffer(RingBuffer *buf);
    115     void SetPlayingInfo(const ProgramInfo *info);
     116    void SetPlayingInfo(const ProgramInfo *info, PlaySettings *settings=NULL);
    116117    void SetPlayGroup(const QString &group);
    117118    void SetPseudoLiveTV(const ProgramInfo *pi, PseudoState new_state);
    118119    void SetPIPLocation(int loc) { pipLocation = loc; }
     
    168169    LiveTVChain        *tvchain;
    169170    RingBuffer         *buffer;
    170171    ProgramInfo        *playingInfo; ///< Currently playing info
     172    PlaySettings       *settings; // corresponding to playingInfo
    171173    long long           playingLen;  ///< Initial CalculateLength()
    172174    bool                nohardwaredecoders; // < Disable use of VDPAU decoding
    173175    int                 last_cardid; ///< CardID of current/last recorder
  • libs/libmythtv/vsync.h

     
    8787
    8888    // documented in vsync.cpp
    8989    static VideoSync *BestMethod(VideoOutput*,
     90                                 PlaySettings *settings,
    9091                                 uint frame_interval, uint refresh_interval,
    9192                                 bool interlaced);
    9293  protected:
  • libs/libmythtv/videoout_xv.h

     
    5151    friend class XvMCOSD;
    5252  public:
    5353    static void GetRenderOptions(render_opts &opts, QStringList &cpudeints);
    54     VideoOutputXv(MythCodecID av_codec_id);
     54    VideoOutputXv(PlaySettings *settings, MythCodecID av_codec_id);
    5555   ~VideoOutputXv();
    5656
    5757    bool Init(int width, int height, float aspect, WId winid,
     
    109109    static MythCodecID GetBestSupportedCodec(uint width, uint height,
    110110                                             uint osd_width, uint osd_height,
    111111                                             uint stream_type, int xvmc_chroma,
    112                                              bool test_surface, bool force_xv);
     112                                             bool test_surface, bool force_xv,
     113                                             PlaySettings *settings);
    113114
    114115    static int GrabSuitableXvPort(MythXDisplay* disp, Window root,
     116                                  PlaySettings *settings,
    115117                                  MythCodecID type,
    116118                                  uint width, uint height,
    117119                                  bool &xvsetdefaults,
  • libs/libmythtv/videoout_xv.cpp

     
    165165 * \see VideoOutput, VideoBuffers
    166166 *
    167167 */
    168 VideoOutputXv::VideoOutputXv(MythCodecID codec_id)
    169     : VideoOutput(),
     168VideoOutputXv::VideoOutputXv(PlaySettings *settings, MythCodecID codec_id)
     169    : VideoOutput(settings),
    170170      myth_codec_id(codec_id), video_output_subtype(XVUnknown),
    171171      global_lock(QMutex::Recursive),
    172172
     
    404404 * \return port number if it succeeds, else -1.
    405405 */
    406406int VideoOutputXv::GrabSuitableXvPort(MythXDisplay* disp, Window root,
     407                                      PlaySettings *settings,
    407408                                      MythCodecID mcodecid,
    408409                                      uint width, uint height,
    409410                                      bool &xvsetdefaults,
     
    488489    }
    489490
    490491    // figure out if we want chromakeying..
    491     VideoDisplayProfile vdp;
     492    VideoDisplayProfile vdp(settings);
    492493    vdp.SetInput(QSize(width, height));
    493494    bool check_for_colorkey = (vdp.GetOSDRenderer() == "chromakey");
    494495
     
    781782    disp->StartLog();
    782783    QString adaptor_name = QString::null;
    783784    const QSize video_dim = windows[0].GetVideoDim();
    784     xv_port = GrabSuitableXvPort(disp, disp->GetRoot(), mcodecid,
     785    xv_port = GrabSuitableXvPort(disp, disp->GetRoot(), settings, mcodecid,
    785786                                 video_dim.width(), video_dim.height(),
    786787                                 xv_set_defaults,
    787788                                 xvmc_chroma, &xvmc_surf_info, &adaptor_name);
     
    860861    disp->StartLog();
    861862    QString adaptor_name = QString::null;
    862863    const QSize video_dim = windows[0].GetVideoDim();
    863     xv_port = GrabSuitableXvPort(disp, disp->GetRoot(), kCodec_MPEG2,
     864    xv_port = GrabSuitableXvPort(disp, disp->GetRoot(), settings, kCodec_MPEG2,
    864865                                 video_dim.width(), video_dim.height(),
    865866                                 xv_set_defaults, 0, NULL, &adaptor_name);
    866867    if (xv_port == -1)
     
    10141015    uint width,       uint height,
    10151016    uint osd_width,   uint osd_height,
    10161017    uint stream_type, int xvmc_chroma,
    1017     bool test_surface, bool force_xv)
     1018    bool test_surface, bool force_xv,
     1019    PlaySettings *settings)
    10181020{
    10191021    (void)width, (void)height, (void)osd_width, (void)osd_height;
    10201022    (void)stream_type, (void)xvmc_chroma, (void)test_surface;
     
    10251027        return ret;
    10261028
    10271029#ifdef USING_XVMC
    1028     VideoDisplayProfile vdp;
     1030    VideoDisplayProfile vdp(settings);
    10291031    vdp.SetInput(QSize(width, height));
    10301032    QString dec = vdp.GetDecoder();
    10311033    if ((dec == "libmpeg2") || (dec == "ffmpeg"))
     
    10751077
    10761078        ok = false;
    10771079        bool dummy;
    1078         int port = GrabSuitableXvPort(disp, disp->GetRoot(), ret, width, height,
     1080        int port = GrabSuitableXvPort(disp, disp->GetRoot(), settings,
     1081                                      ret, width, height,
    10791082                                      dummy, xvmc_chroma, &info);
    10801083        if (port >= 0)
    10811084        {
  • libs/libmythtv/videooutbase.h

     
    3131class FilterChain;
    3232class FilterManager;
    3333class OpenGLContextGLX;
     34class PlaySettings;
    3435
    3536typedef QMap<NuppelVideoPlayer*,PIPLocation> PIPMap;
    3637
     
    5152        PIPState       pipState,
    5253        const QSize   &video_dim, float        video_aspect,
    5354        WId            win_id,    const QRect &display_rect,
    54         float video_prate,        WId          embed_id);
     55        float video_prate,        WId          embed_id,
     56        PlaySettings *settings);
    5557
    56     VideoOutput();
     58    VideoOutput(PlaySettings *settings);
    5759    virtual ~VideoOutput();
    5860
    5961    virtual bool Init(int width, int height, float aspect,
     
    6163                      int winh, WId embedid = 0);
    6264    virtual void InitOSD(OSD *osd);
    6365    virtual void SetVideoFrameRate(float);
    64     virtual bool IsPreferredRenderer(QSize video_size);
     66    virtual bool IsPreferredRenderer(QSize video_size, PlaySettings *settings);
    6567    virtual bool SetDeinterlacingEnabled(bool);
    6668    virtual bool SetupDeinterlace(bool i, const QString& ovrf="");
    6769    virtual void FallbackDeint(void);
     
    337339    // OSD painter and surface
    338340    MythYUVAPainter *osd_painter;
    339341    MythImage       *osd_image;
     342
     343    PlaySettings *settings;
    340344};
    341345
    342346#endif
  • libs/libmythtv/textsubtitleparser.cpp

     
    2121#include "RingBuffer.h"
    2222#include "textsubtitleparser.h"
    2323#include "xine_demux_sputext.h"
     24#include "playsettings.h"
    2425
    2526bool operator<(const text_subtitle_t& left,
    2627               const text_subtitle_t& right)
     
    116117    m_lock.unlock();
    117118}
    118119
    119 bool TextSubtitleParser::LoadSubtitles(QString fileName, TextSubtitles &target)
     120bool TextSubtitleParser::LoadSubtitles(QString fileName, TextSubtitles &target,
     121                                       PlaySettings *settings)
    120122{
    121123    demux_sputext_t sub_data;
    122124    sub_data.rbuffer = new RingBuffer(fileName, 0, false);
     
    134136    target.SetFrameBasedTiming(!sub_data.uses_time);
    135137
    136138    QTextCodec *textCodec = NULL;
    137     QString codec = gCoreContext->GetSetting("SubtitleCodec", "");
     139    QString codec = settings->GetSetting("SubtitleCodec", "");
    138140    if (!codec.isEmpty())
    139141        textCodec = QTextCodec::codecForName(codec.toLatin1());
    140142    if (!textCodec)
  • libs/libmythtv/subtitlescreen.cpp

     
    77#include "mythuiimage.h"
    88#include "mythpainter.h"
    99#include "subtitlescreen.h"
     10#include "playsettings.h"
    1011
    1112#define LOC      QString("Subtitles: ")
    1213#define LOC_WARN QString("Subtitles Warning: ")
     
    6263        VERBOSE(VB_IMPORTANT, LOC_WARN + "Failed to get CEA-608 reader.");
    6364    if (!m_708reader)
    6465        VERBOSE(VB_IMPORTANT, LOC_WARN + "Failed to get CEA-708 reader.");
    65     m_useBackground = (bool)gCoreContext->GetNumSetting("CCBackground", 0);
    66     m_708fontZoom   = gCoreContext->GetNumSetting("OSDCC708TextZoom", 100);
     66    m_useBackground = (bool)m_player->GetPlaySettings()->GetNumSetting("CCBackground", 0);
     67    m_708fontZoom   = m_player->GetPlaySettings()->GetNumSetting("OSDCC708TextZoom", 100);
    6768    return true;
    6869}
    6970
  • libs/libmythtv/videoout_quartz.h

     
    33
    44class DVDV;
    55struct QuartzData;
     6class PlaySettings;
    67
    78#include "videooutbase.h"
    89
     
    1011{
    1112  public:
    1213    static void GetRenderOptions(render_opts &opts, QStringList &cpudeints);
    13     VideoOutputQuartz(MythCodecID av_codec_id, void *codec_priv);
     14    VideoOutputQuartz(PlaySettings *settings, MythCodecID av_codec_id,
     15                      void *codec_priv);
    1416   ~VideoOutputQuartz();
    1517
    1618    bool Init(int width, int height, float aspect, WId winid,
     
    5557    static MythCodecID GetBestSupportedCodec(
    5658        uint width, uint height,
    5759        uint osd_width, uint osd_height,
    58         uint stream_type, uint fourcc);
     60        uint stream_type, uint fourcc, PlaySettings *settings);
    5961    virtual bool NeedExtraAudioDecode(void) const
    6062        { return !codec_is_std(myth_codec_id); }
    6163
  • libs/libmythtv/videodisplayprofile.cpp

     
    88#include "mythverbose.h"
    99#include "videooutbase.h"
    1010#include "avformatdecoder.h"
     11#include "playsettings.h"
    1112
    1213bool ProfileItem::IsMatch(const QSize &size, float rate) const
    1314{
     
    212213pref_map_t  VideoDisplayProfile::dec_name;
    213214safe_list_t VideoDisplayProfile::safe_decoders;
    214215
    215 VideoDisplayProfile::VideoDisplayProfile()
     216VideoDisplayProfile::VideoDisplayProfile(PlaySettings *settings)
    216217    : lock(QMutex::Recursive), last_size(0,0), last_rate(0.0f),
    217218      last_video_renderer(QString::null)
    218219{
     
    220221    init_statics();
    221222
    222223    QString hostname    = gCoreContext->GetHostName();
    223     QString cur_profile = GetDefaultProfileName(hostname);
     224    QString cur_profile = GetDefaultProfileName(hostname, settings);
    224225    uint    groupid     = GetProfileGroupID(cur_profile, hostname);
    225226
    226227    item_list_t items = LoadDB(groupid);
     
    772773    return list;
    773774}
    774775
    775 QString VideoDisplayProfile::GetDefaultProfileName(const QString &hostname)
     776QString VideoDisplayProfile::GetDefaultProfileName(const QString &hostname,
     777                                                   PlaySettings *settings)
    776778{
    777779    QString tmp =
     780        settings ? settings->GetSetting("DefaultVideoPlaybackProfile", "") :
    778781        gCoreContext->GetSettingOnHost("DefaultVideoPlaybackProfile", hostname);
    779782
    780783    QStringList profiles = GetProfiles(hostname);
  • libs/libmythtv/videoout_null.h

     
    99{
    1010  public:
    1111    static void GetRenderOptions(render_opts &opts, QStringList &cpudeints);
    12     VideoOutputNull();
     12    VideoOutputNull(PlaySettings *settings);
    1313   ~VideoOutputNull();
    1414
    1515    bool Init(int width, int height, float aspect, WId winid,
  • libs/libmyth/settings.cpp

     
    235235    return -1;
    236236}
    237237
     238QString SelectSetting::GetValueLabel(const QString &value)
     239{
     240    selectionList::const_iterator iterValues = values.begin();
     241    selectionList::const_iterator iterLabels = labels.begin();
     242    for (; iterValues != values.end() && iterLabels != labels.end();
     243         ++iterValues, ++iterLabels)
     244    {
     245        if (*iterValues == value)
     246            return *iterLabels;
     247    }
     248
     249    return "???";
     250}
     251
    238252bool SelectSetting::ReplaceLabel(const QString &new_label, const QString &value)
    239253{
    240254    int i = getValueIndex(value);
     
    299313        QLabel *label = new QLabel();
    300314        label->setText(getLabel() + ":     ");
    301315        layout->addWidget(label);
     316        labelWidget = label;
    302317    }
    303318
    304319    bxwidget = widget;
     
    327342
    328343    widget->setLayout(layout);
    329344
     345    setValue(getValue());
     346
    330347    return widget;
    331348}
    332349
     
    336353    {
    337354        bxwidget = NULL;
    338355        edit     = NULL;
     356        labelWidget = NULL;
    339357    }
    340358}
    341359
     
    373391    Setting::setHelpText(str);
    374392}
    375393
     394static void adjustFont(QWidget *widget, bool isDefault)
     395{
     396    if (widget)
     397    {
     398        QFont f = widget->font();
     399        f.setWeight(isDefault ? QFont::Light : QFont::Bold);
     400        widget->setFont(f);
     401    }
     402}
     403
     404void LineEditSetting::setValue(const QString &newValue)
     405{
     406    if (adjustOnBlank)
     407    {
     408        adjustFont(labelWidget, newValue.isEmpty());
     409        adjustFont(edit,        newValue.isEmpty());
     410    }
     411    Setting::setValue(newValue);
     412}
     413
    376414void BoundedIntegerSetting::setValue(int newValue)
    377415{
    378416    newValue = std::max(std::min(newValue, max), min);
     
    439477
    440478SpinBoxSetting::SpinBoxSetting(
    441479    Storage *_storage, int _min, int _max, int _step,
    442     bool _allow_single_step, QString _special_value_text) :
     480    bool _allow_single_step, QString _special_value_text,
     481    bool change_style_on_special) :
    443482    BoundedIntegerSetting(_storage, _min, _max, _step),
    444483    spinbox(NULL), relayEnabled(true),
    445     sstep(_allow_single_step), svtext("")
     484    sstep(_allow_single_step), svtext(""), labelWidget(NULL),
     485    changeOnSpecial(change_style_on_special)
    446486{
    447487    if (!_special_value_text.isEmpty())
    448488        svtext = _special_value_text;
     
    476516        QLabel *label = new QLabel();
    477517        label->setText(getLabel() + ":     ");
    478518        layout->addWidget(label);
     519        labelWidget = label;
    479520    }
    480521
    481522    bxwidget = widget;
     
    506547
    507548    widget->setLayout(layout);
    508549
     550    setValue(intValue());
     551
    509552    return widget;
    510553}
    511554
     
    515558    {
    516559        bxwidget = NULL;
    517560        spinbox  = NULL;
     561        labelWidget = NULL;
    518562    }
    519563}
    520564
    521565void SpinBoxSetting::setValue(int newValue)
    522566{
    523567    newValue = std::max(std::min(newValue, max), min);
     568    if (changeOnSpecial)
     569    {
     570        adjustFont(labelWidget, (newValue == min));
     571        adjustFont(spinbox,     (newValue == min));
     572    }
    524573    if (spinbox && (spinbox->value() != newValue))
    525574    {
    526575        //int old = intValue();
     
    631680        QLabel *label = new QLabel();
    632681        label->setText(getLabel() + ":     ");
    633682        layout->addWidget(label);
     683        labelWidget = label;
    634684    }
    635685
    636686    bxwidget = widget;
     
    659709            cbwidget, SLOT(clear()));
    660710
    661711    if (rw)
     712    {
    662713        connect(cbwidget, SIGNAL(editTextChanged(const QString &)),
    663714                this, SLOT(editTextChanged(const QString &)));
     715        connect(cbwidget, SIGNAL(editTextChanged(const QString &)),
     716                this, SLOT(changeLabel(const QString &)));
     717    }
    664718
    665719    if (cg)
    666720        connect(cbwidget, SIGNAL(changeHelpText(QString)), cg,
     
    673727
    674728    widget->setLayout(layout);
    675729
     730    setValue(current);
     731
    676732    return widget;
    677733}
    678734
     
    682738    {
    683739        bxwidget = NULL;
    684740        cbwidget = NULL;
     741        labelWidget = NULL;
    685742    }
    686743}
    687744
     
    717774
    718775    if (rw)
    719776    {
     777        changeLabel(newValue);
    720778        Setting::setValue(newValue);
    721779        if (cbwidget)
    722780            cbwidget->setCurrentIndex(current);
     
    727785{
    728786    if (cbwidget)
    729787        cbwidget->setCurrentIndex(which);
     788    changeLabel(labels[which]);
    730789    SelectSetting::setValue(which);
    731790}
    732791
    733 void ComboBoxSetting::addSelection(
    734     const QString &label, QString value, bool select)
     792void ComboBoxSetting::changeLabel(const QString &newLabel)
    735793{
     794    if (changeOnSpecial)
     795    {
     796        adjustFont(labelWidget, specialLabel == newLabel);
     797        adjustFont(cbwidget,    specialLabel == newLabel);
     798    }
     799}
     800
     801void ComboBoxSetting::addSelection(const QString &label, QString value,
     802                                   bool select, bool special_formatting)
     803{
    736804    if ((findSelection(label, value) < 0) && cbwidget)
    737805    {
    738806        cbwidget->insertItem(label);
    739807    }
    740808
     809    if (special_formatting)
     810    {
     811        changeOnSpecial = true;
     812        specialLabel = label;
     813    }
     814
    741815    SelectSetting::addSelection(label, value, select);
    742816
    743817    if (cbwidget && isSet)
     
    9531027    BooleanSetting::setHelpText(str);
    9541028}
    9551029
     1030QWidget* TristateCheckBoxSetting::configWidget(ConfigurationGroup *cg,
     1031                                               QWidget* parent,
     1032                                               const char* widgetName) {
     1033    widget = new MythCheckBox(parent, widgetName, true);
     1034    connect(widget, SIGNAL(destroyed(QObject*)),
     1035            this,   SLOT(widgetDeleted(QObject*)));
     1036
     1037    widget->setHelpText(getHelpText());
     1038    widget->setText(getLabel());
     1039    widget->setCheckState(tristateValue());
     1040    setValue(tristateValue());
     1041
     1042    connect(widget, SIGNAL(stateChanged(int)),
     1043            this, SLOT(setValue(int)));
     1044    connect(this, SIGNAL(valueChanged(int)),
     1045            this, SLOT(relayValueChanged(int)));
     1046
     1047    if (cg)
     1048        connect(widget, SIGNAL(changeHelpText(QString)), cg,
     1049                SIGNAL(changeHelpText(QString)));
     1050
     1051    return widget;
     1052}
     1053
     1054void TristateCheckBoxSetting::widgetInvalid(QObject *obj)
     1055{
     1056    widget = (widget == obj) ? NULL : widget;
     1057}
     1058
     1059void TristateCheckBoxSetting::setEnabled(bool fEnabled)
     1060{
     1061    TristateSetting::setEnabled(fEnabled);
     1062    if (widget)
     1063        widget->setEnabled(fEnabled);
     1064}
     1065
     1066void TristateCheckBoxSetting::setHelpText(const QString &str)
     1067{
     1068    if (widget)
     1069        widget->setHelpText(str);
     1070    TristateSetting::setHelpText(str);
     1071}
     1072
     1073const char *TristateSetting::kPartiallyCheckedString = "default";
     1074
     1075void TristateCheckBoxSetting::setValue(int check)
     1076{
     1077    adjustFont(widget, (check != Qt::Checked && check != Qt::Unchecked));
     1078    TristateSetting::setValue(check);
     1079    emit valueChanged(check);
     1080}
     1081
     1082void TristateSetting::setValue(int check)
     1083{
     1084    if (check == Qt::Checked)
     1085        Setting::setValue("1");
     1086    else if (check == Qt::Unchecked)
     1087        Setting::setValue("0");
     1088    else
     1089        Setting::setValue(kPartiallyCheckedString);
     1090    emit valueChanged(check);
     1091}
     1092
    9561093void AutoIncrementDBSetting::Save(QString table)
    9571094{
    9581095    if (intValue() == 0)
     
    11401277    addSelection(label, value, select);
    11411278}
    11421279
     1280void ImageSelectSetting::addDefaultSelection(const QString label,
     1281                                             const QString value,
     1282                                             const QString defaultValue,
     1283                                             bool select)
     1284{
     1285    for (unsigned i=0; i<values.size(); i++)
     1286    {
     1287        if (values[i] == defaultValue)
     1288        {
     1289            changeOnSpecial = true;
     1290            specialLabel = label;
     1291            images.push_back(new QImage(*images[i]));
     1292            addSelection(label, value, select);
     1293            return;
     1294        }
     1295    }
     1296}
     1297
    11431298ImageSelectSetting::~ImageSelectSetting()
    11441299{
    11451300    Teardown();
     
    11621317    bxwidget   = NULL;
    11631318    imagelabel = NULL;
    11641319    combo      = NULL;
     1320    labelWidget = NULL;
    11651321}
    11661322
    11671323void ImageSelectSetting::imageSet(int num)
     
    12091365        QLabel *label = new QLabel();
    12101366        label->setText(getLabel() + ":");
    12111367        layout->addWidget(label);
     1368        labelWidget = label;
    12121369    }
    12131370
    12141371    combo = new MythComboBox(false);
     
    12551412    connect(combo, SIGNAL(highlighted(int)), this, SLOT(imageSet(int)));
    12561413    connect(combo, SIGNAL(activated(int)), this, SLOT(setValue(int)));
    12571414    connect(combo, SIGNAL(activated(int)), this, SLOT(imageSet(int)));
     1415    connect(combo, SIGNAL(highlighted(const QString &)),
     1416            this, SLOT(changeLabel(const QString &)));
     1417    connect(combo, SIGNAL(activated(const QString &)),
     1418            this, SLOT(changeLabel(const QString &)));
    12581419
    12591420    connect(this, SIGNAL(selectionsCleared()),
    12601421            combo, SLOT(clear()));
     
    12651426
    12661427    bxwidget->setLayout(layout);
    12671428
     1429    changeLabel(GetLabel(current));
     1430
    12681431    return bxwidget;
    12691432}
    12701433
     1434void ImageSelectSetting::changeLabel(const QString &newLabel)
     1435{
     1436    if (changeOnSpecial)
     1437    {
     1438        adjustFont(labelWidget, specialLabel == newLabel);
     1439        adjustFont(combo,       specialLabel == newLabel);
     1440    }
     1441}
     1442
    12711443void ImageSelectSetting::widgetInvalid(QObject *obj)
    12721444{
    12731445    if (bxwidget == obj)
  • libs/libmyth/mythwidgets.cpp

     
    224224        else if (action == "DOWN")
    225225            focusNextPrevChild(true);
    226226        else if (action == "LEFT" || action == "RIGHT" || action == "SELECT")
    227             toggle();
     227        {
     228            if (isTristate())
     229            {
     230                Qt::CheckState newState =
     231                    (Qt::CheckState)(((int)checkState() + 1) % 3);
     232                setCheckState(newState);
     233            }
     234            else
     235                toggle();
     236        }
    228237        else
    229238            handled = false;
    230239    }
  • libs/libmyth/settings.h

     
    134134
    135135class MPUBLIC LineEditSetting : public Setting
    136136{
     137    Q_OBJECT
     138
    137139  protected:
    138     LineEditSetting(Storage *_storage, bool readwrite = true) :
     140    LineEditSetting(Storage *_storage, bool readwrite = true,
     141                    bool adjust_on_blank = false) :
    139142        Setting(_storage), bxwidget(NULL), edit(NULL),
    140         rw(readwrite), password_echo(false) { }
     143        rw(readwrite), password_echo(false),
     144        adjustOnBlank(adjust_on_blank), labelWidget(NULL) { }
    141145
    142146  public:
    143147    virtual QWidget* configWidget(ConfigurationGroup *cg, QWidget* parent,
     
    159163
    160164    virtual void setHelpText(const QString &str);
    161165
     166  public slots:
     167    virtual void setValue(const QString &newValue);
     168
    162169  private:
    163170    QWidget      *bxwidget;
    164171    MythLineEdit *edit;
    165172    bool rw;
    166173    bool password_echo;
     174    bool adjustOnBlank;
     175    QWidget *labelWidget;
    167176};
    168177
    169178// TODO: set things up so that setting the value as a string emits
     
    219228  public:
    220229    SpinBoxSetting(Storage *_storage, int min, int max, int step,
    221230                   bool allow_single_step = false,
    222                    QString special_value_text = "");
     231                   QString special_value_text = "",
     232                   bool change_style_on_special = false);
    223233
    224234    virtual QWidget *configWidget(ConfigurationGroup *cg, QWidget *parent,
    225235                                  const char *widgetName = 0);
     
    248258    bool         relayEnabled;
    249259    bool         sstep;
    250260    QString      svtext;
     261    QLabel      *labelWidget;
     262    bool         changeOnSpecial;
    251263};
    252264
    253265class MPUBLIC SelectSetting : public Setting
     
    277289        { return (i < labels.size()) ? labels[i] : QString::null; }
    278290    virtual QString GetValue(uint i) const
    279291        { return (i < values.size()) ? values[i] : QString::null; }
     292    virtual QString GetValueLabel(const QString &value);
    280293
    281294signals:
    282295    void selectionAdded(const QString& label, QString value);
     
    318331protected:
    319332    ComboBoxSetting(Storage *_storage, bool _rw = false, int _step = 1) :
    320333        SelectSetting(_storage), rw(_rw),
    321         bxwidget(NULL), cbwidget(NULL), step(_step) { }
     334        bxwidget(NULL), cbwidget(NULL), changeOnSpecial(false),
     335        specialLabel(""), labelWidget(NULL), step(_step) { }
    322336
    323337public:
    324338    virtual void setValue(QString newValue);
     
    340354public slots:
    341355    void addSelection(const QString &label,
    342356                      QString value = QString::null,
    343                       bool select = false);
     357                      bool select = false,
     358                      bool special_formatting = false);
    344359    bool removeSelection(const QString &label,
    345360                         QString value = QString::null);
     361    virtual void changeLabel(const QString &newValue);
    346362    void editTextChanged(const QString &newText);
    347363
    348364private:
    349365    bool rw;
    350366    QWidget      *bxwidget;
    351367    MythComboBox *cbwidget;
     368    bool          changeOnSpecial;
     369    QString       specialLabel;
     370    QLabel       *labelWidget;
    352371
    353372protected:
    354373    int step;
     
    417436    ImageSelectSetting(Storage *_storage) :
    418437        SelectSetting(_storage),
    419438        bxwidget(NULL), imagelabel(NULL), combo(NULL),
    420         m_hmult(1.0f), m_wmult(1.0f) { }
     439        m_hmult(1.0f), m_wmult(1.0f),
     440        changeOnSpecial(false), specialLabel(""), labelWidget(NULL) { }
    421441    virtual QWidget* configWidget(ConfigurationGroup *cg, QWidget* parent,
    422442                                  const char* widgetName = 0);
    423443    virtual void widgetInvalid(QObject *obj);
     
    428448                                   QImage* image,
    429449                                   QString value=QString::null,
    430450                                   bool select=false);
     451    virtual void addDefaultSelection(const QString label,
     452                                     const QString value,
     453                                     const QString defaultValue,
     454                                     bool select);
    431455
    432456protected slots:
    433457    void imageSet(int);
     458    void changeLabel(const QString &newLabel);
    434459
    435460  protected:
    436461    void Teardown(void);
     
    442467    QLabel *imagelabel;
    443468    MythComboBox *combo;
    444469    float m_hmult, m_wmult;
     470    bool          changeOnSpecial;
     471    QString       specialLabel;
     472    QLabel       *labelWidget;
    445473};
    446474
    447475class MPUBLIC BooleanSetting : public Setting
     
    484512    MythCheckBox *widget;
    485513};
    486514
     515class MPUBLIC TristateSetting : public BooleanSetting
     516{
     517    Q_OBJECT
     518
     519  public:
     520    TristateSetting(Storage *_storage) : BooleanSetting(_storage) {}
     521
     522    Qt::CheckState tristateValue(void) const {
     523        if (getValue() == "0")
     524            return Qt::Unchecked;
     525        if (getValue() == "1")
     526            return Qt::Checked;
     527        return Qt::PartiallyChecked;
     528    }
     529
     530    static const char *kPartiallyCheckedString;
     531
     532public slots:
     533    virtual void setValue(/*Qt::CheckState*/int check);
     534
     535signals:
     536    void valueChanged(int);
     537};
     538
     539class MPUBLIC TristateCheckBoxSetting: public TristateSetting {
     540    Q_OBJECT
     541
     542public:
     543    TristateCheckBoxSetting(Storage *_storage) :
     544        TristateSetting(_storage), widget(NULL) { }
     545    virtual QWidget* configWidget(ConfigurationGroup *cg, QWidget* parent,
     546                                  const char* widgetName = 0);
     547    virtual void widgetInvalid(QObject*);
     548
     549    virtual void setEnabled(bool b);
     550
     551    virtual void setHelpText(const QString &str);
     552
     553
     554public slots:
     555    virtual void setValue(/*Qt::CheckState*/int check);
     556    virtual void relayValueChanged(int state) {
     557        if (widget)
     558            widget->setCheckState((Qt::CheckState)state);
     559    }
     560
     561protected:
     562    MythCheckBox *widget;
     563};
     564
    487565class MPUBLIC PathSetting : public ComboBoxSetting
    488566{
    489567public:
  • libs/libmyth/libmyth.pro

     
    6262SOURCES += mythrssmanager.cpp     netgrabbermanager.cpp
    6363SOURCES += rssparse.cpp           netutils.cpp
    6464
     65HEADERS += playsettings.h
     66SOURCES += playsettings.cpp
     67
    6568# remove when everything is switched to mythui
    6669SOURCES += virtualkeyboard_qt.cpp
    6770
  • libs/libmyth/mythconfiggroups.cpp

     
    476476                                            Configurable *target)
    477477{
    478478    VerifyLayout();
     479    bool isDuplicate = triggerMap.values().contains(target);
    479480    triggerMap[triggerValue] = target;
    480481
    481482    if (!configStack)
     
    485486        configStack->setSaveAll(isSaveAll);
    486487    }
    487488
    488     configStack->addChild(target);
     489    // Don't add a target as a child if it has already been added,
     490    // otherwise something goes wrong with signals in the child.
     491    if (!isDuplicate)
     492        configStack->addChild(target);
    489493}
    490494
    491495Setting *TriggeredConfigurationGroup::byName(const QString &settingName)
  • libs/libmyth/mythwidgets.h

     
    329329    Q_OBJECT
    330330
    331331  public:
    332     MythCheckBox(QWidget *parent = 0, const char *name = "MythCheckBox")
    333         : QCheckBox(parent)       { setObjectName(name); };
     332    MythCheckBox(QWidget *parent = 0, const char *name = "MythCheckBox",
     333                 bool isTristate = false) : QCheckBox(parent)
     334    {
     335        setObjectName(name);
     336        setTristate(isTristate);
     337    }
    334338    MythCheckBox(const QString &text,
    335                  QWidget *parent = 0, const char *name = "MythCheckBox")
    336         : QCheckBox(text, parent) { setObjectName(name); };
     339                 QWidget *parent = 0, const char *name = "MythCheckBox",
     340                 bool isTristate = false) : QCheckBox(text, parent)
     341    {
     342        setObjectName(name);
     343        setTristate(isTristate);
     344    }
    337345
    338346    void setHelpText(const QString&);
    339347
  • programs/mythfrontend/globalsettings.cpp

     
    3737#include "mythconfig.h"
    3838#include "mythdirs.h"
    3939#include "mythuihelper.h"
     40#include "playsettings.h"
    4041
     42#define CREATE_CHECKBOX_SETTING(var, name, settings) \
     43    BooleanSetting *var; \
     44    if ((settings)) \
     45        var = new PlaySettingsCheckBox((name), (settings)); \
     46    else \
     47        var = new HostCheckBox((name))
     48
     49#define CREATE_COMBOBOX_SETTING(var, name, settings) \
     50    ComboBoxSetting *var; \
     51    if ((settings)) \
     52        var = new PlaySettingsComboBox((name), (settings)); \
     53    else \
     54        var = new HostComboBox((name))
     55
     56#define CREATE_COMBOBOX1_SETTING(var, name, settings, arg1) \
     57    ComboBoxSetting *var; \
     58    if ((settings)) \
     59        var = new PlaySettingsComboBox((name), (settings), (arg1)); \
     60    else \
     61        var = new HostComboBox((name), (arg1))
     62
     63#define CREATE_SPINBOX_SETTING(var, name, settings, arg1, arg2, arg3, arg4) \
     64    SpinBoxSetting *var; \
     65    if ((settings)) \
     66        var = new PlaySettingsSpinBox((name), (settings), (arg1), (arg2), (arg3), (arg4)); \
     67    else \
     68        var = new HostSpinBox((name), (arg1), (arg2), (arg3), (arg4))
     69
     70#define CREATE_LINEEDIT_SETTING(var, name, settings) \
     71    LineEditSetting *var; \
     72    if ((settings)) \
     73        var = new PlaySettingsLineEdit((name), (settings), ""); \
     74    else \
     75        var = new HostLineEdit((name))
     76
     77// For PlaySettings, use a SpinBox instead of a Slider so that a
     78// default value can be easily used.
     79#define CREATE_SLIDER_SETTING(var, name, settings, arg1, arg2, arg3) \
     80    BoundedIntegerSetting *var; \
     81    if ((settings)) \
     82        var = new PlaySettingsSpinBox((name), (settings), (arg1), (arg2), (arg3)); \
     83    else \
     84        var = new HostSlider((name), (arg1), (arg2), (arg3))
     85
     86#define CREATE_IMAGESELECT_SETTING(var, name, settings) \
     87    ImageSelectSetting *var; \
     88    if ((settings)) \
     89        var = new PlaySettingsImageSelect((name), (settings)); \
     90    else \
     91        var = new HostImageSelect((name))
     92
     93static Setting *wrap(Setting *obj, PlaySettings *settings,
     94                     bool twoLineLabel=false)
     95{
     96    if (!settings)
     97        return obj;
     98
     99    // Get the setting name
     100    PlaySettingsCombinedStorage *storage =
     101        dynamic_cast<PlaySettingsCombinedStorage *>(obj);
     102    const QString &name = storage->getName();
     103
     104    // Get the default value and label.  The label is  different
     105    // from the value for most object types.
     106    QString defaultValue = settings->GetSetting(name, "", true);
     107    QString defaultLabel(defaultValue);
     108    if (dynamic_cast<BooleanSetting *>(obj))
     109        defaultLabel = (defaultValue == "0" || defaultValue.isEmpty() ?
     110                        QObject::tr("disabled") : QObject::tr("enabled"));
     111    if (dynamic_cast<SpinBoxSetting *>(obj) && defaultValue.isEmpty())
     112        defaultLabel = "0";
     113    ComboBoxSetting *cb = dynamic_cast<ComboBoxSetting *>(obj);
     114    if (cb)
     115    {
     116        defaultLabel = cb->GetValueLabel(defaultValue);
     117        // Add the default selection to a ComboBox
     118        cb->addSelection(QString("(") + QObject::tr("default") + ")",
     119                         storage->getDefault(),
     120                         !settings->IsOverridden(name),
     121                         true);
     122    }
     123    ImageSelectSetting *is = dynamic_cast<ImageSelectSetting *>(obj);
     124    if (is)
     125    {
     126        defaultLabel = is->GetValueLabel(defaultValue);
     127        // Add the default selection to a ImageSelect
     128        is->addDefaultSelection(QString("(") + QObject::tr("default") + ")",
     129                                storage->getDefault(),
     130                                defaultValue,
     131                                !settings->IsOverridden(name));
     132    }
     133   
     134    // Change the help text to include the default and its source.
     135    QString helpPrefix;
     136    if (dynamic_cast<LineEditSetting *>(obj))
     137        helpPrefix = QObject::tr("Leave blank to keep default value");
     138    else
     139        helpPrefix = QObject::tr("Override default value");
     140    helpPrefix += " (" + defaultLabel + ") ";
     141    QString inheritsFrom = settings->InheritsFrom(name);
     142    if (inheritsFrom.isNull())
     143        helpPrefix += QObject::tr("from global settings");
     144    else
     145        helpPrefix += QObject::tr("from group") + " " + inheritsFrom;
     146    helpPrefix += ". " + obj->getHelpText();
     147    obj->setHelpText(helpPrefix);
     148
     149    // Change the label to include the default.
     150    obj->setLabel(obj->getLabel() + (twoLineLabel ? "\n" : "") +
     151                  " (" + defaultLabel + ")");
     152
     153    return obj;
     154}
     155
    41156class TriggeredItem : public TriggeredConfigurationGroup
    42157{
    43158  public:
     
    593708    return gs;
    594709}
    595710
    596 static HostCheckBox *DecodeExtraAudio()
     711static Setting *DecodeExtraAudio(PlaySettings *settings)
    597712{
    598     HostCheckBox *gc = new HostCheckBox("DecodeExtraAudio");
     713    CREATE_CHECKBOX_SETTING(gc, "DecodeExtraAudio", settings);
    599714    gc->setLabel(QObject::tr("Extra audio buffering"));
    600715    gc->setValue(true);
    601716    gc->setHelpText(QObject::tr("Enable this setting if MythTV is playing "
     
    604719                    "effect on framegrabbers (MPEG-4/RTJPEG). MythTV will "
    605720                    "keep extra audio data in its internal buffers to "
    606721                    "workaround this bug."));
    607     return gc;
     722    return wrap(gc, settings);
    608723}
    609724
    610 static HostComboBox *PIPLocationComboBox()
     725static Setting *PIPLocationComboBox(PlaySettings *settings)
    611726{
    612     HostComboBox *gc = new HostComboBox("PIPLocation");
     727    CREATE_COMBOBOX_SETTING(gc, "PIPLocation", settings);
    613728    gc->setLabel(QObject::tr("PIP video location"));
    614729    for (uint loc = 0; loc < kPIP_END; ++loc)
    615730        gc->addSelection(toString((PIPLocation) loc), QString::number(loc));
    616731    gc->setHelpText(QObject::tr("Location of PIP Video window."));
    617     return gc;
     732    return wrap(gc, settings);
    618733}
    619734
    620735static GlobalLineEdit *AllRecGroupPassword()
     
    710825    return gc;
    711826}
    712827
    713 static HostCheckBox *SmartForward()
     828static Setting *SmartForward(PlaySettings *settings)
    714829{
    715     HostCheckBox *gc = new HostCheckBox("SmartForward");
     830    CREATE_CHECKBOX_SETTING(gc, "SmartForward", settings);
    716831    gc->setLabel(QObject::tr("Smart fast forwarding"));
    717832    gc->setValue(false);
    718833    gc->setHelpText(QObject::tr("If enabled, then immediately after "
    719834                    "rewinding, only skip forward the same amount as "
    720835                    "skipping backwards."));
    721     return gc;
     836    return wrap(gc, settings);
    722837}
    723838
    724 static HostCheckBox *ExactSeeking()
     839static Setting *ExactSeeking(PlaySettings *settings)
    725840{
    726     HostCheckBox *gc = new HostCheckBox("ExactSeeking");
     841    CREATE_CHECKBOX_SETTING(gc, "ExactSeeking", settings);
    727842    gc->setLabel(QObject::tr("Seek to exact frame"));
    728843    gc->setValue(false);
    729844    gc->setHelpText(QObject::tr("If enabled, seeking is frame exact, but "
    730845                    "slower."));
    731     return gc;
     846    return wrap(gc, settings);
    732847}
    733848
    734849static GlobalComboBox *CommercialSkipMethod()
     
    746861    return bc;
    747862}
    748863
    749 static HostComboBox *AutoCommercialSkip()
     864static Setting *AutoCommercialSkip(PlaySettings *settings)
    750865{
    751     HostComboBox *gc = new HostComboBox("AutoCommercialSkip");
     866    CREATE_COMBOBOX_SETTING(gc, "AutoCommercialSkip", settings);
    752867    gc->setLabel(QObject::tr("Automatically skip commercials"));
    753868    gc->addSelection(QObject::tr("Off"), "0");
    754869    gc->addSelection(QObject::tr("Notify, but do not skip"), "2");
     
    757872                    "have been flagged during automatic commercial detection "
    758873                    "or by the mythcommflag program, or just notify that a "
    759874                    "commercial has been detected."));
    760     return gc;
     875    return wrap(gc, settings);
    761876}
    762877
    763878static GlobalCheckBox *AutoCommercialFlag()
     
    843958    return bc;
    844959}
    845960
    846 static HostSpinBox *CommRewindAmount()
     961static Setting *CommRewindAmount(PlaySettings *settings)
    847962{
    848     HostSpinBox *gs = new HostSpinBox("CommRewindAmount", 0, 10, 1);
     963    CREATE_SPINBOX_SETTING(gs, "CommRewindAmount", settings, 0, 10, 1, false);
    849964    gs->setLabel(QObject::tr("Commercial skip automatic rewind amount (secs)"));
    850965    gs->setHelpText(QObject::tr("MythTV will automatically rewind "
    851966                    "this many seconds after performing a commercial skip."));
    852967    gs->setValue(0);
    853     return gs;
     968    return wrap(gs, settings);
    854969}
    855970
    856 static HostSpinBox *CommNotifyAmount()
     971static Setting *CommNotifyAmount(PlaySettings *settings)
    857972{
    858     HostSpinBox *gs = new HostSpinBox("CommNotifyAmount", 0, 10, 1);
     973    CREATE_SPINBOX_SETTING(gs, "CommNotifyAmount", settings, 0, 10, 1, false);
    859974    gs->setLabel(QObject::tr("Commercial skip notify amount (secs)"));
    860975    gs->setHelpText(QObject::tr("MythTV will act like a commercial "
    861976                    "begins this many seconds early. This can be useful "
    862977                    "when commercial notification is used in place of "
    863978                    "automatic skipping."));
    864979    gs->setValue(0);
    865     return gs;
     980    return wrap(gs, settings);
    866981}
    867982
    868983static GlobalSpinBox *MaximumCommercialSkip()
     
    16641779    labels[j]->setValue(label_i);
    16651780}
    16661781
    1667 PlaybackProfileConfigs::PlaybackProfileConfigs(const QString &str) :
     1782PlaybackProfileConfigs::PlaybackProfileConfigs(const QString &str,
     1783                                               PlaySettings *settings) :
    16681784    TriggeredConfigurationGroup(false, true,  true, true,
    16691785                                false, false, true, true), grouptrigger(NULL)
    16701786{
    16711787    setLabel(QObject::tr("Playback Profiles") + str);
     1788    if (settings)
     1789        setLabel(QObject::tr("Playback group settings for ") +
     1790                 settings->mGroupName + " - " +
     1791                 getLabel());
    16721792
    16731793    QString host = gCoreContext->GetHostName();
    16741794    QStringList profiles = VideoDisplayProfile::GetProfiles(host);
     
    16961816        profiles = VideoDisplayProfile::GetProfiles(host);
    16971817    }
    16981818
    1699     QString profile = VideoDisplayProfile::GetDefaultProfileName(host);
     1819    QString profile = VideoDisplayProfile::GetDefaultProfileName(host, settings);
    17001820    if (!profiles.contains(profile))
    17011821    {
    17021822        profile = (profiles.contains("Normal")) ? "Normal" : profiles[0];
    17031823        VideoDisplayProfile::SetDefaultProfileName(profile, host);
    17041824    }
    17051825
    1706     grouptrigger = new HostComboBox("DefaultVideoPlaybackProfile");
     1826    CREATE_COMBOBOX_SETTING(gs, "DefaultVideoPlaybackProfile", settings);
     1827    grouptrigger = gs;
    17071828    grouptrigger->setLabel(QObject::tr("Current Video Playback Profile"));
    17081829    QStringList::const_iterator it;
    17091830    for (it = profiles.begin(); it != profiles.end(); ++it)
    17101831        grouptrigger->addSelection(ProgramInfo::i18n(*it), *it);
     1832    if (settings)
     1833    {
     1834        addChild(wrap(grouptrigger, settings));
     1835        return;
     1836    }
    17111837
    17121838    HorizontalConfigurationGroup *grp =
    17131839        new HorizontalConfigurationGroup(false, false, true, true);
     
    18401966    return gc;
    18411967}
    18421968
    1843 static HostSpinBox *FFRewReposTime()
     1969static Setting *FFRewReposTime(PlaySettings *settings)
    18441970{
    1845     HostSpinBox *gs = new HostSpinBox("FFRewReposTime", 0, 200, 5);
     1971    CREATE_SPINBOX_SETTING(gs, "FFRewReposTime", settings, 0, 200, 5, false);
    18461972    gs->setLabel(QObject::tr("Fast forward/rewind reposition amount"));
    18471973    gs->setValue(100);
    18481974    gs->setHelpText(QObject::tr("When exiting sticky keys fast forward/rewind "
     
    18501976                    "resuming normal playback. This "
    18511977                    "compensates for the reaction time between seeing "
    18521978                    "where to resume playback and actually exiting seeking."));
    1853     return gs;
     1979    return wrap(gs, settings);
    18541980}
    18551981
    1856 static HostCheckBox *FFRewReverse()
     1982static Setting *FFRewReverse(PlaySettings *settings)
    18571983{
    1858     HostCheckBox *gc = new HostCheckBox("FFRewReverse");
     1984    CREATE_CHECKBOX_SETTING(gc, "FFRewReverse", settings);
    18591985    gc->setLabel(QObject::tr("Reverse direction in fast forward/rewind"));
    18601986    gc->setValue(true);
    18611987    gc->setHelpText(QObject::tr("If enabled, pressing the sticky rewind key "
     
    18631989                    "vice versa. If disabled, it will decrease the "
    18641990                    "current speed or switch to play mode if "
    18651991                    "the speed can't be decreased further."));
    1866     return gc;
     1992    return wrap(gc, settings);
    18671993}
    18681994
    18691995static HostSpinBox *ThemeCacheSize()
     
    19252051    return gc;
    19262052}
    19272053
    1928 static HostSpinBox *OSDCC708TextZoomPercentage(void)
     2054static Setting *OSDCC708TextZoomPercentage(PlaySettings *settings)
    19292055{
    1930     HostSpinBox *gs = new HostSpinBox("OSDCC708TextZoom", 50, 200, 5);
     2056    CREATE_SPINBOX_SETTING(gs, "OSDCC708TextZoom", settings,
     2057                           50, 200, 5, false);
    19312058    gs->setLabel(QObject::tr("ATSC caption text zoom percentage"));
    19322059    gs->setValue(100);
    19332060    gs->setHelpText(QObject::tr("Use this to enlarge or shrink captions."));
    19342061
    1935     return gs;
     2062    return wrap(gs, settings);
    19362063}
    19372064
    1938 static HostComboBox *SubtitleCodec()
     2065static Setting *SubtitleCodec(PlaySettings *settings)
    19392066{
    1940     HostComboBox *gc = new HostComboBox("SubtitleCodec");
     2067    CREATE_COMBOBOX_SETTING(gc, "SubtitleCodec", settings);
    19412068
    19422069    gc->setLabel(QObject::tr("Subtitle Codec"));
    19432070    QList<QByteArray> list = QTextCodec::availableCodecs();
     
    19592086    return gc;
    19602087}
    19612088
    1962 static HostSpinBox *VertScanPercentage()
     2089static Setting *VertScanPercentage(PlaySettings *settings)
    19632090{
    1964     HostSpinBox *gs = new HostSpinBox("VertScanPercentage", -100, 100, 1);
     2091    CREATE_SPINBOX_SETTING(gs, "VertScanPercentage", settings,
     2092                           -100, 100, 1, false);
    19652093    gs->setLabel(QObject::tr("Vertical scaling"));
    19662094    gs->setValue(0);
    19672095    gs->setHelpText(QObject::tr(
    19682096                        "Adjust this if the image does not fill your "
    19692097                        "screen vertically. Range -100% to 100%"));
    1970     return gs;
     2098    return wrap(gs, settings);
    19712099}
    19722100
    1973 static HostSpinBox *HorizScanPercentage()
     2101static Setting *HorizScanPercentage(PlaySettings *settings)
    19742102{
    1975     HostSpinBox *gs = new HostSpinBox("HorizScanPercentage", -100, 100, 1);
     2103    CREATE_SPINBOX_SETTING(gs, "HorizScanPercentage", settings,
     2104                           -100, 100, 1, false);
    19762105    gs->setLabel(QObject::tr("Horizontal scaling"));
    19772106    gs->setValue(0);
    19782107    gs->setHelpText(QObject::tr(
    19792108                        "Adjust this if the image does not fill your "
    19802109                        "screen horizontally. Range -100% to 100%"));
    1981     return gs;
     2110    return wrap(gs, settings);
    19822111};
    19832112
    1984 static HostSpinBox *XScanDisplacement()
     2113static Setting *XScanDisplacement(PlaySettings *settings)
    19852114{
    1986     HostSpinBox *gs = new HostSpinBox("XScanDisplacement", -50, 50, 1);
     2115    CREATE_SPINBOX_SETTING(gs, "XScanDisplacement", settings,
     2116                           -50, 50, 1, false);
    19872117    gs->setLabel(QObject::tr("Scan displacement (X)"));
    19882118    gs->setValue(0);
    19892119    gs->setHelpText(QObject::tr("Adjust this to move the image horizontally."));
    1990     return gs;
     2120    return wrap(gs, settings);
    19912121}
    19922122
    1993 static HostSpinBox *YScanDisplacement()
     2123static Setting *YScanDisplacement(PlaySettings *settings)
    19942124{
    1995     HostSpinBox *gs = new HostSpinBox("YScanDisplacement", -50, 50, 1);
     2125    CREATE_SPINBOX_SETTING(gs, "YScanDisplacement", settings,
     2126                           -50, 50, 1, false);
    19962127    gs->setLabel(QObject::tr("Scan displacement (Y)"));
    19972128    gs->setValue(0);
    19982129    gs->setHelpText(QObject::tr("Adjust this to move the image vertically."));
    1999     return gs;
     2130    return wrap(gs, settings);
    20002131};
    20012132
    20022133static HostCheckBox *AlwaysStreamFiles()
     
    20112142    return gc;
    20122143}
    20132144
    2014 static HostCheckBox *CCBackground()
     2145static Setting *CCBackground(PlaySettings *settings)
    20152146{
    2016     HostCheckBox *gc = new HostCheckBox("CCBackground");
     2147    CREATE_CHECKBOX_SETTING(gc, "CCBackground", settings);
    20172148    gc->setLabel(QObject::tr("Black background for closed captioning"));
    20182149    gc->setValue(false);
    20192150    gc->setHelpText(QObject::tr(
    20202151                        "If enabled, captions will be displayed "
    20212152                        "as white text over a black background "
    20222153                        "for better contrast."));
    2023     return gc;
     2154    return wrap(gc, settings);
    20242155}
    20252156
    2026 static HostCheckBox *DefaultCCMode()
     2157static Setting *DefaultCCMode(PlaySettings *settings)
    20272158{
    2028     HostCheckBox *gc = new HostCheckBox("DefaultCCMode");
     2159    CREATE_CHECKBOX_SETTING(gc, "DefaultCCMode", settings);
    20292160    gc->setLabel(QObject::tr("Always display closed captioning or subtitles"));
    20302161    gc->setValue(false);
    20312162    gc->setHelpText(QObject::tr(
     
    20332164                        "when playing back recordings or watching "
    20342165                        "Live TV. Closed Captioning can be turned on or off "
    20352166                        "by pressing \"T\" during playback."));
    2036     return gc;
     2167    return wrap(gc, settings);
    20372168}
    20382169
    2039 static HostCheckBox *PreferCC708()
     2170static Setting *PreferCC708(PlaySettings *settings)
    20402171{
    2041     HostCheckBox *gc = new HostCheckBox("Prefer708Captions");
     2172    CREATE_CHECKBOX_SETTING(gc, "Prefer708Captions", settings);
    20422173    gc->setLabel(QObject::tr("Prefer EIA-708 over EIA-608 captions"));
    20432174    gc->setValue(true);
    20442175    gc->setHelpText(
     
    20462177            "If enabled, the newer EIA-708 captions will be preferred over "
    20472178            "the older EIA-608 captions in ATSC streams."));
    20482179
    2049     return gc;
     2180    return wrap(gc, settings);
    20502181}
    20512182
    2052 static HostCheckBox *EnableMHEG()
     2183static Setting *EnableMHEG(PlaySettings *settings)
    20532184{
    2054     HostCheckBox *gc = new HostCheckBox("EnableMHEG");
     2185    CREATE_CHECKBOX_SETTING(gc, "EnableMHEG", settings);
    20552186    gc->setLabel(QObject::tr("Enable interactive TV"));
    20562187    gc->setValue(false);
    20572188    gc->setHelpText(QObject::tr(
    20582189                        "If enabled, interactive TV applications (MHEG) will "
    20592190                        "be activated. This is used for teletext and logos for "
    20602191                        "radio and channels that are currently off-air."));
    2061     return gc;
     2192    return wrap(gc, settings);
    20622193}
    20632194
    2064 static HostCheckBox *PersistentBrowseMode()
     2195static Setting *PersistentBrowseMode(PlaySettings *settings)
    20652196{
    2066     HostCheckBox *gc = new HostCheckBox("PersistentBrowseMode");
     2197    CREATE_CHECKBOX_SETTING(gc, "PersistentBrowseMode", settings);
    20672198    gc->setLabel(QObject::tr("Always use browse mode in Live TV"));
    20682199    gc->setValue(true);
    20692200    gc->setHelpText(
    20702201        QObject::tr(
    20712202            "If enabled, browse mode will automatically be activated "
    20722203            "whenever you use channel up/down while watching Live TV."));
    2073     return gc;
     2204    return wrap(gc, settings);
    20742205}
    20752206
    2076 static HostCheckBox *BrowseAllTuners()
     2207static Setting *BrowseAllTuners(PlaySettings *settings)
    20772208{
    2078     HostCheckBox *gc = new HostCheckBox("BrowseAllTuners");
     2209    CREATE_CHECKBOX_SETTING(gc, "BrowseAllTuners", settings);
    20792210    gc->setLabel(QObject::tr("Browse all channels"));
    20802211    gc->setValue(false);
    20812212    gc->setHelpText(
     
    20832214            "If enabled, browse mode will shows channels on all "
    20842215            "available recording devices, instead of showing "
    20852216            "channels on just the current recorder."));
    2086     return gc;
     2217    return wrap(gc, settings);
    20872218}
    20882219
    2089 static HostCheckBox *ClearSavedPosition()
     2220static Setting *ClearSavedPosition(PlaySettings *settings)
    20902221{
    2091     HostCheckBox *gc = new HostCheckBox("ClearSavedPosition");
     2222    CREATE_CHECKBOX_SETTING(gc, "ClearSavedPosition", settings);
    20922223    gc->setLabel(QObject::tr("Clear bookmark on playback"));
    20932224    gc->setValue(true);
    20942225    gc->setHelpText(QObject::tr("If enabled, automatically clear the "
    20952226                    "bookmark on a recording when the recording is played "
    20962227                    "back. If disabled, you can mark the beginning with "
    20972228                    "rewind then save position."));
    2098     return gc;
     2229    return wrap(gc, settings);
    20992230}
    21002231
    2101 static HostCheckBox *AltClearSavedPosition()
     2232static Setting *AltClearSavedPosition(PlaySettings *settings)
    21022233{
    2103     HostCheckBox *gc = new HostCheckBox("AltClearSavedPosition");
     2234    CREATE_CHECKBOX_SETTING(gc, "AltClearSavedPosition", settings);
    21042235    gc->setLabel(QObject::tr("Alternate clear and save bookmark"));
    21052236    gc->setValue(true);
    21062237    gc->setHelpText(QObject::tr("During playback the SELECT key "
     
    21082239                    "Saved\" and \"Bookmark Cleared\". If disabled, the "
    21092240                    "SELECT key will save the current position for each "
    21102241                    "keypress."));
    2111     return gc;
     2242    return wrap(gc, settings);
    21122243}
    21132244
    21142245#if defined(USING_XV) || defined(USING_OPENGL_VIDEO) || defined(USING_VDPAU)
    2115 static HostCheckBox *UsePicControls()
     2246static Setting *UsePicControls(PlaySettings *settings)
    21162247{
    2117     HostCheckBox *gc = new HostCheckBox("UseOutputPictureControls");
     2248    CREATE_CHECKBOX_SETTING(gc, "UseOutputPictureControls", settings);
    21182249    gc->setLabel(QObject::tr("Enable picture controls"));
    21192250    gc->setValue(false);
    21202251    gc->setHelpText(
    21212252        QObject::tr(
    21222253            "If enabled, MythTV attempts to initialize picture controls "
    21232254            "(brightness, contrast, etc.) that are applied during playback."));
    2124     return gc;
     2255    return wrap(gc, settings);
    21252256}
    21262257#endif
    21272258
    2128 static HostLineEdit *UDPNotifyPort()
     2259static Setting *UDPNotifyPort(PlaySettings *settings)
    21292260{
    2130     HostLineEdit *ge = new HostLineEdit("UDPNotifyPort");
     2261    CREATE_LINEEDIT_SETTING(ge, "UDPNotifyPort", settings);
    21312262    ge->setLabel(QObject::tr("UDP notify port"));
    21322263    ge->setValue("6948");
    21332264    ge->setHelpText(QObject::tr("During playback, MythTV will listen for "
    21342265                    "connections from the \"mythtvosd\" or \"mythudprelay\" "
    21352266                    "programs on this port. For additional information, see "
    21362267                    "http://www.mythtv.org/wiki/MythNotify ."));
    2137     return ge;
     2268    return wrap(ge, settings);
    21382269}
    21392270
    2140 static HostComboBox *PlaybackExitPrompt()
     2271static Setting *PlaybackExitPrompt(PlaySettings *settings)
    21412272{
    2142     HostComboBox *gc = new HostComboBox("PlaybackExitPrompt");
     2273    CREATE_COMBOBOX_SETTING(gc, "PlaybackExitPrompt", settings);
    21432274    gc->setLabel(QObject::tr("Action on playback exit"));
    21442275    gc->addSelection(QObject::tr("Just exit"), "0");
    21452276    gc->addSelection(QObject::tr("Save position and exit"), "2");
     
    21502281                    "when you exit playback mode. The options available will "
    21512282                    "allow you to save your position, delete the "
    21522283                    "recording, or continue watching."));
    2153     return gc;
     2284    return wrap(gc, settings);
    21542285}
    21552286
    2156 static HostCheckBox *EndOfRecordingExitPrompt()
     2287static Setting *EndOfRecordingExitPrompt(PlaySettings *settings)
    21572288{
    2158     HostCheckBox *gc = new HostCheckBox("EndOfRecordingExitPrompt");
     2289    CREATE_CHECKBOX_SETTING(gc, "EndOfRecordingExitPrompt", settings);
    21592290    gc->setLabel(QObject::tr("Prompt at end of recording"));
    21602291    gc->setValue(false);
    21612292    gc->setHelpText(QObject::tr("If enabled, a menu will be displayed allowing "
    21622293                    "you to delete the recording when it has finished "
    21632294                    "playing."));
    2164     return gc;
     2295    return wrap(gc, settings);
    21652296}
    21662297
    2167 static HostCheckBox *JumpToProgramOSD()
     2298static Setting *JumpToProgramOSD(PlaySettings *settings)
    21682299{
    2169     HostCheckBox *gc = new HostCheckBox("JumpToProgramOSD");
     2300    CREATE_CHECKBOX_SETTING(gc, "JumpToProgramOSD", settings);
    21702301    gc->setLabel(QObject::tr("Jump to program OSD"));
    21712302    gc->setValue(true);
    21722303    gc->setHelpText(QObject::tr(
     
    21752306                        "'Watch Recording' screen when 'Jump to Program' "
    21762307                        "is activated. If enabled, the recordings are shown "
    21772308                        "in the OSD"));
    2178     return gc;
     2309    return wrap(gc, settings);
    21792310}
    21802311
    2181 static HostCheckBox *ContinueEmbeddedTVPlay()
     2312static Setting *ContinueEmbeddedTVPlay(PlaySettings *settings)
    21822313{
    2183     HostCheckBox *gc = new HostCheckBox("ContinueEmbeddedTVPlay");
     2314    CREATE_CHECKBOX_SETTING(gc, "ContinueEmbeddedTVPlay", settings);
    21842315    gc->setLabel(QObject::tr("Continue playback when embedded"));
    21852316    gc->setValue(false);
    21862317    gc->setHelpText(QObject::tr(
     
    21882319                    "is embedded in the upcoming program list or recorded "
    21892320                    "list. The default is to pause the recorded show when "
    21902321                    "embedded."));
    2191     return gc;
     2322    return wrap(gc, settings);
    21922323}
    21932324
    2194 static HostCheckBox *AutomaticSetWatched()
     2325static Setting *AutomaticSetWatched(PlaySettings *settings)
    21952326{
    2196     HostCheckBox *gc = new HostCheckBox("AutomaticSetWatched");
     2327    CREATE_CHECKBOX_SETTING(gc, "AutomaticSetWatched", settings);
    21972328    gc->setLabel(QObject::tr("Automatically mark a recording as watched"));
    21982329    gc->setValue(false);
    21992330    gc->setHelpText(QObject::tr("If enabled, when you exit near the end of a "
     
    22012332                    "detection is not foolproof, so do not enable this "
    22022333                    "setting if you don't want an unwatched recording marked "
    22032334                    "as watched."));
    2204     return gc;
     2335    return wrap(gc, settings);
    22052336}
    22062337
    22072338static HostSpinBox *LiveTVIdleTimeout()
     
    24392570    return gc;
    24402571}
    24412572
    2442 static HostComboBox *LetterboxingColour()
     2573static Setting *LetterboxingColour(PlaySettings *settings)
    24432574{
    2444     HostComboBox *gc = new HostComboBox("LetterboxColour");
     2575    CREATE_COMBOBOX_SETTING(gc, "LetterboxColour", settings);
    24452576    gc->setLabel(QObject::tr("Letterboxing color"));
    24462577    for (int m = kLetterBoxColour_Black; m < kLetterBoxColour_END; ++m)
    24472578        gc->addSelection(toString((LetterBoxColour)m), QString::number(m));
     
    24512582            "letterboxing, but those with plasma screens may prefer gray "
    24522583            "to minimize burn-in.") + " " +
    24532584        QObject::tr("Currently only works with XVideo video renderer."));
    2454     return gc;
     2585    return wrap(gc, settings);
    24552586}
    24562587
    2457 static HostComboBox *AspectOverride()
     2588static Setting *AspectOverride(PlaySettings *settings)
    24582589{
    2459     HostComboBox *gc = new HostComboBox("AspectOverride");
     2590    CREATE_COMBOBOX_SETTING(gc, "AspectOverride", settings);
    24602591    gc->setLabel(QObject::tr("Video aspect override"));
    24612592    for (int m = kAspect_Off; m < kAspect_END; ++m)
    24622593        gc->addSelection(toString((AspectOverrideMode)m), QString::number(m));
     
    24642595                        "When enabled, these will override the aspect "
    24652596                        "ratio specified by any broadcaster for all "
    24662597                        "video streams."));
    2467     return gc;
     2598    return wrap(gc, settings);
    24682599}
    24692600
    2470 static HostComboBox *AdjustFill()
     2601static Setting *AdjustFill(PlaySettings *settings)
    24712602{
    2472     HostComboBox *gc = new HostComboBox("AdjustFill");
     2603    CREATE_COMBOBOX_SETTING(gc, "AdjustFill", settings);
    24732604    gc->setLabel(QObject::tr("Zoom"));
    24742605    gc->addSelection(toString(kAdjustFill_AutoDetect_DefaultOff),
    24752606                     QString::number(kAdjustFill_AutoDetect_DefaultOff));
     
    24802611    gc->setHelpText(QObject::tr(
    24812612                        "When enabled, these will apply a predefined "
    24822613                        "zoom to all video playback in MythTV."));
    2483     return gc;
     2614    return wrap(gc, settings);
    24842615}
    24852616
    24862617// Theme settings
     
    29023033    return gc;
    29033034}
    29043035
    2905 ThemeSelector::ThemeSelector(QString label):
    2906     HostImageSelect(label) {
    2907 
     3036static Setting *ThemeSelector(QString label, PlaySettings *settings=NULL)
     3037{
     3038    CREATE_IMAGESELECT_SETTING(gs, label, settings);
    29083039    ThemeType themetype = THEME_UI;
    29093040
    29103041    if (label == "Theme")
    29113042    {
    29123043        themetype = THEME_UI;
    2913         setLabel(QObject::tr("UI theme"));
     3044        gs->setLabel(QObject::tr("UI theme"));
    29143045    }
    29153046    else if (label == "MenuTheme")
    29163047    {
    29173048        themetype = THEME_MENU;
    2918         setLabel(QObject::tr("Menu theme"));
     3049        gs->setLabel(QObject::tr("Menu theme"));
    29193050    }
    29203051
    29213052    QDir themes(GetThemesParentDir());
     
    29793110            VERBOSE(VB_IMPORTANT, QString("Problem reading theme preview image"
    29803111                                          " %1").arg(preview.filePath()));
    29813112
    2982         addImageSelection(name, previewImage, theme.fileName());
     3113        gs->addImageSelection(name, previewImage, theme.fileName());
    29833114    }
    29843115
    29853116    if (themetype & THEME_UI)
    2986         setValue(DEFAULT_UI_THEME);
     3117        gs->setValue(DEFAULT_UI_THEME);
     3118
     3119    return wrap(gs, settings);
    29873120}
    29883121
    29893122static HostComboBox *ChannelFormat()
     
    35603693    return gs;
    35613694}
    35623695
    3563 static HostCheckBox *RealtimePriority()
     3696static Setting *RealtimePriority(PlaySettings *settings)
    35643697{
    3565     HostCheckBox *gc = new HostCheckBox("RealtimePriority");
     3698    CREATE_CHECKBOX_SETTING(gc, "RealtimePriority", settings);
    35663699    gc->setLabel(QObject::tr("Enable realtime priority threads"));
    35673700    gc->setHelpText(QObject::tr("When running mythfrontend with root "
    35683701                    "privileges, some threads can be given enhanced priority. "
    35693702                    "Disable this if mythfrontend freezes during video "
    35703703                    "playback."));
    35713704    gc->setValue(true);
    3572     return gc;
     3705    return wrap(gc, settings, false);
    35733706}
    35743707
    35753708static HostCheckBox *EnableMediaMon()
     
    37253858};
    37263859
    37273860#ifdef USING_OPENGL_VSYNC
    3728 static HostCheckBox *UseOpenGLVSync()
     3861static Setting *UseOpenGLVSync(PlaySettings *settings)
    37293862{
    3730     HostCheckBox *gc = new HostCheckBox("UseOpenGLVSync");
     3863    CREATE_CHECKBOX_SETTING(gc, "UseOpenGLVSync", settings);
    37313864    gc->setLabel(QObject::tr("Enable OpenGL vertical sync for timing"));
    37323865    gc->setValue(false);
    37333866    gc->setHelpText(QObject::tr(
    37343867                        "If supported by your hardware/drivers, "
    37353868                        "MythTV will use OpenGL vertical syncing for "
    37363869                        "video timing, reducing frame jitter."));
    3737     return gc;
     3870    return wrap(gc, settings);
    37383871}
    37393872#endif
    37403873
     
    41604293    return gc;
    41614294}
    41624295
    4163 MainGeneralSettings::MainGeneralSettings()
     4296MainGeneralSettings::MainGeneralSettings(PlaySettings *settings,
     4297                                         ConfigurationWizard *base)
    41644298{
     4299    if (!settings)
     4300    {
    41654301    DatabaseSettings::addDatabaseSettings(this);
    41664302
    41674303    VerticalConfigurationGroup *pin =
     
    42134349    remotecontrol->addChild(NetworkControlEnabled());
    42144350    remotecontrol->addChild(NetworkControlPort());
    42154351    addChild(remotecontrol);
     4352    }
    42164353}
    42174354
    4218 PlaybackSettings::PlaybackSettings()
     4355PlaybackSettings::PlaybackSettings(PlaySettings *settings,
     4356                                   ConfigurationWizard *base)
    42194357{
    42204358    uint i = 0, total = 8;
    42214359#if CONFIG_DARWIN
    42224360    total += 2;
    42234361#endif // USING_DARWIN
     4362    if (settings)
     4363        total -= 3;
    42244364
    42254365
    42264366    VerticalConfigurationGroup* general1 =
    42274367        new VerticalConfigurationGroup(false);
    42284368    general1->setLabel(QObject::tr("General Playback") +
    42294369                      QString(" (%1/%2)").arg(++i).arg(total));
     4370    if (settings)
     4371        general1->setLabel(QObject::tr("Playback group settings for ") +
     4372                           settings->mGroupName + " - " +
     4373                           general1->getLabel());
    42304374
    42314375    HorizontalConfigurationGroup *columns =
    42324376        new HorizontalConfigurationGroup(false, false, true, true);
    42334377
    42344378    VerticalConfigurationGroup *column1 =
    42354379        new VerticalConfigurationGroup(false, false, true, true);
    4236     column1->addChild(RealtimePriority());
    4237     column1->addChild(DecodeExtraAudio());
    4238     column1->addChild(JumpToProgramOSD());
     4380    if (!settings)
     4381        column1->addChild(RealtimePriority(settings));
     4382    column1->addChild(DecodeExtraAudio(settings));
     4383    column1->addChild(JumpToProgramOSD(settings));
    42394384    columns->addChild(column1);
    42404385
    42414386    VerticalConfigurationGroup *column2 =
    42424387        new VerticalConfigurationGroup(false, false, true, true);
    4243     column2->addChild(ClearSavedPosition());
    4244     column2->addChild(AltClearSavedPosition());
    4245     column2->addChild(AutomaticSetWatched());
    4246     column2->addChild(ContinueEmbeddedTVPlay());
     4388    column2->addChild(ClearSavedPosition(settings));
     4389    column2->addChild(AltClearSavedPosition(settings));
     4390    column2->addChild(AutomaticSetWatched(settings));
     4391    column2->addChild(ContinueEmbeddedTVPlay(settings));
    42474392    columns->addChild(column2);
    42484393
    42494394    general1->addChild(columns);
    4250     general1->addChild(LiveTVIdleTimeout());
    4251     general1->addChild(AlwaysStreamFiles());
     4395    if (!settings)
     4396        general1->addChild(LiveTVIdleTimeout());
     4397    if (!settings)
     4398        general1->addChild(AlwaysStreamFiles());
    42524399#ifdef USING_OPENGL_VSYNC
    4253     general1->addChild(UseOpenGLVSync());
     4400    general1->addChild(UseOpenGLVSync(settings));
    42544401#endif // USING_OPENGL_VSYNC
    42554402#if defined(USING_XV) || defined(USING_OPENGL_VIDEO) || defined(USING_VDPAU)
    4256     general1->addChild(UsePicControls());
     4403    general1->addChild(UsePicControls(settings));
    42574404#endif // USING_XV
    4258     addChild(general1);
     4405    if (base)
     4406        base->addChild(general1);
     4407    else
     4408        addChild(general1);
    42594409
    42604410    VerticalConfigurationGroup* general2 =
    42614411        new VerticalConfigurationGroup(false);
    42624412    general2->setLabel(QObject::tr("General Playback") +
    42634413                      QString(" (%1/%2)").arg(++i).arg(total));
     4414    if (settings)
     4415        general2->setLabel(QObject::tr("Playback group settings for ") +
     4416                           settings->mGroupName + " - " +
     4417                           general2->getLabel());
    42644418
    42654419    HorizontalConfigurationGroup* oscan =
    42664420        new HorizontalConfigurationGroup(false, false, true, true);
     
    42684422        new VerticalConfigurationGroup(false, false, true, true);
    42694423    VerticalConfigurationGroup *ocol2 =
    42704424        new VerticalConfigurationGroup(false, false, true, true);
    4271     ocol1->addChild(VertScanPercentage());
    4272     ocol1->addChild(YScanDisplacement());
    4273     ocol2->addChild(HorizScanPercentage());
    4274     ocol2->addChild(XScanDisplacement());
     4425    ocol1->addChild(VertScanPercentage(settings));
     4426    ocol1->addChild(YScanDisplacement(settings));
     4427    ocol2->addChild(HorizScanPercentage(settings));
     4428    ocol2->addChild(XScanDisplacement(settings));
    42754429    oscan->addChild(ocol1);
    42764430    oscan->addChild(ocol2);
    42774431
    42784432    HorizontalConfigurationGroup* aspect_fill =
    42794433        new HorizontalConfigurationGroup(false, false, true, true);
    4280     aspect_fill->addChild(AspectOverride());
    4281     aspect_fill->addChild(AdjustFill());
     4434    aspect_fill->addChild(AspectOverride(settings));
     4435    aspect_fill->addChild(AdjustFill(settings));
    42824436
    42834437    general2->addChild(oscan);
    42844438    general2->addChild(aspect_fill);
    4285     general2->addChild(LetterboxingColour());
    4286     general2->addChild(PIPLocationComboBox());
    4287     general2->addChild(PlaybackExitPrompt());
    4288     general2->addChild(EndOfRecordingExitPrompt());
    4289     addChild(general2);
     4439    general2->addChild(LetterboxingColour(settings));
     4440    general2->addChild(PIPLocationComboBox(settings));
     4441    general2->addChild(PlaybackExitPrompt(settings));
     4442    general2->addChild(EndOfRecordingExitPrompt(settings));
     4443    if (base)
     4444        base->addChild(general2);
     4445    else
     4446        addChild(general2);
    42904447
    42914448    QString tmp = QString(" (%1/%2)").arg(++i).arg(total);
    4292     addChild(new PlaybackProfileConfigs(tmp));
     4449    if (base)
     4450        base->addChild(new PlaybackProfileConfigs(tmp, settings));
     4451    else
     4452        addChild(new PlaybackProfileConfigs(tmp, settings));
    42934453
     4454    if (!settings)
     4455    {
    42944456    VerticalConfigurationGroup* pbox = new VerticalConfigurationGroup(false);
    42954457    pbox->setLabel(QObject::tr("View Recordings") +
    42964458                   QString(" (%1/%2)").arg(++i).arg(total));
     
    43184480    pbox3->addChild(DisplayGroupTitleSort());
    43194481    pbox3->addChild(new WatchListSettings());
    43204482    addChild(pbox3);
     4483    }
    43214484
    43224485    VerticalConfigurationGroup* seek = new VerticalConfigurationGroup(false);
    43234486    seek->setLabel(QObject::tr("Seeking") +
    43244487                   QString(" (%1/%2)").arg(++i).arg(total));
    4325     seek->addChild(SmartForward());
    4326     seek->addChild(FFRewReposTime());
    4327     seek->addChild(FFRewReverse());
    4328     seek->addChild(ExactSeeking());
    4329     addChild(seek);
     4488    if (settings)
     4489        seek->setLabel(QObject::tr("Playback group settings for ") +
     4490                       settings->mGroupName + " - " +
     4491                       seek->getLabel());
     4492    seek->addChild(SmartForward(settings));
     4493    seek->addChild(FFRewReposTime(settings));
     4494    seek->addChild(FFRewReverse(settings));
     4495    seek->addChild(ExactSeeking(settings));
     4496    if (base)
     4497        base->addChild(seek);
     4498    else
     4499        addChild(seek);
    43304500
    43314501    VerticalConfigurationGroup* comms = new VerticalConfigurationGroup(false);
    43324502    comms->setLabel(QObject::tr("Commercial Skip") +
    43334503                    QString(" (%1/%2)").arg(++i).arg(total));
    4334     comms->addChild(AutoCommercialSkip());
    4335     comms->addChild(CommRewindAmount());
    4336     comms->addChild(CommNotifyAmount());
     4504    if (settings)
     4505        comms->setLabel(QObject::tr("Playback group settings for ") +
     4506                        settings->mGroupName + " - " +
     4507                        comms->getLabel());
     4508    comms->addChild(AutoCommercialSkip(settings));
     4509    comms->addChild(CommRewindAmount(settings));
     4510    comms->addChild(CommNotifyAmount(settings));
     4511    if (!settings) // these are global settings, not host-specific
     4512    {
    43374513    comms->addChild(MaximumCommercialSkip());
    43384514    comms->addChild(MergeShortCommBreaks());
    43394515    comms->addChild(CommSkipAllBlanks());
    4340     addChild(comms);
     4516    }
     4517    if (base)
     4518        base->addChild(comms);
     4519    else
     4520        addChild(comms);
    43414521
    43424522#if CONFIG_DARWIN
    43434523    VerticalConfigurationGroup* mac1 = new VerticalConfigurationGroup(false);
    43444524    mac1->setLabel(QObject::tr("Mac OS X Video Settings") +
    43454525                   QString(" (%1/%2)").arg(++i).arg(total));
     4526    if (settings)
     4527        mac1->setLabel(QObject::tr("Playback group settings for ") +
     4528                       settings->mGroupName + " - " +
     4529                       mac1->getLabel());
     4530    if (!settings)
     4531    {
    43464532    mac1->addChild(MacGammaCorrect());
    43474533    mac1->addChild(MacScaleUp());
    43484534    mac1->addChild(MacFullSkip());
    4349     addChild(mac1);
     4535    }
     4536    if (base)
     4537        base->addChild(mac1);
     4538    else
     4539        addChild(mac1);
    43504540
    43514541    VerticalConfigurationGroup* mac2 = new VerticalConfigurationGroup(false);
    43524542    mac2->setLabel(QObject::tr("Mac OS X Video Settings") +
    43534543                   QString(" (%1/%2)").arg(++i).arg(total));
     4544    if (settings)
     4545        mac2->setLabel(QObject::tr("Playback group settings for ") +
     4546                       settings->mGroupName + " - " +
     4547                       mac2->getLabel());
     4548    if (!setings)
     4549    {
    43544550    mac2->addChild(new MacMainSettings());
    43554551    mac2->addChild(new MacFloatSettings());
    43564552
     
    43644560#endif
    43654561}
    43664562
    4367 OSDSettings::OSDSettings()
     4563OSDSettings::OSDSettings(PlaySettings *settings,
     4564                         ConfigurationWizard *base)
    43684565{
    43694566    VerticalConfigurationGroup* osd = new VerticalConfigurationGroup(false);
    43704567    osd->setLabel(QObject::tr("On-screen Display"));
     4568    if (settings)
     4569        osd->setLabel(QObject::tr("Playback group settings for ") +
     4570                      settings->mGroupName + " - " +
     4571                      osd->getLabel());
    43714572
    4372     osd->addChild(EnableMHEG());
    4373     osd->addChild(PersistentBrowseMode());
    4374     osd->addChild(BrowseAllTuners());
    4375     osd->addChild(SubtitleCodec());
    4376     osd->addChild(UDPNotifyPort());
    4377     addChild(osd);
     4573    if (!settings)
     4574    {
     4575    osd->addChild(EnableMHEG(settings));
     4576    osd->addChild(PersistentBrowseMode(settings));
     4577    osd->addChild(BrowseAllTuners(settings));
     4578    osd->addChild(SubtitleCodec(settings));
     4579    osd->addChild(UDPNotifyPort(settings));
     4580    }
     4581    if (base)
     4582        base->addChild(osd);
     4583    else
     4584        addChild(osd);
    43784585
    43794586    VerticalConfigurationGroup *cc = new VerticalConfigurationGroup(false);
    43804587    cc->setLabel(QObject::tr("Closed Captions"));
     4588    if (settings)
     4589        cc->setLabel(QObject::tr("Playback group settings for ") +
     4590                     settings->mGroupName + " - " +
     4591                     cc->getLabel());
    43814592    //cc->addChild(DecodeVBIFormat());
    4382     cc->addChild(CCBackground());
    4383     cc->addChild(DefaultCCMode());
    4384     cc->addChild(PreferCC708());
    4385     cc->addChild(OSDCC708TextZoomPercentage());
    4386     addChild(cc);
     4593    cc->addChild(CCBackground(settings));
     4594    cc->addChild(DefaultCCMode(settings));
     4595    cc->addChild(PreferCC708(settings));
     4596    cc->addChild(OSDCC708TextZoomPercentage(settings));
     4597    if (base)
     4598        base->addChild(cc);
     4599    else
     4600        addChild(cc);
    43874601
    43884602#if CONFIG_DARWIN
    43894603    // Any Mac OS-specific OSD stuff would go here.
     
    45354749    VerticalConfigurationGroup* theme = new VerticalConfigurationGroup(false);
    45364750    theme->setLabel(QObject::tr("Theme"));
    45374751
    4538     theme->addChild(new ThemeSelector("Theme"));
     4752    theme->addChild(ThemeSelector("Theme"));
    45394753
    45404754    theme->addChild(ThemeCacheSize());
    45414755
  • programs/mythfrontend/main.cpp

     
    3434#include "globalsettings.h"
    3535#include "profilegroup.h"
    3636#include "playgroup.h"
     37#include "playsettings.h"
    3738#include "networkcontrol.h"
    3839#include "DVDRingBuffer.h"
    3940#include "scheduledrecording.h"
     
    486487        delete statusbox;
    487488}
    488489
     490ConfigurationWizard *createPlaybackSettingsForPlaybackGroup(PlaySettings *settings, ConfigurationWizard *base)
     491{
     492    return new PlaybackSettings(settings, base);
     493}
     494
     495ConfigurationWizard *createOSDSettingsForPlaybackGroup(PlaySettings *settings, ConfigurationWizard *base)
     496{
     497    return new OSDSettings(settings, base);
     498}
     499
     500ConfigurationWizard *createMainGeneralSettingsForPlaybackGroup(PlaySettings *settings, ConfigurationWizard *base)
     501{
     502    return new MainGeneralSettings(settings, base);
     503}
     504
     505static PlayGroupEditor::SettingsLookup pbgroupSetup[] = {
     506    createPlaybackSettingsForPlaybackGroup,
     507    createOSDSettingsForPlaybackGroup,
     508    createMainGeneralSettingsForPlaybackGroup
     509};
     510
    489511void TVMenuCallback(void *data, QString &selection)
    490512{
    491513    (void)data;
     
    578600    }
    579601    else if (sel == "settings playgroup")
    580602    {
    581         PlayGroupEditor editor;
     603        PlayGroupEditor editor(pbgroupSetup,
     604                               sizeof(pbgroupSetup)/sizeof(*pbgroupSetup));
    582605        editor.exec();
    583606    }
    584607    else if (sel == "settings general")
     
    770793            }
    771794        }
    772795        delete tmprbuf;
     796        pginfo->SetPlaybackGroup("Videos");
    773797    }
    774798    else if (pginfo->IsVideo())
     799    {
    775800        pos = pginfo->QueryBookmark();
     801        pginfo->SetPlaybackGroup("Videos");
     802    }
    776803
    777804    if (pos > 0)
    778805    {
  • programs/mythfrontend/globalsettings.h

     
    1313
    1414class QFileInfo;
    1515class AudioDeviceComboBox;
     16class PlaySettings;
    1617
    1718class AudioConfigSettings : public VerticalConfigurationGroup
    1819{
     
    8889class PlaybackSettings : public ConfigurationWizard
    8990{
    9091  public:
    91     PlaybackSettings();
     92    PlaybackSettings(PlaySettings *settings=NULL,
     93                     ConfigurationWizard *base=NULL);
    9294};
    9395
    9496class OSDSettings: virtual public ConfigurationWizard
    9597{
    9698  public:
    97     OSDSettings();
     99    OSDSettings(PlaySettings *settings=NULL,
     100                ConfigurationWizard *base=NULL);
    98101};
    99102
    100103class GeneralSettings : public ConfigurationWizard
     
    118121class MainGeneralSettings : public ConfigurationWizard
    119122{
    120123  public:
    121     MainGeneralSettings();
     124    MainGeneralSettings(PlaySettings *settings=NULL,
     125                        ConfigurationWizard *base=NULL);
    122126};
    123127
    124128class GeneralRecPrioritiesSettings : public ConfigurationWizard
     
    206210    Q_OBJECT
    207211
    208212  public:
    209     PlaybackProfileConfigs(const QString &str);
     213    PlaybackProfileConfigs(const QString &str, PlaySettings *settings);
    210214    virtual ~PlaybackProfileConfigs();
    211215
    212216  private:
     
    218222
    219223  private:
    220224    QStringList   profiles;
    221     HostComboBox *grouptrigger;
     225    ComboBoxSetting *grouptrigger;
    222226};
    223227
    224228#endif
  • programs/mythavtest/main.cpp

     
    2121#include "mythuihelper.h"
    2222#include "dbcheck.h"
    2323#include "myththemebase.h"
     24#include "playsettings.h"
    2425
    2526static void *run_priv_thread(void *data)
    2627{
     
    187188   
    188189    GetMythUI()->LoadQtConfig();
    189190
    190 #if defined(Q_OS_MACX)
    191     // Mac OS X doesn't define the AudioOutputDevice setting
    192 #else
    193     QString auddevice = gCoreContext->GetSetting("AudioOutputDevice");
    194     if (auddevice.isEmpty())
    195     {
    196         VERBOSE(VB_IMPORTANT, "Fatal Error: Audio not configured, you need "
    197                 "to run 'mythfrontend', not 'mythtv'.");
    198         return TV_EXIT_NO_AUDIO;
    199     }
    200 #endif
    201 
    202191    MythMainWindow *mainWindow = GetMythMainWindow();
    203192    mainWindow->Init();
    204193    MythThemeBase *theme = new MythThemeBase();
     
    212201        return GENERIC_EXIT_DB_OUTOFDATE;
    213202    }
    214203
    215     TV *tv = new TV();
     204    QString playgroup("");
     205    if (!filename.isEmpty())
     206    {
     207        ProgramInfo pg(filename);
     208        playgroup = pg.GetPlaybackGroup();
     209    }
     210    PlaySettings settings(playgroup);
     211
     212#if defined(Q_OS_MACX)
     213    // Mac OS X doesn't define the AudioOutputDevice setting
     214#else
     215    QString auddevice = settings.GetSetting("AudioOutputDevice", "");
     216    if (auddevice.isEmpty())
     217    {
     218        VERBOSE(VB_IMPORTANT, "Fatal Error: Audio not configured, you need "
     219                "to run 'mythfrontend', not 'mythtv'.");
     220        return TV_EXIT_NO_AUDIO;
     221    }
     222#endif
     223
     224    TV *tv = new TV(&settings);
    216225    if (!tv->Init())
    217226    {
    218227        VERBOSE(VB_IMPORTANT, "Fatal Error: Could not initialize TV class.");