LCOV - code coverage report
Current view: top level - src - noui.cpp (source / functions) Hit Total Coverage
Test: total_coverage.info Lines: 21 27 77.8 %
Date: 2026-08-09 10:51:41 Functions: 3 3 100.0 %

          Line data    Source code
       1             : // Copyright (c) 2010 Satoshi Nakamoto
       2             : // Copyright (c) 2009-2014 The Bitcoin developers
       3             : // Copyright (c) 2014-2015 The Dash developers
       4             : // Copyright (c) 2015-2021 The PIVX Core developers
       5             : // Distributed under the MIT/X11 software license, see the accompanying
       6             : // file COPYING or http://www.opensource.org/licenses/mit-license.php.
       7             : 
       8             : #include "noui.h"
       9             : 
      10             : #include "guiinterface.h"
      11             : #include "util/system.h"
      12             : 
      13             : #include <cstdio>
      14             : #include <stdint.h>
      15             : #include <string>
      16             : 
      17          32 : static bool noui_ThreadSafeMessageBox(const std::string& message, const std::string& caption, unsigned int style)
      18             : {
      19          32 :     bool fSecure = style & CClientUIInterface::SECURE;
      20          32 :     style &= ~CClientUIInterface::SECURE;
      21             : 
      22          32 :     std::string strCaption;
      23             :     // Check for usage of predefined caption
      24          32 :     switch (style) {
      25          31 :     case CClientUIInterface::MSG_ERROR:
      26          62 :         strCaption += _("Error");
      27          31 :         break;
      28           0 :     case CClientUIInterface::MSG_WARNING:
      29           0 :         strCaption += _("Warning");
      30           0 :         break;
      31           0 :     case CClientUIInterface::MSG_INFORMATION:
      32           0 :         strCaption += _("Information");
      33           0 :         break;
      34           1 :     default:
      35           1 :         strCaption += caption; // Use supplied caption (can be empty)
      36             :     }
      37             : 
      38          32 :     if (!fSecure)
      39          32 :         LogPrintf("%s: %s\n", strCaption, message);
      40          32 :     fprintf(stderr, "%s: %s\n", strCaption.c_str(), message.c_str());
      41          32 :     return false;
      42             : }
      43             : 
      44        4686 : static void noui_InitMessage(const std::string& message)
      45             : {
      46        4686 :     LogPrintf("init message: %s\n", message);
      47        4686 : }
      48             : 
      49         328 : void noui_connect()
      50             : {
      51             :     // Connect pivxd signal handlers
      52         656 :     uiInterface.ThreadSafeMessageBox.connect(noui_ThreadSafeMessageBox);
      53         656 :     uiInterface.InitMessage.connect(noui_InitMessage);
      54         328 : }

Generated by: LCOV version 1.14