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
|
|
|
|
2017-04-20 16:02:19 +00:00
|
|
|
QString const FilterMode::names[NUM_MODES] =
|
2010-07-30 22:31:31 +00:00
|
|
|
{
|
2017-04-19 12:04:45 +00:00
|
|
|
QLatin1String("show-all"),
|
|
|
|
QLatin1String("show-active"),
|
|
|
|
QLatin1String("show-downloading"),
|
|
|
|
QLatin1String("show-seeding"),
|
|
|
|
QLatin1String("show-paused"),
|
|
|
|
QLatin1String("show-finished"),
|
|
|
|
QLatin1String("show-verifying"),
|
|
|
|
QLatin1String("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)
|
|
|
|
{
|
|
|
|
if (names[i] == name)
|
|
|
|
{
|
|
|
|
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
|
|
|
}
|
|
|
|
|
2017-04-20 16:02:19 +00:00
|
|
|
QString const SortMode::names[NUM_MODES] =
|
2013-09-14 22:45:04 +00:00
|
|
|
{
|
2017-04-19 12:04:45 +00:00
|
|
|
QLatin1String("sort-by-activity"),
|
|
|
|
QLatin1String("sort-by-age"),
|
|
|
|
QLatin1String("sort-by-eta"),
|
|
|
|
QLatin1String("sort-by-name"),
|
|
|
|
QLatin1String("sort-by-progress"),
|
|
|
|
QLatin1String("sort-by-queue"),
|
|
|
|
QLatin1String("sort-by-ratio"),
|
|
|
|
QLatin1String("sort-by-size"),
|
|
|
|
QLatin1String("sort-by-state"),
|
|
|
|
QLatin1String("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)
|
|
|
|
{
|
|
|
|
if (names[i] == name)
|
|
|
|
{
|
|
|
|
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
|
|
|
}
|