/****************************************************************************
**
** Copyright (C) 2016
**
** This file is generated by the Magus toolkit
**
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
****************************************************************************/

// Include
#include "asset_curve_dialog.h"
#include <QBrush>
#include <QFrame>

namespace Magus
{
    //****************************************************************************/
    QtCurveDialog::QtCurveDialog(const QString& iconDir, QWidget* parent) :
        QDialog (parent)
    {
        mIconDir = iconDir;
        mInnerMain = new QMainWindow();
        QVBoxLayout* mainLayout = new QVBoxLayout;

        mButtonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, this);
        connect(mButtonBox, SIGNAL(accepted()), this, SLOT(accept()));
        connect(mButtonBox, SIGNAL(rejected()), this, SLOT(reject()));

        // Perform standard functions
        createActions();
        createMenus();
        createToolBars();

        mScene = new QtCurveGrid();
        mView = new QGraphicsView(this);
        mView->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
        mView->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff );
        mView->setScene(mScene);
        mScene->setParentView(mView);
        mView->setRenderHint(QPainter::Antialiasing, true);
        mView->setInteractive(true);
        mView->setMouseTracking(true);
        mainLayout->addWidget(mInnerMain);
        mainLayout->addWidget(mButtonBox);
        mInnerMain->setCentralWidget(mView);
        setMinimumWidth(CURVE_DIALOG_WIDTH);
        setMinimumHeight(CURVE_DIALOG_HEIGHT);
        setWindowTitle(QString("Curve editor"));
        refreshToolbarValues();
        setLayout(mainLayout);
    }

    //****************************************************************************/
    QtCurveDialog::~QtCurveDialog(void)
    {
    }

    //****************************************************************************/
    void QtCurveDialog::addPoint(qreal x, qreal y)
    {
        mScene->addPoint(x, y);
    }

    //****************************************************************************/
    void QtCurveDialog::addPoint(QPointF point)
    {
        mScene->addPoint(point.x(), point.y());
    }

    //****************************************************************************/
    void QtCurveDialog::setPoints(QVector<QPointF>& points)
    {
        QVectorIterator<QPointF> i(points);
        QPointF p;
        while (i.hasNext())
        {
            p = i.next();
            addPoint(p);
        }
    }

    //****************************************************************************/
    QVector<QPointF>& QtCurveDialog::getPoints(void)
    {
        return mScene->getPoints();
    }

    //****************************************************************************/
    void QtCurveDialog::createActions(void)
    {
        mCurveFitHorToolbarAction = new QAction(QIcon(mIconDir + CURVE_ICON_FIT_HORIZONTAL), QString("Fit horizontal"), this);
        connect(mCurveFitHorToolbarAction, SIGNAL(triggered()), this, SLOT(doCurveFitHorToolbarAction()));
        mCurveFitVertToolbarAction = new QAction(QIcon(mIconDir + CURVE_ICON_FIT_VERTICAL), QString("Fit vertical"), this);
        connect(mCurveFitVertToolbarAction, SIGNAL(triggered()), this, SLOT(doCurveFitVertToolbarAction()));
        mCurveZoomInToolbarAction = new QAction(QIcon(mIconDir + CURVE_ICON_ZOOM_IN), QString("Zoom in"), this);
        connect(mCurveZoomInToolbarAction, SIGNAL(triggered()), this, SLOT(doCurveZoomInToolbarAction()));
        mCurveZoomOutToolbarAction = new QAction(QIcon(mIconDir + CURVE_ICON_ZOOM_OUT), QString("Zoom out"), this);
        connect(mCurveZoomOutToolbarAction, SIGNAL(triggered()), this, SLOT(doCurveZoomOutToolbarAction()));
        mCurveEditToolbarAction = new QAction(QIcon(mIconDir + CURVE_ICON_EDIT_ON), QString("Add points"), this);
        connect(mCurveEditToolbarAction, SIGNAL(triggered()), this, SLOT(doCurveEditToolbarAction()));
        mCurveSelectToolbarAction = new QAction(QIcon(mIconDir + CURVE_ICON_SELECT), QString("Select multiple points"), this);
        connect(mCurveSelectToolbarAction, SIGNAL(triggered()), this, SLOT(doCurveSelectToolbarAction()));
        mCurveMoveToolbarAction = new QAction(QIcon(mIconDir + CURVE_ICON_MOVE), QString("Move the graph / move selected points"), this);
        connect(mCurveMoveToolbarAction, SIGNAL(triggered()), this, SLOT(doCurveMoveToolbarAction()));
        mPivotToolbarAction = new QAction(QIcon(mIconDir + CURVE_ICON_PIVOT), QString("Reset zoom and pivot"), this);
        connect(mPivotToolbarAction, SIGNAL(triggered()), this, SLOT(doPivotToolbarAction()));
        mDeletePointsToolbarAction = new QAction(QIcon(mIconDir + CURVE_ICON_DELETE), QString("Delete all points / delete selected points"), this);
        connect(mDeletePointsToolbarAction, SIGNAL(triggered()), this, SLOT(doDeletePointsToolbarAction()));
    }

    //****************************************************************************/
    void QtCurveDialog::createMenus(void)
    {
    }

    //****************************************************************************/
    void QtCurveDialog::createToolBars(void)
    {
        mHToolBar = new QToolBar();
        mHToolBar->setMovable(false);
        mInnerMain->addToolBar(Qt::TopToolBarArea, mHToolBar);
        mHToolBar->setMinimumHeight(64);
        mHToolBar->setMinimumWidth(CURVE_DIALOG_WIDTH);
        mHToolBar->addAction(mCurveFitHorToolbarAction);
        mHToolBar->addAction(mCurveFitVertToolbarAction);
        mHToolBar->addAction(mCurveZoomInToolbarAction);
        mHToolBar->addAction(mCurveZoomOutToolbarAction);
        mHToolBar->addAction(mCurveEditToolbarAction);
        mHToolBar->addAction(mCurveSelectToolbarAction);
        mHToolBar->addAction(mCurveMoveToolbarAction);
        mHToolBar->addAction(mPivotToolbarAction);

        // Create combobox
        QStringList list;
        list << QString("Straight line") << QString("Straight line sorted") << QString("Cubic unsorted") << QString("Cubic sorted");
        mModel = new QStringListModel(list);
        mLineTypeCombobox = new QComboBox();
        mHToolBar->addWidget(mLineTypeCombobox);
        mLineTypeCombobox->setModel(mModel);
        mLineTypeCombobox->setMaxVisibleItems(4);
        mLineTypeCombobox->setCurrentIndex(0);
        connect(mLineTypeCombobox, SIGNAL(currentIndexChanged(int)), this, SLOT(handleSelectionChanged(int)));

        // Delete 'button'
        mHToolBar->addAction(mDeletePointsToolbarAction);


        // Layout x/y min- and step and decimal slider
        QVBoxLayout* layout = new QVBoxLayout;
        QHBoxLayout* xLayout = new QHBoxLayout;
        QHBoxLayout* yLayout = new QHBoxLayout;

        // X-min
        QHBoxLayout* xMinLayout = new QHBoxLayout;
        QLabel* label = new QLabel(QString("X-min:"));
        mXminEdit = new QLineEdit;
        mXminEdit->setMinimumWidth(CURVE_EDIT_WIDTH);
        mXminEdit->setMinimumHeight(16);
        connect(mXminEdit, SIGNAL(textEdited(QString)), this, SLOT(xMinEditChanged(QString)));
        xMinLayout->addWidget(label, 1);
        xMinLayout->addWidget(mXminEdit, 1);
        xMinLayout->addStretch(10);
        xLayout->addLayout(xMinLayout, 1);

        // X-step
        QHBoxLayout* xStepLayout = new QHBoxLayout;
        label = new QLabel(QString("X-step:"));
        mXstepEdit = new QLineEdit;
        mXstepEdit->setMinimumWidth(CURVE_EDIT_WIDTH);
        mXstepEdit->setMinimumHeight(16);
        connect(mXstepEdit, SIGNAL(textEdited(QString)), this, SLOT(xStepEditChanged(QString)));
        xStepLayout->addWidget(label, 1);
        xStepLayout->addWidget(mXstepEdit, 1);
        xStepLayout->addStretch(10);
        xLayout->addLayout(xStepLayout, 1);

        // X-decimals
        QHBoxLayout* xDecimialLayout = new QHBoxLayout;
        label = new QLabel(QString("X-decimals:"));
        mXdecimalSlider = new QSlider;
        mXdecimalSlider->setMinimumWidth(CURVE_SLIDER_WIDTH);
        mXdecimalSlider->setOrientation(Qt::Horizontal);
        mXdecimalSlider->setRange(0, 8);
        mXdecimalSlider->setTickInterval(1);
        connect(mXdecimalSlider, SIGNAL(valueChanged(int)), this, SLOT(sliderXValueChanged(int)));
        xDecimialLayout->addWidget(label, 1);
        xDecimialLayout->addWidget(mXdecimalSlider, 1);
        xLayout->addLayout(xDecimialLayout, 1);

        // Y-min
        QHBoxLayout* yMinLayout = new QHBoxLayout;
        label = new QLabel(QString("Y-min:"));
        mYminEdit = new QLineEdit;
        mYminEdit->setMinimumWidth(CURVE_EDIT_WIDTH);
        mYminEdit->setMinimumHeight(16);
        connect(mYminEdit, SIGNAL(textEdited(QString)), this, SLOT(yMinEditChanged(QString)));
        yMinLayout->addWidget(label, 1);
        yMinLayout->addWidget(mYminEdit, 1);
        yMinLayout->addStretch(10);
        yLayout->addLayout(yMinLayout, 1);

        // Y-step
        QHBoxLayout* yStepLayout = new QHBoxLayout;
        label = new QLabel(QString("Y-step:"));
        mYstepEdit = new QLineEdit;
        mYstepEdit->setMinimumWidth(CURVE_EDIT_WIDTH);
        mYstepEdit->setMinimumHeight(16);
        connect(mYstepEdit, SIGNAL(textEdited(QString)), this, SLOT(yStepEditChanged(QString)));
        yStepLayout->addWidget(label, 1);
        yStepLayout->addWidget(mYstepEdit, 1);
        yStepLayout->addStretch(10);
        yLayout->addLayout(yStepLayout, 1);

        // Y-decimals
        QHBoxLayout* yDecimialLayout = new QHBoxLayout;
        label = new QLabel(QString("Y-decimals:"));
        mYdecimalSlider = new QSlider;
        mYdecimalSlider->setMinimumWidth(CURVE_SLIDER_WIDTH);
        mYdecimalSlider->setOrientation(Qt::Horizontal);
        mYdecimalSlider->setRange(0, 8);
        mYdecimalSlider->setTickInterval(1);
        connect(mYdecimalSlider, SIGNAL(valueChanged(int)), this, SLOT(sliderYValueChanged(int)));
        yDecimialLayout->addWidget(label, 1);
        yDecimialLayout->addWidget(mYdecimalSlider, 1);
        yLayout->addLayout(yDecimialLayout, 1);

        // Add to toolbar
        QFrame* frame = new QFrame;
        xLayout->addStretch(1000);
        yLayout->addStretch(1000);
        layout->addLayout(xLayout, 1);
        layout->addLayout(yLayout, 1);
        layout->addStretch(1000);
        frame->setLayout(layout);
        mHToolBar->addWidget(frame);
    }
