text:
// Copyright (c) 2011-2015 The KoreCore developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.

#include "koregui.h"

#include "koreunits.h"
#include "clientmodel.h"
#include "guiconstants.h"
#include "guiutil.h"
#include "miner.h"
#include "networkstyle.h"
#include "notificator.h"
#include "openuridialog.h"
#include "optionsdialog.h"
#include "optionsmodel.h"
#include "platformstyle.h"
#include "rpcconsole.h"
#include "utilitydialog.h"

#include "net.h"
#ifdef ENABLE_WALLET
#include "blockexplorer.h"
#include "tradingdialog.h"
#include "walletframe.h"
#include "walletmodel.h"
#endif // ENABLE_WALLET

#ifdef Q_OS_MAC
#include "macdockiconhandler.h"
#endif

#include "init.h"
#include "masternodelist.h"
#include "ui_interface.h"
#include "util.h"

#include <iostream>

#include <QAction>
#include <QApplication>
#include <QDateTime>
#include <QDesktopWidget>
#include <QDragEnterEvent>
#include <QListWidget>
#include <QMenuBar>
#include <QMessageBox>
#include <QMimeData>
#include <QProgressBar>
#include <QProgressDialog>
#include <QSettings>
#include <QShortcut>
#include <QStackedWidget>
#include <QStatusBar>
#include <QStyle>
#include <QTimer>
#include <QToolBar>
#include <QVBoxLayout>
#include <QPushButton>
#include <QSpinBox>
#if QT_VERSION < 0x050000
#include <QTextDocument>
#include <QUrl>
#else
#include <QUrlQuery>
#endif

const std::string KoreGUI::DEFAULT_UIPLATFORM =
#if defined(Q_OS_MAC)
        "macosx"
#elif defined(Q_OS_WIN)
        "windows"
#else
        "other"
#endif
        ;

const QString KoreGUI::DEFAULT_WALLET = "~Default";

KoreGUI::KoreGUI(const PlatformStyle *platformStyle, const NetworkStyle *networkStyle, QWidget *parent) :
    QMainWindow(parent),
    clientModel(0),
    walletFrame(0),
    unitDisplayControl(0),
    labelStakingIcon(0),
    labelEncryptionIcon(0),
    labelConnectionsIcon(0),
    labelUsdIcon(0),
    labelBtcIcon(0),
    labelBlocksIcon(0),
    progressBarLabel(0),
    progressBar(0),
    progressDialog(0),
    appMenuBar(0),
    overviewAction(0),
    historyAction(0),
    masternodeAction(0),
    quitAction(0),
    sendCoinsAction(0),
    sendCoinsMenuAction(0),
    usedSendingAddressesAction(0),
    usedReceivingAddressesAction(0),
    signMessageAction(0),
    verifyMessageAction(0),
    aboutAction(0),
    receiveCoinsAction(0),
    receiveCoinsMenuAction(0),
    optionsAction(0),
    toggleHideAction(0),
    encryptWalletAction(0),
    backupWalletAction(0),
    changePassphraseAction(0),
    aboutQtAction(0),
    openRPCConsoleAction(0),
    openAction(0),
    browserAction(0),
    multiSendAction(0),
    pbxclientAction(0),
    showHelpMessageAction(0),
    trayIcon(0),
    trayIconMenu(0),
    notificator(0),
    rpcConsole(0),
    helpMessageDialog(0),
    prevBlocks(0),
    spinnerFrame(0),
    platformStyle(platformStyle)
{
    /* Open CSS when configured */
    //    this->setStyleSheet(GUIUtil::loadStyleSheet());

    //qApp->setStyleSheet("QMenu{color: rgba(36, 224, 130, 0.5); } QMenu::item {background-color: transparent;}QMenu::item:selected {background-color: rgb(163, 3, 47);} QDialog{background: qlineargradient(x1:0, y1:0, x2:0, y2:1,stop: 0 rgba(29, 27, 27, 0.2), stop: 0.1 rgba(29, 27, 27, 0.18), stop: 0.5 rgba(29, 27, 27, 0.17), stop: 0.9 rgba(29, 27, 27, 0.16), stop: 1 rgba(29, 27, 27, 0.15)); }");

    //this->setStyleSheet("background: qlineargradient(x1:0, y1:0, x2:0, y2:1,stop: 0 rgba(255, 255, 255, 1.0), stop: 0.1 rgba(255, 255, 255, 1.0), stop: 0.5 rgba(255, 255, 255, 1.0), stop: 0.9 rgba(255, 255, 255, 1.0), stop: 1 rgba(255, 255, 255, 1.0));");
    this->setStyleSheet("background: white;");

    GUIUtil::restoreWindowGeometry("nWindow", QSize(850, 550), this);
    setWindowOpacity(qreal(100)/100);

    QString windowTitle = tr("Kore") + " - ";
#ifdef ENABLE_WALLET
    /* if compiled with wallet support, -disablewallet can still disable the wallet */
    enableWallet = !GetBoolArg("-disablewallet", false);
#else
    enableWallet = false;
#endif // ENABLE_WALLET
    if(enableWallet)
    {
        windowTitle += tr("Wallet");
    } else {
        windowTitle += tr("Node");
    }
    windowTitle += " " + networkStyle->getTitleAddText();
#ifndef Q_OS_MAC
    QApplication::setWindowIcon(networkStyle->getTrayAndWindowIcon());
    setWindowIcon(networkStyle->getTrayAndWindowIcon());
#else
    MacDockIconHandler::instance()->setIcon(networkStyle->getAppIcon());
#endif
    setWindowTitle(windowTitle);

#if defined(Q_OS_MAC) && QT_VERSION < 0x050000
    // This property is not implemented in Qt 5. Setting it has no effect.
    // A replacement API (QtMacUnifiedToolBar) is available in QtMacExtras.
    setUnifiedTitleAndToolBarOnMac(true);
#endif

    rpcConsole = new RPCConsole(platformStyle, 0);
    helpMessageDialog = new HelpMessageDialog(this, false);
#ifdef ENABLE_WALLET
    if(enableWallet)
    {
        /** Create wallet frame and make it the central widget */
        walletFrame = new WalletFrame(platformStyle, this);
        setCentralWidget(walletFrame);
    } else
#endif // ENABLE_WALLET
    {
        /* When compiled without wallet or -disablewallet is provided,
         * the central widget is the rpc console.
         */
        setCentralWidget(rpcConsole);
    }

    // Accept D&D of URIs
    setAcceptDrops(true);

    // Create actions for the toolbar, menu bar and tray/dock icon
    // Needs walletFrame to be initialized
    createActions();

    // Create application menu bar
    createMenuBar();

    // Create the toolbars
    createToolBars();

    // Create system tray icon and notification
    createTrayIcon(networkStyle);

    // Create status bar
    statusBar();

    // Disable size grip because it looks ugly and nobody needs it
    statusBar()->setSizeGripEnabled(false);

    // Status bar notification icons
    QFrame *frameBlocks = new QFrame();
    frameBlocks->setContentsMargins(0,0,0,0);
    frameBlocks->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Preferred);
    QHBoxLayout *frameBlocksLayout = new QHBoxLayout(frameBlocks);
    frameBlocksLayout->setContentsMargins(3,0,3,0);
    frameBlocksLayout->setSpacing(3);
    unitDisplayControl = new UnitDisplayStatusBarControl(platformStyle);
    labelEncryptionIcon = new QLabel();
    labelConnectionsIcon = new QLabel();
    labelBlocksIcon = new QLabel();
    QLabel *labelUsdlabel = new QLabel("KORE/USD");
    QLabel *labelBtclabel = new QLabel("BTC/USD");
    labelUsdIcon = new QLabel();
    labelBtcIcon = new QLabel();

    QLabel *opacityLabel = new QLabel("Opacity:");
    QSpinBox *opacitySpinBox = new QSpinBox();
    opacitySpinBox->setRange(40, 100);

    //QLabel *minerLabel = new QLabel("Miner Threads: 0");
	//QSlider *miner = new QSlider(Qt::Horizontal, this);
	//int cores = GetNumCores();
	//miner->setRange(0, cores);
	//QString minermax = QString::number(cores);
	//QLabel *maxminer = new QLabel(minermax);
	labelStakingIcon = new QLabel();

    frameBlocksLayout->addWidget(labelBtclabel);
    frameBlocksLayout->addWidget(labelBtcIcon);
    frameBlocksLayout->addWidget(labelUsdlabel);
    frameBlocksLayout->addWidget(labelUsdIcon);

    if(enableWallet)
    {
        frameBlocksLayout->addStretch();
        frameBlocksLayout->addWidget(unitDisplayControl);
        frameBlocksLayout->addStretch();
        frameBlocksLayout->addWidget(labelEncryptionIcon);
    }
    frameBlocksLayout->addStretch();
    frameBlocksLayout->addWidget(labelStakingIcon);
    frameBlocksLayout->addStretch();
    frameBlocksLayout->addWidget(labelConnectionsIcon);
    frameBlocksLayout->addStretch();
    frameBlocksLayout->addWidget(labelBlocksIcon);
    frameBlocksLayout->addStretch();

    // Progress bar and label for blocks download
    progressBarLabel = new QLabel();
    progressBarLabel->setVisible(false);
    progressBar = new GUIUtil::ProgressBar();
    progressBar->setAlignment(Qt::AlignCenter);
    progressBar->setVisible(false);

    // Override style sheet for progress bar for styles that have a segmented progress bar,
    // as they make the text unreadable (workaround for issue #1071)
    // See https://qt-project.org/doc/qt-4.8/gallery.html
    QString curStyle = QApplication::style()->metaObject()->className();
    if(curStyle == "QWindowsStyle" || curStyle == "QWindowsXPStyle")
    {
        progressBar->setStyleSheet("QProgressBar { background-color: #e8e8e8; border: 1px solid grey; border-radius: 7px; padding: 1px; text-align: center; } QProgressBar::chunk { background: QLinearGradient(x1: 0, y1: 0, x2: 1, y2: 0, stop: 0 #FF8000, stop: 1 orange); border-radius: 7px; margin: 0px; }");
    }

    statusBar()->addWidget(progressBarLabel);
    statusBar()->addWidget(progressBar);

    //statusBar()->addWidget(minerLabel);
    //statusBar()->addWidget(miner);
    //statusBar()->addWidget(maxminer);
    statusBar()->addWidget(opacityLabel);
    statusBar()->addWidget(opacitySpinBox);

    statusBar()->addPermanentWidget(frameBlocks);

    connect(openRepairAction, SIGNAL(triggered()), rpcConsole, SLOT(showRepair()));
    connect(openConfEditorAction, SIGNAL(triggered()), rpcConsole, SLOT(showConfEditor()));
    connect(openMNConfEditorAction, SIGNAL(triggered()), rpcConsole, SLOT(showMNConfEditor()));
    connect(showBackupsAction, SIGNAL(triggered()), rpcConsole, SLOT(showBackups()));

    // Get restart command-line parameters and handle restart
    connect(rpcConsole, SIGNAL(handleRestart(QStringList)), this, SLOT(handleRestart(QStringList)));

    // Install event filter to be able to catch status tip events (QEvent::StatusTip)
    this->installEventFilter(this);

    // Initially wallet actions should be disabled
    setWalletActionsEnabled(false);

    // Subscribe to notifications from core
    subscribeToCoreSignals();

	timer = new QTimer();
	connect(this->timer,SIGNAL(timeout()),this,SLOT(setprice()));

	timer->start(180000);

    opacitySpinBox->setValue(static_cast<int>(windowOpacity() * 100));
    connect(opacitySpinBox, SIGNAL(valueChanged(int)), this, SLOT(on_opacitySpinBox_valueChanged(int)));
    //connect(miner, SIGNAL(valueChanged(int)), this, SLOT(engageDisengageMining(int)));

    QTimer* timerStakingIcon = new QTimer(labelStakingIcon);
    connect(timerStakingIcon, SIGNAL(timeout()), this, SLOT(setStakingStatus()));
    timerStakingIcon->start(99999);

}

