src/bmsapp.h

Mon, 07 Mar 2022 17:33:22 +0100

author
Michiel Broek <mbroek@mbse.eu>
date
Mon, 07 Mar 2022 17:33:22 +0100
changeset 49
29cf6e350063
parent 42
88e827ea7172
child 52
ff7b3a41c9b5
permissions
-rw-r--r--

Added Mash profiles table and the first part of the Mash profile editor. Edit and write must be written.

#ifndef	_BMSAPP_H
#define	_BMSAPP_H

#include <QApplication>
#include <QDateTime>
#include <QDebug>
#include <QDir>
// #include <QDomDocument>
#include <QFile>
#include <QList>
#include <QMenu>
#include <QMetaProperty>
#include <QObject>
#include <QSettings>
#include <QString>
#include <QTextStream>
#include <QTranslator>
#include <QtSql>
#include <QUuid>
#include <QStyle>
#include <QPlainTextEdit>
#include <QMessageBox>
#include <QLabel>
#include <QImage>
#include <QImageReader>
#include <QImageWriter>
#include <QColorSpace>
#include <QGraphicsView>
#include <QFileDialog>
#include <QXmlStreamReader>
#include <QXmlStreamWriter>

#include <QJsonArray>
#include <QJsonDocument>
#include <QJsonObject>

#include "Utils.h"
#include "database/database.h"


typedef struct IniMySQL
{
    QString host;               ///< MySQL host
    QString port;               ///< MySQL port
    QString name;               ///< MySQL database
    QString user;		///< MySQL username
    QString pass;               ///< MySQL password
    QString charset;		///< MySQL character encoding
} IniMySQL;

static IniMySQL dbProd;
static IniMySQL dbDev;


class MainWindow;


class Bmsapp : public QObject
{
    Q_OBJECT

    friend class MainWindow;

public:
    Bmsapp();

    static QDir getResourceDir();	/* System wide resources */

    /**
     * @brief Blocking call that executes the application.
     * @return Exit code from the application.
     */
    static int run(bool useDevelop, bool startConfig);

private:
    static MainWindow* m_mainWindow;

    /**
     * @brief Ensure some directories and files exist.
     * @return true if all is ok.
     */
    static bool ensureDirectoriesExist();

    /**
     * @brief Run before showing MainWindow, does all system setup.
     * @return false if anything goes awry, true if it's ok to start MainWindow.
     */
    static bool initialize(bool useDevelop);

    /**
     * @brief Run after QApplication exits to clean up shit, close database, etc.
     */
    static void cleanup();

    /**
     * @brief Read user settings for the MySQL connection.
     */
    static void readsettings();

    /**
     * @brief Write or update the user settings for the MySQL connection.
     */
    static void writesettings();
};


#endif

mercurial