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:
csoler 2010-03-28 20:46:45 +00:00
parent 12536efd16
commit 08065b4298
22 changed files with 264 additions and 299 deletions

View File

@ -947,12 +947,20 @@ int FileIndex::saveIndex(std::string filename, std::string &fileHash, uint64_t &
std::map<std::string, DirEntry *>::iterator it; std::map<std::string, DirEntry *>::iterator it;
for(it = root->subdirs.begin(); it != root->subdirs.end(); 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 ; 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()) if(forbidden_dirs.find(it->second->name) != forbidden_dirs.end())
{
#ifdef FI_DEBUG
std::cerr << " will be suppressed." << std::endl ; std::cerr << " will be suppressed." << std::endl ;
#endif
}
else else
{ {
#ifdef FI_DEBUG
std::cerr << " will be saved." << std::endl ; std::cerr << " will be saved." << std::endl ;
#endif
(it->second)->saveEntry(oss); (it->second)->saveEntry(oss);
} }
} }

View File

@ -57,7 +57,6 @@
* #define CONTROL_DEBUG 1 * #define CONTROL_DEBUG 1
* #define DEBUG_DWLQUEUE 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 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 static const uint32_t INACTIVE_CHUNKS_CHECK_DELAY = 60 ; // time after which an inactive chunk is released

View File

@ -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 << "ftDataMultiplex::handleRecvChunkMap() ERROR: No matching file Provider for hash " << hash ;
std::cerr << std::endl; std::cerr << std::endl;
#endif #endif
return false;
} }
it->second->setClientMap(peerId, compressed_map); it->second->setClientMap(peerId, compressed_map);

View File

@ -431,6 +431,7 @@ bool ftExtraList::loadList(std::list<RsItem *> load)
} }
fclose(fd); fclose(fd);
fd = NULL ;
if (ts > (time_t)fi->file.age) if (ts > (time_t)fi->file.age)
{ {

View File

@ -8,7 +8,7 @@
static const time_t UPLOAD_CHUNK_MAPS_TIME = 30 ; // time to ask for a new chunkmap from uploaders in seconds. 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 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 ******/ RsStackMutex stack(ftcMutex); /********** STACK LOCKED MTX ******/
clients_chunk_maps.clear(); clients_chunk_maps.clear();
@ -25,6 +25,7 @@ ftFileProvider::~ftFileProvider(){
#endif #endif
if (fd!=NULL) { if (fd!=NULL) {
fclose(fd); fclose(fd);
fd = NULL ;
} }
} }
@ -239,7 +240,7 @@ int ftFileProvider::initializeFileAttrs()
* attempt to open file * attempt to open file
*/ */
fd = fopen64(file_name.c_str(), "rb"); fd = fopen64(file_name.c_str(), "r+b");
if (!fd) if (!fd)
{ {
std::cerr << "ftFileProvider::initializeFileAttrs() Failed to open (r+b): "; std::cerr << "ftFileProvider::initializeFileAttrs() Failed to open (r+b): ";

View File

@ -34,7 +34,9 @@
#include "serialiser/rsconfigitems.h" #include "serialiser/rsconfigitems.h"
/*
#define CONFIG_DEBUG 1 #define CONFIG_DEBUG 1
*/
#define BACKEDUP_SAVE #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){ const std::string& sign_fname_backup, BinMemInterface* configbio, BinMemInterface* signbio){
FILE *file = NULL, *sign = NULL; FILE *file = NULL, *sign = NULL;
char *config_buff, *sign_buff; char *config_buff=NULL, *sign_buff=NULL;
int size_file, size_sign; int size_file=0, size_sign=0;
// begin two pass saving by writing to back up file instead // 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())) 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; uint32_t stream_flags = BIN_FLAGS_WRITEABLE;
bool written = true; bool written = true;
FILE* cfg_file = NULL; FILE* cfg_file = NULL;
char* buff; char* buff=NULL;
int size_file = 0; int size_file = 0;
if (!cleanup) if (!cleanup)

View File

@ -138,7 +138,7 @@ class RsConfig
firewalled = forwardPort = false ; firewalled = forwardPort = false ;
maxDownloadDataRate = maxUploadDataRate = maxIndivDataRate = 0 ; maxDownloadDataRate = maxUploadDataRate = maxIndivDataRate = 0 ;
promptAtBoot = 0 ; promptAtBoot = 0 ;
DHTActive = uPnPActive = netLocalOk = netDhtOk = netStunOk = netExtraAddressOk = false ; DHTActive = uPnPActive = netLocalOk = netUpnpOk = netDhtOk = netStunOk = netExtraAddressOk = false ;
uPnPState = DHTPeers = 0 ; uPnPState = DHTPeers = 0 ;
} }
std::string ownId; std::string ownId;

View File

@ -594,15 +594,17 @@ void p3ChatService::sendAvatarJpegData(const std::string& peer_id)
// take avatar, and embed it into a std::wstring. // 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 << "p3ChatService::sending avatar image to peer" << peer_id << ", image size = " << ci->image_size << std::endl ;
std::cerr << std::endl; std::cerr << std::endl;
#endif
sendItem(ci) ; sendItem(ci) ;
} }
else { else {
#ifdef CHAT_DEBUG #ifdef CHAT_DEBUG
std::cerr << "Doing nothing" << std::endl ; std::cerr << "Doing nothing" << std::endl ;
#endif #endif
} }
} }

