#ifndef GENERICCORE_H #define GENERICCORE_H #include #include #include "model/metadata.h" #include "structs.h" class QUndoStack; class QAbstractItemModel; class QAbstractItemModelTester; class QString; class TableModel; class GeneralSortFilterModel; class ServerCommunicator; 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; std::shared_ptr getModel() const; std::shared_ptr getSortFilterModel() 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 biddings); signals: void displayStatusMessage(QString message); /// *** server communication *** /// request signals void sendGetRequest(GetRequestTypes type, QVariant data = QVariant()); /// 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; std::shared_ptr m_mainModel; std::shared_ptr m_sortFilterModel; std::unique_ptr m_mainModelTester; std::unique_ptr m_proxyModelTester; void setupModels(); void initModelData(); QString getMaintenanceToolFilePath() const; /// Network communication std::unique_ptr m_serverCommunicator; void setupServerConfiguration(); void applyServerConfiguration(); }; #endif // GENERICCORE_H