Sharedialog: grouped sharelink stuff in one widget

A bit of grouping in the UI requiring less ->hide() and ->show() calls
This commit is contained in:
Roeland Jago Douma 2015-01-17 08:10:18 +01:00
parent 71560ace71
commit c233baab5b
2 changed files with 74 additions and 82 deletions

View file

@ -30,11 +30,9 @@ ShareDialog::ShareDialog(const QString &sharePath, const QString &localPath, QWi
_pi_link = new QProgressIndicator(); _pi_link = new QProgressIndicator();
_pi_password = new QProgressIndicator(); _pi_password = new QProgressIndicator();
_pi_date = new QProgressIndicator(); _pi_date = new QProgressIndicator();
_pi_password->hide(); _ui->horizontalLayout_shareLink->addWidget(_pi_link);
_pi_date->hide(); _ui->horizontalLayout_password->addWidget(_pi_password);
_ui->horizontalLayout_4->addWidget(_pi_link); _ui->horizontalLayout_expire->addWidget(_pi_date);
_ui->horizontalLayout_5->addWidget(_pi_password);
_ui->horizontalLayout_3->addWidget(_pi_date);
connect(_ui->checkBox_shareLink, SIGNAL(clicked()), this, SLOT(slotCheckBoxShareLinkClicked())); connect(_ui->checkBox_shareLink, SIGNAL(clicked()), this, SLOT(slotCheckBoxShareLinkClicked()));
connect(_ui->checkBox_password, SIGNAL(clicked()), this, SLOT(slotCheckBoxPasswordClicked())); connect(_ui->checkBox_password, SIGNAL(clicked()), this, SLOT(slotCheckBoxPasswordClicked()));
@ -42,11 +40,8 @@ ShareDialog::ShareDialog(const QString &sharePath, const QString &localPath, QWi
connect(_ui->checkBox_expire, SIGNAL(clicked()), this, SLOT(slotCheckBoxExpireClicked())); connect(_ui->checkBox_expire, SIGNAL(clicked()), this, SLOT(slotCheckBoxExpireClicked()));
connect(_ui->calendar, SIGNAL(clicked(QDate)), SLOT(slotCalendarClicked(QDate))); connect(_ui->calendar, SIGNAL(clicked(QDate)), SLOT(slotCalendarClicked(QDate)));
_ui->lineEdit_shareLink->hide(); _ui->widget_shareLink->hide();
_ui->pushButton_copy->hide();
_ui->lineEdit_password->hide(); _ui->lineEdit_password->hide();
_ui->checkBox_password->hide();
_ui->checkBox_expire->hide();
_ui->calendar->hide(); _ui->calendar->hide();
QFileInfo f_info(_localPath); QFileInfo f_info(_localPath);
@ -208,11 +203,7 @@ void ShareDialog::slotSharesFetched(const QString &reply)
{ {
_public_share_id = data.value("id").toULongLong(); _public_share_id = data.value("id").toULongLong();
_ui->lineEdit_shareLink->show(); _ui->widget_shareLink->show();
_ui->pushButton_copy->show();
_ui->checkBox_password->show();
_ui->checkBox_expire->show();
_ui->pushButton_copy->show();
_ui->checkBox_shareLink->setChecked(true); _ui->checkBox_shareLink->setChecked(true);
if (data.value("share_with").isValid()) if (data.value("share_with").isValid())
@ -241,11 +232,8 @@ void ShareDialog::slotDeleteShareFetched(const QString & /* reply */)
_pi_date->hide(); _pi_date->hide();
_pi_link->stopAnimation(); _pi_link->stopAnimation();
_ui->lineEdit_shareLink->hide(); _ui->widget_shareLink->hide();
_ui->pushButton_copy->hide();
_ui->lineEdit_password->hide(); _ui->lineEdit_password->hide();
_ui->checkBox_password->hide();
_ui->checkBox_expire->hide();
_ui->calendar->hide(); _ui->calendar->hide();
} }
@ -309,18 +297,13 @@ void ShareDialog::slotCreateShareFetched(const QString &reply)
_pi_link->stopAnimation(); _pi_link->stopAnimation();
_pi_password->show();
_pi_date->show();
bool success; bool success;
QVariantMap json = QtJson::parse(reply, success).toMap(); QVariantMap json = QtJson::parse(reply, success).toMap();
_public_share_id = json.value("ocs").toMap().values("data")[0].toMap().value("id").toULongLong(); _public_share_id = json.value("ocs").toMap().values("data")[0].toMap().value("id").toULongLong();
QString url = json.value("ocs").toMap().values("data")[0].toMap().value("url").toString(); QString url = json.value("ocs").toMap().values("data")[0].toMap().value("url").toString();
_ui->lineEdit_shareLink->setText(url); _ui->lineEdit_shareLink->setText(url);
_ui->lineEdit_shareLink->show();
_ui->pushButton_copy->show(); _ui->widget_shareLink->show();
_ui->checkBox_password->show();
_ui->checkBox_expire->show();
_ui->pushButton_copy->show();
} }
void ShareDialog::slotCheckBoxPasswordClicked() void ShareDialog::slotCheckBoxPasswordClicked()