View File

@ -423,6 +423,7 @@ void p3Ranking::addRankMsg(RsRankLinkMsg *msg)
RankGroup grp; RankGroup grp;
grp.rid = rid; grp.rid = rid;
grp.ownTag = false; grp.ownTag = false;
grp.rank = 0.0f;
/*************************************************************************/ /*************************************************************************/
/****************************** LINK SPECIFIC ****************************/ /****************************** LINK SPECIFIC ****************************/
@ -438,7 +439,6 @@ void p3Ranking::addRankMsg(RsRankLinkMsg *msg)
mData[rid] = grp; mData[rid] = grp;
it = mData.find(rid); it = mData.find(rid);
if (id == "") if (id == "")
{ {
#ifdef RANK_DEBUG #ifdef RANK_DEBUG

View File

@ -95,6 +95,7 @@ RsQueueThread::RsQueueThread(uint32_t min, uint32_t max, double relaxFactor )
:mMinSleep(min), mMaxSleep(max), mRelaxFactor(relaxFactor) :mMinSleep(min), mMaxSleep(max), mRelaxFactor(relaxFactor)
{ {
mLastSleep = (uint32_t)mMinSleep ; mLastSleep = (uint32_t)mMinSleep ;
mLastWork = time(NULL) ;
} }
void RsQueueThread::run() void RsQueueThread::run()

View File

@ -227,6 +227,8 @@ void FileTransferInfoWidget::draw(const FileInfo& nfo,const FileChunksInfo& info
y += block_sep ; 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 += 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 += 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 += 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 += 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") ; y += text_height ; painter->drawText(20,y,tr("Chunk strategy: ")) ; painter->drawText(tab_size,y,(info.strategy==FileChunksInfo::CHUNK_STRATEGY_RANDOM)?"Random":"Streaming") ;

View File

@ -111,8 +111,6 @@ MainWindow::MainWindow(QWidget* parent, Qt::WFlags flags)
/* Invoke the Qt Designer generated QObject setup routine */ /* Invoke the Qt Designer generated QObject setup routine */
ui.setupUi(this); ui.setupUi(this);
updateToolBaricons();
/* Create RshareSettings object */ /* Create RshareSettings object */
_settings = new RshareSettings(); _settings = new RshareSettings();
@ -183,7 +181,7 @@ MainWindow::MainWindow(QWidget* parent, Qt::WFlags flags)
ui.stackPages->add(messagesDialog = new MessagesDialog(ui.stackPages), 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 #ifndef RS_RELEASE_VERSION
ChannelFeed *channelFeed = NULL; ChannelFeed *channelFeed = NULL;
@ -332,59 +330,59 @@ void MainWindow::displaySystrayMsg(const QString& title,const QString& msg)
void MainWindow::updateStatus() void MainWindow::updateStatus()
{ {
if (ratesstatus) if (ratesstatus)
ratesstatus->getRatesStatus(); ratesstatus->getRatesStatus();
if (peerstatus) if (peerstatus)
peerstatus->getPeerStatus(); peerstatus->getPeerStatus();
if (natstatus) if (natstatus)
natstatus->getNATStatus(); natstatus->getNATStatus();
std::list<std::string> ids; std::list<std::string> ids;
rsPeers->getOnlineList(ids); rsPeers->getOnlineList(ids);
int online = ids.size(); int online = ids.size();
std::list<MsgInfoSummary> msgList;
std::list<MsgInfoSummary>::const_iterator it;
rsMsgs -> getMessageSummaries(msgList); std::list<MsgInfoSummary> msgList;
std::list<MsgInfoSummary>::const_iterator it;
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"));
}
}
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) 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 );
}
}
}

View File

@ -105,8 +105,6 @@ public slots:
void updateHashingInfo(const QString&) ; void updateHashingInfo(const QString&) ;
void displayErrorMessage(int,int,const QString&) ; void displayErrorMessage(int,int,const QString&) ;
void updateToolBaricons();
protected: protected:
void closeEvent(QCloseEvent *); void closeEvent(QCloseEvent *);
@ -190,7 +188,7 @@ private:
QLabel *_hashing_info_label ; QLabel *_hashing_info_label ;
QIcon MessageIcon; QAction *messageAction ;
/** Qt Designer generated object */ /** Qt Designer generated object */
Ui::MainWindow ui; Ui::MainWindow ui;

View File

@ -1025,7 +1025,8 @@ void RemoteDirModel::openSelected(QModelIndexList qmil, bool openFolder)
std::list<DirDetails>::iterator it; std::list<DirDetails>::iterator it;
getFileInfoFromIndexList(qmil, files_info); 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; if ((*it).type & DIR_TYPE_PERSON) continue;
std::string fullpath, name; std::string fullpath, name;
@ -1039,25 +1040,19 @@ void RemoteDirModel::openSelected(QModelIndexList qmil, bool openFolder)
name = fullpath; name = fullpath;
} }
if (!openFolder) { std::cerr << "Opennign this file: " << name << std::endl ;
if ((*it).type & DIR_TYPE_FILE) {
QDesktopServices::openUrl(QUrl::fromLocalFile(name.c_str())); QDesktopServices::openUrl(QUrl::fromLocalFile(QString::fromUtf8(name.c_str(),name.length())));
}
} else {
if (dirs_to_open.end() == std::find(dirs_to_open.begin(), dirs_to_open.end(), fullpath)) {
dirs_to_open.push_back(fullpath);
}
}
} }
if (openFolder) { // if (openFolder) {
std::list<std::string>::iterator dit; // std::list<std::string>::iterator dit;
for (dit = dirs_to_open.begin(); dit != dirs_to_open.end(); dit++) // for (dit = dirs_to_open.begin(); dit != dirs_to_open.end(); dit++)
{ // {
std::cerr << "Opennign this folder: " << (*dit).c_str() << std::endl ; // std::cerr << "Opennign this folder: " << (*dit).c_str() << std::endl ;
QDesktopServices::openUrl(QUrl::fromLocalFile((*dit).c_str())); // QDesktopServices::openUrl(QUrl::fromLocalFile(QString::fromUtf8((*dit).c_str())));
} // }
} // }
#ifdef RDM_DEBUG #ifdef RDM_DEBUG
std::cerr << "::::::::::::Done RemoteDirModel::openSelected()" << std::endl; std::cerr << "::::::::::::Done RemoteDirModel::openSelected()" << std::endl;

View File

