void gui_setFileSelectionBoxPseudoResources(Widget widget, Var* dvStruct, Narray* publicResources) { int i, cont; char* name; Var* value; #if DEBUG fprintf(stderr, "DEBUG: gui_setFileSelectionBoxPseudoResources(widget = %ld, " "dvStruct = %ld, publicResources = %ld)\n", widget, dvStruct, publicResources); #endif /* Iterate over the struct, extracting any pseudo-resource items that * we set. Delete the items from the struct, and start iterating at the * beginning again. This is not really efficient, but I'm not sure how * else to do it without mucking about with Davinci's structures more than * I'd like to, or keeping track of what has/hasn't been set. */ cont = 1; while (cont && get_struct_count(dvStruct)) { cont = 0; for (i = 0; i < get_struct_count(dvStruct); i++) { get_struct_element(dvStruct, i, &name, &value); if (!strcmp(name, "dirListItemCount")) { /* Extrapolated from dirListItems. */ parse_error("WARNING: ignoring dirListItemCount"); free_var(Narray_delete(V_STRUCT(dvStruct), "dirListItemCount")); cont = 1; break; } if (!strcmp(name, "fileListItemCount")) { /* Extrapolated from fileListItems. */ parse_error("WARNING: ignoring fileListItemCount"); free_var(Narray_delete(V_STRUCT(dvStruct), "fileListItemCount")); cont = 1; break; } if (!strcmp(name, "dirListItems")) { setItems(widget, name, "dirListItemCount", value); free_var(Narray_delete(V_STRUCT(dvStruct), "dirListItems")); Narray_add(publicResources, name, NULL); cont = 1; break; } if (!strcmp(name, "fileListItems")) { setItems(widget, name, "fileListItemCount", value); free_var(Narray_delete(V_STRUCT(dvStruct), "fileListItems")); Narray_add(publicResources, name, NULL); cont = 1; break; } /* ...new comparisons go here. */ } } }
void Exceptions::load(ProgressIndicator* progressIndicator) { DatabasePtr db = getDatabase(); MetadataLoader* loader = db->getMetadataLoader(); MetadataLoaderTransaction tr(loader); wxMBConv* converter = db->getCharsetConverter(); IBPP::Statement& st1 = loader->getStatement( Exception::getLoadStatement(true)); CollectionType exceptions; st1->Execute(); checkProgressIndicatorCanceled(progressIndicator); while (st1->Fetch()) { if (!st1->IsNull(1)) { std::string s; st1->Get(1, s); wxString name(std2wxIdentifier(s, converter)); ExceptionPtr exception = findByName(name); if (!exception) { exception.reset(new Exception(db, name)); initializeLockCount(exception, getLockCount()); } exceptions.push_back(exception); exception->loadProperties(st1, converter); } checkProgressIndicatorCanceled(progressIndicator); } setItems(exceptions); }
void MoveManipulator::setItem(FormEditorItem* item) { QList<FormEditorItem*> itemList; itemList.append(item); setItems(itemList); }
void Functions::load(ProgressIndicator* progressIndicator) { wxString stmt = "select rdb$function_name from rdb$functions" " where (rdb$system_flag = 0 or rdb$system_flag is null)" " order by 1"; setItems(getDatabase()->loadIdentifiers(stmt, progressIndicator)); }
void Tables::load(ProgressIndicator* progressIndicator) { wxString stmt = "select rdb$relation_name from rdb$relations" " where (rdb$system_flag = 0 or rdb$system_flag is null)" " and rdb$view_source is null order by 1"; setItems(getDatabase()->loadIdentifiers(stmt, progressIndicator)); }
void KoZoomAction::setZoom( const QString& text ) { bool ok = false; QString t = text; int zoom = t.remove( '%' ).toInt( &ok ); // where we'll store sorted new zoom values QValueList<int> list; if( zoom > 10 ) list.append( zoom ); // "Captured" non-empty sequence of digits QRegExp regexp("(\\d+)"); const QStringList itemsList( items() ); for( QStringList::ConstIterator it = itemsList.begin(); it != itemsList.end(); ++it ) { regexp.search( *it ); const int val=regexp.cap(1).toInt( &ok ); //zoom : limit inferior=10 if( ok && val>9 && list.contains( val )==0 ) list.append( val ); } qHeapSort( list ); // update items with new sorted zoom values QStringList values; for (QValueList<int>::Iterator it = list.begin(); it != list.end(); ++it ) values.append( i18n("%1%").arg(*it) ); setItems( values ); QString zoomStr = i18n("%1%").arg( zoom ); setCurrentItem( values.findIndex( zoomStr ) ); }
void AnchorTool::itemsAboutToRemoved(const QList<FormEditorItem*> &removedItems) { QList<FormEditorItem*> newItemList = items().toSet().subtract(removedItems.toSet()).toList(); setItems(newItemList); m_anchorIndicator.setItems(newItemList); m_anchorLineIndicator.clear(); }
void CPreviewSelectAction::setMode(Mode mode) { QStringList items; items.append(i18n("Standard Preview")); items.append(i18n("All Characters")); switch(mode) { default: case Basic: break; case BlocksAndScripts: for(itsNumUnicodeBlocks=0; constUnicodeBlocks[itsNumUnicodeBlocks].blockName; ++itsNumUnicodeBlocks) items.append(i18n("Unicode Block: %1", i18n(constUnicodeBlocks[itsNumUnicodeBlocks].blockName))); for(int i=0; constUnicodeScriptList[i]; ++i) items.append(i18n("Unicode Script: %1", i18n(constUnicodeScriptList[i]))); break; case ScriptsOnly: for(int i=0; constUnicodeScriptList[i]; ++i) items.append(i18n(constUnicodeScriptList[i])); } setItems(items); setStd(); }
void KoZoomAction::regenerateItems(const qreal zoom, bool asCurrent) { // where we'll store sorted new zoom values QList<qreal> zoomLevels; zoomLevels << 33; zoomLevels << 50; zoomLevels << 75; zoomLevels << 100; zoomLevels << 125; zoomLevels << 150; zoomLevels << 200; zoomLevels << 250; zoomLevels << 350; zoomLevels << 400; zoomLevels << 450; zoomLevels << 500; if( !zoomLevels.contains( zoom*100 ) ) zoomLevels << zoom*100; qSort(zoomLevels.begin(), zoomLevels.end()); // update items with new sorted zoom values QStringList values; if(d->zoomModes & KoZoomMode::ZOOM_WIDTH) { values << KoZoomMode::toString(KoZoomMode::ZOOM_WIDTH); } if(d->zoomModes & KoZoomMode::ZOOM_PAGE) { values << KoZoomMode::toString(KoZoomMode::ZOOM_PAGE); } foreach(qreal value, zoomLevels) { if(value>10.0) values << i18n("%1%", KGlobal::locale()->formatNumber(value, 0)); else values << i18n("%1%", KGlobal::locale()->formatNumber(value, 1)); } setItems( values ); if(d->input) d->input->setZoomLevels(values); if(asCurrent) { QString valueString; if(zoom*100>10.0) valueString = i18n("%1%", KGlobal::locale()->formatNumber(zoom*100, 0)); else valueString = i18n("%1%", KGlobal::locale()->formatNumber(zoom*100, 1)); setCurrentAction(valueString); if(d->input) d->input->setCurrentZoomLevel(valueString); } }
void HistoryList::restore() { AppSettings->beginGroup("/History/"); setSize(AppSettings->getValue("MaxEntries").toInt()); QStringList list = AppSettings->value("RecentFiles").toStringList(); AppSettings->endGroup(); setItems(list); }
//----------------------------------------------------------------------------- void Exceptions::load(ProgressIndicator* progressIndicator) { QString stmt = QString::fromLatin1( "select rdb$exception_name from rdb$exceptions" " order by 1" ); setItems(getDatabase()->loadIdentifiers(stmt, progressIndicator)); }
SearchDialog::SearchDialog( const QList<TagItem*> &items, QWidget *parent ) : QDialog(parent){ setupUi(this); // this sets up GUI items_ = items; for(int i=0;i<items_.size();i++){ if(!items_[i]->tagIsRead()){ items_[i]->readTags(); } } if(items_.size()==0){ QMessageBox::critical(this,"","Bug, no items specified"); return; } albumInfo = new TableWidget(this); QLayout *l = albumInfoFrame->layout(); if(!l){ l = new QGridLayout; albumInfoFrame->setLayout(l); } l->addWidget(albumInfo); setItems(); settings = Global::guiSettings(); api_key_ = settings->value("SearchDialog/api_key","").toString(); currentCoverInd=0; // signals/slots mechanism in action connect( prevCoverButton, SIGNAL( clicked() ), this, SLOT( showPrevCover() ) ); connect( nextCoverButton, SIGNAL( clicked() ), this, SLOT( showNextCover() ) ); connect( searchButton, SIGNAL( clicked() ), this, SLOT( search() ) ); connect( saveButton, SIGNAL( clicked() ), this, SLOT( save() ) ); connect(&downloadImageManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(setCoverFromReply(QNetworkReply*))); connect(&saveCoverManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(saveCoverFromReply(QNetworkReply*))); connect( searchResults, SIGNAL( itemClicked( QListWidgetItem * ) ), this, SLOT( showResult(QListWidgetItem *) ) ); connect( databaseComboBox, SIGNAL( currentIndexChanged( int ) ), this, SLOT( databaseChanged(int) ) ); databaseComboBox->addItem("Discogs"); databaseComboBox->addItem("MusicBrainz"); //save cover now action QAction* saveCoverAction = new QAction(tr("Save current cover now"), this); //saveCoverAction->setShortcut(tr("Ctrl+U"));saveCoverAction->setShortcutContext(Qt::WidgetShortcut); connect(saveCoverAction, SIGNAL(triggered()), this, SLOT(saveCoverNow())); QAction* saveAllCoversAction = new QAction(tr("Save all covers now"), this); //saveAllCoversAction->setShortcut(tr("Ctrl+U"));saveAllCoversAction->setShortcutContext(Qt::WidgetShortcut); connect(saveAllCoversAction, SIGNAL(triggered()), this, SLOT(saveAllCoversNow())); cover->setContextMenuPolicy(Qt::ActionsContextMenu); cover->addAction(saveCoverAction); cover->addAction(saveAllCoversAction); readSettings(); }
//----------------------------------------------------------------------------- void Generators::load(ProgressIndicator* progressIndicator) { QString stmt = QString::fromLatin1( "select rdb$generator_name from rdb$generators" " where (rdb$system_flag = 0 or rdb$system_flag is null)" " order by 1" ); setItems(getDatabase()->loadIdentifiers(stmt, progressIndicator)); }
void AnchorLineIndicator::setItem(FormEditorItem* item) { if (!item) return; QList<FormEditorItem*> itemList; itemList.append(item); setItems(itemList); }
TouchScreenMenu::TouchScreenMenu(TouchScreenMenuItem items[]){ _controller = &TSC; setSpacing(5); setPadding(2); setFontSize(2); setTitleFontSize(2); setJustification(LEFTJ); setItems(items); setTitle(NULL); setTitleColors(0xffff, 0x001f); setClearScreenOnDraw(false); }
void EffectsSelector::updateList() { const auto& config = Config::main(); QStringList names, tooltips; for (const auto& effect : config.effects) { names << effect.name; tooltips << effect.tooltip; } setItems(names, tooltips); }
TouchScreenMenu::TouchScreenMenu(TouchScreenMenuItem items[], unsigned int fontSize, unsigned int spacing, unsigned int padding, Justify justify, char *title){ _controller = &TSC; setSpacing(spacing); setPadding(padding); setFontSize(fontSize); setTitleFontSize(2); setJustification(justify); setItems(items); setTitle(title); setTitleColors(0xffff, 0x001f); setClearScreenOnDraw(false); }
void IngredientsSelector::updateList() { const auto& config = Config::main(); QStringList names, tooltips; for (const auto& ingredient : config.ingredients) { names << ingredient.name; tooltips << ingredient.tooltip; } setItems(names, tooltips); }
void Container::init() { if (_initialized) return; setModal(true); setFullscreen(false); auto game = Game::getInstance(); setX((game->renderer()->width() - 537)/2); setY((game->renderer()->height() - 376)/2); addUI("background", new Image("art/intrface/loot.frm")); addUI("button_done", new ImageButton(ImageButton::TYPE_SMALL_RED_CIRCLE, 478, 331)); getActiveUI("button_done")->addEventHandler("mouseleftclick", [this](Event* event){ this->onDoneButtonClick(dynamic_cast<MouseEvent*>(event)); }); // TAKEALL // invmadn // invmaup // invupds // invupin // invupout auto dudeList = new ItemsList(170, 35); dudeList->setItems(Game::getInstance()->player()->inventory()); addUI(dudeList); auto containerList = new ItemsList(292, 35); containerList->setItems(object()->inventory()); addUI(containerList); dudeList->addEventHandler("itemdragstop", [containerList](Event* event){ containerList->onItemDragStop(dynamic_cast<MouseEvent*>(event)); }); containerList->addEventHandler("itemdragstop", [dudeList](Event* event){ dudeList->onItemDragStop(dynamic_cast<MouseEvent*>(event)); }); }
void ActionModel::update(int row) { Q_ASSERT(m_core); // need to create the row list ... grrr.. if (row >= rowCount()) return; QStandardItemList list; for (int i = 0; i < NumColumns; i++) list += item(row, i); setItems(m_core, actionOfItem(list.front()), list); }
void SelectPageAction::setPageLabels(const QStringList &labels) { disconnect(this, SIGNAL(triggered(QString)), this, SLOT(slotGoToPage(QString))); clear(); const int pageCount = labels.size(); QStringList pageLabelTexts; pageLabelTexts.reserve(pageCount); for (int i = 0; i < pageCount; ++i) pageLabelTexts << labels.at(i) + QLatin1String(" (") + QString::number(i+1) + QLatin1String(" / ") + QString::number(pageCount) + QLatin1Char(')'); setItems(pageLabelTexts); connect(this, SIGNAL(triggered(QString)), this, SLOT(slotGoToPage(QString))); }
void LeapMotionPlugin::init() { loadSettings(); auto preferences = DependencyManager::get<Preferences>(); static const QString LEAPMOTION_PLUGIN { "Leap Motion" }; { auto getter = [this]()->bool { return _enabled; }; auto setter = [this](bool value) { _enabled = value; saveSettings(); if (!_enabled) { auto userInputMapper = DependencyManager::get<controller::UserInputMapper>(); userInputMapper->withLock([&, this]() { _inputDevice->clearState(); }); } }; auto preference = new CheckPreference(LEAPMOTION_PLUGIN, "Enabled", getter, setter); preferences->addPreference(preference); } { auto getter = [this]()->QString { return _sensorLocation; }; auto setter = [this](QString value) { _sensorLocation = value; saveSettings(); applySensorLocation(); }; auto preference = new ComboBoxPreference(LEAPMOTION_PLUGIN, "Sensor location", getter, setter); QStringList list = { SENSOR_ON_DESKTOP, SENSOR_ON_HMD }; preference->setItems(list); preferences->addPreference(preference); } { auto getter = [this]()->float { return _desktopHeightOffset; }; auto setter = [this](float value) { _desktopHeightOffset = value; saveSettings(); applyDesktopHeightOffset(); }; auto preference = new SpinnerPreference(LEAPMOTION_PLUGIN, "Desktop height for horizontal forearms", getter, setter); float MIN_VALUE = 0.0f; float MAX_VALUE = 1.0f; float DECIMALS = 2.0f; float STEP = 0.01f; preference->setMin(MIN_VALUE); preference->setMax(MAX_VALUE); preference->setDecimals(DECIMALS); preference->setStep(STEP); preferences->addPreference(preference); } }
void DynamicMode::setDynamicItems(const QPtrList<QListViewItem>& newList) { QStringList strListEntries; QListViewItem* entry; QPtrListIterator<QListViewItem> it( newList ); while( (entry = it.current()) != 0 ) { ++it; strListEntries << entry->text(0); } setItems(strListEntries); PlaylistBrowser::instance()->saveDynamics(); }
void NewslineWidget::refreshFromCache() { QString RSSDefaultFile = QString::fromStdString(openfluid::base::RuntimeEnvironment::instance()->getUserDataPath("%1/en.rss")) .arg(BUILDER_NEWSLINE_CACHERELDIR); QString RSSFile = QString::fromStdString(openfluid::base::RuntimeEnvironment::instance()->getUserDataPath("%1/%2.rss")) .arg(BUILDER_NEWSLINE_CACHERELDIR,NewsItemWidget::getLocale().name().left(2)); QList<NewsItemData> News = loadRSSFile(RSSFile); if (News.isEmpty()) News = loadRSSFile(RSSDefaultFile); ui->NoNewsLabel->setVisible(News.isEmpty()); setItems(News); }
QModelIndex ActionModel::addAction(QAction *action) { Q_ASSERT(m_core); QStandardItemList items; const Qt::ItemFlags flags = Qt::ItemIsSelectable|Qt::ItemIsDropEnabled|Qt::ItemIsDragEnabled|Qt::ItemIsEnabled; QVariant itemData; qVariantSetValue(itemData, action); for (int i = 0; i < NumColumns; i++) { QStandardItem *item = new QStandardItem; item->setData(itemData, ActionRole); item->setFlags(flags); items.push_back(item); } setItems(m_core, action, items); appendRow(items); return indexFromItem(items.front()); }
TITANIUM_FUNCTION(ListSection, setItems) { const auto js_context = this_object.get_context(); if (arguments.size() >= 1) { JSObject animation = js_context.CreateObject(); const auto _0 = arguments.at(0); TITANIUM_ASSERT(_0.IsObject()); const auto dataItems = js_to_ListDataItem_array(static_cast<JSObject>(_0)); if (arguments.size() >= 2) { const auto _1 = arguments.at(1); if (_1.IsObject()) { animation = listviewAnimationProperties_ctor__.CallAsConstructor({ _1 }); } } setItems(dataItems, animation.GetPrivate<ListViewAnimationProperties>()); } return get_context().CreateUndefined(); }
void ZoomAction::setCurrentZoomFactor(qreal newZoomFactor) { const qreal zoomFactorArray[] = {12.50, 25, 50, 75, 100, 125, 150, 200, 250, 300}; const int zoomFactorNumber = 10; QStringList zoomFactorList; int newZoomFactorPosition = -1; bool addNewZoomFactor = true; if (newZoomFactor < s_minZoomFactor || newZoomFactor > s_maxZoomFactor) addNewZoomFactor = false; newZoomFactor *= 100; for (int i = 0; i < zoomFactorNumber; ++i) { if (addNewZoomFactor && newZoomFactor < zoomFactorArray[i]) { zoomFactorList << formatZoomFactor(newZoomFactor); newZoomFactorPosition = i; addNewZoomFactor = false; } else if (newZoomFactor == zoomFactorArray[i]) { newZoomFactorPosition = i; addNewZoomFactor = false; } zoomFactorList << formatZoomFactor(zoomFactorArray[i]); } if (addNewZoomFactor) { zoomFactorList << formatZoomFactor(newZoomFactor); newZoomFactorPosition = zoomFactorNumber; } disconnect(this, SIGNAL(triggered(QString)), this, SLOT(setZoomFactor(QString))); removeAllActions(); setItems(zoomFactorList); if (newZoomFactorPosition >= 0) setCurrentItem(newZoomFactorPosition); connect(this, SIGNAL(triggered(QString)), this, SLOT(setZoomFactor(QString))); }
void WebContentManager::updateItemsState(QByteArray &values) { Items::Data::ESortOrder itemSortOrder; Qt::SortOrder sortOrder; if(values.isEmpty()) { itemSortOrder = Items::Data::ETypeName; sortOrder = Qt::AscendingOrder; panel->header()->setSortIndicator(0, sortOrder); } else { panel->header()->restoreState(values); itemSortOrder = static_cast<Items::Data::ESortOrder> (panel->header()->sortIndicatorSection()); sortOrder = static_cast<Qt::SortOrder> (panel->header()->sortIndicatorOrder()); } setItems(itemSortOrder, sortOrder); }
void KoZoomAction::init() { setEditable( true ); QStringList values; values << i18n("%1%").arg("33"); values << i18n("%1%").arg("50"); values << i18n("%1%").arg("75"); values << i18n("%1%").arg("100"); values << i18n("%1%").arg("125"); values << i18n("%1%").arg("150"); values << i18n("%1%").arg("200"); values << i18n("%1%").arg("250"); values << i18n("%1%").arg("350"); values << i18n("%1%").arg("400"); values << i18n("%1%").arg("450"); values << i18n("%1%").arg("500"); setItems( values ); setCurrentItem( values.findIndex( i18n("%1%").arg( 100 ) ) ); connect( this, SIGNAL( activated( const QString& ) ), SLOT( activated( const QString& ) ) ); }
/****************************************************************************** * Completely rebuilds the modifier list. ******************************************************************************/ void ModificationListModel::refreshList() { _needListUpdate = false; // Determine the currently selected object and // select it again after the list has been rebuilt (and it is still there). // If _currentObject is already non-NULL then the caller // has specified an object to be selected. if(_nextToSelectObject == nullptr) { ModificationListItem* item = selectedItem(); if(item) _nextToSelectObject = item->object(); } RefTarget* defaultObjectToSelect = nullptr; // Collect all selected ObjectNodes. // Also check if all selected object nodes reference the same data object. _selectedNodes.clear(); DataObject* cmnObject = nullptr; if(_datasetContainer.currentSet()) { for(SceneNode* node : _datasetContainer.currentSet()->selection()->nodes()) { if(ObjectNode* objNode = dynamic_object_cast<ObjectNode>(node)) { _selectedNodes.push_back(objNode); if(cmnObject == nullptr) cmnObject = objNode->dataProvider(); else if(cmnObject != objNode->dataProvider()) { cmnObject = nullptr; break; // The scene nodes are not compatible. } } } } QList<OORef<ModificationListItem>> items; QList<OORef<ModificationListItem>> hiddenItems; if(cmnObject) { // Create list items for display objects. for(ObjectNode* objNode : _selectedNodes.targets()) { for(DisplayObject* displayObj : objNode->displayObjects()) items.push_back(new ModificationListItem(displayObj)); } if(!items.empty()) items.push_front(new ModificationListItem(nullptr, false, tr("Display"))); // Walk up the pipeline. do { OVITO_CHECK_OBJECT_POINTER(cmnObject); // Create entries for the modifier applications if this is a PipelineObject. PipelineObject* modObj = dynamic_object_cast<PipelineObject>(cmnObject); if(modObj) { if(!modObj->modifierApplications().empty()) items.push_back(new ModificationListItem(nullptr, false, tr("Modifications"))); hiddenItems.push_back(new ModificationListItem(modObj)); for(int i = modObj->modifierApplications().size(); i--; ) { ModifierApplication* app = modObj->modifierApplications()[i]; ModificationListItem* item = new ModificationListItem(app->modifier()); item->setModifierApplications({1, app}); items.push_back(item); // Create list items for the modifier's editable sub-objects. for(int j = 0; j < app->modifier()->editableSubObjectCount(); j++) { RefTarget* subobject = app->modifier()->editableSubObject(j); if(subobject != NULL && subobject->isSubObjectEditable()) { items.push_back(new ModificationListItem(subobject, true)); } } } cmnObject = modObj->sourceObject(); } else { items.push_back(new ModificationListItem(nullptr, false, tr("Input"))); // Create an entry for the data object. items.push_back(new ModificationListItem(cmnObject)); if(defaultObjectToSelect == nullptr) defaultObjectToSelect = cmnObject; // Create list items for the object's editable sub-objects. for(int i = 0; i < cmnObject->editableSubObjectCount(); i++) { RefTarget* subobject = cmnObject->editableSubObject(i); if(subobject != NULL && subobject->isSubObjectEditable()) { items.push_back(new ModificationListItem(subobject, true)); } } break; } } while(cmnObject != nullptr); } int selIndex = -1; int selDefaultIndex = -1; for(int i = 0; i < items.size(); i++) { if(_nextToSelectObject && _nextToSelectObject == items[i]->object()) selIndex = i; if(defaultObjectToSelect && defaultObjectToSelect == items[i]->object()) selDefaultIndex = i; } if(selIndex == -1) selIndex = selDefaultIndex; setItems(items, hiddenItems); _nextToSelectObject = nullptr; // Select the proper item in the list box. if(!items.empty()) { if(selIndex == -1) { for(int index = 0; index < items.size(); index++) { if(items[index]->object()) { selIndex = index; break; } } } _selectionModel->select(index(selIndex), QItemSelectionModel::SelectCurrent | QItemSelectionModel::Clear); } else { Q_EMIT selectedItemChanged(); } }