r18612 by jghali - #11832: Expose more functionality of PS QR code backend

scribus-commit scribus-commit at lists.scribus.net
Sun Dec 1 01:07:15 UTC 2013


Author: jghali
Date: Sun Dec  1 01:07:15 2013
New Revision: 18612

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=18612
Log:
#11832: Expose more functionality of PS QR code backend

Modified:
    trunk/Scribus/scribus/plugins/barcodegenerator/barcodegenerator.cpp
    trunk/Scribus/scribus/plugins/barcodegenerator/barcodegenerator.h
    trunk/Scribus/scribus/plugins/barcodegenerator/barcodegenerator.ui

Modified: trunk/Scribus/scribus/plugins/barcodegenerator/barcodegenerator.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18612&path=/trunk/Scribus/scribus/plugins/barcodegenerator/barcodegenerator.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/barcodegenerator/barcodegenerator.cpp (original)
+++ trunk/Scribus/scribus/plugins/barcodegenerator/barcodegenerator.cpp Sun Dec  1 01:07:15 2013
@@ -104,6 +104,8 @@
 								false, false);
 	//    "Symbol"] = "symbol"
 
+	initializeQROptions();
+
 	useSamples = true;
 	guiColor = ui.codeEdit->palette().color(QPalette::Window);
 	ui.bcCombo->addItem(tr("Barcode")); // to prevent 1st gs call
@@ -159,6 +161,37 @@
 	QFile::remove(tmpFile);
 }
 
+void BarcodeGenerator::initializeQROptions()
+{
+	QStringList qrEccKeys, qrEccValues;
+
+	ui.formatCombo->addItem("Standard", "format=full");
+	ui.formatCombo->addItem("Micro", "format=micro");
+
+	ui.eccCombo->addItem("Auto", "");
+	ui.eccCombo->addItem("L", "");
+	ui.eccCombo->addItem("M", "eclevel=M");
+	ui.eccCombo->addItem("Q", "eclevel=Q");
+	ui.eccCombo->addItem("H", "eclevel=H");
+
+    qrOptionsEnabled(false);
+	connect(ui.formatCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(bcComboChanged(int)));
+	connect(ui.eccCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(bcComboChanged(int)));
+}
+
+void BarcodeGenerator::qrOptionsEnabled(bool enabled) 
+{
+	ui.formatLabel->setEnabled(enabled);
+	ui.formatCombo->setEnabled(enabled);
+	ui.eccLabel->setEnabled(enabled);
+	ui.eccCombo->setEnabled(enabled);
+}
+
+void BarcodeGenerator::bcComboChanged(int i)
+{
+	bcComboChanged();
+}
+
 void BarcodeGenerator::bcComboChanged()
 {
 	if (ui.bcCombo->currentIndex() == 0)
@@ -167,8 +200,8 @@
 		ui.sampleLabel->setText(tr("Select Type"));
 		return;
 	}
-	else
-		ui.okButton->setEnabled(true);
+	
+ui.okButton->setEnabled(true);
 
 	QString s = ui.bcCombo->currentText();
 	ui.commentEdit->setText(map[s].comment);
@@ -184,6 +217,11 @@
 		ui.includeCheckInText->setEnabled(map[s].includeCheckInText ? true : false);
 	else
 		ui.includeCheckInText->setEnabled(false);
+
+	if (QString::compare(s, "QR Code") == 0)
+		qrOptionsEnabled(true);
+	else
+		qrOptionsEnabled(false);
 
 	codeEdit_check(ui.codeEdit->text());
 	paintBarcode();
@@ -334,6 +372,18 @@
 		opts += " includecheckintext";
 	if (ui.includeCheck->isChecked() & ui.includeCheck->isEnabled())
 		opts += " includecheck";
+	if (ui.formatCombo->isEnabled())
+	{
+		int index = ui.formatCombo->currentIndex();
+		QVariant currentData = ui.formatCombo->itemData(index);
+		opts += " " + currentData.toString();
+	}
+	if (ui.eccCombo->isEnabled())
+	{
+		int index = ui.eccCombo->currentIndex();
+		QVariant currentData = ui.eccCombo->itemData(index);
+		opts += " " + currentData.toString();
+	}
 	QString comm("15 10 moveto (%1) (%2) /%3 /uk.co.terryburton.bwipp findresource exec");
 	comm = comm.arg(ui.codeEdit->text()).arg(opts).arg(map[ui.bcCombo->currentText()].command);
 	comm = psCommand + comm;