void KoreGUI::on_opacitySpinBox_valueChanged(int i)
{
    // update the window opacity
    if(i > 40)
        setWindowOpacity(qreal(i)/100);
}

void KoreGUI::setprice(){

   QString xprice = QString::number(usdprice, 'f',2);
   labelBtcIcon->setStyleSheet("font-weight: bold; color: black");
   this->labelBtcIcon->setText(xprice);

   QString price = QString::number(usdrate, 'f',2);
   labelUsdIcon->setStyleSheet("font-weight: bold; color: black");
   this->labelUsdIcon->setText(price);

}

KoreGUI::~KoreGUI()
{
    // 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
    delete appMenuBar;
    MacDockIconHandler::cleanup();
#endif

    delete rpcConsole;
}

void KoreGUI::createActions()
{
    QActionGroup *tabGroup = new QActionGroup(this);

    overviewAction = new QAction(platformStyle->SingleColorIcon(":/icons/overview"), tr("&Overview"), this);
    overviewAction->setStatusTip(tr("Show general overview of wallet"));
    overviewAction->setToolTip(overviewAction->statusTip());
    overviewAction->setCheckable(true);
    overviewAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_1));
    tabGroup->addAction(overviewAction);

    sendCoinsAction = new QAction(platformStyle->SingleColorIcon(":/icons/send"), tr("&Send"), this);
    sendCoinsAction->setStatusTip(tr("Send coins to a Kore address"));
    sendCoinsAction->setToolTip(sendCoinsAction->statusTip());
    sendCoinsAction->setCheckable(true);
    sendCoinsAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_2));
    tabGroup->addAction(sendCoinsAction);

    sendCoinsMenuAction = new QAction(platformStyle->TextColorIcon(":/icons/send"), sendCoinsAction->text(), this);
    sendCoinsMenuAction->setStatusTip(sendCoinsAction->statusTip());
    sendCoinsMenuAction->setToolTip(sendCoinsMenuAction->statusTip());

    receiveCoinsAction = new QAction(platformStyle->SingleColorIcon(":/icons/receiving_addresses"), tr("&Receive"), this);
    receiveCoinsAction->setStatusTip(tr("Request payments (generates QR codes and kore: URIs)"));
    receiveCoinsAction->setToolTip(receiveCoinsAction->statusTip());
    receiveCoinsAction->setCheckable(true);
    receiveCoinsAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_3));
    tabGroup->addAction(receiveCoinsAction);

    receiveCoinsMenuAction = new QAction(platformStyle->TextColorIcon(":/icons/receiving_addresses"), receiveCoinsAction->text(), this);
    receiveCoinsMenuAction->setStatusTip(receiveCoinsAction->statusTip());
    receiveCoinsMenuAction->setToolTip(receiveCoinsMenuAction->statusTip());

    historyAction = new QAction(platformStyle->SingleColorIcon(":/icons/history"), tr("&Transactions"), this);
    historyAction->setStatusTip(tr("Browse transaction history"));
    historyAction->setToolTip(historyAction->statusTip());
    historyAction->setCheckable(true);
    historyAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_4));
    tabGroup->addAction(historyAction);

#ifdef ENABLE_WALLET

    masternodeAction = new QAction(platformStyle->SingleColorIcon(":/icons/masternode"), tr("&Masternodes"), this);
    masternodeAction->setStatusTip(tr("Browse masternodes"));
    masternodeAction->setToolTip(masternodeAction->statusTip());
    masternodeAction->setCheckable(true);
#ifdef Q_OS_MAC
    masternodeAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_5));
#else
    masternodeAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_5));
#endif
    tabGroup->addAction(masternodeAction);
    connect(masternodeAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized()));
    connect(masternodeAction, SIGNAL(triggered()), this, SLOT(gotoMasternodePage()));

    // These showNormalIfMinimized are needed because Send Coins and Receive Coins
    // can be triggered from the tray menu, and need to show the GUI to be useful.
    connect(overviewAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized()));
    connect(overviewAction, SIGNAL(triggered()), this, SLOT(gotoOverviewPage()));
    connect(sendCoinsAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized()));
    connect(sendCoinsAction, SIGNAL(triggered()), this, SLOT(gotoSendCoinsPage()));
    connect(sendCoinsMenuAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized()));
    connect(sendCoinsMenuAction, SIGNAL(triggered()), this, SLOT(gotoSendCoinsPage()));
    connect(receiveCoinsAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized()));
    connect(receiveCoinsAction, SIGNAL(triggered()), this, SLOT(gotoReceiveCoinsPage()));
    connect(receiveCoinsMenuAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized()));
    connect(receiveCoinsMenuAction, SIGNAL(triggered()), this, SLOT(gotoReceiveCoinsPage()));
    connect(historyAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized()));
    connect(historyAction, SIGNAL(triggered()), this, SLOT(gotoHistoryPage()));
#endif // ENABLE_WALLET

    quitAction = new QAction(platformStyle->TextColorIcon(":/icons/quit"), tr("E&xit"), this);
    quitAction->setStatusTip(tr("Quit application"));
    quitAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Q));
    quitAction->setMenuRole(QAction::QuitRole);
    aboutAction = new QAction(platformStyle->TextColorIcon(":/icons/about"), tr("&About Kore"), this);
    aboutAction->setStatusTip(tr("Show information about Kore"));
    aboutAction->setMenuRole(QAction::AboutRole);
    aboutAction->setEnabled(false);
    aboutQtAction = new QAction(platformStyle->TextColorIcon(":/icons/about_qt"), tr("About &Qt"), this);
    aboutQtAction->setStatusTip(tr("Show information about Qt"));
    aboutQtAction->setMenuRole(QAction::AboutQtRole);
    optionsAction = new QAction(platformStyle->TextColorIcon(":/icons/options"), tr("&Options..."), this);
    optionsAction->setStatusTip(tr("Modify configuration options for Kore"));
    optionsAction->setMenuRole(QAction::PreferencesRole);
    optionsAction->setEnabled(false);
    toggleHideAction = new QAction(platformStyle->TextColorIcon(":/icons/about"), tr("&Show / Hide"), this);
    toggleHideAction->setStatusTip(tr("Show or hide the main Window"));

    encryptWalletAction = new QAction(platformStyle->TextColorIcon(":/icons/lock_closed"), tr("&Encrypt Wallet..."), this);
    encryptWalletAction->setStatusTip(tr("Encrypt the private keys that belong to your wallet"));
    encryptWalletAction->setCheckable(true);
    backupWalletAction = new QAction(platformStyle->TextColorIcon(":/icons/filesave"), tr("&Backup Wallet..."), this);
    backupWalletAction->setStatusTip(tr("Backup wallet to another location"));
    changePassphraseAction = new QAction(platformStyle->TextColorIcon(":/icons/key"), tr("&Change Passphrase..."), this);
    changePassphraseAction->setStatusTip(tr("Change the passphrase used for wallet encryption"));
    unlockWalletAction = new QAction(tr("&Unlock Wallet..."), this);
    unlockWalletAction->setToolTip(tr("Unlock wallet"));
    lockWalletAction = new QAction(tr("&Lock Wallet"), this);
    signMessageAction = new QAction(platformStyle->TextColorIcon(":/icons/edit"), tr("Sign &message..."), this);
    signMessageAction->setStatusTip(tr("Sign messages with your Kore addresses to prove you own them"));
    verifyMessageAction = new QAction(platformStyle->TextColorIcon(":/icons/verify"), tr("&Verify message..."), this);
    verifyMessageAction->setStatusTip(tr("Verify messages to ensure they were signed with specified Kore addresses"));
    multiSendAction = new QAction(QIcon(":/icons/edit"), tr("&MultiSend"), this);
    multiSendAction->setToolTip(tr("MultiSend Settings"));
    multiSendAction->setCheckable(true);

    openRepairAction = new QAction(QIcon(":/icons/options"), tr("Wallet &Repair"), this);
    openRepairAction->setStatusTip(tr("Show wallet repair options"));
    openConfEditorAction = new QAction(QIcon(":/icons/edit"), tr("Open Wallet &Configuration File"), this);
    openConfEditorAction->setStatusTip(tr("Open configuration file"));
    openMNConfEditorAction = new QAction(QIcon(":/icons/edit"), tr("Open &Masternode Configuration File"), this);
    openMNConfEditorAction->setStatusTip(tr("Open Masternode configuration file"));
    showBackupsAction = new QAction(QIcon(":/icons/browse"), tr("Show Automatic &Backups"), this);
    showBackupsAction->setStatusTip(tr("Show automatically created wallet backups"));

    openRPCConsoleAction = new QAction(platformStyle->TextColorIcon(":/icons/debugwindow"), tr("&Debug window"), this);
    openRPCConsoleAction->setStatusTip(tr("Open debugging and diagnostic console"));
    // initially disable the debug window menu item
    openRPCConsoleAction->setEnabled(false);

    usedSendingAddressesAction = new QAction(platformStyle->TextColorIcon(":/icons/address-book"), tr("&Sending addresses..."), this);
    usedSendingAddressesAction->setStatusTip(tr("Show the list of used sending addresses and labels"));
    usedReceivingAddressesAction = new QAction(platformStyle->TextColorIcon(":/icons/address-book"), tr("&Receiving addresses..."), this);
    usedReceivingAddressesAction->setStatusTip(tr("Show the list of used receiving addresses and labels"));

    openAction = new QAction(platformStyle->TextColorIcon(":/icons/open"), tr("Open &URI..."), this);
    openAction->setStatusTip(tr("Open a Kore: URI or payment request"));

    browserAction = new QAction(platformStyle->SingleColorIcon(":/icons/browser"), tr("&Web Browser..."), this);
    browserAction->setStatusTip(tr("Surf's up!"));

    pbxclientAction = new QAction(platformStyle->SingleColorIcon(":/icons/phone"), tr("&PBX Phone"), this);
    pbxclientAction->setStatusTip(tr("Phone"));

    openTradingwindowAction = new QAction(platformStyle->SingleColorIcon(":/icons/trade"), tr("&Trading window"), this);
    openTradingwindowAction->setStatusTip(tr("Bittrex trading window"));
    openBlockExplorerAction = new QAction(platformStyle->SingleColorIcon(":/icons/explorer"), tr("&Blockchain explorer"), this);
    openBlockExplorerAction->setStatusTip(tr("Block explorer window"));

    showHelpMessageAction = new QAction(platformStyle->TextColorIcon(":/icons/info"), tr("&Command-line options"), this);
    showHelpMessageAction->setMenuRole(QAction::NoRole);
    showHelpMessageAction->setStatusTip(tr("Show the Kore help message to get a list with possible Kore command-line options"));

    connect(quitAction, SIGNAL(triggered()), qApp, SLOT(quit()));
    connect(aboutAction, SIGNAL(triggered()), this, SLOT(aboutClicked()));
    connect(aboutQtAction, SIGNAL(triggered()), qApp, SLOT(aboutQt()));
    connect(optionsAction, SIGNAL(triggered()), this, SLOT(optionsClicked()));
    connect(toggleHideAction, SIGNAL(triggered()), this, SLOT(toggleHidden()));
    connect(showHelpMessageAction, SIGNAL(triggered()), this, SLOT(showHelpMessageClicked()));
    connect(browserAction, SIGNAL(triggered()), this, SLOT(browserClicked()));

    connect(openRPCConsoleAction, SIGNAL(triggered()), this, SLOT(showDebugWindow()));
    // prevents an open debug window from becoming stuck/unusable on client shutdown
    connect(quitAction, SIGNAL(triggered()), rpcConsole, SLOT(hide()));

#ifdef ENABLE_WALLET
    if(walletFrame)
    {
        connect(encryptWalletAction, SIGNAL(triggered(bool)), walletFrame, SLOT(encryptWallet(bool)));
        connect(backupWalletAction, SIGNAL(triggered()), walletFrame, SLOT(backupWallet()));
        connect(changePassphraseAction, SIGNAL(triggered()), walletFrame, SLOT(changePassphrase()));
        connect(unlockWalletAction, SIGNAL(triggered()), walletFrame, SLOT(unlockWallet()));
        connect(lockWalletAction, SIGNAL(triggered()), walletFrame, SLOT(lockWallet()));
        connect(signMessageAction, SIGNAL(triggered()), this, SLOT(gotoSignMessageTab()));
        connect(verifyMessageAction, SIGNAL(triggered()), this, SLOT(gotoVerifyMessageTab()));
        connect(usedSendingAddressesAction, SIGNAL(triggered()), walletFrame, SLOT(usedSendingAddresses()));
        connect(usedReceivingAddressesAction, SIGNAL(triggered()), walletFrame, SLOT(usedReceivingAddresses()));
        connect(openAction, SIGNAL(triggered()), walletFrame, SLOT(openClicked()));
        connect(multiSendAction, SIGNAL(triggered()), walletFrame, SLOT(gotoMultiSendDialog()));
        connect(pbxclientAction, SIGNAL(triggered()), walletFrame, SLOT(gotoPbxClient()));
        connect(openBlockExplorerAction, SIGNAL(triggered()), walletFrame, SLOT(gotoBlockExplorerPage()));
        connect(openTradingwindowAction, SIGNAL(triggered()), walletFrame, SLOT(gotoTradingPage()));

    }
#endif // ENABLE_WALLET

    new QShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_C), this, SLOT(showDebugWindowActivateConsole()));
    new QShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_D), this, SLOT(showDebugWindow()));
}

void KoreGUI::createMenuBar()
{
#ifdef Q_OS_MAC
    // Create a decoupled menu bar on Mac which stays even if the window is closed
    appMenuBar = new QMenuBar();
#else
    // Get the main window's menu bar on other platforms
    appMenuBar = menuBar();
#endif

    // Configure the menus
    QMenu *file = appMenuBar->addMenu(tr("&File"));
#if defined(Q_OS_WIN)
        file->setStyleSheet("font-weight: bold; color: black, background-color: transparent");
#endif

    if(walletFrame)
    {
        file->addAction(openAction);
        file->addAction(backupWalletAction);
        file->addAction(signMessageAction);
        file->addAction(verifyMessageAction);
        file->addSeparator();
        file->addAction(usedSendingAddressesAction);
        file->addAction(usedReceivingAddressesAction);
        file->addSeparator();
    }
    file->addAction(quitAction);

    QMenu *settings = appMenuBar->addMenu(tr("&Settings"));
#if defined(Q_OS_WIN)
        settings->setStyleSheet("font-weight: bold; color: black, background-color: transparent");
#endif
    if(walletFrame)
    {
        settings->addAction(encryptWalletAction);
        settings->addAction(changePassphraseAction);
        settings->addAction(unlockWalletAction);
        settings->addAction(lockWalletAction);
        settings->addAction(multiSendAction);
        settings->addSeparator();
    }
    settings->addAction(optionsAction);

    if (walletFrame) {

        QMenu* tools = appMenuBar->addMenu(tr("&Tools"));
#if defined(Q_OS_WIN)
        tools->setStyleSheet("font-weight: bold; color: black, background-color: transparent");
#endif
        tools->addAction(openRepairAction);
        tools->addAction(openConfEditorAction);
        tools->addAction(openMNConfEditorAction);
        tools->addAction(showBackupsAction);
    }

    QMenu *help = appMenuBar->addMenu(tr("&Help"));
#if defined(Q_OS_WIN)
        help->setStyleSheet("font-weight: bold; color: black, background-color: transparent");
#endif

    if(walletFrame)
    {
        help->addAction(openRPCConsoleAction);
    }
    help->addAction(showHelpMessageAction);
    help->addSeparator();
    help->addAction(aboutAction);
    help->addAction(aboutQtAction);
}

void KoreGUI::engageDisengageMining(int cores)
{
    isMiningEngaged = false;
    if (cores > 0)
        isMiningEngaged = true;

    GenerateKores(isMiningEngaged, cores, Params());

}

void KoreGUI::createToolBars()
{
    labelLogo = new QLabel();
    labelLogo->show();
    labelLogo->setPixmap(QPixmap(":icons/banner"));

    QToolBar *toolbar = addToolBar(tr("Tabs toolbar"));
    addToolBar(Qt::LeftToolBarArea, toolbar);
    toolbar->setOrientation(Qt::Vertical);
    toolbar->setFixedWidth(228);
    toolbar->setFixedHeight(450);
    //toolbar->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
    toolbar->setMovable(false);
    toolbar->addWidget(labelLogo);
    toolbar->setIconSize(QSize(50,20));
    toolbar->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
    QWidget* space = new QWidget();
    space->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
    toolbar->addWidget(space);
    toolbar->setStyleSheet("#toolbar {border-radius: 20px; font-weight:600; background:rgba(255, 255, 255, 0); text-align: left; min-width:180px;} QToolBar QToolButton { font-weight:600;font-size:12px; padding-left:20px; padding-right:180px; padding-top:4px;padding-bottom:4px; width:100%; text-align: left; text-transform:uppercase; }");

    if(walletFrame)
    {
        toolbar->addAction(overviewAction);
        overviewAction->setChecked(true);
        toolbar->addAction(sendCoinsAction);
        toolbar->addAction(receiveCoinsAction);
        toolbar->addAction(historyAction);
        toolbar->addAction(masternodeAction);
        toolbar->addAction(openBlockExplorerAction);
        toolbar->addAction(openTradingwindowAction);
    }

    //browserButton = new QPushButton(this);
    //browserButton->setText("Web Browser");
    //connect(browserButton, SIGNAL(released()), this, SLOT(browserClicked()));
    //toolbar->addWidget(browserButton);

    toolbar->addWidget(space);

}

void KoreGUI::setClientModel(ClientModel *clientModel)
{
    this->clientModel = clientModel;
    if(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();

        // Keep up to date with client
        setNumConnections(clientModel->getNumConnections());
        connect(clientModel, SIGNAL(numConnectionsChanged(int)), this, SLOT(setNumConnections(int)));

        setNumBlocks(clientModel->getNumBlocks(), clientModel->getLastBlockDate(), clientModel->getVerificationProgress(NULL));
        connect(clientModel, SIGNAL(numBlocksChanged(int,QDateTime,double)), this, SLOT(setNumBlocks(int,QDateTime,double)));

        // Receive and report messages from client model
        connect(clientModel, SIGNAL(message(QString,QString,unsigned int)), this, SLOT(message(QString,QString,unsigned int)));

        // Show progress dialog
        connect(clientModel, SIGNAL(showProgress(QString,int)), this, SLOT(showProgress(QString,int)));

        rpcConsole->setClientModel(clientModel);
#ifdef ENABLE_WALLET
        if(walletFrame)
        {
            walletFrame->setClientModel(clientModel);
        }
#endif // ENABLE_WALLET
        unitDisplayControl->setOptionsModel(clientModel->getOptionsModel());
    } else {
        // Disable possibility to show main window via action
        toggleHideAction->setEnabled(false);
        if(trayIconMenu)
        {
            // Disable context menu on tray icon
            trayIconMenu->clear();
        }
    }
}

#ifdef ENABLE_WALLET
bool KoreGUI::addWallet(const QString& name, WalletModel *walletModel)
{
    if(!walletFrame)
        return false;
    setWalletActionsEnabled(true);
    return walletFrame->addWallet(name, walletModel);
}

bool KoreGUI::setCurrentWallet(const QString& name)
{
    if(!walletFrame)
        return false;
    return walletFrame->setCurrentWallet(name);
}

void KoreGUI::removeAllWallets()
{
    if(!walletFrame)
        return;
    setWalletActionsEnabled(false);
    walletFrame->removeAllWallets();
}
#endif // ENABLE_WALLET

void KoreGUI::setWalletActionsEnabled(bool enabled)
{
    overviewAction->setEnabled(enabled);
    sendCoinsAction->setEnabled(enabled);
    sendCoinsMenuAction->setEnabled(enabled);
    receiveCoinsAction->setEnabled(enabled);
    receiveCoinsMenuAction->setEnabled(enabled);
    historyAction->setEnabled(enabled);
    masternodeAction->setEnabled(enabled);
    encryptWalletAction->setEnabled(enabled);
    backupWalletAction->setEnabled(enabled);
    changePassphraseAction->setEnabled(enabled);
    signMessageAction->setEnabled(enabled);
    verifyMessageAction->setEnabled(enabled);
    usedSendingAddressesAction->setEnabled(enabled);
    usedReceivingAddressesAction->setEnabled(enabled);
    openAction->setEnabled(enabled);
}

void KoreGUI::createTrayIcon(const NetworkStyle *networkStyle)
{
#ifndef Q_OS_MAC
    trayIcon = new QSystemTrayIcon(this);
    QString toolTip = tr("Kore client") + " " + networkStyle->getTitleAddText();
    trayIcon->setToolTip(toolTip);
    trayIcon->setIcon(networkStyle->getTrayAndWindowIcon());
    trayIcon->show();
#endif

    notificator = new Notificator(QApplication::applicationName(), trayIcon, this);
}

void KoreGUI::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();
    trayIconMenu->addAction(browserAction);
    trayIconMenu->addSeparator();
    trayIconMenu->addAction(sendCoinsMenuAction);
    trayIconMenu->addAction(receiveCoinsMenuAction);
    trayIconMenu->addSeparator();
    trayIconMenu->addAction(signMessageAction);
    trayIconMenu->addAction(verifyMessageAction);
    trayIconMenu->addSeparator();
    trayIconMenu->addAction(optionsAction);
    trayIconMenu->addAction(openTradingwindowAction);
    trayIconMenu->addSeparator();
    trayIconMenu->addAction(openRPCConsoleAction);
    trayIconMenu->addAction(openRepairAction);
    trayIconMenu->addSeparator();
    trayIconMenu->addAction(openConfEditorAction);
    trayIconMenu->addAction(openMNConfEditorAction);
    trayIconMenu->addAction(showBackupsAction);
    trayIconMenu->addAction(openBlockExplorerAction);
#ifndef Q_OS_MAC // This is built-in on Mac
    trayIconMenu->addSeparator();
    trayIconMenu->addAction(quitAction);
#endif
}

#ifndef Q_OS_MAC
void KoreGUI::trayIconActivated(QSystemTrayIcon::ActivationReason reason)
{
    if(reason == QSystemTrayIcon::Trigger)
    {
        // Click on system tray icon triggers show/hide of the main window
        toggleHidden();
    }
}
#endif

void KoreGUI::optionsClicked()
{
    if(!clientModel || !clientModel->getOptionsModel())
        return;

    OptionsDialog dlg(this, enableWallet);
    dlg.setModel(clientModel->getOptionsModel());
    dlg.exec();
}

void KoreGUI::aboutClicked()
{
    if(!clientModel)
        return;

    HelpMessageDialog dlg(this, true);
    dlg.exec();
}

void KoreGUI::showDebugWindow()
{
    rpcConsole->showNormal();
    rpcConsole->show();
    rpcConsole->raise();
    rpcConsole->activateWindow();
}

void KoreGUI::showDebugWindowActivateConsole()
{
    rpcConsole->setTabFocus(RPCConsole::TAB_CONSOLE);
    showDebugWindow();
}

void KoreGUI::showHelpMessageClicked()
{
    helpMessageDialog->show();
}

void KoreGUI::browserClicked()
{
   // BrowserApplication::instance()->newMainWindow();
}

