1/*
2 * This file Copyright (C) Mnemosyne LLC
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2
6 * as published by the Free Software Foundation.
7 *
8 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
9 *
10 * $Id: filters.cc 12611 2011-08-02 03:59:54Z jordan $
11 */
12
13#include "filters.h"
14
15const QString FilterMode::names[NUM_MODES] =
16{
17    "show-all",
18    "show-active",
19    "show-downloading",
20    "show-seeding",
21    "show-paused",
22    "show-finished",
23    "show-verifying",
24    "show-error",
25};
26
27int
28FilterMode :: modeFromName( const QString& name )
29{
30    for( int i=0; i<NUM_MODES; ++i )
31        if( names[i] == name )
32            return i;
33    return FilterMode().mode(); // use the default value
34}
35
36const QString SortMode::names[NUM_MODES] = {
37    "sort-by-activity",
38    "sort-by-age",
39    "sort-by-eta",
40    "sort-by-name",
41    "sort-by-progress",
42    "sort-by-queue"
43    "sort-by-ratio",
44    "sort-by-size",
45    "sort-by-state",
46    "sort-by-id"
47};
48
49int
50SortMode :: modeFromName( const QString& name )
51{
52    for( int i=0; i<NUM_MODES; ++i )
53        if( names[i] == name )
54            return i;
55    return SortMode().mode(); // use the default value
56}
57