118 lines
2.9 KiB
C++
118 lines
2.9 KiB
C++
#ifndef ITEMDETAILMAPPER_H
|
|
#define ITEMDETAILMAPPER_H
|
|
|
|
#include <QDataWidgetMapper>
|
|
#include <QWidget>
|
|
|
|
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);
|
|
void sendInviteMailTriggered(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 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& accessCode);
|
|
void onCreateOnlineAccountTriggered();
|
|
void onSendInviteMailTriggered();
|
|
|
|
private:
|
|
/// *** members ***
|
|
/// Model stuff
|
|
QTableView* m_tableView = nullptr;
|
|
QAbstractItemModel* m_model = nullptr;
|
|
QItemSelectionModel* m_selectionModel = nullptr;
|
|
|
|
std::unique_ptr<QDataWidgetMapper> m_mapper;
|
|
|
|
QString m_serverUrl;
|
|
/// *** 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
|