void KoreGUI::gotoPbxClient()
{
    pbxclientAction->setChecked(true);
    if (walletFrame) walletFrame->gotoPbxClient();
}

#ifdef ENABLE_WALLET
void KoreGUI::openClicked()
{
    OpenURIDialog dlg(this);
    if(dlg.exec())
    {
        Q_EMIT receivedURI(dlg.getURI());
    }
}

void KoreGUI::gotoOverviewPage()
{
    overviewAction->setChecked(true);
    if (walletFrame) walletFrame->gotoOverviewPage();
}

void KoreGUI::gotoHistoryPage()
{
    historyAction->setChecked(true);
    if (walletFrame) walletFrame->gotoHistoryPage();
}

void KoreGUI::gotoMasternodePage()
{
    QSettings settings;
    if (settings.value("fShowMasternodesTab").toBool()) {
        masternodeAction->setChecked(true);
        if (walletFrame) walletFrame->gotoMasternodePage();
    }
}

void KoreGUI::gotoReceiveCoinsPage()
{
    receiveCoinsAction->setChecked(true);
    if (walletFrame) walletFrame->gotoReceiveCoinsPage();
}

void KoreGUI::gotoSendCoinsPage(QString addr)
{
    sendCoinsAction->setChecked(true);
    if (walletFrame) walletFrame->gotoSendCoinsPage(addr);
}

void KoreGUI::gotoSignMessageTab(QString addr)
{
    if (walletFrame) walletFrame->gotoSignMessageTab(addr);
}

void KoreGUI::gotoVerifyMessageTab(QString addr)
{
    if (walletFrame) walletFrame->gotoVerifyMessageTab(addr);
}

void KoreGUI::gotoTradingPage()
{
    overviewAction->setChecked(true);
    if (walletFrame) walletFrame->gotoTradingPage();
}

void KoreGUI::gotoMultiSendDialog()
{
    multiSendAction->setChecked(true);
    if (walletFrame)
        walletFrame->gotoMultiSendDialog();
}
void KoreGUI::gotoBlockExplorerPage()
{
    if (walletFrame) walletFrame->gotoBlockExplorerPage();
}

#endif // ENABLE_WALLET

void KoreGUI::setNumConnections(int count)
{
    QString icon;
    switch(count)
    {
    case 0: icon = ":/icons/connect_0"; break;
    case 1: case 2: case 3: icon = ":/icons/connect_1"; break;
    case 4: case 5: case 6: icon = ":/icons/connect_2"; break;
    case 7: case 8: case 9: icon = ":/icons/connect_3"; break;
    default: icon = ":/icons/connect_4"; break;
    }
    labelConnectionsIcon->setPixmap(platformStyle->SingleColorIcon(icon).pixmap(STATUSBAR_ICONSIZE,STATUSBAR_ICONSIZE));
    labelConnectionsIcon->setToolTip(tr("%n active connection(s) to Kore network", "", count));
}

void KoreGUI::setNumBlocks(int count, const QDateTime& blockDate, double nVerificationProgress)
{
    if(!clientModel)
        return;

    // Prevent orphan statusbar messages (e.g. hover Quit in main menu, wait until chain-sync starts -> garbelled text)
    statusBar()->clearMessage();

    // Acquire current block source
    enum BlockSource blockSource = clientModel->getBlockSource();
    switch (blockSource) {
        case BLOCK_SOURCE_NETWORK:
            progressBarLabel->setText(tr("Syncing with network..."));
            break;
        case BLOCK_SOURCE_DISK:
            progressBarLabel->setText(tr("Importing blocks from disk..."));
            break;
        case BLOCK_SOURCE_REINDEX:
            progressBarLabel->setText(tr("Reindexing blocks on disk..."));
            break;
        case BLOCK_SOURCE_NONE:
            // Case: not Importing, not Reindexing and no network connection
            progressBarLabel->setText(tr("No block source available..."));
            break;
    }

    QString tooltip;

    QDateTime lastBlockDate = clientModel->getLastBlockDate();
    QDateTime currentDate = QDateTime::currentDateTime();
    qint64 secs = blockDate.secsTo(currentDate);

    tooltip = tr("Processed %n block(s) of transaction history.", "", count);

    // Set icon state: spinning if catching up, tick otherwise
    //if(secs < 25*60)
    if (masternodeSync.IsBlockchainSynced()) {
        QString strSyncStatus;
        tooltip = tr("Up to date") + QString(".<br>") + tooltip;

        if (masternodeSync.IsSynced()) {
            progressBarLabel->setVisible(false);
            progressBar->setVisible(false);
            labelBlocksIcon->setPixmap(QIcon(":/icons/synced").pixmap(STATUSBAR_ICONSIZE, STATUSBAR_ICONSIZE));
        } else {
            int nAttempt;
            int progress = 0;

            labelBlocksIcon->setPixmap(QIcon(QString(
                                                 ":/movies/spinner-%1")
                                                 .arg(spinnerFrame, 3, 10, QChar('0')))
                                           .pixmap(STATUSBAR_ICONSIZE, STATUSBAR_ICONSIZE));
            spinnerFrame = (spinnerFrame + 1) % SPINNER_FRAMES;

#ifdef ENABLE_WALLET
            if (walletFrame)
                walletFrame->showOutOfSyncWarning(false);
#endif // ENABLE_WALLET

            nAttempt = masternodeSync.RequestedMasternodeAttempt < MASTERNODE_SYNC_THRESHOLD ?
                           masternodeSync.RequestedMasternodeAttempt + 1 :
                           MASTERNODE_SYNC_THRESHOLD;
            progress = nAttempt + (masternodeSync.RequestedMasternodeAssets - 1) * MASTERNODE_SYNC_THRESHOLD;
            progressBar->setMaximum(4 * MASTERNODE_SYNC_THRESHOLD);
            progressBar->setFormat(tr("Syncing additional data: %p%"));
            progressBar->setValue(progress);
        }

        strSyncStatus = QString(masternodeSync.GetSyncStatus().c_str());
        progressBarLabel->setText(strSyncStatus);
        tooltip = strSyncStatus + QString("<br>") + tooltip;
    } else
    {
        // Represent time from last generated block in human readable text
        QString timeBehindText;
        const int HOUR_IN_SECONDS = 60*60;
        const int DAY_IN_SECONDS = 24*60*60;
        const int WEEK_IN_SECONDS = 7*24*60*60;
        const int YEAR_IN_SECONDS = 31556952; // Average length of year in Gregorian calendar
        if(secs < 2*DAY_IN_SECONDS)
        {
            timeBehindText = tr("%n hour(s)","",secs/HOUR_IN_SECONDS);
        }
        else if(secs < 2*WEEK_IN_SECONDS)
        {
            timeBehindText = tr("%n day(s)","",secs/DAY_IN_SECONDS);
        }
        else if(secs < YEAR_IN_SECONDS)
        {
            timeBehindText = tr("%n week(s)","",secs/WEEK_IN_SECONDS);
        }
        else
        {
            qint64 years = secs / YEAR_IN_SECONDS;
            qint64 remainder = secs % YEAR_IN_SECONDS;
            timeBehindText = tr("%1 and %2").arg(tr("%n year(s)", "", years)).arg(tr("%n week(s)","", remainder/WEEK_IN_SECONDS));
        }

        progressBarLabel->setVisible(true);
        progressBar->setFormat(tr("%1 behind").arg(timeBehindText));
        progressBar->setMaximum(1000000000);
        progressBar->setValue(nVerificationProgress * 1000000000.0 + 0.5);
        progressBar->setVisible(true);

        tooltip = tr("Catching up...") + QString("<br>") + tooltip;
        if(count != prevBlocks)
        {
            labelBlocksIcon->setPixmap(platformStyle->SingleColorIcon(QString(
                ":/movies/spinner-%1").arg(spinnerFrame, 3, 10, QChar('0')))
                .pixmap(STATUSBAR_ICONSIZE, STATUSBAR_ICONSIZE));
            spinnerFrame = (spinnerFrame + 1) % SPINNER_FRAMES;
        }
        prevBlocks = count;

#ifdef ENABLE_WALLET
        if(walletFrame)
            walletFrame->showOutOfSyncWarning(true);
#endif // ENABLE_WALLET

        tooltip += QString("<br>");
        tooltip += tr("Last received block was generated %1 ago.").arg(timeBehindText);
        tooltip += QString("<br>");
        tooltip += tr("Transactions after this will not yet be visible.");
    }

    // Don't word-wrap this (fixed-width) tooltip
    tooltip = QString("<nobr>") + tooltip + QString("</nobr>");

    labelBlocksIcon->setToolTip(tooltip);
    progressBarLabel->setToolTip(tooltip);
    progressBar->setToolTip(tooltip);
}

void KoreGUI::message(const QString &title, const QString &message, unsigned int style, bool *ret)
{
    QString strTitle = tr("Kore"); // default title
    // Default to information icon
    int nMBoxIcon = QMessageBox::Information;
    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:
            break;
        }
    }
    // Append title to "Kore- "
    if (!msgType.isEmpty())
        strTitle += " - " + msgType;

    // Check for error/warning icon
    if (style & CClientUIInterface::ICON_ERROR) {
        nMBoxIcon = QMessageBox::Critical;
        nNotifyIcon = Notificator::Critical;
    }
    else if (style & CClientUIInterface::ICON_WARNING) {
        nMBoxIcon = QMessageBox::Warning;
        nNotifyIcon = Notificator::Warning;
    }

    // Display message
    if (style & CClientUIInterface::MODAL) {
        // Check for buttons, use OK as default, if none was supplied
        QMessageBox::StandardButton buttons;
        if (!(buttons = (QMessageBox::StandardButton)(style & CClientUIInterface::BTN_MASK)))
            buttons = QMessageBox::Ok;

        showNormalIfMinimized();
        QMessageBox mBox((QMessageBox::Icon)nMBoxIcon, strTitle, message, buttons, this);
        int r = mBox.exec();
        if (ret != NULL)
            *ret = r == QMessageBox::Ok;
    }
    else
        notificator->notify((Notificator::Class)nNotifyIcon, strTitle, message);
}

void KoreGUI::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 KoreGUI::closeEvent(QCloseEvent *event)
{
    if (isMiningEngaged)
        engageDisengageMining(0);
#ifndef Q_OS_MAC // Ignored on Mac
    if(clientModel && clientModel->getOptionsModel())
    {
        if(!clientModel->getOptionsModel()->getMinimizeToTray() &&
           !clientModel->getOptionsModel()->getMinimizeOnClose())
        {
            // close rpcConsole in case it was open to make some space for the shutdown window
            rpcConsole->close();

            QApplication::quit();
        }
    }
#endif
    QMainWindow::closeEvent(event);
}

void KoreGUI::showEvent(QShowEvent *event)
{
    // enable the debug window when the main window shows up
    openRPCConsoleAction->setEnabled(true);
    aboutAction->setEnabled(true);
    optionsAction->setEnabled(true);
}

#ifdef ENABLE_WALLET
void KoreGUI::incomingTransaction(const QString& date, int unit, const CAmount& amount, const QString& type, const QString& address, const QString& label)
{
    // On new transaction, make an info balloon
    QString msg = tr("Date: %1\n").arg(date) +
                  tr("Amount: %1\n").arg(KoreUnits::formatWithUnit(unit, amount, true)) +
                  tr("Type: %1\n").arg(type);
    if (!label.isEmpty())
        msg += tr("Label: %1\n").arg(label);
    else if (!address.isEmpty())
        msg += tr("Address: %1\n").arg(address);
    message((amount)<0 ? tr("Sent transaction") : tr("Incoming transaction"),
             msg, CClientUIInterface::MSG_INFORMATION);
}
#endif // ENABLE_WALLET

