/usr/include/fatrat/Queue.h is in fatrat-dev 1.2.0~beta2-0ubuntu8.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 | /*
FatRat download manager
http://fatrat.dolezel.info
Copyright (C) 2006-2008 Lubos Dolezel <lubos a dolezel.info>
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.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
In addition, as a special exemption, Luboš Doležel gives permission
to link the code of FatRat with the OpenSSL project's
"OpenSSL" library (or with modified versions of it that use the; same
license as the "OpenSSL" library), and distribute the linked
executables. You must obey the GNU General Public License in all
respects for all of the code used other than "OpenSSL".
*/
#ifndef _FRQUEUE_H
#define _FRQUEUE_H
#include <QDomNode>
#include <QQueue>
#include <QReadWriteLock>
#include <QList>
#include <QPair>
#include <QUuid>
#include <QThread>
#include "Transfer.h"
class Queue;
extern QList<Queue*> g_queues;
extern QReadWriteLock g_queuesLock;
class Queue : public QObject
{
Q_OBJECT
public:
Queue();
~Queue();
static void stopQueues();
static void loadQueues();
static void saveQueues();
static void saveQueuesAsync();
static void unloadQueues();
Q_INVOKABLE void setSpeedLimits(int down,int up) { m_nDownLimit=down; m_nUpLimit=up; }
void speedLimits(int& down, int& up) const { down=m_nDownLimit; up=m_nUpLimit; }
Q_INVOKABLE void setTransferLimits(int down = -1,int up = -1) { m_nDownTransferLimit=down; m_nUpTransferLimit=up; }
void transferLimits(int& down,int& up) const { down=m_nDownTransferLimit; up=m_nUpTransferLimit; }
Q_INVOKABLE void setName(QString name);
Q_INVOKABLE QString name() const;
Q_PROPERTY(QString name READ name WRITE setName)
Q_INVOKABLE void setDefaultDirectory(QString path);
Q_INVOKABLE QString defaultDirectory() const;
Q_PROPERTY(QString defaultDirectory READ defaultDirectory WRITE setDefaultDirectory)
Q_INVOKABLE void setMoveDirectory(QString path);
Q_INVOKABLE QString moveDirectory() const;
Q_PROPERTY(QString moveDirectory READ moveDirectory WRITE setMoveDirectory)
Q_INVOKABLE QString uuid() const { return m_uuid.toString(); }
Q_PROPERTY(QString uuid READ uuid)
Q_INVOKABLE bool upAsDown() const { return m_bUpAsDown; }
Q_INVOKABLE void setUpAsDown(bool v) { m_bUpAsDown=v; }
Q_PROPERTY(bool upAsDown READ upAsDown WRITE setUpAsDown)
Q_INVOKABLE int size();
Q_PROPERTY(int size READ size)
void lock() { m_lock.lockForRead(); }
void lockW() { m_lock.lockForWrite(); }
void unlock() { m_lock.unlock(); }
Q_INVOKABLE Transfer* at(int r);
Q_INVOKABLE void add(Transfer* d);
void add(QList<Transfer*> d);
Q_INVOKABLE int moveDown(int n, bool nolock = false);
Q_INVOKABLE int moveUp(int n, bool nolock = false);
Q_INVOKABLE void moveToTop(int n, bool nolock = false);
Q_INVOKABLE void moveToBottom(int n, bool nolock = false);
Q_INVOKABLE void moveToPos(int from, int to, bool nolock = false);
Q_INVOKABLE void remove(int n, bool nolock = false);
Q_INVOKABLE void removeWithData(int n, bool nolock = false);
Transfer* take(int n, bool nolock = false);
void autoLimits(int& down, int& up) const { down=m_nDownAuto; up=m_nUpAuto; }
void setAutoLimits(int down, int up);
bool contains(Transfer* t) const;
void stopAll();
void resumeAll();
QQueue<QPair<int,int> > speedData() const { return m_qSpeedData; }
public slots:
bool replace(Transfer* old, Transfer* _new);
bool replace(Transfer* old, QList<Transfer*> _new);
private:
void loadQueue(const QDomNode& node);
void saveQueue(QDomNode& node,QDomDocument& doc);
QString m_strName, m_strDefaultDirectory, m_strMoveDirectory;
int m_nDownLimit,m_nUpLimit,m_nDownTransferLimit,m_nUpTransferLimit;
int m_nDownAuto, m_nUpAuto;
bool m_bUpAsDown;
QUuid m_uuid;
mutable QReadWriteLock m_lock;
public:
// statistics
struct Stats
{
int active_d, waiting_d, active_u, waiting_u;
int down, up;
} m_stats;
protected:
void updateGraph();
QList<Transfer*> m_transfers;
QQueue<QPair<int,int> > m_qSpeedData;
friend class QueueMgr;
class BackgroundSaver : public QThread
{
public:
virtual void run();
};
static bool m_bLoaded;
};
#endif
|