Permalink
Browse files

Move all the UI for the hardware profiler into the setup wizard.

Allow creating, viewing, and deleting of profiles.

Only thing missing is the default theme, I'll get that up later.
  • Loading branch information...
1 parent 45a3181 commit 0f9ab3ca940b0632081ff6532ca69437cffbe578 Robert McNamara committed Feb 24, 2011
@@ -20,11 +20,9 @@ const QString SMOLT_SERVER_LOCATION =
QString("http://smolt.mythvantage.com/");
HardwareProfile::HardwareProfile() :
- m_popupStack(NULL), m_busyPopup(NULL),
m_uuid(QString()), m_publicuuid(QString()),
m_hardwareProfile(QString())
{
- m_popupStack = GetMythMainWindow()->GetStack("popup stack");
m_uuid = gCoreContext->GetSetting("HardwareProfileUUID");
m_publicuuid = gCoreContext->GetSetting("HardwareProfilePublicUUID");
}
@@ -33,60 +31,6 @@ HardwareProfile::~HardwareProfile()
{
}
-bool HardwareProfile::Prompt(bool force)
-{
- if (m_uuid.isEmpty() || force)
- return true;
- else
- return false;
-}
-
-void HardwareProfile::ShowPrompt()
-{
- QString message = QObject::tr("Would you like to share your "
- "hardware profile with the MythTV developers? "
- "Profiles are anonymous and are a great way to "
- "help with future development.");
- MythConfirmationDialog *confirmdialog =
- new MythConfirmationDialog(m_popupStack,message);
-
- if (confirmdialog->Create())
- m_popupStack->AddScreen(confirmdialog);
-
- connect(confirmdialog, SIGNAL(haveResult(bool)),
- SLOT(OnPromptReturn(bool)));
-}
-
-void HardwareProfile::OnPromptReturn(bool submit)
-{
- if (submit)
- {
- CreateBusyDialog(tr("Submitting your hardware profile..."));
- GenerateUUIDs();
- if (SubmitProfile())
- {
- if (m_busyPopup)
- {
- m_busyPopup->Close();
- m_busyPopup = NULL;
- }
- gCoreContext->SaveSetting("HardwareProfileUUID", m_uuid);
- gCoreContext->SaveSetting("HardwareProfilePublicUUID", m_publicuuid);
- VERBOSE(VB_GENERAL, QString("Profile URL: %1")
- .arg(GetProfileURL()));
- ShowOkPopup(tr("Hardware profile submitted. Thank you for supporting "
- "MythTV!"));
- }
- else
- ShowOkPopup(tr("Encountered a problem while submitting your profile."));
- }
- else
- {
- gCoreContext->SaveSetting("HardwareProfileUUID", "-1");
- gCoreContext->SaveSetting("HardwareProfilePublicUUID", "-1");
- }
-}
-
void HardwareProfile::GenerateUUIDs(void)
{
QString fileprefix = GetConfDir() + "/HardwareProfile";
@@ -125,16 +69,9 @@ void HardwareProfile::GenerateUUIDs(void)
m_uuid = fileUUID;
}
- // Get the Public UUID from file if necessary
-
- if (m_publicuuid.isEmpty())
- m_publicuuid = GetPublicUUIDFromFile();
+ // Get the Public UUID from file
- if (m_busyPopup)
- {
- m_busyPopup->Close();
- m_busyPopup = NULL;
- }
+ m_publicuuid = GetPublicUUIDFromFile();
}
QString HardwareProfile::GetPrivateUUIDFromFile()
@@ -247,21 +184,6 @@ QString HardwareProfile::GetProfileURL()
{
ret = SMOLT_SERVER_LOCATION + "client/show/?uuid=" + m_publicuuid;
}
- else
- ret = tr("No Profile Exists");
return ret;
}
-
-void HardwareProfile::CreateBusyDialog(QString message)
-{
- if (m_busyPopup)
- return;
-
- m_busyPopup = new MythUIBusyDialog(message, m_popupStack,
- "hardwareprofilebusydialog");
-
- if (m_busyPopup->Create())
- m_popupStack->AddScreen(m_busyPopup);
-}
-
@@ -24,31 +24,21 @@ class MPUBLIC HardwareProfile : public QObject
HardwareProfile();
~HardwareProfile(void);
- bool Prompt(bool force = false);
- void ShowPrompt(void);
-
void GenerateUUIDs(void);
QString GetPrivateUUIDFromFile(void);
bool WritePrivateUUIDToFile(QString uuid);
-
QString GetPublicUUIDFromFile(void);
bool SubmitProfile(void);
bool DeleteProfile(void);
- QString GetPublicUUID(void);
- QString GetProfileURL(void);
+ QString GetPublicUUID(void) {return m_publicuuid; };
+ QString GetPrivateUUID(void) {return m_uuid; };
- public slots:
- void OnPromptReturn(bool submit);
+ QString GetProfileURL(void);
private:
- void CreateBusyDialog(QString message);
-
- MythScreenStack *m_popupStack;
- MythUIBusyDialog *m_busyPopup;
-
QString m_uuid;
QString m_publicuuid;
QString m_hardwareProfile;
@@ -43,7 +43,6 @@ using namespace std;
#include "dvdringbuffer.h"
#include "scheduledrecording.h"
#include "mythsystemevent.h"
-#include "hardwareprofile.h"
#include "compat.h" // For SIG* on MinGW
#include "exitcodes.h"
@@ -1390,16 +1389,6 @@ int main(int argc, char **argv)
if (LanguageSelection::prompt())
GetMythMainWindow()->JumpTo("Reload Theme");
-#ifdef __linux__
-#ifdef CONFIG_BINDINGS_PYTHON
- // If this is the first time loading this frontend, prompt to send
- // the hardware profile.
- HardwareProfile *hardwareProfile = new HardwareProfile();
- if (hardwareProfile && hardwareProfile->Prompt())
- hardwareProfile->ShowPrompt();
-#endif
-#endif
-
internal_media_init();
CleanupMyOldInUsePrograms();
@@ -1467,13 +1456,6 @@ int main(int argc, char **argv)
if (themeUpdateChecker)
delete themeUpdateChecker;
-#ifdef __linux__
-#ifdef CONFIG_BINDINGS_PYTHON
- if (hardwareProfile)
- delete hardwareProfile;
-#endif
-#endif
-
delete sysEventHandler;
pmanager->DestroyAllPlugins();
Oops, something went wrong.

0 comments on commit 0f9ab3c

Please sign in to comment.