diff options
author | Britney Fransen <brfransen@gmail.com> | 2017-12-20 16:46:31 (GMT) |
---|---|---|
committer | Britney Fransen <brfransen@gmail.com> | 2017-12-20 16:46:31 (GMT) |
commit | efee56822326dbb2e0cf40a8316212223b909229 (patch) | |
tree | 59ef37adeb37fd67f1dcb3deaf91bd6fe02209a5 /abs | |
parent | f0aab56ffb3976db3189ad94aea7c3c7fe341906 (diff) | |
download | linhes_pkgbuild-efee56822326dbb2e0cf40a8316212223b909229.zip linhes_pkgbuild-efee56822326dbb2e0cf40a8316212223b909229.tar.gz linhes_pkgbuild-efee56822326dbb2e0cf40a8316212223b909229.tar.bz2 |
mythinstall: port mythtv-setup screen and reboot screen to MythUI.
add check for more system call failures
use the BusyPopup for configure
Diffstat (limited to 'abs')
12 files changed, 260 insertions, 301 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 a067f98..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" @@ -36,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 = ""; @@ -57,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) @@ -103,11 +99,15 @@ void WelcomeDialog::shutdownNow(int rc) // system("rm -f /tmp/.install_percent"); // system("rm -f /tmp/.install_error"); if (rc == 1) + { if(!system("/sbin/halt")) LOG(VB_GENERAL, LOG_ERR, "Error running halt"); + } else + { if(!system("/sbin/reboot")) LOG(VB_GENERAL, LOG_ERR, "Error running reboot"); + } } void WelcomeDialog::runLIVECD(void) @@ -125,8 +125,6 @@ void WelcomeDialog::runLIVECD(void) { showPopup(); } - - } bool WelcomeDialog::keyPressEvent(QKeyEvent *event) @@ -160,8 +158,7 @@ bool WelcomeDialog::keyPressEvent(QKeyEvent *event) // QByteArray tmp = cmd.toAscii(); // QByteArray tmp = cmd; // system(tmp); - if(!system(qPrintable(cmd))) - LOG(VB_GENERAL, LOG_ERR, "Error running MythShutdownXTermCMD"); + myth_system(qPrintable(cmd)); } } else @@ -230,8 +227,9 @@ void WelcomeDialog::updateScreen(void) QString cmdtxt; cmdtxt=MV_ROOT ; cmdtxt.append("bin/install_proxy.sh " ); - if(!system(qPrintable(cmdtxt))) - LOG(VB_GENERAL, LOG_ERR, "Error running install_proxy.sh"); + 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=" "; @@ -278,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); @@ -285,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(); } @@ -391,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"); @@ -420,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())); @@ -515,7 +453,7 @@ QString WelcomeDialog::diskmodel(QString drive , QString tsize) return qline; } -QString WelcomeDialog::findinstallsouce(void) +QString WelcomeDialog::findinstallsource(void) { string line; QString currentitem; @@ -542,6 +480,7 @@ QString WelcomeDialog::findinstallsouce(void) return currentitem; }; } + return NULL; }; void WelcomeDialog::showPopup_2(void) @@ -566,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()) { @@ -633,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; - int returncode = 0; - DialogCode dcode = reboot_box->exec(); - reboot_box->deleteLater(); - if (kDialogCodeButton0 == dcode ) + 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; + + 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); } @@ -672,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(); } @@ -869,7 +809,8 @@ void WelcomeDialog::install_generic(void) QString cmdtxt; cmdtxt=MV_ROOT ; cmdtxt.append("bin/install_proxy.sh find_update " + install_drive +" &"); - if(!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; @@ -955,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()) @@ -969,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"); } @@ -981,9 +922,6 @@ void busy_network(void) busyPopup->Close(); busyPopup = NULL; } - - - } @@ -1000,28 +938,62 @@ 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 &"); + cmdtxt=MV_ROOT; + cmdtxt.append("bin/install_proxy.sh network_check_it setup_network"); retval = system(qPrintable(cmdtxt)); - busy_network(); + + //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."; - } + 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)); if ( retval != 0 ) @@ -1034,7 +1006,9 @@ 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)); if ( retval != 0 ) @@ -1047,7 +1021,9 @@ 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)); if ( retval != 0 ) @@ -1060,7 +1036,9 @@ 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)); if ( retval != 0 ) @@ -1070,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) { @@ -1077,7 +1060,7 @@ int WelcomeDialog::ask_validate_network(void) network_check->deleteLater(); } - if (retval != 0 ) + if ( retval != 0 ) { DialogCode val = MythPopupBox::Show2ButtonPopup( GetMythMainWindow(), @@ -1085,7 +1068,7 @@ int WelcomeDialog::ask_validate_network(void) tr("Continue"), tr("Try Again"), kDialogCodeButton0); - if (kDialogCodeButton0 == val ) + if ( kDialogCodeButton0 == val ) retval = 0; } } @@ -1096,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; @@ -1143,32 +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 &"); - if(!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 &"); - if(!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") { @@ -1185,20 +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); - if(!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 &"); - if(!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 51cce48..5c2e128 100755 --- a/abs/core/mythinstall/MythVantage-app/mythinstall/main.cpp +++ b/abs/core/mythinstall/MythVantage-app/mythinstall/main.cpp @@ -3,7 +3,6 @@ #include "installdialog.h" #include "installsettings.h" #include "password_manage.h" -#include "autocard.h" #include "settemplate.h" #include "questionnotice.h" @@ -33,7 +32,6 @@ #include "lcddevice.h" #include "commandlineparser.h" #include "mythlogging.h" -#include "dialogbox.h" #include "signalhandling.h" // libmythui @@ -100,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); @@ -293,7 +291,8 @@ int main(int argc, char **argv) gCoreContext->ActivateSettingsCache(false); gCoreContext->ClearSettingsCache(); bool runconfig = false; - if (!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"); @@ -384,7 +383,8 @@ int main(int argc, char **argv) runconfig = true; } } - if (!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 @@ -397,7 +397,8 @@ 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); - if (!system(qPrintable(cmdtxt))) + sysRet=system(qPrintable(cmdtxt)); + if (sysRet < 0) LOG(VB_GENERAL, LOG_ERR, "Could not save settings"); if ( status != 0 ) @@ -413,7 +414,8 @@ int main(int argc, char **argv) QString cmdtxt; cmdtxt=MV_ROOT; cmdtxt.append("bin/myth_settings_wrapper.sh -c save -t syssettings -d " + olddb ) ; - if (!system(qPrintable(cmdtxt))) + int sysRet=system(qPrintable(cmdtxt)); + if (sysRet < 0) LOG(VB_GENERAL, LOG_ERR, "Could not save settings"); } @@ -431,42 +433,45 @@ int main(int argc, char **argv) QString dbcommand = cmdtxt; dbcommand.append(newdb); run_systemconfig(modulelist,restart,dbcommand); - - - } - if (!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->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" ); - if (!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) @@ -487,49 +492,47 @@ 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) { QString line; @@ -552,8 +555,8 @@ int main(int argc, char **argv) MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); QuestionNoticeDialog *questionNotice = new QuestionNoticeDialog(mainStack, "Notice"); - if (questionNotice->Create("notice", "LinHES Help", LH_HelpText)) - mainStack->AddScreen(questionNotice, true); + if (questionNotice->Create("notice", "LinHES Help", LH_HelpText, + NULL, NULL)) mainStack->AddScreen(questionNotice, true); else return -1; @@ -586,8 +589,8 @@ int main(int argc, char **argv) MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); QuestionNoticeDialog *questionNotice = new QuestionNoticeDialog(mainStack, "Notice"); - if (questionNotice->Create("notice", "Welcome to LinHES!", readmeText)) - mainStack->AddScreen(questionNotice, true); + if (questionNotice->Create("notice", "Welcome to LinHES!", readmeText, + NULL, NULL )) mainStack->AddScreen(questionNotice, true); else return -1; @@ -605,7 +608,7 @@ int main(int argc, char **argv) MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); QuestionNoticeDialog *questionNotice = new QuestionNoticeDialog(mainStack, "Question"); - if (questionNotice->Create("question", "Question", question)) + if (questionNotice->Create("question", "Question", question, "Yes", "No")) mainStack->AddScreen(questionNotice, true); else return -1; diff --git a/abs/core/mythinstall/MythVantage-app/mythinstall/mythinstall.pro b/abs/core/mythinstall/MythVantage-app/mythinstall/mythinstall.pro index 8dd6855..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 questionnotice.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 questionnotice.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 index 529be89..ffd9a1d 100755 --- a/abs/core/mythinstall/MythVantage-app/mythinstall/questionnotice.cpp +++ b/abs/core/mythinstall/MythVantage-app/mythinstall/questionnotice.cpp @@ -27,7 +27,8 @@ QuestionNoticeDialog::QuestionNoticeDialog(MythScreenStack *parent, } bool QuestionNoticeDialog::Create(QString questionORnotice, QString title, - QString displayText) + QString displayText, QString yesButtonText, + QString noButtonText) { bool foundtheme = false; @@ -56,9 +57,6 @@ bool QuestionNoticeDialog::Create(QString questionORnotice, QString title, m_title_text->SetVisible(true); m_title_text->SetText(title); - //LOG(VB_GENERAL, LOG_INFO, QString(questionORnotice)); - //LOG(VB_GENERAL, LOG_INFO, QString(displayText)); - //show the correct text and buttons depending on questionORnotice if (questionORnotice.contains("notice")) { @@ -79,13 +77,13 @@ bool QuestionNoticeDialog::Create(QString questionORnotice, QString title, m_no_button->SetVisible(true); } - m_ok_button->SetText(tr("OK")); + m_ok_button->SetText("OK"); connect(m_ok_button, SIGNAL(Clicked()), this, SLOT(okButtonClick())); - m_yes_button->SetText(tr("Yes")); + m_yes_button->SetText(yesButtonText); connect(m_yes_button, SIGNAL(Clicked()), this, SLOT(yesButtonClick())); - m_no_button->SetText(tr("No")); + m_no_button->SetText(noButtonText); connect(m_no_button, SIGNAL(Clicked()), this, SLOT(noButtonClick())); diff --git a/abs/core/mythinstall/MythVantage-app/mythinstall/questionnotice.h b/abs/core/mythinstall/MythVantage-app/mythinstall/questionnotice.h index a2c2c79..f2d05c1 100755 --- a/abs/core/mythinstall/MythVantage-app/mythinstall/questionnotice.h +++ b/abs/core/mythinstall/MythVantage-app/mythinstall/questionnotice.h @@ -19,7 +19,8 @@ public: QuestionNoticeDialog(MythScreenStack *parent, const char *name); ~QuestionNoticeDialog(); - bool Create(QString questionORnotice, QString title, QString displayText); + bool Create(QString questionORnotice, QString title, QString displayText, + QString yesButtonText, QString noButtonText); protected slots: void yesButton(void); 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/PKGBUILD b/abs/core/mythinstall/PKGBUILD index c51cbe5..64486cd 100644 --- a/abs/core/mythinstall/PKGBUILD +++ b/abs/core/mythinstall/PKGBUILD @@ -1,7 +1,7 @@ # Maintainer: Jams pkgname=mythinstall pkgver=8.5.1 -pkgrel=1 +pkgrel=2 pkgdesc="LinHES installer/systemconfig GUI." arch=('i686' 'x86_64') depends=('mythtv>=29' 'LinHES-config') @@ -33,7 +33,7 @@ package() { done } -md5sums=('4e587d53e64cb9cda12b0133a1fe1831' +md5sums=('20d45199b7642c42cb60c6ce36331f5a' 'c4c26977b723a4b5d6435ede73051d1b' '27ce7f89a83864dfc5abe23c61964c0c' '3291ad55fe6d7884fc732313f1cc2924' diff --git a/abs/core/mythinstall/install-ui.xml b/abs/core/mythinstall/install-ui.xml index 4c51ce9..be0e935 100755 --- a/abs/core/mythinstall/install-ui.xml +++ b/abs/core/mythinstall/install-ui.xml @@ -172,7 +172,7 @@ <button name="yes_button" from="basebutton"> <position>20,540</position> - <value>Yes</value> + <value></value> </button> <button name="ok_button" from="basebutton"> @@ -182,7 +182,7 @@ <button name="no_button" from="basebutton"> <position>630,540</position> - <value>No</value> + <value></value> </button> </window> |