An item (with hard coded values) can be send to the server. Added signals for fetching and posting items to be triggered from the UI.
This commit is contained in:
@ -142,6 +142,11 @@ bool GenericCore::isSyncServerSetup() const {
|
||||
}
|
||||
}
|
||||
|
||||
void GenericCore::onSendItemTriggered(const int row) {
|
||||
// NEXT gather item values from model to send to server
|
||||
m_serverCommunicator->postItems();
|
||||
}
|
||||
|
||||
void GenericCore::onItemsFetched(const QByteArray jsonDoc) {
|
||||
emit displayStatusMessage("New items fetched.");
|
||||
// TODO ? check compability of JSON structure beforehand?
|
||||
@ -219,7 +224,12 @@ QString GenericCore::getMaintenanceToolFilePath() const {
|
||||
|
||||
void GenericCore::setupServerConfiguration() {
|
||||
m_serverCommunicator = make_unique<ServerCommunicator>(this);
|
||||
/// request connections
|
||||
connect(this, &GenericCore::fetchItemsFromServer, m_serverCommunicator.get(),
|
||||
&ServerCommunicator::fetchItems);
|
||||
connect(this, &GenericCore::sendItemToServer, this, &GenericCore::onSendItemTriggered);
|
||||
|
||||
/// response connections
|
||||
connect(m_serverCommunicator.get(), &ServerCommunicator::itemsFetched, this,
|
||||
&GenericCore::onItemsFetched);
|
||||
connect(m_serverCommunicator.get(), &ServerCommunicator::itemsFetchFailure, this,
|
||||
@ -229,6 +239,7 @@ void GenericCore::setupServerConfiguration() {
|
||||
connect(m_serverCommunicator.get(), &ServerCommunicator::postRequestFailure, this,
|
||||
&GenericCore::onPostRequestFailure);
|
||||
|
||||
/// fetching items on startup to test the communication with the server
|
||||
m_serverCommunicator->fetchItems();
|
||||
/// fetching/posting items on startup to test the communication with the server
|
||||
// m_serverCommunicator->fetchItems();
|
||||
// m_serverCommunicator->postItems();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user