Merge branch 'master' of https://git.bukova.info/repos/git/prodejna
						commit
						1d393cf3fb
					
				| @ -1,21 +1,19 @@ | ||||
| <?xml version="1.0" encoding="UTF-8"?> | ||||
| <ui version="4.0"> | ||||
|  <author/> | ||||
|  <comment/> | ||||
|  <exportmacro/> | ||||
|  <class>CampForm</class> | ||||
|  <widget class="QWidget" name="CampForm"> | ||||
|   <property name="geometry"> | ||||
|    <rect> | ||||
|     <x>0</x> | ||||
|     <y>0</y> | ||||
|     <width>400</width> | ||||
|     <height>300</height> | ||||
|     <width>462</width> | ||||
|     <height>403</height> | ||||
|    </rect> | ||||
|   </property> | ||||
|   <property name="windowTitle"> | ||||
|    <string>Form</string> | ||||
|   </property> | ||||
|  </widget> | ||||
|  <pixmapfunction/> | ||||
|  <resources/> | ||||
|  <connections/> | ||||
| </ui> | ||||
|  | ||||
| @ -1,6 +1,20 @@ | ||||
| #include "campgrid.h" | ||||
| #include "campwizard.h" | ||||
| 
 | ||||
| CampGrid::CampGrid(QWidget *parent) : GridForm<CampData>(parent) | ||||
| { | ||||
|     setTableModel(new AutoTableModel<CampData>); | ||||
| } | ||||
| 
 | ||||
| void CampGrid::handleNewRecord() | ||||
| { | ||||
|     CampWizard *wizard = new CampWizard(); | ||||
|     wizard->setAttribute(Qt::WA_DeleteOnClose); | ||||
| 
 | ||||
|     wizard->show(); | ||||
| } | ||||
| 
 | ||||
| void CampGrid::handleEditRecord() | ||||
| { | ||||
| 
 | ||||
| } | ||||
|  | ||||
| @ -0,0 +1,30 @@ | ||||
| #include "campwizard.h" | ||||
| #include "ui_campwizard.h" | ||||
| 
 | ||||
| CampWizard::CampWizard(QWidget *parent) : | ||||
|     QWizard(parent), | ||||
|     ui(new Ui::CampWizard) | ||||
| { | ||||
|     ui->setupUi(this); | ||||
| 
 | ||||
|     m_dataBinder = new ObjectBinder(this); | ||||
|     m_dataBinder->registerBinding(ui->start); | ||||
|     m_dataBinder->registerBinding(ui->end); | ||||
| } | ||||
| 
 | ||||
| CampWizard::~CampWizard() | ||||
| { | ||||
|     delete ui; | ||||
| } | ||||
| 
 | ||||
| void CampWizard::setData(const CampDataPtr &data) | ||||
| { | ||||
|     m_data = data; | ||||
| 
 | ||||
|     m_dataBinder->setData(data.data()); | ||||
| } | ||||
| 
 | ||||
| void CampWizard::on_btnAdd_clicked() | ||||
| { | ||||
| 
 | ||||
| } | ||||
| @ -0,0 +1,31 @@ | ||||
| #ifndef CAMPWIZARD_H | ||||
| #define CAMPWIZARD_H | ||||
| 
 | ||||
| #include <QWizard> | ||||
| #include "data/camp-data.h" | ||||
| #include <objectbinder.h> | ||||
| 
 | ||||
| namespace Ui { | ||||
| class CampWizard; | ||||
| } | ||||
| 
 | ||||
| class CampWizard : public QWizard | ||||
| { | ||||
|     Q_OBJECT | ||||
| 
 | ||||
| public: | ||||
|     explicit CampWizard(QWidget *parent = 0); | ||||
|     ~CampWizard(); | ||||
| 
 | ||||
|     void setData(const CampDataPtr &data); | ||||
| 
 | ||||
| private slots: | ||||
|     void on_btnAdd_clicked(); | ||||
| 
 | ||||
| private: | ||||
|     Ui::CampWizard *ui; | ||||
|     CampDataPtr m_data; | ||||
|     ObjectBinder *m_dataBinder; | ||||
| }; | ||||
| 
 | ||||
| #endif // CAMPWIZARD_H
 | ||||
