Example #1
0
void NSISUpdater::showDialog(const UpdateInfo &info)
{
    // if the version tag is set, there is a newer version.
    QDialog *msgBox = new QDialog;
    msgBox->setAttribute(Qt::WA_DeleteOnClose);

    QIcon infoIcon = msgBox->style()->standardIcon(QStyle::SP_MessageBoxInformation, 0, 0);
    int iconSize = msgBox->style()->pixelMetric(QStyle::PM_MessageBoxIconSize, 0, 0);

    msgBox->setWindowIcon(infoIcon);

    QVBoxLayout *layout = new QVBoxLayout(msgBox);
    QHBoxLayout *hlayout = new QHBoxLayout;
    layout->addLayout(hlayout);

    msgBox->setWindowTitle(tr("New Version Available"));

    QLabel *ico = new QLabel;
    ico->setFixedSize(iconSize, iconSize);
    ico->setPixmap(infoIcon.pixmap(iconSize));
    QLabel *lbl = new QLabel;
    QString txt = tr("<p>A new version of the %1 Client is available.</p>"
                     "<p><b>%2</b> is available for download. The installed version is %3.</p>")
                      .arg(Utility::escape(Theme::instance()->appNameGUI()),
                          Utility::escape(info.versionString()), Utility::escape(clientVersion()));

    lbl->setText(txt);
    lbl->setTextFormat(Qt::RichText);
    lbl->setWordWrap(true);

    hlayout->addWidget(ico);
    hlayout->addWidget(lbl);

    QDialogButtonBox *bb = new QDialogButtonBox;
    bb->setWindowFlags(bb->windowFlags() & ~Qt::WindowContextHelpButtonHint);
    QPushButton *skip = bb->addButton(tr("Skip this version"), QDialogButtonBox::ResetRole);
    QPushButton *reject = bb->addButton(tr("Skip this time"), QDialogButtonBox::AcceptRole);
    QPushButton *getupdate = bb->addButton(tr("Get update"), QDialogButtonBox::AcceptRole);

    connect(skip, &QAbstractButton::clicked, msgBox, &QDialog::reject);
    connect(reject, &QAbstractButton::clicked, msgBox, &QDialog::reject);
    connect(getupdate, &QAbstractButton::clicked, msgBox, &QDialog::accept);

    connect(skip, &QAbstractButton::clicked, this, &NSISUpdater::slotSetSeenVersion);
    connect(getupdate, SIGNAL(clicked()), SLOT(slotOpenUpdateUrl()));

    layout->addWidget(bb);

    msgBox->open();
}
Example #2
0
void UpdateDetector::showDialog()
{
    QDialog *msgBox = new QDialog;

    QIcon info = msgBox->style()->standardIcon(QStyle::SP_MessageBoxInformation, 0, 0);
    int iconSize = msgBox->style()->pixelMetric(QStyle::PM_MessageBoxIconSize, 0, 0);

    msgBox->setWindowIcon(info);

    QVBoxLayout *layout = new QVBoxLayout(msgBox);
    QHBoxLayout *hlayout = new QHBoxLayout;
    layout->addLayout(hlayout);

    msgBox->setWindowTitle(tr("New Version Available"));

    QLabel *ico = new QLabel;
    ico->setFixedSize(iconSize, iconSize);
    ico->setPixmap(info.pixmap(iconSize));
    QLabel *lbl = new QLabel;
    QString txt = tr("<p>A new version of the %1 Client is available.</p>"
                     "<p><b>%2</b> is available for download. The installed version is %3.<p>")
            .arg(Theme::instance()->appNameGUI()).arg(ocClient.versionstring())
            .arg(QLatin1String(MIRALL_STRINGIFY(MIRALL_VERSION_FULL)));

    lbl->setText(txt);
    lbl->setTextFormat(Qt::RichText);
    lbl->setWordWrap(true);

    hlayout->addWidget(ico);
    hlayout->addWidget(lbl);

    QDialogButtonBox *bb = new QDialogButtonBox;
    bb->setWindowFlags(bb->windowFlags() & ~Qt::WindowContextHelpButtonHint);
    QPushButton *skip = bb->addButton(tr("Skip update"), QDialogButtonBox::ResetRole);
    QPushButton *reject = bb->addButton(tr("Skip this time"), QDialogButtonBox::AcceptRole);
    QPushButton  *getupdate = bb->addButton(tr("Get update"), QDialogButtonBox::AcceptRole);

    connect(skip, SIGNAL(clicked()), msgBox, SLOT(reject()));
    connect(reject, SIGNAL(clicked()), msgBox, SLOT(reject()));
    connect(getupdate, SIGNAL(clicked()), msgBox, SLOT(accept()));

    connect(skip, SIGNAL(clicked()), SLOT(slotSetVersionSeen()));
    connect(getupdate, SIGNAL(clicked()), SLOT(slotOpenUpdateUrl()));

    layout->addWidget(bb);

    msgBox->open();
    msgBox->resize(400, msgBox->sizeHint().height());
}
void BCIService::init(BCIControlWindow *bciControlWindow)
{
    ROS_INFO("Initing BCI Service");
    bciRenderArea = bciControlWindow->bciWorldView->renderArea;

    QPushButton * slowButton = new QPushButton("Flex Medium (Next)");
    QPushButton * fastButton = new QPushButton("Flex Hard (Select)");

    slowButton->setDefault(true);
    fastButton->setDefault(true);

    QDialogButtonBox *cursorControlBox = new QDialogButtonBox(Qt::Vertical);
    cursorControlBox->setCaption(QString("Cursor Control Box"));

    cursorControlBox->addButton(slowButton, QDialogButtonBox::ActionRole);
    cursorControlBox->addButton(fastButton, QDialogButtonBox::ActionRole);
    cursorControlBox->setWindowFlags(Qt::WindowStaysOnTopHint);
    cursorControlBox->resize(QSize(200,100));
    cursorControlBox->show();

    QObject::connect(slowButton, SIGNAL(clicked()), this, SLOT(updateControlSceneState1()));
    QObject::connect(fastButton, SIGNAL(clicked()), this, SLOT(updateControlSceneState2()));


    endOfExperimentFormat = new QFormLayout();

    successFailure = new QComboBox();
    successFailure->insertItem("Success");
    successFailure->insertItem("Failure");

    finalComments = new QTextEdit();

    finishedButton = new QPushButton("FINISHED");


    endOfExperimentFormat->addRow(tr("&Success or failure: "), successFailure);
    endOfExperimentFormat->addRow(tr("&Comments: "), finalComments);
    endOfExperimentFormat->addRow(tr(""), finishedButton);

    endOfExperiment = new QGroupBox();
    endOfExperiment->setLayout(endOfExperimentFormat);



    QObject::connect(finishedButton, SIGNAL(clicked()), this, SLOT(onFinishedFinalLog()));

    endOfExperiment->show();

    timer = new QTimer;
    QObject::connect(timer, SIGNAL(timeout()), this, SLOT(updateControlScene()));
    timer->start(1000 / 30);

    QObject::connect(this, SIGNAL(goToStateLow()), this, SLOT(updateControlSceneState0()));
    QObject::connect(this, SIGNAL(goToStateMedium()), this, SLOT(updateControlSceneState1()));
    QObject::connect(this, SIGNAL(goToStateHigh()), this, SLOT(updateControlSceneState2()));

    SoAnnotation *hudSeparator = new SoAnnotation;
    hudSeparator->renderCaching = SoSeparator::OFF;
    hudSeparator->setName("hud");
    graspitCore->getWorld()->getIVRoot()->addChild(hudSeparator);
    pcam = new SoOrthographicCamera;
    pcam->position = SbVec3f(0, 0, 10);
    pcam->nearDistance = 0.1;
    pcam->farDistance = 11;

    hudSeparator->addChild(pcam);
    SoLightModel * hudLightModel = new SoLightModel;
    hudLightModel->model=SoLightModel::BASE_COLOR;
    hudSeparator->addChild(hudLightModel);
    SoCallback * disableZTestNode = new SoCallback();
    disableZTestNode->setCallback(ui_tools::disableZCulling);
    hudSeparator->addChild(disableZTestNode);
    csm = new ControllerSceneManager(hudSeparator);

    BCIStateMachine *bciStateMachine = new BCIStateMachine(bciControlWindow,this);
    connect(this, SIGNAL(plannerUpdated()), bciControlWindow, SLOT(redraw()));
    connect(GraspManager::getInstance(), SIGNAL(render()), bciControlWindow, SLOT(redraw()));
    bciStateMachine->start();

    ROS_INFO("Finished initing BCI Service");
}