void TimeDateModule::save() { if ( ui->isNtpEnabledCheckBox->isChecked() != m_timeDate->isNtpEnabled() ) m_timeDate->setNtp( ui->isNtpEnabledCheckBox->isChecked() ); // Only possible to modify date if ntp is disabled if ( ( m_isTimeEdited || m_isDateEdited ) && !ui->isNtpEnabledCheckBox->isChecked() ) { QDateTime time( ui->dateEdit->date(), ui->timeEdit->time() ); m_timeDate->setTime( time ); } if ( ui->isRtcLocalCheckBox->isChecked() != m_timeDate->isRtcInLocalTimeZone() ) m_timeDate->setLocalRtc( ui->isRtcLocalCheckBox->isChecked() ); if ( !m_timeZone.isEmpty() && QTimeZone( m_timeZone.toLatin1() ).isValid() ) { if ( m_timeZone != m_timeDate->timeZone() ) m_timeDate->setTimeZone( m_timeZone ); } m_isTimeEdited = false; m_isDateEdited = false; updateFields(); updateTimeFields(); }
EditableMarksBar::EditableMarksBar(QWidget *parent) : QFrame(parent) { QVBoxLayout *layout = new QVBoxLayout; layout->setMargin(0); layout->setSpacing(2); setLayout(layout); //Add MarksBar m_marksBar = new MarksBar; m_marksBar->setContentsMargins(5, 0, 6, 0); layout->addWidget(m_marksBar); //Customize it m_marksBar->setRange(0, 256, 2); QVector<int> &values = m_marksBar->values(); values.push_back(0); values.push_back(256); QVector<QColor> &colors = m_marksBar->colors(); colors.fill(Qt::black, 2); //MarksBar dominates values change notifications bool ret = connect(m_marksBar, SIGNAL(marksUpdated()), this, SLOT(updateFields())); ret = ret && connect(m_marksBar, SIGNAL(marksUpdated()), this, SIGNAL(paramsChanged())); //Add fields layout QHBoxLayout *hLayout = new QHBoxLayout; hLayout->setMargin(0); hLayout->setContentsMargins(4, 0, 5, 0); layout->addLayout(hLayout); m_fields[0] = new DVGui::IntLineEdit; hLayout->addWidget(m_fields[0]); ret = ret && connect(m_fields[0], SIGNAL(editingFinished()), this, SLOT(onFieldEdited())); hLayout->addStretch(1); m_fields[1] = new DVGui::IntLineEdit; hLayout->addWidget(m_fields[1]); ret = ret && connect(m_fields[1], SIGNAL(editingFinished()), this, SLOT(onFieldEdited())); updateFields(); }
void StocksDialog::slotDateSearch (QDateTime dt) { Bar record; db->getSearchBar(dt, record); if (record.getEmptyFlag()) return; updateFields(record); }
void StocksDialog::slotPrevRecord () { Bar record; db->getPrevBar(currentDate, record); if (record.getEmptyFlag()) return; updateFields(record); }
void StocksDialog::slotLastRecord () { Bar record; db->getLastBar(record); if (record.getEmptyFlag()) return; updateFields(record); }
void DataRange::readToEndChanged() { if (readToEnd()) { setCountFromEnd(false); } updateFields(None); }
void FuturesDialog::slotNextRecord () { Bar record; db->getNextBar(currentDate, record); if (record.getEmptyFlag()) return; updateFields(record); }
void FuturesDialog::slotFirstRecord () { Bar record; db->getFirstBar(record); if (record.getEmptyFlag()) return; updateFields(record); }
void TimeDateModule::load() { m_isTimeEdited = false; m_isDateEdited = false; m_timeZone = m_timeDate->timeZone(); updateFields(); updateTimeFields(); m_timeFieldsTimer->start( 1000 ); }
void GuiPreferences::deleteSource(void) { int curIndex = currentSourceIndex(); if (curIndex >= 0 && curIndex < MAX_SRCS) { m_sourceBtns.at(curIndex)->setEnabled(false); setSourceState(curIndex, false); setEntry(Settings::SRC_BUCKET_KEY, getSourceStatesSerialized()); sync(); updateFields(); } }
void KexiPasswordWidget::KexiPasswordWidgetPrivate::init() { ui.setupUi( q ); ui.errorMessage->setHidden(true); // Row 4: Username field if ( m_flags & KexiPasswordWidget::ShowUsernameLine ) { ui.userEdit->setFocus(); QObject::connect( ui.userEdit, SIGNAL(returnPressed()), ui.passEdit, SLOT(setFocus()) ); q->setFocusProxy(ui.userEdit); } else { ui.userNameLabel->hide(); ui.userEdit->hide(); ui.passEdit->setFocus(); q->setFocusProxy(ui.passEdit); } if (!(m_flags & KexiPasswordWidget::ShowAnonymousLoginCheckBox)) { ui.anonymousCheckBox->hide(); ui.anonymousLabel->hide(); } else { QObject::connect( ui.anonymousCheckBox, SIGNAL(stateChanged(int)), q, SLOT(updateFields()) ); } if (!(m_flags & KexiPasswordWidget::ShowDatabaseNameLine )) { q->showDatabaseName(false); } if (!(m_flags & KexiPasswordWidget::ShowDomainLine )) { ui.domainLabel->hide(); ui.domainEdit->hide(); } if (!(m_flags & KexiPasswordWidget::ShowKeepPassword)) { ui.keepCheckBox->hide(); ui.keepCheckBoxLabel->hide(); } updateFields(); QRect desktop = KGlobalSettings::desktopGeometry(q->topLevelWidget()); q->setMinimumWidth(qMin(1000, qMax(q->sizeHint().width(), desktop.width() / 4))); if ( ( m_flags & KexiPasswordWidget::ShowIcon ) ) { q->setPixmap(KIcon("dialog-password").pixmap(KIconLoader::SizeHuge)); } QObject::connect(ui.userEdit, SIGNAL(returnPressed()), q, SIGNAL(returnPressed())); QObject::connect(ui.domainEdit, SIGNAL(returnPressed()), q, SIGNAL(returnPressed())); QObject::connect(ui.passEdit, SIGNAL(returnPressed()), q, SIGNAL(returnPressed())); }
/* Update an existing resource in the database If "id" is not defined, this is the same as a create Also we tunnel delete here if the user clicked delete */ static void updatePost() { if (smatch(param("submit"), "Delete")) { removePost(); } else { if (updateFields("post", params())) { flash("inform", "Post Updated Successfully"); redirect("list"); } else { flash("error", "Cannot Update Post"); renderView("post/post-edit"); } } }
bool QgsAuxiliaryLayer::addAuxiliaryField( const QgsPropertyDefinition &definition ) { if ( ( definition.name().isEmpty() && definition.comment().isEmpty() ) || exists( definition ) ) return false; const QgsField af = createAuxiliaryField( definition ); const bool rc = addAttribute( af ); updateFields(); mLayer->updateFields(); if ( rc ) { int auxIndex = indexOfPropertyDefinition( definition ); int index = mLayer->fields().indexOf( nameFromProperty( definition, true ) ); if ( index >= 0 && auxIndex >= 0 ) { if ( isHiddenProperty( auxIndex ) ) { // update editor widget QgsEditorWidgetSetup setup = QgsEditorWidgetSetup( QStringLiteral( "Hidden" ), QVariantMap() ); setEditorWidgetSetup( auxIndex, setup ); // column is hidden QgsAttributeTableConfig attrCfg = mLayer->attributeTableConfig(); attrCfg.update( mLayer->fields() ); QVector<QgsAttributeTableConfig::ColumnConfig> columns = attrCfg.columns(); QVector<QgsAttributeTableConfig::ColumnConfig>::iterator it; for ( it = columns.begin(); it != columns.end(); ++it ) { if ( it->name.compare( mLayer->fields().field( index ).name() ) == 0 ) it->hidden = true; } attrCfg.setColumns( columns ); mLayer->setAttributeTableConfig( attrCfg ); } else if ( definition.standardTemplate() == QgsPropertyDefinition::ColorNoAlpha || definition.standardTemplate() == QgsPropertyDefinition::ColorWithAlpha ) { QgsEditorWidgetSetup setup = QgsEditorWidgetSetup( QStringLiteral( "Color" ), QVariantMap() ); setEditorWidgetSetup( auxIndex, setup ); } mLayer->setEditorWidgetSetup( index, editorWidgetSetup( auxIndex ) ); } } return rc; }
void KPasswordDialog::KPasswordDialogPrivate::init() { ui.setupUi(q); ui.buttonBox->setStandardButtons(QDialogButtonBox::Ok | QDialogButtonBox::Cancel); ui.errorMessage->setHidden(true); // Row 4: Username field if (m_flags & KPasswordDialog::ShowUsernameLine) { ui.userEdit->setFocus(); ui.credentialsGroup->setFocusProxy(ui.userEdit); QObject::connect(ui.userEdit, SIGNAL(returnPressed()), ui.passEdit, SLOT(setFocus())); } else { ui.userNameLabel->hide(); ui.userEdit->hide(); ui.domainLabel->hide(); ui.domainEdit->hide(); ui.passEdit->setFocus(); ui.credentialsGroup->setFocusProxy(ui.passEdit); } if (!(m_flags & KPasswordDialog::ShowAnonymousLoginCheckBox)) { ui.anonymousRadioButton->hide(); ui.usePasswordButton->hide(); } if (!(m_flags & KPasswordDialog::ShowDomainLine)) { ui.domainLabel->hide(); ui.domainEdit->hide(); } if (!(m_flags & KPasswordDialog::ShowKeepPassword)) { ui.keepCheckBox->hide(); } updateFields(); QIcon visibilityIcon = QIcon::fromTheme(QStringLiteral("visibility"), QIcon(QStringLiteral(":/icons/visibility.svg"))); toggleEchoModeAction = ui.passEdit->addAction(visibilityIcon, QLineEdit::TrailingPosition); toggleEchoModeAction->setVisible(false); toggleEchoModeAction->setToolTip(tr("Change the visibility of the password")); connect(toggleEchoModeAction, SIGNAL(triggered(bool)), q, SLOT(toggleEchoMode())); connect(ui.passEdit, SIGNAL(textChanged(QString)), q, SLOT(showToggleEchoModeAction(QString))); QRect desktop = QApplication::desktop()->screenGeometry(q->topLevelWidget()); q->setMinimumWidth(qMin(1000, qMax(q->sizeHint().width(), desktop.width() / 4))); QStyleOption option; option.initFrom(q); const int iconSize = q->style()->pixelMetric(QStyle::PM_MessageBoxIconSize, &option, q); q->setPixmap(QIcon::fromTheme(QStringLiteral("dialog-password")).pixmap(iconSize)); }
void TimeDateModule::timeZoneClicked() { TimeZoneDialog dialog( this ); QString region = m_timeZone.split( "/" ).value( 0 ); QString zone = m_timeZone.split( "/" ).value( 1 ); dialog.init( region, zone ); dialog.exec(); if ( dialog.currentLocation() != m_timeZone ) { m_timeZone = dialog.currentLocation(); updateFields(); updateTimeFields(); emit changed(); } }
void testApp :: update() { if( tileSaver.bGoTiling ) return; audio->update(); trigger.update( audio->getPosition() ); fieldConfig[ fieldConfigIndex ]->setAudioNorm( audio->getAveragePeakNorm() ); fieldConfig[ fieldConfigIndex ]->update(); fieldConfig[ fieldConfigIndex ]->copyChangesTo( fields, fieldsTotal ); updateFields(); ++frameCount; }
void KPasswordDialog::KPasswordDialogPrivate::init() { #pragma message("KF5 TODO: enable clear button in QLineEdits in UI file once available") ui.setupUi(q); ui.buttonBox->setStandardButtons(QDialogButtonBox::Ok | QDialogButtonBox::Cancel); ui.errorMessage->setHidden(true); // Row 4: Username field if ( m_flags & KPasswordDialog::ShowUsernameLine ) { ui.userEdit->setFocus(); QObject::connect( ui.userEdit, SIGNAL(returnPressed()), ui.passEdit, SLOT(setFocus()) ); } else { ui.userNameLabel->hide(); ui.userEdit->hide(); ui.domainLabel->hide(); ui.domainEdit->hide(); ui.passEdit->setFocus(); } if ( !( m_flags & KPasswordDialog::ShowAnonymousLoginCheckBox ) ) { ui.anonymousCheckBox->hide(); } else { QObject::connect( ui.anonymousCheckBox, SIGNAL(stateChanged(int)), q, SLOT(updateFields()) ); } if ( !( m_flags & KPasswordDialog::ShowDomainLine ) ) { ui.domainLabel->hide(); ui.domainEdit->hide(); } if ( !( m_flags & KPasswordDialog::ShowKeepPassword ) ) { ui.keepCheckBox->hide(); } updateFields(); QRect desktop = QApplication::desktop()->screenGeometry(q->topLevelWidget()); q->setMinimumWidth(qMin(1000, qMax(q->sizeHint().width(), desktop.width() / 4))); q->setPixmap(QIcon::fromTheme(QStringLiteral("dialog-password")).pixmap(128)); }
/** @author Alf Birger Rustad (RD IRE FRM) <*****@*****.**> Øystein Arneson (RD IRE FRM) <*****@*****.**>, Erik Bakken <*****@*****.**>, Andreas B. Lindblad <*****@*****.**> */ SettingsDialog::SettingsDialog(Main_crava *main_crava, QWidget *parent, bool forwardOn, bool estimationOn, StandardStrings *standard):QDialog(parent) { this->standard=standard; this->main_crava = main_crava; setupUi(this); setWindowTitle(QString("%1[*] - %2").arg(windowTitle()).arg(StandardStrings::cravaVersion())); QButtonGroup *headerButtonGroup = new QButtonGroup(inputOutputPage); headerButtonGroup->addButton(headerSeisWorksRadioButton); headerButtonGroup->addButton(headerIesxRadioButton); headerButtonGroup->addButton(headerSipRadioButton); headerButtonGroup->addButton(headerCharismaRadioButton); headerButtonGroup->addButton(headerUserDefinedRadioButton); on_headerUserDefinedRadioButton_toggled(false); on_vpVsUserDefinedRadioButton_toggled(!main_crava->vp_vs_ratioPointer->text(1).isEmpty()); forward=forwardOn; estimation=estimationOn; updateFields(); }
void DataRange::setReadToEnd(bool readToEnd) { _readToEnd->setChecked(readToEnd); updateFields(None); }
void SectionResizer::mutate(std::shared_ptr<PEFile> PE, std::map<std::string, std::string>& context) { LOG_EMPTY(); LOG_INFO("Starting mutation..."); identifyFieldsToUpdate(PE); unsigned long sectionAlignment = PE->getNTHeaders()->OptionalHeader.SectionAlignment; unsigned long fileAlignment = PE->getNTHeaders()->OptionalHeader.FileAlignment; unsigned long previousSectionVirtualEnd = 0; unsigned long previousSectionRawEnd = 0; size_t sectionsOverallRawSize = 0; for(std::string sectionName : PE->getSectionsOrder()) { std::shared_ptr<PESection> section = PE->getSections()[sectionName]; // align data size size_t dataSize = section->getDataSize(); size_t virtualPaddingSize = 0; if(section->isShrinked()) virtualPaddingSize = (dataSize % sectionAlignment) ? sectionAlignment - (dataSize % sectionAlignment) : 0; else virtualPaddingSize = (section->getVirtualSize() % sectionAlignment) ? sectionAlignment - (section->getVirtualSize() % sectionAlignment) : 0; size_t filePaddingSize = (dataSize % fileAlignment) ? fileAlignment - (dataSize % fileAlignment) : 0; section->getSectionHeader()->Misc.VirtualSize = (section->isShrinked()) ? dataSize : section->getVirtualSize(); section->getSectionHeader()->SizeOfRawData = dataSize + filePaddingSize; // align section RVA and file offset bool isFirst = (PE->getSectionsOrder().front() == sectionName); if(isFirst) { // first section will always start at default file offset and default RVA section->getSectionHeader()->VirtualAddress = m_firstSectionRVA; section->getSectionHeader()->PointerToRawData = m_firstSectionOffset; } else { // other sections will always start at the end of previous section's end section->getSectionHeader()->VirtualAddress = previousSectionVirtualEnd; section->getSectionHeader()->PointerToRawData = previousSectionRawEnd; } previousSectionVirtualEnd = section->getSectionHeader()->VirtualAddress + section->getVirtualSize() + virtualPaddingSize; if(section->getRawSize()) previousSectionRawEnd = section->getSectionHeader()->PointerToRawData + section->getRawSize(); else previousSectionRawEnd = m_firstFileSectionOffset; sectionsOverallRawSize += section->getRawSize(); updateFields(PE, section); } updateDataDirectory(PE); PE->getNTHeaders()->OptionalHeader.SizeOfImage = previousSectionVirtualEnd; PE->setFileSize(previousSectionRawEnd); LOG_INFO("Mutation success!"); }
void DataRange::unitsChanged() { updateFields(None); }
void DataRange::startChanged() { updateFields(Start); emit modified(); }
void DataRange::lastChanged() { updateFields(Last); emit modified(); }
void DataRange::rangeChanged() { updateFields(Range); emit modified(); }
void DataRange::setStart(qreal start, bool callUpdateFields) { _start->setText(QString::number(start, 'g', 12)); if (callUpdateFields) { updateFields(None); } }
void DataRange::setLast(qreal last, bool callUpdateFields) { _last->setText(QString::number(last, 'g', 12)); if (callUpdateFields) { updateFields(None); } }
void DataRange::setCountFromEnd(bool countFromEnd) { _countFromEnd->setChecked(countFromEnd); updateFields(None); }
FeatureClassDlg::FeatureClassDlg(QWidget* pParent) : QDialog(pParent) { // Classes QLabel* pClassLabel = new QLabel("Feature Classes:", this); QToolButton* pAddFeatureButton = new QToolButton(this); pAddFeatureButton->setAutoRaise(true); pAddFeatureButton->setIcon(QIcon(":/icons/New")); pAddFeatureButton->setToolTip("Add Feature"); QToolButton* pRemoveFeatureButton = new QToolButton(this); pRemoveFeatureButton->setAutoRaise(true); pRemoveFeatureButton->setIcon(QIcon(":/icons/Delete")); pRemoveFeatureButton->setToolTip("Remove Feature"); mpClassList = new QListWidget(this); mpClassList->setFixedWidth(150); mpClassList->setSelectionMode(QAbstractItemView::SingleSelection); mpClassList->setSortingEnabled(true); mpClassList->sortItems(Qt::AscendingOrder); // Fields QLabel* pFieldLabel = new QLabel("Fields:", this); QToolButton* pAddFieldButton = new QToolButton(this); pAddFieldButton->setAutoRaise(true); pAddFieldButton->setIcon(QIcon(":/icons/New")); pAddFieldButton->setToolTip("Add Field"); QToolButton* pRemoveFieldButton = new QToolButton(this); pRemoveFieldButton->setAutoRaise(true); pRemoveFieldButton->setIcon(QIcon(":/icons/Delete")); pRemoveFieldButton->setToolTip("Remove Field"); QStringList columnNames; columnNames.append("Name"); columnNames.append("Type"); columnNames.append("Default Value"); mpFieldTree = new QTreeWidget(this); mpFieldTree->setColumnCount(3); mpFieldTree->setHeaderLabels(columnNames); mpFieldTree->setSelectionMode(QAbstractItemView::SingleSelection); mpFieldTree->setRootIsDecorated(false); mpFieldTree->setAllColumnsShowFocus(true); mpFieldTree->setSortingEnabled(true); mpFieldTree->sortByColumn(0, Qt::AscendingOrder); mpFieldTree->setItemDelegateForColumn(0, new FieldNameDelegate(mpFieldTree)); mpFieldTree->setItemDelegateForColumn(1, new FieldTypeDelegate(mpFieldTree)); mpFieldTree->setItemDelegateForColumn(2, new FieldValueDelegate(mpFieldTree)); QHeaderView* pHeader = mpFieldTree->header(); if (pHeader != NULL) { pHeader->setDefaultAlignment(Qt::AlignLeft | Qt::AlignVCenter); pHeader->setStretchLastSection(false); pHeader->setSortIndicatorShown(true); } // Horizontal line QFrame* pLine = new QFrame(this); pLine->setFrameStyle(QFrame::HLine | QFrame::Sunken); // Dialog buttons QDialogButtonBox* pButtonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal, this); // Layout QHBoxLayout* pFeatureButtonLayout = new QHBoxLayout(); pFeatureButtonLayout->setMargin(0); pFeatureButtonLayout->setSpacing(0); pFeatureButtonLayout->addWidget(pClassLabel); pFeatureButtonLayout->addSpacing(10); pFeatureButtonLayout->addStretch(); pFeatureButtonLayout->addWidget(pAddFeatureButton); pFeatureButtonLayout->addWidget(pRemoveFeatureButton); QVBoxLayout* pFeatureClassLayout = new QVBoxLayout(); pFeatureClassLayout->setMargin(0); pFeatureClassLayout->setSpacing(2); pFeatureClassLayout->addLayout(pFeatureButtonLayout); pFeatureClassLayout->addWidget(mpClassList, 10); QHBoxLayout* pFieldButtonLayout = new QHBoxLayout(); pFieldButtonLayout->setMargin(0); pFieldButtonLayout->setSpacing(0); pFieldButtonLayout->addWidget(pFieldLabel); pFieldButtonLayout->addSpacing(10); pFieldButtonLayout->addStretch(); pFieldButtonLayout->addWidget(pAddFieldButton); pFieldButtonLayout->addWidget(pRemoveFieldButton); QVBoxLayout* pFieldLayout = new QVBoxLayout(); pFieldLayout->setMargin(0); pFieldLayout->setSpacing(2); pFieldLayout->addLayout(pFieldButtonLayout); pFieldLayout->addWidget(mpFieldTree, 10); QGridLayout* pLayout = new QGridLayout(this); pLayout->setMargin(10); pLayout->setSpacing(10); pLayout->addLayout(pFeatureClassLayout, 0, 0); pLayout->addLayout(pFieldLayout, 0, 1); pLayout->addWidget(pLine, 1, 0, 1, 2); pLayout->addWidget(pButtonBox, 2, 0, 1, 2); pLayout->setRowStretch(0, 10); pLayout->setColumnStretch(1, 10); // Initialization setWindowTitle("Feature Classes"); resize(550, 300); loadFromSettings(); updateFields(); // Connections VERIFYNR(connect(pAddFeatureButton, SIGNAL(clicked()), this, SLOT(addFeatureClass()))); VERIFYNR(connect(pRemoveFeatureButton, SIGNAL(clicked()), this, SLOT(removeFeatureClass()))); VERIFYNR(connect(mpClassList, SIGNAL(itemChanged(QListWidgetItem*)), this, SLOT(setFeatureClassData(QListWidgetItem*)))); VERIFYNR(connect(mpClassList, SIGNAL(itemSelectionChanged()), this, SLOT(updateFields()))); VERIFYNR(connect(pAddFieldButton, SIGNAL(clicked()), this, SLOT(addField()))); VERIFYNR(connect(pRemoveFieldButton, SIGNAL(clicked()), this, SLOT(removeField()))); VERIFYNR(connect(mpFieldTree, SIGNAL(itemChanged(QTreeWidgetItem*, int)), this, SLOT(setFieldData(QTreeWidgetItem*, int)))); VERIFYNR(connect(pButtonBox, SIGNAL(accepted()), this, SLOT(accept()))); VERIFYNR(connect(pButtonBox, SIGNAL(rejected()), this, SLOT(reject()))); }
void DataRange::setRange(qreal range, bool callUpdateFields) { _range->setText(QString::number(range)); if (callUpdateFields) { updateFields(None); } }