mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
Updated rs interface for new File Transfer.
tweaked Transfer displays to work with new interface. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@783 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
0d96b43d34
commit
6a8509740b
@ -224,8 +224,13 @@ void TransferFeed::updateDownloads()
|
||||
|
||||
if (rsFiles->FileDetails(*it, hintflags, fi))
|
||||
{
|
||||
// XXX HACK _ TOFIX >>>> fi.source);
|
||||
|
||||
SubFileItem *sfi = new SubFileItem(*it, fi.fname,
|
||||
fi.size, SFI_STATE_DOWNLOAD, fi.source);
|
||||
fi.size, SFI_STATE_DOWNLOAD, "");
|
||||
|
||||
// XXX HACK _ TOFIX >>>> fi.source);
|
||||
|
||||
mDownloads[*it] = sfi;
|
||||
mDownloadsLayout->addWidget(sfi);
|
||||
}
|
||||
@ -314,8 +319,13 @@ void TransferFeed::updateUploads()
|
||||
|
||||
if (rsFiles->FileDetails(*it, hintflags, fi))
|
||||
{
|
||||
// XXX HACK _ TOFIX >>>> fi.source);
|
||||
|
||||
SubFileItem *sfi = new SubFileItem(*it, fi.fname,
|
||||
fi.size, SFI_STATE_UPLOAD, fi.source);
|
||||
fi.size, SFI_STATE_UPLOAD, "");
|
||||
|
||||
// XXX HACK _ TOFIX >>>> fi.source);
|
||||
|
||||
mUploads[*it] = sfi;
|
||||
mUploadsLayout->addWidget(sfi);
|
||||
}
|
||||
|
@ -379,35 +379,81 @@ void TransfersDialog::insertTransfers()
|
||||
continue;
|
||||
}
|
||||
|
||||
std::list<TransferInfo>::iterator pit;
|
||||
for(pit = info.peers.begin(); pit != info.peers.end(); pit++)
|
||||
{
|
||||
symbol = "";
|
||||
coreId = QString::fromStdString(info.hash);
|
||||
name = QString::fromStdString(info.fname);
|
||||
sources = QString::fromStdString(info.source);
|
||||
sources = QString::fromStdString(pit->peerId);
|
||||
|
||||
switch(pit->status)
|
||||
{
|
||||
case FT_STATE_FAILED:
|
||||
status = "Failed";
|
||||
break;
|
||||
case FT_STATE_OKAY:
|
||||
status = "Okay";
|
||||
break;
|
||||
case FT_STATE_WAITING:
|
||||
status = "Waiting";
|
||||
break;
|
||||
case FT_STATE_DOWNLOADING:
|
||||
status = "Downloading";
|
||||
break;
|
||||
case FT_STATE_COMPLETE:
|
||||
default:
|
||||
status = "Complete";
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
if (info.downloadStatus == FT_STATE_COMPLETE)
|
||||
{
|
||||
status = "Complete";
|
||||
}
|
||||
|
||||
dlspeed = pit->tfRate * 1024.0;
|
||||
fileSize = info.size;
|
||||
completed = info.transfered;
|
||||
progress = info.transfered * 100.0 / info.size;
|
||||
remaining = (info.size - info.transfered) / (info.tfRate * 1024.0);
|
||||
|
||||
addItem(symbol, name, coreId, fileSize, progress,
|
||||
dlspeed, sources, status, completed, remaining);
|
||||
|
||||
/* if found in selectedIds -> select again */
|
||||
if (selectedIds.end() != std::find(selectedIds.begin(), selectedIds.end(), info.hash))
|
||||
{
|
||||
selection->select(DLListModel->index(dlCount, 0),
|
||||
QItemSelectionModel::Rows | QItemSelectionModel::SelectCurrent);
|
||||
|
||||
}
|
||||
dlCount++;
|
||||
}
|
||||
/* alternative ... if no peers there stick it in anyway */
|
||||
if (info.peers.size() == 0)
|
||||
{
|
||||
symbol = "";
|
||||
coreId = QString::fromStdString(info.hash);
|
||||
name = QString::fromStdString(info.fname);
|
||||
sources = QString::fromStdString("Unknown");
|
||||
|
||||
switch(info.downloadStatus)
|
||||
{
|
||||
|
||||
/******** XXX HAND CODED!
|
||||
#define FT_STATE_FAILED 0
|
||||
#define FT_STATE_OKAY 1
|
||||
#define FT_STATE_WAITING 2
|
||||
#define FT_STATE_DOWNLOADING 3
|
||||
#define FT_STATE_COMPLETE 4
|
||||
*******************/
|
||||
|
||||
case 0: /* FAILED */
|
||||
case FT_STATE_FAILED:
|
||||
status = "Failed";
|
||||
break;
|
||||
case 1: /* OKAY */
|
||||
case FT_STATE_OKAY:
|
||||
status = "Okay";
|
||||
break;
|
||||
case 2: /* WAITING */
|
||||
case FT_STATE_WAITING:
|
||||
status = "Waiting";
|
||||
break;
|
||||
case 3: /* DOWNLOADING */
|
||||
case FT_STATE_DOWNLOADING:
|
||||
status = "Downloading";
|
||||
break;
|
||||
case 4: /* COMPLETE */
|
||||
case FT_STATE_COMPLETE:
|
||||
default:
|
||||
status = "Complete";
|
||||
break;
|
||||
@ -432,6 +478,7 @@ void TransfersDialog::insertTransfers()
|
||||
}
|
||||
dlCount++;
|
||||
}
|
||||
}
|
||||
|
||||
for(it = upHashes.begin(); it != upHashes.end(); it++)
|
||||
{
|
||||
@ -441,35 +488,73 @@ void TransfersDialog::insertTransfers()
|
||||
continue;
|
||||
}
|
||||
|
||||
std::list<TransferInfo>::iterator pit;
|
||||
for(pit = info.peers.begin(); pit != info.peers.end(); pit++)
|
||||
{
|
||||
symbol = "";
|
||||
coreId = QString::fromStdString(info.hash);
|
||||
name = QString::fromStdString(info.fname);
|
||||
sources = QString::fromStdString(info.source);
|
||||
sources = QString::fromStdString(pit->peerId);
|
||||
|
||||
switch(pit->status)
|
||||
{
|
||||
case FT_STATE_FAILED:
|
||||
status = "Failed";
|
||||
break;
|
||||
case FT_STATE_OKAY:
|
||||
status = "Okay";
|
||||
break;
|
||||
case FT_STATE_WAITING:
|
||||
status = "Waiting";
|
||||
break;
|
||||
case FT_STATE_DOWNLOADING:
|
||||
status = "Downloading";
|
||||
break;
|
||||
case FT_STATE_COMPLETE:
|
||||
default:
|
||||
status = "Complete";
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
if (info.downloadStatus == FT_STATE_COMPLETE)
|
||||
{
|
||||
status = "Complete";
|
||||
}
|
||||
|
||||
dlspeed = pit->tfRate * 1024.0;
|
||||
fileSize = info.size;
|
||||
completed = info.transfered;
|
||||
progress = info.transfered * 100.0 / info.size;
|
||||
remaining = (info.size - info.transfered) / (info.tfRate * 1024.0);
|
||||
|
||||
addUploadItem(symbol, name, coreId, fileSize, progress,
|
||||
dlspeed, sources, status, completed, remaining);
|
||||
ulCount++;
|
||||
}
|
||||
|
||||
if (info.peers.size() == 0)
|
||||
{
|
||||
symbol = "";
|
||||
coreId = QString::fromStdString(info.hash);
|
||||
name = QString::fromStdString(info.fname);
|
||||
sources = QString::fromStdString("Unknown");
|
||||
|
||||
switch(info.downloadStatus)
|
||||
{
|
||||
|
||||
/******** XXX HAND CODED!
|
||||
#define FT_STATE_FAILED 0
|
||||
#define FT_STATE_OKAY 1
|
||||
#define FT_STATE_WAITING 2
|
||||
#define FT_STATE_DOWNLOADING 3
|
||||
#define FT_STATE_COMPLETE 4
|
||||
*******************/
|
||||
|
||||
case 0: /* FAILED */
|
||||
case FT_STATE_FAILED:
|
||||
status = "Failed";
|
||||
break;
|
||||
case 1: /* OKAY */
|
||||
case FT_STATE_OKAY:
|
||||
status = "Okay";
|
||||
break;
|
||||
case 2: /* WAITING */
|
||||
case FT_STATE_WAITING:
|
||||
status = "Waiting";
|
||||
break;
|
||||
case 3: /* DOWNLOADING */
|
||||
case FT_STATE_DOWNLOADING:
|
||||
status = "Downloading";
|
||||
break;
|
||||
case 4: /* COMPLETE */
|
||||
case FT_STATE_COMPLETE:
|
||||
default:
|
||||
status = "Complete";
|
||||
break;
|
||||
@ -487,6 +572,7 @@ void TransfersDialog::insertTransfers()
|
||||
ulCount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void TransfersDialog::cancel()
|
||||
{
|
||||
|
@ -51,7 +51,8 @@ GraphWidget::GraphWidget(QWidget *parent)
|
||||
#if 0
|
||||
QGraphicsScene *scene = new QGraphicsScene(this);
|
||||
scene->setItemIndexMethod(QGraphicsScene::NoIndex);
|
||||
scene->setSceneRect(-200, -200, 400, 400);
|
||||
//scene->setSceneRect(-200, -200, 400, 400);
|
||||
scene->setSceneRect(-200, -200, 1000, 1000);
|
||||
setScene(scene);
|
||||
|
||||
centerNode = new Node(this, 1, "You");
|
||||
@ -66,7 +67,8 @@ GraphWidget::GraphWidget(QWidget *parent)
|
||||
setTransformationAnchor(AnchorUnderMouse);
|
||||
setResizeAnchor(AnchorViewCenter);
|
||||
scale(0.8, 0.8);
|
||||
setMinimumSize(400, 400);
|
||||
//setMinimumSize(400, 400);
|
||||
//setMinimumSize(1000, 1000);
|
||||
setWindowTitle(tr("Elastic Nodes"));
|
||||
|
||||
clearGraph();
|
||||
@ -81,21 +83,14 @@ bool GraphWidget::clearGraph()
|
||||
|
||||
QGraphicsScene *scene = new QGraphicsScene(this);
|
||||
scene->setItemIndexMethod(QGraphicsScene::NoIndex);
|
||||
scene->setSceneRect(-200, -200, 400, 400);
|
||||
//scene->setSceneRect(-200, -200, 400, 400);
|
||||
scene->setSceneRect(-200, -200, 1000, 1000);
|
||||
setScene(scene);
|
||||
//setCacheMode(CacheBackground);
|
||||
//setRenderHint(QPainter::Antialiasing);
|
||||
//setTransformationAnchor(AnchorUnderMouse);
|
||||
//setResizeAnchor(AnchorViewCenter);
|
||||
|
||||
centerNode = new Node(this, 1, "OwnId", "You");
|
||||
scene->addItem(centerNode);
|
||||
centerNode->setPos(0, 0);
|
||||
|
||||
//scale(0.8, 0.8);
|
||||
//setMinimumSize(400, 400);
|
||||
//setWindowTitle(tr("Elastic Nodes"));
|
||||
|
||||
if (oldscene)
|
||||
{
|
||||
delete oldscene;
|
||||
|
@ -30,7 +30,6 @@
|
||||
* #define DEBUG_ITEM 1
|
||||
****/
|
||||
|
||||
#define DEBUG_ITEM 1
|
||||
|
||||
/*******************************************************************
|
||||
* SubFileItem fully controls the file transfer from the gui side
|
||||
@ -541,7 +540,10 @@ void SubFileItem::download()
|
||||
std::cerr << "SubFileItem::download() Calling File Request";
|
||||
std::cerr << std::endl;
|
||||
std::list<std::string> srcIds;
|
||||
if (mSrcId != "")
|
||||
{
|
||||
srcIds.push_back(mSrcId);
|
||||
}
|
||||
rsFiles->FileRequest(mFileName, mFileHash, mFileSize, "", 0, srcIds);
|
||||
|
||||
}
|
||||
|
@ -37,6 +37,22 @@ typedef std::string RsChanId;
|
||||
typedef std::string RsMsgId;
|
||||
typedef std::string RsAuthId;
|
||||
|
||||
const uint32_t FT_STATE_FAILED = 0x0000;
|
||||
const uint32_t FT_STATE_OKAY = 0x0001;
|
||||
const uint32_t FT_STATE_WAITING = 0x0002;
|
||||
const uint32_t FT_STATE_DOWNLOADING = 0x0003;
|
||||
const uint32_t FT_STATE_COMPLETE = 0x0004;
|
||||
|
||||
class TransferInfo
|
||||
{
|
||||
public:
|
||||
/**** Need Some of these Fields ****/
|
||||
std::string peerId;
|
||||
std::string name; /* if has alternative name? */
|
||||
double tfRate; /* kbytes */
|
||||
int status; /* FT_STATE_... */
|
||||
};
|
||||
|
||||
|
||||
class FileInfo
|
||||
{
|
||||
@ -75,37 +91,13 @@ static const int kRsFiStatusDone = 2;
|
||||
double rank;
|
||||
int age;
|
||||
|
||||
/* Old FileTransferInfo Entries */
|
||||
public:
|
||||
std::string source;
|
||||
std::list<std::string> peerIds;
|
||||
int transfered;
|
||||
double tfRate; /* kbytes */
|
||||
bool download;
|
||||
int downloadStatus; /* 0 = Err, 1 = Ok, 2 = Done */
|
||||
|
||||
/* ENTRIES USED BY SFI ***
|
||||
*
|
||||
* path,
|
||||
* fname,
|
||||
* hash,
|
||||
* size,
|
||||
* avail,
|
||||
*
|
||||
* source?
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/* Transfer Stuff */
|
||||
uint64_t transfered;
|
||||
double tfRate; /* in kbytes */
|
||||
uint32_t downloadStatus; /* 0 = Err, 1 = Ok, 2 = Done */
|
||||
std::list<TransferInfo> peers;
|
||||
};
|
||||
|
||||
class FileTransferInfo: public FileInfo
|
||||
{
|
||||
public:
|
||||
FileTransferInfo() { return; }
|
||||
};
|
||||
|
||||
|
||||
std::ostream &operator<<(std::ostream &out, const FileInfo &info);
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user