diff --git a/mythtv/libs/libmyth/guistartup.cpp b/mythtv/libs/libmyth/guistartup.cpp
index d0636b8..1d7eea0 100644
a
|
b
|
void GUIStartup::setTotal(int total) |
157 | 157 | m_Retry = false; |
158 | 158 | } |
159 | 159 | |
| 160 | void GUIStartup::setRetryButtonText(const QString text) |
| 161 | { |
| 162 | m_retryButton->SetText(text); |
| 163 | } |
| 164 | |
160 | 165 | // return = true if time is up |
161 | | bool GUIStartup::updateProgress(bool finished) |
| 166 | bool GUIStartup::updateProgress(bool finished, bool reset) |
162 | 167 | { |
163 | 168 | if (m_progressTimer) |
164 | 169 | { |
… |
… |
bool GUIStartup::updateProgress(bool finished) |
167 | 172 | elapsed = m_total; |
168 | 173 | else |
169 | 174 | elapsed = m_progressTimer->elapsed(); |
170 | | m_progressBar->SetUsed(elapsed); |
| 175 | if (reset) |
| 176 | m_progressBar->SetUsed(0); |
| 177 | else |
| 178 | m_progressBar->SetUsed(elapsed); |
171 | 179 | if (elapsed >= m_total) |
172 | 180 | { |
173 | 181 | m_timer.stop(); |
diff --git a/mythtv/libs/libmyth/guistartup.h b/mythtv/libs/libmyth/guistartup.h
index 27baa26..46e05fb 100644
a
|
b
|
class MPUBLIC GUIStartup : public MythScreenType |
62 | 62 | bool setStatusState(const QString &name); |
63 | 63 | bool setMessageState(const QString &name); |
64 | 64 | void setTotal(int total); |
| 65 | void setRetryButtonText(const QString text); |
65 | 66 | |
66 | 67 | public slots: |
67 | | bool updateProgress(bool finished = false); |
| 68 | bool updateProgress(bool finished = false, bool reset = false); |
68 | 69 | |
69 | 70 | private slots: |
70 | 71 | void Retry(void); |
diff --git a/mythtv/libs/libmyth/mythcontext.cpp b/mythtv/libs/libmyth/mythcontext.cpp
index 4b6680a..d4ccbdd 100644
a
|
b
|
class MythContextPrivate : public QObject |
70 | 70 | |
71 | 71 | bool Init (const bool gui, |
72 | 72 | const bool prompt, const bool noPrompt, |
73 | | const bool ignoreDB); |
| 73 | const bool ignoreDB, |
| 74 | const bool bWaitBeforeConnect); |
74 | 75 | bool FindDatabase(const bool prompt, const bool noPrompt); |
75 | 76 | |
76 | 77 | void TempMainWindow(bool languagePrompt = true); |
… |
… |
class MythContextPrivate : public QObject |
128 | 129 | QEventLoop *m_loop; |
129 | 130 | bool needsBackend; |
130 | 131 | bool m_settingsCacheDirty; |
| 132 | bool m_bWaitBeforeConnect; |
131 | 133 | |
132 | 134 | private: |
133 | 135 | MythConfirmationDialog *MBEversionPopup; |
… |
… |
MythContextPrivate::MythContextPrivate(MythContext *lparent) |
243 | 245 | m_guiStartup(0), |
244 | 246 | needsBackend(false), |
245 | 247 | m_settingsCacheDirty(false), |
| 248 | m_bWaitBeforeConnect(false), |
246 | 249 | MBEversionPopup(NULL), |
247 | 250 | m_registration(-1), |
248 | 251 | m_socket(0) |
… |
… |
bool MythContextPrivate::checkPort(QString &host, int port, int timeLimit) |
343 | 346 | bool MythContextPrivate::Init(const bool gui, |
344 | 347 | const bool promptForBackend, |
345 | 348 | const bool noPrompt, |
346 | | const bool ignoreDB) |
| 349 | const bool ignoreDB, |
| 350 | const bool bWaitBeforeConnect) |
347 | 351 | { |
348 | 352 | gCoreContext->GetDB()->IgnoreDatabase(ignoreDB); |
349 | 353 | m_gui = gui; |
| 354 | m_bWaitBeforeConnect = bWaitBeforeConnect; |
350 | 355 | |
351 | 356 | if (gCoreContext->IsFrontend()) |
352 | 357 | needsBackend = true; |
… |
… |
QString MythContextPrivate::TestDBconnection(bool prompt) |
797 | 802 | st_dbConnects = 3, |
798 | 803 | st_beWOL = 4, |
799 | 804 | st_beAwake = 5, |
800 | | st_success = 6 |
| 805 | st_success = 6, |
| 806 | st_wait = 7 |
801 | 807 | } startupState = st_start; |
802 | 808 | |
803 | | static const QString guiStatuses[7] = |
| 809 | static const QString guiStatuses[8] = |
804 | 810 | {"start","dbAwake","dbStarted","dbConnects","beWOL","beAwake", |
805 | | "success" }; |
| 811 | "success","wait" }; |
| 812 | |
| 813 | bool waitForUser = m_bWaitBeforeConnect; |
806 | 814 | |
807 | 815 | do |
808 | 816 | { |
809 | | host = m_DBparams.dbHostName; |
| 817 | if (m_DBparams.dbHostName.isEmpty() && m_DBhostCp.length()) |
| 818 | host = m_DBhostCp; |
| 819 | else |
| 820 | host = m_DBparams.dbHostName; |
810 | 821 | port = m_DBparams.dbPort; |
811 | 822 | if (port == 0) |
812 | 823 | port = 3306; |
813 | 824 | int wakeupTime = 3; |
814 | 825 | int attempts = 11; |
815 | | if (m_DBparams.wolEnabled) { |
816 | | wakeupTime = m_DBparams.wolReconnect; |
817 | | attempts = m_DBparams.wolRetry + 1; |
818 | | startupState = st_start; |
| 826 | if (waitForUser) |
| 827 | { |
| 828 | startupState = st_wait; |
| 829 | ShowGuiStartup(); |
| 830 | if (m_guiStartup) |
| 831 | //: Text for Start button - to start connecting to backend |
| 832 | m_guiStartup->setRetryButtonText(QObject::tr("Start")); |
819 | 833 | } |
820 | 834 | else |
821 | | startupState = st_dbAwake; |
| 835 | { |
| 836 | if (m_guiStartup) |
| 837 | //: Text for Retry button - to try again connecting to backend |
| 838 | m_guiStartup->setRetryButtonText(QObject::tr("Retry")); |
| 839 | if (m_DBparams.wolEnabled) { |
| 840 | wakeupTime = m_DBparams.wolReconnect; |
| 841 | attempts = m_DBparams.wolRetry + 1; |
| 842 | startupState = st_start; |
| 843 | } |
| 844 | else |
| 845 | startupState = st_dbAwake; |
| 846 | } |
822 | 847 | if (attempts < 6) |
823 | 848 | attempts = 6; |
824 | 849 | if (!prompt) |
… |
… |
QString MythContextPrivate::TestDBconnection(bool prompt) |
837 | 862 | QString masterserver; |
838 | 863 | |
839 | 864 | for (int attempt = 0; |
840 | | attempt < attempts && startupState != st_success; |
| 865 | attempt < attempts && startupState != st_success |
| 866 | && startupState != st_wait; |
841 | 867 | ++attempt) |
842 | 868 | { |
843 | 869 | // The first time do everything with minimum timeout and |
… |
… |
QString MythContextPrivate::TestDBconnection(bool prompt) |
962 | 988 | break; |
963 | 989 | |
964 | 990 | QString stateMsg = guiStatuses[startupState]; |
965 | | stateMsg.append("Fail"); |
966 | | LOG(VB_GENERAL, LOG_INFO, |
967 | | QString("Start up failure. host %1, status %2") |
968 | | .arg(host).arg(stateMsg)); |
969 | | |
| 991 | if (startupState != st_wait) |
| 992 | { |
| 993 | stateMsg.append("Fail"); |
| 994 | LOG(VB_GENERAL, LOG_INFO, |
| 995 | QString("Start up failure. host %1, status %2") |
| 996 | .arg(host).arg(stateMsg)); |
| 997 | } |
970 | 998 | if (m_guiStartup |
971 | 999 | && !m_guiStartup->m_Exit |
972 | 1000 | && !m_guiStartup->m_Setup |
973 | 1001 | && !m_guiStartup->m_Search |
974 | 1002 | && !m_guiStartup->m_Retry) |
975 | 1003 | { |
976 | | m_guiStartup->updateProgress(true); |
| 1004 | m_guiStartup->updateProgress(true, waitForUser); |
977 | 1005 | m_guiStartup->setStatusState(stateMsg); |
978 | 1006 | m_guiStartup->setMessageState("makeselection"); |
979 | 1007 | m_loop->exec(); |
| 1008 | waitForUser = false; |
980 | 1009 | } |
981 | 1010 | } |
982 | 1011 | while (m_guiStartup && m_guiStartup->m_Retry); |
… |
… |
QString MythContextPrivate::TestDBconnection(bool prompt) |
1002 | 1031 | return QObject::tr("Cannot connect to backend", "Backend Setup"); |
1003 | 1032 | } |
1004 | 1033 | |
| 1034 | if (startupState == st_wait) |
| 1035 | { |
| 1036 | return QObject::tr("User requested exit", "Backend Setup"); |
| 1037 | } |
| 1038 | |
| 1039 | |
1005 | 1040 | // Current DB connection may have been silenced (invalid): |
1006 | 1041 | EnableDBerrors(); |
1007 | 1042 | ResetDatabase(); |
… |
… |
void MythContextPrivate::ShowVersionMismatchPopup(uint remote_version) |
1407 | 1442 | // return true if progress is 100% |
1408 | 1443 | void MythContextPrivate::processEvents(void) |
1409 | 1444 | { |
1410 | | // bool ret = false; |
1411 | | // if (m_guiStartup) |
1412 | | // ret = m_guiStartup->updateProgress(); |
1413 | 1445 | qApp->processEvents(QEventLoop::AllEvents, 250); |
1414 | 1446 | qApp->processEvents(QEventLoop::AllEvents, 250); |
1415 | | // return ret; |
1416 | 1447 | } |
1417 | 1448 | |
1418 | 1449 | // cache some settings in cache/contextcache.xml |
… |
… |
MythContext::MythContext(const QString &binversion, bool needsBackend) |
1517 | 1548 | bool MythContext::Init(const bool gui, |
1518 | 1549 | const bool promptForBackend, |
1519 | 1550 | const bool disableAutoDiscovery, |
1520 | | const bool ignoreDB) |
| 1551 | const bool ignoreDB, |
| 1552 | const bool bWaitBeforeConnect) |
1521 | 1553 | { |
1522 | 1554 | SetDisableEventPopup(true); |
1523 | 1555 | |
… |
… |
bool MythContext::Init(const bool gui, |
1582 | 1614 | return false; |
1583 | 1615 | } |
1584 | 1616 | |
1585 | | if (!d->Init(gui, promptForBackend, disableAutoDiscovery, ignoreDB)) |
| 1617 | if (!d->Init(gui, promptForBackend, disableAutoDiscovery, ignoreDB, bWaitBeforeConnect)) |
1586 | 1618 | { |
1587 | 1619 | return false; |
1588 | 1620 | } |
diff --git a/mythtv/libs/libmyth/mythcontext.h b/mythtv/libs/libmyth/mythcontext.h
index 8bc4f86..7cf9e83 100644
a
|
b
|
class MPUBLIC MythContext |
48 | 48 | bool Init(const bool gui = true, |
49 | 49 | const bool promptForBackend = false, |
50 | 50 | const bool bypassAutoDiscovery = false, |
51 | | const bool ignoreDB = false); |
| 51 | const bool ignoreDB = false, |
| 52 | const bool bWaitBeforeConnect = false); |
52 | 53 | |
53 | 54 | DatabaseParams GetDatabaseParams(void); |
54 | 55 | bool SaveDatabaseParams(const DatabaseParams ¶ms); |
diff --git a/mythtv/programs/mythfrontend/commandlineparser.cpp b/mythtv/programs/mythfrontend/commandlineparser.cpp
index 0173ed0..f4aaa2c 100644
a
|
b
|
void MythFrontendCommandLineParser::LoadArguments(void) |
27 | 27 | "noautodiscovery", false, |
28 | 28 | "Prevent frontend from using UPnP autodiscovery.", ""); |
29 | 29 | |
| 30 | add("--wait", "wait", "", |
| 31 | "Wait at the Welcome screen for the user before connecting.", |
| 32 | "Stop at the welcome screen before connecting to " |
| 33 | "database or backend.\nWait for the user to select " |
| 34 | "the Startup button to start frontend.") |
| 35 | ->SetGroup("Startup Behavior"); |
30 | 36 | add("--jumppoint", "jumppoint", "", |
31 | 37 | "Start the frontend at specified jump point.", "") |
32 | 38 | ->SetGroup("Startup Behavior"); |
diff --git a/mythtv/programs/mythfrontend/main.cpp b/mythtv/programs/mythfrontend/main.cpp
index f3b1741..9eee926 100644
a
|
b
|
int main(int argc, char **argv) |
1766 | 1766 | { |
1767 | 1767 | bool bPromptForBackend = false; |
1768 | 1768 | bool bBypassAutoDiscovery = false; |
| 1769 | bool bWaitBeforeConnect = false; |
1769 | 1770 | |
1770 | 1771 | #if CONFIG_OMX_RPI |
1771 | 1772 | setenv("QT_XCB_GL_INTEGRATION","none",0); |
… |
… |
int main(int argc, char **argv) |
1855 | 1856 | bPromptForBackend = true; |
1856 | 1857 | if (cmdline.toBool("noautodiscovery")) |
1857 | 1858 | bBypassAutoDiscovery = true; |
| 1859 | if (cmdline.toBool("wait")) |
| 1860 | bWaitBeforeConnect = true; |
1858 | 1861 | |
1859 | 1862 | if (signal(SIGPIPE, SIG_IGN) == SIG_ERR) |
1860 | 1863 | cerr << "Unable to ignore SIGPIPE\n"; |
… |
… |
int main(int argc, char **argv) |
1872 | 1875 | gContext = new MythContext(MYTH_BINARY_VERSION, true); |
1873 | 1876 | gCoreContext->SetAsFrontend(true); |
1874 | 1877 | |
1875 | | if (!gContext->Init(true, bPromptForBackend, bBypassAutoDiscovery)) |
| 1878 | if (!gContext->Init(true, bPromptForBackend, bBypassAutoDiscovery, false, bWaitBeforeConnect)) |
1876 | 1879 | { |
1877 | 1880 | LOG(VB_GENERAL, LOG_ERR, "Failed to init MythContext, exiting."); |
1878 | 1881 | return GENERIC_EXIT_NO_MYTHCONTEXT; |
diff --git a/mythtv/themes/default/config-ui.xml b/mythtv/themes/default/config-ui.xml
index 61b4589..8b183a1 100644
a
|
b
|
|
897 | 897 | <value>Unable to connect to master backend.</value> |
898 | 898 | </textarea> |
899 | 899 | </state> |
| 900 | <state name="wait" from="start"> |
| 901 | <textarea name="status"> |
| 902 | <value>Select Start to open MythFrontend.</value> |
| 903 | </textarea> |
| 904 | </state> |
900 | 905 | </statetype> |
901 | 906 | |
902 | 907 | <statetype name="messagestate"> |
… |
… |
|
945 | 950 | <button name="retry" from="basebutton"> |
946 | 951 | <position>5%,88%</position> |
947 | 952 | <value>Retry</value> |
948 | | <helptext>Try again to establish connections.</helptext> |
| 953 | <helptext>Establish connections and continue to startup.</helptext> |
949 | 954 | </button> |
950 | 955 | |
951 | 956 | <button name="search" from="retry"> |