| @ -0,0 +1,721 @@ | ||||
| <?xml version="1.0" encoding="UTF-8"?> | ||||
| <ui version="4.0"> | ||||
|  <class>CampWizard</class> | ||||
|  <widget class="QWizard" name="CampWizard"> | ||||
|   <property name="windowModality"> | ||||
|    <enum>Qt::ApplicationModal</enum> | ||||
|   </property> | ||||
|   <property name="geometry"> | ||||
|    <rect> | ||||
|     <x>0</x> | ||||
|     <y>0</y> | ||||
|     <width>948</width> | ||||
|     <height>684</height> | ||||
|    </rect> | ||||
|   </property> | ||||
|   <property name="windowTitle"> | ||||
|    <string>Camp record</string> | ||||
|   </property> | ||||
|   <property name="windowIcon"> | ||||
|    <iconset resource="camprc.qrc"> | ||||
|     <normaloff>:/icons/campPlugin.svg</normaloff>:/icons/campPlugin.svg</iconset> | ||||
|   </property> | ||||
|   <property name="wizardStyle"> | ||||
|    <enum>QWizard::ClassicStyle</enum> | ||||
|   </property> | ||||
|   <widget class="QWizardPage" name="peoplePage"> | ||||
|    <layout class="QVBoxLayout" name="verticalLayout"> | ||||
|     <item> | ||||
|      <widget class="QWidget" name="widget" native="true"> | ||||
|       <layout class="QHBoxLayout" name="horizontalLayout"> | ||||
|        <property name="leftMargin"> | ||||
|         <number>0</number> | ||||
|        </property> | ||||
|        <item> | ||||
|         <widget class="QLabel" name="label"> | ||||
|          <property name="text"> | ||||
|           <string>From</string> | ||||
|          </property> | ||||
|         </widget> | ||||
|        </item> | ||||
|        <item> | ||||
|         <widget class="QDateEdit" name="start"> | ||||
|          <property name="displayFormat"> | ||||
|           <string>d. M. yyyy</string> | ||||
|          </property> | ||||
|          <property name="calendarPopup"> | ||||
|           <bool>true</bool> | ||||
|          </property> | ||||
|         </widget> | ||||
|        </item> | ||||
|        <item> | ||||
|         <widget class="QLabel" name="label_2"> | ||||
|          <property name="text"> | ||||
|           <string>To</string> | ||||
|          </property> | ||||
|         </widget> | ||||
|        </item> | ||||
|        <item> | ||||
|         <widget class="QDateEdit" name="end"> | ||||
|          <property name="displayFormat"> | ||||
|           <string>d. M. yyyy</string> | ||||
|          </property> | ||||
|          <property name="calendarPopup"> | ||||
|           <bool>true</bool> | ||||
|          </property> | ||||
|         </widget> | ||||
|        </item> | ||||
|        <item> | ||||
|         <spacer name="horizontalSpacer"> | ||||
|          <property name="orientation"> | ||||
|           <enum>Qt::Horizontal</enum> | ||||
|          </property> | ||||
|          <property name="sizeHint" stdset="0"> | ||||
|           <size> | ||||
|            <width>40</width> | ||||
|            <height>20</height> | ||||
|           </size> | ||||
|          </property> | ||||
|         </spacer> | ||||
|        </item> | ||||
|       </layout> | ||||
|      </widget> | ||||
|     </item> | ||||
|     <item> | ||||
|      <widget class="QGroupBox" name="groupBox_2"> | ||||
|       <property name="title"> | ||||
|        <string>People</string> | ||||
|       </property> | ||||
|       <layout class="QHBoxLayout" name="horizontalLayout_2"> | ||||
|        <item> | ||||
|         <widget class="QWidget" name="widget_3" native="true"> | ||||
|          <layout class="QGridLayout" name="gridLayout"> | ||||
|           <item row="0" column="0"> | ||||
|            <widget class="QLabel" name="label_4"> | ||||
|             <property name="text"> | ||||
|              <string>Existing address</string> | ||||
|             </property> | ||||
|            </widget> | ||||
|           </item> | ||||
|           <item row="2" column="3"> | ||||
|            <widget class="QPushButton" name="btnAdd"> | ||||
|             <property name="text"> | ||||
|              <string>Add</string> | ||||
|             </property> | ||||
|             <property name="icon"> | ||||
|              <iconset resource="../core/rc.qrc"> | ||||
|               <normaloff>:/icons/new.svg</normaloff>:/icons/new.svg</iconset> | ||||
|             </property> | ||||
|            </widget> | ||||
|           </item> | ||||
|           <item row="1" column="0" colspan="4"> | ||||
|            <widget class="QGroupBox" name="groupNew"> | ||||
|             <property name="sizePolicy"> | ||||
|              <sizepolicy hsizetype="Expanding" vsizetype="Expanding"> | ||||
|               <horstretch>0</horstretch> | ||||
|               <verstretch>0</verstretch> | ||||
|              </sizepolicy> | ||||
|             </property> | ||||
|             <property name="minimumSize"> | ||||
|              <size> | ||||
|               <width>450</width> | ||||
|               <height>0</height> | ||||
|              </size> | ||||
|             </property> | ||||
|             <property name="title"> | ||||
|              <string>New address</string> | ||||
|             </property> | ||||
|             <property name="checkable"> | ||||
|              <bool>true</bool> | ||||
|             </property> | ||||
|             <property name="checked"> | ||||
|              <bool>false</bool> | ||||
|             </property> | ||||
|             <layout class="QFormLayout" name="formLayout_2"> | ||||
|              <item row="0" column="0"> | ||||
|               <widget class="QLabel" name="label_3"> | ||||
|                <property name="text"> | ||||
|                 <string>Title</string> | ||||
|                </property> | ||||
|               </widget> | ||||
|              </item> | ||||
|              <item row="0" column="1"> | ||||
|               <widget class="QLineEdit" name="title"/> | ||||
|              </item> | ||||
|              <item row="1" column="0"> | ||||
|               <widget class="QLabel" name="label_5"> | ||||
|                <property name="text"> | ||||
|                 <string>First name</string> | ||||
|                </property> | ||||
|               </widget> | ||||
|              </item> | ||||
|              <item row="1" column="1"> | ||||
|               <widget class="QLineEdit" name="firstName"/> | ||||
|              </item> | ||||
|              <item row="2" column="0"> | ||||
|               <widget class="QLabel" name="label_6"> | ||||
|                <property name="text"> | ||||
|                 <string>Last name</string> | ||||
|                </property> | ||||
|               </widget> | ||||
|              </item> | ||||
|              <item row="2" column="1"> | ||||
|               <widget class="QLineEdit" name="lastName"/> | ||||
|              </item> | ||||
|              <item row="3" column="0"> | ||||
|               <widget class="QLabel" name="label_7"> | ||||
|                <property name="text"> | ||||
|                 <string>Date of birth</string> | ||||
|                </property> | ||||
|               </widget> | ||||
|              </item> | ||||
|              <item row="3" column="1"> | ||||
|               <widget class="QDateEdit" name="birthDate"> | ||||
|                <property name="displayFormat"> | ||||
|                 <string>d. MM. yyyy</string> | ||||
|                </property> | ||||
|                <property name="calendarPopup"> | ||||
|                 <bool>true</bool> | ||||
|                </property> | ||||
|               </widget> | ||||
|              </item> | ||||
|              <item row="4" column="0"> | ||||
|               <widget class="QLabel" name="label_8"> | ||||
|                <property name="text"> | ||||
|                 <string>ID card</string> | ||||
|                </property> | ||||
|               </widget> | ||||
|              </item> | ||||
|              <item row="4" column="1"> | ||||
|               <widget class="QLineEdit" name="idCardNumber"/> | ||||
|              </item> | ||||
|              <item row="5" column="1"> | ||||
|               <widget class="QCheckBox" name="ztp"> | ||||
|                <property name="text"> | ||||
|                 <string>ZTP</string> | ||||
|                </property> | ||||
|               </widget> | ||||
|              </item> | ||||
|              <item row="6" column="0"> | ||||
|               <widget class="QLabel" name="label_9"> | ||||
|                <property name="text"> | ||||
|                 <string>Street</string> | ||||
|                </property> | ||||
|               </widget> | ||||
|              </item> | ||||
|              <item row="6" column="1"> | ||||
|               <widget class="QLineEdit" name="addressStreet"/> | ||||
|              </item> | ||||
|              <item row="7" column="0"> | ||||
|               <widget class="QLabel" name="label_10"> | ||||
|                <property name="text"> | ||||
|                 <string>House number</string> | ||||
|                </property> | ||||
|               </widget> | ||||
|              </item> | ||||
|              <item row="7" column="1"> | ||||
|               <widget class="QLineEdit" name="addressHouseNumber"/> | ||||
|              </item> | ||||
|              <item row="8" column="0"> | ||||
|               <widget class="QLabel" name="label_11"> | ||||
|                <property name="text"> | ||||
|                 <string>ZIP code</string> | ||||
|                </property> | ||||
|               </widget> | ||||
|              </item> | ||||
|              <item row="8" column="1"> | ||||
|               <widget class="QLineEdit" name="addressZipCode"/> | ||||
|              </item> | ||||
|              <item row="9" column="0"> | ||||
|               <widget class="QLabel" name="label_12"> | ||||
|                <property name="text"> | ||||
|                 <string>City</string> | ||||
|                </property> | ||||
|               </widget> | ||||
|              </item> | ||||
|              <item row="9" column="1"> | ||||
|               <widget class="QLineEdit" name="addressCity"/> | ||||
|              </item> | ||||
|              <item row="10" column="0"> | ||||
|               <widget class="QLabel" name="label_13"> | ||||
|                <property name="text"> | ||||
|                 <string>Country</string> | ||||
|                </property> | ||||
|               </widget> | ||||
|              </item> | ||||
|              <item row="10" column="1"> | ||||
|               <widget class="QComboBox" name="country"> | ||||
|                <property name="editable"> | ||||
|                 <bool>true</bool> | ||||
|                </property> | ||||
|               </widget> | ||||
|              </item> | ||||
|             </layout> | ||||
|            </widget> | ||||
|           </item> | ||||
|           <item row="0" column="1" colspan="3"> | ||||
|            <widget class="QComboBox" name="address"> | ||||
|             <property name="sizePolicy"> | ||||
|              <sizepolicy hsizetype="Preferred" vsizetype="Expanding"> | ||||
|               <horstretch>0</horstretch> | ||||
|               <verstretch>0</verstretch> | ||||
|              </sizepolicy> | ||||
|             </property> | ||||
|             <property name="editable"> | ||||
|              <bool>true</bool> | ||||
|             </property> | ||||
|            </widget> | ||||
|           </item> | ||||
|          </layout> | ||||
|         </widget> | ||||
|        </item> | ||||
|        <item> | ||||
|         <widget class="QWidget" name="widget_8" native="true"> | ||||
|          <property name="minimumSize"> | ||||
|           <size> | ||||
|            <width>150</width> | ||||
|            <height>0</height> | ||||
|           </size> | ||||
|          </property> | ||||
|          <layout class="QVBoxLayout" name="verticalLayout_4"> | ||||
|           <property name="leftMargin"> | ||||
|            <number>0</number> | ||||
|           </property> | ||||
|           <property name="topMargin"> | ||||
|            <number>0</number> | ||||
|           </property> | ||||
|           <property name="rightMargin"> | ||||
|            <number>0</number> | ||||
|           </property> | ||||
|           <property name="bottomMargin"> | ||||
|            <number>0</number> | ||||
|           </property> | ||||
|           <item> | ||||
|            <widget class="QWidget" name="widget_9" native="true"> | ||||
|             <layout class="QHBoxLayout" name="horizontalLayout_8"> | ||||
|              <item> | ||||
|               <spacer name="horizontalSpacer_6"> | ||||
|                <property name="orientation"> | ||||
|                 <enum>Qt::Horizontal</enum> | ||||
|                </property> | ||||
|                <property name="sizeHint" stdset="0"> | ||||
|                 <size> | ||||
|                  <width>40</width> | ||||
|                  <height>20</height> | ||||
|                 </size> | ||||
|                </property> | ||||
|               </spacer> | ||||
|              </item> | ||||
|              <item> | ||||
|               <widget class="QToolButton" name="btnRemove"> | ||||
|                <property name="enabled"> | ||||
|                 <bool>false</bool> | ||||
|                </property> | ||||
|                <property name="toolTip"> | ||||
|                 <string>Remove</string> | ||||
|                </property> | ||||
|                <property name="text"> | ||||
|                 <string>...</string> | ||||
|                </property> | ||||
|                <property name="icon"> | ||||
|                 <iconset resource="../core/rc.qrc"> | ||||
|                  <normaloff>:/icons/remove.svg</normaloff>:/icons/remove.svg</iconset> | ||||
|                </property> | ||||
|                <property name="iconSize"> | ||||
|                 <size> | ||||
|                  <width>24</width> | ||||
|                  <height>24</height> | ||||
|                 </size> | ||||
|                </property> | ||||
|                <property name="autoRaise"> | ||||
|                 <bool>true</bool> | ||||
|                </property> | ||||
|               </widget> | ||||
|              </item> | ||||
|              <item> | ||||
|               <widget class="QToolButton" name="btnOwner"> | ||||
|                <property name="enabled"> | ||||
|                 <bool>false</bool> | ||||
|                </property> | ||||
|                <property name="toolTip"> | ||||
|                 <string>Owner</string> | ||||
|                </property> | ||||
|                <property name="text"> | ||||
|                 <string>...</string> | ||||
|                </property> | ||||
|                <property name="icon"> | ||||
|                 <iconset resource="../core/rc.qrc"> | ||||
|                  <normaloff>:/icons/ok.svg</normaloff>:/icons/ok.svg</iconset> | ||||
|                </property> | ||||
|                <property name="iconSize"> | ||||
|                 <size> | ||||
|                  <width>24</width> | ||||
|                  <height>24</height> | ||||
|                 </size> | ||||
|                </property> | ||||
|                <property name="checkable"> | ||||
|                 <bool>true</bool> | ||||
|                </property> | ||||
|                <property name="autoRaise"> | ||||
|                 <bool>true</bool> | ||||
|                </property> | ||||
|               </widget> | ||||
|              </item> | ||||
|              <item> | ||||
|               <spacer name="horizontalSpacer_5"> | ||||
|                <property name="orientation"> | ||||
|                 <enum>Qt::Horizontal</enum> | ||||
|                </property> | ||||
|                <property name="sizeHint" stdset="0"> | ||||
|                 <size> | ||||
|                  <width>40</width> | ||||
|                  <height>20</height> | ||||
|                 </size> | ||||
|                </property> | ||||
|               </spacer> | ||||
|              </item> | ||||
|             </layout> | ||||
|            </widget> | ||||
|           </item> | ||||
|           <item> | ||||
|            <widget class="QTableView" name="tablePeople"/> | ||||
|           </item> | ||||
|          </layout> | ||||
|          <zorder>widget_9</zorder> | ||||
|          <zorder>tableView</zorder> | ||||
|          <zorder>tablePeople</zorder> | ||||
|         </widget> | ||||
|        </item> | ||||
|       </layout> | ||||
|      </widget> | ||||
|     </item> | ||||
|    </layout> | ||||
|   </widget> | ||||
|   <widget class="QWizardPage" name="servicePage"> | ||||
|    <layout class="QVBoxLayout" name="verticalLayout_3"> | ||||
|     <item> | ||||
|      <widget class="QGroupBox" name="groupBox_3"> | ||||
|       <property name="title"> | ||||
|        <string>Services</string> | ||||
|       </property> | ||||
|       <layout class="QHBoxLayout" name="horizontalLayout_3"> | ||||
|        <item> | ||||
|         <widget class="QTableView" name="tableView_2"/> | ||||
|        </item> | ||||
|        <item> | ||||
|         <widget class="QWidget" name="widget_2" native="true"> | ||||
|          <layout class="QVBoxLayout" name="verticalLayout_2"> | ||||
|           <item> | ||||
|            <spacer name="verticalSpacer"> | ||||
|             <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> | ||||
|            <widget class="QToolButton" name="toolButton"> | ||||
|             <property name="text"> | ||||
|              <string>...</string> | ||||
|             </property> | ||||
|            </widget> | ||||
|           </item> | ||||
|           <item> | ||||
|            <widget class="QToolButton" name="toolButton_2"> | ||||
|             <property name="text"> | ||||
|              <string>...</string> | ||||
|             </property> | ||||
|            </widget> | ||||
|           </item> | ||||
|           <item> | ||||
|            <spacer name="verticalSpacer_2"> | ||||
|             <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> | ||||
|        <item> | ||||
|         <widget class="QTableView" name="tableView_3"/> | ||||
|        </item> | ||||
|       </layout> | ||||
|      </widget> | ||||
|     </item> | ||||
|     <item> | ||||
|      <widget class="QGroupBox" name="groupBox_4"> | ||||
|       <property name="title"> | ||||
|        <string>Sale</string> | ||||
|       </property> | ||||
|       <layout class="QGridLayout" name="gridLayout_2"> | ||||
|        <item row="0" column="0"> | ||||
|         <widget class="QCheckBox" name="checkBox_2"> | ||||
|          <property name="text"> | ||||
|           <string>Apply sale</string> | ||||
|          </property> | ||||
|         </widget> | ||||
|        </item> | ||||
|        <item row="1" column="0"> | ||||
|         <widget class="QComboBox" name="sale"/> | ||||
|        </item> | ||||
|       </layout> | ||||
|      </widget> | ||||
|     </item> | ||||
|    </layout> | ||||
|   </widget> | ||||
|   <widget class="QWizardPage" name="finishPage"> | ||||
|    <layout class="QHBoxLayout" name="horizontalLayout_6"> | ||||
|     <item> | ||||
|      <widget class="QGroupBox" name="groupBox_5"> | ||||
|       <property name="title"> | ||||
|        <string>Summary</string> | ||||
|       </property> | ||||
|       <layout class="QVBoxLayout" name="verticalLayout_5"> | ||||
|        <item> | ||||
|         <widget class="QWidget" name="widget_4" native="true"> | ||||
|          <layout class="QHBoxLayout" name="horizontalLayout_5"> | ||||
|           <property name="leftMargin"> | ||||
|            <number>0</number> | ||||
|           </property> | ||||
|           <property name="topMargin"> | ||||
|            <number>0</number> | ||||
|           </property> | ||||
|           <property name="bottomMargin"> | ||||
|            <number>0</number> | ||||
|           </property> | ||||
|           <item> | ||||
|            <widget class="QLabel" name="label_16"> | ||||
|             <property name="text"> | ||||
|              <string>From:</string> | ||||
|             </property> | ||||
|            </widget> | ||||
|           </item> | ||||
|           <item> | ||||
|            <widget class="QLabel" name="label_17"> | ||||
|             <property name="text"> | ||||
|              <string>TextLabel</string> | ||||
|             </property> | ||||
|            </widget> | ||||
|           </item> | ||||
|           <item> | ||||
|            <widget class="QLabel" name="label_18"> | ||||
|             <property name="text"> | ||||
|              <string>To:</string> | ||||
|             </property> | ||||
|            </widget> | ||||
|           </item> | ||||
|           <item> | ||||
|            <widget class="QLabel" name="label_19"> | ||||
|             <property name="text"> | ||||
|              <string>TextLabel</string> | ||||
|             </property> | ||||
|            </widget> | ||||
|           </item> | ||||
|           <item> | ||||
|            <spacer name="horizontalSpacer_4"> | ||||
|             <property name="orientation"> | ||||
|              <enum>Qt::Horizontal</enum> | ||||
|             </property> | ||||
|             <property name="sizeHint" stdset="0"> | ||||
|              <size> | ||||
|               <width>40</width> | ||||
|               <height>20</height> | ||||
|              </size> | ||||
|             </property> | ||||
|            </spacer> | ||||
|           </item> | ||||
|          </layout> | ||||
|         </widget> | ||||
|        </item> | ||||
|        <item> | ||||
|         <widget class="QWidget" name="widget_5" native="true"> | ||||
|          <layout class="QHBoxLayout" name="horizontalLayout_4"> | ||||
|           <property name="leftMargin"> | ||||
|            <number>0</number> | ||||
|           </property> | ||||
|           <property name="topMargin"> | ||||
|            <number>0</number> | ||||
|           </property> | ||||
|           <property name="bottomMargin"> | ||||
|            <number>0</number> | ||||
|           </property> | ||||
|           <item> | ||||
|            <widget class="QLabel" name="label_20"> | ||||
|             <property name="text"> | ||||
|              <string>Days:</string> | ||||
|             </property> | ||||
|            </widget> | ||||
|           </item> | ||||
|           <item> | ||||
|            <widget class="QLabel" name="label_21"> | ||||
|             <property name="text"> | ||||
|              <string>TextLabel</string> | ||||
|             </property> | ||||
|            </widget> | ||||
|           </item> | ||||
|           <item> | ||||
|            <spacer name="horizontalSpacer_2"> | ||||
|             <property name="orientation"> | ||||
|              <enum>Qt::Horizontal</enum> | ||||
|             </property> | ||||
|             <property name="sizeHint" stdset="0"> | ||||
|              <size> | ||||
|               <width>40</width> | ||||
|               <height>20</height> | ||||
|              </size> | ||||
|             </property> | ||||
|            </spacer> | ||||
|           </item> | ||||
|          </layout> | ||||
|         </widget> | ||||
|        </item> | ||||
|        <item> | ||||
|         <widget class="QLabel" name="label_14"> | ||||
|          <property name="text"> | ||||
|           <string>People:</string> | ||||
|          </property> | ||||
|         </widget> | ||||
|        </item> | ||||
|        <item> | ||||
|         <widget class="QTableView" name="tableView_4"/> | ||||
|        </item> | ||||
|        <item> | ||||
|         <widget class="QLabel" name="label_15"> | ||||
|          <property name="text"> | ||||
|           <string>Services:</string> | ||||
|          </property> | ||||
|         </widget> | ||||
|        </item> | ||||
|        <item> | ||||
|         <widget class="QTableView" name="tableView_5"/> | ||||
|        </item> | ||||
|        <item> | ||||
|         <widget class="QWidget" name="widget_6" native="true"> | ||||
|          <layout class="QFormLayout" name="formLayout"> | ||||
|           <item row="0" column="0"> | ||||
|            <widget class="QLabel" name="label_22"> | ||||
|             <property name="text"> | ||||
|              <string>Sale:</string> | ||||
|             </property> | ||||
|            </widget> | ||||
|           </item> | ||||
|           <item row="0" column="1"> | ||||
|            <widget class="QLabel" name="label_23"> | ||||
|             <property name="text"> | ||||
|              <string>TextLabel</string> | ||||
|             </property> | ||||
|            </widget> | ||||
|           </item> | ||||
|           <item row="1" column="0"> | ||||
|            <widget class="QLabel" name="label_24"> | ||||
|             <property name="font"> | ||||
|              <font> | ||||
|               <weight>75</weight> | ||||
|               <bold>true</bold> | ||||
|              </font> | ||||
|             </property> | ||||
|             <property name="text"> | ||||
|              <string>Total:</string> | ||||
|             </property> | ||||
|            </widget> | ||||
|           </item> | ||||
|           <item row="1" column="1"> | ||||
|            <widget class="QLabel" name="label_25"> | ||||
|             <property name="font"> | ||||
|              <font> | ||||
|               <weight>75</weight> | ||||
|               <bold>true</bold> | ||||
|              </font> | ||||
|             </property> | ||||
|             <property name="text"> | ||||
|              <string>TextLabel</string> | ||||
|             </property> | ||||
|            </widget> | ||||
|           </item> | ||||
|          </layout> | ||||
|         </widget> | ||||
|        </item> | ||||
|        <item> | ||||
|         <widget class="QWidget" name="widget_7" native="true"> | ||||
|          <layout class="QHBoxLayout" name="horizontalLayout_7"> | ||||
|           <item> | ||||
|            <widget class="QPushButton" name="pushButton_2"> | ||||
|             <property name="text"> | ||||
|              <string>Print</string> | ||||
|             </property> | ||||
|             <property name="icon"> | ||||
|              <iconset resource="../core/rc.qrc"> | ||||
|               <normaloff>:/icons/print.svg</normaloff>:/icons/print.svg</iconset> | ||||
|             </property> | ||||
|            </widget> | ||||
|           </item> | ||||
|           <item> | ||||
|            <spacer name="horizontalSpacer_3"> | ||||
|             <property name="orientation"> | ||||
|              <enum>Qt::Horizontal</enum> | ||||
|             </property> | ||||
|             <property name="sizeHint" stdset="0"> | ||||
|              <size> | ||||
|               <width>40</width> | ||||
|               <height>20</height> | ||||
|              </size> | ||||
|             </property> | ||||
|            </spacer> | ||||
|           </item> | ||||
|          </layout> | ||||
|         </widget> | ||||
|        </item> | ||||
|       </layout> | ||||
|      </widget> | ||||
|     </item> | ||||
|    </layout> | ||||
|   </widget> | ||||
|  </widget> | ||||
|  <tabstops> | ||||
|   <tabstop>start</tabstop> | ||||
|   <tabstop>end</tabstop> | ||||
|   <tabstop>address</tabstop> | ||||
|   <tabstop>groupNew</tabstop> | ||||
|   <tabstop>title</tabstop> | ||||
|   <tabstop>firstName</tabstop> | ||||
|   <tabstop>lastName</tabstop> | ||||
|   <tabstop>birthDate</tabstop> | ||||
|   <tabstop>idCardNumber</tabstop> | ||||
|   <tabstop>ztp</tabstop> | ||||
|   <tabstop>addressStreet</tabstop> | ||||
|   <tabstop>addressHouseNumber</tabstop> | ||||
|   <tabstop>addressZipCode</tabstop> | ||||
|   <tabstop>addressCity</tabstop> | ||||
|   <tabstop>country</tabstop> | ||||
|   <tabstop>btnAdd</tabstop> | ||||
|   <tabstop>btnRemove</tabstop> | ||||
|   <tabstop>btnOwner</tabstop> | ||||
|   <tabstop>tablePeople</tabstop> | ||||
|   <tabstop>toolButton</tabstop> | ||||
|   <tabstop>toolButton_2</tabstop> | ||||
|   <tabstop>tableView_3</tabstop> | ||||
|   <tabstop>tableView_4</tabstop> | ||||
|   <tabstop>tableView_5</tabstop> | ||||
|   <tabstop>pushButton_2</tabstop> | ||||
|   <tabstop>checkBox_2</tabstop> | ||||
|   <tabstop>sale</tabstop> | ||||
|   <tabstop>tableView_2</tabstop> | ||||
|  </tabstops> | ||||
|  <resources> | ||||
|   <include location="../core/rc.qrc"/> | ||||
|   <include location="camprc.qrc"/> | ||||
|  </resources> | ||||
|  <connections/> | ||||
| </ui> | ||||
| @ -0,0 +1,71 @@ | ||||
| #include "personprice.h" | ||||
| #include <define.h> | ||||
| 
 | ||||
