r19257 by craig - #12400: Allow a prefix for exported bitmaps

scribus-commit scribus-commit at lists.scribus.net
Thu Jun 19 20:41:47 UTC 2014


Author: craig
Date: Thu Jun 19 20:41:46 2014
New Revision: 19257

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=19257
Log:
#12400: Allow a prefix for exported bitmaps

Modified:
    trunk/Scribus/scribus/plugins/export/pixmapexport/export.cpp
    trunk/Scribus/scribus/plugins/export/pixmapexport/export.h
    trunk/Scribus/scribus/plugins/export/pixmapexport/exportform.ui
    trunk/Scribus/scribus/util.cpp
    trunk/Scribus/scribus/util.h

Modified: trunk/Scribus/scribus/plugins/export/pixmapexport/export.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19257&path=/trunk/Scribus/scribus/plugins/export/pixmapexport/export.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/export/pixmapexport/export.cpp (original)
+++ trunk/Scribus/scribus/plugins/export/pixmapexport/export.cpp Thu Jun 19 20:41:46 2014
@@ -104,6 +104,7 @@
 	// interval widgets handling
 	QString tmp;
 	dia->rangeVal->setText(tmp.setNum(doc->currentPageNumber()+1));
+	dia->prefixLineEdit->setText(doc->DocName);
 	// main "loop"
 	if (dia->exec()==QDialog::Accepted)
 	{
@@ -113,6 +114,7 @@
 		ex->quality     = dia->qualityBox->value();
 		ex->exportDir   = QDir::fromNativeSeparators(dia->outputDirectory->text());
 		ex->bitmapType  = dia->bitmapType->currentText();
+		ex->filenamePrefix = dia->prefixLineEdit->text();
 
 		// check availability of the destination
 		QFileInfo fi(ex->exportDir);
@@ -164,7 +166,7 @@
 
 QString ExportBitmap::getFileName(ScribusDoc* doc, uint pageNr)
 {
-	return QDir::cleanPath(QDir::toNativeSeparators(exportDir + "/" + getFileNameByPage(doc, pageNr, bitmapType.toLower())));
+	return QDir::cleanPath(QDir::toNativeSeparators(exportDir + "/" + getFileNameByPage(doc, pageNr, bitmapType.toLower(), filenamePrefix)));
 }
 
 ExportBitmap::~ExportBitmap()

Modified: trunk/Scribus/scribus/plugins/export/pixmapexport/export.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19257&path=/trunk/Scribus/scribus/plugins/export/pixmapexport/export.h
==============================================================================
--- trunk/Scribus/scribus/plugins/export/pixmapexport/export.h (original)
+++ trunk/Scribus/scribus/plugins/export/pixmapexport/export.h Thu Jun 19 20:41:46 2014
@@ -61,6 +61,8 @@
 	QString exportDir;
 	/*! \brief Overwrite the existing files? */
 	bool overwrite;
+	/*! \brief Prefix for filenames */
+	QString filenamePrefix;
 
 	/*! \brief Exports only the actual page
 	\retval bool true on success */

Modified: trunk/Scribus/scribus/plugins/export/pixmapexport/exportform.ui
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19257&path=/trunk/Scribus/scribus/plugins/export/pixmapexport/exportform.ui
==============================================================================
--- trunk/Scribus/scribus/plugins/export/pixmapexport/exportform.ui (original)
+++ trunk/Scribus/scribus/plugins/export/pixmapexport/exportform.ui Thu Jun 19 20:41:46 2014
@@ -6,151 +6,15 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>519</width>
-    <height>339</height>
+    <width>520</width>
+    <height>352</height>
    </rect>
   </property>
   <property name="windowTitle">
    <string>Export as Image(s)</string>
   </property>
-  <layout class="QGridLayout">
-   <property name="leftMargin">
-    <number>9</number>
-   </property>
-   <property name="topMargin">
-    <number>9</number>
-   </property>
-   <property name="rightMargin">
-    <number>9</number>
-   </property>
-   <property name="bottomMargin">
-    <number>9</number>
-   </property>
-   <property name="spacing">
-    <number>6</number>
-   </property>
-   <item row="1" column="0">
-    <widget class="QGroupBox" name="groupBox">
-     <property name="title">
-      <string>Options</string>
-     </property>
-     <layout class="QGridLayout" name="gridLayout1">
-      <item row="0" column="0">
-       <widget class="QLabel" name="label_2">
-        <property name="text">
-         <string>Image &Type:</string>
-        </property>
-        <property name="buddy">
-         <cstring>bitmapType</cstring>
-        </property>
-       </widget>
-      </item>
-      <item row="0" column="1">
-       <widget class="QComboBox" name="bitmapType"/>
-      </item>
-      <item row="1" column="0">
-       <widget class="QLabel" name="label_3">
-        <property name="text">
-         <string>&Quality:</string>
-        </property>
-        <property name="buddy">
-         <cstring>qualityBox</cstring>
-        </property>
-       </widget>
-      </item>
-      <item row="1" column="1">
-       <widget class="QSpinBox" name="qualityBox">
-        <property name="suffix">
-         <string> %</string>
-        </property>
-        <property name="minimum">
-         <number>-1</number>
-        </property>
-        <property name="maximum">
-         <number>100</number>
-        </property>
-        <property name="value">
-         <number>-1</number>
-        </property>
-       </widget>
-      </item>
-      <item row="2" column="0">
-       <widget class="QLabel" name="label_4">
-        <property name="text">
-         <string>&Resolution:</string>
-        </property>
-        <property name="buddy">
-         <cstring>DPIBox</cstring>
-        </property>
-       </widget>
-      </item>
-      <item row="2" column="1">
-       <widget class="QSpinBox" name="DPIBox">
-        <property name="suffix">
-         <string> dpi</string>
-        </property>
-        <property name="minimum">
-         <number>72</number>
-        </property>
-        <property name="maximum">
-         <number>2400</number>
-        </property>
-        <property name="value">
-         <number>72</number>
-        </property>
-       </widget>
-      </item>
-      <item row="3" column="0">
-       <widget class="QLabel" name="label_5">
-        <property name="text">
-         <string>&Size:</string>
-        </property>
-        <property name="buddy">
-         <cstring>enlargementBox</cstring>
-        </property>
-       </widget>
-      </item>
-      <item row="3" column="1">
-       <widget class="QSpinBox" name="enlargementBox">
-        <property name="suffix">
-         <string> %</string>
-        </property>
-        <property name="minimum">
-         <number>1</number>
-        </property>
-        <property name="maximum">
-         <number>2400</number>
-        </property>
-        <property name="value">
-         <number>100</number>
-        </property>
-       </widget>
-      </item>
-      <item row="4" column="0" colspan="2">
-       <widget class="QCheckBox" name="noBackground">
-        <property name="text">
-         <string>No Background</string>
-        </property>
-       </widget>
-      </item>
-      <item row="5" column="0" colspan="2">
-       <widget class="QLabel" name="label_6">
-        <property name="text">
-         <string>Image size in Pixels</string>
-        </property>
-       </widget>
-      </item>
-      <item row="6" column="0">
-       <widget class="QLabel" name="imageSizeLabel">
-        <property name="text">
-         <string>TextLabel</string>
-        </property>
-       </widget>
-      </item>
-     </layout>
-    </widget>
-   </item>
-   <item row="0" column="0" colspan="2">
+  <layout class="QVBoxLayout" name="verticalLayout">
+   <item>
     <layout class="QHBoxLayout">
      <property name="spacing">
       <number>6</number>
@@ -189,75 +53,219 @@
      </item>
     </layout>
    </item>
-   <item row="1" column="1">
-    <widget class="QGroupBox" name="rangeGroupBox">
-     <property name="title">
-      <string>Range</string>
-     </property>
-     <layout class="QGridLayout">
-      <property name="leftMargin">
-       <number>9</number>
-      </property>
-      <property name="topMargin">
-       <number>9</number>
-      </property>
-      <property name="rightMargin">
-       <number>9</number>
-      </property>
-      <property name="bottomMargin">
-       <number>9</number>
-      </property>
-      <property name="spacing">
-       <number>6</number>
-      </property>
-      <item row="2" column="2">
-       <widget class="QPushButton" name="pageNrButton">
-        <property name="text">
-         <string/>
-        </property>
-       </widget>
-      </item>
-      <item row="2" column="1">
-       <widget class="QLineEdit" name="rangeVal"/>
-      </item>
-      <item row="0" column="0" colspan="3">
-       <widget class="QRadioButton" name="onePageRadio">
-        <property name="text">
-         <string>&Current page</string>
-        </property>
-       </widget>
-      </item>
-      <item row="3" column="0">
-       <spacer>
-        <property name="orientation">
-         <enum>Qt::Vertical</enum>
-        </property>
-        <property name="sizeHint" stdset="0">
-         <size>
-          <width>20</width>
-          <height>40</height>
-         </size>
-        </property>
-       </spacer>
-      </item>
-      <item row="2" column="0">
-       <widget class="QRadioButton" name="intervalPagesRadio">
-        <property name="text">
-         <string>&Range</string>
-        </property>
-       </widget>
-      </item>
-      <item row="1" column="0">
-       <widget class="QRadioButton" name="allPagesRadio">
-        <property name="text">
-         <string>&All pages</string>
-        </property>
-       </widget>
-      </item>
-     </layout>
-    </widget>
+   <item>
+    <layout class="QGridLayout" name="gridLayout">
+     <item row="0" column="0">
+      <widget class="QGroupBox" name="groupBox_2">
+       <property name="title">
+        <string>Naming of exported files:</string>
+       </property>
+       <layout class="QHBoxLayout" name="horizontalLayout">
+        <item>
+         <widget class="QLabel" name="label_7">
+          <property name="text">
+           <string>Prefix:</string>
+          </property>
+         </widget>
+        </item>
+        <item>
+         <widget class="QLineEdit" name="prefixLineEdit"/>
+        </item>
+       </layout>
+      </widget>
+     </item>
+     <item row="0" column="1" rowspan="2">
+      <widget class="QGroupBox" name="groupBox">
+       <property name="title">
+        <string>Options</string>
+       </property>
+       <layout class="QGridLayout" name="gridLayout1">
+        <item row="0" column="0">
+         <widget class="QLabel" name="label_2">
+          <property name="text">
+           <string>Image &Type:</string>
+          </property>
+          <property name="buddy">
+           <cstring>bitmapType</cstring>
+          </property>
+         </widget>
+        </item>
+        <item row="0" column="1">
+         <widget class="QComboBox" name="bitmapType"/>
+        </item>
+        <item row="1" column="0">
+         <widget class="QLabel" name="label_3">
+          <property name="text">
+           <string>&Quality:</string>
+          </property>
+          <property name="buddy">
+           <cstring>qualityBox</cstring>
+          </property>
+         </widget>
+        </item>
+        <item row="1" column="1">
+         <widget class="QSpinBox" name="qualityBox">
+          <property name="suffix">
+           <string> %</string>
+          </property>
+          <property name="minimum">
+           <number>-1</number>
+          </property>
+          <property name="maximum">
+           <number>100</number>
+          </property>
+          <property name="value">
+           <number>-1</number>
+          </property>
+         </widget>
+        </item>
+        <item row="2" column="0">
+         <widget class="QLabel" name="label_4">
+          <property name="text">
+           <string>&Resolution:</string>
+          </property>
+          <property name="buddy">
+           <cstring>DPIBox</cstring>
+          </property>
+         </widget>
+        </item>
+        <item row="2" column="1">
+         <widget class="QSpinBox" name="DPIBox">
+          <property name="suffix">
+           <string> dpi</string>
+          </property>
+          <property name="minimum">
+           <number>72</number>
+          </property>
+          <property name="maximum">
+           <number>2400</number>
+          </property>
+          <property name="value">
+           <number>72</number>
+          </property>
+         </widget>
+        </item>
+        <item row="3" column="0">
+         <widget class="QLabel" name="label_5">
+          <property name="text">
+           <string>&Size:</string>
+          </property>
+          <property name="buddy">
+           <cstring>enlargementBox</cstring>
+          </property>
+         </widget>
+        </item>
+        <item row="3" column="1">
+         <widget class="QSpinBox" name="enlargementBox">
+          <property name="suffix">
+           <string> %</string>
+          </property>
+          <property name="minimum">
+           <number>1</number>
+          </property>
+          <property name="maximum">
+           <number>2400</number>
+          </property>
+          <property name="value">
+           <number>100</number>
+          </property>
+         </widget>
+        </item>
+        <item row="4" column="0" colspan="2">
+         <widget class="QCheckBox" name="noBackground">
+          <property name="text">
+           <string>No Background</string>
+          </property>
+         </widget>
+        </item>
+        <item row="5" column="0" colspan="2">
+         <widget class="QLabel" name="label_6">
+          <property name="text">
+           <string>Image size in Pixels</string>
+          </property>
+         </widget>
+        </item>
+        <item row="6" column="0">
+         <widget class="QLabel" name="imageSizeLabel">
+          <property name="text">
+           <string>TextLabel</string>
+          </property>
+         </widget>
+        </item>
+       </layout>
+      </widget>
+     </item>
+     <item row="1" column="0">
+      <widget class="QGroupBox" name="rangeGroupBox">
+       <property name="title">
+        <string>Range</string>
+       </property>
+       <layout class="QGridLayout">
+        <property name="leftMargin">
+         <number>9</number>
+        </property>
+        <property name="topMargin">
+         <number>9</number>
+        </property>
+        <property name="rightMargin">
+         <number>9</number>
+        </property>
+        <property name="bottomMargin">
+         <number>9</number>
+        </property>
+        <property name="spacing">
+         <number>6</number>
+        </property>
+        <item row="2" column="0">
+         <widget class="QRadioButton" name="intervalPagesRadio">
+          <property name="text">
+           <string>&Range</string>
+          </property>
+         </widget>
+        </item>
+        <item row="1" column="0">
+         <widget class="QRadioButton" name="allPagesRadio">
+          <property name="text">
+           <string>&All pages</string>
+          </property>
+         </widget>
+        </item>
+        <item row="2" column="2">
+         <widget class="QPushButton" name="pageNrButton">
+          <property name="text">
+           <string/>
+          </property>
+         </widget>
+        </item>
+        <item row="0" column="0" colspan="3">
+         <widget class="QRadioButton" name="onePageRadio">
+          <property name="text">
+           <string>&Current page</string>
+          </property>
+         </widget>
+        </item>
+        <item row="2" column="1">
+         <widget class="QLineEdit" name="rangeVal"/>
+        </item>
+        <item row="3" column="0">
+         <spacer>
+          <property name="orientation">
+           <enum>Qt::Vertical</enum>
+          </property>
+          <property name="sizeHint" stdset="0">
+           <size>
+            <width>20</width>
+            <height>40</height>
+           </size>
+          </property>
+         </spacer>
+        </item>
+       </layout>
+      </widget>
+     </item>
+    </layout>
    </item>
-   <item row="2" column="0" colspan="2">
+   <item>
     <widget class="QDialogButtonBox" name="buttonBox">
      <property name="orientation">
       <enum>Qt::Horizontal</enum>

Modified: trunk/Scribus/scribus/util.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19257&path=/trunk/Scribus/scribus/util.cpp
==============================================================================
--- trunk/Scribus/scribus/util.cpp (original)
+++ trunk/Scribus/scribus/util.cpp Thu Jun 19 20:41:46 2014
@@ -525,10 +525,14 @@
 	return newName;
 }
 
