mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-26 16:09:35 -05:00
ported branch v0.5.0 commits 2623, 2624, 2626, 2633, 2634, 2643, 2644, 2646, 2651 and 2654 to trunk
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@2660 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
12536efd16
commit
08065b4298
@ -947,12 +947,20 @@ int FileIndex::saveIndex(std::string filename, std::string &fileHash, uint64_t &
|
||||
std::map<std::string, DirEntry *>::iterator it;
|
||||
for(it = root->subdirs.begin(); it != root->subdirs.end(); it++)
|
||||
{
|
||||
#ifdef FI_DEBUG
|
||||
std::cout << "writting root directory: name=" << it->second->name << ", path=" << it->second->path << std::endl ;
|
||||
#endif
|
||||
if(forbidden_dirs.find(it->second->name) != forbidden_dirs.end())
|
||||
{
|
||||
#ifdef FI_DEBUG
|
||||
std::cerr << " will be suppressed." << std::endl ;
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef FI_DEBUG
|
||||
std::cerr << " will be saved." << std::endl ;
|
||||
#endif
|
||||
(it->second)->saveEntry(oss);
|
||||
}
|
||||
}
|
||||
|
@ -57,7 +57,6 @@
|
||||
* #define CONTROL_DEBUG 1
|
||||
* #define DEBUG_DWLQUEUE 1
|
||||
*****/
|
||||
#define DEBUG_DWLQUEUE 1
|
||||
|
||||
static const uint32_t SAVE_TRANSFERS_DELAY = 61 ; // save transfer progress every 61 seconds.
|
||||
static const uint32_t INACTIVE_CHUNKS_CHECK_DELAY = 60 ; // time after which an inactive chunk is released
|
||||
|
@ -402,6 +402,7 @@ bool ftDataMultiplex::recvChunkMap(const std::string& peerId, const std::string&
|
||||
std::cerr << "ftDataMultiplex::handleRecvChunkMap() ERROR: No matching file Provider for hash " << hash ;
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
it->second->setClientMap(peerId, compressed_map);
|
||||
|
@ -431,6 +431,7 @@ bool ftExtraList::loadList(std::list<RsItem *> load)
|
||||
}
|
||||
|
||||
fclose(fd);
|
||||
fd = NULL ;
|
||||
|
||||
if (ts > (time_t)fi->file.age)
|
||||
{
|
||||
|
@ -8,7 +8,7 @@
|
||||
static const time_t UPLOAD_CHUNK_MAPS_TIME = 30 ; // time to ask for a new chunkmap from uploaders in seconds.
|
||||
|
||||
ftFileProvider::ftFileProvider(std::string path, uint64_t size, std::string
|
||||
hash) : mSize(size), hash(hash), file_name(path), fd(NULL),transfer_rate(0),total_size(0)
|
||||
hash) : mSize(size), hash(hash), file_name(path), fd(NULL),transfer_rate(0),total_size(0),req_loc(0)
|
||||
{
|
||||
RsStackMutex stack(ftcMutex); /********** STACK LOCKED MTX ******/
|
||||
clients_chunk_maps.clear();
|
||||
@ -25,6 +25,7 @@ ftFileProvider::~ftFileProvider(){
|
||||
#endif
|
||||
if (fd!=NULL) {
|
||||
fclose(fd);
|
||||
fd = NULL ;
|
||||
}
|
||||
}
|
||||
|
||||
@ -239,7 +240,7 @@ int ftFileProvider::initializeFileAttrs()
|
||||
* attempt to open file
|
||||
*/
|
||||
|
||||
fd = fopen64(file_name.c_str(), "rb");
|
||||
fd = fopen64(file_name.c_str(), "r+b");
|
||||
if (!fd)
|
||||
{
|
||||
std::cerr << "ftFileProvider::initializeFileAttrs() Failed to open (r+b): ";
|
||||
|
@ -34,7 +34,9 @@
|
||||
|
||||
#include "serialiser/rsconfigitems.h"
|
||||
|
||||
/*
|
||||
#define CONFIG_DEBUG 1
|
||||
*/
|
||||
#define BACKEDUP_SAVE
|
||||
|
||||
|
||||
@ -184,8 +186,8 @@ bool p3ConfigMgr::backedUpFileSave(const std::string& fname, const std::string&
|
||||
const std::string& sign_fname_backup, BinMemInterface* configbio, BinMemInterface* signbio){
|
||||
|
||||
FILE *file = NULL, *sign = NULL;
|
||||
char *config_buff, *sign_buff;
|
||||
int size_file, size_sign;
|
||||
char *config_buff=NULL, *sign_buff=NULL;
|
||||
int size_file=0, size_sign=0;
|
||||
|
||||
// begin two pass saving by writing to back up file instead
|
||||
if (!configbio->writetofile(fname_backup.c_str()) || !signbio->writetofile(sign_fname_backup.c_str()))
|
||||
@ -665,7 +667,7 @@ bool p3Config::backedUpFileSave(const std::string& cfg_fname, const std::string&
|
||||
uint32_t stream_flags = BIN_FLAGS_WRITEABLE;
|
||||
bool written = true;
|
||||
FILE* cfg_file = NULL;
|
||||
char* buff;
|
||||
char* buff=NULL;
|
||||
int size_file = 0;
|
||||
|
||||
if (!cleanup)
|
||||
|
@ -138,7 +138,7 @@ class RsConfig
|
||||
firewalled = forwardPort = false ;
|
||||
maxDownloadDataRate = maxUploadDataRate = maxIndivDataRate = 0 ;
|
||||
promptAtBoot = 0 ;
|
||||
DHTActive = uPnPActive = netLocalOk = netDhtOk = netStunOk = netExtraAddressOk = false ;
|
||||
DHTActive = uPnPActive = netLocalOk = netUpnpOk = netDhtOk = netStunOk = netExtraAddressOk = false ;
|
||||
uPnPState = DHTPeers = 0 ;
|
||||
}
|
||||
std::string ownId;
|
||||
|
@ -594,15 +594,17 @@ void p3ChatService::sendAvatarJpegData(const std::string& peer_id)
|
||||
|
||||
// take avatar, and embed it into a std::wstring.
|
||||
//
|
||||
#ifdef CHAT_DEBUG
|
||||
std::cerr << "p3ChatService::sending avatar image to peer" << peer_id << ", image size = " << ci->image_size << std::endl ;
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
|
||||
sendItem(ci) ;
|
||||
}
|
||||
else {
|
||||
#ifdef CHAT_DEBUG
|
||||
#ifdef CHAT_DEBUG
|
||||
std::cerr << "Doing nothing" << std::endl ;
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -423,6 +423,7 @@ void p3Ranking::addRankMsg(RsRankLinkMsg *msg)
|
||||
RankGroup grp;
|
||||
grp.rid = rid;
|
||||
grp.ownTag = false;
|
||||
grp.rank = 0.0f;
|
||||
|
||||
/*************************************************************************/
|
||||
/****************************** LINK SPECIFIC ****************************/
|
||||
@ -438,7 +439,6 @@ void p3Ranking::addRankMsg(RsRankLinkMsg *msg)
|
||||
mData[rid] = grp;
|
||||
it = mData.find(rid);
|
||||
|
||||
|
||||
if (id == "")
|
||||
{
|
||||
#ifdef RANK_DEBUG
|
||||
|
@ -95,6 +95,7 @@ RsQueueThread::RsQueueThread(uint32_t min, uint32_t max, double relaxFactor )
|
||||
:mMinSleep(min), mMaxSleep(max), mRelaxFactor(relaxFactor)
|
||||
{
|
||||
mLastSleep = (uint32_t)mMinSleep ;
|
||||
mLastWork = time(NULL) ;
|
||||
}
|
||||
|
||||
void RsQueueThread::run()
|
||||
|
@ -227,6 +227,8 @@ void FileTransferInfoWidget::draw(const FileInfo& nfo,const FileChunksInfo& info
|
||||
y += block_sep ;
|
||||
y += text_height ; painter->drawText(20,y,tr("Transfered: ")) ; painter->drawText(tab_size,y,QString::number(nfo.transfered) + " " + tr("bytes") + " " + "(" + misc::friendlyUnit(nfo.transfered) + ")") ;
|
||||
y += block_sep ;
|
||||
y += text_height ; painter->drawText(20,y,tr("Remaining: ")) ; painter->drawText(tab_size,y,QString::number(info.file_size - nfo.transfered) + " " + tr("bytes") + " " + "(" + misc::friendlyUnit(info.file_size - nfo.transfered) + ")") ;
|
||||
y += block_sep ;
|
||||
y += text_height ; painter->drawText(20,y,tr("Number of sources: ")) ; painter->drawText(tab_size,y,QString::number(info.compressed_peer_availability_maps.size())) ;
|
||||
y += block_sep ;
|
||||
y += text_height ; painter->drawText(20,y,tr("Chunk strategy: ")) ; painter->drawText(tab_size,y,(info.strategy==FileChunksInfo::CHUNK_STRATEGY_RANDOM)?"Random":"Streaming") ;
|
||||
|
@ -111,8 +111,6 @@ MainWindow::MainWindow(QWidget* parent, Qt::WFlags flags)
|
||||
/* Invoke the Qt Designer generated QObject setup routine */
|
||||
ui.setupUi(this);
|
||||
|
||||
updateToolBaricons();
|
||||
|
||||
/* Create RshareSettings object */
|
||||
_settings = new RshareSettings();
|
||||
|
||||
@ -183,7 +181,7 @@ MainWindow::MainWindow(QWidget* parent, Qt::WFlags flags)
|
||||
|
||||
|
||||
ui.stackPages->add(messagesDialog = new MessagesDialog(ui.stackPages),
|
||||
createPageAction(QIcon(MessageIcon), tr("Messages"), grp));
|
||||
messageAction = createPageAction(QIcon(IMAGE_MESSAGES), tr("Messages"), grp));
|
||||
|
||||
#ifndef RS_RELEASE_VERSION
|
||||
ChannelFeed *channelFeed = NULL;
|
||||
@ -332,59 +330,59 @@ void MainWindow::displaySystrayMsg(const QString& title,const QString& msg)
|
||||
void MainWindow::updateStatus()
|
||||
{
|
||||
|
||||
if (ratesstatus)
|
||||
ratesstatus->getRatesStatus();
|
||||
if (ratesstatus)
|
||||
ratesstatus->getRatesStatus();
|
||||
|
||||
if (peerstatus)
|
||||
peerstatus->getPeerStatus();
|
||||
if (peerstatus)
|
||||
peerstatus->getPeerStatus();
|
||||
|
||||
if (natstatus)
|
||||
natstatus->getNATStatus();
|
||||
if (natstatus)
|
||||
natstatus->getNATStatus();
|
||||
|
||||
std::list<std::string> ids;
|
||||
rsPeers->getOnlineList(ids);
|
||||
int online = ids.size();
|
||||
|
||||
std::list<MsgInfoSummary> msgList;
|
||||
std::list<MsgInfoSummary>::const_iterator it;
|
||||
std::list<std::string> ids;
|
||||
rsPeers->getOnlineList(ids);
|
||||
int online = ids.size();
|
||||
|
||||
rsMsgs -> getMessageSummaries(msgList);
|
||||
|
||||
for(it = msgList.begin(); it != msgList.end(); it++)
|
||||
{
|
||||
|
||||
if ((it -> msgflags & RS_MSG_BOXMASK) == RS_MSG_INBOX && ((it -> msgflags & RS_MSG_NEW) == RS_MSG_NEW))
|
||||
{
|
||||
trayIcon->setIcon(QIcon(":/images/newmsg.png"));
|
||||
trayIcon->setToolTip(tr("RetroShare") + "\n" + tr("You has a new message"));
|
||||
}
|
||||
else if (online == 0)
|
||||
{
|
||||
trayIcon->setIcon(QIcon(IMAGE_NOONLINE));
|
||||
trayIcon->setToolTip(tr("RetroShare"));
|
||||
}
|
||||
else if (online < 2)
|
||||
{
|
||||
trayIcon->setIcon(QIcon(IMAGE_ONEONLINE));
|
||||
trayIcon->setToolTip(tr("RetroShare"));
|
||||
}
|
||||
else if (online < 3)
|
||||
{
|
||||
trayIcon->setIcon(QIcon(IMAGE_TWOONLINE));
|
||||
trayIcon->setToolTip(tr("RetroShare"));
|
||||
}
|
||||
else
|
||||
{
|
||||
trayIcon->setIcon(QIcon(IMAGE_RETROSHARE));
|
||||
trayIcon->setToolTip(tr("RetroShare"));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
std::list<MsgInfoSummary> msgList;
|
||||
std::list<MsgInfoSummary>::const_iterator it;
|
||||
|
||||
rsMsgs -> getMessageSummaries(msgList);
|
||||
bool new_msg = false ;
|
||||
|
||||
for(it = msgList.begin(); it != msgList.end(); it++)
|
||||
if ((it -> msgflags & RS_MSG_BOXMASK) == RS_MSG_INBOX && ((it -> msgflags & RS_MSG_NEW) == RS_MSG_NEW))
|
||||
new_msg = true ;
|
||||
|
||||
if(new_msg)
|
||||
messageAction->setIcon(QIcon(QPixmap(":/images/messages_new.png"))) ;
|
||||
else
|
||||
messageAction->setIcon(QIcon(QPixmap(":/images/evolution.png"))) ;
|
||||
|
||||
if(new_msg)
|
||||
{
|
||||
trayIcon->setIcon(QIcon(":/images/newmsg.png"));
|
||||
trayIcon->setToolTip(tr("RetroShare") + "\n" + tr("You has a new message"));
|
||||
}
|
||||
else if (online == 0)
|
||||
{
|
||||
trayIcon->setIcon(QIcon(IMAGE_NOONLINE));
|
||||
trayIcon->setToolTip(tr("RetroShare"));
|
||||
}
|
||||
else if (online < 2)
|
||||
{
|
||||
trayIcon->setIcon(QIcon(IMAGE_ONEONLINE));
|
||||
trayIcon->setToolTip(tr("RetroShare"));
|
||||
}
|
||||
else if (online < 3)
|
||||
{
|
||||
trayIcon->setIcon(QIcon(IMAGE_TWOONLINE));
|
||||
trayIcon->setToolTip(tr("RetroShare"));
|
||||
}
|
||||
else
|
||||
{
|
||||
trayIcon->setIcon(QIcon(IMAGE_RETROSHARE));
|
||||
trayIcon->setToolTip(tr("RetroShare"));
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::updateHashingInfo(const QString& s)
|
||||
@ -672,25 +670,4 @@ void MainWindow::setStyle()
|
||||
|
||||
}
|
||||
|
||||
void MainWindow::updateToolBaricons()
|
||||
{
|
||||
std::list<MsgInfoSummary> msgList;
|
||||
std::list<MsgInfoSummary>::const_iterator it;
|
||||
|
||||
rsMsgs -> getMessageSummaries(msgList);
|
||||
|
||||
for(it = msgList.begin(); it != msgList.end(); it++)
|
||||
{
|
||||
|
||||
if (it -> msgflags & RS_MSG_NEW)
|
||||
{
|
||||
MessageIcon.addPixmap(QPixmap(":/images/messages_new.png"), QIcon::Normal, QIcon::On );
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageIcon.addPixmap(QPixmap(":/images/evolution.png"), QIcon::Normal, QIcon::On );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -105,8 +105,6 @@ public slots:
|
||||
void updateHashingInfo(const QString&) ;
|
||||
void displayErrorMessage(int,int,const QString&) ;
|
||||
|
||||
void updateToolBaricons();
|
||||
|
||||
protected:
|
||||
void closeEvent(QCloseEvent *);
|
||||
|
||||
@ -190,7 +188,7 @@ private:
|
||||
|
||||
QLabel *_hashing_info_label ;
|
||||
|
||||
QIcon MessageIcon;
|
||||
QAction *messageAction ;
|
||||
|
||||
/** Qt Designer generated object */
|
||||
Ui::MainWindow ui;
|
||||
|
@ -1025,7 +1025,8 @@ void RemoteDirModel::openSelected(QModelIndexList qmil, bool openFolder)
|
||||
std::list<DirDetails>::iterator it;
|
||||
getFileInfoFromIndexList(qmil, files_info);
|
||||
|
||||
for (it = files_info.begin(); it != files_info.end(); it++) {
|
||||
for (it = files_info.begin(); it != files_info.end(); it++)
|
||||
{
|
||||
if ((*it).type & DIR_TYPE_PERSON) continue;
|
||||
|
||||
std::string fullpath, name;
|
||||
@ -1039,25 +1040,19 @@ void RemoteDirModel::openSelected(QModelIndexList qmil, bool openFolder)
|
||||
name = fullpath;
|
||||
}
|
||||
|
||||
if (!openFolder) {
|
||||
if ((*it).type & DIR_TYPE_FILE) {
|
||||
QDesktopServices::openUrl(QUrl::fromLocalFile(name.c_str()));
|
||||
}
|
||||
} else {
|
||||
if (dirs_to_open.end() == std::find(dirs_to_open.begin(), dirs_to_open.end(), fullpath)) {
|
||||
dirs_to_open.push_back(fullpath);
|
||||
}
|
||||
}
|
||||
std::cerr << "Opennign this file: " << name << std::endl ;
|
||||
|
||||
QDesktopServices::openUrl(QUrl::fromLocalFile(QString::fromUtf8(name.c_str(),name.length())));
|
||||
}
|
||||
|
||||
if (openFolder) {
|
||||
std::list<std::string>::iterator dit;
|
||||
for (dit = dirs_to_open.begin(); dit != dirs_to_open.end(); dit++)
|
||||
{
|
||||
std::cerr << "Opennign this folder: " << (*dit).c_str() << std::endl ;
|
||||
QDesktopServices::openUrl(QUrl::fromLocalFile((*dit).c_str()));
|
||||
}
|
||||
}
|
||||
// if (openFolder) {
|
||||
// std::list<std::string>::iterator dit;
|
||||
// for (dit = dirs_to_open.begin(); dit != dirs_to_open.end(); dit++)
|
||||
// {
|
||||
// std::cerr << "Opennign this folder: " << (*dit).c_str() << std::endl ;
|
||||
// QDesktopServices::openUrl(QUrl::fromLocalFile(QString::fromUtf8((*dit).c_str())));
|
||||
// }
|
||||
// }
|
||||
|
||||
#ifdef RDM_DEBUG
|
||||
std::cerr << "::::::::::::Done RemoteDirModel::openSelected()" << std::endl;
|
||||
|
@ -171,6 +171,24 @@ SharedFilesDialog::SharedFilesDialog(QWidget *parent)
|
||||
#ifdef Q_WS_WIN
|
||||
|
||||
#endif
|
||||
copylinklocalAct = new QAction(QIcon(IMAGE_COPYLINK), tr( "Copy retroshare Links to Clipboard" ), this );
|
||||
connect( copylinklocalAct , SIGNAL( triggered() ), this, SLOT( copyLinkLocal() ) );
|
||||
copylinklocalhtmlAct = new QAction(QIcon(IMAGE_COPYLINK), tr( "Copy retroshare Links to Clipboard (HTML)" ), this );
|
||||
connect( copylinklocalhtmlAct , SIGNAL( triggered() ), this, SLOT( copyLinkhtml() ) );
|
||||
sendlinkAct = new QAction(QIcon(IMAGE_COPYLINK), tr( "Send retroshare Links" ), this );
|
||||
connect( sendlinkAct , SIGNAL( triggered() ), this, SLOT( sendLinkTo( ) ) );
|
||||
sendhtmllinkAct = new QAction(QIcon(IMAGE_COPYLINK), tr( "Send retroshare Links (HTML)" ), this );
|
||||
connect( sendhtmllinkAct , SIGNAL( triggered() ), this, SLOT( sendHtmlLinkTo( ) ) );
|
||||
sendlinkCloudAct = new QAction(QIcon(IMAGE_COPYLINK), tr( "Send retroshare Links to Cloud" ), this );
|
||||
connect( sendlinkCloudAct , SIGNAL( triggered() ), this, SLOT( sendLinkToCloud( ) ) );
|
||||
addlinkCloudAct = new QAction(QIcon(IMAGE_COPYLINK), tr( "Add Links to Cloud" ), this );
|
||||
connect( addlinkCloudAct , SIGNAL( triggered() ), this, SLOT( addLinkToCloud( ) ) );
|
||||
openfileAct = new QAction(QIcon(IMAGE_OPENFILE), tr("Open File"), this);
|
||||
connect(openfileAct, SIGNAL(triggered()), this, SLOT(openfile()));
|
||||
openfolderAct = new QAction(QIcon(IMAGE_OPENFOLDER), tr("Open Folder"), this);
|
||||
connect(openfolderAct, SIGNAL(triggered()), this, SLOT(openfolder()));
|
||||
|
||||
|
||||
}
|
||||
|
||||
void SharedFilesDialog::checkUpdate()
|
||||
@ -595,7 +613,7 @@ void SharedFilesDialog::sharedDirTreeWidgetContextMenu( QPoint point )
|
||||
QMenu contextMnu2( this );
|
||||
//
|
||||
|
||||
QAction* menuAction = fileAssotiationAction(currentFile) ;
|
||||
// QAction* menuAction = fileAssotiationAction(currentFile) ;
|
||||
//new QAction(QIcon(IMAGE_PLAY), currentFile, this);
|
||||
//tr( "111Play File(s)" ), this );
|
||||
// connect( openfolderAct , SIGNAL( triggered() ), this,
|
||||
@ -618,10 +636,10 @@ void SharedFilesDialog::sharedDirTreeWidgetContextMenu( QPoint point )
|
||||
*
|
||||
*/
|
||||
|
||||
QMenu *recMenu = new QMenu( tr("Recommend (Automated message) To "), this );
|
||||
recMenu->setIcon(QIcon(IMAGE_ATTACHMENT));
|
||||
QMenu *msgMenu = new QMenu( tr("Recommend in a message to "), &contextMnu2 );
|
||||
msgMenu->setIcon(QIcon(IMAGE_MSG));
|
||||
QMenu recMenu( tr("Recommend (Automated message) To "), this );
|
||||
recMenu.setIcon(QIcon(IMAGE_ATTACHMENT));
|
||||
QMenu msgMenu( tr("Recommend in a message to "), &contextMnu2 );
|
||||
msgMenu.setIcon(QIcon(IMAGE_MSG));
|
||||
|
||||
std::list<std::string> peers;
|
||||
std::list<std::string>::iterator it;
|
||||
@ -649,52 +667,24 @@ void SharedFilesDialog::sharedDirTreeWidgetContextMenu( QPoint point )
|
||||
* msgMenu
|
||||
*/
|
||||
|
||||
RsAction *qaf1 = new RsAction( QIcon(IMAGE_FRIEND), QString::fromStdString( nn ), recMenu, *it );
|
||||
RsAction *qaf1 = new RsAction( QIcon(IMAGE_FRIEND), QString::fromStdString( nn ), &recMenu, *it );
|
||||
connect( qaf1 , SIGNAL( triggeredId( std::string ) ), this, SLOT( recommendFilesTo( std::string ) ) );
|
||||
recMenu->addAction(qaf1);
|
||||
|
||||
RsAction *qaf2 = new RsAction( QIcon(IMAGE_FRIEND), QString::fromStdString( nn ), msgMenu, *it );
|
||||
RsAction *qaf2 = new RsAction( QIcon(IMAGE_FRIEND), QString::fromStdString( nn ), &msgMenu, *it );
|
||||
connect( qaf2 , SIGNAL( triggeredId( std::string ) ), this, SLOT( recommendFilesToMsg( std::string ) ) );
|
||||
msgMenu->addAction(qaf2);
|
||||
|
||||
recMenu.addAction(qaf1);
|
||||
msgMenu.addAction(qaf2);
|
||||
|
||||
/* create list of ids */
|
||||
|
||||
}
|
||||
//#endif
|
||||
|
||||
copylinklocalAct = new QAction(QIcon(IMAGE_COPYLINK), tr( "Copy retroshare Links to Clipboard" ), this );
|
||||
connect( copylinklocalAct , SIGNAL( triggered() ), this, SLOT( copyLinkLocal() ) );
|
||||
|
||||
copylinklocalhtmlAct = new QAction(QIcon(IMAGE_COPYLINK), tr( "Copy retroshare Links to Clipboard (HTML)" ), this );
|
||||
connect( copylinklocalhtmlAct , SIGNAL( triggered() ), this, SLOT( copyLinkhtml() ) );
|
||||
|
||||
sendlinkAct = new QAction(QIcon(IMAGE_COPYLINK), tr( "Send retroshare Links" ), this );
|
||||
connect( sendlinkAct , SIGNAL( triggered() ), this, SLOT( sendLinkTo( ) ) );
|
||||
|
||||
sendhtmllinkAct = new QAction(QIcon(IMAGE_COPYLINK), tr( "Send retroshare Links (HTML)" ), this );
|
||||
connect( sendhtmllinkAct , SIGNAL( triggered() ), this, SLOT( sendHtmlLinkTo( ) ) );
|
||||
|
||||
// sendchatlinkAct = new QAction(QIcon(IMAGE_COPYLINK), tr( "Send retroshare Links to Chat" ), this );
|
||||
// connect( sendchatlinkAct , SIGNAL( triggered() ), this, SLOT( sendLinktoChat( ) ) );
|
||||
|
||||
sendlinkCloudAct = new QAction(QIcon(IMAGE_COPYLINK), tr( "Send retroshare Links to Cloud" ), this );
|
||||
connect( sendlinkCloudAct , SIGNAL( triggered() ), this, SLOT( sendLinkToCloud( ) ) );
|
||||
|
||||
addlinkCloudAct = new QAction(QIcon(IMAGE_COPYLINK), tr( "Add Links to Cloud" ), this );
|
||||
connect( addlinkCloudAct , SIGNAL( triggered() ), this, SLOT( addLinkToCloud( ) ) );
|
||||
|
||||
openfileAct = new QAction(QIcon(IMAGE_OPENFILE), tr("Open File"), this);
|
||||
connect(openfileAct, SIGNAL(triggered()), this, SLOT(openfile()));
|
||||
|
||||
openfolderAct = new QAction(QIcon(IMAGE_OPENFOLDER), tr("Open Folder"), this);
|
||||
connect(openfolderAct, SIGNAL(triggered()), this, SLOT(openfolder()));
|
||||
|
||||
|
||||
if(localModel->isDir( midx ) )
|
||||
contextMnu2.addAction( openfolderAct);
|
||||
else
|
||||
{
|
||||
contextMnu2.addAction( menuAction );
|
||||
// contextMnu2.addAction( menuAction );
|
||||
contextMnu2.addAction( openfileAct);
|
||||
}
|
||||
|
||||
@ -713,14 +703,12 @@ void SharedFilesDialog::sharedDirTreeWidgetContextMenu( QPoint point )
|
||||
contextMnu2.addAction( addlinkCloudAct);
|
||||
contextMnu2.addSeparator();
|
||||
#endif
|
||||
contextMnu2.addMenu( recMenu);
|
||||
contextMnu2.addMenu( msgMenu);
|
||||
contextMnu2.addMenu( &recMenu);
|
||||
contextMnu2.addMenu( &msgMenu);
|
||||
}
|
||||
|
||||
QMouseEvent *mevent2 = new QMouseEvent( QEvent::MouseButtonPress, point,
|
||||
Qt::RightButton, Qt::RightButton,
|
||||
Qt::NoModifier );
|
||||
contextMnu2.exec( mevent2->globalPos() );
|
||||
QMouseEvent mevent2( QEvent::MouseButtonPress, point, Qt::RightButton, Qt::RightButton, Qt::NoModifier );
|
||||
contextMnu2.exec( mevent2.globalPos() );
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
|
@ -203,6 +203,57 @@ TransfersDialog::TransfersDialog(QWidget *parent)
|
||||
|
||||
QObject::connect(ui._showCacheTransfers_CB,SIGNAL(toggled(bool)),this,SLOT(insertTransfers())) ;
|
||||
|
||||
// Actions. Only need to be defined once.
|
||||
pauseAct = new QAction(QIcon(IMAGE_PAUSE), tr("Pause"), this);
|
||||
connect(pauseAct, SIGNAL(triggered()), this, SLOT(pauseFileTransfer()));
|
||||
|
||||
resumeAct = new QAction(QIcon(IMAGE_RESUME), tr("Resume"), this);
|
||||
connect(resumeAct, SIGNAL(triggered()), this, SLOT(resumeFileTransfer()));
|
||||
|
||||
cancelAct = new QAction(QIcon(IMAGE_CANCEL), tr( "Cancel" ), this );
|
||||
connect( cancelAct , SIGNAL( triggered() ), this, SLOT( cancel() ) );
|
||||
|
||||
openfolderAct = new QAction(QIcon(IMAGE_OPENFOLDER), tr("Open Folder"), this);
|
||||
connect(openfolderAct, SIGNAL(triggered()), this, SLOT(openFolderTransfer()));
|
||||
|
||||
openfileAct = new QAction(QIcon(IMAGE_OPENFILE), tr("Open File"), this);
|
||||
connect(openfileAct, SIGNAL(triggered()), this, SLOT(openTransfer()));
|
||||
|
||||
previewfileAct = new QAction(QIcon(IMAGE_PREVIEW), tr("Preview File"), this);
|
||||
connect(previewfileAct, SIGNAL(triggered()), this, SLOT(previewTransfer()));
|
||||
|
||||
detailsfileAct = new QAction(QIcon(IMAGE_INFO), tr("Details..."), this);
|
||||
connect(detailsfileAct, SIGNAL(triggered()), this, SLOT(showDetailsDialog()));
|
||||
|
||||
clearcompletedAct = new QAction(QIcon(IMAGE_CLEARCOMPLETED), tr( "Clear Completed" ), this );
|
||||
connect( clearcompletedAct , SIGNAL( triggered() ), this, SLOT( clearcompleted() ) );
|
||||
|
||||
#ifndef RS_RELEASE_VERSION
|
||||
copylinkAct = new QAction(QIcon(IMAGE_COPYLINK), tr( "Copy retroshare Link" ), this );
|
||||
connect( copylinkAct , SIGNAL( triggered() ), this, SLOT( copyLink() ) );
|
||||
#endif
|
||||
pastelinkAct = new QAction(QIcon(IMAGE_PASTELINK), tr( "Paste retroshare Link" ), this );
|
||||
connect( pastelinkAct , SIGNAL( triggered() ), this, SLOT( pasteLink() ) );
|
||||
queueDownAct = new QAction(QIcon(":/images/go-down.png"), tr("Down"), this);
|
||||
connect(queueDownAct, SIGNAL(triggered()), this, SLOT(priorityQueueDown()));
|
||||
queueUpAct = new QAction(QIcon(":/images/go-up.png"), tr("Up"), this);
|
||||
connect(queueUpAct, SIGNAL(triggered()), this, SLOT(priorityQueueUp()));
|
||||
queueTopAct = new QAction(QIcon(":/images/go-top.png"), tr("Top"), this);
|
||||
connect(queueTopAct, SIGNAL(triggered()), this, SLOT(priorityQueueTop()));
|
||||
queueBottomAct = new QAction(QIcon(":/images/go-bottom.png"), tr("Bottom"), this);
|
||||
connect(queueBottomAct, SIGNAL(triggered()), this, SLOT(priorityQueueBottom()));
|
||||
chunkStreamingAct = new QAction(QIcon(IMAGE_PRIORITYAUTO), tr("Streaming"), this);
|
||||
connect(chunkStreamingAct, SIGNAL(triggered()), this, SLOT(chunkStreaming()));
|
||||
prioritySlowAct = new QAction(QIcon(IMAGE_PRIORITYLOW), tr("Slower"), this);
|
||||
connect(prioritySlowAct, SIGNAL(triggered()), this, SLOT(speedSlow()));
|
||||
priorityMediumAct = new QAction(QIcon(IMAGE_PRIORITYNORMAL), tr("Average"), this);
|
||||
connect(priorityMediumAct, SIGNAL(triggered()), this, SLOT(speedAverage()));
|
||||
priorityFastAct = new QAction(QIcon(IMAGE_PRIORITYHIGH), tr("Faster"), this);
|
||||
connect(priorityFastAct, SIGNAL(triggered()), this, SLOT(speedFast()));
|
||||
chunkRandomAct = new QAction(QIcon(IMAGE_PRIORITYAUTO), tr("Random"), this);
|
||||
connect(chunkRandomAct, SIGNAL(triggered()), this, SLOT(chunkRandom()));
|
||||
playAct = new QAction(QIcon(IMAGE_PLAY), tr( "Play" ), this );
|
||||
connect( playAct , SIGNAL( triggered() ), this, SLOT( openTransfer() ) );
|
||||
}
|
||||
|
||||
void TransfersDialog::keyPressEvent(QKeyEvent *e)
|
||||
@ -219,7 +270,7 @@ void TransfersDialog::keyPressEvent(QKeyEvent *e)
|
||||
void TransfersDialog::downloadListCostumPopupMenu( QPoint point )
|
||||
{
|
||||
QMenu contextMnu( this );
|
||||
QMouseEvent *mevent = new QMouseEvent( QEvent::MouseButtonPress, point, Qt::RightButton, Qt::RightButton, Qt::NoModifier );
|
||||
QMouseEvent mevent( QEvent::MouseButtonPress, point, Qt::RightButton, Qt::RightButton, Qt::NoModifier );
|
||||
|
||||
std::set<QStandardItem *> items;
|
||||
std::set<QStandardItem *>::iterator it;
|
||||
@ -262,88 +313,25 @@ void TransfersDialog::downloadListCostumPopupMenu( QPoint point )
|
||||
}
|
||||
|
||||
|
||||
QAction *playAct = NULL;
|
||||
if (addPlayOption)
|
||||
{
|
||||
playAct = new QAction(QIcon(IMAGE_PLAY), tr( "Play" ), this );
|
||||
connect( playAct , SIGNAL( triggered() ), this, SLOT( openTransfer() ) );
|
||||
}
|
||||
QMenu viewMenu( tr("View"), this );
|
||||
|
||||
pauseAct = new QAction(QIcon(IMAGE_PAUSE), tr("Pause"), this);
|
||||
connect(pauseAct, SIGNAL(triggered()), this, SLOT(pauseFileTransfer()));
|
||||
QMenu priorityQueueMenu(tr("Move in Queue..."), this);
|
||||
priorityQueueMenu.setIcon(QIcon(IMAGE_PRIORITY));
|
||||
priorityQueueMenu.addAction(queueTopAct);
|
||||
priorityQueueMenu.addAction(queueUpAct);
|
||||
priorityQueueMenu.addAction(queueDownAct);
|
||||
priorityQueueMenu.addAction(queueBottomAct);
|
||||
|
||||
resumeAct = new QAction(QIcon(IMAGE_RESUME), tr("Resume"), this);
|
||||
connect(resumeAct, SIGNAL(triggered()), this, SLOT(resumeFileTransfer()));
|
||||
QMenu prioritySpeedMenu(tr("Priority (Speed)..."), this);
|
||||
prioritySpeedMenu.setIcon(QIcon(IMAGE_PRIORITY));
|
||||
prioritySpeedMenu.addAction(prioritySlowAct);
|
||||
prioritySpeedMenu.addAction(priorityMediumAct);
|
||||
prioritySpeedMenu.addAction(priorityFastAct);
|
||||
|
||||
cancelAct = new QAction(QIcon(IMAGE_CANCEL), tr( "Cancel" ), this );
|
||||
connect( cancelAct , SIGNAL( triggered() ), this, SLOT( cancel() ) );
|
||||
|
||||
openfolderAct = new QAction(QIcon(IMAGE_OPENFOLDER), tr("Open Folder"), this);
|
||||
connect(openfolderAct, SIGNAL(triggered()), this, SLOT(openFolderTransfer()));
|
||||
|
||||
openfileAct = new QAction(QIcon(IMAGE_OPENFILE), tr("Open File"), this);
|
||||
connect(openfileAct, SIGNAL(triggered()), this, SLOT(openTransfer()));
|
||||
|
||||
previewfileAct = new QAction(QIcon(IMAGE_PREVIEW), tr("Preview File"), this);
|
||||
connect(previewfileAct, SIGNAL(triggered()), this, SLOT(previewTransfer()));
|
||||
|
||||
detailsfileAct = new QAction(QIcon(IMAGE_INFO), tr("Details..."), this);
|
||||
connect(detailsfileAct, SIGNAL(triggered()), this, SLOT(showDetailsDialog()));
|
||||
|
||||
clearcompletedAct = new QAction(QIcon(IMAGE_CLEARCOMPLETED), tr( "Clear Completed" ), this );
|
||||
connect( clearcompletedAct , SIGNAL( triggered() ), this, SLOT( clearcompleted() ) );
|
||||
|
||||
#ifndef RS_RELEASE_VERSION
|
||||
copylinkAct = new QAction(QIcon(IMAGE_COPYLINK), tr( "Copy retroshare Link" ), this );
|
||||
connect( copylinkAct , SIGNAL( triggered() ), this, SLOT( copyLink() ) );
|
||||
#endif
|
||||
|
||||
pastelinkAct = new QAction(QIcon(IMAGE_PASTELINK), tr( "Paste retroshare Link" ), this );
|
||||
connect( pastelinkAct , SIGNAL( triggered() ), this, SLOT( pasteLink() ) );
|
||||
|
||||
QMenu *viewMenu = new QMenu( tr("View"), this );
|
||||
|
||||
// clearQueueAct = new QAction(QIcon(), tr("Remove all queued"), this);
|
||||
// connect(clearQueueAct, SIGNAL(triggered()), this, SLOT(clearQueue()));
|
||||
|
||||
queueDownAct = new QAction(QIcon(":/images/go-down.png"), tr("Down"), this);
|
||||
connect(queueDownAct, SIGNAL(triggered()), this, SLOT(priorityQueueDown()));
|
||||
queueUpAct = new QAction(QIcon(":/images/go-up.png"), tr("Up"), this);
|
||||
connect(queueUpAct, SIGNAL(triggered()), this, SLOT(priorityQueueUp()));
|
||||
queueTopAct = new QAction(QIcon(":/images/go-top.png"), tr("Top"), this);
|
||||
connect(queueTopAct, SIGNAL(triggered()), this, SLOT(priorityQueueTop()));
|
||||
queueBottomAct = new QAction(QIcon(":/images/go-bottom.png"), tr("Bottom"), this);
|
||||
connect(queueBottomAct, SIGNAL(triggered()), this, SLOT(priorityQueueBottom()));
|
||||
|
||||
prioritySlowAct = new QAction(QIcon(IMAGE_PRIORITYLOW), tr("Slower"), this);
|
||||
connect(prioritySlowAct, SIGNAL(triggered()), this, SLOT(speedSlow()));
|
||||
priorityMediumAct = new QAction(QIcon(IMAGE_PRIORITYNORMAL), tr("Average"), this);
|
||||
connect(priorityMediumAct, SIGNAL(triggered()), this, SLOT(speedAverage()));
|
||||
priorityFastAct = new QAction(QIcon(IMAGE_PRIORITYHIGH), tr("Faster"), this);
|
||||
connect(priorityFastAct, SIGNAL(triggered()), this, SLOT(speedFast()));
|
||||
|
||||
QMenu *priorityQueueMenu = new QMenu(tr("Move in Queue..."), this);
|
||||
priorityQueueMenu->setIcon(QIcon(IMAGE_PRIORITY));
|
||||
priorityQueueMenu->addAction(queueTopAct);
|
||||
priorityQueueMenu->addAction(queueUpAct);
|
||||
priorityQueueMenu->addAction(queueDownAct);
|
||||
priorityQueueMenu->addAction(queueBottomAct);
|
||||
|
||||
QMenu *prioritySpeedMenu = new QMenu(tr("Priority (Speed)..."), this);
|
||||
prioritySpeedMenu->setIcon(QIcon(IMAGE_PRIORITY));
|
||||
prioritySpeedMenu->addAction(prioritySlowAct);
|
||||
prioritySpeedMenu->addAction(priorityMediumAct);
|
||||
prioritySpeedMenu->addAction(priorityFastAct);
|
||||
|
||||
chunkStreamingAct = new QAction(QIcon(IMAGE_PRIORITYAUTO), tr("Streaming"), this);
|
||||
connect(chunkStreamingAct, SIGNAL(triggered()), this, SLOT(chunkStreaming()));
|
||||
chunkRandomAct = new QAction(QIcon(IMAGE_PRIORITYAUTO), tr("Random"), this);
|
||||
connect(chunkRandomAct, SIGNAL(triggered()), this, SLOT(chunkRandom()));
|
||||
|
||||
QMenu *chunkMenu = new QMenu(tr("Chunk strategy"), this);
|
||||
chunkMenu->setIcon(QIcon(IMAGE_PRIORITY));
|
||||
chunkMenu->addAction(chunkStreamingAct);
|
||||
chunkMenu->addAction(chunkRandomAct);
|
||||
QMenu chunkMenu(tr("Chunk strategy"), this);
|
||||
chunkMenu.setIcon(QIcon(IMAGE_PRIORITY));
|
||||
chunkMenu.addAction(chunkStreamingAct);
|
||||
chunkMenu.addAction(chunkRandomAct);
|
||||
|
||||
contextMnu.clear();
|
||||
|
||||
@ -378,12 +366,12 @@ void TransfersDialog::downloadListCostumPopupMenu( QPoint point )
|
||||
}
|
||||
|
||||
if(all_downloading)
|
||||
contextMnu.addMenu(prioritySpeedMenu);
|
||||
contextMnu.addMenu(&prioritySpeedMenu);
|
||||
else if(all_queued)
|
||||
contextMnu.addMenu(priorityQueueMenu) ;
|
||||
contextMnu.addMenu(&priorityQueueMenu) ;
|
||||
|
||||
if(all_downloading)
|
||||
contextMnu.addMenu( chunkMenu);
|
||||
contextMnu.addMenu( &chunkMenu);
|
||||
|
||||
if(single)
|
||||
{
|
||||
@ -422,11 +410,9 @@ void TransfersDialog::downloadListCostumPopupMenu( QPoint point )
|
||||
contextMnu.addAction( pastelinkAct);
|
||||
|
||||
contextMnu.addSeparator();
|
||||
// contextMnu.addAction( clearQueueAct);
|
||||
contextMnu.addSeparator();
|
||||
contextMnu.addMenu( viewMenu);
|
||||
contextMnu.addMenu( &viewMenu);
|
||||
|
||||
contextMnu.exec( mevent->globalPos() );
|
||||
contextMnu.exec( mevent.globalPos() );
|
||||
}
|
||||
|
||||
TransfersDialog::~TransfersDialog()
|
||||
@ -733,7 +719,7 @@ void TransfersDialog::insertTransfers()
|
||||
FileProgressInfo pinfo ;
|
||||
pinfo.cmap = fcinfo.chunks ;
|
||||
pinfo.type = FileProgressInfo::DOWNLOAD_LINE ;
|
||||
pinfo.progress = completed*100.0/info.size ;
|
||||
pinfo.progress = (info.size==0)?0:(completed*100.0/info.size) ;
|
||||
pinfo.nb_chunks = pinfo.cmap._map.empty()?0:fcinfo.chunks.size() ;
|
||||
|
||||
int addedRow = addItem("", fileName, fileHash, fileSize, pinfo, fileDlspeed, sources, status, priority, completed, remaining, downloadtime);
|
||||
@ -878,8 +864,8 @@ void TransfersDialog::insertTransfers()
|
||||
|
||||
double dlspeed = pit->tfRate * 1024.0;
|
||||
qlonglong fileSize = info.size;
|
||||
double completed = info.transfered;
|
||||
double progress = info.transfered * 100.0 / info.size;
|
||||
qlonglong completed = info.transfered;
|
||||
double progress = (info.size > 0)?(info.transfered * 100.0 / info.size):0.0;
|
||||
qlonglong remaining = (info.size - info.transfered) / (info.tfRate * 1024.0);
|
||||
|
||||
// Estimate the completion. We need something more accurate, meaning that we need to
|
||||
@ -891,49 +877,50 @@ void TransfersDialog::insertTransfers()
|
||||
++nb_chunks ;
|
||||
|
||||
uint32_t filled_chunks = pinfo.cmap.filledChunks(nb_chunks) ;
|
||||
pinfo.type = FileProgressInfo::UPLOAD_LINE ;
|
||||
pinfo.nb_chunks = pinfo.cmap._map.empty()?0:nb_chunks ;
|
||||
|
||||
if(filled_chunks > 1) {
|
||||
pinfo.progress = filled_chunks*100.0/nb_chunks ;
|
||||
pinfo.progress = (nb_chunks==0)?0:(filled_chunks*100.0/nb_chunks) ;
|
||||
completed = std::min(info.size,((uint64_t)filled_chunks)*chunk_size) ;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
pinfo.progress = progress ;
|
||||
}
|
||||
|
||||
addUploadItem("", fileName, fileHash, fileSize, pinfo, dlspeed, sources, status, completed, remaining);
|
||||
}
|
||||
|
||||
if (info.peers.size() == 0) { //it has not been added (maybe only turtle tunnels
|
||||
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);
|
||||
}
|
||||
// if (info.peers.size() == 0) { //it has not been added (maybe only turtle tunnels
|
||||
// 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);
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -132,6 +132,7 @@ private:
|
||||
QMenu* contextMnu;
|
||||
/** Defines the actions for the context menu */
|
||||
QAction* showdowninfoAct;
|
||||
QAction* playAct;
|
||||
QAction* cancelAct;
|
||||
QAction* clearcompletedAct;
|
||||
QAction* copylinkAct;
|
||||
|
@ -11,6 +11,7 @@
|
||||
using namespace std ;
|
||||
|
||||
TrustView::TrustView()
|
||||
: RsAutoUpdatePage(10000)
|
||||
{
|
||||
setupUi(this) ;
|
||||
|
||||
@ -26,13 +27,6 @@ TrustView::TrustView()
|
||||
QObject::connect(trustTableTW->horizontalHeader(),SIGNAL(sectionClicked(int)),this,SLOT(hideShowPeers(int))) ;
|
||||
|
||||
updatePB->setToolTip(tr("This table normaly auto-updates every 10 seconds.")) ;
|
||||
|
||||
QTimer *timer = new QTimer ;
|
||||
|
||||
QObject::connect(timer,SIGNAL(timeout()),this,SLOT(update())) ;
|
||||
timer->start(10000) ;
|
||||
|
||||
update() ;
|
||||
}
|
||||
|
||||
void TrustView::showEvent(QShowEvent *e)
|
||||
@ -55,10 +49,11 @@ void TrustView::selectCell(int row,int col)
|
||||
{
|
||||
static int last_row = -1 ;
|
||||
static int last_col = -1 ;
|
||||
|
||||
#ifdef DEBUG_TRUSTVIEW
|
||||
cout << "row = " << row << ", column = " << col << endl;
|
||||
if(row == 0 || col == 0)
|
||||
cout << "***********************************************" << endl ;
|
||||
#endif
|
||||
if(last_row > -1)
|
||||
{
|
||||
int col_s,row_s ;
|
||||
@ -133,19 +128,18 @@ int TrustView::getRowColId(const string& peerid)
|
||||
return i ;
|
||||
}
|
||||
|
||||
void TrustView::updateDisplay()
|
||||
{
|
||||
update() ;
|
||||
}
|
||||
void TrustView::update()
|
||||
{
|
||||
// collect info.
|
||||
|
||||
if(!isVisible())
|
||||
return ;
|
||||
|
||||
std::list<std::string> neighs;
|
||||
|
||||
if(!rsPeers->getGPGAllList(neighs))
|
||||
if(!rsPeers->getGPGAllList(neighs))
|
||||
return ;
|
||||
|
||||
neighs.push_back(rsPeers->getGPGOwnId()) ;
|
||||
neighs.push_back(rsPeers->getGPGOwnId()) ;
|
||||
|
||||
trustTableTW->setSortingEnabled(false) ;
|
||||
|
||||
@ -162,9 +156,11 @@ void TrustView::update()
|
||||
int i = getRowColId(details.id) ;
|
||||
std::string issuer(details.issuer) ; // the one we check for trust.
|
||||
|
||||
for(list<string>::const_iterator it2(details.gpgSigners.begin());it2!=details.gpgSigners.end();++it2)
|
||||
for(list<string>::const_iterator it2(details.gpgSigners.begin());it2!=details.gpgSigners.end();++it2)
|
||||
{
|
||||
#ifdef DEBUG_TRUSTVIEW
|
||||
cout << *it2 << " " ;
|
||||
#endif
|
||||
|
||||
int j = getRowColId(*it2) ;
|
||||
|
||||
@ -175,7 +171,7 @@ void TrustView::update()
|
||||
else
|
||||
trustTableTW->item(i,j)->setText(trr) ;
|
||||
}
|
||||
// cout << endl ;
|
||||
// cout << endl ;
|
||||
}
|
||||
// assign colors
|
||||
vector<int> ni(trustTableTW->rowCount(),0) ;
|
||||
@ -199,7 +195,7 @@ void TrustView::update()
|
||||
if(i_ji == NULL)
|
||||
{
|
||||
i_ij->setBackgroundColor(Qt::yellow) ;
|
||||
i_ij->setToolTip(trustTableTW->horizontalHeaderItem(i)->text() + tr(" is athenticated (one way) by " )+trustTableTW->verticalHeaderItem(j)->text()) ;
|
||||
i_ij->setToolTip(trustTableTW->horizontalHeaderItem(i)->text() + tr(" is athenticated (one way) by " )+trustTableTW->verticalHeaderItem(j)->text()) ;
|
||||
i_ij->setText(tr("Half")) ;
|
||||
}
|
||||
else
|
||||
@ -207,22 +203,22 @@ void TrustView::update()
|
||||
if(i==j)
|
||||
{
|
||||
i_ij->setBackgroundColor(Qt::red) ;
|
||||
i_ij->setToolTip(trustTableTW->horizontalHeaderItem(i)->text() + tr(" athenticated himself") ) ;
|
||||
i_ij->setToolTip(trustTableTW->horizontalHeaderItem(i)->text() + tr(" athenticated himself") ) ;
|
||||
}
|
||||
else
|
||||
{
|
||||
i_ij->setBackgroundColor(Qt::green) ;
|
||||
i_ij->setToolTip(trustTableTW->horizontalHeaderItem(i)->text() + " and " +trustTableTW->verticalHeaderItem(j)->text() + tr(" athenticated each others") ) ;
|
||||
i_ij->setToolTip(trustTableTW->horizontalHeaderItem(i)->text() + " and " +trustTableTW->verticalHeaderItem(j)->text() + tr(" athenticated each others") ) ;
|
||||
i_ij->setText(tr("Full")) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
for(int i=0;i<trustTableTW->rowCount();++i)
|
||||
trustTableTW->verticalHeaderItem(i)->setToolTip(trustTableTW->verticalHeaderItem(i)->text()+ tr(" is athenticated by ") + QString::number(ni[i]) + tr(" peers, including him(her)self.")) ;
|
||||
trustTableTW->verticalHeaderItem(i)->setToolTip(trustTableTW->verticalHeaderItem(i)->text()+ tr(" is athenticated by ") + QString::number(ni[i]) + tr(" peers, including him(her)self.")) ;
|
||||
|
||||
for(int j=0;j<trustTableTW->columnCount();++j)
|
||||
trustTableTW->horizontalHeaderItem(j)->setToolTip(trustTableTW->horizontalHeaderItem(j)->text()+ tr(" athenticated ") + QString::number(nj[j]) + tr(" peers, including him(her)self.")) ;
|
||||
trustTableTW->horizontalHeaderItem(j)->setToolTip(trustTableTW->horizontalHeaderItem(j)->text()+ tr(" athenticated ") + QString::number(nj[j]) + tr(" peers, including him(her)self.")) ;
|
||||
|
||||
}
|
||||
|
||||
|
@ -1,9 +1,10 @@
|
||||
#include "ui_TrustView.h"
|
||||
#include <gui/RsAutoUpdatePage.h>
|
||||
|
||||
class QWheelEvent ;
|
||||
class QShowEvent ;
|
||||
|
||||
class TrustView: public QWidget, public Ui::TrustView
|
||||
class TrustView: public RsAutoUpdatePage, public Ui::TrustView
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@ -14,6 +15,7 @@ class TrustView: public QWidget, public Ui::TrustView
|
||||
virtual void wheelEvent(QWheelEvent *) ;
|
||||
virtual void showEvent(QShowEvent *) ;
|
||||
|
||||
virtual void updateDisplay() ;
|
||||
public slots:
|
||||
void update() ;
|
||||
void updateZoom(int) ;
|
||||
|
@ -206,16 +206,14 @@ TextPage::TextPage(QWidget *parent)
|
||||
userCertEdit = new QTextEdit;
|
||||
std::string invite = rsPeers->GetRetroshareInvite();
|
||||
|
||||
userCertEdit->setText(QString::fromStdString(invite));
|
||||
userCertEdit->setReadOnly(true);
|
||||
userCertEdit->setMinimumHeight(200);
|
||||
userCertEdit->setMinimumWidth(530);
|
||||
QFont font;
|
||||
font.setPointSize(10);
|
||||
font.setBold(false);
|
||||
font.setStyleHint(QFont::TypeWriter, QFont::PreferDefault);
|
||||
//font.setWeight(75);
|
||||
QFont font("Courier New",10,50,false);
|
||||
font.setStyleHint(QFont::TypeWriter,QFont::PreferMatch);
|
||||
font.setStyle(QFont::StyleNormal);
|
||||
userCertEdit->setFont(font);
|
||||
userCertEdit->setText(QString::fromStdString(invite));
|
||||
|
||||
std::cerr << "TextPage() getting Invite: " << invite << std::endl;
|
||||
|
||||
@ -270,6 +268,9 @@ TextPage::TextPage(QWidget *parent)
|
||||
|
||||
friendCertEdit = new QTextEdit;
|
||||
|
||||
//font.setWeight(75);
|
||||
friendCertEdit->setFont(font);
|
||||
|
||||
//=== add all widgets to one layout
|
||||
textPageLayout = new QVBoxLayout();
|
||||
textPageLayout->addWidget(userCertLabel);
|
||||
|
@ -80,6 +80,9 @@ CryptoPage::load()
|
||||
void
|
||||
CryptoPage::loadPublicKey()
|
||||
{
|
||||
QFont font("Courier New",9,50,false) ;
|
||||
ui.certtextEdit->setFont(font) ;
|
||||
|
||||
ui.certtextEdit->setPlainText(QString::fromStdString(rsPeers->GetRetroshareInvite()));
|
||||
ui.certtextEdit->setReadOnly(true);
|
||||
ui.certtextEdit->setMinimumHeight(200);
|
||||
|
@ -218,7 +218,7 @@ void xProgressBar::paint()
|
||||
else
|
||||
{
|
||||
// calculate progress value
|
||||
int preWidth = static_cast<int>((rect.width() - 1 - hSpan)*(_pinfo.progress/100));
|
||||
int preWidth = static_cast<int>((rect.width() - 1 - hSpan)*(_pinfo.progress/100.0f));
|
||||
int progressWidth = rect.width() - preWidth;
|
||||
if (progressWidth == rect.width() - hSpan) return;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user