void KoreGUI::dragEnterEvent(QDragEnterEvent *event)
{
    // Accept only URIs
    if(event->mimeData()->hasUrls())
        event->acceptProposedAction();
}

void KoreGUI::dropEvent(QDropEvent *event)
{
    if(event->mimeData()->hasUrls())
    {
        Q_FOREACH(const QUrl &uri, event->mimeData()->urls())
        {
            Q_EMIT receivedURI(uri.toString());
        }
    }
    event->acceptProposedAction();
}

bool KoreGUI::eventFilter(QObject *object, QEvent *event)
{
    // Catch status tip events
    if (event->type() == QEvent::StatusTip)
    {
        // Prevent adding text from setStatusTip(), if we currently use the status bar for displaying other stuff
        if (progressBarLabel->isVisible() || progressBar->isVisible())
            return true;
    }
    return QMainWindow::eventFilter(object, event);
}

void KoreGUI::setStakingStatus()
{
    if (pwalletMain)
        fMultiSend = pwalletMain->isMultiSendEnabled();
    if (nLastCoinStakeSearchInterval) {
        labelStakingIcon->show();
        labelStakingIcon->setPixmap(QIcon(":/icons/staking_active").pixmap(STATUSBAR_ICONSIZE, STATUSBAR_ICONSIZE));
        labelStakingIcon->setToolTip(tr("Staking is active\n MultiSend: %1").arg(fMultiSend ? tr("Active") : tr("Not Active")));
    } else {
        labelStakingIcon->show();
        labelStakingIcon->setPixmap(QIcon(":/icons/staking_inactive").pixmap(STATUSBAR_ICONSIZE, STATUSBAR_ICONSIZE));
        labelStakingIcon->setToolTip(tr("Staking is not active\n MultiSend: %1").arg(fMultiSend ? tr("Active") : tr("Not Active")));
    }
}

#ifdef ENABLE_WALLET
bool KoreGUI::handlePaymentRequest(const SendCoinsRecipient& recipient)
{
    // URI has to be valid
    if (walletFrame && walletFrame->handlePaymentRequest(recipient))
    {
        showNormalIfMinimized();
        gotoSendCoinsPage();
        return true;
    }
    return false;
}

void KoreGUI::setEncryptionStatus(int status)
{
    switch(status)
    {
    case WalletModel::Unencrypted:
        labelEncryptionIcon->hide();
        encryptWalletAction->setChecked(false);
        changePassphraseAction->setEnabled(false);
        unlockWalletAction->setVisible(false);
        lockWalletAction->setVisible(false);
        encryptWalletAction->setEnabled(true);
        break;
    case WalletModel::Unlocked:
        nLastCoinStakeSearchInterval = 1;
        labelEncryptionIcon->show();
        labelEncryptionIcon->setPixmap(platformStyle->SingleColorIcon(":/icons/lock_open").pixmap(STATUSBAR_ICONSIZE,STATUSBAR_ICONSIZE));
        labelEncryptionIcon->setToolTip(tr("Wallet is <b>encrypted</b> and currently <b>unlocked</b>"));
        encryptWalletAction->setChecked(true);
        changePassphraseAction->setEnabled(true);
        unlockWalletAction->setVisible(false);
        lockWalletAction->setVisible(true);
        encryptWalletAction->setEnabled(false); // TODO: decrypt currently not supported
        break;
    case WalletModel::UnlockedForAnonymizationOnly:
        nLastCoinStakeSearchInterval = 1;
        labelEncryptionIcon->show();
        labelEncryptionIcon->setPixmap(QIcon(":/icons/lock_open").pixmap(STATUSBAR_ICONSIZE, STATUSBAR_ICONSIZE));
        labelEncryptionIcon->setToolTip(tr("Wallet is <b>encrypted</b> and currently <b>unlocked</b> for anonimization and staking only"));
        encryptWalletAction->setChecked(true);
        changePassphraseAction->setEnabled(true);
        unlockWalletAction->setVisible(true);
        lockWalletAction->setVisible(true);
        encryptWalletAction->setEnabled(false); // TODO: decrypt currently not supported
        break;
    case WalletModel::Locked:
        nLastCoinStakeSearchInterval = 0;
        //printf("nLastCoinStakeSearchInterval ===== %d\n", nLastCoinStakeSearchInterval);
        labelEncryptionIcon->show();
        labelEncryptionIcon->setPixmap(platformStyle->SingleColorIcon(":/icons/lock_closed").pixmap(STATUSBAR_ICONSIZE,STATUSBAR_ICONSIZE));
        labelEncryptionIcon->setToolTip(tr("Wallet is <b>encrypted</b> and currently <b>locked</b>"));
        encryptWalletAction->setChecked(true);
        changePassphraseAction->setEnabled(true);
        unlockWalletAction->setVisible(true);
        lockWalletAction->setVisible(false);
        encryptWalletAction->setEnabled(false); // TODO: decrypt currently not supported
        break;
    }

}
#endif // ENABLE_WALLET

void KoreGUI::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 KoreGUI::toggleHidden()
{
    showNormalIfMinimized(true);
}

void KoreGUI::detectShutdown()
{
    if (ShutdownRequested())
    {
        if (isMiningEngaged)
            engageDisengageMining(0);
        if(rpcConsole)
            rpcConsole->hide();
        qApp->quit();
    }
}

void KoreGUI::showProgress(const QString &title, int nProgress)
{
    if (nProgress == 0)
    {
        progressDialog = new QProgressDialog(title, "", 0, 100);
        progressDialog->setWindowModality(Qt::ApplicationModal);
        progressDialog->setMinimumDuration(0);
        progressDialog->setCancelButton(0);
        progressDialog->setAutoClose(false);
        progressDialog->setValue(0);
    }
    else if (nProgress == 100)
    {
        if (progressDialog)
        {
            progressDialog->close();
            progressDialog->deleteLater();
        }
    }
    else if (progressDialog)
        progressDialog->setValue(nProgress);
}

static bool ThreadSafeMessageBox(KoreGUI *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;
    // 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 KoreGUI::subscribeToCoreSignals()
{
    // Connect signals to client
    uiInterface.ThreadSafeMessageBox.connect(boost::bind(ThreadSafeMessageBox, this, _1, _2, _3));
}

void KoreGUI::unsubscribeFromCoreSignals()
{
    // Disconnect signals from client
    uiInterface.ThreadSafeMessageBox.disconnect(boost::bind(ThreadSafeMessageBox, this, _1, _2, _3));
}

/** Get restart command-line parameters and request restart */
void KoreGUI::handleRestart(QStringList args)
{
    if (!ShutdownRequested())
        Q_EMIT requestedRestart(args);
}

UnitDisplayStatusBarControl::UnitDisplayStatusBarControl(const PlatformStyle *platformStyle) :
    optionsModel(0),
    menu(0)
{
    createContextMenu();
    setToolTip(tr("Unit to show amounts in. Click to select another unit."));
    QList<KoreUnits::Unit> units = KoreUnits::availableUnits();
    int max_width = 0;
    const QFontMetrics fm(font());
    Q_FOREACH (const KoreUnits::Unit unit, units)
    {
        max_width = qMax(max_width, fm.width(KoreUnits::name(unit)));
    }
    setMinimumSize(max_width, 0);
    setAlignment(Qt::AlignRight | Qt::AlignVCenter);
    setStyleSheet(QString("QLabel { color : %1 }").arg(platformStyle->SingleColor().name()));
}

/** So that it responds to button clicks */
void UnitDisplayStatusBarControl::mousePressEvent(QMouseEvent *event)
{
    onDisplayUnitsClicked(event->pos());
}

/** Creates context menu, its actions, and wires up all the relevant signals for mouse events. */
void UnitDisplayStatusBarControl::createContextMenu()
{
    menu = new QMenu();
    Q_FOREACH(KoreUnits::Unit u, KoreUnits::availableUnits())
    {
        QAction *menuAction = new QAction(QString(KoreUnits::name(u)), this);
        menuAction->setData(QVariant(u));
        menu->addAction(menuAction);
    }
    connect(menu,SIGNAL(triggered(QAction*)),this,SLOT(onMenuSelection(QAction*)));
}

/** Lets the control know about the Options Model (and its signals) */
void UnitDisplayStatusBarControl::setOptionsModel(OptionsModel *optionsModel)
{
    if (optionsModel)
    {
        this->optionsModel = optionsModel;

        // be aware of a display unit change reported by the OptionsModel object.
        connect(optionsModel,SIGNAL(displayUnitChanged(int)),this,SLOT(updateDisplayUnit(int)));

        // initialize the display units label with the current value in the model.
        updateDisplayUnit(optionsModel->getDisplayUnit());
    }
}

/** When Display Units are changed on OptionsModel it will refresh the display text of the control on the status bar */
void UnitDisplayStatusBarControl::updateDisplayUnit(int newUnits)
{
    setText(KoreUnits::name(newUnits));
}

/** Shows context menu with Display Unit options by the mouse coordinates */
void UnitDisplayStatusBarControl::onDisplayUnitsClicked(const QPoint& point)
{
    QPoint globalPos = mapToGlobal(point);
    menu->exec(globalPos);
}

/** Tells underlying optionsModel to update its current display unit. */
void UnitDisplayStatusBarControl::onMenuSelection(QAction* action)
{
    if (action)
    {
        optionsModel->setDisplayUnit(action->data());
    }
}


text:
Wrongful Death in Virginia
October 01, 2013 in Criminal Defense - State & Federal; Personal Injury & Wrongful Death;
Every death caused by the negligence of another is horrific and brings with it untold pain to friends and loved ones of the decedent. I do not mean to diminish that point in this note. Nonetheless, all deaths are not the same under the law and my purpose here is to point out a few of the things that make a difference in resolving such a circumstance for the ones left behind.
Virginia like most states has a procedure set forth in its statutes for dealing with the civil ramifications arising from the death of an individual due to the negligence of another person or persons. The same procedure would also apply when the death is caused by the intentional act of another person but those instances are thankfully not as common. I have dealt with a number of those cases both as a plaintiff attorney and as a defense attorney. These are complex cases involving a number of significant issues and the results can vary dramatically based upon all the facts that surround the tragedy. Every life does not have the same verdict or settlement value under the law. That is not a comment on the morality of legal doctrine but instead is a comment on the fact that the law of negligence is designed to compensate the victim not to punish the wrongdoer. Because the law cannot undo what has been done, compensation of the victim equals payment of money to the victim or in wrongful death cases to the victim's survivors (beneficiaries under Virginia law). The question becomes: how much?
The most significant fact that affects the compensation available to the victims' beneficiaries is the source of payment. I know that sounds crass but the truth of the matter is that if a derelict accidently causes the death of another, regardless of how much that death inflicts pain and suffering on the family, there is no source of payment from him/her for the loss. On the other hand, when the accident is caused by a corporate giant with abundant funds, the "value" of the case rises because it can be recovered. This is the "deep pocket" scenario about which much has been written. Not surprisingly then, when the big companies get involved in these types of cases, they take them very seriously, both morally and civilly and put their resources to work to be sure that the case is resolved appropriately under the law. As a corollary, because every personal injury lawyer lives by the deep pocket concept they are inclined to stretch the circumstances to try to create fault on the part of the deep pocket with the hope that a settlement can be reached. In other words to try to convince the "pocket" that paying something is better than risking losing a much greater amount. This risk analysis is crucial on both sides of a case because faulty analysis can prevent fair settlements and lead to trials with disastrous results. I am proud to say I have undertaken that task for several national companies and am equally proud to report that each acted appropriately under the circumstances sometimes by going to trial and sometimes by seeking alternative solutions.
Assuming that there is a viable and valid source for recovery, the next biggest factor to come into play is the nature of the beneficiaries. Under Virginia law, there are classes of beneficiaries that include spouse and children, parents and siblings, and others. If there are no surviving beneficiaries in the first class then the recovery is divided by members of the second class and so on. Not surprisingly, a deceased bread winner who leaves behind a spouse and two small children with all the emotional and financial damages attendant to that leaves a totally different claim from that of a senior citizen who had no surviving children or parents. Most cases fall somewhere in between and thus the compensation appropriate varies dramatically from case to case. Make note that Virginia law make no provision for couples of the same sex since they are not "spouses".
The next most significant factor is the degree of culpability of the defendant. Under Virginia law the doctrine of contributory negligence applies which means that there is no recovery available for the statutory beneficiaries if the deceased was at all negligent in the incident causing his/her death. Thus, it may seem odd that I reference a degree of culpability when, as a matter of law, every successful case requires that the defendant be one hundred percent at fault but a particularly bad set of facts can lead to an enhanced result. For instance an interstate accident in which a driver is speeding a little over the speed limit and loses control on a rain soaked highway causing a mortal accident is an entirely different case from one in which the defendant has consumed alcohol and while racing on the highway loses control. In some instance where the behavior is particularly dangerous and reckless, an award of "punitive damages" may be available but they are the exception rather than the rule. Still, all negligence is not the same and to the degree that a jury may feel that the defendant was particularly negligent the jury award will go up.
The above are just a few of the issues that may arise in prosecuting or defending a tragic death whether arising from automobile accidents, hunting accidents, product defects or some other means of death. While we all acknowledge the senselessness of the loss of life in those circumstances, the law has its own way of dealing with the aftermath. Justice is blind but not ignorant and neither should the lawyer be.
****Legal notes are not legal advice. Because legal problems are factually intensive, the reader must always consult their counsel before acting on any legal matter. .
PREVIOUS ARTICLE The Glue Factor
NEXT ARTICLE Fiduciary Duties During Administration of Trusts and Estates
You can contact one of our attorneys by filling out the form below.
Contact Preference *
- Select One - Phone Email No Preference
- Select One - Banking & Finance Bankruptcy & Restructuring Business Contracts Child & Spousal Support Child Custody Collections & Creditors' Rights Commercial Real Estate Community Associations Construction Law Credit Unions Criminal Defense - State & Federal Divorce & Family Law DUI Defense Elder Law & Medicaid Services Eminent Domain Employment Law for Employers Environmental Law Estate & Gift Taxation Estate Planning Franchising Guardianship / Conservatorship Hotels & Hospitality Immigration Land Use & Zoning Leasing & Landlord / Tenant Litigation Mergers & Acquisitions New Business Formation Overweight Citations & Hauling Violations Personal Injury & Wrongful Death Regulatory Compliance & Export Controls Representation for Schools Residential Real Estate Tax Law White Collar Criminal Defense Will Disputes & Fiduciary Litigation Wills, Trusts & Estate Administration
Preferred Attorney
- Select One - I am not sure Ameet I. Habib Barry Dorans Bretta Z. Lewis Brian M. Latuga C. Arthur Robinson, II Carl A. Eason Christopher A. Pocta Colin A. Dale David M. Bastiaans Edward W. Wolcott, Jr. Gilbert L. Carey, Jr. Glen M. Robertson Gordon M. Wolcott James S. Panagis, Jr. Jessica A. Hayes John E. Basilone John F. Sawyer John W. Richardson Kyle D. Korte Leslie R. Watson M. Powell Peters Mark A. Andrews Mark V. Pascucci Marshall A. Winslow, Jr. Nicholas D. Renninger Regina F. Amick Ronald M. Gates Sarah G. Buitrago Scott A. Krystiniak Stephen P. Pfeiffer W. Brantley Basnight, III
Recaptcha Field

redpajama_set_name: RedPajamaCommonCrawl


text:
Steigleder's hat trick leads to 4-0 win over Mustangs
DUBUQUE– Iowa City West High's Women of Troy remained unbeaten at 5-0 overall, and 1-0 in Mississippi Valley Conference (MVC) play, with a 4-0 soccer win over Dubuque Hempstead, in Dubuque, on Thursday, April 13.
Creek Girls still undefeated
CCA girls escape South Tama with 1-0 win
TAMA– Matt Harding and his Clear Creek Amana (CCA) varsity soccer team escaped from South Tama Thursday, April 13, with their unbeaten streak intact after pulling out a challenging 1-0 win against the Trojans.
Harding said the Creek Girls outshot the Trojans 22-0 but, "(we) got battered around a fair bit and couldn't find the back of the net for much of the game."
Midway through the second half however, Carolina Herrera, a junior, found Carson Gallagher, a freshman, for Gallagher's first varsity goal, which ended up being the game-winner.
Creek Girls fifth at Anamosa Early Bird
Stratton, Barker, Roller and 4x200 take runner-up spots
ANAMOSA– The Clear Creek Amana (CCA) girls' track and field team placed fifth in team points Tuesday, April 11, at Anamosa's Early Bird Relays. Monticello won the meet with 160.5 points followed by the host Blue Raiders (116), Maquoketa Valley (102.5), Center Point-Urbana (100), the Clippers (87), Springville (67) and Dyersville Beckman (62).
Women of Troy remain undefeated on the court
IC West handles Waterloo West and Cedar Falls on a rainy Saturday
CEDAR FALLS– The Iowa City West High Women of Troy tennis team remained undefeated after a pair of matches Saturday, April 15, in Waterloo and Cedar Falls. West High defeated Waterloo West, 9-0, and took down Cedar Falls, 5-1, after rain washed out doubles competition. The wins improved West High's record to 7-0 overall and 4-0 in the Mississippi Valley Conference (MVC).
Iowa City West (ICW) def Waterloo West 9-0
Emma Koch (ICW) def Yassie Buchanan 10-2
Kaily Speer (ICW) def Minela Ikanovic 10-2
Abby Jans (ICW) def Regan Davis 10-1
Spike to End Alzheimer's at Throttle Down April 22
TIFFIN– Help support the 2017 RivALZ Female Flag Football Game by participating in an early season volleyball tournament Saturday, April 22, at Throttle Down Sports Bar & Grill, 607 E. Marengo Rd. All funds raised will be donated to the second annual RivALZ game benefiting the Alzhiemer's Association.
To register, email Brooke at brooke.g.mckenna@gmail.com. The cost is $40 per co-ed team of four players, and the tournament will take place from 9 a.m. to 3 p.m.
Learn more about RivALZ or make an additional donation at act.alz.org/rivalzeci.
Jump Rope for a New Heart April 22 in Tiffin
TIFFIN– Eric McClintock has lived his entire life with a complex heart defect called Transposition of the Great Arteries. Now 47, he is in need of a heart transplant. You can help raise money for Eric and his family during the fundraising event Jump Rope for a New Heart on Saturday, April 22, 10-11 a.m. at Drew Murphy Strength, 411 Greenfield Dr., Ste. 1B.
Each participant needs to find someone to "sponsor" him or her. The sponsor will donate an amount determined by the number of skips completed by the participant.
Sponsorship levels:
Bronze: $0.10 per skip
Silver: $0.25 per skip
Creek Boys blank the Trojans
improve to 4-1
TIFFIN– Clear Creek Amana (CCA)'s varsity boys soccer team improved to a 4-1 record with its fourth consecutive win Thursday, April 13, at home against the South Tama Trojans.
Christian Romero put the Clippers on the board with a rebound goal just inside the 16th minute while Tyreke Williams booted his second long-range free kick of the week to Nick Ritchie for a header into the goal and a 2-0 lead. Trevor King made it 3-0 in the 39th minute with a goal off an assist from Tony Zapata.
Annual golf tournament May 5 to benefit pantry
Quail Creek tournament April 23
NORTH LIBERTY– Quail Creek Golf Course is hosting its first ever Big Cup Tournament to be held in the spring. The 18-hole, four-person best shot with 8-inch cups tournament is Sunday, April 23, 9:30 a.m. to 2 p.m. at 700 Club House Rd.
The cost is $55 per player ($35 for members) or $220 for a foursome and includes a cart, fees, tournament entry and entry into pin events. Space is limited and only paid entrants will be guaranteed carts. Call the clubhouse at 319-626-2281 to reserve your spot.
Library fundraiser and 2K walk April 23
NORTH LIBERTY– It's all about the bump. The North Liberty Community Library invites community members to participate in its first Waddle Walk on Sunday, April 23, at 1 p.m., starting at the library and continuing along the trail around Liberty Centre Pond.
This 2K walk is a fundraiser to support the library's Read to the Bump program, which helps build a baby's personal library before birth by purchasing board books to give to expecting families. The program is currently offered at the North Liberty Community Pantry.


text:
6Th Ave & Avenue of the Americas $60 2,000 $ 10,000
5Th Ave & West 33rd Street Negotiable 2,000 Negotiable
Warren St & Eighth Avenue $44 2,000 $ 7,333
W 30Th St & Avenue of Americas $47 2,000 $ 7,833
W 25Th St & Eleventh Avenue $51 2,000 $ 8,500
W 32Nd St & Fifth Avenue $30 3,000 $ 7,500
W 21St St & Seventh Avenue Negotiable 3,000 Negotiable
W 27Th St & Seventh Avenue $45 3,000 $ 11,250
Eleventh Ave & West 24th Street Negotiable 3,000 Negotiable
Seventh Ave & West 25th Street Negotiable 5,000 Negotiable
W 33Rd St & Seventh Avenue Negotiable 5,000 Negotiable
W 25Th St & Eleventh Avenue $99 5,100 $ 42,075
250 West 30th Street is a 3-story office space building located in Chelsea. The total square feet is 14,700 and built in 1927. It is considered a class C building.


Harrisburg – Senator Bob Mensch (R-24) and Representative Marcy Toepel (R-147) welcomed and recognized the Souderton Area High School Girls' Soccer Team for winning the 2018 PIAA State Class 4A Girls' Soccer Championship. The Souderton Area High School Girls' Soccer Team won the State title by defeating Pennridge High School with a score of 1 to 0 in overtime.
"Claiming the championship represents more than simple athletic ability. It speaks to both training and hard work in pursuit of excellence. The success these young women are enjoying now can inspire each of us and serve as a reminder of all that can be accomplished with dedication," Toepel said.


These are the conditions specific to Intensive Literacy and Numeracy – English for Speakers of Other Languages (ESOL) funding for 2018.
See also the generic conditions that apply to Intensive Literacy and Numeracy - ESOL funding, and all other on-Plan funds.
(iii) the Education Review Office, if you are a state or state-integrated school.
B. has low English language and/or literacy skills.
(iv) if the learner is assessed using Starting Points and presents at the equivalent of below Step 1 in reading on the Learning Progressions.
(b) You must only allow a learner to re-enrol in a programme funded through the INL ESOL Fund for a period of up to 5 years in total.
(c) is flexible and tailored to respond to the particular needs of adult learners (for example, provision may be delivered at off-peak times for those in employment).
(b) has experience in teaching literacy and numeracy.
You must have in place an effective assessment process for identifying a learner's initial literacy and numeracy needs, and measure their progress, using the most appropriate version of the Literacy and Numeracy for Adults Assessment Tool (including Adult, Youth, Te Ata Hāpara and Starting Points, as appropriate).
(a) The total hours of ESOL tuition you deliver per learner is expected to be between 20 and 500 hours per year.
(b) The ESOL tuition you provide must be delivered at the intensity of 5 to 40 hours per week.
You must not charge a fee to a learner who is participating in an eligible programme for which you receive ILN ESOL Fund Funding.
You must report the Withdrawal of students to the Ministry of Social Development within 5 working days of that Withdrawal.
(b) by 30 September you will have delivered at least 70% of the provision specified in your Investment Plan.
B. learner enrolment information, including the NSN, tuition hours delivered (actual attendance) and remaining tuition hours planned (if any), demographic information, regional information, literacy and numeracy information, and the enrolment start and finish dates for each learner enrolled in each ILN ESOL programme of study or training during the period covered by the report.
You must not subcontract the delivery of ESOL provision funded from the ILN ESOL Fund.
For the purposes of this Condition, we will determine whether you have received funding that was greater than it should have been by subtracting the total number of tuition hours delivered in the calendar year (based on actual attendance) from the hours allocated to you in Appendix 1 of your funding confirmation letter.


text:
Coveo launches Quebec hiring spree after closing $227-million round
By Zane Schwartz Nov 6, 2019
The investment, led by OMERS Growth Equity, values the Quebec City-based firm at $1.46 billion. Previous investors Evergreen Coast Capital, Investissement Québec and Fonds de solidarité FTQ also participated. (The Logic)
Read this article for free
Talking point: Coveo plans to use the capital for acquisitions and staff growth—it's currently adding about 60 people a quarter, about 50 of which are based in Canada. "Coveo is a real company with real customers and it's growing," CEO Louis Têtu told The Logic. Most of the new hires will be in Montreal and Quebec City. The firm recently opened a Montreal office that has 160 people in it, but can fit 300. "It'll be full in a year," said Têtu. By nearly any metric, Coveo is now well ahead of its perennial rival, Montreal-based Element AI: the former has $100 million in annual revenue, the latter less than $10 million. Even in fundraising, Coveo's current round is larger than Element's $200-million Series B announced in September. Though Coveo has raised most of its money from Canadian investors—75 per cent of its cap table is Canadian and about 65 per cent is from Quebec—it hasn't taken subsidies from government. That's something Têtu is proud of: "We're actually demonstrating that we can build value here without government subsidy."


Our vertical blinds deals are ideal for when you need to buy more than one blind. These vertical blind offers are ideal for conservatories or simply if you're replacing a full house of blinds. We've selected some of our best selling vertical blinds and put together these unbeatable packages to save you even more. We've tried to keep the order process as simple as possible however feel free to call us if you need assistance.
Take a look at our measuring guide, we've included some videos to help you measure, we even have videos on how to measure vertical blinds for bay windows and blinds for conservatories.


text:
Q: Css match height I have an image slideshow with next/prev buttons. I'm trying to make the boxes behind the arrows' height match the main image. But right now they're stretching to the bottom of the thumbnails that are below. I tried both height: 100%, and position: absolute with top: 0 and bottom: 0, but neither of them are working. Display:flex and height: inherit didn't work either. Here's the codepen .

$(document).ready(function(){
    $('#imgDetail').animate({
    opacity: '1'
    },300);
});

$(document).ready(function(){
 // get all images loaded
  var images = $(".unidoor-class");
 // thumbnails containers
  var thumbnailContainer = $("#thumbnails");
    // generate thumbnail images
  generateThumbnails(images, thumbnailContainer);
  // listeners for controls arrows
 $(".prev-next-button").on("click touchstart", function() {
   // get the images
    var currentImageIndex = $(".unidoor-class.active").index();
  var isPrevious = $(this).hasClass("previous");
    var nextIndex;
    if (isPrevious) {
     if (currentImageIndex === 0) {
       nextIndex = images.length - 1;
      }

      if (currentImageIndex > 0) {
       nextIndex = currentImageIndex - 1;
      }
    } else {
     if (currentImageIndex === images.length - 1) {
       nextIndex = 0;
      }

      if (currentImageIndex < images.length - 1) {
       nextIndex = currentImageIndex + 1;
      }
    }

    // remove any active class from images
  images.removeClass("active");
    // get the next active image and add active class to that next current image
    $(images[nextIndex]).addClass("active");
  });

  $(".thumb").on("click touchstart", function(event){
   event.preventDefault();
    var indexSelected = $(this).data("img-index");
    var currentShown = $(".unidoor-class.active").index();
    if (currentShown === indexSelected) return false;
    images.removeClass("active");
    $(images[indexSelected]).addClass('active');
  });

  function generateThumbnails(images, container) {
   var ul = $("
");
   images.each(function(index, element){
     var currentThumb = $("");
      var li = $("
");
      var src = $(this).attr("src");
      currentThumb.attr("src", src);
      currentThumb.attr("class", "thumb");
      currentThumb.data("img-index", index);
      li.append(currentThumb);
      ul.append(li);
    });
    container.append(ul);
  }
});

window.sr = ScrollReveal({reset: true});
sr.reveal('.active', {mobile:true});
* {
  margin: 0;
  padding: 0;
}

body{
  margin: 0;
  padding:0;
  font-size: 100%;
/*   line-height: 1.6; */
/*   font-family: Arial, Helvetica, sans-serif; */
  height: 100% !important;
}

.header{
  margin: 0 auto;
  width: 100%;
  background-color: #333;
  padding: 30px 0 0 0;
}

.header h1{
  margin: 0;
  text-align: center;
  color: white;
  font-family: Arial, Helvetica, sans-serif;
}

.header ul {
  list-style-type: none;
  margin: 0;
/*   padding: 0; */
  overflow: hidden;
  padding: 20px 0px 30px 0;
  text-align: center;
}

.header li {
  display: block;
  display: inline-block;
/*   border-right: 1px solid #bbb; */
  border-right: 1px solid #bbb;
  height: 25px;
}

.header li:last-child{
  border-right: none;
}

.header li a {
  display: block;
  color: white;
  text-align: center;
  text-decoration: none;
  padding: 0px 40px;
  font-size: 1em;
}

.header li a:hover{
  color: #7bbe9a;
/*   color: #80b198; */
}

#green-room {
  background: #333 !important;
}

.slideshow-container {
  max-width: 1000px;
  position: relative;
  margin: auto;
}

#unidoor, .unidoor-class {
  position: absolute;
  width: 100%;
  margin: 0 auto;
  display: block;
  top: 0;
  left: 0;
  opacity: 0;
  transition: opacity .5s;
  height: auto;
}

.unidoor-class.active {
  position: relative;
  opacity: 1;
}

#prev {
  position: absolute;
  font-weight: bold;
  color: black;
  background-color: #fff;
  opacity: 0.5;
  left: 0;
  top: 0;
  bottom: 0;
}

