mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-24 15:09:33 -05:00
ported branch commits 2666-2668, 2670-2672, 2679, 2682-2683 into trunk
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@2702 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
063a366d12
commit
c6c8e63e91
@ -297,6 +297,8 @@ void FileIndexMonitor::updateCycle()
|
|||||||
mInCheck = true;
|
mInCheck = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cb->notifyHashingInfo("Examining shared files...") ;
|
||||||
|
|
||||||
std::vector<DirContentToHash> to_hash ;
|
std::vector<DirContentToHash> to_hash ;
|
||||||
|
|
||||||
while(moretodo)
|
while(moretodo)
|
||||||
@ -514,6 +516,8 @@ void FileIndexMonitor::updateCycle()
|
|||||||
if(!to_hash.empty())
|
if(!to_hash.empty())
|
||||||
hashFiles(to_hash) ;
|
hashFiles(to_hash) ;
|
||||||
|
|
||||||
|
cb->notifyHashingInfo("") ;
|
||||||
|
|
||||||
{ /* LOCKED DIRS */
|
{ /* LOCKED DIRS */
|
||||||
RsStackMutex stack(fiMutex); /**** LOCKED DIRS ****/
|
RsStackMutex stack(fiMutex); /**** LOCKED DIRS ****/
|
||||||
|
|
||||||
@ -579,7 +583,7 @@ void FileIndexMonitor::hashFiles(const std::vector<DirContentToHash>& to_hash)
|
|||||||
std::ostringstream tmpout;
|
std::ostringstream tmpout;
|
||||||
tmpout << cnt+1 << "/" << n_files << " (" << int(size/double(total_size)*100.0) << "%) : " << to_hash[i].fentries[j].name ;
|
tmpout << cnt+1 << "/" << n_files << " (" << int(size/double(total_size)*100.0) << "%) : " << to_hash[i].fentries[j].name ;
|
||||||
|
|
||||||
cb->notifyHashingInfo(tmpout.str()) ;
|
cb->notifyHashingInfo("Hashing file " + tmpout.str()) ;
|
||||||
|
|
||||||
FileEntry fe(to_hash[i].fentries[j]) ; // copied, because hashFile updates the hash member
|
FileEntry fe(to_hash[i].fentries[j]) ; // copied, because hashFile updates the hash member
|
||||||
|
|
||||||
@ -609,7 +613,6 @@ void FileIndexMonitor::hashFiles(const std::vector<DirContentToHash>& to_hash)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
cb->notifyHashingInfo("") ;
|
|
||||||
cb->notifyListChange(NOTIFY_LIST_DIRLIST_LOCAL, 0);
|
cb->notifyListChange(NOTIFY_LIST_DIRLIST_LOCAL, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ debug {
|
|||||||
################################# Linux ##########################################
|
################################# Linux ##########################################
|
||||||
linux-* {
|
linux-* {
|
||||||
DESTDIR = lib
|
DESTDIR = lib
|
||||||
QMAKE_CXXFLAGS *= -Wall
|
QMAKE_CXXFLAGS *= -Wall -D_FILE_OFFSET_BITS=64
|
||||||
QMAKE_CC = g++
|
QMAKE_CC = g++
|
||||||
|
|
||||||
SSL_DIR = /usr/include/openssl
|
SSL_DIR = /usr/include/openssl
|
||||||
|
@ -359,9 +359,9 @@ bool AuthGPG::storeAllKeys_locked()
|
|||||||
if (GPG_ERR_NO_ERROR != gpgme_op_keylist_start (CTX, "", 0))
|
if (GPG_ERR_NO_ERROR != gpgme_op_keylist_start (CTX, "", 0))
|
||||||
{
|
{
|
||||||
std::cerr << "AuthGPG::storeAllKeys_locked() Error iterating through KeyList" << std::endl;
|
std::cerr << "AuthGPG::storeAllKeys_locked() Error iterating through KeyList" << std::endl;
|
||||||
if (rsicontrol != NULL) {
|
// if (rsicontrol != NULL) {
|
||||||
rsicontrol->getNotify().notifyErrorMsg(0,0,"Error reading gpg keyring, cannot acess key list.");
|
// rsicontrol->getNotify().notifyErrorMsg(0,0,"Error reading gpg keyring, cannot acess key list.");
|
||||||
}
|
// }
|
||||||
gpgme_set_keylist_mode(CTX, origmode);
|
gpgme_set_keylist_mode(CTX, origmode);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -371,9 +371,9 @@ bool AuthGPG::storeAllKeys_locked()
|
|||||||
ERR = gpgme_op_keylist_next (CTX, &KEY);
|
ERR = gpgme_op_keylist_next (CTX, &KEY);
|
||||||
if (GPG_ERR_NO_ERROR != ERR) {
|
if (GPG_ERR_NO_ERROR != ERR) {
|
||||||
std::cerr << "AuthGPG::storeAllKeys_locked() didn't find any gpg key in the keyring" << std::endl;
|
std::cerr << "AuthGPG::storeAllKeys_locked() didn't find any gpg key in the keyring" << std::endl;
|
||||||
if (rsicontrol != NULL) {
|
// if (rsicontrol != NULL) {
|
||||||
rsicontrol->getNotify().notifyErrorMsg(0,0,"Error reading gpg keyring, cannot find any key in the list.");
|
// rsicontrol->getNotify().notifyErrorMsg(0,0,"Error reading gpg keyring, cannot find any key in the list.");
|
||||||
}
|
// }
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
//let's start a new list
|
//let's start a new list
|
||||||
|
@ -18,6 +18,7 @@ debug {
|
|||||||
# Put lib dir in QMAKE_LFLAGS so it appears before -L/usr/lib
|
# Put lib dir in QMAKE_LFLAGS so it appears before -L/usr/lib
|
||||||
linux-* {
|
linux-* {
|
||||||
CONFIG += version_detail_bash_script
|
CONFIG += version_detail_bash_script
|
||||||
|
QMAKE_CXXFLAGS *= -D_FILE_OFFSET_BITS=64
|
||||||
LIBS += ../../libretroshare/src/lib/libretroshare.a
|
LIBS += ../../libretroshare/src/lib/libretroshare.a
|
||||||
LIBS += -lssl -lgpgme -lupnp
|
LIBS += -lssl -lgpgme -lupnp
|
||||||
}
|
}
|
||||||
|
@ -391,7 +391,7 @@ void MainWindow::updateHashingInfo(const QString& s)
|
|||||||
_hashing_info_label->hide() ;
|
_hashing_info_label->hide() ;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_hashing_info_label->setText("Hashing file " + s) ;
|
_hashing_info_label->setText(s) ;
|
||||||
_hashing_info_label->show() ;
|
_hashing_info_label->show() ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -824,9 +824,6 @@ void SearchDialog::insertFile(const std::string& txt,qulonglong searchId, const
|
|||||||
|
|
||||||
if(nb_results[searchId] >= ui._max_results_SB->value())
|
if(nb_results[searchId] >= ui._max_results_SB->value())
|
||||||
return ;
|
return ;
|
||||||
else
|
|
||||||
++nb_results[searchId] ;
|
|
||||||
|
|
||||||
|
|
||||||
// 1 - look in result window whether the file already exists.
|
// 1 - look in result window whether the file already exists.
|
||||||
//
|
//
|
||||||
@ -957,6 +954,8 @@ void SearchDialog::insertFile(const std::string& txt,qulonglong searchId, const
|
|||||||
|
|
||||||
if(!found)
|
if(!found)
|
||||||
{
|
{
|
||||||
|
++nb_results[searchId] ;
|
||||||
|
|
||||||
/* translate search results */
|
/* translate search results */
|
||||||
|
|
||||||
QTreeWidgetItem *item = new QTreeWidgetItem();
|
QTreeWidgetItem *item = new QTreeWidgetItem();
|
||||||
|
@ -228,10 +228,9 @@ TransfersDialog::TransfersDialog(QWidget *parent)
|
|||||||
clearcompletedAct = new QAction(QIcon(IMAGE_CLEARCOMPLETED), tr( "Clear Completed" ), this );
|
clearcompletedAct = new QAction(QIcon(IMAGE_CLEARCOMPLETED), tr( "Clear Completed" ), this );
|
||||||
connect( clearcompletedAct , SIGNAL( triggered() ), this, SLOT( clearcompleted() ) );
|
connect( clearcompletedAct , SIGNAL( triggered() ), this, SLOT( clearcompleted() ) );
|
||||||
|
|
||||||
#ifndef RS_RELEASE_VERSION
|
|
||||||
copylinkAct = new QAction(QIcon(IMAGE_COPYLINK), tr( "Copy retroshare Link" ), this );
|
copylinkAct = new QAction(QIcon(IMAGE_COPYLINK), tr( "Copy retroshare Link" ), this );
|
||||||
connect( copylinkAct , SIGNAL( triggered() ), this, SLOT( copyLink() ) );
|
connect( copylinkAct , SIGNAL( triggered() ), this, SLOT( copyLink() ) );
|
||||||
#endif
|
|
||||||
pastelinkAct = new QAction(QIcon(IMAGE_PASTELINK), tr( "Paste retroshare Link" ), this );
|
pastelinkAct = new QAction(QIcon(IMAGE_PASTELINK), tr( "Paste retroshare Link" ), this );
|
||||||
connect( pastelinkAct , SIGNAL( triggered() ), this, SLOT( pasteLink() ) );
|
connect( pastelinkAct , SIGNAL( triggered() ), this, SLOT( pasteLink() ) );
|
||||||
queueDownAct = new QAction(QIcon(":/images/go-down.png"), tr("Down"), this);
|
queueDownAct = new QAction(QIcon(":/images/go-down.png"), tr("Down"), this);
|
||||||
@ -294,26 +293,17 @@ void TransfersDialog::downloadListCostumPopupMenu( QPoint point )
|
|||||||
bool addOpenFileOption = false;
|
bool addOpenFileOption = false;
|
||||||
|
|
||||||
if (info.downloadStatus == FT_STATE_COMPLETE)
|
if (info.downloadStatus == FT_STATE_COMPLETE)
|
||||||
{
|
{
|
||||||
std::cerr << "Add Play Option" << std::endl;
|
std::cerr << "Add Play Option" << std::endl;
|
||||||
|
|
||||||
addOpenFileOption = true;
|
addOpenFileOption = true;
|
||||||
|
|
||||||
size_t pos = info.fname.find_last_of('.');
|
size_t pos = info.fname.find_last_of('.');
|
||||||
|
|
||||||
if (pos == std::string::npos) return; /* can't identify type of file */
|
/* check if the file is a media file */
|
||||||
|
if(pos != std::string::npos && misc::isPreviewable(info.fname.substr(pos + 1).c_str()))
|
||||||
/* check if the file is a media file */
|
addPlayOption = true;
|
||||||
if (misc::isPreviewable(info.fname.substr(pos + 1).c_str()))
|
}
|
||||||
{
|
|
||||||
addPlayOption = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
QMenu viewMenu( tr("View"), this );
|
|
||||||
|
|
||||||
QMenu priorityQueueMenu(tr("Move in Queue..."), this);
|
QMenu priorityQueueMenu(tr("Move in Queue..."), this);
|
||||||
priorityQueueMenu.setIcon(QIcon(IMAGE_PRIORITY));
|
priorityQueueMenu.setIcon(QIcon(IMAGE_PRIORITY));
|
||||||
@ -373,13 +363,18 @@ void TransfersDialog::downloadListCostumPopupMenu( QPoint point )
|
|||||||
if(all_downloading)
|
if(all_downloading)
|
||||||
contextMnu.addMenu( &chunkMenu);
|
contextMnu.addMenu( &chunkMenu);
|
||||||
|
|
||||||
if(single)
|
if(!all_paused)
|
||||||
{
|
|
||||||
if(info.downloadStatus == FT_STATE_PAUSED)
|
|
||||||
contextMnu.addAction( resumeAct);
|
|
||||||
else if(info.downloadStatus != FT_STATE_COMPLETE)
|
|
||||||
contextMnu.addAction( pauseAct);
|
contextMnu.addAction( pauseAct);
|
||||||
}
|
if(!all_downld)
|
||||||
|
contextMnu.addAction( resumeAct);
|
||||||
|
|
||||||
|
if(single)
|
||||||
|
{
|
||||||
|
if(info.downloadStatus == FT_STATE_PAUSED)
|
||||||
|
contextMnu.addAction( resumeAct);
|
||||||
|
else if(info.downloadStatus != FT_STATE_COMPLETE)
|
||||||
|
contextMnu.addAction( pauseAct);
|
||||||
|
}
|
||||||
|
|
||||||
if(info.downloadStatus != FT_STATE_COMPLETE)
|
if(info.downloadStatus != FT_STATE_COMPLETE)
|
||||||
contextMnu.addAction( cancelAct);
|
contextMnu.addAction( cancelAct);
|
||||||
@ -402,15 +397,14 @@ void TransfersDialog::downloadListCostumPopupMenu( QPoint point )
|
|||||||
|
|
||||||
contextMnu.addAction( clearcompletedAct);
|
contextMnu.addAction( clearcompletedAct);
|
||||||
contextMnu.addSeparator();
|
contextMnu.addSeparator();
|
||||||
#ifndef RS_RELEASE_VERSION
|
|
||||||
if(single)
|
if(!items.empty())
|
||||||
contextMnu.addAction( copylinkAct);
|
contextMnu.addAction( copylinkAct);
|
||||||
#endif
|
|
||||||
if(!RSLinkClipboard::empty())
|
if(!RSLinkClipboard::empty())
|
||||||
contextMnu.addAction( pastelinkAct);
|
contextMnu.addAction( pastelinkAct);
|
||||||
|
|
||||||
contextMnu.addSeparator();
|
contextMnu.addSeparator();
|
||||||
contextMnu.addMenu( &viewMenu);
|
|
||||||
|
|
||||||
contextMnu.exec( mevent.globalPos() );
|
contextMnu.exec( mevent.globalPos() );
|
||||||
}
|
}
|
||||||
@ -479,7 +473,7 @@ int TransfersDialog::addItem(const QString&, const QString& name, const QString&
|
|||||||
return row;
|
return row;
|
||||||
}
|
}
|
||||||
|
|
||||||
int TransfersDialog::addPeerToItem(int row, const QString& name, const QString& coreID, double dlspeed, const QString& status, const FileProgressInfo& peerInfo)
|
int TransfersDialog::addPeerToItem(int row, const QString& name, const QString& coreID, double dlspeed, uint32_t status, const FileProgressInfo& peerInfo)
|
||||||
{
|
{
|
||||||
QStandardItem *dlItem = DLListModel->item(row);
|
QStandardItem *dlItem = DLListModel->item(row);
|
||||||
if (!dlItem) return -1;
|
if (!dlItem) return -1;
|
||||||
@ -496,36 +490,41 @@ int TransfersDialog::addPeerToItem(int row, const QString& name, const QString&
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (childRow == -1) {
|
|
||||||
|
QStandardItem *si1 = NULL,*si7=NULL;
|
||||||
|
|
||||||
|
if (childRow == -1)
|
||||||
|
{
|
||||||
//set this false if you want to expand on double click
|
//set this false if you want to expand on double click
|
||||||
dlItem->setEditable(false);
|
dlItem->setEditable(false);
|
||||||
|
|
||||||
QList<QStandardItem *> items;
|
QStandardItem *i1 = new QStandardItem();
|
||||||
QStandardItem *i1 = new QStandardItem(); i1->setData(QVariant((QString)" "+name), Qt::DisplayRole);
|
QStandardItem *i2 = new QStandardItem();
|
||||||
QStandardItem *i2 = new QStandardItem(); i2->setData(QVariant(QString()), Qt::DisplayRole);
|
QStandardItem *i3 = new QStandardItem();
|
||||||
QStandardItem *i3 = new QStandardItem(); i3->setData(QVariant(QString()), Qt::DisplayRole);
|
QStandardItem *i4 = new QStandardItem();
|
||||||
QStandardItem *i4 = new QStandardItem(); i4->setData(QVariant((double)dlspeed), Qt::DisplayRole);
|
QStandardItem *i5 = new QStandardItem();
|
||||||
QStandardItem *i5 = new QStandardItem(); i5->setData(QVariant::fromValue(peerInfo), Qt::DisplayRole);
|
QStandardItem *i6 = new QStandardItem();
|
||||||
QStandardItem *i6 = new QStandardItem(); i6->setData(QVariant(QString()), Qt::DisplayRole);
|
QStandardItem *i7 = new QStandardItem();
|
||||||
QStandardItem *i7 = new QStandardItem(); i7->setData(QVariant((QString)status), Qt::DisplayRole);
|
QStandardItem *i8 = new QStandardItem();
|
||||||
QStandardItem *i8 = new QStandardItem(); i8->setData(QVariant(QString()), Qt::DisplayRole); // blank field for priority
|
QStandardItem *i9 = new QStandardItem();
|
||||||
QStandardItem *i9 = new QStandardItem(); i9->setData(QVariant(QString()), Qt::DisplayRole);
|
QStandardItem *i10 = new QStandardItem();
|
||||||
QStandardItem *i10 = new QStandardItem(); i10->setData(QVariant(QString()), Qt::DisplayRole);
|
QStandardItem *i11 = new QStandardItem();
|
||||||
QStandardItem *i11 = new QStandardItem(); i11->setData(QVariant((QString)coreID), Qt::DisplayRole);
|
|
||||||
|
|
||||||
/* set status icon in the name field */
|
si1 = i1 ;
|
||||||
if (status == "Downloading") {
|
si7 = i7 ;
|
||||||
i1->setData(QIcon(QString::fromUtf8(":/images/Client0.png")), Qt::DecorationRole);
|
|
||||||
} else if (status == "Failed") {
|
QList<QStandardItem *> items;
|
||||||
i1->setData(QIcon(QString::fromUtf8(":/images/Client1.png")), Qt::DecorationRole);
|
i1->setData(QVariant((QString)" "+name), Qt::DisplayRole);
|
||||||
} else if (status == "Okay") {
|
i2->setData(QVariant(QString()), Qt::DisplayRole);
|
||||||
i1->setData(QIcon(QString::fromUtf8(":/images/Client2.png")), Qt::DecorationRole);
|
i3->setData(QVariant(QString()), Qt::DisplayRole);
|
||||||
} else if (status == "Waiting") {
|
i4->setData(QVariant((double)dlspeed), Qt::DisplayRole);
|
||||||
i1->setData(QIcon(QString::fromUtf8(":/images/Client3.png")), Qt::DecorationRole);
|
i5->setData(QVariant::fromValue(peerInfo), Qt::DisplayRole);
|
||||||
} else if (status == "Unknown") {
|
i6->setData(QVariant(QString()), Qt::DisplayRole);
|
||||||
i1->setData(QIcon(QString::fromUtf8(":/images/Client4.png")), Qt::DecorationRole);
|
|
||||||
} else if (status == "Complete") {
|
i8->setData(QVariant(QString()), Qt::DisplayRole); // blank field for priority
|
||||||
}
|
i9->setData(QVariant(QString()), Qt::DisplayRole);
|
||||||
|
i10->setData(QVariant(QString()), Qt::DisplayRole);
|
||||||
|
i11->setData(QVariant((QString)coreID), Qt::DisplayRole);
|
||||||
|
|
||||||
items.append(i1);
|
items.append(i1);
|
||||||
items.append(i2);
|
items.append(i2);
|
||||||
@ -541,64 +540,47 @@ int TransfersDialog::addPeerToItem(int row, const QString& name, const QString&
|
|||||||
dlItem->appendRow(items);
|
dlItem->appendRow(items);
|
||||||
|
|
||||||
childRow = dlItem->rowCount()-1 ;
|
childRow = dlItem->rowCount()-1 ;
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
//just update the child (peer)
|
//just update the child (peer)
|
||||||
dlItem->child(childRow, DLSPEED)->setData(QVariant((double)dlspeed), Qt::DisplayRole);
|
dlItem->child(childRow, DLSPEED)->setData(QVariant((double)dlspeed), Qt::DisplayRole);
|
||||||
dlItem->child(childRow, STATUS)->setData(QVariant((QString)status), Qt::DisplayRole);
|
|
||||||
dlItem->child(childRow, PROGRESS)->setData(QVariant::fromValue(peerInfo), Qt::DisplayRole);
|
dlItem->child(childRow, PROGRESS)->setData(QVariant::fromValue(peerInfo), Qt::DisplayRole);
|
||||||
|
|
||||||
std::set<QStandardItem *> dlitems;
|
si1 = dlItem->child(childRow,NAME) ;
|
||||||
std::set<QStandardItem *>::iterator it;
|
si7 = dlItem->child(childRow, STATUS) ;
|
||||||
getIdOfSelectedItems(dlitems);
|
|
||||||
|
|
||||||
FileInfo info;
|
|
||||||
for (it = dlitems.begin(); it != dlitems.end(); it ++) {
|
|
||||||
if (!rsFiles->FileDetails((*it)->data(Qt::DisplayRole).toString().toStdString(), RS_FILE_HINTS_DOWNLOAD, info)) continue;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* set status icon in the name field */
|
|
||||||
if ( info.downloadStatus == FT_STATE_DOWNLOADING)
|
|
||||||
{
|
|
||||||
dlItem->child(childRow, NAME)->setData(QIcon(QString::fromUtf8(":/images/Client0.png")), Qt::DecorationRole);
|
|
||||||
}
|
|
||||||
else if ( info.downloadStatus == FT_STATE_FAILED)
|
|
||||||
{
|
|
||||||
dlItem->child(childRow, NAME)->setData(QIcon(QString::fromUtf8(":/images/Client1.png")), Qt::DecorationRole);
|
|
||||||
}
|
|
||||||
else if ( info.downloadStatus == FT_STATE_OKAY)
|
|
||||||
{
|
|
||||||
dlItem->child(childRow, NAME)->setData(QIcon(QString::fromUtf8(":/images/Client2.png")), Qt::DecorationRole);
|
|
||||||
}
|
|
||||||
else if ( info.downloadStatus == FT_STATE_WAITING)
|
|
||||||
{
|
|
||||||
dlItem->child(childRow, NAME)->setData(QIcon(QString::fromUtf8(":/images/Client3.png")), Qt::DecorationRole);
|
|
||||||
}
|
|
||||||
else if ( info.downloadStatus == FT_STATE_COMPLETE)
|
|
||||||
{
|
|
||||||
dlItem->child(childRow, NAME)->setData(QIcon(QString::fromUtf8(":/images/Client0.png")), Qt::DecorationRole);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
//dlItem->child(childRow, NAME)->setData(QIcon(QString::fromUtf8(":/images/Client4.png")), Qt::DecorationRole);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* set status icon in the name field */
|
|
||||||
/*if (status == "Downloading") {
|
|
||||||
dlItem->child(childRow, NAME)->setData(QIcon(QString::fromUtf8(":/images/Client0.png")), Qt::DecorationRole);
|
|
||||||
} else if (status == "Failed") {
|
|
||||||
dlItem->child(childRow, NAME)->setData(QIcon(QString::fromUtf8(":/images/Client1.png")), Qt::DecorationRole);
|
|
||||||
} else if (status == "Okay") {
|
|
||||||
dlItem->child(childRow, NAME)->setData(QIcon(QString::fromUtf8(":/images/Client2.png")), Qt::DecorationRole);
|
|
||||||
} else if (status == "Waiting") {
|
|
||||||
dlItem->child(childRow, NAME)->setData(QIcon(QString::fromUtf8(":/images/Client3.png")), Qt::DecorationRole);
|
|
||||||
} else if (status == "Unknown") {
|
|
||||||
dlItem->child(childRow, NAME)->setData(QIcon(QString::fromUtf8(":/images/Client4.png")), Qt::DecorationRole);
|
|
||||||
} else if (status == "Complete") {
|
|
||||||
}*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return childRow;
|
QString sstatus;
|
||||||
|
switch (status)
|
||||||
|
{
|
||||||
|
case FT_STATE_FAILED: si7->setData(QVariant(tr("Failed"))) ;
|
||||||
|
si1->setData(QIcon(QString::fromUtf8(":/images/Client1.png")), Qt::DecorationRole);
|
||||||
|
break ;
|
||||||
|
|
||||||
|
case FT_STATE_OKAY: si7->setData(QVariant(tr("Okay")));
|
||||||
|
si1->setData(QIcon(QString::fromUtf8(":/images/Client2.png")), Qt::DecorationRole);
|
||||||
|
break ;
|
||||||
|
|
||||||
|
case FT_STATE_WAITING: si7->setData(QVariant(tr("")));
|
||||||
|
si1->setData(QIcon(QString::fromUtf8(":/images/Client3.png")), Qt::DecorationRole);
|
||||||
|
break ;
|
||||||
|
|
||||||
|
case FT_STATE_DOWNLOADING: si7->setData(QVariant(tr("Transferring")));
|
||||||
|
si1->setData(QIcon(QString::fromUtf8(":/images/Client0.png")), Qt::DecorationRole);
|
||||||
|
break ;
|
||||||
|
|
||||||
|
case FT_STATE_COMPLETE: si7->setData(QVariant(tr("Complete")));
|
||||||
|
si1->setData(QIcon(QString::fromUtf8(":/images/Client0.png")), Qt::DecorationRole);
|
||||||
|
break ;
|
||||||
|
|
||||||
|
default: si7->setData(QVariant(tr("")));
|
||||||
|
break ;
|
||||||
|
si1->setData(QIcon(QString::fromUtf8(":/images/Client4.png")), Qt::DecorationRole);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return childRow;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -725,9 +707,6 @@ void TransfersDialog::insertTransfers()
|
|||||||
int addedRow = addItem("", fileName, fileHash, fileSize, pinfo, fileDlspeed, sources, status, priority, completed, remaining, downloadtime);
|
int addedRow = addItem("", fileName, fileHash, fileSize, pinfo, fileDlspeed, sources, status, priority, completed, remaining, downloadtime);
|
||||||
used_hashes.insert(info.hash) ;
|
used_hashes.insert(info.hash) ;
|
||||||
|
|
||||||
/* continue to next download item if no peers to add */
|
|
||||||
if (!info.peers.size()) continue;
|
|
||||||
|
|
||||||
std::map<std::string, std::string>::iterator vit;
|
std::map<std::string, std::string>::iterator vit;
|
||||||
std::map<std::string, std::string> versions;
|
std::map<std::string, std::string> versions;
|
||||||
bool retv = rsDisc->getDiscVersions(versions);
|
bool retv = rsDisc->getDiscVersions(versions);
|
||||||
@ -745,15 +724,6 @@ void TransfersDialog::insertTransfers()
|
|||||||
version = tr("version: ") + QString::fromStdString(vit->second);
|
version = tr("version: ") + QString::fromStdString(vit->second);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString status;
|
|
||||||
switch (pit->status) {
|
|
||||||
case FT_STATE_FAILED: status = tr("Failed"); break;
|
|
||||||
case FT_STATE_OKAY: status = tr("Okay"); break;
|
|
||||||
case FT_STATE_WAITING: status = tr(""); break;
|
|
||||||
case FT_STATE_DOWNLOADING: status = tr("Transferring"); break;
|
|
||||||
case FT_STATE_COMPLETE: status = tr("Complete"); break;
|
|
||||||
default: status = tr(""); break;
|
|
||||||
}
|
|
||||||
double peerDlspeed = 0;
|
double peerDlspeed = 0;
|
||||||
if ((uint32_t)pit->status == FT_STATE_DOWNLOADING && info.downloadStatus != FT_STATE_PAUSED && info.downloadStatus != FT_STATE_COMPLETE)
|
if ((uint32_t)pit->status == FT_STATE_DOWNLOADING && info.downloadStatus != FT_STATE_PAUSED && info.downloadStatus != FT_STATE_COMPLETE)
|
||||||
peerDlspeed = pit->tfRate * 1024.0;
|
peerDlspeed = pit->tfRate * 1024.0;
|
||||||
@ -764,15 +734,7 @@ void TransfersDialog::insertTransfers()
|
|||||||
peerpinfo.progress = 0.0 ; // we don't display completion for sources.
|
peerpinfo.progress = 0.0 ; // we don't display completion for sources.
|
||||||
peerpinfo.nb_chunks = peerpinfo.cmap._map.empty()?0:fcinfo.chunks.size();
|
peerpinfo.nb_chunks = peerpinfo.cmap._map.empty()?0:fcinfo.chunks.size();
|
||||||
|
|
||||||
// std::cerr << std::endl ;
|
int row_id = addPeerToItem(addedRow, peerName, hashFileAndPeerId, peerDlspeed, pit->status, peerpinfo);
|
||||||
// std::cerr << "Source " << pit->peerId << " as map " << peerpinfo.cmap._map.size() << " compressed chunks" << std::endl ;
|
|
||||||
// for(uint j=0;j<peerpinfo.cmap._map.size();++j)
|
|
||||||
// std::cerr << peerpinfo.cmap._map[j] ;
|
|
||||||
// std::cerr << std::endl ;
|
|
||||||
// std::cerr << std::endl ;
|
|
||||||
|
|
||||||
// std::cout << "adding peer " << peerName.toStdString() << " to row " << addedRow << ", hashfile and peerid=" << hashFileAndPeerId.toStdString() << std::endl ;
|
|
||||||
int row_id = addPeerToItem(addedRow, peerName, hashFileAndPeerId, peerDlspeed, status, peerpinfo);
|
|
||||||
|
|
||||||
used_rows.insert(row_id) ;
|
used_rows.insert(row_id) ;
|
||||||
}
|
}
|
||||||
@ -804,40 +766,21 @@ void TransfersDialog::insertTransfers()
|
|||||||
//
|
//
|
||||||
std::list<std::string> upHashes;
|
std::list<std::string> upHashes;
|
||||||
rsFiles->FileUploads(upHashes);
|
rsFiles->FileUploads(upHashes);
|
||||||
//first clean the model in case some files are not uploaded anymore
|
|
||||||
//remove items that are not fiends anymore
|
|
||||||
removeIndex = 0;
|
|
||||||
while (removeIndex < ULListModel->rowCount()) {
|
|
||||||
if (!ULListModel->item(removeIndex, UHASH)) {
|
|
||||||
removeIndex++;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
std::string hash = ULListModel->item(removeIndex, UHASH)->data(Qt::EditRole).toString().toStdString();
|
|
||||||
std::list<std::string>::iterator upHashesIt;
|
|
||||||
bool found = false;
|
|
||||||
for (upHashesIt = upHashes.begin(); upHashesIt != upHashes.end(); upHashesIt++) {
|
|
||||||
if (hash == *upHashesIt) {
|
|
||||||
found = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!found) {
|
|
||||||
ULListModel->takeRow(removeIndex);
|
|
||||||
} else {
|
|
||||||
removeIndex++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for(it = upHashes.begin(); it != upHashes.end(); it++) {
|
used_hashes.clear() ;
|
||||||
|
|
||||||
|
for(it = upHashes.begin(); it != upHashes.end(); it++)
|
||||||
|
{
|
||||||
FileInfo info;
|
FileInfo info;
|
||||||
if (!rsFiles->FileDetails(*it, RS_FILE_HINTS_UPLOAD, info)) {
|
if (!rsFiles->FileDetails(*it, RS_FILE_HINTS_UPLOAD, info))
|
||||||
continue;
|
continue;
|
||||||
}
|
|
||||||
if((info.flags & CB_CODE_CACHE) && !ui._showCacheTransfers_CB->isChecked())
|
if((info.flags & CB_CODE_CACHE) && !ui._showCacheTransfers_CB->isChecked())
|
||||||
continue ;
|
continue ;
|
||||||
|
|
||||||
std::list<TransferInfo>::iterator pit;
|
std::list<TransferInfo>::iterator pit;
|
||||||
for(pit = info.peers.begin(); pit != info.peers.end(); pit++) {
|
for(pit = info.peers.begin(); pit != info.peers.end(); pit++)
|
||||||
|
{
|
||||||
if (pit->peerId == rsPeers->getOwnId()) //don't display transfer to ourselves
|
if (pit->peerId == rsPeers->getOwnId()) //don't display transfer to ourselves
|
||||||
continue ;
|
continue ;
|
||||||
|
|
||||||
@ -888,40 +831,26 @@ void TransfersDialog::insertTransfers()
|
|||||||
pinfo.progress = progress ;
|
pinfo.progress = progress ;
|
||||||
|
|
||||||
addUploadItem("", fileName, fileHash, fileSize, pinfo, dlspeed, sources, status, completed, remaining);
|
addUploadItem("", fileName, fileHash, fileSize, pinfo, dlspeed, sources, status, completed, remaining);
|
||||||
}
|
|
||||||
|
|
||||||
// if (info.peers.size() == 0) { //it has not been added (maybe only turtle tunnels
|
used_hashes.insert(info.hash) ;
|
||||||
// QString fileHash = QString::fromStdString(info.hash);
|
}
|
||||||
// QString fileName = QString::fromUtf8(info.fname.c_str());
|
|
||||||
// QString sources = tr("");
|
|
||||||
//
|
|
||||||
// QString status;
|
|
||||||
// switch(info.downloadStatus)
|
|
||||||
// {
|
|
||||||
// case FT_STATE_FAILED: status = tr("Failed"); break;
|
|
||||||
// case FT_STATE_OKAY: status = tr("Okay"); break;
|
|
||||||
// case FT_STATE_WAITING: status = tr("Waiting"); break;
|
|
||||||
// case FT_STATE_DOWNLOADING: status = tr("Uploading");break;
|
|
||||||
// case FT_STATE_COMPLETE:status = tr("Complete"); break;
|
|
||||||
// default: status = tr("Complete"); break;
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// double dlspeed = info.tfRate * 1024.0;
|
|
||||||
// qlonglong fileSize = info.size;
|
|
||||||
// double completed = info.transfered;
|
|
||||||
// double progress = info.transfered * 100.0 / info.size;
|
|
||||||
// qlonglong remaining = (info.size - info.transfered) / (info.tfRate * 1024.0);
|
|
||||||
//
|
|
||||||
// FileProgressInfo pinfo ;
|
|
||||||
// pinfo.progress = progress ;
|
|
||||||
// pinfo.cmap = CompressedChunkMap() ;
|
|
||||||
// pinfo.type = FileProgressInfo::DOWNLOAD_LINE ;
|
|
||||||
// pinfo.nb_chunks = 0 ;
|
|
||||||
//
|
|
||||||
// addUploadItem("", fileName, fileHash, fileSize, pinfo, dlspeed, sources, status, completed, remaining);
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// remove hashes that where not shown
|
||||||
|
//first clean the model in case some files are not download anymore
|
||||||
|
//remove items that are not fiends anymore
|
||||||
|
removeIndex = 0;
|
||||||
|
while (removeIndex < ULListModel->rowCount())
|
||||||
|
{
|
||||||
|
std::string hash = ULListModel->item(removeIndex, UHASH)->data(Qt::EditRole).toString().toStdString();
|
||||||
|
|
||||||
|
if(used_hashes.find(hash) == used_hashes.end())
|
||||||
|
ULListModel->takeRow(removeIndex);
|
||||||
|
else
|
||||||
|
removeIndex++;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QString TransfersDialog::getPeerName(const std::string& id) const
|
QString TransfersDialog::getPeerName(const std::string& id) const
|
||||||
@ -980,6 +909,7 @@ void TransfersDialog::cancel()
|
|||||||
void TransfersDialog::copyLink ()
|
void TransfersDialog::copyLink ()
|
||||||
{
|
{
|
||||||
QModelIndexList lst = ui.downloadList->selectionModel ()->selectedIndexes ();
|
QModelIndexList lst = ui.downloadList->selectionModel ()->selectedIndexes ();
|
||||||
|
std::vector<RetroShareLink> links ;
|
||||||
|
|
||||||
for (int i = 0; i < lst.count (); i++)
|
for (int i = 0; i < lst.count (); i++)
|
||||||
if ( lst[i].column() == 0 )
|
if ( lst[i].column() == 0 )
|
||||||
@ -989,11 +919,10 @@ void TransfersDialog::copyLink ()
|
|||||||
qulonglong fsize= ind.model ()->data (ind.model ()->index (ind.row (), SIZE)).toULongLong() ;
|
qulonglong fsize= ind.model ()->data (ind.model ()->index (ind.row (), SIZE)).toULongLong() ;
|
||||||
QString fname= ind.model ()->data (ind.model ()->index (ind.row (), NAME)).toString() ;
|
QString fname= ind.model ()->data (ind.model ()->index (ind.row (), NAME)).toString() ;
|
||||||
|
|
||||||
RetroShareLink link(fname, fsize, fhash);
|
RetroShareLink link(fname, uint64_t(fsize), fhash);
|
||||||
|
links.push_back(link) ;
|
||||||
QApplication::clipboard()->setText(link.toString());
|
|
||||||
break ;
|
|
||||||
}
|
}
|
||||||
|
RSLinkClipboard::copyLinks(links) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TransfersDialog::showDetailsDialog()
|
void TransfersDialog::showDetailsDialog()
|
||||||
|
@ -175,7 +175,7 @@ public slots:
|
|||||||
// these two functions add entries to the transfers dialog, and return the row id of the entry modified/added
|
// these two functions add entries to the transfers dialog, and return the row id of the entry modified/added
|
||||||
//
|
//
|
||||||
int addItem(const QString& symbol, const QString& name, const QString& coreID, qlonglong size, const FileProgressInfo& pinfo, double dlspeed, const QString& sources, const QString& status, const QString& priority, qlonglong completed, qlonglong remaining, qlonglong downloadtime);
|
int addItem(const QString& symbol, const QString& name, const QString& coreID, qlonglong size, const FileProgressInfo& pinfo, double dlspeed, const QString& sources, const QString& status, const QString& priority, qlonglong completed, qlonglong remaining, qlonglong downloadtime);
|
||||||
int addPeerToItem(int row, const QString& name, const QString& coreID, double dlspeed, const QString& status, const FileProgressInfo& peerInfo);
|
int addPeerToItem(int row, const QString& name, const QString& coreID, double dlspeed, uint32_t status, const FileProgressInfo& peerInfo);
|
||||||
void delItem(int row);
|
void delItem(int row);
|
||||||
|
|
||||||
int addUploadItem(const QString& symbol, const QString& name, const QString& coreID, qlonglong size, const FileProgressInfo& pinfo, double dlspeed, const QString& sources, const QString& status, qlonglong completed, qlonglong remaining);
|
int addUploadItem(const QString& symbol, const QString& name, const QString& coreID, qlonglong size, const FileProgressInfo& pinfo, double dlspeed, const QString& sources, const QString& status, qlonglong completed, qlonglong remaining);
|
||||||
|
@ -165,13 +165,13 @@ void ServerPage::load()
|
|||||||
/** Loads the settings for this page */
|
/** Loads the settings for this page */
|
||||||
void ServerPage::updateStatus()
|
void ServerPage::updateStatus()
|
||||||
{
|
{
|
||||||
|
if(!isVisible())
|
||||||
|
return ;
|
||||||
|
|
||||||
/* load up configuration from rsPeers */
|
/* load up configuration from rsPeers */
|
||||||
RsPeerDetails detail;
|
RsPeerDetails detail;
|
||||||
if (!rsPeers->getPeerDetails(rsPeers->getOwnId(), detail))
|
if (!rsPeers->getPeerDetails(rsPeers->getOwnId(), detail))
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
/* only update if can't edit */
|
/* only update if can't edit */
|
||||||
if (!ui.localPort->isEnabled())
|
if (!ui.localPort->isEnabled())
|
||||||
@ -185,8 +185,6 @@ void ServerPage::updateStatus()
|
|||||||
ui.localAddress->setText(QString::fromStdString(detail.localAddr));
|
ui.localAddress->setText(QString::fromStdString(detail.localAddr));
|
||||||
/* set the server address */
|
/* set the server address */
|
||||||
ui.extAddress->setText(QString::fromStdString(detail.extAddr));
|
ui.extAddress->setText(QString::fromStdString(detail.extAddr));
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ServerPage::toggleUPnP()
|
void ServerPage::toggleUPnP()
|
||||||
@ -220,14 +218,11 @@ void ServerPage::saveAddresses()
|
|||||||
|
|
||||||
bool saveAddr = false;
|
bool saveAddr = false;
|
||||||
|
|
||||||
|
|
||||||
RsPeerDetails detail;
|
RsPeerDetails detail;
|
||||||
std::string ownId = rsPeers->getOwnId();
|
std::string ownId = rsPeers->getOwnId();
|
||||||
|
|
||||||
if (!rsPeers->getPeerDetails(ownId, detail))
|
if (!rsPeers->getPeerDetails(ownId, detail))
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
int netIndex = ui.netModeComboBox->currentIndex();
|
int netIndex = ui.netModeComboBox->currentIndex();
|
||||||
|
|
||||||
@ -248,26 +243,18 @@ void ServerPage::saveAddresses()
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (detail.tryNetMode != netMode)
|
if (detail.tryNetMode != netMode)
|
||||||
{
|
|
||||||
rsPeers->setNetworkMode(ownId, netMode);
|
rsPeers->setNetworkMode(ownId, netMode);
|
||||||
}
|
|
||||||
|
|
||||||
int visState = 0;
|
int visState = 0;
|
||||||
/* Check if vis has changed */
|
/* Check if vis has changed */
|
||||||
if (0 == ui.discComboBox->currentIndex())
|
if (0 == ui.discComboBox->currentIndex())
|
||||||
{
|
|
||||||
visState |= RS_VS_DISC_ON;
|
visState |= RS_VS_DISC_ON;
|
||||||
}
|
|
||||||
|
|
||||||
if (visState != detail.visState)
|
if (visState != detail.visState)
|
||||||
{
|
|
||||||
rsPeers->setVisState(ownId, visState);
|
rsPeers->setVisState(ownId, visState);
|
||||||
}
|
|
||||||
|
|
||||||
if (0 != netIndex)
|
if (0 != netIndex)
|
||||||
{
|
|
||||||
saveAddr = true;
|
saveAddr = true;
|
||||||
}
|
|
||||||
|
|
||||||
if (saveAddr)
|
if (saveAddr)
|
||||||
{
|
{
|
||||||
|
@ -36,7 +36,7 @@ class TransferPage: public ConfigPage
|
|||||||
~TransferPage() {}
|
~TransferPage() {}
|
||||||
|
|
||||||
/** Saves the changes on this page */
|
/** Saves the changes on this page */
|
||||||
virtual bool save(QString &errmsg) {}
|
virtual bool save(QString &errmsg) { return true ; }
|
||||||
/** Loads the settings for this page */
|
/** Loads the settings for this page */
|
||||||
virtual void load() {}
|
virtual void load() {}
|
||||||
|
|
||||||
|
@ -145,22 +145,22 @@ RSettingsWin::loadSettings()
|
|||||||
void
|
void
|
||||||
RSettingsWin::saveChanges()
|
RSettingsWin::saveChanges()
|
||||||
{
|
{
|
||||||
bool saveOk;
|
|
||||||
QString errmsg;
|
QString errmsg;
|
||||||
|
|
||||||
/* Call each config page's save() method to save its data */
|
/* Call each config page's save() method to save its data */
|
||||||
int i, count = stackedWidget->count();
|
int i, count = stackedWidget->count();
|
||||||
for (i = 0; i < count; i++) {
|
for (i = 0; i < count; i++)
|
||||||
ConfigPage *page = (ConfigPage *) stackedWidget->widget(i);
|
{
|
||||||
saveOk = page->save(errmsg);
|
ConfigPage *page = dynamic_cast<ConfigPage *>(stackedWidget->widget(i));
|
||||||
|
|
||||||
if (!saveOk) {
|
if(!page->save(errmsg))
|
||||||
|
{
|
||||||
/* Display the offending page */
|
/* Display the offending page */
|
||||||
stackedWidget->setCurrentWidget(page);
|
stackedWidget->setCurrentWidget(page);
|
||||||
|
|
||||||
/* Show the user what went wrong */
|
/* Show the user what went wrong */
|
||||||
QMessageBox::warning(this,
|
QMessageBox::warning(this,
|
||||||
tr("Error Saving Configuration"), errmsg,
|
tr("Error Saving Configuration on page ")+QString::number(i), errmsg,
|
||||||
QMessageBox::Ok, QMessageBox::NoButton);
|
QMessageBox::Ok, QMessageBox::NoButton);
|
||||||
|
|
||||||
/* Don't process the rest of the pages */
|
/* Don't process the rest of the pages */
|
||||||
@ -173,3 +173,4 @@ RSettingsWin::saveChanges()
|
|||||||
|
|
||||||
QDialog::close();
|
QDialog::close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -165,7 +165,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
QObject::connect(ConfCertDialog::instance(),SIGNAL(configChanged()),w->networkDialog,SLOT(insertConnect())) ;
|
QObject::connect(ConfCertDialog::instance(),SIGNAL(configChanged()),w->networkDialog,SLOT(insertConnect())) ;
|
||||||
QObject::connect(w->peersDialog,SIGNAL(friendsUpdated()),w->networkDialog,SLOT(insertConnect())) ;
|
QObject::connect(w->peersDialog,SIGNAL(friendsUpdated()),w->networkDialog,SLOT(insertConnect())) ;
|
||||||
QObject::connect(w->peersDialog,SIGNAL(notifyGroupChat(const QString&,const QString&)),w,SLOT(displaySystrayMsg(const QString&,const QString&))) ;
|
QObject::connect(w->peersDialog,SIGNAL(notifyGroupChat(const QString&,const QString&)),w,SLOT(displaySystrayMsg(const QString&,const QString&)),Qt::QueuedConnection) ;
|
||||||
|
|
||||||
/* only show window, if not startMinimized */
|
/* only show window, if not startMinimized */
|
||||||
RshareSettings *_settings = new RshareSettings();
|
RshareSettings *_settings = new RshareSettings();
|
||||||
|
Loading…
Reference in New Issue
Block a user