We had a chicken-egg problem here where functions in the iApp interface depended on the iEnv interface and vice versa. The easiest
solution was to merge them into one.
#include <Common/Globals>
#include <Common/iLogger>
#include <Common/iRegistry>
-#include <Common/iEnv>
+#include <Common/iApp>
#include <QtCore>
#include <QtSql/QtSql>
if (!QSqlDatabase::contains(DbConnectionName)) {
// No database connection yet
mDb = QSqlDatabase::addDatabase("QSQLITE", DbConnectionName);
- mDb.setDatabaseName(Common::iEnv::instance()->dataRootDir() + DbName);
+ mDb.setDatabaseName(Common::iApp::instance()->dataRootDir() + DbName);
if (!mDb.open()) {
QSqlError err = mDb.lastError();
EVAF_ERROR("Failed to open database : %s", qPrintable(err.text()));
# Source files
set(SRCS
app.cpp
- env.cpp
event.cpp
eventqueue.cpp
globals.cpp
# Header files for the meta-object compiler
set(MOC_HDRS
iapp.h
- ienv.h
ieventqueue.h
ilogger.h
iregistry.h
app.h
- env.h
eventqueue.h
logger.h
registry.h
#include "app.h"
#include "globals.h"
#include "registry.h"
-#include "ienv.h"
#include "version.h"
#include <QtCore>
// Clear the XML file name
mXmlFile.clear();
+ // Set initial bin and root directories
+ mRootDir = mBinDir = qApp->applicationDirPath();
+ int t = mBinDir.lastIndexOf(QChar('/'), -1);
+ if (t >= 0)
+ mRootDir = mBinDir.left(t);
+
+ if (!mBinDir.endsWith('/'))
+ mBinDir.append('/');
+ if (!mRootDir.endsWith('/'))
+ mRootDir.append('/');
+
+ // Clear other directories
+ mDataRootDir.clear();
+ mQtPluginsDir.clear();
+ mEtcDir.clear();
+ mLogDir.clear();
+ mDocDir.clear();
+
// Process environment variables
QStringList env = QProcess::systemEnvironment();
for (int i = 0; i < env.size(); ++i) {
mName = value;
else if (name == "EVAF_LANGUAGE")
mLanguage = value;
+ else if (name == "EVAF_ROOT_DIR") {
+ mRootDir = value;
+ if (!mRootDir.endsWith('/'))
+ mRootDir.append('/');
+ }
+ else if (name == "EVAF_DATA_ROOT_DIR") {
+ mDataRootDir = value;
+ if (!mDataRootDir.endsWith('/'))
+ mDataRootDir.append('/');
+ }
+ else if (name == "EVAF_ETC_DIR") {
+ mEtcDir = value;
+ if (!mEtcDir.endsWith('/'))
+ mEtcDir.append('/');
+ }
+ else if (name == "EVAF_LOG_DIR") {
+ mLogDir = value;
+ if (!mLogDir.endsWith('/'))
+ mLogDir.append('/');
+ }
+ else if (name == "EVAF_DOC_DIR") {
+ mDocDir = value;
+ if (!mDocDir.endsWith('/'))
+ mDocDir.append('/');
+ }
+ else if (name == "EVAF_QT_PLUGINS_DIR") {
+ mQtPluginsDir = value;
+ if (!mQtPluginsDir.endsWith('/'))
+ mQtPluginsDir.append('/');
+ }
}
// Then process command-line arguments
mName = arg.at(1);
else if (QRegExp("-[-]?lang(uage)?").exactMatch(arg.at(0)) && arg.size() > 1)
mLanguage = arg.at(1);
+ else if (QRegExp("-[-]?root(dir)?").exactMatch(arg.at(0)) && arg.size() > 1) {
+ mRootDir = arg.at(1);
+ if (!mRootDir.endsWith('/'))
+ mRootDir.append('/');
+ }
+ else if (QRegExp("-[-]?dataroot(dir)?").exactMatch(arg.at(0)) && arg.size() > 1) {
+ mDataRootDir = arg.at(1);
+ if (!mDataRootDir.endsWith('/'))
+ mDataRootDir.append('/');
+ }
+ else if (QRegExp("-[-]?etc(dir)?").exactMatch(arg.at(0)) && arg.size() > 1) {
+ mEtcDir = arg.at(1);
+ if (!mEtcDir.endsWith('/'))
+ mEtcDir.append('/');
+ }
+ else if (QRegExp("-[-]?log(dir)?").exactMatch(arg.at(0)) && arg.size() > 1) {
+ mLogDir = arg.at(1);
+ if (!mLogDir.endsWith('/'))
+ mLogDir.append('/');
+ }
+ else if (QRegExp("-[-]?doc(dir)?").exactMatch(arg.at(0)) && arg.size() > 1) {
+ mDocDir = arg.at(1);
+ if (!mDocDir.endsWith('/'))
+ mDocDir.append('/');
+ }
+ else if (QRegExp("-[-]?qtplugins(dir)?").exactMatch(arg.at(0)) && arg.size() > 1) {
+ mQtPluginsDir = arg.at(1);
+ if (!mQtPluginsDir.endsWith('/'))
+ mQtPluginsDir.append('/');
+ }
}
return true;
}
+QString const App::dataRootDir() const
+{
+ if (mDataRootDir.isEmpty()) {
+#ifdef Q_OS_LINUX
+ QString dataLoc = QDir::homePath();
+ if (!dataLoc.endsWith('/'))
+ dataLoc.append('/');
+ dataLoc.append(".local/share/data/");
+ mDataRootDir = dataLoc + name();
+ if (!mDataRootDir.endsWith('/'))
+ mDataRootDir.append('/');
+#endif
+ /// @TODO: Needs local data directory on Windows
+ mDataRootDir = rootDir();
+ }
+
+ return mDataRootDir;
+}
+
+QString const App::etcDir() const
+{
+ if (mEtcDir.isEmpty())
+ mEtcDir = dataRootDir() + "etc/";
+ return mEtcDir;
+}
+
+QString const App::logDir() const
+{
+ if (mLogDir.isEmpty())
+ mLogDir = dataRootDir() + "log/";
+ return mLogDir;
+}
+
+QString const App::docDir() const
+{
+ if (mDocDir.isEmpty())
+ mDocDir = rootDir() + "doc/";
+ return mDocDir;
+}
+
+QString const App::qtPluginsDir() const
+{
+ if (mQtPluginsDir.isEmpty())
+ mQtPluginsDir = binDir();
+ return mQtPluginsDir;
+}
+
QString const App::xmlFileName() const
{
if (mXmlFile.isEmpty()) {
// Try the full application name + country + language combination
QString name = mName + "_" + mLanguage + ".xml";
- fi.setFile(iEnv::instance()->etcDir() + name);
+ fi.setFile(etcDir() + name);
if (fi.isReadable())
mXmlFile = name;
else {
// Try application name + country
name = mName + "_" + mLanguage.left(2) + ".xml";
- fi.setFile(iEnv::instance()->etcDir() + name);
+ fi.setFile(etcDir() + name);
if (fi.isReadable())
mXmlFile = name;
else
virtual bool isReady() const { return mReady; }
+ virtual QString const rootDir() const { return mRootDir; }
+
+ virtual QString const dataRootDir() const;
+
+ virtual QString const binDir() const { return mBinDir; }
+
+ virtual QString const etcDir() const;
+
+ virtual QString const logDir() const;
+
+ virtual QString const docDir() const;
+
+ virtual QString const qtPluginsDir() const;
+
private:
/// Name of the application's XML file
mutable QString mXmlFile;
+ /// Name of the root directry
+ QString mRootDir;
+
+ /// Name of the data root directory
+ mutable QString mDataRootDir;
+
+ /// Name of the binary directory
+ QString mBinDir;
+
+ /// Name of the Qt plugins directory
+ mutable QString mQtPluginsDir;
+
+ /// Name of the configuration files directory
+ mutable QString mEtcDir;
+
+ /// Name of the log files directory
+ mutable QString mLogDir;
+
+ /// Name of the documentation directory
+ mutable QString mDocDir;
+
};
} // namespace eVaf::Common::Internal
+++ /dev/null
-/**
- * @file Common/env.cpp
- * @brief iEnv interface implementation
- * @author Enar Vaikene
- *
- * Copyright (c) 2011 Enar Vaikene
- *
- * This file is part of the eVaf C++ cross-platform application development framework.
- *
- * This file can be used under the terms of the GNU General Public License
- * version 3.0 as published by the Free Software Foundation and appearing in
- * the file LICENSE included in the packaging of this file. Please review the
- * the following information to ensure the GNU General Public License version
- * 3.0 requirements will be met: http://www.gnu.org/copyleft/gpl.html.
- *
- * Alternatively, this file may be used in accordance with the Commercial License
- * Agreement provided with the Software.
- */
-
-#include "env.h"
-#include "iregistry.h"
-#include "globals.h"
-#include "version.h"
-#include "iapp.h"
-
-#include <QtCore>
-
-
-//-------------------------------------------------------------------
-
-using namespace eVaf::Common;
-
-iEnv * iEnv::instance()
-{
- static eVaf::Common::Internal::Env singleton;
- return &singleton;
-}
-
-
-//-------------------------------------------------------------------
-
-using namespace eVaf::Common::Internal;
-
-Env::Env()
- : iEnv()
-{
- setObjectName(QString("%1-iEnv").arg(VER_MODULE_NAME_STR));
-}
-
-Env::~Env()
-{
-}
-
-bool Env::init()
-{
- // Register out interface
- iRegistry::instance()->registerInterface("iEnv", this);
-
- // Set initial bin and root directories
- mRootDir = mBinDir = qApp->applicationDirPath();
- int t = mBinDir.lastIndexOf(QChar('/'), -1);
- if (t >= 0)
- mRootDir = mBinDir.left(t);
-
- if (!mBinDir.endsWith('/'))
- mBinDir.append('/');
- if (!mRootDir.endsWith('/'))
- mRootDir.append('/');
-
- // Clear other directories
- mDataRootDir.clear();
- mQtPluginsDir.clear();
- mEtcDir.clear();
- mLogDir.clear();
- mDocDir.clear();
-
- // Set the data root directory
-#ifdef Q_OS_LINUX
- QString dataLoc = QDir::homePath();
- if (!dataLoc.endsWith('/'))
- dataLoc.append('/');
- dataLoc.append(".local/share/data/");
- mDataRootDir = dataLoc + iApp::instance()->name();
- if (!mDataRootDir.endsWith('/'))
- mDataRootDir.append('/');
-#endif
- /// @TODO: Needs local data directory on Windows
-
- // Process the environment
- QStringList env = QProcessEnvironment::systemEnvironment().toStringList();
- int sz = env.size();
- for (int i = 0; i < sz; ++i) {
- // Get the name/value pair
- QString name = env.at(i).section('=', 0, 0).trimmed();
- QString value = env.at(i).section('=', 1).trimmed();
-
- if (name == "EVAF_ROOT_DIR") {
- mRootDir = value;
- if (!mRootDir.endsWith('/'))
- mRootDir.append('/');
- }
- else if (name == "EVAF_DATA_ROOT_DIR") {
- mDataRootDir = value;
- if (!mDataRootDir.endsWith('/'))
- mDataRootDir.append('/');
- }
- else if (name == "EVAF_ETC_DIR") {
- mEtcDir = value;
- if (!mEtcDir.endsWith('/'))
- mEtcDir.append('/');
- }
- else if (name == "EVAF_LOG_DIR") {
- mLogDir = value;
- if (!mLogDir.endsWith('/'))
- mLogDir.append('/');
- }
- else if (name == "EVAF_DOC_DIR") {
- mDocDir = value;
- if (!mDocDir.endsWith('/'))
- mDocDir.append('/');
- }
- else if (name == "EVAF_QT_PLUGINS_DIR") {
- mQtPluginsDir = value;
- if (!mQtPluginsDir.endsWith('/'))
- mQtPluginsDir.append('/');
- }
- }
-
- // Then process comman-line arguments
- env = QCoreApplication::arguments();
- sz = env.size();
- for (int i = 0; i < sz; ++i) {
- // Get the name and optional value
- QStringList arg = env.at(i).simplified().split(QChar('='));
-
- if (QRegExp("-[-]?root(dir)?").exactMatch(arg.at(0)) && arg.size() > 1) {
- mRootDir = arg.at(1);
- if (!mRootDir.endsWith('/'))
- mRootDir.append('/');
- }
- else if (QRegExp("-[-]?dataroot(dir)?").exactMatch(arg.at(0)) && arg.size() > 1) {
- mDataRootDir = arg.at(1);
- if (!mDataRootDir.endsWith('/'))
- mDataRootDir.append('/');
- }
- else if (QRegExp("-[-]?etc(dir)?").exactMatch(arg.at(0)) && arg.size() > 1) {
- mEtcDir = arg.at(1);
- if (!mEtcDir.endsWith('/'))
- mEtcDir.append('/');
- }
- else if (QRegExp("-[-]?log(dir)?").exactMatch(arg.at(0)) && arg.size() > 1) {
- mLogDir = arg.at(1);
- if (!mLogDir.endsWith('/'))
- mLogDir.append('/');
- }
- else if (QRegExp("-[-]?doc(dir)?").exactMatch(arg.at(0)) && arg.size() > 1) {
- mDocDir = arg.at(1);
- if (!mDocDir.endsWith('/'))
- mDocDir.append('/');
- }
- else if (QRegExp("-[-]?qtplugins(dir)?").exactMatch(arg.at(0)) && arg.size() > 1) {
- mQtPluginsDir = arg.at(1);
- if (!mQtPluginsDir.endsWith('/'))
- mQtPluginsDir.append('/');
- }
- }
-
- return true;
-}
-
-QString const Env::dataRootDir() const
-{
- // Fall-back to the application's root directory if the data root directory is empty
- if (mDataRootDir.isEmpty())
- mDataRootDir = rootDir();
- return mDataRootDir;
-}
-
-QString const Env::etcDir() const
-{
- if (mEtcDir.isEmpty())
- mEtcDir = dataRootDir() + "etc/";
- return mEtcDir;
-}
-
-QString const Env::logDir() const
-{
- if (mLogDir.isEmpty())
- mLogDir = dataRootDir() + "log/";
- return mLogDir;
-}
-
-QString const Env::docDir() const
-{
- if (mDocDir.isEmpty())
- mDocDir = rootDir() + "doc/";
- return mDocDir;
-}
-
-QString const Env::qtPluginsDir() const
-{
- if (mQtPluginsDir.isEmpty())
- mQtPluginsDir = binDir();
- return mQtPluginsDir;
-}
+++ /dev/null
-/**
- * @file Common/env.h
- * @brief iEnv interface implementation
- * @author Enar Vaikene
- *
- * Copyright (c) 2011 Enar Vaikene
- *
- * This file is part of the eVaf C++ cross-platform application development framework.
- *
- * This file can be used under the terms of the GNU General Public License
- * version 3.0 as published by the Free Software Foundation and appearing in
- * the file LICENSE included in the packaging of this file. Please review the
- * the following information to ensure the GNU General Public License version
- * 3.0 requirements will be met: http://www.gnu.org/copyleft/gpl.html.
- *
- * Alternatively, this file may be used in accordance with the Commercial License
- * Agreement provided with the Software.
- */
-
-#ifndef __COMMON_ENV_H
-#define __COMMON_ENV_H
-
-#include "ienv.h"
-
-#include <QObject>
-#include <QString>
-
-namespace eVaf {
-namespace Common {
-namespace Internal {
-
-/**
- * iEnv interface implementation
- */
-class Env : public iEnv
-{
- Q_OBJECT
-
-public:
-
- Env();
-
- virtual ~Env();
-
- /**
- * Initializes the iEnv interface implementation
- * @return True if ok; false if the initialization fails
- */
- bool init();
-
- /*
- iEnv interface
- */
-
- virtual QString const rootDir() const { return mRootDir; }
-
- virtual QString const dataRootDir() const;
-
- virtual QString const binDir() const { return mBinDir; }
-
- virtual QString const etcDir() const;
-
- virtual QString const logDir() const;
-
- virtual QString const docDir() const;
-
- virtual QString const qtPluginsDir() const;
-
-
-private: // Members
-
- QString mRootDir;
- mutable QString mDataRootDir;
- QString mBinDir;
- mutable QString mQtPluginsDir;
- mutable QString mEtcDir;
- mutable QString mLogDir;
- mutable QString mDocDir;
-
-};
-
-} // namespace eVaf::Common::Internal
-} // namespace eVaf::Common
-} // namespace eVaf
-
-#endif // env.h
*/
#include "globals.h"
-#include "env.h"
#include "app.h"
#include "logger.h"
#include "version.h"
// Initialize all the common interface implementations in the proper sequence
- eVaf::Common::Internal::Env * env =
- qobject_cast<eVaf::Common::Internal::Env *>(eVaf::Common::iEnv::instance());
- if (env) {
- if (!env->init())
+ eVaf::Common::Internal::App * app =
+ qobject_cast<eVaf::Common::Internal::App *>(eVaf::Common::iApp::instance());
+ if (app) {
+ if (!app->init())
return false;
}
eVaf::Common::Internal::Logger * logger =
if (!logger->init())
return false;
}
- eVaf::Common::Internal::App * app =
- qobject_cast<eVaf::Common::Internal::App *>(eVaf::Common::iApp::instance());
- if (app) {
- if (!app->init())
- return false;
- }
EVAF_INFO("%s-Globals initialized", VER_MODULE_NAME_STR);
+++ /dev/null
-#include "ienv.h"
* eVaf application interface
* @code#include <Common/iApp>@endcode
*
- * The iApp interface provides information about current eVaf application.
+ * The iApp interface provides information about current eVaf application. Functions in this interface return
+ * the name of the application, names of directories where different recources are located etc. Modules should
+ * always use the iApp interface for directory names and locations.
+ *
+ * For example, all the configuration files should be located in the eVaf::Common::iApp::instance()->etcDir() directory.
+ *
+ * Directory names returned by functions in this interface are UNIX path names and they are quaranteed to
+ * end with the '/' character.
*
* All the resources returned by this interface have default values, that should work in most of the cases.
+ * Fox example, the binary directory is set to the same directory where the application's main executable is found.
+ * The root directory is the parent of the binary directory etc.
*
* Default values can be overwritten with environment variables and command line arguments. If both are used,
* then command line arguments have higher priorities.
*/
virtual bool isReady() const = 0;
+ /**
+ * Returns the name of the eVaf root directory
+ *
+ * The root directory is the base directory where the eVaf application is installed. The default root
+ * directory is the parent of the binary directory.
+ *
+ * Write access to the root directory is not required to run the application.
+ *
+ * This directory can be changed with the EVAF_ROOT_DIR environment variable or with the -root[dir]=<directory>
+ * command line argument.
+ */
+ virtual QString const rootDir() const = 0;
+
+ /**
+ * Returns the name of the eVaf data directory.
+ *
+ * The data root directory is the base directory for all the directories that require write access.
+ *
+ * The default data directory on Windows is \%APPDATA\%/\%EVAF_APP_NAME\%. The default data directory
+ * on Linux is ${HOME}/.${EVAF_APP_NAME}.
+ *
+ * This directory can be changed with the EVAF_DATA_ROOT_DIR environment variable or with the
+ * -dataroot[dir]=<directory> command line argument.
+ */
+ virtual QString const dataRootDir() const = 0;
+
+ /**
+ * Returns the name of the binary files directory.
+ *
+ * The binary directory is the directory where all the application's binary files (main executable and
+ * modules) are located. The default binary directory is where the main executable is located.
+ *
+ * NB! Changing the application's root directory does not change the location of the binary directory.
+ */
+ virtual QString const binDir() const = 0;
+
+ /**
+ * Returns the configuration files directory.
+ *
+ * This is the directory where all the application's configuration files are located. The default
+ * configuration files directory is 'etc' in the data root directory.
+ *
+ * This directory can be changed with the EVAF_ETC_DIR environment variable or with the -etc[dir]=<directory>
+ * command line argument.
+ */
+ virtual QString const etcDir() const = 0;
+
+ /**
+ * Returns the log files directory.
+ *
+ * This is the directory where the application outputs all the log files. The default log files
+ * directory is 'log' in the data root directory.
+ *
+ * This directory can be changed with the EVAF_LOG_DIR environment variable or with the
+ * -log[dir]=<directory> command line argument.
+ */
+ virtual QString const logDir() const = 0;
+
+ /**
+ * Returns the documentation directory.
+ *
+ * This is the directory where all the documentation and help files are located. The default
+ * documentation directory is 'doc' in the root directory.
+ *
+ * This directory can be changed with the EVAF_DOC_DIR environment variable or with the
+ * -doc[dir]=<directory> command line argument.
+ */
+ virtual QString const docDir() const = 0;
+
+ /**
+ * Returns the Qt plugins directory.
+ *
+ * The Qt plugins directory is where additional Qt plugins are located. These Qt plugins
+ * are loaded manually by the application and specified in the application's XML file.
+ *
+ * Changing this directory does not affect the way how Qt itself loads its plugins.
+ *
+ * This directory can be changed with the EVAF_QT_PLUGINS_DIR environment variable or with the
+ * -qtplugins[dir]=<directory> command line argument.
+ */
+ virtual QString const qtPluginsDir() const = 0;
+
signals:
+++ /dev/null
-/**
- * @file Common/ienv.h
- * @brief Environment interface
- * @author Enar Vaikene
- *
- * Copyright (c) 2011 Enar Vaikene
- *
- * This file is part of the eVaf C++ cross-platform application development framework.
- *
- * This file can be used under the terms of the GNU General Public License
- * version 3.0 as published by the Free Software Foundation and appearing in
- * the file LICENSE included in the packaging of this file. Please review the
- * the following information to ensure the GNU General Public License version
- * 3.0 requirements will be met: http://www.gnu.org/copyleft/gpl.html.
- *
- * Alternatively, this file may be used in accordance with the Commercial License
- * Agreement provided with the Software.
- */
-
-#ifndef __COMMON_IENV_H
-#define __COMMON_IENV_H
-
-#include "libcommon.h"
-
-#include <QObject>
-#include <QString>
-
-namespace eVaf {
-namespace Common {
-
-/**
- * Environment interface for eVaf applications
- * @code#include <Common/iEnv>@endcode
- *
- * The iEnv interface provides information about the environment where the application is running.
- * Functions in this interface return names of directories where different resources are located.
- * Modules should always use the iEnv interface for directory names and locations.
- *
- * Directory names returned by functions in this interface are UNIX path names and they are quaranteed
- * to end with the '/' character.
- *
- * All the directories have reasonable default values, that should work in most of the cases. For example,
- * the binary directory is set to the same directory where the application's main executable is located.
- * The root directory is the parent of the binary directory etc.
- *
- * Default values can be overwritten with environment variables and command line arguments. If both are used,
- * then command line arguments have higher priorities.
- */
-class COMMON_EXPORT iEnv : public QObject
-{
- Q_OBJECT
-
-public:
-
- /// Interface constructor
- iEnv() : QObject() {}
-
- /// Empty virtual destructor
- virtual ~iEnv() {}
-
- /**
- * Returns the iEnv interface instance
- * @return The iEnv interface
- *
- * This function returns the global iEnv interface instance. As all the eVaf modules and applications
- * are expected to be linked against the common library, then this is the preferred method of obtaining
- * the iEnv interface. The other method is by using the iRegistry interface.
- */
- static iEnv * instance();
-
- /**
- * Returns the name of the eVaf root directory
- *
- * The root directory is the base directory where the eVaf application is installed. The default root
- * directory is the parent of the binary directory.
- *
- * Write access to the root directory is not required to run the application.
- *
- * This directory can be changed with the EVAF_ROOT_DIR environment variable or with the -root[dir]=<directory>
- * command line argument.
- */
- virtual QString const rootDir() const = 0;
-
- /**
- * Returns the name of the eVaf data directory.
- *
- * The data root directory is the base directory for all the directories that require write access.
- *
- * The default data directory on Windows is \%APPDATA\%/\%EVAF_APP_NAME\%. The default data directory
- * on Linux is ${HOME}/.${EVAF_APP_NAME}.
- *
- * This directory can be changed with the EVAF_DATA_ROOT_DIR environment variable or with the
- * -dataroot[dir]=<directory> command line argument.
- */
- virtual QString const dataRootDir() const = 0;
-
- /**
- * Returns the name of the binary files directory.
- *
- * The binary directory is the directory where all the application's binary files (main executable and
- * modules) are located. The default binary directory is where the main executable is located.
- *
- * NB! Changing the application's root directory does not change the location of the binary directory.
- */
- virtual QString const binDir() const = 0;
-
- /**
- * Returns the configuration files directory.
- *
- * This is the directory where all the application's configuration files are located. The default
- * configuration files directory is 'etc' in the data root directory.
- *
- * This directory can be changed with the EVAF_ETC_DIR environment variable or with the -etc[dir]=<directory>
- * command line argument.
- */
- virtual QString const etcDir() const = 0;
-
- /**
- * Returns the log files directory.
- *
- * This is the directory where the application outputs all the log files. The default log files
- * directory is 'log' in the data root directory.
- *
- * This directory can be changed with the EVAF_LOG_DIR environment variable or with the
- * -log[dir]=<directory> command line argument.
- */
- virtual QString const logDir() const = 0;
-
- /**
- * Returns the documentation directory.
- *
- * This is the directory where all the documentation and help files are located. The default
- * documentation directory is 'doc' in the root directory.
- *
- * This directory can be changed with the EVAF_DOC_DIR environment variable or with the
- * -doc[dir]=<directory> command line argument.
- */
- virtual QString const docDir() const = 0;
-
- /**
- * Returns the Qt plugins directory.
- *
- * The Qt plugins directory is where additional Qt plugins are located. These Qt plugins
- * are loaded manually by the application and specified in the application's XML file.
- *
- * Changing this directory does not affect the way how Qt itself loads its plugins.
- *
- * This directory can be changed with the EVAF_QT_PLUGINS_DIR environment variable or with the
- * -qtplugins[dir]=<directory> command line argument.
- */
- virtual QString const qtPluginsDir() const = 0;
-
-};
-
-} // namespace eVaf::Common
-} // namespace eVaf
-
-#endif
#include "logger.h"
#include "iregistry.h"
-#include "ienv.h"
+#include "iapp.h"
#include "version.h"
#include <QtCore>
mSources.insert(source, src);
// Initialize the new source
- src->init(source.isEmpty() ? mDefaultSource : source, iEnv::instance()->logDir(), iEnv::instance()->etcDir());
+ src->init(source.isEmpty() ? mDefaultSource : source, iApp::instance()->logDir(), iApp::instance()->etcDir());
return src.data();
}
#include <Common/Globals>
#include <Common/Util>
#include <Common/iLogger>
-#include <Common/iEnv>
#include <Common/iApp>
#include <QtCore>
bool PluginManagerPrivate::loadPlugins()
{
// Get the name of the application's XML file
- QString xmlFileName = Common::iEnv::instance()->etcDir() + Common::iApp::instance()->xmlFileName();
+ QString xmlFileName = Common::iApp::instance()->etcDir() + Common::iApp::instance()->xmlFileName();
// Open the XML file
QFile xmlFile(xmlFileName);
QString fileName;
#ifdef Q_OS_LINUX
- fileName = QString("%1libq%2.so").arg(Common::iEnv::instance()->qtPluginsDir()).arg(name);
+ fileName = QString("%1libq%2.so").arg(Common::iApp::instance()->qtPluginsDir()).arg(name);
# ifndef QT_NO_DEBUG
- QString t = QString("%1libq%2.so.debug").arg(Common::iEnv::instance()->qtPluginsDir()).arg(name);
+ QString t = QString("%1libq%2.so.debug").arg(Common::iApp::instance()->qtPluginsDir()).arg(name);
if (QFile::exists(t))
fileName = t;
# endif
#endif
#ifdef Q_OS_WIN32
- fileName = QString("%2q%2%3").arg(Common::iEnv::instance()->qtPluginsDir()).arg(name).arg("4.dll");
+ fileName = QString("%2q%2%3").arg(Common::iApp::instance()->qtPluginsDir()).arg(name).arg("4.dll");
# ifndef QT_NO_DEBUG
- QString t = QString("%1q%2%3").arg(Common::iEnv::instance()->qtPluginsDir()).arg(name).arg("d4.dll");
+ QString t = QString("%1q%2%3").arg(Common::iApp::instance()->qtPluginsDir()).arg(name).arg("d4.dll");
if (!QFile::exists(t))
fileName = t;
# endif
bool Module::load()
{
// The real file name with path
- QString fileName = Common::iEnv::instance()->binDir() + expandPluginName(mName);
+ QString fileName = Common::iApp::instance()->binDir() + expandPluginName(mName);
// Try to load the module
QScopedPointer<QPluginLoader> p(new QPluginLoader(fileName));
#include <Common/Globals>
#include <Common/iLogger>
-#include <Common/iEnv>
#include <Common/iApp>
#include <Plugins/PluginManager>
" -lang[uage]=xx[_CC] Specifies the language, where xx is the ISO 639\n"
" language code followed by an optional ISO 3166 country\n"
" code.\n"
- // Handled by the iEnv interface implementation
" -root[dir]=DIR Specifies the application's root directory.\n"
" -dataroot[dir]=DIR Specifies the data root directory.\n"
" -etc[dir]=DIR Specifies the configuration files directory.\n"
#include <Common/Globals>
#include <Common/iLogger>
-#include <Common/iEnv>
#include <Common/iApp>
#include <Plugins/PluginManager>
" -lang[uage]=xx[_CC] Specifies the language, where xx is the ISO 639\n"
" language code followed by an optional ISO 3166 country\n"
" code.\n"
- // Handled by the iEnv interface implementation
" -root[dir]=DIR Specifies the application's root directory.\n"
" -dataroot[dir]=DIR Specifies the data root directory.\n"
" -etc[dir]=DIR Specifies the configuration files directory.\n"