1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2024-12-31 20:16:57 +00:00
transmission/qt/Filters.cc
Charles Kerr 51573a3c1e
chore: clang-tidy cleanups (#1287)
* chore: fix syntax error in clang-tidy config file
2020-06-05 14:02:11 -05:00

61 lines
1.4 KiB
C++

/*
* This file Copyright (C) 2009-2015 Mnemosyne LLC
*
* It may be used under the GNU GPL versions 2 or 3
* or any future license endorsed by Mnemosyne LLC.
*
*/
#include "Filters.h"
std::array<QString, FilterMode::NUM_MODES> const FilterMode::Names =
{
QStringLiteral("show-all"),
QStringLiteral("show-active"),
QStringLiteral("show-downloading"),
QStringLiteral("show-seeding"),
QStringLiteral("show-paused"),
QStringLiteral("show-finished"),
QStringLiteral("show-verifying"),
QStringLiteral("show-error")
};
int FilterMode::modeFromName(QString const& name)
{
for (int i = 0; i < NUM_MODES; ++i)
{
if (Names[i] == name)
{
return i;
}
}
return FilterMode().mode(); // use the default value
}
std::array<QString, SortMode::NUM_MODES> const SortMode::Names =
{
QStringLiteral("sort-by-activity"),
QStringLiteral("sort-by-age"),
QStringLiteral("sort-by-eta"),
QStringLiteral("sort-by-name"),
QStringLiteral("sort-by-progress"),
QStringLiteral("sort-by-queue"),
QStringLiteral("sort-by-ratio"),
QStringLiteral("sort-by-size"),
QStringLiteral("sort-by-state"),
QStringLiteral("sort-by-id")
};
int SortMode::modeFromName(QString const& name)
{
for (int i = 0; i < NUM_MODES; ++i)
{
if (Names[i] == name)
{
return i;
}
}
return SortMode().mode(); // use the default value
}