| PersonPrice::PersonPrice(QObject *parent) : QObject(parent) | ||||
| { | ||||
|     m_id = 0; | ||||
|     m_fromAge = 0; | ||||
|     m_toAge = 0; | ||||
|     m_price = 0; | ||||
|     m_active = true; | ||||
| } | ||||
| 
 | ||||
| int PersonPrice::id() const | ||||
| { | ||||
|     return m_id; | ||||
| } | ||||
| 
 | ||||
| void PersonPrice::setId(int id) | ||||
| { | ||||
|     m_id = id; | ||||
| } | ||||
| 
 | ||||
| QString PersonPrice::description() const | ||||
| { | ||||
|     return m_description; | ||||
| } | ||||
| 
 | ||||
| void PersonPrice::setDescription(const QString &description) | ||||
| { | ||||
|     m_description = description; | ||||
| } | ||||
| 
 | ||||
| int PersonPrice::fromAge() const | ||||
| { | ||||
|     return m_fromAge; | ||||
| } | ||||
| 
 | ||||
| void PersonPrice::setFromAge(int fromAge) | ||||
| { | ||||
|     m_fromAge = fromAge; | ||||
| } | ||||
| 
 | ||||
| int PersonPrice::toAge() const | ||||
| { | ||||
|     return m_toAge; | ||||
| } | ||||
| 
 | ||||
