SGMSettingsMasterView::SGMSettingsMasterView(QWidget *parent) :
	QWidget(parent)
{
	sgmPluginsLocationView_ = new SGMPluginsLocationView();
	sgmDetectorsMasterView_ = new SGMDetectorsMasterView();

	connect(sgmPluginsLocationView_, SIGNAL(unsavedChanges(bool)), this, SLOT(onUnsavedChanges(bool)));
	connect(sgmDetectorsMasterView_, SIGNAL(unsavedChanges(bool)), this, SLOT(onUnsavedChanges(bool)));

	vl_ = new QVBoxLayout();
	vl_->addWidget(sgmPluginsLocationView_);
	vl_->addWidget(sgmDetectorsMasterView_);

	applyButton_ = new QPushButton("Apply");
	cancelButton_ = new QPushButton("Cancel");
	okButton_ = new QPushButton("Ok");

	connect(applyButton_, SIGNAL(clicked()), this, SLOT(onApplyButtonClicked()));
	connect(cancelButton_, SIGNAL(clicked()), this, SLOT(onCancelButtonClicked()));
	connect(okButton_, SIGNAL(clicked()), this, SLOT(onOkButtonClicked()));

	QHBoxLayout *hl = new QHBoxLayout();
	hl->addWidget(applyButton_);
	hl->addStretch(4);
	hl->addWidget(cancelButton_);
	hl->addWidget(okButton_);

	vl_->addLayout(hl);

	setLayout(vl_);
}
Exemple #2
0
DialogBare::DialogBare(QWidget *parent) :
    QWidget(parent),
    loading(false),
    ui(new Ui::DialogBare),
    worker(NULL),
    boardFoundWidget(NULL)
{
    ui->setupUi(this);

    foreach (QextPortInfo info, QextSerialEnumerator::getPorts())
        if (!info.portName.isEmpty())
            ui->portBox->addItem(info.portName);
    //make sure user can input their own port name!
    ui->portBox->setEditable(true);

//    ui->led->turnOff();

    PortSettings settings = {BAUD9600, DATA_8, PAR_NONE, STOP_1, FLOW_OFF, 10};
    port = new QextSerialPort(ui->portBox->currentText(), settings, QextSerialPort::Polling);

    enumerator = new QextSerialEnumerator(this);
    enumerator->setUpNotifications();

    ui->boardComboBox->addItem("PX4FMU v1.6+", 5);
    ui->boardComboBox->addItem("PX4FLOW v1.1+", 6);
    ui->boardComboBox->addItem("PX4IO v1.3+", 7);
    ui->boardComboBox->addItem("PX4 board #8", 8);
    ui->boardComboBox->addItem("PX4 board #9", 9);
    ui->boardComboBox->addItem("PX4 board #10", 10);
    ui->boardComboBox->addItem("PX4 board #11", 11);

    connect(ui->portBox, SIGNAL(editTextChanged(QString)), SLOT(onPortNameChanged(QString)));
    connect(ui->flashButton, SIGNAL(clicked()), SLOT(onUploadButtonClicked()));
    connect(ui->scanButton, SIGNAL(clicked()), SLOT(onDetect()));
    connect(ui->selectFileButton, SIGNAL(clicked()), SLOT(onFileSelectRequested()));
    connect(ui->cancelButton, SIGNAL(clicked()), SLOT(onCancelButtonClicked()));

    connect(ui->advancedCheckBox, SIGNAL(clicked(bool)), this, SLOT(onToggleAdvancedMode(bool)));

    connect(enumerator, SIGNAL(deviceDiscovered(QextPortInfo)), SLOT(onPortAddedOrRemoved()));
    connect(enumerator, SIGNAL(deviceRemoved(QextPortInfo)), SLOT(onPortAddedOrRemoved()));

    setWindowTitle(tr("QUpgrade Firmware Upload / Configuration Tool"));

    // Adjust the size
    const int screenHeight = qMin(1000, QApplication::desktop()->height() - 100);

    resize(700, qMax(screenHeight, 550));

    // load settings
    loadSettings();

    // Set up initial state
    if (!lastFilename.isEmpty()) {
        ui->flashButton->setEnabled(true);
    } else {
        ui->flashButton->setEnabled(false);
    }
}
Exemple #3
0
void Dialog::onDownloadFinished()
{
    QNetworkReply *reply = qobject_cast<QNetworkReply*>(QObject::sender());

    if (!reply) {
        // bail out, nothing to do
        ui->upgradeLog->appendPlainText("Download failed, invalid context");
        return;
    }

    if (loading) {
        onCancelButtonClicked();
        ui->upgradeLog->appendPlainText(tr("Still flashing. Waiting for firmware flashing to complete.."));
    } else {

        // Reset progress
        ui->upgradeProgressBar->setValue(0);

        // Pick file
        QString fileName = lastFilename;

        qDebug() << "Handling filename:" << fileName;

        // Store file in download location
        QFile file(fileName);
        if (!file.open(QIODevice::WriteOnly)) {
            ui->upgradeLog->appendPlainText(tr("Could not open %s for writing: %s\n").arg(fileName).arg(file.errorString()));
            return;
        }

        file.write(reply->readAll());
        file.close();

        if (lastFilename.contains("px4io")) {
            // Done, bail out
            return;
        }

        if (fileName.length() > 0) {
            // Got a filename, upload
            onLoadStart();
            lastFilename = fileName;

            worker = QGCFirmwareUpgradeWorker::putWorkerInThread(fileName);
            // Hook up status from worker to progress bar
            connect(worker, SIGNAL(upgradeProgressChanged(int)), ui->upgradeProgressBar, SLOT(setValue(int)));
            // Hook up text from worker to label
            connect(worker, SIGNAL(upgradeStatusChanged(QString)), ui->upgradeLog, SLOT(appendPlainText(QString)));
            // Hook up error handling
            //connect(worker, SIGNAL(error(QString)), ui->upgradeLog, SLOT(appendPlainText(QString)));
            // Hook up status from worker to this class
            connect(worker, SIGNAL(loadFinished(bool)), this, SLOT(onLoadFinished(bool)));

            // Make sure user gets the board going now
            //QMessageBox msgBox;
            //msgBox.setText(" Please unplug your PX4 board now and plug it back in");
            //msgBox.exec();
        }
    }
void UIConfigurePasswordForWirless::onLoad(const QVariantMap& params)
{
    label = findChild<QLabel*>(QString::fromUtf8("label"));
    QPushButton *configbtn = findChild<QPushButton*>(QString::fromUtf8("OKButton"));
    QPushButton *cancelbtn = findChild<QPushButton*>(QString::fromUtf8("CancelButton"));
    connect(configbtn, SIGNAL(clicked()), SLOT(onConfigButtonClicked()));
    connect(cancelbtn, SIGNAL(clicked()), SLOT(onCancelButtonClicked()));
}
void
RenderingProgressDialog::keyPressEvent(QKeyEvent* e)
{
    if (e->key() == Qt::Key_Escape) {
        onCancelButtonClicked();
    } else {
        QDialog::keyPressEvent(e);
    }
}
CalculateWindow::CalculateWindow(QWidget *parent) :
	QDialog(parent)
{
	if (!TensorStore::getInstance().size())
	{
		throw guiException("You have to add at least one tensor to start a calculation.");
	}
	setWindowTitle(tr("Calculate"));
	setMinimumSize(QSize(MINIMUM_WIDTH, MINIMUM_HEIGHT));

	m_comBoxCalcItem = new QComboBox(this);
	m_comBoxCalcItem->setSizeAdjustPolicy(QComboBox::AdjustToContents);
	m_comBoxCalcItem->addItems(OperationItems::getAllowableItems());
	m_calcReqWidget = new OperationRequirementWidget(this);
	QVBoxLayout* calcListLayout = new QVBoxLayout;
	calcListLayout->addWidget(m_comBoxCalcItem, 0, Qt::AlignTop);
	calcListLayout->addWidget(m_calcReqWidget, 1);

	m_tensorView = new TabsWidget(this);
	m_tensorView->setReadOnly(true);

	QHBoxLayout* listAndTensorViewLayout = new QHBoxLayout;
	listAndTensorViewLayout->setSpacing(HORIZ_SPACING);
	listAndTensorViewLayout->addLayout(calcListLayout, 0);
	listAndTensorViewLayout->addWidget(m_tensorView, 1);

	m_pushBtnOk = new QPushButton(tr("OK"), this);
	m_pushBtnOk->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
	m_pushBtnCancel = new QPushButton(tr("Cancel"), this);
	m_pushBtnCancel->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
	QHBoxLayout* okCancelLayout = new QHBoxLayout;
	okCancelLayout->addWidget(m_pushBtnOk, 1, Qt::AlignRight);
	okCancelLayout->addWidget(m_pushBtnCancel, 0, Qt::AlignRight);

	QVBoxLayout* mainLayout = new QVBoxLayout;
	mainLayout->addLayout(listAndTensorViewLayout);
	mainLayout->addLayout(okCancelLayout);
	mainLayout->setContentsMargins(CONTENT_MARGIN, CONTENT_MARGIN, CONTENT_MARGIN, CONTENT_MARGIN);

	setLayout(mainLayout);

	qRegisterMetaType<MatrixVectorExp>("MatrixVectorExp");

	connect(m_pushBtnOk, SIGNAL(clicked()), this, SLOT(onOkButtonClicked()));
	connect(m_pushBtnCancel, SIGNAL(clicked()), this, SLOT(onCancelButtonClicked()));
	connect(m_comBoxCalcItem, SIGNAL(currentIndexChanged(int)), this,
		SLOT(onCalcItemCurrentIndexChanged(int)));
	connect(m_calcReqWidget, SIGNAL(tensorChoosed(QString)), this,
		SLOT(onReqWidgetTensorChosen(QString)));

	onCalcItemCurrentIndexChanged(0);
}
LYGithubProductBacklogAddIssueView::LYGithubProductBacklogAddIssueView(QWidget *parent)
	: QDialog(parent)
{
	issueCreatedSuccessfully_ = false;
	exitCountDownTimer_ = 0;

	issueTitleEdit_ = new QLineEdit();

	issueBodyEdit_ = new QTextEdit();

	submitIssuesButton_ = new QPushButton(QIcon(":/22x22/greenCheck.png"), "Submit");
	submitIssuesButton_->setEnabled(false);

	cancelButton_ = new QPushButton(QIcon(":/22x22/list-remove-2.png"), "Cancel");

	waitingBar_ = new QProgressBar();
	waitingBar_->setMinimum(0);
	waitingBar_->setMaximum(0);
	waitingBar_->setMinimumWidth(200);
	waitingBar_->hide();

	messageLabel_ = new QLabel();

	QHBoxLayout *messageVL = new QHBoxLayout();
	messageVL->addWidget(messageLabel_, 0, Qt::AlignCenter);
	messageVL->addWidget(waitingBar_, 0, Qt::AlignCenter);

	QVBoxLayout *fl = new QVBoxLayout();
	fl->addWidget(new QLabel("Title"), 0, Qt::AlignLeft);
	fl->addWidget(issueTitleEdit_);
	fl->addWidget(new QLabel("Description"), 0, Qt::AlignLeft);
	fl->addWidget(issueBodyEdit_);

	QHBoxLayout *hl = new QHBoxLayout();
	hl->addStretch();
	hl->addWidget(submitIssuesButton_);
	hl->addWidget(cancelButton_);

	QVBoxLayout *vl = new QVBoxLayout();
	vl->addLayout(fl);
	vl->addLayout(messageVL);
	vl->addLayout(hl);

	setLayout(vl);

	connect(cancelButton_, SIGNAL(clicked()), this, SLOT(onCancelButtonClicked()));
	connect(submitIssuesButton_, SIGNAL(clicked()), this, SLOT(onSubmitIssueButtonClicked()));

	connect(issueTitleEdit_, SIGNAL(textEdited(QString)), this, SLOT(onEditsChanged()));
	connect(issueBodyEdit_, SIGNAL(textChanged()), this, SLOT(onEditsChanged()));
}
void LLPanelPlaces::onSaveButtonClicked()
{
	if (!mLandmarkInfo || mItem.isNull())
		return;

	std::string current_title_value = mLandmarkInfo->getLandmarkTitle();
	std::string item_title_value = mItem->getName();
	std::string current_notes_value = mLandmarkInfo->getLandmarkNotes();
	std::string item_notes_value = mItem->getDescription();

	LLStringUtil::trim(current_title_value);
	LLStringUtil::trim(current_notes_value);

	LLUUID item_id = mItem->getUUID();
	LLUUID folder_id = mLandmarkInfo->getLandmarkFolder();

	LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(mItem);

	if (!current_title_value.empty() &&
		(item_title_value != current_title_value || item_notes_value != current_notes_value))
	{
		new_item->rename(current_title_value);
		new_item->setDescription(current_notes_value);
		new_item->updateServer(FALSE);
	}

	if(folder_id != mItem->getParentUUID())
	{
		LLInventoryModel::update_list_t update;
		LLInventoryModel::LLCategoryUpdate old_folder(mItem->getParentUUID(),-1);
		update.push_back(old_folder);
		LLInventoryModel::LLCategoryUpdate new_folder(folder_id, 1);
		update.push_back(new_folder);
		gInventory.accountForUpdate(update);

		new_item->setParent(folder_id);
		new_item->updateParentOnServer(FALSE);
	}

	gInventory.updateItem(new_item);
	gInventory.notifyObservers();

	onCancelButtonClicked();
}
void ExamineResultDialog::createButtonBox()
{
	this->button_layout = new QHBoxLayout;
	this->button_layout->addStretch();

	this->cancel_button = new QPushButton(tr("cancel game"));
	connect(this->cancel_button, SIGNAL(clicked()), this, SLOT(onCancelButtonClicked()));

	if (this->examine_state->total_finished < this->examine_state->total) {
		this->next_button = new QPushButton(tr("next game"));
		this->button_layout->addWidget(this->next_button);
		connect(this->next_button, SIGNAL(clicked()), this, SLOT(onNextButtonClicked()));
	}
	else {
		this->new_button = new QPushButton(tr("change gatekeeper"));
		this->button_layout->addWidget(this->new_button);
		connect(this->new_button, SIGNAL(clicked()), this, SLOT(onNewButtonClicked()));
	}

	this->button_layout->addWidget(this->cancel_button);
}
Exemple #10
0
    void TradeWindow::onOfferButtonClicked(MyGUI::Widget* _sender)
    {
        TradeItemModel* playerItemModel = MWBase::Environment::get().getWindowManager()->getInventoryWindow()->getTradeModel();

        const MWWorld::Store<ESM::GameSetting> &gmst =
            MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>();

        // were there any items traded at all?
        std::vector<ItemStack> playerBought = playerItemModel->getItemsBorrowedToUs();
        std::vector<ItemStack> merchantBought = mTradeModel->getItemsBorrowedToUs();
        if (!playerBought.size() && !merchantBought.size())
        {
            // user notification
            MWBase::Environment::get().getWindowManager()->
                messageBox("#{sBarterDialog11}");
            return;
        }

        MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
        int playerGold = player.getClass().getContainerStore(player).count(MWWorld::ContainerStore::sGoldId);

        // check if the player can afford this
        if (mCurrentBalance < 0 && playerGold < std::abs(mCurrentBalance))
        {
            // user notification
            MWBase::Environment::get().getWindowManager()->
                messageBox("#{sBarterDialog1}");
            return;
        }

        // check if the merchant can afford this
        if (mCurrentBalance > 0 && getMerchantGold() < mCurrentBalance)
        {
            // user notification
            MWBase::Environment::get().getWindowManager()->
                messageBox("#{sBarterDialog2}");
            return;
        }

        // check if the player is attempting to sell back an item stolen from this actor
        for (std::vector<ItemStack>::iterator it = merchantBought.begin(); it != merchantBought.end(); ++it)
        {
            if (Misc::StringUtils::ciEqual(it->mBase.getCellRef().mOwner, mPtr.getCellRef().mRefID))
            {
                std::string msg = gmst.find("sNotifyMessage49")->getString();
                if (msg.find("%s") != std::string::npos)
                    msg.replace(msg.find("%s"), 2, it->mBase.getClass().getName(it->mBase));
                MWBase::Environment::get().getWindowManager()->messageBox(msg);
                MWBase::Environment::get().getDialogueManager()->say(mPtr, "Thief");
                MWBase::Environment::get().getMechanicsManager()->reportCrime(player, mPtr, MWBase::MechanicsManager::OT_Theft,
                                                                              it->mBase.getClass().getValue(it->mBase)
                                                                              * it->mCount);
                onCancelButtonClicked(mCancelButton);
                MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Dialogue);
                return;
            }
        }

        if(mCurrentBalance > mCurrentMerchantOffer)
        {
            //if npc is a creature: reject (no haggle)
            if (mPtr.getTypeName() != typeid(ESM::NPC).name())
            {
                MWBase::Environment::get().getWindowManager()->
                    messageBox("#{sNotifyMessage9}");
                return;
            }

            int a = abs(mCurrentMerchantOffer);
            int b = abs(mCurrentBalance);
            int d = 0;
            if (mCurrentBalance<0)
                d = int(100 * (a - b) / a);
            else
                d = int(100 * (b - a) / a);

            float clampedDisposition = std::max<int>(0,std::min<int>(int(MWBase::Environment::get().getMechanicsManager()->getDerivedDisposition(mPtr)
                + MWBase::Environment::get().getDialogueManager()->getTemporaryDispositionChange()),100));

            const MWMechanics::CreatureStats &sellerStats = mPtr.getClass().getCreatureStats(mPtr);
            const MWMechanics::CreatureStats &playerStats = player.getClass().getCreatureStats(player);

            float a1 = std::min(player.getClass().getSkill(player, ESM::Skill::Mercantile), 100);
            float b1 = std::min(0.1f * playerStats.getAttribute(ESM::Attribute::Luck).getModified(), 10.f);
            float c1 = std::min(0.2f * playerStats.getAttribute(ESM::Attribute::Personality).getModified(), 10.f);
            float d1 = std::min(mPtr.getClass().getSkill(mPtr, ESM::Skill::Mercantile), 100);
            float e1 = std::min(0.1f * sellerStats.getAttribute(ESM::Attribute::Luck).getModified(), 10.f);
            float f1 = std::min(0.2f * sellerStats.getAttribute(ESM::Attribute::Personality).getModified(), 10.f);

            float pcTerm = (clampedDisposition - 50 + a1 + b1 + c1) * playerStats.getFatigueTerm();
            float npcTerm = (d1 + e1 + f1) * sellerStats.getFatigueTerm();
            float x = gmst.find("fBargainOfferMulti")->getFloat() * d + gmst.find("fBargainOfferBase")->getFloat();
            if (mCurrentBalance<0)
                x += abs(int(pcTerm - npcTerm));
            else
                x += abs(int(npcTerm - pcTerm));

            int roll = std::rand()%100 + 1;
            if(roll > x) //trade refused
            {
                MWBase::Environment::get().getWindowManager()->
                    messageBox("#{sNotifyMessage9}");

                int iBarterFailDisposition = gmst.find("iBarterFailDisposition")->getInt();
                if (mPtr.getClass().isNpc())
                    MWBase::Environment::get().getDialogueManager()->applyDispositionChange(iBarterFailDisposition);
                return;
            }

            //skill use!
            player.getClass().skillUsageSucceeded(player, ESM::Skill::Mercantile, 0);
        }

        int iBarterSuccessDisposition = gmst.find("iBarterSuccessDisposition")->getInt();
        if (mPtr.getClass().isNpc())
            MWBase::Environment::get().getDialogueManager()->applyDispositionChange(iBarterSuccessDisposition);

        // make the item transfer
        mTradeModel->transferItems();
        playerItemModel->transferItems();

        // transfer the gold
        if (mCurrentBalance != 0)
        {
            addOrRemoveGold(mCurrentBalance, player);
            mPtr.getClass().getCreatureStats(mPtr).setGoldPool(
                        mPtr.getClass().getCreatureStats(mPtr).getGoldPool() - mCurrentBalance );
        }

        updateTradeTime();

        MWBase::Environment::get().getWindowManager()->getDialogueWindow()->addResponse(
            MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>().find("sBarterDialog5")->getString());

        std::string sound = "Item Gold Up";
        MWBase::Environment::get().getSoundManager()->playSound (sound, 1.0, 1.0);

        MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Barter);
    }
