/*
 * SmartHome server: Base of the system
 *
 * Copyright (C) 2010 Daniel Pisi <dan.pisi@gmail.com>
 *
 * This program is free software; you can redistribute it and/or modify it
 * under the terms of version 2 of the GNU General Public License
 * as published by the Free Software Foundation.
 *
 */

/**
 * @file main.cpp
 * @brief Main of SmartHome server
 * @author Daniel Pisi
 */

#include <QtCore/QCoreApplication>
#include <QtSql>
#include "shbase.h"

// -----------------------------------------------------------------------------

/**
 * \brief Initialization, establishing a database connection and starting the modular subsystem
 * \param argc Number of arguments
 * \param argv Pointer to the list of arguments
 * \return Error code, 0 for regular application termination
 */
int main(int argc, char *argv[])
{
    QCoreApplication app(argc, argv);

    QSqlDatabase db = QSqlDatabase::addDatabase("QMYSQL");
    db.setHostName("localhost");
    db.setDatabaseName("mythconverg");
    db.setUserName("mythtv");
    db.setPassword("mythtv");

    if (!db.open())
    {
        qFatal(app.tr("Unable to establish a database connection.").toLatin1());
        return 1;
    }

    qDebug("Creating ShBase");
    ShBase *shBase;
    shBase = new ShBase;

    return app.exec();
}
// -----------------------------------------------------------------------------
