gui tweaks

git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5-FileSharingPermissions@5785 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
csoler 2012-11-06 21:24:49 +00:00
parent a2f958b956
commit ef09075170
3 changed files with 25 additions and 8 deletions

View File

@ -53,12 +53,19 @@ ShareDialog::ShareDialog(std::string filename, QWidget *parent, Qt::WFlags flags
QVBoxLayout *vbox = new QVBoxLayout() ; QVBoxLayout *vbox = new QVBoxLayout() ;
QHBoxLayout *hb2 = new QHBoxLayout() ;
hb2->addWidget(new QLabel(tr("Share flags and groups: "))) ;
groupflagsbox = new GroupFlagsWidget(ui.shareflags_GB) ; groupflagsbox = new GroupFlagsWidget(ui.shareflags_GB) ;
groupflagsbox->setFlags(DIR_FLAGS_NETWORK_WIDE_OTHERS) ; // default value
messageBox = new QTextEdit(ui.shareflags_GB) ; messageBox = new QTextEdit(ui.shareflags_GB) ;
messageBox->setReadOnly(true) ; messageBox->setReadOnly(true) ;
messageBox->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding,QSizePolicy::Preferred)) ; messageBox->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding,QSizePolicy::Preferred)) ;
vbox->addWidget(groupflagsbox) ; hb2->addWidget(groupflagsbox) ;
vbox->addLayout(hb2) ;
vbox->addWidget(messageBox) ; vbox->addWidget(messageBox) ;
QHBoxLayout *hbox = new QHBoxLayout() ; QHBoxLayout *hbox = new QHBoxLayout() ;
@ -67,6 +74,7 @@ ShareDialog::ShareDialog(std::string filename, QWidget *parent, Qt::WFlags flags
hbox->addWidget(groupselectionbox) ; hbox->addWidget(groupselectionbox) ;
ui.shareflags_GB->setLayout(hbox) ; ui.shareflags_GB->setLayout(hbox) ;
updateInfoMessage() ;
connect(groupselectionbox,SIGNAL(itemSelectionChanged()),this,SLOT(updateInfoMessage())) ; connect(groupselectionbox,SIGNAL(itemSelectionChanged()),this,SLOT(updateInfoMessage())) ;
connect(groupflagsbox,SIGNAL(flagsChanged(FileStorageFlags)),this,SLOT(updateInfoMessage())) ; connect(groupflagsbox,SIGNAL(flagsChanged(FileStorageFlags)),this,SLOT(updateInfoMessage())) ;

View File

@ -70,7 +70,7 @@ GroupFlagsWidget::GroupFlagsWidget(QWidget *parent,FileStorageFlags flags)
connect(_buttons[INDEX_OTHER_BROWSABLE],SIGNAL(toggled(bool)),this,SLOT(update_OB_button(bool))) ; connect(_buttons[INDEX_OTHER_BROWSABLE],SIGNAL(toggled(bool)),this,SLOT(update_OB_button(bool))) ;
_layout->setSpacing(0); _layout->setSpacing(0);
_layout->setContentsMargins(10, 0, 0, 0); _layout->setContentsMargins(0, 0, 0, 0);
_layout->update() ; _layout->update() ;
} }
@ -133,18 +133,25 @@ QString GroupFlagsWidget::groupInfoString(FileStorageFlags flags,const std::list
groups_string += QString::fromStdString(*it) ; groups_string += QString::fromStdString(*it) ;
} }
if((flags & DIR_FLAGS_BROWSABLE_OTHERS) && !groups.empty()) if(flags & DIR_FLAGS_BROWSABLE_OTHERS)
res += tr("All your friends can browse this directory\n") ; res += tr("All your friends can browse this directory\n") ;
else if((flags & DIR_FLAGS_BROWSABLE_GROUPS) && !groups.empty()) else if(flags & DIR_FLAGS_BROWSABLE_GROUPS)
if(!groups.empty())
res += tr("Only friends in groups ") + groups_string + tr(" can browse this directory\n") ; res += tr("Only friends in groups ") + groups_string + tr(" can browse this directory\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_NETWORK_WIDE_OTHERS) if(flags & DIR_FLAGS_NETWORK_WIDE_OTHERS)
res += tr("All your friends can relay anonymous tunnels to this directory") ; res += tr("All your friends can relay anonymous tunnels to this directory") ;
else if(flags & DIR_FLAGS_NETWORK_WIDE_GROUPS) else if(flags & DIR_FLAGS_NETWORK_WIDE_GROUPS)
res += tr("only friends in groups ") + groups_string + tr(" can relay anonymous tunnels to this directory") ; res += tr("Only friends 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) //if(flags.toUInt32() == 0)
res += tr("No friends can access nor see this directory.") ; // res += tr("No friends can access nor see this directory.") ;
return res ; return res ;
} }

View File

@ -14,6 +14,8 @@ GroupSelectionBox::GroupSelectionBox(QWidget *parent)
for(std::list<RsGroupInfo>::const_iterator it(lst.begin());it!=lst.end();++it) for(std::list<RsGroupInfo>::const_iterator it(lst.begin());it!=lst.end();++it)
addItem(QString::fromStdString(it->id)) ; addItem(QString::fromStdString(it->id)) ;
for(int i=0;i<count();++i)
item(i)->setBackgroundColor(QColor(183,236,181)) ;
} }
std::list<std::string> GroupSelectionBox::selectedGroups() const std::list<std::string> GroupSelectionBox::selectedGroups() const