text: // Copyright (c) 2019-2020 The OHONETWORK developers
  // Distributed under the MIT software license, see the accompanying
  // file COPYING or http://www.opensource.org/licenses/mit-license.php.
  
  #include "qt/ohonetwork/ohonetworkgui.h"
  
  #ifdef Q_OS_MAC
  #include "macdockiconhandler.h"
  #endif
  
  #include "qt/guiutil.h"
  #include "clientmodel.h"
  #include "optionsmodel.h"
  #include "networkstyle.h"
  #include "notificator.h"
  #include "guiinterface.h"
  #include "qt/ohonetwork/qtutils.h"
  #include "qt/ohonetwork/defaultdialog.h"
  #include "qt/ohonetwork/settings/settingsfaqwidget.h"
  
  #include <QDesktopWidget>
  #include <QHBoxLayout>
  #include <QVBoxLayout>
  #include <QApplication>
  #include <QColor>
  #include <QShortcut>
  #include <QKeySequence>
  #include <QWindowStateChangeEvent>
  
  #include "util.h"
  
  #define BASE_WINDOW_WIDTH 1200
  #define BASE_WINDOW_HEIGHT 740
  #define BASE_WINDOW_MIN_HEIGHT 620
  #define BASE_WINDOW_MIN_WIDTH 1100
  
  
  const QString OHONETWORKGUI::DEFAULT_WALLET = "~Default";
  
  OHONETWORKGUI::OHONETWORKGUI(const NetworkStyle* networkStyle, QWidget* parent) :
          QMainWindow(parent),
          clientModel(0){
  
      /* Open CSS when configured */
      this->setStyleSheet(GUIUtil::loadStyleSheet());
      this->setMinimumSize(BASE_WINDOW_MIN_WIDTH, BASE_WINDOW_MIN_HEIGHT);
  
  
      // Adapt screen size
      QRect rec = QApplication::desktop()->screenGeometry();
      int adaptedHeight = (rec.height() < BASE_WINDOW_HEIGHT) ?  BASE_WINDOW_MIN_HEIGHT : BASE_WINDOW_HEIGHT;
      int adaptedWidth = (rec.width() < BASE_WINDOW_WIDTH) ?  BASE_WINDOW_MIN_WIDTH : BASE_WINDOW_WIDTH;
      GUIUtil::restoreWindowGeometry(
              "nWindow",
              QSize(adaptedWidth, adaptedHeight),
              this
      );
  
  #ifdef ENABLE_WALLET
      /* if compiled with wallet support, -disablewallet can still disable the wallet */
      enableWallet = !GetBoolArg("-disablewallet", false);
  #else
      enableWallet = false;
  #endif // ENABLE_WALLET
  
      QString windowTitle = tr("OHONETWORK Core") + " - ";
      windowTitle += ((enableWallet) ? tr("Wallet") : tr("Node"));
      windowTitle += " " + networkStyle->getTitleAddText();
      setWindowTitle(windowTitle);
  
  #ifndef Q_OS_MAC
      QApplication::setWindowIcon(networkStyle->getAppIcon());
      setWindowIcon(networkStyle->getAppIcon());
  #else
      MacDockIconHandler::instance()->setIcon(networkStyle->getAppIcon());
  #endif
  
  
  
  
  #ifdef ENABLE_WALLET
      // Create wallet frame
      if(enableWallet){
  
          QFrame* centralWidget = new QFrame(this);
          this->setMinimumWidth(BASE_WINDOW_MIN_WIDTH);
          this->setMinimumHeight(BASE_WINDOW_MIN_HEIGHT);
          QHBoxLayout* centralWidgetLayouot = new QHBoxLayout();
          centralWidget->setLayout(centralWidgetLayouot);
          centralWidgetLayouot->setContentsMargins(0,0,0,0);
          centralWidgetLayouot->setSpacing(0);
  
          centralWidget->setProperty("cssClass", "container");
          centralWidget->setStyleSheet("padding:0px; border:none; margin:0px;");
  
          // First the nav
          navMenu = new NavMenuWidget(this);
          centralWidgetLayouot->addWidget(navMenu);
  
          this->setCentralWidget(centralWidget);
          this->setContentsMargins(0,0,0,0);
  
          QFrame *container = new QFrame(centralWidget);
          container->setContentsMargins(0,0,0,0);
          centralWidgetLayouot->addWidget(container);
  
          // Then topbar + the stackedWidget
          QVBoxLayout *baseScreensContainer = new QVBoxLayout(this);
          baseScreensContainer->setMargin(0);
          baseScreensContainer->setSpacing(0);
          baseScreensContainer->setContentsMargins(0,0,0,0);
          container->setLayout(baseScreensContainer);
  
          // Insert the topbar
          topBar = new TopBar(this);
          topBar->setContentsMargins(0,0,0,0);
          baseScreensContainer->addWidget(topBar);
  
          // Now stacked widget
          stackedContainer = new QStackedWidget(this);
          QSizePolicy sizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
          stackedContainer->setSizePolicy(sizePolicy);
          stackedContainer->setContentsMargins(0,0,0,0);
          baseScreensContainer->addWidget(stackedContainer);
  
          // Init
          dashboard = new DashboardWidget(this);
          sendWidget = new SendWidget(this);
          receiveWidget = new ReceiveWidget(this);
          addressesWidget = new AddressesWidget(this);
          privacyWidget = new PrivacyWidget(this);
          masterNodesWidget = new MasterNodesWidget(this);
          coldStakingWidget = new LiteNodeStakingWidget(this);
          settingsWidget = new SettingsWidget(this);
  
          // Add to parent
          stackedContainer->addWidget(dashboard);
          stackedContainer->addWidget(sendWidget);
          stackedContainer->addWidget(receiveWidget);
          stackedContainer->addWidget(addressesWidget);
          stackedContainer->addWidget(privacyWidget);
          stackedContainer->addWidget(masterNodesWidget);
          stackedContainer->addWidget(coldStakingWidget);
          stackedContainer->addWidget(settingsWidget);
          stackedContainer->setCurrentWidget(dashboard);
  
      } else
  #endif
      {
          // When compiled without wallet or -disablewallet is provided,
          // the central widget is the rpc console.
          rpcConsole = new RPCConsole(enableWallet ? this : 0);
          setCentralWidget(rpcConsole);
      }
  
      // Create actions for the toolbar, menu bar and tray/dock icon
      createActions(networkStyle);
  
      // Create system tray icon and notification
      createTrayIcon(networkStyle);
  
      // Connect events
      connectActions();
  
      // TODO: Add event filter??
      // // Install event filter to be able to catch status tip events (QEvent::StatusTip)
      //    this->installEventFilter(this);
  
      // Subscribe to notifications from core
      subscribeToCoreSignals();
  
  }
  
  void OHONETWORKGUI::createActions(const NetworkStyle* networkStyle){
      toggleHideAction = new QAction(networkStyle->getAppIcon(), tr("&Show / Hide"), this);
      toggleHideAction->setStatusTip(tr("Show or hide the main Window"));
  
      quitAction = new QAction(QIcon(":/icons/quit"), tr("E&xit"), this);
      quitAction->setStatusTip(tr("Quit application"));
      quitAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Q));
      quitAction->setMenuRole(QAction::QuitRole);
  
      connect(toggleHideAction, SIGNAL(triggered()), this, SLOT(toggleHidden()));
      connect(quitAction, SIGNAL(triggered()), qApp, SLOT(quit()));
  }
  
  /**
   * Here add every event connection
   */
  void OHONETWORKGUI::connectActions() {
      QShortcut *consoleShort = new QShortcut(this);
      consoleShort->setKey(QKeySequence(SHORT_KEY + Qt::Key_C));
      connect(consoleShort, &QShortcut::activated, [this](){
          navMenu->selectSettings();
          settingsWidget->showDebugConsole();
          goToSettings();
      });
      connect(topBar, &TopBar::showHide, this, &OHONETWORKGUI::showHide);
      connect(topBar, &TopBar::themeChanged, this, &OHONETWORKGUI::changeTheme);
      connect(topBar, &TopBar::onShowHideLiteNodeStakingChanged, navMenu, &NavMenuWidget::onShowHideLiteNodeStakingChanged);
      connect(settingsWidget, &SettingsWidget::showHide, this, &OHONETWORKGUI::showHide);
      connect(sendWidget, &SendWidget::showHide, this, &OHONETWORKGUI::showHide);
      connect(receiveWidget, &ReceiveWidget::showHide, this, &OHONETWORKGUI::showHide);
      connect(addressesWidget, &AddressesWidget::showHide, this, &OHONETWORKGUI::showHide);
      connect(privacyWidget, &PrivacyWidget::showHide, this, &OHONETWORKGUI::showHide);
      connect(masterNodesWidget, &MasterNodesWidget::showHide, this, &OHONETWORKGUI::showHide);
      connect(masterNodesWidget, &MasterNodesWidget::execDialog, this, &OHONETWORKGUI::execDialog);
      connect(coldStakingWidget, &LiteNodeStakingWidget::showHide, this, &OHONETWORKGUI::showHide);
      connect(coldStakingWidget, &LiteNodeStakingWidget::execDialog, this, &OHONETWORKGUI::execDialog);
      connect(settingsWidget, &SettingsWidget::execDialog, this, &OHONETWORKGUI::execDialog);
  }
  
  
  void OHONETWORKGUI::createTrayIcon(const NetworkStyle* networkStyle) {
  #ifndef Q_OS_MAC
      trayIcon = new QSystemTrayIcon(this);
      QString toolTip = tr("OHONETWORK Core client") + " " + networkStyle->getTitleAddText();
      trayIcon->setToolTip(toolTip);
      trayIcon->setIcon(networkStyle->getAppIcon());
      trayIcon->hide();
  #endif
      notificator = new Notificator(QApplication::applicationName(), trayIcon, this);
  }
  
  //
  OHONETWORKGUI::~OHONETWORKGUI() {
      // Unsubscribe from notifications from core
      unsubscribeFromCoreSignals();
  
      GUIUtil::saveWindowGeometry("nWindow", this);
      if (trayIcon) // Hide tray icon, as deleting will let it linger until quit (on Ubuntu)
          trayIcon->hide();
  #ifdef Q_OS_MAC
      MacDockIconHandler::cleanup();
  #endif
  }
  
  
  /** Get restart command-line parameters and request restart */
  void OHONETWORKGUI::handleRestart(QStringList args){
      if (!ShutdownRequested())
          emit requestedRestart(args);
  }
  
  
  void OHONETWORKGUI::setClientModel(ClientModel* clientModel) {
      this->clientModel = clientModel;
      if(this->clientModel) {
  
          // Create system tray menu (or setup the dock menu) that late to prevent users from calling actions,
          // while the client has not yet fully loaded
          createTrayIconMenu();
  
          topBar->setClientModel(clientModel);
          dashboard->setClientModel(clientModel);
          sendWidget->setClientModel(clientModel);
          settingsWidget->setClientModel(clientModel);
  
          // Receive and report messages from client model
          connect(clientModel, SIGNAL(message(QString, QString, unsigned int)), this, SLOT(message(QString, QString, unsigned int)));
          connect(topBar, SIGNAL(walletSynced(bool)), dashboard, SLOT(walletSynced(bool)));
          connect(topBar, SIGNAL(walletSynced(bool)), coldStakingWidget, SLOT(walletSynced(bool)));
  
          // Get restart command-line parameters and handle restart
          connect(settingsWidget, &SettingsWidget::handleRestart, [this](QStringList arg){handleRestart(arg);});
  
          if (rpcConsole) {
              rpcConsole->setClientModel(clientModel);
          }
  
          if (trayIcon) {
              trayIcon->show();
          }
      } else {
          // Disable possibility to show main window via action
          toggleHideAction->setEnabled(false);
          if (trayIconMenu) {
              // Disable context menu on tray icon
              trayIconMenu->clear();
          }
      }
  }
  
  void OHONETWORKGUI::createTrayIconMenu() {
  #ifndef Q_OS_MAC
      // return if trayIcon is unset (only on non-Mac OSes)
      if (!trayIcon)
          return;
  
      trayIconMenu = new QMenu(this);
      trayIcon->setContextMenu(trayIconMenu);
  
      connect(trayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)),
              this, SLOT(trayIconActivated(QSystemTrayIcon::ActivationReason)));
  #else
      // Note: On Mac, the dock icon is used to provide the tray's functionality.
      MacDockIconHandler* dockIconHandler = MacDockIconHandler::instance();
      dockIconHandler->setMainWindow((QMainWindow*)this);
      trayIconMenu = dockIconHandler->dockMenu();
  #endif
  
      // Configuration of the tray icon (or dock icon) icon menu
      trayIconMenu->addAction(toggleHideAction);
      trayIconMenu->addSeparator();
  
  #ifndef Q_OS_MAC // This is built-in on Mac
      trayIconMenu->addSeparator();
      trayIconMenu->addAction(quitAction);
  #endif
  }
  
  #ifndef Q_OS_MAC
  void OHONETWORKGUI::trayIconActivated(QSystemTrayIcon::ActivationReason reason)
  {
      if (reason == QSystemTrayIcon::Trigger) {
          // Click on system tray icon triggers show/hide of the main window
          toggleHidden();
      }
  }
  #endif
  
  void OHONETWORKGUI::changeEvent(QEvent* e)
  {
      QMainWindow::changeEvent(e);
  #ifndef Q_OS_MAC // Ignored on Mac
      if (e->type() == QEvent::WindowStateChange) {
          if (clientModel && clientModel->getOptionsModel() && clientModel->getOptionsModel()->getMinimizeToTray()) {
              QWindowStateChangeEvent* wsevt = static_cast<QWindowStateChangeEvent*>(e);
              if (!(wsevt->oldState() & Qt::WindowMinimized) && isMinimized()) {
                  QTimer::singleShot(0, this, SLOT(hide()));
                  e->ignore();
              }
          }
      }
  #endif
  }
  
  void OHONETWORKGUI::closeEvent(QCloseEvent* event)
  {
  #ifndef Q_OS_MAC // Ignored on Mac
      if (clientModel && clientModel->getOptionsModel()) {
          if (!clientModel->getOptionsModel()->getMinimizeOnClose()) {
              QApplication::quit();
          }
      }
  #endif
      QMainWindow::closeEvent(event);
  }
  
  
  void OHONETWORKGUI::messageInfo(const QString& text){
      if(!this->snackBar) this->snackBar = new SnackBar(this, this);
      this->snackBar->setText(text);
      this->snackBar->resize(this->width(), snackBar->height());
      openDialog(this->snackBar, this);
  }
  
  
  void OHONETWORKGUI::message(const QString& title, const QString& message, unsigned int style, bool* ret) {
      QString strTitle =  tr("OHONETWORK Core"); // default title
      // Default to information icon
      int nNotifyIcon = Notificator::Information;
  
      QString msgType;
  
      // Prefer supplied title over style based title
      if (!title.isEmpty()) {
          msgType = title;
      } else {
          switch (style) {
              case CClientUIInterface::MSG_ERROR:
                  msgType = tr("Error");
                  break;
              case CClientUIInterface::MSG_WARNING:
                  msgType = tr("Warning");
                  break;
              case CClientUIInterface::MSG_INFORMATION:
                  msgType = tr("Information");
                  break;
              default:
                  msgType = tr("System Message");
                  break;
          }
      }
  
      // Check for error/warning icon
      if (style & CClientUIInterface::ICON_ERROR) {
          nNotifyIcon = Notificator::Critical;
      } else if (style & CClientUIInterface::ICON_WARNING) {
          nNotifyIcon = Notificator::Warning;
      }
  
      // Display message
      if (style & CClientUIInterface::MODAL) {
          // Check for buttons, use OK as default, if none was supplied
          int r = 0;
          showNormalIfMinimized();
          if(style & CClientUIInterface::BTN_MASK){
              r = openStandardDialog(
                      (title.isEmpty() ? strTitle : title), message, "OK", "CANCEL"
                  );
          }else{
              r = openStandardDialog((title.isEmpty() ? strTitle : title), message, "OK");
          }
          if (ret != NULL)
              *ret = r;
      } else if(style & CClientUIInterface::MSG_INFORMATION_SNACK){
          messageInfo(message);
      }else {
          // Append title to "OHONETWORK - "
          if (!msgType.isEmpty())
              strTitle += " - " + msgType;
          notificator->notify((Notificator::Class) nNotifyIcon, strTitle, message);
      }
  }
  
  bool OHONETWORKGUI::openStandardDialog(QString title, QString body, QString okBtn, QString cancelBtn){
      DefaultDialog *dialog;
      if (isVisible()) {
          showHide(true);
          dialog = new DefaultDialog(this);
          dialog->setText(title, body, okBtn, cancelBtn);
          dialog->adjustSize();
          openDialogWithOpaqueBackground(dialog, this);
      } else {
          dialog = new DefaultDialog();
          dialog->setText(title, body, okBtn);
          dialog->setWindowTitle(tr("OHONETWORK Core"));
          dialog->adjustSize();
          dialog->raise();
          dialog->exec();
      }
      bool ret = dialog->isOk;
      dialog->deleteLater();
      return ret;
  }
  
  
  void OHONETWORKGUI::showNormalIfMinimized(bool fToggleHidden) {
      if (!clientModel)
          return;
      // activateWindow() (sometimes) helps with keyboard focus on Windows
      if (isHidden()) {
          show();
          activateWindow();
      } else if (isMinimized()) {
          showNormal();
          activateWindow();
      } else if (GUIUtil::isObscured(this)) {
          raise();
          activateWindow();
      } else if (fToggleHidden)
          hide();
  }
  
  void OHONETWORKGUI::toggleHidden() {
      showNormalIfMinimized(true);
  }
  
  void OHONETWORKGUI::detectShutdown() {
      if (ShutdownRequested()) {
          if (rpcConsole)
              rpcConsole->hide();
          qApp->quit();
      }
  }
  
  void OHONETWORKGUI::goToDashboard(){
      if(stackedContainer->currentWidget() != dashboard){
          stackedContainer->setCurrentWidget(dashboard);
          topBar->showBottom();
      }
  }
  
  void OHONETWORKGUI::goToSend(){
      showTop(sendWidget);
  }
  
  void OHONETWORKGUI::goToAddresses(){
      showTop(addressesWidget);
  }
  
  void OHONETWORKGUI::goToPrivacy(){
      showTop(privacyWidget);
  }
  
  void OHONETWORKGUI::goToMasterNodes(){
      showTop(masterNodesWidget);
  }
  
  void OHONETWORKGUI::goToLiteNodeStaking(){
      showTop(coldStakingWidget);
  }
  
  void OHONETWORKGUI::goToSettings(){
      showTop(settingsWidget);
  }
  
  void OHONETWORKGUI::goToReceive(){
      showTop(receiveWidget);
  }
  
  void OHONETWORKGUI::showTop(QWidget* view){
      if(stackedContainer->currentWidget() != view){
          stackedContainer->setCurrentWidget(view);
          topBar->showTop();
      }
  }
  
  void OHONETWORKGUI::changeTheme(bool isLightTheme){
  
      QString css = GUIUtil::loadStyleSheet();
      this->setStyleSheet(css);
  
      // Notify
      emit themeChanged(isLightTheme, css);
  
      // Update style
      updateStyle(this);
  }
  
  void OHONETWORKGUI::resizeEvent(QResizeEvent* event){
      // Parent..
      QMainWindow::resizeEvent(event);
      // background
      showHide(opEnabled);
      // Notify
      emit windowResizeEvent(event);
  }
  
  bool OHONETWORKGUI::execDialog(QDialog *dialog, int xDiv, int yDiv){
      return openDialogWithOpaqueBackgroundY(dialog, this);
  }
  
  void OHONETWORKGUI::showHide(bool show){
      if(!op) op = new QLabel(this);
      if(!show){
          op->setVisible(false);
          opEnabled = false;
      }else{
          QColor bg("#000000");
          bg.setAlpha(200);
          if(!isLightTheme()){
              bg = QColor("#00000000");
              bg.setAlpha(150);
          }
  
          QPalette palette;
          palette.setColor(QPalette::Window, bg);
          op->setAutoFillBackground(true);
          op->setPalette(palette);
          op->setWindowFlags(Qt::CustomizeWindowHint);
          op->move(0,0);
          op->show();
          op->activateWindow();
          op->resize(width(), height());
          op->setVisible(true);
          opEnabled = true;
      }
  }
  
  int OHONETWORKGUI::getNavWidth(){
      return this->navMenu->width();
  }
  
  void OHONETWORKGUI::openFAQ(int section){
      showHide(true);
      SettingsFaqWidget* dialog = new SettingsFaqWidget(this);
      if (section > 0) dialog->setSection(section);
      openDialogWithOpaqueBackgroundFullScreen(dialog, this);
      dialog->deleteLater();
  }
  
  
  #ifdef ENABLE_WALLET
  bool OHONETWORKGUI::addWallet(const QString& name, WalletModel* walletModel)
  {
      // Single wallet supported for now..
      if(!stackedContainer || !clientModel || !walletModel)
          return false;
  
      // set the model for every view
      navMenu->setWalletModel(walletModel);
      dashboard->setWalletModel(walletModel);
      topBar->setWalletModel(walletModel);
      receiveWidget->setWalletModel(walletModel);
      sendWidget->setWalletModel(walletModel);
      addressesWidget->setWalletModel(walletModel);
      privacyWidget->setWalletModel(walletModel);
      masterNodesWidget->setWalletModel(walletModel);
      coldStakingWidget->setWalletModel(walletModel);
      settingsWidget->setWalletModel(walletModel);
  
      // Connect actions..
      connect(privacyWidget, &PrivacyWidget::message, this, &OHONETWORKGUI::message);
      connect(masterNodesWidget, &MasterNodesWidget::message, this, &OHONETWORKGUI::message);
      connect(coldStakingWidget, &MasterNodesWidget::message, this, &OHONETWORKGUI::message);
      connect(topBar, &TopBar::message, this, &OHONETWORKGUI::message);
      connect(sendWidget, &SendWidget::message,this, &OHONETWORKGUI::message);
      connect(receiveWidget, &ReceiveWidget::message,this, &OHONETWORKGUI::message);
      connect(addressesWidget, &AddressesWidget::message,this, &OHONETWORKGUI::message);
      connect(settingsWidget, &SettingsWidget::message, this, &OHONETWORKGUI::message);
  
      // Pass through transaction notifications
      connect(dashboard, SIGNAL(incomingTransaction(QString, int, CAmount, QString, QString)), this, SLOT(incomingTransaction(QString, int, CAmount, QString, QString)));
  
      return true;
  }
  
  bool OHONETWORKGUI::setCurrentWallet(const QString& name) {
      // Single wallet supported.
      return true;
  }
  
  void OHONETWORKGUI::removeAllWallets() {
      // Single wallet supported.
  }
  
  void OHONETWORKGUI::incomingTransaction(const QString& date, int unit, const CAmount& amount, const QString& type, const QString& address) {
      // Only send notifications when not disabled
      if(!bdisableSystemnotifications){
          // On new transaction, make an info balloon
          message((amount) < 0 ? (pwalletMain->fMultiSendNotify == true ? tr("Sent MultiSend transaction") : tr("Sent transaction")) : tr("Incoming transaction"),
              tr("Date: %1\n"
                 "Amount: %2\n"
                 "Type: %3\n"
                 "Address: %4\n")
                  .arg(date)
                  .arg(BitcoinUnits::formatWithUnit(unit, amount, true))
                  .arg(type)
                  .arg(address),
              CClientUIInterface::MSG_INFORMATION);
  
          pwalletMain->fMultiSendNotify = false;
      }
  }
  
  #endif // ENABLE_WALLET
  
  
  static bool ThreadSafeMessageBox(OHONETWORKGUI* gui, const std::string& message, const std::string& caption, unsigned int style)
  {
      bool modal = (style & CClientUIInterface::MODAL);
      // The SECURE flag has no effect in the Qt GUI.
      // bool secure = (style & CClientUIInterface::SECURE);
      style &= ~CClientUIInterface::SECURE;
      bool ret = false;
      std::cout << "thread safe box: " << message << std::endl;
      // In case of modal message, use blocking connection to wait for user to click a button
      QMetaObject::invokeMethod(gui, "message",
                modal ? GUIUtil::blockingGUIThreadConnection() : Qt::QueuedConnection,
                Q_ARG(QString, QString::fromStdString(caption)),
                Q_ARG(QString, QString::fromStdString(message)),
                Q_ARG(unsigned int, style),
                Q_ARG(bool*, &ret));
      return ret;
  }
  
  
  void OHONETWORKGUI::subscribeToCoreSignals()
  {
      // Connect signals to client
      uiInterface.ThreadSafeMessageBox.connect(boost::bind(ThreadSafeMessageBox, this, _1, _2, _3));
  }
  
  void OHONETWORKGUI::unsubscribeFromCoreSignals()
  {
      // Disconnect signals from client
      uiInterface.ThreadSafeMessageBox.disconnect(boost::bind(ThreadSafeMessageBox, this, _1, _2, _3));
  }
  