[Pkg-owncloud-commits] [owncloud-client] 377/484: ShareDialog: remove the "Premissions" label and adjust the size of the scrollarea (#3737)
Sandro Knauß
hefee-guest at moszumanska.debian.org
Wed Dec 16 00:38:08 UTC 2015
This is an automated email from the git hooks/post-receive script.
hefee-guest pushed a commit to branch master
in repository owncloud-client.
commit d6aa6679713c96299be86b35d0766261d5487e95
Author: Olivier Goffart <ogoffart at woboq.com>
Date: Thu Nov 19 12:32:50 2015 +0100
ShareDialog: remove the "Premissions" label and adjust the size of the scrollarea (#3737)
---
src/gui/shareusergroupwidget.cpp | 19 +++++++++++++++++++
src/gui/shareusergroupwidget.h | 2 ++
src/gui/sharewidget.ui | 6 +++---
3 files changed, 24 insertions(+), 3 deletions(-)
diff --git a/src/gui/shareusergroupwidget.cpp b/src/gui/shareusergroupwidget.cpp
index ffc5bfb..a7eaafb 100644
--- a/src/gui/shareusergroupwidget.cpp
+++ b/src/gui/shareusergroupwidget.cpp
@@ -141,11 +141,14 @@ void ShareUserGroupWidget::slotSharesFetched(const QList<QSharedPointer<Share>>
}
ShareWidget *s = new ShareWidget(share, _ui->scrollArea);
+ connect(s, SIGNAL(resizeRequested()), this, SLOT(slotAdjustScrollWidgetSize()));
layout->addWidget(s);
x++;
if (x <= 3) {
minimumSize = newViewPort->sizeHint();
+ } else {
+ minimumSize.rwidth() = qMax(newViewPort->sizeHint().width(), minimumSize.width());
}
}
@@ -156,6 +159,19 @@ void ShareUserGroupWidget::slotSharesFetched(const QList<QSharedPointer<Share>>
scrollArea->setWidget(newViewPort);
}
+void ShareUserGroupWidget::slotAdjustScrollWidgetSize()
+{
+ QScrollArea *scrollArea = _ui->scrollArea;
+ if (scrollArea->findChildren<ShareWidget*>().count() <= 3) {
+ auto minimumSize = scrollArea->widget()->sizeHint();
+ auto spacing = scrollArea->widget()->layout()->spacing();
+ minimumSize.rwidth() += spacing;
+ minimumSize.rheight() += spacing;
+ scrollArea->setMinimumSize(minimumSize);
+ }
+}
+
+
void ShareUserGroupWidget::slotShareesReady()
{
_completer->complete();
@@ -226,6 +242,7 @@ void ShareWidget::on_permissionToggleButton_clicked()
} else {
_ui->permissionToggleButton->setText("More");
}
+ emit resizeRequested();
}
ShareWidget::~ShareWidget()
@@ -279,6 +296,7 @@ void ShareWidget::slotPermissionsChanged()
void ShareWidget::slotDeleteAnimationFinished()
{
+ resizeRequested();
deleteLater();
}
@@ -291,6 +309,7 @@ void ShareWidget::slotShareDeleted()
animation->setEndValue(0);
connect(animation, SIGNAL(finished()), SLOT(slotDeleteAnimationFinished()));
+ connect(animation, SIGNAL(valueChanged(QVariant)), this, SIGNAL(resizeRequested()));
animation->start();
}
diff --git a/src/gui/shareusergroupwidget.h b/src/gui/shareusergroupwidget.h
index 13b3ef8..9591f88 100644
--- a/src/gui/shareusergroupwidget.h
+++ b/src/gui/shareusergroupwidget.h
@@ -54,6 +54,7 @@ public:
signals:
void shareDeleted(ShareWidget *share);
+ void resizeRequested();
private slots:
void on_deleteShareButton_clicked();
@@ -102,6 +103,7 @@ private slots:
void slotCompleterActivated(const QModelIndex & index);
void slotShareesReady();
+ void slotAdjustScrollWidgetSize();
private:
Ui::ShareUserGroupWidget *_ui;
diff --git a/src/gui/sharewidget.ui b/src/gui/sharewidget.ui
index 66d53d4..83a5841 100644
--- a/src/gui/sharewidget.ui
+++ b/src/gui/sharewidget.ui
@@ -9,8 +9,8 @@
<rect>
<x>0</x>
<y>0</y>
- <width>474</width>
- <height>108</height>
+ <width>468</width>
+ <height>92</height>
</rect>
</property>
<property name="windowTitle">
@@ -54,7 +54,7 @@
<item>
<widget class="QGroupBox" name="groupBox">
<property name="title">
- <string>Permissions</string>
+ <string/>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud-client.git
More information about the Pkg-owncloud-commits
mailing list