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

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


Author: craig
Date: Thu Oct 25 20:10:14 2012
New Revision: 17819

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

Modified:
    trunk/Scribus/scribus/downloadmanager/scdlmgr.cpp
    trunk/Scribus/scribus/langmgr.cpp
    trunk/Scribus/scribus/ui/prefs_spelling.cpp
    trunk/Scribus/scribus/ui/prefs_spelling.h
    trunk/Scribus/scribus/ui/prefs_spellingbase.ui

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

Modified: trunk/Scribus/scribus/langmgr.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17819&path=/trunk/Scribus/scribus/langmgr.cpp
==============================================================================
--- trunk/Scribus/scribus/langmgr.cpp (original)
+++ trunk/Scribus/scribus/langmgr.cpp Thu Oct 25 20:10:14 2012
@@ -91,14 +91,14 @@
 	langTable.append(LangDef("es",     "es_ES", "Spanish",                QObject::tr( "Spanish" )) );
 	langTable.append(LangDef("es_AR",  "",      "Spanish (Argentina)",    QObject::tr( "Spanish (Argentina)" )) );
 	langTable.append(LangDef("es_LA",  "",      "Spanish (Latin)",        QObject::tr( "Spanish (Latin)" )) );
-	langTable.append(LangDef("et",     "",      "Estonian",               QObject::tr( "Estonian" )) );
+	langTable.append(LangDef("et",     "et_EE", "Estonian",               QObject::tr( "Estonian" )) );
 	langTable.append(LangDef("eu",     "",      "Basque",                 QObject::tr( "Basque" )) );
 	langTable.append(LangDef("fi",     "",      "Finnish",                QObject::tr( "Finnish" )) );
 	langTable.append(LangDef("fr",     "fr_FR", "French",                 QObject::tr( "French" )) );
 	langTable.append(LangDef("gl",     "",      "Galician",               QObject::tr( "Galician" )) );
 	langTable.append(LangDef("he",     "",      "Hebrew",                 QObject::tr( "Hebrew" )) );
 	langTable.append(LangDef("hr",     "",      "Croatian",               QObject::tr( "Croatian" )) );
-	langTable.append(LangDef("hu",     "",      "Hungarian",              QObject::tr( "Hungarian" )) );
+	langTable.append(LangDef("hu",     "hu_HU", "Hungarian",              QObject::tr( "Hungarian" )) );
 	langTable.append(LangDef("ia",     "",      "Latin",                  QObject::tr( "Latin" )) );
 	langTable.append(LangDef("id",     "",      "Indonesian",             QObject::tr( "Indonesian" )) );
 	langTable.append(LangDef("is",     "",      "Icelandic",              QObject::tr( "Icelandic" )) );
@@ -111,18 +111,19 @@
 	langTable.append(LangDef("lb",     "",      "Luxembourgish",          QObject::tr( "Luxembourgish" )) );
 	langTable.append(LangDef("lo",     "",      "Lao",                    QObject::tr( "Lao" )) );
 	langTable.append(LangDef("lt",     "lt_LT", "Lithuanian",             QObject::tr( "Lithuanian" )) );
+	langTable.append(LangDef("ne_NP",  "",      "Nepali",                  QObject::tr( "Nepali" )) );
 	langTable.append(LangDef("nb",     "nb_NO", "Norwegian (Bokmål)",     QObject::trUtf8( "Norwegian (Bokm\303\245l)" )) );
-	langTable.append(LangDef("nl",     "",      "Dutch",                  QObject::tr( "Dutch" )) );
+	langTable.append(LangDef("nl",     "nl_NL", "Dutch",                  QObject::tr( "Dutch" )) );
 	langTable.append(LangDef("nn",     "nn_NO", "Norwegian (Nnyorsk)",    QObject::tr( "Norwegian (Nnyorsk)" )) );
 	langTable.append(LangDef("no",     "no_NO", "Norwegian",              QObject::tr( "Norwegian" )) );
 	langTable.append(LangDef("pl",     "pl_PL", "Polish",                 QObject::tr( "Polish" )) );
 	langTable.append(LangDef("pt",     "",      "Portuguese",             QObject::tr( "Portuguese" )) );
 	langTable.append(LangDef("pt_BR",  "",      "Portuguese (BR)",        QObject::tr( "Portuguese (BR)" )) );
 	langTable.append(LangDef("ro",     "",      "Romanian",               QObject::tr( "Romanian" )) );
