2008-06-20 08:43:23 -04:00
|
|
|
/****************************************************************
|
|
|
|
* RetroShare is distributed under the following license:
|
|
|
|
*
|
|
|
|
* Copyright (C) 2008 Robert Fernie
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
****************************************************************/
|
|
|
|
|
|
|
|
#ifndef _SUB_FILE_ITEM_DIALOG_H
|
|
|
|
#define _SUB_FILE_ITEM_DIALOG_H
|
|
|
|
|
|
|
|
#include "ui_SubFileItem.h"
|
|
|
|
|
|
|
|
#include <string>
|
2009-05-11 10:33:32 -04:00
|
|
|
#include <stdint.h>
|
2008-06-20 08:43:23 -04:00
|
|
|
|
2008-07-06 12:03:16 -04:00
|
|
|
const uint32_t SFI_MASK_STATE = 0x000f;
|
|
|
|
const uint32_t SFI_MASK_TYPE = 0x00f0;
|
|
|
|
const uint32_t SFI_MASK_FT = 0x0f00;
|
|
|
|
|
|
|
|
const uint32_t SFI_STATE_ERROR = 0x0001;
|
|
|
|
const uint32_t SFI_STATE_EXTRA = 0x0002;
|
|
|
|
const uint32_t SFI_STATE_REMOTE = 0x0003;
|
|
|
|
const uint32_t SFI_STATE_DOWNLOAD = 0x0004;
|
|
|
|
const uint32_t SFI_STATE_LOCAL = 0x0005;
|
|
|
|
const uint32_t SFI_STATE_UPLOAD = 0x0006;
|
|
|
|
|
|
|
|
const uint32_t SFI_TYPE_CHANNEL = 0x0010;
|
|
|
|
const uint32_t SFI_TYPE_ATTACH = 0x0020;
|
|
|
|
|
2008-06-20 08:43:23 -04:00
|
|
|
class SubFileItem : public QWidget, private Ui::SubFileItem
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2008-06-24 00:36:45 -04:00
|
|
|
/** Default Constructor */
|
2008-07-06 12:03:16 -04:00
|
|
|
SubFileItem(std::string localpath);
|
|
|
|
SubFileItem(std::string hash, std::string name, uint64_t size,
|
|
|
|
uint32_t flags, std::string srcId);
|
2008-06-20 08:43:23 -04:00
|
|
|
|
2008-06-24 00:36:45 -04:00
|
|
|
/** Default Destructor */
|
2008-06-20 08:43:23 -04:00
|
|
|
|
2008-06-24 00:36:45 -04:00
|
|
|
void small();
|
|
|
|
|
|
|
|
std::string FileHash() { return mFileHash; }
|
|
|
|
std::string FileName() { return mFileName; }
|
|
|
|
uint64_t FileSize() { return mFileSize; }
|
2008-07-06 12:03:16 -04:00
|
|
|
std::string FilePath() { return mPath; }
|
|
|
|
|
|
|
|
void updateItemStatic();
|
|
|
|
|
|
|
|
bool done();
|
|
|
|
bool ready();
|
2009-05-06 17:15:12 -04:00
|
|
|
uint32_t getState();
|
2008-06-20 08:43:23 -04:00
|
|
|
|
2008-07-06 12:03:16 -04:00
|
|
|
public slots:
|
|
|
|
void download();
|
2008-06-20 08:43:23 -04:00
|
|
|
|
|
|
|
private slots:
|
2008-07-06 12:03:16 -04:00
|
|
|
void toggle();
|
|
|
|
|
2008-06-20 08:43:23 -04:00
|
|
|
void cancel();
|
|
|
|
void play();
|
2008-07-06 12:03:16 -04:00
|
|
|
void save();
|
2008-06-20 08:43:23 -04:00
|
|
|
|
|
|
|
void updateItem();
|
|
|
|
|
|
|
|
private:
|
2008-07-06 12:03:16 -04:00
|
|
|
|
|
|
|
void Setup();
|
|
|
|
|
|
|
|
|
|
|
|
std::string mPath;
|
2008-06-20 08:43:23 -04:00
|
|
|
std::string mFileHash;
|
2008-06-24 00:36:45 -04:00
|
|
|
std::string mFileName;
|
|
|
|
uint64_t mFileSize;
|
2008-07-06 12:03:16 -04:00
|
|
|
std::string mSrcId;
|
|
|
|
|
|
|
|
uint32_t mMode;
|
|
|
|
uint32_t mType;
|
|
|
|
uint64_t mDivisor;
|
2008-06-20 08:43:23 -04:00
|
|
|
|
|
|
|
/* for display purposes */
|
|
|
|
float amountDone;
|
2009-05-06 17:15:12 -04:00
|
|
|
|
|
|
|
signals:
|
2009-05-07 13:01:45 -04:00
|
|
|
void fileFinished(SubFileItem * subFileItem);
|
2009-05-06 17:15:12 -04:00
|
|
|
|
2008-06-20 08:43:23 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|