r17820 by craig - Add a progress bar for downloading spelling dictionaries

scribus-commit scribus-commit at lists.scribus.net
Thu Oct 25 20:10:23 UTC 2012


Author: craig
Date: Thu Oct 25 20:10:23 2012
New Revision: 17820

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=17820
Log:
Add a progress bar for downloading spelling dictionaries

Modified:
    branches/Version14x/Scribus/scribus/downloadmanager/scdlmgr.cpp
    branches/Version14x/Scribus/scribus/hysettings.cpp
    branches/Version14x/Scribus/scribus/hysettings.h
    branches/Version14x/Scribus/scribus/hysettingsBase.ui
    branches/Version14x/Scribus/scribus/langmgr.cpp

Modified: branches/Version14x/Scribus/scribus/downloadmanager/scdlmgr.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17820&path=/branches/Version14x/Scribus/scribus/downloadmanager/scdlmgr.cpp
==============================================================================
--- branches/Version14x/Scribus/scribus/downloadmanager/scdlmgr.cpp (original)
+++ branches/Version14x/Scribus/scribus/downloadmanager/scdlmgr.cpp Thu Oct 25 20:10:23 2012
@@ -41,5 +41,5 @@
 void ScDLManager::updateText(const QString& t)
 {
 	emit fileReceived(t);
-	qDebug()<<t;
+	qDebug()<<"File Received:"<<t;
 }

Modified: branches/Version14x/Scribus/scribus/hysettings.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17820&path=/branches/Version14x/Scribus/scribus/hysettings.cpp
==============================================================================
--- branches/Version14x/Scribus/scribus/hysettings.cpp (original)
+++ branches/Version14x/Scribus/scribus/hysettings.cpp Thu Oct 25 20:10:23 2012
@@ -17,6 +17,8 @@
 #include <QDomDocument>
 #include <QHeaderView>
 #include <QInputDialog>
+#include <QLabel>
+#include <QProgressBar>
 #include <QTableWidgetItem>
 
 extern ScribusQApp* ScQApp;
@@ -35,7 +37,8 @@
 	}
 	updateDictList();
 	setAvailDictsXMLFile(downloadLocation + "scribus_spell_dicts.xml");
-	
+	downloadProgressBar->setVisible(false);
+	dlLabel->setVisible(false);
 	buttonExceptAdd->setIcon(QIcon(loadIcon("16/list-add.png")));
 	buttonExceptEdit->setEnabled(false);
 	buttonExceptRemove->setIcon(QIcon(loadIcon("16/list-remove.png")));
@@ -176,8 +179,12 @@
 			dlLangs<<availDictTableWidget->item(i,1)->text();
 	}
 	qDebug()<<dlLangs;
+
+	downloadList.clear();
+	downloadProgressBar->setValue(0);
+	downloadProgressBar->setVisible(true);
+	dlLabel->setVisible(true);
 	int i=0;
-	downloadList.clear();
 	foreach(DictData d, dictList)
 	{
 		if (dlLangs.contains(d.lang))
@@ -193,15 +200,20 @@
 				//qDebug()<<d.url<<d.files;
 				QStringList plainURLs(d.files.split(";", QString::SkipEmptyParts));
 				foreach (QString s, plainURLs)
+				{
 					ScQApp->dlManager()->addURL(d.url+"/"+s, true, downloadLocation);
+					++i;
+				}
 				downloadList.append(d);
-				++i;
 			}
 		}
 	}
 	if (i>0)
 	{
+		qDebug()<<"Files to download:"<<i;
+		downloadProgressBar->setRange(0, i);
 		connect(ScQApp->dlManager(), SIGNAL(finished()), this, SLOT(downloadSpellDictsFinished()));
+		connect(ScQApp->dlManager(), SIGNAL(fileReceived(const QString&)), this, SLOT(updateProgressBar()));
 		ScQApp->dlManager()->startDownloads();
 	}
 }
@@ -288,6 +300,14 @@
 		}
 	}
 	updateDictList();
+	downloadProgressBar->setValue(0);
+	downloadProgressBar->setVisible(false);
+	dlLabel->setVisible(false);
+}
+
+void HySettings::updateProgressBar()
+{
+	downloadProgressBar->setValue(downloadProgressBar->value()+1);
 }
 
 void HySettings::setAvailDictsXMLFile(QString availDictsXMLDataFile)

Modified: branches/Version14x/Scribus/scribus/hysettings.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17820&path=/branches/Version14x/Scribus/scribus/hysettings.h
==============================================================================
--- branches/Version14x/Scribus/scribus/hysettings.h (original)
+++ branches/Version14x/Scribus/scribus/hysettings.h Thu Oct 25 20:10:23 2012
@@ -60,6 +60,7 @@
 	void updateAvailDictList();
 	void downloadDictListFinished();
 	void downloadSpellDictsFinished();
+	void updateProgressBar();
 	void setAvailDictsXMLFile(QString availDictsXMLDataFile);
 
 	protected:

Modified: branches/Version14x/Scribus/scribus/hysettingsBase.ui
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17820&path=/branches/Version14x/Scribus/scribus/hysettingsBase.ui
==============================================================================
--- branches/Version14x/Scribus/scribus/hysettingsBase.ui (original)
+++ branches/Version14x/Scribus/scribus/hysettingsBase.ui Thu Oct 25 20:10:23 2012
@@ -6,7 +6,7 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>720</width>
+    <width>724</width>
     <height>445</height>
    </rect>
   </property>
