Skip to content

Commit

Permalink
Fully switch to QStringList
Browse files Browse the repository at this point in the history
  • Loading branch information
Twinki14 committed Jun 12, 2024
1 parent a62c39d commit 55b5aa5
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -318,30 +318,30 @@ void Settings::setExecutablesBlacklist(const QString& s)

QStringList Settings::skipFileSuffixes() const
{
static const QString def = (QStringList() << ".mohidden").join(";");
static const QStringList def = QStringList() << ".mohidden";

auto setting = get<QString>(m_Settings, "Settings", "skip_file_suffixes", def);
auto setting = get<QStringList>(m_Settings, "Settings", "skip_file_suffixes", def);

return setting.split(";");
return setting;
}

void Settings::setSkipFileSuffixes(const QStringList& s)
{
set(m_Settings, "Settings", "skip_file_suffixes", s.join(";"));
set(m_Settings, "Settings", "skip_file_suffixes", s);
}

QStringList Settings::skipDirectories() const
{
static const QString def = (QStringList() << ".git").join(";");
static const QStringList def = QStringList() << ".git";

auto setting = get<QString>(m_Settings, "Settings", "skip_directories", def);
auto setting = get<QStringList>(m_Settings, "Settings", "skip_directories", def);

return setting.split(";");
return setting;
}

void Settings::setSkipDirectories(const QStringList& s)
{
set(m_Settings, "Settings", "skip_directories", s.join(";"));
set(m_Settings, "Settings", "skip_directories", s);
}

void Settings::setMotdHash(uint hash)
Expand Down
9 changes: 9 additions & 0 deletions src/settingsutilities.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,15 @@ struct ValueConverter<QVariantList>
}
};

template <>
struct ValueConverter<QStringList>
{
static QString convert(const QStringList& t)
{
return t.join(", ");
}
};

bool shouldLogSetting(const QString& displayName);

template <class T>
Expand Down

0 comments on commit 55b5aa5

Please sign in to comment.