src/bmsapp.h

Fri, 11 Feb 2022 12:02:09 +0100

author
Michiel Broek <mbroek@mbse.eu>
date
Fri, 11 Feb 2022 12:02:09 +0100
changeset 3
4b95e33ee476
parent 2
a1e435907f3a
child 6
f8474f2c5db9
permissions
-rw-r--r--

We have a mainscreen!

#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 "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();

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();

    /**
     * @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