diff options
Diffstat (limited to 'abs/core/mythinstall')
13 files changed, 572 insertions, 422 deletions
diff --git a/abs/core/mythinstall/MythVantage-app/mythinstall/commandlineparser.cpp b/abs/core/mythinstall/MythVantage-app/mythinstall/commandlineparser.cpp index 7c8f4a2..7ac1788 100755 --- a/abs/core/mythinstall/MythVantage-app/mythinstall/commandlineparser.cpp +++ b/abs/core/mythinstall/MythVantage-app/mythinstall/commandlineparser.cpp @@ -29,16 +29,16 @@ void MythInstallCommandLineParser::LoadArguments(void) "Show readme", ""); add("-H", "help", "", - "Show help screen", ""); + "Show help screen", ""); add("-Q", "question", "", - "Display question with yes/no", ""); + "Display question with yes/no", ""); add("-b", "run_mythsetup", "", "Ask to start mythtv setup", ""); add("-L", "show_lang", "", - "On install show lang/country screen", ""); + "On install show lang/country screen", ""); diff --git a/abs/core/mythinstall/MythVantage-app/mythinstall/fileshare.cpp b/abs/core/mythinstall/MythVantage-app/mythinstall/fileshare.cpp index d09efd7..03aaf40 100755 --- a/abs/core/mythinstall/MythVantage-app/mythinstall/fileshare.cpp +++ b/abs/core/mythinstall/MythVantage-app/mythinstall/fileshare.cpp @@ -230,7 +230,7 @@ public: }; void smb_busy_box() { - system ("nmbscan -d > /tmp/smbdomainlist & "); + myth_system ("nmbscan -d > /tmp/smbdomainlist & "); QString msgtext="Searching for Windows Workgroups"; int return_code; MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); diff --git a/abs/core/mythinstall/MythVantage-app/mythinstall/installdialog.cpp b/abs/core/mythinstall/MythVantage-app/mythinstall/installdialog.cpp index 6f4252f..980fa17 100755 --- a/abs/core/mythinstall/MythVantage-app/mythinstall/installdialog.cpp +++ b/abs/core/mythinstall/MythVantage-app/mythinstall/installdialog.cpp @@ -4,15 +4,16 @@ #include <fstream> #include "mythcontext.h" -//#include "tv.h" -//#include "uitypes.h" #include "installdialog.h" #include "installsettings.h" #include "installationtype.h" #include "mv_common.h" +#include "questionnotice.h" #include "mythprogressdialog.h" #include <stdlib.h> +#include <chrono> // for milliseconds +#include <thread> // for sleep_for #include "mythversion.h" #include "mythsystemlegacy.h" @@ -23,10 +24,9 @@ WelcomeDialog::WelcomeDialog(MythScreenStack *parent, const char *name) - :MythScreenType(parent, name), - m_status_text(NULL), m_recording_text(NULL), m_scheduled_text(NULL), - m_time_text(NULL), m_date_text(NULL), - m_menuPopup(NULL), m_mv_text(NULL) + :MythScreenType(parent, name), m_menuPopup(NULL), + m_status_text(NULL),m_recording_text(NULL), m_scheduled_text(NULL), + m_mv_text(NULL), m_time_text(NULL), m_date_text(NULL) { // system("rm -f /tmp/.install_state"); @@ -37,7 +37,6 @@ WelcomeDialog::WelcomeDialog(MythScreenStack *parent, const char *name) scheduled_text = ""; install_text = ""; version_text = ""; - I_AM_BUSY = false; WORKING_ON_INSTALL = false; current_hostname = ""; @@ -58,13 +57,9 @@ WelcomeDialog::WelcomeDialog(MythScreenStack *parent, const char *name) SLOT(updateTime())); m_timeTimer->start(1000); - reboot_box = NULL; m_menuPopup = NULL; - //QTimer::singleShot(6000, this, showPopup()); - // JM QTimer::singleShot(1000, this, SLOT(showPopup())); - } bool WelcomeDialog::Create(void) @@ -104,9 +99,15 @@ void WelcomeDialog::shutdownNow(int rc) // system("rm -f /tmp/.install_percent"); // system("rm -f /tmp/.install_error"); if (rc == 1) - system("/sbin/halt"); + { + if(!system("/sbin/halt")) + LOG(VB_GENERAL, LOG_ERR, "Error running halt"); + } else - system("/sbin/reboot"); + { + if(!system("/sbin/reboot")) + LOG(VB_GENERAL, LOG_ERR, "Error running reboot"); + } } void WelcomeDialog::runLIVECD(void) @@ -124,8 +125,6 @@ void WelcomeDialog::runLIVECD(void) { showPopup(); } - - } bool WelcomeDialog::keyPressEvent(QKeyEvent *event) @@ -159,7 +158,7 @@ bool WelcomeDialog::keyPressEvent(QKeyEvent *event) // QByteArray tmp = cmd.toAscii(); // QByteArray tmp = cmd; // system(tmp); - system(qPrintable(cmd)); + myth_system(qPrintable(cmd)); } } else @@ -174,7 +173,6 @@ bool WelcomeDialog::keyPressEvent(QKeyEvent *event) void WelcomeDialog::closeDialog() { Close(); - exit(0); } @@ -229,7 +227,9 @@ void WelcomeDialog::updateScreen(void) QString cmdtxt; cmdtxt=MV_ROOT ; cmdtxt.append("bin/install_proxy.sh " ); - system(qPrintable(cmdtxt)); + int sysRet = system(qPrintable(cmdtxt)); + if (sysRet < 0) + LOG(VB_GENERAL, LOG_ERR, "Error running install_proxy.sh in updateScreen"); recording_text="Press MENU for Options"; mythvantage_text=" "; error_text=" "; @@ -276,6 +276,7 @@ void WelcomeDialog::updateScreen(void) } else mythvantage_text=""; + m_recording_text->SetText(recording_text); m_scheduled_text->SetText(scheduled_text); m_mv_text->SetText(mythvantage_text); @@ -283,88 +284,40 @@ void WelcomeDialog::updateScreen(void) if ( install_drive != "" ) install_text = ""; - m_status_text->SetText(install_text ); + m_status_text->SetText(install_text); // m_updateScreenTimer->start(UPDATE_SCREEN_INTERVAL, true); m_updateScreenTimer->start(UPDATE_SCREEN_INTERVAL); if ( scheduled_text == "Done" ) { - Reboot_popup () ; + CloseBusyPopup(); + m_updateScreenTimer->stop(); + Reboot_popup(); } // shows the busy box when configuring the system if ( scheduled_text == "Configuring system") { m_recording_text->SetText(" "); - if ( ! I_AM_BUSY ) - busy_box(); + QString msgtext = "Configuring LinHES on host " ; + msgtext.append(current_hostname); + msgtext.append("..."); + OpenBusyPopup(msgtext); } }; -void WelcomeDialog::busy_box(void) -{ - QString msgtext = "Please wait, configuring LinHES on host " ; - msgtext.append(current_hostname); - msgtext.append("..."); - MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); - MythUIBusyDialog *busyPopup = new MythUIBusyDialog(msgtext, popupStack,"installbusy"); - if (busyPopup->Create()) - { - popupStack->AddScreen(busyPopup, false); - } - else - { - delete busyPopup; - busyPopup = NULL; - } - - - while ( scheduled_text == "Configuring system" ) - { - qApp->processEvents (); - usleep(900); - I_AM_BUSY = true; - } - - if (busyPopup) - { - busyPopup->Close(); - busyPopup = NULL; - } - I_AM_BUSY = false; -} - void WelcomeDialog::busy_find_oldsettings(void) { - - QString msgtext = "Importing Old Settings..." ; - MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); - MythUIBusyDialog *busyPopup = new MythUIBusyDialog(msgtext, popupStack, - "importsettingsbusy"); - if (busyPopup->Create()) - { - popupStack->AddScreen(busyPopup, false); - } - else - { - delete busyPopup; - busyPopup = NULL; - } + QString msgtext = "Importing Old Settings..." ; + OpenBusyPopup(msgtext); int return_code = 0; - while ( return_code == 0 ) + while ( return_code == 0 ) { qApp->processEvents (); - usleep(900); - I_AM_BUSY = true; + std::this_thread::sleep_for(std::chrono::microseconds(900)); return_code = myth_system("ps -ef|grep install_proxy.sh|grep -v grep > /dev/null"); } - if (busyPopup) - { - busyPopup->Close(); - busyPopup = NULL; - } - I_AM_BUSY = false; - + CloseBusyPopup(); } @@ -389,19 +342,6 @@ void WelcomeDialog::updateStatusMessage(void) void WelcomeDialog::showPopup(void) { - -// if (m_menuPopup) - // return; -// -// QString label = tr("MythVantage Menu"); -// MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); -// m_menuPopup = new MythDialogBox(label, mainStack, "menuPopup"); -// -// if (m_menuPopup->Create()) -// mainStack->AddScreen(m_menuPopup); -// -// m_menuPopup->SetReturnEvent(this, "action"); - MythScreenStack *popupStack = GetMythMainWindow()->GetMainStack(); m_menuPopup = new MythDialogBox("Menu", popupStack, "actionmenu"); @@ -418,7 +358,7 @@ void WelcomeDialog::showPopup(void) // This is a bad way to lock the buttons but it works for now. if ( scheduled_text.length() <= 2 ) { - m_menuPopup->AddButton(tr("Install or Upgrade "), + m_menuPopup->AddButton(tr("Install or Upgrade"), SLOT(Display_2ndpopup())); m_menuPopup->AddButton(tr("Run MythFrontend"), SLOT(runLIVECD())); @@ -513,7 +453,7 @@ QString WelcomeDialog::diskmodel(QString drive , QString tsize) return qline; } -QString WelcomeDialog::findinstallsouce(void) +QString WelcomeDialog::findinstallsource(void) { string line; QString currentitem; @@ -522,7 +462,7 @@ QString WelcomeDialog::findinstallsouce(void) { getline (mountfile,line); if ( line.empty() ) - line = "oops didn't find andthing"; + line = "oops didn't find anything"; currentitem= ( QString::fromStdString( line ) ); @@ -540,6 +480,7 @@ QString WelcomeDialog::findinstallsouce(void) return currentitem; }; } + return NULL; }; void WelcomeDialog::showPopup_2(void) @@ -564,7 +505,7 @@ void WelcomeDialog::showPopup_2(void) if ( NETBOOT == "YES" ) m_menuPopup->AddButton(("Diskless Frontend"), SLOT(install_net() ) ); - QString INSTALLSOURCE = findinstallsouce(); + QString INSTALLSOURCE = findinstallsource(); ifstream partitions("/proc/partitions"); if (partitions.is_open()) { @@ -631,38 +572,46 @@ void WelcomeDialog::GO_popup(QString go_text) void WelcomeDialog::Reboot_popup(void) -{ if (reboot_box) - return; +{ QString prompt1; QFile updbstatus("/tmp/.upgrade_db_failed"); if ( updbstatus.open(QIODevice::ReadOnly | QIODevice::Text) ) { - prompt1 = QObject::tr(" "); - prompt1.append("\n"); - prompt1.append("An error occured while attempting to restore the database!"); - prompt1.append("\n"); - prompt1.append("The old database could not be restored, so a new database was created"); + prompt1 = QObject::tr("An error occured while attempting to restore the database."); prompt1.append("\n"); + prompt1.append("The old database could not be restored, so a new database was created."); } else prompt1 = QObject::tr("Installation of LinHES is complete!"); - prompt1.append("\n"); - reboot_box = new DialogBox(GetMythMainWindow(), prompt1); - reboot_box->AddButton(QObject::tr("Reboot")); - reboot_box->AddButton(QObject::tr("Power Off")); + //as extern to be set in questionnotice.cpp + extern int questionReturnCode; + + MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); + QuestionNoticeDialog *questionNotice = + new QuestionNoticeDialog(mainStack, "Question"); + if (questionNotice->Create("question", "Installation Complete", prompt1, + "Reboot", "Shutdown")) mainStack->AddScreen(questionNotice, true); + else + return; - int returncode = 0; - DialogCode dcode = reboot_box->exec(); - reboot_box->deleteLater(); - if (kDialogCodeButton0 == dcode ) + do + { + qApp->processEvents(); + std::this_thread::sleep_for(std::chrono::milliseconds(5)); + } while (mainStack->TotalScreens() > 1); + + int returncode; + if (questionReturnCode == 16) + { + LOG(VB_GENERAL, LOG_INFO, "Reboot"); returncode = 0; - if (kDialogCodeButton1 == dcode ) + } + else + { + LOG(VB_GENERAL, LOG_INFO, "Shutdown"); returncode = 1; - if (kDialogCodeButton2 == dcode ) - returncode = 2; - - reboot_box = NULL; + } shutdownNow(returncode); } @@ -670,18 +619,11 @@ void WelcomeDialog::Reboot_popup(void) void WelcomeDialog::MAINPopup(void) { -// if (!popup) -// return; -// popup->hide(); -// popup->deleteLater(); - popup = NULL; showPopup(); - } void WelcomeDialog::Display_2ndpopup(void) { - //JM VERBOSE(VB_GENERAL, "Display_2ndpopup"); showPopup_2(); } @@ -867,7 +809,9 @@ void WelcomeDialog::install_generic(void) QString cmdtxt; cmdtxt=MV_ROOT ; cmdtxt.append("bin/install_proxy.sh find_update " + install_drive +" &"); - system(qPrintable(cmdtxt)); + int sysRet = system(qPrintable(cmdtxt)); + if (sysRet < 0) + LOG(VB_GENERAL, LOG_ERR, "Could not run install_proxy.sh find update"); busy_find_oldsettings(); bool flag = false; QString line; @@ -952,7 +896,7 @@ void WelcomeDialog::install_generic(void) void busy_network(void) { - QString msgtext = "Starting Network" ; + QString msgtext = "Starting Network..." ; MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); MythUIBusyDialog *busyPopup = new MythUIBusyDialog(msgtext, popupStack,"installbusy"); if (busyPopup->Create()) @@ -966,10 +910,10 @@ void busy_network(void) } int return_code = 0; - while ( return_code == 0 ) + while ( return_code == 0 ) { qApp->processEvents (); - usleep(900); + std::this_thread::sleep_for(std::chrono::microseconds(900)); return_code = myth_system("ps -ef|grep install_proxy.sh| grep setup_network |grep -v grep > /dev/null"); } @@ -978,9 +922,6 @@ void busy_network(void) busyPopup->Close(); busyPopup = NULL; } - - - } @@ -997,30 +938,64 @@ int WelcomeDialog::ask_validate_network(void) { MythProgressDialog *network_check = NULL; network_check = new MythProgressDialog(QObject::tr("Please wait while the network is checked..."), 7); + //busy_network(); + QString msgtext = "Starting Network..." ; + MythScreenStack *popupStack = GetMythMainWindow()->GetStack( + "popup stack"); + m_progressDialog = new MythUIProgressDialog(msgtext, popupStack, + "networkbusy"); + if (m_progressDialog->Create()) + { + popupStack->AddScreen(m_progressDialog, false); + } + else + { + delete m_progressDialog; + m_progressDialog = NULL; + } + + if (m_progressDialog) + m_progressDialog->SetTotal(6); + QString cmdtxt; - cmdtxt=MV_ROOT ; - cmdtxt.append("bin/install_proxy.sh network_check_it setup_network &"); - retval = system(qPrintable(cmdtxt)); - busy_network(); + cmdtxt=MV_ROOT; + cmdtxt.append("bin/install_proxy.sh network_check_it setup_network"); + retval = system(qPrintable(cmdtxt)); + + //int return_code = 0; + //while ( return_code == 0 ) + //{ + // qApp->processEvents (); + // std::this_thread::sleep_for(std::chrono::microseconds(900)); + // return_code = myth_system("ps -ef|grep install_proxy.sh| grep setup_network |grep -v grep > /dev/null"); + //} + + if (network_check) { network_check->setProgress(2); - cmdtxt=MV_ROOT ; + if ( retval == 0) + { + m_progressDialog->SetMessage("Checking Network for this Computer..."); + m_progressDialog->SetProgress(2); + cmdtxt=MV_ROOT; cmdtxt.append("bin/install_proxy.sh network_check_it check_self"); - retval = system(qPrintable(cmdtxt)); - if ( retval != 0 ) - { - network_check->Close(); - pop_text="Could not find myself on the network."; - } + retval = system(qPrintable(cmdtxt)); + if ( retval != 0 ) + { + network_check->Close(); + pop_text="Could not find myself on the network."; + } + } } - if ( retval == 0) { network_check->setProgress(3); - cmdtxt=MV_ROOT ; + m_progressDialog->SetMessage("Checking Network for the Gateway Server..."); + m_progressDialog->SetProgress(3); + cmdtxt=MV_ROOT; cmdtxt.append("bin/install_proxy.sh network_check_it check_gw"); - retval = system(qPrintable(cmdtxt)); + retval = system(qPrintable(cmdtxt)); if ( retval != 0 ) { network_check->Close(); @@ -1031,9 +1006,11 @@ int WelcomeDialog::ask_validate_network(void) if (retval == 0) { network_check->setProgress(4); - cmdtxt=MV_ROOT ; + m_progressDialog->SetMessage("Checking Network for the Nameserver..."); + m_progressDialog->SetProgress(4); + cmdtxt=MV_ROOT; cmdtxt.append("bin/install_proxy.sh network_check_it check_ns"); - retval = system(qPrintable(cmdtxt)); + retval = system(qPrintable(cmdtxt)); if ( retval != 0 ) { network_check->Close(); @@ -1044,9 +1021,11 @@ int WelcomeDialog::ask_validate_network(void) if (retval == 0) { network_check->setProgress(5); - cmdtxt=MV_ROOT ; + m_progressDialog->SetMessage("Checking the Nameserver..."); + m_progressDialog->SetProgress(5); + cmdtxt=MV_ROOT; cmdtxt.append("bin/install_proxy.sh network_check_it check_names"); - retval = system(qPrintable(cmdtxt)); + retval = system(qPrintable(cmdtxt)); if ( retval != 0 ) { network_check->Close(); @@ -1057,9 +1036,11 @@ int WelcomeDialog::ask_validate_network(void) if (retval == 0) { network_check->setProgress(6); - cmdtxt=MV_ROOT ; + m_progressDialog->SetMessage("Checking Network for this Hostname..."); + m_progressDialog->SetProgress(6); + cmdtxt=MV_ROOT; cmdtxt.append("bin/install_proxy.sh network_check_it host_names"); - retval = system(qPrintable(cmdtxt)); + retval = system(qPrintable(cmdtxt)); if ( retval != 0 ) { network_check->Close(); @@ -1067,6 +1048,11 @@ int WelcomeDialog::ask_validate_network(void) } } + if (m_progressDialog) + { + m_progressDialog->Close(); + m_progressDialog = NULL; + } network_check->setProgress(7); if (network_check) { @@ -1074,7 +1060,7 @@ int WelcomeDialog::ask_validate_network(void) network_check->deleteLater(); } - if (retval != 0 ) + if ( retval != 0 ) { DialogCode val = MythPopupBox::Show2ButtonPopup( GetMythMainWindow(), @@ -1082,7 +1068,7 @@ int WelcomeDialog::ask_validate_network(void) tr("Continue"), tr("Try Again"), kDialogCodeButton0); - if (kDialogCodeButton0 == val ) + if ( kDialogCodeButton0 == val ) retval = 0; } } @@ -1093,37 +1079,14 @@ int WelcomeDialog::ask_validate_network(void) void WelcomeDialog::install_it(void) { + int sysRet; QString installtype = gCoreContext->GetSetting("HOSTinstallationtype"); -// QString rootfs = gCoreContext->GetSetting("HOSTrootfstype"); -// QString datafs = gCoreContext->GetSetting("HOSTdatafstype"); -// QString rootsize = gCoreContext->GetSetting("HOSTOSsize"); -// rootsize=rootsize + "000"; -// QString usealldata = gCoreContext->GetSetting("HostUseALLdata"); -// QString datasize = gCoreContext->GetSetting("HOSTDATAsize"); -// QString uprootfs = gCoreContext->GetSetting("HOSTuprootfstype"); -// QString useswap = gCoreContext->GetSetting("HostUseSWAP"); -// QString swapsize = gCoreContext->GetSetting("HOSTSWAPsize"); if ( installtype != "Upgrade" ) current_hostname = gCoreContext->GetSetting("HostMyhostname"); QString clean_upgrade = getenv("CLEAN_UPGRADE"); if ( clean_upgrade == "YES" ) current_hostname = gCoreContext->GetSetting("HostMyhostname"); -//get the hostname here if upgrade then use previous declarion of hostname -// if ( usealldata == "1" ) -// { -// datasize="ALL"; -// } -// else -// { -// datasize=datasize + "000"; -// } -// if ( useswap == "0" ) -// { -// swapsize="NO"; -// }; - - if ( installtype == "Full/Auto" ) { QString currentitem; @@ -1140,28 +1103,22 @@ void WelcomeDialog::install_it(void) } } file.close(); -// bool ok; -// int mem = currentitem.toInt( &ok, 10 ); // dec == 0, ok == FALSE - - -// if ( mem >= 500000 ) -// { -// if ((gCoreContext->GetSetting("HostXres")) == "1280x720" ) -// gCoreContext->SaveSetting("Theme", "syth-lacquer-wide"); -// } - QString cmdtxt=MV_ROOT ; //cmdtxt.append("bin/install_proxy.sh full_install_it " + install_drive + " " + rootfs + " " + rootsize + " " + datafs + " " + datasize + " " + swapsize + "&"); cmdtxt.append("bin/install_proxy.sh full_install_it &"); - system(qPrintable(cmdtxt)); + sysRet = system(qPrintable(cmdtxt)); + if (sysRet < 0) + LOG(VB_GENERAL, LOG_ERR, "Error running install_proxy.sh full_install_it"); } else if ( installtype == "Upgrade" ) { QString cmdtxt=MV_ROOT ; //cmdtxt.append("bin/install_proxy.sh upgrade_it " + install_drive + " " + uprootfs + "&"); cmdtxt.append("bin/install_proxy.sh upgrade_it &"); - system(qPrintable(cmdtxt)); + sysRet = system(qPrintable(cmdtxt)); + if (sysRet < 0) + LOG(VB_GENERAL, LOG_ERR, "Error running install_proxy.sh upgrade_it"); } else if (installtype=="NET") { @@ -1178,16 +1135,21 @@ void WelcomeDialog::install_it(void) QString h; h=localhostname; cmdtxt.append("bin/restore_default_settings.sh -c save -t syssettings -d 127.0.0.1 -h " + h); - system(qPrintable(cmdtxt)); + sysRet = system(qPrintable(cmdtxt)); + if (sysRet < 0) + LOG(VB_GENERAL, LOG_ERR, "Error running restore_default_settings.sh"); + cmdtxt=MV_ROOT ; //cmdtxt.append("bin/install_proxy.sh NETBOOT " + install_drive + " &"); cmdtxt.append("bin/install_proxy.sh NETBOOT &"); - system(qPrintable(cmdtxt)); + sysRet = system(qPrintable(cmdtxt)); + if (sysRet < 0) + LOG(VB_GENERAL, LOG_ERR, "Error running install_proxy.sh NETBOOT"); } WORKING_ON_INSTALL = true; - usleep (500); + std::this_thread::sleep_for(std::chrono::microseconds(500)); updateScreen(); - usleep (500); + std::this_thread::sleep_for(std::chrono::microseconds(500)); updateScreen(); } diff --git a/abs/core/mythinstall/MythVantage-app/mythinstall/installdialog.h b/abs/core/mythinstall/MythVantage-app/mythinstall/installdialog.h index 432ea19..d256ef2 100755 --- a/abs/core/mythinstall/MythVantage-app/mythinstall/installdialog.h +++ b/abs/core/mythinstall/MythVantage-app/mythinstall/installdialog.h @@ -9,8 +9,6 @@ using namespace std; #include "mythdialogs.h" #include "libmyth/dialogbox.h" - - #include "remoteutil.h" #include "programinfo.h" #include "mythscreentype.h" @@ -18,6 +16,7 @@ using namespace std; #include "mythuitext.h" #include "mythdialogbox.h" #include "langsettings.h" +#include <mythprogressdialog.h> class WelcomeDialog : public MythScreenType { @@ -42,7 +41,7 @@ protected slots: void Reboot_popup(); void MAINPopup(); QString diskmodel(QString,QString); - QString findinstallsouce(void); + QString findinstallsource(void); void Display_2ndpopup(); bool updateRecordingList(void); bool updateScheduledList(void); @@ -61,19 +60,15 @@ protected slots: void install_generic(void); void install_it(void); void runLIVECD(void); - void busy_box(void); void busy_find_oldsettings(void); int ask_validate_network(void); private: void updateStatusMessage(void); - - MythPopupBox *popup; //can remove this - MythDialogBox *m_menuPopup; - DialogBox *reboot_box; - DialogBox *upgrade_box; // // GUI stuff // + MythDialogBox *m_menuPopup; + MythUIProgressDialog *m_progressDialog; MythUIText *m_status_text; MythUIText *m_recording_text; @@ -102,9 +97,7 @@ private: string bin_prefix; QString current_hostname; - bool I_AM_BUSY; bool WORKING_ON_INSTALL; - }; #endif diff --git a/abs/core/mythinstall/MythVantage-app/mythinstall/installsettings.cpp b/abs/core/mythinstall/MythVantage-app/mythinstall/installsettings.cpp index aa599ee..5eb8717 100755 --- a/abs/core/mythinstall/MythVantage-app/mythinstall/installsettings.cpp +++ b/abs/core/mythinstall/MythVantage-app/mythinstall/installsettings.cpp @@ -162,7 +162,9 @@ QString findnet_wireless() QString netdev=""; //QString netdev="eth0 eth1 wlan0 wlan1 ath0 "; - system("/usr/sbin/iwconfig > /tmp/.netinfo_wireless"); + int sysRet = system("/usr/sbin/iwconfig > /tmp/.netinfo_wireless"); + if (sysRet < 0) + LOG(VB_GENERAL, LOG_ERR, "Error running iwconfig"); QString line; QFile file("/tmp/.netinfo_wireless"); if ( file.open(QIODevice::ReadOnly | QIODevice::Text) ) @@ -1174,7 +1176,7 @@ static HostComboBox *Hostfoldingusername() if ((new_line = strchr (username, '\n'))) new_line[0] = 0; - std::cout << "found old username " << username << endl; + //std::cout << "found old username " << username << endl; //FIXME?? //gCoreContext->SetSetting("Hostfoldingusername", username); gCoreContext->SaveSetting("Hostfoldingusername", username); @@ -2372,7 +2374,7 @@ QString NetworkOptionsFrame::find_hostname() cmdtxt.append("bin/systemconfig.py -m dhcp_request -d " ); cmdtxt.append(hostparm.ThisHostDefaultInterface); myth_system(cmdtxt); - system(qPrintable(cmdtxt)); + //system(qPrintable(cmdtxt)); QString line; QFile file("/tmp/mvnetwork.dhcpinfo"); if ( file.open(QIODevice::ReadOnly | QIODevice::Text) ) @@ -2842,7 +2844,9 @@ void SoundOSSsettings::loadossdriver() cmdtxt="sudo "; cmdtxt.append(MV_ROOT) ; cmdtxt.append("bin/soundconfig.sh -t LOAD -i OSS &"); - system(qPrintable(cmdtxt)); + int sysRet = system(qPrintable(cmdtxt)); + if (sysRet < 0) + LOG(VB_GENERAL, LOG_ERR, "Error running soundconfig.sh"); int return_code = 0; QString msgtext = "Loading OSS driver" ; @@ -2903,7 +2907,9 @@ void SoundALSAsettings::loadalsadriver() cmdtxt="sudo "; cmdtxt.append(MV_ROOT) ; cmdtxt.append("bin/soundconfig.sh -t LOAD -i ALSA &"); - system(qPrintable(cmdtxt)); + int sysRet = system(qPrintable(cmdtxt)); + if (sysRet < 0) + LOG(VB_GENERAL, LOG_ERR, "Error running soundconfig.sh"); int return_code = 0; QString msgtext = "Loading ALSA driver" ; @@ -3097,7 +3103,9 @@ void SoundOSSsettings::soundossgathersettings(void) QString cmdtxt; cmdtxt=MV_ROOT ; cmdtxt.append("bin/soundconfig.sh -t test -i OSS -d " + hostparm.ThisHostSoundDevice + "&"); - system(qPrintable(cmdtxt)); + int sysRet = system(qPrintable(cmdtxt)); + if (sysRet < 0) + LOG(VB_GENERAL, LOG_ERR, "Error running soundconfig.sh"); int return_code = 0; QString msgtext = "Playing Test Audio" ; @@ -3162,7 +3170,9 @@ void SoundALSAsettings::soundalsagathersettings(void) QString cmdtxt; cmdtxt=MV_ROOT ; cmdtxt.append("bin/soundconfig.sh -t test -i ALSA -d " + hostparm.ThisHostSoundDevice + "&"); - system(qPrintable(cmdtxt)); + int sysRet = system(qPrintable(cmdtxt)); + if (sysRet < 0) + LOG(VB_GENERAL, LOG_ERR, "Error running soundconfig.sh"); int return_code = 0; QString msgtext = "Playing Test Audio" ; MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); @@ -3531,7 +3541,9 @@ int runsettings (bool mysqlonly , bool shownetwork , bool showhostype, if ( showhostype && continuerun ) { displayshowhostype = showhostype; - system ("avahi-browse -l -r -t _mysql._tcp > /tmp/mysqllist"); + int sysRet = system("avahi-browse -l -r -t _mysql._tcp > /tmp/mysqllist"); + if (sysRet < 0) + LOG(VB_GENERAL, LOG_ERR, "Error running avahi-browse"); MythInstallSettings settings1; settings1.Load(); settings1.Save(); diff --git a/abs/core/mythinstall/MythVantage-app/mythinstall/main.cpp b/abs/core/mythinstall/MythVantage-app/mythinstall/main.cpp index b6e66cd..5c2e128 100755 --- a/abs/core/mythinstall/MythVantage-app/mythinstall/main.cpp +++ b/abs/core/mythinstall/MythVantage-app/mythinstall/main.cpp @@ -3,11 +3,8 @@ #include "installdialog.h" #include "installsettings.h" #include "password_manage.h" -#include "autocard.h" #include "settemplate.h" - - - +#include "questionnotice.h" // Qt #include <QApplication> @@ -15,15 +12,12 @@ #include <QDir> #include <QTextStream> - #include <cstdlib> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> -#include <unistd.h> - - - +#include <chrono> // for milliseconds +#include <thread> // for sleep_for #include <stdio.h> @@ -38,14 +32,12 @@ #include "lcddevice.h" #include "commandlineparser.h" #include "mythlogging.h" -#include "dialogbox.h" - +#include "signalhandling.h" // libmythui #include "mythmainwindow.h" #include "mythuihelper.h" - //?? #include "myththemebase.h" @@ -106,25 +98,25 @@ int main(int argc, char **argv) MythInstallCommandLineParser cmdline; int retval; if ((retval = cmdline.ConfigureLogging()) != GENERIC_EXIT_OK) - return retval; + return retval; if (!cmdline.Parse(argc, argv)) { - cmdline.PrintHelp(); - return 4; - return GENERIC_EXIT_INVALID_CMDLINE; + cmdline.PrintHelp(); + return 4; + return GENERIC_EXIT_INVALID_CMDLINE; } if (cmdline.toBool("showhelp")) { - cmdline.PrintHelp(); - return GENERIC_EXIT_OK; + cmdline.PrintHelp(); + return GENERIC_EXIT_OK; } if (cmdline.toBool("showversion")) { - cmdline.PrintVersion(); - return GENERIC_EXIT_OK; + cmdline.PrintVersion(); + return GENERIC_EXIT_OK; } //--------------------Start of real stuff--------------------- gContext = new MythContext(MYTH_BINARY_VERSION); @@ -254,9 +246,8 @@ int main(int argc, char **argv) bShowHelp = true; if (cmdline.toBool("readme")) - { bShowReadme = true; - } + if (cmdline.toBool("question")) { bShowquestion = true; @@ -267,11 +258,11 @@ int main(int argc, char **argv) bRunSetup = true; if (cmdline.toBool("show_lang")) - showLang = true; + showLang = true; LCD::SetupLCD(); if (class LCD *lcd = LCD::Get()) - lcd->switchToTime(); + lcd->switchToTime(); MythTranslation::load("mythfrontend"); @@ -300,14 +291,17 @@ int main(int argc, char **argv) gCoreContext->ActivateSettingsCache(false); gCoreContext->ClearSettingsCache(); bool runconfig = false; - system("cp -f /etc/systemconfig /tmp/systemconfig.bak"); + int sysRet=system("cp -f /etc/systemconfig /tmp/systemconfig.bak"); + if (sysRet < 0) + LOG(VB_GENERAL, LOG_ERR, "Could not backup /etc/systemconfig."); QString olddb = gCoreContext->GetSetting("HostMysqlserver"); QString oldhostype = gCoreContext->GetSetting("HostSystemType"); //sync db with pacman if (bShowplugins || bShowsoftware) { - system("pacman -Q > /tmp/pacman_installed"); + if (!system("pacman -Q > /tmp/pacman_installed")) + LOG(VB_GENERAL, LOG_ERR, "Could not create /tmp/pacman_installed."); QString progPacmanNamesArray[] = { "mythappletrailers", "mytharchive", "mythbrowser", @@ -370,7 +364,7 @@ int main(int argc, char **argv) QByteArray PacName = progPacmanNamesArray[i].toLocal8Bit(); const char *PacNameChar = PacName.data(); sprintf(cmd, "grep -q '%s ' /tmp/pacman_installed", PacNameChar); - + //LOG(VB_GENERAL, LOG_INFO, QString(progPacmanNamesArray[i])); //LOG(VB_GENERAL, LOG_INFO, QString(progDBNamesArray[i])); QString currDBValue = gCoreContext->GetSetting(progDBNamesArray[i]); @@ -389,7 +383,9 @@ int main(int argc, char **argv) runconfig = true; } } - system("rm -f /tmp/pacman_installed"); + int sysRet=system("rm -f /tmp/pacman_installed"); + if (sysRet < 0) + LOG(VB_GENERAL, LOG_ERR, "Could not remove /tmp/pacman_installed."); } //DONE sync db with pacman @@ -401,7 +397,9 @@ int main(int argc, char **argv) //save my settings in case db switches QString cmdtxt=MV_ROOT; cmdtxt.append("bin/myth_settings_wrapper.sh -c save -t syssettings -d " + olddb); - system(qPrintable(cmdtxt)); + sysRet=system(qPrintable(cmdtxt)); + if (sysRet < 0) + LOG(VB_GENERAL, LOG_ERR, "Could not save settings"); if ( status != 0 ) { @@ -416,7 +414,9 @@ int main(int argc, char **argv) QString cmdtxt; cmdtxt=MV_ROOT; cmdtxt.append("bin/myth_settings_wrapper.sh -c save -t syssettings -d " + olddb ) ; - system(qPrintable(cmdtxt)); + int sysRet=system(qPrintable(cmdtxt)); + if (sysRet < 0) + LOG(VB_GENERAL, LOG_ERR, "Could not save settings"); } if ( runconfig ) @@ -433,38 +433,45 @@ int main(int argc, char **argv) QString dbcommand = cmdtxt; dbcommand.append(newdb); run_systemconfig(modulelist,restart,dbcommand); - - - } - system("rm -f /tmp/systemconfig.bak"); + sysRet=system("rm -f /tmp/systemconfig.bak"); + if (sysRet < 0) + LOG(VB_GENERAL, LOG_ERR, "Could not remove /tmp/systemconfig.bak."); + gCoreContext->ActivateSettingsCache(false); gCoreContext->ClearSettingsCache(); if ( restart ) { - DialogBox *dia = NULL; QString prompt; - QString *problems = new QString("The network address of the database has changed."); - problems->append("\n"); - problems->append("The frontend will need to restart to connect to the new database."); - problems->append("\n"); - dia = new DialogBox(mainWindow, problems->append("\n" )); - dia->AddButton(QObject::tr("OK")); - int returncode = 0; - returncode = dia->exec(); - dia->deleteLater(); - //cout << "restarting" << endl; + prompt.append("The network address of the database has changed."); + prompt.append("\n"); + prompt.append("The frontend will need to restart to connect to the new database."); + prompt.append("\n"); + + MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); + QuestionNoticeDialog *questionNotice = + new QuestionNoticeDialog(mainStack, "Notice"); + if (questionNotice->Create("notice", "Restart Frontend", prompt, + NULL, NULL)) mainStack->AddScreen(questionNotice, true); + else + return -1; + + do + { + qApp->processEvents(); + std::this_thread::sleep_for(std::chrono::milliseconds(5)); + } while (mainStack->TotalScreens() > 0); + QString cmdtxt; - cmdtxt=MV_ROOT ; + cmdtxt=MV_ROOT; cmdtxt.append("bin/systemconfig.sh reloadfe" ); - system(qPrintable(cmdtxt)); + int sysRet=system(qPrintable(cmdtxt)); + if (sysRet < 0) + LOG(VB_GENERAL, LOG_ERR, "Could not reload frontend."); } gCoreContext->ActivateSettingsCache(false); gCoreContext->ClearSettingsCache(); gCoreContext->SendMessage("CLEAR_SETTINGS_CACHE"); - - - }//run settings else if (bShowTemplate) @@ -485,111 +492,85 @@ int main(int argc, char **argv) else if (bRunSetup) { - DialogBox *dia = NULL; QString prompt; - QString *problems = new QString("To configure the TV cards and program guide the setup program needs to be run."); - problems->append("\n"); - problems->append("\n"); - - problems->append("For those in North America, guide data is provided by Schedules Direct."); - problems->append("\n"); - problems->append("Visit http://www.schedulesdirect.org/ to signup for your account today"); - problems->append("\n"); - problems->append("\n"); - problems->append("\n"); - - problems->append("If you choose to not run mythtv-setup now, the program can be run at any time by typing mythtv-setup or hitting ALT+s"); - problems->append("\n"); - - problems->append("\n"); - prompt = QObject::tr("Do you wish to run mythtv-setup ?"); - - dia = new DialogBox(mainWindow, problems->append("\n" + prompt)); - dia->AddButton(QObject::tr("Yes")); - dia->AddButton(QObject::tr("Yes and try to autodetect cards")); - dia->AddButton(QObject::tr("No")); - int returncode = 0; - returncode = dia->exec(); - DialogCode dcode = dia->exec(); - dia->deleteLater(); - if (kDialogCodeButton0 == dcode ) - returncode = 0; - if (kDialogCodeButton1 == dcode ) - returncode = 1; - if (kDialogCodeButton2 == dcode ) - returncode = 2; -/* - if (returncode == 1) + prompt.append("To configure the TV tuner cards and program guide, run mythtv-setup."); + prompt.append("\n"); + prompt.append("\n"); + prompt.append("For those in North America, guide data is provided by Schedules Direct."); + prompt.append("\n"); + prompt.append("Visit http://www.schedulesdirect.org/ and signup for your account."); + prompt.append("\n"); + prompt.append("\n"); + prompt.append("If you choose to not run mythtv-setup now,"); + prompt.append("\n"); + prompt.append("it can be run later by typing Alt + s."); + prompt.append("\n"); + prompt.append("\n"); + prompt.append("Do you want to run mythtv-setup now?"); + + //as extern to be set in questionnotice.cpp + extern int questionReturnCode; + + MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); + QuestionNoticeDialog *questionNotice = + new QuestionNoticeDialog(mainStack, "Question"); + if (questionNotice->Create("question", "Run mythtv-setup?", prompt, + "Yes", "No")) mainStack->AddScreen(questionNotice, true); + else + return -1; + + do { - AutoCard listcards; - listcards.exec(); - }*/ + qApp->processEvents(); + std::this_thread::sleep_for(std::chrono::milliseconds(5)); + } while (mainStack->TotalScreens() > 0); - return returncode; + if (questionReturnCode == 16) + { + int sysRet = system("mythtv-setup &"); + if (sysRet < 1) + LOG(VB_GENERAL, LOG_ERR, "Could not run mythtv-setup."); + } + retval = questionReturnCode; } - else if (bShowHelp) { - DialogBox *dia = NULL; - QString prompt; - QString *problems = new QString("LinHES Help"); - problems->append("\n"); - problems->append("Visit http://linhes.org for additional help."); - problems->append("\n"); - problems->append("\n"); - problems->append("------Keyboard Shortcuts---------------------------------"); - problems->append("\n"); - problems->append("Alt + h: This Screen"); - problems->append("\n"); -#ifdef __MVAPP__ - problems->append("F2: Open/Close Terminal"); - problems->append("\n"); - problems->append("Shift + Return: Open New Terminal (xterm)"); - problems->append("\n"); - problems->append("Alt + F2: Show 2nd desktop Alt + F1 To Go Back"); - problems->append("\n"); - problems->append("Alt + c: Capture Myth Screenshot"); - problems->append("\n"); -#else - problems->append("Alt + x: Open New Terminal (xterm)"); - problems->append("\n"); - problems->append("Alt + m: Open mythfrontend"); - problems->append("\n"); - problems->append("m in mythfrontend: Display Power/About Menu"); - problems->append("\n"); -#endif - problems->append("Alt + 1: Start Master mythbackend"); - problems->append("\n"); - problems->append("Alt + 2: Stop Master mythbackend"); - problems->append("\n"); - problems->append("Alt + 3: Restart Master mythbackend"); - problems->append("\n"); - problems->append("Alt + s: Open mythtv-setup"); - problems->append("\n"); - problems->append("Alt + u: Unhide/Hide Mouse Pointer"); - problems->append("\n"); - problems->append("Alt + w: Open Web Browser (Chrome if installed)"); - problems->append("\n"); - problems->append("Alt + f: Restart Window Manager"); - problems->append("\n"); - - - dia = new DialogBox(mainWindow, problems->append("\n" )); - dia->AddButton(QObject::tr("OK")); - int returncode = 0; - returncode = dia->exec(); - dia->deleteLater(); - DestroyMythMainWindow(); - delete gContext; - return returncode; + QString line; + QString LH_HelpText; + QFile file("/usr/MythVantage/LH_HELP"); + if ( file.open(QIODevice::ReadOnly | QIODevice::Text) ) + { + QTextStream t( &file ); // use a text stream + while ( !t.atEnd() ) + { + line = t.readLine(); + LH_HelpText.append(line); + LH_HelpText.append("\n"); + } + file.close(); + } + else + LH_HelpText.append("Couldn't open /usr/MythVantage/LH_HELP"); + + MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); + QuestionNoticeDialog *questionNotice = new QuestionNoticeDialog(mainStack, + "Notice"); + if (questionNotice->Create("notice", "LinHES Help", LH_HelpText, + NULL, NULL)) mainStack->AddScreen(questionNotice, true); + else + return -1; + + do + { + qApp->processEvents(); + std::this_thread::sleep_for(std::chrono::milliseconds(5)); + } while (mainStack->TotalScreens() > 0); + } else if (bShowReadme) { - DialogBox *dia = NULL; - QString prompt; QString line; - QString *problems = new QString(""); - problems->append("\n"); + QString readmeText; QFile file("/usr/MythVantage/README"); if ( file.open(QIODevice::ReadOnly | QIODevice::Text) ) { @@ -597,88 +578,72 @@ int main(int argc, char **argv) while ( !t.atEnd() ) { line = t.readLine(); - problems->append(line); - problems->append("\n"); + readmeText.append(line); + readmeText.append("\n"); } file.close(); } else - problems->append("Couldn't open file"); - dia = new DialogBox(mainWindow, problems->append("\n" )); - dia->AddButton(QObject::tr("OK")); - int returncode = 0; - returncode = dia->exec(); - dia->deleteLater(); - DestroyMythMainWindow(); - delete gContext; - return returncode; - } + readmeText.append("Couldn't open /usr/MythVantage/README"); + MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); + QuestionNoticeDialog *questionNotice = new QuestionNoticeDialog(mainStack, + "Notice"); + if (questionNotice->Create("notice", "Welcome to LinHES!", readmeText, + NULL, NULL )) mainStack->AddScreen(questionNotice, true); + else + return -1; + + do + { + qApp->processEvents(); + std::this_thread::sleep_for(std::chrono::milliseconds(5)); + } while (mainStack->TotalScreens() > 0); + } else if (bShowquestion) { //LOG(VB_GENERAL, LOG_INFO, QString(question)); - DialogBox *dia = NULL; - QString prompt; - QString *problems = new QString(""); - problems->append("\n"); - problems->append("\n"); - problems->append(question); - dia = new DialogBox(mainWindow, problems->append("\n" )); - dia->AddButton(QObject::tr("Yes")); - dia->AddButton(QObject::tr("No")); - int returncode = 0; - - returncode = dia->exec(); - dia->deleteLater(); - DestroyMythMainWindow(); - delete gContext; - - return returncode; + extern int questionReturnCode; //as extern to be set in questionnotice.cpp + + MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); + QuestionNoticeDialog *questionNotice = new QuestionNoticeDialog(mainStack, + "Question"); + if (questionNotice->Create("question", "Question", question, "Yes", "No")) + mainStack->AddScreen(questionNotice, true); + else + return -1; + + do + { + qApp->processEvents(); + std::this_thread::sleep_for(std::chrono::milliseconds(5)); + } while (mainStack->TotalScreens() > 0); + retval = questionReturnCode; } else { - if (LanguageSelection::prompt(showLang)){ + if (LanguageSelection::prompt(showLang)) + { //taken from reloadTheme mythtv-setup MythTranslation::reload(); GetMythMainWindow()->ReinitDone(); - } MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); WelcomeDialog *welcome = new WelcomeDialog(mainStack, "Welcome"); if (welcome->Create()) - { mainStack->AddScreen(welcome, true); - } else return -1; do { - qApp->processEvents(); - usleep(5000); + std::this_thread::sleep_for(std::chrono::milliseconds(5)); } while (mainStack->TotalScreens() > 0); - - - // DestroyMythMainWindow(); - // delete gContext; - // gContext = NULL; - // delete qApp; - } DestroyMythMainWindow(); - - //gCoreContext->GetSetting("MasterServerIP"); - //gCoreContext->GetSetting("BackendServerIP"); - - - delete gContext; - gContext = NULL ; - //delete qApp; - - return 0; + SignalHandler::Done(); + return retval; } - - diff --git a/abs/core/mythinstall/MythVantage-app/mythinstall/mythinstall.pro b/abs/core/mythinstall/MythVantage-app/mythinstall/mythinstall.pro index f517c43..6405b52 100755 --- a/abs/core/mythinstall/MythVantage-app/mythinstall/mythinstall.pro +++ b/abs/core/mythinstall/MythVantage-app/mythinstall/mythinstall.pro @@ -41,7 +41,7 @@ QMAKE_CLEAN += $(TARGET) //HEADERS += commandlineparser.h //SOURCES += main.cpp commandlineparser.cpp -HEADERS += installdialog.h commandlineparser.h installsettings.h settemplate.h installationtype.h autocard.h xorgsettings.h password_manage.h misc_settings.h mv_common.h infrared.h compat-mv.h supplemental.h vnc.h fileshare.h -SOURCES += main.cpp commandlineparser.cpp installdialog.cpp installsettings.cpp settemplate.cpp installationtype.cpp autocard.cpp xorgsettings.cpp password_manage.cpp misc_settings.cpp infrared.cpp compat-mv.cpp supplemental.cpp vnc.cpp fileshare.cpp +HEADERS += installdialog.h commandlineparser.h installsettings.h settemplate.h installationtype.h xorgsettings.h password_manage.h misc_settings.h mv_common.h infrared.h compat-mv.h supplemental.h vnc.h fileshare.h questionnotice.h +SOURCES += main.cpp commandlineparser.cpp installdialog.cpp installsettings.cpp settemplate.cpp installationtype.cpp xorgsettings.cpp password_manage.cpp misc_settings.cpp infrared.cpp compat-mv.cpp supplemental.cpp vnc.cpp fileshare.cpp questionnotice.cpp QT += sql xml network widgets diff --git a/abs/core/mythinstall/MythVantage-app/mythinstall/questionnotice.cpp b/abs/core/mythinstall/MythVantage-app/mythinstall/questionnotice.cpp new file mode 100755 index 0000000..ffd9a1d --- /dev/null +++ b/abs/core/mythinstall/MythVantage-app/mythinstall/questionnotice.cpp @@ -0,0 +1,134 @@ +// ANSI C +#include <cstdlib> + +// POSIX +#include <unistd.h> + +// qt +#include <QCoreApplication> +#include <QKeyEvent> +#include <QEvent> +#include <QTimer> + +// myth +#include "exitcodes.h" +#include "mythcontext.h" +#include "signalhandling.h" +#include "questionnotice.h" + +int questionReturnCode; + +QuestionNoticeDialog::QuestionNoticeDialog(MythScreenStack *parent, + const char *name) + :MythScreenType(parent, name), + m_title_text(NULL), m_notice_text(NULL), m_question_text(NULL) +{ + gCoreContext->addListener(this); +} + +bool QuestionNoticeDialog::Create(QString questionORnotice, QString title, + QString displayText, QString yesButtonText, + QString noButtonText) +{ + bool foundtheme = false; + + // Load the theme for this screen + foundtheme = LoadWindowFromXML("install-ui.xml", + "questionnotice_screen", this); + + if (!foundtheme) + return false; + + bool err = false; + + UIUtilE::Assign(this, m_title_text, "title", &err); + UIUtilE::Assign(this, m_notice_text, "notice_text", &err); + UIUtilE::Assign(this, m_ok_button, "ok_button", &err); + UIUtilE::Assign(this, m_question_text, "question_text", &err); + UIUtilE::Assign(this, m_yes_button, "yes_button", &err); + UIUtilE::Assign(this, m_no_button, "no_button", &err); + + if (err) + { + LOG(VB_GENERAL, LOG_ERR, "Cannot load screen 'questionnotice_screen'"); + return false; + } + + m_title_text->SetVisible(true); + m_title_text->SetText(title); + + //show the correct text and buttons depending on questionORnotice + if (questionORnotice.contains("notice")) + { + m_notice_text->SetVisible(true); + m_notice_text->SetText(displayText); + m_ok_button->SetVisible(true); + m_question_text->SetVisible(false); + m_yes_button->SetVisible(false); + m_no_button->SetVisible(false); + } + else + { + m_notice_text->SetVisible(false); + m_ok_button->SetVisible(false); + m_question_text->SetVisible(true); + m_question_text->SetText(displayText); + m_yes_button->SetVisible(true); + m_no_button->SetVisible(true); + } + + m_ok_button->SetText("OK"); + connect(m_ok_button, SIGNAL(Clicked()), + this, SLOT(okButtonClick())); + m_yes_button->SetText(yesButtonText); + connect(m_yes_button, SIGNAL(Clicked()), + this, SLOT(yesButtonClick())); + m_no_button->SetText(noButtonText); + connect(m_no_button, SIGNAL(Clicked()), + this, SLOT(noButtonClick())); + + BuildFocusList(); + + return true; +} + +void QuestionNoticeDialog::okButtonClick(void) +{ + // this makes sure the button appears to click properly + QTimer::singleShot(500, this, SLOT(okButton())); +} + +void QuestionNoticeDialog::okButton(void) +{ + questionReturnCode = 0; + Close(); +} + +void QuestionNoticeDialog::yesButtonClick(void) +{ + // this makes sure the button appears to click properly + QTimer::singleShot(500, this, SLOT(yesButton())); +} + +void QuestionNoticeDialog::yesButton(void) +{ + questionReturnCode = 16; + Close(); +} + +void QuestionNoticeDialog::noButtonClick(void) +{ + // this makes sure the button appears to click properly + QTimer::singleShot(500, this, SLOT(noButton())); +} + +void QuestionNoticeDialog::noButton(void) +{ + questionReturnCode = 17; + Close(); +} + +QuestionNoticeDialog::~QuestionNoticeDialog() +{ + gCoreContext->removeListener(this); +} diff --git a/abs/core/mythinstall/MythVantage-app/mythinstall/questionnotice.h b/abs/core/mythinstall/MythVantage-app/mythinstall/questionnotice.h new file mode 100755 index 0000000..f2d05c1 --- /dev/null +++ b/abs/core/mythinstall/MythVantage-app/mythinstall/questionnotice.h @@ -0,0 +1,44 @@ +#ifndef QUESIONNOTICEDIALOG_H_ +#define QUESIONNOTICEDIALOG_H_ + +// qt +#include <QDateTime> + +// libmythui +#include "mythscreentype.h" +#include "mythuibutton.h" +#include "mythuitext.h" +#include "mythdialogbox.h" + +class QuestionNoticeDialog : public MythScreenType +{ + + Q_OBJECT + +public: + QuestionNoticeDialog(MythScreenStack *parent, const char *name); + ~QuestionNoticeDialog(); + + bool Create(QString questionORnotice, QString title, QString displayText, + QString yesButtonText, QString noButtonText); + +protected slots: + void yesButton(void); + void yesButtonClick(void); + void noButton(void); + void noButtonClick(void); + void okButton(void); + void okButtonClick(void); + +private: + // GUI stuff + MythUIText *m_title_text; + MythUIText *m_notice_text; + MythUIButton *m_ok_button; + + MythUIText *m_question_text; + MythUIButton *m_yes_button; + MythUIButton *m_no_button; +}; + +#endif diff --git a/abs/core/mythinstall/MythVantage-app/mythinstall/settemplate.cpp b/abs/core/mythinstall/MythVantage-app/mythinstall/settemplate.cpp index 8d9e671..7201304 100755 --- a/abs/core/mythinstall/MythVantage-app/mythinstall/settemplate.cpp +++ b/abs/core/mythinstall/MythVantage-app/mythinstall/settemplate.cpp @@ -32,8 +32,9 @@ void restart_frontend () cmdtxt=MV_ROOT ; cmdtxt.append("bin/systemconfig.sh reloadfe" ); //cout << "Calling systemconfig.sh reloadfe" << endl; - system(qPrintable(cmdtxt)); - //system("/root/systemconfig.sh reloadfe" ); + int sysRet = system(qPrintable(cmdtxt)); + if (sysRet < 0) + LOG(VB_GENERAL, LOG_ERR, "Error running systemconfig.sh reloadfe"); } void choosetemplate (QString templateop, QString templatename , QString templatehostname = "") diff --git a/abs/core/mythinstall/MythVantage-app/mythinstall/xorgsettings.h b/abs/core/mythinstall/MythVantage-app/mythinstall/xorgsettings.h index 88f202c..ad62564 100755 --- a/abs/core/mythinstall/MythVantage-app/mythinstall/xorgsettings.h +++ b/abs/core/mythinstall/MythVantage-app/mythinstall/xorgsettings.h @@ -109,7 +109,6 @@ static HostComboBox *HostXres() gc->addSelection("Auto") ; gc->setHelpText(QObject::tr("")); system ("print_xorg_res.py"); - QFile file("/tmp/modelines"); QString line; if ( file.open(QIODevice::ReadOnly | QIODevice::Text) ) diff --git a/abs/core/mythinstall/PKGBUILD b/abs/core/mythinstall/PKGBUILD index 73c44fe..64486cd 100644 --- a/abs/core/mythinstall/PKGBUILD +++ b/abs/core/mythinstall/PKGBUILD @@ -1,10 +1,10 @@ # Maintainer: Jams pkgname=mythinstall -pkgver=8.5 +pkgver=8.5.1 pkgrel=2 pkgdesc="LinHES installer/systemconfig GUI." arch=('i686' 'x86_64') -depends=('mythtv>=29') +depends=('mythtv>=29' 'LinHES-config') makedepends=('mythtv>=29') logofiles=`ls logo*.png` source=('install-ui.xml' $logofiles) @@ -33,7 +33,7 @@ package() { done } -md5sums=('39d6b7bd1ee305c5523a3cf66d4c2338' +md5sums=('20d45199b7642c42cb60c6ce36331f5a' 'c4c26977b723a4b5d6435ede73051d1b' '27ce7f89a83864dfc5abe23c61964c0c' '3291ad55fe6d7884fc732313f1cc2924' diff --git a/abs/core/mythinstall/install-ui.xml b/abs/core/mythinstall/install-ui.xml index 45b5404..be0e935 100755 --- a/abs/core/mythinstall/install-ui.xml +++ b/abs/core/mythinstall/install-ui.xml @@ -147,4 +147,44 @@ </window> + + <window name="questionnotice_screen"> + + <textarea name="title" from="basetextarea"> + <area>50,10,700,40</area> + <align>allcenter</align> + <value></value> + </textarea> + + <textarea name="notice_text" from="basetextarea"> + <multiline>yes</multiline> + <area>20,60,760,460</area> + <value></value> + <align>allcenter</align> + </textarea> + + <textarea name="question_text" from="basetextarea"> + <multiline>yes</multiline> + <area>20,60,760,460</area> + <value></value> + <align>allcenter</align> + </textarea> + + <button name="yes_button" from="basebutton"> + <position>20,540</position> + <value></value> + </button> + + <button name="ok_button" from="basebutton"> + <position>320,540</position> + <value>OK</value> + </button> + + <button name="no_button" from="basebutton"> + <position>630,540</position> + <value></value> + </button> + + </window> + </mythuitheme> |