From ef09075170eace8963c2de31b1a44cb416d1ad02 Mon Sep 17 00:00:00 2001 From: csoler Date: Tue, 6 Nov 2012 21:24:49 +0000 Subject: [PATCH] gui tweaks git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5-FileSharingPermissions@5785 b45a01b8-16f6-495d-af2f-9b41ad6348cc --- retroshare-gui/src/gui/ShareDialog.cpp | 10 ++++++++- .../src/gui/common/GroupFlagsWidget.cpp | 21 ++++++++++++------- .../src/gui/common/GroupSelectionBox.cpp | 2 ++ 3 files changed, 25 insertions(+), 8 deletions(-) diff --git a/retroshare-gui/src/gui/ShareDialog.cpp b/retroshare-gui/src/gui/ShareDialog.cpp index 60044136b..67062c7b9 100644 --- a/retroshare-gui/src/gui/ShareDialog.cpp +++ b/retroshare-gui/src/gui/ShareDialog.cpp @@ -53,12 +53,19 @@ ShareDialog::ShareDialog(std::string filename, QWidget *parent, Qt::WFlags flags QVBoxLayout *vbox = new QVBoxLayout() ; + QHBoxLayout *hb2 = new QHBoxLayout() ; + hb2->addWidget(new QLabel(tr("Share flags and groups: "))) ; + groupflagsbox = new GroupFlagsWidget(ui.shareflags_GB) ; + groupflagsbox->setFlags(DIR_FLAGS_NETWORK_WIDE_OTHERS) ; // default value + messageBox = new QTextEdit(ui.shareflags_GB) ; messageBox->setReadOnly(true) ; messageBox->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding,QSizePolicy::Preferred)) ; - vbox->addWidget(groupflagsbox) ; + hb2->addWidget(groupflagsbox) ; + + vbox->addLayout(hb2) ; vbox->addWidget(messageBox) ; QHBoxLayout *hbox = new QHBoxLayout() ; @@ -67,6 +74,7 @@ ShareDialog::ShareDialog(std::string filename, QWidget *parent, Qt::WFlags flags hbox->addWidget(groupselectionbox) ; ui.shareflags_GB->setLayout(hbox) ; + updateInfoMessage() ; connect(groupselectionbox,SIGNAL(itemSelectionChanged()),this,SLOT(updateInfoMessage())) ; connect(groupflagsbox,SIGNAL(flagsChanged(FileStorageFlags)),this,SLOT(updateInfoMessage())) ; diff --git a/retroshare-gui/src/gui/common/GroupFlagsWidget.cpp b/retroshare-gui/src/gui/common/GroupFlagsWidget.cpp index 0e34da3bb..999f67842 100644 --- a/retroshare-gui/src/gui/common/GroupFlagsWidget.cpp +++ b/retroshare-gui/src/gui/common/GroupFlagsWidget.cpp @@ -70,7 +70,7 @@ GroupFlagsWidget::GroupFlagsWidget(QWidget *parent,FileStorageFlags flags) connect(_buttons[INDEX_OTHER_BROWSABLE],SIGNAL(toggled(bool)),this,SLOT(update_OB_button(bool))) ; _layout->setSpacing(0); - _layout->setContentsMargins(10, 0, 0, 0); + _layout->setContentsMargins(0, 0, 0, 0); _layout->update() ; } @@ -133,18 +133,25 @@ QString GroupFlagsWidget::groupInfoString(FileStorageFlags flags,const std::list 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") ; - else if((flags & DIR_FLAGS_BROWSABLE_GROUPS) && !groups.empty()) - res += tr("Only friends in groups ") + groups_string + tr(" can browse this directory\n") ; + else if(flags & DIR_FLAGS_BROWSABLE_GROUPS) + if(!groups.empty()) + 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) res += tr("All your friends can relay anonymous tunnels to this directory") ; 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) - res += tr("No friends can access nor see this directory.") ; + //if(flags.toUInt32() == 0) + // res += tr("No friends can access nor see this directory.") ; return res ; } diff --git a/retroshare-gui/src/gui/common/GroupSelectionBox.cpp b/retroshare-gui/src/gui/common/GroupSelectionBox.cpp index c83a18ae1..4f01bd065 100644 --- a/retroshare-gui/src/gui/common/GroupSelectionBox.cpp +++ b/retroshare-gui/src/gui/common/GroupSelectionBox.cpp @@ -14,6 +14,8 @@ GroupSelectionBox::GroupSelectionBox(QWidget *parent) for(std::list::const_iterator it(lst.begin());it!=lst.end();++it) addItem(QString::fromStdString(it->id)) ; + for(int i=0;isetBackgroundColor(QColor(183,236,181)) ; } std::list GroupSelectionBox::selectedGroups() const