[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdenetwork/kget/ui
From:       Matthias Fuchs <mat69 () gmx ! net>
Date:       2009-12-13 23:36:50
Message-ID: 1260747410.591440.8153.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 1062156 by mfuchs:

*Metalink accepts a minimum priority of 999999 now.
*Hack: Changes text to "Priority", whithout adding a String.
*Removes some whitespaces.

 M  +1 -1      metalinkcreator/generalwidget.cpp  
 M  +4 -5      metalinkcreator/generalwidget.h  
 M  +11 -12    metalinkcreator/metalinker.cpp  
 M  +9 -9      metalinkcreator/metalinker.h  
 M  +6 -6      mirror/mirroradddlg.ui  
 M  +2 -2      mirror/mirrormodel.cpp  
 M  +4 -0      mirror/mirrorsettings.cpp  


--- trunk/KDE/kdenetwork/kget/ui/metalinkcreator/generalwidget.cpp #1062155:1062156
@@ -29,7 +29,7 @@
     ui.setupUi(this);
 
     ui.dynamic->setToolTip(ui.labelDynamic->toolTip());
-    
+
     connect(ui.publishedGroupBox, SIGNAL(toggled(bool)), this, \
                SLOT(slotPublishedEnabled(bool)));
     connect(ui.updatedGroupBox, SIGNAL(toggled(bool)), this, \
SLOT(slotUpdatedEnabled(bool)));  }
--- trunk/KDE/kdenetwork/kget/ui/metalinkcreator/generalwidget.h #1062155:1062156
@@ -35,24 +35,23 @@
 
     public:
         GeneralWidget(QWidget *parent = 0);
-        
+
         void load(const KGetMetalink::Metalink &metalink) const;
         void save(KGetMetalink::Metalink *metalink);
-        
+
     private slots:
         /**
          * To correctly enable checkboxes
          */
         void slotPublishedEnabled(bool enabled);
-        
+
         /**
          * To correctly enable checkboxes
          */
         void slotUpdatedEnabled(bool enabled);
-        
+
     private:
         Ui::GeneralWidget ui;
-        
 };
 
 #endif
\ No newline at end of file
--- trunk/KDE/kdenetwork/kget/ui/metalinkcreator/metalinker.cpp #1062155:1062156
@@ -33,7 +33,8 @@
 #endif //HAVE_NEPOMUK
 
 const QString KGetMetalink::Metalink::KGET_DESCRIPTION = QString(QString("KGet ") + \
"2." + QString::number(KDE_VERSION_MINOR) + '.' + \
                QString::number(KDE_VERSION_RELEASE));
-const quint16 KGetMetalink::Metalink::MAX_URL_PRIORITY = 255;
+const uint KGetMetalink::Metalink::MAX_URL_PRIORITY = 999999;
+const uint KGetMetalink::Metalink_v3::MAX_PREFERENCE = 100;//as defined in Metalink \
specification 3.0 2nd edition  
 namespace KGetMetalink
 {
@@ -711,8 +712,6 @@
     files.clear();
 }
 
-const quint16 KGetMetalink::Metalink_v3::MAX_PREFERENCE = 100;//as defined in \
                Metalink specification 3.0 2nd edition
-
 KGetMetalink::Metalink_v3::Metalink_v3()
 {
 }
@@ -749,7 +748,7 @@
 
     const QDomElement filesElem = e.firstChildElement("files");
     CommonData filesData = parseCommonData(filesElem);
