Commit a1c4210b authored by Frerich Raabe's avatar Frerich Raabe

- Moved the code for reading the config file (and possibly using the default

  list of schemes) into a static "TagGuesser::schemeStrings()" method, so
  that we can re-use the defaults in the config dialog.
- Added a static "setSchemeStrings(const QStringList &)" method so that one
  can store the new strings from the config dialog (and the config dialog
  doesn't have to bother what the configuration key is called)

svn path=/trunk/kdemultimedia/juk/; revision=214245
parent ff328c0f
......@@ -113,18 +113,7 @@ QString FileNameScheme::composeRegExp(const QString &s) const
return regExp;
}
TagGuesser::TagGuesser()
{
loadSchemes();
}
TagGuesser::TagGuesser(const QString &absFileName)
{
loadSchemes();
guess(absFileName);
}
void TagGuesser::loadSchemes()
QStringList TagGuesser::schemeStrings()
{
QStringList schemes = kapp->config()->readListEntry( "Filename schemes" );
if ( schemes.isEmpty() ) {
......@@ -154,7 +143,28 @@ void TagGuesser::loadSchemes()
schemes += "%a - %t (%c)";
schemes += "%a - %t";
}
return schemes;
}
void TagGuesser::setSchemeStrings(const QStringList &schemes)
{
kapp->config()->writeEntry("Filename schemes", schemes);
}
TagGuesser::TagGuesser()
{
loadSchemes();
}
TagGuesser::TagGuesser(const QString &absFileName)
{
loadSchemes();
guess(absFileName);
}
void TagGuesser::loadSchemes()
{
const QStringList schemes = schemeStrings();
QStringList::ConstIterator it = schemes.begin();
QStringList::ConstIterator end = schemes.end();
for ( ; it != end; ++it )
......
......@@ -42,6 +42,9 @@ class FileNameScheme
class TagGuesser
{
public:
static QStringList schemeStrings();
static void setSchemeStrings(const QStringList &schemes);
TagGuesser();
TagGuesser(const QString &absFileName);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment