r19785 by craig - Move image data loaders to their own directory, some dl mgr updates
scribus-commit
scribus-commit at lists.scribus.net
Mon Feb 2 21:32:01 UTC 2015
Author: craig
Date: Mon Feb 2 21:32:01 2015
New Revision: 19785
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=19785
Log:
Move image data loaders to their own directory, some dl mgr updates
Added:
trunk/Scribus/scribus/imagedataloaders/
trunk/Scribus/scribus/imagedataloaders/scimgdataloader.cpp
- copied unchanged from r19774, trunk/Scribus/scribus/scimgdataloader.cpp
trunk/Scribus/scribus/imagedataloaders/scimgdataloader.h
- copied unchanged from r19774, trunk/Scribus/scribus/scimgdataloader.h
trunk/Scribus/scribus/imagedataloaders/scimgdataloader_gimp.cpp
- copied unchanged from r19774, trunk/Scribus/scribus/scimgdataloader_gimp.cpp
trunk/Scribus/scribus/imagedataloaders/scimgdataloader_gimp.h
- copied unchanged from r19774, trunk/Scribus/scribus/scimgdataloader_gimp.h
trunk/Scribus/scribus/imagedataloaders/scimgdataloader_gmagick.cpp
- copied unchanged from r19774, trunk/Scribus/scribus/scimgdataloader_gmagick.cpp
trunk/Scribus/scribus/imagedataloaders/scimgdataloader_gmagick.h
- copied unchanged from r19774, trunk/Scribus/scribus/scimgdataloader_gmagick.h
trunk/Scribus/scribus/imagedataloaders/scimgdataloader_jpeg.cpp
- copied unchanged from r19774, trunk/Scribus/scribus/scimgdataloader_jpeg.cpp
trunk/Scribus/scribus/imagedataloaders/scimgdataloader_jpeg.h
- copied unchanged from r19774, trunk/Scribus/scribus/scimgdataloader_jpeg.h
trunk/Scribus/scribus/imagedataloaders/scimgdataloader_ora.cpp
- copied unchanged from r19774, trunk/Scribus/scribus/scimgdataloader_ora.cpp
trunk/Scribus/scribus/imagedataloaders/scimgdataloader_ora.h
- copied unchanged from r19774, trunk/Scribus/scribus/scimgdataloader_ora.h
trunk/Scribus/scribus/imagedataloaders/scimgdataloader_pdf.cpp
- copied unchanged from r19774, trunk/Scribus/scribus/scimgdataloader_pdf.cpp
trunk/Scribus/scribus/imagedataloaders/scimgdataloader_pdf.h
- copied unchanged from r19774, trunk/Scribus/scribus/scimgdataloader_pdf.h
trunk/Scribus/scribus/imagedataloaders/scimgdataloader_pgf.cpp
- copied unchanged from r19774, trunk/Scribus/scribus/scimgdataloader_pgf.cpp
trunk/Scribus/scribus/imagedataloaders/scimgdataloader_pgf.h
- copied unchanged from r19774, trunk/Scribus/scribus/scimgdataloader_pgf.h
trunk/Scribus/scribus/imagedataloaders/scimgdataloader_pict.cpp
- copied unchanged from r19774, trunk/Scribus/scribus/scimgdataloader_pict.cpp
trunk/Scribus/scribus/imagedataloaders/scimgdataloader_pict.h
- copied unchanged from r19774, trunk/Scribus/scribus/scimgdataloader_pict.h
trunk/Scribus/scribus/imagedataloaders/scimgdataloader_ps.cpp
- copied unchanged from r19774, trunk/Scribus/scribus/scimgdataloader_ps.cpp
trunk/Scribus/scribus/imagedataloaders/scimgdataloader_ps.h
- copied unchanged from r19774, trunk/Scribus/scribus/scimgdataloader_ps.h
trunk/Scribus/scribus/imagedataloaders/scimgdataloader_psd.cpp
- copied unchanged from r19774, trunk/Scribus/scribus/scimgdataloader_psd.cpp
trunk/Scribus/scribus/imagedataloaders/scimgdataloader_psd.h
- copied unchanged from r19774, trunk/Scribus/scribus/scimgdataloader_psd.h
trunk/Scribus/scribus/imagedataloaders/scimgdataloader_qt.cpp
- copied unchanged from r19774, trunk/Scribus/scribus/scimgdataloader_qt.cpp
trunk/Scribus/scribus/imagedataloaders/scimgdataloader_qt.h
- copied unchanged from r19774, trunk/Scribus/scribus/scimgdataloader_qt.h
trunk/Scribus/scribus/imagedataloaders/scimgdataloader_tiff.cpp
- copied unchanged from r19774, trunk/Scribus/scribus/scimgdataloader_tiff.cpp
trunk/Scribus/scribus/imagedataloaders/scimgdataloader_tiff.h
- copied unchanged from r19774, trunk/Scribus/scribus/scimgdataloader_tiff.h
trunk/Scribus/scribus/imagedataloaders/scimgdataloader_wpg.cpp
- copied unchanged from r19774, trunk/Scribus/scribus/scimgdataloader_wpg.cpp
trunk/Scribus/scribus/imagedataloaders/scimgdataloader_wpg.h
- copied unchanged from r19774, trunk/Scribus/scribus/scimgdataloader_wpg.h
Modified:
trunk/Scribus/scribus/CMakeLists.txt
trunk/Scribus/scribus/downloadmanager/scdlmgr.cpp
trunk/Scribus/scribus/downloadmanager/scdlmgr.h
trunk/Scribus/scribus/downloadmanager/scdlthread.cpp
trunk/Scribus/scribus/downloadmanager/scdlthread.h
trunk/Scribus/scribus/scimage.cpp
trunk/Scribus/scribus/scimgdataloader.cpp
trunk/Scribus/scribus/scimgdataloader.h
trunk/Scribus/scribus/scimgdataloader_gimp.cpp
trunk/Scribus/scribus/scimgdataloader_gimp.h
trunk/Scribus/scribus/scimgdataloader_gmagick.cpp
trunk/Scribus/scribus/scimgdataloader_gmagick.h
trunk/Scribus/scribus/scimgdataloader_jpeg.cpp
trunk/Scribus/scribus/scimgdataloader_jpeg.h
trunk/Scribus/scribus/scimgdataloader_ora.cpp
trunk/Scribus/scribus/scimgdataloader_ora.h
trunk/Scribus/scribus/scimgdataloader_pdf.cpp
trunk/Scribus/scribus/scimgdataloader_pdf.h
trunk/Scribus/scribus/scimgdataloader_pgf.cpp
trunk/Scribus/scribus/scimgdataloader_pgf.h
trunk/Scribus/scribus/scimgdataloader_pict.cpp
trunk/Scribus/scribus/scimgdataloader_pict.h
trunk/Scribus/scribus/scimgdataloader_ps.cpp
trunk/Scribus/scribus/scimgdataloader_ps.h
trunk/Scribus/scribus/scimgdataloader_psd.cpp
trunk/Scribus/scribus/scimgdataloader_psd.h
trunk/Scribus/scribus/scimgdataloader_qt.cpp
trunk/Scribus/scribus/scimgdataloader_qt.h
trunk/Scribus/scribus/scimgdataloader_tiff.cpp
trunk/Scribus/scribus/scimgdataloader_tiff.h
trunk/Scribus/scribus/scimgdataloader_wpg.cpp
trunk/Scribus/scribus/scimgdataloader_wpg.h
trunk/Scribus/scribus/scribusstructs.h
trunk/Scribus/scribus/ui/downloadspalette.h
trunk/Scribus/scribus/ui/prefs_spelling.cpp
trunk/Scribus/scribus/ui/prefs_spelling.h
Modified: trunk/Scribus/scribus/CMakeLists.txt
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19785&path=/trunk/Scribus/scribus/CMakeLists.txt
==============================================================================
--- trunk/Scribus/scribus/CMakeLists.txt (original)
+++ trunk/Scribus/scribus/CMakeLists.txt Mon Feb 2 21:32:01 2015
@@ -54,7 +54,7 @@
ENDIF (HAVE_OSG)
IF (GMAGICK_FOUND)
- SET(SCRIBUS_GMAGICK_SRC scimgdataloader_gmagick.cpp)
+ SET(SCRIBUS_GMAGICK_SRC imagedataloaders/scimgdataloader_gmagick.cpp)
ELSE(GMAGICK_FOUND)
SET(SCRIBUS_GMAGICK_SRC)
ENDIF(GMAGICK_FOUND)
@@ -670,18 +670,18 @@
scimagecachemanager.cpp
scimagecachewriteaction.cpp
scimagestructs.cpp
- scimgdataloader.cpp
- scimgdataloader_gimp.cpp
- scimgdataloader_jpeg.cpp
- scimgdataloader_ora.cpp
- scimgdataloader_pdf.cpp
- scimgdataloader_pgf.cpp
- scimgdataloader_pict.cpp
- scimgdataloader_ps.cpp
- scimgdataloader_psd.cpp
- scimgdataloader_qt.cpp
- scimgdataloader_tiff.cpp
- scimgdataloader_wpg.cpp
+ imagedataloaders/scimgdataloader.cpp
+ imagedataloaders/scimgdataloader_gimp.cpp
+ imagedataloaders/scimgdataloader_jpeg.cpp
+ imagedataloaders/scimgdataloader_ora.cpp
+ imagedataloaders/scimgdataloader_pdf.cpp
+ imagedataloaders/scimgdataloader_pgf.cpp
+ imagedataloaders/scimgdataloader_pict.cpp
+ imagedataloaders/scimgdataloader_ps.cpp
+ imagedataloaders/scimgdataloader_psd.cpp
+ imagedataloaders/scimgdataloader_qt.cpp
+ imagedataloaders/scimgdataloader_tiff.cpp
+ imagedataloaders/scimgdataloader_wpg.cpp
sclayer.cpp
sclockedfile.cpp
scmimedata.cpp
Modified: trunk/Scribus/scribus/downloadmanager/scdlmgr.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19785&path=/trunk/Scribus/scribus/downloadmanager/scdlmgr.cpp
==============================================================================
--- trunk/Scribus/scribus/downloadmanager/scdlmgr.cpp (original)
+++ trunk/Scribus/scribus/downloadmanager/scdlmgr.cpp Mon Feb 2 21:32:01 2015
@@ -24,19 +24,19 @@
delete thread;
}
-void ScDLManager::addURL(const QUrl &url, bool overwrite, const QString& location)
+void ScDLManager::addURL(const QUrl &url, bool overwrite, const QString& downloadLocation, const QString& destinationLocation)
{
- thread->addURL(url, overwrite, location);
+ thread->addURL(url, overwrite, downloadLocation, destinationLocation);
}
-void ScDLManager::addURL(const QString &url, bool overwrite, const QString &location)
+void ScDLManager::addURL(const QString &url, bool overwrite, const QString &downloadLocation, const QString& destinationLocation)
{
- thread->addURL(QUrl(url), overwrite, location);
+ thread->addURL(QUrl(url), overwrite, downloadLocation, destinationLocation);
}
-void ScDLManager::addURLs(const QStringList &urlList, bool overwrite, const QString &location)
+void ScDLManager::addURLs(const QStringList &urlList, bool overwrite, const QString &downloadLocation, const QString& destinationLocation)
{
- thread->addURLs(urlList, overwrite, location);
+ thread->addURLs(urlList, overwrite, downloadLocation, destinationLocation);
}
void ScDLManager::startDownloads()
@@ -50,3 +50,56 @@
emit fileReceived(t);
qDebug()<<"File Received:"<<t;
}
+
+void ScDLManager::moveFinishedDownloads()
+{
+ /*
+ QStringList allFileList;
+ foreach(DictData d, fileList)
+ {
+ allFileList += d.files.split(";", QString::SkipEmptyParts);
+ }
+ // Move downloaded files to destination
+ foreach(DictData d, fileList)
+ {
+ QString basename = QFileInfo(d.url).fileName();
+ QString filename = downloadLocation+basename;
+ QStringList files = d.files.split(";", QString::SkipEmptyParts);
+ QString affixFile = affixFileName(files);
+ QString dictFile = dictFileName(files);
+ //qDebug()<<filename;
+ if (d.filetype=="zip")
+ {
+ //qDebug()<<"zip data found"<<filename;
+ ScZipHandler* fun = new ScZipHandler();
+ if (fun->open(filename))
+ {
+ foreach (QString s, files)
+ {
+ //qDebug()<<"Unzipping"<<userDictDir+s;
+ fun->extract(s, userDictDir);
+ allFileList.removeOne(s);
+ }
+ }
+ delete fun;
+ }
+ if (d.filetype=="plain")
+ {
+ foreach (QString s, files)
+ {
+ //qDebug()<<"plain data found"<<downloadLocation<<userDictDir<<s;
+ QString dstName = s;
+ if (dstName == affixFile)
+ dstName = QFileInfo(downloadLocation+dictFile).baseName() + ".aff";
+ allFileList.removeOne(s);
+ if (allFileList.contains(s))
+ {
+ copyFile(downloadLocation+s, userDictDir+dstName);
+ continue;
+ }
+ moveFile(downloadLocation+s, userDictDir+dstName);
+ }
+ }
+ }
+ */
+}
Modified: trunk/Scribus/scribus/downloadmanager/scdlmgr.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19785&path=/trunk/Scribus/scribus/downloadmanager/scdlmgr.h
==============================================================================
--- trunk/Scribus/scribus/downloadmanager/scdlmgr.h (original)
+++ trunk/Scribus/scribus/downloadmanager/scdlmgr.h Mon Feb 2 21:32:01 2015
@@ -13,6 +13,7 @@
#include <QUrl>
#include "scdlthread.h"
+#include "scribusstructs.h"
class ScDLManager: public QObject
{
@@ -22,13 +23,16 @@
~ScDLManager();
//TODO: Add download groups so different parts of Scribus can be downloading at the same time
- void addURL(const QUrl &url, bool overwrite, const QString &location="");
- void addURL(const QString &url, bool overwrite, const QString &location="");
- void addURLs(const QStringList &urlList, bool overwrite, const QString &location="");
+ void addURL(const QUrl &url, bool overwrite, const QString &downloadLocation, const QString& destinationLocation);
+ void addURL(const QString &url, bool overwrite, const QString &downloadLocation, const QString& destinationLocation);
+ void addURLs(const QStringList &urlList, bool overwrite, const QString &downloadLocation, const QString& destinationLocation);
void startDownloads();
public slots:
void updateText(const QString& t);
+
+ protected slots:
+ void moveFinishedDownloads();
signals:
void finished();
@@ -36,6 +40,8 @@
private:
ScDLThread *thread;
+
+ QList <DownloadData> fileList;
};
#endif
Modified: trunk/Scribus/scribus/downloadmanager/scdlthread.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19785&path=/trunk/Scribus/scribus/downloadmanager/scdlthread.cpp
==============================================================================
--- trunk/Scribus/scribus/downloadmanager/scdlthread.cpp (original)
+++ trunk/Scribus/scribus/downloadmanager/scdlthread.cpp Mon Feb 2 21:32:01 2015
@@ -26,7 +26,7 @@
emit(runSignal());
}
-void ScDLThread::addURL(const QUrl &url, bool overwrite, const QString& location)
+void ScDLThread::addURL(const QUrl &url, bool overwrite, const QString& location, const QString& destinationLocation)
{
qDebug()<<"ScDLThread::addURL:"<<url;
if (!urlOK(url))
@@ -38,7 +38,7 @@
++totalCount;
}
-void ScDLThread::addURLs(const QStringList &urlList, bool overwrite, const QString& location)
+void ScDLThread::addURLs(const QStringList &urlList, bool overwrite, const QString& location, const QString& destinationLocation)
{
qDebug()<<"ScDLThread::addURLs:"<<urlList;
m_urlList=urlList;
Modified: trunk/Scribus/scribus/downloadmanager/scdlthread.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19785&path=/trunk/Scribus/scribus/downloadmanager/scdlthread.h
==============================================================================
--- trunk/Scribus/scribus/downloadmanager/scdlthread.h (original)
+++ trunk/Scribus/scribus/downloadmanager/scdlthread.h Mon Feb 2 21:32:01 2015
@@ -18,8 +18,8 @@
~ScDLThread();
void run();
- void addURL(const QUrl &url, bool overwrite, const QString& location="");
- void addURLs(const QStringList &urlList, bool overwrite, const QString& location="");
+ void addURL(const QUrl &url, bool overwrite, const QString& location, const QString& destinationLocation);
+ void addURLs(const QStringList &urlList, bool overwrite, const QString& location, const QString& destinationLocation);
void startDownloads();
QString saveFileName(const QUrl &url, const QString &location, bool overwrite);
Modified: trunk/Scribus/scribus/scimage.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19785&path=/trunk/Scribus/scribus/scimage.cpp
==============================================================================
--- trunk/Scribus/scribus/scimage.cpp (original)
+++ trunk/Scribus/scribus/scimage.cpp Mon Feb 2 21:32:01 2015
@@ -11,20 +11,20 @@
#include "scpaths.h"
#include "scribuscore.h"
-#include "scimgdataloader_gimp.h"
+#include "imagedataloaders/scimgdataloader_gimp.h"
#ifdef GMAGICK_FOUND
-#include "scimgdataloader_gmagick.h"
+#include "imagedataloaders/scimgdataloader_gmagick.h"
#endif
-#include "scimgdataloader_jpeg.h"
-#include "scimgdataloader_ora.h"
-#include "scimgdataloader_pict.h"
-#include "scimgdataloader_ps.h"
-#include "scimgdataloader_psd.h"
-#include "scimgdataloader_pdf.h"
-#include "scimgdataloader_pgf.h"
-#include "scimgdataloader_qt.h"
-#include "scimgdataloader_tiff.h"
-#include "scimgdataloader_wpg.h"
+#include "imagedataloaders/scimgdataloader_jpeg.h"
+#include "imagedataloaders/scimgdataloader_ora.h"
+#include "imagedataloaders/scimgdataloader_pict.h"
+#include "imagedataloaders/scimgdataloader_ps.h"
+#include "imagedataloaders/scimgdataloader_psd.h"
+#include "imagedataloaders/scimgdataloader_pdf.h"
+#include "imagedataloaders/scimgdataloader_pgf.h"
+#include "imagedataloaders/scimgdataloader_qt.h"
+#include "imagedataloaders/scimgdataloader_tiff.h"
+#include "imagedataloaders/scimgdataloader_wpg.h"
#include "scstreamfilter_jpeg.h"
#include "sctextstream.h"
#include <QFile>
Modified: trunk/Scribus/scribus/scribusstructs.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19785&path=/trunk/Scribus/scribus/scribusstructs.h
==============================================================================
--- trunk/Scribus/scribus/scribusstructs.h (original)
+++ trunk/Scribus/scribus/scribusstructs.h Mon Feb 2 21:32:01 2015
@@ -370,5 +370,27 @@
QString value;
};
+//TODO: Dict license showing, URL background unzipping, checksumming, pkg mgr platforms warning
+struct DictData
+{
+ QString lang;
+ QString version;
+ QString files;
+ QString url;
+ QString desc;
+ QString license;
+ QString filetype;
+ bool download;
+};
+
+struct DownloadData
+{
+ QString name;
+ QString downloadLocation;
+ QString destinationLocation;
+ typedef enum {Started, Paused, Finished} DownloadState;
+ DownloadState state;
+};
+
#endif
Modified: trunk/Scribus/scribus/ui/downloadspalette.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19785&path=/trunk/Scribus/scribus/ui/downloadspalette.h
==============================================================================
--- trunk/Scribus/scribus/ui/downloadspalette.h (original)
+++ trunk/Scribus/scribus/ui/downloadspalette.h Mon Feb 2 21:32:01 2015
@@ -25,8 +25,11 @@
#define DOWNLOADSPALETTE_H
#include "scribusapi.h"
+#include "scribusstructs.h"
#include "ui/scrpalettebase.h"
#include "ui_downloadspalettebase.h"
+
+
class SCRIBUS_API DownloadsPalette : public ScrPaletteBase, public Ui::DownloadsPalette_Base
{
@@ -36,10 +39,15 @@
DownloadsPalette(QWidget* parent);
~DownloadsPalette() {};
+ //events:
//virtual void changeEvent(QEvent *e);
public slots:
void languageChange();
+ void addDownload(const QString &name, const QString &source, const QString &destination);
+
+ protected:
+
};
#endif // DOWNLOADSPALETTE_H
Modified: trunk/Scribus/scribus/ui/prefs_spelling.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19785&path=/trunk/Scribus/scribus/ui/prefs_spelling.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/prefs_spelling.cpp (original)
+++ trunk/Scribus/scribus/ui/prefs_spelling.cpp Mon Feb 2 21:32:01 2015
@@ -79,15 +79,14 @@
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);
- downloadList.append(d);
+ ScQApp->dlManager()->addURL(d.url, true, downloadLocation, userDictDir);
++i;
}
if (d.filetype=="plain")
@@ -96,7 +95,7 @@
QStringList plainURLs(d.files.split(";", QString::SkipEmptyParts));
foreach (QString s, plainURLs)
{
- ScQApp->dlManager()->addURL(d.url+"/"+s, true, downloadLocation);
+ ScQApp->dlManager()->addURL(d.url+"/"+s, true, downloadLocation, userDictDir);
++i;
}
downloadList.append(d);
@@ -151,7 +150,7 @@
void Prefs_Spelling::updateAvailDictList()
{
availListDownloadButton->setEnabled(false);
- ScQApp->dlManager()->addURL("http://services.scribus.net/scribus_spell_dicts.xml", true, downloadLocation);
+ ScQApp->dlManager()->addURL("http://services.scribus.net/scribus_spell_dicts.xml", true, downloadLocation, downloadLocation);
connect(ScQApp->dlManager(), SIGNAL(finished()), this, SLOT(downloadDictListFinished()));
ScQApp->dlManager()->startDownloads();
}
Modified: trunk/Scribus/scribus/ui/prefs_spelling.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19785&path=/trunk/Scribus/scribus/ui/prefs_spelling.h
==============================================================================
--- trunk/Scribus/scribus/ui/prefs_spelling.h (original)
+++ trunk/Scribus/scribus/ui/prefs_spelling.h Mon Feb 2 21:32:01 2015
@@ -11,23 +11,13 @@
#include "ui_prefs_spellingbase.h"
#include "prefs_pane.h"
#include "scribusapi.h"
+#include "scribusstructs.h"
class ScribusDoc;
class SCRIBUS_API Prefs_Spelling : public Prefs_Pane, Ui::Prefs_Spelling
{
- //TODO: Dict license showing, URL background unzipping, checksumming, pkg mgr platforms warning
- struct DictData
- {
- QString lang;
- QString version;
- QString files;
- QString url;
- QString desc;
- QString license;
- QString filetype;
- bool download;
- };
+
Q_OBJECT
More information about the scribus-commit
mailing list