Exemple #11
0
    void TradeWindow::onOfferButtonClicked(MyGUI::Widget* _sender)
    {
        TradeItemModel* playerItemModel = MWBase::Environment::get().getWindowManager()->getInventoryWindow()->getTradeModel();

        const MWWorld::Store<ESM::GameSetting> &gmst =
            MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>();

        // were there any items traded at all?
        std::vector<ItemStack> playerBought = playerItemModel->getItemsBorrowedToUs();
        std::vector<ItemStack> merchantBought = mTradeModel->getItemsBorrowedToUs();
        if (playerBought.empty() && merchantBought.empty())
        {
            // user notification
            MWBase::Environment::get().getWindowManager()->
                messageBox("#{sBarterDialog11}");
            return;
        }

        MWWorld::Ptr player = MWMechanics::getPlayer();
        int playerGold = player.getClass().getContainerStore(player).count(MWWorld::ContainerStore::sGoldId);

        // check if the player can afford this
        if (mCurrentBalance < 0 && playerGold < std::abs(mCurrentBalance))
        {
            // user notification
            MWBase::Environment::get().getWindowManager()->
                messageBox("#{sBarterDialog1}");
            return;
        }

        // check if the merchant can afford this
        if (mCurrentBalance > 0 && getMerchantGold() < mCurrentBalance)
        {
            // user notification
            MWBase::Environment::get().getWindowManager()->
                messageBox("#{sBarterDialog2}");
            return;
        }

        // check if the player is attempting to sell back an item stolen from this actor
        for (std::vector<ItemStack>::iterator it = merchantBought.begin(); it != merchantBought.end(); ++it)
        {
            if (MWBase::Environment::get().getMechanicsManager()->isItemStolenFrom(it->mBase.getCellRef().getRefId(),
                                                                                   mPtr.getCellRef().getRefId()))
            {
                std::string msg = gmst.find("sNotifyMessage49")->getString();
                if (msg.find("%s") != std::string::npos)
                    msg.replace(msg.find("%s"), 2, it->mBase.getClass().getName(it->mBase));
                MWBase::Environment::get().getWindowManager()->messageBox(msg);

                MWBase::Environment::get().getMechanicsManager()->confiscateStolenItemToOwner(player, it->mBase, mPtr, it->mCount);

                onCancelButtonClicked(mCancelButton);
                MWBase::Environment::get().getWindowManager()->exitCurrentGuiMode();
                return;
            }
        }

        bool offerAccepted = mTrading.haggle(player, mPtr, mCurrentBalance, mCurrentMerchantOffer);

        // apply disposition change if merchant is NPC
        if ( mPtr.getClass().isNpc() ) {
            int dispositionDelta = offerAccepted
                ? gmst.find("iBarterSuccessDisposition")->getInt()
                : gmst.find("iBarterFailDisposition")->getInt();

            MWBase::Environment::get().getDialogueManager()->applyDispositionChange(dispositionDelta);
        }

        // display message on haggle failure
        if ( !offerAccepted ) {
            MWBase::Environment::get().getWindowManager()->
                messageBox("#{sNotifyMessage9}");
            return;
        }

        // make the item transfer
        mTradeModel->transferItems();
        playerItemModel->transferItems();

        // transfer the gold
        if (mCurrentBalance != 0)
        {
            addOrRemoveGold(mCurrentBalance, player);
            mPtr.getClass().getCreatureStats(mPtr).setGoldPool(
                        mPtr.getClass().getCreatureStats(mPtr).getGoldPool() - mCurrentBalance );
        }

        eventTradeDone();

        MWBase::Environment::get().getWindowManager()->playSound("Item Gold Up");
        MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Barter);

        restock();
    }
RenderingProgressDialog::RenderingProgressDialog(Gui* gui,
                                                 const QString & sequenceName,
                                                 int firstFrame,
                                                 int lastFrame,
                                                 int frameStep,
                                                 const boost::shared_ptr<ProcessHandler> & process,
                                                 QWidget* parent)
    : QDialog(parent,Qt::WindowStaysOnTopHint)
      , _imp( new RenderingProgressDialogPrivate(gui,sequenceName,firstFrame,lastFrame,frameStep,process) )

{
    setMinimumWidth(fontMetrics().width(_imp->_sequenceName) + 100);
    setWindowTitle(_imp->_sequenceName);
    _imp->_mainLayout = new QVBoxLayout(this);
    setLayout(_imp->_mainLayout);
    _imp->_mainLayout->setContentsMargins(5, 5, 0, 0);
    _imp->_mainLayout->setSpacing(5);

    QWidget* totalProgressContainer = new QWidget(this);
    QHBoxLayout* totalProgressLayout = new QHBoxLayout(totalProgressContainer);
    _imp->_mainLayout->addWidget(totalProgressContainer);

    
    _imp->_totalProgressLabel = new Label(tr("Total progress:"),totalProgressContainer);
    totalProgressLayout->addWidget(_imp->_totalProgressLabel);
    
    _imp->_totalProgressInfo = new Label("0%",totalProgressContainer);
    totalProgressLayout->addWidget(_imp->_totalProgressInfo);
    
    QWidget* waitTimeContainer = new QWidget(this);
    QHBoxLayout* waitTimeLayout = new QHBoxLayout(waitTimeContainer);
    _imp->_mainLayout->addWidget(waitTimeContainer);

    _imp->_estimatedWaitTimeLabel = new Label(tr("Time remaining:"),waitTimeContainer);
    waitTimeLayout->addWidget(_imp->_estimatedWaitTimeLabel);
    
    _imp->_estimatedWaitTimeInfo = new Label("...",waitTimeContainer);
    waitTimeLayout->addWidget(_imp->_estimatedWaitTimeInfo);

    _imp->_totalProgressBar = new QProgressBar(this);
    _imp->_totalProgressBar->setRange(0, 100);
    _imp->_totalProgressBar->setMinimumWidth(150);
    
    _imp->_mainLayout->addWidget(_imp->_totalProgressBar);
    
    
    _imp->_cancelButton = new Button(tr("Cancel"),this);
    _imp->_cancelButton->setMaximumWidth(50);
    _imp->_mainLayout->addWidget(_imp->_cancelButton);

    QObject::connect( _imp->_cancelButton, SIGNAL(clicked()), this, SLOT(onCancelButtonClicked()) );


    if (process) {
        QObject::connect( this,SIGNAL(canceled()),process.get(),SLOT(onProcessCanceled()) );
        QObject::connect( process.get(),SIGNAL(processCanceled()),this,SLOT(onProcessCanceled()) );
        QObject::connect( process.get(),SIGNAL(frameRendered(int,double)),this,SLOT(onFrameRendered(int,double)) );
        QObject::connect( process.get(),SIGNAL(processFinished(int)),this,SLOT(onProcessFinished(int)) );
        QObject::connect( process.get(),SIGNAL(deleted()),this,SLOT(onProcessDeleted()) );
    }
}
void ParameterDialog::setupConnection()
{
  connect(this->m_ok_button, SIGNAL(clicked()), this, SLOT(onOkButtonClicked()));
  connect(this->m_cancel_button, SIGNAL(clicked()), this, SLOT(onCancelButtonClicked()));
  connect(this->m_select_all_the_left_nodes, SIGNAL(stateChanged(int)), this, SLOT(onCheckBoxStateChanged(int)));
}
    UserRegistrationDialogPrivate::UserRegistrationDialogPrivate(UserRegistrationDialog * dialog)
        : QObject(dialog), dialog(dialog), avatarChanged(false)
    {
        emailConfirmNoticeTemplate = QString(
            "You will shortly receive a confirmation email to the address you just "
            "registered (%1). Before you can log in to Utopia Documents for the first "
            "time, you must follow the instructions in that email to active your "
            "account."
        );

        dialog->setFixedWidth(500);

        QVBoxLayout * dialogLayout = new QVBoxLayout(dialog);
        dialogLayout->setSpacing(0);
        dialogLayout->setContentsMargins(0, 0, 0, 0);

        gridLayout = new QGridLayout;
        gridLayout->setSpacing(8);
        gridLayout->setContentsMargins(12, 12, 12, 0);
        dialogLayout->addLayout(gridLayout);

        QLabel * stepLabel = verticalLabel("Step 1", dialog);
        gridLayout->addWidget(stepLabel, 0, 0, 9, 1, Qt::AlignLeft);
        QLabel * msgLabel = new QLabel;
        msgLabel->setText(
            "Please provide some personal information about yourself here. You can also "
            "choose a profile picture for your account. This information will be visible "
            "to other users."
        );
        msgLabel->setWordWrap(true);
        gridLayout->addWidget(msgLabel, 1, 1, 1, 4);

        // Title
        QLabel * titleLabel = new QLabel("Title:");
        gridLayout->addWidget(titleLabel, 2, 1, Qt::AlignRight);
        title = new QComboBox;
        title->setEditable(true);
        gridLayout->addWidget(title, 2, 2);

        // Forename
        QLabel * forenameLabel = new QLabel("Forename:");
        gridLayout->addWidget(forenameLabel, 3, 1, Qt::AlignRight);
        forename = new QLineEdit;
        gridLayout->addWidget(forename, 3, 2);

        // Surname
        QLabel * surnameLabel = new QLabel("Surname:");
        gridLayout->addWidget(surnameLabel, 4, 1, Qt::AlignRight);
        surname = new QLineEdit;
        gridLayout->addWidget(surname, 4, 2);

        // Institution
        QLabel * institutionLabel = new QLabel("Institution:");
        gridLayout->addWidget(institutionLabel, 5, 1, Qt::AlignRight);
        institution = new QLineEdit;
        gridLayout->addWidget(institution, 5, 2);

        QFrame * avatarFrame = new QFrame;
        avatarFrame->setObjectName("avatarFrame");
        avatarFrame->setFixedSize(128, 128);
        QVBoxLayout * avatarFrameLayout = new QVBoxLayout(avatarFrame);
        avatarFrameLayout->setContentsMargins(1, 1, 1, 1);
        avatar = new QLabel;
        avatar->setScaledContents(true);
        avatar->installEventFilter(this);
        avatar->setCursor(Qt::PointingHandCursor);
        avatar->setToolTip("Choose picture...");
        avatarFrameLayout->addWidget(avatar);
        gridLayout->addWidget(avatarFrame, 2, 3, 5, 2, Qt::AlignTop | Qt::AlignHCenter);

        QPushButton * avatarButton = new QPushButton("Choose picture...");
        connect(avatarButton, SIGNAL(clicked()), this, SLOT(pickAvatar()));
        gridLayout->addWidget(avatarButton, 7, 1, 1, 4, Qt::AlignTop | Qt::AlignRight);

        /////////////////////////////////////////////////////////////////////////////////
        // Email address

        // Email
        stepLabel = verticalLabel("Step 2", dialog);
        gridLayout->addWidget(stepLabel, 9, 0, 4, 1, Qt::AlignLeft);
        emailDisclaimer = new QLabel(
            "You will use your email address to log in to Utopia. You will need to "
            "confirm your email address before you can use your account; instructions "
            "will be emailed to this address."
            );
        emailDisclaimer->setWordWrap(true);
        gridLayout->addWidget(emailDisclaimer, 10, 1, 1, 4);

        QLabel * emailLabel = new QLabel("Email address:");
        gridLayout->addWidget(emailLabel, 11, 1, Qt::AlignRight);
        email = new QLineEdit;
        gridLayout->addWidget(email, 11, 2, 1, 2);
        emailErrorIcon = new QLabel;
        emailErrorIcon->setFixedSize(20, 20);
        gridLayout->addWidget(emailErrorIcon, 11, 4, 1, 1, Qt::AlignCenter);

        emailErrorText = new QLabel;
        emailErrorText->setObjectName("errorLabel");
        emailErrorText->setWordWrap(true);
        emailErrorText->setAlignment(Qt::AlignLeft | Qt::AlignVCenter);
        connect(emailErrorText, SIGNAL(linkActivated(const QString &)), this, SLOT(onLinkActivated(const QString &)));
        emailErrorText->hide();
        gridLayout->addWidget(emailErrorText, 12, 2, 1, 2);

        stepLabel = verticalLabel("Step 3", dialog);
        gridLayout->addWidget(stepLabel, 13, 0, 5, 1, Qt::AlignLeft);
        passwordDisclaimer = new QLabel(
            "Please choose (and confirm) a password for your new account. A combination "
            "of letters, numbers and other characters that is not easy to guess will be "
            "more secure."
            );
        passwordDisclaimer->setWordWrap(true);
        gridLayout->addWidget(passwordDisclaimer, 14, 1, 1, 4);

        // Password 1
        QLabel * newPassword1Label = new QLabel("Password:"******"Retype password:"******"errorLabel");
        newPasswordErrorText->setAlignment(Qt::AlignLeft | Qt::AlignVCenter);
        newPasswordErrorText->hide();
        gridLayout->addWidget(newPasswordErrorText, 17, 2, 1, 2);

        /////////////////////////////////////////////////////////////////////////////////
        // Control buttons
        QHBoxLayout * buttonLayout = new QHBoxLayout;
        buttonLayout->setContentsMargins(12, 12, 12, 12);
        buttonLayout->setSpacing(8);
        QPushButton * okButton = new QPushButton("Register");
        okButton->setDefault(true);
        connect(okButton, SIGNAL(clicked()), this, SLOT(onOkButtonClicked()));
        QPushButton * cancelButton = new QPushButton("Cancel");
        cancelButton->setDefault(false);
        connect(cancelButton, SIGNAL(clicked()), this, SLOT(onCancelButtonClicked()));
        spinner = new Utopia::Spinner;
        spinner->setFixedSize(18, 18);
        buttonLayout->addWidget(cancelButton, 0);
        buttonLayout->addStretch(1);
        buttonLayout->addWidget(spinner, 0);
        buttonLayout->addWidget(okButton, 0);
        dialogLayout->addStretch(1);
        dialogLayout->addLayout(buttonLayout, 0);

        // Layout
        gridLayout->setColumnStretch(0, 0);
        gridLayout->setColumnStretch(1, 0);
        gridLayout->setColumnStretch(2, 100);
        gridLayout->setColumnStretch(3, 1);
        gridLayout->setColumnStretch(4, 0);

        gridLayout->setColumnMinimumWidth(0, stepLabel->minimumWidth() + 10);

        gridLayout->setRowStretch(6, 1);

        dialog->setFixedHeight(dialog->heightForWidth(500));
        dialog->setSizeGripEnabled(false);
    }
