summaryrefslogtreecommitdiffstats
path: root/abs/core/mythinstall/MythVantage-app/mythinstall/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'abs/core/mythinstall/MythVantage-app/mythinstall/main.cpp')
-rwxr-xr-xabs/core/mythinstall/MythVantage-app/mythinstall/main.cpp161
1 files changed, 82 insertions, 79 deletions
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;