@ -171,6 +171,24 @@ SharedFilesDialog::SharedFilesDialog(QWidget *parent)
#ifdef Q_WS_WIN #ifdef Q_WS_WIN
#endif #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() void SharedFilesDialog::checkUpdate()
@ -595,7 +613,7 @@ void SharedFilesDialog::sharedDirTreeWidgetContextMenu( QPoint point )
QMenu contextMnu2( this ); QMenu contextMnu2( this );
// //
QAction* menuAction = fileAssotiationAction(currentFile) ; // QAction* menuAction = fileAssotiationAction(currentFile) ;
//new QAction(QIcon(IMAGE_PLAY), currentFile, this); //new QAction(QIcon(IMAGE_PLAY), currentFile, this);
//tr( "111Play File(s)" ), this ); //tr( "111Play File(s)" ), this );
// connect( openfolderAct , SIGNAL( triggered() ), 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 ); QMenu recMenu( tr("Recommend (Automated message) To "), this );
recMenu->setIcon(QIcon(IMAGE_ATTACHMENT)); recMenu.setIcon(QIcon(IMAGE_ATTACHMENT));
QMenu *msgMenu = new QMenu( tr("Recommend in a message to "), &contextMnu2 ); QMenu msgMenu( tr("Recommend in a message to "), &contextMnu2 );
msgMenu->setIcon(QIcon(IMAGE_MSG)); msgMenu.setIcon(QIcon(IMAGE_MSG));
std::list<std::string> peers; std::list<std::string> peers;
std::list<std::string>::iterator it; std::list<std::string>::iterator it;
@ -649,52 +667,24 @@ void SharedFilesDialog::sharedDirTreeWidgetContextMenu( QPoint point )
* msgMenu * 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 ) ) ); 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 ) ) ); connect( qaf2 , SIGNAL( triggeredId( std::string ) ), this, SLOT( recommendFilesToMsg( std::string ) ) );
msgMenu->addAction(qaf2);
recMenu.addAction(qaf1);
msgMenu.addAction(qaf2);
/* create list of ids */ /* create list of ids */
} }
//#endif //#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 ) ) if(localModel->isDir( midx ) )
contextMnu2.addAction( openfolderAct); contextMnu2.addAction( openfolderAct);
else else
{ {
contextMnu2.addAction( menuAction ); // contextMnu2.addAction( menuAction );
contextMnu2.addAction( openfileAct); contextMnu2.addAction( openfileAct);
} }
@ -713,14 +703,12 @@ void SharedFilesDialog::sharedDirTreeWidgetContextMenu( QPoint point )
contextMnu2.addAction( addlinkCloudAct); contextMnu2.addAction( addlinkCloudAct);
contextMnu2.addSeparator(); contextMnu2.addSeparator();
#endif #endif
contextMnu2.addMenu( recMenu); contextMnu2.addMenu( &recMenu);
contextMnu2.addMenu( msgMenu); contextMnu2.addMenu( &msgMenu);
} }
QMouseEvent *mevent2 = new QMouseEvent( QEvent::MouseButtonPress, point, QMouseEvent mevent2( QEvent::MouseButtonPress, point, Qt::RightButton, Qt::RightButton, Qt::NoModifier );
Qt::RightButton, Qt::RightButton, contextMnu2.exec( mevent2.globalPos() );
Qt::NoModifier );
contextMnu2.exec( mevent2->globalPos() );
} }
//============================================================================ //============================================================================

View File

