mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
to show files sources count in form of friend source/ total source
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@2324 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
d2bda9fff3
commit
a5b01d1de6
@ -702,6 +702,7 @@ void SearchDialog::insertDirectory(const std::string &txt, qulonglong searchId,
|
|||||||
child->setText(SR_AGE_COL, misc::userFriendlyDuration(dir.age));
|
child->setText(SR_AGE_COL, misc::userFriendlyDuration(dir.age));
|
||||||
child->setText(SR_REALSIZE_COL, QString::number(dir.count));
|
child->setText(SR_REALSIZE_COL, QString::number(dir.count));
|
||||||
child->setTextAlignment( SR_SIZE_COL, Qt::AlignRight );
|
child->setTextAlignment( SR_SIZE_COL, Qt::AlignRight );
|
||||||
|
|
||||||
child->setText(SR_ID_COL, QString::number(1));
|
child->setText(SR_ID_COL, QString::number(1));
|
||||||
child->setText(SR_SEARCH_ID_COL, sid_hexa);
|
child->setText(SR_SEARCH_ID_COL, sid_hexa);
|
||||||
setIconAndType(child, ext);
|
setIconAndType(child, ext);
|
||||||
@ -777,7 +778,7 @@ void SearchDialog::insertDirectory(const std::string &txt, qulonglong searchId,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SearchDialog::insertFile(const std::string& txt,qulonglong searchId, const FileDetail& file)
|
void SearchDialog::insertFile(const std::string& txt,qulonglong searchId, const FileDetail& file, int searchType)
|
||||||
{
|
{
|
||||||
// algo:
|
// algo:
|
||||||
//
|
//
|
||||||
@ -794,6 +795,9 @@ void SearchDialog::insertFile(const std::string& txt,qulonglong searchId, const
|
|||||||
int items = ui.searchResultWidget->topLevelItemCount();
|
int items = ui.searchResultWidget->topLevelItemCount();
|
||||||
bool found = false ;
|
bool found = false ;
|
||||||
int sources;
|
int sources;
|
||||||
|
int friendSource = 0;
|
||||||
|
int anonymousSource = 0;
|
||||||
|
QString modifiedResult;
|
||||||
|
|
||||||
QString sid_hexa = QString::number(searchId,16) ;
|
QString sid_hexa = QString::number(searchId,16) ;
|
||||||
|
|
||||||
@ -801,11 +805,24 @@ void SearchDialog::insertFile(const std::string& txt,qulonglong searchId, const
|
|||||||
if(ui.searchResultWidget->topLevelItem(i)->text(SR_HASH_COL) == QString::fromStdString(file.hash)
|
if(ui.searchResultWidget->topLevelItem(i)->text(SR_HASH_COL) == QString::fromStdString(file.hash)
|
||||||
&& ui.searchResultWidget->topLevelItem(i)->text(SR_SEARCH_ID_COL) == sid_hexa)
|
&& ui.searchResultWidget->topLevelItem(i)->text(SR_SEARCH_ID_COL) == sid_hexa)
|
||||||
{
|
{
|
||||||
int s = ui.searchResultWidget->topLevelItem(i)->text(SR_ID_COL).toInt() ;
|
QString resultCount = ui.searchResultWidget->topLevelItem(i)->text(SR_ID_COL);
|
||||||
ui.searchResultWidget->topLevelItem(i)->setText(SR_ID_COL,QString::number(s+1));
|
QStringList modifiedResultCount = resultCount.split("/", QString::SkipEmptyParts);
|
||||||
|
if(searchType == FRIEND_SEARCH)
|
||||||
|
{
|
||||||
|
friendSource = modifiedResultCount.at(0).toInt() + 1;
|
||||||
|
anonymousSource = modifiedResultCount.at(1).toInt();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
friendSource = modifiedResultCount.at(0).toInt();
|
||||||
|
anonymousSource = modifiedResultCount.at(1).toInt() + 1;
|
||||||
|
}
|
||||||
|
anonymousSource = anonymousSource + friendSource;
|
||||||
|
modifiedResult = QString::number(friendSource) + tr("/") + QString::number(anonymousSource);
|
||||||
|
ui.searchResultWidget->topLevelItem(i)->setText(SR_ID_COL,modifiedResult);
|
||||||
QTreeWidgetItem *item = ui.searchResultWidget->topLevelItem(i);
|
QTreeWidgetItem *item = ui.searchResultWidget->topLevelItem(i);
|
||||||
found = true ;
|
found = true ;
|
||||||
sources = s+1;
|
int sources = friendSource;
|
||||||
if ( sources < 1)
|
if ( sources < 1)
|
||||||
{
|
{
|
||||||
for(int i = 0; i < 7; i++)
|
for(int i = 0; i < 7; i++)
|
||||||
@ -919,7 +936,20 @@ void SearchDialog::insertFile(const std::string& txt,qulonglong searchId, const
|
|||||||
item->setText(SR_REALSIZE_COL, QString::number(file.size));
|
item->setText(SR_REALSIZE_COL, QString::number(file.size));
|
||||||
item->setText(SR_AGE_COL, misc::userFriendlyDuration(file.age));
|
item->setText(SR_AGE_COL, misc::userFriendlyDuration(file.age));
|
||||||
item->setTextAlignment( SR_SIZE_COL, Qt::AlignRight );
|
item->setTextAlignment( SR_SIZE_COL, Qt::AlignRight );
|
||||||
item->setText(SR_ID_COL, QString::number(1));
|
if(searchType == FRIEND_SEARCH)
|
||||||
|
{
|
||||||
|
friendSource = 1;
|
||||||
|
anonymousSource = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
friendSource = 0;
|
||||||
|
anonymousSource = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
anonymousSource = anonymousSource + friendSource;
|
||||||
|
modifiedResult =QString::number(friendSource) + tr("/") + QString::number(anonymousSource);
|
||||||
|
item->setText(SR_ID_COL,modifiedResult);
|
||||||
item->setText(SR_SEARCH_ID_COL, sid_hexa);
|
item->setText(SR_SEARCH_ID_COL, sid_hexa);
|
||||||
|
|
||||||
|
|
||||||
@ -987,7 +1017,7 @@ void SearchDialog::resultsToTree(std::string txt,qulonglong searchId, const std:
|
|||||||
fd.age = it->age;
|
fd.age = it->age;
|
||||||
fd.rank = 0;
|
fd.rank = 0;
|
||||||
|
|
||||||
insertFile(txt,searchId,fd);
|
insertFile(txt,searchId,fd, FRIEND_SEARCH);
|
||||||
} else if (it->type == DIR_TYPE_DIR) {
|
} else if (it->type == DIR_TYPE_DIR) {
|
||||||
insertDirectory(txt, searchId, *it, NULL);
|
insertDirectory(txt, searchId, *it, NULL);
|
||||||
}
|
}
|
||||||
|
@ -35,6 +35,8 @@
|
|||||||
#include "advsearch/advancedsearchdialog.h"
|
#include "advsearch/advancedsearchdialog.h"
|
||||||
#include "settings/rsharesettings.h"
|
#include "settings/rsharesettings.h"
|
||||||
|
|
||||||
|
#define FRIEND_SEARCH 1
|
||||||
|
#define ANONYMOUS_SEARCH 2
|
||||||
class SearchDialog : public MainPage
|
class SearchDialog : public MainPage
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@ -95,7 +97,7 @@ private:
|
|||||||
/** render the results to the tree widget display */
|
/** render the results to the tree widget display */
|
||||||
void initSearchResult(const std::string& txt,qulonglong searchId) ;
|
void initSearchResult(const std::string& txt,qulonglong searchId) ;
|
||||||
void resultsToTree(std::string,qulonglong searchId, const std::list<DirDetails>&);
|
void resultsToTree(std::string,qulonglong searchId, const std::list<DirDetails>&);
|
||||||
void insertFile(const std::string& txt,qulonglong searchId, const FileDetail& file) ;
|
void insertFile(const std::string& txt,qulonglong searchId, const FileDetail& file, int searchType = ANONYMOUS_SEARCH) ;
|
||||||
void insertDirectory(const std::string &txt, qulonglong searchId, const DirDetails &dir, QTreeWidgetItem *item);
|
void insertDirectory(const std::string &txt, qulonglong searchId, const DirDetails &dir, QTreeWidgetItem *item);
|
||||||
void setIconAndType(QTreeWidgetItem *item, QString &ext);
|
void setIconAndType(QTreeWidgetItem *item, QString &ext);
|
||||||
void downloadDirectory(const QTreeWidgetItem *item, const QString &base);
|
void downloadDirectory(const QTreeWidgetItem *item, const QString &base);
|
||||||
|
Loading…
Reference in New Issue
Block a user