[Pkg-owncloud-commits] [owncloud-client] 02/218: AccountSettings: Adjust quota info design #3644 #3651

Sandro Knauß hefee-guest at moszumanska.debian.org
Sat Oct 17 14:30:30 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 92f6134ed38fd3d7fef2a7c99e0d335e1afcf9a6
Author: Christian Kamm <mail at ckamm.de>
Date:   Wed Aug 19 15:16:09 2015 +0200

    AccountSettings: Adjust quota info design #3644 #3651
---
 src/gui/accountsettings.cpp | 28 +++++-----------------------
 src/gui/accountsettings.ui  | 41 +++++++++++++++++++++++++----------------
 2 files changed, 30 insertions(+), 39 deletions(-)

diff --git a/src/gui/accountsettings.cpp b/src/gui/accountsettings.cpp
index 206db2d..a0e47f4 100644
--- a/src/gui/accountsettings.cpp
+++ b/src/gui/accountsettings.cpp
@@ -112,19 +112,6 @@ AccountSettings::AccountSettings(AccountState *accountState, QWidget *parent) :
     QColor color = palette().highlight().color();
     ui->quotaProgressBar->setStyleSheet(QString::fromLatin1(progressBarStyleC).arg(color.name()));
 
-    QFont smallFont = ui->quotaInfoLabel->font();
-    smallFont.setPointSize(smallFont.pointSize() * 0.8);
-    ui->quotaInfoLabel->setFont(smallFont);
-
-    _quotaLabel = new QLabel(ui->quotaProgressBar);
-    QVBoxLayout *quotaProgressLayout = new QVBoxLayout(ui->quotaProgressBar);
-    quotaProgressLayout->setContentsMargins(-1,0,-1,0);
-    quotaProgressLayout->setSpacing(0);
-    quotaProgressLayout->addWidget(_quotaLabel);
-
-    // This ensures the progress bar is big enough for the label.
-    ui->quotaProgressBar->setMinimumHeight(_quotaLabel->height());
-
     ui->connectLabel->setText(tr("No account configured."));
 
     connect(_accountState, SIGNAL(stateChanged(int)), SLOT(slotAccountStateChanged(int)));
@@ -419,25 +406,20 @@ void AccountSettings::slotOpenOC()
 void AccountSettings::slotUpdateQuota(qint64 total, qint64 used)
 {
     if( total > 0 ) {
-        ui->storageGroupBox->setVisible(true);
         ui->quotaProgressBar->setVisible(true);
-        ui->quotaInfoLabel->setVisible(true);
         ui->quotaProgressBar->setEnabled(true);
         // workaround the label only accepting ints (which may be only 32 bit wide)
         ui->quotaProgressBar->setMaximum(100);
-        int qVal = qRound(used/(double)total * 100);
-        if( qVal > 100 ) qVal = 100;
-        ui->quotaProgressBar->setValue(qVal);
+        const double percent = used/(double)total*100;
+        const int percentInt = qMin(qRound(percent), 100);
+        ui->quotaProgressBar->setValue(percentInt);
         QString usedStr = Utility::octetsToString(used);
         QString totalStr = Utility::octetsToString(total);
-        double percent = used/(double)total*100;
         QString percentStr = Utility::compactFormatDouble(percent, 1);
-        _quotaLabel->setText(tr("%1 (%3%) of %2 server space in use.").arg(usedStr, totalStr, percentStr));
+        ui->quotaInfoLabel->setText(tr("Storage space: %1 (%3%) of %2 in use").arg(usedStr, totalStr, percentStr));
     } else {
-        ui->storageGroupBox->setVisible(false);
-        ui->quotaInfoLabel->setVisible(false);
         ui->quotaProgressBar->setMaximum(0);
-        _quotaLabel->setText(tr("Currently there is no storage usage information available."));
+        ui->quotaInfoLabel->setText(tr("Currently there is no storage usage information available."));
     }
 }
 
diff --git a/src/gui/accountsettings.ui b/src/gui/accountsettings.ui
index 69e4958..a1ce6de 100644
--- a/src/gui/accountsettings.ui
+++ b/src/gui/accountsettings.ui
@@ -81,10 +81,35 @@
      </property>
      <layout class="QVBoxLayout" name="verticalLayout_2">
       <item>
+       <widget class="QLabel" name="quotaInfoLabel">
+        <property name="sizePolicy">
+         <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
+          <horstretch>0</horstretch>
+          <verstretch>0</verstretch>
+         </sizepolicy>
+        </property>
+        <property name="toolTip">
+         <string>Some folders, including network mounted or shared folders, might have different limits.</string>
+        </property>
+        <property name="text">
+         <string>Storage space: ...</string>
+        </property>
+        <property name="wordWrap">
+         <bool>true</bool>
+        </property>
+       </widget>
+      </item>
+      <item>
        <widget class="QProgressBar" name="quotaProgressBar">
         <property name="enabled">
          <bool>false</bool>
         </property>
+        <property name="maximumSize">
+         <size>
+          <width>16777215</width>
+          <height>7</height>
+         </size>
+        </property>
         <property name="maximum">
          <number>0</number>
         </property>
@@ -96,22 +121,6 @@
         </property>
        </widget>
       </item>
-      <item>
-       <widget class="QLabel" name="quotaInfoLabel">
-        <property name="sizePolicy">
-         <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
-          <horstretch>0</horstretch>
-          <verstretch>0</verstretch>
-         </sizepolicy>
-        </property>
-        <property name="text">
-         <string>Some folders, including network mounted or shared folders, might have different limits.</string>
-        </property>
-        <property name="wordWrap">
-         <bool>true</bool>
-        </property>
-       </widget>
-      </item>
      </layout>
     </widget>
    </item>

-- 
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