@ -203,6 +203,57 @@ TransfersDialog::TransfersDialog(QWidget *parent)
QObject::connect(ui._showCacheTransfers_CB,SIGNAL(toggled(bool)),this,SLOT(insertTransfers())) ; 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) void TransfersDialog::keyPressEvent(QKeyEvent *e)
@ -219,7 +270,7 @@ void TransfersDialog::keyPressEvent(QKeyEvent *e)
void TransfersDialog::downloadListCostumPopupMenu( QPoint point ) void TransfersDialog::downloadListCostumPopupMenu( QPoint point )
{ {
QMenu contextMnu( this ); 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 *> items;
std::set<QStandardItem *>::iterator it; std::set<QStandardItem *>::iterator it;
@ -262,88 +313,25 @@ void TransfersDialog::downloadListCostumPopupMenu( QPoint point )
} }
QAction *playAct = NULL; QMenu viewMenu( tr("View"), this );
if (addPlayOption)
{
playAct = new QAction(QIcon(IMAGE_PLAY), tr( "Play" ), this );
connect( playAct , SIGNAL( triggered() ), this, SLOT( openTransfer() ) );
}
pauseAct = new QAction(QIcon(IMAGE_PAUSE), tr("Pause"), this); QMenu priorityQueueMenu(tr("Move in Queue..."), this);
connect(pauseAct, SIGNAL(triggered()), this, SLOT(pauseFileTransfer())); 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); QMenu prioritySpeedMenu(tr("Priority (Speed)..."), this);
connect(resumeAct, SIGNAL(triggered()), this, SLOT(resumeFileTransfer())); prioritySpeedMenu.setIcon(QIcon(IMAGE_PRIORITY));
prioritySpeedMenu.addAction(prioritySlowAct);
prioritySpeedMenu.addAction(priorityMediumAct);
prioritySpeedMenu.addAction(priorityFastAct);
cancelAct = new QAction(QIcon(IMAGE_CANCEL), tr( "Cancel" ), this ); QMenu chunkMenu(tr("Chunk strategy"), this);
connect( cancelAct , SIGNAL( triggered() ), this, SLOT( cancel() ) ); chunkMenu.setIcon(QIcon(IMAGE_PRIORITY));
chunkMenu.addAction(chunkStreamingAct);
openfolderAct = new QAction(QIcon(IMAGE_OPENFOLDER), tr("Open Folder"), this); chunkMenu.addAction(chunkRandomAct);
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);
contextMnu.clear(); contextMnu.clear();
@ -378,12 +366,12 @@ void TransfersDialog::downloadListCostumPopupMenu( QPoint point )
} }
if(all_downloading) if(all_downloading)
contextMnu.addMenu(prioritySpeedMenu); contextMnu.addMenu(&prioritySpeedMenu);
else if(all_queued) else if(all_queued)
contextMnu.addMenu(priorityQueueMenu) ; contextMnu.addMenu(&priorityQueueMenu) ;
if(all_downloading) if(all_downloading)
contextMnu.addMenu( chunkMenu); contextMnu.addMenu( &chunkMenu);
if(single) if(single)
{ {
@ -422,11 +410,9 @@ void TransfersDialog::downloadListCostumPopupMenu( QPoint point )
contextMnu.addAction( pastelinkAct); contextMnu.addAction( pastelinkAct);
contextMnu.addSeparator(); contextMnu.addSeparator();
// contextMnu.addAction( clearQueueAct); contextMnu.addMenu( &viewMenu);
contextMnu.addSeparator();
contextMnu.addMenu( viewMenu);
contextMnu.exec( mevent->globalPos() ); contextMnu.exec( mevent.globalPos() );
} }
TransfersDialog::~TransfersDialog() TransfersDialog::~TransfersDialog()
@ -733,7 +719,7 @@ void TransfersDialog::insertTransfers()
FileProgressInfo pinfo ; FileProgressInfo pinfo ;
pinfo.cmap = fcinfo.chunks ; pinfo.cmap = fcinfo.chunks ;
pinfo.type = FileProgressInfo::DOWNLOAD_LINE ; 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() ; 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); 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; double dlspeed = pit->tfRate * 1024.0;
qlonglong fileSize = info.size; qlonglong fileSize = info.size;
double completed = info.transfered; qlonglong completed = info.transfered;
double progress = info.transfered * 100.0 / info.size; double progress = (info.size > 0)?(info.transfered * 100.0 / info.size):0.0;
qlonglong remaining = (info.size - info.transfered) / (info.tfRate * 1024.0); qlonglong remaining = (info.size - info.transfered) / (info.tfRate * 1024.0);
// Estimate the completion. We need something more accurate, meaning that we need to // Estimate the completion. We need something more accurate, meaning that we need to
@ -891,49 +877,50 @@ void TransfersDialog::insertTransfers()
++nb_chunks ; ++nb_chunks ;
uint32_t filled_chunks = pinfo.cmap.filledChunks(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 ; pinfo.nb_chunks = pinfo.cmap._map.empty()?0:nb_chunks ;
if(filled_chunks > 1) { 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) ; completed = std::min(info.size,((uint64_t)filled_chunks)*chunk_size) ;
} else { }
else
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 // if (info.peers.size() == 0) { //it has not been added (maybe only turtle tunnels
QString fileHash = QString::fromStdString(info.hash); // QString fileHash = QString::fromStdString(info.hash);
QString fileName = QString::fromUtf8(info.fname.c_str()); // QString fileName = QString::fromUtf8(info.fname.c_str());
QString sources = tr(""); // QString sources = tr("");
//
QString status; // QString status;
switch(info.downloadStatus) // switch(info.downloadStatus)
{ // {
case FT_STATE_FAILED: status = tr("Failed"); break; // case FT_STATE_FAILED: status = tr("Failed"); break;
case FT_STATE_OKAY: status = tr("Okay"); break; // case FT_STATE_OKAY: status = tr("Okay"); break;
case FT_STATE_WAITING: status = tr("Waiting"); break; // case FT_STATE_WAITING: status = tr("Waiting"); break;
case FT_STATE_DOWNLOADING: status = tr("Uploading");break; // case FT_STATE_DOWNLOADING: status = tr("Uploading");break;
case FT_STATE_COMPLETE:status = tr("Complete"); break; // case FT_STATE_COMPLETE:status = tr("Complete"); break;
default: status = tr("Complete"); break; // default: status = tr("Complete"); break;
//
} // }
//
double dlspeed = info.tfRate * 1024.0; // double dlspeed = info.tfRate * 1024.0;
qlonglong fileSize = info.size; // qlonglong fileSize = info.size;
double completed = info.transfered; // double completed = info.transfered;
double progress = info.transfered * 100.0 / info.size; // double progress = info.transfered * 100.0 / info.size;
qlonglong remaining = (info.size - info.transfered) / (info.tfRate * 1024.0); // qlonglong remaining = (info.size - info.transfered) / (info.tfRate * 1024.0);
//
FileProgressInfo pinfo ; // FileProgressInfo pinfo ;
pinfo.progress = progress ; // pinfo.progress = progress ;
pinfo.cmap = CompressedChunkMap() ; // pinfo.cmap = CompressedChunkMap() ;
pinfo.type = FileProgressInfo::DOWNLOAD_LINE ; // pinfo.type = FileProgressInfo::DOWNLOAD_LINE ;
pinfo.nb_chunks = 0 ; // pinfo.nb_chunks = 0 ;
//
addUploadItem("", fileName, fileHash, fileSize, pinfo, dlspeed, sources, status, completed, remaining); // addUploadItem("", fileName, fileHash, fileSize, pinfo, dlspeed, sources, status, completed, remaining);
} // }
} }
} }

