Ticket #8088: 8088_playgroups_v7.patch

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

     
    1616{
    1717  public:
    1818    static void GetRenderOptions(render_opts &opts);
    19     VideoOutputVDPAU(MythCodecID codec_id);
     19    VideoOutputVDPAU(PlaySettings *settings, MythCodecID codec_id);
    2020    ~VideoOutputVDPAU();
    2121    bool Init(int width, int height, float aspect, WId winid,
    2222              int winx, int winy, int winw, int winh, WId embedid = 0);
     
    4949                                    const QSize &video_dim);
    5050    static MythCodecID GetBestSupportedCodec(uint width, uint height,
    5151                                             uint stream_type,
    52                                              bool no_acceleration);
     52                                             bool no_acceleration,
     53                                             PlaySettings *settings);
    5354    DisplayInfo  GetDisplayInfo(void);
    5455    virtual bool IsPIPSupported(void) const { return true; }
    5556    virtual bool IsPBPSupported(void) const { return false; }
  • libs/libmythtv/NuppelVideoPlayer.cpp

     
    5959#include "util-osx-cocoa.h"
    6060#include "mythverbose.h"
    6161#include "myth_imgconvert.h"
     62#include "playsettings.h"
    6263
    6364extern "C" {
    6465#include "vbitext/vbi.h"
     
    224225      // Debugging variables
    225226      output_jmeter(NULL)
    226227{
    227 
    228     // Playback (output) zoom control
    229     detect_letter_box = new DetectLetterbox(this);
    230 
    231     vbimode = VBIMode::Parse(gContext->GetSetting("VbiFormat"));
    232 
    233     commrewindamount = gContext->GetNumSetting("CommRewindAmount",0);
    234     commnotifyamount = gContext->GetNumSetting("CommNotifyAmount",0);
    235     decode_extra_audio=gContext->GetNumSetting("DecodeExtraAudio", 0);
    236     itvEnabled       = gContext->GetNumSetting("EnableMHEG", 0);
    237     db_prefer708     = gContext->GetNumSetting("Prefer708Captions", 1);
    238     autocommercialskip = (CommSkipMode)
    239         gContext->GetNumSetting("AutoCommercialSkip", kCommSkipOff);
    240 
    241228    lastIgnoredManualSkip = QDateTime::currentDateTime().addSecs(-10);
    242229
    243230    bzero(&txtbuffers, sizeof(txtbuffers));
     
    663650
    664651    if (using_null_videoout)
    665652    {
    666         videoOutput = new VideoOutputNull();
     653        videoOutput = new VideoOutputNull(GetPlaySettings());
    667654        if (!videoOutput->Init(video_disp_dim.width(), video_disp_dim.height(),
    668655                               video_aspect, 0, 0, 0, 0, 0, 0))
    669656        {
     
    712699            pipState,
    713700            video_disp_dim, video_aspect,
    714701            widget->winId(), display_rect, (video_frame_rate * play_speed),
    715             0 /*embedid*/);
     702            0 /*embedid*/, GetPlaySettings());
    716703
    717704        if (!videoOutput)
    718705        {
     
    734721        videoOutput->EmbedInWidget(embx, emby, embw, embh);
    735722    }
    736723
    737     SetCaptionsEnabled(gContext->GetNumSetting("DefaultCCMode"), false);
     724    SetCaptionsEnabled(GetPlaySettings()->GetNumSetting("DefaultCCMode", 0),
     725                       false);
    738726
    739727    InitFilters();
    740728
     
    785773
    786774void NuppelVideoPlayer::ReinitVideo(void)
    787775{
    788     if (!videoOutput->IsPreferredRenderer(video_disp_dim))
     776    if (!videoOutput->IsPreferredRenderer(video_disp_dim, GetPlaySettings()))
    789777    {
    790778        VERBOSE(VB_PLAYBACK, LOC + QString("Need to switch video renderer."));
    791779        SetErrored(QObject::tr("Need to switch video renderer."));
     
    856844
    857845    if (!audioOutput && !using_null_videoout && player_ctx->IsAudioNeeded())
    858846    {
    859         bool setVolume = gContext->GetNumSetting("MythControlsVolume", 1);
     847        bool setVolume =
     848            GetPlaySettings()->GetNumSetting("MythControlsVolume", 1);
    860849        audioOutput = AudioOutput::OpenAudio(audio_main_device,
    861850                                             audio_passthru_device,
    862851                                             audio_bits, audio_channels,
    863852                                             audio_codec, audio_samplerate,
    864853                                             AUDIOOUTPUT_VIDEO,
    865                                              setVolume, audio_passthru);
     854                                             setVolume, audio_passthru,
     855                                             GetPlaySettings());
    866856        if (!audioOutput)
    867857            errMsg = QObject::tr("Unable to create AudioOutput.");
    868858        else
     
    894884    if (audioOutput)
    895885    {
    896886        const AudioSettings settings(audio_bits, audio_channels, audio_codec,
    897                                      audio_samplerate, audio_passthru);
     887                                     audio_samplerate, audio_passthru,
     888                                     GetPlaySettings());
    898889        audioOutput->Reconfigure(settings);
    899890        if (audio_passthru)
    900891            audio_channels = 2;
     
    29062897        m_double_process = videoOutput->IsExtraProcessingRequired();
    29072898
    29082899        videosync = VideoSync::BestMethod(
    2909             videoOutput, fr_int, rf_int, m_double_framerate);
     2900            videoOutput, GetPlaySettings(),
     2901            fr_int, rf_int, m_double_framerate);
    29102902
    29112903        // Make sure video sync can do it
    29122904        if (videosync != NULL && m_double_framerate)
     
    33883380        QRect visible, total;
    33893381        float aspect, scaling;
    33903382
    3391         osd = new OSD();
     3383        osd = new OSD(GetPlaySettings());
    33923384
    33933385        osd->SetListener(m_tv);
    33943386
     
    34673459
    34683460        GetDecoder()->setExactSeeks(seeks);
    34693461
    3470         if (gContext->GetNumSetting("ClearSavedPosition", 1) &&
     3462        if (GetPlaySettings()->GetNumSetting("ClearSavedPosition", 1) &&
    34713463            !player_ctx->IsPIP())
    34723464        {
    34733465            if (player_ctx->buffer->isDVD())
     
    37353727            ++deleteIter;
    37363728            if (deleteIter.key() == totalFrames)
    37373729            {
    3738                 if (!(gContext->GetNumSetting("EndOfRecordingExitPrompt") == 1
     3730                if (!(GetPlaySettings()->GetNumSetting("EndOfRecordingExitPrompt", 0) == 1
    37393731                      && !player_ctx->IsPIP() &&
    37403732                      player_ctx->GetState() == kState_WatchingPreRecorded))
    37413733                {
     
    39093901
    39103902    if (sim_pip_players.isEmpty())
    39113903    {
    3912         return (PIPLocation)gContext->GetNumSetting("PIPLocation", kPIPTopLeft);
     3904        return (PIPLocation)GetPlaySettings()->GetNumSetting("PIPLocation",
     3905                                                             kPIPTopLeft);
    39133906    }
    39143907
    39153908    // order of preference, could be stored in db if we want it configurable
     
    46944687    exactseeks   = frame_exact_seek;
    46954688    player_ctx   = ctx;
    46964689    livetv       = ctx->tvchain;
     4690
     4691    vbimode = VBIMode::Parse(GetPlaySettings()->GetSetting("VbiFormat", ""));
     4692
     4693    // Playback (output) zoom control
     4694    detect_letter_box = new DetectLetterbox(this);
     4695
     4696    commrewindamount = GetPlaySettings()->GetNumSetting("CommRewindAmount", 0);
     4697    commnotifyamount = GetPlaySettings()->GetNumSetting("CommNotifyAmount", 0);
     4698    decode_extra_audio = GetPlaySettings()->GetNumSetting("DecodeExtraAudio", 0);
     4699    itvEnabled = GetPlaySettings()->GetNumSetting("EnableMHEG", 0);
     4700    db_prefer708 = GetPlaySettings()->GetNumSetting("Prefer708Captions", 1);
     4701    autocommercialskip = (CommSkipMode)
     4702        GetPlaySettings()->GetNumSetting("AutoCommercialSkip", kCommSkipOff);
     4703    SetAudioInfo(GetPlaySettings()->GetSetting("AudioOutputDevice", ""),
     4704                 GetPlaySettings()->GetSetting("PassThruOutputDevice", ""),
     4705                 gContext->GetNumSetting("AudioSampleRate", 44100));
    46974706}
    46984707
    46994708void NuppelVideoPlayer::SetDeleteIter(void)
     
    73567365{
    73577366    QMutexLocker locker(&subtitleLock);
    73587367    textSubtitles.Clear();
    7359     return TextSubtitleParser::LoadSubtitles(subtitleFileName, textSubtitles);
     7368    return TextSubtitleParser::LoadSubtitles(subtitleFileName, textSubtitles,
     7369                                             GetPlaySettings());
    73607370}
    73617371
    73627372void NuppelVideoPlayer::ChangeDVDTrack(bool ffw)
  • libs/libmythtv/videooutwindow.cpp

     
    3030#include "videooutwindow.h"
    3131#include "osd.h"
    3232#include "osdsurface.h"
     33#include "playsettings.h"
    3334#include "NuppelVideoPlayer.h"
    3435#include "videodisplayprofile.h"
    3536#include "decoderbase.h"
     
    5455const float VideoOutWindow::kManualZoomMinVerticalZoom   = 0.5f;
    5556const int   VideoOutWindow::kManualZoomMaxMove           = 50;
    5657
    57 VideoOutWindow::VideoOutWindow() :
     58VideoOutWindow::VideoOutWindow(PlaySettings *_settings) :
    5859    // DB settings
    5960    db_move(0, 0), db_scale_horiz(0.0f), db_scale_vert(0.0f),
    6061    db_pip_size(26),
     
    8586
    8687    // Various state variables
    8788    embedding(false), needrepaint(false),
    88     allowpreviewepg(true), pip_state(kPIPOff)
     89    allowpreviewepg(true), pip_state(kPIPOff),
     90
     91    settings(_settings)
    8992{
    9093    db_pip_size = gContext->GetNumSetting("PIPSize", 26);
    9194
    92     db_move = QPoint(gContext->GetNumSetting("xScanDisplacement", 0),
    93                      gContext->GetNumSetting("yScanDisplacement", 0));
     95    db_move = QPoint(settings->GetNumSetting("xScanDisplacement", 0),
     96                     settings->GetNumSetting("yScanDisplacement", 0));
    9497    db_use_gui_size = gContext->GetNumSetting("GuiSizeForTV", 0);
    9598
    9699    QDesktopWidget *desktop = NULL;
     
    613616    if (change)
    614617    {
    615618        db_scale_vert =
    616             gContext->GetNumSetting("VertScanPercentage", 0) * 0.01f;
     619            settings->GetNumSetting("VertScanPercentage", 0) * 0.01f;
    617620        db_scale_horiz =
    618             gContext->GetNumSetting("HorizScanPercentage", 0) * 0.01f;
     621            settings->GetNumSetting("HorizScanPercentage", 0) * 0.01f;
    619622        db_scaling_allowed = true;
    620623    }
    621624    else
  • libs/libmythtv/videoout_d3d.cpp

     
    948948    opts.priorities->insert("direct3d", 55);
    949949}
    950950
    951 VideoOutputD3D::VideoOutputD3D(void)
    952   : VideoOutput(),         m_lock(QMutex::Recursive),
     951VideoOutputD3D::VideoOutputD3D(PlaySettings *settings)
     952  : VideoOutput(settings),         m_lock(QMutex::Recursive),
    953953    m_hWnd(NULL),          m_ctx(NULL),
    954954    m_video(NULL),         m_osd(NULL),
    955955    m_d3d_osd(false),      m_osd_ready(false),
  • libs/libmythtv/DetectLetterbox.cpp

     
    55#include "NuppelVideoPlayer.h"
    66#include "videoouttypes.h"
    77#include "mythcontext.h"
     8#include "playsettings.h"
    89
    910DetectLetterbox::DetectLetterbox(NuppelVideoPlayer* const nvp)
    1011{
    11     int dbAdjustFill = gContext->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,
     
    1718    detectLetterboxPossibleHalfFrame = -1;
    1819    detectLetterboxPossibleFullFrame = -1;
    1920    detectLetterboxDetectedMode = nvp->GetAdjustFill();
    20     detectLetterboxLimit = gContext->GetNumSetting("DetectLeterboxLimit", 75);
     21    detectLetterboxLimit =
     22        nvp->GetPlaySettings()->GetNumSetting("DetectLeterboxLimit", 75);
    2123    nupple_video_player = nvp;
    2224}
    2325
  • libs/libmythtv/videoout_opengl.cpp

     
    3838    opts.priorities->insert("opengl", 65);
    3939}
    4040
    41 VideoOutputOpenGL::VideoOutputOpenGL(void)
    42     : VideoOutput(),
     41VideoOutputOpenGL::VideoOutputOpenGL(PlaySettings *settings)
     42    : VideoOutput(settings),
    4343    gl_context_lock(QMutex::Recursive),
    4444    gl_context(NULL), gl_videochain(NULL),
    4545    gl_osdchain(NULL), gl_pipchain_active(NULL),
  • libs/libmythtv/videoout_quartz.cpp

     
    6565#include "videodisplayprofile.h"
    6666#include "videoout_dvdv.h"
    6767
     68class PlaySettings;
     69
    6870#define LOC     QString("VideoOutputQuartz::")
    6971#define LOC_ERR QString("VideoOutputQuartz Error: ")
    7072
     
    11081110/** \class VideoOutputQuartz
    11091111 *  \brief Implementation of Quartz (Mac OS X windowing system) video output
    11101112 */
    1111 VideoOutputQuartz::VideoOutputQuartz(
     1113VideoOutputQuartz::VideoOutputQuartz(PlaySettings *settings
    11121114    MythCodecID _myth_codec_id, void *codec_priv) :
    1113     VideoOutput(), Started(false), data(new QuartzData()),
     1115    VideoOutput(settings), Started(false), data(new QuartzData()),
    11141116    myth_codec_id(_myth_codec_id)
    11151117{
    11161118    init(&pauseFrame, FMT_YV12, NULL, 0, 0, 0, 0);
     
    18151817MythCodecID VideoOutputQuartz::GetBestSupportedCodec(
    18161818    uint width, uint height,
    18171819    uint osd_width, uint osd_height,
    1818     uint stream_type, uint fourcc)
     1820    uint stream_type, uint fourcc, PlaySettings *settings)
    18191821{
    18201822    (void) osd_width;
    18211823    (void) osd_height;
    18221824
    1823     VideoDisplayProfile vdp;
     1825    VideoDisplayProfile vdp(settings);
    18241826    vdp.SetInput(QSize(width, height));
    18251827    QString dec = vdp.GetDecoder();
    18261828    if ((dec == "libmpeg2") || (dec == "ffmpeg"))
  • libs/libmythtv/avformatdecoder.cpp

     
    2828#include "videodisplayprofile.h"
    2929#include "mythuihelper.h"
    3030#include "myth_imgconvert.h"
     31#include "playsettings.h"
    3132
    3233#include "lcddevice.h"
    3334
     
    517518    av_log_set_level((debug) ? AV_LOG_DEBUG : AV_LOG_ERROR);
    518519    av_log_set_callback(myth_av_log);
    519520
    520     max_channels = (uint) gContext->GetNumSetting("MaxChannels", 2);
    521     allow_ac3_passthru = (max_channels > 2) ? gContext->GetNumSetting("AC3PassThru", false) : false;
    522     allow_dts_passthru = (max_channels > 2) ? gContext->GetNumSetting("DTSPassThru", false) : false;
    523     internal_vol = gContext->GetNumSetting("MythControlsVolume", 0);
     521    max_channels =
     522        (uint) GetNVP()->GetPlaySettings()->GetNumSetting("MaxChannels", 2);
     523    allow_ac3_passthru = (max_channels > 2) ?
     524        GetNVP()->GetPlaySettings()->GetNumSetting("AC3PassThru", false) :
     525        false;
     526    allow_dts_passthru = (max_channels > 2) ?
     527        GetNVP()->GetPlaySettings()->GetNumSetting("DTSPassThru", false) :
     528        false;
     529    internal_vol =
     530        GetNVP()->GetPlaySettings()->GetNumSetting("MythControlsVolume", 0);
    524531
    525532    audioIn.sample_size = -32; // force SetupAudioStream to run once
    526533    itv = GetNVP()->GetInteractiveTV();
    527534
    528535    cc608_build_parity_table(cc608_parity_table);
    529536
    530     if (gContext->GetNumSetting("CCBackground", 0))
     537    if (GetNVP()->GetPlaySettings()->GetNumSetting("CCBackground", 0))
    531538        CC708Window::forceWhiteOnBlackText = true;
    532539
    533540    no_dts_hack = false;
     
    13781385        codec = find_vdpau_decoder(codec, enc->codec_id);
    13791386
    13801387    if (selectedStream &&
    1381         !gContext->GetNumSetting("DecodeExtraAudio", 0) &&
     1388        !GetNVP()->GetPlaySettings()->GetNumSetting("DecodeExtraAudio", 0) &&
    13821389        !CODEC_IS_HWACCEL(codec))
    13831390    {
    13841391        SetLowBuffers(false);
     
    18131820
    18141821                if (!is_db_ignored)
    18151822                {
    1816                     VideoDisplayProfile vdp;
     1823                    VideoDisplayProfile vdp(GetNVP()->GetPlaySettings());
    18171824                    vdp.SetInput(QSize(width, height));
    18181825                    dec = vdp.GetDecoder();
    18191826                    thread_count = vdp.GetMaxCPUs();
     
    18361843                    MythCodecID vdpau_mcid;
    18371844                    vdpau_mcid = VideoOutputVDPAU::GetBestSupportedCodec(
    18381845                        width, height,
    1839                         mpeg_version(enc->codec_id), no_hardware_decoders);
     1846                        mpeg_version(enc->codec_id), no_hardware_decoders,
     1847                        GetNVP()->GetPlaySettings());
    18401848
    18411849                    if (vdpau_mcid >= video_codec_id)
    18421850                    {
     
    18681876                        /* mpeg type    */ mpeg_version(enc->codec_id),
    18691877                        /* xvmc pix fmt */ xvmc_pixel_format(enc->pix_fmt),
    18701878                        /* test surface */ codec_is_std(video_codec_id),
    1871                         /* force_xv     */ force_xv);
     1879                        /* force_xv     */ force_xv,
     1880                        GetNVP()->GetPlaySettings());
    18721881
    18731882                    if (mcid >= video_codec_id)
    18741883                    {
     
    19011910                        /* osd dim      */ 0, 0,
    19021911                        /* mpeg type    */ mpeg_version(enc->codec_id),
    19031912                        /* pixel format */
    1904                         (PIX_FMT_YUV420P == enc->pix_fmt) ? FOURCC_I420 : 0);
     1913                        (PIX_FMT_YUV420P == enc->pix_fmt) ? FOURCC_I420 : 0,
     1914                        GetNVP()->GetPlaySettings());
    19051915
    19061916                    if (quartz_mcid >= video_codec_id)
    19071917                    {
  • libs/libmythtv/osdtypes.cpp

     
    1818#include "mythcontext.h"
    1919#include "mythdialogs.h"
    2020#include "mythverbose.h"
     21#include "playsettings.h"
    2122
    2223#ifdef USING_FRIBIDI
    2324    #include "fribidi/fribidi.h"
     
    23592360//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    23602361
    23612362OSDTypeCC::OSDTypeCC(const QString &name, TTFFont *font, int xoff, int yoff,
    2362                      int dispw, int disph, float wmult, float hmult)
     2363                     int dispw, int disph, float wmult, float hmult,
     2364                     PlaySettings *settings)
    23632365         : OSDType(name)
    23642366{
    23652367    m_font = font;
     
    23732375
    23742376    QRect rect = QRect(0, 0, 0, 0);
    23752377    m_box = new OSDTypeBox("cc_background", rect, wmult, hmult);
    2376     m_ccbackground = gContext->GetNumSetting("CCBackground", 0);
     2378    m_ccbackground = settings->GetNumSetting("CCBackground", 0);
    23772379}
    23782380
    23792381OSDTypeCC::~OSDTypeCC()
  • libs/libmythtv/playgroup.cpp

     
    22#include "mythdb.h"
    33#include "playgroup.h"
    44#include "programinfo.h"
     5#include "playsettings.h"
    56
    67// A parameter associated with the profile itself
    78class PlayGroupDBStorage : public SimpleDBStorage
     
    211212    return res;
    212213}
    213214
    214 PlayGroupEditor::PlayGroupEditor(void) :
    215     listbox(new ListBoxSetting(this)), lastValue("Default")
     215PlayGroupEditor::PlayGroupEditor(SettingsLookup *funcArray, int funcArraySize) :
     216    listbox(new ListBoxSetting(this)), lastValue("Default"),
     217    getSettings(funcArray), getSettingsSize(funcArraySize)
    216218{
    217219    listbox->setLabel(tr("Playback Groups"));
    218220    addChild(listbox);
     
    243245    }
    244246
    245247    PlayGroup group(name);
     248    PlaySettings *psettings = new PlaySettings(name);
     249    for (int i=0; i<getSettingsSize; i++)
     250        getSettings[i](psettings, &group);
    246251    if (group.exec() == QDialog::Accepted || !created)
    247252        lastValue = name;
    248253    else
     
    277282        query.bindValue(":NAME", name);
    278283        if (!query.exec())
    279284            MythDB::DBError("PlayGroupEditor::doDelete", query);
     285        PlaySettings::deleteGroup(name);
    280286
    281287        int lastIndex = listbox->getValueIndex(name);
    282288        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/osdtypes.h

     
    3131class OSDTypeText;
    3232class OSDSurface;
    3333class TV;
     34class PlaySettings;
    3435
    3536typedef QHash<QString,QString> InfoMap;
    3637typedef QMap<int,uint>         HotKeyMap;
     
    573574{
    574575  public:
    575576    OSDTypeCC(const QString &name, TTFFont *font, int xoff, int yoff,
    576               int dispw, int disph, float wmult, float hmult);
     577              int dispw, int disph, float wmult, float hmult,
     578              PlaySettings *settings);
    577579   ~OSDTypeCC();
    578580
    579581    void Reinit(float wmult, float hmult);
  • libs/libmythtv/tv_play.h

     
    5656class TV;
    5757class OSDListTreeItemEnteredEvent;
    5858class OSDListTreeItemSelectedEvent;
     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
    185186    bool Init(bool createWindow = true);
     
    204205
    205206    // Recording commands
    206207    int  PlayFromRecorder(int recordernum);
    207     int  Playback(const ProgramInfo &rcinfo);
     208    int  Playback(const ProgramInfo &rcinfo, PlaySettings *settings);
    208209
    209210    // Commands used by frontend playback box
    210211    QString GetRecordingGroup(int player_idx) const;
     
    593594    static TVState RemoveRecording(TVState state);
    594595    void RestoreScreenSaver(const PlayerContext*);
    595596
    596     void InitUDPNotifyEvent(void);
     597    void InitUDPNotifyEvent(PlaySettings *settings);
    597598
    598599    /// true if dialog is either videoplayexit, playexit or askdelete dialog
    599600    bool IsVideoExitDialog(const QString &dialog_name);
  • 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

     
    35693569
    35703570            VideoDisplayProfile::CreateNewProfiles(host);
    35713571            profiles = VideoDisplayProfile::GetProfiles(host);
    3572             QString profile = VideoDisplayProfile::GetDefaultProfileName(host);
     3572            QString profile =
     3573                VideoDisplayProfile::GetDefaultProfileName(host, NULL);
    35733574
    35743575            if (profiles.contains("Normal") &&
    35753576                (profile=="CPU++" || profile=="CPU+" || profile=="CPU--"))
     
    56375638"  jump int(11) NOT NULL default '0',"
    56385639"  PRIMARY KEY  (`name`)"
    56395640");",
     5641"CREATE TABLE playgroupsettings ("
     5642"  playgroupname varchar(64) NOT NULL,"
     5643"  `value` varchar(128) NOT NULL,"
     5644"  `data` text,"
     5645"  overridden tinyint(1) NOT NULL,"
     5646"  PRIMARY KEY (playgroupname, `value`)"
     5647");",
    56405648"CREATE TABLE powerpriority ("
    56415649"  priorityname varchar(64) collate utf8_bin NOT NULL,"
    56425650"  recpriority int(10) NOT NULL default '0',"
  • libs/libmythtv/videoout_vdpau.cpp

     
    4646    opts.deints->insert("vdpau", deints);
    4747}
    4848
    49 VideoOutputVDPAU::VideoOutputVDPAU(MythCodecID codec_id)
    50   : VideoOutput(),
     49VideoOutputVDPAU::VideoOutputVDPAU(PlaySettings *settings, MythCodecID codec_id)
     50  : VideoOutput(settings),
    5151    m_codec_id(codec_id),    m_win(0),         m_render(NULL),
    5252    m_buffer_size(NUM_VDPAU_BUFFERS),          m_pause_surface(0),
    5353    m_need_deintrefs(false), m_video_mixer(0), m_mixer_features(kVDPFeatNone),
     
    858858
    859859MythCodecID VideoOutputVDPAU::GetBestSupportedCodec(
    860860    uint width,       uint height,
    861     uint stream_type, bool no_acceleration)
     861    uint stream_type, bool no_acceleration, PlaySettings *settings)
    862862{
    863863    bool use_cpu = no_acceleration;
    864     VideoDisplayProfile vdp;
     864    VideoDisplayProfile vdp(settings);
    865865    vdp.SetInput(QSize(width, height));
    866866    QString dec = vdp.GetDecoder();
    867867
  • 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

     
    9393{
    9494  public:
    9595    static void GetRenderOptions(render_opts &opts, QStringList &cpudeints);
    96     VideoOutputD3D();
     96    VideoOutputD3D(PlaySettings *settings);
    9797   ~VideoOutputD3D();
    9898
    9999    bool Init(int width, int height, float aspect, WId winid,
  • libs/libmythtv/playercontext.cpp

     
    1414#include "videoouttypes.h"
    1515#include "storagegroup.h"
    1616#include "mythcontext.h"
     17#include "DetectLetterbox.h"
     18#include "playsettings.h"
    1719
    1820#define LOC QString("playCtx: ")
    1921#define LOC_ERR QString("playCtx, Error: ")
     
    435437                              WId embedwinid, const QRect *embedbounds,
    436438                              bool muted)
    437439{
    438     int exact_seeking = gContext->GetNumSetting("ExactSeeking", 0);
     440    int exact_seeking = settings->GetNumSetting("ExactSeeking", 0);
    439441
    440442    if (HasNVP())
    441443    {
     
    450452        _nvp->DisableHardwareDecoders();
    451453
    452454    _nvp->SetPlayerInfo(tv, widget, exact_seeking, this);
    453     _nvp->SetAudioInfo(gContext->GetSetting("AudioOutputDevice"),
    454                        gContext->GetSetting("PassThruOutputDevice"),
    455                        gContext->GetNumSetting("AudioSampleRate", 44100));
    456455    _nvp->SetAudioStretchFactor(ts_normal);
    457456    _nvp->SetLength(playingLen);
    458457
     
    888887/**
    889888 * \brief assign programinfo to the context
    890889 */
    891 void PlayerContext::SetPlayingInfo(const ProgramInfo *info)
     890void PlayerContext::SetPlayingInfo(const ProgramInfo *info,
     891                                   PlaySettings *_settings)
    892892{
    893893    bool ignoreDB = gContext->IsDatabaseIgnored();
    894894
     
    900900            playingInfo->MarkAsInUse(false, recUsage);
    901901        delete playingInfo;
    902902        playingInfo = NULL;
     903        // XXX delete settings?
    903904    }
    904905
    905906    if (info)
     
    908909        if (!ignoreDB)
    909910            playingInfo->MarkAsInUse(true, recUsage);
    910911        playingLen  = playingInfo->CalculateLength();
     912        settings = (_settings ? _settings :
     913                    new PlaySettings(playingInfo->playgroup));
    911914    }
    912915}
    913916
  • libs/libmythtv/NuppelVideoPlayer.h

     
    196196    bool      GetAudioBufferStatus(uint &fill, uint &total) const;
    197197    PIPLocation GetNextPIPLocation(void) const;
    198198
     199    PlaySettings *GetPlaySettings(void) const {
     200        return player_ctx ? player_ctx->settings : NULL;
     201    }
     202
    199203    // Bool Gets
    200204    bool    GetRawAudioState(void) const;
    201205    bool    GetLimitKeyRepeat(void) const     { return limitKeyRepeat; }
  • libs/libmythtv/textsubtitleparser.h

     
    1717// Qt headers
    1818#include <QStringList>
    1919
     20class PlaySettings;
     21
    2022class text_subtitle_t
    2123{
    2224  public:
     
    7577class TextSubtitleParser
    7678{
    7779  public:
    78     static bool LoadSubtitles(QString fileName, TextSubtitles &target);
     80    static bool LoadSubtitles(QString fileName, TextSubtitles &target,
     81                              PlaySettings *settings);
    7982};
    8083
    8184#endif
  • libs/libmythtv/osd.h

     
    7070class TeletextViewer;
    7171class QStringList;
    7272class QDomElement;
     73class PlaySettings;
    7374
    7475class OSD : public QObject
    7576{
    7677    Q_OBJECT
    7778 public:
    78     OSD();
     79    OSD(PlaySettings *settings);
    7980   ~OSD(void);
    8081
    8182    void Init(const QRect &totalBounds,   int   frameRate,
     
    233234
    234235    QObject *m_listener;
    235236
     237    PlaySettings *settings;
     238
    236239    QRect osdBounds;
    237240    int   frameint;
    238241    bool  needPillarBox;
  • libs/libmythtv/vsync.cpp

     
    3434#include "mythcontext.h"
    3535#include "mythverbose.h"
    3636#include "mythmainwindow.h"
     37#include "playsettings.h"
    3738
    3839#ifdef USING_XV
    3940#include "videoout_xv.h"
     
    7677 *  \brief Returns the most sophisticated video sync method available.
    7778 */
    7879VideoSync *VideoSync::BestMethod(VideoOutput *video_output,
     80                                 PlaySettings *settings,
    7981                                 uint frame_interval, uint refresh_interval,
    8082                                 bool halve_frame_interval)
    8183{
    8284    VideoSync *trial = NULL;
    8385    tryingVideoSync  = true;
    84     bool tryOpenGL   = (gContext->GetNumSetting("UseOpenGLVSync", 1) &&
     86    bool tryOpenGL   = (settings->GetNumSetting("UseOpenGLVSync", 1) &&
    8587                        (getenv("NO_OPENGL_VSYNC") == NULL));
    8688
    8789    // m_forceskip allows for skipping one sync method
  • libs/libmythtv/tv_play.cpp

     
    6060#include "tv_play_win.h"
    6161#include "recordinginfo.h"
    6262#include "mythsystemevent.h"
     63#include "playsettings.h"
    6364
    6465#if ! HAVE_ROUND
    6566#define round(x) ((int) ((x) + 0.5))
     
    190191                 bool inPlaylist, bool initByNetworkCommand)
    191192{
    192193    VERBOSE(VB_PLAYBACK, LOC + "StartTV() -- begin");
    193     TV *tv = new TV();
    194194    bool quitAll = false;
    195195    bool showDialogs = true;
    196196    bool playCompleted = false;
     
    201201    if (tvrec)
    202202        curProgram = new ProgramInfo(*tvrec);
    203203
     204    PlaySettings settings(curProgram ? curProgram->playgroup : "Default");
     205    TV *tv = new TV(&settings);
     206
    204207    // Initialize TV
    205208    if (!tv->Init())
    206209    {
     
    231234        if (curProgram)
    232235        {
    233236            VERBOSE(VB_PLAYBACK, LOC + "tv->Playback() -- begin");
    234             if (!tv->Playback(*curProgram))
     237            if (!tv->Playback(*curProgram, &settings))
    235238            {
    236239                quitAll = true;
    237240            }
     
    783786 *  \brief Performs instance initialiation not requiring access to database.
    784787 *  \sa Init(void)
    785788 */
    786 TV::TV(void)
     789TV::TV(PlaySettings *settings)
    787790    : // Configuration variables from database
    788791      baseFilters(""),
    789792      db_channel_format("<num> <sign>"),
     
    921924        kv[QString("FFRewSpeed%1").arg(i)] = QString::number(ff_rew_def[i]);
    922925
    923926    MythDB::getMythDB()->GetSettings(kv);
     927    settings->AddToMap(kv);
    924928
    925929    // convert from minutes to ms.
    926930    db_idle_timeout        = kv["LiveTVIdleTimeout"].toInt() * 60 * 1000;
     
    17111715}
    17121716
    17131717
    1714 int TV::Playback(const ProgramInfo &rcinfo)
     1718int TV::Playback(const ProgramInfo &rcinfo, PlaySettings *settings)
    17151719{
    17161720    wantsToQuit   = false;
    17171721    jumpToProgram = false;
     
    17251729        return 0;
    17261730    }
    17271731
    1728     mctx->SetPlayingInfo(&rcinfo);
     1732    mctx->SetPlayingInfo(&rcinfo, settings);
    17291733    mctx->SetInitialTVState(false);
    17301734    ScheduleStateChange(mctx);
    17311735
     
    18081812
    18091813    if (fileexists)
    18101814    {
    1811         Playback(pginfo);
     1815        PlaySettings settings("Default");
     1816        Playback(pginfo, &settings);
    18121817        retval = 1;
    18131818    }
    18141819
     
    21532158        {
    21542159            OSD *osd = GetOSDLock(ctx);
    21552160            ctx->LockPlayingInfo(__FILE__, __LINE__);
    2156             if (osd && (PlayGroup::GetCount() > 0))
     2161            if (ctx->playingInfo->playgroup != "Default" &&
     2162                ctx->playingInfo->playgroup != "Videos" &&
     2163                osd && (PlayGroup::GetCount() > 0))
    21572164                osd->SetSettingsText(tr("%1 Settings")
    21582165                    .arg(tv_i18n(ctx->playingInfo->playgroup)), 3);
    21592166            ctx->UnlockPlayingInfo(__FILE__, __LINE__);
     
    51655172        return false;
    51665173    }
    51675174
    5168     InitUDPNotifyEvent();
     5175    InitUDPNotifyEvent(ctx->settings);
    51695176    bool ok = false;
    51705177    if (ctx->IsNullVideoDesired())
    51715178    {
     
    1181711824        GetMythUI()->RestoreScreensaver();
    1181811825}
    1181911826
    11820 void TV::InitUDPNotifyEvent(void)
     11827void TV::InitUDPNotifyEvent(PlaySettings *settings)
    1182111828{
    1182211829    if (db_udpnotify_port && !udpnotify)
    1182311830    {
    11824         udpnotify = new UDPNotify(db_udpnotify_port);
     11831        udpnotify = new UDPNotify(db_udpnotify_port, settings);
    1182511832        connect(udpnotify,
    1182611833                SIGNAL(AddUDPNotifyEvent(
    1182711834                        const QString&,const UDPNotifyOSDSet*)),
  • 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);
     
    121123    static QString     GetDecoderName(const QString &decoder);
    122124    static QString     GetDecoderHelp(QString decoder = QString::null);
    123125
    124     static QString     GetDefaultProfileName(const QString &hostname);
     126    static QString     GetDefaultProfileName(const QString &hostname,
     127                                             PlaySettings *settings);
    125128    static void        SetDefaultProfileName(const QString &profilename,
    126129                                             const QString &hostname);
    127130    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 "mythcontext.h"
    1213#include "mythverbose.h"
     
    107108        PIPState pipState,
    108109        const QSize   &video_dim, float        video_aspect,
    109110        WId            win_id,    const QRect &display_rect,
    110         float          video_prate,     WId    embed_id)
     111        float          video_prate,     WId    embed_id,
     112        PlaySettings *settings)
    111113{
    112114    (void) codec_priv;
    113115
     
    152154    QString renderer = QString::null;
    153155    if (renderers.size() > 0)
    154156    {
    155         VideoDisplayProfile vprof;
     157        VideoDisplayProfile vprof(settings);
    156158        vprof.SetInput(video_dim);
    157159
    158160        QString tmp = vprof.GetVideoRenderer();
     
    180182
    181183#ifdef USING_DIRECTFB
    182184        if (renderer == "directfb")
    183             vo = new VideoOutputDirectfb();
     185            vo = new VideoOutputDirectfb(settings);
    184186#endif // USING_DIRECTFB
    185187
    186188#ifdef USING_MINGW
    187189        if (renderer == "direct3d")
    188             vo = new VideoOutputD3D();
     190            vo = new VideoOutputD3D(settings);
    189191#endif // USING_MINGW
    190192
    191193#ifdef Q_OS_MACX
    192194        if (osxlist.contains(renderer))
    193             vo = new VideoOutputQuartz(codec_id, codec_priv);
     195            vo = new VideoOutputQuartz(settings, codec_id, codec_priv);
    194196#endif // Q_OS_MACX
    195197
    196198#ifdef USING_OPENGL_VIDEO
    197199        if (renderer == "opengl")
    198             vo = new VideoOutputOpenGL();
     200            vo = new VideoOutputOpenGL(settings);
    199201#endif // USING_OPENGL_VIDEO
    200202
    201203#ifdef USING_VDPAU
    202204        if (renderer == "vdpau")
    203             vo = new VideoOutputVDPAU(codec_id);
     205            vo = new VideoOutputVDPAU(settings, codec_id);
    204206#endif // USING_VDPAU
    205207
    206208#ifdef USING_XV
    207209        if (xvlist.contains(renderer))
    208             vo = new VideoOutputXv(codec_id);
     210            vo = new VideoOutputXv(settings, codec_id);
    209211#endif // USING_XV
    210212
    211213        if (vo)
     
    302304 * \brief This constructor for VideoOutput must be followed by an
    303305 *        Init(int,int,float,WId,int,int,int,int,WId) call.
    304306 */
    305 VideoOutput::VideoOutput() :
     307VideoOutput::VideoOutput(PlaySettings *_settings) :
    306308    // DB Settings
    307309    db_display_dim(0,0),
    308310    db_aspectoverride(kAspect_Off),     db_adjustfill(kAdjustFill_Off),
     
    336338    display_res(NULL),
    337339
    338340    // Physical display
    339     monitor_sz(640,480),                monitor_dim(400,300)
     341    monitor_sz(640,480),                monitor_dim(400,300),
    340342
     343    settings(_settings)
     344
    341345{
    342346    bzero(&pip_tmp_image, sizeof(pip_tmp_image));
    343     db_display_dim = QSize(gContext->GetNumSetting("DisplaySizeWidth",  0),
    344                            gContext->GetNumSetting("DisplaySizeHeight", 0));
     347    db_display_dim = QSize(settings->GetNumSetting("DisplaySizeWidth",  0),
     348                           settings->GetNumSetting("DisplaySizeHeight", 0));
    345349
    346350    db_pict_attr[kPictureAttribute_Brightness] =
    347         gContext->GetNumSetting("PlaybackBrightness", 50);
     351        settings->GetNumSetting("PlaybackBrightness", 50);
    348352    db_pict_attr[kPictureAttribute_Contrast] =
    349         gContext->GetNumSetting("PlaybackContrast",   50);
     353        settings->GetNumSetting("PlaybackContrast",   50);
    350354    db_pict_attr[kPictureAttribute_Colour] =
    351         gContext->GetNumSetting("PlaybackColour",     50);
     355        settings->GetNumSetting("PlaybackColour",     50);
    352356    db_pict_attr[kPictureAttribute_Hue] =
    353         gContext->GetNumSetting("PlaybackHue",         0);
     357        settings->GetNumSetting("PlaybackHue",         0);
    354358
    355359    db_aspectoverride = (AspectOverrideMode)
    356         gContext->GetNumSetting("AspectOverride",      0);
     360        settings->GetNumSetting("AspectOverride",      0);
    357361    db_adjustfill = (AdjustFillMode)
    358         gContext->GetNumSetting("AdjustFill",          0);
     362        settings->GetNumSetting("AdjustFill",          0);
    359363    db_letterbox_colour = (LetterBoxColour)
    360         gContext->GetNumSetting("LetterboxColour",     0);
     364        settings->GetNumSetting("LetterboxColour",     0);
    361365    db_use_picture_controls =
    362         gContext->GetNumSetting("UseOutputPictureControls", 0);
     366        settings->GetNumSetting("UseOutputPictureControls", 0);
    363367
    364368    if (!gContext->IsDatabaseIgnored())
    365         db_vdisp_profile = new VideoDisplayProfile();
     369        db_vdisp_profile = new VideoDisplayProfile(settings);
    366370
    367     windows.push_back(VideoOutWindow());
     371    windows.push_back(VideoOutWindow(settings));
    368372}
    369373
    370374/**
     
    433437    return QString::null;
    434438}
    435439
    436 bool VideoOutput::IsPreferredRenderer(QSize video_size)
     440bool VideoOutput::IsPreferredRenderer(QSize video_size, PlaySettings *settings)
    437441{
    438442    if (!db_vdisp_profile || (video_size == windows[0].GetVideoDispDim()))
    439443        return true;
    440444
    441     VideoDisplayProfile vdisp;
     445    VideoDisplayProfile vdisp(settings);
    442446    vdisp.SetInput(video_size);
    443447    QString new_rend = vdisp.GetVideoRenderer();
    444448    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

     
    2727class LiveTVChain;
    2828class MythDialog;
    2929class QPainter;
     30class PlaySettings;
    3031
    3132typedef enum
    3233{
     
    9091    void SetRecorder(RemoteEncoder *rec);
    9192    void SetTVChain(LiveTVChain *chain);
    9293    void SetRingBuffer(RingBuffer *buf);
    93     void SetPlayingInfo(const ProgramInfo *info);
     94    void SetPlayingInfo(const ProgramInfo *info, PlaySettings *settings=NULL);
    9495    void SetPlayGroup(const QString &group);
    9596    void SetPseudoLiveTV(const ProgramInfo *pi, PseudoState new_state);
    9697    void SetPIPLocation(int loc) { pipLocation = loc; }
     
    145146    LiveTVChain        *tvchain;
    146147    RingBuffer         *buffer;
    147148    ProgramInfo        *playingInfo; ///< Currently playing info
     149    PlaySettings       *settings; // corresponding to playingInfo
    148150    long long           playingLen;  ///< Initial CalculateLength()
    149151    bool                nohardwaredecoders; // < Disable use of VDPAU decoding
    150152    bool                decoding;    ///< Video decoder thread started
  • libs/libmythtv/vsync.h

     
    101101
    102102    // documented in vsync.cpp
    103103    static VideoSync *BestMethod(VideoOutput*,
     104                                 PlaySettings *settings,
    104105                                 uint frame_interval, uint refresh_interval,
    105106                                 bool interlaced);
    106107  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

     
    166166 * \see VideoOutput, VideoBuffers
    167167 *
    168168 */
    169 VideoOutputXv::VideoOutputXv(MythCodecID codec_id)
    170     : VideoOutput(),
     169VideoOutputXv::VideoOutputXv(PlaySettings *settings, MythCodecID codec_id)
     170    : VideoOutput(settings),
    171171      myth_codec_id(codec_id), video_output_subtype(XVUnknown),
    172172      global_lock(QMutex::Recursive),
    173173
     
    408408 * \return port number if it succeeds, else -1.
    409409 */
    410410int VideoOutputXv::GrabSuitableXvPort(MythXDisplay* disp, Window root,
     411                                      PlaySettings *settings,
    411412                                      MythCodecID mcodecid,
    412413                                      uint width, uint height,
    413414                                      bool &xvsetdefaults,
     
    492493    }
    493494
    494495    // figure out if we want chromakeying..
    495     VideoDisplayProfile vdp;
     496    VideoDisplayProfile vdp(settings);
    496497    vdp.SetInput(QSize(width, height));
    497498    bool check_for_colorkey = (vdp.GetOSDRenderer() == "chromakey");
    498499
     
    785786    disp->StartLog();
    786787    QString adaptor_name = QString::null;
    787788    const QSize video_dim = windows[0].GetVideoDim();
    788     xv_port = GrabSuitableXvPort(disp, disp->GetRoot(), mcodecid,
     789    xv_port = GrabSuitableXvPort(disp, disp->GetRoot(), settings, mcodecid,
    789790                                 video_dim.width(), video_dim.height(),
    790791                                 xv_set_defaults,
    791792                                 xvmc_chroma, &xvmc_surf_info, &adaptor_name);
     
    864865    disp->StartLog();
    865866    QString adaptor_name = QString::null;
    866867    const QSize video_dim = windows[0].GetVideoDim();
    867     xv_port = GrabSuitableXvPort(disp, disp->GetRoot(), kCodec_MPEG2,
     868    xv_port = GrabSuitableXvPort(disp, disp->GetRoot(), settings, kCodec_MPEG2,
    868869                                 video_dim.width(), video_dim.height(),
    869870                                 xv_set_defaults, 0, NULL, &adaptor_name);
    870871    if (xv_port == -1)
     
    10181019    uint width,       uint height,
    10191020    uint osd_width,   uint osd_height,
    10201021    uint stream_type, int xvmc_chroma,
    1021     bool test_surface, bool force_xv)
     1022    bool test_surface, bool force_xv,
     1023    PlaySettings *settings)
    10221024{
    10231025    (void)width, (void)height, (void)osd_width, (void)osd_height;
    10241026    (void)stream_type, (void)xvmc_chroma, (void)test_surface;
     
    10291031        return ret;
    10301032
    10311033#ifdef USING_XVMC
    1032     VideoDisplayProfile vdp;
     1034    VideoDisplayProfile vdp(settings);
    10331035    vdp.SetInput(QSize(width, height));
    10341036    QString dec = vdp.GetDecoder();
    10351037    if ((dec == "libmpeg2") || (dec == "ffmpeg"))
     
    10791081
    10801082        ok = false;
    10811083        bool dummy;
    1082         int port = GrabSuitableXvPort(disp, disp->GetRoot(), ret, width, height,
     1084        int port = GrabSuitableXvPort(disp, disp->GetRoot(), settings,
     1085                                      ret, width, height,
    10831086                                      dummy, xvmc_chroma, &info);
    10841087        if (port >= 0)
    10851088        {
  • libs/libmythtv/udpnotify.cpp

     
    3131#include "udpnotify.h"
    3232#include "mythcontext.h"
    3333#include "mythverbose.h"
     34#include "playsettings.h"
    3435
    3536UDPNotifyOSDSet::UDPNotifyOSDSet(const QString &name, uint timeout)
    3637    : m_name(name), m_timeout(timeout)
     
    7374
    7475/////////////////////////////////////////////////////////////////////////
    7576
    76 UDPNotify::UDPNotify(uint udp_port) :
     77UDPNotify::UDPNotify(uint udp_port, PlaySettings *settings) :
    7778    m_socket(new QUdpSocket()), m_db_osd_udpnotify_timeout(5)
    7879{
    7980    connect(m_socket, SIGNAL(readyRead()),
     
    8182
    8283    m_socket->bind(udp_port);
    8384
    84     m_db_osd_udpnotify_timeout = gContext->GetNumSetting("OSDNotifyTimeout", 5);
     85    m_db_osd_udpnotify_timeout = settings->GetNumSetting("OSDNotifyTimeout", 5);
    8586}
    8687
    8788void UDPNotify::deleteLater(void)
  • libs/libmythtv/videooutbase.h

     
    2929class FilterChain;
    3030class FilterManager;
    3131class OpenGLContextGLX;
     32class PlaySettings;
    3233
    3334typedef QMap<NuppelVideoPlayer*,PIPLocation> PIPMap;
    3435
     
    4950        PIPState       pipState,
    5051        const QSize   &video_dim, float        video_aspect,
    5152        WId            win_id,    const QRect &display_rect,
    52         float video_prate,        WId          embed_id);
     53        float video_prate,        WId          embed_id,
     54        PlaySettings *settings);
    5355
    54     VideoOutput();
     56    VideoOutput(PlaySettings *settings);
    5557    virtual ~VideoOutput();
    5658
    5759    virtual bool Init(int width, int height, float aspect,
     
    5961                      int winh, WId embedid = 0);
    6062    virtual void InitOSD(OSD *osd);
    6163    virtual void SetVideoFrameRate(float);
    62     virtual bool IsPreferredRenderer(QSize video_size);
     64    virtual bool IsPreferredRenderer(QSize video_size, PlaySettings *settings);
    6365    virtual bool SetDeinterlacingEnabled(bool);
    6466    virtual bool SetupDeinterlace(bool i, const QString& ovrf="");
    6567    virtual void FallbackDeint(void);
     
    328330    // Display information
    329331    QSize monitor_sz;
    330332    QSize monitor_dim;
     333
     334    PlaySettings *settings;
    331335};
    332336
    333337#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)
     
    112113    m_subtitles.clear();
    113114}
    114115
    115 bool TextSubtitleParser::LoadSubtitles(QString fileName, TextSubtitles &target)
     116bool TextSubtitleParser::LoadSubtitles(QString fileName, TextSubtitles &target,
     117                                       PlaySettings *settings)
    116118{
    117119    demux_sputext_t sub_data;
    118120    sub_data.rbuffer = new RingBuffer(fileName, 0, false);
     
    130132    target.SetFrameBasedTiming(!sub_data.uses_time);
    131133
    132134    QTextCodec *textCodec = NULL;
    133     QString codec = gContext->GetSetting("SubtitleCodec", "");
     135    QString codec = settings->GetSetting("SubtitleCodec", "");
    134136    if (!codec.isEmpty())
    135137        textCodec = QTextCodec::codecForName(codec.toLatin1());
    136138    if (!textCodec)
  • libs/libmythtv/osd.cpp

     
    3232#include "mythverbose.h"
    3333#include "util.h"
    3434#include "channelutil.h"
     35#include "playsettings.h"
    3536
    3637#include "x11colors.h"
    3738#include "mythdirs.h"
     
    4243static char  *cc708_default_font_names[16];
    4344static bool   cc708_defaults_initialized = false;
    4445static QMutex cc708_init_lock;
    45 static void initialize_osd_fonts(void);
     46static void initialize_osd_fonts(PlaySettings *settings);
    4647
    4748#define LOC QString("OSD: ")
    4849#define LOC_ERR QString("OSD, Error: ")
     
    5859const char *kOSDDialogInfo           = "infobox";
    5960const char *kOSDDialogEditChannel    = "channel_editor";
    6061
    61 OSD::OSD() :
     62OSD::OSD(PlaySettings *_settings) :
    6263    QObject(),                          m_listener(NULL),
     64    settings(_settings),
    6365    osdBounds(),                        frameint(0),
    6466    needPillarBox(false),
    65     themepath(FindTheme(gContext->GetSetting("OSDTheme"))),
     67    themepath(FindTheme(settings->GetSetting("OSDTheme", ""))),
    6668    wscale(1.0f),                       fscale(1.0f),
    6769    m_themeinfo(new ThemeInfo(themepath)),
    6870    m_themeaspect(4.0f/3.0f),
     
    172174    drawSurface = new OSDSurface(osd_bounds.width(), osd_bounds.height());
    173175
    174176    if (!cc708_defaults_initialized)
    175         initialize_osd_fonts();
     177        initialize_osd_fonts(settings);
    176178
    177179    for (uint i = 0; i < 16; i++)
    178180        cc708fontnames[i] = cc708_default_font_names[i];
     
    185187    if (themepath.isEmpty())
    186188    {
    187189        VERBOSE(VB_IMPORTANT, "Couldn't find OSD theme: "
    188                 <<gContext->GetSetting("OSDTheme"));
     190                <<settings->GetSetting("OSDTheme", ""));
    189191        InitDefaults();
    190192        return;
    191193    }
     
    194196    if (!LoadTheme())
    195197    {
    196198        VERBOSE(VB_IMPORTANT, "Couldn't load OSD theme: "
    197                 <<gContext->GetSetting("OSDTheme")<<" at "<<themepath);
     199                <<settings->GetSetting("OSDTheme", "")<<" at "<<themepath);
    198200    }
    199201
    200202    InitDefaults();
     
    238240        QString name = "cc_font";
    239241        int fontsize = m_themeinfo->BaseRes()->height() / 27;
    240242
    241         ccfont = LoadFont(gContext->GetSetting("OSDCCFont"), fontsize);
     243        ccfont = LoadFont(settings->GetSetting("OSDCCFont", ""), fontsize);
    242244
    243245        if (ccfont)
    244246            fontMap[name] = ccfont;
     
    274276
    275277    OSDTypeCC *ccpage =
    276278        new OSDTypeCC(name, ccfont, sub_xoff, sub_yoff,
    277                       sub_dispw, sub_disph, wmult, hmult);
     279                      sub_dispw, sub_disph, wmult, hmult, settings);
    278280    container->AddType(ccpage);
    279281    return true;
    280282}
     
    293295
    294296    // Create fonts...
    295297    TTFFont* ccfonts[48];
    296     uint z = gContext->GetNumSetting("OSDCC708TextZoom", 100) *
     298    uint z = settings->GetNumSetting("OSDCC708TextZoom", 100) *
    297299                    m_themeinfo->BaseRes()->height();
    298300    uint fontsizes[3] = { z / 3600, z / 2900, z / 2200 };
    299301    for (uint i = 0; i < 48; i++)
     
    356358    if (!font)
    357359    {
    358360        int fontsize = 440 / 26;
    359         font = LoadFont(gContext->GetSetting("OSDCCFont"), fontsize);
     361        font = LoadFont(settings->GetSetting("OSDCCFont", ""), fontsize);
    360362
    361363        if (font)
    362364            fontMap[fontname] = font;
     
    464466    TTFFont *font = GetFont(fontname);
    465467    if (!font)
    466468    {
    467         font = LoadFont(gContext->GetSetting("OSDCCFont"), SUBTITLE_FONT_SIZE);
     469        font = LoadFont(settings->GetSetting("OSDCCFont", ""),
     470                        SUBTITLE_FONT_SIZE);
    468471
    469472        if (font)
    470473        {
     
    532535
    533536    if (!actfont)
    534537    {
    535         actfont = LoadFont(gContext->GetSetting("OSDFont"), 16);
     538        actfont = LoadFont(settings->GetSetting("OSDFont", ""), 16);
    536539
    537540        if (actfont)
    538541            fontMap["treemenulistfont"] = actfont;
     
    680683    if (dir.exists())
    681684    {
    682685        VERBOSE(VB_IMPORTANT, QString("Couldn't find OSD theme: %1. "
    683                 "Switching to default.").arg(gContext->GetSetting("OSDTheme")));
    684         gContext->OverrideSettingForSession("OSDTheme", "BlackCurves-OSD");
     686                                      "Switching to default.").arg(settings->GetSetting("OSDTheme", "")));
     687        settings->OverrideSetting/*ForSession*/("OSDTheme", "BlackCurves-OSD");
    685688        return testdir;
    686689    }
    687690
     
    848851void OSD::parseFont(QDomElement &element)
    849852{
    850853    QString name;
    851     QString fontfile = gContext->GetSetting("OSDFont");
     854    QString fontfile = settings->GetSetting("OSDFont", "");
    852855    int size = -1;
    853856    int sizeSmall = -1;
    854857    int sizeBig = -1;
     
    926929        return;
    927930    }
    928931
    929     QString fontSizeType = gContext->GetSetting("OSDThemeFontSizeType",
     932    QString fontSizeType = settings->GetSetting("OSDThemeFontSizeType",
    930933                                                "default");
    931934    if (fontSizeType == "small")
    932935    {
     
    31073110    return QRect(xoffset, yoffset, displaywidth, displayheight);
    31083111}
    31093112
    3110 #define OSD_STRDUP(X) strdup(gContext->GetSetting(X).toLocal8Bit().constData())
     3113#define OSD_STRDUP(X) strdup(settings->GetSetting(X, "").toLocal8Bit().constData())
    31113114
    3112 static void initialize_osd_fonts(void)
     3115static void initialize_osd_fonts(PlaySettings *settings)
    31133116{
    31143117    QMutexLocker locker(&cc708_init_lock);
    31153118    if (cc708_defaults_initialized)
    31163119        return;
    31173120    cc708_defaults_initialized = true;
    31183121
    3119     QString default_font_type = gContext->GetSetting(
     3122    QString default_font_type = settings->GetSetting(
    31203123        "OSDCC708DefaultFontType", "MonoSerif");
    31213124
    31223125    // 0
  • 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,
     
    5153    static MythCodecID GetBestSupportedCodec(
    5254        uint width, uint height,
    5355        uint osd_width, uint osd_height,
    54         uint stream_type, uint fourcc);
     56        uint stream_type, uint fourcc, PlaySettings *settings);
    5557    virtual bool NeedExtraAudioDecode(void) const
    5658        { return !codec_is_std(myth_codec_id); }
    5759
  • 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{
     
    211212pref_map_t  VideoDisplayProfile::dec_name;
    212213safe_list_t VideoDisplayProfile::safe_decoders;
    213214
    214 VideoDisplayProfile::VideoDisplayProfile()
     215VideoDisplayProfile::VideoDisplayProfile(PlaySettings *settings)
    215216    : lock(QMutex::Recursive), last_size(0,0), last_rate(0.0f),
    216217      last_video_renderer(QString::null)
    217218{
     
    219220    init_statics();
    220221
    221222    QString hostname    = gContext->GetHostName();
    222     QString cur_profile = GetDefaultProfileName(hostname);
     223    QString cur_profile = GetDefaultProfileName(hostname, settings);
    223224    uint    groupid     = GetProfileGroupID(cur_profile, hostname);
    224225
    225226    item_list_t items = LoadDB(groupid);
     
    771772    return list;
    772773}
    773774
    774 QString VideoDisplayProfile::GetDefaultProfileName(const QString &hostname)
     775QString VideoDisplayProfile::GetDefaultProfileName(const QString &hostname,
     776                                                   PlaySettings *settings)
    775777{
    776778    QString tmp =
     779        settings ? settings->GetSetting("DefaultVideoPlaybackProfile", "") :
    777780        gContext->GetSettingOnHost("DefaultVideoPlaybackProfile", hostname);
    778781
    779782    QStringList profiles = GetProfiles(hostname);
  • libs/libmythtv/udpnotify.h

     
    2020class QByteArray;
    2121class QUdpSocket;
    2222class QDomElement;
     23class PlaySettings;
    2324
    2425class UDPNotifyOSDSet
    2526{
     
    5455    Q_OBJECT
    5556
    5657  public:
    57     UDPNotify(uint udp_port);
     58    UDPNotify(uint udp_port, PlaySettings *settings);
    5859
    5960  signals:
    6061    void AddUDPNotifyEvent(const QString &name, const UDPNotifyOSDSet*);
  • 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;
     
    657707                this, SLOT(setValue(const QString &)));
    658708        connect(cbwidget, SIGNAL(editTextChanged(const QString &)),
    659709                this, SLOT(setValue(const QString &)));
     710        connect(cbwidget, SIGNAL(editTextChanged(const QString &)),
     711                this, SLOT(changeLabel(const QString &)));
    660712    }
    661713    else
    662714    {
     
    680732
    681733    widget->setLayout(layout);
    682734
     735    setValue(current);
     736
    683737    return widget;
    684738}
    685739
     
    689743    {
    690744        bxwidget = NULL;
    691745        cbwidget = NULL;
     746        labelWidget = NULL;
    692747    }
    693748}
    694749
     
    724779
    725780    if (rw)
    726781    {
     782        changeLabel(newValue);
    727783        Setting::setValue(newValue);
    728784        if (cbwidget)
    729785            cbwidget->setCurrentIndex(current);
     
    734790{
    735791    if (cbwidget)
    736792        cbwidget->setCurrentIndex(which);
     793    changeLabel(labels[which]);
    737794    SelectSetting::setValue(which);
    738795};
    739796
    740 void ComboBoxSetting::addSelection(
    741     const QString &label, QString value, bool select)
     797void ComboBoxSetting::changeLabel(const QString &newLabel)
    742798{
     799    if (changeOnSpecial)
     800    {
     801        adjustFont(labelWidget, specialLabel == newLabel);
     802        adjustFont(cbwidget,    specialLabel == newLabel);
     803    }
     804}
     805
     806void ComboBoxSetting::addSelection(const QString &label, QString value,
     807                                   bool select, bool special_formatting)
     808{
    743809    if ((findSelection(label, value) < 0) && cbwidget)
    744810    {
    745811        cbwidget->insertItem(label);
    746812    }
    747813
     814    if (special_formatting)
     815    {
     816        changeOnSpecial = true;
     817        specialLabel = label;
     818    }
     819
    748820    SelectSetting::addSelection(label, value, select);
    749821
    750822    if (cbwidget && isSet)
     
    917989    BooleanSetting::setHelpText(str);
    918990}
    919991
     992QWidget* TristateCheckBoxSetting::configWidget(ConfigurationGroup *cg,
     993                                               QWidget* parent,
     994                                               const char* widgetName) {
     995    widget = new MythCheckBox(parent, widgetName, true);
     996    connect(widget, SIGNAL(destroyed(QObject*)),
     997            this,   SLOT(widgetDeleted(QObject*)));
     998
     999    widget->setHelpText(getHelpText());
     1000    widget->setText(getLabel());
     1001    widget->setCheckState(tristateValue());
     1002    setValue(tristateValue());
     1003
     1004    connect(widget, SIGNAL(stateChanged(int)),
     1005            this, SLOT(setValue(int)));
     1006    connect(this, SIGNAL(valueChanged(int)),
     1007            this, SLOT(relayValueChanged(int)));
     1008
     1009    if (cg)
     1010        connect(widget, SIGNAL(changeHelpText(QString)), cg,
     1011                SIGNAL(changeHelpText(QString)));
     1012
     1013    return widget;
     1014}
     1015
     1016void TristateCheckBoxSetting::widgetInvalid(QObject *obj)
     1017{
     1018    widget = (widget == obj) ? NULL : widget;
     1019}
     1020
     1021void TristateCheckBoxSetting::setEnabled(bool fEnabled)
     1022{
     1023    TristateSetting::setEnabled(fEnabled);
     1024    if (widget)
     1025        widget->setEnabled(fEnabled);
     1026}
     1027
     1028void TristateCheckBoxSetting::setHelpText(const QString &str)
     1029{
     1030    if (widget)
     1031        widget->setHelpText(str);
     1032    TristateSetting::setHelpText(str);
     1033}
     1034
     1035const char *TristateSetting::kPartiallyCheckedString = "default";
     1036
     1037void TristateCheckBoxSetting::setValue(int check)
     1038{
     1039    adjustFont(widget, (check != Qt::Checked && check != Qt::Unchecked));
     1040    TristateSetting::setValue(check);
     1041    emit valueChanged(check);
     1042}
     1043
     1044void TristateSetting::setValue(int check)
     1045{
     1046    if (check == Qt::Checked)
     1047        Setting::setValue("1");
     1048    else if (check == Qt::Unchecked)
     1049        Setting::setValue("0");
     1050    else
     1051        Setting::setValue(kPartiallyCheckedString);
     1052    emit valueChanged(check);
     1053}
     1054
    9201055void AutoIncrementDBSetting::Save(QString table)
    9211056{
    9221057    if (intValue() == 0)
     
    11041239    addSelection(label, value, select);
    11051240}
    11061241
     1242void ImageSelectSetting::addDefaultSelection(const QString label,
     1243                                             const QString value,
     1244                                             const QString defaultValue,
     1245                                             bool select)
     1246{
     1247    for (unsigned i=0; i<values.size(); i++)
     1248    {
     1249        if (values[i] == defaultValue)
     1250        {
     1251            changeOnSpecial = true;
     1252            specialLabel = label;
     1253            images.push_back(new QImage(*images[i]));
     1254            addSelection(label, value, select);
     1255            return;
     1256        }
     1257    }
     1258}
     1259
    11071260ImageSelectSetting::~ImageSelectSetting()
    11081261{
    11091262    Teardown();
     
    11261279    bxwidget   = NULL;
    11271280    imagelabel = NULL;
    11281281    combo      = NULL;
     1282    labelWidget = NULL;
    11291283}
    11301284
    11311285void ImageSelectSetting::imageSet(int num)
     
    11731327        QLabel *label = new QLabel();
    11741328        label->setText(getLabel() + ":");
    11751329        layout->addWidget(label);
     1330        labelWidget = label;
    11761331    }
    11771332
    11781333    combo = new MythComboBox(false);
     
    12191374    connect(combo, SIGNAL(highlighted(int)), this, SLOT(imageSet(int)));
    12201375    connect(combo, SIGNAL(activated(int)), this, SLOT(setValue(int)));
    12211376    connect(combo, SIGNAL(activated(int)), this, SLOT(imageSet(int)));
     1377    connect(combo, SIGNAL(highlighted(const QString &)),
     1378            this, SLOT(changeLabel(const QString &)));
     1379    connect(combo, SIGNAL(activated(const QString &)),
     1380            this, SLOT(changeLabel(const QString &)));
    12221381
    12231382    connect(this, SIGNAL(selectionsCleared()),
    12241383            combo, SLOT(clear()));
     
    12291388
    12301389    bxwidget->setLayout(layout);
    12311390
     1391    changeLabel(GetLabel(current));
     1392
    12321393    return bxwidget;
    12331394}
    12341395
     1396void ImageSelectSetting::changeLabel(const QString &newLabel)
     1397{
     1398    if (changeOnSpecial)
     1399    {
     1400        adjustFont(labelWidget, specialLabel == newLabel);
     1401        adjustFont(combo,       specialLabel == newLabel);
     1402    }
     1403}
     1404
    12351405void ImageSelectSetting::widgetInvalid(QObject *obj)
    12361406{
    12371407    if (bxwidget == obj)
  • libs/libmyth/audiosettings.cpp

     
    66 */
    77
    88#include "audiosettings.h"
     9#include "playsettings.h"
    910
    1011// startup_upmixer
    1112AudioSettings::AudioSettings() :
     
    1819    set_initial_vol(false),
    1920    use_passthru(false),
    2021    source(AUDIOOUTPUT_UNKNOWN),
     22    psettings(0),
    2123    upmixer(0)
    2224{
    2325}
     
    3234    set_initial_vol(other.set_initial_vol),
    3335    use_passthru(other.use_passthru),
    3436    source(other.source),
     37    psettings(other.psettings),
    3538    upmixer(other.upmixer)
    3639{
    3740}
     
    4649    AudioOutputSource audio_source,
    4750    bool audio_set_initial_vol,
    4851    bool audio_use_passthru,
     52    PlaySettings *_psettings,
    4953    int upmixer_startup) :
    5054    main_device(audio_main_device),
    5155    passthru_device(audio_passthru_device),
     
    5660    set_initial_vol(audio_set_initial_vol),
    5761    use_passthru(audio_use_passthru),
    5862    source(audio_source),
     63    psettings(_psettings),
    5964    upmixer(upmixer_startup)
    6065{
     66    if (!psettings)
     67    {
     68        QString name("Default");
     69        psettings = new PlaySettings(name);
     70    }
    6171}
    6272
    6373AudioSettings::AudioSettings(
     
    6676    int   audio_codec,
    6777    int   audio_samplerate,
    6878    bool  audio_use_passthru,
     79    PlaySettings *_psettings,
    6980    int   upmixer_startup) :
    7081    main_device(QString::null),
    7182    passthru_device(QString::null),
     
    7687    set_initial_vol(false),
    7788    use_passthru(audio_use_passthru),
    7889    source(AUDIOOUTPUT_UNKNOWN),
     90    psettings(_psettings),
    7991    upmixer(upmixer_startup)
    8092{
     93    if (!psettings)
     94    {
     95        QString name("Default");
     96        psettings = new PlaySettings(name);
     97    }
    8198}
    8299
     100AudioSettings::AudioSettings(
     101    int   audio_bits,
     102    int   audio_channels,
     103    int   audio_codec,
     104    int   audio_samplerate,
     105    bool  audio_use_passthru,
     106    int   upmixer_startup) :
     107    main_device(QString::null),
     108    passthru_device(QString::null),
     109    bits(audio_bits),
     110    channels(audio_channels),
     111    codec(audio_codec),
     112    samplerate(audio_samplerate),
     113    set_initial_vol(false),
     114    use_passthru(audio_use_passthru),
     115    source(AUDIOOUTPUT_UNKNOWN),
     116    psettings(NULL),
     117    upmixer(upmixer_startup)
     118{
     119    if (!psettings)
     120    {
     121        QString name("Default");
     122        psettings = new PlaySettings(name);
     123    }
     124}
     125
    83126void AudioSettings::FixPassThrough(void)
    84127{
    85128    if (passthru_device.isEmpty() || passthru_device.toLower() == "default")
  • libs/libmyth/audiooutputbase.h

     
    155155    int orig_config_channels;
    156156    int src_quality;
    157157
     158    PlaySettings *psettings;
     159
    158160 private:
    159161    // software volume
    160162    template <class AudioDataType>
  • libs/libmyth/audiooutputalsa.cpp

     
    88
    99#include "mythcontext.h"
    1010#include "audiooutputalsa.h"
     11#include "playsettings.h"
    1112   
    1213#define LOC QString("ALSA: ")
    1314#define LOC_WARN QString("ALSA, Warning: ")
     
    752753{
    753754    int volume;
    754755
    755     mixer_control = gContext->GetSetting("MixerControl", "PCM");
     756    mixer_control = psettings->GetSetting("MixerControl", "PCM");
    756757
    757758    SetupMixer();
    758759
    759760    if (mixer_handle != NULL && setstartingvolume)
    760761    {
    761         volume = gContext->GetNumSetting("MasterMixerVolume", 80);
     762        volume = psettings->GetNumSetting("MasterMixerVolume", 80);
    762763        SetCurrentVolume("Master", 0, volume);
    763764        SetCurrentVolume("Master", 1, volume);
    764765
    765         volume = gContext->GetNumSetting("PCMMixerVolume", 80);
     766        volume = psettings->GetNumSetting("PCMMixerVolume", 80);
    766767        SetCurrentVolume("PCM", 0, volume);
    767768        SetCurrentVolume("PCM", 1, volume);
    768769    }
     
    779780{
    780781    int err;
    781782
    782     QString alsadevice = gContext->GetSetting("MixerDevice", "default");
     783    QString alsadevice = psettings->GetSetting("MixerDevice", "default");
    783784    QString device = alsadevice.remove(QString("ALSA:"));
    784785
    785786    if (mixer_handle != NULL)
  • libs/libmyth/audiooutputca.cpp

     
    246246
    247247    if (internal_vol && set_initial_vol)
    248248    {
    249         QString controlLabel = gContext->GetSetting("MixerControl", "PCM");
     249        QString controlLabel = psettings->GetSetting("MixerControl", "PCM");
    250250        controlLabel += "MixerVolume";
    251251        SetCurrentVolume(gContext->GetNumSetting(controlLabel, 80));
    252252    }
  • libs/libmyth/volumebase.cpp

     
    88
    99#include "volumebase.h"
    1010#include "mythcontext.h"
     11#include "playsettings.h"
    1112
    12 VolumeBase::VolumeBase() :
     13VolumeBase::VolumeBase(PlaySettings *_settings) :
    1314    internal_vol(false), volume(80),
    14     current_mute_state(kMuteOff)
     15    current_mute_state(kMuteOff), settings(_settings)
    1516{
    1617    swvol = swvol_setting =
    17         (gContext->GetSetting("MixerDevice", "default").toLower() == "software");
     18        (settings->GetSetting("MixerDevice", "default").toLower() == "software");
    1819}
    1920
    2021bool VolumeBase::SWVolume(void)
     
    3940    volume = max(min(value, 100), 0);
    4041    UpdateVolume();
    4142
    42     QString controlLabel = gContext->GetSetting("MixerControl", "PCM");
     43    QString controlLabel = settings->GetSetting("MixerControl", "PCM");
    4344    controlLabel += "MixerVolume";
    4445    gContext->SaveSetting(controlLabel, volume);   
    4546}
  • 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);
     
    338352public slots:
    339353    void addSelection(const QString &label,
    340354                      QString value = QString::null,
    341                       bool select = false);
     355                      bool select = false,
     356                      bool special_formatting = false);
    342357    bool removeSelection(const QString &label,
    343358                         QString value = QString::null);
     359    virtual void changeLabel(const QString &newValue);
    344360
    345361private:
    346362    bool rw;
    347363    QWidget      *bxwidget;
    348364    MythComboBox *cbwidget;
     365    bool          changeOnSpecial;
     366    QString       specialLabel;
     367    QLabel       *labelWidget;
    349368
    350369protected:
    351370    int step;
     
    414433    ImageSelectSetting(Storage *_storage) :
    415434        SelectSetting(_storage),
    416435        bxwidget(NULL), imagelabel(NULL), combo(NULL),
    417         m_hmult(1.0f), m_wmult(1.0f) { }
     436        m_hmult(1.0f), m_wmult(1.0f),
     437        changeOnSpecial(false), specialLabel(""), labelWidget(NULL) { }
    418438    virtual QWidget* configWidget(ConfigurationGroup *cg, QWidget* parent,
    419439                                  const char* widgetName = 0);
    420440    virtual void widgetInvalid(QObject *obj);
     
    425445                                   QImage* image,
    426446                                   QString value=QString::null,
    427447                                   bool select=false);
     448    virtual void addDefaultSelection(const QString label,
     449                                     const QString value,
     450                                     const QString defaultValue,
     451                                     bool select);
    428452
    429453protected slots:
    430454    void imageSet(int);
     455    void changeLabel(const QString &newLabel);
    431456
    432457  protected:
    433458    void Teardown(void);
     
    439464    QLabel *imagelabel;
    440465    MythComboBox *combo;
    441466    float m_hmult, m_wmult;
     467    bool          changeOnSpecial;
     468    QString       specialLabel;
     469    QLabel       *labelWidget;
    442470};
    443471
    444472class MPUBLIC BooleanSetting : public Setting
     
    479507    MythCheckBox *widget;
    480508};
    481509
     510class MPUBLIC TristateSetting : public BooleanSetting
     511{
     512    Q_OBJECT
     513
     514  public:
     515    TristateSetting(Storage *_storage) : BooleanSetting(_storage) {}
     516
     517    Qt::CheckState tristateValue(void) const {
     518        if (getValue() == "0")
     519            return Qt::Unchecked;
     520        if (getValue() == "1")
     521            return Qt::Checked;
     522        return Qt::PartiallyChecked;
     523    }
     524
     525    static const char *kPartiallyCheckedString;
     526
     527public slots:
     528    virtual void setValue(/*Qt::CheckState*/int check);
     529
     530signals:
     531    void valueChanged(int);
     532};
     533
     534class MPUBLIC TristateCheckBoxSetting: public TristateSetting {
     535    Q_OBJECT
     536
     537public:
     538    TristateCheckBoxSetting(Storage *_storage) :
     539        TristateSetting(_storage), widget(NULL) { }
     540    virtual QWidget* configWidget(ConfigurationGroup *cg, QWidget* parent,
     541                                  const char* widgetName = 0);
     542    virtual void widgetInvalid(QObject*);
     543
     544    virtual void setEnabled(bool b);
     545
     546    virtual void setHelpText(const QString &str);
     547
     548
     549public slots:
     550    virtual void setValue(/*Qt::CheckState*/int check);
     551    virtual void relayValueChanged(int state) {
     552        if (widget)
     553            widget->setCheckState((Qt::CheckState)state);
     554    }
     555
     556protected:
     557    MythCheckBox *widget;
     558};
     559
    482560class MPUBLIC PathSetting : public ComboBoxSetting
    483561{
    484562public:
  • libs/libmyth/audiooutputjack.cpp

     
    211211{
    212212    int volume = 100;
    213213    if (set_initial_vol)
    214         volume = gContext->GetNumSetting("MasterMixerVolume", 80);
     214        volume = psettings->GetNumSetting("MasterMixerVolume", 80);
    215215
    216216    JACK_SetAllVolume(audioid, volume);
    217217}
  • libs/libmyth/audiooutputbase.cpp

     
    1515#include "audiooutputdigitalencoder.h"
    1616#include "SoundTouch.h"
    1717#include "freesurround.h"
     18#include "playsettings.h"
    1819
    1920#define LOC QString("AO: ")
    2021#define LOC_ERR QString("AO, ERROR: ")
    2122
    2223AudioOutputBase::AudioOutputBase(const AudioSettings &settings) :
     24    AudioOutput(settings.psettings),
    2325    // protected
    2426    effdsp(0),                  effdspstretched(0),
    2527    audio_channels(-1),         audio_codec(CODEC_ID_NONE),
     
    4042    set_initial_vol(settings.set_initial_vol),
    4143    buffer_output_data_for_use(false),
    4244
     45    psettings(settings.psettings),
     46
    4347    // private
    4448    need_resampler(false),
    4549
     
    8286    memset(tmp_buff,           0, sizeof(short) * kAudioTempBufSize);
    8387    memset(&audiotime_updated, 0, sizeof(audiotime_updated));
    8488    memset(audiobuffer,        0, sizeof(char)  * kAudioRingBufferSize);
    85     orig_config_channels = gContext->GetNumSetting("MaxChannels", 2);
    86     src_quality = gContext->GetNumSetting("AudioUpmixType", 2);
     89    orig_config_channels = psettings->GetNumSetting("MaxChannels", 2);
     90    src_quality = psettings->GetNumSetting("AudioUpmixType", 2);
    8791        //Set default upsampling quality to medium if using stereo
    8892    if (orig_config_channels == 2)
    8993        src_quality = 1;
    9094
    9195        // Handle override of SRC quality settings
    92     if (gContext->GetNumSetting("AdvancedAudioSettings", false) &&
    93         gContext->GetNumSetting("SRCQualityOverride", false))
     96    if (psettings->GetNumSetting("AdvancedAudioSettings", false) &&
     97        psettings->GetNumSetting("SRCQualityOverride", false))
    9498    {
    95         src_quality = gContext->GetNumSetting("SRCQuality", 1);
     99        src_quality = psettings->GetNumSetting("SRCQuality", 1);
    96100            // Extra test to keep backward compatibility with earlier SRC code setting
    97101        if (src_quality > 2)
    98102            src_quality = 2;
     
    100104    }
    101105
    102106    if (!settings.upmixer)
    103         configured_audio_channels = gContext->GetNumSetting("AudioDefaultUpmix", false) ? orig_config_channels : 2;
     107        configured_audio_channels =
     108            psettings->GetNumSetting("AudioDefaultUpmix", false) ?
     109            orig_config_channels : 2;
    104110    else
    105111        if (settings.upmixer == 1)
    106112            configured_audio_channels = 2;
    107113        else
    108114            configured_audio_channels = 6;
    109115
    110     allow_ac3_passthru = (orig_config_channels > 2) ? gContext->GetNumSetting("AC3PassThru", false) : false;
     116    allow_ac3_passthru =
     117        (orig_config_channels > 2) ?
     118        psettings->GetNumSetting("AC3PassThru", false) : false;
    111119
    112120    // You need to call Reconfigure from your concrete class.
    113121    // Reconfigure(laudio_bits,       laudio_channels,
     
    192200
    193201    const AudioSettings settings(audio_bits, source_audio_channels,
    194202                                 audio_codec, source_audio_samplerate,
    195                                  audio_passthru);
     203                                 audio_passthru, psettings);
    196204    Reconfigure(settings);
    197205    return (configured_audio_channels == 6);
    198206}
     
    278286    killaudio = false;
    279287    pauseaudio = false;
    280288    was_paused = true;
    281     internal_vol = gContext->GetNumSetting("MythControlsVolume", 0);
     289    internal_vol = settings.psettings->GetNumSetting("MythControlsVolume", 0);
    282290
    283291    numlowbuffer = 0;
    284292
     
    361369
    362370    // Only used for software volume
    363371    if (set_initial_vol && internal_vol)
    364         volume = gContext->GetNumSetting("PCMMixerVolume", 80);
     372        volume = settings.psettings->GetNumSetting("PCMMixerVolume", 80);
    365373    {
    366         QString controlLabel = gContext->GetSetting("MixerControl", "PCM");
     374        QString controlLabel =
     375            settings.psettings->GetSetting("MixerControl", "PCM");
    367376        controlLabel += "MixerVolume";
    368         volume = gContext->GetNumSetting(controlLabel, 80);
     377        volume = settings.psettings->GetNumSetting(controlLabel, 80);
    369378    }
    370379
    371380    SyncVolume();
     
    377386    if (audio_buffer_unused < 0)
    378387        audio_buffer_unused = 0;
    379388
    380     if (!gContext->GetNumSetting("AdvancedAudioSettings", false))
     389    if (!settings.psettings->GetNumSetting("AdvancedAudioSettings", false))
    381390        audio_buffer_unused = 0;
    382     else if (!gContext->GetNumSetting("AggressiveSoundcardBuffer", false))
     391    else if (!settings.psettings->GetNumSetting("AggressiveSoundcardBuffer",
     392                                                false))
    383393        audio_buffer_unused = 0;
    384394
    385395    audbuf_timecode = 0;
     
    395405        VERBOSE(VB_AUDIO, LOC + QString("create upmixer"));
    396406        if (configured_audio_channels == 6)
    397407        {
    398             surround_mode = gContext->GetNumSetting("AudioUpmixType", 2);
     408            surround_mode =
     409                settings.psettings->GetNumSetting("AudioUpmixType", 2);
    399410        }
    400411
    401412        upmixer = new FreeSurround(
     
    669680    volume = new_volume;
    670681    if (save)
    671682    {
    672         QString controlLabel = gContext->GetSetting("MixerControl", "PCM");
     683        QString controlLabel = psettings->GetSetting("MixerControl", "PCM");
    673684        controlLabel += "MixerVolume";
    674685        gContext->SaveSetting(controlLabel, volume);
    675686    }
  • libs/libmyth/audiooutput.cpp

     
    66#include "mythconfig.h"
    77#include "audiooutput.h"
    88#include "compat.h"
     9#include "playsettings.h"
    910
    1011#include "audiooutputnull.h"
    1112#ifdef USING_MINGW
     
    3738    bool set_initial_vol, bool audio_passthru,
    3839    int upmixer_startup)
    3940{
     41    QString str("Default");
     42    PlaySettings psettings(str);
     43    return OpenAudio(main_device, passthru_device, audio_bits,
     44                     audio_channels, audio_codec, audio_samplerate,
     45                     source, set_initial_vol, audio_passthru,
     46                     &psettings, upmixer_startup);
     47}
     48
     49AudioOutput *AudioOutput::OpenAudio(
     50    const QString &main_device,
     51    const QString &passthru_device,
     52    int audio_bits, int audio_channels,
     53    int audio_codec, int audio_samplerate,
     54    AudioOutputSource source,
     55    bool set_initial_vol, bool audio_passthru,
     56    PlaySettings *psettings,
     57    int upmixer_startup)
     58{
    4059    AudioSettings settings(
    4160        main_device, passthru_device, audio_bits,
    4261        audio_channels, audio_codec, audio_samplerate, source,
    43         set_initial_vol, audio_passthru, upmixer_startup);
     62        set_initial_vol, audio_passthru, psettings, upmixer_startup);
    4463
    4564    settings.FixPassThrough();
    4665
  • libs/libmyth/libmyth.pro

     
    5656SOURCES += recordingtypes.cpp remoteutil.cpp
    5757SOURCES += rawsettingseditor.cpp
    5858
     59HEADERS += playsettings.h
     60SOURCES += playsettings.cpp
     61
    5962# remove when everything is switched to mythui
    6063SOURCES += virtualkeyboard_qt.cpp
    6164
  • libs/libmyth/audiosettings.h

     
    1212
    1313#include "mythexp.h"
    1414
     15class PlaySettings;
     16
    1517typedef enum {
    1618    AUDIOOUTPUT_UNKNOWN,
    1719    AUDIOOUTPUT_VIDEO,
     
    3436        AudioOutputSource audio_source,
    3537        bool              audio_set_initial_vol,
    3638        bool              audio_use_passthru,
     39        PlaySettings     *psettings,
    3740        int               upmixer_startup = 0);
    3841
    3942    AudioSettings(int   audio_bits,
     
    4144                  int   audio_codec,
    4245                  int   audio_samplerate,
    4346                  bool  audio_use_passthru,
     47                  PlaySettings *psettings,
    4448                  int   upmixer_startup = 0);
    4549
     50    AudioSettings(int   audio_bits,
     51                  int   audio_channels,
     52                  int   audio_codec,
     53                  int   audio_samplerate,
     54                  bool  audio_use_passthru,
     55                  int   upmixer_startup = 0);
     56
    4657    void FixPassThrough(void);
    4758    void TrimDeviceType(void);
    4859
     
    6172    bool    set_initial_vol;
    6273    bool    use_passthru;
    6374    AudioOutputSource source;
     75    PlaySettings *psettings;
    6476    int     upmixer;
    6577};
    6678
  • libs/libmyth/audiooutputoss.cpp

     
    2727#include "mythcontext.h"
    2828#include "audiooutputoss.h"
    2929#include "util.h"
     30#include "playsettings.h"
    3031
    3132AudioOutputOSS::AudioOutputOSS(const AudioSettings &settings) :
    3233    AudioOutputBase(settings),
     
    316317    mixerfd = -1;
    317318    int volume = 0;
    318319
    319     QString device = gContext->GetSetting("MixerDevice", "/dev/mixer");
     320    QString device = psettings->GetSetting("MixerDevice", "/dev/mixer");
    320321    if (device.toLower() == "software")
    321322        return;
    322323
    323324    QByteArray dev = device.toAscii();
    324325    mixerfd = open(dev.constData(), O_RDONLY);
    325326
    326     QString controlLabel = gContext->GetSetting("MixerControl", "PCM");
     327    QString controlLabel = psettings->GetSetting("MixerControl", "PCM");
    327328
    328329    if (controlLabel == "Master")
    329330    {
     
    344345    if (set_initial_vol)
    345346    {
    346347        int tmpVol;
    347         volume = gContext->GetNumSetting("MasterMixerVolume", 80);
     348        volume = psettings->GetNumSetting("MasterMixerVolume", 80);
    348349        tmpVol = (volume << 8) + volume;
    349350        int ret = ioctl(mixerfd, MIXER_WRITE(SOUND_MIXER_VOLUME), &tmpVol);
    350351        if (ret < 0)
     
    353354                    QString("Error Setting initial Master Volume") + ENO);
    354355        }
    355356
    356         volume = gContext->GetNumSetting("PCMMixerVolume", 80);
     357        volume = psettings->GetNumSetting("PCMMixerVolume", 80);
    357358        tmpVol = (volume << 8) + volume;
    358359        ret = ioctl(mixerfd, MIXER_WRITE(SOUND_MIXER_PCM), &tmpVol);
    359360        if (ret < 0)
  • libs/libmyth/volumebase.h

     
    33
    44#include "mythexp.h"
    55
     6class PlaySettings;
     7
    68typedef enum {
    79    kMuteOff = 0,
    810    kMuteLeft,
     
    1315class MPUBLIC VolumeBase
    1416{
    1517  public:
    16     VolumeBase();   
     18    VolumeBase(PlaySettings *settings);   
    1719    virtual ~VolumeBase() {};
    1820
    1921    void SWVolume(bool set);
     
    4648    MuteState current_mute_state;
    4749    bool swvol;
    4850    bool swvol_setting;
     51    PlaySettings *settings;
    4952
    5053};
    5154
  • libs/libmyth/mythwidgets.cpp

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

     
    88#include "volumebase.h"
    99#include "output.h"
    1010
     11class PlaySettings;
     12
    1113class MPUBLIC AudioOutput : public VolumeBase, public OutputListeners
    1214{
    1315 public:
     
    1921        int audio_codec, int audio_samplerate,
    2022        AudioOutputSource source,
    2123        bool set_initial_vol, bool audio_passthru,
     24        PlaySettings *psettings,
    2225        int upmixer_startup = 0);
     26    static AudioOutput *OpenAudio(
     27        const QString &audiodevice,
     28        const QString &passthrudevice,
     29        int audio_bits, int audio_channels,
     30        int audio_codec, int audio_samplerate,
     31        AudioOutputSource source,
     32        bool set_initial_vol, bool audio_passthru,
     33        int upmixer_startup = 0);
    2334
    24     AudioOutput() :
    25         VolumeBase(),             OutputListeners(),
     35    AudioOutput(PlaySettings *psettings) :
     36        VolumeBase(psettings),    OutputListeners(),
    2637        lastError(QString::null), lastWarn(QString::null) {}
    2738
    2839    virtual ~AudioOutput() { };
  • libs/libmyth/mythconfiggroups.cpp

     
    475475                                            Configurable *target)
    476476{
    477477    VerifyLayout();
     478    bool isDuplicate = triggerMap.values().contains(target);
    478479    triggerMap[triggerValue] = target;
    479480
    480481    if (!configStack)
     
    484485        configStack->setSaveAll(isSaveAll);
    485486    }
    486487
    487     configStack->addChild(target);
     488    // Don't add a target as a child if it has already been added,
     489    // otherwise something goes wrong with signals in the child.
     490    if (!isDuplicate)
     491        configStack->addChild(target);
    488492}
    489493
    490494Setting *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
  • libs/libmyth/audiooutputpulse.cpp

     
    547547                                     (char*)"under");
    548548    if (set_initial_vol)
    549549    {
    550         int volume = gContext->GetNumSetting("MasterMixerVolume", 80);
     550        int volume = psettings->GetNumSetting("MasterMixerVolume", 80);
    551551        pa_cvolume_set(&volume_control, audio_channels,
    552552                       (float)volume * (float)PA_VOLUME_NORM / 100.0f);
    553553    }
  • programs/mythfrontend/globalsettings.cpp

     
    3737#include "mythconfig.h"
    3838#include "mythdirs.h"
    3939#include "mythuihelper.h"
     40#include "playsettings.h"
    4041
    41 static HostComboBox *AudioOutputDevice()
     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)
    4295{
    43     HostComboBox *gc = new HostComboBox("AudioOutputDevice", true);
     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
     156static QString getDefault(Setting *obj)
     157{
     158    PlaySettingsCombinedStorage *storage =
     159        dynamic_cast<PlaySettingsCombinedStorage *>(obj);
     160    if (storage)
     161        return storage->getDefault();
     162    else
     163        return "";
     164}
     165
     166static Setting *AudioOutputDevice(PlaySettings *settings)
     167{
     168    CREATE_COMBOBOX1_SETTING(gc, "AudioOutputDevice", settings, true);
    44169    gc->setLabel(QObject::tr("Audio output device"));
    45170
    46171#ifdef USING_ALSA
     
    85210
    86211    gc->addSelection("NULL", "NULL");
    87212
    88     return gc;
     213    return wrap(gc, settings);
    89214}
    90215
    91 static HostComboBox *MaxAudioChannels()
     216static Setting *MaxAudioChannels(PlaySettings *settings)
    92217{
    93     HostComboBox *gc = new HostComboBox("MaxChannels",false);
     218    CREATE_COMBOBOX_SETTING(gc, "MaxChannels", settings);
    94219    gc->setLabel(QObject::tr("Speakers configuration"));
    95220    gc->addSelection(QObject::tr("Stereo"), "2", true); // default
    96221    gc->addSelection(QObject::tr("5.1"), "6");
    97222    gc->setHelpText(
    98223            QObject::tr(
    99224                "Set your audio configuration: Stereo or Surround."));
    100     return gc;
     225    return wrap(gc, settings);
    101226}
    102227
    103 static HostCheckBox *AudioUpmix()
     228static Setting *AudioUpmix(PlaySettings *settings)
    104229{
    105     HostCheckBox *gc = new HostCheckBox("AudioDefaultUpmix");
     230    CREATE_CHECKBOX_SETTING(gc, "AudioDefaultUpmix", settings);
    106231    gc->setLabel(QObject::tr("Upconvert stereo to 5.1 surround"));
    107232    gc->setValue(true);
    108233    gc->setHelpText(QObject::tr("MythTV can upconvert stereo to 5.1 audio. "
    109234                                "Set this option to enable it by default. "
    110235                                "You can enable or disable the upconversion during playback at anytime."));
    111     return gc;
     236    return wrap(gc, settings);
    112237}
    113238
    114 static HostComboBox *AudioUpmixType()
     239static Setting *AudioUpmixType(PlaySettings *settings)
    115240{
    116     HostComboBox *gc = new HostComboBox("AudioUpmixType",false);
     241    CREATE_COMBOBOX_SETTING(gc, "AudioUpmixType", settings);
    117242    gc->setLabel(QObject::tr("Upmix"));
    118243    gc->addSelection(QObject::tr("Fastest"), "0", true); // default
    119244    gc->addSelection(QObject::tr("Good"), "1");
     
    122247            QObject::tr(
    123248                "Set the audio surround upconversion quality. "
    124249                "'Fastest' is the least demanding on the CPU at the expense of quality."));
    125     return gc;
     250    return wrap(gc, settings);
    126251}
    127252
    128 static HostCheckBox *AdvancedAudioSettings()
     253static Setting *AdvancedAudioSettings(PlaySettings *settings)
    129254{
    130     HostCheckBox *gc = new HostCheckBox("AdvancedAudioSettings");
     255    CREATE_CHECKBOX_SETTING(gc, "AdvancedAudioSettings", settings);
    131256    gc->setLabel(QObject::tr("Advanced Audio Configuration"));
    132257    gc->setValue(false);
    133258    gc->setHelpText(QObject::tr("Enable extra audio settings."));
    134     return gc;
     259    return wrap(gc, settings);
    135260}
    136261
    137 static HostCheckBox *SRCQualityOverride()
     262static Setting *SRCQualityOverride(PlaySettings *settings)
    138263{
    139     HostCheckBox *gc = new HostCheckBox("SRCQualityOverride");
     264    CREATE_CHECKBOX_SETTING(gc, "SRCQualityOverride", settings);
    140265    gc->setLabel(QObject::tr("Override SRC quality"));
    141266    gc->setValue(false);
    142267    gc->setHelpText(QObject::tr("Override audio sample rate conversion quality"));
    143     return gc;
     268    return wrap(gc, settings);
    144269}
    145270
    146 static HostComboBox *SRCQuality()
     271static Setting *SRCQuality(PlaySettings *settings)
    147272{
    148     HostComboBox *gc = new HostComboBox("SRCQuality", false);
     273    CREATE_COMBOBOX_SETTING(gc, "SRCQuality", settings);
    149274    gc->setLabel(QObject::tr("Sample Rate Conversion"));
    150275    gc->addSelection(QObject::tr("Disabled"), "-1");
    151276    gc->addSelection(QObject::tr("Fastest"), "0");
     
    155280                                "\"Good\" (default) provides the best compromise between CPU usage "
    156281                                "and quality. \"Disabled\" let the audio card handle sample rate conversion. "
    157282                                "This only affects non 48kHz PCM audio."));
    158     return gc;
     283    return wrap(gc, settings);
    159284}
    160285
    161 static HostComboBox *PassThroughOutputDevice()
     286static Setting *PassThroughOutputDevice(PlaySettings *settings)
    162287{
    163     HostComboBox *gc = new HostComboBox("PassThruOutputDevice", true);
     288    CREATE_COMBOBOX1_SETTING(gc, "PassThruOutputDevice", settings, true);
    164289
    165290    gc->setLabel(QObject::tr("Digital output device"));
    166291    gc->addSelection(QObject::tr("Default"), "Default");
     
    178303    gc->setHelpText(QObject::tr("Audio output device to use for digital audio. Default is the same as Audio output "
    179304                    "device. This value is currently only used with ALSA "
    180305                    "and DirectX sound output."));
    181     return gc;
     306    return wrap(gc, settings);
    182307}
    183308
    184 static HostCheckBox *MythControlsVolume()
     309static Setting *MythControlsVolume(PlaySettings *settings)
    185310{
    186     HostCheckBox *gc = new HostCheckBox("MythControlsVolume");
     311    CREATE_CHECKBOX_SETTING(gc, "MythControlsVolume", settings);
    187312    gc->setLabel(QObject::tr("Use internal volume controls"));
    188313    gc->setValue(true);
    189314    gc->setHelpText(QObject::tr("MythTV can control the PCM and master "
    190315                    "mixer volume.  If you prefer to control the volume externally "
    191316                    "(like your amplifier) or use an external mixer "
    192317                    "program, disable this option."));
    193     return gc;
     318    return wrap(gc, settings);
    194319}
    195320
    196 static HostComboBox *MixerDevice()
     321static Setting *MixerDevice(PlaySettings *settings)
    197322{
    198     HostComboBox *gc = new HostComboBox("MixerDevice", true);
     323    CREATE_COMBOBOX1_SETTING(gc, "MixerDevice", settings, true);
    199324    gc->setLabel(QObject::tr("Mixer Device"));
    200325
    201326#ifdef USING_OSS
     
    221346                                "the volume of all audio at the expense of a slight quality loss."));
    222347#endif
    223348
    224     return gc;
     349    return wrap(gc, settings);
    225350}
    226351
    227352static const char* MixerControlControls[] = { "PCM",
    228353                                              "Master" };
    229354
    230 static HostComboBox *MixerControl()
     355static Setting *MixerControl(PlaySettings *settings)
    231356{
    232     HostComboBox *gc = new HostComboBox("MixerControl", true);
     357    CREATE_COMBOBOX1_SETTING(gc, "MixerControl", settings, true);
    233358    gc->setLabel(QObject::tr("Mixer Controls"));
    234359    for (unsigned int i = 0; i < sizeof(MixerControlControls) / sizeof(char*);
    235360         ++i)
     
    239364    }
    240365
    241366    gc->setHelpText(QObject::tr("Changing the volume adjusts the selected mixer."));
    242     return gc;
     367    return wrap(gc, settings);
    243368}
    244369
    245 static HostSlider *MixerVolume()
     370static Setting *MixerVolume(PlaySettings *settings)
    246371{
    247     HostSlider *gs = new HostSlider("MasterMixerVolume", 0, 100, 1);
     372    CREATE_SLIDER_SETTING(gs, "MasterMixerVolume", settings, 0, 100, 1);
    248373    gs->setLabel(QObject::tr("Master Mixer Volume"));
    249374    gs->setValue(70);
    250375    gs->setHelpText(QObject::tr("Initial volume for the Master Mixer.  "
    251376                    "This affects all sound created by the sound card.  "
    252377                    "Note: Do not set this too low."));
    253     return gs;
     378    return wrap(gs, settings);
    254379}
    255380
    256 static HostSlider *PCMVolume()
     381static Setting *PCMVolume(PlaySettings *settings)
    257382{
    258     HostSlider *gs = new HostSlider("PCMMixerVolume", 0, 100, 1);
     383    CREATE_SLIDER_SETTING(gs, "PCMMixerVolume", settings, 0, 100, 1);
    259384    gs->setLabel(QObject::tr("PCM Mixer Volume"));
    260385    gs->setValue(70);
    261386    gs->setHelpText(QObject::tr("Initial volume for PCM output.  Using the "
     
    263388    return gs;
    264389}
    265390
    266 static HostCheckBox *IndividualMuteControl()
     391static Setting *IndividualMuteControl(PlaySettings *settings)
    267392{
    268     HostCheckBox *gc = new HostCheckBox("IndividualMuteControl");
     393    CREATE_CHECKBOX_SETTING(gc, "IndividualMuteControl", settings);
    269394    gc->setLabel(QObject::tr("Independent Muting of Left and Right Audio "
    270395                 "Channels"));
    271396    gc->setValue(false);
     
    274399                    "original language on one channel, and a dubbed "
    275400                    "version of the program on the other one.  This "
    276401                    "modifies the behavior of the Mute key."));
    277     return gc;
     402    return wrap(gc, settings);
    278403}
    279404
    280 static HostCheckBox *AC3PassThrough()
     405static Setting *AC3PassThrough(PlaySettings *settings)
    281406{
    282     HostCheckBox *gc = new HostCheckBox("AC3PassThru");
     407    CREATE_CHECKBOX_SETTING(gc, "AC3PassThru", settings);
    283408    gc->setLabel(QObject::tr("Dolby Digital"));
    284409    gc->setValue(false);
    285410    gc->setHelpText(QObject::tr("Enable if your amplifier or sound decoder supports AC3/Dolby Digital. "
    286411                                "You must use a digital connection. Uncheck if using an analog connection."));
    287     return gc;
     412    return wrap(gc, settings);
    288413}
    289414
    290 static HostCheckBox *DTSPassThrough()
     415static Setting *DTSPassThrough(PlaySettings *settings)
    291416{
    292     HostCheckBox *gc = new HostCheckBox("DTSPassThru");
     417    CREATE_CHECKBOX_SETTING(gc, "DTSPassThru", settings);
    293418    gc->setLabel(QObject::tr("DTS"));
    294419    gc->setValue(false);
    295420    gc->setHelpText(QObject::tr("Enable if your amplifier or sound decoder supports DTS. "
    296421                                "You must use a digital connection. Uncheck if using an analog connection"));
    297     return gc;
     422    return wrap(gc, settings);
    298423}
    299424
    300 static HostCheckBox *AggressiveBuffer()
     425static Setting *AggressiveBuffer(PlaySettings *settings)
    301426{
    302     HostCheckBox *gc = new HostCheckBox("AggressiveSoundcardBuffer");
     427    CREATE_CHECKBOX_SETTING(gc, "AggressiveSoundcardBuffer", settings);
    303428    gc->setLabel(QObject::tr("Aggressive Sound card Buffering"));
    304429    gc->setValue(false);
    305430    gc->setHelpText(QObject::tr("If enabled, MythTV will pretend to have "
     
    309434    return gc;
    310435}
    311436
    312 static HostCheckBox *DecodeExtraAudio()
     437static Setting *DecodeExtraAudio(PlaySettings *settings)
    313438{
    314     HostCheckBox *gc = new HostCheckBox("DecodeExtraAudio");
     439    CREATE_CHECKBOX_SETTING(gc, "DecodeExtraAudio", settings);
    315440    gc->setLabel(QObject::tr("Extra audio buffering"));
    316441    gc->setValue(true);
    317442    gc->setHelpText(QObject::tr("Enable this setting if MythTV is playing "
     
    320445                    "effect on framegrabbers (MPEG-4/RTJPEG).  MythTV will "
    321446                    "keep extra audio data in its internal buffers to workaround "
    322447                    "this bug."));
    323     return gc;
     448    return wrap(gc, settings);
    324449}
    325450
    326 static HostComboBox *PIPLocationComboBox()
     451static Setting *PIPLocationComboBox(PlaySettings *settings)
    327452{
    328     HostComboBox *gc = new HostComboBox("PIPLocation");
     453    CREATE_COMBOBOX_SETTING(gc, "PIPLocation", settings);
    329454    gc->setLabel(QObject::tr("PIP Video Location"));
    330455    for (uint loc = 0; loc < kPIP_END; ++loc)
    331456        gc->addSelection(toString((PIPLocation) loc), QString::number(loc));
    332457    gc->setHelpText(QObject::tr("Location of PIP Video window."));
    333     return gc;
     458    return wrap(gc, settings);
    334459}
    335460
    336461static GlobalLineEdit *AllRecGroupPassword()
     
    427552    return gc;
    428553}
    429554
    430 static HostCheckBox *SmartForward()
     555static Setting *SmartForward(PlaySettings *settings)
    431556{
    432     HostCheckBox *gc = new HostCheckBox("SmartForward");
     557    CREATE_CHECKBOX_SETTING(gc, "SmartForward", settings);
    433558    gc->setLabel(QObject::tr("Smart Fast Forwarding"));
    434559    gc->setValue(false);
    435560    gc->setHelpText(QObject::tr("If enabled, then immediately after "
    436561                    "rewinding, only skip forward the same amount as "
    437562                    "skipping backwards."));
    438     return gc;
     563    return wrap(gc, settings);
    439564}
    440565
    441 static HostCheckBox *ExactSeeking()
     566static Setting *ExactSeeking(PlaySettings *settings)
    442567{
    443     HostCheckBox *gc = new HostCheckBox("ExactSeeking");
     568    CREATE_CHECKBOX_SETTING(gc, "ExactSeeking", settings);
    444569    gc->setLabel(QObject::tr("Seek to exact frame"));
    445570    gc->setValue(false);
    446571    gc->setHelpText(QObject::tr("If enabled, seeking is frame exact, but "
    447572                    "slower."));
    448     return gc;
     573    return wrap(gc, settings);
    449574}
    450575
    451576static GlobalComboBox *CommercialSkipMethod()
     
    463588    return bc;
    464589}
    465590
    466 static HostComboBox *AutoCommercialSkip()
     591static Setting *AutoCommercialSkip(PlaySettings *settings)
    467592{
    468     HostComboBox *gc = new HostComboBox("AutoCommercialSkip");
     593    CREATE_COMBOBOX_SETTING(gc, "AutoCommercialSkip", settings);
    469594    gc->setLabel(QObject::tr("Automatically Skip Commercials"));
    470595    gc->addSelection(QObject::tr("Off"), "0");
    471596    gc->addSelection(QObject::tr("Notify, but do not skip"), "2");
     
    474599                    "have been flagged during Automatic Commercial Flagging "
    475600                    "or by the mythcommflag program, or just notify that a "
    476601                    "commercial has been detected."));
    477     return gc;
     602    return wrap(gc, settings);
    478603}
    479604
    480605static GlobalCheckBox *AutoCommercialFlag()
     
    559684    return bc;
    560685}
    561686
    562 static HostSpinBox *CommRewindAmount()
     687static Setting *CommRewindAmount(PlaySettings *settings)
    563688{
    564     HostSpinBox *gs = new HostSpinBox("CommRewindAmount", 0, 10, 1);
     689    CREATE_SPINBOX_SETTING(gs, "CommRewindAmount", settings, 0, 10, 1, false);
    565690    gs->setLabel(QObject::tr("Commercial Skip Auto-Rewind Amount"));
    566691    gs->setHelpText(QObject::tr("If set, MythTV will automatically rewind "
    567692                    "this many seconds after performing a commercial skip."));
    568693    gs->setValue(0);
    569     return gs;
     694    return wrap(gs, settings);
    570695}
    571696
    572 static HostSpinBox *CommNotifyAmount()
     697static Setting *CommNotifyAmount(PlaySettings *settings)
    573698{
    574     HostSpinBox *gs = new HostSpinBox("CommNotifyAmount", 0, 10, 1);
     699    CREATE_SPINBOX_SETTING(gs, "CommNotifyAmount", settings, 0, 10, 1, false);
    575700    gs->setLabel(QObject::tr("Commercial Skip Notify Amount"));
    576701    gs->setHelpText(QObject::tr("If set, MythTV will act like a commercial "
    577702                    "begins this many seconds early.  This can be useful "
    578703                    "when commercial notification is used in place of "
    579704                    "automatic skipping."));
    580705    gs->setValue(0);
    581     return gs;
     706    return wrap(gs, settings);
    582707}
    583708
    584709static GlobalSpinBox *MaximumCommercialSkip()
     
    13681493    labels[j]->setValue(label_i);
    13691494}
    13701495
    1371 PlaybackProfileConfigs::PlaybackProfileConfigs(const QString &str) :
     1496PlaybackProfileConfigs::PlaybackProfileConfigs(const QString &str,
     1497                                               PlaySettings *settings) :
    13721498    TriggeredConfigurationGroup(false, true,  true, true,
    13731499                                false, false, true, true), grouptrigger(NULL)
    13741500{
    13751501    setLabel(QObject::tr("Playback Profiles") + str);
     1502    if (settings)
     1503        setLabel(QObject::tr("Playback group settings for ") +
     1504                 settings->mGroupName + " - " +
     1505                 getLabel());
    13761506
    13771507    QString host = gContext->GetHostName();
    13781508    QStringList profiles = VideoDisplayProfile::GetProfiles(host);
     
    14001530        profiles = VideoDisplayProfile::GetProfiles(host);
    14011531    }
    14021532
    1403     QString profile = VideoDisplayProfile::GetDefaultProfileName(host);
     1533    QString profile = VideoDisplayProfile::GetDefaultProfileName(host, settings);
    14041534    if (!profiles.contains(profile))
    14051535    {
    14061536        profile = (profiles.contains("Normal")) ? "Normal" : profiles[0];
    14071537        VideoDisplayProfile::SetDefaultProfileName(profile, host);
    14081538    }
    14091539
    1410     grouptrigger = new HostComboBox("DefaultVideoPlaybackProfile");
     1540    CREATE_COMBOBOX_SETTING(gs, "DefaultVideoPlaybackProfile", settings);
     1541    grouptrigger = gs;
    14111542    grouptrigger->setLabel(QObject::tr("Current Video Playback Profile"));
    14121543    QStringList::const_iterator it;
    14131544    for (it = profiles.begin(); it != profiles.end(); ++it)
    14141545        grouptrigger->addSelection(ProgramInfo::i18n(*it), *it);
     1546    if (settings)
     1547    {
     1548        addChild(wrap(grouptrigger, settings));
     1549        return;
     1550    }
    14151551
    14161552    HorizontalConfigurationGroup *grp =
    14171553        new HorizontalConfigurationGroup(false, false, true, true);
     
    15441680    return gc;
    15451681}
    15461682
    1547 static HostSpinBox *FFRewReposTime()
     1683static Setting *FFRewReposTime(PlaySettings *settings)
    15481684{
    1549     HostSpinBox *gs = new HostSpinBox("FFRewReposTime", 0, 200, 5);
     1685    CREATE_SPINBOX_SETTING(gs, "FFRewReposTime", settings, 0, 200, 5, false);
    15501686    gs->setLabel(QObject::tr("Fast forward/rewind reposition amount"));
    15511687    gs->setValue(100);
    15521688    gs->setHelpText(QObject::tr("When exiting sticky keys fast forward/rewind "
     
    15541690                    "resuming normal playback. This "
    15551691                    "compensates for the reaction time between seeing "
    15561692                    "where to resume playback and actually exiting seeking."));
    1557     return gs;
     1693    return wrap(gs, settings);
    15581694}
    15591695
    1560 static HostCheckBox *FFRewReverse()
     1696static Setting *FFRewReverse(PlaySettings *settings)
    15611697{
    1562     HostCheckBox *gc = new HostCheckBox("FFRewReverse");
     1698    CREATE_CHECKBOX_SETTING(gc, "FFRewReverse", settings);
    15631699    gc->setLabel(QObject::tr("Reverse direction in fast forward/rewind"));
    15641700    gc->setValue(true);
    15651701    gc->setHelpText(QObject::tr("If enabled, pressing the sticky rewind key "
     
    15671703                    "vice versa.  If disabled, it will decrease the "
    15681704                    "current speed or switch to play mode if "
    15691705                    "the speed can't be decreased further."));
    1570     return gc;
     1706    return wrap(gc, settings);
    15711707}
    15721708
    1573 static HostSpinBox *OSDGeneralTimeout()
     1709static Setting *OSDGeneralTimeout(PlaySettings *settings)
    15741710{
    1575     HostSpinBox *gs = new HostSpinBox("OSDGeneralTimeout", 1, 30, 1);
     1711    CREATE_SPINBOX_SETTING(gs, "OSDGeneralTimeout", settings, 1, 30, 1, false);
    15761712    gs->setLabel(QObject::tr("General OSD time-out (sec)"));
    15771713    gs->setValue(2);
    15781714    gs->setHelpText(QObject::tr("Length of time an on-screen display "
    15791715                    "window will be visible."));
    1580     return gs;
     1716    return wrap(gs, settings);
    15811717}
    15821718
    1583 static HostSpinBox *OSDProgramInfoTimeout()
     1719static Setting *OSDProgramInfoTimeout(PlaySettings *settings)
    15841720{
    1585     HostSpinBox *gs = new HostSpinBox("OSDProgramInfoTimeout", 1, 30, 1);
     1721    CREATE_SPINBOX_SETTING(gs, "OSDProgramInfoTimeout", settings,
     1722                           1, 30, 1, false);
    15861723    gs->setLabel(QObject::tr("Program Info OSD time-out"));
    15871724    gs->setValue(3);
    15881725    gs->setHelpText(QObject::tr("Length of time the on-screen display "
    15891726                    "will display program information."));
    1590     return gs;
     1727    return wrap(gs, settings);
    15911728}
    15921729
    1593 static HostSpinBox *OSDNotifyTimeout()
     1730static Setting *OSDNotifyTimeout(PlaySettings *settings)
    15941731{
    1595     HostSpinBox *gs = new HostSpinBox("OSDNotifyTimeout", 1, 30, 1);
     1732    CREATE_SPINBOX_SETTING(gs, "OSDNotifyTimeout", settings, 1, 30, 1, false);
    15961733    gs->setLabel(QObject::tr("UDP Notify OSD time-out"));
    15971734    gs->setValue(5);
    15981735    gs->setHelpText(QObject::tr("How many seconds an on-screen display "
    15991736                    "will be active for UDP Notify events."));
    1600     return gs;
     1737    return wrap(gs, settings);
    16011738}
    16021739
    16031740static HostSpinBox *ThemeCacheSize()
     
    16411778    return gc;
    16421779}
    16431780
    1644 static HostComboBox *OSDFont()
     1781static Setting *OSDFont(PlaySettings *settings)
    16451782{
    1646     HostComboBox *gc = new HostComboBox("OSDFont");
     1783    CREATE_COMBOBOX_SETTING(gc, "OSDFont", settings);
    16471784    gc->setLabel(QObject::tr("OSD font"));
    16481785    QDir ttf(GetFontsDir(), GetFontsNameFilter());
    16491786    gc->fillSelectionsFromDir(ttf, false);
     
    16511788    if (gc->findSelection(defaultOSDFont) > -1)
    16521789        gc->setValue(defaultOSDFont);
    16531790
    1654     return gc;
     1791    return wrap(gc, settings);
    16551792}
    16561793
    1657 static HostComboBox *OSDCCFont()
     1794static Setting *OSDCCFont(PlaySettings *settings)
    16581795{
    1659     HostComboBox *gc = new HostComboBox("OSDCCFont");
     1796    CREATE_COMBOBOX_SETTING(gc, "OSDCCFont", settings);
    16601797    gc->setLabel(QObject::tr("CC font"));
    16611798    QDir ttf(GetFontsDir(), GetFontsNameFilter());
    16621799    gc->fillSelectionsFromDir(ttf, false);
    16631800    gc->setHelpText(QObject::tr("Closed Caption font"));
    16641801
    1665     return gc;
     1802    return wrap(gc, settings);
    16661803}
    16671804
    16681805static HostComboBox __attribute__ ((unused)) *DecodeVBIFormat()
     
    16831820    return gc;
    16841821}
    16851822
    1686 static HostSpinBox *OSDCC708TextZoomPercentage(void)
     1823static Setting *OSDCC708TextZoomPercentage(PlaySettings *settings)
    16871824{
    1688     HostSpinBox *gs = new HostSpinBox("OSDCC708TextZoom", 50, 200, 5);
     1825    CREATE_SPINBOX_SETTING(gs, "OSDCC708TextZoom", settings,
     1826                           50, 200, 5, false);
    16891827    gs->setLabel(QObject::tr("Text zoom percentage"));
    16901828    gs->setValue(100);
    16911829    gs->setHelpText(QObject::tr("Use this to enlarge or shrink captions."));
    16921830
    1693     return gs;
     1831    return wrap(gs, settings);
    16941832}
    16951833
    1696 static HostComboBox *OSDCC708DefaultFontType(void)
     1834static Setting *OSDCC708DefaultFontType(PlaySettings *settings)
    16971835{
    1698     HostComboBox *hc = new HostComboBox("OSDCC708DefaultFontType");
     1836    CREATE_COMBOBOX_SETTING(hc, "OSDCC708DefaultFontType", settings);
    16991837    hc->setLabel(QObject::tr("Default Caption Font Type"));
    17001838    hc->setHelpText(
    17011839        QObject::tr("This allows you to set which font type to use "
     
    17181856    };
    17191857    for (uint i = 0; i < 7; ++i)
    17201858        hc->addSelection(typeNames[i], types[i]);
    1721     return hc;
     1859    return wrap(hc, settings);
    17221860}
    17231861
    1724 static VerticalConfigurationGroup *OSDCC708Settings(void)
     1862static VerticalConfigurationGroup *OSDCC708Settings(PlaySettings *settings)
    17251863{
    17261864    VerticalConfigurationGroup *grp =
    17271865        new VerticalConfigurationGroup(false, true, true, true);
    17281866    grp->setLabel(QObject::tr("ATSC Caption Settings"));
     1867    if (settings)
     1868        grp->setLabel(QObject::tr("Playback group settings for ") +
     1869                      settings->mGroupName + " - " +
     1870                      grp->getLabel());
    17291871
    17301872// default text zoom 1.0
    1731     grp->addChild(OSDCC708TextZoomPercentage());
     1873    grp->addChild(OSDCC708TextZoomPercentage(settings));
    17321874
    17331875// force X lines of captions
    17341876// force caption character color
     
    17371879// force background opacity
    17381880
    17391881// set default font type
    1740     grp->addChild(OSDCC708DefaultFontType());
     1882    grp->addChild(OSDCC708DefaultFontType(settings));
    17411883
    17421884    return grp;
    17431885}
    17441886
    1745 static HostComboBox *OSDCC708Font(
     1887static Setting *OSDCC708Font(
    17461888    const QString &subtype, const QString &subtypeName,
    1747     const QString &subtypeNameForHelp)
     1889    const QString &subtypeNameForHelp, PlaySettings *settings)
    17481890{
    1749     HostComboBox *gc = new HostComboBox(
    1750         QString("OSDCC708%1Font").arg(subtype));
     1891    CREATE_COMBOBOX_SETTING(gc, QString("OSDCC708%1Font").arg(subtype),
     1892                            settings);
    17511893
    17521894    gc->setLabel(subtypeName);
    17531895    QDir ttf(GetFontsDir(), GetFontsNameFilter());
     
    17551897    gc->setHelpText(
    17561898        QObject::tr("ATSC %1 closed caption font.").arg(subtypeNameForHelp));
    17571899
    1758     return gc;
     1900    return wrap(gc, settings, (subtypeName.length() > 10));
    17591901}
    17601902
    1761 static HorizontalConfigurationGroup *OSDCC708Fonts(void)
     1903static HorizontalConfigurationGroup *OSDCC708Fonts(PlaySettings *settings)
    17621904{
    17631905    HorizontalConfigurationGroup *grpmain =
    17641906        new HorizontalConfigurationGroup(false, true, true, true);
    17651907    grpmain->setLabel(QObject::tr("ATSC Caption Fonts"));
     1908    if (settings)
     1909        grpmain->setLabel(QObject::tr("Playback group settings for ") +
     1910                          settings->mGroupName + " - " +
     1911                          grpmain->getLabel());
    17661912    VerticalConfigurationGroup *col[] =
    17671913    {
    17681914        new VerticalConfigurationGroup(false, false, true, true),
     
    17981944    for (uint j = 0; j < 7; ++j)
    17991945    {
    18001946        col[i]->addChild(OSDCC708Font(subtypes[i].arg(types[j]),
    1801                                       typeNames[j], typeNames[j]));
     1947                                      typeNames[j], typeNames[j],
     1948                                      settings));
    18021949    }
    18031950    grpmain->addChild(col[i]);
    18041951
    18051952    i = 1;
    18061953    for (uint j = 0; j < 7; ++j)
    18071954    {
    1808         col[i]->addChild(OSDCC708Font(
    1809                              subtypes[i].arg(types[j]), "",
    1810                              QObject::tr("Italic") + ' ' + typeNames[j]));
     1955        col[i]->addChild(OSDCC708Font(subtypes[i].arg(types[j]),
     1956                                      (settings ? typeNames[j] : ""),
     1957                                      QObject::tr("Italic") + ' ' + typeNames[j],
     1958                                      settings));
    18111959    }
    18121960
    18131961    grpmain->addChild(col[i]);
     
    18151963    return grpmain;
    18161964}
    18171965
    1818 static HostComboBox *SubtitleCodec()
     1966static Setting *SubtitleCodec(PlaySettings *settings)
    18191967{
    1820     HostComboBox *gc = new HostComboBox("SubtitleCodec");
     1968    CREATE_COMBOBOX_SETTING(gc, "SubtitleCodec", settings);
    18211969
    18221970    gc->setLabel(QObject::tr("Subtitle Codec"));
    18231971    QList<QByteArray> list = QTextCodec::availableCodecs();
     
    18271975        gc->addSelection(val, val, val.toLower() == "utf-8");
    18281976    }
    18291977
    1830     return gc;
     1978    return wrap(gc, settings);
    18311979}
    18321980
    1833 static HorizontalConfigurationGroup *ExternalSubtitleSettings()
     1981static HorizontalConfigurationGroup *ExternalSubtitleSettings(PlaySettings *settings)
    18341982{
    18351983    HorizontalConfigurationGroup *grpmain =
    18361984        new HorizontalConfigurationGroup(false, true, true, true);
    18371985
    18381986    grpmain->setLabel(QObject::tr("External Subtitle Settings"));
    18391987
    1840     grpmain->addChild(SubtitleCodec());
     1988    grpmain->addChild(SubtitleCodec(settings));
    18411989
    18421990    return grpmain;
    18431991}
    18441992
    1845 static HostComboBox *OSDThemeFontSizeType()
     1993static Setting *OSDThemeFontSizeType(PlaySettings *settings)
    18461994{
    1847     HostComboBox *gc = new HostComboBox("OSDThemeFontSizeType");
     1995    CREATE_COMBOBOX_SETTING(gc, "OSDThemeFontSizeType", settings);
    18481996    gc->setLabel(QObject::tr("Font size"));
    18491997    gc->addSelection(QObject::tr("default"), "default");
    18501998    gc->addSelection(QObject::tr("small"), "small");
    18511999    gc->addSelection(QObject::tr("big"), "big");
    18522000    gc->setHelpText(QObject::tr("default: TV, small: monitor, big:"));
    1853     return gc;
     2001    return wrap(gc, settings);
    18542002}
    18552003
    18562004static HostComboBox *ChannelOrdering()
     
    18622010    return gc;
    18632011}
    18642012
    1865 static HostSpinBox *VertScanPercentage()
     2013static Setting *VertScanPercentage(PlaySettings *settings)
    18662014{
    1867     HostSpinBox *gs = new HostSpinBox("VertScanPercentage", -100, 100, 1);
     2015    CREATE_SPINBOX_SETTING(gs, "VertScanPercentage", settings,
     2016                           -100, 100, 1, false);
    18682017    gs->setLabel(QObject::tr("Vertical scaling"));
    18692018    gs->setValue(0);
    18702019    gs->setHelpText(QObject::tr(
    18712020                        "Adjust this if the image does not fill your "
    18722021                        "screen vertically. Range -100% to 100%"));
    1873     return gs;
     2022    return wrap(gs, settings);
    18742023}
    18752024
    1876 static HostSpinBox *HorizScanPercentage()
     2025static Setting *HorizScanPercentage(PlaySettings *settings)
    18772026{
    1878     HostSpinBox *gs = new HostSpinBox("HorizScanPercentage", -100, 100, 1);
     2027    CREATE_SPINBOX_SETTING(gs, "HorizScanPercentage", settings,
     2028                           -100, 100, 1, false);
    18792029    gs->setLabel(QObject::tr("Horizontal scaling"));
    18802030    gs->setValue(0);
    18812031    gs->setHelpText(QObject::tr(
    18822032                        "Adjust this if the image does not fill your "
    18832033                        "screen horizontally. Range -100% to 100%"));
    1884     return gs;
     2034    return wrap(gs, settings);
    18852035};
    18862036
    1887 static HostSpinBox *XScanDisplacement()
     2037static Setting *XScanDisplacement(PlaySettings *settings)
    18882038{
    1889     HostSpinBox *gs = new HostSpinBox("XScanDisplacement", -50, 50, 1);
     2039    CREATE_SPINBOX_SETTING(gs, "XScanDisplacement", settings,
     2040                           -50, 50, 1, false);
    18902041    gs->setLabel(QObject::tr("Scan displacement (X)"));
    18912042    gs->setValue(0);
    18922043    gs->setHelpText(QObject::tr("Adjust this to move the image horizontally."));
    1893     return gs;
     2044    return wrap(gs, settings);
    18942045}
    18952046
    1896 static HostSpinBox *YScanDisplacement()
     2047static Setting *YScanDisplacement(PlaySettings *settings)
    18972048{
    1898     HostSpinBox *gs = new HostSpinBox("YScanDisplacement", -50, 50, 1);
     2049    CREATE_SPINBOX_SETTING(gs, "YScanDisplacement", settings,
     2050                           -50, 50, 1, false);
    18992051    gs->setLabel(QObject::tr("Scan displacement (Y)"));
    19002052    gs->setValue(0);
    19012053    gs->setHelpText(QObject::tr("Adjust this to move the image vertically."));
    1902     return gs;
     2054    return wrap(gs, settings);
    19032055};
    19042056
    19052057static HostCheckBox *AlwaysStreamFiles()
     
    19152067    return gc;
    19162068}
    19172069
    1918 static HostCheckBox *CCBackground()
     2070static Setting *CCBackground(PlaySettings *settings)
    19192071{
    1920     HostCheckBox *gc = new HostCheckBox("CCBackground");
     2072    CREATE_CHECKBOX_SETTING(gc, "CCBackground", settings);
    19212073    gc->setLabel(QObject::tr("Black background for closed captioning"));
    19222074    gc->setValue(false);
    19232075    gc->setHelpText(QObject::tr(
    19242076                        "If enabled, captions will be displayed "
    19252077                        "as white text over a black background "
    19262078                        "for better contrast."));
    1927     return gc;
     2079    return wrap(gc, settings);
    19282080}
    19292081
    1930 static HostCheckBox *DefaultCCMode()
     2082static Setting *DefaultCCMode(PlaySettings *settings)
    19312083{
    1932     HostCheckBox *gc = new HostCheckBox("DefaultCCMode");
     2084    CREATE_CHECKBOX_SETTING(gc, "DefaultCCMode", settings);
    19332085    gc->setLabel(QObject::tr("Always display closed captioning or subtitles"));
    19342086    gc->setValue(false);
    19352087    gc->setHelpText(QObject::tr(
     
    19372089                        "when playing back recordings or watching "
    19382090                        "live TV.  Closed Captioning can be turned on or off "
    19392091                        "by pressing \"T\" during playback."));
    1940     return gc;
     2092    return wrap(gc, settings);
    19412093}
    19422094
    1943 static HostCheckBox *PreferCC708()
     2095static Setting *PreferCC708(PlaySettings *settings)
    19442096{
    1945     HostCheckBox *gc = new HostCheckBox("Prefer708Captions");
     2097    CREATE_CHECKBOX_SETTING(gc, "Prefer708Captions", settings);
    19462098    gc->setLabel(QObject::tr("Prefer EIA-708 over EIA-608 captions"));
    19472099    gc->setValue(true);
    19482100    gc->setHelpText(
     
    19502102            "When enabled the new EIA-708 captions will be preferred over "
    19512103            "the old EIA-608 captions in ATSC streams."));
    19522104
    1953     return gc;
     2105    return wrap(gc, settings);
    19542106}
    19552107
    1956 static HostCheckBox *EnableMHEG()
     2108static Setting *EnableMHEG(PlaySettings *settings)
    19572109{
    1958     HostCheckBox *gc = new HostCheckBox("EnableMHEG");
     2110    CREATE_CHECKBOX_SETTING(gc, "EnableMHEG", settings);
    19592111    gc->setLabel(QObject::tr("Enable Interactive TV"));
    19602112    gc->setValue(false);
    19612113    gc->setHelpText(QObject::tr(
    19622114                        "If enabled, interactive TV applications (MHEG) will "
    19632115                        "be activated.  This is used for teletext and logos for "
    19642116                        "radio and channels that are currently off-air."));
    1965     return gc;
     2117    return wrap(gc, settings);
    19662118}
    19672119
    1968 static HostCheckBox *PersistentBrowseMode()
     2120static Setting *PersistentBrowseMode(PlaySettings *settings)
    19692121{
    1970     HostCheckBox *gc = new HostCheckBox("PersistentBrowseMode");
     2122    CREATE_CHECKBOX_SETTING(gc, "PersistentBrowseMode", settings);
    19712123    gc->setLabel(QObject::tr("Always use Browse mode in LiveTV"));
    19722124    gc->setValue(true);
    19732125    gc->setHelpText(
    19742126        QObject::tr(
    19752127            "If enabled, Browse mode will automatically be activated "
    19762128            "whenever you use Channel UP/DOWN while watching Live TV."));
    1977     return gc;
     2129    return wrap(gc, settings);
    19782130}
    19792131
    1980 static HostCheckBox *BrowseAllTuners()
     2132static Setting *BrowseAllTuners(PlaySettings *settings)
    19812133{
    1982     HostCheckBox *gc = new HostCheckBox("BrowseAllTuners");
     2134    CREATE_CHECKBOX_SETTING(gc, "BrowseAllTuners", settings);
    19832135    gc->setLabel(QObject::tr("Browse all channels"));
    19842136    gc->setValue(false);
    19852137    gc->setHelpText(
     
    19872139            "If enabled, browse mode will shows channels on all "
    19882140            "available recording devices, instead of showing "
    19892141            "channels on just the current recorder."));
    1990     return gc;
     2142    return wrap(gc, settings);
    19912143}
    19922144
    1993 static HostCheckBox *ClearSavedPosition()
     2145static Setting *ClearSavedPosition(PlaySettings *settings)
    19942146{
    1995     HostCheckBox *gc = new HostCheckBox("ClearSavedPosition");
     2147    CREATE_CHECKBOX_SETTING(gc, "ClearSavedPosition", settings);
    19962148    gc->setLabel(QObject::tr("Clear bookmark on playback"));
    19972149    gc->setValue(true);
    19982150    gc->setHelpText(QObject::tr("Automatically clear the bookmark on a "
    19992151                    "recording when the recording is played back.  If "
    20002152                    "disabled, you can mark the beginning with rewind "
    20012153                    "then save position."));
    2002     return gc;
     2154    return wrap(gc, settings);
    20032155}
    20042156
    2005 static HostCheckBox *AltClearSavedPosition()
     2157static Setting *AltClearSavedPosition(PlaySettings *settings)
    20062158{
    2007     HostCheckBox *gc = new HostCheckBox("AltClearSavedPosition");
     2159    CREATE_CHECKBOX_SETTING(gc, "AltClearSavedPosition", settings);
    20082160    gc->setLabel(QObject::tr("Alternate clear and save bookmark"));
    20092161    gc->setValue(true);
    20102162    gc->setHelpText(QObject::tr("During playback the Select key "
     
    20122164                    "Saved\" and \"Bookmark Cleared\". If disabled, the "
    20132165                    "Select key will save the current position for each "
    20142166                    "keypress."));
    2015     return gc;
     2167    return wrap(gc, settings);
    20162168}
    20172169
    20182170#if defined(USING_XV) || defined(USING_OPENGL_VIDEO) || defined(USING_VDPAU)
    2019 static HostCheckBox *UsePicControls()
     2171static Setting *UsePicControls(PlaySettings *settings)
    20202172{
    2021     HostCheckBox *gc = new HostCheckBox("UseOutputPictureControls");
     2173    CREATE_CHECKBOX_SETTING(gc, "UseOutputPictureControls", settings);
    20222174    gc->setLabel(QObject::tr("Enable picture controls"));
    20232175    gc->setValue(false);
    20242176    gc->setHelpText(
    20252177        QObject::tr(
    20262178            "If enabled, MythTV attempts to initialize picture controls "
    20272179            "(brightness, contrast, etc.) that are applied during playback."));
    2028     return gc;
     2180    return wrap(gc, settings);
    20292181}
    20302182#endif
    20312183
    2032 static HostLineEdit *UDPNotifyPort()
     2184static Setting *UDPNotifyPort(PlaySettings *settings)
    20332185{
    2034     HostLineEdit *ge = new HostLineEdit("UDPNotifyPort");
     2186    CREATE_LINEEDIT_SETTING(ge, "UDPNotifyPort", settings);
    20352187    ge->setLabel(QObject::tr("UDP Notify Port"));
    20362188    ge->setValue("6948");
    20372189    ge->setHelpText(QObject::tr("During playback, MythTV will listen for "
    20382190                    "connections from the \"mythtvosd\" or \"mythudprelay\" "
    20392191                    "programs on this port.  See the README in "
    20402192                    "contrib/mythnotify/ for additional information."));
    2041     return ge;
     2193    return wrap(ge, settings);
    20422194}
    20432195
    2044 static HostComboBox *PlaybackExitPrompt()
     2196static Setting *PlaybackExitPrompt(PlaySettings *settings)
    20452197{
    2046     HostComboBox *gc = new HostComboBox("PlaybackExitPrompt");
     2198    CREATE_COMBOBOX_SETTING(gc, "PlaybackExitPrompt", settings);
    20472199    gc->setLabel(QObject::tr("Action on playback exit"));
    20482200    gc->addSelection(QObject::tr("Just exit"), "0");
    20492201    gc->addSelection(QObject::tr("Save position and exit"), "2");
     
    20542206                    "when you exit playback mode.  The options available will "
    20552207                    "allow you to save your position, delete the "
    20562208                    "recording, or continue watching."));
    2057     return gc;
     2209    return wrap(gc, settings);
    20582210}
    20592211
    2060 static HostCheckBox *EndOfRecordingExitPrompt()
     2212static Setting *EndOfRecordingExitPrompt(PlaySettings *settings)
    20612213{
    2062     HostCheckBox *gc = new HostCheckBox("EndOfRecordingExitPrompt");
     2214    CREATE_CHECKBOX_SETTING(gc, "EndOfRecordingExitPrompt", settings);
    20632215    gc->setLabel(QObject::tr("Prompt at end of recording"));
    20642216    gc->setValue(false);
    20652217    gc->setHelpText(QObject::tr("If set, a menu will be displayed allowing "
    20662218                    "you to delete the recording when it has finished "
    20672219                    "playing."));
    2068     return gc;
     2220    return wrap(gc, settings);
    20692221}
    20702222
    2071 static HostCheckBox *JumpToProgramOSD()
     2223static Setting *JumpToProgramOSD(PlaySettings *settings)
    20722224{
    2073     HostCheckBox *gc = new HostCheckBox("JumpToProgramOSD");
     2225    CREATE_CHECKBOX_SETTING(gc, "JumpToProgramOSD", settings);
    20742226    gc->setLabel(QObject::tr("Jump to Program OSD"));
    20752227    gc->setValue(true);
    20762228    gc->setHelpText(QObject::tr(
     
    20792231                        "'Watch Recording' screen when 'Jump to Program' "
    20802232                        "is activated. If set, the recordings are shown "
    20812233                        "in the OSD"));
    2082     return gc;
     2234    return wrap(gc, settings);
    20832235}
    20842236
    2085 static HostCheckBox *ContinueEmbeddedTVPlay()
     2237static Setting *ContinueEmbeddedTVPlay(PlaySettings *settings)
    20862238{
    2087     HostCheckBox *gc = new HostCheckBox("ContinueEmbeddedTVPlay");
     2239    CREATE_CHECKBOX_SETTING(gc, "ContinueEmbeddedTVPlay", settings);
    20882240    gc->setLabel(QObject::tr("Continue Playback When Embedded"));
    20892241    gc->setValue(false);
    20902242    gc->setHelpText(QObject::tr(
     
    20922244                    "is embedded in the upcoming program list or recorded "
    20932245                    "list. The default is to pause the recorded show when "
    20942246                    "embedded."));
    2095     return gc;
     2247    return wrap(gc, settings);
    20962248}
    20972249
    2098 static HostCheckBox *AutomaticSetWatched()
     2250static Setting *AutomaticSetWatched(PlaySettings *settings)
    20992251{
    2100     HostCheckBox *gc = new HostCheckBox("AutomaticSetWatched");
     2252    CREATE_CHECKBOX_SETTING(gc, "AutomaticSetWatched", settings);
    21012253    gc->setLabel(QObject::tr("Automatically mark a recording as watched"));
    21022254    gc->setValue(false);
    21032255    gc->setHelpText(QObject::tr("If set, when you exit near the end of a "
     
    21052257                    "detection is not foolproof, so do not enable this "
    21062258                    "setting if you don't want an unwatched recording marked "
    21072259                    "as watched."));
    2108     return gc;
     2260    return wrap(gc, settings);
    21092261}
    21102262
    21112263static HostSpinBox *LiveTVIdleTimeout()
     
    23702522    return gc;
    23712523}
    23722524
    2373 static HostComboBox *LetterboxingColour()
     2525static Setting *LetterboxingColour(PlaySettings *settings)
    23742526{
    2375     HostComboBox *gc = new HostComboBox("LetterboxColour");
     2527    CREATE_COMBOBOX_SETTING(gc, "LetterboxColour", settings);
    23762528    gc->setLabel(QObject::tr("Letterboxing Color"));
    23772529    for (int m = kLetterBoxColour_Black; m < kLetterBoxColour_END; ++m)
    23782530        gc->addSelection(toString((LetterBoxColour)m), QString::number(m));
     
    23822534            "letterboxing, but those with plasma screens may prefer gray "
    23832535            "to minimize burn-in.") + " " +
    23842536        QObject::tr("Currently only works with XVideo video renderer."));
    2385     return gc;
     2537    return wrap(gc, settings);
    23862538}
    23872539
    2388 static HostComboBox *AspectOverride()
     2540static Setting *AspectOverride(PlaySettings *settings)
    23892541{
    2390     HostComboBox *gc = new HostComboBox("AspectOverride");
     2542    CREATE_COMBOBOX_SETTING(gc, "AspectOverride", settings);
    23912543    gc->setLabel(QObject::tr("Video Aspect Override"));
    23922544    for (int m = kAspect_Off; m < kAspect_END; ++m)
    23932545        gc->addSelection(toString((AspectOverrideMode)m), QString::number(m));
     
    23952547                        "When enabled, these will override the aspect "
    23962548                        "ratio specified by any broadcaster for all "
    23972549                        "video streams."));
    2398     return gc;
     2550    return wrap(gc, settings);
    23992551}
    24002552
    2401 static HostComboBox *AdjustFill()
     2553static Setting *AdjustFill(PlaySettings *settings)
    24022554{
    2403     HostComboBox *gc = new HostComboBox("AdjustFill");
     2555    CREATE_COMBOBOX_SETTING(gc, "AdjustFill", settings);
    24042556    gc->setLabel(QObject::tr("Zoom"));
    24052557    gc->addSelection(toString(kAdjustFill_AutoDetect_DefaultOff),
    24062558                     QString::number(kAdjustFill_AutoDetect_DefaultOff));
     
    24112563    gc->setHelpText(QObject::tr(
    24122564                        "When enabled, these will apply a predefined "
    24132565                        "zoom to all video playback in MythTV."));
    2414     return gc;
     2566    return wrap(gc, settings);
    24152567}
    24162568
    24172569// Theme settings
     
    28302982    return gc;
    28312983}
    28322984
    2833 ThemeSelector::ThemeSelector(QString label):
    2834     HostImageSelect(label) {
    2835 
     2985static Setting *ThemeSelector(QString label, PlaySettings *settings=NULL)
     2986{
     2987    CREATE_IMAGESELECT_SETTING(gs, label, settings);
    28362988    ThemeType themetype = THEME_UI;
    28372989
    28382990    if (label == "Theme")
    28392991    {
    28402992        themetype = THEME_UI;
    2841         setLabel(QObject::tr("UI Theme"));
     2993        gs->setLabel(QObject::tr("UI Theme"));
    28422994    }
    28432995    else if (label == "OSDTheme")
    28442996    {
    28452997        themetype = THEME_OSD;
    2846         setLabel(QObject::tr("OSD Theme"));
     2998        gs->setLabel(QObject::tr("OSD Theme"));
    28472999    }
    28483000    else if (label == "MenuTheme")
    28493001    {
    28503002        themetype = THEME_MENU;
    2851         setLabel(QObject::tr("Menu Theme"));
     3003        gs->setLabel(QObject::tr("Menu Theme"));
    28523004    }
    28533005
    28543006    QDir themes(GetThemesParentDir());
     
    29123064            VERBOSE(VB_IMPORTANT, QString("Problem reading theme preview image"
    29133065                                          " %1").arg(preview.filePath()));
    29143066
    2915         addImageSelection(name, previewImage, theme.fileName());
     3067        gs->addImageSelection(name, previewImage, theme.fileName());
    29163068    }
    29173069
    29183070    if (themetype & THEME_UI)
    2919         setValue(DEFAULT_UI_THEME);
     3071        gs->setValue(DEFAULT_UI_THEME);
    29203072    else if (themetype & THEME_OSD)
    2921         setValue("BlackCurves-OSD");
     3073        gs->setValue("BlackCurves-OSD");
     3074
     3075    return wrap(gs, settings);
    29223076}
    29233077
    29243078static HostComboBox *ChannelFormat()
     
    34033557
    34043558        addTarget("6", group);
    34053559        addTarget("2", new VerticalConfigurationGroup(false, true));
     3560        QString dflt = getDefault(checkbox);
     3561        if (!dflt.isEmpty())
     3562            addTarget(dflt, group);
    34063563    }
    34073564};
    34083565
     
    34163573
    34173574        addTarget("1", group);
    34183575        addTarget("0", new VerticalConfigurationGroup(false, true));
     3576        QString dflt = getDefault(checkbox);
     3577        if (!dflt.isEmpty())
     3578            addTarget(dflt, group);
    34193579    }
    34203580};
    34213581
     
    34303590
    34313591        addTarget("1", setting);
    34323592        addTarget("0", new VerticalConfigurationGroup(false, false));
     3593        QString dflt = getDefault(checkbox);
     3594        if (!dflt.isEmpty())
     3595            addTarget(dflt, setting);
    34333596    }
    34343597};
    34353598
    3436 static ConfigurationGroup *AudioSystemSettingsGroup()
     3599static ConfigurationGroup *AudioSystemSettingsGroup(PlaySettings *settings)
    34373600{
    34383601    ConfigurationGroup *vcg = new VerticalConfigurationGroup(false, true, false, false);
    34393602   
    34403603    vcg->setLabel(QObject::tr("Audio System"));
    34413604    vcg->setUseLabel(false);
    34423605
    3443     vcg->addChild(AudioOutputDevice());
     3606    vcg->addChild(AudioOutputDevice(settings));
    34443607
    3445     Setting *numchannels = MaxAudioChannels();
     3608    Setting *numchannels = MaxAudioChannels(settings);
    34463609    vcg->addChild(numchannels);
    34473610
    34483611    ConfigurationGroup *group1 =
    34493612        new VerticalConfigurationGroup(false, true, false, false);
    34503613
    3451     group1->addChild(AudioUpmix());
    3452     group1->addChild(AudioUpmixType());
    3453     group1->addChild(PassThroughOutputDevice());
     3614    group1->addChild(AudioUpmix(settings));
     3615    group1->addChild(AudioUpmixType(settings));
     3616    group1->addChild(PassThroughOutputDevice(settings));
    34543617
    34553618    ConfigurationGroup *settings1 =
    34563619        new HorizontalConfigurationGroup();
    34573620    settings1->setLabel(QObject::tr("Audio Processing Capabilities"));
    3458     settings1->addChild(AC3PassThrough());
    3459     settings1->addChild(DTSPassThrough());
     3621    settings1->addChild(AC3PassThrough(settings));
     3622    settings1->addChild(DTSPassThrough(settings));
    34603623
    34613624    group1->addChild(settings1);
    34623625
     
    34653628        new AudioSystemSurroundGroup(numchannels, group1);
    34663629    vcg->addChild(sub1);
    34673630
    3468     Setting *advancedsettings = AdvancedAudioSettings();
     3631    Setting *advancedsettings = AdvancedAudioSettings(settings);
    34693632    vcg->addChild(advancedsettings);
    34703633
    34713634    ConfigurationGroup *group2 =
     
    34783641    ConfigurationGroup *settings2 =
    34793642            new HorizontalConfigurationGroup(false, false, false, false);
    34803643
    3481     Setting *srcqualityoverride = SRCQualityOverride();
     3644    Setting *srcqualityoverride = SRCQualityOverride(settings);
    34823645   
    34833646    AudioSystemAdvancedSettings *sub3 =
    3484         new AudioSystemAdvancedSettings(srcqualityoverride, SRCQuality());
     3647        new AudioSystemAdvancedSettings(srcqualityoverride,
     3648                                        SRCQuality(settings));
    34853649    settings2->addChild(srcqualityoverride);
    34863650    settings2->addChild(sub3);
    34873651   
    34883652    group2->addChild(settings2);
    3489     group2->addChild(AggressiveBuffer());
     3653    group2->addChild(AggressiveBuffer(settings));
    34903654
    34913655    return vcg;
    34923656
     
    34953659class AudioMixerSettingsGroup : public TriggeredConfigurationGroup
    34963660{
    34973661  public:
    3498     AudioMixerSettingsGroup() :
     3662    AudioMixerSettingsGroup(PlaySettings *psettings) :
    34993663        TriggeredConfigurationGroup(false, true, false, false)
    35003664    {
    35013665        setLabel(QObject::tr("Audio Mixer"));
    35023666        setUseLabel(false);
    35033667
    3504         Setting *volumeControl = MythControlsVolume();
     3668        Setting *volumeControl = MythControlsVolume(psettings);
    35053669        addChild(volumeControl);
    35063670
    35073671        // Mixer settings
    35083672        ConfigurationGroup *settings =
    35093673            new VerticalConfigurationGroup(false, true, false, false);
    3510         settings->addChild(MixerDevice());
    3511         settings->addChild(MixerControl());
    3512         settings->addChild(MixerVolume());
    3513         settings->addChild(PCMVolume());
    3514         settings->addChild(IndividualMuteControl());
     3674        settings->addChild(MixerDevice(psettings));
     3675        settings->addChild(MixerControl(psettings));
     3676        settings->addChild(MixerVolume(psettings));
     3677        settings->addChild(PCMVolume(psettings));
     3678        settings->addChild(IndividualMuteControl(psettings));
    35153679
    35163680        ConfigurationGroup *dummy =
    35173681            new VerticalConfigurationGroup(false, true, false, false);
     
    35203684        setTrigger(volumeControl);
    35213685        addTarget("0", dummy);
    35223686        addTarget("1", settings);
     3687        QString dflt = getDefault(volumeControl);
     3688        if (!dflt.isEmpty())
     3689            addTarget(dflt, settings);
    35233690    }
    35243691};
    35253692
     
    35933760    return gs;
    35943761}
    35953762
    3596 static HostCheckBox *RealtimePriority()
     3763static Setting *RealtimePriority(PlaySettings *settings)
    35973764{
    3598     HostCheckBox *gc = new HostCheckBox("RealtimePriority");
     3765    CREATE_CHECKBOX_SETTING(gc, "RealtimePriority", settings);
    35993766    gc->setLabel(QObject::tr("Enable realtime priority threads"));
    36003767    gc->setHelpText(QObject::tr("When running mythfrontend with root "
    36013768                    "privileges, some threads can be given enhanced priority. "
    36023769                    "Disable this if mythfrontend freezes during video "
    36033770                    "playback."));
    36043771    gc->setValue(true);
    3605     return gc;
     3772    return wrap(gc, settings, false);
    36063773}
    36073774
    36083775static HostCheckBox *EnableMediaMon()
     
    37583925};
    37593926
    37603927#ifdef USING_OPENGL_VSYNC
    3761 static HostCheckBox *UseOpenGLVSync()
     3928static Setting *UseOpenGLVSync(PlaySettings *settings)
    37623929{
    3763     HostCheckBox *gc = new HostCheckBox("UseOpenGLVSync");
     3930    CREATE_CHECKBOX_SETTING(gc, "UseOpenGLVSync", settings);
    37643931    gc->setLabel(QObject::tr("Enable OpenGL vertical sync for timing"));
    37653932    gc->setValue(false);
    37663933    gc->setHelpText(QObject::tr(
    37673934                        "If it is supported by your hardware/drivers, "
    37683935                        "MythTV will use OpenGL vertical syncing for "
    37693936                        "video timing, reducing frame jitter."));
    3770     return gc;
     3937    return wrap(gc, settings);
    37713938}
    37723939#endif
    37733940
     
    41934360    return gc;
    41944361}
    41954362
    4196 MainGeneralSettings::MainGeneralSettings()
     4363MainGeneralSettings::MainGeneralSettings(PlaySettings *settings,
     4364                                         ConfigurationWizard *base)
    41974365{
     4366    if (!settings)
     4367    {
    41984368    DatabaseSettings::addDatabaseSettings(this);
    41994369
    42004370    VerticalConfigurationGroup *pin =
     
    42034373    pin->addChild(SetupPinCodeRequired());
    42044374    pin->addChild(SetupPinCode());
    42054375    addChild(pin);
     4376    }
    42064377
    4207     addChild(AudioSystemSettingsGroup());
     4378    if (base)
     4379    {
     4380        base->addChild(AudioSystemSettingsGroup(settings));
     4381        base->addChild(new AudioMixerSettingsGroup(settings));
     4382    }
     4383    else
     4384    {
     4385        addChild(AudioSystemSettingsGroup(settings));
     4386        addChild(new AudioMixerSettingsGroup(settings));
     4387    }
    42084388
    4209     addChild(new AudioMixerSettingsGroup());
    42104389
     4390    if (!settings)
     4391    {
    42114392    VerticalConfigurationGroup *general =
    42124393        new VerticalConfigurationGroup(false, true, false, false);
    42134394    general->setLabel(QObject::tr("General"));
     
    42474428    remotecontrol->addChild(NetworkControlEnabled());
    42484429    remotecontrol->addChild(NetworkControlPort());
    42494430    addChild(remotecontrol);
     4431    }
    42504432}
    42514433
    4252 PlaybackSettings::PlaybackSettings()
     4434PlaybackSettings::PlaybackSettings(PlaySettings *settings,
     4435                                   ConfigurationWizard *base)
    42534436{
    42544437    uint i = 0, total = 8;
    42554438#if CONFIG_DARWIN
    42564439    total += 2;
    42574440#endif // USING_DARWIN
     4441    if (settings)
     4442        total -= 3;
    42584443
    42594444
    42604445    VerticalConfigurationGroup* general1 =
    42614446        new VerticalConfigurationGroup(false);
    42624447    general1->setLabel(QObject::tr("General Playback") +
    42634448                      QString(" (%1/%2)").arg(++i).arg(total));
     4449    if (settings)
     4450        general1->setLabel(QObject::tr("Playback group settings for ") +
     4451                           settings->mGroupName + " - " +
     4452                           general1->getLabel());
    42644453
    42654454    HorizontalConfigurationGroup *columns =
    42664455        new HorizontalConfigurationGroup(false, false, true, true);
    42674456
    42684457    VerticalConfigurationGroup *column1 =
    42694458        new VerticalConfigurationGroup(false, false, true, true);
    4270     column1->addChild(RealtimePriority());
    4271     column1->addChild(DecodeExtraAudio());
    4272     column1->addChild(JumpToProgramOSD());
     4459    if (!settings)
     4460        column1->addChild(RealtimePriority(settings));
     4461    column1->addChild(DecodeExtraAudio(settings));
     4462    column1->addChild(JumpToProgramOSD(settings));
    42734463    columns->addChild(column1);
    42744464
    42754465    VerticalConfigurationGroup *column2 =
    42764466        new VerticalConfigurationGroup(false, false, true, true);
    4277     column2->addChild(ClearSavedPosition());
    4278     column2->addChild(AltClearSavedPosition());
    4279     column2->addChild(AutomaticSetWatched());
    4280     column2->addChild(ContinueEmbeddedTVPlay());
     4467    column2->addChild(ClearSavedPosition(settings));
     4468    column2->addChild(AltClearSavedPosition(settings));
     4469    column2->addChild(AutomaticSetWatched(settings));
     4470    column2->addChild(ContinueEmbeddedTVPlay(settings));
    42814471    columns->addChild(column2);
    42824472
    42834473    general1->addChild(columns);
    4284     general1->addChild(LiveTVIdleTimeout());
    4285     general1->addChild(AlwaysStreamFiles());
     4474    if (!settings)
     4475        general1->addChild(LiveTVIdleTimeout());
     4476    if (!settings)
     4477        general1->addChild(AlwaysStreamFiles());
    42864478#ifdef USING_OPENGL_VSYNC
    4287     general1->addChild(UseOpenGLVSync());
     4479    general1->addChild(UseOpenGLVSync(settings));
    42884480#endif // USING_OPENGL_VSYNC
    42894481#if defined(USING_XV) || defined(USING_OPENGL_VIDEO) || defined(USING_VDPAU)
    4290     general1->addChild(UsePicControls());
     4482    general1->addChild(UsePicControls(settings));
    42914483#endif // USING_XV
    4292     addChild(general1);
     4484    if (base)
     4485        base->addChild(general1);
     4486    else
     4487        addChild(general1);
    42934488
    42944489    VerticalConfigurationGroup* general2 =
    42954490        new VerticalConfigurationGroup(false);
    42964491    general2->setLabel(QObject::tr("General Playback") +
    42974492                      QString(" (%1/%2)").arg(++i).arg(total));
     4493    if (settings)
     4494        general2->setLabel(QObject::tr("Playback group settings for ") +
     4495                           settings->mGroupName + " - " +
     4496                           general2->getLabel());
    42984497
    42994498    HorizontalConfigurationGroup* oscan =
    43004499        new HorizontalConfigurationGroup(false, false, true, true);
     
    43024501        new VerticalConfigurationGroup(false, false, true, true);
    43034502    VerticalConfigurationGroup *ocol2 =
    43044503        new VerticalConfigurationGroup(false, false, true, true);
    4305     ocol1->addChild(VertScanPercentage());
    4306     ocol1->addChild(YScanDisplacement());
    4307     ocol2->addChild(HorizScanPercentage());
    4308     ocol2->addChild(XScanDisplacement());
     4504    ocol1->addChild(VertScanPercentage(settings));
     4505    ocol1->addChild(YScanDisplacement(settings));
     4506    ocol2->addChild(HorizScanPercentage(settings));
     4507    ocol2->addChild(XScanDisplacement(settings));
    43094508    oscan->addChild(ocol1);
    43104509    oscan->addChild(ocol2);
    43114510
    43124511    HorizontalConfigurationGroup* aspect_fill =
    43134512        new HorizontalConfigurationGroup(false, false, true, true);
    4314     aspect_fill->addChild(AspectOverride());
    4315     aspect_fill->addChild(AdjustFill());
     4513    aspect_fill->addChild(AspectOverride(settings));
     4514    aspect_fill->addChild(AdjustFill(settings));
    43164515
    43174516    general2->addChild(oscan);
    43184517    general2->addChild(aspect_fill);
    4319     general2->addChild(LetterboxingColour());
    4320     general2->addChild(PIPLocationComboBox());
    4321     general2->addChild(PlaybackExitPrompt());
    4322     general2->addChild(EndOfRecordingExitPrompt());
    4323     addChild(general2);
     4518    general2->addChild(LetterboxingColour(settings));
     4519    general2->addChild(PIPLocationComboBox(settings));
     4520    general2->addChild(PlaybackExitPrompt(settings));
     4521    general2->addChild(EndOfRecordingExitPrompt(settings));
     4522    if (base)
     4523        base->addChild(general2);
     4524    else
     4525        addChild(general2);
    43244526
    43254527    QString tmp = QString(" (%1/%2)").arg(++i).arg(total);
    4326     addChild(new PlaybackProfileConfigs(tmp));
     4528    if (base)
     4529        base->addChild(new PlaybackProfileConfigs(tmp, settings));
     4530    else
     4531        addChild(new PlaybackProfileConfigs(tmp, settings));
    43274532
     4533    if (!settings)
     4534    {
    43284535    VerticalConfigurationGroup* pbox = new VerticalConfigurationGroup(false);
    43294536    pbox->setLabel(QObject::tr("View Recordings") +
    43304537                   QString(" (%1/%2)").arg(++i).arg(total));
     
    43534560    pbox3->addChild(DisplayGroupTitleSort());
    43544561    pbox3->addChild(new WatchListSettings());
    43554562    addChild(pbox3);
     4563    }
    43564564
    43574565    VerticalConfigurationGroup* seek = new VerticalConfigurationGroup(false);
    43584566    seek->setLabel(QObject::tr("Seeking") +
    43594567                   QString(" (%1/%2)").arg(++i).arg(total));
    4360     seek->addChild(SmartForward());
    4361     seek->addChild(FFRewReposTime());
    4362     seek->addChild(FFRewReverse());
    4363     seek->addChild(ExactSeeking());
    4364     addChild(seek);
     4568    if (settings)
     4569        seek->setLabel(QObject::tr("Playback group settings for ") +
     4570                       settings->mGroupName + " - " +
     4571                       seek->getLabel());
     4572    seek->addChild(SmartForward(settings));
     4573    seek->addChild(FFRewReposTime(settings));
     4574    seek->addChild(FFRewReverse(settings));
     4575    seek->addChild(ExactSeeking(settings));
     4576    if (base)
     4577        base->addChild(seek);
     4578    else
     4579        addChild(seek);
    43654580
    43664581    VerticalConfigurationGroup* comms = new VerticalConfigurationGroup(false);
    43674582    comms->setLabel(QObject::tr("Commercial Skip") +
    43684583                    QString(" (%1/%2)").arg(++i).arg(total));
    4369     comms->addChild(AutoCommercialSkip());
    4370     comms->addChild(CommRewindAmount());
    4371     comms->addChild(CommNotifyAmount());
     4584    if (settings)
     4585        comms->setLabel(QObject::tr("Playback group settings for ") +
     4586                        settings->mGroupName + " - " +
     4587                        comms->getLabel());
     4588    comms->addChild(AutoCommercialSkip(settings));
     4589    comms->addChild(CommRewindAmount(settings));
     4590    comms->addChild(CommNotifyAmount(settings));
     4591    if (!settings) // these are global settings, not host-specific
     4592    {
    43724593    comms->addChild(MaximumCommercialSkip());
    43734594    comms->addChild(MergeShortCommBreaks());
    43744595    comms->addChild(CommSkipAllBlanks());
    4375     addChild(comms);
     4596    }
     4597    if (base)
     4598        base->addChild(comms);
     4599    else
     4600        addChild(comms);
    43764601
    43774602#if CONFIG_DARWIN
    43784603    VerticalConfigurationGroup* mac1 = new VerticalConfigurationGroup(false);
    43794604    mac1->setLabel(QObject::tr("Mac OS X video settings") +
    43804605                   QString(" (%1/%2)").arg(++i).arg(total));
     4606    if (settings)
     4607        mac1->setLabel(QObject::tr("Playback group settings for ") +
     4608                       settings->mGroupName + " - " +
     4609                       mac1->getLabel());
     4610    if (!settings)
     4611    {
    43814612    mac1->addChild(MacGammaCorrect());
    43824613    mac1->addChild(MacScaleUp());
    43834614    mac1->addChild(MacFullSkip());
    4384     addChild(mac1);
     4615    }
     4616    if (base)
     4617        base->addChild(mac1);
     4618    else
     4619        addChild(mac1);
    43854620
    43864621    VerticalConfigurationGroup* mac2 = new VerticalConfigurationGroup(false);
    43874622    mac2->setLabel(QObject::tr("Mac OS X video settings") +
    43884623                   QString(" (%1/%2)").arg(++i).arg(total));
     4624    if (settings)
     4625        mac2->setLabel(QObject::tr("Playback group settings for ") +
     4626                       settings->mGroupName + " - " +
     4627                       mac2->getLabel());
     4628    if (!setings)
     4629    {
    43894630    mac2->addChild(new MacMainSettings());
    43904631    mac2->addChild(new MacFloatSettings());
    43914632
     
    43944635    row->addChild(new MacDockSettings());
    43954636    row->addChild(new MacDesktopSettings());
    43964637    mac2->addChild(row);
     4638    }
    43974639
    4398     addChild(mac2);
     4640    if (base)
     4641        base->addChild(mac2);
     4642    else
     4643        addChild(mac2);
    43994644#endif
    44004645}
    44014646
    4402 OSDSettings::OSDSettings()
     4647OSDSettings::OSDSettings(PlaySettings *settings,
     4648                         ConfigurationWizard *base)
    44034649{
    44044650    VerticalConfigurationGroup* osd = new VerticalConfigurationGroup(false);
    44054651    osd->setLabel(QObject::tr("On-screen display"));
     4652    if (settings)
     4653        osd->setLabel(QObject::tr("Playback group settings for ") +
     4654                      settings->mGroupName + " - " +
     4655                      osd->getLabel());
    44064656
    4407     osd->addChild(new ThemeSelector("OSDTheme"));
    4408     osd->addChild(OSDGeneralTimeout());
    4409     osd->addChild(OSDProgramInfoTimeout());
    4410     osd->addChild(OSDFont());
    4411     osd->addChild(OSDThemeFontSizeType());
    4412     osd->addChild(EnableMHEG());
    4413     osd->addChild(PersistentBrowseMode());
    4414     osd->addChild(BrowseAllTuners());
    4415     addChild(osd);
     4657    osd->addChild(ThemeSelector("OSDTheme", settings));
     4658    osd->addChild(OSDGeneralTimeout(settings));
     4659    osd->addChild(OSDProgramInfoTimeout(settings));
     4660    osd->addChild(OSDFont(settings));
     4661    osd->addChild(OSDThemeFontSizeType(settings));
     4662    osd->addChild(EnableMHEG(settings));
     4663    if (!settings)
     4664    {
     4665    osd->addChild(PersistentBrowseMode(settings));
     4666    osd->addChild(BrowseAllTuners(settings));
     4667    }
     4668    if (base)
     4669        base->addChild(osd);
     4670    else
     4671        addChild(osd);
    44164672
    44174673    VerticalConfigurationGroup *udp = new VerticalConfigurationGroup(false);
    44184674    udp->setLabel(QObject::tr("UDP OSD Notifications"));
    4419     udp->addChild(OSDNotifyTimeout());
    4420     udp->addChild(UDPNotifyPort());
    4421     addChild(udp);
     4675    if (settings)
     4676        udp->setLabel(QObject::tr("Playback group settings for ") +
     4677                      settings->mGroupName + " - " +
     4678                      udp->getLabel());
     4679    udp->addChild(OSDNotifyTimeout(settings));
     4680    udp->addChild(UDPNotifyPort(settings));
     4681    if (base)
     4682        base->addChild(udp);
     4683    else
     4684        addChild(udp);
    44224685
    44234686    VerticalConfigurationGroup *cc = new VerticalConfigurationGroup(false);
    44244687    cc->setLabel(QObject::tr("Analog Closed Captions"));
    4425     cc->addChild(OSDCCFont());
     4688    if (settings)
     4689        cc->setLabel(QObject::tr("Playback group settings for ") +
     4690                     settings->mGroupName + " - " +
     4691                     cc->getLabel());
     4692    cc->addChild(OSDCCFont(settings));
    44264693    //cc->addChild(DecodeVBIFormat());
    4427     cc->addChild(CCBackground());
    4428     cc->addChild(DefaultCCMode());
    4429     cc->addChild(PreferCC708());
    4430     addChild(cc);
     4694    cc->addChild(CCBackground(settings));
     4695    cc->addChild(DefaultCCMode(settings));
     4696    cc->addChild(PreferCC708(settings));
     4697    if (base)
     4698        base->addChild(cc);
     4699    else
     4700        addChild(cc);
    44314701
    4432     addChild(OSDCC708Settings());
    4433     addChild(OSDCC708Fonts());
    4434     addChild(ExternalSubtitleSettings());
     4702    if (base)
     4703    {
     4704        base->addChild(OSDCC708Settings(settings));
     4705        base->addChild(OSDCC708Fonts(settings));
     4706        base->addChild(ExternalSubtitleSettings(settings));
     4707    }
     4708    else
     4709    {
     4710        addChild(OSDCC708Settings(settings));
     4711        addChild(OSDCC708Fonts(settings));
     4712        addChild(ExternalSubtitleSettings(settings));
     4713    }
    44354714
    44364715#if CONFIG_DARWIN
    44374716    // Any Mac OS-specific OSD stuff would go here.
     
    45834862    VerticalConfigurationGroup* theme = new VerticalConfigurationGroup(false);
    45844863    theme->setLabel(QObject::tr("Theme"));
    45854864
    4586     theme->addChild(new ThemeSelector("Theme"));
     4865    theme->addChild(ThemeSelector("Theme"));
    45874866
    45884867    theme->addChild(ThemeCacheSize());
    45894868
  • 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"
     
    485486        delete statusbox;
    486487}
    487488
     489ConfigurationWizard *createPlaybackSettingsForPlaybackGroup(PlaySettings *settings, ConfigurationWizard *base)
     490{
     491    return new PlaybackSettings(settings, base);
     492}
     493
     494ConfigurationWizard *createOSDSettingsForPlaybackGroup(PlaySettings *settings, ConfigurationWizard *base)
     495{
     496    return new OSDSettings(settings, base);
     497}
     498
     499ConfigurationWizard *createMainGeneralSettingsForPlaybackGroup(PlaySettings *settings, ConfigurationWizard *base)
     500{
     501    return new MainGeneralSettings(settings, base);
     502}
     503
     504static PlayGroupEditor::SettingsLookup pbgroupSetup[] = {
     505    createPlaybackSettingsForPlaybackGroup,
     506    createOSDSettingsForPlaybackGroup,
     507    createMainGeneralSettingsForPlaybackGroup
     508};
     509
    488510void TVMenuCallback(void *data, QString &selection)
    489511{
    490512    (void)data;
     
    577599    }
    578600    else if (sel == "settings playgroup")
    579601    {
    580         PlayGroupEditor editor;
     602        PlayGroupEditor editor(pbgroupSetup,
     603                               sizeof(pbgroupSetup)/sizeof(*pbgroupSetup));
    581604        editor.exec();
    582605    }
    583606    else if (sel == "settings general")
     
    749772                                              Qt::ISODate));
    750773    pginfo->lenMins = lenMins;
    751774    pginfo->isVideo = true;
     775    pginfo->playgroup = "Videos";
    752776    pginfo->pathname = mrl;
    753777
    754778    QDir d(mrl + "/VIDEO_TS");
  • programs/mythfrontend/globalsettings.h

     
    1010#include "themeinfo.h"
    1111
    1212class QFileInfo;
     13class PlaySettings;
    1314
    14 class ThemeSelector : public HostImageSelect
    15 {
    16   public:
    17     ThemeSelector(QString label);
    18 
    19   private:
    20     bool parseThemeInfo(QFileInfo *theme, QString &name, QFileInfo &preview);
    21 };
    22 
    2315class PlaybackSettings : public ConfigurationWizard
    2416{
    2517  public:
    26     PlaybackSettings();
     18    PlaybackSettings(PlaySettings *settings=NULL,
     19                     ConfigurationWizard *base=NULL);
    2720};
    2821
    2922class OSDSettings: virtual public ConfigurationWizard
    3023{
    3124  public:
    32     OSDSettings();
     25    OSDSettings(PlaySettings *settings=NULL,
     26                ConfigurationWizard *base=NULL);
    3327};
    3428
    3529class GeneralSettings : public ConfigurationWizard
     
    5347class MainGeneralSettings : public ConfigurationWizard
    5448{
    5549  public:
    56     MainGeneralSettings();
     50    MainGeneralSettings(PlaySettings *settings=NULL,
     51                        ConfigurationWizard *base=NULL);
    5752};
    5853
    5954class GeneralRecPrioritiesSettings : public ConfigurationWizard
     
    140135    Q_OBJECT
    141136
    142137  public:
    143     PlaybackProfileConfigs(const QString &str);
     138    PlaybackProfileConfigs(const QString &str, PlaySettings *settings);
    144139    virtual ~PlaybackProfileConfigs();
    145140
    146141  private:
     
    152147
    153148  private:
    154149    QStringList   profiles;
    155     HostComboBox *grouptrigger;
     150    ComboBoxSetting *grouptrigger;
    156151};
    157152
    158153#endif
  • programs/mythtranscode/transcode.cpp

     
    3636class AudioReencodeBuffer : public AudioOutput
    3737{
    3838 public:
    39     AudioReencodeBuffer(int audio_bits, int audio_channels)
     39    AudioReencodeBuffer(int audio_bits, int audio_channels,
     40                        PlaySettings *psettings)
     41        : AudioOutput(psettings)
    4042    {
    4143        Reset();
    42         const AudioSettings settings(audio_bits, audio_channels, 0, 0, false);
     44        const AudioSettings settings(audio_bits, audio_channels, 0, 0, false,
     45                                     psettings);
    4346        Reconfigure(settings);
    4447        bufsize = 512000;
    4548        audiobuffer = new unsigned char[bufsize];
     
    419422        statustime = statustime.addSecs(5);
    420423    }
    421424
    422     AudioOutput *audioOutput = new AudioReencodeBuffer(0, 0);
     425    AudioOutput *audioOutput =
     426        new AudioReencodeBuffer(0, 0, player_ctx->settings);
    423427    AudioReencodeBuffer *arb = ((AudioReencodeBuffer*)audioOutput);
    424428    nvp->SetAudioOutput(audioOutput);
    425429    nvp->SetTranscoding(true);
  • programs/mythavtest/main.cpp

     
    2222#include "dbcheck.h"
    2323#include "myththemebase.h"
    2424#include "audiopulseutil.h"
     25#include "playsettings.h"
    2526
    2627
    2728static void *run_priv_thread(void *data)
     
    189190    if (pa_ret != GENERIC_EXIT_OK)
    190191        return pa_ret;
    191192
    192 #if defined(Q_OS_MACX)
    193     // Mac OS X doesn't define the AudioOutputDevice setting
    194 #else
    195     QString auddevice = gContext->GetSetting("AudioOutputDevice");
    196     if (auddevice.isEmpty())
    197     {
    198         VERBOSE(VB_IMPORTANT, "Fatal Error: Audio not configured, you need "
    199                 "to run 'mythfrontend', not 'mythtv'.");
    200         return TV_EXIT_NO_AUDIO;
    201     }
    202 #endif
    203 
    204193    MythMainWindow *mainWindow = GetMythMainWindow();
    205194    mainWindow->Init();
    206195    gContext->SetMainWindow(mainWindow);
     
    215204        return GENERIC_EXIT_DB_OUTOFDATE;
    216205    }
    217206
    218     TV *tv = new TV();
    219     if (!tv->Init())
    220     {
    221         VERBOSE(VB_IMPORTANT, "Fatal Error: Could not initialize TV class.");
    222         return TV_EXIT_NO_TV;
    223     }
    224 
    225207    ProgramInfo *pginfo = NULL;
    226208
    227209    if (!filename.isEmpty() &&
     
    240222
    241223    }
    242224
     225    PlaySettings settings(pginfo->playgroup);
     226
     227#if defined(Q_OS_MACX)
     228    // Mac OS X doesn't define the AudioOutputDevice setting
     229#else
     230    QString auddevice = settings.GetSetting("AudioOutputDevice", "");
     231    if (auddevice.isEmpty())
     232    {
     233        VERBOSE(VB_IMPORTANT, "Fatal Error: Audio not configured, you need "
     234                "to run 'mythfrontend', not 'mythtv'.");
     235        return TV_EXIT_NO_AUDIO;
     236    }
     237#endif
     238
     239    TV *tv = new TV(&settings);
     240    if (!tv->Init())
     241    {
     242        VERBOSE(VB_IMPORTANT, "Fatal Error: Could not initialize TV class.");
     243        return TV_EXIT_NO_TV;
     244    }
     245
    243246    TV::StartTV(pginfo, false);
    244247
    245248    if (pginfo)