-	langTable.append(LangDef("ru",     "",      "Russian",                QObject::tr( "Russian" )) );
+	langTable.append(LangDef("ru",     "ru_RU", "Russian",                QObject::tr( "Russian" )) );
 	langTable.append(LangDef("sa",     "",      "Sanskrit",               QObject::tr( "Sanskrit" )) );
 	langTable.append(LangDef("sk",     "sk_SK", "Slovak",                 QObject::tr( "Slovak" )) );
-	langTable.append(LangDef("sl",     "",      "Slovenian",              QObject::tr( "Slovenian" )) );
+	langTable.append(LangDef("sl",     "sl_SL", "Slovenian",              QObject::tr( "Slovenian" )) );
 	langTable.append(LangDef("sq",     "",      "Albanian",               QObject::tr( "Albanian" )) );
 	langTable.append(LangDef("sr",     "",      "Serbian",                QObject::tr( "Serbian" )) );
 	langTable.append(LangDef("sv",     "",      "Swedish",                QObject::tr( "Swedish" )) );

Modified: trunk/Scribus/scribus/ui/prefs_spelling.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17819&path=/trunk/Scribus/scribus/ui/prefs_spelling.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/prefs_spelling.cpp (original)
+++ trunk/Scribus/scribus/ui/prefs_spelling.cpp Thu Oct 25 20:10:14 2012
@@ -8,7 +8,8 @@
 #include <QDomDocument>
 #include <QHeaderView>
 #include <QInputDialog>
-#include <QInputDialog>
+#include <QLabel>
+#include <QProgressBar>
 #include <QListWidget>
 #include <QTableWidgetItem>
 #include <QTextCodec>
@@ -38,7 +39,8 @@
 	updateDictList();
 	downloadLocation=ScPaths::downloadDir();
 	setAvailDictsXMLFile(downloadLocation + "scribus_spell_dicts.xml");
-
+	downloadProgressBar->setVisible(false);
+	dlLabel->setVisible(false);
 	connect(spellDownloadButton, SIGNAL(clicked()), this, SLOT(downloadSpellDicts()));
 	connect(availListDownloadButton, SIGNAL(clicked()), this, SLOT(updateAvailDictList()));
 }
@@ -71,8 +73,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))
@@ -88,15 +94,19 @@
 				//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)
 	{
+		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();
 	}
 }
@@ -184,6 +194,14 @@
 	}
 
 	updateDictList();
+	downloadProgressBar->setValue(0);
+	downloadProgressBar->setVisible(false);
+	dlLabel->setVisible(false);
+}
+
+void Prefs_Spelling::updateProgressBar()
+{
+	downloadProgressBar->setValue(downloadProgressBar->value()+1);
 }
 
 void Prefs_Spelling::setAvailDictsXMLFile(QString availDictsXMLDataFile)

Modified: trunk/Scribus/scribus/ui/prefs_spelling.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17819&path=/trunk/Scribus/scribus/ui/prefs_spelling.h
==============================================================================
--- trunk/Scribus/scribus/ui/prefs_spelling.h (original)
+++ trunk/Scribus/scribus/ui/prefs_spelling.h Thu Oct 25 20:10:14 2012
@@ -45,6 +45,7 @@
 		void updateAvailDictList();
 		void downloadDictListFinished();
 		void downloadSpellDictsFinished();
+		void updateProgressBar();
 		void setAvailDictsXMLFile(QString availDictsXMLDataFile);
 
 	protected:

Modified: trunk/Scribus/scribus/ui/prefs_spellingbase.ui
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17819&path=/trunk/Scribus/scribus/ui/prefs_spellingbase.ui
==============================================================================
--- trunk/Scribus/scribus/ui/prefs_spellingbase.ui (original)
+++ trunk/Scribus/scribus/ui/prefs_spellingbase.ui Thu Oct 25 20:10:14 2012
@@ -6,8 +6,8 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>667</width>
-    <height>299</height>
+    <width>730</width>
+    <height>304</height>
    </rect>
   </property>
   <property name="windowTitle">
@@ -45,8 +45,8 @@
        <rect>
         <x>0</x>
         <y>0</y>
-        <width>641</width>
-        <height>231</height>
+        <width>704</width>
+        <height>236</height>
        </rect>
       </property>
       <layout class="QVBoxLayout" name="verticalLayout_4">
@@ -93,6 +93,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>




More information about the scribus-commit mailing list