diff options
author | Klaas Freitag <freitag@owncloud.com> | 2015-03-26 18:51:31 +0300 |
---|---|---|
committer | Klaas Freitag <freitag@owncloud.com> | 2015-04-07 14:38:01 +0300 |
commit | 1240a8163d41fea97f332121d1e367ea3fdfa560 (patch) | |
tree | 46bf07d4a227aac58aeb1372255dc555c76e13aa /src | |
parent | e15b9b5358961a3a23bb117330132725a77c9353 (diff) |
ShareDialog: Some GUI rework requested by Jan.
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/sharedialog.cpp | 35 | ||||
-rw-r--r-- | src/gui/sharedialog.ui | 211 |
2 files changed, 134 insertions, 112 deletions
diff --git a/src/gui/sharedialog.cpp b/src/gui/sharedialog.cpp index b57f36a44..bbcf05b1c 100644 --- a/src/gui/sharedialog.cpp +++ b/src/gui/sharedialog.cpp @@ -84,24 +84,20 @@ ShareDialog::ShareDialog(AccountPtr account, const QString &sharePath, const QSt QIcon icon = icon_provider.icon(f_info); _ui->label_icon->setPixmap(icon.pixmap(40,40)); - QString name; - if( f_info.isDir() ) { - name = tr("Share Directory"); - } else { - name = tr("Share File"); - } - _ui->groupBox->setTitle(name); - - QString lPath(_localPath); - if( lPath.length() > 50) { - lPath = QLatin1String("...")+lPath.right(50); - } - _ui->label_name->setText(tr("Local path: %1").arg(lPath)); + QFileInfo lPath(_localPath); + QString fileName = lPath.fileName(); + _ui->label_name->setText(tr("%1").arg(fileName)); + QFont f( _ui->label_name->font()); + f.setPointSize( f.pointSize() * 1.4 ); + _ui->label_name->setFont( f ); _ui->label_sharePath->setWordWrap(true); - _ui->label_sharePath->setText(tr("%1 path: %2").arg(Theme::instance()->appNameGUI()).arg(_sharePath)); + QString ocDir(_sharePath); + ocDir.truncate(ocDir.length()-fileName.length()); + + _ui->label_sharePath->setText(tr("%1 path: %2").arg(Theme::instance()->appNameGUI()).arg(ocDir)); this->setWindowTitle(tr("%1 Sharing").arg(Theme::instance()->appNameGUI())); - _ui->label_password->setText(tr("Set p&assword")); + _ui->checkBox_password->setText(tr("Set p&assword")); // check if the file is already inside of a synced folder if( sharePath.isEmpty() ) { // The file is not yet in an ownCloud synced folder. We could automatically @@ -336,7 +332,12 @@ void ShareDialog::setShareLink( const QString& url ) // FIXME: shorten the url for output. const QUrl realUrl(url); if( realUrl.isValid() ) { - const QString u = QString("<a href=\"%1\">%2</a>").arg(realUrl.toString(QUrl::None)).arg(url); + QFontMetrics fm( _ui->_labelShareLink->font() ); + int linkLengthPixel = _ui->_labelShareLink->width(); + + QString elidedUrl = fm.elidedText(url, Qt::ElideRight, linkLengthPixel); + + const QString u = QString("<a href=\"%1\">%2</a>").arg(realUrl.toString(QUrl::None)).arg(elidedUrl); _ui->_labelShareLink->setText(u); _shareUrl = url; _ui->pushButton_copy->setEnabled(true); @@ -407,7 +408,7 @@ void ShareDialog::slotCreateShareFetched(const QString &reply) // there needs to be a password _ui->checkBox_password->setChecked(true); _ui->checkBox_password->setVisible(false); - _ui->label_password->setText(tr("Public shå requires a password:")); + _ui->checkBox_password->setText(tr("Public shå requires a password:")); _ui->lineEdit_password->setFocus(); _ui->widget_shareLink->show(); diff --git a/src/gui/sharedialog.ui b/src/gui/sharedialog.ui index c3194b0e2..820bb97f6 100644 --- a/src/gui/sharedialog.ui +++ b/src/gui/sharedialog.ui @@ -6,20 +6,65 @@ <rect> <x>0</x> <y>0</y> - <width>403</width> - <height>296</height> + <width>372</width> + <height>241</height> </rect> </property> <property name="windowTitle"> <string>Share NewDocument.odt</string> </property> - <layout class="QGridLayout" name="gridLayout_4"> - <item row="4" column="0"> - <widget class="QLabel" name="errorLabel"> - <property name="text"> - <string>TextLabel</string> - </property> - </widget> + <layout class="QGridLayout" name="gridLayout_3"> + <item row="0" column="0" colspan="2"> + <layout class="QGridLayout" name="gridLayout"> + <item row="0" column="0" rowspan="2"> + <widget class="QLabel" name="label_icon"> + <property name="text"> + <string>TextLabel</string> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QLabel" name="label_name"> + <property name="sizePolicy"> + <sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="font"> + <font> + <weight>75</weight> + <bold>true</bold> + </font> + </property> + <property name="text"> + <string>share label</string> + </property> + </widget> + </item> + <item row="0" column="2" rowspan="2"> + <widget class="QProgressIndicator" name="pi_share" native="true"/> + </item> + <item row="1" column="1"> + <widget class="QLabel" name="label_sharePath"> + <property name="sizePolicy"> + <sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="font"> + <font> + <weight>50</weight> + <bold>false</bold> + </font> + </property> + <property name="text"> + <string>ownCloud Path:</string> + </property> + </widget> + </item> + </layout> </item> <item row="1" column="0"> <layout class="QHBoxLayout" name="horizontalLayout_shareLink"> @@ -34,9 +79,12 @@ </item> <item row="2" column="0" colspan="2"> <widget class="QWidget" name="widget_shareLink" native="true"> - <layout class="QGridLayout" name="gridLayout_3"> + <layout class="QGridLayout" name="gridLayout_2"> + <property name="leftMargin"> + <number>20</number> + </property> <property name="topMargin"> - <number>0</number> + <number>1</number> </property> <item row="0" column="0"> <layout class="QHBoxLayout" name="horizontalLayout_3"> @@ -79,30 +127,36 @@ <item> <widget class="QCheckBox" name="checkBox_password"> <property name="sizePolicy"> - <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> + <sizepolicy hsizetype="Maximum" vsizetype="Maximum"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> <property name="text"> - <string/> + <string>Set password</string> </property> </widget> </item> <item> - <widget class="QLabel" name="label_password"> - <property name="text"> - <string>Set p&assword</string> + <spacer name="horizontalSpacer_3"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> </property> - <property name="buddy"> - <cstring>checkBox_password</cstring> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> </property> - </widget> + </spacer> </item> </layout> </item> <item row="2" column="0"> - <layout class="QHBoxLayout" name="horizontalLayout_14"> + <layout class="QHBoxLayout" name="horizontalLayout"> + <property name="leftMargin"> + <number>20</number> + </property> <item> <widget class="QLineEdit" name="lineEdit_password"> <property name="echoMode"> @@ -112,6 +166,12 @@ </item> <item> <widget class="QPushButton" name="pushButton_setPassword"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> <property name="text"> <string>Set &Password</string> </property> @@ -120,7 +180,10 @@ </layout> </item> <item row="3" column="0"> - <layout class="QHBoxLayout" name="horizontalLayout"> + <layout class="QHBoxLayout" name="horizontalLayout_2"> + <property name="leftMargin"> + <number>0</number> + </property> <item> <widget class="QCheckBox" name="checkBox_expire"> <property name="text"> @@ -140,80 +203,6 @@ </layout> </widget> </item> - <item row="5" column="0"> - <widget class="QDialogButtonBox" name="buttonBox"> - <property name="standardButtons"> - <set>QDialogButtonBox::Close</set> - </property> - </widget> - </item> - <item row="0" column="0" colspan="2"> - <widget class="QGroupBox" name="groupBox"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="title"> - <string>Share Info</string> - </property> - <layout class="QGridLayout" name="gridLayout_2"> - <item row="0" column="0"> - <layout class="QGridLayout" name="gridLayout"> - <item row="0" column="0" rowspan="2"> - <widget class="QLabel" name="label_icon"> - <property name="text"> - <string>TextLabel</string> - </property> - </widget> - </item> - <item row="0" column="1"> - <widget class="QLabel" name="label_name"> - <property name="sizePolicy"> - <sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="font"> - <font> - <weight>75</weight> - <bold>true</bold> - </font> - </property> - <property name="text"> - <string>share label</string> - </property> - </widget> - </item> - <item row="0" column="2" rowspan="2"> - <widget class="QProgressIndicator" name="pi_share" native="true"/> - </item> - <item row="1" column="1"> - <widget class="QLabel" name="label_sharePath"> - <property name="sizePolicy"> - <sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="font"> - <font> - <weight>50</weight> - <bold>false</bold> - </font> - </property> - <property name="text"> - <string>ownCloud Path:</string> - </property> - </widget> - </item> - </layout> - </item> - </layout> - </widget> - </item> <item row="3" column="1"> <spacer name="verticalSpacer"> <property name="orientation"> @@ -227,7 +216,39 @@ </property> </spacer> </item> + <item row="4" column="0"> + <widget class="QLabel" name="errorLabel"> + <property name="sizePolicy"> + <sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>TextLabel</string> + </property> + </widget> + </item> + <item row="5" column="0" colspan="2"> + <widget class="QDialogButtonBox" name="buttonBox"> + <property name="sizePolicy"> + <sizepolicy hsizetype="MinimumExpanding" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="standardButtons"> + <set>QDialogButtonBox::Close</set> + </property> + </widget> + </item> </layout> + <zorder>errorLabel</zorder> + <zorder>widget_shareLink</zorder> + <zorder>buttonBox</zorder> + <zorder>checkBox_password</zorder> + <zorder>layoutWidget</zorder> + <zorder>verticalSpacer</zorder> </widget> <layoutdefault spacing="6" margin="11"/> <customwidgets> |