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
|
|
|
|
2010-07-30 22:31:31 +00:00
|
|
|
const QString FilterMode::names[NUM_MODES] =
|
|
|
|
{
|
2015-01-29 21:53:05 +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
|
|
|
};
|
|
|
|
|
|
|
|
int
|
2014-12-12 23:05:10 +00:00
|
|
|
FilterMode::modeFromName (const QString& name)
|
2009-04-11 18:25:12 +00:00
|
|
|
{
|
2013-09-14 22:45:04 +00:00
|
|
|
for (int i=0; i<NUM_MODES; ++i)
|
|
|
|
if( names[i] == name )
|
|
|
|
return i;
|
|
|
|
|
|
|
|
return FilterMode().mode(); // use the default value
|
2009-04-11 18:25:12 +00:00
|
|
|
}
|
|
|
|
|
2013-09-14 22:45:04 +00:00
|
|
|
const QString SortMode::names[NUM_MODES] =
|
|
|
|
{
|
2015-01-29 21:53:05 +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
|
|
|
};
|
|
|
|
|
|
|
|
int
|
2014-12-12 23:05:10 +00:00
|
|
|
SortMode::modeFromName (const QString& name)
|
2009-04-11 18:25:12 +00:00
|
|
|
{
|
2013-09-14 22:45:04 +00:00
|
|
|
for (int i=0; i<NUM_MODES; ++i)
|
|
|
|
if (names[i] == name)
|
|
|
|
return i;
|
|
|
|
|
|
|
|
return SortMode().mode(); // use the default value
|
2009-04-11 18:25:12 +00:00
|
|
|
}
|