#next {
  position: absolute;
  font-weight: bold;
  color: black;
  background-color: #fff;
  opacity: 0.5;
  right: 0;
  top: 0;
  bottom: 0;
}

#imgDetail {
  position: relative;
  width: 90%;
  margin: 0 auto;
  opacity: 0;
}

#imgDetail a {
    text-decoration: none;
    display: inline-block;
    padding: 8px 16px;
}

#imgDetail a:hover {
  background-color: #7bbe9a;
  color: white;
  opacity: 1;
}

#imgDetail ul {
  margin: 0 auto;
  display: block;
/*   width: 50%; */
}

.thumb {
  width: 30%;
  height: auto;
  margin: 15px 1% 0px 2%;
  cursor: pointer;
}

#imgDetail li {
  display: inline;
/*   margin-right: 10px;  */
}

<!DOCTYPE html>

    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Daniel Pollack</title>
    <link rel="stylesheet" type="text/css" href="css/styles.css"/>

Lorem Ipsum 3D Online Portfolio

Home

Portfolio

About

Contact

    ‹
    ›

A: What I did is that I remove the #thumbnails inside the container of .imgDetail so that the next and prev button will follow the height of the .imgDetail.
To be able to center the next and prev button i use display:flex,
#imgDetail a {
  text-decoration: none;
  display: flex;
  padding: 8px 16px;
  justify-content: center;
  align-items: center;
}

and then enclose the text of the next and prev

 tag

‹

›

Sample code below

$(document).ready(function(){
    $('#imgDetail').animate({
    opacity: '1'
    },300);
});

$(document).ready(function(){
 // get all images loaded
  var images = $(".unidoor-class");
 // thumbnails containers
  var thumbnailContainer = $("#thumbnails");
    // generate thumbnail images
  generateThumbnails(images, thumbnailContainer);
  // listeners for controls arrows
 $(".prev-next-button").on("click touchstart", function() {
   // get the images
    var currentImageIndex = $(".unidoor-class.active").index();
  var isPrevious = $(this).hasClass("previous");
    var nextIndex;
    if (isPrevious) {
     if (currentImageIndex === 0) {
       nextIndex = images.length - 1;
      }

      if (currentImageIndex > 0) {
       nextIndex = currentImageIndex - 1;
      }
    } else {
     if (currentImageIndex === images.length - 1) {
       nextIndex = 0;
      }

      if (currentImageIndex < images.length - 1) {
       nextIndex = currentImageIndex + 1;
      }
    }

    // remove any active class from images
  images.removeClass("active");
    // get the next active image and add active class to that next current image
    $(images[nextIndex]).addClass("active");
  });

  $(".thumb").on("click touchstart", function(event){
   event.preventDefault();
    var indexSelected = $(this).data("img-index");
    var currentShown = $(".unidoor-class.active").index();
    if (currentShown === indexSelected) return false;
    images.removeClass("active");
    $(images[indexSelected]).addClass('active');
  });

  function generateThumbnails(images, container) {
   var ul = $("
");
   images.each(function(index, element){
     var currentThumb = $("");
      var li = $("
");
      var src = $(this).attr("src");
      currentThumb.attr("src", src);
      currentThumb.attr("class", "thumb");
      currentThumb.data("img-index", index);
      li.append(currentThumb);
      ul.append(li);
    });
    container.append(ul);
  }
});

window.sr = ScrollReveal({reset: true});
sr.reveal('.active', {mobile:true});
* {
  margin: 0;
  padding: 0;
}

body{
  margin: 0;
  padding:0;
  font-size: 100%;
/*   line-height: 1.6; */
/*   font-family: Arial, Helvetica, sans-serif; */
  height: 100% !important;
}

.header{
  margin: 0 auto;
  width: 100%;
  background-color: #333;
  padding: 30px 0 0 0;
}

.header h1{
  margin: 0;
  text-align: center;
  color: white;
  font-family: Arial, Helvetica, sans-serif;
}

.header ul {
  list-style-type: none;
  margin: 0;
/*   padding: 0; */
  overflow: hidden;
  padding: 20px 0px 30px 0;
  text-align: center;
}

.header li {
  display: block;
  display: inline-block;
/*   border-right: 1px solid #bbb; */
  border-right: 1px solid #bbb;
  height: 25px;
}

.header li:last-child{
  border-right: none;
}

.header li a {
  display: block;
  color: white;
  text-align: center;
  text-decoration: none;
  padding: 0px 40px;
  font-size: 1em;
}

.header li a:hover{
  color: #7bbe9a;
/*   color: #80b198; */
}

#green-room {
  background: #333 !important;
}

.slideshow-container {
  max-width: 1000px;
  position: relative;
  margin: auto;
}

#unidoor, .unidoor-class {
  position: absolute;
  width: 100%;
  margin: 0 auto;
  display: block;
  top: 0;
  left: 0;
  opacity: 0;
  transition: opacity .5s;
  height: auto;
}

.unidoor-class.active {
  position: relative;
  opacity: 1;
}

#prev {
  position: absolute;
  font-weight: bold;
  color: black;
  background-color: #fff;
  opacity: 0.5;
  left: 0;
  top: 0;
  bottom: 0;
}

#next {
  position: absolute;
  font-weight: bold;
  color: black;
  background-color: #fff;
  opacity: 0.5;
  right: 0;
  top: 0;
  bottom: 0;
}

#imgDetail {
  position: relative;
  width: 90%;
  margin: 0 auto;
  opacity: 0;
}

#imgDetail a {
    text-decoration: none;
    display: flex;
    padding: 8px 16px;
    justify-content: center;
    align-items: center;
}

#imgDetail a:hover {
  background-color: #7bbe9a;
  color: white;
  opacity: 1;
}

#imgDetail ul {
  margin: 0 auto;
  display: block;
/*   width: 50%; */
}

