mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-07-28 00:45:34 -04:00
Merge branch 'master' into android
This commit is contained in:
commit
8ab3c7de26
84 changed files with 4132 additions and 1402 deletions
|
@ -1387,7 +1387,12 @@ QString TransfersDialog::getPeerName(const RsPeerId& id) const
|
|||
// connect mgr). In such a case their id can suitably hold for a name.
|
||||
//
|
||||
if(res == "")
|
||||
{
|
||||
if(rsFiles->isEncryptedSource(id))
|
||||
return tr("Anonymous end-to-end encrypted tunnel 0x")+QString::fromStdString(id.toStdString()).left(8) ;
|
||||
else
|
||||
return tr("Anonymous tunnel 0x")+QString::fromStdString(id.toStdString()).left(8) ;
|
||||
}
|
||||
else
|
||||
return res ;
|
||||
}
|
||||
|
|
|
@ -584,10 +584,13 @@ void GenCertDialog::genPerson()
|
|||
|
||||
QCoreApplication::processEvents();
|
||||
QAbstractEventDispatcher* ed = QAbstractEventDispatcher::instance();
|
||||
std::cout << "Waiting ed->processEvents()" << std::endl;
|
||||
time_t waitEnd = time(NULL) + 10;//Wait no more than 10 sec to processEvents
|
||||
if (ed->hasPendingEvents())
|
||||
while(ed->processEvents(QEventLoop::AllEvents));
|
||||
while(ed->processEvents(QEventLoop::AllEvents) && (time(NULL) < waitEnd));
|
||||
|
||||
std::string email_str = "" ;
|
||||
std::cout << "RsAccounts::GeneratePGPCertificate" << std::endl;
|
||||
RsAccounts::GeneratePGPCertificate(
|
||||
ui.name_input->text().toUtf8().constData(),
|
||||
email_str.c_str(),
|
||||
|
@ -609,6 +612,7 @@ void GenCertDialog::genPerson()
|
|||
std::cerr << "GenCertDialog::genPerson() Generating SSL cert with gpg id : " << PGPId << std::endl;
|
||||
std::string err;
|
||||
this->hide();//To show dialog asking password PGP Key.
|
||||
std::cout << "RsAccounts::GenerateSSLCertificate" << std::endl;
|
||||
bool okGen = RsAccounts::GenerateSSLCertificate(PGPId, "", genLoc, "", isHiddenLoc, sslPasswd, sslId, err);
|
||||
|
||||
if (okGen)
|
||||
|
|
|
@ -235,7 +235,7 @@ void QuickStartWizard::on_pushButtonSharesAdd_clicked()
|
|||
{
|
||||
SharedDirInfo sdi ;
|
||||
sdi.filename = dir ;
|
||||
sdi.shareflags = DIR_FLAGS_BROWSABLE_OTHERS | DIR_FLAGS_NETWORK_WIDE_OTHERS ;
|
||||
sdi.shareflags = DIR_FLAGS_BROWSABLE | DIR_FLAGS_ANONYMOUS_DOWNLOAD ;
|
||||
|
||||
rsFiles->addSharedDirectory(sdi);
|
||||
|
||||
|
@ -331,8 +331,8 @@ void QuickStartWizard::loadShare()
|
|||
QCheckBox *cb1 = new QCheckBox ;
|
||||
QCheckBox *cb2 = new QCheckBox ;
|
||||
|
||||
cb1->setChecked( (*it).shareflags & DIR_FLAGS_NETWORK_WIDE_OTHERS ) ;
|
||||
cb2->setChecked( (*it).shareflags & DIR_FLAGS_BROWSABLE_OTHERS ) ;
|
||||
cb1->setChecked( (*it).shareflags & DIR_FLAGS_ANONYMOUS_DOWNLOAD ) ;
|
||||
cb2->setChecked( (*it).shareflags & DIR_FLAGS_BROWSABLE ) ;
|
||||
|
||||
cb1->setToolTip(tr("If checked, the share is anonymously shared to anybody.")) ;
|
||||
cb2->setToolTip(tr("If checked, the share is browsable by your friends.")) ;
|
||||
|
@ -364,8 +364,8 @@ void QuickStartWizard::updateFlags(bool b)
|
|||
{
|
||||
std::cerr << "Looking for row=" << row << ", file=" << (*it).filename << ", flags=" << (*it).shareflags << std::endl ;
|
||||
FileStorageFlags current_flags(0u) ;
|
||||
current_flags |= (dynamic_cast<QCheckBox*>(ui.shareddirList->cellWidget(row,1)))->isChecked()? DIR_FLAGS_NETWORK_WIDE_OTHERS:(FileStorageFlags)0u ;
|
||||
current_flags |= (dynamic_cast<QCheckBox*>(ui.shareddirList->cellWidget(row,2)))->isChecked()? DIR_FLAGS_BROWSABLE_OTHERS :(FileStorageFlags)0u ;
|
||||
current_flags |= (dynamic_cast<QCheckBox*>(ui.shareddirList->cellWidget(row,1)))->isChecked()? DIR_FLAGS_ANONYMOUS_DOWNLOAD:(FileStorageFlags)0u ;
|
||||
current_flags |= (dynamic_cast<QCheckBox*>(ui.shareddirList->cellWidget(row,2)))->isChecked()? DIR_FLAGS_BROWSABLE :(FileStorageFlags)0u ;
|
||||
|
||||
if( ((*it).shareflags ^ current_flags).toUInt32() )
|
||||
{
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#include <gui/common/RsUrlHandler.h>
|
||||
#include <gui/common/FilesDefs.h>
|
||||
#include <gui/common/GroupDefs.h>
|
||||
#include <gui/gxs/GxsIdDetails.h>
|
||||
#include "RemoteDirModel.h"
|
||||
#include <retroshare/rsfiles.h>
|
||||
#include <retroshare/rstypes.h>
|
||||
|
@ -216,16 +217,21 @@ QString RetroshareDirModel::getFlagsString(FileStorageFlags flags)
|
|||
{
|
||||
char str[11] = "- - -" ;
|
||||
|
||||
if(flags & DIR_FLAGS_BROWSABLE_GROUPS) str[0] = 'B' ;
|
||||
//if(flags & DIR_FLAGS_NETWORK_WIDE_GROUPS) str[3] = 'N' ;
|
||||
if(flags & DIR_FLAGS_BROWSABLE_OTHERS) str[3] = 'B' ;
|
||||
if(flags & DIR_FLAGS_NETWORK_WIDE_OTHERS) str[6] = 'N' ;
|
||||
if(flags & DIR_FLAGS_BROWSABLE) str[0] = 'B' ;
|
||||
if(flags & DIR_FLAGS_ANONYMOUS_SEARCH) str[3] = 'S' ;
|
||||
if(flags & DIR_FLAGS_ANONYMOUS_DOWNLOAD) str[6] = 'N' ;
|
||||
|
||||
return QString(str) ;
|
||||
}
|
||||
QString RetroshareDirModel::getGroupsString(const std::list<RsNodeGroupId>& group_ids)
|
||||
QString RetroshareDirModel::getGroupsString(FileStorageFlags flags,const std::list<RsNodeGroupId>& group_ids)
|
||||
{
|
||||
QString groups_str ;
|
||||
if(!(flags & DIR_FLAGS_BROWSABLE))
|
||||
return QString();
|
||||
|
||||
if(group_ids.empty())
|
||||
return tr("[All friend nodes]") ;
|
||||
|
||||
QString groups_str = tr("Only ");
|
||||
RsGroupInfo group_info ;
|
||||
|
||||
for(std::list<RsNodeGroupId>::const_iterator it(group_ids.begin());it!=group_ids.end();)
|
||||
|
@ -271,8 +277,55 @@ QString RetroshareDirModel::getAgeIndicatorString(const DirDetails &details) con
|
|||
return ret;
|
||||
}
|
||||
|
||||
const QIcon& RetroshareDirModel::getFlagsIcon(FileStorageFlags flags)
|
||||
{
|
||||
static QIcon *static_icons[8] = {NULL};
|
||||
|
||||
int n=0;
|
||||
if(flags & DIR_FLAGS_ANONYMOUS_DOWNLOAD) n += 1 ;
|
||||
if(flags & DIR_FLAGS_ANONYMOUS_SEARCH ) n += 2 ;
|
||||
if(flags & DIR_FLAGS_BROWSABLE ) n += 4 ;
|
||||
n-= 1;
|
||||
|
||||
if(static_icons[n] == NULL)
|
||||
{
|
||||
QList<QIcon> icons ;
|
||||
|
||||
if(flags & DIR_FLAGS_ANONYMOUS_SEARCH)
|
||||
icons.push_back(QIcon(":icons/search_red_128.png")) ;
|
||||
else
|
||||
icons.push_back(QIcon(":icons/void_128.png")) ;
|
||||
|
||||
if(flags & DIR_FLAGS_ANONYMOUS_DOWNLOAD)
|
||||
icons.push_back(QIcon(":icons/anonymous_blue_128.png")) ;
|
||||
else
|
||||
icons.push_back(QIcon(":icons/void_128.png")) ;
|
||||
|
||||
if(flags & DIR_FLAGS_BROWSABLE)
|
||||
icons.push_back(QIcon(":icons/browsable_green_128.png")) ;
|
||||
else
|
||||
icons.push_back(QIcon(":icons/void_128.png")) ;
|
||||
|
||||
QPixmap pix ;
|
||||
GxsIdDetails::GenerateCombinedPixmap(pix, icons, 128);
|
||||
|
||||
static_icons[n] = new QIcon(pix);
|
||||
|
||||
std::cerr << "Generated icon for flags " << std::hex << flags << std::endl;
|
||||
}
|
||||
return *static_icons[n] ;
|
||||
}
|
||||
|
||||
QVariant RetroshareDirModel::decorationRole(const DirDetails& details,int coln) const
|
||||
{
|
||||
if(coln == 3)
|
||||
{
|
||||
if(details.type == DIR_TYPE_PERSON) return QVariant() ;
|
||||
|
||||
return getFlagsIcon(details.flags) ;
|
||||
}
|
||||
|
||||
|
||||
if(coln > 0)
|
||||
return QVariant() ;
|
||||
|
||||
|
@ -352,16 +405,9 @@ QVariant TreeStyle_RDM::displayRole(const DirDetails& details,int coln) const
|
|||
case 2:
|
||||
return misc::userFriendlyDuration(details.min_age);
|
||||
case 3:
|
||||
return getFlagsString(details.flags);
|
||||
// case 4:
|
||||
// {
|
||||
// QString ind("");
|
||||
// if (ageIndicator != IND_ALWAYS)
|
||||
// ind = getAgeIndicatorString(details);
|
||||
// return ind;
|
||||
// }
|
||||
return QVariant();
|
||||
case 4:
|
||||
return getGroupsString(details.parent_groups) ;
|
||||
return getGroupsString(details.flags,details.parent_groups) ;
|
||||
|
||||
default:
|
||||
return tr("FILE");
|
||||
|
@ -383,9 +429,9 @@ QVariant TreeStyle_RDM::displayRole(const DirDetails& details,int coln) const
|
|||
case 2:
|
||||
return misc::userFriendlyDuration(details.min_age);
|
||||
case 3:
|
||||
return getFlagsString(details.flags);
|
||||
return QVariant();
|
||||
case 4:
|
||||
return getGroupsString(details.parent_groups) ;
|
||||
return getGroupsString(details.flags,details.parent_groups) ;
|
||||
|
||||
default:
|
||||
return tr("DIR");
|
||||
|
@ -663,12 +709,12 @@ QVariant TreeStyle_RDM::headerData(int section, Qt::Orientation orientation, int
|
|||
if (RemoteMode)
|
||||
return tr("Friend");
|
||||
else
|
||||
return tr("Share Flags");
|
||||
return tr("Access");
|
||||
case 4:
|
||||
if (RemoteMode)
|
||||
return tr("What's new");
|
||||
else
|
||||
return tr("Groups");
|
||||
return tr("Visibility");
|
||||
}
|
||||
return QString("Column %1").arg(section);
|
||||
}
|
||||
|
|
|
@ -94,9 +94,10 @@ class RetroshareDirModel : public QAbstractItemModel
|
|||
void treeStyle();
|
||||
void downloadDirectory(const DirDetails & details, int prefixLen);
|
||||
static QString getFlagsString(FileStorageFlags f) ;
|
||||
static QString getGroupsString(const std::list<RsNodeGroupId> &) ;
|
||||
static QString getGroupsString(FileStorageFlags flags, const std::list<RsNodeGroupId> &) ;
|
||||
QString getAgeIndicatorString(const DirDetails &) const;
|
||||
// void getAgeIndicatorRec(const DirDetails &details, QString &ret) const;
|
||||
static const QIcon& getFlagsIcon(FileStorageFlags flags) ;
|
||||
|
||||
virtual QVariant displayRole(const DirDetails&,int) const = 0 ;
|
||||
virtual QVariant sortRole(const QModelIndex&,const DirDetails&,int) const =0;
|
||||
|
|
|
@ -1587,46 +1587,8 @@ void RSLinkClipboard::parseClipboard(QList<RetroShareLink> &links)
|
|||
{
|
||||
// parse clipboard for links.
|
||||
//
|
||||
links.clear();
|
||||
QString text = QApplication::clipboard()->text() ;
|
||||
|
||||
std::cerr << "Parsing clipboard:" << text.toStdString() << std::endl ;
|
||||
|
||||
QRegExp rx(QString("retroshare://(%1)[^\r\n]+").arg(HOST_REGEXP));
|
||||
|
||||
int pos = 0;
|
||||
|
||||
while((pos = rx.indexIn(text, pos)) != -1)
|
||||
{
|
||||
QString url(text.mid(pos, rx.matchedLength()));
|
||||
RetroShareLink link(url);
|
||||
|
||||
if(link.valid())
|
||||
{
|
||||
// check that the link is not already in the list:
|
||||
bool already = false ;
|
||||
for (int i = 0; i <links.size(); ++i)
|
||||
if(links[i] == link)
|
||||
{
|
||||
already = true ;
|
||||
break ;
|
||||
}
|
||||
|
||||
if(!already)
|
||||
{
|
||||
links.push_back(link) ;
|
||||
#ifdef DEBUG_RSLINK
|
||||
std::cerr << "captured link: " << link.toString().toStdString() << std::endl ;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
#ifdef DEBUG_RSLINK
|
||||
else
|
||||
std::cerr << "invalid link" << std::endl ;
|
||||
#endif
|
||||
|
||||
pos += rx.matchedLength();
|
||||
}
|
||||
parseText(text, links);
|
||||
}
|
||||
|
||||
QString RSLinkClipboard::toString()
|
||||
|
@ -1690,3 +1652,46 @@ bool RSLinkClipboard::empty(RetroShareLink::enumType type /* = RetroShareLink::T
|
|||
return RetroShareLink::process(linksToProcess, flag);
|
||||
}
|
||||
|
||||
void RSLinkClipboard::parseText(QString text, QList<RetroShareLink> &links)
|
||||
{
|
||||
links.clear();
|
||||
|
||||
std::cerr << "Parsing text:" << text.toStdString() << std::endl ;
|
||||
|
||||
QRegExp rx(QString("retroshare://(%1)[^\r\n]+").arg(HOST_REGEXP));
|
||||
|
||||
int pos = 0;
|
||||
|
||||
while((pos = rx.indexIn(text, pos)) != -1)
|
||||
{
|
||||
QString url(text.mid(pos, rx.matchedLength()));
|
||||
RetroShareLink link(url);
|
||||
|
||||
if(link.valid())
|
||||
{
|
||||
// check that the link is not already in the list:
|
||||
bool already = false ;
|
||||
for (int i = 0; i <links.size(); ++i)
|
||||
if(links[i] == link)
|
||||
{
|
||||
already = true ;
|
||||
break ;
|
||||
}
|
||||
|
||||
if(!already)
|
||||
{
|
||||
links.push_back(link) ;
|
||||
#ifdef DEBUG_RSLINK
|
||||
std::cerr << "captured link: " << link.toString().toStdString() << std::endl ;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
#ifdef DEBUG_RSLINK
|
||||
else
|
||||
std::cerr << "invalid link" << std::endl ;
|
||||
#endif
|
||||
|
||||
pos += rx.matchedLength();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -208,6 +208,8 @@ class RSLinkClipboard
|
|||
//
|
||||
static int process(RetroShareLink::enumType type = RetroShareLink::TYPE_UNKNOWN, uint flag = RSLINK_PROCESS_NOTIFY_ALL);
|
||||
|
||||
static void parseText(QString text, QList<RetroShareLink> &links) ;
|
||||
|
||||
private:
|
||||
static void parseClipboard(QList<RetroShareLink> &links) ;
|
||||
};
|
||||
|
|
|
@ -57,7 +57,7 @@ ShareDialog::ShareDialog(std::string filename, QWidget *parent)
|
|||
hb2->addWidget(new QLabel(tr("Share flags and groups:")+" ")) ;
|
||||
|
||||
groupflagsbox = new GroupFlagsWidget(ui.shareflags_GB) ;
|
||||
groupflagsbox->setFlags(DIR_FLAGS_NETWORK_WIDE_OTHERS) ; // default value
|
||||
groupflagsbox->setFlags(DIR_FLAGS_ANONYMOUS_DOWNLOAD) ; // default value
|
||||
|
||||
messageBox = new QTextEdit(ui.shareflags_GB) ;
|
||||
messageBox->setReadOnly(true) ;
|
||||
|
|
|
@ -34,7 +34,8 @@
|
|||
#include "ShareManager.h"
|
||||
#include "ShareDialog.h"
|
||||
#include "settings/rsharesettings.h"
|
||||
#include <gui/common/GroupFlagsWidget.h>
|
||||
#include "gui/common/GroupFlagsWidget.h"
|
||||
#include "gui/common/GroupSelectionBox.h"
|
||||
#include "gui/common/GroupDefs.h"
|
||||
#include "gui/notifyqt.h"
|
||||
#include "util/QtVersion.h"
|
||||
|
@ -61,33 +62,83 @@ ShareManager::ShareManager()
|
|||
ui.headerFrame->setHeaderText(tr("Share Manager"));
|
||||
|
||||
isLoading = false;
|
||||
load();
|
||||
|
||||
Settings->loadWidgetInformation(this);
|
||||
|
||||
connect(ui.addButton, SIGNAL(clicked( bool ) ), this , SLOT( showShareDialog() ) );
|
||||
connect(ui.editButton, SIGNAL(clicked( bool ) ), this , SLOT( editShareDirectory() ) );
|
||||
connect(ui.removeButton, SIGNAL(clicked( bool ) ), this , SLOT( removeShareDirectory() ) );
|
||||
connect(ui.addButton, SIGNAL(clicked( bool ) ), this , SLOT( addShare() ) );
|
||||
connect(ui.closeButton, SIGNAL(clicked()), this, SLOT(applyAndClose()));
|
||||
connect(ui.cancelButton, SIGNAL(clicked()), this, SLOT(cancel()));
|
||||
|
||||
connect(ui.shareddirList, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(shareddirListCostumPopupMenu(QPoint)));
|
||||
connect(ui.shareddirList, SIGNAL(currentCellChanged(int,int,int,int)), this, SLOT(shareddirListCurrentCellChanged(int,int,int,int)));
|
||||
connect(ui.shareddirList, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(shareddirListCustomPopupMenu(QPoint)));
|
||||
connect(ui.shareddirList, SIGNAL(cellDoubleClicked(int,int)), this, SLOT(doubleClickedCell(int,int)));
|
||||
connect(ui.shareddirList, SIGNAL(cellChanged(int,int)), this, SLOT(handleCellChange(int,int)));
|
||||
|
||||
connect(NotifyQt::getInstance(), SIGNAL(groupsChanged(int)), this, SLOT(updateGroups()));
|
||||
|
||||
ui.editButton->setEnabled(false);
|
||||
ui.removeButton->setEnabled(false);
|
||||
connect(NotifyQt::getInstance(), SIGNAL(groupsChanged(int)), this, SLOT(reload()));
|
||||
|
||||
QHeaderView* header = ui.shareddirList->horizontalHeader();
|
||||
QHeaderView_setSectionResizeModeColumn(header, COLUMN_PATH, QHeaderView::Stretch);
|
||||
|
||||
//header->setResizeMode(COLUMN_NETWORKWIDE, QHeaderView::Fixed);
|
||||
//header->setResizeMode(COLUMN_BROWSABLE, QHeaderView::Fixed);
|
||||
|
||||
header->setHighlightSections(false);
|
||||
|
||||
setAcceptDrops(true);
|
||||
setAttribute(Qt::WA_DeleteOnClose, true);
|
||||
|
||||
reload();
|
||||
}
|
||||
|
||||
void ShareManager::handleCellChange(int row,int column)
|
||||
{
|
||||
if(isLoading)
|
||||
return ;
|
||||
|
||||
if(column == COLUMN_VIRTUALNAME)
|
||||
{
|
||||
// check if the thing already exists
|
||||
|
||||
for(uint32_t i=0;i<mDirInfos.size();++i)
|
||||
if(i != (uint32_t)row && (mDirInfos[row].virtualname == std::string(ui.shareddirList->item(i,COLUMN_VIRTUALNAME)->text().toUtf8())))
|
||||
{
|
||||
ui.shareddirList->item(row,COLUMN_VIRTUALNAME)->setText(QString::fromUtf8(mDirInfos[row].virtualname.c_str())) ;
|
||||
return ;
|
||||
}
|
||||
|
||||
mDirInfos[row].virtualname = std::string(ui.shareddirList->item(row,COLUMN_VIRTUALNAME)->text().toUtf8()) ;
|
||||
}
|
||||
}
|
||||
|
||||
void ShareManager::editShareDirectory()
|
||||
{
|
||||
QTableWidget *listWidget = ui.shareddirList;
|
||||
int row = listWidget -> currentRow();
|
||||
|
||||
doubleClickedCell(row,COLUMN_PATH) ;
|
||||
}
|
||||
|
||||
void ShareManager::doubleClickedCell(int row,int column)
|
||||
{
|
||||
if(column == COLUMN_PATH)
|
||||
{
|
||||
QString dirname = QFileDialog::getExistingDirectory(NULL,tr("Choose directory"),QString(),QFileDialog::DontUseNativeDialog | QFileDialog::ShowDirsOnly);
|
||||
|
||||
if(!dirname.isNull())
|
||||
{
|
||||
std::string new_name( dirname.toUtf8() );
|
||||
|
||||
for(uint32_t i=0;i<mDirInfos.size();++i)
|
||||
if(mDirInfos[row].filename == new_name)
|
||||
return ;
|
||||
|
||||
mDirInfos[row].filename = new_name ;
|
||||
load();
|
||||
}
|
||||
}
|
||||
else if(column == COLUMN_GROUPS)
|
||||
{
|
||||
std::list<RsNodeGroupId> selected_groups = GroupSelectionDialog::selectGroups(mDirInfos[row].parent_groups) ;
|
||||
|
||||
mDirInfos[row].parent_groups = selected_groups ;
|
||||
load();
|
||||
}
|
||||
}
|
||||
|
||||
ShareManager::~ShareManager()
|
||||
|
@ -97,15 +148,25 @@ ShareManager::~ShareManager()
|
|||
Settings->saveWidgetInformation(this);
|
||||
}
|
||||
|
||||
void ShareManager::cancel()
|
||||
{
|
||||
close();
|
||||
}
|
||||
void ShareManager::applyAndClose()
|
||||
{
|
||||
// std::cerr << "ShareManager:::close(): updating!" << std::endl;
|
||||
// This is the only place where we change things.
|
||||
|
||||
std::list<SharedDirInfo> infos ;
|
||||
|
||||
for(uint32_t i=0;i<mDirInfos.size();++i)
|
||||
infos.push_back(mDirInfos[i]) ;
|
||||
|
||||
rsFiles->setSharedDirectories(infos) ;
|
||||
|
||||
updateFlags() ;
|
||||
close() ;
|
||||
}
|
||||
|
||||
void ShareManager::shareddirListCostumPopupMenu( QPoint /*point*/ )
|
||||
void ShareManager::shareddirListCustomPopupMenu( QPoint /*point*/ )
|
||||
{
|
||||
QMenu contextMnu( this );
|
||||
|
||||
|
@ -121,6 +182,19 @@ void ShareManager::shareddirListCostumPopupMenu( QPoint /*point*/ )
|
|||
contextMnu.exec(QCursor::pos());
|
||||
}
|
||||
|
||||
void ShareManager::reload()
|
||||
{
|
||||
std::list<SharedDirInfo> dirs ;
|
||||
rsFiles->getSharedDirectories(dirs) ;
|
||||
|
||||
mDirInfos.clear();
|
||||
|
||||
for(std::list<SharedDirInfo>::const_iterator it(dirs.begin());it!=dirs.end();++it)
|
||||
mDirInfos.push_back(*it) ;
|
||||
|
||||
load();
|
||||
}
|
||||
|
||||
/** Loads the settings for this page */
|
||||
void ShareManager::load()
|
||||
{
|
||||
|
@ -128,44 +202,46 @@ void ShareManager::load()
|
|||
return ;
|
||||
|
||||
isLoading = true;
|
||||
// std::cerr << "ShareManager:: In load !!!!!" << std::endl ;
|
||||
|
||||
std::list<SharedDirInfo>::const_iterator it;
|
||||
std::list<SharedDirInfo> dirs;
|
||||
rsFiles->getSharedDirectories(dirs);
|
||||
|
||||
/* get a link to the table */
|
||||
QTableWidget *listWidget = ui.shareddirList;
|
||||
|
||||
/* set new row count */
|
||||
listWidget->setRowCount(dirs.size());
|
||||
listWidget->setRowCount(mDirInfos.size());
|
||||
|
||||
int row=0 ;
|
||||
for(it = dirs.begin(); it != dirs.end(); ++it,++row)
|
||||
for(uint32_t row=0;row<mDirInfos.size();++row)
|
||||
{
|
||||
listWidget->setItem(row, COLUMN_PATH, new QTableWidgetItem(QString::fromUtf8((*it).filename.c_str())));
|
||||
listWidget->setItem(row, COLUMN_VIRTUALNAME, new QTableWidgetItem(QString::fromUtf8((*it).virtualname.c_str())));
|
||||
listWidget->setItem(row, COLUMN_PATH, new QTableWidgetItem(QString::fromUtf8(mDirInfos[row].filename.c_str())));
|
||||
listWidget->setItem(row, COLUMN_VIRTUALNAME, new QTableWidgetItem(QString::fromUtf8(mDirInfos[row].virtualname.c_str())));
|
||||
|
||||
GroupFlagsWidget *widget = new GroupFlagsWidget(NULL,(*it).shareflags);
|
||||
GroupFlagsWidget *widget = new GroupFlagsWidget(NULL,mDirInfos[row].shareflags);
|
||||
|
||||
listWidget->setRowHeight(row, 32 * QFontMetricsF(font()).height()/14.0);
|
||||
listWidget->setCellWidget(row, COLUMN_SHARE_FLAGS, widget);
|
||||
listWidget->setRowHeight(row, 32 * QFontMetricsF(font()).height()/14.0);
|
||||
listWidget->setCellWidget(row, COLUMN_SHARE_FLAGS, widget);
|
||||
|
||||
listWidget->setItem(row, COLUMN_GROUPS, new QTableWidgetItem()) ;
|
||||
listWidget->item(row,COLUMN_GROUPS)->setBackgroundColor(QColor(183,236,181)) ;
|
||||
listWidget->setItem(row, COLUMN_GROUPS, new QTableWidgetItem()) ;
|
||||
listWidget->item(row,COLUMN_GROUPS)->setBackgroundColor(QColor(183,236,181)) ;
|
||||
|
||||
//connect(widget,SIGNAL(flagsChanged(FileStorageFlags)),this,SLOT(updateFlags())) ;
|
||||
connect(widget,SIGNAL(flagsChanged(FileStorageFlags)),this,SLOT(updateFlags())) ;
|
||||
|
||||
listWidget->item(row,COLUMN_PATH)->setToolTip(tr("Double click to change shared directory path")) ;
|
||||
listWidget->item(row,COLUMN_GROUPS)->setToolTip(tr("Double click to select which groups of friends can see the files")) ;
|
||||
listWidget->item(row,COLUMN_VIRTUALNAME)->setToolTip(tr("Double click to change the name that friends will see")) ;
|
||||
|
||||
listWidget->item(row,COLUMN_GROUPS)->setText(getGroupString(mDirInfos[row].parent_groups));
|
||||
|
||||
QFont font = listWidget->item(row,COLUMN_GROUPS)->font();
|
||||
font.setBold(mDirInfos[row].shareflags & DIR_FLAGS_BROWSABLE) ;
|
||||
listWidget->item(row,COLUMN_GROUPS)->setTextColor( (mDirInfos[row].shareflags & DIR_FLAGS_BROWSABLE)? (Qt::black):(Qt::lightGray)) ;
|
||||
listWidget->item(row,COLUMN_GROUPS)->setFont(font);
|
||||
}
|
||||
|
||||
listWidget->setColumnWidth(COLUMN_SHARE_FLAGS,132 * QFontMetricsF(font()).height()/14.0) ;
|
||||
|
||||
//ui.incomingDir->setText(QString::fromStdString(rsFiles->getDownloadDirectory()));
|
||||
listWidget->setColumnWidth(COLUMN_SHARE_FLAGS,132 * QFontMetricsF(font()).height()/14.0) ;
|
||||
|
||||
listWidget->update(); /* update display */
|
||||
update();
|
||||
|
||||
isLoading = false ;
|
||||
updateGroups();
|
||||
}
|
||||
|
||||
void ShareManager::showYourself()
|
||||
|
@ -173,6 +249,7 @@ void ShareManager::showYourself()
|
|||
if(_instance == NULL)
|
||||
_instance = new ShareManager() ;
|
||||
|
||||
_instance->reload() ;
|
||||
_instance->show() ;
|
||||
_instance->activateWindow();
|
||||
}
|
||||
|
@ -184,109 +261,39 @@ void ShareManager::showYourself()
|
|||
}
|
||||
|
||||
if (update_local) {
|
||||
_instance->load();
|
||||
_instance->reload();
|
||||
}
|
||||
}
|
||||
|
||||
void ShareManager::updateFlags()
|
||||
{
|
||||
if(isLoading)
|
||||
return ;
|
||||
|
||||
isLoading = true ; // stops GUI update. Otherwise each call to rsFiles->updateShareFlags() modifies the GUI that we count on to check
|
||||
// what has changed => fail!
|
||||
|
||||
// std::cerr << "Updating flags" << std::endl;
|
||||
|
||||
std::list<SharedDirInfo>::iterator it;
|
||||
std::list<SharedDirInfo> dirs;
|
||||
rsFiles->getSharedDirectories(dirs);
|
||||
|
||||
std::map<QString, FileStorageFlags> mapped_flags ;
|
||||
|
||||
for(int row=0;row<ui.shareddirList->rowCount();++row)
|
||||
{
|
||||
QString dirpath = ui.shareddirList->item(row,COLUMN_PATH)->text() ;
|
||||
FileStorageFlags flags = (dynamic_cast<GroupFlagsWidget*>(ui.shareddirList->cellWidget(row,COLUMN_SHARE_FLAGS)))->flags() ;
|
||||
|
||||
mapped_flags[dirpath] = flags ;
|
||||
|
||||
// std::cerr << "Getting new flags " << flags << " for path " << dirpath.toStdString() << std::endl;
|
||||
}
|
||||
|
||||
for(std::list<SharedDirInfo>::iterator it(dirs.begin());it!=dirs.end();++it)
|
||||
{
|
||||
FileStorageFlags newf = mapped_flags[QString::fromUtf8((*it).filename.c_str())] ;
|
||||
|
||||
if( (*it).shareflags != newf )
|
||||
{
|
||||
(*it).shareflags = newf ;
|
||||
rsFiles->updateShareFlags(*it) ; // modifies the flags
|
||||
|
||||
// std::cerr << "Updating flags to " << newf << " for dir " << (*it).filename << std::endl ;
|
||||
}
|
||||
}
|
||||
|
||||
isLoading = false ; // re-enable GUI load
|
||||
load() ; // update the GUI.
|
||||
}
|
||||
|
||||
void ShareManager::updateGroups()
|
||||
{
|
||||
if(isLoading)
|
||||
return ;
|
||||
|
||||
// std::cerr << "Updating groups" << std::endl;
|
||||
|
||||
std::list<SharedDirInfo>::iterator it;
|
||||
std::list<SharedDirInfo> dirs;
|
||||
rsFiles->getSharedDirectories(dirs);
|
||||
|
||||
int row=0 ;
|
||||
for(it = dirs.begin(); it != dirs.end(); ++it,++row)
|
||||
for(int row=0;row<ui.shareddirList->rowCount();++row)
|
||||
{
|
||||
QTableWidgetItem *item = ui.shareddirList->item(row, COLUMN_GROUPS);
|
||||
|
||||
QString group_string;
|
||||
int n = 0;
|
||||
for (std::list<RsNodeGroupId>::const_iterator it2((*it).parent_groups.begin());it2!=(*it).parent_groups.end();++it2,++n)
|
||||
{
|
||||
if (n>0)
|
||||
group_string += ", " ;
|
||||
|
||||
RsGroupInfo groupInfo;
|
||||
rsPeers->getGroupInfo(*it2, groupInfo);
|
||||
group_string += GroupDefs::name(groupInfo);
|
||||
}
|
||||
|
||||
item->setText(group_string);
|
||||
FileStorageFlags flags = (dynamic_cast<GroupFlagsWidget*>(ui.shareddirList->cellWidget(row,COLUMN_SHARE_FLAGS)))->flags() ;
|
||||
mDirInfos[row].shareflags = flags ;
|
||||
}
|
||||
load() ; // update the GUI.
|
||||
}
|
||||
|
||||
void ShareManager::editShareDirectory()
|
||||
QString ShareManager::getGroupString(const std::list<RsNodeGroupId>& groups)
|
||||
{
|
||||
/* id current dir */
|
||||
int row = ui.shareddirList->currentRow();
|
||||
QTableWidgetItem *item = ui.shareddirList->item(row, COLUMN_PATH);
|
||||
if(groups.empty())
|
||||
return tr("[All friend nodes]") ;
|
||||
|
||||
if (item) {
|
||||
std::string filename = item->text().toUtf8().constData();
|
||||
int n = 0;
|
||||
QString group_string ;
|
||||
|
||||
std::list<SharedDirInfo> dirs;
|
||||
rsFiles->getSharedDirectories(dirs);
|
||||
for (std::list<RsNodeGroupId>::const_iterator it(groups.begin());it!=groups.end();++it,++n)
|
||||
{
|
||||
if (n>0)
|
||||
group_string += ", " ;
|
||||
|
||||
std::list<SharedDirInfo>::const_iterator it;
|
||||
for (it = dirs.begin(); it != dirs.end(); ++it) {
|
||||
if (it->filename == filename) {
|
||||
/* file name found, show dialog */
|
||||
ShareDialog sharedlg (it->filename, this);
|
||||
sharedlg.setWindowTitle(tr("Edit Shared Folder"));
|
||||
sharedlg.exec();
|
||||
load();
|
||||
break;
|
||||
}
|
||||
}
|
||||
RsGroupInfo groupInfo;
|
||||
rsPeers->getGroupInfo(*it, groupInfo);
|
||||
group_string += GroupDefs::name(groupInfo);
|
||||
}
|
||||
|
||||
return group_string ;
|
||||
}
|
||||
|
||||
void ShareManager::removeShareDirectory()
|
||||
|
@ -301,7 +308,10 @@ void ShareManager::removeShareDirectory()
|
|||
{
|
||||
if ((QMessageBox::question(this, tr("Warning!"),tr("Do you really want to stop sharing this directory ?"),QMessageBox::Yes|QMessageBox::No, QMessageBox::Yes))== QMessageBox::Yes)
|
||||
{
|
||||
rsFiles->removeSharedDirectory( qdir->text().toUtf8().constData());
|
||||
for(uint32_t i=row;i+1<mDirInfos.size();++i)
|
||||
mDirInfos[i] = mDirInfos[i+1] ;
|
||||
|
||||
mDirInfos.pop_back() ;
|
||||
load();
|
||||
}
|
||||
}
|
||||
|
@ -315,6 +325,30 @@ void ShareManager::showEvent(QShowEvent *event)
|
|||
}
|
||||
}
|
||||
|
||||
void ShareManager::addShare()
|
||||
{
|
||||
QString fname = QFileDialog::getExistingDirectory(NULL,tr("Choose a directory to share"),QString(),QFileDialog::DontUseNativeDialog | QFileDialog::ShowDirsOnly);
|
||||
|
||||
if(fname.isNull())
|
||||
return;
|
||||
|
||||
std::string dir_name ( fname.toUtf8() );
|
||||
|
||||
// check that the directory does not already exist
|
||||
|
||||
for(uint32_t i=0;i<mDirInfos.size();++i)
|
||||
if(mDirInfos[i].filename == dir_name)
|
||||
return ;
|
||||
|
||||
mDirInfos.push_back(SharedDirInfo());
|
||||
mDirInfos.back().filename = dir_name ;
|
||||
mDirInfos.back().virtualname = std::string();
|
||||
mDirInfos.back().shareflags = DIR_FLAGS_ANONYMOUS_DOWNLOAD | DIR_FLAGS_ANONYMOUS_SEARCH;
|
||||
mDirInfos.back().parent_groups.clear();
|
||||
|
||||
load();
|
||||
}
|
||||
|
||||
void ShareManager::showShareDialog()
|
||||
{
|
||||
ShareDialog sharedlg ("", this);
|
||||
|
@ -327,14 +361,6 @@ void ShareManager::shareddirListCurrentCellChanged(int currentRow, int currentCo
|
|||
Q_UNUSED(currentColumn);
|
||||
Q_UNUSED(previousRow);
|
||||
Q_UNUSED(previousColumn);
|
||||
|
||||
if (currentRow >= 0) {
|
||||
ui.editButton->setEnabled(true);
|
||||
ui.removeButton->setEnabled(true);
|
||||
} else {
|
||||
ui.editButton->setEnabled(false);
|
||||
ui.removeButton->setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
void ShareManager::dragEnterEvent(QDragEnterEvent *event)
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include <QDialog>
|
||||
#include <QFileDialog>
|
||||
|
||||
#include <retroshare/rsfiles.h>
|
||||
#include "ui_ShareManager.h"
|
||||
|
||||
class ShareManager : public QDialog
|
||||
|
@ -54,15 +55,20 @@ protected:
|
|||
private slots:
|
||||
/** Create the context popup menu and it's submenus */
|
||||
void shareddirListCurrentCellChanged(int currentRow, int currentColumn, int previousRow, int previousColumn);
|
||||
void shareddirListCostumPopupMenu( QPoint point );
|
||||
void shareddirListCustomPopupMenu( QPoint point );
|
||||
void addShare();
|
||||
void doubleClickedCell(int,int);
|
||||
void handleCellChange(int row,int column);
|
||||
void editShareDirectory();
|
||||
|
||||
void showShareDialog();
|
||||
void editShareDirectory();
|
||||
void removeShareDirectory();
|
||||
void updateFlags();
|
||||
void updateGroups();
|
||||
void applyAndClose() ;
|
||||
void applyAndClose() ;
|
||||
void cancel() ;
|
||||
void reload() ;
|
||||
|
||||
static QString getGroupString(const std::list<RsNodeGroupId>& groups);
|
||||
private:
|
||||
static ShareManager *_instance;
|
||||
bool isLoading;
|
||||
|
@ -72,6 +78,8 @@ private:
|
|||
|
||||
/** Qt Designer generated object */
|
||||
Ui::ShareManager ui;
|
||||
|
||||
std::vector<SharedDirInfo> mDirInfos ;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>741</width>
|
||||
<width>1210</width>
|
||||
<height>334</height>
|
||||
</rect>
|
||||
</property>
|
||||
|
@ -18,7 +18,16 @@
|
|||
<normaloff>:/images/logo/logo_16.png</normaloff>:/images/logo/logo_16.png</iconset>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<property name="margin">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
|
@ -49,7 +58,7 @@
|
|||
<property name="topMargin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item row="1" column="0" colspan="6">
|
||||
<item row="1" column="0" colspan="4">
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
<string>Shared Folder Manager</string>
|
||||
|
@ -64,7 +73,7 @@
|
|||
<enum>Qt::CustomContextMenu</enum>
|
||||
</property>
|
||||
<property name="editTriggers">
|
||||
<set>QAbstractItemView::NoEditTriggers</set>
|
||||
<set>QAbstractItemView::DoubleClicked</set>
|
||||
</property>
|
||||
<property name="alternatingRowColors">
|
||||
<bool>true</bool>
|
||||
|
@ -92,17 +101,17 @@
|
|||
</attribute>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Directory</string>
|
||||
<string>Shared directory</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Virtual Folder</string>
|
||||
<string>Visible name</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Share flags</string>
|
||||
<string>Access</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string comment="If activated, the share is anonymously accessible to anybody"/>
|
||||
|
@ -110,7 +119,7 @@
|
|||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Groups</string>
|
||||
<string>Visibility</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string comment="If checked, the share is browsable by your friends"/>
|
||||
|
@ -139,7 +148,7 @@
|
|||
<string>Add a Share Directory</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Add</string>
|
||||
<string>Add new</string>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
|
@ -149,35 +158,7 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<widget class="QPushButton" name="removeButton">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>200</width>
|
||||
<height>200</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Stop sharing selected Directory</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Remove</string>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>16</width>
|
||||
<height>16</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="3">
|
||||
<item row="2" column="1">
|
||||
<spacer>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
|
@ -190,24 +171,14 @@
|
|||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="2" column="4">
|
||||
<item row="2" column="2">
|
||||
<widget class="QPushButton" name="closeButton">
|
||||
<property name="text">
|
||||
<string>Apply and close</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QPushButton" name="editButton">
|
||||
<property name="toolTip">
|
||||
<string>Edit selected Shared Directory</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Edit</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" colspan="5">
|
||||
<item row="0" column="0" colspan="3">
|
||||
<widget class="StyledLabel" name="labelInstructions">
|
||||
<property name="palette">
|
||||
<palette>
|
||||
|
@ -290,6 +261,13 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="3">
|
||||
<widget class="QPushButton" name="cancelButton">
|
||||
<property name="text">
|
||||
<string>Cancel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
|
|
|
@ -25,8 +25,10 @@
|
|||
#include <QTreeView>
|
||||
#include <QClipboard>
|
||||
#include <QMenu>
|
||||
#include <QPainter>
|
||||
#include <QProcess>
|
||||
#include <QSortFilterProxyModel>
|
||||
#include <QStyledItemDelegate>
|
||||
|
||||
#include "SharedFilesDialog.h"
|
||||
#include "settings/AddFileAssociationDialog.h"
|
||||
|
@ -114,6 +116,36 @@ private:
|
|||
RetroshareDirModel *m_dirModel;
|
||||
};
|
||||
|
||||
// This class allows to draw the item in the share flags column using an appropriate size
|
||||
|
||||
class ShareFlagsItemDelegate: public QStyledItemDelegate
|
||||
{
|
||||
public:
|
||||
ShareFlagsItemDelegate() {}
|
||||
|
||||
virtual void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
|
||||
{
|
||||
Q_ASSERT(index.isValid());
|
||||
|
||||
QStyleOptionViewItemV4 opt = option;
|
||||
initStyleOption(&opt, index);
|
||||
// disable default icon
|
||||
opt.icon = QIcon();
|
||||
// draw default item
|
||||
QApplication::style()->drawControl(QStyle::CE_ItemViewItem, &opt, painter, 0);
|
||||
|
||||
const QRect r = option.rect;
|
||||
|
||||
// get pixmap
|
||||
QIcon icon = qvariant_cast<QIcon>(index.data(Qt::DecorationRole));
|
||||
QPixmap pix = icon.pixmap(r.size());
|
||||
|
||||
// draw pixmap at center of item
|
||||
const QPoint p = QPoint((r.width() - pix.width())/2, (r.height() - pix.height())/2);
|
||||
painter->drawPixmap(r.topLeft() + p, pix);
|
||||
}
|
||||
};
|
||||
|
||||
/** Constructor */
|
||||
SharedFilesDialog::SharedFilesDialog(RetroshareDirModel *_tree_model,RetroshareDirModel *_flat_model,QWidget *parent)
|
||||
: RsAutoUpdatePage(1000,parent),model(NULL)
|
||||
|
@ -220,7 +252,9 @@ LocalSharedFilesDialog::LocalSharedFilesDialog(QWidget *parent)
|
|||
editshareAct = new QAction(QIcon(IMAGE_EDITSHARE), tr("Edit Share Permissions"), this) ;
|
||||
connect(editshareAct, SIGNAL(triggered()), this, SLOT(editSharePermissions())) ;
|
||||
|
||||
ui.titleBarPixmap->setPixmap(QPixmap(IMAGE_MYFILES)) ;
|
||||
ui.titleBarPixmap->setPixmap(QPixmap(IMAGE_MYFILES)) ;
|
||||
|
||||
ui.dirTreeView->setItemDelegateForColumn(COLUMN_FRIEND,new ShareFlagsItemDelegate()) ;
|
||||
}
|
||||
|
||||
RemoteSharedFilesDialog::RemoteSharedFilesDialog(QWidget *parent)
|
||||
|
@ -232,6 +266,7 @@ RemoteSharedFilesDialog::RemoteSharedFilesDialog(QWidget *parent)
|
|||
|
||||
connect(ui.downloadButton, SIGNAL(clicked()), this, SLOT(downloadRemoteSelected()));
|
||||
connect(ui.dirTreeView, SIGNAL( expanded(const QModelIndex & ) ), this, SLOT( expanded(const QModelIndex & ) ) );
|
||||
connect(ui.dirTreeView, SIGNAL( doubleClicked(const QModelIndex & ) ), this, SLOT( expanded(const QModelIndex & ) ) );
|
||||
|
||||
// load settings
|
||||
processSettings(true);
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>737</width>
|
||||
<width>1156</width>
|
||||
<height>402</height>
|
||||
</rect>
|
||||
</property>
|
||||
|
@ -86,7 +86,7 @@
|
|||
<item>
|
||||
<widget class="QPushButton" name="addShares_PB">
|
||||
<property name="text">
|
||||
<string>Add Share</string>
|
||||
<string>Configure shared directories</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="images.qrc">
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
#include "util/HandleRichText.h"
|
||||
|
||||
static QHash<QString, QString> Smileys;
|
||||
static QVector<QString> order;
|
||||
|
||||
void Emoticons::load()
|
||||
{
|
||||
|
@ -115,6 +116,7 @@ void Emoticons::load()
|
|||
} else {
|
||||
Smileys.insert(smcode, smfile);
|
||||
}
|
||||
order.append(smcode);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -174,15 +176,15 @@ void Emoticons::showSmileyWidget(QWidget *parent, QWidget *button, const char *s
|
|||
x = 0;
|
||||
y = 0;
|
||||
|
||||
QHashIterator<QString, QString> i(Smileys);
|
||||
QVectorIterator<QString> i(order);
|
||||
while(i.hasNext())
|
||||
{
|
||||
i.next();
|
||||
QString key = i.next();
|
||||
QPushButton *smButton = new QPushButton("", smWidget);
|
||||
smButton->setGeometry(x*buttonWidth, y*buttonHeight, buttonWidth, buttonHeight);
|
||||
smButton->setIconSize(QSize(buttonWidth, buttonHeight));
|
||||
smButton->setIcon(QPixmap(i.value()));
|
||||
smButton->setToolTip(i.key());
|
||||
smButton->setIcon(QPixmap(Smileys.value(key)));
|
||||
smButton->setToolTip(key);
|
||||
smButton->setStyleSheet("QPushButton:hover {border: 3px solid white; border-radius: 2px;}");
|
||||
smButton->setFlat(true);
|
||||
++x;
|
||||
|
|
|
@ -3,31 +3,26 @@
|
|||
#include "GroupFlagsWidget.h"
|
||||
#include <retroshare/rsfiles.h>
|
||||
|
||||
#define FLAGS_GROUP_NETWORK_WIDE_ICON ":images/anonymous_128_green.png"
|
||||
#define FLAGS_GROUP_BROWSABLE_ICON ":images/browsable_128_green.png"
|
||||
#define FLAGS_GROUP_UNCHECKED ":images/blank_128_green.png"
|
||||
#define FLAGS_OTHER_NETWORK_WIDE_ICON ":images/anonymous_128_blue.png"
|
||||
#define FLAGS_OTHER_BROWSABLE_ICON ":images/browsable_128_blue.png"
|
||||
#define FLAGS_OTHER_UNCHECKED ":images/blank_128_blue.png"
|
||||
#define FLAGS_ANONYMOUS_SEARCH_ON ":icons/search_red_128.png"
|
||||
#define FLAGS_ANONYMOUS_SEARCH_OFF ":icons/blank_red_128.png"
|
||||
#define FLAGS_BROWSABLE_ON ":icons/browsable_green_128.png"
|
||||
#define FLAGS_BROWSABLE_OFF ":icons/blank_green_128.png"
|
||||
#define FLAGS_ANONYMOUS_DL_ON ":icons/anonymous_blue_128.png"
|
||||
#define FLAGS_ANONYMOUS_DL_OFF ":icons/blank_blue_128.png"
|
||||
|
||||
#define INDEX_GROUP_BROWSABLE 0
|
||||
#define INDEX_GROUP_NETWORK_W 1
|
||||
#define INDEX_OTHER_BROWSABLE 2
|
||||
#define INDEX_OTHER_NETWORK_W 3
|
||||
#define INDEX_GROUP_UNCHECKED 4
|
||||
#define INDEX_OTHER_UNCHECKED 5
|
||||
#define INDEX_ANON_SEARCH 0
|
||||
#define INDEX_ANON_DL 1
|
||||
#define INDEX_BROWSABLE 2
|
||||
|
||||
/*QString GroupFlagsWidget::_tooltips_on[4] = {
|
||||
QObject::tr("Directory is browsable for friends from groups"),
|
||||
QObject::tr("Directory is accessible by anonymous tunnels from friends from groups"),
|
||||
QObject::tr("Directory is browsable for any friend"),
|
||||
QObject::tr("Directory is accessible by anonymous tunnels from any friend")
|
||||
QObject::tr("Directory is visible to friends"),
|
||||
QObject::tr("Directory can be search anonymously"),
|
||||
QObject::tr("Directory is accessible by anonymous tunnels")
|
||||
};
|
||||
QString GroupFlagsWidget::_tooltips_off[4] = {
|
||||
QObject::tr("Directory is NOT browsable for friends from groups"),
|
||||
QObject::tr("Directory is NOT accessible by anonymous tunnels from friends from groups"),
|
||||
QObject::tr("Directory is NOT browsable for any friend"),
|
||||
QObject::tr("Directory is NOT accessible by anonymous tunnels from any friend")
|
||||
QObject::tr("Directory is not visible to friends"),
|
||||
QObject::tr("Directory cannot be searched anonymously"),
|
||||
QObject::tr("Directory is NOT accessible by anonymous tunnels")
|
||||
};
|
||||
*/
|
||||
GroupFlagsWidget::GroupFlagsWidget(QWidget *parent,FileStorageFlags flags)
|
||||
|
@ -39,35 +34,33 @@ GroupFlagsWidget::GroupFlagsWidget(QWidget *parent,FileStorageFlags flags)
|
|||
setMaximumSize(128 * QFontMetricsF(font()).height()/14.0,32 * QFontMetricsF(font()).height()/14.0) ;
|
||||
setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed);
|
||||
|
||||
_icons[INDEX_GROUP_BROWSABLE] = new QIcon(FLAGS_GROUP_BROWSABLE_ICON) ;
|
||||
_icons[INDEX_GROUP_NETWORK_W] = new QIcon(FLAGS_GROUP_NETWORK_WIDE_ICON) ;
|
||||
_icons[INDEX_OTHER_BROWSABLE] = new QIcon(FLAGS_OTHER_BROWSABLE_ICON) ;
|
||||
_icons[INDEX_OTHER_NETWORK_W] = new QIcon(FLAGS_OTHER_NETWORK_WIDE_ICON) ;
|
||||
_icons[INDEX_GROUP_UNCHECKED] = new QIcon(FLAGS_GROUP_UNCHECKED) ;
|
||||
_icons[INDEX_OTHER_UNCHECKED] = new QIcon(FLAGS_OTHER_UNCHECKED) ;
|
||||
_icons[2*INDEX_BROWSABLE+0] = new QIcon(FLAGS_BROWSABLE_OFF) ;
|
||||
_icons[2*INDEX_BROWSABLE+1] = new QIcon(FLAGS_BROWSABLE_ON) ;
|
||||
_icons[2*INDEX_ANON_SEARCH+0] = new QIcon(FLAGS_ANONYMOUS_SEARCH_OFF) ;
|
||||
_icons[2*INDEX_ANON_SEARCH+1] = new QIcon(FLAGS_ANONYMOUS_SEARCH_ON) ;
|
||||
_icons[2*INDEX_ANON_DL+0] = new QIcon(FLAGS_ANONYMOUS_DL_OFF) ;
|
||||
_icons[2*INDEX_ANON_DL+1] = new QIcon(FLAGS_ANONYMOUS_DL_ON) ;
|
||||
|
||||
setLayout(_layout) ;
|
||||
|
||||
_flags[0] = DIR_FLAGS_BROWSABLE_GROUPS ;
|
||||
_flags[1] = DIR_FLAGS_NETWORK_WIDE_GROUPS ;
|
||||
_flags[2] = DIR_FLAGS_BROWSABLE_OTHERS ;
|
||||
_flags[3] = DIR_FLAGS_NETWORK_WIDE_OTHERS ;
|
||||
_flags[INDEX_BROWSABLE ] = DIR_FLAGS_BROWSABLE ;
|
||||
_flags[INDEX_ANON_SEARCH] = DIR_FLAGS_ANONYMOUS_SEARCH ;
|
||||
_flags[INDEX_ANON_DL ] = DIR_FLAGS_ANONYMOUS_DOWNLOAD ;
|
||||
|
||||
for(int i=0;i<4;++i)
|
||||
for(int i=0;i<3;++i)
|
||||
{
|
||||
_buttons[i] = new QPushButton(this) ;
|
||||
_buttons[i]->setCheckable(true) ;
|
||||
_buttons[i]->setChecked(flags & _flags[i]) ;
|
||||
_buttons[i]->setIconSize(QSize(32 * QFontMetricsF(font()).height()/14.0,32 * QFontMetricsF(font()).height()/14.0));
|
||||
|
||||
update_button_state(_buttons[i]->isChecked(),i) ;
|
||||
_layout->addWidget(_buttons[i]) ;
|
||||
}
|
||||
_buttons[INDEX_GROUP_NETWORK_W]->setHidden(true);
|
||||
|
||||
connect(_buttons[INDEX_GROUP_NETWORK_W],SIGNAL(toggled(bool)),this,SLOT(update_GN_button(bool))) ;
|
||||
connect(_buttons[INDEX_OTHER_NETWORK_W],SIGNAL(toggled(bool)),this,SLOT(update_ON_button(bool))) ;
|
||||
connect(_buttons[INDEX_GROUP_BROWSABLE],SIGNAL(toggled(bool)),this,SLOT(update_GB_button(bool))) ;
|
||||
connect(_buttons[INDEX_OTHER_BROWSABLE],SIGNAL(toggled(bool)),this,SLOT(update_OB_button(bool))) ;
|
||||
connect(_buttons[INDEX_ANON_DL ],SIGNAL(toggled(bool)),this,SLOT(update_DL_button(bool))) ;
|
||||
connect(_buttons[INDEX_ANON_SEARCH],SIGNAL(toggled(bool)),this,SLOT(update_SR_button(bool))) ;
|
||||
connect(_buttons[INDEX_BROWSABLE ],SIGNAL(toggled(bool)),this,SLOT(update_BR_button(bool))) ;
|
||||
|
||||
_layout->setSpacing(0);
|
||||
_layout->setContentsMargins(0, 0, 0, 0);
|
||||
|
@ -84,16 +77,15 @@ FileStorageFlags GroupFlagsWidget::flags() const
|
|||
{
|
||||
FileStorageFlags flags ;
|
||||
|
||||
for(int i=0;i<4;++i)
|
||||
for(int i=0;i<3;++i)
|
||||
if(_buttons[i]->isChecked()) flags |= _flags[i] ;
|
||||
|
||||
flags &= ~DIR_FLAGS_NETWORK_WIDE_GROUPS ;
|
||||
return flags ;
|
||||
}
|
||||
|
||||
void GroupFlagsWidget::setFlags(FileStorageFlags flags)
|
||||
{
|
||||
for(int i=0;i<4;++i)
|
||||
for(int i=0;i<3;++i)
|
||||
{
|
||||
_buttons[i]->setChecked(flags & _flags[i]) ;
|
||||
update_button_state(_buttons[i]->isChecked(),i) ;
|
||||
|
@ -104,41 +96,28 @@ void GroupFlagsWidget::update_button_state(bool b,int button_id)
|
|||
{
|
||||
QString tip_on, tip_off;
|
||||
switch (button_id) {
|
||||
case 0:
|
||||
tip_on = tr("Directory is browsable for friends from groups");
|
||||
tip_off = tr("Directory is NOT browsable for friends from groups");
|
||||
case INDEX_BROWSABLE:
|
||||
tip_on = tr("Directory content is visible to friend nodes (see list at right)");
|
||||
tip_off = tr("Directory content is NOT visible to friend nodes");
|
||||
break;
|
||||
case 1:
|
||||
tip_on = tr("Directory is accessible by anonymous tunnels from friends from groups");
|
||||
tip_off = tr("Directory is NOT accessible by anonymous tunnels from friends from groups");
|
||||
case INDEX_ANON_SEARCH:
|
||||
tip_on = tr("Directory can be searched anonymously");
|
||||
tip_off = tr("Directory cannot be searched anonymously");
|
||||
break;
|
||||
case 2:
|
||||
tip_on = tr("Directory is browsable for any friend");
|
||||
tip_off = tr("Directory is NOT browsable for any friend");
|
||||
break;
|
||||
case 3:
|
||||
tip_on = tr("Directory is accessible by anonymous tunnels from any friend");
|
||||
tip_off = tr("Directory is NOT accessible by anonymous tunnels from any friend");
|
||||
case INDEX_ANON_DL:
|
||||
if(_buttons[INDEX_ANON_SEARCH]->isChecked())
|
||||
tip_on = tr("Files can be accessed using anonymous tunnels");
|
||||
else
|
||||
tip_on = tr("Files can be accessed using anonymous & end-to-end encrypted tunnels");
|
||||
|
||||
tip_off = tr("Files cannot be downloaded anonymously");
|
||||
break;
|
||||
default:
|
||||
tip_on = "";
|
||||
tip_off = "";
|
||||
}
|
||||
if(b)
|
||||
{
|
||||
_buttons[button_id]->setIcon(*_icons[button_id]) ;
|
||||
_buttons[button_id]->setToolTip(tip_on) ;
|
||||
}
|
||||
else if(button_id == INDEX_GROUP_NETWORK_W || button_id == INDEX_GROUP_BROWSABLE)
|
||||
{
|
||||
_buttons[button_id]->setIcon(*_icons[INDEX_GROUP_UNCHECKED]) ;
|
||||
_buttons[button_id]->setToolTip(tip_off) ;
|
||||
}
|
||||
else
|
||||
{
|
||||
_buttons[button_id]->setIcon(*_icons[INDEX_OTHER_UNCHECKED]) ;
|
||||
_buttons[button_id]->setToolTip(tip_off) ;
|
||||
}
|
||||
_buttons[button_id]->setIcon(*_icons[2*button_id+(int)b]) ;
|
||||
_buttons[button_id]->setToolTip(b?tip_on:tip_off) ;
|
||||
}
|
||||
|
||||
QString GroupFlagsWidget::groupInfoString(FileStorageFlags flags, const QList<QString>& groupNames)
|
||||
|
@ -155,42 +134,39 @@ QString GroupFlagsWidget::groupInfoString(FileStorageFlags flags, const QList<QS
|
|||
groups_string += *it ;
|
||||
}
|
||||
|
||||
if(flags & DIR_FLAGS_BROWSABLE_OTHERS)
|
||||
res += tr("All friend nodes can browse this directory") + "\n" ;
|
||||
else if(flags & DIR_FLAGS_BROWSABLE_GROUPS)
|
||||
if(!groupNames.empty())
|
||||
res += tr("Only friend nodes in groups %1 can browse this directory").arg(groups_string) + "\n" ;
|
||||
else
|
||||
res += tr("No one can browse this directory") + "\n" ;
|
||||
else
|
||||
res += tr("No one can browse this directory") + "\n" ;
|
||||
if(flags & DIR_FLAGS_BROWSABLE)
|
||||
{
|
||||
if(groupNames.empty())
|
||||
res += tr("All friend nodes can see this directory") + "\n" ;
|
||||
else
|
||||
res += tr("Only visible to friend nodes in groups: %1").arg(groups_string) + "\n" ;
|
||||
}
|
||||
else
|
||||
res += tr("Not visible to friend nodes") + "\n" ;
|
||||
|
||||
if(flags & DIR_FLAGS_NETWORK_WIDE_OTHERS)
|
||||
res += tr("All friend nodes can relay anonymous tunnels to this directory") ;
|
||||
else if(flags & DIR_FLAGS_NETWORK_WIDE_GROUPS)
|
||||
res += tr("Only friend nodes in groups")+" " + groups_string +" "+ tr("can relay anonymous tunnels to this directory") ;
|
||||
else
|
||||
res += tr("No one can anonymously access this directory.") ;
|
||||
|
||||
//if(flags.toUInt32() == 0)
|
||||
// res += tr("No friends can access nor see this directory.") ;
|
||||
if((flags & DIR_FLAGS_ANONYMOUS_DOWNLOAD) && !(flags & DIR_FLAGS_ANONYMOUS_SEARCH))
|
||||
res += tr("Files can be downloaded (but not searched) anonymously") ;
|
||||
else if((flags & DIR_FLAGS_ANONYMOUS_DOWNLOAD) && (flags & DIR_FLAGS_ANONYMOUS_SEARCH))
|
||||
res += tr("Files can be downloaded and searched anonymously") ;
|
||||
else if(!(flags & DIR_FLAGS_ANONYMOUS_DOWNLOAD) && (flags & DIR_FLAGS_ANONYMOUS_SEARCH))
|
||||
res += tr("Files can be searched (but not downloaded) anonymously") ;
|
||||
else
|
||||
res += tr("No one can anonymously access/search these files.") ;
|
||||
|
||||
return res ;
|
||||
}
|
||||
|
||||
void GroupFlagsWidget::update_GN_button(bool b) { update_button_state(b,INDEX_GROUP_NETWORK_W) ; updated() ; }
|
||||
void GroupFlagsWidget::update_GB_button(bool b) { update_button_state(b,INDEX_GROUP_BROWSABLE) ; updated() ; }
|
||||
void GroupFlagsWidget::update_ON_button(bool b) { update_button_state(b,INDEX_OTHER_NETWORK_W) ; updated() ; }
|
||||
void GroupFlagsWidget::update_OB_button(bool b) { update_button_state(b,INDEX_OTHER_BROWSABLE) ; updated() ; }
|
||||
void GroupFlagsWidget::update_DL_button(bool b) { update_button_state(b,INDEX_ANON_DL ) ; updated() ; }
|
||||
void GroupFlagsWidget::update_SR_button(bool b) { update_button_state(b,INDEX_ANON_SEARCH) ; updated() ; }
|
||||
void GroupFlagsWidget::update_BR_button(bool b) { update_button_state(b,INDEX_BROWSABLE ) ; updated() ; }
|
||||
|
||||
GroupFlagsWidget::~GroupFlagsWidget()
|
||||
{
|
||||
for(int i=0;i<4;++i)
|
||||
for(int i=0;i<3;++i)
|
||||
{
|
||||
delete _buttons[i] ;
|
||||
delete _icons[i] ;
|
||||
}
|
||||
delete _icons[INDEX_GROUP_UNCHECKED] ;
|
||||
delete _icons[INDEX_OTHER_UNCHECKED] ;
|
||||
delete _icons[2*i+0] ;
|
||||
delete _icons[2*i+1] ;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -22,10 +22,9 @@ class GroupFlagsWidget: public QWidget
|
|||
void updated() ;
|
||||
|
||||
protected slots:
|
||||
void update_GN_button(bool) ;
|
||||
void update_GB_button(bool) ;
|
||||
void update_ON_button(bool) ;
|
||||
void update_OB_button(bool) ;
|
||||
void update_DL_button(bool) ;
|
||||
void update_SR_button(bool) ;
|
||||
void update_BR_button(bool) ;
|
||||
|
||||
signals:
|
||||
void flagsChanged(FileStorageFlags) const ;
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
#include <QLayout>
|
||||
#include <QDialogButtonBox>
|
||||
#include <retroshare/rspeers.h>
|
||||
#include "GroupSelectionBox.h"
|
||||
#include "GroupDefs.h"
|
||||
|
@ -17,7 +19,6 @@ GroupSelectionBox::GroupSelectionBox(QWidget *parent)
|
|||
// Fill with available groups
|
||||
fillGroups();
|
||||
}
|
||||
|
||||
void GroupSelectionBox::fillGroups()
|
||||
{
|
||||
std::list<RsNodeGroupId> selectedIds;
|
||||
|
@ -78,3 +79,39 @@ void GroupSelectionBox::selectedGroupNames(QList<QString> &groupNames) const
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
std::list<RsNodeGroupId> GroupSelectionDialog::selectGroups(const std::list<RsNodeGroupId>& default_groups)
|
||||
{
|
||||
GroupSelectionDialog gsd(NULL) ;
|
||||
|
||||
gsd.mBox->setSelectedGroupIds(default_groups) ;
|
||||
|
||||
gsd.exec();
|
||||
|
||||
std::list<RsNodeGroupId> selected_groups ;
|
||||
gsd.mBox->selectedGroupIds(selected_groups);
|
||||
|
||||
return selected_groups ;
|
||||
}
|
||||
|
||||
GroupSelectionDialog::~GroupSelectionDialog()
|
||||
{
|
||||
delete mBox ;
|
||||
}
|
||||
GroupSelectionDialog::GroupSelectionDialog(QWidget *parent)
|
||||
{
|
||||
mBox = new GroupSelectionBox(this) ;
|
||||
|
||||
QLayout *l = new QVBoxLayout ;
|
||||
setLayout(l) ;
|
||||
|
||||
QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
|
||||
|
||||
connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
|
||||
connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
|
||||
|
||||
l->addWidget(mBox) ;
|
||||
l->addWidget(buttonBox) ;
|
||||
l->update() ;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include <QListWidget>
|
||||
#include <QDialog>
|
||||
#include <retroshare/rsids.h>
|
||||
|
||||
class GroupSelectionBox: public QListWidget
|
||||
|
@ -8,6 +9,8 @@ class GroupSelectionBox: public QListWidget
|
|||
public:
|
||||
GroupSelectionBox(QWidget *parent);
|
||||
|
||||
static void selectGroups(const std::list<RsNodeGroupId>& default_groups) ;
|
||||
|
||||
void selectedGroupIds(std::list<RsNodeGroupId> &groupIds) const;
|
||||
void selectedGroupNames(QList<QString> &groupNames) const;
|
||||
|
||||
|
@ -16,3 +19,17 @@ public:
|
|||
private slots:
|
||||
void fillGroups();
|
||||
};
|
||||
|
||||
class GroupSelectionDialog: public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
GroupSelectionDialog(QWidget *parent) ;
|
||||
virtual ~GroupSelectionDialog() ;
|
||||
|
||||
static std::list<RsNodeGroupId> selectGroups(const std::list<RsNodeGroupId>& default_groups) ;
|
||||
|
||||
private:
|
||||
GroupSelectionBox *mBox ;
|
||||
};
|
||||
|
|
|
@ -78,6 +78,17 @@ void MimeTextEdit::insertFromMimeData(const QMimeData* source)
|
|||
}
|
||||
#endif
|
||||
|
||||
//insert retroshare links
|
||||
QList<RetroShareLink> links;
|
||||
RSLinkClipboard::parseText(source->text(), links);
|
||||
if(links.size() > 0)
|
||||
{
|
||||
for(int i = 0; i < links.size(); ++i)
|
||||
insertHtml(links[i].toHtml() + "<br>");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
return RSTextEdit::insertFromMimeData(source);
|
||||
}
|
||||
|
||||
|
|
|
@ -25,15 +25,16 @@
|
|||
<file>icons/settings/sound.svg</file>
|
||||
<file>icons/settings/webinterface.svg</file>
|
||||
<file>icons/add_user_256.png</file>
|
||||
<file>icons/anonymous_blue_128.png</file>
|
||||
<file>icons/anonymous_green_128.png</file>
|
||||
<file>icons/aol.png</file>
|
||||
<file>icons/avatar_128.png</file>
|
||||
<file>icons/avatar_grey_128.png</file>
|
||||
<file>icons/blank_blue_128.png</file>
|
||||
<file>icons/blank_red_128.png</file>
|
||||
<file>icons/void_128.png</file>
|
||||
<file>icons/blank_green_128.png</file>
|
||||
<file>icons/browsable_blue_128.png</file>
|
||||
<file>icons/blank_blue_128.png</file>
|
||||
<file>icons/browsable_green_128.png</file>
|
||||
<file>icons/search_red_128.png</file>
|
||||
<file>icons/anonymous_blue_128.png</file>
|
||||
<file>icons/bullet_blue_128.png</file>
|
||||
<file>icons/bullet_green_128.png</file>
|
||||
<file>icons/bullet_grey_128.png</file>
|
||||
|
|
BIN
retroshare-gui/src/gui/icons/blank_red_128.png
Normal file
BIN
retroshare-gui/src/gui/icons/blank_red_128.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.9 KiB |
|
@ -3,7 +3,7 @@
|
|||
echo '<RCC>'
|
||||
echo '\t<qresource prefix="/">'
|
||||
|
||||
for i in `ls *.png`; do
|
||||
for i in `ls *.png */*png */*svg`; do
|
||||
echo '\t\t<file>icons/'$i'</file>'
|
||||
done
|
||||
|
||||
|
|
BIN
retroshare-gui/src/gui/icons/search_red_128.png
Normal file
BIN
retroshare-gui/src/gui/icons/search_red_128.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 8.7 KiB |
BIN
retroshare-gui/src/gui/icons/void_128.png
Normal file
BIN
retroshare-gui/src/gui/icons/void_128.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.6 KiB |
|
@ -32,24 +32,31 @@
|
|||
TransferPage::TransferPage(QWidget * parent, Qt::WindowFlags flags)
|
||||
: ConfigPage(parent, flags)
|
||||
{
|
||||
/* Invoke the Qt Designer generated object setup routine */
|
||||
ui.setupUi(this);
|
||||
/* Invoke the Qt Designer generated object setup routine */
|
||||
ui.setupUi(this);
|
||||
|
||||
ui._queueSize_SB->setValue(rsFiles->getQueueSize()) ;
|
||||
ui._queueSize_SB->setValue(rsFiles->getQueueSize()) ;
|
||||
|
||||
switch(rsFiles->defaultChunkStrategy())
|
||||
{
|
||||
case FileChunksInfo::CHUNK_STRATEGY_STREAMING: ui._defaultStrategy_CB->setCurrentIndex(0) ; break ;
|
||||
case FileChunksInfo::CHUNK_STRATEGY_PROGRESSIVE: ui._defaultStrategy_CB->setCurrentIndex(1) ; break ;
|
||||
case FileChunksInfo::CHUNK_STRATEGY_RANDOM: ui._defaultStrategy_CB->setCurrentIndex(2) ; break ;
|
||||
}
|
||||
switch(rsFiles->defaultChunkStrategy())
|
||||
{
|
||||
case FileChunksInfo::CHUNK_STRATEGY_STREAMING: ui._defaultStrategy_CB->setCurrentIndex(0) ; break ;
|
||||
case FileChunksInfo::CHUNK_STRATEGY_PROGRESSIVE: ui._defaultStrategy_CB->setCurrentIndex(1) ; break ;
|
||||
case FileChunksInfo::CHUNK_STRATEGY_RANDOM: ui._defaultStrategy_CB->setCurrentIndex(2) ; break ;
|
||||
}
|
||||
|
||||
ui._diskSpaceLimit_SB->setValue(rsFiles->freeDiskSpaceLimit()) ;
|
||||
switch(rsFiles->defaultEncryptionPolicy())
|
||||
{
|
||||
case RS_FILE_CTRL_ENCRYPTION_POLICY_PERMISSIVE: ui._e2e_encryption_CB->setCurrentIndex(0) ; break ;
|
||||
case RS_FILE_CTRL_ENCRYPTION_POLICY_STRICT : ui._e2e_encryption_CB->setCurrentIndex(1) ; break ;
|
||||
}
|
||||
|
||||
QObject::connect(ui._queueSize_SB,SIGNAL(valueChanged(int)),this,SLOT(updateQueueSize(int))) ;
|
||||
QObject::connect(ui._defaultStrategy_CB,SIGNAL(activated(int)),this,SLOT(updateDefaultStrategy(int))) ;
|
||||
QObject::connect(ui._diskSpaceLimit_SB,SIGNAL(valueChanged(int)),this,SLOT(updateDiskSizeLimit(int))) ;
|
||||
QObject::connect(ui._max_tr_up_per_sec_SB, SIGNAL( valueChanged( int ) ), this, SLOT( updateMaxTRUpRate(int) ) );
|
||||
ui._diskSpaceLimit_SB->setValue(rsFiles->freeDiskSpaceLimit()) ;
|
||||
|
||||
QObject::connect(ui._queueSize_SB,SIGNAL(valueChanged(int)),this,SLOT(updateQueueSize(int))) ;
|
||||
QObject::connect(ui._defaultStrategy_CB,SIGNAL(activated(int)),this,SLOT(updateDefaultStrategy(int))) ;
|
||||
QObject::connect(ui._e2e_encryption_CB,SIGNAL(activated(int)),this,SLOT(updateEncryptionPolicy(int))) ;
|
||||
QObject::connect(ui._diskSpaceLimit_SB,SIGNAL(valueChanged(int)),this,SLOT(updateDiskSizeLimit(int))) ;
|
||||
QObject::connect(ui._max_tr_up_per_sec_SB, SIGNAL( valueChanged( int ) ), this, SLOT( updateMaxTRUpRate(int) ) );
|
||||
|
||||
ui._max_tr_up_per_sec_SB->setValue(rsTurtle->getMaxTRForwardRate()) ;
|
||||
}
|
||||
|
@ -57,6 +64,19 @@ void TransferPage::updateMaxTRUpRate(int b)
|
|||
{
|
||||
rsTurtle->setMaxTRForwardRate(b) ;
|
||||
}
|
||||
|
||||
void TransferPage::updateEncryptionPolicy(int b)
|
||||
{
|
||||
switch(b)
|
||||
{
|
||||
case 1: rsFiles->setDefaultEncryptionPolicy(RS_FILE_CTRL_ENCRYPTION_POLICY_STRICT) ;
|
||||
break ;
|
||||
default:
|
||||
case 0: rsFiles->setDefaultEncryptionPolicy(RS_FILE_CTRL_ENCRYPTION_POLICY_PERMISSIVE) ;
|
||||
break ;
|
||||
}
|
||||
}
|
||||
|
||||
void TransferPage::updateDefaultStrategy(int i)
|
||||
{
|
||||
switch(i)
|
||||
|
|
|
@ -49,6 +49,7 @@ class TransferPage: public ConfigPage
|
|||
void updateDefaultStrategy(int) ;
|
||||
void updateDiskSizeLimit(int) ;
|
||||
void updateMaxTRUpRate(int);
|
||||
void updateEncryptionPolicy(int);
|
||||
|
||||
private:
|
||||
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>700</width>
|
||||
<height>356</height>
|
||||
<width>741</width>
|
||||
<height>372</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
|
@ -49,6 +49,13 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>End-to-end encryption:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
|
@ -135,6 +142,23 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="_e2e_encryption_CB">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Anonymous tunnels can be end-o-end encrypted. In order to maintain backward compatibility, this can be made optional (choosing &quot;Accepted&quot;), but in the end, all Retroshare nodes will be switched to &quot;Enforced&quot;, meaning that all anonymous transfers will be end-to-end encrypted.</p></body></html></string>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Accepted</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Enforced</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
|
|
|
@ -234,6 +234,9 @@ macx {
|
|||
mac_icon.files = $$files($$PWD/rsMacIcon.icns)
|
||||
mac_icon.path = Contents/Resources
|
||||
QMAKE_BUNDLE_DATA += mac_icon
|
||||
mac_webui.files = $$files($$PWD/../../libresapi/src/webui)
|
||||
mac_webui.path = Contents/Resources
|
||||
QMAKE_BUNDLE_DATA += mac_webui
|
||||
|
||||
CONFIG += version_detail_bash_script
|
||||
LIBS += -lssl -lcrypto -lz
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue