bool IdfExtensibleGroup::setFields(const std::vector<std::string>& values) { bool result = setFields(values,true); if (result) { m_impl->emitChangeSignals(); } return result; }
void Prefs::slotApplyPrefs () { if (mod_options.marker_color != options->marker_color) dataChanged = NVTrue; if (mod_options.coast_color != options->coast_color) dataChanged = NVTrue; if (mod_options.landmask_color != options->landmask_color) dataChanged = NVTrue; if (mod_options.highlight_color != options->highlight_color) dataChanged = NVTrue; if (mod_options.feature_color != options->feature_color) dataChanged = NVTrue; if (mod_options.feature_info_color != options->feature_info_color) dataChanged = NVTrue; if (mod_options.feature_poly_color != options->feature_poly_color) dataChanged = NVTrue; if (mod_options.rect_color != options->rect_color) dataChanged = NVTrue; // We don't need to set dataChanged on these since they cause no visible change // in the picture. if (sMessage->checkState () == Qt::Checked) { options->startup_message = NVTrue; } else { options->startup_message = NVFalse; } options->position_form = mod_options.position_form; options->zoom_percent = mod_options.zoom_percent; NV_FLOAT32 tmp_f; QString tmp = featureDiameter->text (); NV_INT32 status = sscanf (tmp.toAscii (), "%f", &tmp_f); if (status == 1) mod_options.feature_diameter = tmp_f; if (mod_options.feature_diameter != options->feature_diameter) dataChanged = NVTrue; mod_misc.feature_search_string = textSearch->text (); if (mod_misc.feature_search_string != misc->feature_search_string) dataChanged = NVTrue; setFields (); hide (); if (dataChanged) { *options = mod_options; *misc = mod_misc; emit dataChangedSignal (); } close (); }
void Prefs::slotHighlightColor () { QColor clr; clr = QColorDialog::getColor (mod_options.highlight_color, this, tr ("mosaicView Highlight Color"), QColorDialog::ShowAlphaChannel); if (clr.isValid ()) mod_options.highlight_color = clr; setFields (); }
void Prefs::slotBackgroundColor () { QColor clr; clr = QColorDialog::getColor (mod_options.background_color, this, tr ("areaCheck Background Color")); if (clr.isValid ()) mod_options.background_color = clr; setFields (); }
void Prefs::slotCoastColor () { QColor clr; clr = QColorDialog::getColor (mod_options.coast_color, this, tr ("areaCheck Coastline Color"), QColorDialog::ShowAlphaChannel); if (clr.isValid ()) mod_options.coast_color = clr; setFields (); }
void Prefs::slotFeaturePolyColor () { QColor clr; clr = QColorDialog::getColor (mod_options.feature_poly_color, this, tr ("mosaicView Feature Polygon Color"), QColorDialog::ShowAlphaChannel); if (clr.isValid ()) mod_options.feature_poly_color = clr; setFields (); }
void Prefs::slotLandmaskColor () { QColor clr; clr = QColorDialog::getColor (mod_options.landmask_color, this, tr ("mosaicView Land Mask Color"), QColorDialog::ShowAlphaChannel); if (clr.isValid ()) mod_options.landmask_color = clr; setFields (); }
> inline void setFields( State* state, int index, Key1&& key1, Type1&& value1, Key2&& key2, Type2&& value2, Pairs&&... rest ) { static_assert(sizeof...(Pairs) % 2 == 0, "Field parameters must appear in pairs"); setFields(state, index, std::forward<Key1>(key1), std::forward<Type1>(value1)); setFields( state, index, std::forward<Key2>(key2), std::forward<Type2>(value2), std::forward<Pairs>(rest)... ); }
void CameraTab::updateGui(CleanupParameters *params, CleanupParameters *oldParams) { blockSignals(true); setFields(params); blockSignals(false); if (params->m_lineProcessingMode != oldParams->m_lineProcessingMode || params->m_camera.getRes() != oldParams->m_camera.getRes() || params->m_camera.getSize() != oldParams->m_camera.getSize() || params->m_closestField != oldParams->m_closestField) { updateImageInfo(); } }
/** * Register the metatable for user type `T`. This function allows you to register methods * which are shared across all instances of this type. * * By default a garbage-collector hook and string representation function are added as meta methods. * Both can be overwritten. * * \tparam U User type struct or class * * \param state Lua state * \param methods Map of methods * \param meta_methods Map of meta methods */ template <typename U> static inline void registerUserType( State* state, const FieldVector& methods = FieldVector(), const FieldVector& meta_methods = FieldVector() ) { using T = internal::StripUserType<U>; // Setup an appropriate metatable name internal::new_user_type_metatable<T>(state); // Insert methods setFields(state, -1, { {"__index", methods}, {"__gc", &internal::destruct_user_type<T>}, {"__tostring", &internal::stringify_user_type<T>} }); // Insert meta methods setFields(state, -1, meta_methods); // Pop metatable off the stack lua_pop(state, -1); }
// static void LLPanelLogin::onSelectLoginEntry(LLUICtrl* ctrl, void* data) { if (sInstance) { LLComboBox* combo = sInstance->getChild<LLComboBox>("name_combo"); if (ctrl == combo) { LLSD selected_entry = combo->getSelectedValue(); if (!selected_entry.isUndefined()) { LLSavedLoginEntry entry(selected_entry); setFields(entry); } // This stops the automatic matching of the first name to a selected grid. LLViewerLogin::getInstance()->setNameEditted(true); } } }
void Prefs::slotRestoreDefaults () { void set_defaults (MISC *misc, OPTIONS *options, NV_BOOL restore); set_defaults (misc, options, NVTrue); mod_options = *options; setFields (); emit dataChangedSignal (NVTrue); close (); }
void VcsBaseSubmitEditor::createUserFields(const QString &fieldConfigFile) { FileReader reader; if (!reader.fetch(fieldConfigFile, QIODevice::Text, Core::ICore::mainWindow())) return; // Parse into fields const QStringList fields = fieldTexts(QString::fromUtf8(reader.data())); if (fields.empty()) return; // Create a completer on user names const QStandardItemModel *nickNameModel = VcsPlugin::instance()->nickNameModel(); auto completer = new QCompleter(NickNameDialog::nickNameList(nickNameModel), this); auto fieldWidget = new SubmitFieldWidget; connect(fieldWidget, &SubmitFieldWidget::browseButtonClicked, this, &VcsBaseSubmitEditor::slotSetFieldNickName); fieldWidget->setCompleter(completer); fieldWidget->setAllowDuplicateFields(true); fieldWidget->setHasBrowseButton(true); fieldWidget->setFields(fields); d->m_widget->addSubmitFieldWidget(fieldWidget); }
void ossimNmeaMessage::parseMessage(std::istream& in)throw(ossimException) { ossim::skipws(in); m_validCheckSum = false; m_message = ""; if(!isValidStartChar(static_cast<char>(in.peek()))) { throw ossimException(ossimString("Starting NMEA messsage indicator not found, expected one of ") + m_startChars + " but found " + ossimString((char)in.peek())); } char c = static_cast<char>(in.get()); while(((c!='\n')&&(c!='\r'))&& !in.eof()&&!in.bad()) { m_message += c; c = static_cast<char>(in.get()); } std::string::iterator iter = std::find(m_message.begin(), m_message.end(), '*'); if(iter != m_message.end()) { setFields(m_message.begin()+1, m_message.end()); ossim_uint32 check = checksum(m_message.begin()+1, iter); std::ostringstream out; out << std::setw(2) << std::setfill('0') << std::hex << check; std::string::iterator endChecksumIter = iter+1; while((endChecksumIter!= m_message.end())&&(*endChecksumIter!=',')) ++endChecksumIter; if(out.str() == ossimString(iter+1, endChecksumIter).downcase()) { m_validCheckSum = true; } } else { throw ossimException("Terminating * indicator for cbecksum not found in NMEA message format"); } }
void ArchivingRulesDialog::executeArchiving() { if(_changed) { QMessageBox::StandardButton answer; answer = QMessageBox::question(this, tr("O banco de dados deve ser atulalizado antes da execução"), tr("Deseja salvar as regras de arquivamento?"), QMessageBox::Yes | QMessageBox::Cancel, QMessageBox::Cancel); if(answer == QMessageBox::Cancel) return; // Save the archiving roles std::vector<struct wsArchivingRule> rules = getFields(); _manager->saveArchivingRules(rules); // Update the table with the generated IDS for each archiving role in database std::vector<struct wsArchivingRule> archivingRules; _manager->getArchivingRules(archivingRules); setFields(archivingRules); saveBtn->setDisabled(true); _changed = false; } QList<QTableWidgetItem*> selectedItems = archivingItemsTbl->selectedItems(); QStringList arguments; arguments.push_back(_configFileName); QTableWidgetItem* item; if (selectedItems.size() > 0) { for(int i=0; i<selectedItems.size(); i++) { item = selectedItems.at(i); if(item->column() != 0) continue; arguments.push_back(item->data(Qt::UserRole).toString()); } } else { QMessageBox::warning(this, tr("Resultado"), tr("Nenhuma regra de arquivamento está selecionada!\nO arquivamento não foi realizado!"), QMessageBox::Ok); return; } enableButtons(false); QString archivingProgramPath = QCoreApplication::applicationDirPath() + "/arquivador"; #ifdef WIN32 archivingProgramPath.append(".exe"); #endif // Check if the "arquivador" program is at correct folder and it can be executed if(!QFile::exists(archivingProgramPath)) { enableButtons(true); QMessageBox::warning(this, tr("Resultado"), tr("O arquivamento não foi realizado!\n Programa \"arquivador\" não foi encontrado."), QMessageBox::Ok); return; } _process.start(archivingProgramPath, arguments); }
int ex5_17(int argc, char *argv[]){ //this function adds ability to sort by field e.g Line: FIELD1 FIELD2 FIELD 3 //have a second pointer array to point to field set, this is set after lines read in int numeric = 0; reversed = 0; fold = 0; directory = 0; field = 0; char *fieldPointer; int startingField; int endingField; //go through argv and pick out flags and set accordingly if(argc > 1){ if(strcmp(argv[1], "-n") == 0){ numeric = 1; } else if(strcmp(argv[1], "-r") == 0){ reversed = 1; } else if(strcmp(argv[1], "-f") == 0){ fold = 1; } else if(strcmp(argv[1], "-d") == 0){ directory = 1; } else if(strncmp(argv[1], "-l", 2) == 0){ field = 1; fieldPointer = argv[1]+2; } } if (argc > 2){ if(strcmp(argv[2], "-n") == 0){ numeric = 1; } else if(strcmp(argv[2], "-r") == 0){ reversed = 1; } else if(strcmp(argv[2], "-f") == 0){ fold = 1; } else if(strcmp(argv[2], "-d") == 0){ directory = 1; } else if(strncmp(argv[2], "-l", 2) == 0){ field = 1; fieldPointer = argv[2]+2; } } if (argc > 3){ if(strcmp(argv[3], "-n") == 0){ numeric = 1; } else if(strcmp(argv[3], "-r") == 0){ reversed = 1; } else if(strcmp(argv[3], "-f") == 0){ fold = 1; } else if(strcmp(argv[3], "-d") == 0){ directory = 1; } else if(strncmp(argv[3], "-l",2) == 0){ field = 1; fieldPointer = argv[3]+2; } } if (argc > 4){ if(strcmp(argv[4], "-n") == 0){ numeric = 1; } else if(strcmp(argv[4], "-r") == 0){ reversed = 1; } else if(strcmp(argv[4], "-f") == 0){ fold = 1; } else if(strcmp(argv[4], "-d") == 0){ directory = 1; } else if(strncmp(argv[4], "-l", 2) == 0){ field = 1; fieldPointer = argv[4]+2; } } if (argc > 5){ if(strcmp(argv[5], "-n") == 0){ numeric = 1; } else if(strcmp(argv[5], "-r") == 0){ reversed = 1; } else if(strcmp(argv[5], "-f") == 0){ fold = 1; } else if(strcmp(argv[5], "-d") == 0){ directory = 1; } else if(strncmp(argv[5], "-l", 2) == 0){ field = 1; fieldPointer = argv[5]+2; } } if(field){ field = atoi(fieldPointer); printf("\nField is set to: %d\n", field); } printf("\nSetup: Directory: %d, Numeric: %d, Fold:%d, Reverse: %d\n", directory, numeric, fold, reversed); if((nlines = readlinesch5(linePointerch5_11, MAXLINESCH5_11)) >= 0){ //use function tp set start & end values startingField = 0; endingField = nlines-1; if(field > 0){ printf("GOt here.."); setFields(&startingField, &endingField); printf("\nStart is now: %d, End is now: %d\n", startingField, endingField); startingField = startOfPointers[0]; } printf("\nPrinting before qsort:\n"); writelinesch5(linePointerch5_11, nlines); printf("\n"); qsortch5_11((void **) linePointerch5_11, 0, nlines-1, (intptr_t (*)(void *, void *))((numeric) ? (intptr_t) numcmpch5 : (intptr_t) strcmpch5r)); //function passing printf("\nPrinting after qsort:\n"); writelinesch5(linePointerch5_11, nlines); printf("\n"); return 0; } else{ printf("\nerror: input too big to sort.\n"); return 1; } return 0; }
ProjectionScan::ProjectionScan(storage::field_list_t *fields): _PlanOperation() { setFields(fields); }
void XDataWidget::setForm(const XMPP::XData& d) { setInstructions(d.instructions()); setFields(d.fields()); }
pfmPage::pfmPage (QWidget *parent, PFM_DEFINITION *pfmDef, PFM_GLOBAL *pfmg, NV_INT32 page_num): QWizardPage (parent) { setPixmap (QWizard::WatermarkPixmap, QPixmap(":/icons/pfmLoadMWatermark.png")); pfm_def = pfmDef; pfm_global = pfmg; pfm_def->existing = NVFalse; l_page_num = page_num; pfmIndex.sprintf ("%02d", page_num - 1); prev_mbin = pfm_def->mbin_size; prev_gbin = pfm_def->gbin_size; QString title; title = tr ("PFM ") + pfmIndex + tr (" Options"); setTitle (title); QVBoxLayout *pageLayout = new QVBoxLayout (this); pageLayout->setMargin (5); pageLayout->setSpacing (5); QHBoxLayout *pfm_file_box = new QHBoxLayout; pfm_file_box->setSpacing (5); pageLayout->addLayout (pfm_file_box); QString pfl = tr ("PFM file ") + pfmIndex; pfm_file_label = new QLabel (pfl, this); pfm_file_box->addWidget (pfm_file_label, 1); pfm_file_edit = new QLineEdit (this); pfm_file_edit->setToolTip (tr ("Set the PFM file name manually")); connect (pfm_file_edit, SIGNAL (textChanged (const QString &)), this, SLOT (slotPFMFileEdit (const QString &))); pfm_file_box->addWidget (pfm_file_edit, 10); pfm_file_browse = new QPushButton (tr ("Browse..."), this); pfm_file_browse->setToolTip (tr ("Select a preexisting PFM file to append to or create file in new directory")); pfm_file_label->setWhatsThis (pfm_fileText); pfm_file_edit->setWhatsThis (pfm_fileText); pfm_file_browse->setWhatsThis (pfm_fileBrowseText); connect (pfm_file_browse, SIGNAL (clicked ()), this, SLOT (slotPFMFileBrowse ())); pfm_file_box->addWidget (pfm_file_browse, 1); QGroupBox *limBox = new QGroupBox (tr ("Limits"), this); QHBoxLayout *limBoxLayout = new QHBoxLayout; limBox->setLayout (limBoxLayout); limBoxLayout->setSpacing (10); QGroupBox *mBinsBox = new QGroupBox (tr ("Bin size (meters)"), this); QHBoxLayout *mBinsBoxLayout = new QHBoxLayout; mBinsBox->setLayout (mBinsBoxLayout); mBinsBoxLayout->setSpacing (10); mBinSize = new QDoubleSpinBox (this); mBinSize->setDecimals (2); mBinSize->setRange (0.0, 1000.0); mBinSize->setSingleStep (1.0); mBinSize->setValue (pfm_def->mbin_size); mBinSize->setWrapping (TRUE); mBinSize->setToolTip (tr ("Set the PFM bin size in meters")); mBinSize->setWhatsThis (mBinSizeText); connect (mBinSize, SIGNAL (valueChanged (double)), this, SLOT (slotMBinSizeChanged (double))); mBinsBoxLayout->addWidget (mBinSize); limBoxLayout->addWidget (mBinsBox); QGroupBox *gBinsBox = new QGroupBox (tr ("Bin size (minutes)"), this); QHBoxLayout *gBinsBoxLayout = new QHBoxLayout; gBinsBox->setLayout (gBinsBoxLayout); gBinsBoxLayout->setSpacing (10); gBinSize = new QDoubleSpinBox (this); gBinSize->setDecimals (3); gBinSize->setRange (0.0, 200.0); gBinSize->setSingleStep (0.05); gBinSize->setValue (pfm_def->gbin_size); gBinSize->setWrapping (TRUE); gBinSize->setToolTip (tr ("Set the PFM bin size in minutes")); gBinSize->setWhatsThis (gBinSizeText); connect (gBinSize, SIGNAL (valueChanged (double)), this, SLOT (slotGBinSizeChanged (double))); gBinsBoxLayout->addWidget (gBinSize); limBoxLayout->addWidget (gBinsBox); QGroupBox *minDBox = new QGroupBox (tr ("Minimum depth"), this); QHBoxLayout *minDBoxLayout = new QHBoxLayout; minDBox->setLayout (minDBoxLayout); minDBoxLayout->setSpacing (10); minDepth = new QDoubleSpinBox (this); minDepth->setDecimals (1); minDepth->setRange (-10000.0, 12000.0); minDepth->setSingleStep (1000.0); minDepth->setValue (pfm_def->min_depth); minDepth->setWrapping (TRUE); minDepth->setToolTip (tr ("Set the minimum allowable depth for the PFM structure")); minDepth->setWhatsThis (minDepthText); minDBoxLayout->addWidget (minDepth); limBoxLayout->addWidget (minDBox); QGroupBox *maxDBox = new QGroupBox (tr ("Maximum depth"), this); QHBoxLayout *maxDBoxLayout = new QHBoxLayout; maxDBox->setLayout (maxDBoxLayout); maxDBoxLayout->setSpacing (10); maxDepth = new QDoubleSpinBox (this); maxDepth->setDecimals (1); maxDepth->setRange (-10000.0, 12000.0); maxDepth->setSingleStep (1000.0); maxDepth->setValue (pfm_def->max_depth); maxDepth->setWrapping (TRUE); maxDepth->setToolTip (tr ("Set the maximum allowable depth for the PFM structure")); maxDepth->setWhatsThis (maxDepthText); maxDBoxLayout->addWidget (maxDepth); limBoxLayout->addWidget (maxDBox); QGroupBox *precBox = new QGroupBox (tr ("Precision"), this); QHBoxLayout *precBoxLayout = new QHBoxLayout; precBox->setLayout (precBoxLayout); precBoxLayout->setSpacing (10); precision = new QComboBox (this); precision->setToolTip (tr ("Set the PFM structure depth precision")); precision->setWhatsThis (precisionText); precision->setEditable (FALSE); precision->addItem ("0.01 " + tr ("(one centimeter)")); precision->addItem ("0.10 " + tr ("(one decimeter)")); precision->addItem ("1.00 " + tr ("(one meter)")); precBoxLayout->addWidget (precision); limBoxLayout->addWidget (precBox); pageLayout->addWidget (limBox); QGroupBox *areaBox = new QGroupBox (tr ("Area file"), this); QHBoxLayout *areaBoxLayout = new QHBoxLayout; areaBox->setLayout (areaBoxLayout); areaBoxLayout->setSpacing (10); area_edit = new QLineEdit (this); area_edit->setReadOnly (TRUE); area_edit->setToolTip (tr ("Area file name for this PFM")); area_edit->setWhatsThis (areaText); areaBoxLayout->addWidget (area_edit); area_browse = new QPushButton (tr ("Browse..."), this); area_browse->setToolTip (tr ("Select an area file to define the PFM area")); area_browse->setWhatsThis (areaBrowseText); connect (area_browse, SIGNAL (clicked ()), this, SLOT (slotAreaFileBrowse ())); areaBoxLayout->addWidget (area_browse); area_map = new QPushButton (tr ("Map..."), this); area_map->setToolTip (tr ("Create an area file using areaCheck")); area_map->setWhatsThis (area_mapText); connect (area_map, SIGNAL (clicked ()), this, SLOT (slotAreaMap ())); areaBoxLayout->addWidget (area_map); area_pfm = new QPushButton (tr ("PFM..."), this); area_pfm->setToolTip (tr ("Use the area in an already existing PFM structure")); area_pfm->setWhatsThis (area_PFMText); connect (area_pfm, SIGNAL (clicked ()), this, SLOT (slotAreaPFM ())); areaBoxLayout->addWidget (area_pfm); area_nsew = new QPushButton (tr ("NSEW..."), this); area_nsew->setToolTip (tr ("Create an area file by defining North, South, East, and West bounds")); area_nsew->setWhatsThis (area_nsewText); connect (area_nsew, SIGNAL (clicked ()), this, SLOT (slotAreaNSEW ())); areaBoxLayout->addWidget (area_nsew); pageLayout->addWidget (areaBox, 1); QGroupBox *optBox = new QGroupBox (tr ("Optional files"), this); QHBoxLayout *optBoxLayout = new QHBoxLayout; optBox->setLayout (optBoxLayout); optBoxLayout->setSpacing (10); QGroupBox *mosaicBox = new QGroupBox (tr ("Mosaic file"), this); QHBoxLayout *mosaicBoxLayout = new QHBoxLayout; mosaicBox->setLayout (mosaicBoxLayout); mosaicBoxLayout->setSpacing (10); mosaic_edit = new QLineEdit (this); mosaic_edit->setReadOnly (TRUE); mosaic_edit->setToolTip (tr ("Mosaic file name for this PFM")); mosaic_edit->setWhatsThis (mosaicText); mosaicBoxLayout->addWidget (mosaic_edit); mosaic_browse = new QPushButton (tr ("Browse..."), this); mosaic_browse->setToolTip (tr ("Select a mosaic file for this PFM")); mosaic_browse->setWhatsThis (mosaicBrowseText); mosaic_edit->setText (pfm_def->mosaic); connect (mosaic_browse, SIGNAL (clicked ()), this, SLOT (slotMosaicFileBrowse ())); mosaicBoxLayout->addWidget (mosaic_browse); optBoxLayout->addWidget (mosaicBox); QGroupBox *featureBox = new QGroupBox (tr ("Feature file"), this); QHBoxLayout *featureBoxLayout = new QHBoxLayout; featureBox->setLayout (featureBoxLayout); featureBoxLayout->setSpacing (10); feature_edit = new QLineEdit (this); feature_edit->setReadOnly (TRUE); feature_edit->setToolTip (tr ("Feature file name for this PFM")); feature_edit->setWhatsThis (featureText); featureBoxLayout->addWidget (feature_edit); feature_browse = new QPushButton (tr ("Browse..."), this); feature_browse->setToolTip (tr ("Select a feature file for this PFM")); feature_browse->setWhatsThis (featureBrowseText); feature_edit->setText (pfm_def->feature); connect (feature_browse, SIGNAL (clicked ()), this, SLOT (slotFeatureFileBrowse ())); featureBoxLayout->addWidget (feature_browse); optBoxLayout->addWidget (featureBox); pageLayout->addWidget (optBox, 1); QGroupBox *filtBox = new QGroupBox (tr ("Area filter settings"), this); QHBoxLayout *filtBoxLayout = new QHBoxLayout; filtBox->setLayout (filtBoxLayout); filtBoxLayout->setSpacing (10); QGroupBox *aBox = new QGroupBox (tr ("Apply area filter"), this); QHBoxLayout *aBoxLayout = new QHBoxLayout; aBox->setLayout (aBoxLayout); aBoxLayout->setSpacing (10); applyFilter = new QCheckBox (this); applyFilter->setToolTip (tr ("Apply the area filter for this PFM")); applyFilter->setWhatsThis (applyFilterText); applyFilter->setChecked (pfm_def->apply_area_filter); connect (applyFilter, SIGNAL (stateChanged (int)), this, SLOT (slotApplyFilterStateChanged (int))); aBoxLayout->addWidget (applyFilter); filtBoxLayout->addWidget (aBox); QGroupBox *dBox = new QGroupBox (tr ("Deep filter only"), this); QHBoxLayout *dBoxLayout = new QHBoxLayout; dBox->setLayout (dBoxLayout); dBoxLayout->setSpacing (10); deepFilter = new QCheckBox (this); deepFilter->setToolTip (tr ("Only filter values deeper than the average surface")); deepFilter->setWhatsThis (deepFilterText); deepFilter->setChecked (pfm_def->deep_filter_only); if (!pfm_def->apply_area_filter) deepFilter->setEnabled (FALSE); dBoxLayout->addWidget (deepFilter); filtBoxLayout->addWidget (dBox); QGroupBox *bBox = new QGroupBox (tr ("Bin standard deviation"), this); QHBoxLayout *bBoxLayout = new QHBoxLayout; bBox->setLayout (bBoxLayout); bBoxLayout->setSpacing (10); stdSpin = new QDoubleSpinBox (this); stdSpin->setDecimals (2); stdSpin->setRange (0.3, 3.0); stdSpin->setSingleStep (0.1); stdSpin->setValue (pfm_def->cellstd); stdSpin->setWrapping (TRUE); stdSpin->setToolTip (tr ("Set the area filter standard deviation")); stdSpin->setWhatsThis (stdText); if (!pfm_def->apply_area_filter) stdSpin->setEnabled (FALSE); bBoxLayout->addWidget (stdSpin); filtBoxLayout->addWidget (bBox); QGroupBox *tBox = new QGroupBox (tr ("Feature Radius"), this); QHBoxLayout *tBoxLayout = new QHBoxLayout; tBox->setLayout (tBoxLayout); tBoxLayout->setSpacing (10); featureRadius = new QDoubleSpinBox (this); featureRadius->setDecimals (2); featureRadius->setRange (0.0, 200.0); featureRadius->setSingleStep (10.0); featureRadius->setValue (pfm_def->radius); featureRadius->setWrapping (TRUE); featureRadius->setToolTip (tr ("Set the radius of the area around features to exclude from filtering")); featureRadius->setWhatsThis (featureRadiusText); if (!pfm_def->apply_area_filter) featureRadius->setEnabled (FALSE); tBoxLayout->addWidget (featureRadius); filtBoxLayout->addWidget (tBox); pageLayout->addWidget (filtBox, 1); // Register fields. pfm_file_edit_field = "pfm_file_edit" + pfmIndex; registerField (pfm_file_edit_field, pfm_file_edit); area_edit_field = "area_edit" + pfmIndex; registerField (area_edit_field, area_edit); mBinSizeField = "mBinSize" + pfmIndex; registerField (mBinSizeField, mBinSize, "value", "valueChanged"); gBinSizeField = "gBinSize" + pfmIndex; registerField (gBinSizeField, gBinSize, "value", "valueChanged"); minDepthField = "minDepth" + pfmIndex; registerField (minDepthField, minDepth, "value", "valueChanged"); maxDepthField = "maxDepth" + pfmIndex; registerField (maxDepthField, maxDepth, "value", "valueChanged"); precisionField = "precision" + pfmIndex; registerField (precisionField, precision); mosaic_edit_field = "mosaic_edit" + pfmIndex; registerField (mosaic_edit_field, mosaic_edit); feature_edit_field = "feature_edit" + pfmIndex; registerField (feature_edit_field, feature_edit); applyFilterField = "applyFilter" + pfmIndex; registerField (applyFilterField, applyFilter); deepFilterField = "deepFilter" + pfmIndex; registerField (deepFilterField, deepFilter); stdSpinField = "stdSpin" + pfmIndex; registerField (stdSpinField, stdSpin, "value", "valueChanged"); featureRadiusField = "featureRadius" + pfmIndex; registerField (featureRadiusField, featureRadius, "value", "valueChanged"); setFields (pfmDef); }
PUBLIC bool updateRecFromParams(cchar *table) { return updateRec(setFields(readRec(table, param("id")), params())); }
Prefs::Prefs (QWidget * parent, OPTIONS *op, MISC *mi): QDialog (parent, (Qt::WindowFlags) Qt::WA_DeleteOnClose) { options = op; mod_options = *options; misc = mi; dataChanged = NVFalse; setWindowTitle (tr ("areaCheck preferences")); QVBoxLayout *vbox = new QVBoxLayout (this); vbox->setMargin (5); vbox->setSpacing (5); QGroupBox *fbox = new QGroupBox (tr ("Position Format"), this); fbox->setWhatsThis (bGrpText); QRadioButton *hdms = new QRadioButton (tr ("Hemisphere Degrees Minutes Seconds.decimal")); QRadioButton *hdm_ = new QRadioButton (tr ("Hemisphere Degrees Minutes.decimal")); QRadioButton *hd__ = new QRadioButton (tr ("Hemisphere Degrees.decimal")); QRadioButton *sdms = new QRadioButton (tr ("+/-Degrees Minutes Seconds.decimal")); QRadioButton *sdm_ = new QRadioButton (tr ("+/-Degrees Minutes.decimal")); QRadioButton *sd__ = new QRadioButton (tr ("+/-Degrees.decimal")); bGrp = new QButtonGroup (this); bGrp->setExclusive (TRUE); connect (bGrp, SIGNAL (buttonClicked (int)), this, SLOT (slotPositionClicked (int))); bGrp->addButton (hdms, 0); bGrp->addButton (hdm_, 1); bGrp->addButton (hd__, 2); bGrp->addButton (sdms, 3); bGrp->addButton (sdm_, 4); bGrp->addButton (sd__, 5); QHBoxLayout *fboxSplit = new QHBoxLayout; QVBoxLayout *fboxLeft = new QVBoxLayout; QVBoxLayout *fboxRight = new QVBoxLayout; fboxSplit->addLayout (fboxLeft); fboxSplit->addLayout (fboxRight); fboxLeft->addWidget (hdms); fboxLeft->addWidget (hdm_); fboxLeft->addWidget (hd__); fboxRight->addWidget (sdms); fboxRight->addWidget (sdm_); fboxRight->addWidget (sd__); fbox->setLayout (fboxSplit); vbox->addWidget (fbox, 1); QGroupBox *cbox = new QGroupBox (tr ("Colors"), this); QHBoxLayout *cboxSplit = new QHBoxLayout; cbox->setLayout (cboxSplit); QVBoxLayout *cboxLeft = new QVBoxLayout; QVBoxLayout *cboxRight = new QVBoxLayout; cboxSplit->addLayout (cboxLeft); cboxSplit->addLayout (cboxRight); bCoastColor = new QPushButton (tr ("Coast"), this); bCoastPalette = bCoastColor->palette (); bCoastColor->setToolTip (tr ("Change coastline color")); bCoastColor->setWhatsThis (coastColorText); connect (bCoastColor, SIGNAL (clicked ()), this, SLOT (slotCoastColor ())); cboxLeft->addWidget (bCoastColor); bMaskColor = new QPushButton (tr ("Landmask"), this); bMaskPalette = bMaskColor->palette (); bMaskColor->setToolTip (tr ("Change landmask color")); bMaskColor->setWhatsThis (maskColorText); connect (bMaskColor, SIGNAL (clicked ()), this, SLOT (slotMaskColor ())); cboxLeft->addWidget (bMaskColor); bBackgroundColor = new QPushButton (tr ("Background"), this); bBackgroundPalette = bBackgroundColor->palette (); bBackgroundColor->setToolTip (tr ("Change display background color")); bBackgroundColor->setWhatsThis (backgroundColorText); connect (bBackgroundColor, SIGNAL (clicked ()), this, SLOT (slotBackgroundColor ())); cboxRight->addWidget (bBackgroundColor); bHighlightColor = new QPushButton (tr ("Highlight"), this); bHighlightPalette = bHighlightColor->palette (); bHighlightColor->setToolTip (tr ("Change highlight color")); bHighlightColor->setWhatsThis (highlightColorText); connect (bHighlightColor, SIGNAL (clicked ()), this, SLOT (slotHighlightColor ())); cboxRight->addWidget (bHighlightColor); vbox->addWidget (cbox, 1); QGroupBox *c2box = new QGroupBox (tr ("Data Type Colors"), this); c2box->setWhatsThis (colorGrpText); c2[0] = new QPushButton (misc->type_name[ISS60_AREA], this); c2Palette[0] = c2[0]->palette (); c2[1] = new QPushButton (misc->type_name[GENERIC_AREA], this); c2Palette[1] = c2[1]->palette (); c2[2] = new QPushButton (misc->type_name[ACE_AREA], this); c2Palette[2] = c2[2]->palette (); c2[3] = new QPushButton (misc->type_name[ISS60_ZONE], this); c2Palette[3] = c2[3]->palette (); c2[4] = new QPushButton (misc->type_name[GENERIC_ZONE], this); c2Palette[4] = c2[4]->palette (); c2[5] = new QPushButton (misc->type_name[SHAPE], this); c2Palette[5] = c2[5]->palette (); c2[6] = new QPushButton (misc->type_name[TRACK], this); c2Palette[6] = c2[6]->palette (); c2[7] = new QPushButton (misc->type_name[FEATURE], this); c2Palette[7] = c2[7]->palette (); c2[8] = new QPushButton (misc->type_name[YXZ], this); c2Palette[8] = c2[8]->palette (); c2[9] = new QPushButton (misc->type_name[LLZ_DATA], this); c2Palette[9] = c2[9]->palette (); c2[10] = new QPushButton (misc->type_name[GEOTIFF], this); c2Palette[10] = c2[10]->palette (); c2[11] = new QPushButton (misc->type_name[CHRTR], this); c2Palette[11] = c2[11]->palette (); c2[12] = new QPushButton (misc->type_name[BAG], this); c2Palette[12] = c2[12]->palette (); c2[13] = new QPushButton (misc->type_name[OPTECH_FLT], this); c2Palette[13] = c2[13]->palette (); colorGrp = new QButtonGroup (c2box); colorGrp->setExclusive (FALSE); connect (colorGrp, SIGNAL (buttonClicked (int)), this, SLOT (slotColor (int))); colorGrp->addButton (c2[0], ISS60_AREA); colorGrp->addButton (c2[1], GENERIC_AREA); colorGrp->addButton (c2[2], ACE_AREA); colorGrp->addButton (c2[3], ISS60_ZONE); colorGrp->addButton (c2[4], GENERIC_ZONE); colorGrp->addButton (c2[5], SHAPE); colorGrp->addButton (c2[6], TRACK); colorGrp->addButton (c2[7], FEATURE); colorGrp->addButton (c2[8], YXZ); colorGrp->addButton (c2[9], LLZ_DATA); colorGrp->addButton (c2[10], GEOTIFF); colorGrp->addButton (c2[11], CHRTR); colorGrp->addButton (c2[12], BAG); colorGrp->addButton (c2[13], OPTECH_FLT); QHBoxLayout *c2boxSplit = new QHBoxLayout; QVBoxLayout *c2boxLeft = new QVBoxLayout; QVBoxLayout *c2boxRight = new QVBoxLayout; c2boxSplit->addLayout (c2boxLeft); c2boxSplit->addLayout (c2boxRight); c2boxLeft->addWidget (c2[0]); c2boxLeft->addWidget (c2[1]); c2boxLeft->addWidget (c2[2]); c2boxLeft->addWidget (c2[3]); c2boxLeft->addWidget (c2[4]); c2boxLeft->addWidget (c2[5]); c2boxLeft->addWidget (c2[6]); c2boxRight->addWidget (c2[7]); c2boxRight->addWidget (c2[8]); c2boxRight->addWidget (c2[9]); c2boxRight->addWidget (c2[10]); c2boxRight->addWidget (c2[11]); c2boxRight->addWidget (c2[12]); c2boxRight->addWidget (c2[13]); c2box->setLayout (c2boxSplit); vbox->addWidget (c2box, 1); QGroupBox *sunBox = new QGroupBox (tr ("CHRTR/BAG Sun Shading"), this); QHBoxLayout *sunBoxLayout = new QHBoxLayout; sunBox->setLayout (sunBoxLayout); QGroupBox *angBox = new QGroupBox (tr ("Angle"), this); QHBoxLayout *angBoxLayout = new QHBoxLayout; angBox->setLayout (angBoxLayout); sunAz = new QDoubleSpinBox (angBox); sunAz->setDecimals (1); sunAz->setRange (0.0, 359.9); sunAz->setSingleStep (1.0); sunAz->setValue (mod_options.sunopts.azimuth); sunAz->setWrapping (TRUE); sunAz->setToolTip (tr ("Change the sun angle (0.0-360.0)")); sunAz->setWhatsThis (sunAzText); angBoxLayout->addWidget (sunAz); sunBoxLayout->addWidget (angBox); QGroupBox *eleBox = new QGroupBox (tr ("Elevation"), this); QHBoxLayout *eleBoxLayout = new QHBoxLayout; eleBox->setLayout (eleBoxLayout); sunEl = new QDoubleSpinBox (eleBox); sunEl->setDecimals (1); sunEl->setRange (0.0, 90.0); sunEl->setSingleStep (1.0); sunEl->setValue (mod_options.sunopts.elevation); sunEl->setWrapping (TRUE); sunEl->setToolTip (tr ("Change the sun elevation (0.0-90.0)")); sunEl->setWhatsThis (sunElText); eleBoxLayout->addWidget (sunEl); sunBoxLayout->addWidget (eleBox); QGroupBox *exaBox = new QGroupBox (tr ("Exaggeration"), this); QHBoxLayout *exaBoxLayout = new QHBoxLayout; exaBox->setLayout (exaBoxLayout); sunEx = new QDoubleSpinBox (exaBox); sunEx->setDecimals (1); sunEx->setRange (0.0, 359.9); sunEx->setSingleStep (1.0); sunEx->setValue (mod_options.sunopts.exag); sunEx->setWrapping (TRUE); sunEx->setToolTip (tr ("Change the sun Z exaggeration (1-10)")); sunEx->setWhatsThis (sunExText); exaBoxLayout->addWidget (sunEx); sunBoxLayout->addWidget (exaBox); vbox->addWidget (sunBox, 1); QGroupBox *mbox = new QGroupBox (tr ("MINMAX parameters"), this); mbox->setWhatsThis (colorGrpText); QHBoxLayout *mboxLayout = new QHBoxLayout; mbox->setLayout (mboxLayout); QGroupBox *sBox = new QGroupBox (tr ("Use stoplight colors"), this); QHBoxLayout *sBoxLayout = new QHBoxLayout; sBox->setLayout (sBoxLayout); stopLight = new QCheckBox (this); connect (stopLight, SIGNAL (clicked ()), this, SLOT (slotStopLightClicked ())); stopLight->setToolTip (tr ("Use stoplight colors when displaying MINMAX .trk files")); stopLight->setWhatsThis (stopLightText); sBoxLayout->addWidget (stopLight); mboxLayout->addWidget (sBox); QGroupBox *gBox = new QGroupBox (tr ("Green to yellow value"), this); QHBoxLayout *gBoxLayout = new QHBoxLayout; gBox->setLayout (gBoxLayout); minStop = new QLineEdit (this); mboxLayout->addWidget (minStop); minStop->setToolTip (tr ("Set value below which data is green")); minStop->setWhatsThis (minStopText); gBoxLayout->addWidget (minStop); mboxLayout->addWidget (gBox); QGroupBox *yBox = new QGroupBox (tr ("Yellow to red value"), this); QHBoxLayout *yBoxLayout = new QHBoxLayout; yBox->setLayout (yBoxLayout); maxStop = new QLineEdit (this); mboxLayout->addWidget (maxStop); maxStop->setToolTip (tr ("Set value above which data is red")); maxStop->setWhatsThis (maxStopText); yBoxLayout->addWidget (maxStop); mboxLayout->addWidget (yBox); vbox->addWidget (mbox, 1); setFields (); QHBoxLayout *actions = new QHBoxLayout (0); vbox->addLayout (actions); QPushButton *bHelp = new QPushButton (this); bHelp->setIcon (QIcon (":/icons/contextHelp.xpm")); bHelp->setToolTip (tr ("Enter What's This mode for help")); connect (bHelp, SIGNAL (clicked ()), this, SLOT (slotHelp ())); actions->addWidget (bHelp); actions->addStretch (10); bRestoreDefaults = new QPushButton (tr ("Restore Defaults"), this); bRestoreDefaults->setToolTip (tr ("Restore all preferences to the default state")); bRestoreDefaults->setWhatsThis (restoreDefaultsText); connect (bRestoreDefaults, SIGNAL (clicked ()), this, SLOT (slotRestoreDefaults ())); actions->addWidget (bRestoreDefaults); QPushButton *applyButton = new QPushButton (tr ("OK"), this); applyButton->setToolTip (tr ("Accept changes and close dialog")); applyButton->setWhatsThis (applyPrefsText); connect (applyButton, SIGNAL (clicked ()), this, SLOT (slotApplyPrefs ())); actions->addWidget (applyButton); QPushButton *closeButton = new QPushButton (tr ("Cancel"), this); closeButton->setToolTip (tr ("Discard changes and close dialog")); closeButton->setWhatsThis (closePrefsText); connect (closeButton, SIGNAL (clicked ()), this, SLOT (slotClosePrefs ())); actions->addWidget (closeButton); show (); }
/* Can call this without being authenticated */ static void publishPackage() { HttpConn *conn; EdiRec *rec; cchar *email, *password, *name, *endpoint; bool checkPassword; name = param("name"); endpoint = param("endpoint"); password = param("password"); email = param("email"); conn = getConn(); if (!name || !*name || !endpoint || !*endpoint) { sendResult(feedback("error", "Missing name or endpoint parameters")); return; } if (!email || !*email) { sendResult(feedback("error", "Missing email parameter")); return; } if (canUser("edit", 0) && smatch(conn->username, name)) { checkPassword = 0; httpTrace(conn, "auth.login.authenticated", "context", "msg=\"Authenticated for package\", pak=%s", name); } else { if (!password || !*password) { sendResult(feedback("error", "Missing password parameter")); return; } checkPassword = 1; } if ((rec = readRecWhere("pak", "name", "==", name)) != 0) { if (checkPassword && !mprCheckPassword(password, getField(rec, "password"))) { sendResult(feedback("error", "Package already exists but invalid password")); return; } setFields(rec, params()); } else { #if FUTURE cchar *uri, *response, *err; uri = strim(endpoint, ".git", MPR_TRIM_END); uri = sjoin(uri, "/raw/master/package.json", NULL); status = httpRequest("GET", uri, NULL, &response, &err); if (status != 200) { feedback("warn", "Could not verify endpoint"); } else { if (!response || mprParseJson(response) == 0) { feedback("warn", "Could not verify endpoint package.json"); } } #endif if ((rec = createRec("pak", params())) == 0) { sendResult(feedback("error", "Cannot create package record")); return; } } setField(rec, "password", mprMakePassword(password, PASSWORD_SALT, PASSWORD_ROUNDS)); if (!(updateRec(rec))) { sendResult(feedback("error", "Cannot save package details")); return; } sendRec(rec); }
//--------------------------------------------------------------------------- // Public methods //--------------------------------------------------------------------------- LLPanelLogin::LLPanelLogin(const LLRect& rect) : LLPanel(std::string("panel_login"), rect, FALSE), // not bordered mLogoImage(LLUI::getUIImage("startup_logo.j2c")) { setFocusRoot(TRUE); setBackgroundVisible(FALSE); setBackgroundOpaque(TRUE); LLPanelLogin::sInstance = this; // add to front so we are the bottom-most child gViewerWindow->getRootView()->addChildInBack(this); LLUICtrlFactory::getInstance()->buildPanel(this, "panel_login.xml"); reshape(rect.getWidth(), rect.getHeight()); LLComboBox* username_combo(getChild<LLComboBox>("username_combo")); username_combo->setCommitCallback(boost::bind(LLPanelLogin::onSelectLoginEntry, _1, this)); username_combo->setFocusLostCallback(boost::bind(&LLPanelLogin::onLoginComboLostFocus, this, username_combo)); username_combo->setPrevalidate(LLLineEditor::prevalidatePrintableNotPipe); username_combo->setSuppressTentative(true); username_combo->setSuppressAutoComplete(true); childSetCommitCallback("remember_name_check", onNameCheckChanged); LLLineEditor* password_edit(getChild<LLLineEditor>("password_edit")); password_edit->setKeystrokeCallback(onPassKey); // STEAM-14: When user presses Enter with this field in focus, initiate login password_edit->setCommitCallback(mungePassword, this); password_edit->setDrawAsterixes(TRUE); getChild<LLUICtrl>("remove_login")->setCommitCallback(boost::bind(&LLPanelLogin::confirmDelete, this)); // change z sort of clickable text to be behind buttons sendChildToBack(getChildView("channel_text")); sendChildToBack(getChildView("forgot_password_text")); //llinfos << " url history: " << LLSDOStreamer<LLSDXMLFormatter>(LLURLHistory::getURLHistory("regionuri")) << llendl; LLComboBox* location_combo = getChild<LLComboBox>("start_location_combo"); updateLocationSelectorsVisibility(); // separate so that it can be called from preferences location_combo->setAllowTextEntry(TRUE, 128, FALSE); location_combo->setFocusLostCallback( boost::bind(&LLPanelLogin::onLocationSLURL, this) ); LLComboBox *server_choice_combo = getChild<LLComboBox>("grids_combo"); server_choice_combo->setCommitCallback(boost::bind(&LLPanelLogin::onSelectGrid, _1)); server_choice_combo->setFocusLostCallback(boost::bind(&LLPanelLogin::onSelectGrid, server_choice_combo)); // Load all of the grids, sorted, and then add a bar and the current grid at the top updateGridCombo(); LLSLURL start_slurl(LLStartUp::getStartSLURL()); if ( !start_slurl.isSpatial() ) // has a start been established by the command line or NextLoginLocation ? { // no, so get the preference setting std::string defaultStartLocation = gSavedSettings.getString("LoginLocation"); LL_INFOS("AppInit")<<"default LoginLocation '"<<defaultStartLocation<<"'"<<LL_ENDL; LLSLURL defaultStart(defaultStartLocation); if ( defaultStart.isSpatial() ) { LLStartUp::setStartSLURL(defaultStart); // calls onUpdateStartSLURL } else { LL_INFOS("AppInit")<<"no valid LoginLocation, using home"<<LL_ENDL; LLSLURL homeStart(LLSLURL::SIM_LOCATION_HOME); LLStartUp::setStartSLURL(homeStart); // calls onUpdateStartSLURL } } else { LLPanelLogin::onUpdateStartSLURL(start_slurl); // updates grid if needed } // Also set default button for subpanels, otherwise hitting enter in text entry fields won't login { LLButton* connect_btn(findChild<LLButton>("connect_btn")); connect_btn->setCommitCallback(boost::bind(&LLPanelLogin::onClickConnect, this)); setDefaultBtn(connect_btn); findChild<LLPanel>("name_panel")->setDefaultBtn(connect_btn); findChild<LLPanel>("password_panel")->setDefaultBtn(connect_btn); findChild<LLPanel>("grids_panel")->setDefaultBtn(connect_btn); findChild<LLPanel>("location_panel")->setDefaultBtn(connect_btn); findChild<LLPanel>("login_html")->setDefaultBtn(connect_btn); } childSetAction("grids_btn", onClickGrids, this); std::string channel = gVersionChannel; std::string version = llformat("%d.%d.%d (%d)", gVersionMajor, gVersionMinor, gVersionPatch, gVersionBuild ); LLTextBox* channel_text = getChild<LLTextBox>("channel_text"); channel_text->setTextArg("[CHANNEL]", channel); // though not displayed channel_text->setTextArg("[VERSION]", version); channel_text->setClickedCallback(boost::bind(&LLPanelLogin::onClickVersion,(void*)NULL)); LLTextBox* forgot_password_text = getChild<LLTextBox>("forgot_password_text"); forgot_password_text->setClickedCallback(boost::bind(&onClickForgotPassword)); LLTextBox* create_new_account_text = getChild<LLTextBox>("create_new_account_text"); create_new_account_text->setClickedCallback(boost::bind(&onClickNewAccount)); // get the web browser control LLMediaCtrl* web_browser = getChild<LLMediaCtrl>("login_html"); web_browser->addObserver(this); web_browser->setBackgroundColor(LLColor4::black); reshapeBrowser(); refreshLoginPage(); gHippoGridManager->setCurrentGridChangeCallback(boost::bind(&LLPanelLogin::onCurGridChange,this,_1,_2)); // Load login history std::string login_hist_filepath = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, "saved_logins_sg2.xml"); mLoginHistoryData = LLSavedLogins::loadFile(login_hist_filepath); const LLSavedLoginsList& saved_login_entries(mLoginHistoryData.getEntries()); for (LLSavedLoginsList::const_reverse_iterator i = saved_login_entries.rbegin(); i != saved_login_entries.rend(); ++i) { LLSD e = i->asLLSD(); if (e.isMap() && gHippoGridManager->getGrid(i->getGrid())) username_combo->add(getDisplayString(*i), e); } if (saved_login_entries.size() > 0) { setFields(*saved_login_entries.rbegin()); } }
void Packet::setHeaderFields(uint16_t newseqnum, uint16_t newacknum, uint16_t newwindow, bool ACK, bool SYN, bool FIN) { setFields((struct TCPHeader *)&m_header, newseqnum, newacknum, newwindow, ACK, SYN, FIN); }
void Prefs::slotColor (int id) { QString name; switch (id) { case 0: name = tr ("ISS-60 Area File"); break; case 1: name = tr ("Generic Area File"); break; case 2: name = tr ("ACE Area File"); break; case 3: name = tr ("ISS-60 Zone File"); break; case 4: name = tr ("Generic Zone File"); break; case 5: name = tr ("Shape File"); break; case 6: name = tr ("Track File"); break; case 7: name = tr ("Feature File"); break; case 8: name = tr ("YXZ File"); break; case 9: name = tr ("LLZ File"); break; case 10: name = tr ("GeoTIFF File"); break; case 11: name = tr ("CHRTR File"); break; case 12: name = tr ("BAG File"); break; case 13: name = tr ("Optech Flightline File"); break; } QColor clr; clr = QColorDialog::getColor (mod_options.color[id], this, tr ("areaCheck ") + name + tr (" Color"), QColorDialog::ShowAlphaChannel); if (clr.isValid ()) mod_options.color[id] = clr; setFields (); }
Prefs::Prefs (QWidget * parent, OPTIONS *op, MISC *mi): QDialog (parent, (Qt::WindowFlags) Qt::WA_DeleteOnClose) { options = op; misc = mi; mod_options = *op; mod_misc = *mi; setModal (TRUE); dataChanged = NVFalse; setWindowTitle (tr ("mosaicView Preferences")); QVBoxLayout *vbox = new QVBoxLayout (this); vbox->setMargin (5); vbox->setSpacing (5); QGroupBox *fbox = new QGroupBox (tr ("Position Format"), this); fbox->setWhatsThis (bGrpText); QRadioButton *hdms = new QRadioButton (tr ("Hemisphere Degrees Minutes Seconds.decimal")); QRadioButton *hdm_ = new QRadioButton (tr ("Hemisphere Degrees Minutes.decimal")); QRadioButton *hd__ = new QRadioButton (tr ("Hemisphere Degrees.decimal")); QRadioButton *sdms = new QRadioButton (tr ("+/-Degrees Minutes Seconds.decimal")); QRadioButton *sdm_ = new QRadioButton (tr ("+/-Degrees Minutes.decimal")); QRadioButton *sd__ = new QRadioButton (tr ("+/-Degrees.decimal")); bGrp = new QButtonGroup (this); bGrp->setExclusive (TRUE); connect (bGrp, SIGNAL (buttonClicked (int)), this, SLOT (slotPositionClicked (int))); bGrp->addButton (hdms, 0); bGrp->addButton (hdm_, 1); bGrp->addButton (hd__, 2); bGrp->addButton (sdms, 3); bGrp->addButton (sdm_, 4); bGrp->addButton (sd__, 5); QHBoxLayout *fboxSplit = new QHBoxLayout; QVBoxLayout *fboxLeft = new QVBoxLayout; QVBoxLayout *fboxRight = new QVBoxLayout; fboxSplit->addLayout (fboxLeft); fboxSplit->addLayout (fboxRight); fboxLeft->addWidget (hdms); fboxLeft->addWidget (hdm_); fboxLeft->addWidget (hd__); fboxRight->addWidget (sdms); fboxRight->addWidget (sdm_); fboxRight->addWidget (sd__); fbox->setLayout (fboxSplit); vbox->addWidget (fbox, 1); QGroupBox *miscBox = new QGroupBox (tr ("Miscellaneous"), this); QHBoxLayout *miscBoxLayout = new QHBoxLayout; miscBox->setLayout (miscBoxLayout); QGroupBox *zoomBox = new QGroupBox (tr ("Zoom percentage"), this); QHBoxLayout *zoomBoxLayout = new QHBoxLayout; zoomBox->setLayout (zoomBoxLayout); zoomPercent = new QSpinBox (zoomBox); zoomPercent->setRange (10, 50); zoomPercent->setSingleStep (5); zoomPercent->setToolTip (tr ("Change the zoom in/out percentage (10-50)")); zoomPercent->setWhatsThis (zoomPercentText); zoomBoxLayout->addWidget (zoomPercent); miscBoxLayout->addWidget (zoomBox); QGroupBox *featureBox = new QGroupBox (tr ("Feature Circle Diameter"), this); QHBoxLayout *featureBoxLayout = new QHBoxLayout; featureBox->setLayout (featureBoxLayout); featureDiameter = new QLineEdit (featureBox); featureDiameter->setToolTip (tr ("Change the add feature circle diameter (meters)")); featureDiameter->setWhatsThis (featureDiameterText); featureBoxLayout->addWidget (featureDiameter); miscBoxLayout->addWidget (featureBox); QGroupBox *textSearchBox = new QGroupBox (tr ("Feature search string"), this); QHBoxLayout *textSearchBoxLayout = new QHBoxLayout; textSearchBox->setLayout (textSearchBoxLayout); textSearch = new QLineEdit (textSearchBox); textSearch->setToolTip (tr ("Highlight features based on text search")); textSearch->setWhatsThis (textSearchText); textSearchBoxLayout->addWidget (textSearch); miscBoxLayout->addWidget (textSearchBox); vbox->addWidget (miscBox); QGroupBox *cbox = new QGroupBox (tr ("Colors"), this); QVBoxLayout *cboxLayout = new QVBoxLayout; cbox->setLayout (cboxLayout); QHBoxLayout *cboxTopLayout = new QHBoxLayout; QHBoxLayout *cboxBottomLayout = new QHBoxLayout; cboxLayout->addLayout (cboxTopLayout); cboxLayout->addLayout (cboxBottomLayout); bMarkerColor = new QPushButton (tr ("Marker"), this); bMarkerColor->setToolTip (tr ("Change marker color")); bMarkerColor->setWhatsThis (markerColorText); bMarkerPalette = bMarkerColor->palette (); connect (bMarkerColor, SIGNAL (clicked ()), this, SLOT (slotMarkerColor ())); cboxTopLayout->addWidget (bMarkerColor); bCoastColor = new QPushButton (tr ("Coast"), this); bCoastColor->setToolTip (tr ("Change coastline color")); bCoastColor->setWhatsThis (coastColorText); bCoastPalette = bCoastColor->palette (); connect (bCoastColor, SIGNAL (clicked ()), this, SLOT (slotCoastColor ())); cboxBottomLayout->addWidget (bCoastColor); bLandmaskColor = new QPushButton (tr ("Landmask"), this); bLandmaskColor->setToolTip (tr ("Change landmask color")); bLandmaskColor->setWhatsThis (landmaskColorText); bLandmaskPalette = bLandmaskColor->palette (); connect (bLandmaskColor, SIGNAL (clicked ()), this, SLOT (slotLandmaskColor ())); cboxTopLayout->addWidget (bLandmaskColor); bRectColor = new QPushButton (tr ("Zoom box"), this); bRectColor->setToolTip (tr ("Change zomm rectangle color")); bRectColor->setWhatsThis (rectColorText); bRectPalette = bRectColor->palette (); connect (bRectColor, SIGNAL (clicked ()), this, SLOT (slotRectColor ())); cboxBottomLayout->addWidget (bRectColor); bFeatureColor = new QPushButton (tr ("Feature"), this); bFeatureColor->setToolTip (tr ("Change feature color")); bFeatureColor->setWhatsThis (featureColorText); bFeaturePalette = bFeatureColor->palette (); connect (bFeatureColor, SIGNAL (clicked ()), this, SLOT (slotFeatureColor ())); cboxTopLayout->addWidget (bFeatureColor); bFeatureInfoColor = new QPushButton (tr ("Feature information"), this); bFeatureInfoColor->setToolTip (tr ("Change feature information text color")); bFeatureInfoColor->setWhatsThis (featureInfoColorText); bFeatureInfoPalette = bFeatureInfoColor->palette (); connect (bFeatureInfoColor, SIGNAL (clicked ()), this, SLOT (slotFeatureInfoColor ())); cboxBottomLayout->addWidget (bFeatureInfoColor); bFeaturePolyColor = new QPushButton (tr ("Feature polygon"), this); bFeaturePolyColor->setToolTip (tr ("Change feature polygonal area color")); bFeaturePolyColor->setWhatsThis (featurePolyColorText); bFeaturePolyPalette = bFeaturePolyColor->palette (); connect (bFeaturePolyColor, SIGNAL (clicked ()), this, SLOT (slotFeaturePolyColor ())); cboxTopLayout->addWidget (bFeaturePolyColor); bHighlightColor = new QPushButton (tr ("Highlight"), this); bHighlightColor->setToolTip (tr ("Change feature highlight color")); bHighlightColor->setWhatsThis (highlightColorText); bHighlightPalette = bHighlightColor->palette (); connect (bHighlightColor, SIGNAL (clicked ()), this, SLOT (slotHighlightColor ())); cboxBottomLayout->addWidget (bHighlightColor); vbox->addWidget (cbox, 1); QGroupBox *mBox = new QGroupBox (tr ("Display startup message"), this); QHBoxLayout *mBoxLayout = new QHBoxLayout; mBox->setLayout (mBoxLayout); sMessage = new QCheckBox (mBox); sMessage->setToolTip (tr ("Toggle display of startup message when program starts")); mBoxLayout->addWidget (sMessage); vbox->addWidget (mBox, 1); setFields (); QHBoxLayout *actions = new QHBoxLayout (0); vbox->addLayout (actions); QPushButton *bHelp = new QPushButton (this); bHelp->setIcon (QIcon (":/icons/contextHelp.xpm")); bHelp->setToolTip (tr ("Enter What's This mode for help")); connect (bHelp, SIGNAL (clicked ()), this, SLOT (slotHelp ())); actions->addWidget (bHelp); actions->addStretch (10); bRestoreDefaults = new QPushButton (tr ("Restore Defaults"), this); bRestoreDefaults->setToolTip (tr ("Restore all preferences to the default state")); bRestoreDefaults->setWhatsThis (restoreDefaultsText); connect (bRestoreDefaults, SIGNAL (clicked ()), this, SLOT (slotRestoreDefaults ())); actions->addWidget (bRestoreDefaults); QPushButton *applyButton = new QPushButton (tr ("OK"), this); applyButton->setToolTip (tr ("Accept changes and close dialog")); applyButton->setWhatsThis (applyPrefsText); connect (applyButton, SIGNAL (clicked ()), this, SLOT (slotApplyPrefs ())); actions->addWidget (applyButton); QPushButton *closeButton = new QPushButton (tr ("Cancel"), this); closeButton->setToolTip (tr ("Discard changes and close dialog")); closeButton->setWhatsThis (closePrefsText); connect (closeButton, SIGNAL (clicked ()), this, SLOT (slotClosePrefs ())); actions->addWidget (closeButton); show (); }
void Prefs::slotApplyPrefs () { if (mod_options.position_form != options->position_form) dataChanged = NVTrue; if (mod_options.stoplight != options->stoplight) dataChanged = NVTrue; sscanf (minStop->text ().toAscii (), "%f", &mod_options.minstop); if (mod_options.minstop != options->minstop) dataChanged = NVTrue; sscanf (maxStop->text ().toAscii (), "%f", &mod_options.maxstop); if (mod_options.maxstop != options->maxstop) dataChanged = NVTrue; mod_options.sunopts.azimuth = sunAz->value (); if (mod_options.sunopts.azimuth != options->sunopts.azimuth) dataChanged = NVTrue; mod_options.sunopts.elevation = sunEl->value (); if (mod_options.sunopts.elevation != options->sunopts.elevation) dataChanged = NVTrue; mod_options.sunopts.exag = sunEx->value (); if (mod_options.sunopts.exag != options->sunopts.exag) dataChanged = NVTrue; mod_options.sunopts.sun = sun_unv (mod_options.sunopts.azimuth, mod_options.sunopts.elevation); if (mod_options.coast_color != options->coast_color) dataChanged = NVTrue; if (mod_options.mask_color != options->mask_color) dataChanged = NVTrue; if (mod_options.background_color != options->background_color) dataChanged = NVTrue; if (mod_options.highlight_color != options->highlight_color) dataChanged = NVTrue; for (NV_INT32 i = 0 ; i < NUM_TYPES ; i++) { if (mod_options.color[i] != options->color[i]) dataChanged = NVTrue; } if (mod_options.color[CHRTR] != options->color[CHRTR] || mod_options.color[BAG] != options->color[BAG]) { // Redefine the surface colors because the CHRTR/BAG alpha value has changed.. NV_FLOAT32 hue_inc = 315.0 / (NV_FLOAT32) (NUMHUES + 1); for (NV_INT32 i = 0 ; i < NUMHUES ; i++) { for (NV_INT32 j = 0 ; j < NUMSHADES ; j++) { misc->color_array[i][j].setHsv ((NV_INT32) (((NUMHUES + 1) - i) * hue_inc), 255, j, mod_options.color[CHRTR].alpha ()); } } dataChanged = NVTrue; } setFields (); if (dataChanged) { *options = mod_options; emit dataChangedSignal (NVTrue); } close (); }