diff --git a/client/src/CMakeLists.txt b/client/src/CMakeLists.txt index 9b15d8eb..dd0314d4 100755 --- a/client/src/CMakeLists.txt +++ b/client/src/CMakeLists.txt @@ -64,6 +64,7 @@ set(headers dialogs/GeneratePasswordDialog.h dialogs/PasswordStrengthDialog.h dialogs/QRCodeDialog.h + dialogs/TestInvitationDialog.h dialogs/TransferProgressDialog.h # Editors @@ -205,6 +206,7 @@ set(srcs dialogs/GeneratePasswordDialog.cpp dialogs/PasswordStrengthDialog.cpp dialogs/QRCodeDialog.cpp + dialogs/TestInvitationDialog.cpp dialogs/TransferProgressDialog.cpp # Editors @@ -323,6 +325,7 @@ SET(uis dialogs/QRCodeDialog.ui dialogs/SessionLobbyDialog.ui dialogs/StartSessionDialog.ui + dialogs/TestInvitationDialog.ui dialogs/TransferProgressDialog.ui dialogs/WebLoginDialog.ui diff --git a/client/src/dialogs/TestInvitationDialog.cpp b/client/src/dialogs/TestInvitationDialog.cpp new file mode 100644 index 00000000..155f27a5 --- /dev/null +++ b/client/src/dialogs/TestInvitationDialog.cpp @@ -0,0 +1,58 @@ +#include "TestInvitationDialog.h" +#include "ui_TestInvitationDialog.h" + +TestInvitationDialog::TestInvitationDialog(QWidget *parent) + : QDialog(parent) + , ui(new Ui::TestInvitationDialog) +{ + ui->setupUi(this); + setModal(true); + + initUI(); +} + +TestInvitationDialog::~TestInvitationDialog() +{ + delete ui; +} + +void TestInvitationDialog::initUI() +{ + ui->stackedPages->setCurrentIndex(0); + ui->btnPrevious->setEnabled(false); + ui->btnOK->setEnabled(false); +} + +void TestInvitationDialog::on_btnCancel_clicked() +{ + reject(); +} + + +void TestInvitationDialog::on_stackedPages_currentChanged(int current_index) +{ + ui->btnPrevious->setEnabled(current_index>0); + ui->btnNext->setEnabled(current_index < ui->stackedPages->count() - 1); + ui->btnOK->setEnabled(current_index == ui->stackedPages->count() -1); +} + + +void TestInvitationDialog::on_btnPrevious_clicked() +{ + if (ui->stackedPages->currentIndex() > 0) + ui->stackedPages->setCurrentIndex(ui->stackedPages->currentIndex()-1); +} + + +void TestInvitationDialog::on_btnNext_clicked() +{ + if (ui->stackedPages->currentIndex() < ui->stackedPages->count() -1) + ui->stackedPages->setCurrentIndex(ui->stackedPages->currentIndex()+1); +} + + +void TestInvitationDialog::on_btnOK_clicked() +{ + accept(); +} + diff --git a/client/src/dialogs/TestInvitationDialog.h b/client/src/dialogs/TestInvitationDialog.h new file mode 100644 index 00000000..67c2871d --- /dev/null +++ b/client/src/dialogs/TestInvitationDialog.h @@ -0,0 +1,33 @@ +#ifndef TESTINVITATIONDIALOG_H +#define TESTINVITATIONDIALOG_H + +#include + +namespace Ui { +class TestInvitationDialog; +} + +class TestInvitationDialog : public QDialog +{ + Q_OBJECT + +public: + explicit TestInvitationDialog(QWidget *parent = nullptr); + ~TestInvitationDialog(); + +private slots: + void on_btnCancel_clicked(); + + void on_stackedPages_currentChanged(int current_index); + + void on_btnPrevious_clicked(); + + void on_btnNext_clicked(); + +private: + Ui::TestInvitationDialog *ui; + + void initUI(); +}; + +#endif // TESTINVITATIONDIALOG_H diff --git a/client/src/dialogs/TestInvitationDialog.ui b/client/src/dialogs/TestInvitationDialog.ui new file mode 100644 index 00000000..1772dea7 --- /dev/null +++ b/client/src/dialogs/TestInvitationDialog.ui @@ -0,0 +1,320 @@ + + + TestInvitationDialog + + + + 0 + 0 + 646 + 515 + + + + Invitation - Tests + + + + :/icons/test.png:/icons/test.png + + + + + + + 0 + 0 + + + + 0 + + + + + + + + 0 + 0 + + + + + true + + + + Usage maximal + + + Qt::AlignmentFlag::AlignRight|Qt::AlignmentFlag::AlignTrailing|Qt::AlignmentFlag::AlignVCenter + + + + + + + + 0 + 30 + + + + + + + + + 0 + 30 + + + + + + + + Envoyer les invitations automatiquement par courriel + + + + :/icons/email.png:/icons/email.png + + + + 24 + 24 + + + + + + + + + + + + 0 + 0 + + + + + true + + + + Test + + + Qt::AlignmentFlag::AlignRight|Qt::AlignmentFlag::AlignTrailing|Qt::AlignmentFlag::AlignVCenter + + + + + + + + true + + + + Date d'expiration + + + Qt::AlignmentFlag::AlignRight|Qt::AlignmentFlag::AlignTrailing|Qt::AlignmentFlag::AlignVCenter + + + + + + + + 0 + 0 + + + + false + + + true + + + + + + + Qt::Orientation::Vertical + + + + 20 + 40 + + + + + + + + + + + + + + + + + + + Message à joindre à l'invitation + + + + + + + + + + + + + + + + + 100 + 32 + + + + PointingHandCursor + + + Précédent + + + + :/controls/branch_left.png:/controls/branch_left.png + + + + 24 + 24 + + + + + + + + + 100 + 32 + + + + PointingHandCursor + + + Suivant + + + + :/controls/branch_closed.png:/controls/branch_closed.png + + + + 24 + 24 + + + + + + + + Qt::Orientation::Horizontal + + + + 40 + 20 + + + + + + + + + 150 + 32 + + + + PointingHandCursor + + + Inviter + + + + :/icons/ok.png:/icons/ok.png + + + + 24 + 24 + + + + + + + + + 150 + 32 + + + + PointingHandCursor + + + Annuler + + + + :/icons/undo.png:/icons/undo.png + + + + 24 + 24 + + + + + + + + + + + SessionInviteWidget + QWidget +
widgets/SessionInviteWidget.h
+ 1 +
+
+ + + + +
diff --git a/client/src/widgets/TestInvitationsWidget.cpp b/client/src/widgets/TestInvitationsWidget.cpp index 911ae56d..7c6ca5b6 100644 --- a/client/src/widgets/TestInvitationsWidget.cpp +++ b/client/src/widgets/TestInvitationsWidget.cpp @@ -52,6 +52,12 @@ void TestInvitationsWidget::processTestInvitationsReply(QList invitati } } +void TestInvitationsWidget::onTestInvitationDialogFinished(int result) +{ + m_invitationDialog->deleteLater(); + m_invitationDialog = nullptr; +} + void TestInvitationsWidget::updateInvitation(const TeraData *invitation) { int id_test_invitation = invitation->getId(); @@ -156,3 +162,15 @@ void TestInvitationsWidget::setViewMode(const ViewMode &mode) break; } } + +void TestInvitationsWidget::on_btnInvite_clicked() +{ + if (m_invitationDialog) + m_invitationDialog->deleteLater(); + + m_invitationDialog = new TestInvitationDialog(this); + + connect(m_invitationDialog, &TestInvitationDialog::finished, this, &TestInvitationsWidget::onTestInvitationDialogFinished); + m_invitationDialog->show(); +} + diff --git a/client/src/widgets/TestInvitationsWidget.h b/client/src/widgets/TestInvitationsWidget.h index 6c8cda94..d51e6ace 100644 --- a/client/src/widgets/TestInvitationsWidget.h +++ b/client/src/widgets/TestInvitationsWidget.h @@ -5,6 +5,7 @@ #include #include "managers/ComManager.h" +#include "dialogs/TestInvitationDialog.h" namespace Ui { class TestInvitationsWidget; @@ -24,6 +25,9 @@ class TestInvitationsWidget : public QWidget private slots: void processTestInvitationsReply(QList invitations); + void onTestInvitationDialogFinished(int result); + + void on_btnInvite_clicked(); private: typedef enum { @@ -53,6 +57,8 @@ private slots: ComManager* m_comManager = nullptr; ViewMode m_currentView = VIEWMODE_UNKNOWN; + TestInvitationDialog* m_invitationDialog = nullptr; + QHash m_listInvitations_items; // ID Invitation to QTableWidgetItem* mapping void updateInvitation(const TeraData* invitation);