/*
    This file is part of Gabriel's Qt/QML CardBoard Sample (or short GQQCS)

    GQQCS is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    GQQCS is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with Foobar.  If not, see <http://www.gnu.org/licenses/>.

    Updated: 07/08/2015 by: Gabriel F.
*/

#include "generalqmlengine.h"

GeneralQMLEngine::GeneralQMLEngine(QQuickItem *parent) : QQmlApplicationEngine(parent)
{

}

void GeneralQMLEngine::customLoadQML(const QUrl &url)
{
    this->load(url);
}

void GeneralQMLEngine::applicationStateChanged(Qt::ApplicationState state)
{
    QObject *rootObject = this->rootObjects().first();
    QString response;
    switch (state) {
    case Qt::ApplicationSuspended: {
        response = "Suspended";
        break;
    }
    case Qt::ApplicationHidden: {
        response = "Hidden";
        break;
    }
    case Qt::ApplicationInactive: {
        response = "Inactive";
        break;
    }
    case Qt::ApplicationActive: {
        response = "Active";
        break;
    }
    default:{
        response = "Unknown";
        break;
    }
    }
    rootObject->setProperty("appState",response);
}

