@@ -52,11 +52,8 @@ QStringList SplitWarnings(const QString& warnings)
5252 return result;
5353}
5454
55- QString RuntimeDialogTitle (const QString& caption, unsigned int style)
55+ QString RuntimeDialogTitle (unsigned int style)
5656{
57- if (!caption.isEmpty ()) {
58- return caption;
59- }
6057 if (style & CClientUIInterface::ICON_ERROR ) {
6158 return QObject::tr (" Error" );
6259 }
@@ -386,7 +383,7 @@ void NodeModel::showStartupWarnings()
386383 const QString warnings{m_startup_warning_messages.join (QStringLiteral (" \n\n " ))};
387384 m_startup_warning_messages.clear ();
388385 // MSG_WARNING is modal; startup notices should be shown once without blocking initialization.
389- showRuntimeDialogOnGuiThread (warnings, QString{}, CClientUIInterface::ICON_WARNING , /* question=*/ false );
386+ showRuntimeDialogOnGuiThread (warnings, CClientUIInterface::ICON_WARNING , /* question=*/ false );
390387}
391388
392389void NodeModel::recordStartupErrorMessage (const QString& message)
@@ -567,20 +564,16 @@ void NodeModel::ConnectToRuntimeDialogSignals()
567564 assert (!m_handler_question);
568565
569566 m_handler_message_box = m_node.handleMessageBox (
570- [this ](const bilingual_str& message, const std::string& caption, unsigned int style) {
571- return showRuntimeDialog (
567+ [this ](const bilingual_str& message, unsigned int style) {
568+ showRuntimeMessageBox (
572569 QString::fromStdString (message.translated ),
573- QString::fromStdString (caption),
574- style,
575- /* question=*/ false );
570+ style);
576571 });
577572 m_handler_question = m_node.handleQuestion (
578- [this ](const bilingual_str& message, [[maybe_unused]] const std::string& non_interactive_message, const std::string& caption, unsigned int style) {
579- return showRuntimeDialog (
573+ [this ](const bilingual_str& message, [[maybe_unused]] const std::string& non_interactive_message, unsigned int style) {
574+ return showRuntimeQuestion (
580575 QString::fromStdString (message.translated ),
581- QString::fromStdString (caption),
582- style,
583- /* question=*/ true );
576+ style);
584577 });
585578}
586579
@@ -658,7 +651,7 @@ QVariantList NodeModel::nodeInformationRows()
658651 rows.push_back (InformationRow (tr (" User agent" ), QString::fromStdString (strSubVersion)));
659652 rows.push_back (InformationRow (tr (" Datadir" ), QString::fromStdString (fs::PathToString (gArgs .GetDataDirNet ()))));
660653 rows.push_back (InformationRow (tr (" Blocks dir" ), QString::fromStdString (fs::PathToString (gArgs .GetBlocksDirPath ()))));
661- rows.push_back (InformationRow (tr (" Startup time" ), QDateTime::fromSecsSinceEpoch ( GetStartupTime ( )).toString ()));
654+ rows.push_back (InformationRow (tr (" Startup time" ), QDateTime::currentDateTime (). addSecs (- TicksSeconds ( GetUptime () )).toString ()));
662655 rows.push_back (InformationRow (tr (" Network" ), QString::fromStdString (Params ().GetChainTypeString ())));
663656 rows.push_back (InformationRow (tr (" Block height" ), QString::number (block_height)));
664657 rows.push_back (InformationRow (tr (" Header height" ), QString::number (header_height)));
@@ -672,27 +665,39 @@ QVariantList NodeModel::nodeInformationRows()
672665 return rows;
673666}
674667
675- bool NodeModel::showRuntimeDialog (const QString& message, const QString& caption, unsigned int style, bool question )
668+ void NodeModel::showRuntimeMessageBox (const QString& message, unsigned int style)
676669{
677670 if (QThread::currentThread () == thread ()) {
678- return showRuntimeDialogOnGuiThread (message, caption, style, question);
671+ showRuntimeDialogOnGuiThread (message, style, /* question=*/ false );
672+ return ;
679673 }
680674
681- if (!(style & CClientUIInterface::MODAL ) && !question ) {
682- QMetaObject::invokeMethod (this , [this , message, caption, style, question ] {
683- showRuntimeDialogOnGuiThread (message, caption, style, question);
675+ if (!(style & CClientUIInterface::MODAL )) {
676+ QMetaObject::invokeMethod (this , [this , message, style] {
677+ showRuntimeDialogOnGuiThread (message, style, /* question= */ false );
684678 }, Qt::QueuedConnection);
685- return false ;
679+ return ;
680+ }
681+
682+ QMetaObject::invokeMethod (this , [this , message, style] {
683+ showRuntimeDialogOnGuiThread (message, style, /* question=*/ false );
684+ }, Qt::BlockingQueuedConnection);
685+ }
686+
687+ bool NodeModel::showRuntimeQuestion (const QString& message, unsigned int style)
688+ {
689+ if (QThread::currentThread () == thread ()) {
690+ return showRuntimeDialogOnGuiThread (message, style, /* question=*/ true );
686691 }
687692
688693 bool result{false };
689- QMetaObject::invokeMethod (this , [this , &result, message, caption, style, question ] {
690- result = showRuntimeDialogOnGuiThread (message, caption, style, question);
694+ QMetaObject::invokeMethod (this , [this , &result, message, style] {
695+ result = showRuntimeDialogOnGuiThread (message, style, /* question= */ true );
691696 }, Qt::BlockingQueuedConnection);
692697 return result;
693698}
694699
695- bool NodeModel::showRuntimeDialogOnGuiThread (const QString& message, const QString& caption, unsigned int style, bool question)
700+ bool NodeModel::showRuntimeDialogOnGuiThread (const QString& message, unsigned int style, bool question)
696701{
697702 if (!m_runtime_dialogs_enabled && !question) {
698703 if (style & CClientUIInterface::ICON_WARNING ) {
@@ -710,7 +715,6 @@ bool NodeModel::showRuntimeDialogOnGuiThread(const QString& message, const QStri
710715 const bool blocking{(style & CClientUIInterface::MODAL ) || question};
711716 auto request{std::make_shared<RuntimeDialogRequest>()};
712717 request->message = message;
713- request->caption = caption;
714718 request->style = style;
715719 request->question = question;
716720 if (!m_runtime_dialogs_enabled && (question || (style & CClientUIInterface::ICON_ERROR ))) {
@@ -743,7 +747,7 @@ bool NodeModel::showRuntimeDialogOnGuiThread(const QString& message, const QStri
743747void NodeModel::showRuntimeDialogRequest (const std::shared_ptr<RuntimeDialogRequest>& request)
744748{
745749 m_runtime_dialog_active = request;
746- m_runtime_dialog_title = RuntimeDialogTitle (request->caption , request-> style );
750+ m_runtime_dialog_title = RuntimeDialogTitle (request->style );
747751 m_runtime_dialog_message = request->message ;
748752 m_runtime_dialog_icon = RuntimeDialogIcon (request->style );
749753 m_runtime_dialog_buttons = RuntimeDialogButtons (request->style );
@@ -778,11 +782,10 @@ void NodeModel::answerRuntimeDialog(unsigned int button)
778782}
779783
780784#ifdef ENABLE_TEST_AUTOMATION
781- void NodeModel::showRuntimeDialogForTest (const QString& message, const QString& caption, unsigned int style, bool question)
785+ void NodeModel::showRuntimeDialogForTest (const QString& message, unsigned int style, bool question)
782786{
783787 auto request{std::make_shared<RuntimeDialogRequest>()};
784788 request->message = message;
785- request->caption = caption;
786789 request->style = style;
787790 request->question = question;
788791
0 commit comments