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.
This commit is contained in:
@ -300,7 +300,8 @@ void MainWindow::findItems() {
|
|||||||
|
|
||||||
void MainWindow::fetchCurrentBiddings() {
|
void MainWindow::fetchCurrentBiddings() {
|
||||||
showStatusMessage(tr("Invoked 'Server|Fetch current biddings'"));
|
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() {
|
void MainWindow::execSettingsDialog() {
|
||||||
|
|||||||
@ -13,12 +13,7 @@ class BiddingRoundControl : public QWidget {
|
|||||||
explicit BiddingRoundControl(QWidget* parent = nullptr);
|
explicit BiddingRoundControl(QWidget* parent = nullptr);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void sendGetRequest(GetRequestTypes type);
|
void sendGetRequest(GetRequestTypes type, QVariant data = QVariant());
|
||||||
|
|
||||||
void triggerStartNewRound();
|
|
||||||
void triggerRestartLastRound();
|
|
||||||
void triggerStopCurrentRound();
|
|
||||||
// void refreshCurrentRound();
|
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
/// button slots
|
/// button slots
|
||||||
|
|||||||
@ -2,6 +2,7 @@
|
|||||||
#define GENERICCORE_H
|
#define GENERICCORE_H
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
#include <QVariant>
|
||||||
|
|
||||||
#include "model/metadata.h"
|
#include "model/metadata.h"
|
||||||
#include "structs.h"
|
#include "structs.h"
|
||||||
@ -48,7 +49,7 @@ class GenericCore : public QObject {
|
|||||||
|
|
||||||
/// *** server communication ***
|
/// *** server communication ***
|
||||||
/// request signals
|
/// request signals
|
||||||
void sendGetRequest(GetRequestTypes type);
|
void sendGetRequest(GetRequestTypes type, QVariant data = QVariant());
|
||||||
/// response signals
|
/// response signals
|
||||||
void currentBiddingRoundChanged(int round, bool isRunning);
|
void currentBiddingRoundChanged(int round, bool isRunning);
|
||||||
|
|
||||||
|
|||||||
@ -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_RESTART_BIDDINGROUND = ROUTE_BIDDINGROUNDS + "/restart";
|
||||||
static const QString ROUTE_STOP_BIDDINGROUND = ROUTE_BIDDINGROUNDS + "/stop";
|
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_SPECIFIC_ROUND = 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_HIGHEST_ROUND = apiPrefix + "biddings_of_highest_round";
|
||||||
#endif // APIROUTES_H
|
#endif // APIROUTES_H
|
||||||
|
|||||||
@ -113,7 +113,8 @@ void ServerCommunicator::setServerConfiguration(const QString url,
|
|||||||
m_password = password;
|
m_password = password;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ServerCommunicator::onSendGetRequestTriggered(const GetRequestTypes type) {
|
void ServerCommunicator::onSendGetRequestTriggered(const GetRequestTypes type,
|
||||||
|
QVariant data = QVariant()) {
|
||||||
QString path;
|
QString path;
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case GetCurrentBiddingRound:
|
case GetCurrentBiddingRound:
|
||||||
@ -128,7 +129,9 @@ void ServerCommunicator::onSendGetRequestTriggered(const GetRequestTypes type) {
|
|||||||
case StopCurrentBiddingRound:
|
case StopCurrentBiddingRound:
|
||||||
path = ROUTE_STOP_BIDDINGROUND;
|
path = ROUTE_STOP_BIDDINGROUND;
|
||||||
break;
|
break;
|
||||||
// case GetBiddingsOfSpecificRound:
|
case GetBiddingsOfSpecificRound:
|
||||||
|
path = ROUTE_GET_BIDDINGS_OF_SPECIFIC_ROUND + "/" + data.toString();
|
||||||
|
break;
|
||||||
case GetBiddingsOfHighestRound:
|
case GetBiddingsOfHighestRound:
|
||||||
path = ROUTE_GET_BIDDINGS_OF_HIGHEST_ROUND;
|
path = ROUTE_GET_BIDDINGS_OF_HIGHEST_ROUND;
|
||||||
break;
|
break;
|
||||||
@ -172,6 +175,7 @@ void ServerCommunicator::onGetReplySuccessful(const GetRequestTypes type, const
|
|||||||
case StopCurrentBiddingRound:
|
case StopCurrentBiddingRound:
|
||||||
currentBiddingRoundChangedReply(doc);
|
currentBiddingRoundChangedReply(doc);
|
||||||
break;
|
break;
|
||||||
|
case GetBiddingsOfSpecificRound:
|
||||||
case GetBiddingsOfHighestRound:
|
case GetBiddingsOfHighestRound:
|
||||||
currentBiddingsReply(doc);
|
currentBiddingsReply(doc);
|
||||||
break;
|
break;
|
||||||
|
|||||||
Reference in New Issue
Block a user