UIWizardCloneVDPageExpert::UIWizardCloneVDPageExpert(KDeviceType enmDeviceType)
{
    /* Create widgets: */
    QGridLayout *pMainLayout = new QGridLayout(this);
    {
        m_pDestinationCnt = new QGroupBox(this);
        {
            m_pDestinationCnt->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed);
            QHBoxLayout *pLocationCntLayout = new QHBoxLayout(m_pDestinationCnt);
            {
                m_pDestinationDiskEditor = new QLineEdit(m_pDestinationCnt);
                m_pDestinationDiskOpenButton = new QIToolButton(m_pDestinationCnt);
                {
                    m_pDestinationDiskOpenButton->setAutoRaise(true);
                    m_pDestinationDiskOpenButton->setIcon(UIIconPool::iconSet(":/select_file_16px.png", "select_file_disabled_16px.png"));
                }
            }
            pLocationCntLayout->addWidget(m_pDestinationDiskEditor);
            pLocationCntLayout->addWidget(m_pDestinationDiskOpenButton);
        }
        m_pFormatCnt = new QGroupBox(this);
        {
            m_pFormatCnt->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed);
            QVBoxLayout *pFormatCntLayout = new QVBoxLayout(m_pFormatCnt);
            {
                m_pFormatButtonGroup = new QButtonGroup(m_pFormatCnt);
                {
                    /* Enumerate medium formats in special order: */
                    CSystemProperties properties = vboxGlobal().virtualBox().GetSystemProperties();
                    const QVector<CMediumFormat> &formats = properties.GetMediumFormats();
                    QMap<QString, CMediumFormat> vdi, preferred, others;
                    foreach (const CMediumFormat &format, formats)
                    {
                        /* VDI goes first: */
                        if (format.GetName() == "VDI")
                            vdi[format.GetId()] = format;
                        else
                        {
                            const QVector<KMediumFormatCapabilities> &capabilities = format.GetCapabilities();
                            /* Then goes preferred: */
                            if (capabilities.contains(KMediumFormatCapabilities_Preferred))
                                preferred[format.GetId()] = format;
                            /* Then others: */
                            else
                                others[format.GetId()] = format;
                        }
                    }

                    /* Create buttons for VDI, preferred and others: */
                    foreach (const QString &strId, vdi.keys())
                        addFormatButton(this, pFormatCntLayout, enmDeviceType, vdi.value(strId), true);
                    foreach (const QString &strId, preferred.keys())
                        addFormatButton(this, pFormatCntLayout, enmDeviceType, preferred.value(strId), true);
                    foreach (const QString &strId, others.keys())
                        addFormatButton(this, pFormatCntLayout, enmDeviceType, others.value(strId));

                    if (!m_pFormatButtonGroup->buttons().isEmpty())
                    {
                        m_pFormatButtonGroup->button(0)->click();
                        m_pFormatButtonGroup->button(0)->setFocus();
                    }
                }
            }
        }
        m_pVariantCnt = new QGroupBox(this);
        {
            m_pVariantCnt->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed);
            QVBoxLayout *pVariantCntLayout = new QVBoxLayout(m_pVariantCnt);
            {
                m_pVariantButtonGroup = new QButtonGroup(m_pVariantCnt);
                {
                    m_pDynamicalButton = new QRadioButton(m_pVariantCnt);
                    if (enmDeviceType == KDeviceType_HardDisk)
                    {
                        m_pDynamicalButton->click();
                        m_pDynamicalButton->setFocus();
                    }
                    m_pFixedButton = new QRadioButton(m_pVariantCnt);
                    if (   enmDeviceType == KDeviceType_DVD
                        || enmDeviceType == KDeviceType_Floppy)
                    {
                        m_pFixedButton->click();
                        m_pFixedButton->setFocus();
                    }
                    m_pVariantButtonGroup->addButton(m_pDynamicalButton, 0);
                    m_pVariantButtonGroup->addButton(m_pFixedButton, 1);
                }
                m_pSplitBox = new QCheckBox(m_pVariantCnt);
                pVariantCntLayout->addWidget(m_pDynamicalButton);
                pVariantCntLayout->addWidget(m_pFixedButton);
                pVariantCntLayout->addWidget(m_pSplitBox);
            }
        }
        pMainLayout->addWidget(m_pDestinationCnt, 1, 0, 1, 2);
        pMainLayout->addWidget(m_pFormatCnt, 2, 0, Qt::AlignTop);
        pMainLayout->addWidget(m_pVariantCnt, 2, 1, Qt::AlignTop);
    }

    /* Setup connections: */
    connect(m_pFormatButtonGroup, static_cast<void(QButtonGroup::*)(QAbstractButton*)>(&QButtonGroup::buttonClicked),
            this, &UIWizardCloneVDPageExpert::sltMediumFormatChanged);
    connect(m_pVariantButtonGroup, static_cast<void(QButtonGroup::*)(QAbstractButton*)>(&QButtonGroup::buttonClicked),
            this, &UIWizardCloneVDPageExpert::completeChanged);
    connect(m_pSplitBox, &QCheckBox::stateChanged,
            this, &UIWizardCloneVDPageExpert::completeChanged);
    connect(m_pDestinationDiskEditor, &QLineEdit::textChanged,
            this, &UIWizardCloneVDPageExpert::completeChanged);
    connect(m_pDestinationDiskOpenButton, &QIToolButton::clicked,
            this, &UIWizardCloneVDPageExpert::sltSelectLocationButtonClicked);

    /* Register classes: */
    qRegisterMetaType<CMedium>();
    qRegisterMetaType<CMediumFormat>();
    /* Register fields: */
    registerField("mediumFormat", this, "mediumFormat");
    registerField("mediumVariant", this, "mediumVariant");
    registerField("mediumPath", this, "mediumPath");
    registerField("mediumSize", this, "mediumSize");
}
Пример #2
0
int main(int argc, char* argv[])
{
    QApplication app(argc, argv);
    char* sequence = NULL;
    Tracking track; // tracking object
    QString status = ""; // status which is displayed in the status bar

    // Indicates whether the recording functionality is enabled.
    bool enableRecording = false;

    for(int i=1; i < argc; i++)
    {
        if(strcmp(argv[i], "-seq") == 0)
        {
            sequence = argv[i+1];
            QString tempSeq = QString(argv[i+1]);
            QStringList tempSeqList = tempSeq.split(QRegExp("/"));
            status.append(tempSeqList.last()); // sequence name
        }
        // enable the recording functionality
        else if(strcmp(argv[i], "-rec") == 0)
            enableRecording = true;

    }

    if(track.initialize(sequence))
    {
        cerr << "Failed to initialize tracking !" << endl;
        return 1;
    }

    TrackingWindow * labelMask = new TrackingWindow(track.getImageWidth(), track.getImageHeight());
    TrackingWindow * labelDepth = new TrackingWindow(track.getImageWidth(), track.getImageHeight());

    labelMask->setScaledContents(true);
    labelMask->setFixedSize(2*track.getImageWidth(), 2*track.getImageHeight());
    labelDepth->setScaledContents(true);
    labelDepth->setFixedSize(2*track.getImageWidth(), 2*track.getImageHeight());

    MainWindow *window = new MainWindow();
    window->setWindowOpacity(10);
    window->adjustSize(); // adjust to the sizes of child widgets

    QHBoxLayout *masterLayout = new QHBoxLayout(); // main layout
    masterLayout->addWidget(labelDepth);
    masterLayout->addWidget(labelMask);
    window->setLayout(masterLayout);

    QPushButton *recordButton = NULL;
    if(enableRecording)
    {
        // Create the recording button.
        recordButton = new QPushButton("REC");
        recordButton->setCheckable(true);
        masterLayout->addWidget(recordButton,0,0);
    }


    QMainWindow mWind;
    mWind.setWindowTitle(QApplication::translate("windowlayout", "Omek Interactive Tracking Demo"));
    mWind.setCentralWidget(window);
    mWind.statusBar()->showMessage(status);
    mWind.show();

    QTimer timer;

    if(enableRecording)
    {
        QObject::connect(recordButton,
                         SIGNAL(toggled(bool)),
                         &track,
                         SLOT(recordOrStop(bool)));
    }

    QObject::connect(window, SIGNAL(shutdown()),
                     &app, SLOT(quit()));

    QObject::connect(&timer,
                     SIGNAL(timeout()),
                     &track,
                     SLOT(updateFrame()));

    QObject::connect(&track, SIGNAL(shutdown()),
                     &app, SLOT(quit()));

    QObject::connect(&track,
                     SIGNAL(updateDepthImage(unsigned char*)),
                     labelDepth,
                     SLOT(updateDepthImage(unsigned char*)));

    QObject::connect(&track,
                     SIGNAL(updateMaskImage(unsigned char*)),
                     labelMask,
                     SLOT(updateMaskImage(unsigned char*)));

    QObject::connect(&track,
                     SIGNAL(addPoint(uint,uint,JointID)),
                     labelMask,
                     SLOT(addPoint(uint,uint,JointID)));

    timer.start(TIMER_INT);

    return app.exec();
}
Пример #3
0
GeneralPage::GeneralPage(QWidget* parent) : QWidget(parent)
{
    QSettings settings("Pencil","Pencil");
    QVBoxLayout* lay = new QVBoxLayout();

    QGroupBox* windowOpacityBox = new QGroupBox(tr("Window opacity"));
    QGroupBox* backgroundBox = new QGroupBox(tr("Background"));
    QGroupBox* appearanceBox = new QGroupBox(tr("Appearance"));
    QGroupBox* displayBox = new QGroupBox(tr("Rendering"));
    QGroupBox* editingBox = new QGroupBox(tr("Editing"));

    QLabel* windowOpacityLabel = new QLabel(tr("Opacity"));
    QSlider* windowOpacityLevel = new QSlider(Qt::Horizontal);
    windowOpacityLevel->setMinimum(30);
    windowOpacityLevel->setMaximum(100);
    int value = settings.value("windowOpacity").toInt();
    windowOpacityLevel->setValue( 100 - value );

    QButtonGroup* backgroundButtons = new QButtonGroup();
    QRadioButton* checkerBackgroundButton = new QRadioButton();
    QRadioButton* whiteBackgroundButton = new QRadioButton();
    QRadioButton* greyBackgroundButton = new QRadioButton();
    QRadioButton* dotsBackgroundButton = new QRadioButton();
    QRadioButton* weaveBackgroundButton = new QRadioButton();
    QPixmap previewCheckerboard(32,32);
    QPixmap previewWhite(32,32);
    QPixmap previewGrey(32,32);
    QPixmap previewDots(32,32);
    QPixmap previewWeave(32,32);
    QPainter painter(&previewCheckerboard);
    painter.fillRect( QRect(0,0,32,32), ScribbleArea::getBackgroundBrush("checkerboard") );
    painter.end();
    painter.begin(&previewDots);
    painter.fillRect( QRect(0,0,32,32), ScribbleArea::getBackgroundBrush("dots") );
    painter.end();
    painter.begin(&previewWeave);
    painter.fillRect( QRect(0,0,32,32), ScribbleArea::getBackgroundBrush("weave") );
    painter.end();
    previewWhite.fill( Qt::white );
    previewGrey.fill( Qt:: lightGray );
    checkerBackgroundButton->setIcon( previewCheckerboard );
    whiteBackgroundButton->setIcon( previewWhite );
    greyBackgroundButton->setIcon( previewGrey );
    dotsBackgroundButton->setIcon( previewDots );
    dotsBackgroundButton->setIcon( previewWeave );
    backgroundButtons->addButton(checkerBackgroundButton);
    backgroundButtons->addButton(whiteBackgroundButton);
    backgroundButtons->addButton(greyBackgroundButton);
    backgroundButtons->addButton(dotsBackgroundButton);
    backgroundButtons->addButton(weaveBackgroundButton);
    backgroundButtons->setId(checkerBackgroundButton, 1);
    backgroundButtons->setId(whiteBackgroundButton, 2);
    backgroundButtons->setId(greyBackgroundButton, 3);
    backgroundButtons->setId(dotsBackgroundButton, 4);
    backgroundButtons->setId(weaveBackgroundButton, 5);
    QHBoxLayout* backgroundLayout = new QHBoxLayout();
    backgroundBox->setLayout(backgroundLayout);
    backgroundLayout->addWidget(checkerBackgroundButton);
    backgroundLayout->addWidget(whiteBackgroundButton);
    backgroundLayout->addWidget(greyBackgroundButton);
    backgroundLayout->addWidget(dotsBackgroundButton);
    backgroundLayout->addWidget(weaveBackgroundButton);
    if ( settings.value("background").toString() == "checkerboard" ) checkerBackgroundButton->setChecked(true);
    if ( settings.value("background").toString() == "white" ) whiteBackgroundButton->setChecked(true);
    if ( settings.value("background").toString() == "grey" ) greyBackgroundButton->setChecked(true);
    if ( settings.value("background").toString() == "dots" ) dotsBackgroundButton->setChecked(true);
    if ( settings.value("background").toString() == "weave" ) weaveBackgroundButton->setChecked(true);

    QCheckBox* shadowsBox = new QCheckBox(tr("Shadows"));
    shadowsBox->setChecked(false); // default
    if (settings.value("shadows").toString()=="true") shadowsBox->setChecked(true);

    QCheckBox* toolCursorsBox = new QCheckBox(tr("Tool Cursors"));
    toolCursorsBox->setChecked(true); // default
    if (settings.value("toolCursors").toString()=="false") toolCursorsBox->setChecked(false);

    QCheckBox* aquaBox = new QCheckBox(tr("Aqua Style"));
    aquaBox->setChecked(false); // default
    if (settings.value("style").toString()=="aqua") aquaBox->setChecked(true);

    QCheckBox* antialiasingBox = new QCheckBox(tr("Antialiasing"));
    antialiasingBox->setChecked(true); // default
    if (settings.value("antialiasing").toString()=="false") antialiasingBox->setChecked(false);

    QButtonGroup* gradientsButtons = new QButtonGroup();
    QRadioButton* gradient1Button = new QRadioButton(tr("None"));
    QRadioButton* gradient2Button = new QRadioButton(tr("Quick"));
    QRadioButton* gradient3Button = new QRadioButton(tr("Gradient1"));
    QRadioButton* gradient4Button = new QRadioButton(tr("Gradient2"));
    gradientsButtons->addButton(gradient1Button);
    gradientsButtons->addButton(gradient2Button);
    gradientsButtons->addButton(gradient3Button);
    gradientsButtons->addButton(gradient4Button);
    gradientsButtons->setId(gradient1Button, 1);
    gradientsButtons->setId(gradient2Button, 2);
    gradientsButtons->setId(gradient3Button, 3);
    gradientsButtons->setId(gradient4Button, 4);
    QGroupBox* gradientsBox = new QGroupBox(tr("Gradients"));
    QHBoxLayout* gradientsLayout = new QHBoxLayout();
    gradientsBox->setLayout(gradientsLayout);
    gradientsLayout->addWidget(gradient1Button);
    gradientsLayout->addWidget(gradient2Button);
    gradientsLayout->addWidget(gradient3Button);
    gradientsLayout->addWidget(gradient4Button);
    if ( settings.value("gradients").toString() == "1" ) gradient1Button->setChecked(true);
    if ( settings.value("gradients").toString() == "2" ) gradient2Button->setChecked(true);
    if ( settings.value("gradients").toString() == "" )  gradient2Button->setChecked(true); // default
    if ( settings.value("gradients").toString() == "3" ) gradient3Button->setChecked(true);
    if ( settings.value("gradients").toString() == "4" ) gradient4Button->setChecked(true);


    /*QCheckBox *gradientsBox = new QCheckBox(tr("Gradients"));
    gradientsBox->setChecked(true); // default
    if (settings.value("gradients").toString()=="0") gradientsBox->setChecked(false);*/

    QLabel* curveOpacityLabel = new QLabel(tr("Vector curve opacity"));
    QSlider* curveOpacityLevel = new QSlider(Qt::Horizontal);
    curveOpacityLevel->setMinimum(0);
    curveOpacityLevel->setMaximum(100);
    curveOpacityLevel->setValue( 100 - settings.value("curveOpacity").toInt() );

    QGridLayout* windowOpacityLayout = new QGridLayout();
    windowOpacityBox->setLayout(windowOpacityLayout);
    windowOpacityLayout->addWidget(windowOpacityLabel, 0, 0);
    windowOpacityLayout->addWidget(windowOpacityLevel, 0, 1);

    QVBoxLayout* appearanceLayout = new QVBoxLayout();
    appearanceBox->setLayout(appearanceLayout);
    appearanceLayout->addWidget(shadowsBox);
    appearanceLayout->addWidget(toolCursorsBox);
#ifdef Q_WS_MAC
    appearanceLayout->addWidget(aquaBox);
#endif

    QGridLayout* displayLayout = new QGridLayout();
    displayBox->setLayout(displayLayout);
    displayLayout->addWidget(antialiasingBox, 0, 0);
    displayLayout->addWidget(gradientsBox, 1, 0);
    displayLayout->addWidget(curveOpacityLabel, 2, 0);
    displayLayout->addWidget(curveOpacityLevel, 3, 0);

    QLabel* curveSmoothingLabel = new QLabel(tr("Vector curve smoothing"));
    QSlider* curveSmoothingLevel = new QSlider(Qt::Horizontal);
    curveSmoothingLevel->setMinimum(1);
    curveSmoothingLevel->setMaximum(100);
    value = settings.value("curveSmoothing").toInt();
    curveSmoothingLevel->setValue( value );

    QCheckBox* highResBox = new QCheckBox(tr("Tablet high-resolution position"));
    if (settings.value("highResPosition")=="true") highResBox->setChecked(true);
    else highResBox->setChecked(false);

    QGridLayout* editingLayout = new QGridLayout();
    editingBox->setLayout(editingLayout);
    editingLayout->addWidget(curveSmoothingLabel, 0, 0);
    editingLayout->addWidget(curveSmoothingLevel, 1, 0);
    editingLayout->addWidget(highResBox, 2, 0);

    //QLabel *fontSizeLabel = new QLabel(tr("Labels font size"));
    //QDoubleSpinBox *fontSize = new QDoubleSpinBox();

    /*fontSize->setMinimum(4);
    fontSize->setMaximum(20);
    frameSize->setMinimum(4);
    frameSize->setMaximum(20);

    fontSize->setFixedWidth(50);
    frameSize->setFixedWidth(50);
    lengthSize->setFixedWidth(50);

    if (settings.value("drawLabel")=="false") drawLabel->setChecked(false);
    else drawLabel->setChecked(true);
    fontSize->setValue(settings.value("labelFontSize").toInt());
    frameSize->setValue(settings.value("frameSize").toInt());
    if (settings.value("labelFontSize").toInt()==0) fontSize->setValue(12);
    if (settings.value("frameSize").toInt()==0) frameSize->setValue(6);
    lengthSize->setText(settings.value("length").toString());
    if (settings.value("length").toInt()==0) lengthSize->setText("240");

    connect(fontSize, SIGNAL(valueChanged(int)), this, SIGNAL(fontSizeChange(int)));
    connect(frameSize, SIGNAL(valueChanged(int)), this, SIGNAL(frameSizeChange(int)));
    connect(lengthSize, SIGNAL(textChanged(QString)), this, SIGNAL(lengthSizeChange(QString)));
    connect(drawLabel, SIGNAL(stateChanged(int)), this, SIGNAL(labelChange(int)));*/

    lay->addWidget(windowOpacityBox);
    lay->addWidget(appearanceBox);
    lay->addWidget(backgroundBox);
    lay->addWidget(displayBox);
    lay->addWidget(editingBox);

    connect(windowOpacityLevel, SIGNAL(valueChanged(int)), parent, SIGNAL(windowOpacityChange(int)));
    connect(backgroundButtons, SIGNAL(buttonClicked(int)), parent, SIGNAL(backgroundChange(int)));
    connect(gradientsButtons, SIGNAL(buttonClicked(int)), parent, SIGNAL(gradientsChange(int)));
    connect(shadowsBox, SIGNAL(stateChanged(int)), parent, SIGNAL(shadowsChange(int)));
    connect(toolCursorsBox, SIGNAL(stateChanged(int)), parent, SIGNAL(toolCursorsChange(int)));
    connect(aquaBox, SIGNAL(stateChanged(int)), parent, SIGNAL(styleChange(int)));
    connect(antialiasingBox, SIGNAL(stateChanged(int)), parent, SIGNAL(antialiasingChange(int)));
    connect(curveOpacityLevel, SIGNAL(valueChanged(int)), parent, SIGNAL(curveOpacityChange(int)));
    connect(curveSmoothingLevel, SIGNAL(valueChanged(int)), parent, SIGNAL(curveSmoothingChange(int)));
    connect(highResBox, SIGNAL(stateChanged(int)), parent, SIGNAL(highResPositionChange(int)));

    /*lay->addWidget(fontSizeLabel);
    lay->addWidget(fontSize);
    lay->addWidget(frameSizeLabel);
    lay->addWidget(frameSize);
    lay->addWidget(lengthSizeLabel);
    lay->addWidget(lengthSize);*/
    setLayout(lay);
}
median_noise_ui::median_noise_ui(QWidget* pParent) : QDialog(pParent)
{
   
   setWindowTitle("Median denoising");

   
   ResearchValue=3;
   
   
   
   QGridLayout* pLayout = new QGridLayout(this);
   pLayout->setMargin(10);
   pLayout->setSpacing(5);
   

   
   QLabel* pLable1 = new QLabel("Noise deviation: ", this);
   pLable1->hide();
   pLayout->addWidget(pLable1, 0, 0);

   SigmaValueBox = new QDoubleSpinBox(this);
   SigmaValueBox->setRange(10, 30);
   SigmaValueBox->setSingleStep(1);
   SigmaValueBox->setValue(SigmaValue);
   SigmaValueBox->hide();
   pLayout->addWidget(SigmaValueBox, 0, 1, 1, 2);
   

   
   QLabel* pLable2 = new QLabel("Research window: ", this);
   pLayout->addWidget(pLable2, 1, 0);

   ResearchBox = new QDoubleSpinBox(this);
   ResearchBox->setRange(3, 11);
   ResearchBox->setSingleStep(2);
   ResearchBox->setValue(ResearchValue);
   pLayout->addWidget(ResearchBox, 1, 1, 1, 2);

   
   
   QLabel* pLable3 = new QLabel("Comparison window: ", this);
   pLable3->hide();
   pLayout->addWidget(pLable3, 2, 0);

   CompareBox = new QDoubleSpinBox(this);
   CompareBox->setRange(3, 11);
   CompareBox->setSingleStep(2);
   CompareBox->setValue(CompareValue);
   CompareBox->hide();
   pLayout->addWidget(CompareBox, 2, 1, 1, 2);

   

   QHBoxLayout* pRespLayout = new QHBoxLayout;
   pLayout->addLayout(pRespLayout, 3, 0, 1, 3);

   QPushButton* pAccept = new QPushButton("OK", this);
   pRespLayout->addStretch();
   pRespLayout->addWidget(pAccept);

   QPushButton* pReject = new QPushButton("Cancel", this);
   pRespLayout->addWidget(pReject);
   
   connect(pAccept, SIGNAL(clicked()), this, SLOT(accept()));
   connect(pReject, SIGNAL(clicked()), this, SLOT(reject()));

   connect(SigmaValueBox, SIGNAL(valueChanged(double)), this, SLOT(setSigmaValue(double)));
   connect(ResearchBox, SIGNAL(valueChanged(double)), this, SLOT(setResearchWindow(double)));
   connect(CompareBox, SIGNAL(valueChanged(double)), this, SLOT(setCompareWindow(double)));
   
}
void MusicWebDJRadioInfoWidget::createLabels()
{
    initFirstWidget();
    m_container->show();

    layout()->removeWidget(m_mainWindow);
    QScrollArea *scrollArea = new QScrollArea(this);
    scrollArea->verticalScrollBar()->setStyleSheet(MusicUIObject::MScrollBarStyle01);
    scrollArea->setWidgetResizable(true);
    scrollArea->setFrameShape(QFrame::NoFrame);
    scrollArea->setAlignment(Qt::AlignLeft);
    scrollArea->setWidget(m_mainWindow);
    layout()->addWidget(scrollArea);

    QWidget *function = new QWidget(m_mainWindow);
    function->setStyleSheet(MusicUIObject::MCheckBoxStyle01 + MusicUIObject::MPushButtonStyle03);
    QVBoxLayout *grid = new QVBoxLayout(function);

    QWidget *firstTopFuncWidget = new QWidget(function);
    QHBoxLayout *firstTopFuncLayout = new QHBoxLayout(firstTopFuncWidget);
    QLabel *firstLabel = new QLabel(function);
    firstLabel->setText(tr("<font color=#158FE1> DJRadio > %1 </font>").arg(m_currentPlaylistItem.m_name));
    QPushButton *backButton = new QPushButton(tr("Back"));
    backButton->setFixedSize(90, 30);
    backButton->setStyleSheet(MusicUIObject::MPushButtonStyle03);
    backButton->setCursor(QCursor(Qt::PointingHandCursor));
    connect(backButton, SIGNAL(clicked()), this, SIGNAL(backToMainMenu()));
    firstTopFuncLayout->addWidget(firstLabel);
    firstTopFuncLayout->addWidget(backButton);
    grid->addWidget(firstTopFuncWidget);
    ////////////////////////////////////////////////////////////////////////////
    QWidget *topFuncWidget = new QWidget(function);
    QHBoxLayout *topFuncLayout = new QHBoxLayout(topFuncWidget);

    m_iconLabel = new QLabel(topFuncWidget);
    m_iconLabel->setPixmap(QPixmap(":/image/lb_warning").scaled(180, 180));
    m_iconLabel->setFixedSize(210, 180);
    ////////////////////////////////////////////////////////////////////////////

    QWidget *topLineWidget = new QWidget(topFuncWidget);
    QVBoxLayout *topLineLayout = new QVBoxLayout(topLineWidget);
    topLineLayout->setContentsMargins(10, 5, 5, 0);
    QLabel *nameLabel = new QLabel(topLineWidget);
    QFont nameFont = nameLabel->font();
    nameFont.setPixelSize(20);
    nameLabel->setFont(nameFont);
    nameLabel->setStyleSheet(MusicUIObject::MFontStyle01);
    nameLabel->setText("-");
    QLabel *singerLabel = new QLabel(topLineWidget);
    singerLabel->setStyleSheet(MusicUIObject::MColorStyle04 + MusicUIObject::MFontStyle03);
    singerLabel->setText("-");
    QLabel *playCountLabel = new QLabel(topLineWidget);
    playCountLabel->setStyleSheet(MusicUIObject::MColorStyle04 + MusicUIObject::MFontStyle03);
    QLabel *updateTimeLabel = new QLabel(topLineWidget);
    updateTimeLabel->setStyleSheet(MusicUIObject::MColorStyle04 + MusicUIObject::MFontStyle03);
    updateTimeLabel->setText("-");

    topLineLayout->addWidget(nameLabel);
    topLineLayout->addWidget(singerLabel);
    topLineLayout->addWidget(playCountLabel);
    topLineLayout->addWidget(updateTimeLabel);
    topLineWidget->setLayout(topLineLayout);

    topFuncLayout->addWidget(m_iconLabel);
    topFuncLayout->addWidget(topLineWidget);
    topFuncWidget->setLayout(topFuncLayout);
    grid->addWidget(topFuncWidget);
    ////////////////////////////////////////////////////////////////////////////

    QWidget *functionWidget = new QWidget(this);
    functionWidget->setStyleSheet(MusicUIObject::MPushButtonStyle03);
    QHBoxLayout *hlayout = new QHBoxLayout(functionWidget);
    m_songButton = new QPushButton(functionWidget);
    m_songButton->setText(tr("songItems"));
    m_songButton->setFixedSize(100, 25);
    m_songButton->setCursor(QCursor(Qt::PointingHandCursor));
    hlayout->addWidget(m_songButton);
    hlayout->addStretch(1);
    functionWidget->setLayout(hlayout);
    QButtonGroup *group = new QButtonGroup(this);
    group->addButton(m_songButton, 0);
    connect(group, SIGNAL(buttonClicked(int)), m_container, SLOT(setCurrentIndex(int)));

#ifdef Q_OS_UNIX
    m_songButton->setFocusPolicy(Qt::NoFocus);
#endif
    grid->addWidget(functionWidget);
    //////////////////////////////////////////////////////////////////////
    grid->addWidget(m_container);
    grid->addStretch(1);

    function->setLayout(grid);
    m_mainWindow->layout()->addWidget(function);

    m_resizeWidgets << nameLabel << singerLabel << playCountLabel << updateTimeLabel;
}
Пример #6
0
/**
 * Creates a treewidget item for a row of a table workspace.
 *
 * @param row Row from a table workspace with each row specfying a savu plugin
 */