-QString getFileNameByPage(ScribusDoc* currDoc, uint pageNo, QString extension)
+QString getFileNameByPage(ScribusDoc* currDoc, uint pageNo, QString extension, QString prefix)
 {
 	uint number = pageNo + currDoc->FirstPnum;
-	QString defaultName = currDoc->DocName;
+	QString defaultName;
+	if (prefix!=QString::null)
+		defaultName=prefix;
+	else
+		defaultName=currDoc->DocName;
 	if (defaultName.isNull())
 		defaultName = "export";
 	else

Modified: trunk/Scribus/scribus/util.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19257&path=/trunk/Scribus/scribus/util.h
==============================================================================
--- trunk/Scribus/scribus/util.h (original)
+++ trunk/Scribus/scribus/util.h Thu Jun 19 20:41:46 2014
@@ -150,7 +150,7 @@
    \retval QString standardized filename
    \author Petr Vanek
  */
-QString SCRIBUS_API getFileNameByPage(ScribusDoc* currDoc, uint pageNo, QString extension);
+QString SCRIBUS_API getFileNameByPage(ScribusDoc* currDoc, uint pageNo, QString extension, QString prefix=QString::null);
 void SCRIBUS_API sDebug(QString message);
 //asterix is QString used in numeration when number is presented as few chars, like *, **, *** etc
 //default is '*' but can be used any string




More information about the scribus-commit mailing list