| void PersonPrice::setToAge(int toAge) | ||||
| { | ||||
|     m_toAge = toAge; | ||||
| } | ||||
| 
 | ||||
| QDecDouble PersonPrice::price() const | ||||
| { | ||||
|     return TO_DEC(m_price); | ||||
| } | ||||
| 
 | ||||
| void PersonPrice::setPrice(QDecDouble price) | ||||
| { | ||||
|     m_price = FROM_DEC(price); | ||||
| } | ||||
| 
 | ||||
| bool PersonPrice::active() const | ||||
| { | ||||
|     return m_active; | ||||
| } | ||||
| 
 | ||||
| void PersonPrice::setActive(bool active) | ||||
| { | ||||
|     m_active = active; | ||||
| } | ||||
| @ -0,0 +1,50 @@ | ||||
| #ifndef PERSONPRICE_H | ||||
| #define PERSONPRICE_H | ||||
| 
 | ||||
| #include <QObject> | ||||
| #include <QDecDouble.hh> | ||||
| #include <odb/core.hxx> | ||||
| 
 | ||||
| #pragma db object | ||||
| class PersonPrice : public QObject | ||||
| { | ||||
|     Q_OBJECT | ||||
|     Q_PROPERTY(QString description READ description WRITE setDescription) | ||||
|     Q_PROPERTY(int fromAge READ fromAge WRITE setFromAge) | ||||
|     Q_PROPERTY(int toAge READ toAge WRITE setToAge) | ||||
|     Q_PROPERTY(QDecDouble price READ price WRITE setPrice) | ||||
|     Q_PROPERTY(bool active READ active WRITE setActive) | ||||
| 
 | ||||
| public: | ||||
|     explicit PersonPrice(QObject *parent = 0); | ||||
| 
 | ||||
|     int id() const; | ||||
|     void setId(int id); | ||||
| 
 | ||||
|     QString description() const; | ||||
|     void setDescription(const QString &description); | ||||
| 
 | ||||
|     int fromAge() const; | ||||
|     void setFromAge(int fromAge); | ||||
| 
 | ||||
|     int toAge() const; | ||||
|     void setToAge(int toAge); | ||||
| 
 | ||||
|     QDecDouble price() const; | ||||
|     void setPrice(QDecDouble price); | ||||
| 
 | ||||
|     bool active() const; | ||||
|     void setActive(bool active); | ||||
| 
 | ||||
| private: | ||||
|     friend class odb::access; | ||||
| #pragma db id auto | ||||
|     int m_id; | ||||
|     QString m_description; | ||||
|     int m_fromAge; | ||||
|     int m_toAge; | ||||
|     int m_price; | ||||
|     bool m_active; | ||||
| }; | ||||
| 
 | ||||
