92 lines
2.4 KiB
C++
92 lines
2.4 KiB
C++
#ifndef GENERICCORE_H
|
|
#define GENERICCORE_H
|
|
|
|
#include <QObject>
|
|
#include <QVariant>
|
|
|
|
#include "model/metadata.h"
|
|
#include "structs.h"
|
|
|
|
class QUndoStack;
|
|
class QAbstractItemModel;
|
|
class QAbstractItemModelTester;
|
|
class QString;
|
|
|
|
class TableModel;
|
|
class GeneralSortFilterModel;
|
|
class ModelSummary;
|
|
class ServerCommunicator;
|
|
|
|
using namespace std;
|
|
|
|
class GenericCore : public QObject {
|
|
Q_OBJECT
|
|
|
|
public:
|
|
GenericCore();
|
|
~GenericCore();
|
|
|
|
QString toString() const;
|
|
void sayHello() const;
|
|
|
|
bool isApplicationUpdateAvailable();
|
|
void triggerApplicationUpdate(const bool saveChanges);
|
|
|
|
QUndoStack* getModelUndoStack() const;
|
|
|
|
shared_ptr<TableModel> getModel() const;
|
|
shared_ptr<GeneralSortFilterModel> getSortFilterModel() const;
|
|
shared_ptr<ModelSummary> getModelSummary() const;
|
|
|
|
void saveItems();
|
|
void importCSVFile(const QString& filePath);
|
|
bool exportCSVFile(const QString& filePath);
|
|
|
|
QVariantMap getSettings(QString group = "") const;
|
|
void applySettings(QVariantMap settingMap, QString group = "");
|
|
bool isSyncServerSetup() const;
|
|
|
|
public slots:
|
|
void onBiddingsChanged(int round, QList<bidding> biddings);
|
|
|
|
void onCreateOnlineAccountTriggered(const QString& mailAddress);
|
|
void onOnlineUserAccountReceived(const QString mailAddress,
|
|
const QString uuid,
|
|
const QString accessToken);
|
|
|
|
signals:
|
|
void displayStatusMessage(QString message);
|
|
|
|
/// *** server communication ***
|
|
/// request signals
|
|
void sendGetRequest(GetRequestTypes type, QVariant data = QVariant());
|
|
void sendPostRequest(PostRequestTypes type, QByteArray data);
|
|
/// response signals
|
|
void currentBiddingRoundChanged(int round, bool isRunning);
|
|
|
|
/// deprecated signals
|
|
void fetchItemsFromServer();
|
|
void postItemToServer(const QByteArray& jsonData);
|
|
void deleteItemFromServer(const QString& id);
|
|
|
|
private:
|
|
QUndoStack* m_modelUndoStack;
|
|
shared_ptr<TableModel> m_mainModel;
|
|
shared_ptr<GeneralSortFilterModel> m_sortFilterModel;
|
|
shared_ptr<ModelSummary> m_modelSummary;
|
|
unique_ptr<QAbstractItemModelTester> m_mainModelTester;
|
|
unique_ptr<QAbstractItemModelTester> m_proxyModelTester;
|
|
|
|
void setupModels();
|
|
void initModelData();
|
|
|
|
QString getMaintenanceToolFilePath() const;
|
|
|
|
/// Network communication
|
|
unique_ptr<ServerCommunicator> m_serverCommunicator;
|
|
void setupServerConfiguration();
|
|
void applyServerConfiguration();
|
|
};
|
|
|
|
#endif // GENERICCORE_H
|