void DeviceTree::PopulateTree(DiSEqCDevDevice *node, DiSEqCDevDevice *parent, uint childnum, uint depth) { QString indent; indent.fill(' ', 8 * depth); if (node) { QString id = QString::number(node->GetDeviceID()); addSelection(indent + node->GetDescription(), id); uint num_ch = node->GetChildCount(); for (uint ch = 0; ch < num_ch; ch++) PopulateTree(node->GetChild(ch), node, ch, depth+1); } else { QString id; if (parent) id = QString::number(parent->GetDeviceID()); id += ":" + QString::number(childnum); addSelection(indent + "(Unconnected)", id); } }
void fillSelections(void) { addSelection(QCoreApplication::translate("(ChannelSettings)", "[Not Selected]"), "0"); MSqlQuery query(MSqlQuery::InitCon()); query.prepare("SELECT name, sourceid " "FROM videosource " "ORDER BY sourceid"); if (!query.exec() || !query.isActive()) { MythDB::DBError("Source::fillSelections", query); } else { for (uint i = 1; query.next(); i++) { sourceid_to_index[query.value(1).toUInt()] = i; addSelection(query.value(0).toString(), query.value(1).toString()); } } sourceid_to_index[0] = 0; // Not selected entry. }
void OptionThemeStyle::Reload() { selections.clear(); addSelection("Dynamic"); map<string, WStyle*>::iterator it; StyleManager * sm = options.getStyleMan(); for (it = sm->styles.begin(); it != sm->styles.end(); it++) addSelection(it->first); }
SCRPositionSetting(DiSEqCDevDevice &node, DiSEqCDevSettings &settings) : ComboBoxSetting(this), m_node(node), m_settings(settings) { setLabel("Position"); setHelpText(DeviceTree::tr("Unicable satellite position (A/B)")); addSelection(DiSEqCDevSCR::SCRPositionToString(DiSEqCDevSCR::kTypeScrPosA), QString::number((uint)DiSEqCDevSCR::kTypeScrPosA), true); addSelection(DiSEqCDevSCR::SCRPositionToString(DiSEqCDevSCR::kTypeScrPosB), QString::number((uint)DiSEqCDevSCR::kTypeScrPosB), false); }
RotorTypeSetting(DiSEqCDevRotor &rotor) : ComboBoxSetting(this), m_rotor(rotor) { setLabel(DeviceTree::tr("Rotor Type")); setHelpText(DeviceTree::tr("Select the type of rotor from the list.")); addSelection(DeviceTree::tr("DiSEqC 1.2"), QString::number((uint) DiSEqCDevRotor::kTypeDiSEqC_1_2)); addSelection(DeviceTree::tr("DiSEqC 1.3 (GotoX/USALS)"), QString::number((uint) DiSEqCDevRotor::kTypeDiSEqC_1_3)); }
DeviceTypeSetting(DiSEqCDevDevice &device) : ComboBoxSetting(this), m_device(device) { setLabel(DeviceTree::tr("Device Type")); addSelection(DeviceTree::tr("Switch"), QString::number((uint) DiSEqCDevDevice::kTypeSwitch)); addSelection(DeviceTree::tr("Rotor"), QString::number((uint) DiSEqCDevDevice::kTypeRotor)); addSelection(DeviceTree::tr("LNB"), QString::number((uint) DiSEqCDevDevice::kTypeLNB)); }
LNBPresetSetting(DiSEqCDevLNB &lnb) : ComboBoxSetting(this), m_lnb(lnb) { setLabel(DeviceTree::tr("LNB Preset")); QString help = DeviceTree::tr( "Select the LNB preset from the list, or choose " "'Custom' and set the advanced settings below."); setHelpText(help); uint i = 0; for (; !lnb_presets[i].name.isEmpty(); i++) addSelection(lnb_presets[i].name, QString::number(i)); addSelection(DeviceTree::tr("Custom"), QString::number(i)); }
ChannelTVFormat::ChannelTVFormat(const ChannelID &id) : ComboBoxSetting(this), ChannelDBStorage(this, id, "tvformat") { setLabel(QCoreApplication::translate("(ChannelSettings)", "TV Format")); setHelpText(QCoreApplication::translate("(ChannelSettings)", "If this channel uses a format other than TV Format in the General " "Backend Setup screen, set it here.")); addSelection(QCoreApplication::translate("(Common)", "Default"), "Default"); QStringList list = GetFormats(); for (int i = 0; i < list.size(); i++) addSelection(list[i]); }
SwitchTypeSetting(DiSEqCDevSwitch &switch_dev) : ComboBoxSetting(this), m_switch(switch_dev) { setLabel(DeviceTree::tr("Switch Type")); setHelpText(DeviceTree::tr("Select the type of switch from the list.")); addSelection(DeviceTree::tr("Tone"), QString::number((uint) DiSEqCDevSwitch::kTypeTone)); addSelection(DeviceTree::tr("Voltage"), QString::number((uint) DiSEqCDevSwitch::kTypeVoltage)); addSelection(DeviceTree::tr("Mini DiSEqC"), QString::number((uint) DiSEqCDevSwitch::kTypeMiniDiSEqC)); addSelection(DeviceTree::tr("DiSEqC"), QString::number((uint) DiSEqCDevSwitch::kTypeDiSEqCCommitted)); addSelection(DeviceTree::tr("DiSEqC (Uncommitted)"), QString::number((uint) DiSEqCDevSwitch::kTypeDiSEqCUncommitted)); addSelection(DeviceTree::tr("Legacy SW21"), QString::number((uint) DiSEqCDevSwitch::kTypeLegacySW21)); addSelection(DeviceTree::tr("Legacy SW42"), QString::number((uint) DiSEqCDevSwitch::kTypeLegacySW42)); addSelection(DeviceTree::tr("Legacy SW64"), QString::number((uint) DiSEqCDevSwitch::kTypeLegacySW64)); }
ChannelTVFormat::ChannelTVFormat(const ChannelID &id) : ComboBoxSetting(this), ChannelDBStorage(this, id, "tvformat") { setLabel(QObject::tr("TV Format")); setHelpText( QObject::tr( "If this channel uses a format other than TV " "Format in the General Backend Setup screen, set it here.")); addSelection(QObject::tr("Default"), "Default"); QStringList list = GetFormats(); for (uint i = 0; i < list.size(); i++) addSelection(list[i]); }
LNBTypeSetting(DiSEqCDevLNB &lnb) : ComboBoxSetting(this), m_lnb(lnb) { setLabel(DeviceTree::tr("LNB Type")); setHelpText(DeviceTree::tr("Select the type of LNB from the list.")); addSelection(DeviceTree::tr("Legacy (Fixed)"), QString::number((uint) DiSEqCDevLNB::kTypeFixed)); addSelection(DeviceTree::tr("Standard (Voltage)"), QString::number((uint) DiSEqCDevLNB:: kTypeVoltageControl)); addSelection(DeviceTree::tr("Universal (Voltage & Tone)"), QString::number((uint) DiSEqCDevLNB:: kTypeVoltageAndToneControl)); addSelection(DeviceTree::tr("Bandstacked"), QString::number((uint) DiSEqCDevLNB::kTypeBandstacked)); }
void load() { MSqlQuery query(MSqlQuery::InitCon()); query.prepare("SELECT name, sourceid FROM videosource"); if (query.exec() && query.isActive() && query.size() > 0) { while(query.next()) { addSelection(query.value(0).toString(), query.value(1).toString()); } } addSelection(QObject::tr("(Unassigned)"),"Unassigned"); }
void MythTerminal::AddText(const QString &_str) { QMutexLocker locker(&lock); QString str = _str; while (str.length()) { int nlf = str.indexOf("\r\n"); nlf = (nlf < 0) ? str.indexOf("\r") : nlf; nlf = (nlf < 0) ? str.indexOf("\n") : nlf; QString curStr = (nlf >= 0) ? str.left(nlf) : str; if (curStr.length()) { curLabel += curStr; ReplaceLabel(curLabel, QString::number(curValue)); } if (nlf >= 0) { addSelection(curLabel = "", QString::number(++curValue)); str = str.mid(nlf + 1); } else { str = ""; } } if (lbwidget) { lbwidget->setEnabled(true); lbwidget->setFocus(); lbwidget->setCurrentRow(lbwidget->count() - 1); } }
Zone::Zone(std::vector<VolumeSelection*> Volumes) { for (int i =0; i < Volumes.size(); i++) { addSelection(Volumes[i]); } }
void fillSelections(void) { clearSelections(); QString xmltvFile = GetConfDir() + '/' + sourceName + ".xmltv"; if (QFile::exists(xmltvFile)) { QFile file(xmltvFile); if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) return; QStringList idList; while (!file.atEnd()) { QByteArray line = file.readLine(); if (line.startsWith("channel=")) { QString id = line.mid(8, -1).trimmed(); idList.append(id); } } idList.sort(); for (int x = 0; x < idList.size(); x++) addSelection(idList.at(x), idList.at(x)); } }
void ListSelections::setProjectionList( ListProjections* l ) { m_lpListProjections = l; CatalogInstance* lpCatalog = NULL; lpCatalog = CatalogInstance::getCatalog(); //new CatalogInstance(); if (lpCatalog == NULL) parser_error("Unable to create Catalog."); if( m_iSelectAll ) { m_iSelectAll = 0; list<Projection*> lp = m_lpListProjections->getProjections(); for( list<Projection*>::iterator i = lp.begin(); i != lp.end(); i++ ) { Projection* p = (*i); string name = p->getAlias(); if( name == "" ) { name = p->get(); } vector<string>* lpListColumnNames = lpCatalog->getColumnNames(p->get()); for(vector<string>::iterator i = lpListColumnNames->begin(); i != lpListColumnNames->end(); ++i) { EColumn* col = EColumn::create(name, *i); EHolder* lpHolder = EHolder::create(col); addSelection(lpHolder); } } } }
void EditInteraction::snapMousePressEvent(QMouseEvent * ev, Feature* aLast) { Qt::KeyboardModifiers modifiers = ev->modifiers(); if (!view()->isSelectionLocked()) { if (modifiers) { if (modifiersForToggle(modifiers) && aLast) PROPERTIES(toggleSelection(aLast)); if (modifiersForAdd(modifiers) && aLast) PROPERTIES(addSelection(aLast)); if (g_Merk_Segment_Mode && aLast) { PROPERTIES(setSelection(aLast)); } } else { StackSnap = SnapList; // if (aLast) // PROPERTIES(setSelection(aLast)); } if (!aLast && modifiersForDrag(modifiers)) { EndDrag = StartDrag = XY_TO_COORD(ev->pos()); Dragging = true; } PROPERTIES(checkMenuStatus()); view()->update(); } }
// Replace some text. void QsciAccessibleScintillaBase::replaceText(int startOffset, int endOffset, const QString &text) { QsciScintillaBase *sb = sciWidget(); addSelection(startOffset, endOffset); sb->SendScintilla(QsciScintillaBase::SCI_REPLACESEL, textAsBytes(sb, text).constData()); }
OptionTheme::OptionTheme(OptionThemeStyle * style) : OptionDirectory("themes", Options::ACTIVE_THEME, "Current Theme", DIRTESTER) { addSelection("Default"); sort(selections.begin(), selections.end()); initSelections(); mFocus = false; bChecked = false; ts = style; }
void Dropdown::addSelection(std::string label) { int id = 0; if (!_selectionOptions.empty()) { for (auto sel : _selectionOptions) { id = std::max(id, sel.id); } id++; } addSelection(id, label); }
virtual void Load(void) { clearSelections(); uint_to_dbl_t::const_iterator it; for (it = m_posmap.begin(); it != m_posmap.end(); ++it) addSelection(AngleToString(*it), QString::number(*it)); double angle = m_settings.GetValue(m_node.GetDeviceID()); setValue(getValueIndex(QString::number(angle))); }
GameType(const MythGamePlayerSettings &parent) : ComboBoxSetting(this), GameDBStorage(this, parent, "gametype") { setLabel(QObject::tr("Type")); for (int i = 0; i < MAX_GAME_TYPES; i++) { addSelection(GameTypeList[i].nameStr, GameTypeList[i].idStr); } setValue(0); setHelpText(QObject::tr("Type of Game/Emulator. Mostly for informational purposes and has little effect on the function of your system.")); };
OptionProfile::OptionProfile(GameApp * _app, JGuiListener * jgl) : OptionDirectory("profiles/", Options::ACTIVE_PROFILE, "Profile", DIRTESTER) { app = _app; listener = jgl; height = 60; addSelection("Default"); sort(selections.begin(), selections.end()); mFocus = false; initSelections(); populate(); }
void k9MenuEditor::contentsMousePressEvent(QMouseEvent* e) { QPoint p = inverseWorldMatrix().map(e->pos()); moving_start = p; QCanvasItemList l=canvas()->collisions(p); moving=0; for (QCanvasItemList::Iterator it=l.begin(); it!=l.end(); ++it) { QCanvasItem *item=*it; if (item->rtti()==QCanvasItem::Rtti_Rectangle) moving = item; if (item->rtti()>2000) { moving=item; return; } } if (moving) return; for (QCanvasItemList::Iterator it=l.begin(); it!=l.end(); ++it) { // if ((*it)->rtti()==QCanvasItem::Rtti_Rectangle) // continue; moving = *it; if (moving->rtti()==1000) { if (e->state() & QMouseEvent::ControlButton) addSelection(moving); else { if (!isSelected(moving)) { clearSelection(); addSelection(moving); } } m_canvasSelection->setPosition(p); m_canvasSelection->drawSelection(); } else if (moving->rtti() <1001 ) clearSelection(); emit itemSelected(); return; } m_canvasSelection->setPosition(p); clearSelection(); emit itemSelected(); }
//OptionDirectory void OptionDirectory::Reload() { vector<string> subfolders = JFileSystem::GetInstance()->scanfolder(root); for (size_t i = 0; i < subfolders.size(); ++i) { string filename = root + "/" + subfolders[i] + "/" + type; if (!JFileSystem::GetInstance()->FileExists(filename)) continue; if (find(selections.begin(), selections.end(), subfolders[i]) == selections.end()) addSelection(subfolders[i]); } initSelections(); }
void k9MenuEditor::contentsMouseMoveEvent(QMouseEvent* e) { updateCursor(e); if ( moving && (e->state() & Qt::LeftButton ==Qt::LeftButton) ) { if (moving->rtti() !=QCanvasItem::Rtti_Text || moving==m_menu->getText()) { QPoint p = inverseWorldMatrix().map(e->pos()); int offsetX=p.x() - moving_start.x(); int offsetY=p.y() - moving_start.y(); moving_start = p; if (moving->rtti()==1000 || moving->rtti() == QCanvasItem::Rtti_Rectangle) { for (k9MenuButton *b=m_selection.first();b;b=m_selection.next()) { k9CanvasSprite*spr=b->getSprite(); spr->moveBy(offsetX,offsetY); spr->update(); } } else moving->moveBy(offsetX,offsetY); if (moving->rtti() >2001 && moving->rtti() <2010) { k9CanvasSelectionRedim *ssr=(k9CanvasSelectionRedim*)moving; ssr->updateSelection(); } else if (moving->rtti() != QCanvasItem::Rtti_Text ){ //if selection not resized, move the selection m_canvasSelection->moveBy(offsetX,offsetY); m_canvasSelection->update(); } if (moving==m_menu->getText()) emit m_menu->updateTextPos(QPoint(moving->x(),moving->y())); canvas()->update(); } } else if ((e->state() & Qt::LeftButton) ==Qt::LeftButton ) { m_canvasSelection->hide(); canvas()->update(); QPoint p = inverseWorldMatrix().map(e->pos()); int offsetX=p.x() - moving_start.x(); int offsetY=p.y() - moving_start.y(); m_canvasSelection->setSize(offsetX,offsetY); m_canvasSelection->show(); canvas()->update(); clearSelection(); QCanvasItemList l=canvas()->collisions(m_canvasSelection->getRect()); for (QCanvasItemList::Iterator it=l.begin(); it!=l.end(); ++it) { QCanvasItem *item = *it; if (item->rtti()==1000) { addSelection(item); } } } }
void AudioDeviceComboBox::AudioRescan() { AudioOutput::ADCVect &vect = m_parent->AudioDeviceVect(); AudioOutput::ADCVect::const_iterator it; if (vect.empty()) return; QString value = getValue(); clearSelections(); resetMaxCount(vect.size()); bool found = false; for (it = vect.begin(); it != vect.end(); it++) addSelection(it->name, it->name, value == it->name ? (found = true) : false); if (!found) { resetMaxCount(vect.size()+1); addSelection(value, value, true); } // For some reason, it adds an empty entry, remove it removeSelection(QString::null); }
explicit GameType(const PlayerId &parent) : MythUIComboBoxSetting(new GameDBStorage(this, parent, "gametype")) { //: Game type setLabel(TR("Type")); for (int i = 0; i < MAX_GAME_TYPES; i++) { addSelection(QCoreApplication::translate("(GameTypes)", GameTypeList[i].nameStr.toUtf8()), GameTypeList[i].idStr); } setValue(0); setHelpText(TR("Type of Game/Emulator. Mostly for informational " "purposes and has little effect on the " "function of your system.")); }
void RotorPosMap::PopulateList(void) { int old_sel = getValueIndex(getValue()); clearSelections(); uint num_pos = 64; for (uint pos = 1; pos < num_pos; pos++) { uint_to_dbl_t::const_iterator it = m_posmap.find(pos); QString posval = DeviceTree::tr("None"); if (it != m_posmap.end()) posval = AngleToString(*it); addSelection(DeviceTree::tr("Position #%1 (%2)").arg(pos).arg(posval), QString::number(pos)); } setCurrentItem(old_sel); }
SwitchSetting(DiSEqCDevDevice &node, DiSEqCDevSettings &settings) : ComboBoxSetting(this), m_node(node), m_settings(settings) { setLabel(node.GetDescription()); setHelpText(DeviceTree::tr("Choose a port to use for this switch.")); uint num_children = node.GetChildCount(); for (uint ch = 0; ch < num_children; ch++) { QString val = QString("%1").arg(ch); QString descr = DeviceTree::tr("Port %1").arg(ch+1); DiSEqCDevDevice *child = node.GetChild(ch); if (child) descr += QString(" (%2)").arg(child->GetDescription()); addSelection(descr, val); } }