本文整理汇总了C++中KConfigGroup类的典型用法代码示例。如果您正苦于以下问题:C++ KConfigGroup类的具体用法?C++ KConfigGroup怎么用?C++ KConfigGroup使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了KConfigGroup类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: process
static void process( QTreeView *tv, const KConfigGroup &config )
{
const QByteArray state = config.readEntry( tv->objectName(), QByteArray() );
if ( !state.isEmpty() )
tv->header()->restoreState( state );
}
示例2: storedConfig
int PlasmaApp::newInstance()
{
KCmdLineArgs* args = KCmdLineArgs::parsedArgs();
if (args->count() == 0) {
KCmdLineArgs::usage();
return 0;
}
QString pluginName;
if (args->count() > 0) {
pluginName = args->arg(0);
}
//is the applet already running?
if (m_viewForPlugin.contains(pluginName)) {
m_viewForPlugin.value(pluginName)->activateWindow();
m_viewForPlugin.value(pluginName)->raise();
return 0;
}
QVariantList appletArgs;
for (int i = 1; i < args->count(); ++i) {
appletArgs << args->arg(i);
}
int appletId;
Plasma::Containment *containment = m_corona->addContainment("null");
containment->setFormFactor(Plasma::Planar);
containment->setLocation(Plasma::Floating);
appletId = ++m_maxId;
if (m_storedApplets.contains(pluginName)) {
int storedAppletId = m_storedApplets.values(pluginName).first();
KConfigGroup config = storedConfig(storedAppletId);
KConfigGroup actualConfig(containment->config());
actualConfig = KConfigGroup(&actualConfig, "Applets");
actualConfig = KConfigGroup(&actualConfig, QString::number(appletId));
config.copyTo(&actualConfig);
config.deleteGroup();
m_storedApplets.remove(pluginName, storedAppletId);
}
SingleView *view = new SingleView(m_corona, containment, pluginName, appletId, appletArgs);
if (!view->applet()) {
delete view;
return 0;
}
connect(view, SIGNAL(storeApplet(Plasma::Applet*)), this, SLOT(storeApplet(Plasma::Applet*)));
connect(view, SIGNAL(destroyed(QObject*)), this, SLOT(viewDestroyed(QObject*)));
if (args->isSet("border")) {
view->setBackgroundBrush(KColorUtils::mix(Plasma::Theme::defaultTheme()->color(Plasma::Theme::BackgroundColor), Plasma::Theme::defaultTheme()->color(Plasma::Theme::TextColor), 0.15));
connect(Plasma::Theme::defaultTheme(), SIGNAL(themeChanged()), SLOT(themeChanged()));
view->applet()->setBackgroundHints(Plasma::Applet::NoBackground);
} else {
view->setWindowFlags(Qt::FramelessWindowHint);
view->setAttribute(Qt::WA_TranslucentBackground);
view->setAutoFillBackground(false);
view->viewport()->setAutoFillBackground(false);
view->setAttribute(Qt::WA_NoSystemBackground);
view->viewport()->setAttribute(Qt::WA_NoSystemBackground);
Plasma::WindowEffects::overrideShadow(view->winId(), true);
}
if (args->isSet("fullscreen")) {
view->setWindowState(Qt::WindowFullScreen);
}
args->clear();
m_viewForPlugin[pluginName] = view;
m_pluginForView[view] = pluginName;
KWindowSystem::setOnDesktop(view->winId(), KWindowSystem::currentDesktop());
view->show();
view->raise();
return 0;
}
示例3: save
void Area::save(KConfigGroup& group) const
{
QStringList desired;
QMap<QString, Sublime::Position>::iterator i, e;
for (i = d->desiredToolViews.begin(), e = d->desiredToolViews.end(); i != e; ++i)
{
desired << i.key() + ':' + QString::number(static_cast<int>(i.value()));
}
group.writeEntry("desired views", desired);
kDebug() << "save " << this << "wrote" << group.readEntry("desired views", "");
group.writeEntry("view on left", shownToolView(Sublime::Left));
group.writeEntry("view on right", shownToolView(Sublime::Right));
group.writeEntry("view on top", shownToolView(Sublime::Top));
group.writeEntry("view on bottom", shownToolView(Sublime::Bottom));
group.writeEntry("thickness left", thickness(Sublime::Left));
group.writeEntry("thickness right", thickness(Sublime::Right));
group.writeEntry("thickness bottom", thickness(Sublime::Bottom));
group.writeEntry("thickness top", thickness(Sublime::Top));
group.writeEntry("working set", d->workingSet);
}
示例4: main
//.........这里部分代码省略.........
if (!commandLineDBDir.exists())
{
qCDebug(DIGIKAM_GENERAL_LOG) << "The given database-directory does not exist or is not readable. Ignoring." << commandLineDBDir.path();
}
else
{
commandLineDBPath = commandLineDBDir.path();
}
}
if (parser.isSet(QLatin1String("config")))
{
QString configFilename = parser.value(QLatin1String("config"));
QFileInfo configFile(configFilename);
if (configFile.isDir() || !configFile.dir().exists() ||
!configFile.isReadable() || !configFile.isWritable())
{
QMessageBox::critical(qApp->activeWindow(),
qApp->applicationName(),
QLatin1String("--config ") + configFilename
+ i18n("<p>The given path for the config file "
"is not valid. Either its parent "
"directory does not exist, it is a "
"directory itself or it cannot be read/"
"written to.</p>"));
qCDebug(DIGIKAM_GENERAL_LOG) << "Invalid path: --config"
<< configFilename;
return 1;
}
}
KSharedConfig::Ptr config = KSharedConfig::openConfig();
KConfigGroup group = config->group(QLatin1String("General Settings"));
QString version = group.readEntry(QLatin1String("Version"), QString());
QString iconTheme = group.readEntry(QLatin1String("Icon Theme"), QString());
KConfigGroup mainConfig = config->group(QLatin1String("Album Settings"));
QString firstAlbumPath;
DbEngineParameters params;
// Run the first run assistant if we have no or very old config
if (!mainConfig.exists() || (version.startsWith(QLatin1String("0.5"))))
{
FirstRunDlg firstRun;
firstRun.show();
if (firstRun.exec() == QDialog::Rejected)
{
return 1;
}
// parameters are written to config
firstAlbumPath = firstRun.firstAlbumPath();
if (firstRun.getDbEngineParameters().isSQLite())
{
AlbumManager::checkDatabaseDirsAfterFirstRun(firstRun.getDbEngineParameters().getCoreDatabaseNameOrDir(), firstAlbumPath);
}
}
if (!commandLineDBPath.isNull())
{
// command line option set?
params = DbEngineParameters::parametersForSQLiteDefaultFile(commandLineDBPath);
ApplicationSettings::instance()->setDatabaseDirSetAtCmd(true);
示例5: Q_D
void DatapickerCurve::init() {
Q_D(DatapickerCurve);
KConfig config;
KConfigGroup group;
group = config.group("DatapickerCurve");
d->posXColumn = NULL;
d->posYColumn = NULL;
d->posZColumn = NULL;
d->plusDeltaXColumn = NULL;
d->minusDeltaXColumn = NULL;
d->plusDeltaYColumn = NULL;
d->minusDeltaYColumn = NULL;
d->curveErrorTypes.x = (ErrorType) group.readEntry("CurveErrorType_X", (int) NoError);
d->curveErrorTypes.y = (ErrorType) group.readEntry("CurveErrorType_X", (int) NoError);
// point properties
d->pointStyle = (Symbol::Style)group.readEntry("PointStyle", (int)Symbol::Cross);
d->pointSize = group.readEntry("Size", Worksheet::convertToSceneUnits(7, Worksheet::Point));
d->pointRotationAngle = group.readEntry("Rotation", 0.0);
d->pointOpacity = group.readEntry("Opacity", 1.0);
d->pointBrush.setStyle( (Qt::BrushStyle)group.readEntry("FillingStyle", (int)Qt::NoBrush) );
d->pointBrush.setColor( group.readEntry("FillingColor", QColor(Qt::black)) );
d->pointPen.setStyle( (Qt::PenStyle)group.readEntry("BorderStyle", (int)Qt::SolidLine) );
d->pointPen.setColor( group.readEntry("BorderColor", QColor(Qt::red)) );
d->pointPen.setWidthF( group.readEntry("BorderWidth", Worksheet::convertToSceneUnits(1, Worksheet::Point)) );
d->pointErrorBarSize = group.readEntry("ErrorBarSize", Worksheet::convertToSceneUnits(8, Worksheet::Point));
d->pointErrorBarBrush.setStyle( (Qt::BrushStyle)group.readEntry("ErrorBarFillingStyle", (int)Qt::NoBrush) );
d->pointErrorBarBrush.setColor( group.readEntry("ErrorBarFillingColor", QColor(Qt::black)) );
d->pointErrorBarPen.setStyle( (Qt::PenStyle)group.readEntry("ErrorBarBorderStyle", (int)Qt::SolidLine) );
d->pointErrorBarPen.setColor( group.readEntry("ErrorBarBorderColor", QColor(Qt::black)) );
d->pointErrorBarPen.setWidthF( group.readEntry("ErrorBarBorderWidth", Worksheet::convertToSceneUnits(1, Worksheet::Point)) );
d->pointVisibility = group.readEntry("PointVisibility", true);
this->initAction();
}
示例6: saveSettings
void ScriptingSettings::saveSettings(KConfigGroup& group)
{
group.writeEntry("Script", d->script->text());
}
示例7: writeSettings
void RestorationTool::writeSettings()
{
GreycstorationContainer prm = d->settingsWidget->settings();
KSharedConfig::Ptr config = KGlobal::config();
KConfigGroup group = config->group(d->configGroupName);
group.writeEntry(d->configPresetEntry, d->restorationTypeCB->currentIndex());
group.writeEntry(d->configFastApproxEntry, prm.fastApprox);
group.writeEntry(d->configInterpolationEntry, prm.interp);
group.writeEntry(d->configAmplitudeEntry, (double)prm.amplitude);
group.writeEntry(d->configSharpnessEntry, (double)prm.sharpness);
group.writeEntry(d->configAnisotropyEntry, (double)prm.anisotropy);
group.writeEntry(d->configAlphaEntry, (double)prm.alpha);
group.writeEntry(d->configSigmaEntry, (double)prm.sigma);
group.writeEntry(d->configGaussPrecEntry, (double)prm.gaussPrec);
group.writeEntry(d->configDlEntry, (double)prm.dl);
group.writeEntry(d->configDaEntry, (double)prm.da);
group.writeEntry(d->configIterationEntry, prm.nbIter);
group.writeEntry(d->configTileEntry, prm.tile);
group.writeEntry(d->configBTileEntry, prm.btile);
group.sync();
}
示例8: slotToggleAll
void K3b::MediaCopyDialog::loadSettings( const KConfigGroup& c )
{
m_writerSelectionWidget->loadConfig( c );
m_comboSourceDevice->setSelectedDevice( k3bcore->deviceManager()->findDevice( c.readEntry( "source_device" ) ) );
m_writingModeWidget->loadConfig( c );
m_checkSimulate->setChecked( c.readEntry( "simulate", false ) );
m_checkCacheImage->setChecked( !c.readEntry( "on_the_fly", false ) );
m_checkDeleteImages->setChecked( c.readEntry( "delete_images", true ) );
m_checkOnlyCreateImage->setChecked( c.readEntry( "only_create_image", false ) );
m_comboParanoiaMode->setCurrentIndex( c.readEntry( "paranoia_mode", 0 ) );
m_checkVerifyData->setChecked( c.readEntry( "verify data", false ) );
m_spinCopies->setValue( c.readEntry( "copies", 1 ) );
m_tempDirSelectionWidget->readConfig( c );
if( c.readEntry( "copy mode", "normal" ) == "normal" )
m_comboCopyMode->setCurrentIndex( 0 );
else
m_comboCopyMode->setCurrentIndex( 1 );
m_checkReadCdText->setChecked( c.readEntry( "copy cdtext", true ) );
m_checkIgnoreDataReadErrors->setChecked( c.readEntry( "ignore data read errors", false ) );
m_checkIgnoreAudioReadErrors->setChecked( c.readEntry( "ignore audio read errors", true ) );
m_checkNoCorrection->setChecked( c.readEntry( "no correction", false ) );
m_spinDataRetries->setValue( c.readEntry( "data retries", 128 ) );
m_spinAudioRetries->setValue( c.readEntry( "audio retries", 5 ) );
slotToggleAll();
}
示例9: QString
void K3b::MediaCopyDialog::saveSettings( KConfigGroup c )
{
m_writingModeWidget->saveConfig( c );
c.writeEntry( "simulate", m_checkSimulate->isChecked() );
c.writeEntry( "on_the_fly", !m_checkCacheImage->isChecked() );
c.writeEntry( "delete_images", m_checkDeleteImages->isChecked() );
c.writeEntry( "only_create_image", m_checkOnlyCreateImage->isChecked() );
c.writeEntry( "paranoia_mode", m_comboParanoiaMode->currentText().toInt() );
c.writeEntry( "copies", m_spinCopies->value() );
c.writeEntry( "verify data", m_checkVerifyData->isChecked() );
m_writerSelectionWidget->saveConfig( c );
m_tempDirSelectionWidget->saveConfig( c );
c.writeEntry( "source_device", m_comboSourceDevice->selectedDevice() ? m_comboSourceDevice->selectedDevice()->blockDeviceName() : QString() );
c.writeEntry( "copy cdtext", m_checkReadCdText->isChecked() );
c.writeEntry( "ignore data read errors", m_checkIgnoreDataReadErrors->isChecked() );
c.writeEntry( "ignore audio read errors", m_checkIgnoreAudioReadErrors->isChecked() );
c.writeEntry( "no correction", m_checkNoCorrection->isChecked() );
c.writeEntry( "data retries", m_spinDataRetries->value() );
c.writeEntry( "audio retries", m_spinAudioRetries->value() );
QString s;
if( m_comboCopyMode->currentIndex() == 1 )
s = "clone";
else
s = "normal";
c.writeEntry( "copy mode", s );
}
示例10: saveProperties
void KTutorialEditor::saveProperties(KConfigGroup& configGroup) {
configGroup.writeEntry("TutorialUrl", mFileActions->tutorialUrl());
}
示例11: readProperties
void KTutorialEditor::readProperties(const KConfigGroup& configGroup) {
KUrl url = configGroup.readEntry("TutorialUrl");
if (!url.isEmpty()) {
mFileActions->loadTutorialFromUrl(url);
}
}
示例12: KPWizardPage
OptimizePage::OptimizePage(Manager* const mngr, KAssistantDialog* const dlg)
: KPWizardPage(dlg, i18n("<b>Optimization</b>")),
d(new OptimizePagePriv)
{
d->mngr = mngr;
KVBox* vbox = new KVBox(this);
d->progressTimer = new QTimer(this);
d->title = new QLabel(vbox);
d->title->setOpenExternalLinks(true);
d->title->setWordWrap(true);
KConfig config("kipirc");
KConfigGroup group = config.group(QString("Panorama Settings"));
d->horizonCheckbox = new QCheckBox(i18n("Level horizon"), vbox);
d->horizonCheckbox->setChecked(group.readEntry("Horizon", true));
d->horizonCheckbox->setToolTip(i18n("Detect the horizon and adapt the project to make it horizontal."));
d->horizonCheckbox->setWhatsThis(i18n("<b>Level horizon</b>: Detect the horizon and adapt the projection so that "
"the detected horizon is an horizontal line in the final panorama"));
d->projectionAndSizeCheckbox = new QCheckBox(i18n("Automatic projection and crop"), vbox);
d->projectionAndSizeCheckbox->setChecked(group.readEntry("Output Projection And Size", true));
d->projectionAndSizeCheckbox->setToolTip(i18n("Adapt the projection of the panorama and the cropping on the resulting "
"projection so that every photo fits in the resulting panorama."));
d->projectionAndSizeCheckbox->setWhatsThis(i18n("<b>Automatic projection and crop</b>: Automatically adapt the projection "
"and the crop of the panorama to get every photos into the panorama."));
d->preprocessResults = new QLabel(vbox);
QLabel* space1 = new QLabel(vbox);
vbox->setStretchFactor(space1, 2);
KHBox* hbox = new KHBox(vbox);
d->detailsBtn = new QPushButton(hbox);
d->detailsBtn->setText(i18n("Details..."));
d->detailsBtn->hide();
QLabel* space2 = new QLabel(hbox);
hbox->setStretchFactor(space2, 10);
QLabel* space3 = new QLabel(vbox);
vbox->setStretchFactor(space3, 2);
d->progressLabel = new QLabel(vbox);
d->progressLabel->setAlignment(Qt::AlignCenter);
QLabel* space4 = new QLabel(vbox);
vbox->setStretchFactor(space4, 10);
vbox->setSpacing(KDialog::spacingHint());
vbox->setMargin(KDialog::spacingHint());
setPageWidget(vbox);
resetTitle();
QPixmap leftPix = KStandardDirs::locate("data", "kipiplugin_panorama/pics/assistant-hugin.png");
setLeftBottomPix(leftPix.scaledToWidth(128, Qt::SmoothTransformation));
// connect(d->mngr->thread(), SIGNAL(starting(KIPIPanoramaPlugin::ActionData)),
// this, SLOT(slotAction(KIPIPanoramaPlugin::ActionData)));
connect(d->progressTimer, SIGNAL(timeout()),
this, SLOT(slotProgressTimerDone()));
connect(d->detailsBtn, SIGNAL(clicked()),
this, SLOT(slotShowDetails()));
}
示例13: writeConfig
void KAResourceLocal::writeConfig(KConfigGroup& group)
{
group.writePathEntry("CalendarURL", mURL.prettyUrl());
AlarmResource::writeConfig(group);
}
示例14: fi
bool K3b::MiscOptionTab::saveSettings()
{
KConfigGroup c = KGlobal::config()->group( "General Options" );
c.writeEntry( "ask_for_saving_changes_on_exit", m_checkSaveOnExit->isChecked() );
c.writeEntry( "Show splash", m_checkShowSplash->isChecked() );
c.writeEntry( "Show progress OSD", m_checkShowProgressOSD->isChecked() );
c.writeEntry( "hide main window while writing", m_checkHideMainWindowWhileWriting->isChecked() );
c.writeEntry( "keep action dialogs open", m_checkKeepDialogsOpen->isChecked() );
c.writeEntry( "check system config", m_checkSystemConfig->isChecked() );
c.writeEntry( "action dialog startup settings", m_comboActionDialogSettings->selectedValue() );
QString tempDir = m_editTempDir->url().toLocalFile();
QFileInfo fi( tempDir );
if( fi.isRelative() ) {
fi.setFile( fi.absoluteFilePath() );
}
if( !fi.exists() ) {
if( KMessageBox::questionYesNo( this,
i18n("Folder (%1) does not exist. Create?",tempDir),
i18n("Create Folder"),
KGuiItem( i18n("Create") ),
KStandardGuiItem::cancel() ) == KMessageBox::Yes ) {
if( !KStandardDirs::makeDir( fi.absoluteFilePath() ) ) {
KMessageBox::error( this, i18n("Unable to create folder %1",tempDir) );
return false;
}
}
else {
// the dir does not exist and the user doesn't want to create it
return false;
}
}
if( fi.isFile() ) {
KMessageBox::information( this, i18n("You specified a file for the temporary folder. "
"K3b will use its base path as the temporary folder."),
i18n("Warning"),
"temp file only using base path" );
fi.setFile( fi.path() );
}
// check for writing permission
if( !fi.isWritable() ) {
KMessageBox::error( this, i18n("You do not have permission to write to %1.",fi.absoluteFilePath()) );
return false;
}
m_editTempDir->setUrl( fi.absoluteFilePath() );
k3bcore->globalSettings()->setDefaultTempPath( m_editTempDir->url().toLocalFile() );
// if( m_radioMultipleInstancesSmart->isChecked() )
// c.writeEntry( "Multiple Instances", "smart" );
// else
// c.writeEntry( "Multiple Instances", "always_new" );
return true;
}
示例15: config
/*!
\fn KmlExport::getConfig()
*/
int KmlExport::getConfig()
{
KConfig config("kipirc");
KConfigGroup group = config.group("KMLExport Settings");
m_localTarget = group.readEntry("localTarget", true);
m_optimize_googlemap = group.readEntry("optimize_googlemap", false);
m_iconSize = group.readEntry("iconSize", 33);
// googlemapSize = group.readNumEntry("googlemapSize");
m_size = group.readEntry("size", 320);
// UrlDestDir have to have the trailing
m_baseDestDir = group.readEntry("baseDestDir", QString("/tmp/"));
m_UrlDestDir = group.readEntry("UrlDestDir", QString("http://www.example.com/"));
m_KMLFileName = group.readEntry("KMLFileName", QString("kmldocument"));
m_altitudeMode = group.readEntry("Altitude Mode", 0);
m_GPXtracks = group.readEntry("UseGPXTracks", false);
m_GPXFile = group.readEntry("GPXFile", QString());
m_TimeZone = group.readEntry("Time Zone", 12);
m_LineWidth = group.readEntry("Line Width", 4);
m_GPXColor = group.readEntry("Track Color", "#17eeee" );
m_GPXOpacity = group.readEntry("Track Opacity", 64 );
m_GPXAltitudeMode = group.readEntry("GPX Altitude Mode", 0);
KStandardDirs dir;
m_tempDestDir = dir.saveLocation("tmp", "kipi-kmlrexportplugin-" + QString::number(getpid()) + '/');
m_imageDir = "images/";
m_googlemapSize = 32;
return 1;
}