From ca824684acfe160dfc878d502c77918815b555f8 Mon Sep 17 00:00:00 2001
From: hooper114 <hooper114>
Date: Sun, 9 Aug 2009 23:00:47 +0000
Subject: [PATCH] Add GS1data support to QR Code in zint-qt

---
 frontend_qt4/grpQR.ui       | 70 ++++++++++++++++++++++++++++++++-----
 frontend_qt4/mainwindow.cpp |  9 +++--
 2 files changed, 69 insertions(+), 10 deletions(-)

diff --git a/frontend_qt4/grpQR.ui b/frontend_qt4/grpQR.ui
index cf2f3d8b..e81d8709 100644
--- a/frontend_qt4/grpQR.ui
+++ b/frontend_qt4/grpQR.ui
@@ -6,7 +6,7 @@
     <x>0</x>
     <y>0</y>
     <width>441</width>
-    <height>171</height>
+    <height>208</height>
    </rect>
   </property>
   <property name="windowTitle" >
@@ -273,15 +273,69 @@
        </item>
       </widget>
      </item>
-     <item row="3" column="0" >
-      <widget class="QCheckBox" name="chkQRHIBC" >
-       <property name="text" >
-        <string>&amp;HIBC QR Code</string>
-       </property>
-      </widget>
-     </item>
     </layout>
    </item>
+   <item>
+    <widget class="QGroupBox" name="grpAztecMode" >
+     <property name="minimumSize" >
+      <size>
+       <width>0</width>
+       <height>70</height>
+      </size>
+     </property>
+     <property name="title" >
+      <string>Data Encoding</string>
+     </property>
+     <widget class="QRadioButton" name="radQRStand" >
+      <property name="geometry" >
+       <rect>
+        <x>10</x>
+        <y>17</y>
+        <width>102</width>
+        <height>24</height>
+       </rect>
+      </property>
+      <property name="minimumSize" >
+       <size>
+        <width>0</width>
+        <height>0</height>
+       </size>
+      </property>
+      <property name="text" >
+       <string>S&amp;tandard</string>
+      </property>
+      <property name="checked" >
+       <bool>true</bool>
+      </property>
+     </widget>
+     <widget class="QRadioButton" name="radQRHIBC" >
+      <property name="geometry" >
+       <rect>
+        <x>200</x>
+        <y>14</y>
+        <width>142</width>
+        <height>24</height>
+       </rect>
+      </property>
+      <property name="text" >
+       <string>&amp;HIBC QR Code</string>
+      </property>
+     </widget>
+     <widget class="QRadioButton" name="radQRGS1" >
+      <property name="geometry" >
+       <rect>
+        <x>9</x>
+        <y>41</y>
+        <width>151</width>
+        <height>24</height>
+       </rect>
+      </property>
+      <property name="text" >
+       <string>&amp;GS-1 Data Mode</string>
+      </property>
+     </widget>
+    </widget>
+   </item>
    <item>
     <spacer name="verticalSpacer" >
      <property name="orientation" >
diff --git a/frontend_qt4/mainwindow.cpp b/frontend_qt4/mainwindow.cpp
index f2fd8135..c004f919 100644
--- a/frontend_qt4/mainwindow.cpp
+++ b/frontend_qt4/mainwindow.cpp
@@ -365,7 +365,9 @@ void MainWindow::change_options()
 		connect(m_optionWidget->findChild<QObject*>("radQRECC"), SIGNAL(clicked( bool )), SLOT(update_preview()));
 		connect(m_optionWidget->findChild<QObject*>("cmbQRSize"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview()));
 		connect(m_optionWidget->findChild<QObject*>("cmbQRECC"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview()));
-		connect(m_optionWidget->findChild<QObject*>("chkQRHIBC"), SIGNAL(stateChanged( int )), SLOT(update_preview()));
+		connect(m_optionWidget->findChild<QObject*>("radQRStand"), SIGNAL(clicked( bool )), SLOT(update_preview()));
+		connect(m_optionWidget->findChild<QObject*>("radQRGS1"), SIGNAL(clicked( bool )), SLOT(update_preview()));
+		connect(m_optionWidget->findChild<QObject*>("radQRHIBC"), SIGNAL(clicked( bool )), SLOT(update_preview()));
 	}
 
 	if(metaObject()->enumerator(0).value(bstyle->currentIndex()) == BARCODE_MICROQR)
@@ -705,11 +707,14 @@ void MainWindow::update_preview()
 			break;
 
 		case BARCODE_QRCODE:
-			if(m_optionWidget->findChild<QCheckBox*>("chkQRHIBC")->isChecked())
+			if(m_optionWidget->findChild<QRadioButton*>("radQRHIBC")->isChecked())
 				m_bc.bc.setSymbol(BARCODE_HIBC_QR);
 			else
 				m_bc.bc.setSymbol(BARCODE_QRCODE);
 
+			if(m_optionWidget->findChild<QRadioButton*>("radQRGS1")->isChecked())
+				m_bc.bc.setInputMode(GS1_MODE);
+			
 			if(m_optionWidget->findChild<QRadioButton*>("radQRSize")->isChecked())
 				m_bc.bc.setWidth(m_optionWidget->findChild<QComboBox*>("cmbQRSize")->currentIndex() + 1);