/*! \file Utils.h
 *  \brief Widget utility functions and classes.
 *
 * TDE-IDE widget utility functions and classes.
 */

#ifndef QTDE_WIDGETS_UTILS_H
#define QTDE_WIDGETS_UTILS_H

#include <QWidget>

#include <stdint.h>
#include <sys/types.h>

#include "common.h"
#include "opaque.h"

// -- TDE NAMESPACE ----------------------------------------------------

namespace TDE {

/*!
 * \brief Obtain the active translation of the variable name for the given VariableDescr
 *
 * \param vDescr Variable description
 */
inline QString trVariableName( const VariableDescr& vDescr )
{
	return QObject::tr( vDescr.name.c_str(), vDescr.name.c_str() );
}

/*!
 * \brief Obtain the active translation of the variable description for the given VariableDescr
 *
 * \param vDescr Variable description
 */
inline QString trVariableDescription( const VariableDescr& vDescr )
{
	return QObject::tr( vDescr.description.c_str(), vDescr.name.c_str() );
}

/*!
 * \brief Obtain the active translation of the variable notes for the given VariableDescr
 *
 * \param vDescr Variable description
 */
inline QString trVariableNotes( const VariableDescr& vDescr )
{
	return QObject::tr( vDescr.notes.c_str(), vDescr.name.c_str() );
}

// -- Widgets NAMESPACE ------------------------------------------------

namespace Widgets {

/*!
 * \brief Return a new DataStore and load in it the specified configuration file
 *
 * \param pathname Variable database configuration file
 * \param initializer_func Initialization callback function
 */
SHARED_PTR<TDE::DataStore> LoadDefaultDataStore(const std::string& pathname, DataStoreInitializer initializer_func = 0);

} /* end of namespace Widgets */

} /* end of namespace TDE */

#endif /* QTDE_WIDGETS_UTILS_H */
