r18297 by fschmid - Simplify the fileloader plugins by removing the unused property "nameMatch"
scribus-commit
scribus-commit at lists.scribus.net
Thu May 30 09:28:40 UTC 2013
Author: fschmid
Date: Thu May 30 09:28:40 2013
New Revision: 18297
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=18297
Log:
Simplify the fileloader plugins by removing the unused property "nameMatch"
Modified:
trunk/Scribus/scribus/canvasmode_normal.cpp
trunk/Scribus/scribus/fileloader.cpp
trunk/Scribus/scribus/fileloader.h
trunk/Scribus/scribus/loadsaveplugin.cpp
trunk/Scribus/scribus/loadsaveplugin.h
trunk/Scribus/scribus/plugins/barcodegenerator/barcodegenerator.cpp
trunk/Scribus/scribus/plugins/fileloader/scribus12format/scribus12format.cpp
trunk/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format.cpp
trunk/Scribus/scribus/plugins/fileloader/scribus13format/scribus13format.cpp
trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp
trunk/Scribus/scribus/plugins/formatidlist.h
trunk/Scribus/scribus/plugins/import/ai/importaiplugin.cpp
trunk/Scribus/scribus/plugins/import/cgm/importcgmplugin.cpp
trunk/Scribus/scribus/plugins/import/cvg/importcvgplugin.cpp
trunk/Scribus/scribus/plugins/import/drw/importdrwplugin.cpp
trunk/Scribus/scribus/plugins/import/idml/importidmlplugin.cpp
trunk/Scribus/scribus/plugins/import/oodraw/oodrawimp.cpp
trunk/Scribus/scribus/plugins/import/pct/importpctplugin.cpp
trunk/Scribus/scribus/plugins/import/pdf/importpdfplugin.cpp
trunk/Scribus/scribus/plugins/import/pub/importpub.cpp
trunk/Scribus/scribus/plugins/import/pub/importpub.h
trunk/Scribus/scribus/plugins/import/pub/importpubplugin.cpp
trunk/Scribus/scribus/plugins/import/shape/importshapeplugin.cpp
trunk/Scribus/scribus/plugins/import/sml/importsmlplugin.cpp
trunk/Scribus/scribus/plugins/import/svg/svgplugin.cpp
trunk/Scribus/scribus/plugins/import/uniconvertor/uniconvplugin.cpp
trunk/Scribus/scribus/plugins/import/wmf/wmfimportplugin.cpp
trunk/Scribus/scribus/plugins/import/wpg/importwpgplugin.cpp
trunk/Scribus/scribus/plugins/import/xar/importxarplugin.cpp
trunk/Scribus/scribus/plugins/import/xfig/importxfigplugin.cpp
trunk/Scribus/scribus/plugins/picbrowser/loadimage.cpp
trunk/Scribus/scribus/plugins/picbrowser/picturebrowser.cpp
trunk/Scribus/scribus/plugins/scriptplugin/svgimport.cpp
trunk/Scribus/scribus/scribus.cpp
trunk/Scribus/scribus/scribusview.cpp
trunk/Scribus/scribus/ui/customfdialog.cpp
trunk/Scribus/scribus/ui/paintmanager.cpp
trunk/Scribus/scribus/ui/scrapbookpalette.cpp
Modified: trunk/Scribus/scribus/canvasmode_normal.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18297&path=/trunk/Scribus/scribus/canvasmode_normal.cpp
==============================================================================
--- trunk/Scribus/scribus/canvasmode_normal.cpp (original)
+++ trunk/Scribus/scribus/canvasmode_normal.cpp Thu May 30 09:28:40 2013
@@ -1813,7 +1813,7 @@
QString fileName;
QString allFormats = tr("All Supported Formats")+" (";
QStringList formats;
- int fmtCode = FORMATID_ODGIMPORT;
+ int fmtCode = FORMATID_FIRSTUSER;
const FileFormat *fmt = LoadSavePlugin::getFormatById(fmtCode);
while (fmt != 0)
{
@@ -1863,7 +1863,7 @@
FileLoader *fileLoader = new FileLoader(fileName);
int testResult = fileLoader->testFile();
delete fileLoader;
- if ((testResult != -1) && (testResult >= FORMATID_ODGIMPORT))
+ if ((testResult != -1) && (testResult >= FORMATID_FIRSTUSER))
{
const FileFormat * fmt = LoadSavePlugin::getFormatById(testResult);
if( fmt )
Modified: trunk/Scribus/scribus/fileloader.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18297&path=/trunk/Scribus/scribus/fileloader.cpp
==============================================================================
--- trunk/Scribus/scribus/fileloader.cpp (original)
+++ trunk/Scribus/scribus/fileloader.cpp Thu May 30 09:28:40 2013
@@ -65,10 +65,6 @@
formatSLA13x(LoadSavePlugin::getFormatById(FORMATID_SLA13XIMPORT)),
formatSLA134(LoadSavePlugin::getFormatById(FORMATID_SLA134IMPORT)),
formatSLA150(LoadSavePlugin::getFormatById(FORMATID_SLA150IMPORT)),
- formatPS(LoadSavePlugin::getFormatById(FORMATID_PSIMPORT)),
- formatSVG(LoadSavePlugin::getFormatById(FORMATID_SVGIMPORT)),
- formatSXD(LoadSavePlugin::getFormatById(FORMATID_SXDIMPORT)),
- formatODG(LoadSavePlugin::getFormatById(FORMATID_ODGIMPORT)),
prefsManager(PrefsManager::instance()),
m_fileName(fileName),
m_fileType(-1)
@@ -128,23 +124,18 @@
QList<FileFormat>::const_iterator itEnd(fileFormats.constEnd());
for ( ; it != itEnd ; ++it )
{
- if (it->nameMatch.indexIn("."+ext)!=-1)
- {
-// qDebug() << QString("Match :%1: :.%2: on %3").arg(it->nameMatch.pattern()).arg(ext).arg(it->trName);
+ if (it->fileExtensions.contains(ext))
+ {
if (it->plug != 0)
{
if (it->plug->fileSupported(0, m_fileName))
{
-// qDebug(QString("File Supported With: %1").arg(it->trName));
ret = it->formatId;
break;
}
}
}
-// else
-// qDebug() << QString("No Match :%1: :.%2: on %3").arg(it->nameMatch.pattern()).arg(ext).arg(it->trName);
- }
-
+ }
m_fileType = ret;
return ret;
}
Modified: trunk/Scribus/scribus/fileloader.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18297&path=/trunk/Scribus/scribus/fileloader.h
==============================================================================
--- trunk/Scribus/scribus/fileloader.h (original)
+++ trunk/Scribus/scribus/fileloader.h Thu May 30 09:28:40 2013
@@ -53,10 +53,6 @@
const FileFormat * const formatSLA13x;
const FileFormat * const formatSLA134;
const FileFormat * const formatSLA150;
- const FileFormat * const formatPS;
- const FileFormat * const formatSVG;
- const FileFormat * const formatSXD;
- const FileFormat * const formatODG;
static const QString getLoadFilterString();
private:
Modified: trunk/Scribus/scribus/loadsaveplugin.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18297&path=/trunk/Scribus/scribus/loadsaveplugin.cpp
==============================================================================
--- trunk/Scribus/scribus/loadsaveplugin.cpp (original)
+++ trunk/Scribus/scribus/loadsaveplugin.cpp Thu May 30 09:28:40 2013
@@ -378,8 +378,7 @@
QList<FileFormat>::iterator itEnd(formats.end());
for ( ; it != itEnd ; ++it )
{
- // if (((*it).fileExtensions.contains(extension.toLower())) && ((plug == 0) || (plug == (*it).plug)) )
- if ( ((*it).nameMatch.indexIn(extension)) && ((plug == 0) || (plug == (*it).plug)) )
+ if (((*it).fileExtensions.contains(extension.toLower())) && ((plug == 0) || (plug == (*it).plug)) )
return it;
}
return itEnd;
Modified: trunk/Scribus/scribus/loadsaveplugin.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18297&path=/trunk/Scribus/scribus/loadsaveplugin.h
==============================================================================
--- trunk/Scribus/scribus/loadsaveplugin.h (original)
+++ trunk/Scribus/scribus/loadsaveplugin.h Thu May 30 09:28:40 2013
@@ -232,7 +232,7 @@
// select for this format.
QString filter;
// Regexp to match filenames for this format
- QRegExp nameMatch;
+ // QRegExp nameMatch;
// MIME type(s) that should be matched by this format.
QStringList mimeTypes;
// Extension list supported by format
Modified: trunk/Scribus/scribus/plugins/barcodegenerator/barcodegenerator.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18297&path=/trunk/Scribus/scribus/plugins/barcodegenerator/barcodegenerator.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/barcodegenerator/barcodegenerator.cpp (original)
+++ trunk/Scribus/scribus/plugins/barcodegenerator/barcodegenerator.cpp Thu May 30 09:28:40 2013
@@ -260,7 +260,7 @@
// no need to call paintBarcode(tmpFile, 300); because
// it's created by previous run...
hide();
- const FileFormat * fmt = LoadSavePlugin::getFormatById(FORMATID_PSIMPORT);
+ const FileFormat * fmt = LoadSavePlugin::getFormatByExt("ps");
QSharedPointer<UndoTransaction> tran;
if (UndoManager::undoEnabled())
Modified: trunk/Scribus/scribus/plugins/fileloader/scribus12format/scribus12format.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18297&path=/trunk/Scribus/scribus/plugins/fileloader/scribus12format/scribus12format.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/fileloader/scribus12format/scribus12format.cpp (original)
+++ trunk/Scribus/scribus/plugins/fileloader/scribus12format/scribus12format.cpp Thu May 30 09:28:40 2013
@@ -118,7 +118,6 @@
fmt.save = false;
fmt.colorReading = true;
fmt.filter = fmt.trName + " (*.sla *.SLA *.sla.gz *.SLA.GZ *.scd *.SCD *.scd.gz *.SCD.GZ)";
- fmt.nameMatch = QRegExp("\\.(sla|scd)(\\.gz)?", Qt::CaseInsensitive);
fmt.mimeTypes = QStringList();
fmt.mimeTypes.append("application/x-scribus");
fmt.fileExtensions = QStringList() << "sla" << "sla.gz" << "scd" << "scd.gz";
Modified: trunk/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18297&path=/trunk/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format.cpp (original)
+++ trunk/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format.cpp Thu May 30 09:28:40 2013
@@ -103,7 +103,6 @@
fmt.save = false;
fmt.colorReading = true;
fmt.filter = fmt.trName + " (*.sla *.SLA *.sla.gz *.SLA.GZ *.scd *.SCD *.scd.gz *.SCD.GZ)";
- fmt.nameMatch = QRegExp("\\.(sla|scd)(\\.gz)?", Qt::CaseInsensitive);
fmt.mimeTypes = QStringList();
fmt.mimeTypes.append("application/x-scribus");
fmt.fileExtensions = QStringList() << "sla" << "sla.gz" << "scd" << "scd.gz";
Modified: trunk/Scribus/scribus/plugins/fileloader/scribus13format/scribus13format.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18297&path=/trunk/Scribus/scribus/plugins/fileloader/scribus13format/scribus13format.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/fileloader/scribus13format/scribus13format.cpp (original)
+++ trunk/Scribus/scribus/plugins/fileloader/scribus13format/scribus13format.cpp Thu May 30 09:28:40 2013
@@ -99,7 +99,6 @@
fmt.save = false; //Only support 134format saving in 134cvs
fmt.colorReading = true;
fmt.filter = fmt.trName + " (*.sla *.SLA *.sla.gz *.SLA.GZ *.scd *.SCD *.scd.gz *.SCD.GZ)";
- fmt.nameMatch = QRegExp("\\.(sla|scd)(\\.gz)?", Qt::CaseInsensitive);
fmt.mimeTypes = QStringList();
fmt.mimeTypes.append("application/x-scribus");
fmt.fileExtensions = QStringList() << "sla" << "sla.gz" << "scd" << "scd.gz";
Modified: trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18297&path=/trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp (original)
+++ trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp Thu May 30 09:28:40 2013
@@ -111,7 +111,6 @@
fmt.save = true;
fmt.colorReading = true;
fmt.filter = fmt.trName + " (*.sla *.SLA *.sla.gz *.SLA.GZ *.scd *.SCD *.scd.gz *.SCD.GZ)";
- fmt.nameMatch = QRegExp("\\.(sla|scd)(\\.gz)?", Qt::CaseInsensitive);
fmt.mimeTypes = QStringList();
fmt.mimeTypes.append("application/x-scribus");
fmt.fileExtensions = QStringList() << "sla" << "sla.gz" << "scd" << "scd.gz";
Modified: trunk/Scribus/scribus/plugins/formatidlist.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18297&path=/trunk/Scribus/scribus/plugins/formatidlist.h
==============================================================================
--- trunk/Scribus/scribus/plugins/formatidlist.h (original)
+++ trunk/Scribus/scribus/plugins/formatidlist.h Thu May 30 09:28:40 2013
@@ -15,20 +15,7 @@
#define FORMATID_SLA12XIMPORT 50
#define FORMATID_NATIVEIMPORTEND 99
-#define FORMATID_ODGIMPORT 100
-#define FORMATID_SXDIMPORT 101
-#define FORMATID_SVGIMPORT 102
-#define FORMATID_EPSIMPORT 103
-#define FORMATID_WMFIMPORT 104
-#define FORMATID_AIIMPORT 105
-#define FORMATID_XFIGIMPORT 106
-#define FORMATID_CVGIMPORT 107
-#define FORMATID_WPGIMPORT 108
-#define FORMATID_UNICONVIMPORT 109
-#define FORMATID_PCTIMPORT 110
-#define FORMATID_PSIMPORT 111
-#define FORMATID_PDFIMPORT 112
-#define FORMATID_FIRSTUSER 113
+#define FORMATID_FIRSTUSER 100
// EXPORT
Modified: trunk/Scribus/scribus/plugins/import/ai/importaiplugin.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18297&path=/trunk/Scribus/scribus/plugins/import/ai/importaiplugin.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/ai/importaiplugin.cpp (original)
+++ trunk/Scribus/scribus/plugins/import/ai/importaiplugin.cpp Thu May 30 09:28:40 2013
@@ -93,9 +93,8 @@
{
FileFormat fmt(this);
fmt.trName = FormatsManager::instance()->nameOfFormat(FormatsManager::AI); // Human readable name
- fmt.formatId = FORMATID_AIIMPORT;
+ fmt.formatId = 0;
fmt.filter = FormatsManager::instance()->extensionsForFormat(FormatsManager::AI); // QFileDialog filter
- fmt.nameMatch = QRegExp("\\."+FormatsManager::instance()->extensionListForFormat(FormatsManager::AI, 1)+"$", Qt::CaseInsensitive);
fmt.fileExtensions = QStringList() << "ai";
fmt.load = true;
fmt.save = false;
@@ -174,7 +173,7 @@
if ((QPushButton *)msgBox.clickedButton() == pdfButton)
{
//Import PDF
- const FileFormat *fmt = LoadSavePlugin::getFormatById(FORMATID_PDFIMPORT);
+ const FileFormat *fmt = LoadSavePlugin::getFormatByExt("pdf");
if (!fmt)
{
QMessageBox::warning(ScCore->primaryMainWindow(), CommonStrings::trWarning, tr("The PDF Import plugin could not be found"), 1, 0, 0);
Modified: trunk/Scribus/scribus/plugins/import/cgm/importcgmplugin.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18297&path=/trunk/Scribus/scribus/plugins/import/cgm/importcgmplugin.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/cgm/importcgmplugin.cpp (original)
+++ trunk/Scribus/scribus/plugins/import/cgm/importcgmplugin.cpp Thu May 30 09:28:40 2013
@@ -97,7 +97,6 @@
fmt.trName = tr("CGM File"); // Human readable name
fmt.formatId = 0;
fmt.filter = tr("CGM File (*.cgm *.CGM)"); // QFileDialog filter
- fmt.nameMatch = QRegExp("\\.cgm$", Qt::CaseInsensitive);
fmt.fileExtensions = QStringList() << "cgm";
fmt.load = true;
fmt.save = false;
Modified: trunk/Scribus/scribus/plugins/import/cvg/importcvgplugin.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18297&path=/trunk/Scribus/scribus/plugins/import/cvg/importcvgplugin.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/cvg/importcvgplugin.cpp (original)
+++ trunk/Scribus/scribus/plugins/import/cvg/importcvgplugin.cpp Thu May 30 09:28:40 2013
@@ -88,9 +88,8 @@
{
FileFormat fmt(this);
fmt.trName = FormatsManager::instance()->nameOfFormat(FormatsManager::CVG); // Human readable name
- fmt.formatId = FORMATID_CVGIMPORT;
+ fmt.formatId = 0;
fmt.filter = FormatsManager::instance()->extensionsForFormat(FormatsManager::CVG); // QFileDialog filter
- fmt.nameMatch = QRegExp("\\."+FormatsManager::instance()->extensionListForFormat(FormatsManager::CVG, 1)+"$", Qt::CaseInsensitive);
fmt.fileExtensions = QStringList() << "cvg";
fmt.load = true;
fmt.save = false;
Modified: trunk/Scribus/scribus/plugins/import/drw/importdrwplugin.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18297&path=/trunk/Scribus/scribus/plugins/import/drw/importdrwplugin.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/drw/importdrwplugin.cpp (original)
+++ trunk/Scribus/scribus/plugins/import/drw/importdrwplugin.cpp Thu May 30 09:28:40 2013
@@ -98,7 +98,6 @@
fmt.trName = tr("Micrografx DRW File"); // Human readable name
fmt.formatId = 0;
fmt.filter = tr("Micrografx DRW File (*.drw *.DRW)"); // QFileDialog filter
- fmt.nameMatch = QRegExp("\\.drw$", Qt::CaseInsensitive);
fmt.fileExtensions = QStringList() << "drw";
fmt.load = true;
fmt.save = false;
Modified: trunk/Scribus/scribus/plugins/import/idml/importidmlplugin.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18297&path=/trunk/Scribus/scribus/plugins/import/idml/importidmlplugin.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/idml/importidmlplugin.cpp (original)
+++ trunk/Scribus/scribus/plugins/import/idml/importidmlplugin.cpp Thu May 30 09:28:40 2013
@@ -99,7 +99,6 @@
fmt.trName = tr("Adobe Indesign IDML");
fmt.filter = tr("Adobe Indesign IDML (*.idml *.IDML)");
fmt.formatId = 0;
- fmt.nameMatch = QRegExp("\\.idml$", Qt::CaseInsensitive);
fmt.fileExtensions = QStringList() << "idml";
fmt.load = true;
fmt.save = false;
@@ -114,7 +113,6 @@
fmt2.trName = tr("Adobe Indesign IDMS");
fmt2.filter = tr("Adobe Indesign IDMS (*.idms *.IDMS)");
fmt2.formatId = 0;
- fmt2.nameMatch = QRegExp("\\.idms$", Qt::CaseInsensitive);
fmt2.fileExtensions = QStringList() << "idms";
fmt2.load = true;
fmt2.save = false;
Modified: trunk/Scribus/scribus/plugins/import/oodraw/oodrawimp.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18297&path=/trunk/Scribus/scribus/plugins/import/oodraw/oodrawimp.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/oodraw/oodrawimp.cpp (original)
+++ trunk/Scribus/scribus/plugins/import/oodraw/oodrawimp.cpp Thu May 30 09:28:40 2013
@@ -124,9 +124,8 @@
QString odtName = tr("OpenDocument 1.0 Draw", "Import/export format name");
FileFormat odtformat(this);
odtformat.trName = odtName; // Human readable name
- odtformat.formatId = FORMATID_ODGIMPORT;
+ odtformat.formatId = 0;
odtformat.filter = odtName + " (*.odg *.ODG)"; // QFileDialog filter
- odtformat.nameMatch = QRegExp("\\.odg$", Qt::CaseInsensitive);
odtformat.fileExtensions = QStringList() << "odg";
odtformat.load = true;
odtformat.save = false;
@@ -138,9 +137,8 @@
QString sxdName = tr("OpenOffice.org 1.x Draw", "Import/export format name");
FileFormat sxdformat(this);
sxdformat.trName = sxdName; // Human readable name
- sxdformat.formatId = FORMATID_SXDIMPORT;
+ sxdformat.formatId = 0;
sxdformat.filter = sxdName + " (*.sxd *.SXD)"; // QFileDialog filter
- sxdformat.nameMatch = QRegExp("\\.sxd$", Qt::CaseInsensitive);
sxdformat.fileExtensions = QStringList() << "sxd";
sxdformat.load = true;
sxdformat.save = false;
Modified: trunk/Scribus/scribus/plugins/import/pct/importpctplugin.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18297&path=/trunk/Scribus/scribus/plugins/import/pct/importpctplugin.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/pct/importpctplugin.cpp (original)
+++ trunk/Scribus/scribus/plugins/import/pct/importpctplugin.cpp Thu May 30 09:28:40 2013
@@ -88,9 +88,8 @@
{
FileFormat fmt(this);
fmt.trName = FormatsManager::instance()->nameOfFormat(FormatsManager::PCT); // Human readable name
- fmt.formatId = FORMATID_PCTIMPORT;
+ fmt.formatId = 0;
fmt.filter = FormatsManager::instance()->extensionsForFormat(FormatsManager::PCT); // QFileDialog filter
- fmt.nameMatch = QRegExp("\\."+FormatsManager::instance()->extensionListForFormat(FormatsManager::PCT, 1)+"$", Qt::CaseInsensitive);
fmt.fileExtensions = QStringList() << "pct" << "pic" << "pict";
fmt.load = true;
fmt.save = false;
@@ -129,7 +128,8 @@
else
return true;
}
- m_Doc=ScCore->primaryMainWindow()->doc;
+ if (m_Doc == 0)
+ m_Doc=ScCore->primaryMainWindow()->doc;
UndoTransaction* activeTransaction = NULL;
bool emptyDoc = (m_Doc == NULL);
bool hasCurrentPage = (m_Doc && m_Doc->currentPage());
Modified: trunk/Scribus/scribus/plugins/import/pdf/importpdfplugin.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18297&path=/trunk/Scribus/scribus/plugins/import/pdf/importpdfplugin.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/pdf/importpdfplugin.cpp (original)
+++ trunk/Scribus/scribus/plugins/import/pdf/importpdfplugin.cpp Thu May 30 09:28:40 2013
@@ -102,9 +102,8 @@
{
FileFormat fmt(this);
fmt.trName = FormatsManager::instance()->nameOfFormat(FormatsManager::PDF); // Human readable name
- fmt.formatId = FORMATID_PDFIMPORT;
+ fmt.formatId = 0;
fmt.filter = FormatsManager::instance()->extensionsForFormat(FormatsManager::PDF); // QFileDialog filter
- fmt.nameMatch = QRegExp("\\."+FormatsManager::instance()->extensionListForFormat(FormatsManager::PDF, 1)+"$", Qt::CaseInsensitive);
fmt.fileExtensions = QStringList() << "pdf";
fmt.load = true;
fmt.save = false;
@@ -117,9 +116,8 @@
{
FileFormat fmt2(this);
fmt2.trName = FormatsManager::instance()->nameOfFormat(FormatsManager::EPS); // Human readable name
- fmt2.formatId = FORMATID_EPSIMPORT;
+ fmt2.formatId = 0;
fmt2.filter = FormatsManager::instance()->extensionsForFormat(FormatsManager::EPS);// QFileDialog filter
- fmt2.nameMatch = QRegExp("\\.("+FormatsManager::instance()->extensionListForFormat(FormatsManager::EPS, 1)+")$", Qt::CaseInsensitive);
fmt2.fileExtensions = QStringList() << "eps" << "epsf" << "epsi" << "eps2" << "eps3" << "epi" << "ept";
fmt2.load = true;
fmt2.save = false;
@@ -129,9 +127,8 @@
FileFormat fmt3(this);
fmt3.trName = FormatsManager::instance()->nameOfFormat(FormatsManager::PS); // Human readable name
- fmt3.formatId = FORMATID_PSIMPORT;
+ fmt3.formatId = 0;
fmt3.filter = FormatsManager::instance()->extensionsForFormat(FormatsManager::PS);// QFileDialog filter
- fmt3.nameMatch = QRegExp("\\.("+FormatsManager::instance()->extensionListForFormat(FormatsManager::PS, 1)+")$", Qt::CaseInsensitive);
fmt3.fileExtensions = QStringList() << "ps";
fmt3.load = true;
fmt3.save = false;
Modified: trunk/Scribus/scribus/plugins/import/pub/importpub.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18297&path=/trunk/Scribus/scribus/plugins/import/pub/importpub.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/pub/importpub.cpp (original)
+++ trunk/Scribus/scribus/plugins/import/pub/importpub.cpp Thu May 30 09:28:40 2013
@@ -81,9 +81,9 @@
void RawPainter::startGraphics(const ::WPXPropertyList &propList)
{
if (propList["svg:width"])
- docWidth = propList["svg:width"]->getDouble() * 72.0;
+ docWidth = valueAsPoint(propList["svg:width"]);
if (propList["svg:height"])
- docHeight = propList["svg:height"]->getDouble() * 72.0;
+ docHeight = valueAsPoint(propList["svg:height"]);
if (importerFlags & LoadSavePlugin::lfCreateDoc)
{
if (!firstPage)
@@ -283,7 +283,7 @@
fillrule = true;
}
if (propList["svg:stroke-width"])
- LineW = propList["svg:stroke-width"]->getDouble() * 72.0;
+ LineW = valueAsPoint(propList["svg:stroke-width"]);
if (propList["draw:stroke"])
{
if (propList["draw:stroke"]->getStr() == "none")
@@ -301,19 +301,19 @@
dashArray.clear();
double gap = LineW;
if (propList["draw:distance"])
- gap = propList["draw:distance"]->getDouble() * 72;
+ gap = valueAsPoint(propList["draw:distance"]);
int dots1 = 0;
if (propList["draw:dots1"])
dots1 = propList["draw:dots1"]->getInt();
double dots1len = LineW;
if (propList["draw:dots1-length"])
- dots1len = propList["draw:dots1-length"]->getDouble() * 72;
+ dots1len = valueAsPoint(propList["draw:dots1-length"]);
int dots2 = 0;
if (propList["draw:dots2"])
dots2 = propList["draw:dots2"]->getInt();
double dots2len = LineW;
if (propList["draw:dots2-length"])
- dots2len = propList["draw:dots2-length"]->getDouble() * 72;
+ dots2len = valueAsPoint(propList["draw:dots2-length"]);
for (int i = 0; i < dots1; i++)
{
dashArray << qMax(dots1len, 0.1) << qMax(gap, 0.1);
@@ -361,10 +361,10 @@
return;
if (propList["svg:x"] && propList["svg:y"] && propList["svg:width"] && propList["svg:height"])
{
- double x = propList["svg:x"]->getDouble() * 72.0;
- double y = propList["svg:y"]->getDouble() * 72.0;
- double w = propList["svg:width"]->getDouble() * 72.0;
- double h = propList["svg:height"]->getDouble() * 72.0;
+ double x = valueAsPoint(propList["svg:x"]);
+ double y = valueAsPoint(propList["svg:y"]);
+ double w = valueAsPoint(propList["svg:width"]);
+ double h = valueAsPoint(propList["svg:height"]);
int z = m_Doc->itemAdd(PageItem::Polygon, PageItem::Rectangle, baseX + x, baseY + y, w, h, LineW, CurrColorFill, CurrColorStroke, true);
PageItem *ite = m_Doc->Items->at(z);
finishItem(ite);
@@ -381,10 +381,10 @@
return;
if (propList["svg:x"] && propList["svg:y"] && propList["svg:width"] && propList["svg:height"])
{
- double x = propList["svg:x"]->getDouble() * 72.0;
- double y = propList["svg:y"]->getDouble() * 72.0;
- double w = propList["svg:width"]->getDouble() * 72.0;
- double h = propList["svg:height"]->getDouble() * 72.0;
+ double x = valueAsPoint(propList["svg:x"]);
+ double y = valueAsPoint(propList["svg:y"]);
+ double w = valueAsPoint(propList["svg:width"]);
+ double h = valueAsPoint(propList["svg:height"]);
int z = m_Doc->itemAdd(PageItem::Polygon, PageItem::Ellipse, baseX + x, baseY + y, w, h, LineW, CurrColorFill, CurrColorStroke, true);
PageItem *ite = m_Doc->Items->at(z);
finishItem(ite);
@@ -402,10 +402,10 @@
Coords.resize(0);
Coords.svgInit();
PageItem *ite;
- Coords.svgMoveTo(72 * vertices[0]["svg:x"]->getDouble(), 72 * vertices[0]["svg:y"]->getDouble());
+ Coords.svgMoveTo(valueAsPoint(vertices[0]["svg:x"]), valueAsPoint(vertices[0]["svg:y"]));
for(unsigned i = 1; i < vertices.count(); i++)
{
- Coords.svgLineTo(72 * vertices[i]["svg:x"]->getDouble(), 72 * vertices[i]["svg:y"]->getDouble());
+ Coords.svgLineTo(valueAsPoint(vertices[i]["svg:x"]), valueAsPoint(vertices[i]["svg:y"]));
}
if (Coords.size() > 0)
{
@@ -426,10 +426,10 @@
Coords.svgInit();
PageItem *ite;
int z;
- Coords.svgMoveTo(72 * vertices[0]["svg:x"]->getDouble(), 72 * vertices[0]["svg:y"]->getDouble());
+ Coords.svgMoveTo(valueAsPoint(vertices[0]["svg:x"]), valueAsPoint(vertices[0]["svg:y"]));
for(unsigned i = 1; i < vertices.count(); i++)
{
- Coords.svgLineTo(72 * vertices[i]["svg:x"]->getDouble(), 72 * vertices[i]["svg:y"]->getDouble());
+ Coords.svgLineTo(valueAsPoint(vertices[i]["svg:x"]), valueAsPoint(vertices[i]["svg:y"]));
}
Coords.svgClosePath();
if (Coords.size() > 0)
@@ -481,13 +481,38 @@
if (m_Doc->m_Selection->count() > 0)
{
ite = m_Doc->groupObjectsSelection();
+ double rot = 0;
+ if (m_style["libwpg:rotate"])
+ rot = m_style["libwpg:rotate"]->getDouble();
QPainterPath ba = Coords.toQPainterPath(true);
QRectF baR = ba.boundingRect();
- ite->setXYPos(baseX + baR.x(), baseY + baR.y(), true);
- ite->setWidthHeight(baR.width(), baR.height(), true);
- FPoint tp2(getMinClipF(&Coords));
- Coords.translate(-tp2.x(), -tp2.y());
- ite->PoLine = Coords.copy();
+ if (rot != 0)
+ {
+ QTransform mm;
+ mm.translate(baR.width() / 2.0, baR.height() / 2.0);
+ mm.rotate(rot);
+ mm.translate(-baR.width() / 2.0, -baR.height() / 2.0);
+ ba = mm.map(ba);
+ baR = ba.boundingRect();
+ ite->setXYPos(baseX + baR.x(), baseY + baR.y(), true);
+ ite->setWidthHeight(baR.width(), baR.height(), true);
+ Coords.fromQPainterPath(ba, true);
+ FPoint tp2(getMinClipF(&Coords));
+ Coords.translate(-tp2.x(), -tp2.y());
+ ite->PoLine = Coords.copy();
+ int rm = m_Doc->RotMode();
+ m_Doc->RotMode(2);
+ m_Doc->RotateItem(-rot, ite);
+ m_Doc->RotMode(rm);
+ }
+ else
+ {
+ ite->setXYPos(baseX + baR.x(), baseY + baR.y(), true);
+ ite->setWidthHeight(baR.width(), baR.height(), true);
+ FPoint tp2(getMinClipF(&Coords));
+ Coords.translate(-tp2.x(), -tp2.y());
+ ite->PoLine = Coords.copy();
+ }
finishItem(ite);
}
}
@@ -519,15 +544,15 @@
{
WPXPropertyList propList = path[i];
if (propList["libwpg:path-action"] && propList["libwpg:path-action"]->getStr() == "M")
- svgString += QString("M %1 %2 ").arg(propList["svg:x"]->getDouble() * 72.0).arg(propList["svg:y"]->getDouble() * 72.0);
+ svgString += QString("M %1 %2 ").arg(valueAsPoint(propList["svg:x"])).arg(valueAsPoint(propList["svg:y"]));
else if (propList["libwpg:path-action"] && propList["libwpg:path-action"]->getStr() == "L")
- svgString += QString("L %1 %2 ").arg(propList["svg:x"]->getDouble() * 72.0).arg(propList["svg:y"]->getDouble() * 72.0);
+ svgString += QString("L %1 %2 ").arg(valueAsPoint(propList["svg:x"])).arg(valueAsPoint(propList["svg:y"]));
else if (propList["libwpg:path-action"] && propList["libwpg:path-action"]->getStr() == "C")
- svgString += QString("C %1 %2 %3 %4 %5 %6 ").arg(propList["svg:x1"]->getDouble() * 72.0).arg(propList["svg:y1"]->getDouble() * 72.0).arg(propList["svg:x2"]->getDouble() * 72.0).arg(propList["svg:y2"]->getDouble() * 72.0).arg(propList["svg:x"]->getDouble() * 72.0).arg(propList["svg:y"]->getDouble() * 72.0);
+ svgString += QString("C %1 %2 %3 %4 %5 %6 ").arg(valueAsPoint(propList["svg:x1"])).arg(valueAsPoint(propList["svg:y1"])).arg(valueAsPoint(propList["svg:x2"])).arg(valueAsPoint(propList["svg:y2"])).arg(valueAsPoint(propList["svg:x"])).arg(valueAsPoint(propList["svg:y"]));
else if (propList["libwpg:path-action"] && propList["libwpg:path-action"]->getStr() == "Q")
- svgString += QString("Q %1 %2 %3 %4 ").arg(propList["svg:x1"]->getDouble() * 72.0).arg(propList["svg:y1"]->getDouble() * 72.0).arg(propList["svg:x"]->getDouble() * 72.0).arg(propList["svg:y"]->getDouble() * 72.0);
+ svgString += QString("Q %1 %2 %3 %4 ").arg(valueAsPoint(propList["svg:x1"])).arg(valueAsPoint(propList["svg:y1"])).arg(valueAsPoint(propList["svg:x"])).arg(valueAsPoint(propList["svg:y"]));
else if (propList["libwpg:path-action"] && propList["libwpg:path-action"]->getStr() == "A")
- svgString += QString("A %1 %2 %3 %4 %5 %6 %7") .arg(propList["svg:rx"]->getDouble() * 72.0) .arg(propList["svg:ry"]->getDouble() * 72.0) .arg(propList["libwpg:rotate"] ? propList["libwpg:rotate"]->getDouble() : 0) .arg(propList["libwpg:large-arc"] ? propList["libwpg:large-arc"]->getInt() : 1) .arg(propList["libwpg:sweep"] ? propList["libwpg:sweep"]->getInt() : 1) .arg(propList["svg:x"]->getDouble() * 72.0) .arg(propList["svg:y"]->getDouble() * 72.0);
+ svgString += QString("A %1 %2 %3 %4 %5 %6 %7") .arg(valueAsPoint(propList["svg:rx"])) .arg(valueAsPoint(propList["svg:ry"])).arg(propList["libwpg:rotate"] ? propList["libwpg:rotate"]->getDouble() : 0).arg(propList["libwpg:large-arc"] ? propList["libwpg:large-arc"]->getInt() : 1).arg(propList["libwpg:sweep"] ? propList["libwpg:sweep"]->getInt() : 1).arg(valueAsPoint(propList["svg:x"])).arg(valueAsPoint(propList["svg:y"]));
else if ((i >= path.count()-1 && i > 2) && propList["libwpg:path-action"] && propList["libwpg:path-action"]->getStr() == "Z" )
{
isClosed = true;
@@ -634,10 +659,10 @@
if (propList["svg:x"] && propList["svg:y"] && propList["svg:width"] && propList["svg:height"])
{
PageItem *ite;
- double x = propList["svg:x"]->getDouble() * 72.0;
- double y = propList["svg:y"]->getDouble() * 72.0;
- double w = propList["svg:width"]->getDouble() * 72.0;
- double h = propList["svg:height"]->getDouble() * 72.0;
+ double x = valueAsPoint(propList["svg:x"]);
+ double y = valueAsPoint(propList["svg:y"]);
+ double w = valueAsPoint(propList["svg:width"]);
+ double h = valueAsPoint(propList["svg:height"]);
QByteArray ba(base64.cstr());
QByteArray imageData = QByteArray::fromBase64(ba);
QString imgExt = "";
@@ -709,10 +734,10 @@
lineSpIsPT = false;
if (propList["svg:x"] && propList["svg:y"] && propList["svg:width"] && propList["svg:height"])
{
- double x = propList["svg:x"]->getDouble() * 72.0;
- double y = propList["svg:y"]->getDouble() * 72.0;
- double w = propList["svg:width"]->getDouble() * 72.0;
- double h = propList["svg:height"]->getDouble() * 72.0;
+ double x = valueAsPoint(propList["svg:x"]);
+ double y = valueAsPoint(propList["svg:y"]);
+ double w = valueAsPoint(propList["svg:width"]);
+ double h = valueAsPoint(propList["svg:height"]);
double rot = 0;
if (propList["libwpg:rotate"])
rot = propList["libwpg:rotate"]->getDouble();
@@ -728,17 +753,17 @@
m_Doc->RotMode(rm);
}
if (propList["fo:padding-left"])
- ite->setTextToFrameDistLeft(propList["fo:padding-left"]->getDouble() * 72.0);
+ ite->setTextToFrameDistLeft(valueAsPoint(propList["fo:padding-left"]));
if (propList["fo:padding-right"])
- ite->setTextToFrameDistRight(propList["fo:padding-right"]->getDouble() * 72.0);
+ ite->setTextToFrameDistRight(valueAsPoint(propList["fo:padding-right"]));
if (propList["fo:padding-top"])
- ite->setTextToFrameDistTop(propList["fo:padding-top"]->getDouble() * 72.0);
+ ite->setTextToFrameDistTop(valueAsPoint(propList["fo:padding-top"]));
if (propList["fo:padding-bottom"])
- ite->setTextToFrameDistBottom(propList["fo:padding-bottom"]->getDouble() * 72.0);
+ ite->setTextToFrameDistBottom(valueAsPoint(propList["fo:padding-bottom"]));
if (propList["fo:column-count"])
ite->setColumns(propList["fo:column-count"]->getInt());
if (propList["fo:column-gap"])
- ite->setColumnGap(propList["fo:column-gap"]->getDouble() * 72.0);
+ ite->setColumnGap(valueAsPoint(propList["fo:column-gap"]));
ite->setFirstLineOffset(FLOPFontAscent);
actTextItem = ite;
QString pStyle = CommonStrings::DefaultParagraphStyle;
@@ -778,20 +803,20 @@
textStyle.setAlignment(ParagraphStyle::Justified);
}
if (propList["fo:margin-left"])
- textStyle.setLeftMargin(propList["fo:margin-left"]->getDouble() * 72.0);
+ textStyle.setLeftMargin(valueAsPoint(propList["fo:margin-left"]));
if (propList["fo:margin-right"])
- textStyle.setRightMargin(propList["fo:margin-right"]->getDouble() * 72.0);
+ textStyle.setRightMargin(valueAsPoint(propList["fo:margin-right"]));
if (propList["fo:text-indent"])
- textStyle.setFirstIndent(propList["fo:text-indent"]->getDouble() * 72.0);
+ textStyle.setFirstIndent(valueAsPoint(propList["fo:text-indent"]));
if (propList["style:drop-cap"])
{
textStyle.setDropCapLines(propList["style:drop-cap"]->getInt());
textStyle.setHasDropCap(true);
}
if (propList["fo:margin-bottom"])
- textStyle.setGapAfter(propList["fo:margin-bottom"]->getDouble() * 72.0);
+ textStyle.setGapAfter(valueAsPoint(propList["fo:margin-bottom"]));
if (propList["fo:margin-top"])
- textStyle.setGapBefore(propList["fo:margin-top"]->getDouble() * 72.0);
+ textStyle.setGapBefore(valueAsPoint(propList["fo:margin-top"]));
m_maxFontSize = textStyle.charStyle().fontSize() / 10.0;
if (propList["fo:line-height"])
{
@@ -824,8 +849,8 @@
textCharStyle = textStyle.charStyle();
if (propList["fo:font-size"])
{
- textCharStyle.setFontSize(propList["fo:font-size"]->getDouble() * 720.0);
- m_maxFontSize = qMax(m_maxFontSize, propList["fo:font-size"]->getDouble() * 72.0);
+ textCharStyle.setFontSize(valueAsPoint(propList["fo:font-size"]) * 10.0);
+ m_maxFontSize = qMax(m_maxFontSize, valueAsPoint(propList["fo:font-size"]));
}
if (propList["fo:color"])
textCharStyle.setFillColor(parseColor(QString(propList["fo:color"]->getStr().cstr())));
@@ -948,6 +973,17 @@
}
}
return fontName;
+}
+
+double RawPainter::valueAsPoint(const WPXProperty *prop)
+{
+ double value = 0.0;
+ QString str = QString(prop->getStr().cstr()).toLower();
+ if (str.endsWith("in"))
+ value = prop->getDouble() * 72.0;
+ else
+ value = prop->getDouble();
+ return value;
}
double RawPainter::fromPercentage( const QString &s )
@@ -1272,9 +1308,9 @@
double xof = 0.0;
double yof = 0.0;
if (m_style["draw:shadow-offset-x"])
- xof = m_style["draw:shadow-offset-x"]->getDouble() * 72.0;
+ xof = valueAsPoint(m_style["draw:shadow-offset-x"]);
if (m_style["draw:shadow-offset-y"])
- yof = m_style["draw:shadow-offset-y"]->getDouble() * 72.0;
+ yof = valueAsPoint(m_style["draw:shadow-offset-y"]);
xp += xof;
yp += yof;
QString shadowColor = CurrColorFill;
Modified: trunk/Scribus/scribus/plugins/import/pub/importpub.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18297&path=/trunk/Scribus/scribus/plugins/import/pub/importpub.h
==============================================================================
--- trunk/Scribus/scribus/plugins/import/pub/importpub.h (original)
+++ trunk/Scribus/scribus/plugins/import/pub/importpub.h Thu May 30 09:28:40 2013
@@ -55,6 +55,7 @@
void endTextSpan();
void insertText(const ::WPXString &str);
QString constructFontName(QString fontBaseName, QString fontStyle);
+ double valueAsPoint(const WPXProperty *prop);
double fromPercentage(const QString &s );
QColor parseColorN( const QString &rgbColor );
QString parseColor( const QString &s );
Modified: trunk/Scribus/scribus/plugins/import/pub/importpubplugin.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18297&path=/trunk/Scribus/scribus/plugins/import/pub/importpubplugin.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/pub/importpubplugin.cpp (original)
+++ trunk/Scribus/scribus/plugins/import/pub/importpubplugin.cpp Thu May 30 09:28:40 2013
@@ -90,7 +90,6 @@
fmt.trName = tr("MS Publisher");
fmt.filter = tr("MS Publisher (*.pub *.PUB)");
fmt.formatId = 0;
- fmt.nameMatch = QRegExp("\\.pub$", Qt::CaseInsensitive);
fmt.fileExtensions = QStringList() << "pub";
fmt.load = true;
fmt.save = false;
Modified: trunk/Scribus/scribus/plugins/import/shape/importshapeplugin.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18297&path=/trunk/Scribus/scribus/plugins/import/shape/importshapeplugin.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/shape/importshapeplugin.cpp (original)
+++ trunk/Scribus/scribus/plugins/import/shape/importshapeplugin.cpp Thu May 30 09:28:40 2013
@@ -90,7 +90,6 @@
fmt.trName = tr("Dia Shapes \"*.shape\" File"); // Human readable name
fmt.formatId = 0;
fmt.filter = tr("Dia shapes \"*.shape\" File (*.shape *.SHAPE)"); // QFileDialog filter
- fmt.nameMatch = QRegExp("\\.shape$", Qt::CaseInsensitive);
fmt.fileExtensions = QStringList() << "shape";
fmt.load = true;
fmt.save = false;
Modified: trunk/Scribus/scribus/plugins/import/sml/importsmlplugin.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18297&path=/trunk/Scribus/scribus/plugins/import/sml/importsmlplugin.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/sml/importsmlplugin.cpp (original)
+++ trunk/Scribus/scribus/plugins/import/sml/importsmlplugin.cpp Thu May 30 09:28:40 2013
@@ -90,7 +90,6 @@
fmt.trName = tr("Kivio Stencils \"*.sml\" File"); // Human readable name
fmt.formatId = 0;
fmt.filter = tr("Kivio Stencils \"*.sml\" File (*.sml *.SML)"); // QFileDialog filter
- fmt.nameMatch = QRegExp("\\.sml$", Qt::CaseInsensitive);
fmt.fileExtensions = QStringList() << "sml";
fmt.load = true;
fmt.save = false;
Modified: trunk/Scribus/scribus/plugins/import/svg/svgplugin.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18297&path=/trunk/Scribus/scribus/plugins/import/svg/svgplugin.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/svg/svgplugin.cpp (original)
+++ trunk/Scribus/scribus/plugins/import/svg/svgplugin.cpp Thu May 30 09:28:40 2013
@@ -125,9 +125,8 @@
{
FileFormat fmt(this);
fmt.trName = FormatsManager::instance()->nameOfFormat(FormatsManager::SVG);
- fmt.formatId = FORMATID_SVGIMPORT;
+ fmt.formatId = 0;
fmt.filter = FormatsManager::instance()->extensionsForFormat(FormatsManager::SVG);
- fmt.nameMatch = QRegExp("\\."+FormatsManager::instance()->extensionListForFormat(FormatsManager::SVG, 1)+"$", Qt::CaseInsensitive);
fmt.fileExtensions = QStringList() << "svg" << "svgz";
fmt.load = true;
fmt.save = false;
Modified: trunk/Scribus/scribus/plugins/import/uniconvertor/uniconvplugin.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18297&path=/trunk/Scribus/scribus/plugins/import/uniconvertor/uniconvplugin.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/uniconvertor/uniconvplugin.cpp (original)
+++ trunk/Scribus/scribus/plugins/import/uniconvertor/uniconvplugin.cpp Thu May 30 09:28:40 2013
@@ -67,7 +67,7 @@
void UniconvImportPlugin::languageChange()
{
QString name = tr("Uniconvertor Import");
- FileFormat* fmt = getFormatByID(FORMATID_UNICONVIMPORT);
+ FileFormat* fmt = getFormatByExt("cdt");
fmt->trName = name;
fmt->filter = name + " (" + FormatsManager::instance()->extensionListForFormat( FormatsManager::UNICONV, 0)+")";
}
@@ -100,13 +100,9 @@
QString name = tr("Uniconvertor Import");
FileFormat fmt(this);
fmt.trName = name;
- fmt.formatId = FORMATID_UNICONVIMPORT;
- fmt.filter = name + " (" +
- FormatsManager::instance()->extensionListForFormat(
- FormatsManager::UNICONV, 0)+")"; // QFileDialog filter
- fmt.nameMatch = QRegExp("\\.("+
- FormatsManager::instance()->extensionListForFormat(
- FormatsManager::UNICONV, 1)+")$", Qt::CaseInsensitive);
+ fmt.formatId = 0;
+ fmt.filter = name + " (" + FormatsManager::instance()->extensionListForFormat( FormatsManager::UNICONV, 0)+")"; // QFileDialog filter
+ fmt.fileExtensions = QStringList() << "cdt" << "ccx" << "aff" << "sk" << "sk1" << "plt" << "dxf" << "dst" << "pes" << "exp" << "pcs";
fmt.load = true;
fmt.save = false;
//TODO: fmt.mimeTypes = QStringList(""); // MIME types
@@ -182,7 +178,7 @@
}
//Import SVG
- const FileFormat *fmt = LoadSavePlugin::getFormatById(FORMATID_SVGIMPORT);
+ const FileFormat *fmt = LoadSavePlugin::getFormatByExt("svg");
if (!fmt) {
QMessageBox::warning(mw, CommonStrings::trWarning, tr("The SVG Import plugin could not be found"), 1, 0, 0);
return false;
Modified: trunk/Scribus/scribus/plugins/import/wmf/wmfimportplugin.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18297&path=/trunk/Scribus/scribus/plugins/import/wmf/wmfimportplugin.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/wmf/wmfimportplugin.cpp (original)
+++ trunk/Scribus/scribus/plugins/import/wmf/wmfimportplugin.cpp Thu May 30 09:28:40 2013
@@ -105,9 +105,8 @@
{
FileFormat fmt(this);
fmt.trName = FormatsManager::instance()->nameOfFormat(FormatsManager::WMF);
- fmt.formatId = FORMATID_WMFIMPORT;
+ fmt.formatId = 0;
fmt.filter = FormatsManager::instance()->extensionsForFormat(FormatsManager::WMF);
- fmt.nameMatch = QRegExp("\\."+FormatsManager::instance()->extensionListForFormat(FormatsManager::WMF, 1)+"$", Qt::CaseInsensitive);
fmt.fileExtensions = QStringList() << "wmf";
fmt.load = true;
fmt.save = false;
Modified: trunk/Scribus/scribus/plugins/import/wpg/importwpgplugin.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18297&path=/trunk/Scribus/scribus/plugins/import/wpg/importwpgplugin.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/wpg/importwpgplugin.cpp (original)
+++ trunk/Scribus/scribus/plugins/import/wpg/importwpgplugin.cpp Thu May 30 09:28:40 2013
@@ -88,9 +88,8 @@
{
FileFormat fmt(this);
fmt.trName = FormatsManager::instance()->nameOfFormat(FormatsManager::WPG); // Human readable name
- fmt.formatId = FORMATID_WPGIMPORT;
+ fmt.formatId = 0;
fmt.filter = FormatsManager::instance()->extensionsForFormat(FormatsManager::WPG); // QFileDialog filter
- fmt.nameMatch = QRegExp("\\."+FormatsManager::instance()->extensionListForFormat(FormatsManager::WPG, 1)+"$", Qt::CaseInsensitive);
fmt.fileExtensions = QStringList() << "wpg";
fmt.load = true;
fmt.save = false;
Modified: trunk/Scribus/scribus/plugins/import/xar/importxarplugin.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18297&path=/trunk/Scribus/scribus/plugins/import/xar/importxarplugin.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/xar/importxarplugin.cpp (original)
+++ trunk/Scribus/scribus/plugins/import/xar/importxarplugin.cpp Thu May 30 09:28:40 2013
@@ -90,7 +90,6 @@
fmt.trName = tr("XARA \"*.xar\" File"); // Human readable name
fmt.formatId = 0;
fmt.filter = tr("XARA \"*.xar\" File (*.xar *.XAR)"); // QFileDialog filter
- fmt.nameMatch = QRegExp("\\.xar$", Qt::CaseInsensitive);
fmt.fileExtensions = QStringList() << "xar";
fmt.load = true;
fmt.save = false;
Modified: trunk/Scribus/scribus/plugins/import/xfig/importxfigplugin.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18297&path=/trunk/Scribus/scribus/plugins/import/xfig/importxfigplugin.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/xfig/importxfigplugin.cpp (original)
+++ trunk/Scribus/scribus/plugins/import/xfig/importxfigplugin.cpp Thu May 30 09:28:40 2013
@@ -88,9 +88,8 @@
{
FileFormat fmt(this);
fmt.trName = FormatsManager::instance()->nameOfFormat(FormatsManager::XFIG); // Human readable name
- fmt.formatId = FORMATID_XFIGIMPORT;
+ fmt.formatId = 0;
fmt.filter = FormatsManager::instance()->extensionsForFormat(FormatsManager::XFIG); // QFileDialog filter
- fmt.nameMatch = QRegExp("\\."+FormatsManager::instance()->extensionListForFormat(FormatsManager::XFIG, 1)+"$", Qt::CaseInsensitive);
fmt.fileExtensions = QStringList() << "fig";
fmt.load = true;
fmt.save = false;
Modified: trunk/Scribus/scribus/plugins/picbrowser/loadimage.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18297&path=/trunk/Scribus/scribus/plugins/picbrowser/loadimage.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/picbrowser/loadimage.cpp (original)
+++ trunk/Scribus/scribus/plugins/picbrowser/loadimage.cpp Thu May 30 09:28:40 2013
@@ -83,13 +83,13 @@
QFileInfo fi = QFileInfo(path);
QString ext = fi.suffix().toLower();
- QStringList allFormatsV = LoadSavePlugin::getExtensionsForPreview(FORMATID_ODGIMPORT);
+ QStringList allFormatsV = LoadSavePlugin::getExtensionsForPreview(FORMATID_FIRSTUSER);
if (allFormatsV.contains(ext.toUtf8()))
{
FileLoader *fileLoader = new FileLoader(path);
int testResult = fileLoader->testFile();
delete fileLoader;
- if ((testResult != -1) && (testResult >= FORMATID_ODGIMPORT))
+ if ((testResult != -1) && (testResult >= FORMATID_FIRSTUSER))
{
const FileFormat * fmt = LoadSavePlugin::getFormatById(testResult);
if( fmt )
Modified: trunk/Scribus/scribus/plugins/picbrowser/picturebrowser.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18297&path=/trunk/Scribus/scribus/plugins/picbrowser/picturebrowser.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/picbrowser/picturebrowser.cpp (original)
+++ trunk/Scribus/scribus/plugins/picbrowser/picturebrowser.cpp Thu May 30 09:28:40 2013
@@ -238,7 +238,7 @@
nameFilters = formatD.split(" ", QString::SkipEmptyParts);
nameFilters.append("*.svg");
- QStringList vectorFiles = LoadSavePlugin::getExtensionsForPreview(FORMATID_ODGIMPORT);
+ QStringList vectorFiles = LoadSavePlugin::getExtensionsForPreview(FORMATID_FIRSTUSER);
for (int v = 0; v < vectorFiles.count(); v++)
{
nameFilters.append("*." + vectorFiles[v]);
Modified: trunk/Scribus/scribus/plugins/scriptplugin/svgimport.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18297&path=/trunk/Scribus/scribus/plugins/scriptplugin/svgimport.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/scriptplugin/svgimport.cpp (original)
+++ trunk/Scribus/scribus/plugins/scriptplugin/svgimport.cpp Thu May 30 09:28:40 2013
@@ -30,7 +30,7 @@
return NULL;
if(!checkHaveDocument())
return NULL;
- QStringList allFormatsV = LoadSavePlugin::getExtensionsForImport(FORMATID_ODGIMPORT);
+ QStringList allFormatsV = LoadSavePlugin::getExtensionsForImport(FORMATID_FIRSTUSER);
QString fName = QString::fromUtf8(Image);
QFileInfo fi = QFileInfo(fName);
QString ext = fi.suffix().toLower();
@@ -42,7 +42,7 @@
FileLoader *fileLoader = new FileLoader(fName);
int testResult = fileLoader->testFile();
delete fileLoader;
- if ((testResult != -1) && (testResult >= FORMATID_ODGIMPORT))
+ if ((testResult != -1) && (testResult >= FORMATID_FIRSTUSER))
{
const FileFormat * fmt = LoadSavePlugin::getFormatById(testResult);
if( fmt )
Modified: trunk/Scribus/scribus/scribus.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18297&path=/trunk/Scribus/scribus/scribus.cpp
==============================================================================
--- trunk/Scribus/scribus/scribus.cpp (original)
+++ trunk/Scribus/scribus/scribus.cpp Thu May 30 09:28:40 2013
@@ -3558,13 +3558,13 @@
QFileInfo fi(data);
QString formatD(FormatsManager::instance()->extensionListForFormat(FormatsManager::RASTORIMAGES, 1));
QStringList rasterFiles = formatD.split("|");
- QStringList vectorFiles = LoadSavePlugin::getExtensionsForPreview(FORMATID_ODGIMPORT);
+ QStringList vectorFiles = LoadSavePlugin::getExtensionsForPreview(FORMATID_FIRSTUSER);
if (vectorFiles.contains(fi.suffix().toLower()))
{
FileLoader *fileLoader = new FileLoader(data);
int testResult = fileLoader->testFile();
delete fileLoader;
- if ((testResult != -1) && (testResult >= FORMATID_ODGIMPORT))
+ if ((testResult != -1) && (testResult >= FORMATID_FIRSTUSER))
{
const FileFormat * fmt = LoadSavePlugin::getFormatById(testResult);
if( fmt )
@@ -3643,7 +3643,7 @@
QString fileName = "";
QStringList formats;
QString allFormats = tr("All Supported Formats")+" (";
- int fmtCode = FORMATID_ODGIMPORT;
+ int fmtCode = FORMATID_FIRSTUSER;
const FileFormat *fmt = LoadSavePlugin::getFormatById(fmtCode);
while (fmt != 0)
{
@@ -3695,7 +3695,7 @@
FileLoader *fileLoader = new FileLoader(fileName);
int testResult = fileLoader->testFile();
delete fileLoader;
- if ((testResult != -1) && (testResult >= FORMATID_ODGIMPORT))
+ if ((testResult != -1) && (testResult >= FORMATID_FIRSTUSER))
{
const FileFormat * fmt = LoadSavePlugin::getFormatById(testResult);
if( fmt )
@@ -10125,7 +10125,7 @@
FileLoader *fileLoader = new FileLoader(url.path());
int testResult = fileLoader->testFile();
delete fileLoader;
- if ((testResult != -1) && (testResult >= FORMATID_ODGIMPORT))
+ if ((testResult != -1) && (testResult >= FORMATID_FIRSTUSER))
{
accepted = true;
break;
@@ -10193,7 +10193,7 @@
FileLoader *fileLoader = new FileLoader(url.path());
int testResult = fileLoader->testFile();
delete fileLoader;
- if ((testResult != -1) && (testResult >= FORMATID_ODGIMPORT))
+ if ((testResult != -1) && (testResult >= FORMATID_FIRSTUSER))
{
QFileInfo fi(url.path());
if ( fi.exists() )
Modified: trunk/Scribus/scribus/scribusview.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18297&path=/trunk/Scribus/scribus/scribusview.cpp
==============================================================================
--- trunk/Scribus/scribus/scribusview.cpp (original)
+++ trunk/Scribus/scribus/scribusview.cpp Thu May 30 09:28:40 2013
@@ -1002,7 +1002,7 @@
FileLoader *fileLoader = new FileLoader(url.toLocalFile());
int testResult = fileLoader->testFile();
delete fileLoader;
- if ((testResult != -1) && (testResult >= FORMATID_ODGIMPORT))
+ if ((testResult != -1) && (testResult >= FORMATID_FIRSTUSER))
vectorFile = true;
}
}
@@ -1083,7 +1083,7 @@
FileLoader *fileLoader = new FileLoader(url.toLocalFile());
int testResult = fileLoader->testFile();
delete fileLoader;
- if ((testResult != -1) && (testResult >= FORMATID_ODGIMPORT))
+ if ((testResult != -1) && (testResult >= FORMATID_FIRSTUSER))
{
const FileFormat * fmt = LoadSavePlugin::getFormatById(testResult);
if( fmt )
Modified: trunk/Scribus/scribus/ui/customfdialog.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18297&path=/trunk/Scribus/scribus/ui/customfdialog.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/customfdialog.cpp (original)
+++ trunk/Scribus/scribus/ui/customfdialog.cpp Thu May 30 09:28:40 2013
@@ -80,7 +80,7 @@
QIcon ImIconProvider::icon(const QFileInfo &fi) const
{
- QStringList allFormatsV = LoadSavePlugin::getExtensionsForImport(FORMATID_ODGIMPORT);
+ QStringList allFormatsV = LoadSavePlugin::getExtensionsForImport(FORMATID_FIRSTUSER);
QString ext = fi.suffix().toLower();
if (ext.isEmpty())
return QFileIconProvider::icon(fi);
@@ -149,7 +149,7 @@
formats.append("pat");
formats.removeAll("pdf");
- QStringList allFormatsV = LoadSavePlugin::getExtensionsForPreview(FORMATID_ODGIMPORT);
+ QStringList allFormatsV = LoadSavePlugin::getExtensionsForPreview(FORMATID_FIRSTUSER);
if (ext.isEmpty())
ext = getImageType(name);
if (formats.contains(ext.toUtf8()))
@@ -203,7 +203,7 @@
FileLoader *fileLoader = new FileLoader(name);
int testResult = fileLoader->testFile();
delete fileLoader;
- if ((testResult != -1) && (testResult >= FORMATID_ODGIMPORT))
+ if ((testResult != -1) && (testResult >= FORMATID_FIRSTUSER))
{
const FileFormat * fmt = LoadSavePlugin::getFormatById(testResult);
if( fmt )
Modified: trunk/Scribus/scribus/ui/paintmanager.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18297&path=/trunk/Scribus/scribus/ui/paintmanager.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/paintmanager.cpp (original)
+++ trunk/Scribus/scribus/ui/paintmanager.cpp Thu May 30 09:28:40 2013
@@ -1072,7 +1072,7 @@
QString fileName;
QStringList formats;
QString allFormats = tr("All Supported Formats")+" (";
- int fmtCode = FORMATID_ODGIMPORT;
+ int fmtCode = FORMATID_FIRSTUSER;
const FileFormat *fmt = LoadSavePlugin::getFormatById(fmtCode);
while (fmt != 0)
{
@@ -1304,7 +1304,7 @@
FileLoader *fileLoader = new FileLoader(data);
int testResult = fileLoader->testFile();
delete fileLoader;
- if ((testResult != -1) && (testResult >= FORMATID_ODGIMPORT))
+ if ((testResult != -1) && (testResult >= FORMATID_FIRSTUSER))
{
const FileFormat * fmt = LoadSavePlugin::getFormatById(testResult);
if( fmt )
Modified: trunk/Scribus/scribus/ui/scrapbookpalette.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18297&path=/trunk/Scribus/scribus/ui/scrapbookpalette.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/scrapbookpalette.cpp (original)
+++ trunk/Scribus/scribus/ui/scrapbookpalette.cpp Thu May 30 09:28:40 2013
@@ -81,7 +81,7 @@
void BibView::startDrag(Qt::DropActions supportedActions)
{
- QStringList vectorFiles = LoadSavePlugin::getExtensionsForPreview(FORMATID_ODGIMPORT);
+ QStringList vectorFiles = LoadSavePlugin::getExtensionsForPreview(FORMATID_FIRSTUSER);
QString formatD(FormatsManager::instance()->extensionListForFormat(FormatsManager::RASTORIMAGES, 1));
QStringList rasterFiles = formatD.split("|");
QString dt = objectMap[currentItem()->text()].Data;
@@ -143,7 +143,7 @@
}
else if ( e->mimeData()->hasFormat("text/uri-list"))
{
- QStringList vectorFiles = LoadSavePlugin::getExtensionsForPreview(FORMATID_ODGIMPORT);
+ QStringList vectorFiles = LoadSavePlugin::getExtensionsForPreview(FORMATID_FIRSTUSER);
QString formatD(FormatsManager::instance()->extensionListForFormat(FormatsManager::RASTORIMAGES, 1));
QStringList rasterFiles = formatD.split("|");
QList<QUrl> fileUrls = e->mimeData()->urls();
@@ -157,7 +157,7 @@
FileLoader *fileLoader = new FileLoader(url.path());
int testResult = fileLoader->testFile();
delete fileLoader;
- if ((testResult != -1) && (testResult >= FORMATID_ODGIMPORT) && (fi.exists()))
+ if ((testResult != -1) && (testResult >= FORMATID_FIRSTUSER) && (fi.exists()))
emit fileDropped(url.path(), testResult);
}
else if (rasterFiles.contains(fi.suffix().toLower()))
@@ -347,7 +347,7 @@
fileCount += dd.count();
QDir d(name, "*.sce", QDir::Name, QDir::Files | QDir::Readable | QDir::NoSymLinks);
fileCount += d.count();
- QStringList vectorFiles = LoadSavePlugin::getExtensionsForPreview(FORMATID_ODGIMPORT);
+ QStringList vectorFiles = LoadSavePlugin::getExtensionsForPreview(FORMATID_FIRSTUSER);
for (int v = 0; v < vectorFiles.count(); v++)
{
QString ext = "*." + vectorFiles[v];
@@ -448,7 +448,7 @@
FileLoader *fileLoader = new FileLoader(QDir::cleanPath(QDir::toNativeSeparators(name + "/" + d4[dc])));
int testResult = fileLoader->testFile();
delete fileLoader;
- if ((testResult != -1) && (testResult >= FORMATID_ODGIMPORT))
+ if ((testResult != -1) && (testResult >= FORMATID_FIRSTUSER))
{
const FileFormat * fmt = LoadSavePlugin::getFormatById(testResult);
if( fmt )
More information about the scribus-commit
mailing list