summaryrefslogtreecommitdiffstats
path: root/abs/core/mythinstall/MythVantage-app/mythbeselect/installdialog.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'abs/core/mythinstall/MythVantage-app/mythbeselect/installdialog.cpp')
-rwxr-xr-xabs/core/mythinstall/MythVantage-app/mythbeselect/installdialog.cpp216
1 files changed, 216 insertions, 0 deletions
diff --git a/abs/core/mythinstall/MythVantage-app/mythbeselect/installdialog.cpp b/abs/core/mythinstall/MythVantage-app/mythbeselect/installdialog.cpp
new file mode 100755
index 0000000..6d1920f
--- /dev/null
+++ b/abs/core/mythinstall/MythVantage-app/mythbeselect/installdialog.cpp
@@ -0,0 +1,216 @@
+#include <qapplication.h>
+#include <unistd.h>
+#include <fstream>
+#include <sys/wait.h> // For WIFEXITED on Mac OS X
+
+#include "mythcontext.h"
+#include "mythdbcon.h"
+#include "lcddevice.h"
+#include "tv.h"
+#include "programinfo.h"
+#include "uitypes.h"
+#include "remoteutil.h"
+#include "installdialog.h"
+#include "libmyth/dialogbox.h"
+#include <qvaluevector.h>
+#include <stdlib.h>
+#define UPDATE_STATUS_INTERVAL 5000
+#define UPDATE_SCREEN_INTERVAL 5000
+QStringList belist;
+BEvector beveclist (100);
+QString BECommand;
+int retval;
+int runstuff(QStringList hostlist,BEvector Bea,QString bcmd ){
+belist=hostlist;
+beveclist = Bea;
+BECommand=bcmd;
+
+WelcomeDialog *mythWelcome = new WelcomeDialog(gContext->GetMainWindow(),
+ "welcome_screen", "bpopup-",
+ "welcome_screen");
+ mythWelcome->exec();
+ delete mythWelcome;
+ return (0);
+}
+
+
+WelcomeDialog::WelcomeDialog(MythMainWindow *parent,
+ QString window_name,
+ QString theme_filename,
+ const char* name)
+:MythThemedDialog(parent, window_name, theme_filename, name)
+{
+ gContext->addListener(this);
+ m_timeFormat = gContext->GetSetting("TimeFormat", "h:mm AP");
+ wireUpTheme();
+ assignFirstFocus();
+ popup = NULL;
+ showPopup();
+}
+
+
+int WelcomeDialog::exec()
+{
+ return MythDialog::exec();
+}
+
+
+
+void WelcomeDialog::keyPressEvent(QKeyEvent *e)
+{
+ bool handled = false;
+
+ QStringList actions;
+ gContext->GetMainWindow()->TranslateKeyPress("Welcome", e, actions);
+
+ for (unsigned int i = 0; i < actions.size() && !handled; i++)
+ {
+ QString action = actions[i];
+ handled = true;
+ if (action == "ESCAPE")
+ {
+ return; // eat escape key
+ }
+ else if (action == "MENU")
+ {
+ showPopup();
+ }
+ else if (action == "NEXTVIEW")
+ {
+ accept();
+ }
+ else if (action == "SELECT")
+ {
+ activateCurrent();
+ }
+ else
+ handled = false;
+ }
+
+ if (!handled)
+ MythThemedDialog::keyPressEvent(e);
+}
+
+UITextType* WelcomeDialog::getTextType(QString name)
+{
+ UITextType* type = getUITextType(name);
+
+ if (!type)
+ {
+ cout << "ERROR: Failed to find '" << name << "' UI element in theme file\n"
+ << "Bailing out!" << endl;
+ exit(0);
+ }
+ return type;
+}
+
+void WelcomeDialog::wireUpTheme()
+{
+ m_status_text = getTextType("status_text");
+ m_recording_text = getTextType("recording_text");
+ m_scheduled_text = getTextType("scheduled_text");
+ m_time_text = getTextType("time_text");
+ m_date_text = getTextType("date_text");
+ m_warning_text = getTextType("conflicts_text");
+ m_warning_text->hide();
+ buildFocusList();
+}
+
+void WelcomeDialog::closeDialog()
+{
+cout <<"close dialog" <<endl;
+ done(1);
+}
+
+WelcomeDialog::~WelcomeDialog()
+{
+ gContext->removeListener(this);
+
+ if (m_updateStatusTimer)
+ delete m_updateStatusTimer;
+
+ if (m_updateScreenTimer)
+ delete m_updateScreenTimer;
+
+ if (m_timeTimer)
+ delete m_timeTimer;
+}
+
+void WelcomeDialog::updateTime(void)
+{
+ QString s="";
+ m_date_text->SetText(s);
+}
+
+void WelcomeDialog::updateStatus(void)
+{
+ updateStatusMessage();
+}
+
+void WelcomeDialog::updateScreen(void)
+{
+ m_recording_text->SetText(recording_text);
+ m_scheduled_text->SetText(scheduled_text);
+ m_status_text->SetText("");
+ m_updateScreenTimer->start(UPDATE_SCREEN_INTERVAL, true);
+
+}
+
+void WelcomeDialog::updateAll(void)
+{
+ updateRecordingList();
+ updateScheduledList();
+}
+
+bool WelcomeDialog::updateRecordingList()
+{
+ return true;
+}
+
+bool WelcomeDialog::updateScheduledList()
+{
+
+
+ updateStatus();
+ updateScreen();
+ return true;
+}
+
+void WelcomeDialog::updateStatusMessage(void)
+{
+
+}
+
+void WelcomeDialog::showPopup(void)
+{
+ if (popup)
+ return;
+ DialogCode retitem = MythPopupBox::ShowButtonPopup(gContext->GetMainWindow(),
+ QString("JobQueuePopup"),
+ QObject::tr("Select Backend to " + BECommand ),
+ belist,kDialogCodeButton0);
+ retval = retitem - kDialogCodeListStart;
+ cout << beveclist[retval] << endl;
+ cancelPopup();
+ dorestart( BECommand , beveclist[retval] );
+ }
+
+
+
+void WelcomeDialog::cancelPopup(void)
+{
+ if (!popup)
+ return;
+ popup->hide();
+ popup->deleteLater();
+ popup = NULL;
+ setActiveWindow();
+}
+
+void dorestart (QString command , QString behost)
+{
+cout << command << behost << endl;
+system("/usr/bin/backend_control.sh " + command + " " + behost );
+exit(0);
+}
+