~ubuntu-branches/ubuntu/maverick/transmission/maverick

« back to all changes in this revision

Viewing changes to qt/filters.cc

  • Committer: Bazaar Package Importer
  • Author(s): Krzysztof Klimonda
  • Date: 2009-05-22 21:57:30 UTC
  • mfrom: (1.2.2 upstream)
  • mto: (2.1.18 sid) (1.3.8 upstream)
  • mto: This revision was merged to the branch mainline in revision 36.
  • Revision ID: james.westby@ubuntu.com-20090522215730-ly5kgv5aw9ig2u82
Tags: upstream-1.61
ImportĀ upstreamĀ versionĀ 1.61

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * This file Copyright (C) 2009 Charles Kerr <charles@transmissionbt.com>
 
3
 *
 
4
 * This file is licensed by the GPL version 2.  Works owned by the
 
5
 * Transmission project are granted a special exemption to clause 2(b)
 
6
 * so that the bulk of its code can remain under the MIT license.
 
7
 * This exemption does not extend to derived works not owned by
 
8
 * the Transmission project.
 
9
 *
 
10
 * $Id:$
 
11
 */
 
12
 
 
13
#include "filters.h"
 
14
 
 
15
const QString FilterMode::names[NUM_MODES] = {
 
16
    "show-all",
 
17
    "show-active",
 
18
    "show-downloading",
 
19
    "show-seeding",
 
20
    "show-paused"
 
21
};
 
22
 
 
23
int
 
24
FilterMode :: modeFromName( const QString& name )
 
25
{
 
26
    for( int i=0; i<NUM_MODES; ++i )
 
27
        if( names[i] == name )
 
28
            return i;
 
29
    return FilterMode().mode(); // use the default value
 
30
}
 
31
 
 
32
const QString SortMode::names[NUM_MODES] = {
 
33
    "sort-by-activity",
 
34
    "sort-by-age",
 
35
    "sort-by-eta",
 
36
    "sort-by-name",
 
37
    "sort-by-progress",
 
38
    "sort-by-ratio",
 
39
    "sort-by-size",
 
40
    "sort-by-state",
 
41
    "sort-by-tracker",
 
42
    "sort-by-id"
 
43
};
 
44
 
 
45
int
 
46
SortMode :: modeFromName( const QString& name )
 
47
{
 
48
    for( int i=0; i<NUM_MODES; ++i )
 
49
        if( names[i] == name )
 
50
            return i;
 
51
    return SortMode().mode(); // use the default value
 
52
}