View file

@ -7,7 +7,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>454</width> <width>454</width>
<height>532</height> <height>558</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@ -133,7 +133,7 @@
</widget> </widget>
</item> </item>
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_4"> <layout class="QHBoxLayout" name="horizontalLayout_shareLink">
<item> <item>
<widget class="QCheckBox" name="checkBox_shareLink"> <widget class="QCheckBox" name="checkBox_shareLink">
<property name="text"> <property name="text">
@ -144,61 +144,70 @@
</layout> </layout>
</item> </item>
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout"> <widget class="QWidget" name="widget_shareLink" native="true">
<property name="sizeConstraint"> <layout class="QVBoxLayout" name="verticalLayout_6">
<enum>QLayout::SetDefaultConstraint</enum> <property name="margin">
</property> <number>0</number>
<item> </property>
<widget class="QLineEdit" name="lineEdit_shareLink"> <item>
<property name="readOnly"> <layout class="QHBoxLayout" name="horizontalLayout_3">
<bool>true</bool> <property name="sizeConstraint">
</property> <enum>QLayout::SetDefaultConstraint</enum>
</widget> </property>
</item> <item>
<item> <widget class="QLineEdit" name="lineEdit_shareLink">
<widget class="QPushButton" name="pushButton_copy"> <property name="readOnly">
<property name="text"> <bool>true</bool>
<string/> </property>
</property> </widget>
</widget> </item>
</item> <item>
</layout> <widget class="QPushButton" name="pushButton_copy">
</item> <property name="text">
<item> <string/>
<layout class="QHBoxLayout" name="horizontalLayout_5"> </property>
<item> </widget>
<widget class="QCheckBox" name="checkBox_password"> </item>
<property name="text"> </layout>
<string>Set password</string> </item>
</property> <item>
</widget> <layout class="QHBoxLayout" name="horizontalLayout_password">
</item> <item>
</layout> <widget class="QCheckBox" name="checkBox_password">
</item> <property name="text">
<item> <string>Set password</string>
<layout class="QHBoxLayout" name="horizontalLayout_2"> </property>
<item> </widget>
<widget class="QLineEdit" name="lineEdit_password"> </item>
<property name="echoMode"> </layout>
<enum>QLineEdit::Password</enum> </item>
</property> <item>
</widget> <layout class="QHBoxLayout" name="horizontalLayout_14">
</item> <item>
</layout> <widget class="QLineEdit" name="lineEdit_password">
</item> <property name="echoMode">
<item> <enum>QLineEdit::Password</enum>
<layout class="QHBoxLayout" name="horizontalLayout_3"> </property>
<item> </widget>
<widget class="QCheckBox" name="checkBox_expire"> </item>
<property name="text"> </layout>
<string>Set expiry date</string> </item>
</property> <item>
</widget> <layout class="QHBoxLayout" name="horizontalLayout_expire">
</item> <item>
</layout> <widget class="QCheckBox" name="checkBox_expire">
</item> <property name="text">
<item> <string>Set expiry date</string>
<widget class="QCalendarWidget" name="calendar"/> </property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QCalendarWidget" name="calendar"/>
</item>
</layout>
</widget>
</item> </item>
</layout> </layout>
</item> </item>