.thumb {
  width: 30%;
  height: auto;
  margin: 15px 1% 0px 2%;
  cursor: pointer;
}

#imgDetail li {
  display: inline;
/*   margin-right: 10px;  */
}

#thumbnails ul{
  margin: 0 auto;
    display: block;
}

#thumbnails li{
  display: inline;
}

<!DOCTYPE html>

    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Daniel Pollack</title>
    <link rel="stylesheet" type="text/css" href="css/styles.css"/>

Lorem Ipsum 3D Online Portfolio

Home

Portfolio

About

Contact

‹

›

Hope this helps

redpajama_set_name: RedPajamaStackExchange


text:
Wim Aart Louis Beeren (Sint-Joost-ten-Noode, 29 januari 1928 - Amsterdam, 21 augustus 2000) was directeur van het Museum Boijmans Van Beuningen in Rotterdam en daarna van het Stedelijk Museum in Amsterdam.

Hij studeerde kunstgeschiedenis en archeologie in Nijmegen en begon zijn loopbaan bij het Haags Gemeentemuseum.

Beeren presenteerde als directeur van het Stedelijk Museum enkele belangrijke exposities van onder anderen Kasimir Malevich, Keith Haring, Jeff Koons en Sigmar Polke.
Hij verwierf daarnaast werken van Andy Warhol, Piet Mondriaan en het varken van Jeff Koons voor het museum.

Hij was directeur van het Stedelijk Museum in Amsterdam toen in 1986 het werk "Who's afraid of Red, Yellow and Blue" van Barnett Newman werd vernield. Beeren vertrouwde de restauratie van dit schilderij toe aan de Amerikaan Daniel Goldreyer, die in plaats van een miljoen verfstippen de kleurvakken vulde met een verfroller. Beeren hield echter vol dat de restauratie "redelijk geslaagd" was.

Beeren overleed op 72-jarige leeftijd te Amsterdam.

Bibliografie
Wim Beeren - om de kunst. Opvattingen van een museumman over moderne kunst, kunstenaars, musea en kunstbeleid. Rotterdam, 2005

Nederlands museumdirecteur
Directeur van Nederlands museum
Museum Boijmans Van Beuningen

redpajama_set_name: RedPajamaWikipedia


We have Linda K Potter coming for our August program. She will talk about Needle Magic. She will have lots of her things to sell at the meeting as well. The best news is that she is doing a workshop on Saturday – also Needle Magic. It is based on her book "Quilt & Embellish in One Step". It is from 9:00 to 3:00 at Central United Methodist Church in Rogers. If you missed the meeting, you missed seeing her class samples. If you want to learn about beading and embellishing a quilt, this is the workshop for you! For those of you who didn't pick up a supply list there is one attached to this blog. Please contact me for workshop sign up and come have a lot of fun. If you want to take the easy way out, bring a $10 kit fee for her instead of worrying about all the supplies. Let me know so I can tell her how many to bring!
Special thanks goes out to Sager Creek Quilt shop from Siloam Springs for filling in at the last minute as vendor for July's guild meeting. We appreciate you!
The July Newsletter is now ready to view online. Check out the link on the Newsletter page!


Incredibles 2 has a "triumphantly feminist message", according to Holly Hunter.
Everyone's favourite superhero family are back in action, 14 years after Disney Pixar first introduced the Parr clan to moviegoers.
Holly, Craig T. Nelson and Samuel L. Jackson are among the voice actors reprising their roles for the second instalment of writer/director Brad Bird's franchise, which Holly says boasts a girl power message.
Joining the second movie is Better Call Saul stars Bob Odenkirk and Jonathan Banks, while Brad is back voicing diminutive superhero costume designer Edna Mode.
The film has been 10 years in the making, with Holly explaining to Digital Spy that Brad held out until he thought of a story good enough to share with fans of The Incredibles.
Incredibles 2 began hitting cinemas in June and reaches U.K. theatres on Friday (13Jul18).


Live it up with this pair of black colored sandals by Bata. Perfect for twist and turns, this pair can be worn with a casual dress for the fun-filled night!
Team these flats with a boxy top and denims while heading out for a great night with friends.


text:
module Math.Optimization.SPSA.Construction (
  -- Construction of the SPSA type through the State monad
  standardGainAk,
  standardGainCk,
  semiautomaticTuning,
  bernoulli
) where

import System.Random (mkStdGen, randoms)
import Numeric.LinearAlgebra (Vector,randomVector,RandDist(Uniform))

import Math.Optimization.SPSA.Types (StateSPSA, setGainA, setGainC)

-----------------
-- Gain Sequences
-----------------

-- | Standard gain sequence for a_k = a / (k + 1 + A) ^ alpha
-- | a is the most important and variable tuning parameter. Start with it set to get desired change in first iteration.
-- | A is usually set to 10% of expected iterations
-- | alpha is usually set to 0.602, but is valid up to 1.0 (the optimal for infinite iterations)
standardGainAk :: Double -> Int -> Double -> [Double]
standardGainAk a aA alpha = map (\k -> a / (k + 1 + (fromIntegral aA)) ** alpha) [1..]

-- | Standard gain sequence for c_k
standardGainCk :: Double -> Double -> [Double]
standardGainCk c gamma = standardGainAk c 0 gamma

-- | Set semiautomatic tuning for the gain sequences
-- | c should be about the standard deviation of a measurement
-- | a is set how much you want the first iteration to move
-- | A is set to be 10% of expected iterations
-- | alpha and gamma are set to the lowest values for best finite iteration performance (not infinitely optimal)
semiautomaticTuning :: Int -> Double -> Double -> StateSPSA ()
semiautomaticTuning iterations a c = do
  setGainA $ standardGainAk a (iterations `quot` 10) 0.602
  setGainC $ standardGainCk c 0.101

-----------------
-- Distributions
-----------------

-- | Create a bernoulli +1 / -1 distributed infinite series of perturbation vectors based on seed and dimension
bernoulli :: Int -> Int -> [Vector Double]
bernoulli seed n = map (toBernoulli . mkVec) seeds
  where
    toBernoulli vec = (vec - 0.5) / (abs $ vec - 0.5)
    mkVec s = (randomVector s Uniform n)
    seeds = (randoms $ mkStdGen seed :: [Int])

redpajama_set_name: RedPajamaGithub


text:
Saturday November 12, 2016, 7:30 pm
Bluegrass, Americana
"…One of the lonesomest, hard-drivingest traditional bluegrass bands alive…High Country manages to be fresh and exciting without even the merest nod to modern music." -Bluegrass Unlimited
Over the last forty years, High Country has earned its place as the West Coast's premier traditional bluegrass band. Strongly influenced by the classic styles of Bill Monroe, Flatt & Scruggs and the Stanley Brothers, the band's blend of banjo, mandolin, fiddle, dobro, guitar and bass delivers the upbeat excitement of true bluegrass music. High Country's show offers a vital mix of powerful originals and standards, from blues to breakdowns to gospels sung in close harmony. Even the songs and tunes written by band members themselves remain true to the genre, with careful attention paid to the nuances of the bluegrass style. With driving rhythm, skillful picking and soulful singing, High Country brings the energy and experience of six seasoned professionals to this spirited American art form. After four decades of performing, the band remains fresh and exciting, and brings their love of bluegrass to an ever-widening audience.


Agnosticism is the view that the truth values of certain claims – especially metaphysical and religious claims such as whether or not God, the divine or the supernatural exist – are unknown and perhaps unknowable. According to the philosopher William L. Rowe: "In the popular sense of the term, an agnostic is someone who neither believes nor disbelieves in the existence of God, while a theist believes that God exists, an atheist disbelieves in God". Agnosticism is a doctrine or set of tenets rather than a religion as such.
In the time since Huxley coined the term, many other thinkers have written extensively about agnosticism.
Being a scientist, above all else, Huxley presented agnosticism as a form of demarcation. A hypothesis with no supporting objective, testable, evidence is not an objective, scientific, claim. As such, there would be no way to test said hypotheses, leaving the results inconclusive. His agnosticism was not compatible with forming a belief as to the truth, or falsehood, of the claim at hand. Huxley came up with this term at a time when narrow definition atheism (the belief that no gods exist) was, by far, the most popular definition of the word. Karl Popper would also describe himself simply as an agnostic. According to philosopher William L. Rowe, in this strict sense, agnosticism is the view that human reason is incapable of providing sufficient rational grounds to justify either the belief that God exists or the belief that God does not exist.
Others have redefined this concept, making it compatible with forming a belief, and only incompatible with absolute certainty.
^ Wikisource has the full text of the article here.
According to Richard Dawkins, a distinction between agnosticism and atheism is unwieldy and depends on how close to zero a person is willing to rate the probability of existence for any given god-like entity. About himself, Dawkins continues, "I am agnostic only to the extent that I am agnostic about fairies at the bottom of the garden." Dawkins also identifies two categories of agnostics; "Temporary Agnostics in Practice" (TAPs), and "Permanent Agnostics in Principle" (PAPs). Dawkins considers temporary agnosticism an entirely reasonable position, but views permanent agnosticism as "fence-sitting, intellectual cowardice".
An agnostic thinks it impossible to know the truth in matters such as God and the future life with which Christianity and other religions are concerned. Or, if not impossible, at least impossible at the present time. Are Agnostics Atheists? No. An atheist, like a Christian, holds that we can know whether or not there is a God. The Christian holds that we can know there is a God; the atheist, that we can know there is not. The Agnostic suspends judgment, saying that there are not sufficient grounds either for affirmation or for denial.
Is there a supernatural power—an arbitrary mind—an enthroned God—a supreme will that sways the tides and currents of the world—to which all causes bow? I do not deny. I do not know—but I do not believe. I believe that the natural is supreme—that from the infinite chain no link can be lost or broken—that there is no supernatural power that can answer prayer—no power that worship can persuade or change—no power that cares for man. I believe that with infinite arms Nature embraces the all—that there is no interference—no chance—that behind every event are the necessary and countless causes, and that beyond every event will be and must be the necessary and countless effects. Is there a God? I do not know. Is man immortal? I do not know. One thing I do know, and that is, that neither hope, nor fear, belief, nor denial, can change the fact. It is as it is, and it will be as it must be.
When I reached intellectual maturity and began to ask myself whether I was an atheist, a theist, or a pantheist; a materialist or an idealist; Christian or a freethinker; I found that the more I learned and reflected, the less ready was the answer; until, at last, I came to the conclusion that I had neither art nor part with any of these denominations, except the last. The one thing in which most of these good people were agreed was the one thing in which I differed from them. They were quite sure they had attained a certain "gnosis"–had, more or less successfully, solved the problem of existence; while I was quite sure I had not, and had a pretty strong conviction that the problem was insoluble. And, with Hume and Kant on my side, I could not think myself presumptuous in holding fast by that opinion ... So I took thought, and invented what I conceived to be the appropriate title of "agnostic". It came into my head as suggestively antithetic to the "gnostic" of Church history, who professed to know so much about the very things of which I was ignorant. ... To my great satisfaction the term took.
I neither affirm nor deny the immortality of man. I see no reason for believing it, but, on the other hand, I have no means of disproving it. I have no a priori objections to the doctrine. No man who has to deal daily and hourly with nature can trouble himself about a priori difficulties. Give me such evidence as would justify me in believing in anything else, and I will believe that. Why should I not? It is not half so wonderful as the conservation of force or the indestructibility of matter ... It is no use to talk to me of analogies and probabilities. I know what I mean when I say I believe in the law of the inverse squares, and I will not rest my life and my hopes upon weaker convictions ... That my personality is the surest thing I know may be true. But the attempt to conceive what it is leads me into mere verbal subtleties. I have champed up all that chaff about the ego and the non-ego, noumena and phenomena, and all the rest of it, too often not to know that in attempting even to think of these questions, the human intellect flounders at once out of its depth.