QString KDesktopFile::readName() const { return readEntry("Name"); }
uint64_t getKeyCnt(uint64_t const entryid) const { return readEntry(entryid).kcnt; }
uint64_t getKeyValueCnt(uint64_t const entryid) const { IndexEntry const entry = readEntry(entryid); return entry.kcnt + entry.vcnt; }
KexiCSVExportWizard::KexiCSVExportWizard(const KexiCSVExport::Options& options, QWidget * parent) : K3Wizard(parent) , m_options(options) // , m_mode(mode) // , m_itemId(itemId) , m_fileSavePage(0) , m_defaultsBtn(0) , m_importExportGroup(KGlobal::config()->group("ImportExport")) , m_rowCount(-1) , m_rowCountDetermined(false) , m_cancelled(false) { if (m_options.mode == KexiCSVExport::Clipboard) { finishButton()->setText(i18n("Copy")); backButton()->hide(); } else { finishButton()->setText(i18n("Export")); } helpButton()->hide(); QString infoLblFromText; KexiGUIMessageHandler msgh(this); m_tableOrQuery = new KexiDB::TableOrQuerySchema( KexiMainWindowIface::global()->project()->dbConnection(), m_options.itemId); if (m_tableOrQuery->table()) { if (m_options.mode == KexiCSVExport::Clipboard) { setWindowTitle(i18n("Copy Data From Table to Clipboard")); infoLblFromText = i18n("Copying data from table:"); } else { setWindowTitle(i18n("Export Data From Table to CSV File")); infoLblFromText = i18n("Exporting data from table:"); } } else if (m_tableOrQuery->query()) { if (m_options.mode == KexiCSVExport::Clipboard) { setWindowTitle(i18n("Copy Data From Query to Clipboard")); infoLblFromText = i18n("Copying data from table:"); } else { setWindowTitle(i18n("Export Data From Query to CSV File")); infoLblFromText = i18n("Exporting data from query:"); } } else { msgh.showErrorMessage(KexiMainWindowIface::global()->project()->dbConnection(), i18n("Could not open data for exporting.")); m_cancelled = true; return; } // OK, source data found. // Setup pages // 1. File Save Page if (m_options.mode == KexiCSVExport::File) { m_fileSavePage = new KexiStartupFileWidget( KUrl("kfiledialog:///CSVImportExport"), //startDir KexiStartupFileWidget::Custom | KexiStartupFileWidget::SavingFileBasedDB, this); m_fileSavePage->setObjectName("m_fileSavePage"); m_fileSavePage->setMinimumHeight(kapp->desktop()->availableGeometry().height() / 2); m_fileSavePage->setAdditionalFilters(csvMimeTypes().toSet()); m_fileSavePage->setDefaultExtension("csv"); m_fileSavePage->setLocationText( KexiUtils::stringToFileName(m_tableOrQuery->captionOrName())); connect(m_fileSavePage, SIGNAL(rejected()), this, SLOT(reject())); addPage(m_fileSavePage, i18n("Enter Name of File You Want to Save Data To")); } // 2. Export options m_exportOptionsPage = new QWidget(this); m_exportOptionsPage->setObjectName("m_exportOptionsPage"); QGridLayout *exportOptionsLyr = new QGridLayout(m_exportOptionsPage); exportOptionsLyr->setObjectName("exportOptionsLyr"); m_infoLblFrom = new KexiCSVInfoLabel(infoLblFromText, m_exportOptionsPage); KexiPart::Info *partInfo = Kexi::partManager().infoForClass( QString("org.kexi-project.%1").arg(m_tableOrQuery->table() ? "table" : "query")); if (partInfo) m_infoLblFrom->setIcon(partInfo->itemIcon()); m_infoLblFrom->separator()->hide(); exportOptionsLyr->addWidget(m_infoLblFrom, 0, 0, 0, 2); m_infoLblTo = new KexiCSVInfoLabel( (m_options.mode == KexiCSVExport::File) ? i18n("To CSV file:") : i18n("To clipboard:"), m_exportOptionsPage ); if (m_options.mode == KexiCSVExport::Clipboard) m_infoLblTo->setIcon("edit-paste"); exportOptionsLyr->addWidget(m_infoLblTo, 1, 0, 1, 3); m_showOptionsButton = new KPushButton(KGuiItem(i18n("Show Options >>"), "configure"), m_exportOptionsPage); connect(m_showOptionsButton, SIGNAL(clicked()), this, SLOT(slotShowOptionsButtonClicked())); exportOptionsLyr->addWidget(m_showOptionsButton, 2, 2, 0, 0); m_showOptionsButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); // -<options section> m_exportOptionsSection = new Q3GroupBox(1, Qt::Vertical, i18n("Options"), m_exportOptionsPage); m_exportOptionsSection->setObjectName("m_exportOptionsSection"); m_exportOptionsSection->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); exportOptionsLyr->addWidget(m_exportOptionsSection, 3, 3, 0, 1); QWidget *exportOptionsSectionWidget = new QWidget(m_exportOptionsSection); exportOptionsSectionWidget->setObjectName("exportOptionsSectionWidget"); QGridLayout *exportOptionsSectionLyr = new QGridLayout(exportOptionsSectionWidget); exportOptionsLyr->setObjectName("exportOptionsLyr"); // -delimiter m_delimiterWidget = new KexiCSVDelimiterWidget(false, //!lineEditOnBottom exportOptionsSectionWidget); m_delimiterWidget->setDelimiter(defaultDelimiter()); exportOptionsSectionLyr->addWidget(m_delimiterWidget, 0, 1); QLabel *delimiterLabel = new QLabel(i18n("Delimiter:"), exportOptionsSectionWidget); delimiterLabel->setBuddy(m_delimiterWidget); exportOptionsSectionLyr->addWidget(delimiterLabel, 0, 0); // -text quote QWidget *textQuoteWidget = new QWidget(exportOptionsSectionWidget); QHBoxLayout *textQuoteLyr = new QHBoxLayout(textQuoteWidget); exportOptionsSectionLyr->addWidget(textQuoteWidget, 1, 1); m_textQuote = new KexiCSVTextQuoteComboBox(textQuoteWidget); m_textQuote->setTextQuote(defaultTextQuote()); textQuoteLyr->addWidget(m_textQuote); textQuoteLyr->addStretch(0); QLabel *textQuoteLabel = new QLabel(i18n("Text quote:"), exportOptionsSectionWidget); textQuoteLabel->setBuddy(m_textQuote); exportOptionsSectionLyr->addWidget(textQuoteLabel, 1, 0); // - character encoding m_characterEncodingCombo = new KexiCharacterEncodingComboBox(exportOptionsSectionWidget); m_characterEncodingCombo->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); exportOptionsSectionLyr->addWidget(m_characterEncodingCombo, 2, 1); QLabel *characterEncodingLabel = new QLabel(i18n("Text encoding:"), exportOptionsSectionWidget); characterEncodingLabel->setBuddy(m_characterEncodingCombo); exportOptionsSectionLyr->addWidget(characterEncodingLabel, 2, 0); // - checkboxes m_addColumnNamesCheckBox = new QCheckBox(i18n("Add column names as the first row"), exportOptionsSectionWidget); m_addColumnNamesCheckBox->setChecked(true); exportOptionsSectionLyr->addWidget(m_addColumnNamesCheckBox, 3, 1); //! @todo 1.1: for copying use "Always use above options for copying" string m_alwaysUseCheckBox = new QCheckBox(i18n("Always use above options for exporting"), m_exportOptionsPage); exportOptionsLyr->addWidget(m_alwaysUseCheckBox, 4, 4, 0, 1); // exportOptionsSectionLyr->addWidget( m_alwaysUseCheckBox, 4, 1 ); m_exportOptionsSection->hide(); m_alwaysUseCheckBox->hide(); // -</options section> // exportOptionsLyr->setColumnStretch(3, 1); exportOptionsLyr->addItem( new QSpacerItem(0, 0, QSizePolicy::Preferred, QSizePolicy::MinimumExpanding), 5, 0, 1, 2); // addPage(m_exportOptionsPage, i18n("Set Export Options")); addPage(m_exportOptionsPage, m_options.mode == KexiCSVExport::Clipboard ? i18n("Copying") : i18n("Exporting")); setFinishEnabled(m_exportOptionsPage, true); // load settings if (m_options.mode != KexiCSVExport::Clipboard && readBoolEntry("ShowOptionsInCSVExportDialog", false)) { show(); slotShowOptionsButtonClicked(); } if (readBoolEntry("StoreOptionsForCSVExportDialog", false)) { // load defaults: m_alwaysUseCheckBox->setChecked(true); QString s = readEntry("DefaultDelimiterForExportingCSVFiles", defaultDelimiter()); if (!s.isEmpty()) m_delimiterWidget->setDelimiter(s); s = readEntry("DefaultTextQuoteForExportingCSVFiles", defaultTextQuote()); m_textQuote->setTextQuote(s); //will be invaliudated here, so not a problem s = readEntry("DefaultEncodingForExportingCSVFiles"); if (!s.isEmpty()) m_characterEncodingCombo->setSelectedEncoding(s); m_addColumnNamesCheckBox->setChecked( readBoolEntry("AddColumnNamesForExportingCSVFiles", true)); } updateGeometry(); // -keep widths equal on page #2: int width = qMax(m_infoLblFrom->leftLabel()->sizeHint().width(), m_infoLblTo->leftLabel()->sizeHint().width()); m_infoLblFrom->leftLabel()->setFixedWidth(width); m_infoLblTo->leftLabel()->setFixedWidth(width); }
void ApplicationListModel::loadApplications() { auto cfg = KSharedConfig::openConfig("applications-blacklistrc"); auto blgroup = KConfigGroup(cfg, QStringLiteral("Applications")); // This is only temporary to get a clue what those apps' desktop files are called // I'll remove it once I've done a blacklist QStringList bl; QStringList blacklist = blgroup.readEntry("blacklist", QStringList()); beginResetModel(); m_applicationList.clear(); KServiceGroup::Ptr group = KServiceGroup::root(); if (!group || !group->isValid()) return; KServiceGroup::List subGroupList = group->entries(true); QMap<int, ApplicationData> orderedList; QList<ApplicationData> unorderedList; // Iterate over all entries in the group while (!subGroupList.isEmpty()) { KSycocaEntry::Ptr groupEntry = subGroupList.first(); subGroupList.pop_front(); if (groupEntry->isType(KST_KServiceGroup)) { KServiceGroup::Ptr serviceGroup(static_cast<KServiceGroup* >(groupEntry.data())); if (!serviceGroup->noDisplay()) { KServiceGroup::List entryGroupList = serviceGroup->entries(true); for(KServiceGroup::List::ConstIterator it = entryGroupList.constBegin(); it != entryGroupList.constEnd(); it++) { KSycocaEntry::Ptr entry = (*it); if (entry->isType(KST_KServiceGroup)) { KServiceGroup::Ptr serviceGroup(static_cast<KServiceGroup* >(entry.data())); subGroupList << serviceGroup; } else if (entry->property("Exec").isValid()) { KService::Ptr service(static_cast<KService* >(entry.data())); qDebug() << " desktopEntryName: " << service->desktopEntryName(); if (service->isApplication() && !blacklist.contains(service->desktopEntryName()) && service->showOnCurrentPlatform() && !service->property("Terminal", QVariant::Bool).toBool()) { bl << service->desktopEntryName(); ApplicationData data; data.name = service->name(); data.icon = service->icon(); data.storageId = service->storageId(); data.entryPath = service->exec(); auto it = m_appPositions.constFind(service->storageId()); if (it != m_appPositions.constEnd()) { orderedList[*it] = data; } else { unorderedList << data; } } } } } } } blgroup.writeEntry("allapps", bl); blgroup.writeEntry("blacklist", blacklist); cfg->sync(); std::sort(unorderedList.begin(), unorderedList.end(), appNameLessThan); m_applicationList << orderedList.values(); m_applicationList << unorderedList; endResetModel(); emit countChanged(); }
void BlacklistedApplicationsModel::load() { // Loading plugin configuration const auto config = d->pluginConfig->group(SQLITE_PLUGIN_CONFIG_KEY); const auto defaultBlockedValue = config.readEntry("blocked-by-default", false); auto blockedApplications = QSet<QString>::fromList(config.readEntry("blocked-applications", QStringList())); auto allowedApplications = QSet<QString>::fromList(config.readEntry("allowed-applications", QStringList())); // Reading new applications from the database const QString path = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + QStringLiteral("/kactivitymanagerd/resources/database"); d->database = QSqlDatabase::addDatabase("QSQLITE", "plugins_sqlite_db_resources"); d->database.setDatabaseName(path); if (!d->database.open()) { // qDebug() << "Failed to open the database" << path << d->database.lastError(); return; } auto query = d->database.exec("SELECT DISTINCT(initiatingAgent) FROM ResourceScoreCache ORDER BY initiatingAgent"); if (d->applications.length() > 0) { beginRemoveRows(QModelIndex(), 0, d->applications.length() - 1); d->applications.clear(); endRemoveRows(); } while (query.next()) { const auto name = query.value(0).toString(); if (defaultBlockedValue) { if (!allowedApplications.contains(name)) { blockedApplications << name; } } else { if (!blockedApplications.contains(name)) { allowedApplications << name; } } } auto applications = (blockedApplications + allowedApplications).toList(); if (applications.length() > 0) { qSort(applications); beginInsertRows(QModelIndex(), 0, applications.length() - 1); foreach(const auto & name, applications) { const auto service = KService::serviceByDesktopName(name); const auto blocked = blockedApplications.contains(name); if (service) { d->applications << Private::ApplicationData{ name, service->name(), service->icon(), blocked }; } else { d->applications << Private::ApplicationData{ name, name, QString(), blocked }; } } endInsertRows(); }
Job::Job(int dbRowID) { rowID = dbRowID; readEntry(dbRowID); }
bool KDesktopFile::hasMimeTypeType() const { return readEntry("Type") == QString::fromLatin1("MimeType"); }
bool KDesktopFile::hasDeviceType() const { return readEntry("Type") == QString::fromLatin1("FSDev") || readEntry("Type") == QString::fromLatin1("FSDevice"); }
bool KDesktopFile::hasLinkType() const { return readEntry("Type") == QString::fromLatin1("Link"); }
bool KDesktopFile::hasApplicationType() const { return readEntry("Type") == QString::fromLatin1("Application"); }
QString KDesktopFile::readDevice() const { return readEntry("Dev"); }
QString KDesktopFile::readGenericName() const { return readEntry("GenericName"); }
QString KDesktopFile::readComment() const { return readEntry("Comment"); }
QVariant KConfigBase::readPropertyEntry(const char *pKey, const QVariant &aDefault) const { if(!hasKey(pKey)) return aDefault; QVariant tmp = aDefault; switch(aDefault.type()) { case QVariant::Invalid: return QVariant(); case QVariant::String: return QVariant(readEntry(pKey, aDefault.toString())); case QVariant::StringList: return QVariant(readListEntry(pKey)); case QVariant::List: { QStringList strList = readListEntry(pKey); QStringList::ConstIterator it = strList.begin(); QStringList::ConstIterator end = strList.end(); QValueList< QVariant > list; for(; it != end; ++it) { tmp = *it; list.append(tmp); } return QVariant(list); } case QVariant::Font: return QVariant(readFontEntry(pKey, &tmp.asFont())); case QVariant::Point: return QVariant(readPointEntry(pKey, &tmp.asPoint())); case QVariant::Rect: return QVariant(readRectEntry(pKey, &tmp.asRect())); case QVariant::Size: return QVariant(readSizeEntry(pKey, &tmp.asSize())); case QVariant::Color: return QVariant(readColorEntry(pKey, &tmp.asColor())); case QVariant::Int: return QVariant(readNumEntry(pKey, aDefault.toInt())); case QVariant::UInt: return QVariant(readUnsignedNumEntry(pKey, aDefault.toUInt())); case QVariant::LongLong: return QVariant(readNum64Entry(pKey, aDefault.toLongLong())); case QVariant::ULongLong: return QVariant(readUnsignedNum64Entry(pKey, aDefault.toULongLong())); case QVariant::Bool: return QVariant(readBoolEntry(pKey, aDefault.toBool()), 0); case QVariant::Double: return QVariant(readDoubleNumEntry(pKey, aDefault.toDouble())); case QVariant::DateTime: return QVariant(readDateTimeEntry(pKey, &tmp.asDateTime())); case QVariant::Date: return QVariant(readDateTimeEntry(pKey, &tmp.asDateTime()).date()); case QVariant::Pixmap: case QVariant::Image: case QVariant::Brush: case QVariant::Palette: case QVariant::ColorGroup: case QVariant::Map: case QVariant::IconSet: case QVariant::CString: case QVariant::PointArray: case QVariant::Region: case QVariant::Bitmap: case QVariant::Cursor: case QVariant::SizePolicy: case QVariant::Time: case QVariant::ByteArray: case QVariant::BitArray: case QVariant::KeySequence: case QVariant::Pen: break; } Q_ASSERT(0); return QVariant(); }
KAutostart::StartPhase KAutostart::startPhase() const { return readEntry(d->df->desktopGroup(), "X-KDE-autostart-phase", Applications); }
QFont KConfigBase::readFontEntry(const char *pKey, const QFont *pDefault) const { QFont aRetFont; QString aValue = readEntry(pKey); if(!aValue.isNull()) { if(aValue.contains(',') > 5) { // KDE3 and upwards entry if(!aRetFont.fromString(aValue) && pDefault) aRetFont = *pDefault; } else { // backward compatibility with older font formats // ### remove KDE 3.1 ? // find first part (font family) int nIndex = aValue.find(','); if(nIndex == -1) { if(pDefault) aRetFont = *pDefault; return aRetFont; } aRetFont.setFamily(aValue.left(nIndex)); // find second part (point size) int nOldIndex = nIndex; nIndex = aValue.find(',', nOldIndex + 1); if(nIndex == -1) { if(pDefault) aRetFont = *pDefault; return aRetFont; } aRetFont.setPointSize(aValue.mid(nOldIndex + 1, nIndex - nOldIndex - 1).toInt()); // find third part (style hint) nOldIndex = nIndex; nIndex = aValue.find(',', nOldIndex + 1); if(nIndex == -1) { if(pDefault) aRetFont = *pDefault; return aRetFont; } aRetFont.setStyleHint((QFont::StyleHint)aValue.mid(nOldIndex + 1, nIndex - nOldIndex - 1).toUInt()); // find fourth part (char set) nOldIndex = nIndex; nIndex = aValue.find(',', nOldIndex + 1); if(nIndex == -1) { if(pDefault) aRetFont = *pDefault; return aRetFont; } QString chStr = aValue.mid(nOldIndex + 1, nIndex - nOldIndex - 1); // find fifth part (weight) nOldIndex = nIndex; nIndex = aValue.find(',', nOldIndex + 1); if(nIndex == -1) { if(pDefault) aRetFont = *pDefault; return aRetFont; } aRetFont.setWeight(aValue.mid(nOldIndex + 1, nIndex - nOldIndex - 1).toUInt()); // find sixth part (font bits) uint nFontBits = aValue.right(aValue.length() - nIndex - 1).toUInt(); aRetFont.setItalic(nFontBits & 0x01); aRetFont.setUnderline(nFontBits & 0x02); aRetFont.setStrikeOut(nFontBits & 0x04); aRetFont.setFixedPitch(nFontBits & 0x08); aRetFont.setRawMode(nFontBits & 0x20); } } else { if(pDefault) aRetFont = *pDefault; } return aRetFont; }
bool Zips::read(const file_entry* entry, file::buffer& bf) { MutexAutoLock al(_lock); return readEntry(entry, bf); }
QFont KResourceMan::readFontEntry( const QString& rKey, const QFont* pDefault ) const { QFont aRetFont; QString aValue = readEntry( rKey ); if( !aValue.isNull() ) { // find first part (font family) int nIndex = aValue.find( ',' ); if( nIndex == -1 ) return aRetFont; aRetFont.setFamily( aValue.left( nIndex ) ); // find second part (point size) int nOldIndex = nIndex; nIndex = aValue.find( ',', nOldIndex+1 ); if( nIndex == -1 ) return aRetFont; aRetFont.setPointSize( aValue.mid( nOldIndex+1, nIndex-nOldIndex-1 ).toInt() ); // find third part (style hint) nOldIndex = nIndex; nIndex = aValue.find( ',', nOldIndex+1 ); if( nIndex == -1 ) return aRetFont; aRetFont.setStyleHint( (QFont::StyleHint)aValue.mid( nOldIndex+1, nIndex-nOldIndex-1 ).toUInt() ); // find fourth part (char set) nOldIndex = nIndex; nIndex = aValue.find( ',', nOldIndex+1 ); if( nIndex == -1 ) return aRetFont; aRetFont.setCharSet( (QFont::CharSet)aValue.mid( nOldIndex+1, nIndex-nOldIndex-1 ).toUInt() ); // find fifth part (weight) nOldIndex = nIndex; nIndex = aValue.find( ',', nOldIndex+1 ); if( nIndex == -1 ) return aRetFont; aRetFont.setWeight( aValue.mid( nOldIndex+1, nIndex-nOldIndex-1 ).toUInt() ); // find sixth part (font bits) uint nFontBits = aValue.right( aValue.length()-nIndex-1 ).toUInt(); if( nFontBits & 0x01 ) aRetFont.setItalic( true ); if( nFontBits & 0x02 ) aRetFont.setUnderline( true ); if( nFontBits & 0x04 ) aRetFont.setStrikeOut( true ); if( nFontBits & 0x08 ) aRetFont.setFixedPitch( true ); if( nFontBits & 0x20 ) aRetFont.setRawMode( true ); } else if( pDefault ) aRetFont = *pDefault; return aRetFont; }
uint64_t getKeyCnt(std::istream & istr, uint64_t const entryid) const { return readEntry(istr,entryid).kcnt; }
void dvbcut_settings::load_settings() { int version = readNumEntry("/version", 0); if (version >= 1) { // config format version 1 or later beginGroup("/wheel"); wheel_increments[WHEEL_INCR_NORMAL] = readNumEntry("/incr_normal", 25*60); wheel_increments[WHEEL_INCR_SHIFT] = readNumEntry("/incr_shift", 25); wheel_increments[WHEEL_INCR_CTRL] = readNumEntry("/incr_ctrl", 1); wheel_increments[WHEEL_INCR_ALT] = readNumEntry("/incr_alt", 15*25*60); wheel_threshold = readNumEntry("/threshold", 24); // Note: delta is a multiple of 120 (see Qt documentation) wheel_delta = readNumEntry("/delta", 120); if (wheel_delta == 0) wheel_delta = 1; // avoid devide by zero endGroup(); // wheel beginGroup("/slider"); jog_maximum = readNumEntry("/jog_maximum", 180000); jog_threshold = readNumEntry("/jog_threshold", 50); // to increase the "zero frames"-region of the jog-slider jog_offset = readDoubleEntry("/jog_offset", 0.4); // sub-intervals of jog_maximum jog_interval = readNumEntry("/jog_interval", 1); if (jog_interval < 0) jog_interval = 0; lin_interval = readNumEntry("/lin_interval", 3600); if (lin_interval < 0) lin_interval = 0; endGroup(); // slider beginGroup("/lastdir"); lastdir = readEntry("/name", ""); lastdir_update = readBoolEntry("/update", true); endGroup(); // lastdir } else { // old (unnumbered) config format wheel_increments[WHEEL_INCR_NORMAL] = readNumEntry("/wheel_incr_normal", 25*60); wheel_increments[WHEEL_INCR_SHIFT] = readNumEntry("/wheel_incr_shift", 25); wheel_increments[WHEEL_INCR_CTRL] = readNumEntry("/wheel_incr_ctrl", 1); wheel_increments[WHEEL_INCR_ALT] = readNumEntry("/wheel_incr_alt", 15*25*60); wheel_threshold = readNumEntry("/wheel_threshold", 24); // Note: delta is a multiple of 120 (see Qt documentation) wheel_delta = readNumEntry("/wheel_delta", 120); if (wheel_delta == 0) wheel_delta = 1; // avoid devide by zero jog_maximum = readNumEntry("/jog_maximum", 180000); jog_threshold = readNumEntry("/jog_threshold", 50); // to increase the "zero frames"-region of the jog-slider jog_offset = readDoubleEntry("/jog_offset", 0.4); // sub-intervals of jog_maximum jog_interval = readNumEntry("/jog_interval", 1); if (jog_interval < 0) jog_interval = 0; lin_interval = readNumEntry("/lin_interval", 3600); if (lin_interval < 0) lin_interval = 0; lastdir = readEntry("/lastdir", ""); lastdir_update = true; // remove old-style entries remove("/wheel_incr_normal"); remove("/wheel_incr_shift"); remove("/wheel_incr_ctrl"); remove("/wheel_incr_alt"); remove("/wheel_threshold"); remove("/wheel_delta"); remove("/jog_maximum"); remove("/jog_threshold"); remove("/jog_offset"); remove("/jog_interval"); remove("/lin_interval"); remove("/lastdir"); remove("/idxfilter"); remove("/prjfilter"); remove("/loadfilter"); } if (version >= 2) { /* float view scale factor */ beginGroup("/viewscalefactor"); viewscalefactor = readNumEntry("/current", 1); viewscalefactor_custom = readDoubleEntry("/custom", 3.0); endGroup(); // viewscalefactor } else { viewscalefactor = readNumEntry("/viewscalefactor", 1); viewscalefactor_custom = 3.0; remove("/viewscalefactor"); } export_format = readNumEntry("/export_format", 0); beginGroup("/recentfiles"); recentfiles_max = readNumEntry("/max", 5); recentfiles.clear(); std::list<std::string> filenames; QStringList keys = childKeys(); for (unsigned int i = 0; i < recentfiles_max; ++i) { QString key = "/" + QString::number(i); if (version < 1 && keys.size()>1) { // OLD format (2 keys per input file, NO subkeys!) QString filename = readEntry(key); if (filename.isEmpty()) continue; filenames.clear(); filenames.push_back(filename.toStdString()); QString idxfilename = readEntry(key + "-idx", ""); recentfiles.push_back( std::pair<std::list<std::string>,std::string>(filenames, idxfilename.toStdString())); } else { // NEW format with subkeys and multiple files! beginGroup(key); QString filename = readEntry("/0"); if (!filename.isEmpty()) { // multiple input files? int j=0; filenames.clear(); while(!filename.isEmpty()) { filenames.push_back(filename.toStdString()); filename = readEntry("/" + QString::number(++j), ""); } QString idxfilename = readEntry("/idx", ""); recentfiles.push_back( std::pair<std::list<std::string>,std::string>(filenames, idxfilename.toStdString())); } endGroup(); // key } } endGroup(); // recentfiles start_bof = readBoolEntry("/start_bof", true); stop_eof = readBoolEntry("/stop_eof", true); beginGroup("/snapshots"); snapshot_type = readEntry("/type", "PNG"); snapshot_quality = readNumEntry("/quality", -1); snapshot_prefix = readEntry("/prefix", ""); snapshot_delimiter = readEntry("/delimiter", "_"); snapshot_first = readNumEntry("/first", 1); snapshot_width = readNumEntry("/width", 3); snapshot_extension = readEntry("/extension", "png"); snapshot_range = readNumEntry("/range", 0); snapshot_samples = readNumEntry("/samples", 1); endGroup(); // snapshots beginGroup("/pipe"); pipe_command.clear(); pipe_post.clear(); pipe_label.clear(); pipe_format.clear(); beginGroup("/0"); QString command = readEntry("/command", DVBCUT_DEFAULT_PIPE_COMMAND); QString post = readEntry("/post", DVBCUT_DEFAULT_PIPE_POST); QString label = readEntry("/label", DVBCUT_DEFAULT_PIPE_LABEL); int format = readNumEntry("/format", DVBCUT_DEFAULT_PIPE_FORMAT); endGroup(); // 0 unsigned int i = 0; while(!command.isEmpty() && !label.isEmpty()) { if(format<0 || format>3) format = 0; pipe_command.push_back(command); pipe_post.push_back(post); pipe_label.push_back(label); pipe_format.push_back(format); QString key = "/" + QString::number(++i); beginGroup(key); command = readEntry("/command",""); post = readEntry("/post",""); label = readEntry("/label",""); format = readNumEntry("/format", 0); endGroup(); // key } endGroup(); // pipe beginGroup("/chapters"); // length (>0) or number (<0) of chapter(s) chapter_interval = readNumEntry("/interval", 600*25); // detection of scene changes is rather time comsuming... //chapter_tolerance = readNumEntry("/tolerance", 10*25); //... better switch it off per default! chapter_tolerance = readNumEntry("/tolerance", 0); // average color distance needed for a scene change chapter_threshold = readDoubleEntry("/threshold", 50.); // minimal length of a chapter chapter_minimum = readNumEntry("/minimum", 200*25); endGroup(); // auto chapters }
uint64_t getValueCnt(std::istream & istr, uint64_t const entryid) const { return readEntry(istr,entryid).vcnt; }
Company::Company(std::string nameOfCompany) { readEntry(nameOfCompany); }
uint64_t getKeyValueCnt(std::istream & istr, uint64_t const entryid) const { IndexEntry const entry = readEntry(istr,entryid); return entry.kcnt + entry.vcnt; }
uint64_t getPos(uint64_t const entryid) const { return readEntry(entryid).pos; }
IndexEntry readEntry(uint64_t const entryid) const { input_stream_pointer_type indexistr = openFile(); return readEntry(*indexistr,entryid); }
uint64_t getValueCnt(uint64_t const entryid) const { return readEntry(entryid).vcnt; }
cmm_error_t cnt_init(char *filename, cmm_nodeid_t local_node_id) { int filefd; fifo_t *elems; cnt_entry_t *entry; cmm_error_t err = CMM_OK; if ( pthread_mutex_init( &cnt_mutex, NULL ) ) { cm_trace(CM_TRACE_LEVEL_ERROR, "pthread_mutex_init failed" ); return(CMM_EOTHER); } filefd = open( filename, O_RDONLY ); if (filefd == -1) { cm_trace(CM_TRACE_LEVEL_ERROR, "Failed to open file %s in O_RDONLY mode", filename ); return( CMM_EINVAL ); } elems = fifo_init(NULL); if (!elems) { cm_trace(CM_TRACE_LEVEL_ERROR, "fifo_init failed" ); close(filefd); return( CMM_ENOMEM ); } while ((entry = readEntry(filefd))) { err = fifo_add_elem( elems, entry ); if (err != CMM_OK) { cm_trace(CM_TRACE_LEVEL_ERROR, "fifo_add_elem failed [%d]", err ); break; } } if (err == CMM_OK) { err = cnt_create_table( local_node_id, elems ); if (err != CMM_OK) { cm_trace(CM_TRACE_LEVEL_ERROR, "cnt_create_table failed [%d]", err ); } } if (err == CMM_OK) { err = cnt_update_dns(); if (err != CMM_OK) { cm_trace(CM_TRACE_LEVEL_ERROR, "cnt_update_dns failed [%d]", err ); } } if (err != CMM_OK) { while ((entry = fifo_extract_elem(elems))) { free(entry); } } fifo_destroy(elems); elems = NULL; if (err == CMM_OK) { cm_trace(CM_TRACE_LEVEL_DEBUG, "The CNT initialized properly" ); } return(err); }
uint64_t getPos(std::istream & istr, uint64_t const entryid) const { return readEntry(istr,entryid).pos; }
QString KDesktopFile::readIcon() const { return readEntry("Icon"); }