Modified: trunk/Scribus/scribus/plugins/barcodegenerator/barcodegenerator.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18612&path=/trunk/Scribus/scribus/plugins/barcodegenerator/barcodegenerator.h
==============================================================================
--- trunk/Scribus/scribus/plugins/barcodegenerator/barcodegenerator.h (original)
+++ trunk/Scribus/scribus/plugins/barcodegenerator/barcodegenerator.h Sun Dec  1 01:07:15 2013
@@ -113,9 +113,12 @@
 		/*! \brief Perform BarcodeCheckType checks here
 		\param s new string */
 		bool codeEdit_check(const QString & s);
+		void qrOptionsEnabled(bool);
+		void initializeQROptions();
 
 	protected slots:
 		void bcComboChanged();
+		void bcComboChanged(int);
 		void textCheck_changed();
 		void guardCheck_changed();
 		void includeCheck_stateChanged(int state);

Modified: trunk/Scribus/scribus/plugins/barcodegenerator/barcodegenerator.ui
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18612&path=/trunk/Scribus/scribus/plugins/barcodegenerator/barcodegenerator.ui
==============================================================================
--- trunk/Scribus/scribus/plugins/barcodegenerator/barcodegenerator.ui (original)
+++ trunk/Scribus/scribus/plugins/barcodegenerator/barcodegenerator.ui Sun Dec  1 01:07:15 2013
@@ -8,8 +8,8 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>455</width>
-    <height>404</height>
+    <width>511</width>
+    <height>559</height>
    </rect>
   </property>
   <property name="windowTitle">
@@ -122,13 +122,6 @@
         </property>
        </widget>
       </item>
-      <item row="0" column="1" colspan="2">
-       <widget class="QComboBox" name="bcCombo">
-        <property name="toolTip">
-         <string>Select one of the available barcode type here</string>
-        </property>
-       </widget>
-      </item>
       <item row="0" column="0">
        <widget class="QLabel" name="bcLabel">
         <property name="text">
@@ -139,6 +132,13 @@
         </property>
         <property name="buddy">
          <cstring>bcCombo</cstring>
+        </property>
+       </widget>
+      </item>
+      <item row="0" column="1">
+       <widget class="QComboBox" name="bcCombo">
+        <property name="toolTip">
+         <string>Select one of the available barcode type here</string>
         </property>
        </widget>
       </item>
@@ -263,7 +263,7 @@
      </layout>
     </widget>
    </item>
-   <item row="1" column="0" colspan="2">
+   <item row="3" column="0" colspan="2">
     <widget class="QTextEdit" name="commentEdit">
      <property name="toolTip">
       <string>Hints and help is shown here</string>
@@ -273,7 +273,7 @@
      </property>
     </widget>
    </item>
-   <item row="1" column="2">
+   <item row="3" column="2">
     <widget class="QLabel" name="sampleLabel">
      <property name="frameShape">
       <enum>QFrame::Box</enum>
@@ -286,7 +286,7 @@
      </property>
     </widget>
    </item>
-   <item row="2" column="0" colspan="3">
+   <item row="4" column="0" colspan="3">
     <layout class="QHBoxLayout">
      <item>
       <spacer>
@@ -317,6 +317,55 @@
      </item>
     </layout>
    </item>
+   <item row="2" column="0" colspan="3">
+    <widget class="QGroupBox" name="optionsBox">
+     <property name="title">
+      <string>Options</string>
+     </property>
+     <layout class="QGridLayout">
+      <item row="0" column="0">
+       <widget class="QLabel" name="formatLabel">
+        <property name="text">
+         <string>&Format:</string>
+        </property>
+        <property name="wordWrap">
+         <bool>false</bool>
+        </property>
+        <property name="buddy">
+         <cstring>formatCombo</cstring>
+        </property>
+       </widget>
+      </item>
+      <item row="0" column="1">
+       <widget class="QComboBox" name="formatCombo">
+        <property name="toolTip">
+         <string/>
+        </property>
+       </widget>
+      </item>
+      <item row="1" column="0">
+       <widget class="QLabel" name="eccLabel">
+        <property name="text">
+         <string>Error &checking:</string>
+        </property>
+        <property name="wordWrap">
+         <bool>false</bool>
+        </property>
+        <property name="buddy">
+         <cstring>eccCombo</cstring>
+        </property>
+       </widget>
+      </item>
+      <item row="1" column="1">
+       <widget class="QComboBox" name="eccCombo">
+        <property name="toolTip">
+         <string>Minimum error checking; raised opportunistically if size of symbol is not increased</string>
+        </property>
+       </widget>
+      </item>
+     </layout>
+    </widget>
+   </item>
   </layout>
  </widget>
  <layoutdefault spacing="6" margin="11"/>




More information about the scribus-commit mailing list