2009-04-11 18:25:12 +00:00
|
|
|
/*
|
2014-01-19 01:09:44 +00:00
|
|
|
* This file Copyright (C) 2009-2014 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
|
|
|
*
|
2009-05-31 19:33:48 +00:00
|
|
|
* $Id$
|
2009-04-11 18:25:12 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "filters.h"
|
|
|
|
|
2010-07-30 22:31:31 +00:00
|
|
|
const QString FilterMode::names[NUM_MODES] =
|
|
|
|
{
|
2013-09-14 22:45:04 +00:00
|
|
|
"show-all",
|
|
|
|
"show-active",
|
|
|
|
"show-downloading",
|
|
|
|
"show-seeding",
|
|
|
|
"show-paused",
|
|
|
|
"show-finished",
|
|
|
|
"show-verifying",
|
|
|
|
"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] =
|
|
|
|
{
|
|
|
|
"sort-by-activity",
|
|
|
|
"sort-by-age",
|
|
|
|
"sort-by-eta",
|
|
|
|
"sort-by-name",
|
|
|
|
"sort-by-progress",
|
|
|
|
"sort-by-queue"
|
|
|
|
"sort-by-ratio",
|
|
|
|
"sort-by-size",
|
|
|
|
"sort-by-state",
|
|
|
|
"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
|
|
|
}
|