View File

@ -132,6 +132,7 @@ private:
QMenu* contextMnu; QMenu* contextMnu;
/** Defines the actions for the context menu */ /** Defines the actions for the context menu */
QAction* showdowninfoAct; QAction* showdowninfoAct;
QAction* playAct;
QAction* cancelAct; QAction* cancelAct;
QAction* clearcompletedAct; QAction* clearcompletedAct;
QAction* copylinkAct; QAction* copylinkAct;

View File

@ -11,6 +11,7 @@
using namespace std ; using namespace std ;
TrustView::TrustView() TrustView::TrustView()
: RsAutoUpdatePage(10000)
{ {
setupUi(this) ; setupUi(this) ;
@ -26,13 +27,6 @@ TrustView::TrustView()
QObject::connect(trustTableTW->horizontalHeader(),SIGNAL(sectionClicked(int)),this,SLOT(hideShowPeers(int))) ; QObject::connect(trustTableTW->horizontalHeader(),SIGNAL(sectionClicked(int)),this,SLOT(hideShowPeers(int))) ;
updatePB->setToolTip(tr("This table normaly auto-updates every 10 seconds.")) ; 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) void TrustView::showEvent(QShowEvent *e)
@ -55,10 +49,11 @@ void TrustView::selectCell(int row,int col)
{ {
static int last_row = -1 ; static int last_row = -1 ;
static int last_col = -1 ; static int last_col = -1 ;
#ifdef DEBUG_TRUSTVIEW
cout << "row = " << row << ", column = " << col << endl; cout << "row = " << row << ", column = " << col << endl;
if(row == 0 || col == 0) if(row == 0 || col == 0)
cout << "***********************************************" << endl ; cout << "***********************************************" << endl ;
#endif
if(last_row > -1) if(last_row > -1)
{ {
int col_s,row_s ; int col_s,row_s ;
@ -133,19 +128,18 @@ int TrustView::getRowColId(const string& peerid)
return i ; return i ;
} }
void TrustView::updateDisplay()
{
update() ;
}
void TrustView::update() void TrustView::update()
{ {
// collect info.
if(!isVisible())
return ;
std::list<std::string> neighs; std::list<std::string> neighs;
if(!rsPeers->getGPGAllList(neighs)) if(!rsPeers->getGPGAllList(neighs))
return ; return ;
neighs.push_back(rsPeers->getGPGOwnId()) ; neighs.push_back(rsPeers->getGPGOwnId()) ;
trustTableTW->setSortingEnabled(false) ; trustTableTW->setSortingEnabled(false) ;
@ -162,9 +156,11 @@ void TrustView::update()
int i = getRowColId(details.id) ; int i = getRowColId(details.id) ;
std::string issuer(details.issuer) ; // the one we check for trust. 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 << " " ; cout << *it2 << " " ;
#endif
int j = getRowColId(*it2) ; int j = getRowColId(*it2) ;
@ -175,7 +171,7 @@ void TrustView::update()
else else
trustTableTW->item(i,j)->setText(trr) ; trustTableTW->item(i,j)->setText(trr) ;
} }
// cout << endl ; // cout << endl ;
} }
// assign colors // assign colors
vector<int> ni(trustTableTW->rowCount(),0) ; vector<int> ni(trustTableTW->rowCount(),0) ;
@ -199,7 +195,7 @@ void TrustView::update()
if(i_ji == NULL) if(i_ji == NULL)
{ {
i_ij->setBackgroundColor(Qt::yellow) ; 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")) ; i_ij->setText(tr("Half")) ;
} }
else else
@ -207,22 +203,22 @@ void TrustView::update()
if(i==j) if(i==j)
{ {
i_ij->setBackgroundColor(Qt::red) ; 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 else
{ {
i_ij->setBackgroundColor(Qt::green) ; 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")) ; i_ij->setText(tr("Full")) ;
} }
} }
} }
} }
for(int i=0;i<trustTableTW->rowCount();++i) 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) 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.")) ;
} }