| #endif // PERSONPRICE_H
 | ||||
| @ -0,0 +1,49 @@ | ||||
| #include "sale.h" | ||||
| #include <define.h> | ||||
| 
 | ||||
| Sale::Sale(QObject *parent) : QObject(parent) | ||||
| { | ||||
|     m_id = 0; | ||||
|     m_sale = 0; | ||||
|     m_fixed = false; | ||||
| } | ||||
| 
 | ||||
| int Sale::id() const | ||||
| { | ||||
|     return m_id; | ||||
| } | ||||
| 
 | ||||
| void Sale::setId(int id) | ||||
| { | ||||
|     m_id = id; | ||||
| } | ||||
| 
 | ||||
| QDecDouble Sale::sale() const | ||||
| { | ||||
|     return TO_DEC(m_sale); | ||||
| } | ||||
| 
 | ||||
| void Sale::setSale(QDecDouble sale) | ||||
| { | ||||
|     m_sale = FROM_DEC(sale); | ||||
| } | ||||
| 
 | ||||
| bool Sale::fixed() const | ||||
| { | ||||
|     return m_fixed; | ||||
| } | ||||
| 
 | ||||
| void Sale::setFixed(bool fixed) | ||||
| { | ||||
|     m_fixed = fixed; | ||||
| } | ||||
| 
 | ||||
| QString Sale::description() const | ||||
| { | ||||
|     return m_description; | ||||
| } | ||||
| 
 | ||||
| void Sale::setDescription(const QString &description) | ||||
| { | ||||
|     m_description = description; | ||||
| } | ||||
| @ -0,0 +1,40 @@ | ||||
| #ifndef SALE_H | ||||
| #define SALE_H | ||||
| 
 | ||||
| #include <QObject> | ||||
| #include <odb/core.hxx> | ||||
| #include <QDecDouble.hh> | ||||
| 
 | ||||
| #pragma db object | ||||
| class Sale : public QObject | ||||
| { | ||||
|     Q_OBJECT | ||||
|     Q_PROPERTY(QString description READ description WRITE setDescription) | ||||
|     Q_PROPERTY(QDecDouble sale READ sale WRITE setSale) | ||||
|     Q_PROPERTY(bool fixed READ fixed WRITE setFixed) | ||||
| 
 | ||||
| public: | ||||
|     explicit Sale(QObject *parent = 0); | ||||
| 
 | ||||
|     int id() const; | ||||
|     void setId(int id); | ||||
| 
 | ||||
|     QDecDouble sale() const; | ||||
|     void setSale(QDecDouble sale); | ||||
| 
 | ||||
|     bool fixed() const; | ||||
|     void setFixed(bool fixed); | ||||
| 
 | ||||
|     QString description() const; | ||||
|     void setDescription(const QString &description); | ||||
| 
 | ||||
| private: | ||||
|     friend class odb::access; | ||||
| #pragma db id auto | ||||
|     int m_id; | ||||
|     QString m_description; | ||||
|     int m_sale; | ||||
|     bool m_fixed; | ||||
| }; | ||||
| 
 | ||||
| #endif // SALE_H
 | ||||
| @ -0,0 +1,40 @@ | ||||
| #include "campsettings.h" | ||||
| #include <define.h> | ||||
| #include <QDebug> | ||||
| 
 | ||||
| CampSettings::CampSettings(QObject *parent) : QObject(parent) | ||||
| { | ||||
|     m_accFee = 0; | ||||
|     m_rounding = Enums::R_MATH; | ||||
|     m_decimalPlaces = 0; | ||||
| } | ||||
| 
 | ||||
| QDecDouble CampSettings::accFee() const | ||||
| { | ||||
|     return TO_DEC(m_accFee); | ||||
| } | ||||
| 
 | ||||
| void CampSettings::setAccFee(QDecDouble accFee) | ||||
| { | ||||
|     m_accFee = FROM_DEC(accFee); | ||||
| } | ||||
| 
 | ||||
| Enums::Rounding CampSettings::rounding() const | ||||
| { | ||||
|     return m_rounding; | ||||
| } | ||||
| 
 | ||||
| void CampSettings::setRounding(const Enums::Rounding &rounding) | ||||
| { | ||||
|     m_rounding = rounding; | ||||
| } | ||||
| 
 | ||||
| int CampSettings::decimalPlaces() const | ||||
| { | ||||
|     return m_decimalPlaces; | ||||
| } | ||||
| 
 | ||||
| void CampSettings::setDecimalPlaces(int decimalPlaces) | ||||
| { | ||||
|     m_decimalPlaces = decimalPlaces; | ||||
| } | ||||
| @ -0,0 +1,36 @@ | ||||
| #ifndef CAMPSETTINGS_H | ||||
| #define CAMPSETTINGS_H | ||||
| 
 | ||||
| #include <QObject> | ||||
| #include <enums.h> | ||||
| #include <QDecDouble.hh> | ||||
| #include <QSharedPointer> | ||||
| 
 | ||||
| class CampSettings : public QObject | ||||
| { | ||||
|     Q_OBJECT | ||||
|     Q_PROPERTY(QDecDouble accFee READ accFee WRITE setAccFee) | ||||
|     Q_PROPERTY(Enums::Rounding rounding READ rounding WRITE setRounding) | ||||
|     Q_PROPERTY(int decimalPlaces READ decimalPlaces WRITE setDecimalPlaces) | ||||
| 
 | ||||
| public: | ||||
|     explicit CampSettings(QObject *parent = 0); | ||||
| 
 | ||||
|     QDecDouble accFee() const; | ||||
|     void setAccFee(QDecDouble accFee); | ||||
| 
 | ||||
|     Enums::Rounding rounding() const; | ||||
|     void setRounding(const Enums::Rounding &rounding); | ||||
| 
 | ||||
|     int decimalPlaces() const; | ||||
|     void setDecimalPlaces(int decimalPlaces); | ||||
| 
 | ||||
| private: | ||||
|     int m_accFee; | ||||
|     Enums::Rounding m_rounding; | ||||
|     int m_decimalPlaces; | ||||
| }; | ||||
| 
 | ||||
| typedef QSharedPointer<CampSettings> CampSettingsPtr; | ||||
| 
 | ||||
| #endif // CAMPSETTINGS_H
 | ||||
| @ -0,0 +1,172 @@ | ||||
| #include "camp-odb.hxx" | ||||
| #include "campsettingsform.h" | ||||
| #include "ui_campsettingsform.h" | ||||
| 
 | ||||
| #include <settingsservice.h> | ||||
| #include <QScroller> | ||||
| #include <QMessageBox> | ||||
| 
 | ||||
| CampSettingsForm::CampSettingsForm(QWidget *parent) : | ||||
|     FormBinder<CampSettings>(parent), | ||||
|     ui(new Ui::CampSettingsForm) | ||||
| { | ||||
|     ui->setupUi(this); | ||||
| 
 | ||||
|     m_personPriceModel = new AutoTableModel<PersonPrice>(); | ||||
|     m_personPriceModel->setEditableCols(QList<int>() << 0 << 1 << 2 << 3); | ||||
|     m_saleModel = new AutoTableModel<Sale>(); | ||||
|     m_saleModel->setEditableCols(QList<int>() << 0 << 1 << 2); | ||||
| 
 | ||||
|     ui->tablePersonPrices->setModel(m_personPriceModel); | ||||
|     ui->tableSales->setModel(m_saleModel); | ||||
| 
 | ||||
|     ui->tablePersonPrices->horizontalHeader()->setSectionResizeMode(0, QHeaderView::Stretch); | ||||
|     ui->tableSales->horizontalHeader()->setSectionResizeMode(0, QHeaderView::Stretch); | ||||
| 
 | ||||
|     QScroller::grabGesture(ui->tablePersonPrices, QScroller::LeftMouseButtonGesture); | ||||
|     QScroller::grabGesture(ui->tableSales, QScroller::LeftMouseButtonGesture); | ||||
| 
 | ||||
|     connect(ui->tablePersonPrices->selectionModel(), &QItemSelectionModel::currentRowChanged, [this](){ | ||||
|         ui->btnPriceDisable->setEnabled(ui->tablePersonPrices->currentIndex().isValid()); | ||||
|         ui->btnPriceRemove->setEnabled(ui->tablePersonPrices->currentIndex().isValid()); | ||||
|         ui->btnPriceDisable->setChecked(m_personPriceModel->itemFromIndex(ui->tablePersonPrices->currentIndex())->active()); | ||||
|     }); | ||||
| 
 | ||||
|     connect(ui->tableSales->selectionModel(), &QItemSelectionModel::currentRowChanged, [this](){ | ||||
|         ui->btnSaleRemove->setEnabled(ui->tableSales->currentIndex().isValid()); | ||||
|     }); | ||||
| 
 | ||||
|     registerBinding(ui->accFee); | ||||
|     registerBinding(ui->decimalPlaces); | ||||
|     QList<ComboData> roundings ; | ||||
|     roundings << ComboData(Enums::R_NONE, tr("None")) | ||||
|        << ComboData(Enums::R_UP, tr("Up")) | ||||
|        << ComboData(Enums::R_DOWN, tr("Down")) | ||||
|        << ComboData(Enums::R_MATH, tr("Mathematic")); | ||||
|     registerBinding(ui->rounding, roundings); | ||||
| } | ||||
| 
 | ||||
