2009-04-11 18:25:12 +00:00
|
|
|
/*
|
2015-06-10 21:27:11 +00:00
|
|
|
* This file Copyright (C) 2009-2015 Mnemosyne LLC
|
2009-04-11 18:25:12 +00:00
|
|
|
*
|
2014-12-21 23:49:39 +00:00
|
|
|
* It may be used under the GNU GPL versions 2 or 3
|
2014-01-19 01:09:44 +00:00
|
|
|
* or any future license endorsed by Mnemosyne LLC.
|
2009-04-11 18:25:12 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2015-06-10 21:27:11 +00:00
|
|
|
#include "Filters.h"
|
2009-04-11 18:25:12 +00:00
|
|
|
|
2020-06-05 19:02:11 +00:00
|
|
|
std::array<QString, FilterMode::NUM_MODES> const FilterMode::Names =
|
2010-07-30 22:31:31 +00:00
|
|
|
{
|
2020-05-29 17:40:07 +00:00
|
|
|
QStringLiteral("show-all"),
|
|
|
|
QStringLiteral("show-active"),
|
|
|
|
QStringLiteral("show-downloading"),
|
|
|
|
QStringLiteral("show-seeding"),
|
|
|
|
QStringLiteral("show-paused"),
|
|
|
|
QStringLiteral("show-finished"),
|
|
|
|
QStringLiteral("show-verifying"),
|
|
|
|
QStringLiteral("show-error")
|
2009-04-11 18:25:12 +00:00
|
|
|
};
|
|
|
|
|
2017-04-20 16:02:19 +00:00
|
|
|
int FilterMode::modeFromName(QString const& name)
|
2009-04-11 18:25:12 +00:00
|
|
|
{
|
2017-04-19 12:04:45 +00:00
|
|
|
for (int i = 0; i < NUM_MODES; ++i)
|
|
|
|
{
|
2020-06-05 19:02:11 +00:00
|
|
|
if (Names[i] == name)
|
2017-04-19 12:04:45 +00:00
|
|
|
{
|
|
|
|
return i;
|
|
|
|
}
|
|
|
|
}
|
2013-09-14 22:45:04 +00:00
|
|
|
|
2017-04-19 12:04:45 +00:00
|
|
|
return FilterMode().mode(); // use the default value
|
2009-04-11 18:25:12 +00:00
|
|
|
}
|
|
|
|
|
2020-06-05 19:02:11 +00:00
|
|
|
std::array<QString, SortMode::NUM_MODES> const SortMode::Names =
|
2013-09-14 22:45:04 +00:00
|
|
|
{
|
2020-05-29 17:40:07 +00:00
|
|
|
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")
|
2009-04-11 18:25:12 +00:00
|
|
|
};
|
|
|
|
|
2017-04-20 16:02:19 +00:00
|
|
|
int SortMode::modeFromName(QString const& name)
|
2009-04-11 18:25:12 +00:00
|
|
|
{
|
2017-04-19 12:04:45 +00:00
|
|
|
for (int i = 0; i < NUM_MODES; ++i)
|
|
|
|
{
|
2020-06-05 19:02:11 +00:00
|
|
|
if (Names[i] == name)
|
2017-04-19 12:04:45 +00:00
|
|
|
{
|
|
|
|
return i;
|
|
|
|
}
|
|
|
|
}
|
2013-09-14 22:45:04 +00:00
|
|
|
|
2017-04-19 12:04:45 +00:00
|
|
|
return SortMode().mode(); // use the default value
|
2009-04-11 18:25:12 +00:00
|
|
|
}
|