#ifndef ITEMDETAILMAPPER_H #define ITEMDETAILMAPPER_H #include #include class QLabel; class QLineEdit; class QComboBox; class QDoubleSpinBox; class QSpinBox; class QPushButton; class QAbstractItemModel; class QItemSelectionModel; class QStringListModel; class QTableView; #include "QrCodeGenerator.h" class ItemDetailMapper : public QWidget { Q_OBJECT public: explicit ItemDetailMapper(QWidget* parent = nullptr); void setModelMappings(QTableView* tableView); bool submit(); void revert(); signals: void contentChanged(const QString text); void createOnlineAccountTriggered(const QString& mailAddress); private slots: void rowsInserted(const QModelIndex& parent, int start, int end); void rowsRemoved(const QModelIndex& parent, int start, int end); void toPrevious(); void toNext(); void updateButtons(int row); void emitContentChanged(const QModelIndex& currentIndex); void onCurrentIndexChanged(const QModelIndex& current, const QModelIndex& previous); void updateQRCode(const QString text = ""); void onMailEditChanged(const QString& text); void onOnlineIDChanged(const QString& text); void onAccessCodeChanged(const QString& text); void onCreateOnlineAccountTriggered(); private: /// *** members *** /// Model stuff QTableView* m_tableView = nullptr; QAbstractItemModel* m_model = nullptr; QItemSelectionModel* m_selectionModel = nullptr; std::unique_ptr m_mapper; /// *** GUI elements *** /// left layout QLabel* m_numberLabel; QSpinBox* m_numberBox; QLabel* m_lastNameLabel; QLineEdit* m_lastNameEdit; QLabel* m_firstNameLabel; QLineEdit* m_firstNameEdit; QLabel* m_shareTypeLabel; QComboBox* m_shareTypeBox; QStringListModel* m_shareTypeModel = nullptr; QLabel* m_amountLabel; QDoubleSpinBox* m_amountSpinBox; QLabel* m_biddingTypeLabel; QComboBox* m_biddingTypeBox; QStringListModel* m_biddingTypeModel = nullptr; QLabel* m_bidding1Label; QSpinBox* m_bidding1SpinBox; QLabel* m_bidding2Label; QSpinBox* m_bidding2SpinBox; QLabel* m_bidding3Label; QSpinBox* m_bidding3SpinBox; QLabel* m_depotWish1Label; QLineEdit* m_depotWish1Edit; QLabel* m_depotWish2Label; QLineEdit* m_depotWish2Edit; QLabel* m_mailLabel; QLineEdit* m_mailEdit; /// right layout QPushButton* m_createOnlineAccountButton = nullptr; QPushButton* m_sendInviteMailButton = nullptr; QLabel* m_onlineIdLabel; QLineEdit* m_onlineIdDisplay = nullptr; QLabel* m_accessCodeLabel; QLineEdit* m_accessCodeDisplay = nullptr; QLabel* m_qrCodeDisplay = nullptr; QrCodeGenerator m_generator; QLineEdit* m_accessUrlDisplay = nullptr; /// *** Model mapper stuff *** QPushButton* m_nextButton; QPushButton* m_previousButton; }; #endif // ITEMDETAILMAPPER_H