[Pkg-owncloud-commits] [owncloud-client] 132/484: Network Settings: Adjust the bandwidth limit option with old Qt

Sandro Knauß hefee-guest at moszumanska.debian.org
Wed Dec 16 00:37:29 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 6a0633083d5dc3823439e4648573b6cc319c679b
Author: Olivier Goffart <ogoffart at woboq.com>
Date:   Thu Oct 22 17:57:34 2015 +0200

    Network Settings: Adjust the bandwidth limit option with old Qt
    
    - Disable the whole group box
    - Add a tooltip explaining why it is disabled
    - Make sure it is disabled in the settings in case of upgrade
    - Do a runtime check in case the running Qt is greater
---
 src/gui/networksettings.cpp | 32 +++++++++++++++++++-------------
 src/gui/networksettings.ui  | 10 +++++-----
 2 files changed, 24 insertions(+), 18 deletions(-)

diff --git a/src/gui/networksettings.cpp b/src/gui/networksettings.cpp
index 2c5a22a..6a21f04 100644
--- a/src/gui/networksettings.cpp
+++ b/src/gui/networksettings.cpp
@@ -117,23 +117,29 @@ void NetworkSettings::loadProxySettings()
 
 void NetworkSettings::loadBWLimitSettings()
 {
+    ConfigFile cfgFile;
+
 #if QT_VERSION < QT_VERSION_CHECK(5,3,3)
-    // QNAM bandwith limiting only works with versions of Qt greater or equal to 5.3.3
+    // QNAM bandwidth limiting only works with versions of Qt greater or equal to 5.3.3
     // (It needs Qt commits 097b641 and b99fa32)
-    _ui->noDownloadLimitRadioButton->setChecked(true);
-    _ui->downloadLimitRadioButton->setEnabled(false);
-    _ui->noDownloadLimitRadioButton->setEnabled(false);
-    _ui->autoDownloadLimitRadioButton->setEnabled(false);
-
-    _ui->noUploadLimitRadioButton->setChecked(true);
-    _ui->uploadLimitRadioButton->setEnabled(false);
-    _ui->noUploadLimitRadioButton->setEnabled(false);
-    _ui->autoUploadLimitRadioButton->setEnabled(false);
-    return;
-#endif
 
-    ConfigFile cfgFile;
+    const char *v = qVersion(); // "x.y.z";
+    if (QLatin1String(v) < QLatin1String("5.3.3")) {
+        QString tooltip = tr("Qt >= 5.4 is required in order to use the bandwidth limit");
+        _ui->downloadBox->setEnabled(false);
+        _ui->uploadBox->setEnabled(false);
+        _ui->downloadBox->setToolTip(tooltip);
+        _ui->uploadBox->setToolTip(tooltip);
+        _ui->noDownloadLimitRadioButton->setChecked(true);
+        _ui->noUploadLimitRadioButton->setChecked(true);
+        if (cfgFile.useUploadLimit() != 0 || cfgFile.useDownloadLimit() != 0) {
+            // Update from old mirall that was using neon propagator jobs.
+            saveBWLimitSettings();
+        }
+        return;
+    }
 
+#endif
     int useDownloadLimit = cfgFile.useDownloadLimit();
     if ( useDownloadLimit >= 1 ) {
         _ui->downloadLimitRadioButton->setChecked(true);
diff --git a/src/gui/networksettings.ui b/src/gui/networksettings.ui
index 9e4e319..60c5ae9 100644
--- a/src/gui/networksettings.ui
+++ b/src/gui/networksettings.ui
@@ -179,7 +179,7 @@
    <item row="1" column="0">
     <layout class="QHBoxLayout" name="horizontalLayout_5">
      <item>
-      <widget class="QGroupBox" name="groupBox">
+      <widget class="QGroupBox" name="downloadBox">
        <property name="sizePolicy">
         <sizepolicy hsizetype="Preferred" vsizetype="Maximum">
          <horstretch>0</horstretch>
@@ -258,7 +258,7 @@
       </widget>
      </item>
      <item>
-      <widget class="QGroupBox" name="groupBox_2">
+      <widget class="QGroupBox" name="uploadBox">
        <property name="sizePolicy">
         <sizepolicy hsizetype="Preferred" vsizetype="Maximum">
          <horstretch>0</horstretch>
@@ -284,9 +284,6 @@
           <property name="text">
            <string>Limit automatically</string>
           </property>
-          <property name="checked">
-           <bool>true</bool>
-          </property>
          </widget>
         </item>
         <item row="0" column="0" colspan="2">
@@ -294,6 +291,9 @@
           <property name="text">
            <string>No limit</string>
           </property>
+          <property name="checked">
+           <bool>true</bool>
+          </property>
          </widget>
         </item>
         <item row="2" column="1">

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