Exemple #15
0
Dialog::Dialog(QWidget *parent) :
    QWidget(parent),
    loading(false),
    ui(new Ui::Dialog)
{
    ui->setupUi(this);

    foreach (QextPortInfo info, QextSerialEnumerator::getPorts())
        if (!info.portName.isEmpty())
            ui->portBox->addItem(info.portName);
    //make sure user can input their own port name!
    ui->portBox->setEditable(true);

//    ui->led->turnOff();

    PortSettings settings = {BAUD9600, DATA_8, PAR_NONE, STOP_1, FLOW_OFF, 10};
    port = new QextSerialPort(ui->portBox->currentText(), settings, QextSerialPort::Polling);

    enumerator = new QextSerialEnumerator(this);
    enumerator->setUpNotifications();

    ui->boardComboBox->addItem("PX4FMU v1.6+", 5);
    ui->boardComboBox->addItem("PX4FLOW v1.1+", 6);
    ui->boardComboBox->addItem("PX4IO v1.3+", 7);
    ui->boardComboBox->addItem("PX4 board #8", 8);
    ui->boardComboBox->addItem("PX4 board #9", 9);
    ui->boardComboBox->addItem("PX4 board #10", 10);
    ui->boardComboBox->addItem("PX4 board #11", 11);

    connect(ui->portBox, SIGNAL(editTextChanged(QString)), SLOT(onPortNameChanged(QString)));
    connect(ui->flashButton, SIGNAL(clicked()), SLOT(onUploadButtonClicked()));
    connect(ui->selectFileButton, SIGNAL(clicked()), SLOT(onFileSelectRequested()));
    connect(ui->cancelButton, SIGNAL(clicked()), SLOT(onCancelButtonClicked()));

    // disable JavaScript for Windows for faster startup
#ifdef Q_OS_WIN
    QWebSettings *webViewSettings = ui->webView->settings();
    webViewSettings->setAttribute(QWebSettings::JavascriptEnabled, false);
#endif

    connect(ui->webView->page(), SIGNAL(downloadRequested(const QNetworkRequest&)), this, SLOT(onDownloadRequested(const QNetworkRequest&)));
    ui->webView->page()->setLinkDelegationPolicy(QWebPage::DelegateAllLinks);

    connect(ui->webView->page(), SIGNAL(linkClicked(const QUrl&)), this, SLOT(onLinkClicked(const QUrl&)));

    connect(ui->prevButton, SIGNAL(clicked()), ui->webView, SLOT(back()));
    connect(ui->homeButton, SIGNAL(clicked()), this, SLOT(onHomeRequested()));

    connect(ui->advancedCheckBox, SIGNAL(clicked(bool)), this, SLOT(onToggleAdvancedMode(bool)));

    connect(enumerator, SIGNAL(deviceDiscovered(QextPortInfo)), SLOT(onPortAddedOrRemoved()));
    connect(enumerator, SIGNAL(deviceRemoved(QextPortInfo)), SLOT(onPortAddedOrRemoved()));

    setWindowTitle(tr("QUpgrade Firmware Upload / Configuration Tool"));

    // Adjust the size
    const int screenHeight = qMin(1000, QApplication::desktop()->height() - 100);

    resize(700, qMax(screenHeight, 550));

    // about:blank shouldn't be part of the history
    ui->webView->history()->clear();
    onHomeRequested();

    // load settings
    loadSettings();

    // Set up initial state
    if (!lastFilename.isEmpty()) {
        ui->flashButton->setEnabled(true);
    } else {
        ui->flashButton->setEnabled(false);
    }
}