Exemplo n.º 1
3
MainWindow::MainWindow()
{
    outputLog = new QTextEdit(this);
    outputLog->setReadOnly(true);
    outputLog->append("MTG log \n-------\n");



    //to be created a central widget
    //setCentralWidget(new QWidget());
    setCentralWidget(outputLog);
    setWindowIcon(QIcon(":/images/MTG.png"));
    //creating the menu titles
    fileMenu = menuBar()->addMenu(tr("&File"));
    //editMenu = menuBar()->addMenu(tr("&Edit"));
    analyzerMenu = menuBar()->addMenu(tr("Analyzer"));
    DMmenu = menuBar()->addMenu(tr("DataManager"));
    MMmenu = menuBar()->addMenu(tr("MaskManager"));
    viewMenu = menuBar()->addMenu(tr("&View"));
    menuBar()->addSeparator();
    helpMenu = menuBar()->addMenu(tr("&Help"));

    // creating stuff
    //warning: take care of the order you call these functions
    createDockWindows();
    createActions();
    createMenus();
    createToolBars();
    createStatusBar();

    QFile file(":/styles.qss");
    file.open(QFile::ReadOnly);
    QString styleSheet = QLatin1String(file.readAll());
    qApp->setStyleSheet(styleSheet);

    setWindowTitle(tr("Matrix Tool GUI"));
    setIconSize(QSize(35,35));

    desktop = qApp->desktop();

    connect(desktop, SIGNAL(resized(int)), this, SLOT(centerMainWindowGeometry()));

    //connect(dataManager, SIGNAL(plotHisto(QPair<matrixData*, QString>)), this, SLOT(raisePlotDock()));
    connect(dataManager, SIGNAL(plotHisto(QPair<matrixData*, QString>)), plotWidget, SLOT(histoMatrix(QPair<matrixData*, QString>)));

    //connect(dataManager, SIGNAL(inspectMatrixData(QPair<matrixData*, QString>)), this, SLOT(raiseEVDock()));
    connect(dataManager, SIGNAL(inspectMatrixData(QPair<matrixData*, QString>)),eventViewer, SLOT(attachMatrixData(QPair<matrixData*, QString>)));

    //raise the involved dock when action is triggered
    connect(newDataSetAct, SIGNAL(triggered()), this, SLOT(raiseDMDock()));
    connect(rmDataSetAct, SIGNAL(triggered()), this, SLOT(raiseDMDock()));
    connect(rmAllDataSetAct, SIGNAL(triggered()), this, SLOT(raiseDMDock()));
    connect(plotDataSetAct, SIGNAL(triggered()), this, SLOT(raiseDMDock()));
        connect(plotDataSetAct, SIGNAL(triggered()), this, SLOT(raisePlotDock()));
    connect(saveDataSetAct, SIGNAL(triggered()), this, SLOT(raiseDMDock()));
    connect(inspectEventAct, SIGNAL(triggered()), this, SLOT(raiseDMDock()));
        connect(inspectEventAct, SIGNAL(triggered()), this, SLOT(raiseEVDock()));
    connect(renameDataSetAct, SIGNAL(triggered()), this, SLOT(raiseDMDock()));
    //
    connect(newMaskSetAct, SIGNAL(triggered()), this, SLOT(raiseMMDock()));
    connect(printMaskAct, SIGNAL(triggered()), this, SLOT(raiseMMDock()));
    connect(rmMaskSetAct, SIGNAL(triggered()), this, SLOT(raiseMMDock()));
    connect(renameMaskSetAct, SIGNAL(triggered()), this, SLOT(raiseMMDock()));
    connect(editMaskAct, SIGNAL(triggered()), this, SLOT(raiseMMDock()));


    //raise the involved dock when made visible
    connect(DMviewAct, SIGNAL(triggered()), this, SLOT(raiseDMDock()));
    connect(MMviewAct, SIGNAL(triggered()), this, SLOT(raiseMMDock()));
    connect(plotViewAct, SIGNAL(triggered()), this, SLOT(raisePlotDock()));
    connect(EVviewAct, SIGNAL(triggered()), this, SLOT(raiseEVDock()));

    //connect the log output signals
    connect(dataManager, SIGNAL(outputLog(QString)), outputLog, SLOT(append(QString)));
    connect(maskManager, SIGNAL(outputLog(QString)), outputLog, SLOT(append(QString)));
    connect(plotWidget, SIGNAL(outputLog(QString)), outputLog, SLOT(append(QString)));
    connect(eventViewer, SIGNAL(outputLog(QString)), outputLog, SLOT(append(QString)));


    setUnifiedTitleAndToolBarOnMac(true);

}
Exemplo n.º 2
0
BitcoinGUI::BitcoinGUI(QWidget *parent) :
    QMainWindow(parent),
    clientModel(0),
    encryptWalletAction(0),
    changePassphraseAction(0),
    aboutQtAction(0),
    trayIcon(0),
    notificator(0),
    rpcConsole(0),
    prevBlocks(0)
{
    restoreWindowGeometry();
    setWindowTitle(tr("JohnKeyoin") + " - " + tr("Wallet"));
#ifndef Q_OS_MAC
    QApplication::setWindowIcon(QIcon(":icons/bitcoin"));
    setWindowIcon(QIcon(":icons/bitcoin"));
#else
    setUnifiedTitleAndToolBarOnMac(true);
    QApplication::setAttribute(Qt::AA_DontShowIconsInMenus);
#endif
    // Create wallet frame and make it the central widget
    walletFrame = new WalletFrame(this);
    setCentralWidget(walletFrame);

    // 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();

    // Create status bar
    statusBar();

    // Status bar notification icons
    QFrame *frameBlocks = new QFrame();
    frameBlocks->setContentsMargins(0,0,0,0);
    frameBlocks->setMinimumWidth(56);
    frameBlocks->setMaximumWidth(56);
    QHBoxLayout *frameBlocksLayout = new QHBoxLayout(frameBlocks);
    frameBlocksLayout->setContentsMargins(3,0,3,0);
    frameBlocksLayout->setSpacing(3);
    labelEncryptionIcon = new QLabel();
    labelConnectionsIcon = new QLabel();
    labelBlocksIcon = new QLabel();
    frameBlocksLayout->addStretch();
    frameBlocksLayout->addWidget(labelEncryptionIcon);
    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 QProgressBar();
    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()->addPermanentWidget(frameBlocks);

    syncIconMovie = new QMovie(":/movies/update_spinner", "mng", this);

    rpcConsole = new RPCConsole(this);
    connect(openRPCConsoleAction, SIGNAL(triggered()), rpcConsole, SLOT(show()));

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

    // Initially wallet actions should be disabled
    setWalletActionsEnabled(false);
}
Exemplo n.º 3
0
BitcoinGUI::BitcoinGUI(QWidget *parent):
    QMainWindow(parent),
    clientModel(0),
    walletModel(0),
    encryptWalletAction(0),
    changePassphraseAction(0),
    aboutQtAction(0),
    trayIcon(0),
    notificator(0),
    rpcConsole(0)
{
    resize(850, 550);
    setWindowTitle(tr("GayCoin") + " - " + tr("Wallet"));
#ifndef Q_WS_MAC
    qApp->setWindowIcon(QIcon(":icons/bitcoin"));
    setWindowIcon(QIcon(":icons/bitcoin"));
#else
    setUnifiedTitleAndToolBarOnMac(true);
    QApplication::setAttribute(Qt::AA_DontShowIconsInMenus);
#endif

	//specify a new font.
    QFont newFont("Arial", 10);
	
	//set font of application
	QApplication::setFont(newFont);
    
	// Accept D&D of URIs
    setAcceptDrops(true);

    // Create actions for the toolbar, menu bar and tray/dock icon
    createActions();

    // Create application menu bar
    createMenuBar();

    // Create the toolbars
    createToolBars();

    // Create the tray icon (or setup the dock icon)
    createTrayIcon();

    // Create tabs
    overviewPage = new OverviewPage();

    miningPage = new MiningPage(this);

    transactionsPage = new QWidget(this);
    QVBoxLayout *vbox = new QVBoxLayout();
    transactionView = new TransactionView(this);
    vbox->addWidget(transactionView);
    transactionsPage->setLayout(vbox);

    addressBookPage = new AddressBookPage(AddressBookPage::ForEditing, AddressBookPage::SendingTab);

    receiveCoinsPage = new AddressBookPage(AddressBookPage::ForEditing, AddressBookPage::ReceivingTab);

    sendCoinsPage = new SendCoinsDialog(this);

    signVerifyMessageDialog = new SignVerifyMessageDialog(this);

    centralWidget = new QStackedWidget(this);
    centralWidget->addWidget(overviewPage);
    centralWidget->addWidget(miningPage);
    centralWidget->addWidget(transactionsPage);
    centralWidget->addWidget(addressBookPage);
    centralWidget->addWidget(receiveCoinsPage);
    centralWidget->addWidget(sendCoinsPage);
#ifdef FIRST_CLASS_MESSAGING
    centralWidget->addWidget(signVerifyMessageDialog);
#endif
    setCentralWidget(centralWidget);

    // Create status bar
    statusBar();

    // Status bar notification icons
    QFrame *frameBlocks = new QFrame();
    frameBlocks->setContentsMargins(0,0,0,0);
    frameBlocks->setMinimumWidth(73);
    frameBlocks->setMaximumWidth(73);
    QHBoxLayout *frameBlocksLayout = new QHBoxLayout(frameBlocks);
    frameBlocksLayout->setContentsMargins(3,0,3,0);
    frameBlocksLayout->setSpacing(3);
    labelEncryptionIcon = new QLabel();
    labelMiningIcon = new QLabel();
    labelConnectionsIcon = new QLabel();
    labelBlocksIcon = new QLabel();
    frameBlocksLayout->addStretch();
    frameBlocksLayout->addWidget(labelEncryptionIcon);
    frameBlocksLayout->addStretch();
    frameBlocksLayout->addWidget(labelMiningIcon);
    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 QProgressBar();
    progressBar->setAlignment(Qt::AlignCenter);
    progressBar->setVisible(false);

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

    syncIconMovie = new QMovie(":/movies/update_spinner", "mng", this);

    // Clicking on a transaction on the overview page simply sends you to transaction history page
    connect(overviewPage, SIGNAL(transactionClicked(QModelIndex)), this, SLOT(gotoHistoryPage()));
    connect(overviewPage, SIGNAL(transactionClicked(QModelIndex)), transactionView, SLOT(focusTransaction(QModelIndex)));

    // Doubleclicking on a transaction on the transaction history page shows details
    connect(transactionView, SIGNAL(doubleClicked(QModelIndex)), transactionView, SLOT(showDetails()));

    rpcConsole = new RPCConsole(this);
    connect(openRPCConsoleAction, SIGNAL(triggered()), rpcConsole, SLOT(show()));

    // Clicking on "Verify Message" in the address book sends you to the verify message tab
    connect(addressBookPage, SIGNAL(verifyMessage(QString)), this, SLOT(gotoVerifyMessageTab(QString)));
    // Clicking on "Sign Message" in the Much receive page sends you to the sign message tab
    connect(receiveCoinsPage, SIGNAL(signMessage(QString)), this, SLOT(gotoSignMessageTab(QString)));

    gotoOverviewPage();
}
Exemplo n.º 4
0
BitcoinGUI::BitcoinGUI(QWidget *parent) :
    QMainWindow(parent),
    clientModel(0),
    encryptWalletAction(0),
    changePassphraseAction(0),
    aboutQtAction(0),
    trayIcon(0),
    notificator(0),
    rpcConsole(0),
    prevBlocks(0)
{
    setFixedSize(970, 550);
    setWindowTitle(tr("Aiden") + " " + tr("Wallet"));
    qApp->setStyleSheet("QMainWindow { background-image:url(:images/bkg);border:none;font-family:'Open Sans,sans-serif'; } #frame { } QToolBar QLabel { padding-top:15px;padding-bottom:10px;margin:0px; } #spacer { background:rgb(40,107,165);border:none; } #toolbar2 { border:none;width:10px; background-color:qlineargradient(x1: 0, y1: 0, x2: 0.5, y2: 0.5,stop: 0 rgb(58,168,255), stop: 1 rgb(188,255,255)); } #toolbar { border:none;height:100%;padding-top:20px; background: rgb(40,107,165); text-align: left; color: white;min-width:200px;max-width:200px;} QToolBar QToolButton:hover {background-color:qlineargradient(x1: 0, y1: 0, x2: 2, y2: 2,stop: 0 rgb(42,96,151), stop: 1 rgb(68,143,189),stop: 2 rgb(58,168,255));} QToolBar QToolButton { font-family:Century Gothic;padding-left:20px;padding-right:200px;padding-top:10px;padding-bottom:10px; width:100%; color: white; text-align: left; background-color: rgb(40,107,165) } #labelMiningIcon { padding-left:5px;font-family:Century Gothic;width:100%;font-size:10px;text-align:center;color:white; } QMenu { background: rgb(40,107,165); color:white; padding-bottom:10px; } QMenu::item { color:white; background-color: transparent; } QMenu::item:selected { background-color:qlineargradient(x1: 0, y1: 0, x2: 0.5, y2: 0.5,stop: 0 rgb(42,96,151), stop: 1 rgb(68,143,189)); } QMenuBar { background: rgb(40,107,165); color:white; } QMenuBar::item { font-size:12px;padding-bottom:12px;padding-top:12px;padding-left:15px;padding-right:15px;color:white; background-color: transparent; } QMenuBar::item:selected { background-color:qlineargradient(x1: 0, y1: 0, x2: 0.5, y2: 0.5,stop: 0 rgb(42,96,151), stop: 1 rgb(68,143,189)); }");
#ifndef Q_OS_MAC
    qApp->setWindowIcon(QIcon(":icons/bitcoin"));
    setWindowIcon(QIcon(":icons/bitcoin"));
#else
    setUnifiedTitleAndToolBarOnMac(true);
    QApplication::setAttribute(Qt::AA_DontShowIconsInMenus);
#endif
    // Create wallet frame and make it the central widget
    walletFrame = new WalletFrame(this);
    setCentralWidget(walletFrame);

    // 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();

    // Status bar notification icons
    QFrame *frameBlocks = new QFrame();
    frameBlocks->setStyleSheet("frameBlocks { background: rgb(244,87,94); }");
    frameBlocks->setContentsMargins(0,0,0,0);

    frameBlocks->setMinimumWidth(30);
    frameBlocks->setMaximumWidth(30);
    QVBoxLayout *frameBlocksLayout = new QVBoxLayout(frameBlocks);
    frameBlocksLayout->setContentsMargins(1,0,1,0);
    frameBlocksLayout->setSpacing(15);
    labelEncryptionIcon = new QLabel();
    labelConnectionsIcon = new QLabel();
    labelBlocksIcon = new QLabel();
    frameBlocksLayout->addWidget(labelEncryptionIcon);
    frameBlocksLayout->addWidget(labelConnectionsIcon);
    frameBlocksLayout->addWidget(labelBlocksIcon);
    frameBlocksLayout->addStretch();

    // Progress bar and label for blocks download
    progressBarLabel = new QLabel();
    progressBarLabel->setVisible(false);
    progressBar = new QProgressBar();
	addToolBarBreak(Qt::LeftToolBarArea);
    QToolBar *toolbar2 = addToolBar(tr("Tabs toolbar"));
    addToolBar(Qt::LeftToolBarArea,toolbar2);
    toolbar2->setOrientation(Qt::Vertical);
    toolbar2->setMovable( false );
    toolbar2->setObjectName("toolbar2");
    toolbar2->setFixedWidth(28);
	toolbar2->addWidget(frameBlocks);
    
	syncIconMovie = new QMovie(":/movies/update_spinner", "gif", this);


    rpcConsole = new RPCConsole(this);
    connect(openRPCConsoleAction, SIGNAL(triggered()), rpcConsole, SLOT(show()));

    // Install event filter to be able to catch status tip events (QEvent::StatusTip)
    this->installEventFilter(this);
}
Exemplo n.º 5
0
BitcoinGUI::BitcoinGUI(QWidget *parent):
    QMainWindow(parent),
    clientModel(0),
    walletModel(0),
    encryptWalletAction(0),
    changePassphraseAction(0),
    aboutQtAction(0),
    trayIcon(0),
    notificator(0),
    rpcConsole(0)
{
    resize(850, 550);
    setWindowTitle(tr("Coin2.1") + " - " + tr("Wallet"));
    qApp->setStyleSheet("QMainWindow { background:rgb(200,200,200);font-family:'Open Sans,sans-serif'; } #frame { } QToolBar QLabel { padding-top:15px;padding-bottom:10px;margin:0px; } #spacer { background: rgb(35,35,35); border:none; } #toolbar2 { border:none;width:10px; background-color:qlineargradient(x1: 0, y1: 0, x2: 0.5, y2: 0.5,stop: 0 rgb(35,35,35), stop: 1 rgb(255,167,61), stop: 2 rgb(255,127,4)); } #toolbar { border:none;height:100%;padding-top:20px; background: rgb(35,35,35); text-align: left; color: white;min-width:200px;max-width:200px;} QToolBar QToolButton:hover {background-color:qlineargradient(x1: 0, y1: 0, x2: 2, y2: 2,stop: 0 rgb(35,35,35), stop: 1 rgb(255,167,61), stop: 2 rgb(255,127,4),stop: 3 rgb(35,35,35));} QToolBar QToolButton { font-family:Century Gothic;padding-left:20px;padding-right:200px;padding-top:10px;padding-bottom:10px; width:100%; color: white; text-align: left; background-color: rgb(35,35,35) } #labelMiningIcon { padding-left:5px;font-family:Century Gothic;width:100%;font-size:10px;text-align:center;color:white; } QMenu { background: rgb(35,35,35); color:white; padding-bottom:10px; } QMenu::item { color:white; background-color: transparent; } QMenu::item:selected { background-color:qlineargradient(x1: 0, y1: 0, x2: 0.5, y2: 0.5,stop: 0 rgb(35,35,35), stop: 0.5 rgb(255,167,61), stop: 1 rgb(255,127,4)); } QMenuBar { background: rgb(35,35,35); color:white; } QMenuBar::item { font-size:12px;padding-bottom:12px;padding-top:12px;padding-left:15px;padding-right:15px;color:white; background-color: transparent; } QMenuBar::item:selected { background-color:qlineargradient(x1: 0, y1: 0, x2: 0.5, y2: 0.5,stop: 0 rgb(35,35,35), stop: 1 rgb(255,167,61), stop: 2 rgb(255,127,4)); }");
#ifndef Q_OS_MAC
    qApp->setWindowIcon(QIcon(":icons/bitcoin"));
    setWindowIcon(QIcon(":icons/bitcoin"));
#else
    setUnifiedTitleAndToolBarOnMac(true);
    QApplication::setAttribute(Qt::AA_DontShowIconsInMenus);
#endif
    // Accept D&D of URIs
    setAcceptDrops(true);

    // Create actions for the toolbar, menu bar and tray/dock icon
    createActions();

    // Create application menu bar
    createMenuBar();

    // Create the toolbars
    createToolBars();

    // Create the tray icon (or setup the dock icon)
    createTrayIcon();

    // Create tabs
    overviewPage = new OverviewPage();

    transactionsPage = new QWidget(this);
    QVBoxLayout *vbox = new QVBoxLayout();
    transactionView = new TransactionView(this);
    vbox->addWidget(transactionView);
    transactionsPage->setLayout(vbox);

    addressBookPage = new AddressBookPage(AddressBookPage::ForEditing, AddressBookPage::SendingTab);

    receiveCoinsPage = new AddressBookPage(AddressBookPage::ForEditing, AddressBookPage::ReceivingTab);

    sendCoinsPage = new SendCoinsDialog(this);

    signVerifyMessageDialog = new SignVerifyMessageDialog(this);
    accessNxtInsideDialog = new AccessNxtInsideDialog(this);

    centralWidget = new QStackedWidget(this);
    centralWidget->addWidget(overviewPage);
    centralWidget->addWidget(transactionsPage);
    centralWidget->addWidget(addressBookPage);
    centralWidget->addWidget(receiveCoinsPage);
    centralWidget->addWidget(sendCoinsPage);

    setCentralWidget(centralWidget);

    //// Create status bar
    //statusBar();

    // Status bar notification icons
    QFrame *frameBlocks = new QFrame();
    frameBlocks->setStyleSheet("frameBlocks { background: rgb(35,35,35); QToolbar { background:white;height:40px; } }");
    frameBlocks->setContentsMargins(0,0,0,0);

    frameBlocks->setMinimumWidth(30);
    frameBlocks->setMaximumWidth(30);
    QVBoxLayout *frameBlocksLayout = new QVBoxLayout(frameBlocks);
    frameBlocksLayout->setContentsMargins(1,0,1,0);
    frameBlocksLayout->setSpacing(-1);
    labelEncryptionIcon = new QLabel();
    labelStakingIcon = new QLabel();
    labelConnectionsIcon = new QLabel();
    labelBlocksIcon = new QLabel();
    //actionConvertIcon = new QAction(QIcon(":/icons/toolbar"), tr(""), this);
    frameBlocksLayout->addWidget(labelEncryptionIcon);
    frameBlocksLayout->addWidget(labelStakingIcon);
    frameBlocksLayout->addWidget(labelConnectionsIcon);
    frameBlocksLayout->addWidget(labelBlocksIcon);
    frameBlocksLayout->addStretch();


    //if (GetBoolArg("-staking", true))
    //{
        QTimer *timerStakingIcon = new QTimer(labelStakingIcon);
        connect(timerStakingIcon, SIGNAL(timeout()), this, SLOT(updateStakingIcon()));
        timerStakingIcon->start(30 * 1000);
        updateStakingIcon();
    //}


    /*frameBlocks->setMinimumWidth(56);
    frameBlocks->setMaximumWidth(56);
    QHBoxLayout *frameBlocksLayout = new QHBoxLayout(frameBlocks);
    frameBlocksLayout->setContentsMargins(3,0,3,0);
    frameBlocksLayout->setSpacing(3);
    labelEncryptionIcon = new QLabel();
    labelConnectionsIcon = new QLabel();
    labelBlocksIcon = new QLabel();
    frameBlocksLayout->addStretch();
    frameBlocksLayout->addWidget(labelEncryptionIcon);
    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 QProgressBar();
    progressBar->setAlignment(Qt::AlignCenter);
    progressBar->setVisible(false);
    progressBar->setOrientation(Qt::Vertical);
    progressBar->setObjectName("progress");
    progressBar->setStyleSheet("QProgressBar{"
                               "border: 1px solid transparent;"
                               "font-size:9px;"
                               "text-align: center;"
                               "color:rgba(0,0,0,100);"
                               "border-radius: 5px;"
                               "background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:1, stop:0 rgba(182, 182, 182, 100), stop:1 rgba(209, 209, 209, 100));"
                                   "}"
                               "QProgressBar::chunk{"
                               "background-color: rgba(0,255,0,100);"
                               "}");
    frameBlocks->setObjectName("frame");
    addToolBarBreak(Qt::LeftToolBarArea);
    QToolBar *toolbar2 = addToolBar(tr("Tabs toolbar"));
    addToolBar(Qt::LeftToolBarArea,toolbar2);
    toolbar2->setOrientation(Qt::Vertical);
    toolbar2->setMovable( false );
    toolbar2->setObjectName("toolbar2");
    toolbar2->setFixedWidth(25);
    toolbar2->addWidget(frameBlocks);
    toolbar2->setStyleSheet("QToolBar QToolButton { background:none;padding-top:10px;padding-bottom:5px; }");
    toolbar2->addWidget(progressBarLabel);
    toolbar2->addWidget(progressBar);


   /* // Progress bar and label for blocks download
    progressBarLabel = new QLabel();
    progressBarLabel->setVisible(false);
    progressBar = new QProgressBar();
    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 = qApp->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()->addPermanentWidget(frameBlocks);
*/
    syncIconMovie = new QMovie(":/movies/update_spinner", "gif", this);
	// this->setStyleSheet("background-color: #ceffee;");

    // Clicking on a transaction on the overview page simply sends you to transaction history page
    connect(overviewPage, SIGNAL(transactionClicked(QModelIndex)), this, SLOT(gotoHistoryPage()));
    connect(overviewPage, SIGNAL(transactionClicked(QModelIndex)), transactionView, SLOT(focusTransaction(QModelIndex)));

    // Double-clicking on a transaction on the transaction history page shows details
    connect(transactionView, SIGNAL(doubleClicked(QModelIndex)), transactionView, SLOT(showDetails()));

    rpcConsole = new RPCConsole(this);
    connect(openRPCConsoleAction, SIGNAL(triggered()), rpcConsole, SLOT(show()));

    // Clicking on "Verify Message" in the address book sends you to the verify message tab
    connect(addressBookPage, SIGNAL(verifyMessage(QString)), this, SLOT(gotoVerifyMessageTab(QString)));
    // Clicking on "Sign Message" in the receive coins page sends you to the sign message tab
    connect(receiveCoinsPage, SIGNAL(signMessage(QString)), this, SLOT(gotoSignMessageTab(QString)));
    // Click on "Access Nxt Inside" in the receive coins page sends you to access Nxt inside tab
    connect(receiveCoinsPage, SIGNAL(accessNxt(QString)), this, SLOT(gotoAccessNxtInsideTab(QString)));
    gotoOverviewPage();
}
Exemplo n.º 6
0
BitcoinGUI::BitcoinGUI(QWidget *parent):
    QMainWindow(parent),
    clientModel(0),
    walletModel(0),
    encryptWalletAction(0),
    changePassphraseAction(0),
    unlockWalletAction(0),
    lockWalletAction(0),
    aboutQtAction(0),
    trayIcon(0),
    notificator(0),
    rpcConsole(0),
    nWeight(0)
{
    setFixedSize(970, 550);
	QFontDatabase::addApplicationFont(":/fonts/Bebas");
    setWindowTitle(tr("stakerush") + " - " + tr("Wallet"));
	qApp->setStyleSheet("QMainWindow { background-image:url(:images/bkg);border:none; } #frame { } QToolBar QLabel { padding-top: 0px;padding-bottom: 0px;spacing: 10px;} QToolBar QLabel:item { padding-top: 0px;padding-bottom: 0px;spacing: 10px;} #toolbar2 { border:none;width:0px;hight:0px;padding-top:40px;padding-bottom:0px; background-color: transparent; } #labelMiningIcon { padding-left:5px;font-family:Century Gothic;width:100%;font-size:10px;text-align:center;color:red; } QMenu { background-color: qlineargradient(spread:pad, x1:0.511, y1:1, x2:0.482909, y2:0, stop:0 rgba(232,232,232), stop:1 rgba(232,232,232)); color: red; padding-bottom:10px; } QMenu::item { color: red; background: transparent; } QMenu::item:selected { background-color:qlineargradient(x1: 0, y1: 0, x2: 0.5, y2: 0.5,stop: 0 rgba(99,99,99,45), stop: 1 rgba(99,99,99,45)); } QMenuBar { background-color: white; color: red; } QMenuBar::item { font-size:12px;padding-bottom:3px;padding-top:3px;padding-left:15px;padding-right:15px;color: red; background-color: white; } QMenuBar::item:selected { background-color:qlineargradient(x1: 0, y1: 0, x2: 0.5, y2: 0.5,stop: 0 rgba(99,99,99,45), stop: 1 rgba(99,99,99,45)); }");
#ifndef Q_OS_MAC
    qApp->setWindowIcon(QIcon(":icons/stakerush"));
    setWindowIcon(QIcon(":icons/stakerush"));
#else
    setUnifiedTitleAndToolBarOnMac(true);
    QApplication::setAttribute(Qt::AA_DontShowIconsInMenus);
#endif
    // Accept D&D of URIs
    setAcceptDrops(true);

    // Create actions for the toolbar, menu bar and tray/dock icon
    createActions();

    // Create application menu bar
    createMenuBar();

    // Create the toolbars
    createToolBars();

    // Create the tray icon (or setup the dock icon)
    createTrayIcon();

    // Create tabs
    overviewPage = new OverviewPage();
    statisticsPage = new StatisticsPage(this);
    blockBrowser = new BlockBrowser(this);
    chatWindow = new ChatWindow(this);

    transactionsPage = new QWidget(this);
    QVBoxLayout *vbox = new QVBoxLayout();
    transactionView = new TransactionView(this);
    vbox->addWidget(transactionView);
    transactionsPage->setLayout(vbox);

    addressBookPage = new AddressBookPage(AddressBookPage::ForEditing, AddressBookPage::SendingTab);

    receiveCoinsPage = new AddressBookPage(AddressBookPage::ForEditing, AddressBookPage::ReceivingTab);

    sendCoinsPage = new SendCoinsDialog(this);

    signVerifyMessageDialog = new SignVerifyMessageDialog(this);

    centralWidget = new QStackedWidget(this);
    centralWidget->addWidget(overviewPage);
    centralWidget->addWidget(statisticsPage);
    centralWidget->addWidget(blockBrowser);
    centralWidget->addWidget(chatWindow);
    centralWidget->addWidget(transactionsPage);
    centralWidget->addWidget(addressBookPage);
    centralWidget->addWidget(receiveCoinsPage);
    centralWidget->addWidget(sendCoinsPage);
    setCentralWidget(centralWidget);

    // Create status bar


    // Status bar notification icons
    labelEncryptionIcon = new QLabel();
	labelStakingIcon = new QLabel();
    labelConnectionsIcon = new QLabel();
    labelBlocksIcon = new QLabel();
	
	if (GetBoolArg("-staking", true))
    {
        QTimer *timerStakingIcon = new QTimer(labelStakingIcon);
        connect(timerStakingIcon, SIGNAL(timeout()), this, SLOT(updateStakingIcon()));
        timerStakingIcon->start(30 * 1000);
        updateStakingIcon();
    }

    // Progress bar and label for blocks download
    progressBarLabel = new QLabel();
    progressBarLabel->setVisible(false);
    progressBar = new QProgressBar();
    addToolBarBreak(Qt::LeftToolBarArea);
    QToolBar *toolbar2 = addToolBar(tr("Tabs toolbar"));
    addToolBar(Qt::LeftToolBarArea,toolbar2);
    toolbar2->setOrientation(Qt::Vertical);
    toolbar2->setMovable( false );
    toolbar2->setObjectName("toolbar2");
    toolbar2->setFixedWidth(28);
    toolbar2->setIconSize(QSize(28,54));
	toolbar2->addWidget(labelEncryptionIcon);
	toolbar2->addWidget(labelStakingIcon);
    toolbar2->addWidget(labelConnectionsIcon);
    toolbar2->addWidget(labelBlocksIcon);
	toolbar2->setStyleSheet("#toolbar2 QToolButton { background: transparent;border:none;padding:0px;margin:0px;height:54px;width:28px; }");
	
    syncIconMovie = new QMovie(":/movies/update_spinner", "gif", this);

    // Clicking on a transaction on the overview page simply sends you to transaction history page
    connect(overviewPage, SIGNAL(transactionClicked(QModelIndex)), this, SLOT(gotoHistoryPage()));
    connect(overviewPage, SIGNAL(transactionClicked(QModelIndex)), transactionView, SLOT(focusTransaction(QModelIndex)));

    // Double-clicking on a transaction on the transaction history page shows details
    connect(transactionView, SIGNAL(doubleClicked(QModelIndex)), transactionView, SLOT(showDetails()));

    rpcConsole = new RPCConsole(this);
    connect(openRPCConsoleAction, SIGNAL(triggered()), rpcConsole, SLOT(show()));

    // Clicking on "Verify Message" in the address book sends you to the verify message tab
    connect(addressBookPage, SIGNAL(verifyMessage(QString)), this, SLOT(gotoVerifyMessageTab(QString)));
    // Clicking on "Sign Message" in the receive coins page sends you to the sign message tab
    connect(receiveCoinsPage, SIGNAL(signMessage(QString)), this, SLOT(gotoSignMessageTab(QString)));

    gotoOverviewPage();
}
Exemplo n.º 7
0
// Constructor
MainWindow::MainWindow(QWidget *parent, QStringList torrentCmdLine)
    :
      QMainWindow(parent),
      m_posInitialized(false),
      force_exit(false),
      icon_TrayConn(res::trayConnected()),
      icon_TrayDisconn(res::trayDisconnected()),
      icon_CurTray(icon_TrayDisconn)
{
    setupUi(this);
    stackedWidget->addWidget(new transfers_widget(this));
    stackedWidget->addWidget(new search_widget(this));
    stackedWidget->addWidget(new preferences_widget(this));
    stackedWidget->setCurrentIndex(0);
    setWindowTitle(tr("qDonkey %1").arg(misc::versionString()));
    QCoreApplication::instance()->installEventFilter(this);

    //QApplication::setOverrideCursor(Qt::WaitCursor);
    m_last_file_error = QDateTime::currentDateTime().addSecs(-1); // imagine last file error event was 1 seconds in past

#ifdef Q_WS_WIN
    m_nTaskbarButtonCreated = RegisterWindowMessage(L"TaskbarButtonCreated");
#else
    m_nTaskbarButtonCreated = 0;
#endif

    Preferences pref;

    // Clean exit on log out
    connect(static_cast<SessionApplication*>(qApp), SIGNAL(sessionIsShuttingDown()), this, SLOT(deleteSession()));

    this->setWindowIcon(QIcon(res::favicon()));

#ifdef Q_WS_MAC
    connect(static_cast<QMacApplication*>(qApp), SIGNAL(newFileOpenMacEvent(QString)), this, SLOT(processParams(QString)));
#endif

    statusBar = new status_bar(this, QMainWindow::statusBar());
    m_pwr = new PowerManagement(this);

    // Configure session according to options
    loadPreferences(false);

    // Start connection checking timer
    guiUpdater = new QTimer(this);
    connect(guiUpdater, SIGNAL(timeout()), this, SLOT(updateGUI()));
    guiUpdater->start(2000);

    // Accept drag 'n drops
    //setAcceptDrops(true);
    createKeyboardShortcuts();

#ifdef Q_WS_MAC
    setUnifiedTitleAndToolBarOnMac(true);
#endif

    // View settings



    // Auto shutdown actions
/*    QActionGroup * autoShutdownGroup = new QActionGroup(this);
    autoShutdownGroup->setExclusive(true);
    autoShutdownGroup->addAction(actionAutoShutdown_Disabled);
    autoShutdownGroup->addAction(actionAutoExit_mule);
    autoShutdownGroup->addAction(actionAutoShutdown_system);
    autoShutdownGroup->addAction(actionAutoSuspend_system);

#if !defined(Q_WS_X11) || defined(QT_DBUS_LIB)
    actionAutoShutdown_system->setChecked(pref.shutdownWhenDownloadsComplete());
    actionAutoSuspend_system->setChecked(pref.suspendWhenDownloadsComplete());
#else
    actionAutoShutdown_system->setDisabled(true);
    actionAutoSuspend_system->setDisabled(true);
#endif

    actionAutoExit_mule->setChecked(pref.shutdownqBTWhenDownloadsComplete());

    if (!autoShutdownGroup->checkedAction())
        actionAutoShutdown_Disabled->setChecked(true);
*/

    readSettings();

    show();
    activateWindow();
    raise();

    // Start watching the executable for updates
    executable_watcher = new QFileSystemWatcher();
    connect(executable_watcher, SIGNAL(fileChanged(QString)), this, SLOT(notifyOfUpdate(QString)));
    executable_watcher->addPath(qApp->applicationFilePath());

    // Add torrent given on command line
    processParams(torrentCmdLine);
#ifdef Q_WS_MAC
    //qt_mac_set_dock_menu(icon_CurTray);
#endif

    // Make sure the Window is visible if we don't have a tray icon
    if (!systrayIcon && isHidden())  {
        show();
        activateWindow();
        raise();
    }

    connect(Session::instance(), SIGNAL(serverNameResolved(QString)), this, SLOT(handleServerNameResolved(QString)));
    connect(Session::instance(), SIGNAL(serverConnectionInitialized(quint32,quint32,quint32)), this, SLOT(handleServerConnectionInitialized(quint32,quint32,quint32)));
    connect(Session::instance(), SIGNAL(serverConnectionClosed(QString)), this, SLOT(handleServerConnectionClosed(QString)));
    connect(Session::instance(), SIGNAL(serverStatus(int,int)), this, SLOT(handleServerStatus(int,int)));
    connect(Session::instance(), SIGNAL(serverMessage(QString)), this, SLOT(handleServerMessage(QString)));
    connect(Session::instance(), SIGNAL(serverIdentity(QString,QString)), this, SLOT(handleServerIdentity(QString,QString)));

    connect(Session::instance(), SIGNAL(transferAdded(QED2KHandle)), SLOT(addedTransfer(QED2KHandle)));
    connect(Session::instance(), SIGNAL(transferFinished(QED2KHandle)), SLOT(finishedTransfer(QED2KHandle)));

    //Tray actions.
    //connect(actionToggleVisibility, SIGNAL(triggered()), this, SLOT(toggleVisibility()));
    //connect(actionStart_All, SIGNAL(triggered()), Session::instance(), SLOT(resumeAllTransfers()));
    //connect(actionPause_All, SIGNAL(triggered()), Session::instance(), SLOT(pauseAllTransfers()));

    actionConnect->trigger();
    Session::instance()->loadDirectory(pref.inputDir());
}
Exemplo n.º 8
0
//---------------------------------------------------------------------------
void MainWindow::Ui_Init()
{
    ui->setupUi(this);

    // Shortcuts
    QShortcut *shortcutEqual = new QShortcut(QKeySequence(Qt::CTRL+Qt::Key_Equal), this);
    QObject::connect(shortcutEqual, SIGNAL(activated()), this, SLOT(on_actionZoomIn_triggered()));
    QShortcut *shortcutJ = new QShortcut(QKeySequence(Qt::Key_J), this);
    QObject::connect(shortcutJ, SIGNAL(activated()), this, SLOT(on_M1_triggered()));
    QShortcut *shortcutLeft = new QShortcut(QKeySequence(Qt::Key_Left), this);
    QObject::connect(shortcutLeft, SIGNAL(activated()), this, SLOT(on_Minus_triggered()));
    QShortcut *shortcutK = new QShortcut(QKeySequence(Qt::Key_K), this);
    QObject::connect(shortcutK, SIGNAL(activated()), this, SLOT(on_Pause_triggered()));
    QShortcut *shortcutRight = new QShortcut(QKeySequence(Qt::Key_Right), this);
    QObject::connect(shortcutRight, SIGNAL(activated()), this, SLOT(on_Plus_triggered()));
    QShortcut *shortcutL = new QShortcut(QKeySequence(Qt::Key_L), this);
    QObject::connect(shortcutL, SIGNAL(activated()), this, SLOT(on_P1_triggered()));
    QShortcut *shortcutSpace = new QShortcut(QKeySequence(Qt::Key_Space), this);
    QObject::connect(shortcutSpace, SIGNAL(activated()), this, SLOT(on_PlayPause_triggered()));
    QShortcut *shortcutF = new QShortcut(QKeySequence(Qt::Key_F), this);
    QObject::connect(shortcutF, SIGNAL(activated()), this, SLOT(on_Full_triggered()));

    // Drag n drop
    setAcceptDrops(true);

    // Icons
    ui->actionOpen->setIcon(QIcon(":/icon/document-open.png"));
    ui->actionCSV->setIcon(QIcon(":/icon/export.png"));
    ui->actionPrint->setIcon(QIcon(":/icon/document-print.png"));
    ui->actionZoomIn->setIcon(QIcon(":/icon/zoom-in.png"));
    ui->actionZoomOut->setIcon(QIcon(":/icon/zoom-out.png"));
    ui->actionFilesList->setIcon(QIcon(":/icon/multifile_layout.png"));
    ui->actionGraphsLayout->setIcon(QIcon(":/icon/graph_layout.png"));
    ui->actionFiltersLayout->setIcon(QIcon(":/icon/filters_layout.png"));
    ui->actionGettingStarted->setIcon(QIcon(":/icon/help.png"));
    ui->actionWindowOut->setIcon(QIcon(":/icon/window-out.png"));
    QWidget* spacer = new QWidget();
    spacer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
    ui->toolBar->insertWidget(ui->actionFilesList, spacer);

    // Config
    ui->verticalLayout->setSpacing(0);
    ui->verticalLayout->setMargin(0);
    ui->verticalLayout->setStretch(0, 1);
    ui->verticalLayout->setContentsMargins(0,0,0,0);

    QLabel* DragDrop=new QLabel();
    DragDrop->setAlignment(Qt::AlignCenter);
    DragDrop->setPixmap(QPixmap(":/icon/window-out.png"));

    // Window
    setWindowTitle("QCTools");
    setWindowIcon(QIcon(":/icon/logo.png"));
    move(75, 75);
    resize(QApplication::desktop()->screenGeometry().width()-150, QApplication::desktop()->screenGeometry().height()-150);
    setUnifiedTitleAndToolBarOnMac(true);

    //ToolBar
    QObject::connect(ui->toolBar, SIGNAL(visibilityChanged(bool)), this, SLOT(on_Toolbar_visibilityChanged(bool)));

    //ToolTip
    if (ui->fileNamesBox)
        ui->fileNamesBox->hide();
    for (size_t j=0; j<PlotType_Axis; j++)
    {
        CheckBoxes[j]=new QCheckBox(PerPlotGroup[j].Name);
        CheckBoxes[j]->setToolTip(PerPlotGroup[j].Description);
        CheckBoxes[j]->setCheckable(true);
        CheckBoxes[j]->setChecked(PerPlotGroup[j].CheckedByDefault);
        CheckBoxes[j]->setVisible(false);
        QObject::connect(CheckBoxes[j], SIGNAL(toggled(bool)), this, SLOT(on_check_toggled(bool)));
        ui->horizontalLayout->addWidget(CheckBoxes[j]);
    }

    configureZoom();

    //Groups
    QActionGroup* alignmentGroup = new QActionGroup(this);
    alignmentGroup->addAction(ui->actionFilesList);
    alignmentGroup->addAction(ui->actionGraphsLayout);
    alignmentGroup->addAction(ui->actionFiltersLayout);

    createDragDrop();
    ui->actionFilesList->setChecked(false);
    ui->actionGraphsLayout->setChecked(false);

    //Temp
    ui->actionFiltersLayout->setVisible(false);
    ui->actionWindowOut->setVisible(false);
    ui->actionPrint->setVisible(false);
    ui->actionPreferences->setVisible(false);
    ui->menuOptions->setVisible(false);
    ui->menuOptions->setTitle(QString());
    ui->menuOptions->setEnabled(false);

    // Not implemented action
    if (ui->actionExport_XmlGz_Custom)
        ui->actionExport_XmlGz_Custom->setVisible(false);
}
Exemplo n.º 9
0
BitcoinGUI::BitcoinGUI(QWidget *parent):
    QMainWindow(parent),
    clientModel(0),
    walletModel(0),
    dummyWidget(0),
    encryptWalletAction(0),
    changePassphraseAction(0),
    aboutQtAction(0),
    trayIcon(0),
    notificator(0)
{
    resize(850, 550);
    setWindowTitle(tr("Bitcoin Wallet"));
#ifndef Q_WS_MAC
    setWindowIcon(QIcon(":icons/bitcoin"));
#else
    setUnifiedTitleAndToolBarOnMac(true);
    QApplication::setAttribute(Qt::AA_DontShowIconsInMenus);
#endif
    // Accept D&D of URIs
    setAcceptDrops(true);

    // Create actions for the toolbar, menu bar and tray/dock icon
    createActions();

    // Create application menu bar
    createMenuBar();

    // Create the toolbars
    createToolBars();

    // Create the tray icon (or setup the dock icon)
    createTrayIcon();

    // Dummy widget used when restoring window state after minimization
    dummyWidget = new QWidget();

    // Create tabs
    overviewPage = new OverviewPage();

    transactionsPage = new QWidget(this);
    QVBoxLayout *vbox = new QVBoxLayout();
    transactionView = new TransactionView(this);
    vbox->addWidget(transactionView);
    transactionsPage->setLayout(vbox);

    addressBookPage = new AddressBookPage(AddressBookPage::ForEditing, AddressBookPage::SendingTab);

    receiveCoinsPage = new AddressBookPage(AddressBookPage::ForEditing, AddressBookPage::ReceivingTab);

    sendCoinsPage = new SendCoinsDialog(this);

    messagePage = new MessagePage(this);

    centralWidget = new QStackedWidget(this);
    centralWidget->addWidget(overviewPage);
    centralWidget->addWidget(transactionsPage);
    centralWidget->addWidget(addressBookPage);
    centralWidget->addWidget(receiveCoinsPage);
    centralWidget->addWidget(sendCoinsPage);
#ifdef FIRST_CLASS_MESSAGING
    centralWidget->addWidget(messagePage);
#endif
    setCentralWidget(centralWidget);

    // Create status bar
    statusBar();

    // Status bar notification icons
    QFrame *frameBlocks = new QFrame();
    frameBlocks->setContentsMargins(0,0,0,0);
    frameBlocks->setMinimumWidth(56);
    frameBlocks->setMaximumWidth(56);
    QHBoxLayout *frameBlocksLayout = new QHBoxLayout(frameBlocks);
    frameBlocksLayout->setContentsMargins(3,0,3,0);
    frameBlocksLayout->setSpacing(3);
    labelEncryptionIcon = new QLabel();
    labelConnectionsIcon = new QLabel();
    labelBlocksIcon = new QLabel();
    frameBlocksLayout->addStretch();
    frameBlocksLayout->addWidget(labelEncryptionIcon);
    frameBlocksLayout->addStretch();
    frameBlocksLayout->addWidget(labelConnectionsIcon);
    frameBlocksLayout->addStretch();
    frameBlocksLayout->addWidget(labelBlocksIcon);
    frameBlocksLayout->addStretch();

    // Progress bar for blocks download
    progressBarLabel = new QLabel(tr("Synchronizing with network..."));
    progressBarLabel->setVisible(false);
    progressBar = new QProgressBar();
    progressBar->setToolTip(tr("Block chain synchronization in progress"));
    progressBar->setVisible(false);

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

    syncIconMovie = new QMovie(":/movies/update_spinner", "mng", this);

    // Clicking on a transaction on the overview page simply sends you to transaction history page
    connect(overviewPage, SIGNAL(transactionClicked(QModelIndex)), this, SLOT(gotoHistoryPage()));

    // Doubleclicking on a transaction on the transaction history page shows details
    connect(transactionView, SIGNAL(doubleClicked(QModelIndex)), transactionView, SLOT(showDetails()));

    gotoOverviewPage();
}
Exemplo n.º 10
0
XSettingsWindow::XSettingsWindow(const qutim_sdk_0_3::SettingsItemList& settings, QObject* controller, QWidget *parent) :
	QMainWindow(parent),
	p(new XSettingsWindowPrivate)
{
	setAttribute(Qt::WA_DeleteOnClose);
	p->controller = controller;
    setWindowModality(controller ? Qt::WindowModal : Qt::NonModal);
	//setup ui
	QWidget *w = new QWidget(this);
	QVBoxLayout *l = new QVBoxLayout(w);
	Config cfg;
	cfg.beginGroup("xsettings/window");
	QByteArray data;

	p->parent = qobject_cast<XSettingsWindow*>(qApp->activeWindow());
	if(p->parent) {
		QRect geom = p->parent->geometry();
		int width = geom.width()/15;
		int height = geom.height()/15;
		geom.adjust(width,height,-width,-height);
		setGeometry(geom);
	} else {
		data = cfg.value("geometry", QByteArray());
		if (data.isEmpty() || !restoreGeometry(data)) {
			QSize desktopSize = QApplication::desktop()->availableGeometry(QCursor::pos()).size();
			resize(desktopSize.width() / 2, desktopSize.height() * 2 / 3);
			centerizeWidget(this);
		}
	}
	//init widgets
	p->splitter = new QSplitter(Qt::Horizontal,w);
	p->listWidget = new QListWidget(w);

	p->stackedWidget = new QStackedWidget(w);
	//default widget
	QWidget *empty = new QWidget(this);

	p->stackedWidget->addWidget(empty);
	p->splitter->addWidget(p->listWidget);
	p->splitter->addWidget(p->stackedWidget);
	data = cfg.value("splitterState", QByteArray());
	if (data.isEmpty() || !p->splitter->restoreState(data))
		p->splitter->setSizes(QList<int>() << 80  << 250);
	l->addWidget(p->splitter);

    QDialogButtonBox::StandardButtons buttons;
    if (controller)
        buttons = QDialogButtonBox::Ok;
    else
        buttons = QDialogButtonBox::Save | QDialogButtonBox::Cancel;

    p->buttonBox = new QDialogButtonBox(buttons, Qt::Horizontal, w);
	l->addWidget(p->buttonBox);
    p->buttonBox->setVisible(controller);
	//init actiontoolbar
	setCentralWidget(w);
    setUnifiedTitleAndToolBarOnMac(true);

	p->toolBar = new ActionToolBar(w);
	addToolBar(Qt::TopToolBarArea,p->toolBar);

	int width = style()->pixelMetric(QStyle::PM_IconViewIconSize);
	QSize size = QSize(width, width);

	p->toolBar->setIconSize(size);
	p->toolBar->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
	p->toolBar->setObjectName(QLatin1String("SettingsBar"));
	p->toolBar->setMovable(false);

#if defined (Q_WS_WIN32) || defined(Q_WS_MAC)
	width = 22;
#else
	width = style()->pixelMetric(QStyle::PM_ToolBarIconSize);
#endif
	size = QSize(width, width);
	p->listWidget->setIconSize(size);

	p->group = new QActionGroup(w);
	p->group->setExclusive(true);
	//connections
    connect(p->group,SIGNAL(triggered(QAction*)), SLOT(onGroupActionTriggered(QAction*)));
	connect(p->listWidget,
			SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)),
			SLOT(onCurrentItemChanged(QListWidgetItem*))
			);
    connect(p->buttonBox,SIGNAL(accepted()), SLOT(save()));
    connect(p->buttonBox,SIGNAL(rejected()), SLOT(cancel()));
	loadSettings(settings);
	if (p->group->actions().count())
		p->group->actions().first()->trigger();
}
Exemplo n.º 11
0
BitcoinGUI::BitcoinGUI(QWidget *parent):
    QMainWindow(parent),
    clientModel(0),
    walletModel(0),
    encryptWalletAction(0),
    changePassphraseAction(0),
    aboutQtAction(0),
    trayIcon(0),
    notificator(0),
    rpcConsole(0)
{
    resize(850, 550);
    setWindowTitle(tr("ECCoin") + " - " + tr("Wallet"));
	qApp->setStyleSheet("QMainWindow { background:rgb(220,220,220);font-family:'Proxima Nova Rg'; }" //content
    "#toolbar2 { border:none;width:28px;background-color:qlineargradient(x1: 0, y1: 0, x2: 0.5, y2: 0.5,stop: 0 rgb(195,205,250), stop: 1 rgb(28,29,33)) }"
    "QMenu { background: rgb(115,115,115); color:white; padding-bottom:10px; } "
    "QMenu::item { color:white; background-color: transparent; } "
    "QMenu::item:selected { background-color:qlineargradient(x1: 0, y1: 0, x2: 0.5, y2: 0.5,stop: 0 rgb(195,205,250), stop: 1 rgb(28,29,33)); }"
    "QMenuBar { background-color:qlineargradient(x1: 0, y1: 0, x2: 0.5, y2: 0.5,stop: 0 rgb(195,205,250), stop: 1 rgb(28,29,33));  color:white; }"
    "QMenuBar::item { font-size:12px;padding-bottom:12px;padding-top:12px;padding-left:15px;padding-right:15px;color:white; background-color: transparent; }"
    "QMenuBar::item:selected { background-color:qlineargradient(x1: 0, y1: 0, x2: 0.5, y2: 0.5,stop: 0 rgb(35,35,35), stop: 1 rgb(0, 141, 210)); }"
    );


#ifndef Q_OS_MAC
    qApp->setWindowIcon(QIcon(":icons/bitcoin"));
    setWindowIcon(QIcon(":icons/bitcoin"));
#else
    setUnifiedTitleAndToolBarOnMac(true);
    QApplication::setAttribute(Qt::AA_DontShowIconsInMenus);
#endif
    // Accept D&D of URIs
    setAcceptDrops(true);

    // Create actions for the toolbar, menu bar and tray/dock icon
    createActions();

    // Create application menu bar
    createMenuBar();

    // Create the toolbars
    createToolBars2();

    // Create the tray icon (or setup the dock icon)
    createTrayIcon();

    // Create tabs
    overviewPage = new OverviewPage();

    transactionsPage = new QWidget(this);
    QVBoxLayout *vbox = new QVBoxLayout();
    transactionView = new TransactionView(this);
    vbox->addWidget(transactionView);
    transactionsPage->setLayout(vbox);

    addressBookPage = new AddressBookPage(AddressBookPage::ForEditing, AddressBookPage::SendingTab);

    receiveCoinsPage = new AddressBookPage(AddressBookPage::ForEditing, AddressBookPage::ReceivingTab);

    sendCoinsPage = new SendCoinsDialog(this);
	blockBrowser = new BlockBrowser();
    chatWindow = new ChatWindow(this);
    //tradingWindow = new TradingWindow();
    signVerifyMessageDialog = new SignVerifyMessageDialog(this);

    centralWidget = new QStackedWidget(this);
    centralWidget->addWidget(overviewPage);
    centralWidget->addWidget(transactionsPage);
    centralWidget->addWidget(addressBookPage);
    centralWidget->addWidget(receiveCoinsPage);
    centralWidget->addWidget(sendCoinsPage);
	centralWidget->addWidget(blockBrowser);
    // centralWidget->addWidget(tradingWindow);
    centralWidget->addWidget(chatWindow);
    setCentralWidget(centralWidget);

    // Create status bar
    statusBar();

    // Status bar notification icons
    QFrame *frameBlocks = new QFrame();
    frameBlocks->setContentsMargins(0,0,0,0);
    frameBlocks->setMinimumWidth(56);
    frameBlocks->setMaximumWidth(56);
    QHBoxLayout *frameBlocksLayout = new QHBoxLayout(frameBlocks);
    frameBlocksLayout->setContentsMargins(3,0,3,0);
    frameBlocksLayout->setSpacing(3);
    labelEncryptionIcon = new QLabel();
    labelConnectionsIcon = new QLabel();
    labelBlocksIcon = new QLabel();
    frameBlocksLayout->addStretch();
    frameBlocksLayout->addWidget(labelEncryptionIcon);
    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 QProgressBar();
    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 = qApp->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()->addPermanentWidget(frameBlocks);

    syncIconMovie = new QMovie(":/movies/update_spinner", "mng", this);
	// this->setStyleSheet("background-color: #ceffee;");

    // Clicking on a transaction on the overview page simply sends you to transaction history page
    connect(overviewPage, SIGNAL(transactionClicked(QModelIndex)), this, SLOT(gotoHistoryPage()));
    connect(overviewPage, SIGNAL(transactionClicked(QModelIndex)), transactionView, SLOT(focusTransaction(QModelIndex)));

    // Double-clicking on a transaction on the transaction history page shows details
    connect(transactionView, SIGNAL(doubleClicked(QModelIndex)), transactionView, SLOT(showDetails()));

    rpcConsole = new RPCConsole(this);
    connect(openRPCConsoleAction, SIGNAL(triggered()), rpcConsole, SLOT(show()));

    // Clicking on "Verify Message" in the address book sends you to the verify message tab
    connect(addressBookPage, SIGNAL(verifyMessage(QString)), this, SLOT(gotoVerifyMessageTab(QString)));
    // Clicking on "Sign Message" in the receive coins page sends you to the sign message tab
    connect(receiveCoinsPage, SIGNAL(signMessage(QString)), this, SLOT(gotoSignMessageTab(QString)));

    gotoOverviewPage();
}
Exemplo n.º 12
0
UIMain::UIMain( QWidget* parent )
    : QMainWindow( parent )
{
#if defined( Q_OS_MAC )
    mMenuBar = new QMenuBar;
#endif
    mCache = pNetworkAccessManager::instance();
    mUpdateChecker = new pUpdateChecker( this );
    mUpdateChecker->setDownloadsFeedUrl( QUrl( APPLICATION_DOWNLOADS_FEED ) );
    mUpdateChecker->setVersion( APPLICATION_VERSION );
    mUpdateChecker->setVersionString( APPLICATION_VERSION_STR );
    mUpdateChecker->setVersionDiscoveryPattern( ".*qwbfsmanager-([0-9\\.]+).*" );

    setWindowTitle( QString( "%1 v%2" ).arg( APPLICATION_NAME ).arg( APPLICATION_VERSION_STR ) );
    setUnifiedTitleAndToolBarOnMac( true );
    setupUi( this );

#if defined( Q_OS_MAC )
    mMenuBar->addMenu( "Fake" )->addAction( aProperties );
#endif

    centralVerticalLayout->setMenuBar( qmtbInfos );
    qmtbInfos->layout()->setMargin( 5 );
    qmtbInfos->queuedMessageWidget()->setContentsMargins( 5, 0, 5, 0 );
    qmtbInfos->setVisible( false );

    dwTools->toggleViewAction()->setIcon( QIcon( ":/icons/256/tools.png" ) );
    dwCovers->toggleViewAction()->setIcon( QIcon( ":/icons/256/covers.png" ) );

    mDonationWidget = new pPaypalButton( this );
    mDonationWidget->setBusinessId( "5R924WYXJ6BAW" );
    mDonationWidget->setItemName( "QWBFS Manager" );
    mDonationWidget->setItemId( "QWBFS-DONATION" );
    mDonationWidget->setCurrencyCode( "EUR" );

    mActions = new QMenu( this );
    mActions->setIcon( aConvertToWBFSFiles->icon() );
    mActions->addAction( aConvertToWBFSFiles );
    mActions->addAction( aConvertToISOFiles );
    mActions->addAction( aRenameDiscsInFolder );

    toolBar->insertAction( aAbout, mUpdateChecker->menuAction() );
    toolBar->addAction( mActions->menuAction() );
    toolBar->addSeparator();
    toolBar->addAction( dwTools->toggleViewAction() );
    toolBar->addAction( dwCovers->toggleViewAction() );
    QWidget* spacerWidget = new QWidget( toolBar );
    spacerWidget->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Maximum ) );
    toolBar->addWidget( spacerWidget );
    toolBar->addWidget( mDonationWidget );

    mFoldersModel = new QFileSystemModel( this );
    mFoldersModel->setFilter( QDir::Dirs | QDir::NoDotAndDotDot );

    mFilesModel = new QFileSystemModel( this );
    mFilesModel->setFilter( QDir::Files );

    tvFolders->setModel( mFoldersModel );
    tvFolders->setColumnHidden( 1, true );
    tvFolders->setColumnHidden( 2, true );
    tvFolders->setColumnHidden( 3, true );

    lvFiles->setModel( mFilesModel );

    lvExport->initialize( 0, mCache );

    mLastDiscId = -1;

    pwMainView->setMainView( true );
    pwMainView->showHideImportViewButton()->setChecked( false );
    connectView( pwMainView );

    qmtbInfos->installEventFilter( this );
    lWiiTDB->installEventFilter( this );

    localeChanged();

    connect( mCache, SIGNAL( finished( QNetworkReply* ) ), this, SLOT( networkAccessManager_finished( QNetworkReply* ) ) );
    connect( mCache, SIGNAL( cached( const QUrl& ) ), this, SLOT( networkAccessManager_cached( const QUrl& ) ) );
    connect( mCache, SIGNAL( error( const QUrl&, const QString& ) ), this, SLOT( networkAccessManager_error( const QUrl&, const QString& ) ) );
    connect( mCache, SIGNAL( cacheCleared() ), this, SLOT( networkAccessManager_cacheCleared() ) );
}
Exemplo n.º 13
0
BitcoinGUI::BitcoinGUI(QWidget *parent):
    QMainWindow(parent),
    clientModel(0),
    walletModel(0),
    encryptWalletAction(0),
    changePassphraseAction(0),
    aboutQtAction(0),
    trayIcon(0),
    notificator(0),
    rpcConsole(0)
{
    resize(650, 550);
//    resize(530, 550);
    setWindowTitle(tr("LEOcoin") + " - " + tr("Wallet"));

    qApp->setStyleSheet(
                "QMainWindow { background: #e8e8e8;font-family:'Open Sans,sans-serif'; } " \
                "QCheckBox { spacing: 5px; } "\
                "QCheckBox::indicator { width: 24px; height: 24px; }" \
                "QCheckBox::indicator:unchecked { image: url(:/images/checkbox_unchecked); }" \
                "QCheckBox::indicator:checked { image: url(:/images/checkbox_checked); }" \
                "QComboBox  { border: 1px solid gray; border-radius: 3px; padding: 1px 18px 1px 3px; }" \
                "QComboBox:editable  { background: white; }" \
                "QComboBox:!editable, QComboBox::drop-down:editable { background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #E1E1E1, stop: 0.4 #DDDDDD, stop: 0.5 #D8D8D8, stop: 1.0 #D3D3D3); } " \
                "QComboBox:!editable:on, QComboBox::drop-down:editable:on  { background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #D3D3D3, stop: 0.4 #D8D8D8, stop: 0.5 #DDDDDD, stop: 1.0 #E1E1E1); } " \
                "QComboBox:on  { /* shift the text when the popup opens */ padding-top: 3px; padding-left: 4px; } " \
                "QComboBox::drop-down  { subcontrol-origin: padding; subcontrol-position: top right; width: 15px; border-left-width: 1px; border-left-color: darkgray; border-left-style: solid; /* just a single line */ border-top-right-radius: 3px; /* same radius as the QComboBox */ border-bottom-right-radius: 3px; } " \
                "QComboBox::down-arrow1  { image: url(/usr/share/icons/crystalsvg/16x16/actions/1downarrow.png); } " \
                "QComboBox::down-arrow:on  { /* shift the arrow when popup is open */ top: 1px; left: 1px; }" \
                "QLineEdit { border: 0px; border-radius1: 10px; padding: 0 8px; background: #c7c8ca; selection-background-color: #eea734; margin: 6px; }" \
                "QLabel { color: #404041; } " \
                "QTableView { background: #c7c8ca; border-color: #e8e8e8; margin: 6px; } " \
                "QTableView QHeaderView { } " \
                "QTableView QAbstractItemView { margin: 4px; min-height: 28px; border: 3px; } " \
                "QStatusBar { background: #a7aaac; } " \
                    "#frame { } QToolBar QLabel { padding-top:15px;padding-bottom:10px;margin:0px; border: 0px; border-color: yellow;} " \
                    "#spacer { background:#a7aaac;border:none; } " \
                    "#toolbar { height:100%;padding-top:20px; background: #e8e8e8; text-align: left; min-width:200px;max-width:200px; border: none; margin: -2px; padding: -2px; } " \
                "QToolBar QToolButton { font-family:Open Sans;padding-left:0px;padding-top:10px;padding-bottom:10px; width:200px; color: black; text-align: left; background-color: #a7aaac } " \
                "QToolBar QToolButton:hover:!checked { color: #eea734; background-color: #a7aaac; border: none; } " \
                "QToolBar QToolButton:pressed { color: #404041; background-color: #e8e8e8; border: none; } " \
                "QToolBar QToolButton:checked { color: #eea734; background-color: #e8e8e8; border: none; } " \
                "QToolBar QToolButton:disabled { color: grey; } " \
                "QToolButton { color: black; background-color: #eea734; border: none; text-align: center; min-height: 24px; } " \
                    "#labelMiningIcon { padding-left:5px;font-family:Open Sans;width:100%;font-size:10px;text-align:center;color:grey; } " \
                "QMenu { background: #a7aaac; color: #404041; padding-bottom:10px; border: 1px solid grey; } " \
                "QMenu::item { color:#404041; background-color: transparent; } " \
                "QMenu::item:selected { color: #282828; background-color: #e8e8e8; } " \
                "QMenuBar { background: #a7aaac; color: #404041; } " \
                "QMenuBar::item { font-size:12px;padding-bottom:12px;padding-top:12px;padding-left:15px;padding-right:15px;color:#282828; background-color: transparent; } " \
                "QMenuBar::item:selected { color: #e8e8e8; background-color: #282828); }"
                "QTabWidget {background-color: #e8e8e8; }" \
                "#debug QLabel {color: white; }" \
                "QDateTime {}"
    );


#ifndef Q_OS_MAC
    qApp->setWindowIcon(QIcon(":icons/bitcoin"));
    setWindowIcon(QIcon(":icons/bitcoin"));
#else
    setUnifiedTitleAndToolBarOnMac(true);
    QApplication::setAttribute(Qt::AA_DontShowIconsInMenus);
#endif
    // Accept D&D of URIs
    setAcceptDrops(true);

    // Create actions for the toolbar, menu bar and tray/dock icon
    createActions();

    // Create application menu bar
    createMenuBar();

    // Create the toolbars
    createToolBars();

    // Create the tray icon (or setup the dock icon)
    createTrayIcon();

    // Create tabs
    overviewPage = new OverviewPage();

    transactionsPage = new QWidget(this);
    QVBoxLayout *vbox = new QVBoxLayout();
    transactionView = new TransactionView(this);
    vbox->addWidget(transactionView);
    transactionsPage->setLayout(vbox);

    addressBookPage = new AddressBookPage(AddressBookPage::ForEditing, AddressBookPage::SendingTab);

    receiveCoinsPage = new AddressBookPage(AddressBookPage::ForEditing, AddressBookPage::ReceivingTab);

    sendCoinsPage = new SendCoinsDialog(this);

    signVerifyMessageDialog = new SignVerifyMessageDialog(this);

    centralWidget = new QStackedWidget(this);
    centralWidget->addWidget(overviewPage);
    centralWidget->addWidget(transactionsPage);
    centralWidget->addWidget(addressBookPage);
    centralWidget->addWidget(receiveCoinsPage);
    centralWidget->addWidget(sendCoinsPage);
    setCentralWidget(centralWidget);

    // Create status bar
    statusBar();

    // Status bar notification icons
    QFrame *frameBlocks = new QFrame();
    frameBlocks->setContentsMargins(0,0,0,0);
    frameBlocks->setMinimumWidth(56);
    frameBlocks->setMaximumWidth(56);
    QHBoxLayout *frameBlocksLayout = new QHBoxLayout(frameBlocks);
    frameBlocksLayout->setContentsMargins(3,0,3,0);
    frameBlocksLayout->setSpacing(3);
    labelEncryptionIcon = new QLabel();
    labelConnectionsIcon = new QLabel();
    labelBlocksIcon = new QLabel();
    frameBlocksLayout->addStretch();
    frameBlocksLayout->addWidget(labelEncryptionIcon);
    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 QProgressBar();
    progressBar->setAlignment(Qt::AlignCenter);
    progressBar->setVisible(false);
    progressBar->setStyleSheet("QProgressBar { background-color: #e8e8e8; border: 0px solid grey; border-radius: 7px; padding: 1px; text-align: center; } " \
                               "QProgressBar::chunk { background: #eea734; border-radius: 7px; margin: 0px; }");

    // 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 = qApp->style()->metaObject()->className();
    if(curStyle == "QWindowsStyle" || curStyle == "QWindowsXPStyle")
    {
        progressBar->setStyleSheet("QProgressBar { background-color: #e8e8e8; border: 0px solid grey; border-radius: 7px; padding: 1px; text-align: center; } " \
                                   "QProgressBar::chunk { background: #eea734; border-radius: 7px; margin: 0px; }");
    }

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

    syncIconMovie = new QMovie(":/movies/update_spinner", "gif", this);
    syncIconMovie->setScaledSize(QSize(24,24));

    // Clicking on a transaction on the overview page simply sends you to transaction history page
    connect(overviewPage, SIGNAL(transactionClicked(QModelIndex)), this, SLOT(gotoHistoryPage()));
    connect(overviewPage, SIGNAL(transactionClicked(QModelIndex)), transactionView, SLOT(focusTransaction(QModelIndex)));

    // Double-clicking on a transaction on the transaction history page shows details
    connect(transactionView, SIGNAL(doubleClicked(QModelIndex)), transactionView, SLOT(showDetails()));

    rpcConsole = new RPCConsole(this);
    connect(openRPCConsoleAction, SIGNAL(triggered()), rpcConsole, SLOT(show()));

    // Clicking on "Verify Message" in the address book sends you to the verify message tab
    connect(addressBookPage, SIGNAL(verifyMessage(QString)), this, SLOT(gotoVerifyMessageTab(QString)));
    // Clicking on "Sign Message" in the receive coins page sends you to the sign message tab
    connect(receiveCoinsPage, SIGNAL(signMessage(QString)), this, SLOT(gotoSignMessageTab(QString)));

    gotoOverviewPage();
}
Exemplo n.º 14
0
BitcoinGUI::BitcoinGUI(QWidget *parent):
    QMainWindow(parent),
    clientModel(0),
    walletModel(0),
    encryptWalletAction(0),
    changePassphraseAction(0),
    aboutQtAction(0),
    trayIcon(0),
    notificator(0),
    rpcConsole(0)
{
    resize(850, 550);
  setWindowTitle(tr("BitBar")+" - "+tr("Wallet")+" "+QString::fromStdString(CLIENT_BUILD));
#ifndef Q_OS_MAC
    qApp->setWindowIcon(QIcon(":icons/bitcoin"));
    setWindowIcon(QIcon(":icons/bitcoin"));
#else
    setUnifiedTitleAndToolBarOnMac(true);
    QApplication::setAttribute(Qt::AA_DontShowIconsInMenus);
#endif

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

    // Create actions for the toolbar, menu bar and tray/dock icon
    createActions();

    // Create application menu bar
    createMenuBar();
menuBar()->setNativeMenuBar(false);// menubar on form instead

    // Create the toolbars
    createToolBars();

    // Create the tray icon (or setup the dock icon)
    createTrayIcon();

    // Create tabs
    overviewPage = new OverviewPage();

    transactionsPage = new QWidget(this);
    QVBoxLayout *vbox = new QVBoxLayout();
    transactionView = new TransactionView(this);
    vbox->addWidget(transactionView);
    transactionsPage->setLayout(vbox);

    addressBookPage = new AddressBookPage(AddressBookPage::ForEditing, AddressBookPage::SendingTab);

    receiveCoinsPage = new AddressBookPage(AddressBookPage::ForEditing, AddressBookPage::ReceivingTab);

    sendCoinsPage = new SendCoinsDialog(this);

    signVerifyMessageDialog = new SignVerifyMessageDialog(this);

    skinsPage = new SkinsPage(this);
    connect(skinsPage, SIGNAL(error(QString,QString,bool)), this, SLOT(error(QString,QString,bool)));
    connect(skinsPage, SIGNAL(information(QString,QString)), this, SLOT(information(QString,QString)));
    connect(skinsPage, SIGNAL(status(QString)), this, SLOT(status(QString)));

    centralWidget = new QStackedWidget(this);
    centralWidget->addWidget(overviewPage);
    centralWidget->addWidget(transactionsPage);
    centralWidget->addWidget(addressBookPage);
    centralWidget->addWidget(receiveCoinsPage);
    centralWidget->addWidget(sendCoinsPage);
	centralWidget->addWidget(skinsPage);
    setCentralWidget(centralWidget);

    // Create status bar
    statusBar();

    // 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);
    labelEncryptionIcon = new QLabel();
    labelMintingIcon = new QLabel();
    labelConnectionsIcon = new QLabel();
    labelBlocksIcon = new QLabel();
    frameBlocksLayout->addStretch();
    frameBlocksLayout->addWidget(labelEncryptionIcon);
    frameBlocksLayout->addStretch();
    frameBlocksLayout->addWidget(labelMintingIcon);
    frameBlocksLayout->addStretch();
    frameBlocksLayout->addWidget(labelConnectionsIcon);
    frameBlocksLayout->addStretch();
    frameBlocksLayout->addWidget(labelBlocksIcon);
    frameBlocksLayout->addStretch();

    // Set minting pixmap
    labelMintingIcon->setPixmap(QIcon(":/icons/staking_on").pixmap(STATUSBAR_ICONSIZE,STATUSBAR_ICONSIZE));
    labelMintingIcon->setEnabled(false);
    // Add timer to update minting icon
    QTimer *timerMintingIcon = new QTimer(labelMintingIcon);
    timerMintingIcon->start(MODEL_UPDATE_DELAY);
    connect(timerMintingIcon, SIGNAL(timeout()), this, SLOT(updateMintingIcon()));
    // Add timer to update minting weights
    QTimer *timerMintingWeights = new QTimer(labelMintingIcon);
    timerMintingWeights->start(30 * 1000);
    connect(timerMintingWeights, SIGNAL(timeout()), this, SLOT(updateMintingWeights()));
    // Set initial values for user and network weights
    nWeight=0;
    nNetworkWeight = 0;

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

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

    syncIconMovie = new QMovie(":/movies/update_spinner", "mng", this);

    // Clicking on a transaction on the overview page simply sends you to transaction history page
    connect(overviewPage, SIGNAL(transactionClicked(QModelIndex)), this, SLOT(gotoHistoryPage()));
    connect(overviewPage, SIGNAL(transactionClicked(QModelIndex)), transactionView, SLOT(focusTransaction(QModelIndex)));

    // Double-clicking on a transaction on the transaction history page shows details
    connect(transactionView, SIGNAL(doubleClicked(QModelIndex)), transactionView, SLOT(showDetails()));

    rpcConsole = new RPCConsole(this);
    connect(openRPCConsoleAction, SIGNAL(triggered()), rpcConsole, SLOT(show()));

    // Clicking on "Verify Message" in the address book sends you to the verify message tab
    connect(addressBookPage, SIGNAL(verifyMessage(QString)), this, SLOT(gotoVerifyMessageTab(QString)));
    // Clicking on "Sign Message" in the receive coins page sends you to the sign message tab
    connect(receiveCoinsPage, SIGNAL(signMessage(QString)), this, SLOT(gotoSignMessageTab(QString)));

    gotoOverviewPage();
}
Exemplo n.º 15
0
void MainWindow::setupToolBar()
{
	setUnifiedTitleAndToolBarOnMac(true);
	d->pagesBar = addToolBar(tr("Pages"));
	d->pagesBar->setIconSize(QSize(32, 32));
}
BitcoinGUI::BitcoinGUI(QWidget *parent):
    QMainWindow(parent),
    clientModel(0),
    walletModel(0),
    encryptWalletAction(0),
    changePassphraseAction(0),
    unlockWalletAction(0),
    lockWalletAction(0),
    aboutQtAction(0),
    trayIcon(0),
    notificator(0),
    rpcConsole(0)
{
    setMinimumSize(1000,550);
    resize(1040, 650); //setFixedSize(970, 550);
    setWindowTitle(tr("WhiteCoin") + " " + tr("Wallet"));
    qApp->setStyleSheet(
                    "QMainWindow { background:white url(:/images/wallet_logo_background) no-repeat right bottom; background-origin: border; font-family:'Open Sans,sans-serif'; } "
                    "QLineEdit { border: 4px solid rgb(14,105,162); } "
                    "#frame { } QToolBar QLabel { padding-top:15px; padding-bottom:10px; margin:0px; border: 0px; border-color: yellow;} "
                    "#spacer { background: rgb(14,105,162); border:none; } "
                    "#toolbar { height:100%; padding-top:20px; background: white; text-align: left; min-width:220px; max-width:220px; border: none;} "
                    "QToolBar QToolButton { font-family:Open Sans; padding-left:0px; padding-top:10px; padding-bottom:10px; width:220px; color: white; text-align: left; background-color: rgb(14,105,162) } "
                    "QToolBar QToolButton:hover { color: black; background-color: white; border: none; } "
                    "QToolBar QToolButton:pressed {color: black; background-color: white; border: none; } "
                    "QToolBar QToolButton:checked { color: black; background-color: white; border: none; } "
                    "#labelMiningIcon { padding-left:5px; font-family:Open Sans; width:100%;font-size:10px; text-align:center; color:grey; } "
                    "QMenu { background: rgb(255,255,255); color:black; padding-bottom:10px; } "
                    "QMenu::item { color:grey; background-color: transparent; } "
                    "QMenu::item:selected { color: white; background-color: rgb(14,105,162); } "
                    "QMenuBar { background: rgb(255,255,255); color:black; } "
                    "QMenuBar::item { font-size:12px; padding-bottom:12px; padding-top:12px; padding-left:15px; padding-right:15px; color:grey; background-color: transparent; border:none;} "
                    "QMenuBar::item:selected { color: white; background-color:rgb(14,105,162); border:none;}"
                    "QRadionButton::indicator { background-color: rgb(14,105,162); } "
                    "QIcon {}"
                    "QTabWidget { background-color: rbg(14,105,162); }"
                    "#debug QLabel {color: white; }"
                    "QLineEdit { border: 1px solid rbg(14,105,162); border-radius: 4px; }"
                    "#scrollArea { border-color: transparent; } "
                    "QPushButton {}"
                    "QStackedWidget {}"
                    "QDateTime {}"
    );
#ifndef Q_OS_MAC
    QApplication::setWindowIcon(QIcon(":icons/bitcoin"));
    setWindowIcon(QIcon(":icons/bitcoin"));
#else
    setUnifiedTitleAndToolBarOnMac(true);
    QApplication::setAttribute(Qt::AA_DontShowIconsInMenus);
#endif
    // Accept D&D of URIs
    setAcceptDrops(true);

    // Create actions for the toolbar, menu bar and tray/dock icon
    createActions();

    // Create application menu bar
    createMenuBar();

    // Create the toolbars
    createToolBars();

    // Create the tray icon (or setup the dock icon)
    createTrayIcon();

    // Create tabs
    overviewPage = new OverviewPage();
    statisticsPage = new StatisticsPage(this);

    blockBrowser = new BlockBrowser(this);
    poolBrowser = new PoolBrowser(this);

    transactionsPage = new QWidget(this);
    QVBoxLayout *vbox = new QVBoxLayout();
    transactionView = new TransactionView(this);
    vbox->addWidget(transactionView);
    transactionsPage->setLayout(vbox);

    addressBookPage = new AddressBookPage(AddressBookPage::ForEditing, AddressBookPage::SendingTab);

    receiveCoinsPage = new AddressBookPage(AddressBookPage::ForEditing, AddressBookPage::ReceivingTab);

    sendCoinsPage = new SendCoinsDialog(this);

    signVerifyMessageDialog = new SignVerifyMessageDialog(this);

    //QVBoxLayout *vboxcentral = new QVBoxLayout();
    //QWidget *centralWidgetWrapper = new QWidget(this);


    //centralWidgetWrapper->setStyleSheet("QStackedWidget{border:1px solid #555;}");

    //centralWidget = new QStackedWidget(centralWidgetWrapper);
    centralWidget = new QStackedWidget(this);

    centralWidget->setStyleSheet("QStackedWidget{border:0px solid #000;}");

    centralWidget->addWidget(overviewPage);
    centralWidget->addWidget(statisticsPage);
    centralWidget->addWidget(blockBrowser);
    centralWidget->addWidget(poolBrowser);
    centralWidget->addWidget(transactionsPage);
    centralWidget->addWidget(addressBookPage);
    centralWidget->addWidget(receiveCoinsPage);
    centralWidget->addWidget(sendCoinsPage);

    //vboxcentral->addWidget(centralWidget);
    //centralWidgetWrapper->setLayout(vboxcentral);

//    setCentralWidget(centralWidgetWrapper);
    setCentralWidget(centralWidget);

    // create status bar
//    statusBar();

    // Status bar notification icons
    QFrame *frameBlocks = new QFrame();
    frameBlocks->setStyleSheet("frameBlocks { background: rgb(255,255,255); }");
    frameBlocks->setContentsMargins(0,0,0,0);

    frameBlocks->setMinimumHeight(26);
    frameBlocks->setMaximumHeight(26);
    frameBlocks->setMaximumWidth(96);
    QHBoxLayout *frameBlocksLayout = new QHBoxLayout(frameBlocks);
    frameBlocksLayout->setContentsMargins(0,1,0,1);
    frameBlocksLayout->setSpacing(-1);
    labelEncryptionIcon = new QLabel();
    labelStakingIcon = new QLabel();
    labelConnectionsIcon = new QLabel();
    labelBlocksIcon = new QLabel();
    frameBlocksLayout->addWidget(labelEncryptionIcon);
    frameBlocksLayout->addWidget(labelStakingIcon);
    frameBlocksLayout->addWidget(labelConnectionsIcon);
    frameBlocksLayout->addWidget(labelBlocksIcon);
    frameBlocksLayout->addStretch();

    if (!GetBoolArg("-posmint", false))
    {
        QTimer *timerStakingIcon = new QTimer(labelStakingIcon);
        connect(timerStakingIcon, SIGNAL(timeout()), this, SLOT(updateStakingIcon()));
        timerStakingIcon->start(30 * 1000);
        updateStakingIcon();
    }

    // Progress bar and label for blocks download
    progressBarLabel = new QLabel();
    progressBarLabel->setVisible(false);
    progressBar = new QProgressBar();
    progressBar->setAlignment(Qt::AlignCenter);
    progressBar->setVisible(false);
    progressBar->setOrientation(Qt::Horizontal);
    progressBar->setObjectName("progress");
    progressBar->setStyleSheet("QProgressBar { background-color: white; border: 0px solid grey; border-radius: 5px; padding: 1px; text-align: center;} "
                               "QProgressBar::chunk { background: #0E69A2; border-radius: 5px; margin: 0px; }");
    frameBlocks->setObjectName("frame");

    // 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: white; border: 0px solid grey; border-radius: 5px; padding: 1px; text-align: center;} "
                                   "QProgressBar::chunk { background: #0E69A2; border-radius: 5px; margin: 0px; }");
    }

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



    syncIconMovie = new QMovie(":/movies/update_spinner", "mng", this);

    // Clicking on a transaction on the overview page simply sends you to transaction history page
    connect(overviewPage, SIGNAL(transactionClicked(QModelIndex)), this, SLOT(gotoHistoryPage()));
    connect(overviewPage, SIGNAL(transactionClicked(QModelIndex)), transactionView, SLOT(focusTransaction(QModelIndex)));

    // Double-clicking on a transaction on the transaction history page shows details
    connect(transactionView, SIGNAL(doubleClicked(QModelIndex)), transactionView, SLOT(showDetails()));

    rpcConsole = new RPCConsole(this);
    connect(openRPCConsoleAction, SIGNAL(triggered()), rpcConsole, SLOT(show()));

    // Clicking on "Verify Message" in the address book sends you to the verify message tab
    connect(addressBookPage, SIGNAL(verifyMessage(QString)), this, SLOT(gotoVerifyMessageTab(QString)));
    // Clicking on "Sign Message" in the receive coins page sends you to the sign message tab
    connect(receiveCoinsPage, SIGNAL(signMessage(QString)), this, SLOT(gotoSignMessageTab(QString)));

    gotoOverviewPage();
}
Exemplo n.º 17
0
Window::Window(testApp * _app)
{
	
	QWidget * content = new QWidget();

	ofApp = _app;
//	tab = new QTabWidget;
	viewCombo = new QComboBox();

    glWidget = new GLWidget(ofApp);
	glWidget->setFixedWidth(500);
	glWidget->setFixedHeight(500);
	
//	content->setFixedWidth(500);
//	content->setFixedHeight(500);
	
	glWidget->viewCombo = viewCombo;
	
	QTimer *timer = new QTimer(this);
    timer->setInterval(20);
	QObject::connect(timer, SIGNAL(timeout()), glWidget, SLOT(update()));
	QObject::connect(timer, SIGNAL(timeout()), glWidget, SLOT(updateGL()));
	timer->start();
	
    setWindowTitle(tr("Illutron Robot"));
	
	QTimer *settingsTimer = new QTimer(this);
    settingsTimer->setInterval(1000);
	QObject::connect(settingsTimer, SIGNAL(timeout()), this, SLOT(saveSettings()));
	settingsTimer->start();


	
	
	//GENERAL SETTINGS TAB
	QLabel *fpsLabel = new QLabel(tr("FPS"));
	
	QWidget *settingsGroupBox = new QWidget();
	QGridLayout *settingsGrid = new QGridLayout;
	settingsGrid->setAlignment(Qt::AlignTop);
	settingsGrid->addWidget(new QLabel(tr("FPS:")), 0, 0);
	settingsGrid->addWidget(fpsLabel, 0,1);
	settingsGrid->setColumnStretch(1,20);
	settingsGroupBox->setLayout(settingsGrid);
	
	//tab->addTab(settingsGroupBox, "General");
	
	/*
	QDockWidget *dockWidget = new QDockWidget(tr("General"), this);
	dockWidget->setAllowedAreas(Qt::LeftDockWidgetArea |
								Qt::RightDockWidgetArea);
	dockWidget->setWidget(settingsGroupBox);*/
	//addDockWidget(Qt::RightDockWidgetArea, dockWidget);
	
	setTabPosition(Qt::RightDockWidgetArea,QTabWidget::East);

	
	

	//SETUP MAIN LAYOUT
    QHBoxLayout *mainLayout = new QHBoxLayout;
	QWidget *glGroupBox = new QWidget();
	QVBoxLayout *glLayout = new QVBoxLayout;
	
	
	glGroupBox->setLayout(glLayout);
	glLayout->addWidget(viewCombo);
	glLayout->addWidget(glWidget);
	glLayout->setAlignment(Qt::AlignTop);
	
	mainLayout->addWidget(glGroupBox);
//	mainLayout->addWidget(tab);
	
    content->setLayout(mainLayout);
	
	setCentralWidget(content);
	
	
	//GENERAL EVENT CONNECTIONS
	//connect(xSlider, SIGNAL(valueChanged(int)), glWidget, SLOT(setXRotation(int))); //This line connects the x slider to the testApp
   // connect(rotateSlider, SIGNAL(valueChanged(int)), glWidget, SLOT(setRotateSlider(int)));
	connect(glWidget, SIGNAL(frameRateChanged(double)), fpsLabel, SLOT(setNum(double)));
	//connect(tabLayout, SIGNAL(valueChanged(int)), glWidget, SLOT(setXRotation(int)));

	settings = new QSettings("BrandtsRobot", "Illutron");
	
	setUnifiedTitleAndToolBarOnMac(true);
	
	lock = new QAction(QIcon(QString(ofToDataPath("lock.png", true).c_str())), tr("Lock"),this);
	lock->setShortcut( QKeySequence(Qt::ControlModifier + Qt::Key_L));

	QObject::connect(lock, SIGNAL(triggered()), this, SLOT(toggleLock()));

	toolbar = addToolBar(tr("Toolbar"));
	setIconSize(QSize(20,20));
	toolbar->addAction(lock);
	statusBar()->showMessage(tr("Locked"));
	
	setDockOptions(QMainWindow::AnimatedDocks | QMainWindow::AllowTabbedDocks | QMainWindow::AllowNestedDocks);

}
Exemplo n.º 18
0
MainWindow::MainWindow(DVRServerRepository *serverRepository, QWidget *parent)
    : QMainWindow(parent), m_serverRepository(serverRepository), m_trayIcon(0)
{
    Q_ASSERT(m_serverRepository);

    bcApp->mainWindow = this;
    connect(bcApp->eventDownloadManager(), SIGNAL(eventVideoDownloadAdded(EventVideoDownload*)),
            this, SLOT(showDownloadsWindow()));

    setUnifiedTitleAndToolBarOnMac(true);
	resize(1100, 750);
    createMenu();
    updateTrayIcon();
    setObjectName("MainWindow");

    statusBar()->addPermanentWidget(new StatusBandwidthWidget(statusBar()));
    statusBar()->addWidget(new StatusBarServerAlert(m_serverRepository, statusBar()));

#ifdef Q_OS_MAC
    statusBar()->setSizeGripEnabled(false);
    if (style()->inherits("QMacStyle"))
        statusBar()->setFixedHeight(24);
#endif

    /* Experimental toolbar */
    m_mainToolbar = new QToolBar(tr("Main"));
    m_mainToolbar->setMovable(false);
    m_mainToolbar->setIconSize(QSize(16, 16));
    m_mainToolbar->addAction(QIcon(QLatin1String(":/icons/cassette.png")), tr("Events"), this, SLOT(showEventsWindow()));
	m_expandAllServersAction = m_mainToolbar->addAction(QIcon(QLatin1String(":/icons/expand-all.png")), tr("Expand All Servers"));
	m_collapseAllServersAction = m_mainToolbar->addAction(QIcon(QLatin1String(":/icons/collapse-all.png")), tr("Collapse All Servers"));
    addToolBar(Qt::TopToolBarArea, m_mainToolbar);

    /* Splitters */
    m_leftSplit = new MacSplitter(Qt::Horizontal);
    m_centerSplit = new MacSplitter(Qt::Vertical);

    /* Live view */
    m_liveView = new LiveViewWindow(serverRepository, this);

    /* Recent events */
    QWidget *eventsWidget = createRecentEvents();

    /* Layouts */
    m_leftSplit->addWidget(createSourcesList());
    m_leftSplit->addWidget(m_centerSplit);
    m_leftSplit->setStretchFactor(1, 1);
    m_leftSplit->setCollapsible(0, false);
    m_leftSplit->setCollapsible(1, false);

    m_centerSplit->addWidget(m_liveView);
    m_centerSplit->addWidget(eventsWidget);
    m_centerSplit->setStretchFactor(0, 1);
    m_centerSplit->setCollapsible(0, false);
    m_centerSplit->setCollapsible(1, false);

    /* Set center widget */
    QWidget *center = new QWidget;
    QBoxLayout *centerLayout = new QVBoxLayout(center);
    centerLayout->setMargin(0);
    centerLayout->setSpacing(0);
    centerLayout->addWidget(m_leftSplit, 1);
    setCentralWidget(center);

#ifdef Q_OS_WIN
    /* There is no top border on the statusbar on Windows, and we need one. */
    if (style()->inherits("QWindowsStyle"))
    {
        QFrame *line = new QFrame;
        line->setFrameStyle(QFrame::Plain | QFrame::HLine);
        QPalette p = line->palette();
        p.setColor(QPalette::WindowText, QColor(171, 175, 183));
        line->setPalette(p);
        line->setFixedHeight(1);
        centerLayout->addWidget(line);
    }
#endif

    QSettings settings;
    bcApp->liveView->setBandwidthMode(settings.value(QLatin1String("ui/liveview/bandwidthMode")).toInt());
    restoreGeometry(settings.value(QLatin1String("ui/main/geometry")).toByteArray());
    if (!m_centerSplit->restoreState(settings.value(QLatin1String("ui/main/centerSplit")).toByteArray()))
    {
        m_centerSplit->setSizes(QList<int>() << 1000 << 130);
    }
    if (!m_leftSplit->restoreState(settings.value(QLatin1String("ui/main/leftSplit")).toByteArray()))
    {
#ifdef Q_OS_MAC
        m_leftSplit->setSizes(QList<int>() << 210 << 1000);
#else
        m_leftSplit->setSizes(QList<int>() << 190 << 1000);
#endif
    }

    m_leftSplit->setHandleWidth(2);
    m_centerSplit->setHandleWidth(2);

    QString lastLayout = settings.value(QLatin1String("ui/cameraArea/lastLayout"), tr("Default")).toString();
    m_liveView->setLayout(lastLayout);

    connect(m_liveView, SIGNAL(layoutChanged(QString)), SLOT(liveViewLayoutChanged(QString)));
    connect(m_leftSplit, SIGNAL(splitterMoved(int,int)), SLOT(updateToolbarWidth()));
    updateToolbarWidth();

    connect(bcApp, SIGNAL(sslConfirmRequired(DVRServer*,QList<QSslError>,QSslConfiguration)),
            SLOT(sslConfirmRequired(DVRServer*,QList<QSslError>,QSslConfiguration)));
    connect(bcApp, SIGNAL(queryLivePaused()), SLOT(queryLivePaused()));
    connect(m_serverRepository, SIGNAL(serverAdded(DVRServer*)), SLOT(onServerAdded(DVRServer*)));

    foreach (DVRServer *s, m_serverRepository->servers())
        onServerAdded(s);

    connect(qApp, SIGNAL(aboutToQuit()), SLOT(saveSettings()));

    m_sourcesList->setFocus(Qt::OtherFocusReason);

    connect(m_expandAllServersAction, SIGNAL(triggered()), m_sourcesList, SLOT(expandAll()));
    connect(m_collapseAllServersAction, SIGNAL(triggered()), m_sourcesList, SLOT(collapseAll()));

    retranslateUI();

    if (settings.value(QLatin1String("ui/saveSession"), false).toBool())
        m_liveView->restoreSession();
}
Exemplo n.º 19
0
spincoinGUI::spincoinGUI(QWidget *parent):
    QMainWindow(parent),
    clientModel(0),
    walletModel(0),
    encryptWalletAction(0),
    changePassphraseAction(0),
    unlockWalletAction(0),
    lockWalletAction(0),
    aboutQtAction(0),
    trayIcon(0),
    notificator(0),
    rpcConsole(0)
{
    setFixedSize(970, 550);
    setWindowTitle(tr("SpinCoin") + " " + tr("Wallet"));
    qApp->setStyleSheet("QMainWindow { background-image:url(:images/bkg);border:none;font-family:'Open Sans,sans-serif'; } #frame { } QToolBar QLabel { padding-top:15px;padding-bottom:10px;margin:0px; } #spacer { background:rgb(0,0,0);border:none; } #toolbar2 { border:none;width:10px; background-color:qlineargradient(x1: 0, y1: 0, x2: 0.5, y2: 0.5,stop: 0 rgb(128,130,131), stop: 1 rgb(232,237,241)); } #toolbar { border:none;height:100%;padding-top:20px; background: rgb(0,0,0); text-align: left; color: white;min-width:200px;max-width:200px;} QToolBar QToolButton:hover {background-color:qlineargradient(x1: 0, y1: 0, x2: 2, y2: 2,stop: 0 rgb(0,0,0), stop: 1 rgb(155,155,155),stop: 2 rgb(0,0,0));} QToolBar QToolButton { font-family:Century Gothic;padding-left:20px;padding-right:200px;padding-top:10px;padding-bottom:10px; width:100%; color: white; text-align: left; background-color: rgb(0,0,0) } #labelMiningIcon { padding-left:5px;font-family:Century Gothic;width:100%;font-size:10px;text-align:center;color:white; } QMenu { background: black; color: white; padding-bottom:10px; } QMenu::item { color:white; background-color: transparent; } QMenu::item:selected { background-color:qlineargradient(x1: 0, y1: 0, x2: 0.5, y2: 0.5,stop: 0 rgb(60,60,60), stop: 1 rgb(155,155,155)); } QMenuBar { background: rgb(0,0,0); color:white; } QMenuBar::item { font-size:12px;padding-bottom:8px;padding-top:8px;padding-left:15px;padding-right:15px;color:white; background-color: transparent; } QMenuBar::item:selected { background-color:qlineargradient(x1: 0, y1: 0, x2: 0.5, y2: 0.5,stop: 0 rgb(60,60,60), stop: 1 rgb(155,155,155)); }");
#ifndef Q_OS_MAC
    qApp->setWindowIcon(QIcon(":icons/spincoin"));
    setWindowIcon(QIcon(":icons/spincoin"));
#else
    setUnifiedTitleAndToolBarOnMac(true);
    QApplication::setAttribute(Qt::AA_DontShowIconsInMenus);
#endif
    // Accept D&D of URIs
    setAcceptDrops(true);

    // Create actions for the toolbar, menu bar and tray/dock icon
    createActions();

    // Create application menu bar
    createMenuBar();

    // Create the toolbars
    createToolBars();

    // Create the tray icon (or setup the dock icon)
    createTrayIcon();

    // Create tabs
    overviewPage = new OverviewPage();
    statisticsPage = new StatisticsPage(this);
	blockBrowser = new BlockBrowser(this);

    transactionsPage = new QWidget(this);
    QVBoxLayout *vbox = new QVBoxLayout();
    transactionView = new TransactionView(this);
    vbox->addWidget(transactionView);
    transactionsPage->setLayout(vbox);

    addressBookPage = new AddressBookPage(AddressBookPage::ForEditing, AddressBookPage::SendingTab);

    receiveCoinsPage = new AddressBookPage(AddressBookPage::ForEditing, AddressBookPage::ReceivingTab);

    sendCoinsPage = new SendCoinsDialog(this);

    signVerifyMessageDialog = new SignVerifyMessageDialog(this);

    centralWidget = new QStackedWidget(this);
    centralWidget->addWidget(overviewPage);
    centralWidget->addWidget(statisticsPage);
	centralWidget->addWidget(blockBrowser);
	centralWidget->addWidget(transactionsPage);
    centralWidget->addWidget(addressBookPage);
    centralWidget->addWidget(receiveCoinsPage);
    centralWidget->addWidget(sendCoinsPage);
    setCentralWidget(centralWidget);



    // Status bar notification icons
    QFrame *frameBlocks = new QFrame();
    frameBlocks->setStyleSheet("frameBlocks { background: rgb(127,154,131); }");
    frameBlocks->setContentsMargins(0,0,0,0);

    frameBlocks->setMinimumWidth(30);
    frameBlocks->setMaximumWidth(30);
    QVBoxLayout *frameBlocksLayout = new QVBoxLayout(frameBlocks);
    frameBlocksLayout->setContentsMargins(1,0,1,0);
    frameBlocksLayout->setSpacing(-1);
    labelEncryptionIcon = new QLabel();
    labelStakingIcon = new QLabel();
    labelConnectionsIcon = new QLabel();
    labelBlocksIcon = new QLabel();
    frameBlocksLayout->addWidget(labelEncryptionIcon);
    frameBlocksLayout->addWidget(labelStakingIcon);
    frameBlocksLayout->addWidget(labelConnectionsIcon);
    frameBlocksLayout->addWidget(labelBlocksIcon);
    frameBlocksLayout->addStretch();

    if (GetBoolArg("-staking", true))
    {
        QTimer *timerStakingIcon = new QTimer(labelStakingIcon);
        connect(timerStakingIcon, SIGNAL(timeout()), this, SLOT(updateStakingIcon()));
        timerStakingIcon->start(30 * 1000);
        updateStakingIcon();
    }

    // Progress bar and label for blocks download
    progressBarLabel = new QLabel();
    progressBarLabel->setVisible(false);
    progressBar = new QProgressBar();
    progressBar->setAlignment(Qt::AlignCenter);
    progressBar->setVisible(false);
    progressBar->setOrientation(Qt::Vertical);
    progressBar->setObjectName("progress");
    progressBar->setStyleSheet("QProgressBar{"
                               "border: 1px solid transparent;"
							   "font-size:9px;"
                               "text-align: center;"
                               "color:rgba(0,0,0,100);"
                               "border-radius: 5px;"
                               "background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:1, stop:0 rgba(182, 182, 182, 100), stop:1 rgba(209, 209, 209, 100));"
                                   "}"
                               "QProgressBar::chunk{"
                               "background-color: rgba(0,255,0,100);"
                               "}");
    frameBlocks->setObjectName("frame");
	addToolBarBreak(Qt::LeftToolBarArea);
    QToolBar *toolbar2 = addToolBar(tr("Tabs toolbar"));
    addToolBar(Qt::LeftToolBarArea,toolbar2);
    toolbar2->setOrientation(Qt::Vertical);
    toolbar2->setMovable( false );
    toolbar2->setObjectName("toolbar2");
    toolbar2->setFixedWidth(25);
    toolbar2->addWidget(frameBlocks);
    toolbar2->addWidget(progressBarLabel);
    toolbar2->addWidget(progressBar);


    syncIconMovie = new QMovie(":/movies/update_spinner", "gif", this);

    // Clicking on a transaction on the overview page simply sends you to transaction history page
    connect(overviewPage, SIGNAL(transactionClicked(QModelIndex)), this, SLOT(gotoHistoryPage()));
    connect(overviewPage, SIGNAL(transactionClicked(QModelIndex)), transactionView, SLOT(focusTransaction(QModelIndex)));

    // Double-clicking on a transaction on the transaction history page shows details
    connect(transactionView, SIGNAL(doubleClicked(QModelIndex)), transactionView, SLOT(showDetails()));

    rpcConsole = new RPCConsole(this);
    connect(openRPCConsoleAction, SIGNAL(triggered()), rpcConsole, SLOT(show()));

    // Clicking on "Verify Message" in the address book sends you to the verify message tab
    connect(addressBookPage, SIGNAL(verifyMessage(QString)), this, SLOT(gotoVerifyMessageTab(QString)));
    // Clicking on "Sign Message" in the receive coins page sends you to the sign message tab
    connect(receiveCoinsPage, SIGNAL(signMessage(QString)), this, SLOT(gotoSignMessageTab(QString)));

    gotoOverviewPage();
}
Exemplo n.º 20
0
BitcoinGUI::BitcoinGUI(const PlatformStyle *_platformStyle, const NetworkStyle *networkStyle, QWidget *parent) :
    QMainWindow(parent),
    enableWallet(false),
    clientModel(0),
    walletFrame(0),
    unitDisplayControl(0),
    labelWalletEncryptionIcon(0),
    labelWalletHDStatusIcon(0),
    connectionsControl(0),
    labelBlocksIcon(0),
    progressBarLabel(0),
    progressBar(0),
    progressDialog(0),
    appMenuBar(0),
    overviewAction(0),
    historyAction(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),
    showHelpMessageAction(0),
    trayIcon(0),
    trayIconMenu(0),
    notificator(0),
    rpcConsole(0),
    helpMessageDialog(0),
    modalOverlay(0),
    prevBlocks(0),
    spinnerFrame(0),
    platformStyle(_platformStyle)
{
    QSettings settings;
    if (!restoreGeometry(settings.value("MainWindowGeometry").toByteArray())) {
        // Restore failed (perhaps missing setting), center the window
        move(QApplication::desktop()->availableGeometry().center() - frameGeometry().center());
    }

    QString windowTitle = tr(PACKAGE_NAME) + " - ";
#ifdef ENABLE_WALLET
    enableWallet = WalletModel::isWalletEnabled();
#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);
    labelWalletEncryptionIcon = new QLabel();
    labelWalletHDStatusIcon = new QLabel();
    connectionsControl = new GUIUtil::ClickableLabel();
    labelBlocksIcon = new GUIUtil::ClickableLabel();
    if(enableWallet)
    {
        frameBlocksLayout->addStretch();
        frameBlocksLayout->addWidget(unitDisplayControl);
        frameBlocksLayout->addStretch();
        frameBlocksLayout->addWidget(labelWalletEncryptionIcon);
        frameBlocksLayout->addWidget(labelWalletHDStatusIcon);
    }
    frameBlocksLayout->addStretch();
    frameBlocksLayout->addWidget(connectionsControl);
    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()->addPermanentWidget(frameBlocks);

    // 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();

    connect(connectionsControl, SIGNAL(clicked(QPoint)), this, SLOT(toggleNetworkActive()));

    modalOverlay = new ModalOverlay(this->centralWidget());
#ifdef ENABLE_WALLET
    if(enableWallet) {
        connect(walletFrame, SIGNAL(requestedSyncWarningInfo()), this, SLOT(showModalOverlay()));
        connect(labelBlocksIcon, SIGNAL(clicked(QPoint)), this, SLOT(showModalOverlay()));
        connect(progressBar, SIGNAL(clicked(QPoint)), this, SLOT(showModalOverlay()));
    }
#endif
}
Exemplo n.º 21
0
ShadowGUI::ShadowGUI(QWidget *parent):
    QMainWindow(parent),
    bridge(new ShadowBridge(this)),
    clientModel(0),
    walletModel(0),
    messageModel(0),
    encryptWalletAction(0),
    changePassphraseAction(0),
    unlockWalletAction(0),
    lockWalletAction(0),
    aboutQtAction(0),
    trayIcon(0),
    notificator(0),
    rpcConsole(0),
    nWeight(0)
{
    webView = new QWebView();

    webView->page()->setLinkDelegationPolicy(QWebPage::DelegateAllLinks);

    webView->page()->action(QWebPage::Reload )->setVisible(false);
    webView->page()->action(QWebPage::Back   )->setVisible(false);
    webView->page()->action(QWebPage::Forward)->setVisible(false);

    connect(webView, SIGNAL(linkClicked(const QUrl&)), this, SLOT(urlClicked(const QUrl&)));

    setCentralWidget(webView);

    resize(1280, 720);
    setWindowTitle(tr("ZirkCoin") + " - " + tr("Client"));
#ifndef Q_OS_MAC
    qApp->setWindowIcon(QIcon(":icons/shadow"));
    setWindowIcon(QIcon(":icons/shadow"));
#else
    setUnifiedTitleAndToolBarOnMac(true);
    QApplication::setAttribute(Qt::AA_DontShowIconsInMenus);
#endif

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

    // Create actions for the toolbar, menu bar and tray/dock icon
    createActions();

    // Create application menu bar
    createMenuBar();

    // Create the tray icon (or setup the dock icon)
    createTrayIcon();

    signVerifyMessageDialog = new SignVerifyMessageDialog(this);

    rpcConsole = new RPCConsole(this);

    connect(openRPCConsoleAction, SIGNAL(triggered()), rpcConsole, SLOT(show()));

    documentFrame = webView->page()->mainFrame();

    QWebSettings::globalSettings()->setAttribute(QWebSettings::DeveloperExtrasEnabled, true);

    //connect(webView->page()->action(QWebPage::Reload), SIGNAL(triggered()), SLOT(pageLoaded(bool)));

    connect(webView, SIGNAL(loadFinished(bool)),                    SLOT(pageLoaded(bool)));
    connect(documentFrame, SIGNAL(javaScriptWindowObjectCleared()), SLOT(addJavascriptObjects()));
    connect(documentFrame, SIGNAL(urlChanged(QUrl)),                SLOT(urlClicked(const QUrl&)));

#ifdef Q_OS_WIN
    QFile html("C:/shadow/index.html");
#else
    QFile html("/opt/shadow/index.html");
#endif

    if(html.exists())
        webView->setUrl(QUrl("file:///" + html.fileName()));
    else
        webView->setUrl(QUrl("qrc:///src/qt/res/index.html"));
}
Exemplo n.º 22
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow),
    _axis_len(97),_inertial_len(150)
{
    ui->setupUi(this);

    // Model
    _model = new QStandardItemModel(5,3,parent);

    _idx_seq1 = _model->index(0,0);
    _idx_seq2 = _model->index(0,1);
    _idx_seq3 = _model->index(0,2);
    _idx_ang1 = _model->index(1,0);
    _idx_ang2 = _model->index(1,1);
    _idx_ang3 = _model->index(1,2);

    _model->setData(_idx_seq1,QString("Roll"));
    _model->setData(_idx_seq2,QString("Pitch"));
    _model->setData(_idx_seq3,QString("Yaw"));
    _model->setHeaderData(0,
                          Qt::Horizontal,
                          _model->data(_idx_seq1).toString());
    _model->setHeaderData(1,
                          Qt::Horizontal,
                          _model->data(_idx_seq2).toString());
    _model->setHeaderData(2,
                          Qt::Horizontal,
                          _model->data(_idx_seq3).toString());

    _model->setData(_idx_ang1,0.0);
    _model->setData(_idx_ang2,0.0);
    _model->setData(_idx_ang3,0.0);


    for ( int ii = 0 ; ii < 3 ; ii++ ) {
        for ( int jj = 0 ; jj < 3 ; jj++ ) {
            QModelIndex idx = _model->index(ii+2,jj);
            qreal val = _mat(ii,jj);
            _model->setData(idx,val);
        }
    }

    // Minimum size policy ( i don't care about growing)
    QSizePolicy size_policy_min(QSizePolicy::Minimum, QSizePolicy::Minimum);

    QSizePolicy size_policy_fixed(QSizePolicy::Fixed,
                                  QSizePolicy::Fixed);

    // Sequence view
    _sequenceview = new QTableView(parent);
    _sequenceview->setModel(_model);
    _sequenceview->verticalHeader()->setVisible(false);
    _sequenceview->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    _sequenceview->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    _sequenceview->horizontalHeader()->setMovable(true);
    for ( int ii = 0 ; ii < 6; ii++ ) {
        _sequenceview->setRowHidden(ii,true);
    }
    _sequenceview->setRowHidden(1,false);

    // Matrix view
    _matrixview = new QTableView(parent);
    _matrixview->setModel(_model);
    _matrixview->horizontalHeader()->setVisible(false);
    _matrixview->verticalHeader()->setVisible(false);
    _matrixview->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    _matrixview->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    _matrixview->setRowHidden(0,true);
    _matrixview->setRowHidden(1,true);

    // Scene view
    _scene = new QGraphicsScene(parent);
    _scene->setBackgroundBrush(QBrush(Qt::white));
    _gview = new QGraphicsView(_scene);
    _gview->setRenderHint(QPainter::Antialiasing);
    _gview->horizontalScrollBar()->setVisible(false);
    _gview->verticalScrollBar()->setVisible(false);
    _gview->setViewportUpdateMode(QGraphicsView::FullViewportUpdate);

    _xinertial = new QGraphicsLineItem(QLine(QPoint(0,0),
                                       QPoint(_inertial_len,0)));
    _scene->addItem(_xinertial);
    QGraphicsSimpleTextItem* xlabel = new
            QGraphicsSimpleTextItem(QString("x"));
    _scene->addItem(xlabel);

    QRectF bb = xlabel->boundingRect();
    xlabel->setPos(_inertial_len+10,-bb.height()/2.0);


    _yinertial = new QGraphicsLineItem(QLine(QPoint(0,0),
                                       QPoint(0,-_inertial_len)));
    _scene->addItem(_yinertial);
    QGraphicsSimpleTextItem* ylabel = new QGraphicsSimpleTextItem(QString("y"));
    _scene->addItem(ylabel);
    bb = ylabel->boundingRect();
    ylabel->setPos(-bb.width()/2.0,-_inertial_len-10-bb.height()/2.0 );

    _xitem = new QGraphicsLineItem(QLine(QPoint(0,0),QPoint(_axis_len,0)));
    QPen xpen(Qt::red);
    xpen.setWidth(6);

    _xitem->setPen(xpen);
    _yitem = new QGraphicsLineItem(QLine(QPoint(0,0),QPoint(0,-_axis_len)));
    QPen ypen(Qt::green);
    ypen.setWidth(6);
    _yitem->setPen(ypen);
    _zitem = new QGraphicsLineItem(QLine(QPoint(0,0),QPoint(0,0)));
    QPen zpen(Qt::blue);
    zpen.setWidth(6);
    _zitem->setPen(zpen);

    QGraphicsEllipseItem* ell = new QGraphicsEllipseItem(
                                     -100,-100,200,200);
    _scene->addItem(_xitem);
    _scene->addItem(_yitem);
    _scene->addItem(_zitem);
    _scene->addItem(ell);
    QPointF center = _scene->itemsBoundingRect().center();
    _gview->centerOn(center);


    // Connect
    connect(_model,SIGNAL(dataChanged(QModelIndex,QModelIndex)),
            this,SLOT(_slot_model_data_changed(QModelIndex,QModelIndex)));

    //
    // Widget Layout
    //
    QWidget *mainwidget = new QWidget;
    setCentralWidget(mainwidget);
    setWindowTitle(tr("Euler"));
    setUnifiedTitleAndToolBarOnMac(true);

    QHBoxLayout *mainlayout = new QHBoxLayout;
    QVBoxLayout *leftbox = new QVBoxLayout;

    leftbox->addWidget(_sequenceview);
    leftbox->addWidget(_matrixview);

    mainlayout->addLayout(leftbox);
    mainlayout->addWidget(_gview);

    mainwidget->setLayout(mainlayout);
}
Exemplo n.º 23
0
/**
 * @brief Sets up the toolbar
 */