| CampSettingsForm::~CampSettingsForm() | ||||
| { | ||||
|     delete ui; | ||||
| } | ||||
| 
 | ||||
| bool CampSettingsForm::saveRecord() | ||||
| { | ||||
|     bindToData(); | ||||
|     SettingsService srv("CAMP"); | ||||
|     srv.saveSettings(entity()); | ||||
| 
 | ||||
|     Service<PersonPrice> personSrv; | ||||
|     Service<Sale> saleSrv; | ||||
|     bool ret = true; | ||||
| 
 | ||||
|     connect(&personSrv, &IService::dbErrorDelete, [&ret, this](QString){ | ||||
|         QMessageBox::critical(this, tr("Cannot delete"), tr("Price already used")); | ||||
|         ret = false; | ||||
|     }); | ||||
| 
 | ||||
|     foreach (PersonPricePtr p, personSrv.all()) { | ||||
|         bool found = false; | ||||
|         foreach (PersonPricePtr price, m_personPriceModel->list()) { | ||||
|             if (price->id() == p->id()) | ||||
|             { | ||||
|                 found = true; | ||||
|                 break; | ||||
|             } | ||||
|         } | ||||
| 
 | ||||
|         if (!found) | ||||
|         { | ||||
|             personSrv.erase(p); | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     foreach (PersonPricePtr p, m_personPriceModel->list()) { | ||||
|         bool found = false; | ||||
|         foreach (PersonPricePtr price, personSrv.all()) { | ||||
|             if (price->id() == p->id()) | ||||
|             { | ||||
|                 found = true; | ||||
|                 break; | ||||
|             } | ||||
|         } | ||||
| 
 | ||||
|         if (!found) | ||||
|         { | ||||
|             personSrv.save(p); | ||||
|         } | ||||
|         else | ||||
|         { | ||||
|             personSrv.update(p); | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     foreach (SalePtr s, saleSrv.all()) { | ||||
|         saleSrv.erase(s); | ||||
|     } | ||||
| 
 | ||||
|     foreach (SalePtr s, m_saleModel->list()) { | ||||
|         saleSrv.save(s); | ||||
|     } | ||||
| 
 | ||||
|     return ret; | ||||
| } | ||||
| 
 | ||||
| void CampSettingsForm::loadEntity() | ||||
| { | ||||
|     SettingsService srv("CAMP"); | ||||
|     CampSettingsPtr settings = srv.loadSettings<CampSettings>(); | ||||
|     setEntity(settings); | ||||
| 
 | ||||
|     Service<PersonPrice> personSrv; | ||||
|     Service<Sale> saleSrv; | ||||
| 
 | ||||
|     m_personPriceModel->setData(personSrv.all()); | ||||
|     m_saleModel->setData(saleSrv.all()); | ||||
| 
 | ||||
|     ui->btnPriceDisable->setEnabled(false); | ||||
|     ui->btnPriceRemove->setEnabled(false); | ||||
|     ui->btnSaleRemove->setEnabled(false); | ||||
| } | ||||
| 
 | ||||
| void CampSettingsForm::on_btnPriceAdd_clicked() | ||||
| { | ||||
|     PersonPricePtr price(new PersonPrice()); | ||||
|     m_personPriceModel->addRow(price); | ||||
| } | ||||
| 
 | ||||
| void CampSettingsForm::on_btnSaleAdd_clicked() | ||||
| { | ||||
|     SalePtr sale(new Sale()); | ||||
|     m_saleModel->addRow(sale); | ||||
| } | ||||
| 
 | ||||
| void CampSettingsForm::on_btnPriceRemove_clicked() | ||||
| { | ||||
|     m_personPriceModel->removeRowAt(ui->tablePersonPrices->currentIndex()); | ||||
| } | ||||
| 
 | ||||
| void CampSettingsForm::on_btnPriceDisable_clicked() | ||||
| { | ||||
|     PersonPricePtr price = m_personPriceModel->itemFromIndex(ui->tablePersonPrices->currentIndex()); | ||||
|     price->setActive(!price->active()); | ||||
| } | ||||
| 
 | ||||
| void CampSettingsForm::on_btnPriceFilter_clicked() | ||||
| { | ||||
|     Service<PersonPrice> srv; | ||||
|     if (ui->btnPriceFilter->isChecked()) | ||||
|     { | ||||
|         m_personPriceModel->setData(srv.all("active = 1")); | ||||
|     } | ||||
|     else | ||||
|     { | ||||
|         m_personPriceModel->setData(srv.all()); | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| void CampSettingsForm::on_btnSaleRemove_clicked() | ||||
| { | ||||
|     m_saleModel->removeRowAt(ui->tableSales->currentIndex()); | ||||
| } | ||||
| @ -0,0 +1,51 @@ | ||||
| #ifndef CAMPSETTINGSFORM_H | ||||
| #define CAMPSETTINGSFORM_H | ||||
| 
 | ||||
| #include <QWidget> | ||||
| #include <QList> | ||||
| 
 | ||||
| #include "campsettings.h" | ||||
| #include "data/camp-data.h" | ||||
| #include <formbinder.h> | ||||
| #include <autotablemodel.h> | ||||
| 
 | ||||
| namespace Ui { | ||||
| class CampSettingsForm; | ||||
| } | ||||
| 
 | ||||
| class CampSettingsForm : public FormBinder<CampSettings> | ||||
| { | ||||
|     Q_OBJECT | ||||
| 
 | ||||
| public: | ||||
|     explicit CampSettingsForm(QWidget *parent = 0); | ||||
|     ~CampSettingsForm(); | ||||
| 
 | ||||
|     // IForm interface
 | ||||
| public slots: | ||||
|     bool saveRecord(); | ||||
| 
 | ||||
|     // IForm interface
 | ||||
| public: | ||||
|     void loadEntity(); | ||||
| 
 | ||||
| private slots: | ||||
|     void on_btnPriceAdd_clicked(); | ||||
| 
 | ||||
|     void on_btnSaleAdd_clicked(); | ||||
| 
 | ||||
|     void on_btnPriceRemove_clicked(); | ||||
| 
 | ||||
|     void on_btnPriceDisable_clicked(); | ||||
| 
 | ||||
|     void on_btnPriceFilter_clicked(); | ||||
| 
 | ||||
|     void on_btnSaleRemove_clicked(); | ||||
| 
 | ||||
| private: | ||||
|     Ui::CampSettingsForm *ui; | ||||
|     AutoTableModel<PersonPrice> *m_personPriceModel; | ||||
|     AutoTableModel<Sale> *m_saleModel; | ||||
| }; | ||||
| 
 | ||||
| #endif // CAMPSETTINGSFORM_H
 | ||||
| @ -0,0 +1,282 @@ | ||||
| <?xml version="1.0" encoding="UTF-8"?> | ||||
| <ui version="4.0"> | ||||
|  <class>CampSettingsForm</class> | ||||
|  <widget class="QWidget" name="CampSettingsForm"> | ||||
|   <property name="geometry"> | ||||
|    <rect> | ||||
|     <x>0</x> | ||||
|     <y>0</y> | ||||
|     <width>696</width> | ||||
|     <height>489</height> | ||||
|    </rect> | ||||
|   </property> | ||||
|   <property name="windowTitle"> | ||||
|    <string>Form</string> | ||||
|   </property> | ||||
|   <layout class="QVBoxLayout" name="verticalLayout"> | ||||
|    <item> | ||||
|     <widget class="QGroupBox" name="groupBox"> | ||||
|      <property name="title"> | ||||
|       <string>Person prices</string> | ||||
|      </property> | ||||
|      <layout class="QVBoxLayout" name="verticalLayout_2"> | ||||
|       <item> | ||||
|        <widget class="QWidget" name="widget" native="true"> | ||||
|         <layout class="QHBoxLayout" name="horizontalLayout"> | ||||
|          <property name="leftMargin"> | ||||
|           <number>0</number> | ||||
|          </property> | ||||
|          <property name="topMargin"> | ||||
|           <number>0</number> | ||||
|          </property> | ||||
|          <property name="rightMargin"> | ||||
|           <number>0</number> | ||||
|          </property> | ||||
|          <property name="bottomMargin"> | ||||
|           <number>0</number> | ||||
|          </property> | ||||
|          <item> | ||||
|           <widget class="QToolButton" name="btnPriceAdd"> | ||||
|            <property name="toolTip"> | ||||
|             <string>Add</string> | ||||
|            </property> | ||||
|            <property name="text"> | ||||
|             <string>...</string> | ||||
|            </property> | ||||
|            <property name="icon"> | ||||
|             <iconset resource="../../core/rc.qrc"> | ||||
|              <normaloff>:/icons/new.svg</normaloff>:/icons/new.svg</iconset> | ||||
|            </property> | ||||
|            <property name="autoRaise"> | ||||
|             <bool>true</bool> | ||||
|            </property> | ||||
|           </widget> | ||||
|          </item> | ||||
|          <item> | ||||
|           <widget class="QToolButton" name="btnPriceRemove"> | ||||
|            <property name="enabled"> | ||||
|             <bool>false</bool> | ||||
|            </property> | ||||
|            <property name="toolTip"> | ||||
|             <string>Remove</string> | ||||
|            </property> | ||||
|            <property name="text"> | ||||
|             <string>...</string> | ||||
|            </property> | ||||
|            <property name="icon"> | ||||
|             <iconset resource="../../core/rc.qrc"> | ||||
|              <normaloff>:/icons/remove.svg</normaloff>:/icons/remove.svg</iconset> | ||||
|            </property> | ||||
|            <property name="autoRaise"> | ||||
|             <bool>true</bool> | ||||
|            </property> | ||||
|           </widget> | ||||
|          </item> | ||||
|          <item> | ||||
|           <widget class="QToolButton" name="btnPriceDisable"> | ||||
|            <property name="enabled"> | ||||
|             <bool>false</bool> | ||||
|            </property> | ||||
|            <property name="toolTip"> | ||||
|             <string>Deactivate</string> | ||||
|            </property> | ||||
|            <property name="text"> | ||||
|             <string>...</string> | ||||
|            </property> | ||||
|            <property name="icon"> | ||||
|             <iconset resource="../../core/rc.qrc"> | ||||
|              <normaloff>:/icons/ok.svg</normaloff>:/icons/ok.svg</iconset> | ||||
|            </property> | ||||
|            <property name="checkable"> | ||||
|             <bool>true</bool> | ||||
|            </property> | ||||
|            <property name="autoRaise"> | ||||
|             <bool>true</bool> | ||||
|            </property> | ||||
|           </widget> | ||||
|          </item> | ||||
|          <item> | ||||
|           <widget class="QToolButton" name="btnPriceFilter"> | ||||
|            <property name="toolTip"> | ||||
|             <string>Filter active</string> | ||||
|            </property> | ||||
|            <property name="text"> | ||||
|             <string>...</string> | ||||
|            </property> | ||||
|            <property name="icon"> | ||||
|             <iconset resource="../../core/rc.qrc"> | ||||
|              <normaloff>:/icons/filter.svg</normaloff>:/icons/filter.svg</iconset> | ||||
|            </property> | ||||
|            <property name="checkable"> | ||||
|             <bool>true</bool> | ||||
|            </property> | ||||
|            <property name="autoRaise"> | ||||
|             <bool>true</bool> | ||||
|            </property> | ||||
|           </widget> | ||||
|          </item> | ||||
|          <item> | ||||
|           <spacer name="horizontalSpacer"> | ||||
|            <property name="orientation"> | ||||
|             <enum>Qt::Horizontal</enum> | ||||
|            </property> | ||||
|            <property name="sizeHint" stdset="0"> | ||||
|             <size> | ||||
|              <width>40</width> | ||||
|              <height>20</height> | ||||
|             </size> | ||||
|            </property> | ||||
|           </spacer> | ||||
|          </item> | ||||
|         </layout> | ||||
|        </widget> | ||||
|       </item> | ||||
|       <item> | ||||
|        <widget class="QTableView" name="tablePersonPrices"/> | ||||
|       </item> | ||||
|      </layout> | ||||
|     </widget> | ||||
|    </item> | ||||
|    <item> | ||||
|     <widget class="QGroupBox" name="groupBox_2"> | ||||
|      <property name="title"> | ||||
|       <string>Sales</string> | ||||
|      </property> | ||||
|      <layout class="QVBoxLayout" name="verticalLayout_3"> | ||||
|       <item> | ||||
|        <widget class="QWidget" name="widget_2" native="true"> | ||||
|         <layout class="QHBoxLayout" name="horizontalLayout_2"> | ||||
|          <property name="leftMargin"> | ||||
|           <number>0</number> | ||||
|          </property> | ||||
|          <property name="topMargin"> | ||||
|           <number>0</number> | ||||
|          </property> | ||||
|          <property name="rightMargin"> | ||||
|           <number>0</number> | ||||
|          </property> | ||||
|          <property name="bottomMargin"> | ||||
|           <number>0</number> | ||||
|          </property> | ||||
|          <item> | ||||
|           <widget class="QToolButton" name="btnSaleAdd"> | ||||
|            <property name="toolTip"> | ||||
|             <string>Add</string> | ||||
|            </property> | ||||
|            <property name="text"> | ||||
|             <string>...</string> | ||||
|            </property> | ||||
|            <property name="icon"> | ||||
|             <iconset resource="../../core/rc.qrc"> | ||||
|              <normaloff>:/icons/new.svg</normaloff>:/icons/new.svg</iconset> | ||||
|            </property> | ||||
|            <property name="autoRaise"> | ||||
|             <bool>true</bool> | ||||
|            </property> | ||||
|           </widget> | ||||
|          </item> | ||||
|          <item> | ||||
|           <widget class="QToolButton" name="btnSaleRemove"> | ||||
|            <property name="enabled"> | ||||
|             <bool>false</bool> | ||||
|            </property> | ||||
|            <property name="toolTip"> | ||||
|             <string>Remove</string> | ||||
|            </property> | ||||
|            <property name="text"> | ||||
|             <string>...</string> | ||||
|            </property> | ||||
|            <property name="icon"> | ||||
|             <iconset resource="../../core/rc.qrc"> | ||||
|              <normaloff>:/icons/remove.svg</normaloff>:/icons/remove.svg</iconset> | ||||
|            </property> | ||||
|            <property name="autoRaise"> | ||||
|             <bool>true</bool> | ||||
|            </property> | ||||
|           </widget> | ||||
|          </item> | ||||
|          <item> | ||||
|           <spacer name="horizontalSpacer_2"> | ||||
|            <property name="orientation"> | ||||
|             <enum>Qt::Horizontal</enum> | ||||
|            </property> | ||||
|            <property name="sizeHint" stdset="0"> | ||||
|             <size> | ||||
|              <width>40</width> | ||||
|              <height>20</height> | ||||
|             </size> | ||||
|            </property> | ||||
|           </spacer> | ||||
|          </item> | ||||
|         </layout> | ||||
|        </widget> | ||||
|       </item> | ||||
|       <item> | ||||
|        <widget class="QTableView" name="tableSales"/> | ||||
|       </item> | ||||
|      </layout> | ||||
|     </widget> | ||||
|    </item> | ||||
|    <item> | ||||
|     <widget class="QGroupBox" name="groupBox_3"> | ||||
|      <property name="title"> | ||||
|       <string>Other settings</string> | ||||
|      </property> | ||||
|      <layout class="QFormLayout" name="formLayout"> | ||||
|       <item row="0" column="0"> | ||||
|        <widget class="QLabel" name="label"> | ||||
|         <property name="text"> | ||||
|          <string>Accommodation fee</string> | ||||
|         </property> | ||||
|        </widget> | ||||
|       </item> | ||||
|       <item row="1" column="0"> | ||||
|        <widget class="QLabel" name="label_2"> | ||||
|         <property name="text"> | ||||
|          <string>Rounding</string> | ||||
|         </property> | ||||
|        </widget> | ||||
|       </item> | ||||
|       <item row="1" column="1"> | ||||
|        <widget class="QComboBox" name="rounding"/> | ||||
|       </item> | ||||
|       <item row="2" column="0"> | ||||
|        <widget class="QLabel" name="decimalPlaceslab"> | ||||
|         <property name="text"> | ||||
|          <string>Decimal places</string> | ||||
|         </property> | ||||
|        </widget> | ||||
|       </item> | ||||
|       <item row="2" column="1"> | ||||
|        <widget class="QDoubleSpinBox" name="decimalPlaces"> | ||||
|         <property name="buttonSymbols"> | ||||
|          <enum>QAbstractSpinBox::NoButtons</enum> | ||||
|         </property> | ||||
|         <property name="decimals"> | ||||
|          <number>0</number> | ||||
|         </property> | ||||
|         <property name="maximum"> | ||||
|          <double>100000.000000000000000</double> | ||||
|         </property> | ||||
|        </widget> | ||||
|       </item> | ||||
|       <item row="0" column="1"> | ||||
|        <widget class="QDoubleSpinBox" name="accFee"> | ||||
|         <property name="buttonSymbols"> | ||||
|          <enum>QAbstractSpinBox::NoButtons</enum> | ||||
|         </property> | ||||
|         <property name="maximum"> | ||||
|          <double>99999.990000000005239</double> | ||||
|         </property> | ||||
|        </widget> | ||||
|       </item> | ||||
|      </layout> | ||||
|     </widget> | ||||
|    </item> | ||||
|   </layout> | ||||
|  </widget> | ||||
|  <resources> | ||||
|   <include location="../../core/rc.qrc"/> | ||||
|  </resources> | ||||
|  <connections/> | ||||
| </ui> | ||||
| Before Width: | Height: | Size: 820 B After Width: | Height: | Size: 820 B | 
| @ -0,0 +1,36 @@ | ||||
| #include "importdialog.h" | ||||
| #include "ui_importdialog.h" | ||||
| #include "importprogress.h" | ||||
| #include "csvimporter.h" | ||||
| 
 | ||||
| #include <QFileDialog> | ||||
| #include <QApplication> | ||||
| #include <QDesktopWidget> | ||||
| 
 | ||||
| ImportDialog::ImportDialog(QWidget *parent) : | ||||
|     QDialog(parent), | ||||
|     ui(new Ui::ImportDialog) | ||||
| { | ||||
|     ui->setupUi(this); | ||||
| } | ||||
| 
 | ||||
| ImportDialog::~ImportDialog() | ||||
| { | ||||
|     delete ui; | ||||
| } | ||||
| 
 | ||||
| QString ImportDialog::fileName() | ||||
| { | ||||
|     return ui->editFile->text(); | ||||
| } | ||||
| 
 | ||||
| QString ImportDialog::separator() | ||||
| { | ||||
|     return ui->editSeparator->text(); | ||||
| } | ||||
| 
 | ||||
| void ImportDialog::on_btnFile_clicked() | ||||
| { | ||||
|     QString file = QFileDialog::getOpenFileName(this, tr("Import file"), "", tr("All Files (*.*)")); | ||||
|     ui->editFile->setText(file); | ||||
| } | ||||
| @ -0,0 +1,34 @@ | ||||
| #include "importprogress.h" | ||||
| #include "ui_importprogress.h" | ||||
| 
 | ||||
| ImportProgress::ImportProgress(QWidget *parent) : | ||||
|     QWidget(parent), | ||||
|     ui(new Ui::ImportProgress) | ||||
| { | ||||
|     ui->setupUi(this); | ||||
|     ui->progressBar->setRange(0, 100); | ||||
|     ui->progressBar->setValue(0); | ||||
| 
 | ||||
|     m_terminate = false; | ||||
| } | ||||
| 
 | ||||
| ImportProgress::~ImportProgress() | ||||
| { | ||||
|     delete ui; | ||||
| } | ||||
| 
 | ||||
| void ImportProgress::on_btnCancel_clicked() | ||||
| { | ||||
|     m_terminate = true; | ||||
|     this->close(); | ||||
| } | ||||
| 
 | ||||
| void ImportProgress::updateProgress(int currentPos) | ||||
| { | ||||
|     ui->progressBar->setValue(currentPos); | ||||
| } | ||||
| 
 | ||||
| bool ImportProgress::terminate() | ||||
| { | ||||
|     return m_terminate; | ||||
| } | ||||
| @ -0,0 +1,32 @@ | ||||
| #ifndef IMPORTPROGRESS_H | ||||
| #define IMPORTPROGRESS_H | ||||
| 
 | ||||
| #include <QWidget> | ||||
| #include "iimportprogress.h" | ||||
| 
 | ||||
| namespace Ui { | ||||
| class ImportProgress; | ||||
| } | ||||
| 
 | ||||
| class ImportProgress : public QWidget, public IImportProgress | ||||
| { | ||||
|     Q_OBJECT | ||||
| 
 | ||||
| public: | ||||
|     explicit ImportProgress(QWidget *parent = 0); | ||||
|     ~ImportProgress(); | ||||
| 
 | ||||
| private slots: | ||||
|     void on_btnCancel_clicked(); | ||||
| 
 | ||||
| private: | ||||
|     Ui::ImportProgress *ui; | ||||
|     bool m_terminate; | ||||
| 
 | ||||
|     // IImportProgress interface
 | ||||
| public: | ||||
|     void updateProgress(int currentPos); | ||||
|     bool terminate(); | ||||
| }; | ||||
| 
 | ||||
| #endif // IMPORTPROGRESS_H
 | ||||
| @ -1,46 +0,0 @@ | ||||
| #include "importdialog.h" | ||||
| #include "ui_importdialog.h" | ||||
| 
 | ||||
| #include <service.h> | ||||
| #include <csvimporter.h> | ||||
| #include <QDesktopWidget> | ||||
| #include <QFileDialog> | ||||
| 
 | ||||
| #include "data/postdata.h" | ||||
| #include "postregister-odb.hxx" | ||||
| #include "importprogressform.h" | ||||
| 
 | ||||
| ImportDialog::ImportDialog(QWidget *parent) : | ||||
|     QDialog(parent), | ||||
|     ui(new Ui::ImportDialog) | ||||
| { | ||||
|     ui->setupUi(this); | ||||
| } | ||||
| 
 | ||||
| ImportDialog::~ImportDialog() | ||||
| { | ||||
|     delete ui; | ||||
| } | ||||
| 
 | ||||
| void ImportDialog::on_buttonBox_accepted() | ||||
| { | ||||
|     QString fileName = ui->editFile->text(); | ||||
|     Service<PostData> service; | ||||
|     PostData pd; | ||||
|     CsvImporter importer(pd.metaObject()); | ||||
| 
 | ||||
|     importer.setImportFile(fileName); | ||||
|     importer.setSeparator(ui->editSparator->text()); | ||||
| 
 | ||||
|     ImportProgressForm *progress = new ImportProgressForm(); | ||||
|     progress->move(QApplication::desktop()->screen()->rect().center() - progress->rect().center()); | ||||
|     progress->setWindowModality(Qt::ApplicationModal); | ||||
|     progress->show(); | ||||
|     service.importData(&importer, progress); | ||||
| } | ||||
| 
 | ||||
| void ImportDialog::on_btnFile_clicked() | ||||
| { | ||||
|     QString file = QFileDialog::getOpenFileName(this, tr("Import file"), "", tr("All Files (*.*)")); | ||||
|     ui->editFile->setText(file); | ||||
| } | ||||
| @ -1,34 +0,0 @@ | ||||
| #include "importprogressform.h" | ||||
| #include "ui_importprogressform.h" | ||||
| 
 | ||||
| ImportProgressForm::ImportProgressForm(QWidget *parent) : | ||||
|     QWidget(parent), | ||||
|     ui(new Ui::ImportProgressForm) | ||||
| { | ||||
|     ui->setupUi(this); | ||||
|     ui->progressBar->setRange(0, 100); | ||||
|     ui->progressBar->setValue(0); | ||||
| 
 | ||||
|     m_terminate = false; | ||||
| } | ||||
| 
 | ||||
| ImportProgressForm::~ImportProgressForm() | ||||
| { | ||||
|     delete ui; | ||||
| } | ||||
| 
 | ||||
| void ImportProgressForm::on_btnCancel_clicked() | ||||
| { | ||||
|     m_terminate = true; | ||||
|     this->close(); | ||||
| } | ||||
| 
 | ||||
| void ImportProgressForm::updateProgress(int currentPos) | ||||
| { | ||||
|     ui->progressBar->setValue(currentPos); | ||||
| } | ||||
| 
 | ||||
| bool ImportProgressForm::terminate() | ||||
| { | ||||
|     return m_terminate; | ||||
| } | ||||
| @ -1,32 +0,0 @@ | ||||
| #ifndef IMPORTPROGRESSFORM_H | ||||
| #define IMPORTPROGRESSFORM_H | ||||
| 
 | ||||
| #include <QWidget> | ||||
| #include <iimportprogress.h> | ||||
| 
 | ||||
| namespace Ui { | ||||
| class ImportProgressForm; | ||||
| } | ||||
| 
 | ||||
| class ImportProgressForm : public QWidget, public IImportProgress | ||||
| { | ||||
|     Q_OBJECT | ||||
| 
 | ||||
| public: | ||||
|     explicit ImportProgressForm(QWidget *parent = 0); | ||||
|     ~ImportProgressForm(); | ||||
| 
 | ||||
| private slots: | ||||
|     void on_btnCancel_clicked(); | ||||
| 
 | ||||
| private: | ||||
|     Ui::ImportProgressForm *ui; | ||||
|     bool m_terminate; | ||||
| 
 | ||||
|     // IImportProgress interface
 | ||||
| public: | ||||
|     void updateProgress(int currentPos); | ||||
|     bool terminate(); | ||||
| }; | ||||
| 
 | ||||
| #endif // IMPORTPROGRESSFORM_H
 | ||||
| @ -1,5 +0,0 @@ | ||||
| <RCC> | ||||
|     <qresource prefix="/"> | ||||
|         <file>icons/import.svg</file> | ||||
|     </qresource> | ||||
| </RCC> | ||||
					Loading…
					
					
				
		Reference in New Issue