/* Checks the position of every point of the vertex, if any of them are outside of the window and still heading there changes their direction momentOfInertia = mass * r^2 */ void Convex::borderCollision(sf::RenderWindow* window) { float impulse; float Px, Py; for (int i = 0; i < getPointCount(); i++) { if (getPoint(i).x < 0 && _velocity.x < 0) { sf::Vector2f collisionNormal(1, 0); applyChanges(i, &collisionNormal); } if (getPoint(i).x > window->getSize().x && _velocity.x > 0) { sf::Vector2f collisionNormal(-1, 0); applyChanges(i, &collisionNormal); } if (getPoint(i).y < 0 && _velocity.y < 0) { sf::Vector2f collisionNormal(0, 1); applyChanges(i, &collisionNormal); } if (getPoint(i).y > window->getSize().y && _velocity.y > 0) { sf::Vector2f collisionNormal(0, -1); applyChanges(i, &collisionNormal); } _momentOfInertia = _mass; } }
void SettingsPageDlg::buttonClicked(QAbstractButton *button) { switch (ui.buttonBox->standardButton(button)) { case QDialogButtonBox::Ok: if (currentPage() && currentPage()->hasChanged()) { if (applyChanges()) accept(); } else accept(); break; case QDialogButtonBox::Apply: applyChanges(); break; case QDialogButtonBox::Cancel: undoChanges(); reject(); break; case QDialogButtonBox::Reset: reload(); break; case QDialogButtonBox::RestoreDefaults: loadDefaults(); break; default: break; } }
MapPropertiesDialog::MapPropertiesDialog(Processor *processor, QWidget *parent) : QDialog(parent) { this->processor = processor; this->optionsLayout = new OptionsLayout(this); this->geometryPropetries = new QWidget(this); this->geometryPropetriesLayout = new QGridLayout(this->geometryPropetries); this->geometryPropetriesLayout->setAlignment(Qt::AlignTop); this->horizontalSquareSpinBox = new QSpinBox(this->geometryPropetries); this->horizontalSquareSpinBox->setRange(PIDGIRL::MIN_HORIZONTAL_SQUARE_COUNT, PIDGIRL::MAX_HORIZONTAL_SQUARE_COUNT); this->horizontalSquareSideComboBox = new QComboBox(this->geometryPropetries); this->horizontalSquareSideComboBox->addItem(tr("Left")); this->horizontalSquareSideComboBox->addItem(tr("Right")); this->verticalSquareSpinBox = new QSpinBox(this->geometryPropetries); this->verticalSquareSpinBox->setRange(PIDGIRL::MIN_VERTICAL_SQUARE_COUNT, PIDGIRL::MAX_VERTICAL_SQUARE_COUNT); this->verticalSquareSideComboBox = new QComboBox(this->geometryPropetries); this->verticalSquareSideComboBox->addItem(tr("Up")); this->verticalSquareSideComboBox->addItem(tr("Down")); this->maxHeightSpinBox = new QSpinBox(this->geometryPropetries); this->maxHeightSpinBox->setRange(PIDGIRL::MIN_HEIGHT, PIDGIRL::MAX_HEIGHT); this->maxHeightComboBox = new QComboBox(this->geometryPropetries); this->maxHeightComboBox->addItem(tr("Top")); this->maxHeightComboBox->addItem(tr("Bottom")); // Buttons connect(this->optionsLayout->refOkButton(), SIGNAL(clicked()), this, SLOT(applyChanges())); connect(this->optionsLayout->refOkButton(),SIGNAL(clicked()), this, SLOT(close())); connect(this->optionsLayout->refApplyButton(), SIGNAL(clicked()), this, SLOT(applyChanges())); // Properties this->geometryPropetries->setLayout(this->geometryPropetriesLayout); this->geometryPropetriesLayout->addWidget(new QLabel(tr("Horizontal Square Count: ")), 0,0); this->geometryPropetriesLayout->addWidget(this->horizontalSquareSpinBox, 0, 1); this->geometryPropetriesLayout->addWidget(this->horizontalSquareSideComboBox, 0, 2); this->geometryPropetriesLayout->addWidget(new QLabel(tr("Vertical Square Count: ")), 1,0); this->geometryPropetriesLayout->addWidget(this->verticalSquareSpinBox, 1, 1); this->geometryPropetriesLayout->addWidget(this->verticalSquareSideComboBox, 1, 2); this->geometryPropetriesLayout->addWidget(new QLabel(tr("Max Height: ")), 2,0); this->geometryPropetriesLayout->addWidget(this->maxHeightSpinBox, 2, 1); this->geometryPropetriesLayout->addWidget(this->maxHeightComboBox, 2, 2); this->geometryPropetriesLayout->addWidget(this->optionsLayout->refOkButton(), this->geometryPropetriesLayout->rowCount(), 1); this->geometryPropetriesLayout->addWidget(this->optionsLayout->refApplyButton(), this->geometryPropetriesLayout->rowCount()-1, 2); this->optionsLayout->addPropertyWidget(tr("Geometry"), this->geometryPropetries); // Finish this->setLayout(this->optionsLayout); }
/* TextureXPanel::saveTEXTUREX * Saves a TEXTUREX format texture list *******************************************************************/ bool TextureXPanel::saveTEXTUREX() { // Save any changes to current texture applyChanges(); // Write list to entry, in the correct format tx_entry->unlock(); // Have to unlock the entry first bool ok = false; if (texturex.getFormat() == TXF_TEXTURES) ok = texturex.writeTEXTURESData(tx_entry); else ok = texturex.writeTEXTUREXData(tx_entry, tx_editor->patchTable()); // Redetect type and lock it up EntryType::detectEntryType(tx_entry); tx_entry->lock(); // Set all textures to unmodified for (unsigned a = 0; a < texturex.nTextures(); a++) texturex.getTexture(a)->setState(0); list_textures->updateList(); // Update variables modified = false; return ok; }
// If we ever find and fix the bug behind queueAppSignal we can re-enable // this. void EnabledProtocolsDialog::on_buttonBox_clicked(QAbstractButton *button) { if (button == ui->buttonBox->button(QDialogButtonBox::Apply)) { applyChanges(TRUE); } }
ConquirereSettingsDialog::ConquirereSettingsDialog(QWidget *parent) : KPageDialog(parent) { setupPages(); connect(this, SIGNAL(applyClicked()), this, SLOT(applyChanges())); }
int MainWindow::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QMainWindow::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: openFile(); break; case 1: applyChanges(); break; case 2: saveFile(); break; case 3: exit(); break; case 4: effects(); break; case 5: zoom(); break; case 6: resize(); break; case 7: crop(); break; case 8: rotateRight(); break; case 9: rotateLeft(); break; case 10: mirror(); break; case 11: reflection(); break; case 12: grayScale(); break; case 13: xray(); break; case 14: sepia(); break; default: ; } _id -= 15; } return _id; }
//----------------------------------------------------------------------------- // Function: save() //----------------------------------------------------------------------------- bool ApiDefinitionEditor::save() { applyChanges(); libHandler_->writeModelToFile(apiDef_); return TabDocument::save(); }
PreferencesDialog::PreferencesDialog(QWidget *parent) : QDialog(parent) , m_appFontChanged(false) , m_browserFontChanged(false) , helpEngine(HelpEngineWrapper::instance()) { TRACE_OBJ m_ui.setupUi(this); connect(m_ui.buttonBox->button(QDialogButtonBox::Ok), SIGNAL(clicked()), this, SLOT(applyChanges())); connect(m_ui.buttonBox->button(QDialogButtonBox::Cancel), SIGNAL(clicked()), this, SLOT(reject())); m_hideFiltersTab = !helpEngine.filterFunctionalityEnabled(); m_hideDocsTab = !helpEngine.documentationManagerEnabled(); if (!m_hideFiltersTab) { m_ui.attributeWidget->header()->hide(); m_ui.attributeWidget->setRootIsDecorated(false); connect(m_ui.attributeWidget, SIGNAL(itemChanged(QTreeWidgetItem*,int)), this, SLOT(updateFilterMap())); connect(m_ui.filterWidget, SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)), this, SLOT(updateAttributes(QListWidgetItem*))); connect(m_ui.filterAddButton, SIGNAL(clicked()), this, SLOT(addFilter())); connect(m_ui.filterRemoveButton, SIGNAL(clicked()), this, SLOT(removeFilter())); updateFilterPage(); } else {
void QgsMapToolChangeLabelProperties::canvasReleaseEvent( QgsMapMouseEvent* e ) { Q_UNUSED( e ); if ( mLabelRubberBand && mCurrentLabel.valid ) { QString labeltext = QString(); // NULL QString signifies no expression if ( mCurrentLabel.settings.isExpression ) { labeltext = mCurrentLabel.pos.labelText; } QgsLabelPropertyDialog d( mCurrentLabel.pos.layerID, mCurrentLabel.pos.providerID, mCurrentLabel.pos.featureId, mCurrentLabel.pos.labelFont, labeltext, nullptr ); connect( &d, SIGNAL( applied() ), this, SLOT( dialogPropertiesApplied() ) ); if ( d.exec() == QDialog::Accepted ) { applyChanges( d.changedProperties() ); } deleteRubberBands(); } }
int LshttpdMain::processAdminBuffer(char *p, char *pEnd) { while ((pEnd > p) && isspace(pEnd[-1])) --pEnd; if (pEnd - p < 14) return LS_FAIL; if (strncasecmp(pEnd - 14, "end of actions", 14) != 0) { LS_ERROR("[ADMIN] failed to read command, command buf len=%d", (int)(pEnd - p)); return LS_FAIL; } pEnd -= 14; int apply; char *pLineEnd; while (p < pEnd) { pLineEnd = (char *)memchr(p, '\n', pEnd - p); if (pLineEnd == NULL) pLineEnd = pEnd; char *pTemp = pLineEnd; while ((pLineEnd > p) && isspace(pLineEnd[-1])) --pLineEnd; *pLineEnd = 0; if (processAdminCmd(p, pLineEnd, apply)) break; p = pTemp + 1; } m_pBuilder->releaseConfigXmlTree(); if (s_iRunning > 0) m_pServer->generateStatusReport(); if (apply) applyChanges(); return 0; }
OptionsDialog::OptionsDialog(QWidget* parent) : QWidget(parent) { ui.setupUi(this); connect(ui.OKButton, SIGNAL(clicked()), this, SLOT(acceptChanges())); connect(ui.ApplyButton, SIGNAL(clicked()), this, SLOT(applyChanges())); connect(ui.CancelButton, SIGNAL(clicked()), this, SLOT(revertAndClose())); QSettings settings; mMusicDirectory = settings.value("General/MusicDirectory").toString(); mLyricsDirectory = settings.value("General/LyricsDirectory").toString(); mCoversDirectory = settings.value("General/CoversDirectory").toString(); mLoginAtStart = settings.value("Login/AutoLogin").toInt(); mUseKanji = settings.value("General/UseKanji").toInt(); if(settings.contains("General/OutputPlugin")) mOutputPlugin = settings.value("General/OutputPlugin").toString(); else mOutputPlugin = tr("Null Output"); ui.OutputPluginCombo->addItems(uApp->pluginManager()->pluginsList()); revertChanges(); };
void FloaterGridManager::apply() { if (mState == NORMAL) { applyChanges(); } else if ((mState == ADD_NEW) || (mState == ADD_COPY)) { if (createNewGrid()) { setState(NORMAL); //LLScrollListCtrl *grids = FloaterGridManager::getInstance()->getChild<LLScrollListCtrl>("grid_selector"); //grids->selectItemByLabel(childGetValue("gridnick")); } else { //LLScrollListCtrl *grids = self->getChild<LLScrollListCtrl>("grid_selector"); //grids->setCurrentByIndex(grids->getItemCount() - 1); return; } } else { llwarns << "Illegal state " << mState << '.' << llendl; return; } //gHippoGridManager->setCurrentGrid(mCurGrid); //gHippoGridManager->setDefaultGrid(mCurGrid); gHippoGridManager->saveFile(); LLPanelLogin::addServer(LLViewerLogin::getInstance()->getGridLabel()); }
//----------------------------------------------------------------------------- // Function: saveAs() //----------------------------------------------------------------------------- bool ApiDefinitionEditor::saveAs() { // Ask the user for a new VLNV and directory. VLNV vlnv; QString directory; if (!NewObjectDialog::saveAsDialog(parentWidget(), libHandler_, *apiDef_->getVlnv(), vlnv, directory)) { return false; } // Create a copy of the object and update its VLNV. apiDef_ = QSharedPointer<ApiDefinition>(new ApiDefinition(*apiDef_)); vlnv.setType(VLNV::APIDEFINITION); apiDef_->setVlnv(vlnv); // Apply changes to the copy. applyChanges(); if (libHandler_->writeModelToFile(directory, apiDef_)) { setDocumentName(vlnv.getName() + " (" + vlnv.getVersion() + ")"); return TabDocument::saveAs(); } else { return false; } }
void UserConfig::apply() { emit applyChanges(); if (m_contact) getContacts()->addContact(m_contact); Event e(EventSaveState); e.process(); }
void EnabledProtocolsDialog::on_buttonBox_accepted() { if (applyChanges()) { writeChanges(); wsApp->queueAppSignal(WiresharkApplication::PacketDissectionChanged); } }
void QgsMapToolChangeLabelProperties::dialogPropertiesApplied() { QgsLabelPropertyDialog* dlg = qobject_cast<QgsLabelPropertyDialog*>( sender() ); if ( !dlg ) return; applyChanges( dlg->changedProperties() ); }
/* MapObjectPropsPanel::onBtnApply * Called when the apply button is clicked *******************************************************************/ void MapObjectPropsPanel::onBtnApply(wxCommandEvent& e) { // Apply changes applyChanges(); // Refresh map view theMapEditor->forceRefresh(true); }
BattlingOptionsWindow::BattlingOptionsWindow() { setAttribute(Qt::WA_DeleteOnClose, true); QVBoxLayout *fl = new QVBoxLayout(this); QPushButton *apply; fl->addWidget(allowCRated = new QCheckBox(tr("Allow rated battles through regular challenges. (not recommended)"))); fl->addWidget(sameIp = new QCheckBox(tr("Don't allow rated battles between players with the same IP"))); fl->addLayout(new QSideBySide(new QLabel(tr("Number of battles between rated battles against the same IP")), diffIps = new QSpinBox(this))); fl->addSpacing(10); fl->addWidget(desc = new QLabel()); desc->setWordWrap(true); QHBoxLayout *hl = new QHBoxLayout(); hl->addWidget(percent = new QSpinBox()); hl->addWidget(hours = new QSpinBox()); hl->addWidget(max_decay = new QSpinBox()); hl->addWidget(periods = new QSpinBox()); hl->addWidget(months = new QSpinBox()); fl->addLayout(hl); fl->addWidget(processOnStartUp = new QCheckBox(tr("Process Ratings on Server Startup"))); percent->setSuffix(" %"); hours->setSuffix(" hours"); max_decay->setSuffix(" %"); periods->setSuffix(" periods"); months->setSuffix(" months"); connect(percent, SIGNAL(valueChanged(int)), SLOT(updateLabel())); connect(hours, SIGNAL(valueChanged(int)), SLOT(updateLabel())); connect(max_decay, SIGNAL(valueChanged(int)), SLOT(updateLabel())); connect(periods, SIGNAL(valueChanged(int)), SLOT(updateLabel())); connect(months, SIGNAL(valueChanged(int)), SLOT(updateLabel())); percent->setRange(1, 10); hours->setRange(1, 10000); max_decay->setRange(0, 100); periods->setRange(1, 1000); months->setRange(1, 240); percent->setValue(TierMachine::obj()->percent_per_period); hours->setValue(TierMachine::obj()->hours_per_period); max_decay->setValue(TierMachine::obj()->max_percent_decay); periods->setValue(TierMachine::obj()->max_saved_periods); months->setValue(TierMachine::obj()->alt_expiration); fl->addWidget(apply = new QPushButton(tr("&Apply"))); QSettings s("config", QSettings::IniFormat); sameIp->setChecked(s.value("battles_with_same_ip_unrated").toBool()); diffIps->setValue(s.value("rated_battles_memory_number").toInt()); allowCRated->setChecked(s.value("rated_battle_through_challenge").toBool()); processOnStartUp->setChecked(s.value("process_ratings_on_startup", true).toBool()); updateLabel(); connect(apply, SIGNAL(clicked()), SLOT(applyChanges())); }
void WidgetOptions::onButtonPressed(std::string text){ if(text == "apply"){ applyChanges(); game::getHomescreenWidget()->toMainMenu(); } else if(text == "cancel"){ game::getHomescreenWidget()->toMainMenu(); } }
void QDeclarativeChangeSet::apply(const QVector<Remove> &removals, const QVector<Insert> &insertions, const QVector<Change> &changes) { QVector<Remove> r = removals; QVector<Insert> i = insertions; QVector<Change> c = changes; applyRemovals(r, i); applyInsertions(i); applyChanges(c); }
void CLayerTypeDlg::OnBnClickedSave() { CFileDialog FileDialog(FALSE, "LT", "DEFAULT.LT", OFN_FILEMUSTEXIST | OFN_HIDEREADONLY, "Layertype Info File (*.LT)|*.LT|All Files (*.*)|*.*||", NULL); if (FileDialog.DoModal() != IDOK) return; applyChanges(); SaveLayerTypeInfo(pDoc, FileDialog.GetPathName()); }
void ofxLayout::loadOfmlFromFile(string ofmlFilename){ ofxXmlSettings xmlLayout; bool ofmlParsingSuccessful = xmlLayout.loadFile(ofmlFilename); if(ofmlParsingSuccessful){ populateXML(&xmlLayout); loadFromXmlLayout(&xmlLayout, &contextTreeRoot, TAG::BODY); } else{ ofLogError("ofxLayout::loadFromFile","Unable to parse OFML file "+ofmlFilename+"."); } applyChanges(); }
int DevPoller::remove(EventReactor *pHandler) { if (!pHandler) return LS_FAIL; int fd = pHandler->getfd(); if (!m_reactorIndex.get(fd)) return LS_OK; if (!appendChange(fd, POLLREMOVE)) m_reactorIndex.set(fd, NULL); applyChanges(); return LS_OK; }
void ofxLayout::loadOssFromFile(string ossFilename){ ofxJSONElement ossStylesheet; bool ossParsingSuccessful = ossStylesheet.open(ossFilename); if(ossParsingSuccessful){ populateJSON(&ossStylesheet); loadFromOss(&ossStylesheet, &contextTreeRoot.styles); applyChanges(); allocateBlurFbo(width, height); } else{ ofLogError("ofxLayout::loadFromFile","Unable to parse OSS file "+ossFilename+"."); } }
void SettingsDialog::on_buttonBox_clicked(QAbstractButton* button) { switch (ui->buttonBox->buttonRole(button)) { case QDialogButtonBox::ApplyRole: applyChanges(); break; case QDialogButtonBox::ResetRole: settings.clear(); reloadSettings(); break; default: break; } }
MapDialog::MapDialog(QWidget* parent) : QDialog(parent) { setWindowTitle(tr("New Map")); mMap = NULL; QGroupBox* groupBox = new QGroupBox("Map",this); QGridLayout* gridLayout = new QGridLayout(groupBox); QLabel* label; //Create the properties fields.. label = new QLabel(tr("Name:"), groupBox); label->setAlignment(Qt::AlignRight); mNameEdit = new QLineEdit(groupBox); gridLayout->addWidget(label, 0, 0); gridLayout->addWidget(mNameEdit, 0, 1); label = new QLabel(tr("FileName:"), groupBox); label->setAlignment(Qt::AlignRight); mFileEdit = new QLineEdit(groupBox); mFileEdit->setEnabled(false); //fileEdit->setValidator(new QValidator(fileEdit)); gridLayout->addWidget(label, 1, 0); gridLayout->addWidget(mFileEdit, 1, 1); label = new QLabel(tr("Description:"), groupBox); label->setAlignment(Qt::AlignRight); mDescEdit = new QTextEdit(groupBox); gridLayout->addWidget(label, 2, 0); gridLayout->addWidget(mDescEdit, 2, 1); // Create the buttons... mOkButton = new QPushButton(tr("OK"), this); QPushButton* cancelButton = new QPushButton(tr("Cancel"), this); QHBoxLayout* buttonLayout = new QHBoxLayout; mOkButton->setEnabled(false); buttonLayout->addStretch(1); buttonLayout->addWidget(mOkButton); buttonLayout->addWidget(cancelButton); buttonLayout->addStretch(1); connect(mOkButton, SIGNAL(clicked()), this, SLOT(applyChanges())); connect(cancelButton, SIGNAL(clicked()), this, SLOT(reject())); QVBoxLayout* mainLayout = new QVBoxLayout(this); mainLayout->addWidget(groupBox); mainLayout->addLayout(buttonLayout); connect(mNameEdit, SIGNAL(textChanged(const QString&)), this, SLOT(edited(const QString&))); }
ossimQtTopographicCorrectionDialogController::ossimQtTopographicCorrectionDialogController(ossimQtTopographicCorrectionDialog* dialog) :theDialog(dialog), theObject(NULL) { if(theDialog) { connect(theDialog->theCorrectionTypeComboBox, SIGNAL(activated (const QString&)), this, SLOT(typeActivated(const QString&))); connect(theDialog->theApplyButton, SIGNAL(clicked()), this, SLOT(applyChanges())); connect(theDialog->theImportParametersButton, SIGNAL(clicked()), this, SLOT(importParametersButtonClicked())); } }
void ConfigItem::show() { UserConfig *dlg = static_cast<UserConfig*>(listView()->topLevelWidget()); if (m_widget == NULL){ m_widget = getWidget(dlg); if (m_widget == NULL) return; dlg->wnd->addWidget(m_widget, id() ? id() : defId++); dlg->wnd->setMinimumSize(dlg->wnd->sizeHint()); QObject::connect(dlg, SIGNAL(applyChanges()), m_widget, SLOT(apply())); } dlg->showUpdate(m_bShowUpdate); dlg->wnd->raiseWidget(m_widget); }
void UatDialog::rejectChanges() { if (!uat_) return; if (uat_->changed) { gchar *err = NULL; uat_clear(uat_); if (!uat_load(uat_, &err)) { report_failure("Error while loading %s: %s", uat_->name, err); g_free(err); } applyChanges(); } }