void MainWindow::setupToolbar()
{
    qDebug() << "Entered";

#ifdef IS_MAC_AND_QT5
    QtMacUnifiedToolBar *toolBar = new QtMacUnifiedToolBar(this);
    ui->mainToolBar->setVisible(false);
#else
    QToolBar *toolBar = ui->mainToolBar;
#ifdef Q_OS_MAC
    setUnifiedTitleAndToolBarOnMac(true);
#endif
#endif

    QPainter p;
    QList<QPixmap> icons;
    icons << QPixmap(":/img/spanner.png") << QPixmap(":/img/info.png") << QPixmap(":/img/folder_in.png")
          << QPixmap(":/img/magnifier.png") <<QPixmap(":/img/save.png")
          << QPixmap(":/img/storage.png") << QPixmap(":/img/heart.png") << QPixmap(":/img/arrow_circle_right.png")
          << QPixmap(":/img/xbmc.png") << QPixmap(":/img/folder_64.png") << QPixmap(":/img/export.png");
    for (int i=0, n=icons.count() ; i<n ; ++i) {
        p.begin(&icons[i]);
        p.setCompositionMode(QPainter::CompositionMode_SourceIn);
        p.fillRect(icons[i].rect(), QColor(0, 0, 0, 100));
        p.end();
    }

    m_actionSearch = new QAction(QIcon(icons[3]), tr("Search"), this);
    m_actionSearch->setShortcut(QKeySequence::Find);
    m_actionSearch->setToolTip(tr("Search (%1)").arg(QKeySequence(QKeySequence::Find).toString(QKeySequence::NativeText)));

    m_actionSave = new QAction(QIcon(icons[4]), tr("Save"), this);
    m_actionSave->setShortcut(QKeySequence::Save);
    m_actionSave->setToolTip(tr("Save (%1)").arg(QKeySequence(QKeySequence::Save).toString(QKeySequence::NativeText)));

    m_actionSaveAll = new QAction(QIcon(icons[5]), tr("Save All"), this);
    QKeySequence seqSaveAll(Qt::CTRL+Qt::ShiftModifier+Qt::Key_S);
    m_actionSaveAll->setShortcut(seqSaveAll);
    m_actionSaveAll->setToolTip(tr("Save All (%1)").arg(seqSaveAll.toString(QKeySequence::NativeText)));

    m_actionReload = new QAction(QIcon(icons[7]), tr("Reload"), this);
    m_actionReload->setShortcut(QKeySequence::Refresh);
    m_actionReload->setToolTip(tr("Reload all files (%1)").arg(QKeySequence(QKeySequence::Refresh).toString(QKeySequence::NativeText)));

    m_actionRename = new QAction(QIcon(icons[9]), tr("Rename"), this);
    m_actionRename->setToolTip(tr("Rename selected files"));

    m_actionSettings = new QAction(QIcon(icons[0]), tr("Settings"), this);

    m_actionXbmc = new QAction(QIcon(icons[8]), tr("XBMC"), this);
    m_actionXbmc->setToolTip(tr("Synchronize to XBMC"));

    m_actionExport = new QAction(QIcon(icons[10]), tr("Export"), this);
    m_actionExport->setToolTip(tr("Export Database"));

    m_actionAbout = new QAction(QIcon(icons[1]), tr("About"), this);

    m_actionLike = new QAction(QIcon(icons[6]), tr("Donate"), this);

    toolBar->addAction(m_actionSearch);
    toolBar->addAction(m_actionSave);
    toolBar->addAction(m_actionSaveAll);
    toolBar->addAction(m_actionReload);
    toolBar->addAction(m_actionRename);
    toolBar->addAction(m_actionSettings);
    toolBar->addAction(m_actionXbmc);
    toolBar->addAction(m_actionExport);
    toolBar->addAction(m_actionAbout);
#ifndef IS_MAC_AND_QT5
    m_filterWidget->setParent(toolBar);
    toolBar->addWidget(m_filterWidget);
#endif
#ifndef APPSTORE
    toolBar->addAction(m_actionLike);
#endif

    connect(m_actionSearch, SIGNAL(triggered()), this, SLOT(onActionSearch()));
    connect(m_actionSave, SIGNAL(triggered()), this, SLOT(onActionSave()));
    connect(m_actionSaveAll, SIGNAL(triggered()), this, SLOT(onActionSaveAll()));
    connect(m_actionReload, SIGNAL(triggered()), this, SLOT(onActionReload()));
    connect(m_actionAbout, SIGNAL(triggered()), m_aboutDialog, SLOT(exec()));
    connect(m_actionSettings, SIGNAL(triggered()), m_settingsWindow, SLOT(show()));
    connect(m_actionLike, SIGNAL(triggered()), m_supportDialog, SLOT(exec()));
    connect(m_actionXbmc, SIGNAL(triggered()), this, SLOT(onActionXbmc()));
    connect(m_actionRename, SIGNAL(triggered()), this, SLOT(onActionRename()));
    connect(m_actionExport, SIGNAL(triggered()), m_exportDialog, SLOT(exec()));

    m_actionSearch->setEnabled(false);
    m_actionSave->setEnabled(false);
    m_actionSaveAll->setEnabled(false);
    m_actionRename->setEnabled(false);

#ifdef IS_MAC_AND_QT5
    toolBar->showInWindowForWidget(this);
#endif

#ifdef Q_OS_WIN32
    toolBar->setStyleSheet("QToolButton {border: 0; padding: 5px;} QToolBar { border-bottom: 1px solid rgba(0, 0, 0, 100); }");
#endif
}
Exemplo n.º 24
0
BitcoinGUI::BitcoinGUI(const NetworkStyle *networkStyle, QWidget *parent) :
    QMainWindow(parent),
    clientModel(0),
    walletFrame(0),
    unitDisplayControl(0),
    labelEncryptionIcon(0),
    labelConnectionsIcon(0),
    labelBlocksIcon(0),
    progressBarLabel(0),
    progressBar(0),
    progressDialog(0),
    appMenuBar(0),
    overviewAction(0),
    historyAction(0),
    quitAction(0),
    sendCoinsAction(0),
    usedSendingAddressesAction(0),
    usedReceivingAddressesAction(0),
    signMessageAction(0),
    verifyMessageAction(0),
    aboutAction(0),
    receiveCoinsAction(0),
    optionsAction(0),
    toggleHideAction(0),
    encryptWalletAction(0),
    backupWalletAction(0),
    changePassphraseAction(0),
    aboutQtAction(0),
    openRPCConsoleAction(0),
    openAction(0),
    showHelpMessageAction(0),
    trayIcon(0),
    trayIconMenu(0),
    notificator(0),
    rpcConsole(0),
    prevBlocks(0),
    spinnerFrame(0)
{
    /* Open CSS when configured */
    this->setStyleSheet(GUIUtil::loadStyleSheet());

    GUIUtil::restoreWindowGeometry("nWindow", QSize(850, 550), this);

    QString windowTitle = tr("X11BaseCoin Core") + " - ";
#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");
    }
    QString userWindowTitle = QString::fromStdString(GetArg("-windowtitle", ""));
    if(!userWindowTitle.isEmpty()) windowTitle += " - " + userWindowTitle;
    windowTitle += " " + networkStyle->getTitleAddText();