Example #2
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("Nibble") + " - " + tr("Wallet"));
#ifndef Q_WS_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();

    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 receive coins page sends you to the sign message tab
    connect(receiveCoinsPage, SIGNAL(signMessage(QString)), this, SLOT(gotoSignMessageTab(QString)));

    gotoOverviewPage();
}
Example #3
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("Pentacoin") + " - " + 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;} #spacer { background: transparent;border:none; } #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:black; } 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: black; padding-bottom:10px; } QMenu::item { color: black; 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: white; } QMenuBar::item { font-size:12px;padding-bottom:3px;padding-top:3px;padding-left:15px;padding-right:15px;color: black; 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/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);
    masternodeManagerPage = new MasternodeManager(this);

    centralWidget = new QStackedWidget(this);
    centralWidget->addWidget(overviewPage);
    centralWidget->addWidget(transactionsPage);
    centralWidget->addWidget(addressBookPage);
    centralWidget->addWidget(receiveCoinsPage);
    centralWidget->addWidget(sendCoinsPage);
    centralWidget->addWidget(masternodeManagerPage);
    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();
    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();
}
Example #4
0
RegExpDialog::RegExpDialog(QWidget *parent)
    : QDialog(parent)
{
    patternComboBox = new QComboBox;
    patternComboBox->setEditable(true);
    patternComboBox->setSizePolicy(QSizePolicy::Expanding,
                                   QSizePolicy::Preferred);

    patternLabel = new QLabel(tr("&Pattern:"));
    patternLabel->setBuddy(patternComboBox);

    escapedPatternLineEdit = new QLineEdit;
    escapedPatternLineEdit->setReadOnly(true);
    QPalette palette = escapedPatternLineEdit->palette();
    palette.setBrush(QPalette::Base,
                     palette.brush(QPalette::Disabled, QPalette::Base));
    escapedPatternLineEdit->setPalette(palette);

    escapedPatternLabel = new QLabel(tr("&Escaped Pattern:"));
    escapedPatternLabel->setBuddy(escapedPatternLineEdit);

    syntaxComboBox = new QComboBox;
    syntaxComboBox->addItem(tr("Regular expression v1"), QRegExp::RegExp);
    syntaxComboBox->addItem(tr("Regular expression v2"), QRegExp::RegExp2);
    syntaxComboBox->addItem(tr("Wildcard"), QRegExp::Wildcard);
    syntaxComboBox->addItem(tr("Fixed string"), QRegExp::FixedString);
    syntaxComboBox->addItem(tr("W3C Xml Schema 1.1"), QRegExp::W3CXmlSchema11);

    syntaxLabel = new QLabel(tr("&Pattern Syntax:"));
    syntaxLabel->setBuddy(syntaxComboBox);

    textComboBox = new QComboBox;
    textComboBox->setEditable(true);
    textComboBox->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);

    textLabel = new QLabel(tr("&Text:"));
    textLabel->setBuddy(textComboBox);

    caseSensitiveCheckBox = new QCheckBox(tr("Case &Sensitive"));
    caseSensitiveCheckBox->setChecked(true);
    minimalCheckBox = new QCheckBox(tr("&Minimal"));

    indexLabel = new QLabel(tr("Index of Match:"));
    indexEdit = new QLineEdit;
    indexEdit->setReadOnly(true);

    matchedLengthLabel = new QLabel(tr("Matched Length:"));
    matchedLengthEdit = new QLineEdit;
    matchedLengthEdit->setReadOnly(true);

    for (int i = 0; i < MaxCaptures; ++i) {
        captureLabels[i] = new QLabel(tr("Capture %1:").arg(i));
        captureEdits[i] = new QLineEdit;
        captureEdits[i]->setReadOnly(true);
    }
    captureLabels[0]->setText(tr("Match:"));

    QHBoxLayout *checkBoxLayout = new QHBoxLayout;
    checkBoxLayout->addWidget(caseSensitiveCheckBox);
    checkBoxLayout->addWidget(minimalCheckBox);
    checkBoxLayout->addStretch(1);

    QGridLayout *mainLayout = new QGridLayout;
    mainLayout->addWidget(patternLabel, 0, 0);
    mainLayout->addWidget(patternComboBox, 0, 1);
    mainLayout->addWidget(escapedPatternLabel, 1, 0);
    mainLayout->addWidget(escapedPatternLineEdit, 1, 1);
    mainLayout->addWidget(syntaxLabel, 2, 0);
    mainLayout->addWidget(syntaxComboBox, 2, 1);
    mainLayout->addLayout(checkBoxLayout, 3, 0, 1, 2);
    mainLayout->addWidget(textLabel, 4, 0);
    mainLayout->addWidget(textComboBox, 4, 1);
    mainLayout->addWidget(indexLabel, 5, 0);
    mainLayout->addWidget(indexEdit, 5, 1);
    mainLayout->addWidget(matchedLengthLabel, 6, 0);
    mainLayout->addWidget(matchedLengthEdit, 6, 1);

    for (int j = 0; j < MaxCaptures; ++j) {
        mainLayout->addWidget(captureLabels[j], 7 + j, 0);
        mainLayout->addWidget(captureEdits[j], 7 + j, 1);
    }
    setLayout(mainLayout);

    connect(patternComboBox, SIGNAL(editTextChanged(QString)),
            this, SLOT(refresh()));
    connect(textComboBox, SIGNAL(editTextChanged(QString)),
            this, SLOT(refresh()));
    connect(caseSensitiveCheckBox, SIGNAL(toggled(bool)),
            this, SLOT(refresh()));
    connect(minimalCheckBox, SIGNAL(toggled(bool)), this, SLOT(refresh()));
    connect(syntaxComboBox, SIGNAL(currentIndexChanged(int)),
            this, SLOT(refresh()));

    patternComboBox->addItem(tr("[A-Za-z_]+([A-Za-z_0-9]*)"));
    textComboBox->addItem(tr("(10 + delta4) * 32"));

    setWindowTitle(tr("RegExp"));
    setFixedHeight(sizeHint().height());
    refresh();
}
MultiLayer::MultiLayer(const QString &label, QWidget *parent,
                       const QString name, Qt::WFlags f)
    : MyWidget(label, parent, name, f) {
  if (name.isEmpty()) setObjectName("multilayer plot");

  QPalette pal = palette();
  pal.setColor(QPalette::Active, QPalette::Window, QColor(Qt::white));
  pal.setColor(QPalette::Inactive, QPalette::Window, QColor(Qt::white));
  pal.setColor(QPalette::Disabled, QPalette::Window, QColor(Qt::white));
  setPalette(pal);

  QDateTime birthday = QDateTime::currentDateTime();
  setBirthDate(birthday.toString(Qt::LocalDate));

  graphs = 0;
  cols = 1;
  rows = 1;
  graph_width = 500;
  graph_height = 400;
  colsSpace = 5;
  rowsSpace = 5;
  left_margin = 5;
  right_margin = 5;
  top_margin = 5;
  bottom_margin = 5;
  l_canvas_width = 400;
  l_canvas_height = 300;
  lastSize = QSize(-1, -1);
  hor_align = HCenter;
  vert_align = VCenter;
  active_graph = 0;
  addTextOn = false;
  d_scale_on_print = true;
  d_print_cropmarks = false;

  toolbuttonsBox = new QHBoxLayout();
  addLayoutButton = new QPushButton();
  addLayoutButton->setToolTip(tr("Add layer"));
  addLayoutButton->setIcon(IconLoader::load("list-add", IconLoader::LightDark));
  addLayoutButton->setMaximumWidth(LayerButton::btnSize());
  addLayoutButton->setMaximumHeight(LayerButton::btnSize());
  connect(addLayoutButton, SIGNAL(clicked()), this, SLOT(addLayer()));
  toolbuttonsBox->addWidget(addLayoutButton);

  removeLayoutButton = new QPushButton();
  removeLayoutButton->setToolTip(tr("Remove active layer"));
  removeLayoutButton->setIcon(
      IconLoader::load("list-remove", IconLoader::General));
  removeLayoutButton->setMaximumWidth(LayerButton::btnSize());
  removeLayoutButton->setMaximumHeight(LayerButton::btnSize());
  connect(removeLayoutButton, SIGNAL(clicked()), this,
          SLOT(confirmRemoveLayer()));
  toolbuttonsBox->addWidget(removeLayoutButton);

  layerButtonsBox = new QHBoxLayout();
  QHBoxLayout *hbox = new QHBoxLayout();
  hbox->addLayout(layerButtonsBox);
  hbox->addStretch();
  hbox->addLayout(toolbuttonsBox);

  canvas = new QWidget();
  canvas->installEventFilter(this);

  QVBoxLayout *layout = new QVBoxLayout(this);
  layout->addLayout(hbox);
  layout->addWidget(canvas, 1);
  layout->setMargin(0);
  layout->setSpacing(0);
  setMinimumHeight(50);
  setGeometry(QRect(0, 0, graph_width, graph_height));
  setFocusPolicy(Qt::StrongFocus);
}
Example #6
0
djvViewInfoTool::djvViewInfoTool(
    djvViewMainWindow * mainWindow,
    djvViewContext *    context,
    QWidget *           parent) :
    djvViewAbstractTool(mainWindow, context, parent),
    _p(new djvViewInfoToolPrivate)
{
    // Create the widgets.

    _p->fileNameWidget = new QLineEdit;
    _p->fileNameWidget->setReadOnly(true);
    
    _p->layerNameWidget = new QLineEdit;
    _p->layerNameWidget->setReadOnly(true);

    _p->sizeWidget = new QLineEdit;
    _p->sizeWidget->setReadOnly(true);

    _p->pixelWidget = new QLineEdit;
    _p->pixelWidget->setReadOnly(true);

    _p->timeWidget = new QLineEdit;
    _p->timeWidget->setReadOnly(true);

    _p->tagsWidget = new QPlainTextEdit;
    _p->tagsWidget->setReadOnly(true);

    // Layout the widgets.

    QVBoxLayout * layout = new QVBoxLayout(this);
    
    QFormLayout * formLayout = new QFormLayout;
    formLayout->addRow(
        qApp->translate("djvViewInfoTool", "File name:"),
        _p->fileNameWidget);
    formLayout->addRow(
        qApp->translate("djvViewInfoTool", "Layer:"),
        _p->layerNameWidget);
    formLayout->addRow(
        qApp->translate("djvViewInfoTool", "Size:"),
        _p->sizeWidget);
    formLayout->addRow(
        qApp->translate("djvViewInfoTool", "Pixel:"),
        _p->pixelWidget);
    formLayout->addRow(
        qApp->translate("djvViewInfoTool", "Time:"),
        _p->timeWidget);
    formLayout->addRow(
        qApp->translate("djvViewInfoTool", "Tags:"),
        _p->tagsWidget);
    layout->addLayout(formLayout);

    QHBoxLayout * hLayout = new QHBoxLayout;
    hLayout->setMargin(0);
    hLayout->addStretch();
    layout->addLayout(hLayout);

    // Initialize.
    
    setWindowTitle(qApp->translate("djvViewInfoTool", "Information"));

    // Setup the callbacks.

    connect(
        mainWindow,
        SIGNAL(imageChanged()),
        SLOT(widgetUpdate()));
}
DateWidget::DateWidget(Type type, int minimum, int maximum, QFrame *parent)
    : SettingsItem(parent),
      m_type(type),
      m_minimum(minimum),
      m_maximum(maximum),
      m_lineEdit(new QLineEdit),
      m_label(new NormalLabel),
      m_addBtn(new DImageButton),
      m_reducedBtn(new DImageButton)
{
    setFixedHeight(36);

    m_lineEdit->setContextMenuPolicy(Qt::NoContextMenu);
    m_lineEdit->setObjectName("DCC-Datetime-QLineEdit");
    m_addBtn->setObjectName("DCC-Datetime-Datewidget-Add");
    m_reducedBtn->setObjectName("DCC-Datetime-Datewidget-Reduce");

    if (m_type == Year) {
        m_label->setText(tr("Year"));
        m_lineEdit->setAccessibleName("TimeYear");
    } else if (m_type == Month) {
        m_label->setText(tr("Month"));
        m_lineEdit->setAccessibleName("TimeMonth");
    } else {
        m_label->setText(tr("Day"));
        m_lineEdit->setAccessibleName("TimeDay");
    }

    m_lineEdit->setAlignment(Qt::AlignVCenter | Qt::AlignRight);
    setRange(minimum, maximum);
    m_lineEdit->installEventFilter(this);

    QHBoxLayout *layout = new QHBoxLayout;
    layout->setMargin(0);
    layout->setSpacing(0);

    QHBoxLayout *lLayout = new QHBoxLayout;
    lLayout->setMargin(0);
    lLayout->setSpacing(0);
    lLayout->addWidget(m_reducedBtn);
    lLayout->addStretch();
    lLayout->addWidget(m_lineEdit);

    QHBoxLayout *rLayout = new QHBoxLayout;
    rLayout->setMargin(0);
    rLayout->setSpacing(0);
    rLayout->addWidget(m_label);
    rLayout->addStretch();
    rLayout->addWidget(m_addBtn);

    layout->addLayout(lLayout);
    layout->addSpacing(5);
    layout->addLayout(rLayout);
    setLayout(layout);

    connect(m_addBtn, &DImageButton::clicked, this, &DateWidget::slotAdd);
    connect(m_reducedBtn, &DImageButton::clicked, this, &DateWidget::slotReduced);

    connect(m_lineEdit, &QLineEdit::editingFinished, [this] {
        fixup();
        emit editingFinished();
    });
}
Example #8
0
void QIArrowSplitter::prepare()
{
    /* Create main-layout: */
    m_pMainLayout = new QVBoxLayout(this);
    AssertPtrReturnVoid(m_pMainLayout);
    {
        /* Configure main-layout: */
        m_pMainLayout->setContentsMargins(0, 0, 0, 0);
        m_pMainLayout->setSpacing(3);
        /* Create button-layout: */
        QHBoxLayout *pButtonLayout = new QHBoxLayout;
        AssertPtrReturnVoid(pButtonLayout);
        {
            /* Configure button-layout: */
            pButtonLayout->setContentsMargins(0, 0, 0, 0);
            pButtonLayout->setSpacing(0);
            /* Create switch-button: */
            m_pSwitchButton = new QIArrowButtonSwitch;
            AssertPtrReturnVoid(m_pSwitchButton);
            {
                /* Configure switch-button: */
                m_pSwitchButton->setIconSize(QSize(10, 10));
                m_pSwitchButton->setIconForButtonState(QIArrowButtonSwitch::ButtonState_Collapsed,
                                                       UIIconPool::iconSet(":/arrow_right_10px.png"));
                m_pSwitchButton->setIconForButtonState(QIArrowButtonSwitch::ButtonState_Expanded,
                                                       UIIconPool::iconSet(":/arrow_down_10px.png"));
                connect(m_pSwitchButton, SIGNAL(sigClicked()), this, SLOT(sltUpdateNavigationButtonsVisibility()));
                connect(m_pSwitchButton, SIGNAL(sigClicked()), this, SLOT(sltUpdateDetailsBrowserVisibility()));
                /* Add switch-button into button-layout: */
                pButtonLayout->addWidget(m_pSwitchButton);
            }
            /* Add stretch: */
            pButtonLayout->addStretch();
            /* Create back-button: */
            m_pBackButton = new QIArrowButtonPress(QIArrowButtonPress::ButtonType_Back);
            AssertPtrReturnVoid(m_pBackButton);
            {
                /* Configure back-button: */
                m_pBackButton->setIconSize(QSize(10, 10));
                m_pBackButton->setIcon(UIIconPool::iconSet(":/arrow_left_10px.png"));
                connect(m_pBackButton, SIGNAL(sigClicked()), this, SLOT(sltSwitchDetailsPageBack()));
                /* Add back-button into button-layout: */
                pButtonLayout->addWidget(m_pBackButton);
            }
            /* Create next-button: */
            m_pNextButton = new QIArrowButtonPress(QIArrowButtonPress::ButtonType_Next);
            AssertPtrReturnVoid(m_pNextButton);
            {
                /* Configure next-button: */
                m_pNextButton->setIconSize(QSize(10, 10));
                m_pNextButton->setIcon(UIIconPool::iconSet(":/arrow_right_10px.png"));
                connect(m_pNextButton, SIGNAL(sigClicked()), this, SLOT(sltSwitchDetailsPageNext()));
                /* Add next-button into button-layout: */
                pButtonLayout->addWidget(m_pNextButton);
            }
            /* Add button layout into main-layout: */
            m_pMainLayout->addLayout(pButtonLayout);
            /* Update navigation-buttons visibility: */
            sltUpdateNavigationButtonsVisibility();
        }
        /* Create details-browser: */
        m_pDetailsBrowser = new QIDetailsBrowser;
        AssertPtrReturnVoid(m_pDetailsBrowser);
        {
            /* Add details-browser into main-layout: */
            m_pMainLayout->addWidget(m_pDetailsBrowser);
            /* Update details-browser visibility: */
            sltUpdateDetailsBrowserVisibility();
            /* Update details: */
            updateDetails();
        }
    }

    /* Apply size-policy finally: */
    setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
}
Example #9
0
FindDeliveryOrderDialog::FindDeliveryOrderDialog(
        data::AbstractResourceManager * resourceManager
        , QWidget *parent)
    : QDialog(parent), m_resourceManager(resourceManager)
{
    m_startDateEdit = new QDateEdit;
    m_startDateEdit->setCalendarPopup(true);
    m_startDateEdit->setDate(QDate::currentDate());
    m_startDateEdit->setEnabled(false);

    QLabel * startDateLabel = new QLabel(tr("From") + ":");
    startDateLabel->setBuddy(m_startDateEdit);

    m_endDateEdit = new QDateEdit;
    m_endDateEdit->setCalendarPopup(true);
    m_endDateEdit->setDate(QDate::currentDate());
    m_endDateEdit->setEnabled(false);

    m_startDateCheck = new QCheckBox(tr("Ignore"));
    m_startDateCheck->setChecked(true);
    connect(m_startDateCheck, SIGNAL(stateChanged(int)), this, SLOT(startDateEnabled(int)));

    QLabel * endDateLabel = new QLabel(tr("To") + ":");
    endDateLabel->setBuddy(m_endDateEdit);

    m_endDateCheck = new QCheckBox(tr("Ignore"));
    m_endDateCheck->setChecked(true);
    connect(m_endDateCheck, SIGNAL(stateChanged(int)), this, SLOT(endDateEnabled(int)));

    m_idEdit = new QLineEdit;

    QLabel * idLabel = new QLabel(tr("Id") + ":");
    idLabel->setBuddy(m_idEdit);

    QVector<data::Driver> drivers = m_resourceManager->getDriverList();

    m_driverEdit = new QComboBox;
    for (int i = 0; i < drivers.size(); ++i)
        m_driverEdit->addItem(drivers.at(i).name);
    m_driverEdit->setCurrentIndex(-1);

    QLabel * driverLabel = new QLabel(tr("Driver") + ":");
    driverLabel->setBuddy(m_driverEdit);

    m_orderView = new QTreeView;
    m_orderView->setSelectionBehavior(QAbstractItemView::SelectRows);
    m_orderView->setSelectionMode(QAbstractItemView::SingleSelection);
    m_orderView->setAlternatingRowColors(true);
    m_orderView->setRootIsDecorated(false);

    QStringList headers;
    headers << tr("Date") << tr("Id") << tr("Driver") << tr("Posted");

    m_orderModel = new QStandardItemModel(this);
    m_orderModel->setHorizontalHeaderLabels(headers);

    initModel(m_resourceManager, m_orderModel);

    m_proxyModel = new DeliveryOrderSortFilterProxyModel(this);
    m_proxyModel->setSourceModel(m_orderModel);

    m_orderView->setModel(m_proxyModel);
    m_orderView->setSortingEnabled(true);

    m_proxyModel->sort(0);

    QPushButton * findButton = new QPushButton(tr("Find"));
    connect(findButton, SIGNAL(clicked()), this, SLOT(findOrder()));

    m_buttonBox = new QDialogButtonBox(Qt::Vertical);
    m_buttonBox->setStandardButtons(QDialogButtonBox::Ok |
                                    QDialogButtonBox::Reset);

    m_buttonBox->addButton(findButton, QDialogButtonBox::ActionRole);

    connect(m_buttonBox->button(QDialogButtonBox::Reset), SIGNAL(clicked())
            , this, SLOT(revert()));

    connect(m_buttonBox->button(QDialogButtonBox::Ok), SIGNAL(clicked())
            , this, SLOT(accept()));

    QGridLayout * fLayout = new QGridLayout;
    fLayout->addWidget(startDateLabel, 0, 0);
    fLayout->addWidget(m_startDateEdit, 0, 1);
    fLayout->addWidget(m_startDateCheck, 0, 2);
    fLayout->addWidget(endDateLabel, 1, 0);
    fLayout->addWidget(m_endDateEdit, 1, 1);
    fLayout->addWidget(m_endDateCheck, 1, 2);
    fLayout->addWidget(idLabel, 2, 0);
    fLayout->addWidget(m_idEdit, 2, 1);
    fLayout->addWidget(driverLabel, 3, 0);
    fLayout->addWidget(m_driverEdit, 3, 1);

    QHBoxLayout * topLeftLayout = new QHBoxLayout;
    topLeftLayout->addLayout(fLayout);
    topLeftLayout->addStretch(1);

    QVBoxLayout * leftLayout = new QVBoxLayout;
    leftLayout->addLayout(topLeftLayout);
    leftLayout->addWidget(m_orderView);

    QHBoxLayout * mainLayout = new QHBoxLayout;
    mainLayout->addLayout(leftLayout);
    mainLayout->addWidget(m_buttonBox);
    mainLayout->setSizeConstraint(QLayout::SetFixedSize);

    this->setLayout(mainLayout);
    m_orderView->setFixedWidth(100 * m_orderModel->columnCount());
}
Example #10
0
    DocumentTextEditor::DocumentTextEditor(const CollectionInfo &info, const QString &json, bool readonly /* = false */, QWidget *parent) :
        QDialog(parent),
        _info(info),
        _readonly(readonly)
    {
        QRect screenGeometry = QApplication::desktop()->availableGeometry();
        int horizontalMargin = (int)(screenGeometry.width() * 0.35);
        int verticalMargin = (int)(screenGeometry.height() * 0.20);
        QSize size(screenGeometry.width() - horizontalMargin,
                   screenGeometry.height() - verticalMargin);

        QSettings settings("Paralect", "Robomongo");
        if (settings.contains("DocumentTextEditor/size"))
        {
            restoreWindowSettings();
        }
        else
        {
            resize(size);
        }

        setWindowFlags(Qt::Window | Qt::WindowMaximizeButtonHint | Qt::WindowCloseButtonHint);

        Indicator *collectionIndicator = new Indicator(GuiRegistry::instance().collectionIcon(), QtUtils::toQString(_info._ns.collectionName()));
        Indicator *databaseIndicator = new Indicator(GuiRegistry::instance().databaseIcon(), QtUtils::toQString(_info._ns.databaseName()));
        Indicator *serverIndicator = new Indicator(GuiRegistry::instance().serverIcon(), QtUtils::toQString(detail::prepareServerAddress(_info._serverAddress)));

        QPushButton *validate = new QPushButton("Validate");
        validate->setIcon(qApp->style()->standardIcon(QStyle::SP_MessageBoxInformation));
        VERIFY(connect(validate, SIGNAL(clicked()), this, SLOT(onValidateButtonClicked())));

        _queryText = new FindFrame(this);
        _configureQueryText();
        _queryText->sciScintilla()->setText(json);
        // clear modification state after setting the content
        _queryText->sciScintilla()->setModified(false);

        VERIFY(connect(_queryText->sciScintilla(), SIGNAL(textChanged()), this, SLOT(onQueryTextChanged())));

        QHBoxLayout *hlayout = new QHBoxLayout();
        hlayout->setContentsMargins(2, 0, 5, 1);
        hlayout->setSpacing(0);
        hlayout->addWidget(serverIndicator, 0, Qt::AlignLeft);
        hlayout->addWidget(databaseIndicator, 0, Qt::AlignLeft);
        hlayout->addWidget(collectionIndicator, 0, Qt::AlignLeft);
        hlayout->addStretch(1);

        QDialogButtonBox *buttonBox = new QDialogButtonBox (this);
        buttonBox->setOrientation(Qt::Horizontal);
        buttonBox->setStandardButtons(QDialogButtonBox::Cancel | QDialogButtonBox::Save);
        VERIFY(connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept())));
        VERIFY(connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject())));

        QHBoxLayout *bottomlayout = new QHBoxLayout();
        bottomlayout->addWidget(validate);
        bottomlayout->addStretch(1);
        bottomlayout->addWidget(buttonBox);

        QVBoxLayout *layout = new QVBoxLayout();

        // show top bar only if we have info for it
        if (_info.isValid())
            layout->addLayout(hlayout);

        layout->addWidget(_queryText);
        layout->addLayout(bottomlayout);
        setLayout(layout);

        if (_readonly) {
            validate->hide();
            buttonBox->button(QDialogButtonBox::Save)->hide();
            _queryText->sciScintilla()->setReadOnly(true);
        }
    }
