#ifndef APPLICATION_H
#define APPLICATION_H

#include <QObject>
#include <QString>
#include <QMutex>
#include <QMutexLocker>
#include <QSqlRecord>

#include "ApplicationConfigurator.h"
#include "DatabaseConnector.h"


class Application : public QObject
{
    Q_OBJECT

public:
    static Application* instance();

private:
    Application();
    ~Application();

    static Application* m_instance;

public:
    void init();

    ApplicationConfigurator *getConfigurator() const { return configurator; };
    DatabaseConnector *getDatabaseConnector() const { return dbConnector; };

	void showLoading(const QString &msg);
	void hideLoading();

	int showModalDialog(QWidget *contentWidget, QWidget *parent);

signals:
	void message(const QString &msg, bool err);
	void loading(bool show, const QString &msg = "");

private:    
    void uninit();
	void sendMessage(const QString &msg, bool err = false);

    bool inited;
    ApplicationConfigurator* configurator;
    DatabaseConnector* dbConnector;    
};

#endif // APPLICATION_H