#ifndef Q_OS_MAC
    QApplication::setWindowIcon(networkStyle->getAppIcon());
    setWindowIcon(networkStyle->getAppIcon());
#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(enableWallet ? this : 0);
#ifdef ENABLE_WALLET
    if(enableWallet)
    {
        /** Create wallet frame*/
        walletFrame = new WalletFrame(this);
    } 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(networkStyle);

    // Create application menu bar
    createMenuBar();

    // Create the toolbars
    createToolBars();

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

    // Create status bar
    statusBar();

    // 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();
    labelEncryptionIcon = new QLabel();
    labelConnectionsIcon = new QPushButton();
    labelConnectionsIcon->setFlat(true); // Make the button look like a label, but clickable
    labelConnectionsIcon->setStyleSheet(".QPushButton { background-color: rgba(255, 255, 255, 0);}");
    labelConnectionsIcon->setMaximumSize(STATUSBAR_ICONSIZE, STATUSBAR_ICONSIZE);
    labelBlocksIcon = new QLabel();
    if(enableWallet)
    {
        frameBlocksLayout->addStretch();
        frameBlocksLayout->addWidget(unitDisplayControl);
        frameBlocksLayout->addStretch();
        frameBlocksLayout->addWidget(labelEncryptionIcon);
    }
    frameBlocksLayout->addStretch();
    frameBlocksLayout->addWidget(labelConnectionsIcon);
    frameBlocksLayout->addStretch();
    frameBlocksLayout->addWidget(labelBlocksIcon);
    frameBlocksLayout->addStretch();

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

    // 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: #F8F8F8; 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 #00CCFF, stop: 1 #33CCFF); border-radius: 7px; margin: 0px; }");
    }

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

    // Jump directly to tabs in RPC-console
    connect(openInfoAction, SIGNAL(triggered()), rpcConsole, SLOT(showInfo()));
    connect(openRPCConsoleAction, SIGNAL(triggered()), rpcConsole, SLOT(showConsole()));
    connect(openNetworkAction, SIGNAL(triggered()), rpcConsole, SLOT(showNetwork()));
    connect(openPeersAction, SIGNAL(triggered()), rpcConsole, SLOT(showPeers()));
    connect(openRepairAction, SIGNAL(triggered()), rpcConsole, SLOT(showRepair()));
    connect(openConfEditorAction, SIGNAL(triggered()), rpcConsole, SLOT(showConfEditor()));
    connect(showBackupsAction, SIGNAL(triggered()), rpcConsole, SLOT(showBackups()));
    connect(labelConnectionsIcon, SIGNAL(clicked()), rpcConsole, SLOT(showPeers()));

    // Get restart command-line parameters and handle restart
    connect(rpcConsole, SIGNAL(handleRestart(QStringList)), this, SLOT(handleRestart(QStringList)));
    
    // prevents an open debug window from becoming stuck/unusable on client shutdown
    connect(quitAction, SIGNAL(triggered()), rpcConsole, SLOT(hide()));

    // 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();
}
BitcoinGUI::BitcoinGUI(QWidget *parent):
    QMainWindow(parent),
    clientModel(0),
    walletModel(0),
    encryptWalletAction(0),
    changePassphraseAction(0),
    unlockWalletAction(0),
    lockWalletAction(0),
    aboutQtAction(0),
    trayIcon(0),
    notificator(0),
    rpcConsole(0)
{
    resize(850, 550);
    setWindowTitle(tr("10k Wallet"));
#ifndef Q_WS_MAC
    setWindowIcon(QIcon(":icons/toolbar"));
#else
    setUnifiedTitleAndToolBarOnMac(true);
    QApplication::setAttribute(Qt::AA_DontShowIconsInMenus);
#endif
    // Accept D&D of URIs
    setAcceptDrops(true);

    // Create actions for the toolbar, menu bar and tray/dock icon
    createActions();

    // Create application menu bar
    createMenuBar();

    // Create the toolbars
    createToolBars();

    // Create the tray icon (or setup the dock icon)
    createTrayIcon();

    // Create tabs
    overviewPage = new OverviewPage();

    transactionsPage = new QWidget(this);
    QVBoxLayout *vbox = new QVBoxLayout();
    transactionView = new TransactionView(this);
    vbox->addWidget(transactionView);
    transactionsPage->setLayout(vbox);

    addressBookPage = new AddressBookPage(AddressBookPage::ForEditing, AddressBookPage::SendingTab);

    receiveCoinsPage = new AddressBookPage(AddressBookPage::ForEditing, AddressBookPage::ReceivingTab);

    sendCoinsPage = new SendCoinsDialog(this);

    messagePage = new MessagePage(this);

    centralWidget = new QStackedWidget(this);
    centralWidget->addWidget(overviewPage);
    centralWidget->addWidget(transactionsPage);
    centralWidget->addWidget(addressBookPage);
    centralWidget->addWidget(receiveCoinsPage);
    centralWidget->addWidget(sendCoinsPage);
#ifdef FIRST_CLASS_MESSAGING
    centralWidget->addWidget(messagePage);
#endif
    setCentralWidget(centralWidget);

    // Create status bar
    statusBar();

    // Status bar notification icons
    QFrame *frameBlocks = new QFrame();
    frameBlocks->setContentsMargins(0,0,0,0);
    frameBlocks->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Preferred);
    //frameBlocks->setMinimumWidth(56);
    //frameBlocks->setMaximumWidth(56);
    QHBoxLayout *frameBlocksLayout = new QHBoxLayout(frameBlocks);
    frameBlocksLayout->setContentsMargins(3,0,3,0);
    frameBlocksLayout->setSpacing(3);
    labelEncryptionIcon = new QLabel();
    labelStakingIcon = new QLabel();
    labelConnectionsIcon = new QLabel();
    labelBlocksIcon = new QLabel();
    frameBlocksLayout->addStretch();
    frameBlocksLayout->addWidget(labelEncryptionIcon);
    frameBlocksLayout->addStretch();
    frameBlocksLayout->addWidget(labelStakingIcon);
    frameBlocksLayout->addStretch();
    frameBlocksLayout->addWidget(labelConnectionsIcon);
    frameBlocksLayout->addStretch();
    frameBlocksLayout->addWidget(labelBlocksIcon);
    frameBlocksLayout->addStretch();

    if (GetBoolArg("-staking", true))
    {
        QTimer *timerStakingIcon = new QTimer(labelStakingIcon);
        connect(timerStakingIcon, SIGNAL(timeout()), this, SLOT(updateStakingIcon()));
        timerStakingIcon->start(30 * 1000);
        updateStakingIcon();
    }

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

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

    syncIconMovie = new QMovie(":/movies/update_spinner", "mng", this);

    // Clicking on a transaction on the overview page simply sends you to transaction history page
    connect(overviewPage, SIGNAL(transactionClicked(QModelIndex)), this, SLOT(gotoHistoryPage()));

    // Doubleclicking on a transaction on the transaction history page shows details
    connect(transactionView, SIGNAL(doubleClicked(QModelIndex)), transactionView, SLOT(showDetails()));

    rpcConsole = new RPCConsole(this);
    connect(openRPCConsoleAction, SIGNAL(triggered()), rpcConsole, SLOT(show()));

    gotoOverviewPage();
}
Exemplo n.º 26
0
BitcoinGUI::BitcoinGUI(const NetworkStyle *networkStyle, QWidget *parent) :
    QMainWindow(parent),
    clientModel(0),
    walletFrame(0),
    unitDisplayControl(0),
    labelEncryptionIcon(0),
    labelConnectionsIcon(0),
    labelBlocksIcon(0),
    progressBarLabel(0),
    progressBar(0),
    progressDialog(0),
    appMenuBar(0),
    overviewAction(0),
    historyAction(0),
    quitAction(0),
    sendCoinsAction(0),
    depositCoinsAction(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),
    showHelpMessageAction(0),
    trayIcon(0),
    trayIconMenu(0),
    notificator(0),
    rpcConsole(0),
    prevBlocks(0),
    spinnerFrame(0),
    miningOffAction(0),
    miningOnAction(0)
{
    GUIUtil::restoreWindowGeometry("nWindow", QSize(850, 550), this);

    QString windowTitle = tr("HOdlcoin Core") + " - ";
#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(0);
#ifdef ENABLE_WALLET
    if(enableWallet)
    {
        /** Create wallet frame and make it the central widget */
        walletFrame = new WalletFrame(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();
    labelEncryptionIcon = new QLabel();
    labelMiningIcon = new QLabel();

    labelConnectionsIcon = new QLabel();
    labelBlocksIcon = new QLabel();
    if(enableWallet)
    {
        frameBlocksLayout->addStretch();
        frameBlocksLayout->addWidget(unitDisplayControl);
        frameBlocksLayout->addStretch();
        frameBlocksLayout->addWidget(labelEncryptionIcon);
    }
    frameBlocksLayout->addStretch();
    frameBlocksLayout->addWidget(labelMiningIcon);
    frameBlocksLayout->addStretch();
    frameBlocksLayout->addWidget(labelConnectionsIcon);
    frameBlocksLayout->addStretch();
    frameBlocksLayout->addWidget(labelBlocksIcon);
    frameBlocksLayout->addStretch();
    
    // Set mining pixmap
    labelMiningIcon->setPixmap(QIcon(":/icons/transaction_conflicted").pixmap(STATUSBAR_ICONSIZE, STATUSBAR_ICONSIZE));
    QTimer *timerMiningIcon = new QTimer(labelMiningIcon);
    timerMiningIcon->start(MODEL_UPDATE_DELAY);
    connect(timerMiningIcon, SIGNAL(timeout()), this, SLOT(updateMiningIcon()));
    // Set initial values for mining icon
    fGenerate = false;
    dHashesPerSec = 0;

    // 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()->addPermanentWidget(frameBlocks);

    // 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();
}
Exemplo n.º 27
0
BitcoinGUI::BitcoinGUI(bool fIsTestnet, QWidget *parent) :
    QMainWindow(parent),
    clientModel(0),
    walletFrame(0),
    encryptWalletAction(0),
    changePassphraseAction(0),
    aboutQtAction(0),
    trayIcon(0),
    notificator(0),
    rpcConsole(0),
    prevBlocks(0),
    spinnerFrame(0)
{
    GUIUtil::restoreWindowGeometry("nWindow", QSize(850, 550), this);

    QString windowTitle = tr("Crowncoin") + " - ";
#ifdef ENABLE_WALLET
    /* if compiled with wallet support, -disablewallet can still disable the wallet */
    bool enableWallet = !GetBoolArg("-disablewallet", false);
#else
    bool enableWallet = false;
#endif
    if(enableWallet)
    {
        windowTitle += tr("Wallet");
    } else {
        windowTitle += tr("Node");
    }

    if (!fIsTestnet)
    {
#ifndef Q_OS_MAC
        QApplication::setWindowIcon(QIcon(":icons/bitcoin"));
        setWindowIcon(QIcon(":icons/bitcoin"));
#else
        MacDockIconHandler::instance()->setIcon(QIcon(":icons/bitcoin"));
#endif
    }
    else
    {
        windowTitle += " " + tr("[testnet]");
#ifndef Q_OS_MAC
        QApplication::setWindowIcon(QIcon(":icons/bitcoin_testnet"));
        setWindowIcon(QIcon(":icons/bitcoin_testnet"));
#else
        MacDockIconHandler::instance()->setIcon(QIcon(":icons/bitcoin_testnet"));
#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(enableWallet ? this : 0);
#ifdef ENABLE_WALLET
    if(enableWallet)
    {
        /** Create wallet frame and make it the central widget */
        walletFrame = new WalletFrame(this);
        setCentralWidget(walletFrame);
    } else
#endif
    {
        /* 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(fIsTestnet);

    // Create application menu bar
    createMenuBar();

    // Create the toolbars
    createToolBars();

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

    // Create status bar
    statusBar();

    // 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);
    labelEncryptionIcon = new QLabel();
    labelConnectionsIcon = new QLabel();
    labelBlocksIcon = new QLabel();
    frameBlocksLayout->addStretch();
    frameBlocksLayout->addWidget(labelEncryptionIcon);
    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 QProgressBar();
    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()->addPermanentWidget(frameBlocks);

    connect(openRPCConsoleAction, SIGNAL(triggered()), rpcConsole, SLOT(show()));

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

    // 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();
}
Exemplo n.º 28
0
UIYabause::UIYabause( QWidget* parent )
	: QMainWindow( parent )
{
	mInit = false;
   search.clear();
	searchType = 0;

	// setup dialog
	setupUi( this );
	toolBar->insertAction( aFileSettings, mFileSaveState->menuAction() );
	toolBar->insertAction( aFileSettings, mFileLoadState->menuAction() );
	toolBar->insertSeparator( aFileSettings );
	setAttribute( Qt::WA_DeleteOnClose );
#ifdef USE_UNIFIED_TITLE_TOOLBAR
	setUnifiedTitleAndToolBarOnMac( true );
#endif
	fSound->setParent( 0, Qt::Popup );
	fVideoDriver->setParent( 0, Qt::Popup );
	fSound->installEventFilter( this );
	fVideoDriver->installEventFilter( this );
	// Get Screen res list
	getSupportedResolutions();
	// fill combo driver
	cbVideoDriver->blockSignals( true );
	for ( int i = 0; VIDCoreList[i] != NULL; i++ )
		cbVideoDriver->addItem( VIDCoreList[i]->Name, VIDCoreList[i]->id );
	cbVideoDriver->blockSignals( false );
	// create glcontext
	mYabauseGL = new YabauseGL( this );
	// and set it as central application widget
	setCentralWidget( mYabauseGL );
	// create log widget
	teLog = new QTextEdit( this );
	teLog->setReadOnly( true );
	teLog->setWordWrapMode( QTextOption::NoWrap );
	teLog->setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOn );
	teLog->setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOn );
	mLogDock = new QDockWidget( this );
	mLogDock->setWindowTitle( "Log" );
	mLogDock->setWidget( teLog );
	addDockWidget( Qt::BottomDockWidgetArea, mLogDock );
	mLogDock->setVisible( false );
	mCanLog = true;
	oldMouseX = oldMouseY = 0;
	mouseCaptured = false;

#ifndef SH2_TRACE
	aTraceLogging->setVisible(false);
#endif

	// create emulator thread
	mYabauseThread = new YabauseThread( this );
	// create hide mouse timer
	hideMouseTimer = new QTimer();
	// create mouse cursor timer
	mouseCursorTimer = new QTimer();
	// connections
	connect( mYabauseThread, SIGNAL( requestSize( const QSize& ) ), this, SLOT( sizeRequested( const QSize& ) ) );
	connect( mYabauseThread, SIGNAL( requestFullscreen( bool ) ), this, SLOT( fullscreenRequested( bool ) ) );
	connect( mYabauseThread, SIGNAL( requestVolumeChange( int ) ), this, SLOT( on_sVolume_valueChanged( int ) ) );
	connect( aViewLog, SIGNAL( toggled( bool ) ), mLogDock, SLOT( setVisible( bool ) ) );
	connect( mLogDock->toggleViewAction(), SIGNAL( toggled( bool ) ), aViewLog, SLOT( setChecked( bool ) ) );
	connect( mYabauseThread, SIGNAL( error( const QString&, bool ) ), this, SLOT( errorReceived( const QString&, bool ) ) );
	connect( mYabauseThread, SIGNAL( pause( bool ) ), this, SLOT( pause( bool ) ) );
	connect( mYabauseThread, SIGNAL( reset() ), this, SLOT( reset() ) );
	connect( hideMouseTimer, SIGNAL( timeout() ), this, SLOT( hideMouse() ));
	connect( mouseCursorTimer, SIGNAL( timeout() ), this, SLOT( cursorRestore() ));
	connect( mYabauseThread, SIGNAL( toggleEmulateMouse( bool ) ), this, SLOT( toggleEmulateMouse( bool ) ) );

	// Load shortcuts
	VolatileSettings* vs = QtYabause::volatileSettings();
	QList<QAction *> actions = findChildren<QAction *>();
	foreach ( QAction* action, actions )
	{
		if (action->text().isEmpty())
			continue;

		QString text = vs->value(QString("Shortcuts/") + action->text(), "").toString();
		if (text.isEmpty())
			continue;
		action->setShortcut(text);
	}

	// retranslate widgets
	QtYabause::retranslateWidget( this );

	QList<QAction *> actionList = menubar->actions();
	for(int i = 0;i < actionList.size();i++) {
		addAction(actionList.at(i));
	}

	restoreGeometry( vs->value("General/Geometry" ).toByteArray() );
	mYabauseGL->setMouseTracking(true);
	setMouseTracking(true);
	mouseXRatio = mouseYRatio = 1.0;
	emulateMouse = false;
	mouseSensitivity = vs->value( "Input/GunMouseSensitivity", 100 ).toInt();
	showMenuBarHeight = menubar->height();
	translations = QtYabause::getTranslationList();
	
	VIDSoftSetBilinear(QtYabause::settings()->value( "Video/Bilinear", false ).toBool());
}
Exemplo n.º 29
0
BitcoinGUI::BitcoinGUI(QWidget *parent):
    QMainWindow(parent),
    clientModel(0),
    walletModel(0),
    encryptWalletAction(0),
    changePassphraseAction(0),
    unlockWalletAction(0),
    lockWalletAction(0),
    aboutQtAction(0),
    trayIcon(0),
    notificator(0),
    rpcConsole(0)
{
    resize(850, 550);
    setWindowTitle(tr("Blurry") + " - " + tr("Wallet"));
#ifndef Q_OS_MAC
    qApp->setWindowIcon(QIcon(":icons/bitcoin"));
    setWindowIcon(QIcon(":icons/bitcoin"));
#else
    setUnifiedTitleAndToolBarOnMac(true);
    QApplication::setAttribute(Qt::AA_DontShowIconsInMenus);
#endif
    // Accept D&D of URIs
    setAcceptDrops(true);

    // Create actions for the toolbar, menu bar and tray/dock icon
    createActions();

    // Create application menu bar
    createMenuBar();

    // Create the toolbars
    createToolBars();

    // Create the tray icon (or setup the dock icon)
    createTrayIcon();

    // Create tabs
    overviewPage = new OverviewPage();

    transactionsPage = new QWidget(this);
    QVBoxLayout *vbox = new QVBoxLayout();
    transactionView = new TransactionView(this);
    vbox->addWidget(transactionView);
    transactionsPage->setLayout(vbox);

    addressBookPage = new AddressBookPage(AddressBookPage::ForEditing, AddressBookPage::SendingTab);

    receiveCoinsPage = new AddressBookPage(AddressBookPage::ForEditing, AddressBookPage::ReceivingTab);

    sendCoinsPage = new SendCoinsDialog(this);

    signVerifyMessageDialog = new SignVerifyMessageDialog(this);

    centralWidget = new QStackedWidget(this);
    centralWidget->addWidget(overviewPage);
    centralWidget->addWidget(transactionsPage);
    centralWidget->addWidget(addressBookPage);
    centralWidget->addWidget(receiveCoinsPage);
    centralWidget->addWidget(sendCoinsPage);
    setCentralWidget(centralWidget);

    // Create status bar
    statusBar();

    // 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);
    labelEncryptionIcon = new QLabel();
    labelStakingIcon = new QLabel();
    labelConnectionsIcon = new QLabel();
    labelBlocksIcon = new QLabel();
    frameBlocksLayout->addStretch();
    frameBlocksLayout->addWidget(labelEncryptionIcon);
    frameBlocksLayout->addStretch();
    frameBlocksLayout->addWidget(labelStakingIcon);
    frameBlocksLayout->addStretch();
    frameBlocksLayout->addWidget(labelConnectionsIcon);
    frameBlocksLayout->addStretch();
    frameBlocksLayout->addWidget(labelBlocksIcon);
    frameBlocksLayout->addStretch();

    if (GetBoolArg("-staking", true))
    {
        QTimer *timerStakingIcon = new QTimer(labelStakingIcon);
        connect(timerStakingIcon, SIGNAL(timeout()), this, SLOT(updateStakingIcon()));
        timerStakingIcon->start(30 * 1000);
        updateStakingIcon();
    }

    // Progress bar and label for blocks download
    progressBarLabel = new QLabel();
    progressBarLabel->setVisible(false);
    progressBar = new QProgressBar();
    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 = qApp->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()->addPermanentWidget(frameBlocks);

    syncIconMovie = new QMovie(":/movies/update_spinner", "mng", this);

    // Clicking on a transaction on the overview page simply sends you to transaction history page
    connect(overviewPage, SIGNAL(transactionClicked(QModelIndex)), this, SLOT(gotoHistoryPage()));
    connect(overviewPage, SIGNAL(transactionClicked(QModelIndex)), transactionView, SLOT(focusTransaction(QModelIndex)));

    // Double-clicking on a transaction on the transaction history page shows details
    connect(transactionView, SIGNAL(doubleClicked(QModelIndex)), transactionView, SLOT(showDetails()));

    rpcConsole = new RPCConsole(this);
    connect(openRPCConsoleAction, SIGNAL(triggered()), rpcConsole, SLOT(show()));

    // Clicking on "Verify Message" in the address book sends you to the verify message tab
    connect(addressBookPage, SIGNAL(verifyMessage(QString)), this, SLOT(gotoVerifyMessageTab(QString)));
    // Clicking on "Sign Message" in the receive coins page sends you to the sign message tab
    connect(receiveCoinsPage, SIGNAL(signMessage(QString)), this, SLOT(gotoSignMessageTab(QString)));

    gotoOverviewPage();
}
Exemplo n.º 30
0
MainWindow::MainWindow(Application *app)
    : QMainWindow(),
      m_application(app)
{
    app->setMainWindow(this);
    setUnifiedTitleAndToolBarOnMac(true);
    setDocumentMode(true);

    QCoreApplication::setOrganizationName("Dunnart");
    QCoreApplication::setOrganizationDomain("dunnart.org");
    QCoreApplication::setApplicationName("Dunnart");

    // Correct the look of the tab bar on OS X cocoa.
    app->setStyleSheet(
        "QGraphicsView {"
            "border: 0px;"
        "}"
#ifdef Q_WS_MAC
        "QTabBar::tab:top {"
            "font-family: \"Lucida Grande\";"
            "font-size: 11px;"
        "}"
#endif
    );

    // Set the window title.
    setWindowTitle("Dunnart");

    m_tab_widget = new CanvasTabWidget(this);    
    connect(m_tab_widget, SIGNAL(currentCanvasChanged(Canvas*)),
            this, SLOT(canvasChanged(Canvas*)));
    connect(m_tab_widget, SIGNAL(currentCanvasFileInfoChanged(QFileInfo)),
            this, SLOT(canvasFileInfoChanged(QFileInfo)));
    m_tab_widget->newTab();
    setCentralWidget(m_tab_widget);
    app->setCanvasTabWidget(m_tab_widget);

    // Inital window size.
    resize(1020, 743);

    m_new_action = new QAction("New", this);
    m_new_action->setShortcut(QKeySequence::New);
    connect(m_new_action, SIGNAL(triggered()), this, SLOT(documentNew()));

    m_open_action = new QAction("Open...", this);
    m_open_action->setShortcut(QKeySequence::Open);
    connect(m_open_action, SIGNAL(triggered()), this, SLOT(documentOpen()));

    for (int i = 0; i < MAX_RECENT_FILES; ++i)
    {
        m_action_open_recent_file[i] = new QAction(this);
        m_action_open_recent_file[i]->setVisible(false);
        connect(m_action_open_recent_file[i], SIGNAL(triggered()),
                this, SLOT(documentOpenRecent()));
    }

    m_close_action = new QAction("Close", this);
    m_close_action->setShortcut(QKeySequence::Close);
    connect(m_close_action, SIGNAL(triggered()),
            m_tab_widget, SLOT(currentCanvasClose()));

    m_save_action = new QAction("Save", this);
    m_save_action->setShortcut(QKeySequence::Save);
    connect(m_save_action, SIGNAL(triggered()),
            m_tab_widget, SLOT(currentCanvasSave()));

    m_save_as_action = new QAction("Save As...", this);
    m_save_as_action->setShortcut(QKeySequence::SaveAs);
    connect(m_save_as_action, SIGNAL(triggered()),
            m_tab_widget, SLOT(currentCanvasSaveAs()));

    m_export_action = new QAction("Export...", this);
    connect(m_export_action, SIGNAL(triggered()), this, SLOT(documentExport()));

    m_print_action = new QAction("Print...", this);
    m_print_action->setShortcut(QKeySequence::Print);
    connect(m_print_action, SIGNAL(triggered()), this, SLOT(documentPrint()));

    m_quit_action = new QAction(tr("Quit"), this);
    m_quit_action->setShortcut(QKeySequence::Quit);
    connect(m_quit_action, SIGNAL(triggered()),
            this, SLOT(close()));

    m_about_action = new QAction(tr("About"), this);
    connect(m_about_action, SIGNAL(triggered()), this, SLOT(about()));

    m_homepage_action = new QAction(tr("Dunnart homepage"), this);
    connect(m_homepage_action, SIGNAL(triggered()), this, SLOT(openHomepage()));

    m_action_show_zoom_level_dialog = new QAction(
            tr("Zoom Level"), this);
    m_action_show_zoom_level_dialog->setCheckable(true);

    m_action_show_properties_editor_dialog = new QAction(
            tr("Properties Editor"), this);
    m_action_show_properties_editor_dialog->setCheckable(true);

    m_action_show_layout_properties_dialog = new QAction(
            tr("Layout Properties"), this);
    m_action_show_layout_properties_dialog->setCheckable(true);

    m_action_show_connector_properties_dialog = new QAction(
            tr("Connector Properties"), this);
    m_action_show_connector_properties_dialog->setCheckable(true);

    m_action_show_create_alignment_dialog = new QAction(
            tr("Create Alignments"), this);
    m_action_show_create_alignment_dialog->setCheckable(true);

    m_action_show_create_distribution_dialog = new QAction(
            tr("Create Distributions"), this);
    m_action_show_create_distribution_dialog->setCheckable(true);

    m_action_show_create_separation_dialog = new QAction(
            tr("Create Separations"), this);
    m_action_show_create_separation_dialog->setCheckable(true);

    m_action_show_create_template_dialog = new QAction(
            tr("Create Templates"), this);
    m_action_show_create_template_dialog->setShortcut(tr("Ctrl+T"));
    m_action_show_create_template_dialog->setCheckable(true);

    m_action_show_shape_picker_dialog = new QAction(
            tr("Shape Picker"), this);
    m_action_show_shape_picker_dialog->setCheckable(true);

    m_action_clear_recent_files = new QAction(tr("Clear Menu"), this);
    connect(m_action_clear_recent_files, SIGNAL(triggered()),
            this, SLOT(clearRecentFileMenu()));

    m_action_show_undo_history_dialog = new QAction(
            tr("Undo History"), this);
    m_action_show_undo_history_dialog->setCheckable(true);

    m_action_show_canvas_overview_dialog = new QAction(
            tr("Canvas Overview"), this);
    m_action_show_canvas_overview_dialog->setCheckable(true);

    CanvasView *canvasview = m_tab_widget->currentCanvasView();
    Canvas *canvas = m_tab_widget->currentCanvas();

    m_action_auto_align_selection = new QAction(tr("Auto-align Selection"), this);
    connect(m_action_auto_align_selection, SIGNAL(triggered()),
            m_tab_widget, SLOT(alignSelection()));

    // Create statusBar, and assign it to the canvas.
    canvas->setStatusBar(statusBar());

#ifdef Q_WS_MAC
    // Make the status bar font size slightly smaller.
    QFont statusBarFont = statusBar()->font();
    statusBarFont.setPointSize(statusBarFont.pointSize() - 2);
    statusBar()->setFont(statusBarFont);
#endif

    m_file_menu = menuBar()->addMenu("File");
    m_file_menu->addAction(m_new_action);
    m_file_menu->addAction(m_open_action);
    QMenu *recentsMenu = m_file_menu->addMenu(tr("Open Recent"));
    for (int i = 0; i < MAX_RECENT_FILES; ++i)
    {
        recentsMenu->addAction(m_action_open_recent_file[i]);
    }
    m_action_recent_file_separator = recentsMenu->addSeparator();
    recentsMenu->addAction(m_action_clear_recent_files);
    updateRecentFileActions();

    m_file_menu->addSeparator();
    m_file_menu->addAction(m_close_action);
    m_file_menu->addAction(m_save_action);
    m_file_menu->addAction(m_save_as_action);
    m_file_menu->addSeparator();
    m_file_menu->addAction(m_export_action);
    m_file_menu->addSeparator();
    m_file_menu->addAction(m_print_action);
    m_file_menu->addSeparator();
    m_file_menu->addAction(m_quit_action);

    m_edit_menu = menuBar()->addMenu(tr("Edit"));
    m_tab_widget->addEditMenuActions(m_edit_menu);

    m_view_menu = menuBar()->addMenu(tr("View"));
    QMenu *dialogs_menu = m_view_menu->addMenu(tr("Show Dialogs"));
    dialogs_menu->addAction(m_action_show_canvas_overview_dialog);
    dialogs_menu->addAction(m_action_show_zoom_level_dialog);
    dialogs_menu->addSeparator();
    dialogs_menu->addAction(m_action_show_shape_picker_dialog);
    dialogs_menu->addAction(m_action_show_undo_history_dialog);
    dialogs_menu->addAction(m_action_show_properties_editor_dialog);
    dialogs_menu->addSeparator();
    dialogs_menu->addAction(m_action_show_create_alignment_dialog);
    dialogs_menu->addAction(m_action_show_create_distribution_dialog);
    dialogs_menu->addAction(m_action_show_create_separation_dialog);
    dialogs_menu->addAction(m_action_show_create_template_dialog);
    dialogs_menu->addSeparator();
    dialogs_menu->addAction(m_action_show_layout_properties_dialog);
    dialogs_menu->addAction(m_action_show_connector_properties_dialog);
    QMenu *overlays_menu = m_view_menu->addMenu(tr("Canvas Debug Layers"));
    m_tab_widget->addDebugOverlayMenuActions(overlays_menu);

    m_layout_menu = menuBar()->addMenu("Layout");
    m_tab_widget->addLayoutMenuActions(m_layout_menu);
    m_layout_menu->addAction(m_action_auto_align_selection);
    
    m_edit_toolbar = addToolBar(tr("Edit toolbar"));
    m_edit_toolbar->setIconSize(QSize(24, 24));
    m_edit_toolbar->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
    m_tab_widget->addEditToolBarActions(m_edit_toolbar);

    m_dialog_zoomLevel = new ZoomLevel(canvasview);
    connect(m_tab_widget, SIGNAL(currentCanvasViewChanged(CanvasView*)),
            m_dialog_zoomLevel, SLOT(changeCanvasView(CanvasView*)));
    connect(m_action_show_zoom_level_dialog,  SIGNAL(triggered(bool)),
            m_dialog_zoomLevel, SLOT(setVisible(bool)));
    connect(m_dialog_zoomLevel, SIGNAL(visibilityChanged(bool)),
            m_action_show_zoom_level_dialog,  SLOT(setChecked(bool)));
    addDockWidget(Qt::RightDockWidgetArea, m_dialog_zoomLevel);
    m_dialog_zoomLevel->show();

    m_dialog_properties_editor = new PropertiesEditorDialog(canvas);
    connect(m_tab_widget, SIGNAL(currentCanvasChanged(Canvas*)),
            m_dialog_properties_editor, SLOT(changeCanvas(Canvas*)));
    connect(m_action_show_properties_editor_dialog, SIGNAL(triggered(bool)),
            m_dialog_properties_editor, SLOT(setVisible(bool)));
    connect(m_dialog_properties_editor, SIGNAL(visibilityChanged(bool)),
            m_action_show_properties_editor_dialog,  SLOT(setChecked(bool)));
    addDockWidget(Qt::BottomDockWidgetArea, m_dialog_properties_editor);
    m_dialog_properties_editor->hide();

    m_dialog_shape_picker = new ShapePickerDialog(canvas);
    connect(m_tab_widget, SIGNAL(currentCanvasChanged(Canvas*)),
            m_dialog_shape_picker, SLOT(changeCanvas(Canvas*)));
    connect(m_action_show_shape_picker_dialog,  SIGNAL(triggered(bool)),
            m_dialog_shape_picker, SLOT(setVisible(bool)));
    connect(m_dialog_shape_picker, SIGNAL(visibilityChanged(bool)),
            m_action_show_shape_picker_dialog,  SLOT(setChecked(bool)));
    addDockWidget(Qt::LeftDockWidgetArea, m_dialog_shape_picker);
    m_dialog_shape_picker->show();

    m_dialog_layoutProps = new LayoutPropertiesDialog(canvas);
    connect(m_tab_widget, SIGNAL(currentCanvasChanged(Canvas*)),
            m_dialog_layoutProps, SLOT(changeCanvas(Canvas*)));
    connect(m_action_show_layout_properties_dialog,  SIGNAL(triggered(bool)),
            m_dialog_layoutProps, SLOT(setVisible(bool)));
    connect(m_dialog_layoutProps, SIGNAL(visibilityChanged(bool)),
            m_action_show_layout_properties_dialog,  SLOT(setChecked(bool)));
    addDockWidget(Qt::LeftDockWidgetArea, m_dialog_layoutProps);
    m_dialog_layoutProps->show();

    m_dialog_connectorProps = new ConnectorPropertiesDialog(canvas);
    connect(m_tab_widget, SIGNAL(currentCanvasChanged(Canvas*)),
            m_dialog_connectorProps, SLOT(changeCanvas(Canvas*)));
    connect(m_action_show_connector_properties_dialog,  SIGNAL(triggered(bool)),
            m_dialog_connectorProps, SLOT(setVisible(bool)));
    connect(m_dialog_connectorProps, SIGNAL(visibilityChanged(bool)),
            m_action_show_connector_properties_dialog,  SLOT(setChecked(bool)));
    addDockWidget(Qt::LeftDockWidgetArea, m_dialog_connectorProps);
    m_dialog_connectorProps->hide();

    m_dialog_alignment = new CreateAlignmentDialog(canvas);
    connect(m_tab_widget, SIGNAL(currentCanvasChanged(Canvas*)),
            m_dialog_alignment, SLOT(changeCanvas(Canvas*)));
    connect(m_action_show_create_alignment_dialog,  SIGNAL(triggered(bool)),
            m_dialog_alignment, SLOT(setVisible(bool)));
    connect(m_dialog_alignment, SIGNAL(visibilityChanged(bool)),
            m_action_show_create_alignment_dialog,  SLOT(setChecked(bool)));
    addDockWidget(Qt::RightDockWidgetArea, m_dialog_alignment);
    m_dialog_alignment->show();

    m_dialog_distribution = new  CreateDistributionDialog(canvas, this);
    connect(m_tab_widget, SIGNAL(currentCanvasChanged(Canvas*)),
            m_dialog_distribution, SLOT(changeCanvas(Canvas*)));
    connect(m_action_show_create_distribution_dialog,  SIGNAL(triggered(bool)),
            m_dialog_distribution, SLOT(setVisible(bool)));
    connect(m_dialog_distribution, SIGNAL(visibilityChanged(bool)),
            m_action_show_create_distribution_dialog,  SLOT(setChecked(bool)));
    addDockWidget(Qt::RightDockWidgetArea, m_dialog_distribution);
    m_dialog_distribution->show();

    m_dialog_separation = new CreateSeparationDialog(canvas, this);
    connect(m_tab_widget, SIGNAL(currentCanvasChanged(Canvas*)),
            m_dialog_separation, SLOT(changeCanvas(Canvas*)));
    connect(m_action_show_create_separation_dialog,  SIGNAL(triggered(bool)),
            m_dialog_separation, SLOT(setVisible(bool)));
    connect(m_dialog_separation, SIGNAL(visibilityChanged(bool)),
            m_action_show_create_separation_dialog,  SLOT(setChecked(bool)));
    addDockWidget(Qt::RightDockWidgetArea, m_dialog_separation);
    m_dialog_separation->show();

    m_dialog_template = new CreateTemplateDialog(canvas, this);
    connect(m_tab_widget, SIGNAL(currentCanvasChanged(Canvas*)),
            m_dialog_template, SLOT(changeCanvas(Canvas*)));
    connect(m_action_show_create_template_dialog,  SIGNAL(triggered(bool)),
            m_dialog_template, SLOT(setVisible(bool)));
    connect(m_dialog_template, SIGNAL(visibilityChanged(bool)),
            m_action_show_create_template_dialog,  SLOT(setChecked(bool)));
    m_dialog_template->hide();

    m_dialog_undo_history = new UndoHistoryDialog(
            m_tab_widget->undoGroup(), this);
    connect(m_action_show_undo_history_dialog,  SIGNAL(triggered(bool)),
            m_dialog_undo_history, SLOT(setVisible(bool)));
    connect(m_dialog_undo_history, SIGNAL(visibilityChanged(bool)),
            m_action_show_undo_history_dialog,  SLOT(setChecked(bool)));
    addDockWidget(Qt::LeftDockWidgetArea, m_dialog_undo_history);
    m_dialog_undo_history->hide();

    m_dialog_canvas_overview = new CanvasOverviewDialog(canvasview, this);
    connect(m_tab_widget, SIGNAL(currentCanvasViewChanged(CanvasView*)),
            m_dialog_canvas_overview, SLOT(changeCanvasView(CanvasView*)));
    connect(m_action_show_canvas_overview_dialog,  SIGNAL(triggered(bool)),
            m_dialog_canvas_overview, SLOT(setVisible(bool)));
    connect(m_dialog_canvas_overview, SIGNAL(visibilityChanged(bool)),
            m_action_show_canvas_overview_dialog,  SLOT(setChecked(bool)));
    addDockWidget(Qt::LeftDockWidgetArea, m_dialog_canvas_overview);
    m_dialog_canvas_overview->hide();

    // Allow plugins to initialise themselves and add things like
    // menu items and dock widgets to the main window.
    PluginApplicationManager *appPluginManager =
            sharedPluginApplicationManager();
    appPluginManager->applicationMainWindowInitialised(app);

    // Add help menu after everything else (if should be rightmost).
    m_help_menu = menuBar()->addMenu(tr("Help"));
    m_help_menu->addAction(m_homepage_action);
    m_help_menu->addSeparator();
    m_help_menu->addAction(m_about_action);

    // Restore window geometry and Dock Widget geometry.
    QSettings settings;
    restoreGeometry(settings.value("geometry").toByteArray());
    restoreState(settings.value("windowState").toByteArray());
}