diff --git a/mythtv/programs/mythfrontend/main.cpp b/mythtv/programs/mythfrontend/main.cpp index 88c75519958..bb94410a201 100644 --- a/mythtv/programs/mythfrontend/main.cpp +++ b/mythtv/programs/mythfrontend/main.cpp @@ -28,6 +28,7 @@ using namespace std; #include "manualschedule.h" #include "playbackbox.h" #include "themechooser.h" +#include "setupwizard_general.h" #include "customedit.h" #include "viewscheduled.h" #include "programrecpriority.h" @@ -580,6 +581,16 @@ static void TVMenuCallback(void *data, QString &selection) else delete tp; } + else if (sel == "settings setupwizard") + { + MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); + GeneralSetupWizard *sw = new GeneralSetupWizard(mainStack, "setupwizard"); + + if (sw->Create()) + mainStack->AddScreen(sw); + else + delete sw; + } else if (sel == "screensetupwizard") { startAppearWiz(); diff --git a/mythtv/programs/mythfrontend/mythfrontend.pro b/mythtv/programs/mythfrontend/mythfrontend.pro index dca3c035582..018ae43c290 100644 --- a/mythtv/programs/mythfrontend/mythfrontend.pro +++ b/mythtv/programs/mythfrontend/mythfrontend.pro @@ -31,7 +31,8 @@ HEADERS += schedulecommon.h progdetails.h scheduleeditor.h HEADERS += backendconnectionmanager.h programinfocache.h HEADERS += proglist.h proglist_helpers.h HEADERS += playbackboxhelper.h viewschedulediff.h -HEADERS += themechooser.h +HEADERS += themechooser.h setupwizard_general.h +HEADERS += setupwizard_audio.h setupwizard_video.h SOURCES += main.cpp playbackbox.cpp viewscheduled.cpp audiogeneralsettings.cpp SOURCES += globalsettings.cpp manualschedule.cpp programrecpriority.cpp @@ -44,7 +45,8 @@ SOURCES += customedit.cpp schedulecommon.cpp progdetails.cpp scheduleeditor.cpp SOURCES += backendconnectionmanager.cpp programinfocache.cpp SOURCES += proglist.cpp proglist_helpers.cpp SOURCES += playbackboxhelper.cpp viewschedulediff.cpp -SOURCES += themechooser.cpp +SOURCES += themechooser.cpp setupwizard_general.cpp +SOURCES += setupwizard_audio.cpp setupwizard_video.cpp macx { mac_bundle { diff --git a/mythtv/programs/mythfrontend/setupwizard_audio.cpp b/mythtv/programs/mythfrontend/setupwizard_audio.cpp new file mode 100644 index 00000000000..d92d413501d --- /dev/null +++ b/mythtv/programs/mythfrontend/setupwizard_audio.cpp @@ -0,0 +1,270 @@ +// qt +#include +#include + +// myth +#include +#include +#include +#include + +#include + +#include "audiogeneralsettings.h" +#include "setupwizard_general.h" +#include "setupwizard_audio.h" +#include "setupwizard_video.h" + +AudioSetupWizard::AudioSetupWizard(MythScreenStack *parent, MythScreenType *previous, + const char *name) + : MythScreenType(parent, name), + m_outputlist(NULL), m_testThread(NULL), + m_generalScreen(previous), m_audioDeviceButtonList(NULL), + m_speakerNumberButtonList(NULL), m_dtsCheck(NULL), + m_ac3Check(NULL), m_hdCheck(NULL), + m_hdplusCheck(NULL), m_testSpeakerButton(NULL), + m_nextButton(NULL), m_prevButton(NULL) +{ + m_generalScreen->Hide(); +} + +bool AudioSetupWizard::Create() +{ + bool foundtheme = false; + + // Load the theme for this screen + foundtheme = LoadWindowFromXML("config-ui.xml", "audiowizard", this); + + if (!foundtheme) + return false; + + m_audioDeviceButtonList = dynamic_cast (GetChild("audiodevices")); + m_speakerNumberButtonList = dynamic_cast (GetChild("speakers")); + + m_dtsCheck = dynamic_cast (GetChild("dtscheck")); + m_ac3Check = dynamic_cast (GetChild("ac3check")); + m_hdCheck = dynamic_cast (GetChild("hdcheck")); + m_hdplusCheck = dynamic_cast (GetChild("hdpluscheck")); + + m_testSpeakerButton = dynamic_cast (GetChild("testspeakers")); + + m_nextButton = dynamic_cast (GetChild("next")); + m_prevButton = dynamic_cast (GetChild("previous")); + + if (!m_audioDeviceButtonList || !m_speakerNumberButtonList || + !m_dtsCheck || !m_ac3Check || + !m_hdCheck || !m_hdplusCheck || + !m_testSpeakerButton ||!m_nextButton || !m_prevButton) + { + VERBOSE(VB_IMPORTANT, "Theme is missing critical theme elements."); + return false; + } + + // Pre-set the widgets to their database values + // Buttonlists are set in load() + + int dtsSetting = gCoreContext->GetNumSetting("DTSPassThru", 0); + if (dtsSetting == 1) + m_dtsCheck->SetCheckState(MythUIStateType::Full); + + int ac3Setting = gCoreContext->GetNumSetting("AC3PassThru", 0); + if (ac3Setting == 1) + m_ac3Check->SetCheckState(MythUIStateType::Full); + + int hdSetting = gCoreContext->GetNumSetting("EAC3PassThru", 0); + if (hdSetting == 1) + m_hdCheck->SetCheckState(MythUIStateType::Full); + + int hdplusSetting = gCoreContext->GetNumSetting("TrueHDPassThru", 0); + if (hdplusSetting == 1) + m_hdplusCheck->SetCheckState(MythUIStateType::Full); + + // Help Text + + // Buttonlists + m_audioDeviceButtonList->SetHelpText( tr("Select from one of the " + "audio devices detected on your system. When " + "satisfied, you can test audio before moving " + "on. If you fail to configure audio, video " + "playback may fail as well.") ); + m_speakerNumberButtonList->SetHelpText( tr("Select the number of speakers you " + "have.") ); + + // Checkboxes + m_dtsCheck->SetHelpText( tr("Select this checkbox if your receiver " + "is capable of playing DTS.") ); + m_ac3Check->SetHelpText( tr("Select this checkbox if your receiver " + "is capable of playing AC-3 (Dolby Digital).") ); + m_hdCheck->SetHelpText( tr("Select this checkbox if your receiver " + "is capable of playing E-AC-3 (Dolby Digital Plus) " + "or DTS-HD.") ); + m_hdplusCheck->SetHelpText( tr("Select this checkbox if your receiver " + "is capable of playing TrueHD or DTS-HD MA.") ); + + // Buttons + m_testSpeakerButton->SetHelpText( tr("Test your audio settings by playing " + "noise through each speaker.") ); + m_nextButton->SetHelpText( tr("Save these changes and move on to the next " + "configuration step.") ); + m_prevButton->SetHelpText( tr("Return to the previous configuration step.") ); + + // I hate to SetText but it's the only way to make it reliably bi-modal + m_testSpeakerButton->SetText(tr("Test Speakers")); + + connect(m_testSpeakerButton, SIGNAL(Clicked()), this, SLOT(toggleSpeakers())); + connect(m_nextButton, SIGNAL(Clicked()), this, SLOT(slotNext())); + connect(m_prevButton, SIGNAL(Clicked()), this, SLOT(slotPrevious())); + + QString message = tr("Discovering audio devices..."); + LoadInBackground(message); + + BuildFocusList(); + + return true; +} + +AudioSetupWizard::~AudioSetupWizard() +{ + if (m_generalScreen) + m_generalScreen->Show(); + + if (m_testThread) + { + m_testThread->cancel(); + m_testThread->wait(); + delete m_testThread; + m_testThread = NULL; + } +} + +void AudioSetupWizard::Load(void) +{ + m_outputlist = AudioOutput::GetOutputList(); +} + +void AudioSetupWizard::Init(void) +{ + for (QVector::const_iterator it = m_outputlist->begin(); + it != m_outputlist->end(); it++) + { + QString name = it->name; + MythUIButtonListItem *output = + new MythUIButtonListItem(m_audioDeviceButtonList, name); + output->SetData(name); + } + + MythUIButtonListItem *stereo = + new MythUIButtonListItem(m_speakerNumberButtonList, "Stereo"); + stereo->SetData(2); + + MythUIButtonListItem *sixchan = + new MythUIButtonListItem(m_speakerNumberButtonList, "5.1 Channel Audio"); + sixchan->SetData(6); + + MythUIButtonListItem *eightchan = + new MythUIButtonListItem(m_speakerNumberButtonList, "7.1 Channel Audio"); + eightchan->SetData(8); + + // If there is a DB value for device and channels, set the buttons accordingly. + + QString currentDevice = gCoreContext->GetSetting("AudioOutputDevice"); + int channels = gCoreContext->GetNumSetting("MaxChannels", 2); + + if (!currentDevice.isEmpty()) + m_audioDeviceButtonList->SetValueByData(qVariantFromValue(currentDevice)); + m_speakerNumberButtonList->SetValueByData(qVariantFromValue(channels)); +} + +void AudioSetupWizard::slotNext(void) +{ + if (m_testThread) + { + m_testThread->cancel(); + m_testThread->wait(); + } + + save(); + + MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); + VideoSetupWizard *sw = new VideoSetupWizard(mainStack, m_generalScreen, + this, "videosetupwizard"); + + if (sw->Create()) + { + mainStack->AddScreen(sw); + } + else + delete sw; +} + +void AudioSetupWizard::save(void) +{ + int channels = qVariantValue + (m_speakerNumberButtonList->GetItemCurrent()->GetData()); + gCoreContext->SaveSetting("MaxChannels", channels); + + QString device = + m_audioDeviceButtonList->GetItemCurrent()->GetText(); + gCoreContext->SaveSetting("AudioOutputDevice", device); + + int ac3State = 0; + if (m_ac3Check->GetCheckState() == MythUIStateType::Full) + ac3State = 1; + gCoreContext->SaveSetting("AC3PassThru", ac3State); + + int dtsState = 0; + if (m_dtsCheck->GetCheckState() == MythUIStateType::Full) + dtsState = 1; + gCoreContext->SaveSetting("DTSPassThru", dtsState); + + int hdState = 0; + if (m_hdCheck->GetCheckState() == MythUIStateType::Full) + hdState = 1; + gCoreContext->SaveSetting("EAC3PassThru", hdState); + + int hdplusState = 0; + if (m_hdplusCheck->GetCheckState() == MythUIStateType::Full) + hdplusState = 1; + gCoreContext->SaveSetting("TrueHDPassThru", hdplusState); +} + +void AudioSetupWizard::slotPrevious(void) +{ + m_generalScreen->Show(); + Close(); +} + +bool AudioSetupWizard::keyPressEvent(QKeyEvent *event) +{ + if (GetFocusWidget()->keyPressEvent(event)) + return true; + + bool handled = false; + + if (!handled && MythScreenType::keyPressEvent(event)) + handled = true; + + return handled; +} + +void AudioSetupWizard::toggleSpeakers(void) +{ + if (m_testThread) + { + m_testThread->cancel(); + m_testThread->wait(); + delete m_testThread; + m_testThread = NULL; + m_testSpeakerButton->SetText(tr("Test Speakers")); + } + else + { + QString device = m_audioDeviceButtonList->GetItemCurrent()->GetText(); + int channels = qVariantValue (m_speakerNumberButtonList->GetItemCurrent()->GetData()); + AudioOutputSettings settings; + m_testThread = new AudioTestThread(this, device, device, channels, settings, false); + m_testThread->start(); + m_testSpeakerButton->SetText(tr("Stop Speaker Test")); + } +} + diff --git a/mythtv/programs/mythfrontend/setupwizard_audio.h b/mythtv/programs/mythfrontend/setupwizard_audio.h new file mode 100644 index 00000000000..6d4bdc6d043 --- /dev/null +++ b/mythtv/programs/mythfrontend/setupwizard_audio.h @@ -0,0 +1,61 @@ +#ifndef AUDIOSETUPWIZARD_H +#define AUDIOSETUPWIZARD_H + +#include +#include +#include + +// libmythui +#include +#include +#include +#include +#include + +class AudioTestThread; + +class AudioSetupWizard : public MythScreenType +{ + Q_OBJECT + + public: + + AudioSetupWizard(MythScreenStack *parent, MythScreenType *generalScreen, + const char *name = 0); + ~AudioSetupWizard(); + + bool Create(void); + bool keyPressEvent(QKeyEvent *); + + void save(void); + + private: + virtual void Load(void); + virtual void Init(void); + + QVector *m_outputlist; + AudioTestThread *m_testThread; + + MythScreenType *m_generalScreen; + + MythUIButtonList *m_audioDeviceButtonList; + MythUIButtonList *m_speakerNumberButtonList; + + MythUICheckBox *m_dtsCheck; + MythUICheckBox *m_ac3Check; + MythUICheckBox *m_hdCheck; + MythUICheckBox *m_hdplusCheck; + + MythUIButton *m_testSpeakerButton; + + MythUIButton *m_nextButton; + MythUIButton *m_prevButton; + + private slots: + void slotNext(void); + void slotPrevious(void); + + void toggleSpeakers(void); +}; + +#endif diff --git a/mythtv/programs/mythfrontend/setupwizard_general.cpp b/mythtv/programs/mythfrontend/setupwizard_general.cpp new file mode 100644 index 00000000000..8e4401817cd --- /dev/null +++ b/mythtv/programs/mythfrontend/setupwizard_general.cpp @@ -0,0 +1,184 @@ +// qt +#include +#include + +// myth +#include +#include +#include + +#include "audiogeneralsettings.h" +#include "setupwizard_general.h" +#include "setupwizard_audio.h" + +// --------------------------------------------------- + +GeneralSetupWizard::GeneralSetupWizard(MythScreenStack *parent, const char *name) + : MythScreenType(parent, name), + m_ldateButtonList(NULL), m_sdateButtonList(NULL), + m_timeButtonList(NULL), m_nextButton(NULL), + m_cancelButton(NULL) +{ +} + +bool GeneralSetupWizard::Create() +{ + bool foundtheme = false; + + // Load the theme for this screen + foundtheme = LoadWindowFromXML("config-ui.xml", "generalwizard", this); + + if (!foundtheme) + return false; + + m_ldateButtonList = dynamic_cast (GetChild("longdate")); + m_sdateButtonList = dynamic_cast (GetChild("shortdate")); + m_timeButtonList = dynamic_cast (GetChild("timeformat")); + + m_nextButton = dynamic_cast (GetChild("next")); + m_cancelButton = dynamic_cast (GetChild("cancel")); + + if (!m_ldateButtonList || !m_sdateButtonList || !m_timeButtonList || + !m_nextButton || !m_cancelButton) + { + VERBOSE(VB_IMPORTANT, "Theme is missing critical theme elements."); + return false; + } + + m_ldateButtonList->SetHelpText( tr("Choose the date format to use when the full " + "date is displayed.") ); + m_sdateButtonList->SetHelpText( tr("Choose the date format to use when a short " + "date format is displayed.") ); + m_timeButtonList->SetHelpText( tr("Choose your preferred time format.") ); + + m_nextButton->SetHelpText( tr("Save these changes and move on to the " + "next configuration step.") ); + m_cancelButton->SetHelpText( tr("Exit this wizard, save no changes.") ); + + connect(m_nextButton, SIGNAL(Clicked()), this, SLOT(slotNext())); + connect(m_cancelButton, SIGNAL(Clicked()), this, SLOT(Close())); + + BuildFocusList(); + loadData(); + + return true; +} + +GeneralSetupWizard::~GeneralSetupWizard() +{ +} + +void GeneralSetupWizard::loadData() +{ + QDate sampdate = QDate::currentDate(); + QStringList ldateformats; + + ldateformats.append(sampdate.toString("ddd MMM d")); + ldateformats.append(sampdate.toString("ddd d MMM")); + ldateformats.append(sampdate.toString("ddd MMMM d")); + ldateformats.append(sampdate.toString("ddd d MMMM")); + ldateformats.append(sampdate.toString("dddd MMM d")); + ldateformats.append(sampdate.toString("dddd d MMM")); + ldateformats.append(sampdate.toString("MMM d")); + ldateformats.append(sampdate.toString("d MMM")); + ldateformats.append(sampdate.toString("MM/dd")); + ldateformats.append(sampdate.toString("dd/MM")); + ldateformats.append(sampdate.toString("MM.dd")); + ldateformats.append(sampdate.toString("dd.MM")); + ldateformats.append(sampdate.toString("M/d/yyyy")); + ldateformats.append(sampdate.toString("d/M/yyyy")); + ldateformats.append(sampdate.toString("MM.dd.yyyy")); + ldateformats.append(sampdate.toString("dd.MM.yyyy")); + ldateformats.append(sampdate.toString("yyyy-MM-dd")); + ldateformats.append(sampdate.toString("ddd MMM d yyyy")); + ldateformats.append(sampdate.toString("ddd d MMM yyyy")); + ldateformats.append(sampdate.toString("ddd yyyy-MM-dd")); + + for (QStringList::const_iterator i = ldateformats.begin(); + i != ldateformats.end(); i++) + { + MythUIButtonListItem *item = + new MythUIButtonListItem(m_ldateButtonList, *i); + item->SetData(*i); + } + + QStringList sdateformats; + + sdateformats.append(sampdate.toString("M/d")); + sdateformats.append(sampdate.toString("d/M")); + sdateformats.append(sampdate.toString("MM/dd")); + sdateformats.append(sampdate.toString("dd/MM")); + sdateformats.append(sampdate.toString("MM.dd")); + sdateformats.append(sampdate.toString("dd.MM.")); + sdateformats.append(sampdate.toString("M.d.")); + sdateformats.append(sampdate.toString("d.M.")); + sdateformats.append(sampdate.toString("MM-dd")); + sdateformats.append(sampdate.toString("dd-MM")); + sdateformats.append(sampdate.toString("MMM d")); + sdateformats.append(sampdate.toString("d MMM")); + sdateformats.append(sampdate.toString("ddd d")); + sdateformats.append(sampdate.toString("d ddd")); + sdateformats.append(sampdate.toString("ddd M/d")); + sdateformats.append(sampdate.toString("ddd d/M")); + sdateformats.append(sampdate.toString("M/d ddd")); + sdateformats.append(sampdate.toString("d/M ddd")); + + for (QStringList::const_iterator i = sdateformats.begin(); + i != sdateformats.end(); i++) + { + MythUIButtonListItem *item = + new MythUIButtonListItem(m_sdateButtonList, *i); + item->SetData(*i); + } + + QStringList timeformats; + QTime samptime = QTime::currentTime(); + + timeformats.append(samptime.toString("h:mm AP")); + timeformats.append(samptime.toString("h:mm ap")); + timeformats.append(samptime.toString("hh:mm AP")); + timeformats.append(samptime.toString("hh:mm ap")); + timeformats.append(samptime.toString("h:mm")); + timeformats.append(samptime.toString("hh:mm")); + timeformats.append(samptime.toString("hh.mm")); + + for (QStringList::const_iterator i = timeformats.begin(); + i != timeformats.end(); i++) + { + MythUIButtonListItem *item = + new MythUIButtonListItem(m_timeButtonList, *i); + item->SetData(*i); + } + +} +void GeneralSetupWizard::slotNext(void) +{ + save(); + + MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); + AudioSetupWizard *sw = new AudioSetupWizard(mainStack, this, "audiosetupwizard"); + + if (sw->Create()) + { + mainStack->AddScreen(sw); + } + else + delete sw; +} + +void GeneralSetupWizard::save(void) +{ +} + +bool GeneralSetupWizard::keyPressEvent(QKeyEvent *event) +{ + if (GetFocusWidget()->keyPressEvent(event)) + return true; + + bool handled = false; + + if (!handled && MythScreenType::keyPressEvent(event)) + handled = true; + + return handled; +} diff --git a/mythtv/programs/mythfrontend/setupwizard_general.h b/mythtv/programs/mythfrontend/setupwizard_general.h new file mode 100644 index 00000000000..867a0caa34e --- /dev/null +++ b/mythtv/programs/mythfrontend/setupwizard_general.h @@ -0,0 +1,43 @@ +#ifndef GENERALSETUPWIZARD_H +#define GENERALSETUPWIZARD_H + +#include +#include +#include + +// libmythui +#include +#include +#include +#include +#include + +class GeneralSetupWizard : public MythScreenType +{ + Q_OBJECT + + public: + + GeneralSetupWizard(MythScreenStack *parent, const char *name = 0); + ~GeneralSetupWizard(); + + bool Create(void); + bool keyPressEvent(QKeyEvent *); + + void save(void); + + private: + MythUIButtonList *m_ldateButtonList; + MythUIButtonList *m_sdateButtonList; + MythUIButtonList *m_timeButtonList; + + MythUIButton *m_nextButton; + MythUIButton *m_cancelButton; + + private slots: + void loadData(void); + void slotNext(void); +}; + +#endif + diff --git a/mythtv/programs/mythfrontend/setupwizard_video.cpp b/mythtv/programs/mythfrontend/setupwizard_video.cpp new file mode 100644 index 00000000000..004dfaae570 --- /dev/null +++ b/mythtv/programs/mythfrontend/setupwizard_video.cpp @@ -0,0 +1,179 @@ +// qt +#include +#include + +// myth +#include +#include +#include +#include + +#include "setupwizard_general.h" +#include "setupwizard_audio.h" +#include "setupwizard_video.h" + +VideoSetupWizard::VideoSetupWizard(MythScreenStack *parent, MythScreenType *general, + MythScreenType *audio, const char *name) + : MythScreenType(parent, name), + m_generalScreen(general), m_audioScreen(audio), + m_playbackProfileButtonList(NULL), m_testSDButton(NULL), + m_testHDButton(NULL), m_nextButton(NULL), + m_prevButton(NULL) +{ + m_vdp = new VideoDisplayProfile(); + m_audioScreen->Hide(); +} + +bool VideoSetupWizard::Create() +{ + bool foundtheme = false; + + // Load the theme for this screen + foundtheme = LoadWindowFromXML("config-ui.xml", "videowizard", this); + + if (!foundtheme) + return false; + + m_playbackProfileButtonList = dynamic_cast (GetChild("playbackprofiles")); + + m_testSDButton = dynamic_cast (GetChild("testsd")); + m_testHDButton = dynamic_cast (GetChild("testhd")); + + m_nextButton = dynamic_cast (GetChild("next")); + m_prevButton = dynamic_cast (GetChild("previous")); + + if (!m_playbackProfileButtonList || !m_testSDButton || + !m_testHDButton ||!m_nextButton || !m_prevButton) + { + VERBOSE(VB_IMPORTANT, "Theme is missing critical theme elements."); + return false; + } + + m_playbackProfileButtonList->SetHelpText( tr("Select from one of the " + "preconfigured playback profiles. When " + "satisfied, you can test Standard Definition " + "and High Definition playback with your choice " + "before moving on.") ); + m_testSDButton->SetHelpText( tr("Test your playback settings with Standard " + "definition content. (480p)") ); + m_testHDButton->SetHelpText( tr("Test your playback settings with High " + "definition content (1080p).") ); + m_nextButton->SetHelpText( tr("Save these changes and move on to the " + "next configuration step.") ); + m_prevButton->SetHelpText( tr("Return to the previous configuration step.") ); + + connect(m_testSDButton, SIGNAL(Clicked()), this, SLOT(testSDVideo())); + connect(m_testHDButton, SIGNAL(Clicked()), this, SLOT(testHDVideo())); + connect(m_nextButton, SIGNAL(Clicked()), this, SLOT(slotNext())); + connect(m_prevButton, SIGNAL(Clicked()), this, SLOT(slotPrevious())); + + BuildFocusList(); + loadData(); + + return true; +} + +VideoSetupWizard::~VideoSetupWizard() +{ + if (m_vdp) + delete m_vdp; + + if (m_audioScreen) + m_audioScreen->Show(); +} + +void VideoSetupWizard::loadData(void) +{ + QStringList profiles = m_vdp->GetProfiles(gCoreContext->GetHostName()); + + for (QStringList::const_iterator i = profiles.begin(); + i != profiles.end(); i++) + { + MythUIButtonListItem *item = + new MythUIButtonListItem(m_playbackProfileButtonList, *i); + item->SetData(*i); + } + + QString currentpbp = m_vdp->GetDefaultProfileName(gCoreContext->GetHostName()); + if (!currentpbp.isEmpty()) + { + MythUIButtonListItem *set = + m_playbackProfileButtonList->GetItemByData(currentpbp); + m_playbackProfileButtonList->SetItemCurrent(set); + } +} + +void VideoSetupWizard::slotNext(void) +{ + save(); +} + +void VideoSetupWizard::save(void) +{ + QString desiredpbp = + m_playbackProfileButtonList->GetItemCurrent()->GetText(); + m_vdp->SetDefaultProfileName(desiredpbp, gCoreContext->GetHostName()); +} + +void VideoSetupWizard::slotPrevious(void) +{ + if (m_audioScreen) + m_audioScreen->Show(); + Close(); +} + +bool VideoSetupWizard::keyPressEvent(QKeyEvent *event) +{ + if (GetFocusWidget()->keyPressEvent(event)) + return true; + + bool handled = false; + + if (!handled && MythScreenType::keyPressEvent(event)) + handled = true; + + return handled; +} + +void VideoSetupWizard::testSDVideo(void) +{ + QString sdtestfile = + QString("%1themes/default/test_sd.mov") + .arg(GetShareDir()); + + QString desiredpbp = + m_playbackProfileButtonList->GetItemCurrent()->GetText(); + QString currentpbp = m_vdp->GetDefaultProfileName(gCoreContext->GetHostName()); + + QString desc = tr("A short test of your system's playback of " + "Standard Definition content with the %1 profile.") + .arg(desiredpbp); + QString title = tr("Standard Definition Playback Test"); + + m_vdp->SetDefaultProfileName(desiredpbp, gCoreContext->GetHostName()); + GetMythMainWindow()->HandleMedia("Internal", sdtestfile, + desc, title); + m_vdp->SetDefaultProfileName(currentpbp, gCoreContext->GetHostName()); +} + +void VideoSetupWizard::testHDVideo(void) +{ + QString hdtestfile = + QString("%1themes/default/test_hd.mov") + .arg(GetShareDir()); + + QString desiredpbp = + m_playbackProfileButtonList->GetItemCurrent()->GetText(); + QString currentpbp = m_vdp->GetDefaultProfileName(gCoreContext->GetHostName()); + + QString desc = tr("A short test of your system's playback of " + "High Definition content with the %1 profile.") + .arg(desiredpbp); + QString title = tr("High Definition Playback Test"); + + m_vdp->SetDefaultProfileName(desiredpbp, gCoreContext->GetHostName()); + GetMythMainWindow()->HandleMedia("Internal", hdtestfile, + desc, title); + m_vdp->SetDefaultProfileName(currentpbp, gCoreContext->GetHostName()); +} + diff --git a/mythtv/programs/mythfrontend/setupwizard_video.h b/mythtv/programs/mythfrontend/setupwizard_video.h new file mode 100644 index 00000000000..23821e028f2 --- /dev/null +++ b/mythtv/programs/mythfrontend/setupwizard_video.h @@ -0,0 +1,55 @@ +#ifndef VIDEOSETUPWIZARD_H +#define VIDEOSETUPWIZARD_H + +#include +#include +#include + +// Utility headers +#include + +// libmythui +#include +#include +#include +#include + +class VideoSetupWizard : public MythScreenType +{ + Q_OBJECT + + public: + + VideoSetupWizard(MythScreenStack *parent, MythScreenType *general, + MythScreenType *audio, const char *name = 0); + ~VideoSetupWizard(); + + bool Create(void); + bool keyPressEvent(QKeyEvent *); + + void save(void); + + private: + MythScreenType *m_generalScreen; + MythScreenType *m_audioScreen; + + MythUIButtonList *m_playbackProfileButtonList; + + MythUIButton *m_testSDButton; + MythUIButton *m_testHDButton; + + MythUIButton *m_nextButton; + MythUIButton *m_prevButton; + + VideoDisplayProfile *m_vdp; + + private slots: + void slotNext(void); + void slotPrevious(void); + void loadData(void); + + void testSDVideo(void); + void testHDVideo(void); +}; + +#endif