From bb5e8945572f43bf5d289dc1f88ad652b2e48c6d Mon Sep 17 00:00:00 2001 From: Bent Witthold Date: Sat, 14 Feb 2026 10:17:31 +0100 Subject: [PATCH] Adding optional QVariant data argument to sendGetRequest to pass it to the server. Using hard coded sendGetRequest(GetBiddingsOfSpecificRound, 2) in fetchCurrentBiddings action to test this. --- UIs/BeetRoundWidgets/mainwindow.cpp | 3 ++- UIs/BeetRoundWidgets/widgets/biddingroundcontrol.h | 7 +------ libs/BeetRoundCore/genericcore.h | 3 ++- libs/BeetRoundCore/network/apiroutes.h | 4 ++-- libs/BeetRoundCore/network/servercommunicator.cpp | 8 ++++++-- 5 files changed, 13 insertions(+), 12 deletions(-) diff --git a/UIs/BeetRoundWidgets/mainwindow.cpp b/UIs/BeetRoundWidgets/mainwindow.cpp index 1fb23d4..d93c0f1 100644 --- a/UIs/BeetRoundWidgets/mainwindow.cpp +++ b/UIs/BeetRoundWidgets/mainwindow.cpp @@ -300,7 +300,8 @@ void MainWindow::findItems() { void MainWindow::fetchCurrentBiddings() { showStatusMessage(tr("Invoked 'Server|Fetch current biddings'")); - emit m_core->sendGetRequest(GetBiddingsOfHighestRound); + // emit m_core->sendGetRequest(GetBiddingsOfHighestRound); + emit m_core->sendGetRequest(GetBiddingsOfSpecificRound, 2); } void MainWindow::execSettingsDialog() { diff --git a/UIs/BeetRoundWidgets/widgets/biddingroundcontrol.h b/UIs/BeetRoundWidgets/widgets/biddingroundcontrol.h index ef03c47..ee64bf1 100644 --- a/UIs/BeetRoundWidgets/widgets/biddingroundcontrol.h +++ b/UIs/BeetRoundWidgets/widgets/biddingroundcontrol.h @@ -13,12 +13,7 @@ class BiddingRoundControl : public QWidget { explicit BiddingRoundControl(QWidget* parent = nullptr); signals: - void sendGetRequest(GetRequestTypes type); - - void triggerStartNewRound(); - void triggerRestartLastRound(); - void triggerStopCurrentRound(); - // void refreshCurrentRound(); + void sendGetRequest(GetRequestTypes type, QVariant data = QVariant()); public slots: /// button slots diff --git a/libs/BeetRoundCore/genericcore.h b/libs/BeetRoundCore/genericcore.h index afc069c..9df744b 100644 --- a/libs/BeetRoundCore/genericcore.h +++ b/libs/BeetRoundCore/genericcore.h @@ -2,6 +2,7 @@ #define GENERICCORE_H #include +#include #include "model/metadata.h" #include "structs.h" @@ -48,7 +49,7 @@ class GenericCore : public QObject { /// *** server communication *** /// request signals - void sendGetRequest(GetRequestTypes type); + void sendGetRequest(GetRequestTypes type, QVariant data = QVariant()); /// response signals void currentBiddingRoundChanged(int round, bool isRunning); diff --git a/libs/BeetRoundCore/network/apiroutes.h b/libs/BeetRoundCore/network/apiroutes.h index 7e024aa..5422772 100644 --- a/libs/BeetRoundCore/network/apiroutes.h +++ b/libs/BeetRoundCore/network/apiroutes.h @@ -15,6 +15,6 @@ static const QString ROUTE_START_BIDDINGROUND = ROUTE_BIDDINGROUNDS + "/start_ static const QString ROUTE_RESTART_BIDDINGROUND = ROUTE_BIDDINGROUNDS + "/restart"; static const QString ROUTE_STOP_BIDDINGROUND = ROUTE_BIDDINGROUNDS + "/stop"; -static const QString ROUTE_GET_BIDDINGS = apiPrefix + "biddings_of_round"; -static const QString ROUTE_GET_BIDDINGS_OF_HIGHEST_ROUND = apiPrefix + "biddings_of_highest_round"; +static const QString ROUTE_GET_BIDDINGS_OF_SPECIFIC_ROUND = apiPrefix + "biddings_of_round"; +static const QString ROUTE_GET_BIDDINGS_OF_HIGHEST_ROUND = apiPrefix + "biddings_of_highest_round"; #endif // APIROUTES_H diff --git a/libs/BeetRoundCore/network/servercommunicator.cpp b/libs/BeetRoundCore/network/servercommunicator.cpp index 45e4a35..0c42fb6 100644 --- a/libs/BeetRoundCore/network/servercommunicator.cpp +++ b/libs/BeetRoundCore/network/servercommunicator.cpp @@ -113,7 +113,8 @@ void ServerCommunicator::setServerConfiguration(const QString url, m_password = password; } -void ServerCommunicator::onSendGetRequestTriggered(const GetRequestTypes type) { +void ServerCommunicator::onSendGetRequestTriggered(const GetRequestTypes type, + QVariant data = QVariant()) { QString path; switch (type) { case GetCurrentBiddingRound: @@ -128,7 +129,9 @@ void ServerCommunicator::onSendGetRequestTriggered(const GetRequestTypes type) { case StopCurrentBiddingRound: path = ROUTE_STOP_BIDDINGROUND; break; - // case GetBiddingsOfSpecificRound: + case GetBiddingsOfSpecificRound: + path = ROUTE_GET_BIDDINGS_OF_SPECIFIC_ROUND + "/" + data.toString(); + break; case GetBiddingsOfHighestRound: path = ROUTE_GET_BIDDINGS_OF_HIGHEST_ROUND; break; @@ -172,6 +175,7 @@ void ServerCommunicator::onGetReplySuccessful(const GetRequestTypes type, const case StopCurrentBiddingRound: currentBiddingRoundChangedReply(doc); break; + case GetBiddingsOfSpecificRound: case GetBiddingsOfHighestRound: currentBiddingsReply(doc); break;