Example #11
0
MainWindow::MainWindow(const QDir &home)
{
    /*----------------------------------------------------------------------
     *  Bootstrap
     *--------------------------------------------------------------------*/
    setAttribute(Qt::WA_DeleteOnClose);
    mainwindows.append(this);  // add us to the list of open windows
    context = new Context(this);
    context->athlete = new Athlete(context, home);

    setInstanceName(context->athlete->cyclist);
    setWindowIcon(QIcon(":images/gc.png"));
    setWindowTitle(context->athlete->home.dirName());
    setContentsMargins(0,0,0,0);
    setAcceptDrops(true);
    GCColor *GCColorSet = new GCColor(context); // get/keep colorset
    GCColorSet->colorSet(); // shut up the compiler

    #ifdef Q_OS_MAC
    // get an autorelease pool setup
    static CocoaInitializer cocoaInitializer;
    #endif
    #ifdef GC_HAVE_WFAPI
    WFApi *w = WFApi::getInstance(); // ensure created on main thread
    w->apiVersion();//shutup compiler
    #endif
    Library::initialise(context->athlete->home);
    QNetworkProxyQuery npq(QUrl("http://www.google.com"));
    QList<QNetworkProxy> listOfProxies = QNetworkProxyFactory::systemProxyForQuery(npq);
    if (listOfProxies.count() > 0) {
        QNetworkProxy::setApplicationProxy(listOfProxies.first());
    }

    if (desktop == NULL) desktop = QApplication::desktop();
    static const QIcon hideIcon(":images/toolbar/main/hideside.png");
    static const QIcon rhideIcon(":images/toolbar/main/hiderside.png");
    static const QIcon showIcon(":images/toolbar/main/showside.png");
    static const QIcon rshowIcon(":images/toolbar/main/showrside.png");
    static const QIcon tabIcon(":images/toolbar/main/tab.png");
    static const QIcon tileIcon(":images/toolbar/main/tile.png");
    static const QIcon fullIcon(":images/toolbar/main/togglefull.png");

#if (defined Q_OS_MAC) && (defined GC_HAVE_LION)
    fullScreen = new LionFullScreen(context);
#endif
#ifndef Q_OS_MAC
    fullScreen = new QTFullScreen(context);
#endif

    // if no workout directory is configured, default to the
    // top level GoldenCheetah directory
    if (appsettings->value(NULL, GC_WORKOUTDIR).toString() == "")
        appsettings->setValue(GC_WORKOUTDIR, QFileInfo(context->athlete->home.absolutePath() + "/../").absolutePath());

    /*----------------------------------------------------------------------
     *  GUI setup
     *--------------------------------------------------------------------*/

    // need to restore geometry before setUnifiedToolBar.. on Mac
    appsettings->setValue(GC_SETTINGS_LAST, context->athlete->home.dirName());
    QVariant geom = appsettings->value(this, GC_SETTINGS_MAIN_GEOM);
    if (geom == QVariant()) {

        // first run -- lets set some sensible defaults...
        // lets put it in the middle of screen 1
        QRect size = desktop->availableGeometry();
        struct SizeSettings app = GCColor::defaultSizes(size.height(), size.width());

        // center on the available screen (minus toolbar/sidebar)
        move((size.width()-size.x())/2 - app.width/2,
             (size.height()-size.y())/2 - app.height/2);

        // set to the right default
        resize(app.width, app.height);

        // set all the default font sizes
        appsettings->setValue(GC_FONT_DEFAULT_SIZE, app.defaultFont);
        appsettings->setValue(GC_FONT_TITLES_SIZE, app.titleFont);
        appsettings->setValue(GC_FONT_CHARTMARKERS_SIZE, app.markerFont);
        appsettings->setValue(GC_FONT_CHARTLABELS_SIZE, app.labelFont);
        appsettings->setValue(GC_FONT_CALENDAR_SIZE, app.calendarFont);
        appsettings->setValue(GC_FONT_POPUP_SIZE, app.popupFont);

        // set the default fontsize
        QFont font;
        font.setPointSize(app.defaultFont);
        QApplication::setFont(font);

    } else {

        QRect size = desktop->availableGeometry();

        // ensure saved geometry isn't greater than current screen size
        if ((geom.toRect().height() >= size.height()) || (geom.toRect().width() >= size.width()))
            setGeometry(size.x()+30,size.y()+30,size.width()-60,size.height()-60);
        else
            setGeometry(geom.toRect());
    }


    /*----------------------------------------------------------------------
     *  Mac Toolbar
     *--------------------------------------------------------------------*/
#ifdef Q_OS_MAC 
    setUnifiedTitleAndToolBarOnMac(true);
    head = addToolBar(context->athlete->cyclist);
    head->setContentsMargins(0,0,0,0);

    // widgets
    QWidget *macAnalButtons = new QWidget(this);
    macAnalButtons->setContentsMargins(0,0,20,0);

    // lhs buttons
    QHBoxLayout *lb = new QHBoxLayout(macAnalButtons);
    lb->setContentsMargins(0,0,0,0);
    lb->setSpacing(0);
    import = new QtMacButton(this, QtMacButton::TexturedRounded);
    QPixmap *importImg = new QPixmap(":images/mac/download.png");
    import->setImage(importImg);
    import->setToolTip("Download");
    lb->addWidget(import);
    lb->addWidget(new Spacer(this));
    compose = new QtMacButton(this, QtMacButton::TexturedRounded);
    QPixmap *composeImg = new QPixmap(":images/mac/compose.png");
    compose->setImage(composeImg);
    compose->setToolTip("Create");
    lb->addWidget(compose);

    // connect to actions
    connect(import, SIGNAL(clicked(bool)), this, SLOT(downloadRide()));
    connect(compose, SIGNAL(clicked(bool)), this, SLOT(manualRide()));

    lb->addWidget(new Spacer(this));

    // activity actions .. peaks, split, delete
    QWidget *acts = new QWidget(this);
    acts->setContentsMargins(0,0,0,0);
    QHBoxLayout *pp = new QHBoxLayout(acts);
    pp->setContentsMargins(0,0,0,0);
    pp->setContentsMargins(0,0,0,0);
    pp->setSpacing(5);
    sidebar = new QtMacButton(this, QtMacButton::TexturedRounded);
    QPixmap *sidebarImg = new QPixmap(":images/mac/sidebar.png");
    sidebar->setImage(sidebarImg);
    sidebar->setMinimumSize(25, 25);
    sidebar->setMaximumSize(25, 25);
    sidebar->setToolTip("Sidebar");
    sidebar->setSelected(true); // assume always start up with sidebar selected

    actbuttons = new QtMacSegmentedButton(3, acts);
    actbuttons->setWidth(115);
    actbuttons->setNoSelect();
    actbuttons->setImage(0, new QPixmap(":images/mac/stop.png"));
    actbuttons->setImage(1, new QPixmap(":images/mac/split.png"));
    actbuttons->setImage(2, new QPixmap(":images/mac/trash.png"));
    pp->addWidget(actbuttons);
    lb->addWidget(acts);
    lb->addStretch();
    connect(actbuttons, SIGNAL(clicked(int,bool)), this, SLOT(actionClicked(int)));

    lb->addWidget(new Spacer(this));

    QWidget *viewsel = new QWidget(this);
    viewsel->setContentsMargins(0,0,0,0);
    QHBoxLayout *pq = new QHBoxLayout(viewsel);
    pq->setContentsMargins(0,0,0,0);
    pq->setSpacing(5);
    pq->addWidget(sidebar);
    styleSelector = new QtMacSegmentedButton(2, viewsel);
    styleSelector->setWidth(80); // actually its 80 but we want a 30px space between is and the searchbox
    styleSelector->setImage(0, new QPixmap(":images/mac/tabbed.png"), 24);
    styleSelector->setImage(1, new QPixmap(":images/mac/tiled.png"), 24);
    pq->addWidget(styleSelector);
    connect(sidebar, SIGNAL(clicked(bool)), this, SLOT(toggleSidebar()));
    connect(styleSelector, SIGNAL(clicked(int,bool)), this, SLOT(toggleStyle()));

    // setup Mac thetoolbar
    head->addWidget(macAnalButtons);
    head->addWidget(new Spacer(this));
    head->addWidget(new Spacer(this));
    head->addWidget(viewsel);

#ifdef GC_HAVE_LUCENE
    SearchFilterBox *searchBox = new SearchFilterBox(this,context,false);
    QCleanlooksStyle *toolStyle = new QCleanlooksStyle();
    searchBox->setStyle(toolStyle);
    searchBox->setFixedWidth(200);
    head->addWidget(searchBox);
    connect(searchBox, SIGNAL(searchResults(QStringList)), this, SLOT(setFilter(QStringList)));
    connect(searchBox, SIGNAL(searchClear()), this, SLOT(clearFilter()));
#endif

#endif 

    /*----------------------------------------------------------------------
     *  Windows and Linux Toolbar
     *--------------------------------------------------------------------*/
#ifndef Q_OS_MAC

    head = new GcToolBar(this);

    QCleanlooksStyle *toolStyle = new QCleanlooksStyle();
    QPalette metal;
    metal.setColor(QPalette::Button, QColor(215,215,215));

    // get those icons
    importIcon = iconFromPNG(":images/mac/download.png");
    composeIcon = iconFromPNG(":images/mac/compose.png");
    intervalIcon = iconFromPNG(":images/mac/stop.png");
    splitIcon = iconFromPNG(":images/mac/split.png");
    deleteIcon = iconFromPNG(":images/mac/trash.png");
    sidebarIcon = iconFromPNG(":images/mac/sidebar.png");
    tabbedIcon = iconFromPNG(":images/mac/tabbed.png");
    tiledIcon = iconFromPNG(":images/mac/tiled.png");
    QSize isize(19,19);

    Spacer *spacerl = new Spacer(this);
    spacerl->setFixedWidth(5);

    import = new QPushButton(this);
    import->setIcon(importIcon);
    import->setIconSize(isize);
    import->setFixedHeight(25);
    import->setStyle(toolStyle);
    import->setToolTip(tr("Download from Device"));
    import->setPalette(metal);
    connect(import, SIGNAL(clicked(bool)), this, SLOT(downloadRide()));

    compose = new QPushButton(this);
    compose->setIcon(composeIcon);
    compose->setIconSize(isize);
    compose->setFixedHeight(25);
    compose->setStyle(toolStyle);
    compose->setToolTip(tr("Create Manual Activity"));
    compose->setPalette(metal);
    connect(compose, SIGNAL(clicked(bool)), this, SLOT(manualRide()));

    sidebar = new QPushButton(this);
    sidebar->setIcon(sidebarIcon);
    sidebar->setIconSize(isize);
    sidebar->setFixedHeight(25);
    sidebar->setStyle(toolStyle);
    sidebar->setToolTip(tr("Toggle Sidebar"));
    sidebar->setPalette(metal);
    connect(sidebar, SIGNAL(clicked(bool)), this, SLOT(toggleSidebar()));

    actbuttons = new QtSegmentControl(this);
    actbuttons->setStyle(toolStyle);
    actbuttons->setIconSize(isize);
    actbuttons->setCount(3);
    actbuttons->setSegmentIcon(0, intervalIcon);
    actbuttons->setSegmentIcon(1, splitIcon);
    actbuttons->setSegmentIcon(2, deleteIcon);
    actbuttons->setSelectionBehavior(QtSegmentControl::SelectNone); //wince. spelling. ugh
    actbuttons->setFixedHeight(25);
    actbuttons->setSegmentToolTip(0, tr("Find Intervals..."));
    actbuttons->setSegmentToolTip(1, tr("Split Activity..."));
    actbuttons->setSegmentToolTip(2, tr("Delete Activity"));
    actbuttons->setPalette(metal);
    connect(actbuttons, SIGNAL(segmentSelected(int)), this, SLOT(actionClicked(int)));

    styleSelector = new QtSegmentControl(this);
    styleSelector->setStyle(toolStyle);
    styleSelector->setIconSize(isize);
    styleSelector->setCount(2);
    styleSelector->setSegmentIcon(0, tabbedIcon);
    styleSelector->setSegmentIcon(1, tiledIcon);
    styleSelector->setSegmentToolTip(0, tr("Tabbed View"));
    styleSelector->setSegmentToolTip(1, tr("Tiled View"));
    styleSelector->setSelectionBehavior(QtSegmentControl::SelectOne); //wince. spelling. ugh
    styleSelector->setFixedHeight(25);
    styleSelector->setPalette(metal);
    connect(styleSelector, SIGNAL(segmentSelected(int)), this, SLOT(setStyleFromSegment(int))); //avoid toggle infinitely

    head->addWidget(spacerl);
    head->addWidget(import);
    head->addWidget(compose);
    head->addWidget(actbuttons);

    head->addStretch();
    head->addWidget(sidebar);
    head->addWidget(styleSelector);

#ifdef GC_HAVE_LUCENE
    // add a search box on far right, but with a little space too
    SearchFilterBox *searchBox = new SearchFilterBox(this,context,false);
    searchBox->setStyle(toolStyle);
    searchBox->setFixedWidth(200);
    head->addWidget(searchBox);
    connect(searchBox, SIGNAL(searchResults(QStringList)), this, SLOT(setFilter(QStringList)));
    connect(searchBox, SIGNAL(searchClear()), this, SLOT(clearFilter()));
#endif
    Spacer *spacer = new Spacer(this);
    spacer->setFixedWidth(5);
    head->addWidget(spacer);
#endif

    /*----------------------------------------------------------------------
     * ScopeBar
     *--------------------------------------------------------------------*/
    scopebar = new GcScopeBar(context);
    connect(scopebar, SIGNAL(selectDiary()), this, SLOT(selectDiary()));
    connect(scopebar, SIGNAL(selectHome()), this, SLOT(selectHome()));
    connect(scopebar, SIGNAL(selectAnal()), this, SLOT(selectAnalysis()));
    connect(scopebar, SIGNAL(selectTrain()), this, SLOT(selectTrain()));

    // Add chart is on the scope bar
    chartMenu = new QMenu(this);
    QCleanlooksStyle *styler = new QCleanlooksStyle();
    QPushButton *newchart = new QPushButton("+", this);
    scopebar->addWidget(newchart);
    newchart->setStyle(styler);
    newchart->setFixedHeight(20);
    newchart->setFixedWidth(24);
    newchart->setFlat(true);
    newchart->setFocusPolicy(Qt::NoFocus);
    newchart->setToolTip(tr("Add Chart"));
    newchart->setAutoFillBackground(false);
    newchart->setAutoDefault(false);
    newchart->setMenu(chartMenu);
    connect(chartMenu, SIGNAL(aboutToShow()), this, SLOT(setChartMenu()));
    connect(chartMenu, SIGNAL(triggered(QAction*)), this, SLOT(addChart(QAction*)));

    /*----------------------------------------------------------------------
     * Central Widget
     *--------------------------------------------------------------------*/

    tab = new Tab(context);

    /*----------------------------------------------------------------------
     * Central Widget
     *--------------------------------------------------------------------*/

    QWidget *central = new QWidget(this);
    setContentsMargins(0,0,0,0);
    central->setContentsMargins(0,0,0,0);
    QVBoxLayout *mainLayout = new QVBoxLayout(central);
    mainLayout->setSpacing(0);
    mainLayout->setContentsMargins(0,0,0,0);
#ifndef Q_OS_MAC // nonmac toolbar on main view -- its not 
                 // unified with the title bar.
    mainLayout->addWidget(head);
#endif
    mainLayout->addWidget(scopebar);
    mainLayout->addWidget(tab);
    setCentralWidget(central);

    /*----------------------------------------------------------------------
     * Application Menus
     *--------------------------------------------------------------------*/
#ifdef WIN32
    menuBar()->setStyleSheet("QMenuBar { background: rgba(225,225,225); }"
		    	     "QMenuBar::item { background: rgba(225,225,225); }");
    menuBar()->setContentsMargins(0,0,0,0);
#endif

    QMenu *fileMenu = menuBar()->addMenu(tr("&Athlete"));
    fileMenu->addAction(tr("&New..."), this, SLOT(newCyclist()), tr("Ctrl+N"));
    fileMenu->addAction(tr("&Open..."), this, SLOT(openCyclist()), tr("Ctrl+O"));
    fileMenu->addAction(tr("&Close Window"), this, SLOT(close()), tr ("Ctrl+W"));
    fileMenu->addAction(tr("&Quit All Windows"), this, SLOT(closeAll()), tr("Ctrl+Q"));

    QMenu *rideMenu = menuBar()->addMenu(tr("A&ctivity"));
    rideMenu->addAction(tr("&Download from device..."), this, SLOT(downloadRide()), tr("Ctrl+D"));
    rideMenu->addAction(tr("&Import from file..."), this, SLOT (importFile()), tr ("Ctrl+I"));
    rideMenu->addAction(tr("&Manual activity entry..."), this, SLOT(manualRide()), tr("Ctrl+M"));
    rideMenu->addSeparator ();
    rideMenu->addAction(tr("&Export..."), this, SLOT(exportRide()), tr("Ctrl+E"));
    rideMenu->addAction(tr("&Batch export..."), this, SLOT(exportBatch()), tr("Ctrl+B"));
    rideMenu->addAction(tr("Export Metrics as CSV..."), this, SLOT(exportMetrics()), tr(""));
#ifdef GC_HAVE_SOAP
    rideMenu->addSeparator ();
    rideMenu->addAction(tr("&Upload to TrainingPeaks"), this, SLOT(uploadTP()), tr("Ctrl+U"));
    rideMenu->addAction(tr("Down&load from TrainingPeaks..."), this, SLOT(downloadTP()), tr("Ctrl+L"));
#endif

#ifdef GC_HAVE_LIBOAUTH
    tweetAction = new QAction(tr("Tweet Activity"), this);
    connect(tweetAction, SIGNAL(triggered(bool)), this, SLOT(tweetRide()));
    rideMenu->addAction(tweetAction);

    shareAction = new QAction(tr("Share (Strava, RideWithGPS, CyclingAnalytics)..."), this);
    connect(shareAction, SIGNAL(triggered(bool)), this, SLOT(share()));
    rideMenu->addAction(shareAction);
#endif

    ttbAction = new QAction(tr("Upload to Trainingstagebuch..."), this);
    connect(ttbAction, SIGNAL(triggered(bool)), this, SLOT(uploadTtb()));
    rideMenu->addAction(ttbAction);

    rideMenu->addSeparator ();
    rideMenu->addAction(tr("&Save activity"), this, SLOT(saveRide()), tr("Ctrl+S"));
    rideMenu->addAction(tr("D&elete activity..."), this, SLOT(deleteRide()));
    rideMenu->addAction(tr("Split &activity..."), this, SLOT(splitRide()));
    rideMenu->addAction(tr("Merge activities..."), this, SLOT(mergeRide()));
    rideMenu->addSeparator ();

    QMenu *optionsMenu = menuBar()->addMenu(tr("&Tools"));
    optionsMenu->addAction(tr("&Options..."), this, SLOT(showOptions()));
    optionsMenu->addAction(tr("Critical Power Estimator..."), this, SLOT(showTools()));
    optionsMenu->addAction(tr("Air Density (Rho) Estimator..."), this, SLOT(showRhoEstimator()));

    optionsMenu->addSeparator();
    optionsMenu->addAction(tr("Get &Withings Data..."), this,
                        SLOT (downloadMeasures()));
    optionsMenu->addAction(tr("Get &Zeo Data..."), this,
                        SLOT (downloadMeasuresFromZeo()));
    optionsMenu->addSeparator();
    optionsMenu->addAction(tr("Create a new workout..."), this, SLOT(showWorkoutWizard()));
    optionsMenu->addAction(tr("Download workouts from ErgDB..."), this, SLOT(downloadErgDB()));
    optionsMenu->addAction(tr("Import workouts or videos..."), this, SLOT(importWorkout()));
    optionsMenu->addAction(tr("Scan disk for videos and workouts..."), this, SLOT(manageLibrary()));

#ifdef GC_HAVE_ICAL
    optionsMenu->addSeparator();
    optionsMenu->addAction(tr("Upload Activity to Calendar"), this, SLOT(uploadCalendar()), tr (""));
    //optionsMenu->addAction(tr("Import Calendar..."), this, SLOT(importCalendar()), tr ("")); // planned for v3.1
    //optionsMenu->addAction(tr("Export Calendar..."), this, SLOT(exportCalendar()), tr ("")); // planned for v3.1
    optionsMenu->addAction(tr("Refresh Calendar"), this, SLOT(refreshCalendar()), tr (""));
#endif
    optionsMenu->addSeparator();
    optionsMenu->addAction(tr("Find intervals..."), this, SLOT(addIntervals()), tr (""));

    // Add all the data processors to the tools menu
    const DataProcessorFactory &factory = DataProcessorFactory::instance();
    QMap<QString, DataProcessor*> processors = factory.getProcessors();

    if (processors.count()) {

        optionsMenu->addSeparator();
        toolMapper = new QSignalMapper(this); // maps each option
        QMapIterator<QString, DataProcessor*> i(processors);
        connect(toolMapper, SIGNAL(mapped(const QString &)), this, SLOT(manualProcess(const QString &)));

        i.toFront();
        while (i.hasNext()) {
            i.next();
            // The localized processor name is shown in menu
            QAction *action = new QAction(QString("%1...").arg(i.value()->name()), this);
            optionsMenu->addAction(action);
            connect(action, SIGNAL(triggered()), toolMapper, SLOT(map()));
            toolMapper->setMapping(action, i.key());
        }
    }
Example #12
0
Exif::SearchDialog::SearchDialog( QWidget* parent )
    : KPageDialog( parent )
{
    setWindowTitle( i18n("EXIF Search") );
    QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok|QDialogButtonBox::Cancel|QDialogButtonBox::Help);
    QWidget *mainWidget = new QWidget(this);
    QVBoxLayout *mainLayout = new QVBoxLayout;
    setLayout(mainLayout);
    mainLayout->addWidget(mainWidget);
    QPushButton *okButton = buttonBox->button(QDialogButtonBox::Ok);
    okButton->setDefault(true);
    okButton->setShortcut(Qt::CTRL | Qt::Key_Return);
    connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
    connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
    //PORTING SCRIPT: WARNING mainLayout->addWidget(buttonBox) must be last item in layout. Please move it.
    mainLayout->addWidget(buttonBox);
    setFaceType( Tabbed );

    QWidget* settings = new QWidget;
    KPageWidgetItem* page = new KPageWidgetItem( settings, i18n("Settings" ) );

    addPage(  page );
    QVBoxLayout* vlay = new QVBoxLayout( settings );

    // Iso, Exposure, Aperture, FNumber
    QHBoxLayout* hlay = new QHBoxLayout;
    vlay->addLayout( hlay );
    QGridLayout* gridLayout = new QGridLayout;
    gridLayout->setSpacing( 6 );
    hlay->addLayout( gridLayout );
    hlay->addStretch( 1 );

    makeISO( gridLayout );
    makeExposureTime( gridLayout );
    hlay->addSpacing(30);

    gridLayout = new QGridLayout;
    gridLayout->setSpacing( 6 );
    hlay->addLayout( gridLayout );
    hlay->addStretch( 1 );
    m_apertureValue = makeApertureOrFNumber( i18n( "Aperture Value" ), QString::fromLatin1( "Exif_Photo_ApertureValue" ), gridLayout, 0 );
    m_fNumber = makeApertureOrFNumber( i18n( "F Number" ), QString::fromLatin1( "Exif_Photo_FNumber" ), gridLayout, 1 );

    hlay->addSpacing(30);

    // Focal length
    QHBoxLayout* focalLayout = new QHBoxLayout;
    focalLayout->setSpacing( 6 );
    hlay->addLayout( focalLayout );
    hlay->addStretch( 1 );

    QLabel* label = new QLabel( i18n( "Focal Length" ) );
    focalLayout->addWidget(label);

    m_fromFocalLength = new QSpinBox;
    focalLayout->addWidget(m_fromFocalLength);
    m_fromFocalLength->setRange( 0, 10000 );
    m_fromFocalLength->setSingleStep( 10 );

    label = new QLabel( i18nc("As in 'A range from x to y'","to"));
    focalLayout->addWidget(label);

    m_toFocalLength = new QSpinBox;
    focalLayout->addWidget(m_toFocalLength);
    m_toFocalLength->setRange( 0, 10000 );
    m_toFocalLength->setSingleStep( 10 );

    m_toFocalLength->setValue( 10000 );
    QString suffix = i18nc( "This is millimeter for focal length, like 35mm", "mm" );
    m_fromFocalLength->setSuffix( suffix );
    m_toFocalLength->setSuffix( suffix );

    connect( m_fromFocalLength, SIGNAL(valueChanged(int)), this, SLOT(fromFocalLengthChanged(int)) );
    connect( m_toFocalLength, SIGNAL(valueChanged(int)), this, SLOT(toFocalLengthChanged(int)) );

    // exposure program and Metring mode
    hlay = new QHBoxLayout;
    vlay->addLayout( hlay );
    hlay->addWidget( makeExposureProgram( settings ) );
    hlay->addWidget( makeMeteringMode( settings ) );

    vlay->addStretch( 1 );

    // ------------------------------------------------------------ Camera
    page = new KPageWidgetItem( makeCamera(), i18n("Camera") );
    addPage( page );

    // ------------------------------------------------------------ Lens
    page = new KPageWidgetItem( makeLens(), i18n("Lens") );
    addPage( page );

    // ------------------------------------------------------------ Misc
    QWidget* misc = new QWidget;
    addPage( new KPageWidgetItem( misc, i18n("Miscellaneous") ) );
    vlay = new QVBoxLayout( misc );
    vlay->addWidget( makeOrientation( misc ), 1 );

    hlay = new QHBoxLayout;
    vlay->addLayout( hlay );
    hlay->addWidget( makeContrast( misc ) );
    hlay->addWidget( makeSharpness( misc ) );
    hlay->addWidget( makeSaturation( misc ) );
    vlay->addStretch( 1 );
}
Example #13
0
AccountWidget::AccountWidget( QWidget* parent )
    : QWidget( parent )
    , TomahawkUtils::DpiScaler( this )
{
    QHBoxLayout *mainLayout = new QHBoxLayout( this );
    TomahawkUtils::unmarginLayout( mainLayout );
    setLayout( mainLayout );
    setContentsMargins( 0, scaledY( 8 ), 0, scaledY( 8 ) );

    m_imageLabel = new QLabel( this );
    mainLayout->addWidget( m_imageLabel );
    mainLayout->setSpacing( scaledX( 4 ) );

    QGridLayout* vLayout = new QGridLayout( this );
    vLayout->setSpacing( 8 );
    mainLayout->addLayout( vLayout );

    QFrame* idContainer = new QFrame( this );
    idContainer->setAttribute( Qt::WA_TranslucentBackground, false );
    vLayout->addWidget( idContainer, 0, 0 );

    QHBoxLayout* idContLayout = new QHBoxLayout( idContainer );
    idContainer->setLayout( idContLayout );
    idContainer->setContentsMargins( 0, 0, 0, 0 );
    idContLayout->setMargin( 2 );

    m_idLabel = new ElidedLabel( idContainer );
    m_idLabel->setElideMode( Qt::ElideRight );
    m_idLabel->setContentsMargins( 3, 0, 3, 0 );
    m_idLabel->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Preferred );
    m_idLabel->setAlignment( Qt::AlignLeft | Qt::AlignVCenter );
    idContLayout->addWidget( m_idLabel );

    m_spinnerWidget = new QWidget( idContainer );
    QSize spinnerSize = 16 > TomahawkUtils::defaultFontHeight()  ?
                            QSize( 16, 16 ) :
                            QSize( TomahawkUtils::defaultFontHeight(),
                                   TomahawkUtils::defaultFontHeight() );
    m_spinnerWidget->setFixedSize( spinnerSize );
    idContLayout->addWidget( m_spinnerWidget );
    m_spinnerWidget->setContentsMargins( 0, 1, 0, 0 );
    m_spinner = new AnimatedSpinner( m_spinnerWidget->size() - QSize( 2, 2 ), m_spinnerWidget );

    idContainer->setStyleSheet( QString( "QFrame {"
                                "border: 1px solid #e9e9e9;"
                                "border-radius: %1px;"
                                "background: #e9e9e9;"
                                "}" ).arg( idContainer->sizeHint().height() / 2 + 1 ) );
    idContainer->setMinimumHeight( spinnerSize.height() + 6 /*margins*/ );

    m_statusToggle = new SlideSwitchButton( this );
    m_statusToggle->setContentsMargins( 0, 0, 0, 0 );
    m_statusToggle->setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Expanding );
    m_statusToggle->setFixedSize( m_statusToggle->sizeHint() );
    QHBoxLayout *statusToggleLayout = new QHBoxLayout( this );
    vLayout->addLayout( statusToggleLayout, 0, 1, 1, 1 );
    statusToggleLayout->addStretch();
    statusToggleLayout->addWidget( m_statusToggle );

    m_inviteContainer = new UnstyledFrame( this );
    vLayout->addWidget( m_inviteContainer, 1, 0 );
    m_inviteContainer->setFrameColor( TomahawkStyle::BORDER_LINE );
    m_inviteContainer->setMinimumWidth( m_inviteContainer->logicalDpiX() * 2 );
    m_inviteContainer->setContentsMargins( 1, 1, 1, 2 );
    m_inviteContainer->setAttribute( Qt::WA_TranslucentBackground, false );
    m_inviteContainer->setStyleSheet( "background: white" );

    QHBoxLayout* containerLayout = new QHBoxLayout( m_inviteContainer );
    m_inviteContainer->setLayout( containerLayout );
    TomahawkUtils::unmarginLayout( containerLayout );
    containerLayout->setContentsMargins( 1, 1, 0, 0 );

    m_addAccountIcon = new QLabel( m_inviteContainer );
    m_addAccountIcon->setContentsMargins( 1, 0, 0, 0 );
    m_addAccountIcon->setPixmap( TomahawkUtils::defaultPixmap( TomahawkUtils::AddContact, TomahawkUtils::Original, QSize( 16, 16 ) ) );
    m_addAccountIcon->setSizePolicy( QSizePolicy::Minimum, QSizePolicy::Expanding );
    m_addAccountIcon->setAlignment( Qt::AlignCenter );
    containerLayout->addWidget( m_addAccountIcon );

    m_inviteEdit = new QLineEdit( m_inviteContainer );
    m_inviteEdit->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding );
    containerLayout->addWidget( m_inviteEdit );
    m_inviteEdit->setFrame( false );

    m_inviteButton = new QPushButton( this );
    m_inviteButton->setMinimumWidth( m_inviteButton->logicalDpiX() * 0.8 );
    m_inviteButton->setText( tr( "Invite" ) );
    m_inviteButton->setSizePolicy( QSizePolicy::Minimum, QSizePolicy::Preferred );
    vLayout->addWidget( m_inviteButton, 1, 1 );
    vLayout->setColumnStretch( 0, 1 );

#ifdef Q_OS_MAC
    layout()->setContentsMargins( 0, 0, 0, 0 );
#endif

    setInviteWidgetsEnabled( false );
}
Example #14
0
AMScanDataView::AMScanDataView(AMDatabase *database, QWidget *parent) :
	QWidget(parent)
{


	// Widgets
	browseScansView_ = new AMBrowseScansView(database);
	titleLabel_ = new QLabel();
	titleLabel_->setObjectName(QString::fromUtf8("headingLabel_"));
	titleLabel_->setStyleSheet(QString::fromUtf8("font: 20pt \"Lucida Grande\";\n"
	"color: rgb(79, 79, 79);"));
	titleLabel_->setText(QString("%1: Data").arg(AMUser::user()->name()));

	QIcon searchIcon;
	searchIcon.addFile(QString::fromUtf8(":/system-search-2.png"), QSize(), QIcon::Normal, QIcon::Off);

	// Action bar Widgets
	QHBoxLayout* actionButtonLayout = new QHBoxLayout();

	QIcon editButtonIcon;
	QString actionButtonStyle = QString::fromUtf8("QToolButton:hover {\n"
												  "	border-top: 1px solid transparent;\n"
												  "}\n"
												  "\n"
												  "QToolButton:pressed {\n"
												  "border-top: 3px solid transparent;\n"
												  "}\n"
												  "\n"
												  "QToolButton {\n"
												  "border: none;\n"
												  "}\n"
												  "\n"
												  "");

	editButtonIcon.addFile(QString::fromUtf8(":/32x32/edit-find-replace.png"), QSize(), QIcon::Normal, QIcon::Off);

	editButton_ = new QToolButton();
	editButton_->setIcon(editButtonIcon);
	editButton_->setIconSize(QSize(32, 32));
	editButton_->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
	editButton_->setAutoRaise(true);
	editButton_->setStyleSheet(actionButtonStyle);
	editButton_->setEnabled(false);
	editButton_->setToolTip("View Scans in Separate Windows");
	actionButtonLayout->addWidget(editButton_);

	QIcon compareButtonIcon;
	compareButtonIcon.addFile(QString::fromUtf8(":/32x32/preferences-desktop-theme.png"), QSize(), QIcon::Normal, QIcon::Off);

	compareButton_ = new QToolButton();
	compareButton_->setIcon(compareButtonIcon);
	compareButton_->setIconSize(QSize(32, 32));
	compareButton_->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
	compareButton_->setAutoRaise(true);
	compareButton_->setStyleSheet(actionButtonStyle);
	compareButton_->setEnabled(false);
	compareButton_->setToolTip("View Scans in Same Window");
	actionButtonLayout->addWidget(compareButton_);

	QIcon exportButtonIcon;
	exportButtonIcon.addFile(QString::fromUtf8(":/32x32/system-file-manager.png"), QSize(), QIcon::Normal, QIcon::Off);

	exportButton_ = new QToolButton();
	exportButton_->setIcon(exportButtonIcon);
	exportButton_->setIconSize(QSize(32, 32));
	exportButton_->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
	exportButton_->setAutoRaise(true);
	exportButton_->setStyleSheet(actionButtonStyle);
	exportButton_->setEnabled(false);
	exportButton_->setToolTip("Export Selected Scan(s)");
	actionButtonLayout->addWidget(exportButton_);

	QIcon configButtonIcon;
	configButtonIcon.addFile(QString::fromUtf8(":/32x32/hammer-wrench.png"), QSize(), QIcon::Normal, QIcon::Off);

	configButton_ = new QToolButton();
	configButton_->setIcon(configButtonIcon);
	configButton_->setIconSize(QSize(32, 32));
	configButton_->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
	configButton_->setAutoRaise(true);
	configButton_->setStyleSheet(actionButtonStyle);
	configButton_->setEnabled(false);
	configButton_->setToolTip("Show Scan Config(s)");
	actionButtonLayout->addWidget(configButton_);
	actionButtonLayout->addStretch();

	connect(editButton_, SIGNAL(clicked()), this, SLOT(onEditScan()));
	connect(compareButton_, SIGNAL(clicked()), this, SLOT(onCompareScans()));
	connect(exportButton_, SIGNAL(clicked()), this, SLOT(onExportScans()));
	connect(configButton_, SIGNAL(clicked()), this, SLOT(onShowScanConfiguration()));

	// Context menu
	contextMenu_  = new QMenu(this);
	QAction* editScan = contextMenu_->addAction("Edit");
	QAction* compareScans = contextMenu_->addAction("Compare");
	QAction* exportScans = contextMenu_->addAction("Export");
	QAction* viewScanConfig = contextMenu_->addAction("Show Scan Configuration");
	QAction* fixCDFile = contextMenu_->addAction("Fix CDF");
	contextMenu_->addSeparator();
	contextMenu_->addAction("Select All", browseScansView_, SLOT(selectAll()));
	contextMenu_->addAction("Clear Selection", browseScansView_, SLOT(clearSelection()));

	// Signals, Slots
	connect(editScan, SIGNAL(triggered()), this, SLOT(onEditScan()));
	connect(compareScans, SIGNAL(triggered()), this, SLOT(onCompareScans()));
	connect(exportScans, SIGNAL(triggered()), this, SLOT(onExportScans()));
	connect(viewScanConfig, SIGNAL(triggered()), this, SLOT(onShowScanConfiguration()));
	connect(fixCDFile, SIGNAL(triggered()), this, SLOT(onFixCDF()));
	connect(browseScansView_, SIGNAL(childContextMenuRequested(const QPoint&)), this, SLOT(onCustomContextMenuRequested(const QPoint&)));
	connect(browseScansView_, SIGNAL(filterChanged(bool)), this, SLOT(onFilterChanged(bool)));
	connect(browseScansView_, SIGNAL(selectionChanged()), this, SLOT(onChildViewSelectionChanged()));
	connect(browseScansView_, SIGNAL(childViewDoubleClicked(const QModelIndex&)), this, SLOT(onChildViewDoubleClicked()));

	// Layout
	QVBoxLayout* layout = new QVBoxLayout();
	layout->addWidget(titleLabel_);
	layout->addWidget(browseScansView_);
	layout->addLayout(actionButtonLayout);

	setLayout(layout);
}
Example #15
0
GameBoard::GameBoard(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::GameBoard)
{
    ui->setupUi(this);

    QPushButton *quit = new QPushButton(tr("&Quit"));
    quit->setFont(QFont("Times", 18, QFont::Bold));

    connect(quit, SIGNAL(clicked()), qApp, SLOT(quit()));

    QFrame *battleBox = new QFrame;

    battleBox->setFrameStyle(QFrame::WinPanel | QFrame::Sunken);



    battleField = new BattleField;

    QPushButton *shoot = new QPushButton(tr("&Shoot"));
    shoot->setFont(QFont("Times", 18, QFont::Bold));

    connect(shoot, SIGNAL(pressed()), battleField, SLOT(fire()));

    QPushButton *left = new QPushButton(tr("&Left"));
    left->setFont(QFont("Times", 18, QFont::Bold));

    connect(left, SIGNAL(pressed()), battleField, SLOT(goLeft()));

    QPushButton *right= new QPushButton(tr("&Right"));
    right->setFont(QFont("Times", 18, QFont::Bold));

    connect(right, SIGNAL(pressed()), battleField, SLOT(goRight()));

    QPushButton *pause= new QPushButton(tr("&Pause"));
    pause->setFont(QFont("Times", 18, QFont::Bold));

    connect(pause, SIGNAL(clicked()), this, SLOT(pause()));

    QPushButton *stop= new QPushButton(tr("&Stop"));
    stop->setFont(QFont("Times", 18, QFont::Bold));

    connect(stop, SIGNAL(clicked()), this, SLOT(stop()));

    QPushButton *restart = new QPushButton(tr("&New Game"));
    restart->setFont(QFont("Times", 18, QFont::Bold));

    connect(restart, SIGNAL(clicked()), this, SLOT(newGame()));

    hits = new QLCDNumber(2);
    hits->setSegmentStyle(QLCDNumber::Filled);

    missed = new QLCDNumber(2);
    missed->setSegmentStyle(QLCDNumber::Filled);

    timeLeft = new QLCDNumber(2);
    timeLeft->setSegmentStyle(QLCDNumber::Filled);

    QLabel *hitsLabel = new QLabel(tr("HITS"));
    QLabel *missedLabel = new QLabel(tr("MISSED"));
    QLabel *timeLeftLabel = new QLabel(tr("TIME LEFT"));


    (void) new QShortcut(Qt::Key_Space, battleField, SLOT(fire()));

    (void) new QShortcut(Qt::Key_Left, battleField, SLOT(goLeft()));

    (void) new QShortcut(Qt::Key_Right, battleField, SLOT(goRight()));

    (void) new QShortcut(Qt::Key_P, this, SLOT(pause()));

    (void) new QShortcut(Qt::Key_S, this, SLOT(stop()));

    (void) new QShortcut(Qt::Key_N, this, SLOT(newGame()));

    (void) new QShortcut(Qt::Key_X, this, SLOT(close()));


    QHBoxLayout *topLayout = new QHBoxLayout;
    topLayout->addStretch(1);
    topLayout->addWidget(restart);
    topLayout->addWidget(pause);
    topLayout->addWidget(stop);

    QVBoxLayout *leftLayout = new QVBoxLayout;
    leftLayout->addWidget(hitsLabel);
    leftLayout->addWidget(hits);
    leftLayout->addWidget(missedLabel);
    leftLayout->addWidget(missed);
    leftLayout->addWidget(timeLeftLabel);
    leftLayout->addWidget(timeLeft);


    QVBoxLayout *battleLayout = new QVBoxLayout;

    battleLayout->addWidget(battleField);
    battleBox->setLayout(battleLayout);

    QGridLayout *gridLayout = new QGridLayout;
    gridLayout->addWidget(quit, 0, 0);
    gridLayout->addLayout(topLayout, 0, 1);
    gridLayout->addLayout(leftLayout, 1, 0);
    gridLayout->addWidget(battleBox, 1, 1, 2, 1);
    gridLayout->setColumnStretch(1, 10);

    QHBoxLayout *bottomLayout = new QHBoxLayout;
    bottomLayout->addWidget(left);
    bottomLayout->addWidget(shoot);
    bottomLayout->addWidget(right);

    gridLayout->addLayout(bottomLayout, 3, 1);

    setLayout(gridLayout);

    newGame();
}
Example #16
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("Litecoin") + " - " + 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);
}
VESPERSEXAFSScanConfigurationView::VESPERSEXAFSScanConfigurationView(VESPERSEXAFSScanConfiguration *config, QWidget *parent)
	: VESPERSScanConfigurationView(parent)
{
	configuration_ = config;
	AMTopFrame *frame = new AMTopFrame("VESPERS EXAFS Configuration");

	// Regions setup
	regionsView_ = new AMEXAFSScanAxisView("", configuration_);

	QVBoxLayout *regionsViewLayout = new QVBoxLayout;
	regionsViewLayout->addWidget(regionsView_);

	QGroupBox *regionsViewGroupBox = new QGroupBox("Regions Setup");
	regionsViewGroupBox->setLayout(regionsViewLayout);

	// The fluorescence detector setup
	fluorescenceDetectorComboBox_  = createFluorescenceComboBox();
	connect(fluorescenceDetectorComboBox_, SIGNAL(currentIndexChanged(int)), this, SLOT(onFluorescenceChoiceChanged(int)));
	connect(configuration_->dbObject(), SIGNAL(fluorescenceDetectorChanged(int)), this, SLOT(updateFluorescenceDetectorComboBox(int)));
	fluorescenceDetectorComboBox_->setCurrentIndex((int)configuration_->fluorescenceDetector());

	// Ion chamber selection
	itComboBox_ = createIonChamberComboBox();
	connect(itComboBox_, SIGNAL(currentIndexChanged(int)), this, SLOT(onItClicked(int)));
	connect(configuration_->dbObject(), SIGNAL(transmissionChoiceChanged(int)), this, SLOT(updateItComboBox(int)));

	i0ComboBox_ = createIonChamberComboBox();
	connect(i0ComboBox_, SIGNAL(currentIndexChanged(int)), this, SLOT(onI0Clicked(int)));
	connect(configuration_->dbObject(), SIGNAL(incomingChoiceChanged(int)), this, SLOT(updateI0ComboBox(int)));

	QHBoxLayout *ionChambersLayout = new QHBoxLayout;
	ionChambersLayout->addWidget(i0ComboBox_);
	ionChambersLayout->addWidget(itComboBox_);

	// Scan name selection
	scanName_ = createScanNameView(configuration_->name());
	connect(scanName_, SIGNAL(editingFinished()), this, SLOT(onScanNameEdited()));
	connect(configuration_, SIGNAL(nameChanged(QString)), scanName_, SLOT(setText(QString)));
	onScanNameEdited();

	// The estimated scan time.
	estimatedTime_ = new QLabel;
	connect(configuration_, SIGNAL(totalTimeChanged(double)), this, SLOT(onEstimatedTimeChanged()));
	onEstimatedTimeChanged();

	QFormLayout *scanNameLayout = new QFormLayout;
	scanNameLayout->addRow("Scan Name:", scanName_);
	scanNameLayout->addRow(estimatedTime_);

	QGroupBox *scanNameGroupBox = new QGroupBox("Scan Name");
	scanNameGroupBox->setLayout(scanNameLayout);

	// Energy (Eo) selection
	energy_ = new QDoubleSpinBox;
	energy_->setSuffix(" eV");
	energy_->setMinimum(0);
	energy_->setMaximum(30000);
	connect(energy_, SIGNAL(editingFinished()), this, SLOT(setEnergy()));

	elementChoice_ = new QToolButton;
	connect(elementChoice_, SIGNAL(clicked()), this, SLOT(onElementChoiceClicked()));

	lineChoice_ = new QComboBox;
	connect(lineChoice_, SIGNAL(currentIndexChanged(int)), this, SLOT(onLinesComboBoxIndexChanged(int)));

	if (configuration_->edge().isEmpty()){

		elementChoice_->setText("Cu");
		fillLinesComboBox(AMPeriodicTable::table()->elementBySymbol("Cu"));
		lineChoice_->setCurrentIndex(0);
	}
	// Resets the view for the view to what it should be.  Using the saved for the energy in case it is different from the original line energy.
	else
		onEdgeChanged();

	connect(configuration_, SIGNAL(edgeChanged(QString)), this, SLOT(onEdgeChanged()));

	QFormLayout *energySetpointLayout = new QFormLayout;
	energySetpointLayout->addRow("Energy:", energy_);

	QHBoxLayout *energyLayout = new QHBoxLayout;
	energyLayout->addLayout(energySetpointLayout);
	energyLayout->addWidget(elementChoice_);
	energyLayout->addWidget(lineChoice_);

	// Setting the scan position.
	QGroupBox *goToPositionGroupBox = addGoToPositionView(configuration_->goToPosition(), configuration_->x(), configuration_->y());

	connect(configuration_, SIGNAL(gotoPositionChanged(bool)), goToPositionCheckBox_, SLOT(setChecked(bool)));
	connect(goToPositionCheckBox_, SIGNAL(toggled(bool)), configuration_, SLOT(setGoToPosition(bool)));
	connect(goToPositionCheckBox_, SIGNAL(toggled(bool)), setCurrentPositionButton_, SLOT(setEnabled(bool)));
	connect(goToPositionCheckBox_, SIGNAL(toggled(bool)), savedXPosition_, SLOT(setEnabled(bool)));
	connect(goToPositionCheckBox_, SIGNAL(toggled(bool)), savedYPosition_, SLOT(setEnabled(bool)));
	connect(goToPositionCheckBox_, SIGNAL(toggled(bool)), positionsSaved_, SLOT(setEnabled(bool)));
	connect(setCurrentPositionButton_, SIGNAL(clicked()), this, SLOT(setScanPosition()));
	connect(configuration_->dbObject(), SIGNAL(motorChanged(int)), this, SLOT(onMotorsUpdated(int)));

	onMotorsUpdated(configuration_->motor());

	// Label showing where the data will be saved.
	QLabel *exportPath = addExportPathLabel();

	// Default XANES and EXAFS buttons.
	QPushButton *defaultXANESButton = new QPushButton("Default XANES");
	connect(defaultXANESButton, SIGNAL(clicked()), this, SLOT(setupDefaultXANESScanRegions()));
	QPushButton *defaultEXAFSButton = new QPushButton("Default EXAFS");
	connect(defaultEXAFSButton, SIGNAL(clicked()), this, SLOT(setupDefaultEXAFSScanRegions()));

	// Setting up the steps to show the time offset for scan time estimation.
	connect(this, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(onCustomContextMenuRequested(QPoint)));
	setContextMenuPolicy(Qt::CustomContextMenu);

	QGroupBox *timeOffsetBox = addTimeOffsetLabel(configuration_->timeOffset());
	connect(timeOffset_, SIGNAL(valueChanged(double)), this, SLOT(setTimeOffset(double)));

	// Auto-export option.
	QGroupBox *autoExportGroupBox = addExporterOptionsView(QStringList(), configuration_->exportSpectraSources(), configuration_->exportSpectraInRows());
	connect(autoExportSpectra_, SIGNAL(toggled(bool)), configuration_, SLOT(setExportSpectraSources(bool)));
	connect(autoExportSpectra_, SIGNAL(toggled(bool)), exportSpectraInRows_, SLOT(setEnabled(bool)));
	connect(exportSpectraInRows_, SIGNAL(toggled(bool)), this, SLOT(updateExportSpectraInRows(bool)));

	fluorescenceDetectorComboBox_->setCurrentIndex((int)configuration_->fluorescenceDetector());
	i0ComboBox_->setCurrentIndex((int)configuration_->incomingChoice());
	itComboBox_->setCurrentIndex((int)configuration_->transmissionChoice());

	disableStandardI0Options();
	disableStandardItOptions();

	QVBoxLayout *defaultLayout = new QVBoxLayout;
	defaultLayout->addSpacing(35);
	defaultLayout->addWidget(defaultXANESButton);
	defaultLayout->addWidget(defaultEXAFSButton);
	defaultLayout->addStretch();

	QFormLayout *detectorLayout = new QFormLayout;
	detectorLayout->addRow("XRF:", fluorescenceDetectorComboBox_);
	detectorLayout->addRow("I0:", i0ComboBox_);
	detectorLayout->addRow("It:", itComboBox_);

	QGroupBox *detectorGroupBox = new QGroupBox("Detectors");
	detectorGroupBox->setLayout(detectorLayout);

	QGroupBox *afterScanBox = createAfterScanOptionsBox(configuration_->closeFastShutter(), configuration_->returnToOriginalPosition(), configuration_->cleanupScaler());
	connect(closeFastShutterCheckBox_, SIGNAL(toggled(bool)), this, SLOT(setCloseFastShutter(bool)));
//	connect(goToPositionCheckBox_, SIGNAL(toggled(bool)), this, SLOT(setReturnToOriginalPosition(bool)));
	connect(cleanupScalerCheckBox_, SIGNAL(toggled(bool)), this, SLOT(setCleanupScaler(bool)));

	goToPositionCheckBox_->setDisabled(true);

	// Setting up the layout.
	QGridLayout *contentsLayout = new QGridLayout;
	contentsLayout->addLayout(energyLayout, 0, 0, 1, 3);
	contentsLayout->addWidget(regionsViewGroupBox, 1, 0, 2, 3);
	contentsLayout->addWidget(scanNameGroupBox, 3, 0, 1, 2);
	contentsLayout->addWidget(goToPositionGroupBox, 4, 0, 1, 1);
	contentsLayout->addWidget(timeOffsetBox, 5, 0, 1, 1);
	contentsLayout->addWidget(detectorGroupBox, 3, 2, 1, 1);
	contentsLayout->addWidget(autoExportGroupBox, 4, 1, 1, 2);
	contentsLayout->addWidget(afterScanBox, 5, 2, 1, 1);

	QHBoxLayout *squeezeContents = new QHBoxLayout;
	squeezeContents->addStretch();
	squeezeContents->addLayout(defaultLayout);
	squeezeContents->addLayout(contentsLayout);
	squeezeContents->addStretch();

	QVBoxLayout *configViewLayout = new QVBoxLayout;
	configViewLayout->addWidget(frame);
	configViewLayout->addStretch();
	configViewLayout->addSpacing(30);
	configViewLayout->addLayout(squeezeContents);
	configViewLayout->addSpacing(30);
	configViewLayout->addWidget(exportPath, 0, Qt::AlignCenter);
	configViewLayout->addStretch();

	setLayout(configViewLayout);
}
Example #18
0
IncrementalSearchBar::IncrementalSearchBar(QWidget* aParent)
    : QWidget(aParent)
    , _foundMatch(false)
    , _searchEdit(0)
    , _caseSensitive(0)
    , _regExpression(0)
    , _highlightMatches(0)
{
    QHBoxLayout* barLayout = new QHBoxLayout(this);

    QToolButton* closeButton = new QToolButton(this);
    closeButton->setObjectName(QLatin1String("close-button"));
    closeButton->setToolTip(i18n("Close the search bar"));
    closeButton->setAutoRaise(true);
    closeButton->setIcon(KIcon("dialog-close"));
    connect(closeButton , SIGNAL(clicked()) , this , SIGNAL(closeClicked()));

    QLabel* findLabel = new QLabel(i18n("Find:"), this);
    _searchEdit = new KLineEdit(this);
    _searchEdit->setClearButtonShown(true);
    _searchEdit->installEventFilter(this);
    _searchEdit->setObjectName(QLatin1String("search-edit"));
    _searchEdit->setToolTip(i18n("Enter the text to search for here"));

    // text box may be a minimum of 6 characters wide and a maximum of 10 characters wide
    // (since the maxWidth metric is used here, more characters probably will fit in than 6
    //  and 10)
    QFontMetrics metrics(_searchEdit->font());
    int maxWidth = metrics.maxWidth();
    _searchEdit->setMinimumWidth(maxWidth * 6);
    _searchEdit->setMaximumWidth(maxWidth * 10);

    _searchTimer = new QTimer(this);
    _searchTimer->setInterval(250);
    _searchTimer->setSingleShot(true);
    connect(_searchTimer , SIGNAL(timeout()) , this , SLOT(notifySearchChanged()));
    connect(_searchEdit , SIGNAL(clearButtonClicked()) , this , SLOT(clearLineEdit()));
    connect(_searchEdit , SIGNAL(textChanged(QString)) , _searchTimer , SLOT(start()));

    QToolButton* findNext = new QToolButton(this);
    findNext->setObjectName(QLatin1String("find-next-button"));
    findNext->setText(i18nc("@action:button Go to the next phrase", "Next"));
    findNext->setIcon(KIcon("go-down-search"));
    findNext->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
    findNext->setToolTip(i18n("Find the next match for the current search phrase"));
    connect(findNext , SIGNAL(clicked()) , this , SIGNAL(findNextClicked()));

    QToolButton* findPrev = new QToolButton(this);
    findPrev->setObjectName(QLatin1String("find-previous-button"));
    findPrev->setText(i18nc("@action:button Go to the previous phrase", "Previous"));
    findPrev->setIcon(KIcon("go-up-search"));
    findPrev->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
    findPrev->setToolTip(i18n("Find the previous match for the current search phrase"));
    connect(findPrev , SIGNAL(clicked()) , this , SIGNAL(findPreviousClicked()));

    QToolButton* optionsButton = new QToolButton(this);
    optionsButton->setObjectName(QLatin1String("find-options-button"));
    optionsButton->setText(i18nc("@action:button Display options menu", "Options"));
    optionsButton->setCheckable(false);
    optionsButton->setPopupMode(QToolButton::InstantPopup);
    optionsButton->setArrowType(Qt::DownArrow);
    optionsButton->setToolButtonStyle(Qt::ToolButtonTextOnly);
    optionsButton->setToolTip(i18n("Display the options menu"));

    barLayout->addWidget(closeButton);
    barLayout->addWidget(findLabel);
    barLayout->addWidget(_searchEdit);
    barLayout->addWidget(findNext);
    barLayout->addWidget(findPrev);
    barLayout->addWidget(optionsButton);

    // Fill the options menu
    QMenu* optionsMenu = new QMenu(this);
    optionsButton->setMenu(optionsMenu);

    _caseSensitive = optionsMenu->addAction(i18n("Case sensitive"));
    _caseSensitive->setCheckable(true);
    _caseSensitive->setToolTip(i18n("Sets whether the search is case sensitive"));
    connect(_caseSensitive, SIGNAL(toggled(bool)),
            this, SIGNAL(matchCaseToggled(bool)));

    _regExpression = optionsMenu->addAction(i18n("Match regular expression"));
    _regExpression->setCheckable(true);
    connect(_regExpression, SIGNAL(toggled(bool)),
            this, SIGNAL(matchRegExpToggled(bool)));

    _highlightMatches = optionsMenu->addAction(i18n("Highlight all matches"));
    _highlightMatches->setCheckable(true);
    _highlightMatches->setToolTip(i18n("Sets whether matching text should be highlighted"));
    _highlightMatches->setChecked(true);
    connect(_highlightMatches, SIGNAL(toggled(bool)),
            this, SIGNAL(highlightMatchesToggled(bool)));

    barLayout->addStretch();

    barLayout->setContentsMargins(4, 4, 4, 4);

    setLayout(barLayout);
}
Example #19
0
InstrumentMidiIOView::InstrumentMidiIOView( QWidget* parent ) :
	QWidget( parent ),
	ModelView( NULL, this ),
	m_rpBtn( NULL ),
	m_wpBtn( NULL )
{
	QVBoxLayout* layout = new QVBoxLayout( this );
	layout->setMargin( 5 );
	m_midiInputGroupBox = new groupBox( tr( "ENABLE MIDI INPUT" ) );
	layout->addWidget( m_midiInputGroupBox );

	QHBoxLayout* midiInputLayout = new QHBoxLayout( m_midiInputGroupBox );
	midiInputLayout->setContentsMargins( 8, 18, 8, 8 );
	midiInputLayout->setSpacing( 6 );

	m_inputChannelSpinBox = new LcdSpinBox( 2, m_midiInputGroupBox );
	m_inputChannelSpinBox->addTextForValue( 0, "--" );
	m_inputChannelSpinBox->setLabel( tr( "CHANNEL" ) );
	m_inputChannelSpinBox->setEnabled( false );
	midiInputLayout->addWidget( m_inputChannelSpinBox );

	m_fixedInputVelocitySpinBox = new LcdSpinBox( 3, m_midiInputGroupBox );
	m_fixedInputVelocitySpinBox->setDisplayOffset( 1 );
	m_fixedInputVelocitySpinBox->addTextForValue( 0, "---" );
	m_fixedInputVelocitySpinBox->setLabel( tr( "VELOCITY" ) );
	m_fixedInputVelocitySpinBox->setEnabled( false );
	midiInputLayout->addWidget( m_fixedInputVelocitySpinBox );
	midiInputLayout->addStretch();

	connect( m_midiInputGroupBox->ledButton(), SIGNAL( toggled( bool ) ),
			m_inputChannelSpinBox, SLOT( setEnabled( bool ) ) );
	connect( m_midiInputGroupBox->ledButton(), SIGNAL( toggled( bool ) ),
		m_fixedInputVelocitySpinBox, SLOT( setEnabled( bool ) ) );



	m_midiOutputGroupBox = new groupBox( tr( "ENABLE MIDI OUTPUT" ) );
	layout->addWidget( m_midiOutputGroupBox );

	QHBoxLayout* midiOutputLayout = new QHBoxLayout( m_midiOutputGroupBox );
	midiOutputLayout->setContentsMargins( 8, 18, 8, 8 );
	midiOutputLayout->setSpacing( 6 );

	m_outputChannelSpinBox = new LcdSpinBox( 2, m_midiOutputGroupBox );
	m_outputChannelSpinBox->setLabel( tr( "CHANNEL" ) );
	m_outputChannelSpinBox->setEnabled( false );
	midiOutputLayout->addWidget( m_outputChannelSpinBox );

	m_fixedOutputVelocitySpinBox = new LcdSpinBox( 3, m_midiOutputGroupBox );
	m_fixedOutputVelocitySpinBox->setDisplayOffset( 1 );
	m_fixedOutputVelocitySpinBox->addTextForValue( 0, "---" );
	m_fixedOutputVelocitySpinBox->setLabel( tr( "VELOCITY" ) );
	m_fixedOutputVelocitySpinBox->setEnabled( false );
	midiOutputLayout->addWidget( m_fixedOutputVelocitySpinBox );

	m_outputProgramSpinBox = new LcdSpinBox( 3, m_midiOutputGroupBox );
	m_outputProgramSpinBox->setLabel( tr( "PROGRAM" ) );
	m_outputProgramSpinBox->setEnabled( false );
	midiOutputLayout->addWidget( m_outputProgramSpinBox );

	m_fixedOutputNoteSpinBox = new LcdSpinBox( 3, m_midiOutputGroupBox );
	m_fixedOutputNoteSpinBox->setDisplayOffset( 1 );
	m_fixedOutputNoteSpinBox->addTextForValue( 0, "---" );
	m_fixedOutputNoteSpinBox->setLabel( tr( "NOTE" ) );
	m_fixedOutputNoteSpinBox->setEnabled( false );
	midiOutputLayout->addWidget( m_fixedOutputNoteSpinBox );
	midiOutputLayout->addStretch();

	connect( m_midiOutputGroupBox->ledButton(), SIGNAL( toggled( bool ) ),
			m_outputChannelSpinBox, SLOT( setEnabled( bool ) ) );
	connect( m_midiOutputGroupBox->ledButton(), SIGNAL( toggled( bool ) ),
		m_fixedOutputVelocitySpinBox, SLOT( setEnabled( bool ) ) );
	connect( m_midiOutputGroupBox->ledButton(), SIGNAL( toggled( bool ) ),
			m_outputProgramSpinBox, SLOT( setEnabled( bool ) ) );
	connect( m_midiOutputGroupBox->ledButton(), SIGNAL( toggled( bool ) ),
		m_fixedOutputNoteSpinBox, SLOT( setEnabled( bool ) ) );

	if( !engine::mixer()->midiClient()->isRaw() )
	{
		m_rpBtn = new QToolButton;
		m_rpBtn->setMinimumSize( 32, 32 );
		m_rpBtn->setText( tr( "MIDI devices to receive MIDI events from" ) );
		m_rpBtn->setIcon( embed::getIconPixmap( "piano" ) );
		m_rpBtn->setPopupMode( QToolButton::InstantPopup );
		midiInputLayout->insertSpacing( 0, 4 );
		midiInputLayout->insertWidget( 0, m_rpBtn );

		m_wpBtn = new QToolButton;
		m_wpBtn->setMinimumSize( 32, 32 );
		m_wpBtn->setText( tr( "MIDI devices to send MIDI events to" ) );
		m_wpBtn->setIcon( embed::getIconPixmap( "piano" ) );
		m_wpBtn->setPopupMode( QToolButton::InstantPopup );
		midiOutputLayout->insertSpacing( 0, 4 );
		midiOutputLayout->insertWidget( 0, m_wpBtn );
	}

#define PROVIDE_CUSTOM_BASE_VELOCITY_UI
#ifdef PROVIDE_CUSTOM_BASE_VELOCITY_UI
	groupBox* baseVelocityGroupBox = new groupBox( tr( "CUSTOM BASE VELOCITY" ) );
	layout->addWidget( baseVelocityGroupBox );

	QVBoxLayout* baseVelocityLayout = new QVBoxLayout( baseVelocityGroupBox );
	baseVelocityLayout->setContentsMargins( 8, 18, 8, 8 );
	baseVelocityLayout->setSpacing( 6 );

	QLabel* baseVelocityHelp = new QLabel( tr( "Specify the velocity normalization base for MIDI-based instruments at note volume 100%" ) );
	baseVelocityHelp->setWordWrap( true );
    baseVelocityHelp->setFont( pointSize<8>( baseVelocityHelp->font() ) );

	baseVelocityLayout->addWidget( baseVelocityHelp );

	m_baseVelocitySpinBox = new LcdSpinBox( 3, baseVelocityGroupBox );
	m_baseVelocitySpinBox->setLabel( tr( "BASE VELOCITY" ) );
	m_baseVelocitySpinBox->setEnabled( false );
	baseVelocityLayout->addWidget( m_baseVelocitySpinBox );

	connect( baseVelocityGroupBox->ledButton(), SIGNAL( toggled( bool ) ),
			m_baseVelocitySpinBox, SLOT( setEnabled( bool ) ) );
#endif

	layout->addStretch();
}
Example #20
0
cal2::cal2(QWidget *parent)
    : QWidget(parent)
{

    initBasicData();
//--------------------------顶层--------------------------------------------------------------
    QFont font1;
    font1.setPixelSize(15);

    QPalette palette1;
    palette1.setColor(QPalette::WindowText,QColor(155,155,155,255));

    today = new ClickedLabel;
    today->setFont(font1);
    today->setPalette(palette1);
    today->setText(tr("Today"));
    connect(today,SIGNAL(clicked(ClickedLabel*)),this,SLOT(todayOnClicked()));

    pre = new ClickedLabel;
    pre->setFont(font1);
    pre->setPalette(palette1);
    pre->setText(tr("PRE"));
    connect(pre,SIGNAL(clicked(ClickedLabel*)),this,SLOT(preOnClicked()));

    next = new ClickedLabel;
    next->setFont(font1);
    next->setPalette(palette1);
    next->setText(tr("NEXT"));
    connect(next,SIGNAL(clicked(ClickedLabel*)),this,SLOT(nextOnClicked()));

    month = new ClickedLabel;
    month->setFont(font1);
    month->setPalette(palette1);

    year = new ClickedLabel;
    year->setFont(font1);
    year->setPalette(palette1);

    QHBoxLayout *toplayout = new QHBoxLayout;
    toplayout->addWidget(today);
    toplayout->addStretch();
    toplayout->addWidget(pre);
    toplayout->addSpacing(20);
    toplayout->addWidget(month);
    toplayout->addSpacing(5);
    toplayout->addWidget(year);
    toplayout->addSpacing(20);
    toplayout->addWidget(next);
    toplayout->addStretch();

//--------------------------顶层结束----------------------------------------------------------



//---------------------------星期---------------------------------------------------------------
    QString weekstr[7]={"MON","TUE","WED","THU","FRI","SAT","SUN"};
    QHBoxLayout* weeklayout = new QHBoxLayout;
    weeklayout->setSpacing(0);

    QFont font2;
    font2.setPixelSize(15);
    QPalette palette2;
    palette2.setColor(QPalette::WindowText,QColor(155,155,155,255));

    for(int i=0;i<7;i++)
    {
        QLabel* label = new QLabel(tr("%1").arg(weekstr[i]));
        label->setFont(font2);
        label->setPalette(palette2);
        label->setAlignment(Qt::AlignBottom|Qt::AlignHCenter);
        label->setFixedHeight(20);
        weeklayout->addWidget(label);
    }


    QVBoxLayout *toplayout2 = new QVBoxLayout;
    toplayout2->addLayout(toplayout);
    toplayout2->addLayout(weeklayout);
    QWidget *topwidget = new QWidget;
    topwidget->setLayout(toplayout2);
    topwidget->setFixedHeight(70);
    topwidget->setAutoFillBackground(true);
    QPalette pet;
    pet.setColor(QPalette::Background,QColor(50,58,69));
    topwidget->setPalette(pet);
    topwidget->setFixedHeight(100);
    //topwidget->setStyleSheet("background-color: rgb(50,58,69)");

//---------------------------星期结束---------------------------------------------------------------



//----------------------------月历----------------------------------------------------------------
    QGridLayout* grid = new QGridLayout;
    grid->setSpacing(1);

    int row,col,num;
    for(row=0;row<6;row++)
        for(col=1;col<=7;col++)
        {
            num =row*7+col;
            labels[num] = new cal_label;

            QPalette lpa;
            lpa.setColor(QPalette::WindowText,QColor(200,200,200));
            labels[num]->lunarday->setPalette(lpa);
            connect(labels[num],SIGNAL(clicked(cal_label*)),this,SLOT(changeday(cal_label*)));
            grid->addWidget(labels[num],row,col-1);
        }

    QVBoxLayout* mainlayout = new QVBoxLayout();
    //mainlayout->setSpacing(0);
    mainlayout->addWidget(topwidget);
    mainlayout->addLayout(grid);


    QFont rtfont1;
    rtfont1.setPixelSize(30);
    righttop = new QLabel;
    righttop->setFont(rtfont1);
    righttop->setStyleSheet("color:white;background-color:rgb(20,185,214)");
    righttop->setFixedSize(360,100);
    //righttop->setAlignment(Qt::AlignCenter);
    righttop->setIndent(20);

    righttop2 = new QLabel;
    rtfont1.setPixelSize(20);
    righttop2->setFont(rtfont1);
    righttop2->setFixedHeight(100);
    righttop2->setStyleSheet("color:white;background-color:grey");
    righttop2->setAlignment(Qt::AlignCenter);
    //righttop2->setIndent(30);

    QVBoxLayout *rtlayout = new QVBoxLayout;
    rtlayout->addWidget(righttop);
    rtlayout->addWidget(righttop2);
    rtlayout->setSpacing(0);

//    QLabel *rtwidget = new QLabel;
//    rtwidget->setLayout(rtlayout);
//    rtwidget->setFixedHeight(200);
//    rtwidget->setStyleSheet("background-color:rgb(107,203,202)");
//    //rtwidget->setPalette(pet);

    todaylist = new QListWidget;
    QFont f1;
    f1.setPixelSize(20);
    todaylist->setFont(f1);
    //todaylist->setStyleSheet("background-color:rgb(24,34,144)");

    QVBoxLayout *right1 = new QVBoxLayout;
    right1->addLayout(rtlayout);
    right1->addWidget(todaylist);

    QHBoxLayout *lastlayout = new QHBoxLayout(this);
    lastlayout->setSpacing(1);
    lastlayout->addLayout(mainlayout);
    lastlayout->addLayout(right1);
    lastlayout->setMargin(0);

    newCal();

}
Example #21
0
MainWidget::MainWidget(QWidget *parent)
    : QWidget(parent)
    , m_textLog(nullptr)
    , m_textInput(nullptr)
    , m_chatClient(nullptr)
{
    m_textLog = new QTextEdit;
    m_textLog->setReadOnly(true);

    m_textInput = new QTextEdit;

    QSplitter *splitter = new QSplitter;
    splitter->setOrientation(Qt::Vertical);
    splitter->addWidget(m_textLog);
    splitter->addWidget(m_textInput);

    QPushButton *buttonSend = new QPushButton(tr("Send"));
    QPushButton *buttonClear = new QPushButton(tr("Clear"));

    QPushButton *buttonConnect = new QPushButton(tr("connect"));
    QPushButton *buttonDisconnect = new QPushButton(tr("disconnect"));
    QLabel *labelHost = new QLabel(tr(" host:"));
    m_editHost = new QLineEdit;
    QLabel *labelPort = new QLabel(tr(" port:"));
    m_editPort = new QLineEdit;
    m_editHost->setText("localhost");
    m_editPort->setText("12345");

    QVBoxLayout *layout = new QVBoxLayout(this);
    layout->addWidget(splitter);

    QHBoxLayout *buttonLayout = new QHBoxLayout;
    buttonLayout->addStretch();
    buttonLayout->addWidget(buttonClear);
    buttonLayout->addWidget(buttonSend);
    buttonLayout->addStretch();

    layout->addLayout(buttonLayout);

    QHBoxLayout *netLayout = new QHBoxLayout;
    netLayout->addStretch();
    netLayout->addWidget(buttonConnect);
    netLayout->addWidget(buttonDisconnect);
    netLayout->addWidget(labelHost);
    netLayout->addWidget(m_editHost);
    netLayout->addWidget(labelPort);
    netLayout->addWidget(m_editPort);
    netLayout->addStretch();

    layout->addLayout(netLayout);

    resize(400,400);

    connect( buttonClear, &QPushButton::clicked, this, &MainWidget::clearClicked );
    connect( buttonSend, &QPushButton::clicked, this, &MainWidget::sendClicked );

    connect( buttonConnect, &QPushButton::clicked, this, &MainWidget::connectClicked );
    connect( buttonDisconnect, &QPushButton::clicked, this, &MainWidget::disconnectClicked );

    m_chatClient = ChatClient::instance();
    connect( m_chatClient, &ChatClient::received, this, &MainWidget::messageReceived );
}
TableDialog::TableDialog(Table *t, QWidget* parent, Qt::WFlags fl )
    : QDialog( parent, fl),
    d_table(t)
{
    setName( "TableDialog" );
    setWindowTitle( tr( "QtiPlot - Column options" ) );
    setSizeGripEnabled(true);

	QHBoxLayout *hboxa = new QHBoxLayout();
	hboxa->addWidget(new QLabel(tr( "Column Name:" )));
    colName = new QLineEdit();
    hboxa->addWidget(colName);

	enumerateAllBox = new QCheckBox(tr("Enumerate all to the right" ));

	buttonPrev = new QPushButton("&<<");
	buttonPrev->setAutoDefault(false);
	buttonPrev->setMaximumWidth(40);

	buttonNext = new QPushButton("&>>");
	buttonNext->setAutoDefault(false);
	buttonNext->setMaximumWidth(40);

	QHBoxLayout *hboxb = new QHBoxLayout();
    hboxb->addWidget(buttonPrev);
    hboxb->addWidget(buttonNext);
    hboxb->addStretch();

    QVBoxLayout *vbox1 = new QVBoxLayout();
    vbox1->addLayout(hboxa);
    vbox1->addWidget(enumerateAllBox);
    vbox1->addLayout(hboxb);

	buttonOk = new QPushButton(tr( "&OK" ));
    buttonOk->setDefault(true);

	buttonApply = new QPushButton(tr("&Apply"));
	buttonApply->setAutoDefault(false);

	buttonCancel = new QPushButton(tr( "&Cancel" ));
	buttonCancel->setAutoDefault(false);

	QVBoxLayout  *vbox2 = new QVBoxLayout();
	vbox2->setSpacing(5);
	vbox2->setMargin(5);
	vbox2->addWidget(buttonOk);
	vbox2->addWidget(buttonApply);
	vbox2->addWidget(buttonCancel);

    QHBoxLayout  *hbox1 = new QHBoxLayout();
	hbox1->setSpacing(5);
	hbox1->addLayout(vbox1);
	hbox1->addLayout(vbox2);

	QGridLayout *gl1 = new QGridLayout();
    gl1->addWidget(new QLabel( tr("Plot Designation:")), 0, 0);

   	columnsBox = new QComboBox();
	columnsBox->addItem(tr("None"));
	columnsBox->addItem(tr("X (abscissae)"));
	columnsBox->addItem(tr("Y (ordinates)"));
	columnsBox->addItem(tr("Z (height)"));
	columnsBox->addItem(tr("X Error"));
	columnsBox->addItem(tr("Y Error"));
	columnsBox->addItem(tr("Label"));
    gl1->addWidget(columnsBox, 0, 1);

    gl1->addWidget(new QLabel(tr("Display")), 1, 0);

   	displayBox = new QComboBox();
	displayBox->addItem(tr("Numeric"));
	displayBox->addItem(tr("Text"));
	displayBox->addItem(tr("Date"));
	displayBox->addItem(tr("Time"));
	displayBox->addItem(tr("Month"));
	displayBox->addItem(tr("Day of Week"));
    gl1->addWidget(displayBox, 1, 1);

    labelFormat = new QLabel(tr( "Format:" ));
 	gl1->addWidget(labelFormat, 2, 0);

    formatBox = new QComboBox(false);
    gl1->addWidget(formatBox, 2, 1);

	labelNumeric = new QLabel(tr( "Precision:" ));
	gl1->addWidget(labelNumeric, 3, 0);

    precisionBox = new QSpinBox();
    precisionBox->setRange(0, 14);
    gl1->addWidget(precisionBox, 3, 1);

    boxReadOnly = new QCheckBox(tr("&Read-only" ));
    gl1->addWidget(boxReadOnly, 4, 0);

	boxHideColumn = new QCheckBox(tr("&Hidden" ));
    gl1->addWidget(boxHideColumn, 4, 1);
	
	applyToRightCols = new QCheckBox(tr( "Apply to all columns to the right" ));

    QVBoxLayout *vbox3 = new QVBoxLayout();
    vbox3->addLayout(gl1);
    vbox3->addWidget(applyToRightCols);

    QGroupBox *gb = new QGroupBox(tr("Options"));
    gb->setLayout(vbox3);

    QHBoxLayout  *hbox2 = new QHBoxLayout();
    hbox2->addWidget(new QLabel(tr( "Column Width:" )));

	colWidth = new QSpinBox();
    colWidth->setRange(0, 1000);
	colWidth->setSingleStep(10);

	hbox2->addWidget(colWidth);

    applyToAllBox = new QCheckBox(tr( "Apply to all" ));
	hbox2->addWidget(applyToAllBox);

	comments = new QTextEdit();
	boxShowTableComments = new QCheckBox(tr("&Display Comments in Header"));
	boxShowTableComments->setChecked(d_table->commentsEnabled());

	QVBoxLayout* vbox4 = new QVBoxLayout();
    vbox4->addLayout(hbox1);
	vbox4->addWidget(gb);
	vbox4->addLayout(hbox2);
	vbox4->addWidget(new QLabel(tr( "Comment:" )));
	vbox4->addWidget(comments);
	vbox4->addWidget(boxShowTableComments);

    setLayout(vbox4);
    setFocusProxy (colName);

    updateColumn(d_table->selectedColumn());

   // signals and slots connections
	connect(colWidth, SIGNAL(valueChanged(int)), this, SLOT(setColumnWidth(int)));
	connect(buttonApply, SIGNAL(clicked()), this, SLOT(apply()));
    connect(buttonOk, SIGNAL(clicked()), this, SLOT(accept()));
    connect(buttonCancel, SIGNAL( clicked() ), this, SLOT( close() ) );
	connect(columnsBox, SIGNAL(activated(int)), this, SLOT(setPlotDesignation(int)) );
	connect(displayBox, SIGNAL(activated(int)), this, SLOT(updateDisplay(int)));
	connect(buttonPrev, SIGNAL(clicked()), this, SLOT(prevColumn()));
	connect(buttonNext, SIGNAL(clicked()), this, SLOT(nextColumn()));
	connect(formatBox, SIGNAL(activated(int)), this, SLOT(enablePrecision(int)) );
	connect(precisionBox, SIGNAL(valueChanged(int)), this, SLOT(updatePrecision(int)));
	connect(boxShowTableComments, SIGNAL(toggled(bool)), d_table, SLOT(showComments(bool)));
}
Example #23
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)
{
    // resize(850, 550);
	setFixedSize(920, 560);
    setWindowTitle(tr("ParkByte") + " - " + 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();
	blockBrowser = new BlockBrowser(this);  //block

    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(blockBrowser);   // block
    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();
}
Example #24
0
void ShortcutsModule::initGUI()
{
	kDebug(125) << "A-----------";
	KActionCollection* actionCollection = m_actionsGeneral;
// see also KShortcutsModule::init() below !!!
	QAction* a = 0L;
#define NOSLOTS
//#define KICKER_ALL_BINDINGS
#include "../../kwin/kwinbindings.cpp"
//#include "../../kicker/kicker/core/kickerbindings.cpp"
//#include "../../kicker/taskbar/taskbarbindings.cpp"
//#include "../../kdesktop/kdesktopbindings.cpp"
#include "../../klipper/klipperbindings.cpp"
#include "../kxkb/kxkbbindings.cpp"

	kDebug(125) << "B-----------";

	kDebug(125) << "C-----------";
	createActionsGeneral();
	kDebug(125) << "D-----------";
	createActionsSequence();
	kDebug(125) << "E-----------";

	kDebug(125) << "F-----------";
	QVBoxLayout* pVLayout = new QVBoxLayout( this );
	pVLayout->addSpacing( KDialog::marginHint() );

	// (o) [Current      ] <Remove>   ( ) New <Save>

	QHBoxLayout *pHLayout = new QHBoxLayout();
	pVLayout->addItem( pHLayout );
	Q3ButtonGroup* pGroup = new Q3ButtonGroup( this );
	pGroup->hide();

	m_prbPre = new QRadioButton( "", this );
	connect( m_prbPre, SIGNAL(clicked()), SLOT(slotSchemeCur()) );
	pGroup->insert( m_prbPre );
	pHLayout->addWidget( m_prbPre );

	m_pcbSchemes = new QComboBox( this );
	m_pcbSchemes->setMinimumWidth( 100 );
	m_pcbSchemes->setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Fixed );
	connect( m_pcbSchemes, SIGNAL(activated(int)), SLOT(slotSelectScheme(int)) );
	pHLayout->addWidget( m_pcbSchemes );

	pHLayout->addSpacing( KDialog::marginHint() );

	m_pbtnRemove = new QPushButton( i18n("&Remove"), this );
	m_pbtnRemove->setEnabled( false );
	connect( m_pbtnRemove, SIGNAL(clicked()), SLOT(slotRemoveScheme()) );
	m_pbtnRemove->setWhatsThis( i18n("Click here to remove the selected key bindings scheme. You cannot"
		" remove the standard system-wide schemes 'Current scheme' and 'KDE default'.") );
	pHLayout->addWidget( m_pbtnRemove );

	pHLayout->addSpacing( KDialog::marginHint() * 3 );

	m_prbNew = new QRadioButton( i18n("New scheme"), this );
	m_prbNew->setEnabled( false );
	pGroup->insert( m_prbNew );
	pHLayout->addWidget( m_prbNew );

	m_pbtnSave = new QPushButton( i18n("&Save..."), this );
	m_pbtnSave->setEnabled( false );
	m_pbtnSave->setWhatsThis( i18n("Click here to add a new key bindings scheme. You will be prompted for a name.") );
	connect( m_pbtnSave, SIGNAL(clicked()), SLOT(slotSaveSchemeAs()) );
	pHLayout->addWidget( m_pbtnSave );

	pHLayout->addStretch( 1 );

	m_pTab = new QTabWidget( this );
	pVLayout->addWidget( m_pTab );

	m_listGeneral = new KActionCollection( this );
	//m_listGeneral->addActions(m_actionsGeneral);
	m_pseGeneral = new KShortcutsEditor( m_listGeneral, this, false );
	m_pTab->addTab( m_pseGeneral, i18n("&Global Shortcuts") );
	//connect( m_pseGeneral, SIGNAL(keyChange()), SLOT(slotKeyChange()) );

	m_listSequence = new KActionCollection( this );
	m_pseSequence = new KShortcutsEditor( m_listSequence, this, false );
	m_pTab->addTab( m_pseSequence, i18n("Shortcut Se&quences") );
	//connect( m_pseSequence, SIGNAL(keyChange()), SLOT(slotKeyChange()) );

	m_listApplication = new KActionCollection( this );
	m_pseApplication = new KShortcutsEditor( m_listApplication, this, false );
	m_pTab->addTab( m_pseApplication, i18n("App&lication Shortcuts") );
	//connect( m_pseApplication, SIGNAL(keyChange()), SLOT(slotKeyChange()) );

	kDebug(125) << "G-----------";
	readSchemeNames();

	kDebug(125) << "I-----------";
	slotSchemeCur();

	kDebug(125) << "J-----------";
}
CableDelayDialog::CableDelayDialog(QVector<bool> &manualDelayEnabled, vector<int> &currentDelay, QWidget *parent) :
    QDialog(parent)
{
    QLabel *label1 = new QLabel(
                tr("The RHD2000 USB interface board can compensate for the nanosecond-scale time delays "
                   "resulting from finite signal velocities on the SPI interface cables.  "
                   "Each time the interface software is opened or the <b>Rescan Ports A-D</b> button is "
                   "clicked, the software attempts to determine the optimum delay settings for each SPI "
                   "port.  Sometimes this delay-setting algorithm fails, particularly when using RHD2164 "
                   "chips which use a double-data-rate SPI protocol."));
    label1->setWordWrap(true);

    QLabel *label2 = new QLabel(
                tr("This dialog box allows users to override this algorithm and set delays manually.  "
                   "If a particular SPI port is returning noisy signals with large discontinuities, "
                   "try checking the manual delay box for that port and adjust the delay setting up or "
                   "down by one."));
    label2->setWordWrap(true);

    QLabel *label3 = new QLabel(
                tr("Note that the optimum delay setting for a particular SPI cable length will change if the "
                   "amplifier sampling rate is changed."));
    label3->setWordWrap(true);

    manualPortACheckBox = new QCheckBox("Set manual delay for Port A");
    manualPortBCheckBox = new QCheckBox("Set manual delay for Port B");
    manualPortCCheckBox = new QCheckBox("Set manual delay for Port C");
    manualPortDCheckBox = new QCheckBox("Set manual delay for Port D");

    manualPortACheckBox->setChecked(manualDelayEnabled[0]);
    manualPortBCheckBox->setChecked(manualDelayEnabled[1]);
    manualPortCCheckBox->setChecked(manualDelayEnabled[2]);
    manualPortDCheckBox->setChecked(manualDelayEnabled[3]);

    delayPortASpinBox = new QSpinBox();
    delayPortASpinBox->setRange(0, 15);
    delayPortASpinBox->setValue(currentDelay[0]);

    delayPortBSpinBox = new QSpinBox();
    delayPortBSpinBox->setRange(0, 15);
    delayPortBSpinBox->setValue(currentDelay[1]);

    delayPortCSpinBox = new QSpinBox();
    delayPortCSpinBox->setRange(0, 15);
    delayPortCSpinBox->setValue(currentDelay[2]);

    delayPortDSpinBox = new QSpinBox();
    delayPortDSpinBox->setRange(0, 15);
    delayPortDSpinBox->setValue(currentDelay[3]);

    buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);

    connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
    connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));

    QHBoxLayout *portARow = new QHBoxLayout;
    portARow->addWidget(manualPortACheckBox);
    portARow->addStretch(1);
    portARow->addWidget(new QLabel(tr("Current delay:")));
    portARow->addWidget(delayPortASpinBox);

    QHBoxLayout *portBRow = new QHBoxLayout;
    portBRow->addWidget(manualPortBCheckBox);
    portBRow->addStretch(1);
    portBRow->addWidget(new QLabel(tr("Current delay:")));
    portBRow->addWidget(delayPortBSpinBox);

    QHBoxLayout *portCRow = new QHBoxLayout;
    portCRow->addWidget(manualPortCCheckBox);
    portCRow->addStretch(1);
    portCRow->addWidget(new QLabel(tr("Current delay:")));
    portCRow->addWidget(delayPortCSpinBox);

    QHBoxLayout *portDRow = new QHBoxLayout;
    portDRow->addWidget(manualPortDCheckBox);
    portDRow->addStretch(1);
    portDRow->addWidget(new QLabel(tr("Current delay:")));
    portDRow->addWidget(delayPortDSpinBox);

    QVBoxLayout *controlLayout = new QVBoxLayout;
    controlLayout->addLayout(portARow);
    controlLayout->addLayout(portBRow);
    controlLayout->addLayout(portCRow);
    controlLayout->addLayout(portDRow);

    QGroupBox *controlBox = new QGroupBox();
    controlBox->setLayout(controlLayout);

    QVBoxLayout *mainLayout = new QVBoxLayout;
    mainLayout->addWidget(label1);
    mainLayout->addWidget(label2);
    mainLayout->addWidget(label3);
    mainLayout->addWidget(controlBox);
    mainLayout->addWidget(buttonBox);

    setLayout(mainLayout);

    setWindowTitle(tr("Manual SPI Cable Delay Configuration"));
}
Example #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),
    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)
{
    GUIUtil::restoreWindowGeometry("nWindow", QSize(850, 550), this);

    QString windowTitle = tr("dkcoin 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();
    labelConnectionsIcon = new QLabel();
    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(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);

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

    // 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();
}
Example #27
0
   TaskEditor::TaskEditor(QWidget* parent)
      : QDialog(parent)
   {
      //dtUtil::Log::GetInstance("taskeditor.cpp").SetLogLevel(dtUtil::Log::LOG_DEBUG);
      QGroupBox*   group = new QGroupBox(tr("Tasks"));
      QGridLayout* grid  = new QGridLayout(group);

      QVBoxLayout* rightSideLayout = new QVBoxLayout;
      QLabel*      child = new QLabel(tr("Children"));
      grid->addWidget(child, 0, 0);


      mChildrenView = new QTableWidget(NULL);
      mChildrenView->setSelectionMode(QAbstractItemView::SingleSelection);
      mChildrenView->setSelectionBehavior(QAbstractItemView::SelectRows);
      mChildrenView->setAlternatingRowColors(true);
      mChildrenView->setEditTriggers(QAbstractItemView::NoEditTriggers);
      grid->addWidget(mChildrenView, 1, 0);

      mAddExisting = new QPushButton(tr("Add Existing"));

      mComboBox = new QComboBox;
      mComboBox->setEditable(false);

      mShowTasksWithParents = new QCheckBox("Show Tasks With Parents");
      mShowTasksWithParents->setCheckState(Qt::Unchecked);
      mShowTasksWithParents->setTristate(false);

      rightSideLayout->addWidget(mAddExisting);
      rightSideLayout->addWidget(mComboBox);
      rightSideLayout->addWidget(mShowTasksWithParents);
      rightSideLayout->addStretch(1);

      grid->addLayout(rightSideLayout, 0, 1, 2, 1);

      QHBoxLayout* buttonLayout = new QHBoxLayout;
      mMoveUp = new QPushButton(tr("Move Up"));
      mMoveDown = new QPushButton(tr("Move Down"));
      buttonLayout->addWidget(mMoveUp);
      buttonLayout->addStretch(1);
      buttonLayout->addWidget(mMoveDown);
      grid->addLayout(buttonLayout, 2, 0);

      mRemoveChild = new QPushButton(tr("Remove Child"));
      grid->addWidget(mRemoveChild, 3, 0);

      QHBoxLayout* okCancelLayout = new QHBoxLayout;
      QPushButton* ok             = new QPushButton(tr("OK"));
      QPushButton* cancel         = new QPushButton(tr("Cancel"));
      okCancelLayout->addStretch(1);
      okCancelLayout->addWidget(ok);
      okCancelLayout->addStretch(1);
      okCancelLayout->addWidget(cancel);
      okCancelLayout->addStretch(1);

      QVBoxLayout* mainLayout = new QVBoxLayout(this);
      mainLayout->addWidget(group);
      mainLayout->addLayout(okCancelLayout);

      setModal(true);
      setWindowTitle(tr("Task Editor"));
      //setMinimumSize(360, 375);

      connect(mComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(OnComboSelectionChanged(int)));
      connect(mAddExisting, SIGNAL(clicked()), this, SLOT(AddSelected()));

      connect(mShowTasksWithParents, SIGNAL(stateChanged(int)), this, SLOT(OnShowTasksWithParentsChanged(int)));

      connect(mMoveUp,       SIGNAL(clicked()), this, SLOT(OnMoveUpClicked()));
      connect(mMoveDown,     SIGNAL(clicked()), this, SLOT(OnMoveDownClicked()));
      connect(mRemoveChild,  SIGNAL(clicked()), this, SLOT(OnRemoveChildClicked()));
      connect(ok,            SIGNAL(clicked()), this, SLOT(OnOkClicked()));
      connect(cancel,        SIGNAL(clicked()), this, SLOT(close()));
      connect(mChildrenView, SIGNAL(itemSelectionChanged()), this, SLOT(EnableEditButtons()));

      RefreshComboBox("");
   }
ScatterWindow::ScatterWindow(MainWindow *parent, const QDir &home) :
    GcChartWindow(parent), home(home), main(parent), ride(NULL), current(NULL)
{
    setInstanceName("2D Window");

    //
    // reveal controls widget
    //

    // reveal controls
    QLabel *rxLabel = new QLabel(tr("X-Axis:"), this);
    rxSelector = new QxtStringSpinBox();
    addrStandardChannels(rxSelector);

    QLabel *ryLabel = new QLabel(tr("Y-Axis:"), this);
    rySelector = new QxtStringSpinBox();
    addrStandardChannels(rySelector);

    rIgnore = new QCheckBox(tr("Ignore Zero"));
    rIgnore->setChecked(true);
    rIgnore->hide();
    rFrameInterval = new QCheckBox(tr("Frame intervals"));
    rFrameInterval->setChecked(true);

    // layout reveal controls
    QHBoxLayout *r = new QHBoxLayout;
    r->setContentsMargins(0,0,0,0);
    r->addStretch();
    r->addWidget(rxLabel);
    r->addWidget(rxSelector);
    r->addWidget(ryLabel);
    r->addWidget(rySelector);
    r->addSpacing(5);
    r->addWidget(rIgnore);
    r->addWidget(rFrameInterval);
    r->addStretch();
    setRevealLayout(r);

    QWidget *c = new QWidget;
    QFormLayout *cl = new QFormLayout(c);
    setControls(c);

    // the plot widget
    scatterPlot= new ScatterPlot(main);
    QVBoxLayout *vlayout = new QVBoxLayout;
    vlayout->addWidget(scatterPlot);

    setChartLayout(vlayout);

    // labels
    xLabel = new QLabel(tr("X-Axis:"), this);
    xSelector = new QComboBox;
    addStandardChannels(xSelector);
    xSelector->setCurrentIndex(0); // power
    rxSelector->setValue(0);
    cl->addRow(xLabel, xSelector);

    yLabel = new QLabel(tr("Y-Axis:"), this);
    ySelector = new QComboBox;
    addStandardChannels(ySelector);
    ySelector->setCurrentIndex(2); // heartrate
    rySelector->setValue(2);
    cl->addRow(yLabel, ySelector);

    timeLabel = new QLabel(tr("00:00:00"), this);
    timeSlider = new QSlider(Qt::Horizontal);
    timeSlider->setTickPosition(QSlider::TicksBelow);
    timeSlider->setTickInterval(1);
    timeSlider->setMinimum(0);
    timeSlider->setTickInterval(5);
    timeSlider->setMaximum(100);
    timeSlider->setValue(0);
    timeSlider->setTracking(true);
    cl->addRow(timeLabel, timeSlider);

    // selectors
    ignore = new QCheckBox(tr("Ignore Zero"));
    ignore->setChecked(true);
    cl->addRow(ignore);

    grid = new QCheckBox(tr("Show Grid"));
    grid->setChecked(true);
    cl->addRow(grid);

    frame = new QCheckBox(tr("Frame Intervals"));
    frame->setChecked(true);
    cl->addRow(frame);

    // now connect up the widgets
    //connect(main, SIGNAL(rideSelected()), this, SLOT(rideSelected()));
    connect(this, SIGNAL(rideItemChanged(RideItem*)), this, SLOT(rideSelected()));
    connect(main, SIGNAL(intervalSelected()), this, SLOT(intervalSelected()));
    connect(main, SIGNAL(intervalsChanged()), this, SLOT(intervalSelected()));
    connect(xSelector, SIGNAL(currentIndexChanged(int)), this, SLOT(setData()));
    connect(ySelector, SIGNAL(currentIndexChanged(int)), this, SLOT(setData()));
    connect(rxSelector, SIGNAL(valueChanged(int)), this, SLOT(rxSelectorChanged(int)));
    connect(rySelector, SIGNAL(valueChanged(int)), this, SLOT(rySelectorChanged(int)));
    connect(timeSlider, SIGNAL(valueChanged(int)), this, SLOT(setTime(int)));
    connect(grid, SIGNAL(stateChanged(int)), this, SLOT(setGrid()));
    //connect(legend, SIGNAL(stateChanged(int)), this, SLOT(setLegend()));
    connect(frame, SIGNAL(stateChanged(int)), this, SLOT(setFrame()));
    connect(ignore, SIGNAL(stateChanged(int)), this, SLOT(setIgnore()));
    connect(rFrameInterval, SIGNAL(stateChanged(int)), this, SLOT(setrFrame()));
    connect(rIgnore, SIGNAL(stateChanged(int)), this, SLOT(setrIgnore()));

}
mafGUIApplicationSettingsPageProxy::mafGUIApplicationSettingsPageProxy(QWidget *parent) : mafGUIApplicationSettingsPage(parent) {
    m_PageText = mafTr("Proxy");
    m_PageIcon = QIcon(":/images/config.png");

    // Build the Page's GUI
    QGroupBox *configGroup = new QGroupBox(tr("Proxy configuration"));

    QLabel *proxyHostLabel = new QLabel(tr("Proxy host:"));
    m_ProxyHostLineEdit = new QLineEdit();
    m_ProxyHostLineEdit->setPlaceholderText("Set host name here");
    m_ProxyHostLineEdit->setObjectName(QString::fromUtf8("proxyHostLineEdit"));

    QLabel *proxyPortLabel = new QLabel(tr("Proxy port:"));
    m_ProxyPortLineEdit = new QLineEdit();
    m_ProxyPortLineEdit->setPlaceholderText("Set proxy port port");
    m_ProxyPortLineEdit->setValidator(new QIntValidator(this));
    m_ProxyPortLineEdit->setObjectName(QString::fromUtf8("proxyPortLineEdit"));

    QLabel *proxyUserNameLabel = new QLabel(tr("Proxy user name:"));
    m_ProxyUserNameLineEdit = new QLineEdit();
    m_ProxyUserNameLineEdit->setPlaceholderText("Set proxy user name here");
    m_ProxyUserNameLineEdit->setObjectName(QString::fromUtf8("proxyUserNameLineEdit"));

    QLabel *proxyPasswordLabel = new QLabel(tr("Proxy password:"));
    m_ProxyPasswordLineEdit = new QLineEdit();
    m_ProxyPasswordLineEdit->setPlaceholderText("Set proxy password here");
    m_ProxyPasswordLineEdit->setEchoMode( QLineEdit::Password );
    m_ProxyPasswordLineEdit->setObjectName(QString::fromUtf8("proxyPasswordLineEdit"));

    QHBoxLayout *proxyHostLayout = new QHBoxLayout;
    proxyHostLayout->addWidget(proxyHostLabel);
    proxyHostLayout->addWidget(m_ProxyHostLineEdit);

    QHBoxLayout *proxyPortLayout = new QHBoxLayout;
    proxyPortLayout->addWidget(proxyPortLabel);
    proxyPortLayout->addWidget(m_ProxyPortLineEdit);

    QHBoxLayout *proxyUserNameLayout = new QHBoxLayout;
    proxyUserNameLayout->addWidget(proxyUserNameLabel);
    proxyUserNameLayout->addWidget(m_ProxyUserNameLineEdit);

    QHBoxLayout *proxyPasswordLayout = new QHBoxLayout;
    proxyPasswordLayout->addWidget(proxyPasswordLabel);
    proxyPasswordLayout->addWidget(m_ProxyPasswordLineEdit);

   
    QHBoxLayout *useProxyLayout = new QHBoxLayout;
    QLabel *useProxyLabel = new QLabel( this );
    useProxyLabel->setText(tr("use proxy"));
    m_Checkbox = new QCheckBox();

    // connects slots
    connect(m_Checkbox, SIGNAL(stateChanged(int)), this, SLOT(slotCheckBox(int)));
    connect(m_ProxyHostLineEdit, SIGNAL(editingFinished()), this, SLOT(writeSettings(void)));
    connect(m_ProxyPortLineEdit, SIGNAL(editingFinished()), this, SLOT(writeSettings(void)));
    connect(m_ProxyUserNameLineEdit, SIGNAL(editingFinished()), this, SLOT(writeSettings(void)));
    connect(m_ProxyPasswordLineEdit, SIGNAL(editingFinished()), this, SLOT(writeSettings(void)));

    useProxyLayout->addWidget(useProxyLabel);
    useProxyLayout->addWidget(m_Checkbox);
    useProxyLayout->addStretch(1);


    QVBoxLayout *configLayout = new QVBoxLayout;
    configLayout->addLayout(proxyHostLayout);
    configLayout->addLayout(proxyPortLayout);
    configLayout->addLayout(proxyUserNameLayout);
    configLayout->addLayout(proxyPasswordLayout);
    configLayout->addLayout(useProxyLayout);
    configGroup->setLayout(configLayout);

    QVBoxLayout *mainLayout = new QVBoxLayout;
    mainLayout->addWidget(configGroup);
    mainLayout->addStretch(1);
    setLayout(mainLayout);

    readSettings();
}
Example #30
0
ProgressDialog::ProgressDialog( QWidget* pParent, QStatusBar* pStatusBar )
: QDialog(pParent), m_pStatusBar(pStatusBar)
{
   m_pGuiThread = QThread::currentThread();

   setObjectName("ProgressDialog");
   m_bStayHidden = false;
   setModal(true);
   QVBoxLayout* layout = new QVBoxLayout(this);

   m_pInformation = new QLabel( " ", this );
   layout->addWidget( m_pInformation );

   m_pProgressBar = new QProgressBar();
   m_pProgressBar->setRange(0,1000);
   layout->addWidget( m_pProgressBar );

   m_pSubInformation = new QLabel( " ", this);
   layout->addWidget( m_pSubInformation );

   m_pSubProgressBar = new QProgressBar();
   m_pSubProgressBar->setRange(0,1000);
   layout->addWidget( m_pSubProgressBar );

   m_pSlowJobInfo = new QLabel( " ", this);
   layout->addWidget( m_pSlowJobInfo );

   QHBoxLayout* hlayout = new QHBoxLayout();
   layout->addLayout(hlayout);
   hlayout->addStretch(1);
   m_pAbortButton = new QPushButton( i18n("&Cancel"), this);
   hlayout->addWidget( m_pAbortButton );
   connect( m_pAbortButton, SIGNAL(clicked()), this, SLOT(slotAbort()) );

   if (m_pStatusBar)
   {
      m_pStatusBarWidget = new QWidget;
      QHBoxLayout* pStatusBarLayout = new QHBoxLayout(m_pStatusBarWidget);
      pStatusBarLayout->setMargin(0);
      pStatusBarLayout->setSpacing(3);
      m_pStatusProgressBar = new QProgressBar;
      m_pStatusProgressBar->setRange(0, 1000);
      m_pStatusProgressBar->setTextVisible(false);
      m_pStatusAbortButton = new QPushButton( i18n("&Cancel") );
      connect(m_pStatusAbortButton, SIGNAL(clicked()), this, SLOT(slotAbort()));
      pStatusBarLayout->addWidget(m_pStatusProgressBar);
      pStatusBarLayout->addWidget(m_pStatusAbortButton);
      m_pStatusBar->addPermanentWidget(m_pStatusBarWidget,0);
      m_pStatusBarWidget->setFixedHeight(m_pStatusBar->height());
      m_pStatusBarWidget->hide();
   }
   else
   {
      m_pStatusProgressBar = 0;
      m_pStatusAbortButton = 0;
   }

   m_progressDelayTimer = 0;
   m_delayedHideTimer = 0;
   m_delayedHideStatusBarWidgetTimer = 0;
   resize(400, 100);
   m_t1.start();
   m_t2.start();
   m_bWasCancelled = false;
   m_eCancelReason = eUserAbort;
   m_pJob = 0;
}