/*
 * Copyright 2013 Canonical Ltd.
 *
 * This file is part of ubuntu-html5-ui-toolkit.
 *
 * ubuntu-html5-ui-toolkit 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; version 3.
 *
 * ubuntu-html5-ui-toolkit 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 this program.  If not, see <http://www.gnu.org/licenses/>.
 */

#ifndef __CONFIG_H__
#define __CONFIG_H__

#include <QtCore/QCoreApplication>
#include <QtCore/QDir>
#include <QtCore/QString>

#define REMOTE_INSPECTOR_PORT 9221

namespace Webapp {

namespace Config {

bool isRunningInstalled()
{
    static bool installed = (QCoreApplication::applicationDirPath() == QDir("@CMAKE_INSTALL_FULL_BINDIR@").canonicalPath());
    return installed;
}

QString getContainerMainQmlPath()
{
    static QString mainQml =
      isRunningInstalled()
      ? QString("@CMAKE_INSTALL_FULL_DATADIR@/ubuntu-html5-app-launcher/qml")
      : QString("@CMAKE_SOURCE_DIR@/src/ubuntu-html5-app-launcher");
    return mainQml;
}

QString getContainerImportPath()
{
    static QString mainQml =
      ! isRunningInstalled()
      ? QString("@CMAKE_SOURCE_DIR@/src/plugin")
      : QString();
    return mainQml;
}

} // namespace Config

} // namespace Webapp

#endif // __CONFIG_H__

