You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
tdevelop/lib/util/settings.cpp

64 lines
2.2 KiB

/***************************************************************************
* Copyright (C) 2005 by Jens Dagerbo *
* jens.dagerbo@swipnet.se *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#include <tdeconfig.h>
#include <tdeglobal.h>
#include <kstandarddirs.h>
#include "settings.h"
TQString Settings::terminalEmulatorName( TDEConfig & config )
{
config.setGroup("TerminalEmulator");
bool useKDESetting = config.readBoolEntry( "UseKDESetting", true );
TQString terminal;
if ( useKDESetting )
{
TDEConfigGroup confGroup( TDEGlobal::config(), TQString::fromLatin1("General") );
terminal = confGroup.readEntry("TerminalApplication", TQString::fromLatin1("konsole"));
}
else
{
terminal = config.readEntry( "TerminalApplication", TQString::fromLatin1("konsole"));
}
return terminal;
}
TQString Settings::profileByAttributes(const TQString &language, const TQStringList &keywords)
{
TDEConfig config(locate("data", "tdevelop/profiles/projectprofiles"));
config.setGroup(language);
TQStringList profileKeywords = TQStringList::split("/", "Empty");
if (config.hasKey("Keywords"))
profileKeywords = config.readListEntry("Keywords");
int idx = 0;
for (TQStringList::const_iterator it = profileKeywords.constBegin();
it != profileKeywords.constEnd(); ++it)
{
if (keywords.contains(*it))
{
idx = profileKeywords.findIndex(*it);
break;
}
}
TQStringList profiles;
if (config.hasKey("Profiles"))
{
profiles = config.readListEntry("Profiles");
return profiles[idx];
}
return "KDevelop";
}