2009-04-11 18:25:12 +00:00
|
|
|
/*
|
2010-08-01 20:36:13 +00:00
|
|
|
* This file Copyright (C) Mnemosyne LLC
|
2009-04-11 18:25:12 +00:00
|
|
|
*
|
2010-08-01 20:36:13 +00:00
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License version 2
|
|
|
|
* as published by the Free Software Foundation.
|
|
|
|
*
|
|
|
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
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
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef QTR_FILTERS_H
|
|
|
|
#define QTR_FILTERS_H
|
|
|
|
|
|
|
|
#include <QMetaType>
|
|
|
|
#include <QString>
|
|
|
|
#include <QVariant>
|
|
|
|
|
|
|
|
class FilterMode
|
|
|
|
{
|
|
|
|
private:
|
|
|
|
int myMode;
|
|
|
|
public:
|
|
|
|
FilterMode( int mode=SHOW_ALL ): myMode(mode) { }
|
|
|
|
FilterMode( const QString& name ): myMode(modeFromName(name)) { }
|
|
|
|
static const QString names[];
|
2010-07-30 22:31:31 +00:00
|
|
|
enum { SHOW_ALL, SHOW_ACTIVE, SHOW_DOWNLOADING, SHOW_SEEDING, SHOW_PAUSED,
|
2011-08-01 22:24:24 +00:00
|
|
|
SHOW_FINISHED, SHOW_VERIFYING, SHOW_ERROR, NUM_MODES };
|
2009-04-11 18:25:12 +00:00
|
|
|
static int modeFromName( const QString& name );
|
|
|
|
static const QString& nameFromMode( int mode ) { return names[mode]; }
|
|
|
|
int mode() const { return myMode; }
|
|
|
|
const QString& name() const { return names[myMode]; }
|
|
|
|
};
|
|
|
|
|
|
|
|
class SortMode
|
|
|
|
{
|
|
|
|
private:
|
|
|
|
int myMode;
|
|
|
|
public:
|
|
|
|
SortMode( int mode=SORT_BY_ID ): myMode(mode) { }
|
|
|
|
SortMode( const QString& name ): myMode(modeFromName(name)) { }
|
|
|
|
static const QString names[];
|
|
|
|
enum { SORT_BY_ACTIVITY, SORT_BY_AGE, SORT_BY_ETA, SORT_BY_NAME,
|
2011-08-02 03:59:54 +00:00
|
|
|
SORT_BY_PROGRESS, SORT_BY_QUEUE, SORT_BY_RATIO, SORT_BY_SIZE,
|
2010-09-06 00:19:37 +00:00
|
|
|
SORT_BY_STATE, SORT_BY_ID, NUM_MODES };
|
2009-04-11 18:25:12 +00:00
|
|
|
static int modeFromName( const QString& name );
|
|
|
|
static const QString& nameFromMode( int mode );
|
|
|
|
int mode() const { return myMode; }
|
|
|
|
const QString& name() const { return names[myMode]; }
|
|
|
|
};
|
|
|
|
|
|
|
|
Q_DECLARE_METATYPE(FilterMode)
|
|
|
|
Q_DECLARE_METATYPE(SortMode)
|
|
|
|
|
|
|
|
#endif
|