void KDModule::propagateUsers() { groupmap.clear(); emit clearUsers(); QMap< QString, int > lusers; QMapConstIterator< QString, QPair< int, QStringList > > it; QStringList::ConstIterator jt; QMap< QString, int >::Iterator gmapi; for(it = usermap.begin(); it != usermap.end(); ++it) { int uid = it.data().first; if(!uid || (uid >= minshowuid && uid <= maxshowuid)) { lusers[it.key()] = uid; for(jt = it.data().second.begin(); jt != it.data().second.end(); ++jt) if((gmapi = groupmap.find(*jt)) == groupmap.end()) { groupmap[*jt] = 1; lusers['@' + *jt] = -uid; } else (*gmapi)++; } } emit addUsers(lusers); updateOK = true; }
void ODateBookAccessBackend_SQL::initFields() { // This map contains the translation of the fieldtype id's to // the names of the table columns m_fieldMap.insert( OEvent::FUid, "uid" ); m_fieldMap.insert( OEvent::FCategories, "Categories" ); m_fieldMap.insert( OEvent::FDescription, "Description" ); m_fieldMap.insert( OEvent::FLocation, "Location" ); m_fieldMap.insert( OEvent::FType, "Type" ); m_fieldMap.insert( OEvent::FAlarm, "Alarm" ); m_fieldMap.insert( OEvent::FSound, "Sound" ); m_fieldMap.insert( OEvent::FRType, "RType" ); m_fieldMap.insert( OEvent::FRWeekdays, "RWeekdays" ); m_fieldMap.insert( OEvent::FRPosition, "RPosition" ); m_fieldMap.insert( OEvent::FRFreq, "RFreq" ); m_fieldMap.insert( OEvent::FRHasEndDate, "RHasEndDate" ); m_fieldMap.insert( OEvent::FREndDate, "REndDate" ); m_fieldMap.insert( OEvent::FRCreated, "RCreated" ); m_fieldMap.insert( OEvent::FRExceptions, "RExceptions" ); m_fieldMap.insert( OEvent::FStart, "Start" ); m_fieldMap.insert( OEvent::FEnd, "End" ); m_fieldMap.insert( OEvent::FNote, "Note" ); m_fieldMap.insert( OEvent::FTimeZone, "TimeZone" ); m_fieldMap.insert( OEvent::FRecParent, "RecParent" ); m_fieldMap.insert( OEvent::FRecChildren, "Recchildren" ); // Create a map that maps the column name to the id QMapConstIterator<int, QString> it; for ( it = ++m_fieldMap.begin(); it != m_fieldMap.end(); ++it ){ m_reverseFieldMap.insert( it.data(), it.key() ); } }
const void * KFileItem::extraData( const void *key ) const { QMapConstIterator<const void*,void*> it = m_extra.find( key ); if ( it != m_extra.end() ) return it.data(); return 0L; }
QString ParserData::keywordToString(Parse::Keyword k) const { for (QMapConstIterator<QString, Keyword> it = m_keywords.begin(); it != m_keywords.end(); ++it) if (it.data() == k) return it.key(); return QString(); }
int KMacroMapExpander<QString,VT>::expandEscapedMacro( const QString &str, uint pos, QStringList &ret ) { if (str[pos + 1] == escapeChar()) { ret += QString( escapeChar() ); return 2; } uint sl, rsl, rpos; if (str[pos + 1] == '{') { rpos = pos + 2; for (sl = 0; str[rpos + sl] != '}'; sl++) if (rpos + sl >= str.length()) return 0; rsl = sl + 3; } else { rpos = pos + 1; for (sl = 0; isIdentifier( str[rpos + sl].unicode() ); sl++); rsl = sl + 1; } if (!sl) return 0; QMapConstIterator<QString,VT> it = macromap.find( QConstString( str.unicode() + rpos, sl ).string() ); if (it != macromap.end()) { ret += it.data(); return rsl; } return 0; }
void KDModule::slotMinMaxUID(int min, int max) { if(updateOK) { QMap< QString, int > alusers, dlusers; QMapConstIterator< QString, QPair< int, QStringList > > it; QStringList::ConstIterator jt; QMap< QString, int >::Iterator gmapi; for(it = usermap.begin(); it != usermap.end(); ++it) { int uid = it.data().first; if(!uid) continue; if((uid >= minshowuid && uid <= maxshowuid) && !(uid >= min && uid <= max)) { dlusers[it.key()] = uid; for(jt = it.data().second.begin(); jt != it.data().second.end(); ++jt) { gmapi = groupmap.find(*jt); if(!--(*gmapi)) { groupmap.remove(gmapi); dlusers['@' + *jt] = -uid; } } } else if((uid >= min && uid <= max) && !(uid >= minshowuid && uid <= maxshowuid)) { alusers[it.key()] = uid; for(jt = it.data().second.begin(); jt != it.data().second.end(); ++jt) if((gmapi = groupmap.find(*jt)) == groupmap.end()) { groupmap[*jt] = 1; alusers['@' + *jt] = -uid; } else (*gmapi)++; } } emit delUsers(dlusers); emit addUsers(alusers); } minshowuid = min; maxshowuid = max; }
int KMacroMapExpander<QChar,VT>::expandPlainMacro( const QString &str, uint pos, QStringList &ret ) { QMapConstIterator<QChar,VT> it = macromap.find(str[pos]); if (it != macromap.end()) { ret += it.data(); return 1; } return 0; }
void KTouchStatistics::run(const KURL& currentLecture, const KTouchStatisticsData& stats, const KTouchLevelStats& currLevelStats, const KTouchSessionStats& currSessionStats) { // kdDebug() << "[KTouchStatistics::run]" << endl; // kdDebug() << " currentLecture = '" << currentLecture << "'" << endl; // fill lecture combo with data // loop over all lecturestatistics lectureCombo->clear(); QMapConstIterator<KURL, KTouchLectureStats> it = stats.m_lectureStats.begin(); m_currentIndex = 0; while (it != stats.m_lectureStats.end()) { QString t = it.data().m_lectureTitle; // if current lecture, remember index and adjust text if (it.key() == currentLecture || currentLecture.isEmpty() && it.key().url()=="default") { m_currentIndex = lectureCombo->count(); if (t == "default") t = i18n("Default level..."); lectureLabel1->setText(t); lectureLabel2->setText(t); t = i18n("***current*** ") + t; } lectureCombo->insertItem(t); ++it; } if (lectureCombo->count()==0) { // this shouldn't happen if the dialog is run with proper data KMessageBox::information(this, i18n("No statistics data available yet!")); return; } // remember stats m_allStats = stats; m_currLevelStats = currLevelStats; m_currSessionStats = currSessionStats; // modify current lecture entry lectureCombo->setCurrentItem(m_currentIndex); lectureActivated(m_currentIndex); m_lectureIndex = m_currentIndex; // update the current tabs with current session/level data updateCurrentSessionTab(); updateCurrentLevelTab(); // set current session as current tab tabWidget->showPage(currentTab); exec(); }
int KMacroMapExpander<QChar,VT>::expandEscapedMacro( const QString &str, uint pos, QStringList &ret ) { if (str[pos + 1] == escapeChar()) { ret += QString( escapeChar() ); return 2; } QMapConstIterator<QChar,VT> it = macromap.find(str[pos+1]); if (it != macromap.end()) { ret += it.data(); return 2; } return 0; }
int KMacroMapExpander<QString,VT>::expandPlainMacro( const QString &str, uint pos, QStringList &ret ) { if (isIdentifier( str[pos - 1].unicode() )) return 0; uint sl; for (sl = 0; isIdentifier( str[pos + sl].unicode() ); sl++); if (!sl) return 0; QMapConstIterator<QString,VT> it = macromap.find( QConstString( str.unicode() + pos, sl ).string() ); if (it != macromap.end()) { ret += it.data(); return sl; } return 0; }
void Template::compose( const TemplateManager & tm ) { QMapConstIterator <QString, QString> i = const_cast<QMap<QString, QString> &>( d->requestedNestedTemplates).begin(); for( ; i != const_cast<QMap<QString, QString> &>( d->requestedNestedTemplates).end(); ++i ) { //try to acquire template of a given type Template * t = tm.instantiate( i.data(), getLoggerPtr(), d->requestedNestedTemplateLibs[ i.key() ] ); if( t != NULL ) { // recursively compose even our nested templates t->compose( tm ); // and put our template to our internal hash registerNestedTemplate( i.key(), t ); } } }
void K3bVideoDVDRippingDialog::slotStartClicked() { // // check if the selected audio codec is usable for all selected audio streams // We can only use the AC3 pass-through mode for AC3 streams // if( m_w->selectedAudioCodec() == K3bVideoDVDTitleTranscodingJob::AUDIO_CODEC_AC3_PASSTHROUGH ) { for( QMap<QCheckListItem*, K3bVideoDVDRippingJob::TitleRipInfo>::iterator it = m_titleRipInfos.begin(); it != m_titleRipInfos.end(); ++it ) { if( m_dvd[it.data().title-1].numAudioStreams() > 0 && m_dvd[it.data().title-1].audioStream(it.data().audioStream).format() != K3bVideoDVD::AUDIO_FORMAT_AC3 ) { KMessageBox::sorry( this, i18n("<p>When using the <em>AC3 pass-through</em> audio codec all selected audio " "streams need to be in AC3 format. Please select another audio codec or " "choose AC3 audio streams for all ripped titles."), i18n("AC3 Pass-through") ); return; } } } // check if we need to overwrite some files... QStringList filesToOverwrite; for( QMap<QCheckListItem*, K3bVideoDVDRippingJob::TitleRipInfo>::iterator it = m_titleRipInfos.begin(); it != m_titleRipInfos.end(); ++it ) { if( QFile::exists( it.data().filename ) ) filesToOverwrite.append( it.data().filename ); } if( !filesToOverwrite.isEmpty() ) if( KMessageBox::questionYesNoList( this, i18n("Do you want to overwrite these files?"), filesToOverwrite, i18n("Files Exist"), i18n("Overwrite"), KStdGuiItem::cancel() ) == KMessageBox::No ) return; QSize videoSize = m_w->selectedPictureSize(); int i = 0; QValueVector<K3bVideoDVDRippingJob::TitleRipInfo> titles( m_titleRipInfos.count() ); for( QMapConstIterator<QCheckListItem*, K3bVideoDVDRippingJob::TitleRipInfo> it = m_titleRipInfos.begin(); it != m_titleRipInfos.end(); ++it ) { titles[i] = it.data(); titles[i].videoBitrate = 0; // use the global bitrate set below titles[i].width = videoSize.width(); titles[i].height = videoSize.height(); ++i; } // sort the titles which come from a map and are thus not sorted properly // simple bubble sort for these small arrays is sufficient for( unsigned int i = 0; i < titles.count(); ++i ) { for( unsigned int j = i+1; j < titles.count(); ++j ) { if( titles[i].title > titles[j].title ) { K3bVideoDVDRippingJob::TitleRipInfo tmp = titles[i]; titles[i] = titles[j]; titles[j] = tmp; } } } // start the job K3bJobProgressDialog dlg( parentWidget() ); K3bVideoDVDRippingJob* job = new K3bVideoDVDRippingJob( &dlg, &dlg ); job->setVideoDVD( m_dvd ); job->setTitles( titles ); job->setVideoBitrate( m_w->m_spinVideoBitrate->value() ); job->setTwoPassEncoding( m_w->m_checkTwoPassEncoding->isChecked() ); job->setResampleAudioTo44100( m_w->m_checkAudioResampling->isChecked() ); job->setAutoClipping( m_w->m_checkAutoClipping->isChecked() ); job->setVideoCodec( m_w->selectedVideoCodec() ); job->setAudioCodec( m_w->selectedAudioCodec() ); job->setLowPriority( m_w->m_checkLowPriority->isChecked() ); job->setAudioBitrate( m_w->selectedAudioBitrate() ); job->setAudioVBR( m_w->m_checkAudioVBR->isChecked() ); hide(); dlg.startJob( job ); close(); }