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: 2025-02-23 09:33:43 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          33 : static bool noui_ThreadSafeMessageBox(const std::string& message, const std::string& caption, unsigned int style)
      18             : {
      19          33 :     bool fSecure = style & CClientUIInterface::SECURE;
      20          33 :     style &= ~CClientUIInterface::SECURE;
      21             : 
      22          33 :     std::string strCaption;
      23             :     // Check for usage of predefined caption
      24          33 :     switch (style) {
      25          32 :     case CClientUIInterface::MSG_ERROR:
      26          64 :         strCaption += _("Error");
      27          32 :         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          33 :     if (!fSecure)
      39          33 :         LogPrintf("%s: %s\n", strCaption, message);
      40          33 :     fprintf(stderr, "%s: %s\n", strCaption.c_str(), message.c_str());
      41          33 :     return false;
      42             : }
      43             : 
      44        5625 : static void noui_InitMessage(const std::string& message)
      45             : {
      46        5625 :     LogPrintf("init message: %s\n", message);
      47        5625 : }
      48             : 
      49         391 : void noui_connect()
      50             : {
      51             :     // Connect pivxd signal handlers
      52         782 :     uiInterface.ThreadSafeMessageBox.connect(noui_ThreadSafeMessageBox);
      53         782 :     uiInterface.InitMessage.connect(noui_InitMessage);
      54         391 : }

Generated by: LCOV version 1.14