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)); } }
int QtTreeSelectionManager::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QObject::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: currentChanged((*reinterpret_cast< const QtTreeModelBase::iterator_base(*)>(_a[1])),(*reinterpret_cast< const QtTreeModelBase::iterator_base(*)>(_a[2]))); break; case 1: anchorChanged((*reinterpret_cast< const QtTreeModelBase::iterator_base(*)>(_a[1])),(*reinterpret_cast< const QtTreeModelBase::iterator_base(*)>(_a[2]))); break; case 2: selectionsChanged((*reinterpret_cast< const QtTreeSelection(*)>(_a[1]))); break; case 3: setCurrentItem((*reinterpret_cast< const QtTreeModelIterator(*)>(_a[1]))); break; case 4: setAnchorItem((*reinterpret_cast< const QtTreeModelIterator(*)>(_a[1]))); break; case 5: setAnchorSelectionMode((*reinterpret_cast< SelectionMode(*)>(_a[1]))); break; case 6: setSelected((*reinterpret_cast< const QtTreeSelection(*)>(_a[1])),(*reinterpret_cast< SelectionMode(*)>(_a[2]))); break; case 7: setSelected((*reinterpret_cast< const QtTreeSelection(*)>(_a[1]))); break; case 8: setAnchorSelection((*reinterpret_cast< const QtTreeSelection(*)>(_a[1]))); break; case 9: clearSelections(); break; case 10: d_func()->_q_modelDestroyed(); break; case 11: d_func()->_q_itemsRemoved((*reinterpret_cast< const QtTreeModelBase::iterator_base(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2]))); break; default: ; } _id -= 12; } return _id; }
void DeviceTree::PopulateTree(void) { int old_sel = getValueIndex(getValue()); clearSelections(); PopulateTree(m_tree.Root()); setCurrentItem(old_sel); }
InfoPanel::InfoPanel(SDL_Surface* backbuf, int numPlayers, bool * isMale) { WIDTH = PANEL_TILE_WIDTH * Map::TILE_WIDTH; HEIGHT = Map::MAP_HEIGHT * Map::TILE_HEIGHT; m_players = numPlayers; for (int i = 0; i < 4; i++) { playerPointer[i] = NULL; } clearSelections(); // set up surface // DDSURFACEDESC2 ddsd; // memset(&ddsd,0,sizeof(ddsd)); // ddsd.dwSize = sizeof(ddsd); // ddsd.dwFlags = DDSD_WIDTH | DDSD_HEIGHT | DDSD_CAPS; // ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | DDSCAPS_VIDEOMEMORY; // ddsd.dwWidth = WIDTH; // ddsd.dwHeight = HEIGHT; // lpdd->CreateSurface(&ddsd, &m_surface, NULL); m_surface = SDL_CreateRGBSurface(0, WIDTH, HEIGHT, backbuf->format->BitsPerPixel, backbuf->format->Rmask, backbuf->format->Gmask, backbuf->format->Bmask, 0); // set up face surfaces for (int i = 0; i < 4; i++) { stringstream ss; ss << "bitmaps/player" << (i + 1); if (isMale[i]) { ss << "male"; } else { ss << "female"; } ss << "face.bmp"; //m_faceSurfaces[i] = DDLoadBitmap(lpdd, ss.str().c_str(), 0, 0); m_faceSurfaces[i] = SDL_LoadBMP(ss.str().c_str()); } //DDCOLORKEY key; //key.dwColorSpaceLowValue = TRANSPARENT_COLOR; //key.dwColorSpaceHighValue = TRANSPARENT_COLOR; // change to team colours and apply color key for (int i = 0; i < 4; ++i) { SDL_SetColorKey( m_faceSurfaces[i], SDL_TRUE, SDL_MapRGB(m_faceSurfaces[i]->format, 0, 255, 255) ); } }
void ItemListItem::handleSelectionChanged() { auto attached = static_cast<ItemListAttached*>(sender()); Q_ASSERT(attached != nullptr); bool clear = false; if (d->selectionMode == SingleSelection) { if (attached->isSelected()) { Q_ASSERT(d->selections.size() < 2); if (d->selections.isEmpty()) d->selections.append(attached); else { d->selections[0]->selection() = false; d->selections[0] = attached; } } else clear = true; } else if (d->selectionMode == MultiSelection) { if (attached->isSelected()) d->selections.append(attached); else d->selections.removeOne(attached); } else clear = true; if (clear) clearSelections(); else { emit selectionsChanged(); forceToUpdateGeometry(); } }
int QtListSelectionManager::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QObject::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: currentChanged((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2]))); break; case 1: anchorChanged((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2]))); break; case 2: selectionsChanged((*reinterpret_cast< const QtListSelectionChange(*)>(_a[1]))); break; case 3: setCurrentItem((*reinterpret_cast< int(*)>(_a[1]))); break; case 4: setAnchorItem((*reinterpret_cast< int(*)>(_a[1]))); break; case 5: setSelected((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2])),(*reinterpret_cast< SelectionMode(*)>(_a[3]))); break; case 6: setSelected((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2]))); break; case 7: setSelected((*reinterpret_cast< int(*)>(_a[1]))); break; case 8: clearSelections(); break; case 9: d_func()->_q_modelDestroyed(); break; case 10: d_func()->_q_itemsInserted((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2]))); break; case 11: d_func()->_q_itemsRemoved((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2]))); break; case 12: d_func()->_q_itemsMoved((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2])),(*reinterpret_cast< int(*)>(_a[3]))); break; default: ; } _id -= 13; } #ifndef QT_NO_PROPERTIES else if (_c == QMetaObject::ReadProperty) { void *_v = _a[0]; switch (_id) { case 0: *reinterpret_cast< int*>(_v) = currentItem(); break; case 1: *reinterpret_cast< bool*>(_v) = isAnchoredSelectionActive(); break; case 2: *reinterpret_cast< SelectionMode*>(_v) = anchoredSelectionMode(); break; } _id -= 3; } else if (_c == QMetaObject::WriteProperty) { void *_v = _a[0]; switch (_id) { case 0: setCurrentItem(*reinterpret_cast< int*>(_v)); break; case 1: setAnchoredSelectionActive(*reinterpret_cast< bool*>(_v)); break; case 2: setAnchoredSelectionMode(*reinterpret_cast< SelectionMode*>(_v)); break; } _id -= 3; } else if (_c == QMetaObject::ResetProperty) { _id -= 3; } else if (_c == QMetaObject::QueryPropertyDesignable) { _id -= 3; } else if (_c == QMetaObject::QueryPropertyScriptable) { _id -= 3; } else if (_c == QMetaObject::QueryPropertyStored) { _id -= 3; } else if (_c == QMetaObject::QueryPropertyEditable) { _id -= 3; } else if (_c == QMetaObject::QueryPropertyUser) { _id -= 3; } #endif // QT_NO_PROPERTIES return _id; }
/************************************************************************* Handler for cursor movement events *************************************************************************/ void ComboDropList::onCursorMove(CursorInputEventArgs& e) { ListWidget::onCursorMove(e); // if cursor is within our area (but not our children) if (isHit(e.position)) { if (!getChildAtPosition(e.position)) { // handle auto-arm if (d_autoArm) { d_armed = true; } if (d_armed) { // check for an item under the cursor StandardItem* item = d_itemModel.getItemForIndex(indexAt(e.position)); // if an item is under cursor, select it if (item != 0) { setIndexSelectionState(item, true); } else { clearSelections(); } } } ++e.handled; } // not within the list area else { // if left cursor is held, clear any selection if (e.state.isHeld(CIS_Left)) { clearSelections(); } } }
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))); }
/************************************************************************* Handler for when input capture is lost *************************************************************************/ void ComboDropList::onCaptureLost(WindowEventArgs& e) { ListWidget::onCaptureLost(e); d_armed = false; hide(); ++e.handled; // ensure 'sticky' selection remains. if (d_lastItemSelected != 0 && isItemSelected(d_lastItemSelected)) { clearSelections(); setIndexSelectionState(d_lastItemSelected, true); } }
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); }
void Project::SetOpenGLPanel(OpenGLPanel *newPanel) { if (newPanel) { glPanel = newPanel; connect(this, SIGNAL(subdomainCreated(QString)), glPanel, SLOT(addSubdomainToMenus(QString))); connect(glPanel, SIGNAL(openColorOptions()), this, SLOT(ShowDisplayOptionsDialog())); connect(glPanel, SIGNAL(matchColors(QAction*)), this, SLOT(MatchColors(QAction*))); connect(glPanel, SIGNAL(matchCamera(QAction*)), this, SLOT(MatchCamera(QAction*))); connect(glPanel, SIGNAL(clearSelections()), this, SLOT(ClearSelections())); for (std::vector<SubDomain*>::iterator it = subDomains.begin(); it != subDomains.end(); ++it) { SubDomain* currSubdomain = *it; emit subdomainCreated(currSubdomain->GetDomainName()); } } }
/************************************************************************* Handler for cursor pressed events *************************************************************************/ void ComboDropList::onCursorPressHold(CursorInputEventArgs& e) { ListWidget::onCursorPressHold(e); if (e.source == CIS_Left) { if (!isHit(e.position)) { clearSelections(); releaseInput(); } else { d_armed = true; } ++e.handled; } }
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); }
void ScanTypeSetting::SetInput(const QString &cardids_inputname) { uint cardid = 0; QString inputname = QString::null; if (!InputSelector::Parse(cardids_inputname, cardid, inputname)) return; // Only refresh if we really have to. If we do it too often // Then we end up fighting the scan routine when we want to // check the type of dvb card :/ if (cardid == hw_cardid) return; hw_cardid = cardid; QString subtype = CardUtil::ProbeSubTypeName(hw_cardid); int nCardType = CardUtil::toInputType(subtype); clearSelections(); switch (nCardType) { case CardUtil::V4L: case CardUtil::MPEG: addSelection(tr("Full Scan"), QString::number(FullScan_Analog), true); addSelection(tr("Import existing scan"), QString::number(ExistingScanImport)); return; case CardUtil::DVBT: addSelection(tr("Full Scan"), QString::number(FullScan_DVBT), true); addSelection(tr("Full Scan (Tuned)"), QString::number(NITAddScan_DVBT)); // addSelection(tr("Import channels.conf"), // QString::number(DVBUtilsImport)); addSelection(tr("Import existing scan"), QString::number(ExistingScanImport)); break; case CardUtil::DVBS: addSelection(tr("Full Scan (Tuned)"), QString::number(NITAddScan_DVBS)); // addSelection(tr("Import channels.conf"), // QString::number(DVBUtilsImport)); addSelection(tr("Import existing scan"), QString::number(ExistingScanImport)); break; case CardUtil::DVBS2: addSelection(tr("Full Scan (Tuned)"), QString::number(NITAddScan_DVBS2)); // addSelection(tr("Import channels.conf"), // QString::number(DVBUtilsImport)); addSelection(tr("Import existing scan"), QString::number(ExistingScanImport)); break; case CardUtil::QAM: addSelection(tr("Full Scan (Tuned)"), QString::number(NITAddScan_DVBC)); addSelection(tr("Full Scan"), QString::number(FullScan_DVBC)); // addSelection(tr("Import channels.conf"), // QString::number(DVBUtilsImport)); addSelection(tr("Import existing scan"), QString::number(ExistingScanImport)); break; case CardUtil::ATSC: addSelection(tr("Full Scan"), QString::number(FullScan_ATSC), true); // addSelection(tr("Import channels.conf"), // QString::number(DVBUtilsImport)); addSelection(tr("Import existing scan"), QString::number(ExistingScanImport)); break; case CardUtil::HDHOMERUN: if (CardUtil::HDHRdoesDVB(CardUtil::GetVideoDevice(cardid))) { addSelection(tr("Full Scan"), QString::number(FullScan_DVBT), true); addSelection(tr("Full Scan (Tuned)"), QString::number(NITAddScan_DVBT)); } else addSelection(tr("Full Scan"), QString::number(FullScan_ATSC), true); // addSelection(tr("Import channels.conf"), // QString::number(DVBUtilsImport)); addSelection(tr("Import existing scan"), QString::number(ExistingScanImport)); break; case CardUtil::VBOX: addSelection(tr("VBox Channel Import"), QString::number(VBoxImport), true); return; case CardUtil::FREEBOX: addSelection(tr("M3U Import with MPTS"), QString::number(IPTVImportMPTS), true); addSelection(tr("M3U Import"), QString::number(IPTVImport), true); return; case CardUtil::ASI: addSelection(tr("ASI Scan"), QString::number(CurrentTransportScan), true); return; case CardUtil::EXTERNAL: addSelection(tr("MPTS Scan"), QString::number(CurrentTransportScan), true); return; case CardUtil::ERROR_PROBE: addSelection(tr("Failed to probe the card"), QString::number(Error_Probe), true); return; default: addSelection(tr("Failed to open the card"), QString::number(Error_Open), true); return; } addSelection(tr("Scan of all existing transports"), QString::number(FullTransportScan)); addSelection(tr("Scan of single existing transport"), QString::number(TransportScan)); }
void ItemListItem::setSelectionMode(SelectionMode mode) { if (_Change(d->selectionMode, mode)) { clearSelections(); emit selectionModeChanged(); } }
int ChannelListSetting::fillSelections(void) { QString currentValue = getValue(); uint currentIndex = max(getValueIndex(currentValue), 0); clearSelections(); addSelection(QObject::tr("(New Channel)"), "0", 0 == currentValue.toUInt()); bool fAllSources = true; QString querystr = "SELECT channel.name,channum,chanid "; if ((currentSourceID.isEmpty()) || (currentSourceID == "Unassigned") || (currentSourceID == "All")) { querystr += ",videosource.name FROM channel " "LEFT JOIN videosource ON " "(channel.sourceid = videosource.sourceid) "; fAllSources = true; } else { querystr += QString("FROM channel WHERE sourceid='%1' ") .arg(currentSourceID); fAllSources = false; } if (currentSortMode == QObject::tr("Channel Name")) { querystr += " ORDER BY channel.name"; } else if (currentSortMode == QObject::tr("Channel Number")) { querystr += " ORDER BY channum + 0"; } MSqlQuery query(MSqlQuery::InitCon()); query.prepare(querystr); uint selidx = 0, idx = 1; if (query.exec() && query.isActive() && query.size() > 0) { for (; query.next() ; idx++) { QString name = QString::fromUtf8(query.value(0).toString()); QString channum = query.value(1).toString(); QString chanid = query.value(2).toString(); QString sourceid = "Unassigned"; if (fAllSources && !query.value(3).toString().isNull()) { sourceid = query.value(3).toString(); if (currentSourceID == "Unassigned") continue; } if (channum == "" && currentHideMode) continue; if (name == "") name = "(Unnamed : " + chanid + ")"; if (currentSortMode == QObject::tr("Channel Name")) { if (channum != "") name += " (" + channum + ")"; } else if (currentSortMode == QObject::tr("Channel Number")) { if (channum != "") name = channum + ". " + name; else name = "???. " + name; } if ((currentSourceID == "") && (currentSourceID != "Unassigned")) name += " (" + sourceid + ")"; bool sel = (chanid == currentValue); selidx = (sel) ? idx : selidx; addSelection(name, chanid, sel); } } // Make sure we select the current item, or the following one after // deletion, with wrap around to "(New Channel)" after deleting last item. setCurrentItem((!selidx && currentIndex < idx) ? currentIndex : selidx); return idx; }
void MultiSelection::setSelection(const Selection &selection) { clearSelections(); addSelection(selection); }