-    
+
     inheritCommonData(data, &filesData);
 
     for (QDomElement elem = filesElem.firstChildElement("file"); !elem.isNull(); \
elem = elem.nextSiblingElement("file")) { @@ -814,7 +813,7 @@
     if (!inheritor) {
         return;
     }
-    
+
     //ensure that inheritance works
     if (inheritor->identity.isEmpty()) {
         inheritor->identity = ancestor.identity;
@@ -853,7 +852,7 @@
     for (QDomElement elemRes = res.firstChildElement("url"); !elemRes.isNull(); \
elemRes = elemRes.nextSiblingElement("url")) {  const QString location = \
elemRes.attribute("location").toLower();  
-        quint16 preference = elemRes.attribute("preference").toUInt();
+        uint preference = elemRes.attribute("preference").toUInt();
         //the maximum preference we use is MAX_PREFERENCE
         if (preference > MAX_PREFERENCE) {
             preference = MAX_PREFERENCE;
@@ -862,7 +861,7 @@
 
         const KUrl link = KUrl(elemRes.text());
         QString type;
-        
+
         if (link.fileName().endsWith(QLatin1String(".torrent"))) {
             type = "torrent";
         }
@@ -910,7 +909,7 @@
 
     //Date according to RFC 822, the year with four characters preferred
     //e.g.: "Mon, 15 May 2006 00:00:01 GMT", "Fri, 01 Apr 2009 00:00:01 +1030"
-    
+
     //find the date
     const QString weekdayExp = "ddd, ";
     const bool weekdayIncluded = (temp.indexOf(',') == 3);
@@ -953,7 +952,7 @@
         }
     }
     dateTime.setTime(time);
-    
+
     //find the offset
     temp = temp.mid(length + 1);//also remove the space
     bool negativeOffset = false;
@@ -1036,7 +1035,7 @@
 
     foreach (const Url &url, resources.urls) {
         QDomElement elem = doc.createElement("url");
-        const quint16 priority = url.priority;
+        const uint priority = url.priority;
         if (priority) {
             int preference = MAX_PREFERENCE - priority + 1;
             if (preference <= 0) {
@@ -1058,7 +1057,7 @@
         if (metaurl.type == "torrent") {
             QDomElement elem = doc.createElement("url");
             elem.setAttribute("type", "bittorrent");
-            const quint16 priority = metaurl.priority;
+            const uint priority = metaurl.priority;
             if (priority) {
                 int preference = MAX_PREFERENCE - priority + 1;
                 if (preference <= 0) {
@@ -1176,7 +1175,7 @@
     if (!date.isValid()) {
         return dateString;
     }
-    
+
     QLocale locale = QLocale::c();
 
     //"Fri, 01 Apr 2009 00:00:01 +1030"
--- trunk/KDE/kdenetwork/kget/ui/metalinkcreator/metalinker.h #1062155:1062156
@@ -137,10 +137,10 @@
         QString type;
 
         /**
-         * the priority of the urls, 1 is highest priority, 255 lowest
-         * default is 0 as in not set and thus is ranked even behind 255
+         * the priority of the urls, 1 is highest priority, 999999 lowest
+         * default is 0 as in not set and thus is ranked even behind 999999
          */
-        quint16 priority;
+        uint priority;
 
         /**
          * Optional the name of a file that should be get of that metaurl
@@ -171,10 +171,10 @@
         void clear();
 
         /**
-         * the priority of the urls, 1 is highest priority, 255 lowest
-         * default is 0 as in not set and thus is ranked even behind 255
+         * the priority of the urls, 1 is highest priority, 999999 lowest
+         * default is 0 as in not set and thus is ranked even behind 999999
          */
-        quint16 priority;
+        uint priority;
 
         /**
          * the location of the server eg. "uk"
@@ -319,7 +319,7 @@
         Files files;
 
         static const QString KGET_DESCRIPTION;
-        static const quint16 MAX_URL_PRIORITY; //maximum pirority a Metalink 4.0 Url \
or Metaurl can have, not to be mixed up with the highest priority +        static \
const uint MAX_URL_PRIORITY; //maximum pirority a Metalink 4.0 Url or Metaurl can \
have, not to be mixed up with the highest priority  };
 
 /**
@@ -348,7 +348,7 @@
         Resources parseResources(const QDomElement &e);
         DateConstruct parseDateConstruct(const QString &data);
         CommonData parseCommonData(const QDomElement &e);
-        
+
         /**
          * Inherits CommonData, the inheritor inherits every settings
          * from the ancestor it has not set itself
@@ -363,7 +363,7 @@
 
     private:
         Metalink m_metalink;
-        static const quint16 MAX_PREFERENCE;
+        static const uint MAX_PREFERENCE;
 };
 
 /**
--- trunk/KDE/kdenetwork/kget/ui/mirror/mirroradddlg.ui #1062155:1062156
@@ -76,7 +76,7 @@
         <number>0</number>
        </property>
        <property name="maximum">
-        <number>100</number>
+        <number>999999</number>
        </property>
        <property name="specialValueText">
         <string>not specified</string>
@@ -112,6 +112,11 @@
  </widget>
  <customwidgets>
   <customwidget>
+   <class>KLineEdit</class>
+   <extends>QLineEdit</extends>
+   <header>klineedit.h</header>
+  </customwidget>
+  <customwidget>
    <class>KComboBox</class>
    <extends>QComboBox</extends>
    <header>kcombobox.h</header>
@@ -121,11 +126,6 @@
    <extends>QWidget</extends>
    <header>knuminput.h</header>
   </customwidget>
-  <customwidget>
-   <class>KLineEdit</class>
-   <extends>QLineEdit</extends>
-   <header>klineedit.h</header>
-  </customwidget>
  </customwidgets>
  <resources/>
  <connections/>
--- trunk/KDE/kdenetwork/kget/ui/mirror/mirrormodel.cpp #1062155:1062156
@@ -64,7 +64,7 @@
         else if (index.column() == MirrorItem::Priority)
         {
             QSpinBox *preference = new QSpinBox(parent);
-            preference->setRange(0, 255);
+            preference->setRange(0, 999999);
 
             return preference;
         }
@@ -362,7 +362,7 @@
     if (orientation == Qt::Vertical) {
         return QVariant();
     }
-    
+
     if ((section == MirrorItem::Url) && (role == Qt::DisplayRole)) {
         return i18nc("Mirror as in server, in url", "Mirror");
     } else if (section == MirrorItem::Priority) {
--- trunk/KDE/kdenetwork/kget/ui/mirror/mirrorsettings.cpp #1062155:1062156
@@ -55,6 +55,10 @@
 
     ui.successLabel->hide();
 
+    //FIXME in 4.5 change the text to Priority once trunk opens again
+    //TODO also change Widget-Names to Priority instead of Preference
+    ui.labelPreference->setText(m_model->headerData(MirrorItem::Priority, \
Qt::Horizontal, Qt::DisplayRole).toString() + ':'); +
     setButtons(KDialog::Yes | KDialog::User1 | KDialog::Cancel);
     setButtonGuiItem(KDialog::Yes, KStandardGuiItem::add());
     setButtonGuiItem(KDialog::User1, KGuiItem(i18nc("Adds the item and reopens the \
dialog to add a further item", "Add more"), KIcon("list-add")));


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic