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"
|
2009-05-11 10:33:32 -04:00
|
|
|
#include <stdint.h>
|
2014-03-17 16:56:06 -04:00
|
|
|
#include <retroshare/rstypes.h>
|
2012-02-01 07:21:14 -05:00
|
|
|
const uint32_t SFI_MASK_STATE = 0x000f;
|
|
|
|
const uint32_t SFI_MASK_TYPE = 0x00f0;
|
|
|
|
//const uint32_t SFI_MASK_FT = 0x0f00;
|
2011-07-06 19:46:16 -04:00
|
|
|
const uint32_t SFI_MASK_FLAG = 0xf000;
|
2008-07-06 12:03:16 -04:00
|
|
|
|
2012-02-01 07:21:14 -05:00
|
|
|
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;
|
2008-07-06 12:03:16 -04:00
|
|
|
|
2012-02-01 07:21:14 -05:00
|
|
|
const uint32_t SFI_TYPE_CHANNEL = 0x0010;
|
|
|
|
const uint32_t SFI_TYPE_ATTACH = 0x0020;
|
2008-07-06 12:03:16 -04:00
|
|
|
|
2017-05-15 15:37:22 -04:00
|
|
|
const uint32_t SFI_FLAG_CREATE = 0x1000;
|
|
|
|
const uint32_t SFI_FLAG_ALLOW_DELETE = 0x2000;
|
|
|
|
const uint32_t SFI_FLAG_ASSUME_FILE_READY = 0x4000;
|
2011-07-06 19:46:16 -04:00
|
|
|
|
2010-05-08 12:21:57 -04:00
|
|
|
|
|
|
|
//! This create a gui widget that allows users to access files shared by user
|
|
|
|
/*!
|
|
|
|
* Widget that allows user to share files with a visual attachment interface
|
|
|
|
* Note: extra files (files not already shared/hashed in rs) need to
|
|
|
|
* be hashed by the clients of this class or else objects of this class will
|
|
|
|
* have reduced functionality
|
|
|
|
*/
|
2008-06-20 08:43:23 -04:00
|
|
|
class SubFileItem : public QWidget, private Ui::SubFileItem
|
|
|
|
{
|
2012-02-01 07:21:14 -05:00
|
|
|
Q_OBJECT
|
2008-06-20 08:43:23 -04:00
|
|
|
|
|
|
|
public:
|
2012-02-01 07:21:14 -05:00
|
|
|
/** Default Constructor */
|
2014-03-17 16:56:06 -04:00
|
|
|
SubFileItem(const RsFileHash &hash, const std::string &name, const std::string &path, uint64_t size, uint32_t flags, const RsPeerId &srcId);
|
2008-06-20 08:43:23 -04:00
|
|
|
|
2012-02-01 07:21:14 -05:00
|
|
|
void smaller();
|
2008-06-24 00:36:45 -04:00
|
|
|
|
2014-03-17 16:56:06 -04:00
|
|
|
RsFileHash FileHash() { return mFileHash; }
|
2008-06-24 00:36:45 -04:00
|
|
|
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();
|
|
|
|
|
2012-02-01 07:21:14 -05:00
|
|
|
bool done();
|
2008-07-06 12:03:16 -04:00
|
|
|
bool ready();
|
2009-05-06 17:15:12 -04:00
|
|
|
uint32_t getState();
|
2008-06-20 08:43:23 -04:00
|
|
|
|
2010-10-05 16:39:14 -04:00
|
|
|
bool isDownloadable(bool &startable);
|
|
|
|
bool isPlayable(bool &startable);
|
|
|
|
|
2013-11-16 08:21:25 -05:00
|
|
|
void setChannelId(const std::string &channelId) { mChannelId = channelId; }
|
|
|
|
|
2012-02-01 07:21:14 -05:00
|
|
|
public slots:
|
2008-07-06 12:03:16 -04:00
|
|
|
void download();
|
2010-10-05 16:39:14 -04:00
|
|
|
void play();
|
2013-11-02 10:56:22 -04:00
|
|
|
void mediatype();
|
|
|
|
void copyLink();
|
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();
|
2017-05-14 15:26:45 -04:00
|
|
|
void del();
|
2008-07-06 12:03:16 -04:00
|
|
|
void save();
|
2008-06-20 08:43:23 -04:00
|
|
|
|
|
|
|
void updateItem();
|
|
|
|
|
2017-05-14 15:26:45 -04:00
|
|
|
signals:
|
|
|
|
void wantsToBeDeleted();
|
|
|
|
|
2008-06-20 08:43:23 -04:00
|
|
|
private:
|
2008-07-06 12:03:16 -04:00
|
|
|
void Setup();
|
|
|
|
|
|
|
|
std::string mPath;
|
2014-03-17 16:56:06 -04:00
|
|
|
RsFileHash mFileHash;
|
2008-06-24 00:36:45 -04:00
|
|
|
std::string mFileName;
|
|
|
|
uint64_t mFileSize;
|
2014-03-17 16:56:06 -04:00
|
|
|
RsPeerId mSrcId;
|
2013-11-16 08:21:25 -05:00
|
|
|
std::string mChannelId;
|
2008-07-06 12:03:16 -04:00
|
|
|
|
|
|
|
uint32_t mMode;
|
|
|
|
uint32_t mType;
|
2011-07-06 19:46:16 -04:00
|
|
|
uint32_t mFlag;
|
2008-07-06 12:03:16 -04:00
|
|
|
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:
|
2011-07-06 19:46:16 -04:00
|
|
|
void fileFinished(SubFileItem * subFileItem);
|
2008-06-20 08:43:23 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|