/*
 * This file contains minor utility functions
 */

#ifndef UTILS_H
#define UTILS_H

#include <QUrl>
#include <QDebug>
#include <QMessageLogContext>

bool checkInternetConnection(QUrl url);

void logMessageHandler(QtMsgType type, const QMessageLogContext &context, const QString &msg);

bool checkSingleAppInstance();

enum AppErrorStatus : int {
    E_WRONG_GAME_FOLDER = 32,
    E_DAT_FILES_MISSING = 16,
    E_WRONG_FILE_PERMISSIONS = 8,
    E_CANNOT_ACCESS_DAT_FILES = 4,
    E_DAT_FILE_INCORRECT = 2,
    E_NO_SERVER_CONNECTION = 1,
    E_NO_ERRORS = 0
};

AppErrorStatus CheckAppPrerequesities();

QDebug operator<<(QDebug dbg, const AppErrorStatus &status);

#endif // UTILS_H