View File

@ -1,9 +1,10 @@
#include "ui_TrustView.h" #include "ui_TrustView.h"
#include <gui/RsAutoUpdatePage.h>
class QWheelEvent ; class QWheelEvent ;
class QShowEvent ; class QShowEvent ;
class TrustView: public QWidget, public Ui::TrustView class TrustView: public RsAutoUpdatePage, public Ui::TrustView
{ {
Q_OBJECT Q_OBJECT
@ -14,6 +15,7 @@ class TrustView: public QWidget, public Ui::TrustView
virtual void wheelEvent(QWheelEvent *) ; virtual void wheelEvent(QWheelEvent *) ;
virtual void showEvent(QShowEvent *) ; virtual void showEvent(QShowEvent *) ;
virtual void updateDisplay() ;
public slots: public slots:
void update() ; void update() ;
void updateZoom(int) ; void updateZoom(int) ;

View File

@ -206,16 +206,14 @@ TextPage::TextPage(QWidget *parent)
userCertEdit = new QTextEdit; userCertEdit = new QTextEdit;
std::string invite = rsPeers->GetRetroshareInvite(); std::string invite = rsPeers->GetRetroshareInvite();
userCertEdit->setText(QString::fromStdString(invite));
userCertEdit->setReadOnly(true); userCertEdit->setReadOnly(true);
userCertEdit->setMinimumHeight(200); userCertEdit->setMinimumHeight(200);
userCertEdit->setMinimumWidth(530); userCertEdit->setMinimumWidth(530);
QFont font; QFont font("Courier New",10,50,false);
font.setPointSize(10); font.setStyleHint(QFont::TypeWriter,QFont::PreferMatch);
font.setBold(false); font.setStyle(QFont::StyleNormal);
font.setStyleHint(QFont::TypeWriter, QFont::PreferDefault);
//font.setWeight(75);
userCertEdit->setFont(font); userCertEdit->setFont(font);
userCertEdit->setText(QString::fromStdString(invite));
std::cerr << "TextPage() getting Invite: " << invite << std::endl; std::cerr << "TextPage() getting Invite: " << invite << std::endl;
@ -270,6 +268,9 @@ TextPage::TextPage(QWidget *parent)
friendCertEdit = new QTextEdit; friendCertEdit = new QTextEdit;
//font.setWeight(75);
friendCertEdit->setFont(font);
//=== add all widgets to one layout //=== add all widgets to one layout
textPageLayout = new QVBoxLayout(); textPageLayout = new QVBoxLayout();
textPageLayout->addWidget(userCertLabel); textPageLayout->addWidget(userCertLabel);

View File

@ -80,6 +80,9 @@ CryptoPage::load()
void void
CryptoPage::loadPublicKey() CryptoPage::loadPublicKey()
{ {
QFont font("Courier New",9,50,false) ;
ui.certtextEdit->setFont(font) ;
ui.certtextEdit->setPlainText(QString::fromStdString(rsPeers->GetRetroshareInvite())); ui.certtextEdit->setPlainText(QString::fromStdString(rsPeers->GetRetroshareInvite()));
ui.certtextEdit->setReadOnly(true); ui.certtextEdit->setReadOnly(true);
ui.certtextEdit->setMinimumHeight(200); ui.certtextEdit->setMinimumHeight(200);

View File

@ -218,7 +218,7 @@ void xProgressBar::paint()
else else
{ {
// calculate progress value // 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; int progressWidth = rect.width() - preWidth;
if (progressWidth == rect.width() - hSpan) return; if (progressWidth == rect.width() - hSpan) return;