@@ -345,6 +345,26 @@
        <item>
         <layout class="QHBoxLayout" name="horizontalLayout">
          <item>
+          <widget class="QLabel" name="dlLabel">
+           <property name="text">
+            <string>Downloading</string>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <widget class="QProgressBar" name="downloadProgressBar">
+           <property name="value">
+            <number>0</number>
+           </property>
+           <property name="textVisible">
+            <bool>true</bool>
+           </property>
+           <property name="invertedAppearance">
+            <bool>false</bool>
+           </property>
+          </widget>
+         </item>
+         <item>
           <spacer name="horizontalSpacer">
            <property name="orientation">
             <enum>Qt::Horizontal</enum>

Modified: branches/Version14x/Scribus/scribus/langmgr.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17820&path=/branches/Version14x/Scribus/scribus/langmgr.cpp
==============================================================================
--- branches/Version14x/Scribus/scribus/langmgr.cpp (original)
+++ branches/Version14x/Scribus/scribus/langmgr.cpp Thu Oct 25 20:10:23 2012
@@ -89,6 +89,7 @@
 	langList.insert("es_ES",    langPair("Spanish",             QObject::tr( "Spanish" )) );
 	langList.insert("es_LA",    langPair("Spanish (Latin)",     QObject::tr( "Spanish (Latin)" )) );
 	langList.insert("et",       langPair("Estonian",            QObject::tr( "Estonian" )) );
+	langList.insert("et_EE",    langPair("Estonian",            QObject::tr( "Estonian" )) );
 	langList.insert("eu",       langPair("Basque",              QObject::tr( "Basque" )) );
 	langList.insert("fi",       langPair("Finnish",             QObject::tr( "Finnish" )) );
 	langList.insert("fr",       langPair("French",              QObject::tr( "French" )) );
@@ -97,6 +98,7 @@
 	langList.insert("he",       langPair("Hebrew",              QObject::tr( "Hebrew" )) );
 	langList.insert("hr",       langPair("Croatian",            QObject::tr( "Croatian" )) );
 	langList.insert("hu",       langPair("Hungarian",           QObject::tr( "Hungarian" )) );
+	langList.insert("hu_HU",    langPair("Hungarian",           QObject::tr( "Hungarian" )) );
 	langList.insert("ia",       langPair("Latin",               QObject::tr( "Latin" )) );
 	langList.insert("id",       langPair("Indonesian",          QObject::tr( "Indonesian" )) );
 	langList.insert("is",       langPair("Icelandic",           QObject::tr( "Icelandic" )) );
@@ -111,9 +113,11 @@
 	langList.insert("lo",       langPair("Lao",                 QObject::tr( "Lao" )) );
 	langList.insert("lt",       langPair("Lithuanian",          QObject::tr( "Lithuanian" )) );
 	langList.insert("lt_LT",    langPair("Lithuanian",          QObject::tr( "Lithuanian" )) );
+	langList.insert("ne_NP",    langPair("Nepali",              QObject::tr( "Nepali" )) );
 	langList.insert("nb",       langPair("Norwegian (Bokmål)",  QObject::trUtf8( "Norwegian (Bokm\303\245l)" )) );
 	langList.insert("nb_NO",    langPair("Norwegian (Bokmål)",  QObject::trUtf8( "Norwegian (Bokm\303\245l)" )) );
 	langList.insert("nl",       langPair("Dutch",               QObject::tr( "Dutch" )) );
+	langList.insert("nl_NL",    langPair("Dutch",               QObject::tr( "Dutch" )) );
 	langList.insert("nn",       langPair("Norwegian (Nnyorsk)", QObject::tr( "Norwegian (Nnyorsk)" )) );
 	langList.insert("nn_NO",    langPair("Norwegian (Nnyorsk)", QObject::tr( "Norwegian (Nnyorsk)" )) );
 	langList.insert("no",       langPair("Norwegian",           QObject::tr( "Norwegian" )) );
@@ -124,10 +128,12 @@
 	langList.insert("pt_BR",    langPair("Portuguese (BR)",     QObject::tr( "Portuguese (BR)" )) );
 	langList.insert("ro",       langPair("Romanian",            QObject::tr( "Romanian" )) );
 	langList.insert("ru",       langPair("Russian",             QObject::tr( "Russian" )) );
+	langList.insert("ru_RU",    langPair("Russian",             QObject::tr( "Russian" )) );
 	langList.insert("sa",       langPair("Sanskrit",            QObject::tr( "Sanskrit" )) );
 	langList.insert("sk",       langPair("Slovak",              QObject::tr( "Slovak" )) );
 	langList.insert("sk_SK",    langPair("Slovak",              QObject::tr( "Slovak" )) );
 	langList.insert("sl",       langPair("Slovenian",           QObject::tr( "Slovenian" )) );
+	langList.insert("sl_SL",    langPair("Slovenian",           QObject::tr( "Slovenian" )) );
 	langList.insert("sq",       langPair("Albanian",            QObject::tr( "Albanian" )) );
 	langList.insert("sr",       langPair("Serbian",             QObject::tr( "Serbian" )) );
 	langList.insert("sv",       langPair("Swedish",             QObject::tr( "Swedish" )) );




More information about the scribus-commit mailing list