void TomographyIfaceViewQtGUI::createPluginTreeEntry(TableRow &row) {
  QStringList idStr, nameStr, citeStr, paramsStr;
  idStr.push_back(QString::fromStdString("ID: " + row.cell<std::string>(0)));
  nameStr.push_back(
      QString::fromStdString("Name: " + row.cell<std::string>(2)));
  citeStr.push_back(
      QString::fromStdString("Cite: " + row.cell<std::string>(3)));
  paramsStr.push_back(QString::fromStdString("Params:"));

  // Setup editable tree items
  QList<QTreeWidgetItem *> items;
  OwnTreeWidgetItem *pluginBaseItem = new OwnTreeWidgetItem(nameStr);
  OwnTreeWidgetItem *pluginParamsItem =
      new OwnTreeWidgetItem(pluginBaseItem, paramsStr, pluginBaseItem);

  // Add to the tree list. Adding now to build hierarchy for later setItemWidget
  // call
  items.push_back(new OwnTreeWidgetItem(pluginBaseItem, idStr, pluginBaseItem));
  items.push_back(
      new OwnTreeWidgetItem(pluginBaseItem, nameStr, pluginBaseItem));
  items.push_back(
      new OwnTreeWidgetItem(pluginBaseItem, citeStr, pluginBaseItem));
  items.push_back(pluginParamsItem);

  // Params will be a json string which needs splitting into child tree items
  // [key/value]
  ::Json::Value root;
  std::string paramString = row.cell<std::string>(1);
  ::Json::Reader r;
  if (r.parse(paramString, root)) {
    auto members = root.getMemberNames();
    for (auto it = members.begin(); it != members.end(); ++it) {
      OwnTreeWidgetItem *container =
          new OwnTreeWidgetItem(pluginParamsItem, pluginBaseItem);

      QWidget *w = new QWidget();
      w->setAutoFillBackground(true);

      QHBoxLayout *layout = new QHBoxLayout(w);
      layout->setMargin(1);
      QLabel *label1 = new QLabel(QString::fromStdString((*it) + ": "));

      QTreeWidget *paramContainerTree = new QTreeWidget(w);
      connect(paramContainerTree, SIGNAL(itemChanged(QTreeWidgetItem *, int)),
              this, SLOT(paramValModified(QTreeWidgetItem *, int)));
      paramContainerTree->setHeaderHidden(true);
      paramContainerTree->setIndentation(0);

      auto jsonVal = root.get(*it, "");
      std::string valStr = pluginParamValString(jsonVal, *it);

      QStringList paramVal(QString::fromStdString(valStr));
      OwnTreeWidgetItem *paramValueItem =
          new OwnTreeWidgetItem(paramVal, pluginBaseItem, *it);
      paramValueItem->setFlags(Qt::ItemIsEditable | Qt::ItemIsEnabled);

      paramContainerTree->addTopLevelItem(paramValueItem);
      QRect rect = paramContainerTree->visualItemRect(paramValueItem);
      paramContainerTree->setMaximumHeight(rect.height());
      paramContainerTree->setFrameShape(QFrame::NoFrame);

      layout->addWidget(label1);
      layout->addWidget(paramContainerTree);

      pluginParamsItem->addChild(container);
      m_uiSavu.treeCurrentPlugins->setItemWidget(container, 0, w);
    }
  }
Пример #7
0
TrayWindow::TrayWindow(AppCore *core, QWidget *parent)
  : QFrame(parent, Qt::Window | Qt::CustomizeWindowHint | Qt::WindowStaysOnTopHint)
  , m_pin(false)
  , m_core(core)
  , m_width(0)
{
  setObjectName(LS("TrayWindow"));
  setFocusPolicy(Qt::WheelFocus);
  setAcceptDrops(true);

  m_topFrame = new QFrame(this);
  m_topFrame->setObjectName("top_frame");

  m_recentLabel = new QLabel(this);

  m_recentView = new RecentView(this);

  m_pinBtn = new QToolButton(this);
  m_pinBtn->setObjectName("menu_btn");
  m_pinBtn->setFocusPolicy(Qt::NoFocus);
  m_pinBtn->setAutoRaise(true);
  m_pinBtn->setIcon(QIcon(":/images/pin.png"));
  m_pinBtn->setCheckable(true);

  createMenu();

  m_controlFrame = new QFrame(this);
  m_controlFrame->setObjectName("control_frame");

  addButton(QIcon(":/images/rect.png"),    RectangleBtn);
  addButton(QIcon(":/images/desktop.png"), FullscreenBtn);
  addButton(QIcon(":/images/open.png"),    FileBtn);

  m_linksFrame = new QFrame(this);
  m_linksFrame->setObjectName("links_frame");

  m_siteBtn = new QToolButton(this);
  m_siteBtn->setObjectName("site_btn");
  m_siteBtn->setText(ORG_DOMAIN);
  m_siteBtn->setFocusPolicy(Qt::NoFocus);
  m_siteBtn->setCursor(Qt::PointingHandCursor);
  m_siteBtn->setIcon(QIcon(":/images/globe.png"));
  m_siteBtn->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);

  retranslateUi();

  QHBoxLayout *topLay = new QHBoxLayout(m_topFrame);
  topLay->addWidget(m_recentLabel);
  topLay->addStretch();
  topLay->addWidget(m_pinBtn);
  topLay->addWidget(m_menuBtn);
  topLay->setContentsMargins(8, 6, 4, 6);
  topLay->setSpacing(0);

  QHBoxLayout *controlLay = new QHBoxLayout(m_controlFrame);
  controlLay->addWidget(m_buttons.value(RectangleBtn));
  controlLay->addWidget(m_buttons.value(FullscreenBtn));
  controlLay->addWidget(m_buttons.value(FileBtn));
  controlLay->setSpacing(0);

  QHBoxLayout *linksLay = new QHBoxLayout(m_linksFrame);
  linksLay->addStretch();
  linksLay->addWidget(m_siteBtn);
  linksLay->addStretch();

  QVBoxLayout *layout = new QVBoxLayout(this);
  layout->addWidget(m_topFrame);
  layout->addWidget(m_recentView);
  layout->addWidget(m_controlFrame);
  layout->addWidget(m_linksFrame);
  layout->setMargin(0);
  layout->setSpacing(0);

  foreach (QToolButton *button, m_buttons) {
    connect(button, SIGNAL(clicked()), SLOT(close()));
  }
Пример #8
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("KombatKoin") + " - " + 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);
}
Пример #9
0
InstrumentWindowMaskTab::InstrumentWindowMaskTab(InstrumentWindow* instrWindow):
QFrame(instrWindow),
m_instrumentWindow(instrWindow),
m_activity(Select),
m_userEditing(true)
{
  m_instrumentDisplay = m_instrumentWindow->getInstrumentDisplay();

  // main layout
  QVBoxLayout* layout=new QVBoxLayout(this);

  // Create the tool buttons

  m_move = new QPushButton();
  m_move->setCheckable(true);
  m_move->setAutoExclusive(true);
  m_move->setIcon(QIcon(":/PickTools/selection-tube.png"));
  m_move->setToolTip("Move the instrument");

  m_pointer = new QPushButton();
  m_pointer->setCheckable(true);
  m_pointer->setAutoExclusive(true);
  m_pointer->setIcon(QIcon(":/MaskTools/selection-pointer.png"));
  m_pointer->setToolTip("Select and edit shapes");

  m_ellipse = new QPushButton();
  m_ellipse->setCheckable(true);
  m_ellipse->setAutoExclusive(true);
  m_ellipse->setIcon(QIcon(":/MaskTools/selection-circle.png"));
  m_ellipse->setToolTip("Draw an ellipse");

  m_rectangle = new QPushButton();
  m_rectangle->setCheckable(true);
  m_rectangle->setAutoExclusive(true);
  m_rectangle->setIcon(QIcon(":/MaskTools/selection-box.png"));
  m_rectangle->setToolTip("Draw a rectangle");

  m_ring_ellipse = new QPushButton();
  m_ring_ellipse->setCheckable(true);
  m_ring_ellipse->setAutoExclusive(true);
  m_ring_ellipse->setIcon(QIcon(":/MaskTools/selection-circle.png"));
  m_ring_ellipse->setToolTip("Draw an elliptical ring");

  m_ring_rectangle = new QPushButton();
  m_ring_rectangle->setCheckable(true);
  m_ring_rectangle->setAutoExclusive(true);
  m_ring_rectangle->setIcon(QIcon(":/MaskTools/selection-box.png"));
  m_ring_rectangle->setToolTip("Draw a rectangular ring ");

  QHBoxLayout* toolBox = new QHBoxLayout();
  toolBox->addWidget(m_move);
  toolBox->addWidget(m_pointer);
  toolBox->addWidget(m_ellipse);
  toolBox->addWidget(m_rectangle);
  toolBox->addWidget(m_ring_ellipse);
  toolBox->addWidget(m_ring_rectangle);
  toolBox->addStretch();
  toolBox->setSpacing(2);

  connect(m_move,SIGNAL(clicked()),this,SLOT(setActivity()));
  connect(m_pointer,SIGNAL(clicked()),this,SLOT(setActivity()));
  connect(m_ellipse,SIGNAL(clicked()),this,SLOT(setActivity()));
  connect(m_rectangle,SIGNAL(clicked()),this,SLOT(setActivity()));
  connect(m_ring_ellipse,SIGNAL(clicked()),this,SLOT(setActivity()));
  connect(m_ring_rectangle,SIGNAL(clicked()),this,SLOT(setActivity()));
  m_move->setChecked(true);

  layout->addLayout(toolBox);

  // Create property browser

    /* Create property managers: they create, own properties, get and set values  */

  m_groupManager = new QtGroupPropertyManager(this);
  m_doubleManager = new QtDoublePropertyManager(this);
  connect(m_doubleManager,SIGNAL(propertyChanged(QtProperty*)),this,SLOT(doubleChanged(QtProperty*)));

     /* Create editors and assign them to the managers */

  DoubleEditorFactory *doubleEditorFactory = new DoubleEditorFactory(this);

  m_browser = new QtTreePropertyBrowser();
  m_browser->setFactoryForManager(m_doubleManager, doubleEditorFactory);
  
  layout->addWidget(m_browser);

  // Algorithm buttons

  m_apply = new QPushButton("Apply");
  connect(m_apply,SIGNAL(clicked()),this,SLOT(applyMask()));

  m_clear_all = new QPushButton("Clear All");
  connect(m_clear_all,SIGNAL(clicked()),this,SLOT(clearMask()));

  m_save_as_workspace_include = new QAction("Save As Workspace (include)",this);
  connect(m_save_as_workspace_include,SIGNAL(activated()),this,SLOT(saveMaskToWorkspaceInclude()));

  m_save_as_workspace_exclude = new QAction("Save As Workspace (exclude)",this);
  connect(m_save_as_workspace_exclude,SIGNAL(activated()),this,SLOT(saveMaskToWorkspaceExclude()));

  m_save_as_file_include = new QAction("Save As File (include)",this);
  connect(m_save_as_file_include,SIGNAL(activated()),this,SLOT(saveMaskToFileInclude()));

  m_save_as_file_exclude = new QAction("Save As File (exclude)",this);
  connect(m_save_as_file_exclude,SIGNAL(activated()),this,SLOT(saveMaskToFileExclude()));

  QPushButton* saveButton = new QPushButton("Save");
  QMenu* saveMenu = new QMenu(this);
  saveMenu->addAction(m_save_as_workspace_include);
  saveMenu->addAction(m_save_as_workspace_exclude);
  saveMenu->addAction(m_save_as_file_include);
  saveMenu->addAction(m_save_as_file_exclude);
  saveButton->setMenu(saveMenu);

  QGridLayout* buttons = new QGridLayout();
  buttons->addWidget(m_apply,0,0);
  buttons->addWidget(m_clear_all,0,1);
  buttons->addWidget(saveButton,1,0,1,2);
  
  layout->addLayout(buttons);
}
// Configuration widget
CMakeRunConfigurationWidget::CMakeRunConfigurationWidget(CMakeRunConfiguration *cmakeRunConfiguration, QWidget *parent)
    : QWidget(parent), m_ignoreChange(false), m_cmakeRunConfiguration(cmakeRunConfiguration)
{
    QFormLayout *fl = new QFormLayout();
    fl->setMargin(0);
    fl->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow);
    QLineEdit *argumentsLineEdit = new QLineEdit();
    argumentsLineEdit->setText(cmakeRunConfiguration->commandLineArguments());
    connect(argumentsLineEdit, SIGNAL(textChanged(QString)),
            this, SLOT(setArguments(QString)));
    fl->addRow(tr("Arguments:"), argumentsLineEdit);

    m_workingDirectoryEdit = new Utils::PathChooser();
    m_workingDirectoryEdit->setExpectedKind(Utils::PathChooser::Directory);
    m_workingDirectoryEdit->setBaseDirectory(m_cmakeRunConfiguration->target()->project()->projectDirectory());
    m_workingDirectoryEdit->setPath(m_cmakeRunConfiguration->baseWorkingDirectory());
    m_workingDirectoryEdit->setPromptDialogTitle(tr("Select Working Directory"));

    QToolButton *resetButton = new QToolButton();
    resetButton->setToolTip(tr("Reset to default"));
    resetButton->setIcon(QIcon(QLatin1String(Core::Constants::ICON_RESET)));

    QHBoxLayout *boxlayout = new QHBoxLayout();
    boxlayout->addWidget(m_workingDirectoryEdit);
    boxlayout->addWidget(resetButton);

    fl->addRow(tr("Working directory:"), boxlayout);

    QCheckBox *runInTerminal = new QCheckBox;
    fl->addRow(tr("Run in Terminal"), runInTerminal);

    m_detailsContainer = new Utils::DetailsWidget(this);
    m_detailsContainer->setState(Utils::DetailsWidget::NoSummary);

    QWidget *m_details = new QWidget(m_detailsContainer);
    m_detailsContainer->setWidget(m_details);
    m_details->setLayout(fl);

    QVBoxLayout *vbx = new QVBoxLayout(this);
    vbx->setMargin(0);;
    vbx->addWidget(m_detailsContainer);

    QLabel *environmentLabel = new QLabel(this);
    environmentLabel->setText(tr("Run Environment"));
    QFont f = environmentLabel->font();
    f.setBold(true);
    f.setPointSizeF(f.pointSizeF() *1.2);
    environmentLabel->setFont(f);
    vbx->addWidget(environmentLabel);

    QWidget *baseEnvironmentWidget = new QWidget;
    QHBoxLayout *baseEnvironmentLayout = new QHBoxLayout(baseEnvironmentWidget);
    baseEnvironmentLayout->setMargin(0);
    QLabel *label = new QLabel(tr("Base environment for this runconfiguration:"), this);
    baseEnvironmentLayout->addWidget(label);
    m_baseEnvironmentComboBox = new QComboBox(this);
    m_baseEnvironmentComboBox->addItems(QStringList()
                                        << tr("Clean Environment")
                                        << tr("System Environment")
                                        << tr("Build Environment"));
    m_baseEnvironmentComboBox->setCurrentIndex(m_cmakeRunConfiguration->baseEnvironmentBase());
    connect(m_baseEnvironmentComboBox, SIGNAL(currentIndexChanged(int)),
            this, SLOT(baseEnvironmentComboBoxChanged(int)));
    baseEnvironmentLayout->addWidget(m_baseEnvironmentComboBox);
    baseEnvironmentLayout->addStretch(10);

    m_environmentWidget = new ProjectExplorer::EnvironmentWidget(this, baseEnvironmentWidget);
    m_environmentWidget->setBaseEnvironment(m_cmakeRunConfiguration->baseEnvironment());
    m_environmentWidget->setBaseEnvironmentText(m_cmakeRunConfiguration->baseEnvironmentText());
    m_environmentWidget->setUserChanges(m_cmakeRunConfiguration->userEnvironmentChanges());

    vbx->addWidget(m_environmentWidget);

    connect(m_workingDirectoryEdit, SIGNAL(changed(QString)),
            this, SLOT(setWorkingDirectory()));

    connect(resetButton, SIGNAL(clicked()),
            this, SLOT(resetWorkingDirectory()));

    connect(runInTerminal, SIGNAL(toggled(bool)),
            this, SLOT(runInTerminalToggled(bool)));

    connect(m_environmentWidget, SIGNAL(userChangesChanged()),
            this, SLOT(userChangesChanged()));

    connect(m_cmakeRunConfiguration, SIGNAL(baseWorkingDirectoryChanged(QString)),
            this, SLOT(workingDirectoryChanged(QString)));
    connect(m_cmakeRunConfiguration, SIGNAL(baseEnvironmentChanged()),
            this, SLOT(baseEnvironmentChanged()));
    connect(m_cmakeRunConfiguration, SIGNAL(userEnvironmentChangesChanged(QList<Utils::EnvironmentItem>)),
            this, SLOT(userEnvironmentChangesChanged()));

    setEnabled(m_cmakeRunConfiguration->isEnabled());
}
Пример #11
0
DasmWindow::DasmWindow(running_machine* machine, QWidget* parent) :
	WindowQt(machine, NULL)
{
	setWindowTitle("Debug: Disassembly View");

	if (parent != NULL)
	{
		QPoint parentPos = parent->pos();
		setGeometry(parentPos.x()+100, parentPos.y()+100, 800, 400);
	}

	//
	// The main frame and its input and log widgets
	//
	QFrame* mainWindowFrame = new QFrame(this);

	// The top frame & groupbox that contains the input widgets
	QFrame* topSubFrame = new QFrame(mainWindowFrame);

	// The input edit
	m_inputEdit = new QLineEdit(topSubFrame);
	connect(m_inputEdit, &QLineEdit::returnPressed, this, &DasmWindow::expressionSubmitted);

	// The cpu combo box
	m_cpuComboBox = new QComboBox(topSubFrame);
	m_cpuComboBox->setObjectName("cpu");
	m_cpuComboBox->setMinimumWidth(300);
	connect(m_cpuComboBox, static_cast<void(QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, &DasmWindow::cpuChanged);

	// The main disasm window
	m_dasmView = new DebuggerView(DVT_DISASSEMBLY, m_machine, this);
	connect(m_dasmView, &DebuggerView::updated, this, &DasmWindow::dasmViewUpdated);

	// Force a recompute of the disassembly region
	downcast<debug_view_disasm*>(m_dasmView->view())->set_expression("curpc");

	// Populate the combo box & set the proper cpu
	populateComboBox();
	//const debug_view_source *source = mem->views[0]->view->source_for_device(curcpu);
	//gtk_combo_box_set_active(zone_w, mem->views[0]->view->source_list().indexof(*source));
	//mem->views[0]->view->set_source(*source);


	// Layout
	QHBoxLayout* subLayout = new QHBoxLayout(topSubFrame);
	subLayout->addWidget(m_inputEdit);
	subLayout->addWidget(m_cpuComboBox);
	subLayout->setSpacing(3);
	subLayout->setContentsMargins(2,2,2,2);

	QVBoxLayout* vLayout = new QVBoxLayout(mainWindowFrame);
	vLayout->setSpacing(3);
	vLayout->setContentsMargins(2,2,2,2);
	vLayout->addWidget(topSubFrame);
	vLayout->addWidget(m_dasmView);

	setCentralWidget(mainWindowFrame);

	//
	// Menu bars
	//
	// Create three commands
	m_breakpointToggleAct = new QAction("Toggle Breakpoint at Cursor", this);
	m_breakpointEnableAct = new QAction("Disable Breakpoint at Cursor", this);
	m_runToCursorAct = new QAction("Run to Cursor", this);
	m_breakpointToggleAct->setShortcut(Qt::Key_F9);
	m_breakpointEnableAct->setShortcut(Qt::SHIFT + Qt::Key_F9);
	m_runToCursorAct->setShortcut(Qt::Key_F4);
	connect(m_breakpointToggleAct, &QAction::triggered, this, &DasmWindow::toggleBreakpointAtCursor);
	connect(m_breakpointEnableAct, &QAction::triggered, this, &DasmWindow::enableBreakpointAtCursor);
	connect(m_runToCursorAct, &QAction::triggered, this, &DasmWindow::runToCursor);

	// Right bar options
	QActionGroup* rightBarGroup = new QActionGroup(this);
	rightBarGroup->setObjectName("rightbargroup");
	QAction* rightActRaw = new QAction("Raw Opcodes", this);
	QAction* rightActEncrypted = new QAction("Encrypted Opcodes", this);
	QAction* rightActComments = new QAction("Comments", this);
	rightActRaw->setCheckable(true);
	rightActEncrypted->setCheckable(true);
	rightActComments->setCheckable(true);
	rightActRaw->setActionGroup(rightBarGroup);
	rightActEncrypted->setActionGroup(rightBarGroup);
	rightActComments->setActionGroup(rightBarGroup);
	rightActRaw->setShortcut(QKeySequence("Ctrl+R"));
	rightActEncrypted->setShortcut(QKeySequence("Ctrl+E"));
	rightActComments->setShortcut(QKeySequence("Ctrl+C"));
	rightActRaw->setChecked(true);
	connect(rightBarGroup, &QActionGroup::triggered, this, &DasmWindow::rightBarChanged);

	// Assemble the options menu
	QMenu* optionsMenu = menuBar()->addMenu("&Options");
	optionsMenu->addAction(m_breakpointToggleAct);
	optionsMenu->addAction(m_breakpointEnableAct);
	optionsMenu->addAction(m_runToCursorAct);
	optionsMenu->addSeparator();
	optionsMenu->addActions(rightBarGroup->actions());
}
Пример #12
0
GradientWidget::GradientWidget(QWidget *parent)
    : QWidget(parent)
{
    setWindowTitle(tr("Gradients"));

    m_renderer = new GradientRenderer(this);

    QGroupBox *mainGroup = new QGroupBox(this);
    mainGroup->setTitle(tr("Gradients"));

    QGroupBox *editorGroup = new QGroupBox(mainGroup);
    editorGroup->setTitle(tr("Color Editor"));
    m_editor = new GradientEditor(editorGroup);

    QGroupBox *typeGroup = new QGroupBox(mainGroup);
    typeGroup->setTitle(tr("Gradient Type"));
    m_linearButton = new QRadioButton(tr("Linear Gradient"), typeGroup);
    m_radialButton = new QRadioButton(tr("Radial Gradient"), typeGroup);
    m_conicalButton = new QRadioButton(tr("Conical Gradient"), typeGroup);

    QGroupBox *spreadGroup = new QGroupBox(mainGroup);
    spreadGroup->setTitle(tr("Spread Method"));
    m_padSpreadButton = new QRadioButton(tr("Pad Spread"), spreadGroup);
    m_reflectSpreadButton = new QRadioButton(tr("Reflect Spread"), spreadGroup);
    m_repeatSpreadButton = new QRadioButton(tr("Repeat Spread"), spreadGroup);

    QGroupBox *defaultsGroup = new QGroupBox(mainGroup);
    defaultsGroup->setTitle(tr("Defaults"));
    QPushButton *default1Button = new QPushButton(tr("1"), defaultsGroup);
    QPushButton *default2Button = new QPushButton(tr("2"), defaultsGroup);
    QPushButton *default3Button = new QPushButton(tr("3"), defaultsGroup);
    QPushButton *default4Button = new QPushButton(tr("Reset"), editorGroup);

    QPushButton *showSourceButton = new QPushButton(mainGroup);
    showSourceButton->setText(tr("Show Source"));
#ifdef QT_OPENGL_SUPPORT
    QPushButton *enableOpenGLButton = new QPushButton(mainGroup);
    enableOpenGLButton->setText(tr("Use OpenGL"));
    enableOpenGLButton->setCheckable(true);
    enableOpenGLButton->setChecked(m_renderer->usesOpenGL());
    if (!QGLFormat::hasOpenGL())
        enableOpenGLButton->hide();
#endif
    QPushButton *whatsThisButton = new QPushButton(mainGroup);
    whatsThisButton->setText(tr("What's This?"));
    whatsThisButton->setCheckable(true);

    // Layouts
    QHBoxLayout *mainLayout = new QHBoxLayout(this);
    mainLayout->addWidget(m_renderer);
    mainLayout->addWidget(mainGroup);

    mainGroup->setFixedWidth(180);
    QVBoxLayout *mainGroupLayout = new QVBoxLayout(mainGroup);
    mainGroupLayout->addWidget(editorGroup);
    mainGroupLayout->addWidget(typeGroup);
    mainGroupLayout->addWidget(spreadGroup);
    mainGroupLayout->addWidget(defaultsGroup);
    mainGroupLayout->addStretch(1);
    mainGroupLayout->addWidget(showSourceButton);
#ifdef QT_OPENGL_SUPPORT
    mainGroupLayout->addWidget(enableOpenGLButton);
#endif
    mainGroupLayout->addWidget(whatsThisButton);

    QVBoxLayout *editorGroupLayout = new QVBoxLayout(editorGroup);
    editorGroupLayout->addWidget(m_editor);

    QVBoxLayout *typeGroupLayout = new QVBoxLayout(typeGroup);
    typeGroupLayout->addWidget(m_linearButton);
    typeGroupLayout->addWidget(m_radialButton);
    typeGroupLayout->addWidget(m_conicalButton);

    QVBoxLayout *spreadGroupLayout = new QVBoxLayout(spreadGroup);
    spreadGroupLayout->addWidget(m_padSpreadButton);
    spreadGroupLayout->addWidget(m_repeatSpreadButton);
    spreadGroupLayout->addWidget(m_reflectSpreadButton);

    QHBoxLayout *defaultsGroupLayout = new QHBoxLayout(defaultsGroup);
    defaultsGroupLayout->addWidget(default1Button);
    defaultsGroupLayout->addWidget(default2Button);
    defaultsGroupLayout->addWidget(default3Button);
    editorGroupLayout->addWidget(default4Button);

    connect(m_editor, SIGNAL(gradientStopsChanged(QGradientStops)),
            m_renderer, SLOT(setGradientStops(QGradientStops)));

    connect(m_linearButton, SIGNAL(clicked()), m_renderer, SLOT(setLinearGradient()));
    connect(m_radialButton, SIGNAL(clicked()), m_renderer, SLOT(setRadialGradient()));
    connect(m_conicalButton, SIGNAL(clicked()), m_renderer, SLOT(setConicalGradient()));

    connect(m_padSpreadButton, SIGNAL(clicked()), m_renderer, SLOT(setPadSpread()));
    connect(m_reflectSpreadButton, SIGNAL(clicked()), m_renderer, SLOT(setReflectSpread()));
    connect(m_repeatSpreadButton, SIGNAL(clicked()), m_renderer, SLOT(setRepeatSpread()));

    connect(default1Button, SIGNAL(clicked()), this, SLOT(setDefault1()));
    connect(default2Button, SIGNAL(clicked()), this, SLOT(setDefault2()));
    connect(default3Button, SIGNAL(clicked()), this, SLOT(setDefault3()));
    connect(default4Button, SIGNAL(clicked()), this, SLOT(setDefault4()));

    connect(showSourceButton, SIGNAL(clicked()), m_renderer, SLOT(showSource()));
#ifdef QT_OPENGL_SUPPORT
    connect(enableOpenGLButton, SIGNAL(clicked(bool)), m_renderer, SLOT(enableOpenGL(bool)));
#endif
    connect(whatsThisButton, SIGNAL(clicked(bool)), m_renderer, SLOT(setDescriptionEnabled(bool)));
    connect(whatsThisButton, SIGNAL(clicked(bool)),
            m_renderer->hoverPoints(), SLOT(setDisabled(bool)));
    connect(m_renderer, SIGNAL(descriptionEnabledChanged(bool)),
            whatsThisButton, SLOT(setChecked(bool)));
    connect(m_renderer, SIGNAL(descriptionEnabledChanged(bool)),
            m_renderer->hoverPoints(), SLOT(setDisabled(bool)));

    m_renderer->loadSourceFile(":res/gradients/gradients.cpp");
    m_renderer->loadDescription(":res/gradients/gradients.html");

    QTimer::singleShot(50, this, SLOT(setDefault1()));
}
Пример #13
0
void MainWindow::CreateLayout()
{
    layout = new QHBoxLayout;

    QHBoxLayout* leftLayout = new QHBoxLayout;
    leftLayout->setContentsMargins(10, 0, 10, 0);
    leftLayout->setSpacing(20);

    gxin = new ClickedLabel(20);
    gxin->setText("<u>更新</u>");
    connect(gxin,SIGNAL(clicked()),this,SLOT(OnGengxin()));

    wluo = new ClickedLabel(20);
    wluo->setText("<u>网络</u>");
    wluo->setDisabled(true);

    wjian = new ClickedLabel(20);
    wjian->setText("<u>文件</u>");
    connect(wjian, SIGNAL(clicked()),this, SLOT(OnWenjian()));

    bbiao = new ClickedLabel(20);
    bbiao->setText("<u>报表</u>");
    connect(bbiao,SIGNAL(clicked()),this,SLOT(OnBaobiao()));

    fwuqi = new ClickedLabel(20);
    fwuqi->setVisible(false);
    fwuqi->setText("<u>服务器</u>");
    connect(fwuqi,SIGNAL(clicked()),this,SLOT(OnJiaoZhun()));

    cangkuid = new QLabel;
    cangkuid->setText("仓库ID:");

    devDB devDB;
    string cid;
    devDB.get(CHAN_ID, cid);
    id = new QLabel;
    id->setText(QString::fromStdString(cid));

    //更新图标
    LabUpdateState = new QLabel;
    LabUpdateState->setVisible(false);
    MvUpdate = new QMovie(":/images/updating.gif");
    LabUpdateState->setMovie(MvUpdate);
    //connect(this,SIGNAL(setMvState()),MvUpdate,SLOT(ChangeMvState()));
    network = new QLabel;
    //if(m_netConf->isOnline())
    if(Global::s_netState)
    {
        QImage image1(":/images/NetConn24.ico");
        network->setPixmap(QPixmap::fromImage(image1));
    }
    else
    {
        QImage image1(":/images/NetDisConn24.ico");
        network->setPixmap(QPixmap::fromImage(image1));
    }
    //neicun = new QLabel;
    //QImage CardImage(":/images/SdCard24.ico");
    //neicun->setPixmap(QPixmap::fromImage(CardImage));

    shangchuan = new QPushButton;
    shangchuan->setText("上传");
    connect(shangchuan,SIGNAL(clicked()),this,SLOT(OnShangchuan()));

    weishangchuan = new QLabel;
    weishangchuan->setText("未上传:");

    wscnum = new QLabel;
    wscnum->setText("0");

    QSpacerItem* horizonSpacer1 = new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum);
    QSpacerItem* horizonSpacer2 = new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum);
    leftLayout->addWidget(gxin);
    leftLayout->addWidget(wluo);
    leftLayout->addWidget(wjian);
    leftLayout->addWidget(bbiao);
    layout->addLayout(leftLayout);

    layout->addSpacerItem(horizonSpacer1);
    layout->addWidget(cangkuid);
    layout->addWidget(id);
    layout->addSpacerItem(horizonSpacer2);
    layout->addWidget(network);
    //layout->addWidget(neicun);
    layout->addWidget(shangchuan);
    layout->addWidget(weishangchuan);
    layout->addWidget(wscnum);
    //layout->addWidget(LabUpdateState);


    gridlayout = new QGridLayout;
    for(int nDevCount = 0; nDevCount < DEVCOUNT; nDevCount++)
    {
        DevWdg* TmpDevWdg = new DevWdg;
        s_devArray[nDevCount] = TmpDevWdg;
        //VecDev.append(TmpDevWdg);
        QString strNum = QString::number((nDevCount+1),10);
        s_devArray[nDevCount]->SetNum(strNum);
        s_devArray[nDevCount]->SetStatus(tr("空闲"));
        gridlayout->addWidget(s_devArray[nDevCount],nDevCount/6,nDevCount%6);
    }
}
Пример #14
0
ProfileForm::ProfileForm(QWidget *parent) :
    QWidget{parent}, qr{nullptr}
{
    bodyUI = new Ui::IdentitySettings;
    bodyUI->setupUi(this);
    core = Core::getInstance();

    head = new QWidget(this);
    QHBoxLayout* headLayout = new QHBoxLayout();
    head->setLayout(headLayout);

    QLabel* imgLabel = new QLabel();
    headLayout->addWidget(imgLabel);

    nameLabel = new QLabel();
    QFont bold;
    bold.setBold(true);
    nameLabel->setFont(bold);
    headLayout->addWidget(nameLabel);
    headLayout->addStretch(1);

    imgLabel->setPixmap(QPixmap(":/img/settings/identity.png").scaledToHeight(40, Qt::SmoothTransformation));

    // tox
    toxId = new ClickableTE();
    toxId->setReadOnly(true);
    toxId->setFrame(false);
    toxId->setFont(Style::getFont(Style::Small));
    toxId->setToolTip(bodyUI->toxId->toolTip());

    QVBoxLayout *toxIdGroup = qobject_cast<QVBoxLayout*>(bodyUI->toxGroup->layout());
    delete toxIdGroup->replaceWidget(bodyUI->toxId, toxId);     // Original toxId is in heap, delete it
    bodyUI->toxId->hide();

    /* Toxme section init */
    bodyUI->toxmeServersList->addItem("toxme.io");
    QString toxmeInfo = Settings::getInstance().getToxmeInfo();
    if (toxmeInfo.isEmpty()) // User not registered
        showRegisterToxme();
    else
        showExistingToxme();

    bodyUI->qrLabel->setWordWrap(true);

    QRegExp re("[^@ ]+");
    QRegExpValidator* validator = new QRegExpValidator(re);
    bodyUI->toxmeUsername->setValidator(validator);

    profilePicture = new MaskablePixmapWidget(this, QSize(64, 64), ":/img/avatar_mask.svg");
    profilePicture->setPixmap(QPixmap(":/img/contact_dark.svg"));
    profilePicture->setContextMenuPolicy(Qt::CustomContextMenu);
    profilePicture->setClickable(true);
    profilePicture->installEventFilter(this);
    connect(profilePicture, SIGNAL(clicked()), this, SLOT(onAvatarClicked()));
    connect(profilePicture, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(showProfilePictureContextMenu(const QPoint&)));
    QHBoxLayout *publicGrouplayout = qobject_cast<QHBoxLayout*>(bodyUI->publicGroup->layout());
    publicGrouplayout->insertWidget(0, profilePicture);
    publicGrouplayout->insertSpacing(1, 7);

    timer.setInterval(750);
    timer.setSingleShot(true);
    connect(&timer, &QTimer::timeout, this, [=]() {bodyUI->toxIdLabel->setText(bodyUI->toxIdLabel->text().replace(" ✔", "")); hasCheck = false;});

    connect(bodyUI->toxIdLabel, SIGNAL(clicked()), this, SLOT(copyIdClicked()));
    connect(toxId, SIGNAL(clicked()), this, SLOT(copyIdClicked()));
    connect(core, &Core::idSet, this, &ProfileForm::setToxId);
    connect(bodyUI->userName, SIGNAL(editingFinished()), this, SLOT(onUserNameEdited()));
    connect(bodyUI->statusMessage, SIGNAL(editingFinished()), this, SLOT(onStatusMessageEdited()));
    connect(bodyUI->renameButton, &QPushButton::clicked, this, &ProfileForm::onRenameClicked);
    connect(bodyUI->exportButton, &QPushButton::clicked, this, &ProfileForm::onExportClicked);
    connect(bodyUI->deleteButton, &QPushButton::clicked, this, &ProfileForm::onDeleteClicked);
    connect(bodyUI->logoutButton, &QPushButton::clicked, this, &ProfileForm::onLogoutClicked);
    connect(bodyUI->deletePassButton, &QPushButton::clicked, this, &ProfileForm::onDeletePassClicked);
    connect(bodyUI->changePassButton, &QPushButton::clicked, this, &ProfileForm::onChangePassClicked);
    connect(bodyUI->saveQr, &QPushButton::clicked, this, &ProfileForm::onSaveQrClicked);
    connect(bodyUI->copyQr, &QPushButton::clicked, this, &ProfileForm::onCopyQrClicked);
    connect(bodyUI->toxmeRegisterButton, &QPushButton::clicked, this, &ProfileForm::onRegisterButtonClicked);
    connect(bodyUI->toxmeUpdateButton, &QPushButton::clicked, this, &ProfileForm::onRegisterButtonClicked);

    connect(core, &Core::usernameSet, this, [=](const QString& val) { bodyUI->userName->setText(val); });
    connect(core, &Core::statusMessageSet, this, [=](const QString& val) { bodyUI->statusMessage->setText(val); });

    for (QComboBox* cb : findChildren<QComboBox*>())
    {
            cb->installEventFilter(this);
            cb->setFocusPolicy(Qt::StrongFocus);
    }

    retranslateUi();
    Translator::registerHandler(std::bind(&ProfileForm::retranslateUi, this), this);
}
Пример #15
0
ExprAddDialog::ExprAddDialog(int& count, QWidget* parent) : QDialog(parent) {
    QVBoxLayout* verticalLayout;
    verticalLayout = new QVBoxLayout();
    verticalLayout->setSpacing(3);
    verticalLayout->setMargin(3);
    setLayout(verticalLayout);
    QHBoxLayout* horizontalLayout = new QHBoxLayout();

    horizontalLayout->addWidget(new QLabel("Variable"));
    // TODO would be nice to unique this over multiple sessions
    variableName = new QLineEdit(QString("$var%1").arg(count++));

    horizontalLayout->addWidget(variableName);
    verticalLayout->addLayout(horizontalLayout);

    tabWidget = new QTabWidget();

    // Curve
    {
        QWidget* curveTab = new QWidget();
        QFormLayout* curveLayout = new QFormLayout(curveTab);
        curveLayout->setWidget(0, QFormLayout::LabelRole, new QLabel("Lookup"));
        curveLookup = new QLineEdit("$u");
        curveLayout->setWidget(0, QFormLayout::FieldRole, curveLookup);
        tabWidget->addTab(curveTab, QString("Curve"));
    }

    // Color Curve
    {
        QWidget* colorCurveTab = new QWidget();
        QFormLayout* colorCurveLayout = new QFormLayout(colorCurveTab);
        colorCurveLayout->setWidget(0, QFormLayout::LabelRole, new QLabel("Lookup"));
        colorCurveLookup = new QLineEdit("$u");
        colorCurveLayout->setWidget(0, QFormLayout::FieldRole, colorCurveLookup);
        tabWidget->addTab(colorCurveTab, QString("Color Curve"));
    }

    // Integer
    {
        QWidget* intTab = new QWidget();
        QFormLayout* intFormLayout = new QFormLayout(intTab);
        intFormLayout->setWidget(0, QFormLayout::LabelRole, new QLabel("Default"));
        intFormLayout->setWidget(1, QFormLayout::LabelRole, new QLabel("Min"));
        intFormLayout->setWidget(2, QFormLayout::LabelRole, new QLabel("Max"));
        intDefault = new QLineEdit("0");
        intFormLayout->setWidget(0, QFormLayout::FieldRole, intDefault);
        intMin = new QLineEdit("0");
        intFormLayout->setWidget(1, QFormLayout::FieldRole, intMin);
        intMax = new QLineEdit("10");
        intFormLayout->setWidget(2, QFormLayout::FieldRole, intMax);
        tabWidget->addTab(intTab, QString("Int"));
    }

    // Float
    {
        QWidget* floatTab = new QWidget();
        QFormLayout* floatFormLayout = new QFormLayout(floatTab);
        floatFormLayout->setWidget(0, QFormLayout::LabelRole, new QLabel("Default"));
        floatFormLayout->setWidget(1, QFormLayout::LabelRole, new QLabel("Min"));
        floatFormLayout->setWidget(2, QFormLayout::LabelRole, new QLabel("Max"));
        floatDefault = new QLineEdit("0");
        floatFormLayout->setWidget(0, QFormLayout::FieldRole, floatDefault);
        floatMin = new QLineEdit("0");
        floatFormLayout->setWidget(1, QFormLayout::FieldRole, floatMin);
        floatMax = new QLineEdit("1");
        floatFormLayout->setWidget(2, QFormLayout::FieldRole, floatMax);

        tabWidget->addTab(floatTab, QString("Float"));
    }

    // Vector
    {
        QWidget* vectorTab = new QWidget();
        QFormLayout* vectorFormLayout = new QFormLayout(vectorTab);
        vectorFormLayout->setWidget(0, QFormLayout::LabelRole, new QLabel("Default"));
        vectorFormLayout->setWidget(1, QFormLayout::LabelRole, new QLabel("Min"));
        vectorFormLayout->setWidget(2, QFormLayout::LabelRole, new QLabel("Max"));
        vectorDefault0 = new QLineEdit("0");
        vectorDefault1 = new QLineEdit("0");
        vectorDefault2 = new QLineEdit("0");
        QHBoxLayout* compLayout = new QHBoxLayout();
        compLayout->addWidget(vectorDefault0);
        compLayout->addWidget(vectorDefault1);
        compLayout->addWidget(vectorDefault2);
        vectorFormLayout->setLayout(0, QFormLayout::FieldRole, compLayout);
        vectorMin = new QLineEdit("0");
        vectorFormLayout->setWidget(1, QFormLayout::FieldRole, vectorMin);
        vectorMax = new QLineEdit("1");
        vectorFormLayout->setWidget(2, QFormLayout::FieldRole, vectorMax);

        tabWidget->addTab(vectorTab, QString("Vector"));
    }

    // Color
    {
        QWidget* colorTab = new QWidget();
        QFormLayout* colorLayout = new QFormLayout(colorTab);
        colorWidget = new QPushButton();
        colorWidget->setFixedWidth(30);
        colorWidget->setFixedWidth(30);
        colorLayout->setWidget(0, QFormLayout::LabelRole, new QLabel("Color"));
        colorLayout->setWidget(0, QFormLayout::FieldRole, colorWidget);
        color = Qt::red;
        QPixmap colorPix(30, 30);
        colorPix.fill(color);
        colorWidget->setIcon(QIcon(colorPix));
        tabWidget->addTab(colorTab, QString("Color"));

        connect(colorWidget, SIGNAL(clicked()), this, SLOT(colorChooseClicked()));
    }

    // Color Swatch
    {
        QWidget* swatchTab = new QWidget();
        QFormLayout* swatchLayout = new QFormLayout(swatchTab);
        swatchLookup = new QLineEdit("$u");
        swatchLayout->setWidget(0, QFormLayout::LabelRole, new QLabel("Lookup"));
        swatchLayout->setWidget(0, QFormLayout::FieldRole, swatchLookup);
        rainbowPaletteBtn = new QRadioButton("Rainbow");
        rainbowPaletteBtn->setChecked(true);
        grayPaletteBtn = new QRadioButton("Shades of Gray");
        swatchLayout->setWidget(1, QFormLayout::LabelRole, new QLabel("Colors"));
        swatchLayout->setWidget(1, QFormLayout::FieldRole, rainbowPaletteBtn);
        swatchLayout->setWidget(2, QFormLayout::LabelRole, new QLabel(""));
        swatchLayout->setWidget(2, QFormLayout::FieldRole, grayPaletteBtn);
        tabWidget->addTab(swatchTab, QString("Swatch"));
    }

    // String literal
    {
        QWidget* stringTab = new QWidget();
        QFormLayout* stringLayout = new QFormLayout(stringTab);
        stringTypeWidget = new QComboBox();
        stringTypeWidget->addItem("string");
        stringTypeWidget->addItem("file");
        stringTypeWidget->addItem("directory");
        stringDefaultWidget = new QLineEdit();
        stringNameWidget = new QLineEdit("str1");

        stringLayout->setWidget(0, QFormLayout::LabelRole, new QLabel("String Name"));
        stringLayout->setWidget(0, QFormLayout::FieldRole, stringNameWidget);
        stringLayout->setWidget(1, QFormLayout::LabelRole, new QLabel("String Type"));
        stringLayout->setWidget(1, QFormLayout::FieldRole, stringTypeWidget);
        stringLayout->setWidget(2, QFormLayout::LabelRole, new QLabel("String Default"));
        stringLayout->setWidget(3, QFormLayout::FieldRole, stringDefaultWidget);

        tabWidget->addTab(stringTab, QString("String"));
    }

    // Anim Curve
    {
        QWidget* curveTab = new QWidget();
        QFormLayout* curveLayout = new QFormLayout(curveTab);
        curveLayout->setWidget(0, QFormLayout::LabelRole, new QLabel("Lookup"));
        curveLayout->setWidget(1, QFormLayout::LabelRole, new QLabel("Link"));
        animCurveLookup = new QLineEdit("$frame");
        animCurveLink = new QLineEdit("");
        curveLayout->setWidget(0, QFormLayout::FieldRole, animCurveLookup);
        curveLayout->setWidget(1, QFormLayout::FieldRole, animCurveLink);
        tabWidget->addTab(curveTab, QString("AnimCurve"));
    }

    // DeepWater
    {
        QWidget* deepWaterTab = new QWidget();
        QFormLayout* deepWaterLayout = new QFormLayout(deepWaterTab);
        deepWaterLayout->setWidget(0, QFormLayout::LabelRole, new QLabel("Lookup"));
        deepWaterLookup = new QLineEdit("$u");
        deepWaterLayout->setWidget(0, QFormLayout::FieldRole, deepWaterLookup);
        tabWidget->addTab(deepWaterTab, QString("Deep Water"));
    }

    verticalLayout->addWidget(tabWidget);

    QDialogButtonBox* buttonBox = new QDialogButtonBox();
    buttonBox->setOrientation(Qt::Horizontal);
    buttonBox->setStandardButtons(QDialogButtonBox::Cancel | QDialogButtonBox::Ok);

    verticalLayout->addWidget(buttonBox);

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

    tabWidget->setCurrentIndex(0);
}
Пример #16
0
QVBoxLayout* ServerWidget::initWidget()
{
	QVBoxLayout *layout = new QVBoxLayout;
	QHBoxLayout *row;
	//row1
	row = new QHBoxLayout;
	QLabel *label = new QLabel(tr("请选择用户查看答题情况:"));
	usersComboBox = new QComboBox;
	connect(usersComboBox, static_cast<void(QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, &ServerWidget::usersComboBoxChanged);
	addUserBtn = new QPushButton(tr("添加用户"));
	connect(addUserBtn, &QPushButton::clicked, this, &ServerWidget::addUserBtnClicked);
	userOnlineBtn = new QPushButton(tr("查看在线用户"));
	connect(userOnlineBtn, &QPushButton::clicked, this, &ServerWidget::userOnlineBtnClicked);
	row->addWidget(label);
	row->addWidget(usersComboBox);
	row->addWidget(addUserBtn);
	row->addWidget(userOnlineBtn);
	layout->addLayout(row);

	//row2 由3个垂直布局构成
	row = new QHBoxLayout;
	//ver1
	QVBoxLayout *vert = new QVBoxLayout;
	label = new QLabel(tr("未做章节:"));
	hasNotDoChapterComboBox = new QComboBox;
	connect(hasNotDoChapterComboBox, static_cast<void(QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, &ServerWidget::hasNotDoChapterComboBoxChanged);
	hasNotDoListWidget = new QListWidget;
	vert->addWidget(label);
	vert->addWidget(hasNotDoChapterComboBox);
	vert->addWidget(hasNotDoListWidget);
	row->addLayout(vert);
	//ver2
	vert = new QVBoxLayout;
	label = new QLabel(tr("已做章节:"));
	alreadyDoChapterComboBox = new QComboBox;
	connect(alreadyDoChapterComboBox, static_cast<void(QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, &ServerWidget::alreadyDoChapterComboBoxChanged);
	alreadyDoListWidget = new QListWidget;
	connect(alreadyDoListWidget, &QListWidget::itemClicked, this, &ServerWidget::alreadyDoListWidgetItemClicked);
	vert->addWidget(label);
	vert->addWidget(alreadyDoChapterComboBox);
	vert->addWidget(alreadyDoListWidget);
	row->addLayout(vert);
	//ver3
	vert = new QVBoxLayout;
	label = new QLabel(tr("用户作答:"));
	userAlreadyDoText = new QTextEdit;
	userAlreadyDoText->setReadOnly(true);
	vert->addWidget(label);
	vert->addWidget(userAlreadyDoText);

	label = new QLabel(tr("批语:"));
	commentInput = new QTextEdit;
	vert->addWidget(label);
	vert->addWidget(commentInput);

	label = new QLabel(tr("评分:"));
	scoreInput = new QLineEdit;
	vert->addWidget(label);
	vert->addWidget(scoreInput);
	commentCommitBtn = new QPushButton(tr("提交"));
	connect(commentCommitBtn, &QPushButton::clicked, this, &ServerWidget::commentCommitBtnClicked);
	vert->addWidget(commentCommitBtn);
	row->addLayout(vert);
	layout->addLayout(row);

	//row3
	row = new QHBoxLayout;
	label = new QLabel(tr("添加题目:"));
	showAlreadySelectFilePath = new QLineEdit;
	showAlreadySelectFilePath->setReadOnly(true);
	selectFileBtn = new QPushButton(tr("...选择文件"));
	connect(selectFileBtn, &QPushButton::clicked, this, &ServerWidget::selectFileBtnClicked);
	row->addWidget(label);
	row->addWidget(showAlreadySelectFilePath);
	row->addWidget(selectFileBtn);
	layout->addLayout(row);

	//row3
	row = new QHBoxLayout;
	debugMsg = new QTextEdit;
	debugMsg->setReadOnly(true);
	row->addWidget(debugMsg);
	vert = new QVBoxLayout;
	sendRemoteMsgBtn = new QPushButton(tr("发送远程消息"));
	connect(sendRemoteMsgBtn, &QPushButton::clicked, this, &ServerWidget::sendRemoteMsgBtnClicked);
	quitServerBtn = new QPushButton(tr("退出服务"));
	connect(quitServerBtn, &QPushButton::clicked, this, &ServerWidget::quitServerBtnClicked);
	vert->addWidget(sendRemoteMsgBtn);
	vert->addWidget(quitServerBtn);
	row->addLayout(vert);
	layout->addLayout(row);

	this->setLayout(layout);
	return layout;
}
Пример #17
0
CDetailsView::CDetailsView(UINT Mode, QWidget *parent)
:QWidget(parent)
{
	m_ID = 0;
	m_Mode = Mode;

	m_IsComplete = false;

	m_bLockDown = false;

	m_pMainLayout = new QVBoxLayout();

	m_pWidget = new QWidget();
	m_pLayout = new QHBoxLayout(m_pWidget);
	m_pLayout->setMargin(0);

	m_pDetailWidget = new QWidget();
	m_pDetailLayout = new QFormLayout();

	m_pFileName = new QLineEdit();
	m_pFileName->setMaximumWidth(450);
	connect(m_pFileName, SIGNAL(editingFinished()), this, SLOT(OnSetFileName()));
	m_pDetailLayout->setWidget(0, QFormLayout::LabelRole, new QLabel(tr("FileName:")));
	m_pDetailLayout->setWidget(0, QFormLayout::FieldRole, m_pFileName);

	m_pHashes = new QTableWidget();
	m_pHashes->setMaximumWidth(450);
	m_pHashes->horizontalHeader()->hide();
	m_pHashes->setSelectionMode(QAbstractItemView::NoSelection);
	m_pHashes->setEditTriggers(QTableWidget::NoEditTriggers);
	m_pDetailLayout->setWidget(1, QFormLayout::LabelRole, new QLabel(tr("Hashes:")));
	m_pDetailLayout->setWidget(1, QFormLayout::FieldRole, m_pHashes);

	m_pHashes->setContextMenuPolicy(Qt::CustomContextMenu);
	connect(m_pHashes, SIGNAL(customContextMenuRequested( const QPoint& )), this, SLOT(OnMenuRequested(const QPoint &)));

	if(theGUI->Cfg()->GetInt("Gui/AdvancedControls"))
	{
		m_pMenu = new QMenu(this);

		m_pCopyHash = new QAction(tr("Copy Hash"), m_pMenu);
		connect(m_pCopyHash, SIGNAL(triggered()), this, SLOT(OnCopyHash()));
		m_pCopyHash->setShortcut(QKeySequence::Copy);
		m_pCopyHash->setShortcutContext(Qt::WidgetShortcut);
		m_pHashes->addAction(m_pCopyHash);
		m_pMenu->addAction(m_pCopyHash);

		m_pSetMaster = new QAction(tr("Set as Master Hash"), m_pMenu);
		connect(m_pSetMaster, SIGNAL(triggered()), this, SLOT(OnSetMaster()));
		m_pMenu->addAction(m_pSetMaster);

		m_pAddHash = new QAction(tr("Add Hash"), m_pMenu);
		connect(m_pAddHash, SIGNAL(triggered()), this, SLOT(OnAddHash()));
		m_pMenu->addAction(m_pAddHash);

		m_pRemoveHash = new QAction(tr("Remove Hash"), m_pMenu);
		connect(m_pRemoveHash, SIGNAL(triggered()), this, SLOT(OnRemoveHash()));
		m_pMenu->addAction(m_pRemoveHash);

		m_pSelectHash = new QAction(tr("Use Hash"), m_pMenu);
		m_pSelectHash->setCheckable(true);
		connect(m_pSelectHash, SIGNAL(triggered()), this, SLOT(OnSelectHash()));
		m_pMenu->addAction(m_pSelectHash);

		m_pBanHash = new QAction(tr("Blacklist Hash"), m_pMenu);
		m_pBanHash->setCheckable(true);
		connect(m_pBanHash, SIGNAL(triggered()), this, SLOT(OnBanHash()));
		m_pMenu->addAction(m_pBanHash);
	}
	else
	{
		m_pMenu = NULL;
		m_pSetMaster = NULL;
		m_pAddHash = NULL;
		m_pRemoveHash = NULL;
		m_pSelectHash = NULL;
		m_pMenu = NULL;
	}

	m_pDescription = new QTextEdit();
	m_pDescription->setMaximumWidth(450);
	connect(m_pDescription, SIGNAL(textChanged()), this, SLOT(OnEnableSubmit()));
	m_pDetailLayout->setWidget(2, QFormLayout::LabelRole, new QLabel(tr("Description:")));
	m_pDetailLayout->setWidget(2, QFormLayout::FieldRole, m_pDescription);

	m_pRating = new QComboBox();
	m_pRating->setMaximumWidth(100);
	m_pRating->addItem(tr("Not Rated"));
	m_pRating->addItem(tr("Fake"));
	m_pRating->addItem(tr("Poor"));
	m_pRating->addItem(tr("Fair"));
	m_pRating->addItem(tr("Good"));
	m_pRating->addItem(tr("Excellent"));
	connect(m_pRating, SIGNAL(currentIndexChanged(int)), this, SLOT(OnEnableSubmit()));
	m_pDetailLayout->setWidget(3, QFormLayout::LabelRole, new QLabel(tr("Rating:")));
	QWidget* pRatingSubmit = new QWidget();
	pRatingSubmit->setMaximumWidth(450);
	QHBoxLayout* pSubmitLayout = new QHBoxLayout();
	pSubmitLayout->setMargin(0);
	pSubmitLayout->addWidget(m_pRating);
	//QWidget* pSpacer = new QWidget();
	//pSpacer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
	//pSubmitLayout->addWidget(pSpacer);
	m_pInfo = new QLabel();
	m_pInfo->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
	m_pInfo->setAlignment(Qt::AlignCenter);
	pSubmitLayout->addWidget(m_pInfo);
	m_pSubmit = new QPushButton(tr("Submit"));
	connect(m_pSubmit, SIGNAL(pressed()), this, SLOT(OnSetRating()));
	pSubmitLayout->addWidget(m_pSubmit);
	pRatingSubmit->setLayout(pSubmitLayout);
	m_pDetailLayout->setWidget(3, QFormLayout::FieldRole, pRatingSubmit);

	m_pDetailWidget->setLayout(m_pDetailLayout);

	m_pLayout->addWidget(m_pDetailWidget);

	m_pCoverView = new CCoverView();
	m_pCoverView->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding));

	m_pLayout->addWidget(m_pCoverView);

	if(theGUI->Cfg()->GetInt("Gui/AdvancedControls") == 1)
		m_pProgress = new CProgressBar(-1, 0, "-Plan");
	else
		m_pProgress = new CProgressBar(-1, 0, "-");
	m_pProgress->setMinimumHeight(24);
	m_pProgress->setMaximumHeight(24);
	m_pProgress->setMinimumWidth(450);

	m_pMainLayout->addWidget(m_pProgress);
	m_pMainLayout->addWidget(m_pWidget);

	setLayout(m_pMainLayout);

	m_TimerId = startTimer(500);
}
Пример #18
0
Window::Window()
{
    setWindowTitle(tr("CSC 205 Assignment 1"));

    // define our drawing widget (see GLWidget.h / .cpp)
    glWidget = new GLWidget;

    menubar = new QMenuBar;
    QMenu *file = new QMenu("&File");
    QMenu *edit = new QMenu("&Edit");
    menubar->addMenu(file);
    menubar->addMenu(edit);

    QAction *quitAct = new QAction(tr("&Close"), this);
    file->addAction(quitAct);

    // define our color sliders
    hSlider = new QSlider(Qt::Horizontal);
    sSlider = new QSlider(Qt::Horizontal);
    vSlider = new QSlider(Qt::Horizontal);

    rSlider = new QSlider(Qt::Horizontal);
    gSlider = new QSlider(Qt::Horizontal);
    bSlider = new QSlider(Qt::Horizontal);

    // added slider
    bSizeSlider = new QSlider(Qt::Horizontal);

    // configure our color sliders
    hSlider->setRange(0,360);
    hSlider->setTickInterval(360/8);
    hSlider->setTickPosition(QSlider::TicksBelow);
    hSlider->setMinimumWidth(200);


    sSlider->setRange(0,100);
    sSlider->setTickInterval(100/8);
    sSlider->setTickPosition(QSlider::TicksBelow);

    vSlider->setRange(0,100);
    vSlider->setTickInterval(100/8);
    vSlider->setTickPosition(QSlider::TicksBelow);

    rSlider->setRange(0,255);
    rSlider->setTickInterval(255/8);
    rSlider->setTickPosition(QSlider::TicksBelow);

    gSlider->setRange(0,255);
    gSlider->setTickInterval(255/8);
    gSlider->setTickPosition(QSlider::TicksBelow);

    bSlider->setRange(0,255);
    bSlider->setTickInterval(255/8);
    bSlider->setTickPosition(QSlider::TicksBelow);

    bSizeSlider->setRange(2,80);
    bSizeSlider->setTickInterval(80/6);
    bSizeSlider->setTickPosition(QSlider::TicksBelow);

    // labels for our sliders
    hLabel = new QLabel("0");
    sLabel = new QLabel("0");
    vLabel = new QLabel("0");

    rLabel = new QLabel("0");
    gLabel = new QLabel("0");
    bLabel = new QLabel("0");

    bSizeLabel = new QLabel("2");


    // The main (biggest) layout for our screen is a horizontal layout
    // This means items added to this layout will be added horizontally
    QHBoxLayout *mainLayout = new QHBoxLayout;

    // add our drawing widget as the first (leftmost) widget in our horizontal layout
    mainLayout->addWidget(glWidget);

    // our sliders are going to be in a vertical column
    QVBoxLayout *sliderLayout = new QVBoxLayout;
    sliderLayout->setAlignment(Qt::AlignTop);
    sliderLayout->setSizeConstraint(QLayout::SizeConstraint());

    // each slider has 2 labels below it in a horizontal box
    QHBoxLayout *hLabels = new QHBoxLayout;
    // first is just a name that never changes
    hLabels->addWidget(new QLabel(QString("Hue")));
    // we keep a reference to the next one because it's the label we're going to use to show
    // the value of this slider, and we'll need to update it accordingly
    hLabels->addWidget(hLabel);


    QHBoxLayout *sLabels = new QHBoxLayout;
    sLabels->addWidget(new QLabel(QString("Saturation")));
    sLabels->addWidget(sLabel);

    QHBoxLayout *vLabels = new QHBoxLayout;
    vLabels->addWidget(new QLabel(QString("Value")));
    vLabels->addWidget(vLabel);

    QHBoxLayout *rLabels = new QHBoxLayout;
    rLabels->addWidget(new QLabel(QString("Red")));
    rLabels->addWidget(rLabel);

    QHBoxLayout *gLabels = new QHBoxLayout;
    gLabels->addWidget(new QLabel(QString("Green")));
    gLabels->addWidget(gLabel);

    QHBoxLayout *bLabels = new QHBoxLayout;
    bLabels->addWidget(new QLabel(QString("Blue")));
    bLabels->addWidget(bLabel);

    QHBoxLayout *bSizeLabels = new QHBoxLayout;
    bSizeLabels->addWidget(new QLabel(QString("Brush Size")));
    bSizeLabels->addWidget(bSizeLabel);


    // we're going to have a box that shows the currently selected color
    // this is that box
    colorFrame = new QFrame;
    colorFrame->setFrameStyle(QFrame::Panel | QFrame::Raised);
    colorFrame->setLineWidth(2);
    colorFrame->setAutoFillBackground(true);
    colorFrame->setMinimumHeight(75);
    colorFrame->setMinimumWidth(75);

    // this is how we change the color of a QFrame
    QPalette pal = colorFrame->palette();
    pal.setColor(colorFrame->backgroundRole(), QColor(0,0,0));
    colorFrame->setPalette(pal);

    // add all of our sliders and our color box to our vertical slider layout
    sliderLayout->addWidget(hSlider);
    sliderLayout->addLayout(hLabels);

    sliderLayout->addWidget(sSlider);
    sliderLayout->addLayout(sLabels);

    sliderLayout->addWidget(vSlider);
    sliderLayout->addLayout(vLabels);

    sliderLayout->addWidget(colorFrame);

    sliderLayout->addWidget(rSlider);
    sliderLayout->addLayout(rLabels);

    sliderLayout->addWidget(gSlider);
    sliderLayout->addLayout(gLabels);

    sliderLayout->addWidget(bSlider);
    sliderLayout->addLayout(bLabels);

    sliderLayout->addSpacing(30);
    sliderLayout->addWidget(bSizeSlider);
    sliderLayout->addLayout(bSizeLabels);

    // add the slider layout to the main layout
    mainLayout->addLayout(sliderLayout);

    QGridLayout *buttonsLayout = new QGridLayout;
    QPushButton *rectButton[14];

    //declare buttons
    rectButton[0] = new QPushButton("Brush 1");
    rectButton[1] = new QPushButton("Brush 2");
    rectButton[2] = new QPushButton("Brush 3");
    rectButton[3] = new QPushButton("Brush 4");
    rectButton[4] = new QPushButton("Bresenham's Line");
    rectButton[5] = new QPushButton("Wu's Line");
    rectButton[6] = new QPushButton("Rectangle");
    rectButton[7] = new QPushButton("Filled Rectangle");
    rectButton[8] = new QPushButton("Circle");
    rectButton[9] = new QPushButton("Filled Circle");
    rectButton[10] = new QPushButton("Polygon");
    rectButton[11] = new QPushButton("Filled Polygon");
    rectButton[12] = new QPushButton("Edit a Vertex");
    rectButton[13] = new QPushButton("Clear");

    for (int i=0; i < 14; i++)
        buttonsLayout->addWidget(rectButton[i], i/2, i%2, Qt::AlignTop);

    sliderLayout->addLayout(buttonsLayout);
    setLayout(mainLayout);

    /*  Connections between our sliders and their labels */
    connect(hSlider, SIGNAL(valueChanged(int)), hLabel, SLOT(setNum(int)));
    connect(bSizeSlider, SIGNAL(valueChanged(int)), bSizeLabel, SLOT(setNum(int)));

    // had to use a special method for saturation and value because sliders go from 0 - 100 and we want 0 - 1
    connect(sSlider, SIGNAL(valueChanged(int)), this, SLOT(updateSVal(int)));
    connect(vSlider, SIGNAL(valueChanged(int)), this, SLOT(updateVVal(int)));

    connect(rSlider, SIGNAL(valueChanged(int)), rLabel, SLOT(setNum(int)));
    connect(gSlider, SIGNAL(valueChanged(int)), gLabel, SLOT(setNum(int)));
    connect(bSlider, SIGNAL(valueChanged(int)), bLabel, SLOT(setNum(int)));

    connect(hSlider, SIGNAL(valueChanged(int)), this, SLOT(hsvChanged()));
    connect(sSlider, SIGNAL(valueChanged(int)), this, SLOT(hsvChanged()));
    connect(vSlider, SIGNAL(valueChanged(int)), this, SLOT(hsvChanged()));

    connect(rSlider, SIGNAL(valueChanged(int)), this, SLOT(rgbChanged()));
    connect(gSlider, SIGNAL(valueChanged(int)), this, SLOT(rgbChanged()));
    connect(bSlider, SIGNAL(valueChanged(int)), this, SLOT(rgbChanged()));

    connect(bSizeSlider, SIGNAL(valueChanged(int)), glWidget, SLOT(setSize(int)));

    connect(this, SIGNAL(colorChanged(RGBColor)), glWidget, SLOT(setColor(RGBColor)));

    connect(rectButton[0], SIGNAL(clicked()), glWidget, SLOT(setBrush1() ));
    connect(rectButton[1], SIGNAL(clicked()), glWidget, SLOT(setBrush2() ));
    connect(rectButton[2], SIGNAL(clicked()), glWidget, SLOT(setBrush3() ));
    connect(rectButton[3], SIGNAL(clicked()), glWidget, SLOT(setBrush4() ));
    connect(rectButton[4], SIGNAL(clicked()), glWidget, SLOT(setBresenhamLine() ));
    connect(rectButton[5], SIGNAL(clicked()), glWidget, SLOT(setWuLine() ));
    connect(rectButton[6], SIGNAL(clicked()), glWidget, SLOT(setRectangle() ));
    connect(rectButton[7], SIGNAL(clicked()), glWidget, SLOT(setFillRectangle() ));
    connect(rectButton[8], SIGNAL(clicked()), glWidget, SLOT(setCircle() ));
    connect(rectButton[9], SIGNAL(clicked()), glWidget, SLOT(setFillCircle() ));
    connect(rectButton[10], SIGNAL(clicked()), glWidget, SLOT(setPolygon() ));
    connect(rectButton[11], SIGNAL(clicked()), glWidget, SLOT(setFillPolygon() ));
    connect(rectButton[12], SIGNAL(clicked()), glWidget, SLOT(setEditVertex() ));
    connect(rectButton[13], SIGNAL(clicked()), glWidget, SLOT(clear() ));

    connect(quitAct, SIGNAL(triggered()), this, SLOT(close()));
}
Пример #19
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent)
{

    setCentralWidget(new QWidget);
    QVBoxLayout* layout = new QVBoxLayout( centralWidget() );
    layout->setContentsMargins(0,0,0,0);
    layout->setSpacing(0);

    layout->addWidget( ui.header = new Header( this ) );
    connect( &Socket::sock(), SIGNAL(userLoggedIn(QString)), ui.header, SLOT(onUserConnected(QString)) );
    connect( &Socket::sock(), SIGNAL(userLoggedOut()), ui.header, SLOT(onUserDisconnected()) );
    connect( ui.header, SIGNAL(disconnectClicked()), &Socket::sock(), SLOT(logout()) );
    // mettre obligatoirement ici pour corriger un petit bug d'affichage

//    /*temp refresh button*/
//    QPushButton *refreshBtn = new QPushButton( "Refresh" );
//    refreshBtn->setObjectName( "refreshBtn" );
//    mainLayout->addWidget( refreshBtn );
//    connect(refreshBtn, SIGNAL(clicked()), ui.header, SLOT( onRefreshClicked() ) );

    QHBoxLayout* centralLayout = new QHBoxLayout( );
    centralLayout->addWidget( ui.sideBar = new SideBar( this ) );
    centralLayout->addWidget( ui.stackedWidget = new StackedWidget( this ) );

    layout->addLayout( centralLayout );

    connect(ui.sideBar, SIGNAL( currentChanged( int ) ), ui.stackedWidget, SLOT( setCurrentIndex( int ) ) );
    connect(ui.sideBar, SIGNAL( currentChanged( int ) ), SLOT( loadViewData( int ) ) );


    // LOG
    connect( &Socket::sock(), SIGNAL(clientEvent(int)), &Socket::sock(), SLOT(log(int)) );


    // LIGHT BOX
    lightBox = new QLightBoxWidget(this);
    QHBoxLayout *mainLayout = new QHBoxLayout( lightBox );

    QWidget *fm = new QWidget();
    fm->setObjectName("connexionFrame");
    mainLayout->addWidget( fm );

    QGridLayout *lightBoxLayout = new QGridLayout( fm );
    lightBoxLayout->setRowStretch(1, 1);

    settings = new QSettings("smoky.ini",QSettings::IniFormat);


    lightBoxLayout->addWidget( new QLabel( "IP du serveur" ), 0, 0);
    lightBoxLayout->addWidget( serverIpEdt = new QLineEdit(), 0, 1 );
    serverIpEdt->setInputMask( "000.000.000.000; " );
    serverIpEdt->setText( settings->value("serverIp").toString() );
    serverIpEdt->setObjectName( "serverIpEdt" );

    lightBoxLayout->addWidget( localhostCbx = new QCheckBox("localhost"), 1,1);
    localhostCbx->setObjectName( "localhostCbx" );
    connect( localhostCbx, SIGNAL( stateChanged(int)), SLOT(onLocalhostCbx(int)) );

    lightBoxLayout->addWidget( loginIndication = new QLabel(), 1, 0);
    loginIndication->setObjectName( "loginIndication" );
    loginIndication->setText("<center><small>Placez votre visage<br>face à la caméra</small></center>");

    lightBoxLayout->addWidget( loginAvatarLbl = new QLabel(""), 2, 0, 2, 1);
    loginAvatarLbl->setObjectName( "loginAvatarLbl" );

    lightBoxLayout->addWidget( loginUserEdt = new QLineEdit(), 2, 1);
    loginUserEdt->setPlaceholderText("Nom d'utilisateur");
    loginUserEdt->setObjectName( "loginUserEdt" );

    lightBoxLayout->addWidget( loginPasswordEdt = new QLineEdit(), 3, 1);
    loginPasswordEdt->setObjectName( "loginPasswordEdt" );
    loginPasswordEdt->setEchoMode( QLineEdit::Password );
    loginPasswordEdt->setPlaceholderText("Mot de passe");


    lightBoxLayout->addWidget( loginSubmitBtn = new QPushButton("Connexion"), 4, 1);
    loginSubmitBtn->setObjectName( "loginSubmitBtn" );

    lightBoxLayout->addWidget( statLbl = new QLabel( "" ), 5,0, 1, 2 );
    statLbl->setObjectName( "statLbl" );

    lightBox->show();



    Camera *cam = new Camera();
    t = new QThread();

    mTimer = new QTimer();
    mTimer->setInterval(1000/24);
    connect(mTimer, SIGNAL(timeout()), cam, SLOT(queryFrame()) );
    connect( this, SIGNAL(startWork()), cam, SLOT(openCamera()) );
    connect( this, SIGNAL(startWork()), mTimer, SLOT(start()) );

    connect( cam, SIGNAL(stopCamera()), mTimer, SLOT(stop()) );
    connect( this, SIGNAL(stopWork()), cam, SLOT(closeCamera()) );

    /*destruction*/
    // connect( qApp, SIGNAL(aboutToQuit()),mTimer, SLOT(stop()) );
    // connect( qApp, SIGNAL(aboutToQuit()),mTimer, SLOT(deleteLater()) );

    // connect( qApp, SIGNAL(aboutToQuit()), cam, SLOT(closeCamera()) );
    // connect( qApp, SIGNAL(aboutToQuit()), cam, SLOT(deleteLater()) );

    connect(t, SIGNAL(finished()), cam, SLOT(deleteLater()));
    // connect(this, &Controller::operate, worker, &Worker::doWork);

    //connect( qApp, SIGNAL(aboutToQuit()), t, SLOT(quit()) );
    // connect( t, SIGNAL(finished()), t, SLOT(deleteLater()) );

    // user logged out
    connect( &Socket::sock(), SIGNAL(userLoggedOut()), SLOT(startCamera()) );

    // user logged in
    connect( &Socket::sock(), SIGNAL(userLoggedIn(QString)), SLOT(stopCamera()) );

    cam->moveToThread( t );
    mTimer->moveToThread( t );
    t->start( QThread::IdlePriority );

    emit startWork();

    connect(cam, SIGNAL(sendShot(QImage, QRect)), SLOT(onShotSent(QImage)) ); // receive shots

    connect( &Socket::sock(), SIGNAL(userLoggedIn(QString)), loginPasswordEdt, SLOT(clear()) );
    connect( &Socket::sock(), SIGNAL(userLoggedIn(QString)), lightBox, SLOT(hide()) );

    // rendre la page d'accueil
    connect( &Socket::sock(), SIGNAL(userLoggedOut()), SLOT(resetThings()) );

    connect( &Socket::sock(), SIGNAL(invalidCred()), SLOT(onInvalidCred()) );

    connect( loginSubmitBtn, SIGNAL(clicked()), SLOT(connectUser()) );


    connect( &Socket::sock(), SIGNAL(connexionError(int)), SLOT(onConnexionError(int)) );

    // move(QApplication::desktop()->screen()->rect().center() - this->rect().center());
    /*
        QDesktopWidget desktop;
        QRect desktop_geometry = desktop.screenGeometry();
    */

    // resize( 780, 650 );

    /*int x = desktop_geometry.width()/2 - width()/2;
    int y = desktop_geometry.height()/2 - height()/2;
    move( x, y );*/

    // showMaximized();
}
Пример #20
0
FindBar::FindBar(QWidget *parent)
    : QWidget(parent)
    , m_lineEdit(new LineEdit(this))
    , m_matchCase(new QCheckBox(tr("&Match case"), this))
    , m_highlightAll(new QCheckBox(tr("&Highlight all"), this)),
      m_associatedWebView(0)
{
    QHBoxLayout *layout = new QHBoxLayout;

    // cosmetic
    layout->setContentsMargins(2, 0, 2, 0);

    // hide button
    QToolButton *hideButton = new QToolButton(this);
    hideButton->setAutoRaise(true);
    hideButton->setIcon(QIcon::fromTheme(QLatin1String("dialog-close")));
    hideButton->setShortcut(tr("Esc"));
    connect(hideButton, SIGNAL(clicked()), this, SLOT(hide()));
    layout->addWidget(hideButton);
    layout->setAlignment(hideButton, Qt::AlignLeft | Qt::AlignTop);

    // label
    QLabel *label = new QLabel(tr("Find:"));
    layout->addWidget(label);

    // Find Bar signal
    connect(this, SIGNAL(searchString(QString)), this, SLOT(find(QString)));

    // lineEdit, focusProxy
    setFocusProxy(m_lineEdit);
    m_lineEdit->setMaximumWidth(250);
    connect(m_lineEdit, SIGNAL(textChanged(QString)), this, SLOT(find(QString)));
    layout->addWidget(m_lineEdit);

    // buttons
    QPushButton *findNext = new QPushButton(QIcon::fromTheme(QLatin1String("go-down")), tr("&Next"), this);
    findNext->setShortcut(tr("F3"));
    QPushButton *findPrev = new QPushButton(QIcon::fromTheme(QLatin1String("go-up")), tr("&Previous"), this);
    findPrev->setShortcut(tr("Shift+F3"));
    connect(findNext, SIGNAL(clicked()), this, SLOT(findNext()));
    connect(findPrev, SIGNAL(clicked()), this, SLOT(findPrevious()));
    layout->addWidget(findNext);
    layout->addWidget(findPrev);

    // Case sensitivity. Deliberately set so this is off by default.
    m_matchCase->setCheckState(Qt::Unchecked);
    m_matchCase->setTristate(false);
    connect(m_matchCase, SIGNAL(toggled(bool)), this, SLOT(matchCaseUpdate()));
    layout->addWidget(m_matchCase);

    // Hightlight All. On by default
    m_highlightAll->setCheckState(Qt::Checked);
    m_highlightAll->setTristate(false);
    connect(m_highlightAll, SIGNAL(toggled(bool)), this, SLOT(updateHighlight()));
    layout->addWidget(m_highlightAll);

    // stretching widget on the left
    layout->addStretch();

    setLayout(layout);

    // we start off hidden
    hide();
}
TransactionView::TransactionView(QWidget *parent) :
    QWidget(parent), model(0), transactionProxyModel(0),
    transactionView(0)
{
    // Build filter row
    setContentsMargins(0,0,0,0);

    QHBoxLayout *hlayout = new QHBoxLayout();
    hlayout->setContentsMargins(0,0,0,0);
#ifdef Q_OS_MAC
    hlayout->setSpacing(5);
    hlayout->addSpacing(26);
#else
    hlayout->setSpacing(0);
    hlayout->addSpacing(23);
#endif

    dateWidget = new QComboBox(this);
#ifdef Q_OS_MAC
    dateWidget->setFixedWidth(121);
#else
    dateWidget->setFixedWidth(120);
#endif
    dateWidget->addItem(tr("All"), All);
    dateWidget->addItem(tr("Today"), Today);
    dateWidget->addItem(tr("This week"), ThisWeek);
    dateWidget->addItem(tr("This month"), ThisMonth);
    dateWidget->addItem(tr("Last month"), LastMonth);
    dateWidget->addItem(tr("This year"), ThisYear);
    dateWidget->addItem(tr("Range..."), Range);
    hlayout->addWidget(dateWidget);

    typeWidget = new QComboBox(this);
#ifdef Q_OS_MAC
    typeWidget->setFixedWidth(121);
#else
    typeWidget->setFixedWidth(120);
#endif

    typeWidget->addItem(tr("All"), TransactionFilterProxy::ALL_TYPES);
    typeWidget->addItem(tr("Received with"), TransactionFilterProxy::TYPE(TransactionRecord::RecvWithAddress) |
                        TransactionFilterProxy::TYPE(TransactionRecord::RecvFromOther));
    typeWidget->addItem(tr("Sent to"), TransactionFilterProxy::TYPE(TransactionRecord::SendToAddress) |
                        TransactionFilterProxy::TYPE(TransactionRecord::SendToOther));
    typeWidget->addItem(tr("To yourself"), TransactionFilterProxy::TYPE(TransactionRecord::SendToSelf));
    typeWidget->addItem(tr("POFMined"), TransactionFilterProxy::TYPE(TransactionRecord::StakeMint));
    typeWidget->addItem(tr("POWMined"), TransactionFilterProxy::TYPE(TransactionRecord::Generated));
    typeWidget->addItem(tr("Other"), TransactionFilterProxy::TYPE(TransactionRecord::Other));

    hlayout->addWidget(typeWidget);

    addressWidget = new QLineEdit(this);
#if QT_VERSION >= 0x040700
    /* Do not move this to the XML file, Qt before 4.7 will choke on it */
    addressWidget->setPlaceholderText(tr("Enter address or label to search"));
#endif
    hlayout->addWidget(addressWidget);

    amountWidget = new QLineEdit(this);
#if QT_VERSION >= 0x040700
    /* Do not move this to the XML file, Qt before 4.7 will choke on it */
    amountWidget->setPlaceholderText(tr("Min amount"));
#endif
#ifdef Q_OS_MAC
    amountWidget->setFixedWidth(97);
#else
    amountWidget->setFixedWidth(100);
#endif
    amountWidget->setValidator(new QDoubleValidator(0, 1e20, 8, this));
    hlayout->addWidget(amountWidget);

    QVBoxLayout *vlayout = new QVBoxLayout(this);
    vlayout->setContentsMargins(0,0,0,0);
    vlayout->setSpacing(0);

    QTableView *view = new QTableView(this);
    vlayout->addLayout(hlayout);
    vlayout->addWidget(createDateRangeWidget());
    vlayout->addWidget(view);
    vlayout->setSpacing(0);
    int width = view->verticalScrollBar()->sizeHint().width();
    // Cover scroll bar width with spacing
#ifdef Q_OS_MAC
    hlayout->addSpacing(width+2);
#else
    hlayout->addSpacing(width);
#endif
    // Always show scroll bar
    view->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
    view->setTabKeyNavigation(false);
    view->setContextMenuPolicy(Qt::CustomContextMenu);

    transactionView = view;

    // Actions
    QAction *copyAddressAction = new QAction(tr("Copy address"), this);
    QAction *copyLabelAction = new QAction(tr("Copy label"), this);
    QAction *copyAmountAction = new QAction(tr("Copy amount"), this);
    QAction *editLabelAction = new QAction(tr("Edit label"), this);
    QAction *showDetailsAction = new QAction(tr("Show transaction details"), this);

    contextMenu = new QMenu();
    contextMenu->addAction(copyAddressAction);
    contextMenu->addAction(copyLabelAction);
    contextMenu->addAction(copyAmountAction);
    contextMenu->addAction(editLabelAction);
    contextMenu->addAction(showDetailsAction);

    // Connect actions
    connect(dateWidget, SIGNAL(activated(int)), this, SLOT(chooseDate(int)));
    connect(typeWidget, SIGNAL(activated(int)), this, SLOT(chooseType(int)));
    connect(addressWidget, SIGNAL(textChanged(QString)), this, SLOT(changedPrefix(QString)));
    connect(amountWidget, SIGNAL(textChanged(QString)), this, SLOT(changedAmount(QString)));

    connect(view, SIGNAL(doubleClicked(QModelIndex)), this, SIGNAL(doubleClicked(QModelIndex)));
    connect(view, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(contextualMenu(QPoint)));

    connect(copyAddressAction, SIGNAL(triggered()), this, SLOT(copyAddress()));
    connect(copyLabelAction, SIGNAL(triggered()), this, SLOT(copyLabel()));
    connect(copyAmountAction, SIGNAL(triggered()), this, SLOT(copyAmount()));
    connect(editLabelAction, SIGNAL(triggered()), this, SLOT(editLabel()));
    connect(showDetailsAction, SIGNAL(triggered()), this, SLOT(showDetails()));
}
Пример #22
0
//---------------------------------------------------------------------------
// createWidgets
//---------------------------------------------------------------------------
void WndAbout::createWidgets (void)
{
  QLabel* pLblIcon = new QLabel;
  QLabel* pLblAbout = new QLabel;

  this->readChangeLog();

  pLblIcon->setAlignment(Qt::AlignLeft | Qt::AlignTop);
  pLblIcon->setPixmap(QPixmap(":/icons/appicon-128.png"));
  pLblIcon->setFixedWidth(140);

  // 'about' text
  {
    QString strAbout;
    QMapIterator<QString, QString> itLog(m_mapChangeLog);

    strAbout = QString(
      "<h1>%1</h1>"
      "version <b>%2</b><br>"
      "<br>"
      "<a href=\"%3\">%3</a><br>"
      "<br>"
      "Copyright (c) 2010 <a href=\"mailto:%4\">Jean-Charles Lefebvre</a><br>"
      "Licensed under the terms of the zLib License.<br>"
      "<br>"
      "Current output directory is :<br>"
      "%5<br>"
      "<h3>ChangeLog :</h3>"
      )
      .arg(App::applicationLabel())
      .arg(App::applicationVersion())
      .arg(App::applicationUrl())
      .arg(App::applicationEMail())
      .arg(App::outputDir());

    itLog.toBack();
    while (itLog.hasPrevious())
    {
      itLog.previous();
      strAbout += itLog.key() + " :\n" + itLog.value() + "\n";
    }
    strAbout.replace('\n', "<br>");

    //pLblAbout->setStyleSheet("background-image: url(:/images/wallpaper-800x480.jpg);");
    pLblAbout->setTextFormat(Qt::RichText);
    pLblAbout->setWordWrap(true);
    pLblAbout->setTextInteractionFlags(Qt::LinksAccessibleByMouse);
    pLblAbout->setOpenExternalLinks(true);
    pLblAbout->setText(strAbout);
  }

  // main layout setup
  {
    QWidget*     pRootWidget = new QWidget;
    QHBoxLayout* pHBox = new QHBoxLayout;

    m_pScrollArea = new QScrollArea;
    m_pScrollArea->setWidgetResizable(true);
    m_pScrollArea->setWidget(pLblAbout);
    m_pScrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    m_pScrollArea->setProperty("FingerScrollable", true);

    pHBox->setSpacing(1);
    pHBox->addWidget(pLblIcon, 0, Qt::AlignLeft | Qt::AlignTop);
    pHBox->addWidget(m_pScrollArea);

    pRootWidget->setLayout(pHBox);

    this->setCentralWidget(pRootWidget);
  }
}
void MusicWidget::setupGUI()
{
    QVBoxLayout *layout = new QVBoxLayout(this);
    layout->addSpacing(10);

    m_playlistView = new QTableWidget();
    RowDelegate *rowDelegate = new RowDelegate(this);
    m_playlistView->setItemDelegate(rowDelegate);
    m_playlistView->setStyleSheet(PLAYLIST_VIEW_STYLE);
    m_playlistView->setSelectionMode(QAbstractItemView::SingleSelection);
    m_playlistView->setSelectionBehavior(QAbstractItemView::SelectRows);
    m_playlistView->setVerticalScrollMode(QAbstractItemView::ScrollPerItem);
    m_playlistView->setEditTriggers(QAbstractItemView::NoEditTriggers);
    m_playlistView->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    m_playlistView->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    m_playlistView->setShowGrid(false);
    layout->addWidget(m_playlistView);
    connect(m_playlistView, SIGNAL(cellClicked(int,int))
            , this, SLOT(onCellClicked(int,int)));
    layout->addSpacing(4);

    m_currentSongLabel = new QLabel();
    m_currentSongLabel->setStyleSheet(CURRENT_LABEL_STYLE);
    layout->addWidget(m_currentSongLabel);

    QSize buttonSize(41, 33);
    m_playModeButton = new QPushButton(g_playmodeTexts[QMediaPlaylist::Loop], this);
    m_playModeButton->adjustSize();
#ifdef ANDROID
    QSize screenSize = qApp->primaryScreen()->size();
    if(screenSize.width() > 960 || screenSize.height() > 960)
    {
        buttonSize *= (m_playModeButton->height() / 33);
    }
#endif
    QHBoxLayout * controlLayout = new QHBoxLayout;
    controlLayout->setSpacing(4);
    layout->addLayout(controlLayout);
    controlLayout->addStretch(1);
    m_folderButton = new ImageButton(QPixmap(":/images/openfile.png")
                                     , QPixmap(":/images/openfile_down.png"));
    connect(m_folderButton, SIGNAL(clicked()), this, SIGNAL(selectSong()));
    m_folderButton->setFixedSize(buttonSize);
    controlLayout->addWidget(m_folderButton);

    m_prevButton = new ImageButton(QPixmap(":/images/preSong.png"),
                                   QPixmap(":/images/preSong_down.png"));
    m_prevButton->setFixedSize(buttonSize);
    connect(m_prevButton, SIGNAL(clicked()), m_playlist, SLOT(previous()));
    controlLayout->addWidget(m_prevButton);

    m_playpauseButton = new ImageButton(QPixmap(":/images/playpause.png")
                                        ,QPixmap(":/images/playpause_down.png"));
    m_playpauseButton->setFixedSize(buttonSize);
    connect(m_playpauseButton, SIGNAL(clicked()), this, SLOT(onPlayPauseButton()));
    controlLayout->addWidget(m_playpauseButton);

    m_stopButton = new ImageButton(QPixmap(":/images/stop.png")
                                   , QPixmap(":/images/stop_down.png"));
    m_stopButton->setFixedSize(buttonSize);
    connect(m_stopButton, SIGNAL(clicked()), this, SLOT(onStopButton()));
    controlLayout->addWidget(m_stopButton);

    m_nextButton = new ImageButton(QPixmap(":/images/nextSong.png")
                                   , QPixmap(":/images/nextSong_down.png"));
    m_nextButton->setFixedSize(buttonSize);
    connect(m_nextButton, SIGNAL(clicked()), m_playlist, SLOT(next()));
    controlLayout->addWidget(m_nextButton);

    QCheckBox *muteBox = new QCheckBox();
    muteBox->setStyleSheet(MUTE_CHECKBOX_STYLE);
    connect(muteBox, SIGNAL(stateChanged(int)),
            this, SLOT(onMuteButtonStateChanged(int)));
    controlLayout->addWidget(muteBox);

    connect(m_playModeButton, SIGNAL(clicked()),
            this, SLOT(onPlayModeButton()));
    controlLayout->addWidget(m_playModeButton);

    controlLayout->addStretch(1);

    QGridLayout *progressLayout = new QGridLayout();
    layout->addLayout(progressLayout);
    m_playProgress = new QSlider(Qt::Horizontal);
    //m_playProgress->setFixedWidth(280);
    m_playProgress->setStyleSheet(SLIDER_STYLE);
    progressLayout->addWidget(m_playProgress, 0, 0, 1, 2);
    connect(m_playProgress, SIGNAL(sliderPressed()),
            this, SLOT(onSliderPressed()));
    connect(m_playProgress, SIGNAL(sliderReleased()),
            this, SLOT(onSliderReleased()));
    m_positionLabel = new QLabel();
    m_positionLabel->setAlignment(Qt::AlignLeft | Qt::AlignTop);
    progressLayout->addWidget(m_positionLabel, 1, 0, Qt::AlignLeft | Qt::AlignTop);
    m_durationLabel = new QLabel();
    m_durationLabel->setAlignment(Qt::AlignRight | Qt::AlignTop);
    progressLayout->addWidget(m_durationLabel, 1, 1, Qt::AlignRight | Qt::AlignTop);
}
Пример #24
0
BitcoinGUI::BitcoinGUI(QWidget *parent):
    QMainWindow(parent),
    clientModel(0),
    walletModel(0),
    encryptWalletAction(0),
    changePassphraseAction(0),
    unlockWalletAction(0),
    lockWalletAction(0),
    aboutQtAction(0),
    trayIcon(0),
    notificator(0),
    rpcConsole(0)
{
    resize(850, 550);
    setWindowTitle(tr("Warp") + " - " + tr("Wallet"));
#ifndef Q_OS_MAC
    qApp->setWindowIcon(QIcon(":icons/bitcoin"));
    setWindowIcon(QIcon(":icons/bitcoin"));
#else
    setUnifiedTitleAndToolBarOnMac(true);
    QApplication::setAttribute(Qt::AA_DontShowIconsInMenus);
#endif
    // Accept D&D of URIs
    setAcceptDrops(true);

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

    // Create application menu bar
    createMenuBar();

    // Create the toolbars
    createToolBars();

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

    // Create tabs
    overviewPage = new OverviewPage();

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

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

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

    sendCoinsPage = new SendCoinsDialog(this);

    signVerifyMessageDialog = new SignVerifyMessageDialog(this);

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

    // Create status bar
    statusBar();

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

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

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

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

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

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

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

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

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

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

    gotoOverviewPage();
}
Пример #25
0
CompositionWidget::CompositionWidget(void)
{
	/* ViewGroup */
	QGroupBox* viewGroup = new QGroupBox(this);
	QGroupBox* meshViewGroup = new QGroupBox(viewGroup);
	meshViewGroup->setTitle(tr("Mesh View"));
	mMeshViewer = new MeshViewer(meshViewGroup);
	QGroupBox* skeletonViewGroup = new QGroupBox(viewGroup);
	skeletonViewGroup->setTitle(tr("Skeleton View"));
	mSkeletonViewer = new SkeletonViewer(skeletonViewGroup);
	 
	/* ControlGroup */
	QGroupBox* buttonGroup = new QGroupBox(this);
	buttonGroup->setTitle(QObject::tr("Drape"));
	QPushButton* extractSkeletonButton = new QPushButton(buttonGroup);
	extractSkeletonButton->setText(QObject::tr("Extract Skeleton"));	 
	QPushButton* findNeckButton = new QPushButton(buttonGroup);
	findNeckButton->setText(QObject::tr("Deform Cloth"));
	QPushButton* moveClothButton = new QPushButton(buttonGroup);
	moveClothButton->setText(QObject::tr("Move Cloth"));
	QPushButton* resolvePenetrationButton = new QPushButton(buttonGroup);
	resolvePenetrationButton->setText(QObject::tr("Resolve Penetration"));
	QPushButton* physicalSimuationButton = new QPushButton(buttonGroup);
	physicalSimuationButton->setText(QObject::tr("PhysicalSimuate"));
	QPushButton* physicalSimuationStopButton = new QPushButton(buttonGroup);
	physicalSimuationStopButton->setText(QObject::tr("Stop PhysicalSimuation"));
	 
	/* Layout */
	QHBoxLayout* mainLayout = new QHBoxLayout(this);
	QSizePolicy sizePolicy = QSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
	sizePolicy.setHorizontalStretch(4);
	viewGroup->setSizePolicy(sizePolicy);
	sizePolicy.setHorizontalStretch(1);
	buttonGroup->setSizePolicy(sizePolicy);
	mainLayout->addWidget(viewGroup);
	mainLayout->addWidget(buttonGroup);


	QVBoxLayout* viewGroupLayout = new QVBoxLayout(viewGroup);
	viewGroupLayout->addWidget(meshViewGroup);
	viewGroupLayout->addWidget(skeletonViewGroup);
	QVBoxLayout* meshViewGroupLayout = new QVBoxLayout(meshViewGroup);
	meshViewGroupLayout->addWidget(mMeshViewer);
	QVBoxLayout* skeletonViewGroupLayout = new QVBoxLayout(skeletonViewGroup);
	skeletonViewGroupLayout->addWidget(mSkeletonViewer);
	
	QVBoxLayout* buttonGroupLayout = new QVBoxLayout(buttonGroup);
	buttonGroupLayout->addWidget(extractSkeletonButton);
	buttonGroupLayout->addWidget(findNeckButton);
	buttonGroupLayout->addWidget(moveClothButton);
	buttonGroupLayout->addWidget(resolvePenetrationButton);
	buttonGroupLayout->addWidget(physicalSimuationButton);
	buttonGroupLayout->addWidget(physicalSimuationStopButton);

	connect(extractSkeletonButton, SIGNAL(clicked()), this, SLOT(extractSkeleton()));
	connect(moveClothButton, SIGNAL(clicked()), this, SLOT(moveCloth()));
	connect(findNeckButton, SIGNAL(clicked()), this, SLOT(deformCloth()));
	connect(resolvePenetrationButton, SIGNAL(clicked()), this, SLOT(resolvePenetration()));
	connect(physicalSimuationButton, SIGNAL(clicked()), this, SLOT(startPhysicalSimulation()));
	connect(physicalSimuationStopButton, SIGNAL(clicked()), this, SLOT(stopPhysicalSimulation()));

//	SkeletonUtility utility;
//	utility.readIntoContainer("humanskeleton.txt");
//	utility.readIntoContainer("clothskeleton.txt");
//
// 	for (int i = 0; i < globalSkeletonContainer.size(); i++)
// 	{
// 		Skeleton& skeleton = globalSkeletonContainer.getSkeletonRef(i);
// 		skeleton.findNeck();
// 		skeleton.findHand();
// 	}
//  	utility.skeletonMatch(globalSkeletonContainer.getSkeletonRef(0), globalSkeletonContainer.getSkeletonRef(1));
// 
//  	mSkeletonViewer->updateSkeleton();		

	mInterval = 1000/25;
}
Пример #26
0
LTMWindow::LTMWindow(Context *context) :
    GcChartWindow(context), context(context), dirty(true), stackDirty(true), compareDirty(true)
{
    useToToday = useCustom = false;
    plotted = DateRange(QDate(01,01,01), QDate(01,01,01));
    lastRefresh = QTime::currentTime().addSecs(-10);

    // the plot
    QVBoxLayout *mainLayout = new QVBoxLayout;

    QPalette palette;
    palette.setBrush(QPalette::Background, QBrush(GColor(CTRENDPLOTBACKGROUND)));

    // single plot
    plotWidget = new QWidget(this);
    plotWidget->setPalette(palette);
    QVBoxLayout *plotLayout = new QVBoxLayout(plotWidget);
    plotLayout->setSpacing(0);
    plotLayout->setContentsMargins(0,0,0,0);

    ltmPlot = new LTMPlot(this, context, true);
    spanSlider = new QxtSpanSlider(Qt::Horizontal, this);
    spanSlider->setFocusPolicy(Qt::NoFocus);
    spanSlider->setHandleMovementMode(QxtSpanSlider::NoOverlapping);
    spanSlider->setLowerValue(0);
    spanSlider->setUpperValue(15);

    QFont smallFont;
    smallFont.setPointSize(6);

    scrollLeft = new QPushButton("<", this);
    scrollLeft->setFont(smallFont);
    scrollLeft->setAutoRepeat(true);
    scrollLeft->setFixedHeight(16);
    scrollLeft->setFixedWidth(16);
    scrollLeft->setContentsMargins(0,0,0,0);

    scrollRight = new QPushButton(">", this);
    scrollRight->setFont(smallFont);
    scrollRight->setAutoRepeat(true);
    scrollRight->setFixedHeight(16);
    scrollRight->setFixedWidth(16);
    scrollRight->setContentsMargins(0,0,0,0);

    QHBoxLayout *span = new QHBoxLayout;
    span->addWidget(scrollLeft);
    span->addWidget(spanSlider);
    span->addWidget(scrollRight);
    plotLayout->addWidget(ltmPlot);
    plotLayout->addLayout(span);

#ifdef Q_OS_MAC
    // BUG in QMacStyle and painting of spanSlider
    // so we use a plain style to avoid it, but only
    // on a MAC, since win and linux are fine
#if QT_VERSION > 0x5000
    QStyle *style = QStyleFactory::create("fusion");
#else
    QStyle *style = QStyleFactory::create("Cleanlooks");
#endif
    spanSlider->setStyle(style);
    scrollLeft->setStyle(style);
    scrollRight->setStyle(style);
#endif

    // the stack of plots
    plotsWidget = new QWidget(this);
    plotsWidget->setPalette(palette);
    plotsLayout = new QVBoxLayout(plotsWidget);
    plotsLayout->setSpacing(0);
    plotsLayout->setContentsMargins(0,0,0,0);

    plotArea = new QScrollArea(this);
#ifdef Q_OS_WIN
    QStyle *cde = QStyleFactory::create(OS_STYLE);
    plotArea->setStyle(cde);
#endif
    plotArea->setAutoFillBackground(false);
    plotArea->setWidgetResizable(true);
    plotArea->setWidget(plotsWidget);
    plotArea->setFrameStyle(QFrame::NoFrame);
    plotArea->setContentsMargins(0,0,0,0);
    plotArea->setPalette(palette);

    // the data table
    dataSummary = new QWebView(this);
    dataSummary->setContentsMargins(0,0,0,0);
    dataSummary->page()->view()->setContentsMargins(0,0,0,0);
    dataSummary->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
    dataSummary->setAcceptDrops(false);

    QFont defaultFont; // mainwindow sets up the defaults.. we need to apply
    dataSummary->settings()->setFontSize(QWebSettings::DefaultFontSize, defaultFont.pointSize()+1);
    dataSummary->settings()->setFontFamily(QWebSettings::StandardFont, defaultFont.family());

    // compare plot page
    compareplotsWidget = new QWidget(this);
    compareplotsWidget->setPalette(palette);
    compareplotsLayout = new QVBoxLayout(compareplotsWidget);
    compareplotsLayout->setSpacing(0);
    compareplotsLayout->setContentsMargins(0,0,0,0);

    compareplotArea = new QScrollArea(this);
#ifdef Q_OS_WIN
    cde = QStyleFactory::create(OS_STYLE);
    compareplotArea->setStyle(cde);
#endif
    compareplotArea->setAutoFillBackground(false);
    compareplotArea->setWidgetResizable(true);
    compareplotArea->setWidget(compareplotsWidget);
    compareplotArea->setFrameStyle(QFrame::NoFrame);
    compareplotArea->setContentsMargins(0,0,0,0);
    compareplotArea->setPalette(palette);

    // the stack
    stackWidget = new QStackedWidget(this);
    stackWidget->addWidget(plotWidget);
    stackWidget->addWidget(dataSummary);
    stackWidget->addWidget(plotArea);
    stackWidget->addWidget(compareplotArea);
    stackWidget->setCurrentIndex(0);
    mainLayout->addWidget(stackWidget);
    setChartLayout(mainLayout);

    HelpWhatsThis *helpStack = new HelpWhatsThis(stackWidget);
    stackWidget->setWhatsThis(helpStack->getWhatsThisText(HelpWhatsThis::ChartTrends_MetricTrends));

    // reveal controls
    QHBoxLayout *revealLayout = new QHBoxLayout;
    revealLayout->setContentsMargins(0,0,0,0);
    revealLayout->addStretch();
    revealLayout->addWidget(new QLabel(tr("Group by"),this));

    rGroupBy = new QxtStringSpinBox(this);
    QStringList strings;
    strings << tr("Days")
            << tr("Weeks")
            << tr("Months")
            << tr("Years")
            << tr("Time Of Day")
            << tr("All");
    rGroupBy->setStrings(strings);
    rGroupBy->setValue(0);

    revealLayout->addWidget(rGroupBy);
    rData = new QCheckBox(tr("Data Table"), this);
    rStack = new QCheckBox(tr("Stacked"), this);
    QVBoxLayout *checks = new QVBoxLayout;
    checks->setSpacing(2);
    checks->setContentsMargins(0,0,0,0);
    checks->addWidget(rData);
    checks->addWidget(rStack);
    revealLayout->addLayout(checks);
    revealLayout->addStretch();
    setRevealLayout(revealLayout);

    // add additional menu items before setting
    // controls since the menu is SET from setControls
    QAction *exportData = new QAction(tr("Export Chart Data..."), this);
    addAction(exportData);
    QAction *exportConfig = new QAction(tr("Export Chart Configuration..."), this);
    addAction(exportConfig);
#ifdef GC_HAS_CLOUD_DB
    QAction *shareConfig = new QAction(tr("Export Chart Configuration to CloudDB..."), this);
    addAction(shareConfig);
#endif
    // the controls
    QWidget *c = new QWidget;
    c->setContentsMargins(0,0,0,0);
    HelpWhatsThis *helpConfig = new HelpWhatsThis(c);
    c->setWhatsThis(helpConfig->getWhatsThisText(HelpWhatsThis::ChartTrends_MetricTrends));
    QVBoxLayout *cl = new QVBoxLayout(c);
    cl->setContentsMargins(0,0,0,0);
    cl->setSpacing(0);
    setControls(c);

    // the popup
    popup = new GcPane();
    ltmPopup = new LTMPopup(context);
    QVBoxLayout *popupLayout = new QVBoxLayout();
    popupLayout->addWidget(ltmPopup);
    popup->setLayout(popupLayout);

    ltmTool = new LTMTool(context, &settings);

    // initialise
    settings.ltmTool = ltmTool;
    settings.groupBy = LTM_DAY;
    settings.legend = ltmTool->showLegend->isChecked();
    settings.events = ltmTool->showEvents->isChecked();
    settings.shadeZones = ltmTool->shadeZones->isChecked();
    settings.showData = ltmTool->showData->isChecked();
    settings.stack = ltmTool->showStack->isChecked();
    settings.stackWidth = ltmTool->stackSlider->value();
    rData->setChecked(ltmTool->showData->isChecked());
    rStack->setChecked(ltmTool->showStack->isChecked());
    cl->addWidget(ltmTool);

    connect(this, SIGNAL(dateRangeChanged(DateRange)), this, SLOT(dateRangeChanged(DateRange)));
    connect(this, SIGNAL(styleChanged(int)), this, SLOT(styleChanged(int)));
    connect(ltmTool, SIGNAL(filterChanged()), this, SLOT(filterChanged()));
    connect(context, SIGNAL(homeFilterChanged()), this, SLOT(filterChanged()));
    connect(ltmTool->groupBy, SIGNAL(currentIndexChanged(int)), this, SLOT(groupBySelected(int)));
    connect(rGroupBy, SIGNAL(valueChanged(int)), this, SLOT(rGroupBySelected(int)));
    connect(ltmTool->applyButton, SIGNAL(clicked(bool)), this, SLOT(applyClicked(void)));
    connect(ltmTool->shadeZones, SIGNAL(stateChanged(int)), this, SLOT(shadeZonesClicked(int)));
    connect(ltmTool->showData, SIGNAL(stateChanged(int)), this, SLOT(showDataClicked(int)));
    connect(rData, SIGNAL(stateChanged(int)), this, SLOT(showDataClicked(int)));
    connect(ltmTool->showStack, SIGNAL(stateChanged(int)), this, SLOT(showStackClicked(int)));
    connect(rStack, SIGNAL(stateChanged(int)), this, SLOT(showStackClicked(int)));
    connect(ltmTool->stackSlider, SIGNAL(valueChanged(int)), this, SLOT(zoomSliderChanged()));
    connect(ltmTool->showLegend, SIGNAL(stateChanged(int)), this, SLOT(showLegendClicked(int)));
    connect(ltmTool->showEvents, SIGNAL(stateChanged(int)), this, SLOT(showEventsClicked(int)));
    connect(ltmTool, SIGNAL(useCustomRange(DateRange)), this, SLOT(useCustomRange(DateRange)));
    connect(ltmTool, SIGNAL(useThruToday()), this, SLOT(useThruToday()));
    connect(ltmTool, SIGNAL(useStandardRange()), this, SLOT(useStandardRange()));
    connect(ltmTool, SIGNAL(curvesChanged()), this, SLOT(refresh()));
    connect(context, SIGNAL(filterChanged()), this, SLOT(filterChanged()));
    connect(context, SIGNAL(refreshUpdate(QDate)), this, SLOT(refreshUpdate(QDate)));
    connect(context, SIGNAL(refreshEnd()), this, SLOT(refresh()));

    // comparing things
    connect(context, SIGNAL(compareDateRangesStateChanged(bool)), this, SLOT(compareChanged()));
    connect(context, SIGNAL(compareDateRangesChanged()), this, SLOT(compareChanged()));

    connect(context, SIGNAL(rideAdded(RideItem*)), this, SLOT(refresh(void)));
    connect(context, SIGNAL(rideDeleted(RideItem*)), this, SLOT(refresh(void)));
    connect(context, SIGNAL(rideSaved(RideItem*)), this, SLOT(refresh(void)));
    connect(context, SIGNAL(configChanged(qint32)), this, SLOT(configChanged(qint32)));
    connect(context, SIGNAL(presetSelected(int)), this, SLOT(presetSelected(int)));

    // custom menu item
    connect(exportData, SIGNAL(triggered()), this, SLOT(exportData()));
    connect(exportConfig, SIGNAL(triggered()), this, SLOT(exportConfig()));
#if GC_HAS_CLOUD_DB
    connect(shareConfig, SIGNAL(triggered()), this, SLOT(shareConfig()));
#endif

    // normal view
    connect(spanSlider, SIGNAL(lowerPositionChanged(int)), this, SLOT(spanSliderChanged()));
    connect(spanSlider, SIGNAL(upperPositionChanged(int)), this, SLOT(spanSliderChanged()));
    connect(scrollLeft, SIGNAL(clicked()), this, SLOT(moveLeft()));
    connect(scrollRight, SIGNAL(clicked()), this, SLOT(moveRight()));

    configChanged(CONFIG_APPEARANCE);
}
Пример #27
0
DataFormatTypeForm::DataFormatTypeForm(DataFormatType *dataFormat,
                                       QEbuMainWindow *mainWindow,
                                       QWidget *parent) :
    StackableWidget(mainWindow, parent)
{
    m_op = (dataFormat) ? Edit : Add;
    if (!dataFormat)
        m_dataFormat = new DataFormatType;
    else
        m_dataFormat = dataFormat;
    //Layout
    QHBoxLayout *mainHLayout = new QHBoxLayout;
    QVBoxLayout *vl = new QVBoxLayout;
    {
        QFormLayout *fl = new QFormLayout;
        m_editDataFormatId = new QLineEdit;
        m_editDataFormatId->setValidator(TypeConverter::getUriValidator());
        fl->addRow(tr("Data format ID"), m_editDataFormatId);
        m_editDataFormatName = new QLineEdit;
        fl->addRow(tr("Data format name"), m_editDataFormatName);
        m_editDataFormatDefinition = new QLineEdit;
        fl->addRow(tr("Data format definition"), m_editDataFormatDefinition);
        vl->addLayout(fl);
    }
    {
        QFormLayout *fl = new QFormLayout;
        m_buttonCaptioningFormat = new QPushButton(">>");
        fl->addRow(tr("Captioning format"), m_buttonCaptioningFormat);
        QObject::connect(m_buttonCaptioningFormat, SIGNAL(toggled(bool)),
                         this, SLOT(captioningFormatChecked(bool)));
        m_buttonAncillaryDataFormat = new QPushButton(">>");
        fl->addRow(tr("Ancillary data format"), m_buttonAncillaryDataFormat);
        QObject::connect(m_buttonAncillaryDataFormat, SIGNAL(toggled(bool)),
                         this, SLOT(ancillaryDataFormatChecked(bool)));
        m_buttonTechnicalAttributes = new QPushButton(">>");
        fl->addRow(tr("Technical attributes"), m_buttonTechnicalAttributes);
        QObject::connect(m_buttonTechnicalAttributes, SIGNAL(toggled(bool)),
                         this, SLOT(technicalAttributesChecked(bool)));
        vl->addLayout(fl);
        QButtonGroup *group = new QButtonGroup(this);
        m_buttonCaptioningFormat->setCheckable(true);
        group->addButton(m_buttonCaptioningFormat);
        m_buttonAncillaryDataFormat->setCheckable(true);
        group->addButton(m_buttonAncillaryDataFormat);
        m_buttonTechnicalAttributes->setCheckable(true);
        group->addButton(m_buttonTechnicalAttributes);
    }
    mainHLayout->addLayout(vl);
    // Add list view on the right
    m_listView = new ListView();
    QObject::connect(m_listView->buttonAdd(), SIGNAL(clicked()),
                     this, SLOT(addClicked()));
    QObject::connect(m_listView->buttonEdit(), SIGNAL(clicked()),
                     this, SLOT(editClicked()));
    QObject::connect(m_listView->buttonRemove(), SIGNAL(clicked()),
                     this, SLOT(removeClicked()));
    mainHLayout->addWidget(m_listView);
    this->setLayout(mainHLayout);

    //Set data fields...
    m_textDocumentation->setText(tr("To provide information on captioning and ancillary data formats optionally used in the resource"));
    m_editDataFormatId->setText(m_dataFormat->dataFormatId());
    m_editDataFormatName->setText(m_dataFormat->dataFormatName());
    m_editDataFormatDefinition->setText(m_dataFormat->dataFormatDefinition());
    m_editDataFormatId->installEventFilter(this);
    m_editDataFormatName->installEventFilter(this);
    m_editDataFormatDefinition->installEventFilter(this);
    m_buttonCaptioningFormat->installEventFilter(this);
    m_buttonAncillaryDataFormat->installEventFilter(this);
    m_buttonTechnicalAttributes->installEventFilter(this);
    m_buttonCaptioningFormat->setChecked(true);
}
Пример #28
0
MessageListWidget::MessageListWidget(QWidget *parent) :
    QWidget(parent), m_supportsFuzzySearch(false)
{
    tree = new MsgListView(this);

    m_quickSearchText = new LineEdit(this);
    m_quickSearchText->setHistoryEnabled(true);
    // Filter out newline. It will wreak havoc into the direct IMAP passthrough and could lead to data loss.
    QValidator *validator = new ReplaceCharValidator(QLatin1Char('\n'), QLatin1Char(' '), m_quickSearchText);
    m_quickSearchText->setValidator(validator);
#if QT_VERSION >= 0x040700
    m_quickSearchText->setPlaceholderText(tr("Quick Search"));
#endif
    m_quickSearchText->setToolTip(tr("Type in a text to search for within this mailbox. "
                                     "The icon on the left can be used to limit the search options "
                                     "(like whether to include addresses or message bodies, etc)."
                                     "<br/><hr/>"
                                     "Experts who have read RFC3501 can use the <code>:=</code> prefix and switch to a raw IMAP mode."));
    m_queryPlaceholder = tr("<query>");

    connect(m_quickSearchText, SIGNAL(returnPressed()), this, SLOT(slotApplySearch()));
    connect(m_quickSearchText, SIGNAL(textChanged(QString)), this, SLOT(slotConditionalSearchReset()));
    connect(m_quickSearchText, SIGNAL(cursorPositionChanged(int, int)), this, SLOT(slotUpdateSearchCursor()));

    m_searchOptions = new QToolButton(this);
    m_searchOptions->setAutoRaise(true);
    m_searchOptions->setPopupMode(QToolButton::InstantPopup);
    m_searchOptions->setText(QLatin1String("*"));
    m_searchOptions->setIcon(UiUtils::loadIcon(QLatin1String("imap-search-details")));
    QMenu *optionsMenu = new QMenu(m_searchOptions);
    m_searchFuzzy = optionsMenu->addAction(tr("Fuzzy Search"));
    m_searchFuzzy->setCheckable(true);
    optionsMenu->addSeparator();
    m_searchInSubject = optionsMenu->addAction(tr("Subject"));
    m_searchInSubject->setCheckable(true);
    m_searchInSubject->setChecked(true);
    m_searchInBody = optionsMenu->addAction(tr("Body"));
    m_searchInBody->setCheckable(true);
    m_searchInSenders = optionsMenu->addAction(tr("Senders"));
    m_searchInSenders->setCheckable(true);
    m_searchInSenders->setChecked(true);
    m_searchInRecipients = optionsMenu->addAction(tr("Recipients"));
    m_searchInRecipients->setCheckable(true);

    optionsMenu->addSeparator();

    QMenu *complexMenu = new QMenu(tr("Complex IMAP query"), optionsMenu);
    connect(complexMenu, SIGNAL(triggered(QAction*)), this, SLOT(slotComplexSearchInput(QAction*)));
    complexMenu->addAction(tr("Not ..."))->setData(QLatin1String("NOT ") + m_queryPlaceholder);
    complexMenu->addAction(tr("Either... or..."))->setData(QLatin1String("OR ") + m_queryPlaceholder + QLatin1Char(' ') + m_queryPlaceholder);
    complexMenu->addSeparator();
    complexMenu->addAction(tr("From sender"))->setData(QLatin1String("FROM ") + m_queryPlaceholder);
    complexMenu->addAction(tr("To receiver"))->setData(QLatin1String("TO ") + m_queryPlaceholder);
    complexMenu->addSeparator();
    complexMenu->addAction(tr("About subject"))->setData(QLatin1String("SUBJECT " )+ m_queryPlaceholder);
    complexMenu->addAction(tr("Message contains ..."))->setData(QLatin1String("BODY ") + m_queryPlaceholder);
    complexMenu->addSeparator();
    complexMenu->addAction(tr("Before date"))->setData(QLatin1String("BEFORE <d-mmm-yyyy>"));
    complexMenu->addAction(tr("Since date"))->setData(QLatin1String("SINCE <d-mmm-yyyy>"));
    complexMenu->addSeparator();
    complexMenu->addAction(tr("Has been seen"))->setData(QLatin1String("SEEN"));

    m_rawSearch = optionsMenu->addAction(tr("Allow raw IMAP search"));
    m_rawSearch->setCheckable(true);
    QAction *rawSearchMenu = optionsMenu->addMenu(complexMenu);
    rawSearchMenu->setVisible(false);
    connect (m_rawSearch, SIGNAL(toggled(bool)), rawSearchMenu, SLOT(setVisible(bool)));
    connect (m_rawSearch, SIGNAL(toggled(bool)), SIGNAL(rawSearchSettingChanged(bool)));

    m_searchOptions->setMenu(optionsMenu);
    connect (optionsMenu, SIGNAL(aboutToShow()), SLOT(slotDeActivateSimpleSearch()));

    delete m_quickSearchText->layout();
    QHBoxLayout *hlayout = new QHBoxLayout(m_quickSearchText);
    hlayout->setContentsMargins(0, 0, 0, 0);
    hlayout->addWidget(m_searchOptions);
    hlayout->addStretch();
    hlayout->addWidget(m_quickSearchText->clearButton());
    hlayout->activate(); // this processes the layout and ensures the toolbutton has it's final dimensions
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
    if (QGuiApplication::isLeftToRight())
#else
    if (qApp->keyboardInputDirection() == Qt::LeftToRight)
#endif
        m_quickSearchText->setTextMargins(m_searchOptions->width(), 0, 0, 0);
    else // ppl. in N Africa and the middle east write the wrong direction...
        m_quickSearchText->setTextMargins(0, 0, m_searchOptions->width(), 0);
    m_searchOptions->setCursor(Qt::ArrowCursor); // inherits I-Beam from lineedit otherwise

    QVBoxLayout *layout = new QVBoxLayout(this);
    layout->setSpacing(0);
    layout->setContentsMargins(0, 0, 0, 0);
    layout->addWidget(m_quickSearchText);
    layout->addWidget(tree);

    m_searchResetTimer = new QTimer(this);
    m_searchResetTimer->setSingleShot(true);
    connect(m_searchResetTimer, SIGNAL(timeout()), SLOT(slotApplySearch()));

    slotAutoEnableDisableSearch();
}
Пример #29
0
void GradientDialog::Private::init()
{
    ui->setupUi( q );
    QStringList list; list << tr( "stop1" ) << tr( "stop2" );
    ui->stopSelector->addItems( list );
    QHBoxLayout *redLayout = new QHBoxLayout;
    dynamic_cast< QVBoxLayout* >( ui->gradientStopBox->layout() )->addLayout( redLayout );
    QLabel *redLabel = new QLabel( "R" );
    QFont redFont( redLabel->font() );
    redFont.setUnderline( true );
    redLabel->setFont( redFont );
    redLayout->addWidget( redLabel );
    redSlider = new ColorSlider( q );
    redSlider->setStartColor( Qt::black );
    redSlider->setEndColor( Qt::red );
    QSpinBox *redSpin = new QSpinBox( q );
    redSpin->setMinimum( 0 );
    redSpin->setMaximum( 255 );
    redSpin->setAccelerated( true );
    redSpin->setValue( redSlider->value() );
    connect( redSpin, SIGNAL( valueChanged( int ) ), redSlider, SLOT( setValue( int ) ) );
    connect( redSlider, SIGNAL( valueChanged( int ) ), redSpin, SLOT( setValue( int ) ) );
    redLayout->addWidget( redSlider );
    redLayout->addWidget( redSpin );

    QHBoxLayout *greenLayout = new QHBoxLayout;
    dynamic_cast< QVBoxLayout* >( ui->gradientStopBox->layout() )->addLayout( greenLayout );
    QLabel *greenLabel = new QLabel( "G" );
    QFont greenFont( greenLabel->font() );
    greenFont.setUnderline( true );
    greenLabel->setFont( greenFont );
    greenLayout->addWidget( greenLabel );
    greenSlider = new ColorSlider( q );
    greenSlider->setStartColor( Qt::black );
    greenSlider->setEndColor( Qt::green );
    QSpinBox *greenSpin = new QSpinBox( q );
    greenSpin->setMinimum( 0 );
    greenSpin->setMaximum( 255 );
    greenSpin->setAccelerated( true );
    greenSpin->setValue( greenSlider->value() );
    connect( greenSpin, SIGNAL( valueChanged( int ) ), greenSlider, SLOT( setValue( int ) ) );
    connect( greenSlider, SIGNAL( valueChanged( int ) ), greenSpin, SLOT( setValue( int ) ) );
    greenLayout->addWidget( greenSlider );
    greenLayout->addWidget( greenSpin );

    QHBoxLayout *blueLayout = new QHBoxLayout;
    dynamic_cast< QVBoxLayout* >( ui->gradientStopBox->layout() )->addLayout( blueLayout );
    QLabel *blueLabel = new QLabel( "B" );
    QFont blueFont( blueLabel->font() );
    blueFont.setUnderline( true );
    blueLabel->setFont( blueFont );
    blueLayout->addWidget( blueLabel );
    blueSlider = new ColorSlider( q );
    blueSlider->setStartColor( Qt::black );
    blueSlider->setEndColor( Qt::blue );
    QSpinBox *blueSpin = new QSpinBox( q );
    blueSpin->setMinimum( 0 );
    blueSpin->setMaximum( 255 );
    blueSpin->setAccelerated( true );
    blueSpin->setValue( blueSlider->value() );
    connect( blueSpin, SIGNAL( valueChanged( int ) ), blueSlider, SLOT( setValue( int ) ) );
    connect( blueSlider, SIGNAL( valueChanged( int ) ), blueSpin, SLOT( setValue( int ) ) );
    blueLayout->addWidget( blueSlider );
    blueLayout->addWidget( blueSpin );

    updateGradientDisplay();

    connect( redSlider, SIGNAL( valueChanged( int ) ), this, SLOT( resetColors() ) );
    connect( greenSlider, SIGNAL( valueChanged( int ) ), this, SLOT( resetColors() ) );
    connect( blueSlider, SIGNAL( valueChanged( int ) ), this, SLOT( resetColors() ) );

    connect( ui->newStop, SIGNAL( clicked() ), this, SLOT( insertItem() ) );
    connect( ui->deleteStop, SIGNAL( clicked() ), this, SLOT( deleteItem() ) );
    connect( ui->stopSelector, SIGNAL( currentIndexChanged( int ) ), this, SLOT( changedIndex( int ) ) );

    connect( ui->stopPosition, SIGNAL( valueChanged( double ) ), this, SLOT( changeStopPosition( double ) ) );
}
Пример #30
0
AvatarSpiritPage::AvatarSpiritPage(QWidget *parent) :
    ConfigPage(parent)
{
    // life
    QGroupBox *lifeGroup = new QGroupBox(tr("Default Life Value"));
    QLabel *mouseLifeLabel = new QLabel(tr("Mouse Life"));
    mouseLifeEdit = new QLineEdit(g_config.getValue("AvatarSpirit/Life/Mouse").toString());
    mouseLifeEdit->setToolTip(tr("float (>0)"));
    QLabel *catLifeLabel = new QLabel(tr("Cat Life"));
    catLifeEdit = new QLineEdit(g_config.getValue("AvatarSpirit/Life/Cat").toString());
    catLifeEdit->setToolTip(tr("float (>0)"));
    QLabel *elephantLifeLabel = new QLabel(tr("Elephant Life"));
    elephantLifeEdit = new QLineEdit(g_config.getValue("AvatarSpirit/Life/Elephant").toString());
    elephantLifeEdit->setToolTip(tr("float (>0)"));

    QGridLayout *lifeLayout = new QGridLayout;
    lifeLayout->addWidget(mouseLifeLabel, 0, 0);
    lifeLayout->addWidget(mouseLifeEdit, 0, 1);
    lifeLayout->addWidget(catLifeLabel, 1, 0);
    lifeLayout->addWidget(catLifeEdit, 1, 1);
    lifeLayout->addWidget(elephantLifeLabel, 2, 0);
    lifeLayout->addWidget(elephantLifeEdit, 2, 1);
    lifeGroup->setLayout(lifeLayout);

    // sharing
    QGroupBox *shareGroup = new QGroupBox(tr("Default Sharing Params"));
    QLabel *rangeLabel = new QLabel(tr("Share Range"));
    rangeEdit = new QLineEdit(g_config.getValue("AvatarSpirit/ShareParams/ShareRange").toString());
    rangeEdit->setToolTip(tr("int (>=0, 0 to turn off sharing)"));
    QLabel *freqLabel = new QLabel(tr("Share Freq"));
    freqEdit = new QLineEdit(g_config.getValue("AvatarSpirit/ShareParams/ShareFreq").toString());
    freqEdit->setToolTip(tr("int (>0)"));

    QGridLayout *shareLayout = new QGridLayout;
    shareLayout->addWidget(rangeLabel, 0, 0);
    shareLayout->addWidget(rangeEdit, 0, 1);
    shareLayout->addWidget(freqLabel, 1, 0);
    shareLayout->addWidget(freqEdit, 1, 1);
    shareGroup->setLayout(shareLayout);

    // gamcs params
    QGroupBox *paramsGroup = new QGroupBox(tr("Default GAMCS Parameters"));
    QLabel *drLabel = new QLabel(tr("Discount Rate"));
    drEdit = new QLineEdit(g_config.getValue("AvatarSpirit/GAMCSParams/DiscountRate").toString());
    drEdit->setToolTip(tr("float (>=0, <1)"));
    QLabel *acuLabel = new QLabel(tr("Accuracy"));
    acuEdit = new QLineEdit(g_config.getValue("AvatarSpirit/GAMCSParams/Accuracy").toString());
    acuEdit->setToolTip(tr("float (>=0)"));
    QLabel *lmLabel = new QLabel(tr("Learning Mode"));
    lmCombo = new QComboBox;
    lmCombo->addItem(tr("Online"));
    lmCombo->addItem(tr("Explore"));
    if (g_config.getValue("AvatarSpirit/GAMCSParams/LearningMode").toString() == "Explore")
        lmCombo->setCurrentIndex(1);
    else	// online is the default
        lmCombo->setCurrentIndex(0);

    QGridLayout *paramsLayout = new QGridLayout;
    paramsLayout->addWidget(drLabel, 0, 0);
    paramsLayout->addWidget(drEdit, 0, 1);
    paramsLayout->addWidget(acuLabel, 1, 0);
    paramsLayout->addWidget(acuEdit, 1, 1);
    paramsLayout->addWidget(lmLabel, 2, 0);
    paramsLayout->addWidget(lmCombo, 2, 1);
    paramsGroup->setLayout(paramsLayout);

    QPushButton *defaultButton = new QPushButton(tr("Default"));
    connect(defaultButton, SIGNAL(clicked()), this, SLOT(resetDefault()));
    QHBoxLayout *defaultLayout = new QHBoxLayout;
    defaultLayout->addWidget(defaultButton, 0, Qt::AlignRight);

    QVBoxLayout *mainLayout = new QVBoxLayout;
    mainLayout->addWidget(lifeGroup);
    mainLayout->addSpacing(10);
    mainLayout->addWidget(shareGroup);
    mainLayout->addSpacing(10);
    mainLayout->addWidget(paramsGroup);
    mainLayout->addStretch(1);
    mainLayout->addLayout(defaultLayout);
    setLayout(mainLayout);
}