r19800 by craig - Add Hyphenation dictionary download capability
scribus-commit
scribus-commit at lists.scribus.net
Sat Feb 7 22:38:16 UTC 2015
Author: craig
Date: Sat Feb 7 22:38:16 2015
New Revision: 19800
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=19800
Log:
Add Hyphenation dictionary download capability
Modified:
trunk/Scribus/scribus/langmgr.cpp
trunk/Scribus/scribus/langmgr.h
trunk/Scribus/scribus/scpaths.cpp
trunk/Scribus/scribus/scpaths.h
trunk/Scribus/scribus/scribus.cpp
trunk/Scribus/scribus/ui/prefs_hyphenator.cpp
trunk/Scribus/scribus/ui/prefs_hyphenator.h
trunk/Scribus/scribus/ui/prefs_spelling.cpp
trunk/Scribus/scribus/ui/prefs_spelling.h
Modified: trunk/Scribus/scribus/langmgr.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19800&path=/trunk/Scribus/scribus/langmgr.cpp
==============================================================================
--- trunk/Scribus/scribus/langmgr.cpp (original)
+++ trunk/Scribus/scribus/langmgr.cpp Sat Feb 7 22:38:16 2015
@@ -114,7 +114,7 @@
langTable.append(LangDef("en_ZA", "", "English (South Africa)", QObject::tr( "English (South Africa)" )) );
langTable.append(LangDef("eo", "", "Esperanto", QObject::tr( "Esperanto" )) );
langTable.append(LangDef("es", "es_ES", "Spanish", QObject::tr( "Spanish" )) );
- langTable.append(LangDef("es", "es_ANY", "Spanish", QObject::tr( "Spanish" )) );
+ langTable.append(LangDef("es", "es_ANY", "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", "et_EE", "Estonian", QObject::tr( "Estonian" )) );
@@ -139,7 +139,7 @@
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("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", "nl_NL", "Dutch", QObject::tr( "Dutch" )) );
langTable.append(LangDef("nn", "nn_NO", "Norwegian (Nnyorsk)", QObject::tr( "Norwegian (Nnyorsk)" )) );
@@ -154,7 +154,9 @@
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("sr-Latn","sr-Latn","Serbian (Latin)", QObject::tr( "Serbian (Latin)" )) );
langTable.append(LangDef("sv", "", "Swedish", QObject::tr( "Swedish" )) );
+ langTable.append(LangDef("te", "te_IN", "Telugu", QObject::tr( "Telugu" )) );
langTable.append(LangDef("th", "th_TH", "Thai", QObject::tr( "Thai" )) );
langTable.append(LangDef("tr", "tr_TR", "Turkish", QObject::tr( "Turkish" )) );
langTable.append(LangDef("uk", "uk_UA", "Ukranian", QObject::tr( "Ukranian" )) );
@@ -194,7 +196,7 @@
//Build our list of hyphenation dictionaries we have in the install dir
//Grab the language abbreviation from it, get the full language text
//Insert the name as key and a new string list into the map
- QString hyphDirName = QDir::toNativeSeparators(ScPaths::instance().dictDir());
+ QString hyphDirName = QDir::toNativeSeparators(ScPaths::instance().dictDir()+"/hyph");
QDir hyphDir(hyphDirName, "hyph*.dic", QDir::Name, QDir::Files | QDir::NoSymLinks);
if (!hyphDir.exists() || hyphDir.count() == 0)
{
@@ -553,6 +555,76 @@
}
}
+bool LanguageManager::findHyphDictionaries(QStringList& sl)
+{
+ sl=ScPaths::instance().hyphDirs();
+ if (sl.count()==0)
+ return false;
+ return true;
+}
+
+void LanguageManager::findHyphDictionarySets(QStringList& dictionaryPaths, QMap<QString, QString>& dictionaryMap)
+{
+ for (int i=0; i<dictionaryPaths.count(); ++i)
+ {
+ // Find the dic and aff files in the location
+ QDir dictLocation(dictionaryPaths.at(i));
+ QStringList dictFilters("hyph*.dic");
+ QStringList dictList(dictLocation.entryList(dictFilters, QDir::Files, QDir::Name));
+ dictList.replaceInStrings(".dic","");
+
+ //Ensure we have aff+dic file pairs, remove any hyphenation dictionaries from the list
+ foreach(QString dn, dictList)
+ {
+ QString dictName(dn.section('_',1));
+ if (!dictionaryMap.contains(dictName))
+ {
+ if (dictName.length()<=2)
+ {
+ QString shortAbbrev(LanguageManager::getShortAbbrevFromAbbrev(dictName));
+ dictionaryMap.insert(dictName, dictionaryPaths.at(i)+dn);
+ }
+ if (dictName.length()>2)
+ {
+ QString shortAbbrev(LanguageManager::getShortAbbrevFromAbbrev(dictName));
+ dictionaryMap.insert(shortAbbrev, dictionaryPaths.at(i)+dn);
+ }
+ }
+ }
+ }
+ /*
+ //Now rescan dictionary map for any extra languages we can support with the files we have
+ QMap<QString, QString>::iterator it = dictionaryMap.begin();
+ while (it != dictionaryMap.end())
+ {
+ QString lang(it.key());
+ if (lang.length()==5)
+ {
+ QString shortAbbrev(LanguageManager::getShortAbbrevFromAbbrev(lang));
+ if (!dictionaryMap.contains(shortAbbrev))
+ {
+ //qDebug()<<"Adding extra spelling definitions for:"<<lang<<":"<<shortAbbrev;
+ dictionaryMap.insert(shortAbbrev, it.value());
+ }
+ //else
+ //qDebug()<<"Short abbreviation:"<<shortAbbrev<<"already exists for:"<<lang;
+ }
+ if (lang.length()==2)
+ {
+ QString altAbbrev(LanguageManager::getAlternativeAbbrevfromAbbrev(lang));
+ if (!dictionaryMap.contains(altAbbrev))
+ {
+ //qDebug()<<"Adding extra spelling definitions for:"<<lang<<":"<<altAbbrev;
+ dictionaryMap.insert(altAbbrev, it.value());
+ }
+ //else
+ //qDebug()<<"Alt. abbreviation:"<<altAbbrev<<"already exists for:"<<lang;
+ }
+ ++it;
+ }
+ */
+}
+
LanguageManager::~LanguageManager()
{
langTable.clear();
Modified: trunk/Scribus/scribus/langmgr.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19800&path=/trunk/Scribus/scribus/langmgr.h
==============================================================================
--- trunk/Scribus/scribus/langmgr.h (original)
+++ trunk/Scribus/scribus/langmgr.h Sat Feb 7 22:38:16 2015
@@ -59,6 +59,8 @@
QString numericSequence(QString seq);
bool findSpellingDictionaries(QStringList& sl);
void findSpellingDictionarySets(QStringList& dictionaryPaths, QMap<QString, QString>& dictionaryMap);
+ bool findHyphDictionaries(QStringList& sl);
+ void findHyphDictionarySets(QStringList& dictionaryPaths, QMap<QString, QString>& dictionaryMap);
const QString getHyphFilename(const QString& langAbbrev);
int langTableIndex(const QString& abbrev);
Modified: trunk/Scribus/scribus/scpaths.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19800&path=/trunk/Scribus/scribus/scpaths.cpp
==============================================================================
--- trunk/Scribus/scribus/scpaths.cpp (original)
+++ trunk/Scribus/scribus/scpaths.cpp Sat Feb 7 22:38:16 2015
@@ -302,6 +302,76 @@
return spellDirs;
}
+QStringList ScPaths::hyphDirs() const
+{
+ //dictionaryPaths
+/*
+ QString macPortsPath("/opt/local/share/hunspell/");
+ QString finkPath("/sw/share/hunspell/");
+ QString osxLibreOfficePath("/Applications/LibreOffice.app/Contents/share/extensions");
+ QString osxUserLibreOfficePath(QDir::homePath()+"/Applications/LibreOffice.app/Contents/share/extensions");
+ QString linuxLocalPath("/usr/local/share/hunspell/");
+ QString linuxHunspellPath("/usr/share/hunspell/");
+ QString linuxMyspellPath("/usr/share/myspell/");
+ QString windowsLOPath("LibreOffice 3.5/share/extensions");
+*/
+ QDir d;
+ QStringList hyphDirs;
+ hyphDirs.append(getUserDictDir(false));
+ hyphDirs.append(m_shareDir + "dicts/hyph/");
+/*
+#ifdef Q_OS_MAC
+ d.setPath(macPortsPath);
+ if (d.exists())
+ hyphDirs.append(macPortsPath);
+ d.setPath(finkPath);
+ if (d.exists())
+ hyphDirs.append(finkPath);
+ d.setPath(osxLibreOfficePath);
+ if (d.exists())
+ {
+ QStringList dictDirFilters("dict-*");
+ QStringList dictDirList(d.entryList(dictDirFilters, QDir::Dirs, QDir::Name));
+ QString dir;
+ foreach (dir, dictDirList)
+ hyphDirs.append(osxLibreOfficePath + "/" + dir + "/");
+ }
+ d.setPath(osxUserLibreOfficePath);
+ if (d.exists())
+ {
+ QStringList dictDirFilters("dict-*");
+ QStringList dictDirList(d.entryList(dictDirFilters, QDir::Dirs, QDir::Name));
+ QString dir;
+ foreach (dir, dictDirList)
+ hyphDirs.append(osxUserLibreOfficePath + "/" + dir + "/");
+ }
+
+#elif defined(_WIN32)
+ QString progFiles = getSpecialDir(CSIDL_PROGRAM_FILES);
+ d.setPath(progFiles+windowsLOPath);
+ if (d.exists())
+ {
+ QStringList dictDirFilters("dict-*");
+ QStringList dictDirList(d.entryList(dictDirFilters, QDir::Dirs, QDir::Name));
+ QString dir;
+ foreach (dir, dictDirList)
+ spellDirs.append(progFiles+windowsLOPath + "/" + dir + "/");
+ }
+#elif defined(Q_OS_LINUX)
+ d.setPath(linuxHunspellPath);
+ if (d.exists())
+ spellDirs.append(linuxHunspellPath);
+ d.setPath(linuxMyspellPath);
+ if (d.exists())
+ spellDirs.append(linuxMyspellPath);
+ d.setPath(linuxLocalPath);
+ if (d.exists())
+ spellDirs.append(linuxLocalPath);
+#endif
+ */
+ return hyphDirs;
+}
+
QStringList ScPaths::getSystemFontDirs(void)
{
QStringList fontDirs;
Modified: trunk/Scribus/scribus/scpaths.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19800&path=/trunk/Scribus/scribus/scpaths.h
==============================================================================
--- trunk/Scribus/scribus/scpaths.h (original)
+++ trunk/Scribus/scribus/scpaths.h Sat Feb 7 22:38:16 2015
@@ -57,6 +57,8 @@
QString dictDir() const;
/** @brief Return path to the spelling dictionary directory */
QStringList spellDirs() const;
+ /** @brief Return path to the hyphenation dictionary directory */
+ QStringList hyphDirs() const;
/** @brief Return paths to system font directories*/
static QStringList getSystemFontDirs(void);
Modified: trunk/Scribus/scribus/scribus.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19800&path=/trunk/Scribus/scribus/scribus.cpp
==============================================================================
--- trunk/Scribus/scribus/scribus.cpp (original)
+++ trunk/Scribus/scribus/scribus.cpp Sat Feb 7 22:38:16 2015
@@ -7966,7 +7966,7 @@
//Build our list of hyphenation dictionaries we have in the install dir
//Grab the language abbreviation from it, get the full language text
//Insert the name as key and a new string list into the map
- QString hyphDirName = QDir::toNativeSeparators(ScPaths::instance().dictDir());
+ QString hyphDirName = QDir::toNativeSeparators(ScPaths::instance().dictDir()+"/hyph/");
QDir hyphDir(hyphDirName, "hyph*.dic", QDir::Name, QDir::Files | QDir::NoSymLinks);
//IL if ((hyphDir.exists()) && (hyphDir.count() != 0))
//IL {
Modified: trunk/Scribus/scribus/ui/prefs_hyphenator.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19800&path=/trunk/Scribus/scribus/ui/prefs_hyphenator.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/prefs_hyphenator.cpp (original)
+++ trunk/Scribus/scribus/ui/prefs_hyphenator.cpp Sat Feb 7 22:38:16 2015
@@ -4,16 +4,28 @@
a copyright and/or license notice that predates the release of Scribus 1.3.2
for which a new license (GPL+exception) is in place.
*/
+
+#include <QDebug>
+#include <QDomDocument>
#include <QInputDialog>
#include <QListWidget>
-#include <QDebug>
-
+#include <QTableWidgetItem>
+#include <QTextCodec>
+#include <QTextStream>
+
+#include "downloadmanager/scdlmgr.h"
#include "prefs_hyphenator.h"
#include "langmgr.h"
#include "prefsstructs.h"
+#include "scpaths.h"
+#include "scribusapp.h"
#include "scribusdoc.h"
+#include "third_party/zip/scribus_zip.h"
+#include "util.h"
+#include "util_file.h"
#include "util_icon.h"
-#include "util.h"
+
+extern ScribusQApp* ScQApp;
Prefs_Hyphenator::Prefs_Hyphenator(QWidget* parent, ScribusDoc* doc)
: Prefs_Pane(parent)
@@ -24,6 +36,16 @@
LanguageManager::instance()->fillInstalledHyphStringList(&languageList);
languageList.sort();
hyphLanguageComboBox->addItems( languageList );
+
+ //<<DL
+ updateDictList();
+ downloadLocation=ScPaths::downloadDir();
+ setAvailDictsXMLFile(downloadLocation + "scribus_hyph_dicts.xml");
+ downloadProgressBar->setVisible(false);
+ dlLabel->setVisible(false);
+ connect(hyphDownloadButton, SIGNAL(clicked()), this, SLOT(downloadHyphDicts()));
+ connect(availHyphListDownloadButton, SIGNAL(clicked()), this, SLOT(updateAvailDictList()));
+ //>DL
exceptionAddButton->setIcon(QIcon(loadIcon("16/list-add.png")));
exceptionEditButton->setEnabled(false);
@@ -166,3 +188,200 @@
exceptionEditButton->setEnabled(true);
exceptionRemoveButton->setEnabled(true);
}
+
+void Prefs_Hyphenator::downloadHyphDicts()
+{
+ hyphDownloadButton->setEnabled(false);
+ int rows=availHyphDictTableWidget->rowCount();
+ QStringList dlLangs;
+ for (int i=0; i<rows; ++i)
+ {
+ QTableWidgetItem *dlItem=availHyphDictTableWidget->item(i,3);
+ if (dlItem->checkState()==Qt::Checked)
+ dlLangs<<availHyphDictTableWidget->item(i,1)->text();
+ }
+ //qDebug()<<dlLangs;
+ downloadList.clear();
+ downloadProgressBar->setValue(0);
+ downloadProgressBar->setVisible(true);
+ dlLabel->setVisible(true);
+ int i=0;
+ QString userDictDir(ScPaths::getUserDictDir(true));
+ foreach(DictData d, dictList)
+ {
+ if (dlLangs.contains(d.lang))
+ {
+ if (d.filetype=="zip")
+ {
+ ScQApp->dlManager()->addURL(d.url, true, downloadLocation, userDictDir);
+ ++i;
+ }
+ if (d.filetype=="plain")
+ {
+ //qDebug()<<d.url<<d.files;
+ QStringList plainURLs(d.files.split(";", QString::SkipEmptyParts));
+ foreach (QString s, plainURLs)
+ {
+ ScQApp->dlManager()->addURL(d.url+"/"+s, true, downloadLocation, userDictDir);
+ ++i;
+ }
+ downloadList.append(d);
+ }
+ }
+ }
+ if (i>0)
+ {
+ downloadProgressBar->setRange(0, i);
+ connect(ScQApp->dlManager(), SIGNAL(finished()), this, SLOT(downloadHyphDictsFinished()));
+ connect(ScQApp->dlManager(), SIGNAL(fileReceived(const QString&)), this, SLOT(updateProgressBar()));
+ connect(ScQApp->dlManager(), SIGNAL(fileFailed(const QString&)), this, SLOT(updateProgressBar()));
+ ScQApp->dlManager()->startDownloads();
+ }
+}
+
+void Prefs_Hyphenator::updateDictList()
+{
+ bool dictsFound=LanguageManager::instance()->findHyphDictionaries(dictionaryPaths);
+ if (!dictsFound)
+ return;
+ dictionaryMap.clear();
+ LanguageManager::instance()->findHyphDictionarySets(dictionaryPaths, dictionaryMap);
+
+ hyphDictTableWidget->clear();
+ hyphDictTableWidget->setRowCount(dictionaryMap.count());
+ hyphDictTableWidget->setColumnCount(3);
+ QMapIterator<QString, QString> i(dictionaryMap);
+ int row=0;
+ while (i.hasNext())
+ {
+ i.next();
+ int column=0;
+ //qDebug()<<i.key()<<i.value()<<LanguageManager::instance()->getLangFromAbbrev(i.key(), false);
+ QTableWidgetItem *newItem1 = new QTableWidgetItem(LanguageManager::instance()->getLangFromAbbrev(i.key()));
+ newItem1->setFlags(newItem1->flags() & ~Qt::ItemIsEditable);
+ hyphDictTableWidget->setItem(row, column++, newItem1);
+ QTableWidgetItem *newItem2 = new QTableWidgetItem(i.key());
+ newItem2->setFlags(newItem1->flags());
+ hyphDictTableWidget->setItem(row, column++, newItem2);
+ QTableWidgetItem *newItem3 = new QTableWidgetItem(i.value());
+ newItem3->setFlags(newItem1->flags());
+ newItem3->setToolTip(i.value());
+ hyphDictTableWidget->setItem(row, column++, newItem3);
+ ++row;
+ }
+ QStringList headers;
+ headers << tr("Language") << tr("Code") << tr("Location");
+ hyphDictTableWidget->setHorizontalHeaderLabels(headers);
+ hyphDictTableWidget->resizeColumnsToContents();
+}
+
+void Prefs_Hyphenator::updateAvailDictList()
+{
+ availHyphListDownloadButton->setEnabled(false);
+ ScQApp->dlManager()->addURL("http://services.scribus.net/scribus_hyph_dicts.xml", true, downloadLocation, downloadLocation);
+ connect(ScQApp->dlManager(), SIGNAL(finished()), this, SLOT(downloadDictListFinished()));
+ ScQApp->dlManager()->startDownloads();
+}
+
+void Prefs_Hyphenator::downloadDictListFinished()
+{
+ disconnect(ScQApp->dlManager(), SIGNAL(finished()), this, SLOT(downloadDictListFinished()));
+ setAvailDictsXMLFile(downloadLocation + "scribus_hyph_dicts.xml");
+ availHyphListDownloadButton->setEnabled(true);
+}
+
+void Prefs_Hyphenator::downloadHyphDictsFinished()
+{
+ disconnect(ScQApp->dlManager(), SIGNAL(finished()), this, SLOT(downloadDictListFinished()));
+ updateDictList();
+ downloadProgressBar->setValue(0);
+ downloadProgressBar->setVisible(false);
+ dlLabel->setVisible(false);
+ hyphDownloadButton->setEnabled(true);
+}
+
+void Prefs_Hyphenator::updateProgressBar()
+{
+ downloadProgressBar->setValue(downloadProgressBar->value()+1);
+}
+
+void Prefs_Hyphenator::setAvailDictsXMLFile(QString availDictsXMLDataFile)
+{
+ QFile dataFile(availDictsXMLDataFile);
+ dataFile.open(QIODevice::ReadOnly);
+ QTextStream ts(&dataFile);
+ ts.setCodec(QTextCodec::codecForName("UTF-8"));
+ QString errorMsg;
+ int eline;
+ int ecol;
+ QDomDocument doc( "scribus_hyph_dicts" );
+ QString data(ts.readAll());
+ dataFile.close();
+ if ( !doc.setContent( data, &errorMsg, &eline, &ecol ))
+ {
+ if (data.toLower().contains("404 not found"))
+ qDebug()<<"File not found on server";
+ else
+ qDebug()<<"Could not open file"<<availDictsXMLDataFile;
+ return;
+ }
+ dictList.clear();
+ QDomElement docElem = doc.documentElement();
+ QDomNode n = docElem.firstChild();
+ while( !n.isNull() ) {
+ QDomElement e = n.toElement();
+ if( !e.isNull() ) {
+ if (e.tagName()=="dictionary")
+ {
+ if (e.hasAttribute("type") && e.hasAttribute("filetype"))
+ {
+ if (e.attribute("type")=="hyph")
+ {
+ struct DictData d;
+ d.desc=e.attribute("description");
+ d.download=false;
+ d.files=e.attribute("files");
+ d.url=e.attribute("URL");
+ d.version=e.attribute("version");
+ d.lang=e.attribute("language");
+ d.license=e.attribute("license");
+ d.filetype=e.attribute("filetype");
+ QUrl url(d.url);
+ if (url.isValid() && !url.isEmpty() && !url.host().isEmpty())
+ dictList.append(d);
+ //else
+ // qDebug()<<"hysettings : availDicts : invalid URL"<<d.url;
+ }
+ }
+ }
+ }
+ n = n.nextSibling();
+ }
+ availHyphDictTableWidget->clear();
+ availHyphDictTableWidget->setRowCount(dictList.count());
+ availHyphDictTableWidget->setColumnCount(4);
+ int row=0;
+ foreach(DictData d, dictList)
+ {
+ int column=0;
+ //qDebug()<<d.version<<d.files<<d.url<<d.desc<<d.license;
+ QTableWidgetItem *newItem1 = new QTableWidgetItem(d.desc);
+ newItem1->setFlags(newItem1->flags() & ~Qt::ItemIsEditable);
+ availHyphDictTableWidget->setItem(row, column++, newItem1);
+ QTableWidgetItem *newItem2 = new QTableWidgetItem(d.lang);
+ newItem2->setFlags(newItem1->flags());
+ availHyphDictTableWidget->setItem(row, column++, newItem2);
+ QTableWidgetItem *newItem3 = new QTableWidgetItem();
+ newItem3->setCheckState(dictionaryMap.contains(d.lang) ? Qt::Checked : Qt::Unchecked);
+ newItem3->setFlags(newItem1->flags() & ~Qt::ItemIsUserCheckable);
+ availHyphDictTableWidget->setItem(row, column++, newItem3);
+ QTableWidgetItem *newItem4 = new QTableWidgetItem();
+ newItem4->setCheckState(d.download ? Qt::Checked : Qt::Unchecked);
+ availHyphDictTableWidget->setItem(row, column++, newItem4);
+ ++row;
+ }
+ QStringList headers;
+ headers << tr("Language") << tr("Code") << tr("Installed") << tr("Download");
+ availHyphDictTableWidget->setHorizontalHeaderLabels(headers);
+ availHyphDictTableWidget->resizeColumnsToContents();
+}
Modified: trunk/Scribus/scribus/ui/prefs_hyphenator.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19800&path=/trunk/Scribus/scribus/ui/prefs_hyphenator.h
==============================================================================
--- trunk/Scribus/scribus/ui/prefs_hyphenator.h (original)
+++ trunk/Scribus/scribus/ui/prefs_hyphenator.h Sat Feb 7 22:38:16 2015
@@ -11,6 +11,7 @@
#include "ui_prefs_hyphenatorbase.h"
#include "prefs_pane.h"
#include "scribusapi.h"
+#include "scribusstructs.h"
class ScribusDoc;
@@ -37,6 +38,23 @@
void removeExceptListEntry();
void enableExceptButtons();
+ protected slots:
+ void downloadHyphDicts();
+ void updateDictList();
+ void updateAvailDictList();
+ void downloadDictListFinished();
+ void downloadHyphDictsFinished();
+ void updateProgressBar();
+
+ protected:
+ QString affixFileName(QStringList files);
+ QString dictFileName(QStringList files);
+ void setAvailDictsXMLFile(QString availDictsXMLDataFile);
+ QMap<QString, QString> dictionaryMap;
+ QStringList dictionaryPaths;
+ QString downloadLocation;
+ QList <DictData> dictList;
+ QList <DictData> downloadList;
};
#endif // PREFS_HYPHENATOR_H
Modified: trunk/Scribus/scribus/ui/prefs_spelling.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19800&path=/trunk/Scribus/scribus/ui/prefs_spelling.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/prefs_spelling.cpp (original)
+++ trunk/Scribus/scribus/ui/prefs_spelling.cpp Sat Feb 7 22:38:16 2015
@@ -15,18 +15,19 @@
#include <QTextCodec>
#include <QTextStream>
+
#include "downloadmanager/scdlmgr.h"
+#include "langmgr.h"
#include "prefs_spelling.h"
-#include "langmgr.h"
#include "prefsstructs.h"
+#include "scpaths.h"
+#include "scribusapp.h"
#include "scribusdoc.h"
-#include "util_icon.h"
+#include "third_party/zip/scribus_zip.h"
#include "util.h"
#include "util_file.h"
-#include "third_party/zip/scribus_zip.h"
-
-#include "scribusapp.h"
-#include "scpaths.h"
+#include "util_icon.h"
+
extern ScribusQApp* ScQApp;
@@ -104,7 +105,7 @@
if (i>0)
{
downloadProgressBar->setRange(0, i);
- //connect(ScQApp->dlManager(), SIGNAL(finished()), this, SLOT(downloadSpellDictsFinished()));
+ connect(ScQApp->dlManager(), SIGNAL(finished()), this, SLOT(downloadSpellDictsFinished()));
connect(ScQApp->dlManager(), SIGNAL(fileReceived(const QString&)), this, SLOT(updateProgressBar()));
connect(ScQApp->dlManager(), SIGNAL(fileFailed(const QString&)), this, SLOT(updateProgressBar()));
ScQApp->dlManager()->startDownloads();
@@ -165,6 +166,7 @@
void Prefs_Spelling::downloadSpellDictsFinished()
{
disconnect(ScQApp->dlManager(), SIGNAL(finished()), this, SLOT(downloadDictListFinished()));
+/*
//qDebug()<<"Downloads All Finished";
QString userDictDir(ScPaths::getUserDictDir(true));
// List all downloaded files in order to handle identical
@@ -217,7 +219,7 @@
}
}
}
-
+*/
updateDictList();
downloadProgressBar->setValue(0);
downloadProgressBar->setVisible(false);
Modified: trunk/Scribus/scribus/ui/prefs_spelling.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19800&path=/trunk/Scribus/scribus/ui/prefs_spelling.h
==============================================================================
--- trunk/Scribus/scribus/ui/prefs_spelling.h (original)
+++ trunk/Scribus/scribus/ui/prefs_spelling.h Sat Feb 7 22:38:16 2015
@@ -30,7 +30,7 @@
public slots:
void languageChange();
- private slots:
+ protected slots:
void downloadSpellDicts();
void updateDictList();
void updateAvailDictList();
@@ -38,12 +38,10 @@
void downloadSpellDictsFinished();
void updateProgressBar();
- private:
+ protected:
QString affixFileName(QStringList files);
QString dictFileName(QStringList files);
void setAvailDictsXMLFile(QString availDictsXMLDataFile);
-
- protected:
QMap<QString, QString> dictionaryMap;
QStringList dictionaryPaths;
QString downloadLocation;
More information about the scribus-commit
mailing list