本文整理汇总了C++中KConfigGroup::config方法的典型用法代码示例。如果您正苦于以下问题:C++ KConfigGroup::config方法的具体用法?C++ KConfigGroup::config怎么用?C++ KConfigGroup::config使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KConfigGroup
的用法示例。
在下文中一共展示了KConfigGroup::config方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: readProperties
void KompareShell::readProperties(const KConfigGroup &config)
{
// The 'config' object points to the session managed
// config file. This function is automatically called whenever
// the app is being restored. Read in here whatever you wrote
// in 'saveProperties'
QString mode = config.readEntry( "Mode", "ComparingFiles" );
if ( mode == "ComparingFiles" )
{
m_mode = Kompare::ComparingFiles;
m_sourceURL = config.readPathEntry( "SourceUrl", "" );
m_destinationURL = config.readPathEntry( "DestinationFile", "" );
viewPart()->readProperties( const_cast<KConfig *>(config.config()) );
viewPart()->compareFiles( m_sourceURL, m_destinationURL );
}
else if ( mode == "ShowingDiff" )
{
m_mode = Kompare::ShowingDiff;
m_diffURL = config.readPathEntry( "DiffUrl", "" );
viewPart()->readProperties( const_cast<KConfig *>(config.config()) );
m_viewPart->openUrl( m_diffURL );
}
else
{ // just in case something weird has happened, don't restore the diff then
// Bruggie: or when some idiot like me changes the possible values for mode
// IOW, a nice candidate for a kconf_update thingy :)
viewPart()->readProperties( const_cast<KConfig *>(config.config()) );
}
}
示例2: QString
void Koushin_TownEditor::Editor::fieldClicked(Koushin_TownEditor::EditorField* field)
{
int x = field->boundingRect().topLeft().x() / m_fieldSize;
int y = field->boundingRect().topLeft().y() / m_fieldSize;
QString xString = QString("%1").arg(QString::number(x), 3, QLatin1Char('0'));
QString yString = QString("%1").arg(QString::number(y), 3, QLatin1Char('0'));
kDebug() << "Field clicked at " << xString << "," << yString;
if(m_type == "plainField")
field->setBrush(QBrush(Qt::white));
if(m_type == "fieldWithForest")
field->setBrush(QBrush(Qt::green));
if(m_type == "fieldWithRocks")
field->setBrush(QBrush(Qt::black));
if(m_type == "fieldWithWater")
field->setBrush(QBrush(Qt::blue));
if(m_type == "fieldNotUsable")
field->setBrush(QBrush(Qt::yellow));
field->update(field->boundingRect());
if(m_config) {
foreach(QString groupName, m_fieldTypes) {
if(groupName == m_type) {
KConfigGroup group = m_config->group(groupName);
group.writeEntry("field"+xString+yString, QString::number(x) + "," + QString::number(y));
group.config()->sync();
} else {
KConfigGroup group = m_config->group(groupName);
group.deleteEntry("field"+xString+yString);
group.config()->sync();
}
}
}
}
示例3: cfg_write
void Active_window_condition::cfg_write( KConfigGroup& cfg_P ) const
{
base::cfg_write( cfg_P );
KConfigGroup windowConfig( cfg_P.config(), cfg_P.name() + "Window" );
window()->cfg_write( windowConfig );
cfg_P.writeEntry( "Type", "ACTIVE_WINDOW" ); // overwrites value set in base::cfg_write()
}
示例4: windowConfig
Active_window_condition::Active_window_condition( KConfigGroup& cfg_P, Condition_list_base* parent_P )
: Condition( cfg_P, parent_P )
{
KConfigGroup windowConfig( cfg_P.config(), cfg_P.name() + "Window" );
_window = new Windowdef_list( windowConfig );
init();
set_match();
}
示例5: saveViewConfiguration
void KateViewManager::saveViewConfiguration(KConfigGroup& config)
{
// set Active ViewSpace to 0, just in case there is none active (would be
// strange) and config somehow has previous value set
config.writeEntry("Active ViewSpace", 0);
m_splitterIndex = 0;
saveSplitterConfig(this, config.config(), config.name());
}
示例6: path
QString path(KConfigGroup group)
{
QString ret;
while (group.exists()) {
ret.prepend( "/" + group.name());
group = group.parent();
}
ret.prepend(group.config()->name());
return ret;
}
示例7: conditionConfig
Condition_list_base::Condition_list_base( KConfigGroup& cfg_P, Condition_list_base* parent_P )
: Condition( parent_P )
{
int cnt = cfg_P.readEntry( "ConditionsCount", 0 );
for( int i = 0;
i < cnt;
++i )
{
KConfigGroup conditionConfig( cfg_P.config(), cfg_P.name() + QString::number( i ) );
(void) Condition::create_cfg_read( conditionConfig, this );
}
}
示例8: cfg_write
void Condition_list_base::cfg_write( KConfigGroup& cfg_P ) const
{
int i = 0;
for( ConstIterator it(begin());
it != end();
++it, ++i )
{
KConfigGroup conditionConfig( cfg_P.config(), cfg_P.name() + QString::number( i ) );
(*it)->cfg_write( conditionConfig );
}
cfg_P.writeEntry( "ConditionsCount", i );
}
示例9: cfg_write
void KeyboardInputAction::cfg_write( KConfigGroup& cfg_P ) const
{
base::cfg_write( cfg_P );
cfg_P.writeEntry( "Type", "KEYBOARD_INPUT" ); // overwrites value set in base::cfg_write()
cfg_P.writeEntry( "Input", input());
cfg_P.writeEntry( "DestinationWindow", int(_destination) );
if( _destination == SpecificWindow && dest_window() != NULL )
{
KConfigGroup windowGroup( cfg_P.config(), cfg_P.name() + "DestinationWindow" );
dest_window()->cfg_write( windowGroup );
}
}
示例10: loadEntries
void loadEntries(const KConfigGroup &grp)
{
recentFiles.clear();
recentFilesIndex.clear();
QString value;
QString nameValue;
QUrl url;
KConfigGroup cg = grp;
if ( cg.name().isEmpty()) {
cg = KConfigGroup(cg.config(),"RecentFiles");
}
// read file list
for (int i = 1; i <= maxItems; i++) {
value = cg.readPathEntry(QString("File%1").arg(i), QString());
if (value.isEmpty()) continue;
url = QUrl(value);
// gemini only handles local files
// yes, i know the second half here isn't good on windows... but without it we fail on linux, and second part for windows
if (!url.isLocalFile() && !value.startsWith('/') && value.midRef(2, 1) != QLatin1String(":")) {
qDebug() << "Not a local file:" << url;
continue;
}
// Don't restore if file doesn't exist anymore
if (!QFile::exists(url.toLocalFile()) && !QFile::exists(value)) {
qDebug() << "Recent file apparently no longer exists:" << url.toLocalFile();
continue;
}
value = QDir::toNativeSeparators( value );
// Don't restore where the url is already known (eg. broken config)
if (recentFiles.contains(value))
continue;
nameValue = cg.readPathEntry(QString("Name%1").arg(i), url.fileName());
if (!value.isNull()) {
recentFilesIndex << nameValue;
recentFiles << value;
}
}
}
示例11: read
void SpriteDef::read(KConfigGroup &config)
{
mDirX.set( config.readEntry( QStringLiteral("DirectionX"), QStringLiteral("0") ) );
mDirY.set( config.readEntry( QStringLiteral("DirectionY"), QStringLiteral("0") ) );
mStartX.set( config.readEntry( QStringLiteral("StartX"), QStringLiteral("0") ) );
mStartY.set( config.readEntry( QStringLiteral("StartY"), QStringLiteral("0") ) );
mEndX.set( config.readEntry( QStringLiteral("EndX"), QStringLiteral("10000") ) );
mEndY.set( config.readEntry( QStringLiteral("EndY"), QStringLiteral("10000") ) );
mLifeSpan = config.readEntry( QStringLiteral("LifeSpan"), -1 );
mZ = config.readEntry( QStringLiteral("Z"), 1 );
QString animation = config.readEntry( QStringLiteral("Animation"), QString() );
KConfigBase *grp = config.config();
mSeq = SpriteSequenceManager::manager()->load( *grp, animation );
qDebug() << QStringLiteral("Set Z = ") << mZ;
}
示例12: saveEntries
void saveEntries( const KConfigGroup &grp)
{
KConfigGroup cg = grp;
if (cg.name().isEmpty()) {
cg = KConfigGroup(cg.config(),"RecentFiles");
}
cg.deleteGroup();
// write file list
for (int i = 1; i <= recentFilesIndex.size(); ++i) {
// i - 1 because we started from 1
cg.writePathEntry(QString("File%1").arg(i), recentFiles[i - 1]);
cg.writePathEntry(QString("Name%1").arg(i), recentFilesIndex[i - 1]);
}
}
示例13: saveProperties
void KompareShell::saveProperties(KConfigGroup &config)
{
// The 'config' object points to the session managed
// config file. Anything you write here will be available
// later when this app is restored
if ( m_mode == Kompare::ComparingFiles )
{
config.writeEntry( "Mode", "ComparingFiles" );
config.writePathEntry( "SourceUrl", m_sourceURL.url() );
config.writePathEntry( "DestinationUrl", m_destinationURL.url() );
}
else if ( m_mode == Kompare::ShowingDiff )
{
config.writeEntry( "Mode", "ShowingDiff" );
config.writePathEntry( "DiffUrl", m_diffURL.url() );
}
viewPart()->saveProperties( config.config() );
}
示例14: restoreViewConfiguration
void KateViewManager::restoreViewConfiguration (const KConfigGroup& config)
{
// remove all views and viewspaces + remove their xml gui clients
for (int i = 0; i < m_viewList.count(); ++i)
mainWindow()->guiFactory ()->removeClient (m_viewList.at(i));
qDeleteAll( m_viewList );
m_viewList.clear();
qDeleteAll( m_viewSpaceList );
m_viewSpaceList.clear();
m_activeStates.clear();
// start recursion for the root splitter (Splitter 0)
restoreSplitter( config.config(), config.name() + "-Splitter 0", this, config.name() );
// finally, make the correct view from the last session active
int lastViewSpace = config.readEntry("Active ViewSpace", 0);
if( lastViewSpace > m_viewSpaceList.size() ) lastViewSpace = 0;
if( lastViewSpace >= 0 && lastViewSpace < m_viewSpaceList.size())
{
setActiveSpace( m_viewSpaceList.at( lastViewSpace ) );
setActiveView( m_viewSpaceList.at( lastViewSpace )->currentView() );
m_viewSpaceList.at( lastViewSpace )->currentView()->setFocus();
}
// emergency
if (m_viewSpaceList.empty())
{
// kill bad children
while (count())
delete widget (0);
KateViewSpace* vs = new KateViewSpace( this, 0 );
addWidget (vs);
vs->setActive( true );
m_viewSpaceList.append(vs);
}
updateViewSpaceActions();
// the view has (maybe) changed - promote it to the world
emit viewChanged();
}
示例15: start
bool LldbDebugger::start(KConfigGroup& config, const QStringList& extraArguments)
{
// Get path to executable
QUrl lldbUrl = config.readEntry(Config::LldbExecutableEntry, QUrl());
if (!lldbUrl.isValid() || !lldbUrl.isLocalFile()) {
debuggerBinary_ = "lldb-mi";
} else {
debuggerBinary_ = lldbUrl.toLocalFile();
}
if (!checkVersion()) {
return false;
}
// Get arguments
QStringList arguments = extraArguments;
//arguments << "-quiet";
arguments.append(KShell::splitArgs(config.readEntry(Config::LldbArgumentsEntry, QString())));
// Get environment
const EnvironmentGroupList egl(config.config());
const auto &envs = egl.variables(config.readEntry(Config::LldbEnvironmentEntry, egl.defaultGroup()));
QProcessEnvironment processEnv;
if (config.readEntry(Config::LldbInheritSystemEnvEntry, true)) {
processEnv = QProcessEnvironment::systemEnvironment();
}
for (auto it = envs.begin(), ite = envs.end(); it != ite; ++it) {
processEnv.insert(it.key(), it.value());
}
// Start!
process_->setProcessEnvironment(processEnv);
process_->setProgram(debuggerBinary_, arguments);
process_->start();
qCDebug(DEBUGGERLLDB) << "Starting LLDB with command" << debuggerBinary_ + ' ' + arguments.join(' ');
qCDebug(DEBUGGERLLDB) << "LLDB process pid:" << process_->pid();
emit userCommandOutput(debuggerBinary_ + ' ' + arguments.join(' ') + '\n');
return true;
}