2016-04-07 02:39:30 +05:30
# pragma once
# include <memory>
2016-11-07 02:28:54 +05:30
# include "QObjectPtr.h"
2016-04-07 02:39:30 +05:30
class QWidget ;
class QString ;
2016-11-07 02:28:54 +05:30
using WonkoIndexPtr = shared_qobject_ptr < class WonkoIndex > ;
2016-04-07 02:39:30 +05:30
using WonkoVersionListPtr = std : : shared_ptr < class WonkoVersionList > ;
using WonkoVersionPtr = std : : shared_ptr < class WonkoVersion > ;
namespace Wonko
{
enum UpdateType
{
AlwaysUpdate ,
UpdateIfNeeded
} ;
/// Ensures that the index has been loaded, either from the local cache or remotely
WonkoIndexPtr ensureIndexLoaded ( QWidget * parent ) ;
/// Ensures that the given uid exists. Returns a nullptr if it doesn't.
WonkoVersionListPtr ensureVersionListExists ( const QString & uid , QWidget * parent ) ;
/// Ensures that the given uid exists and is loaded, either from the local cache or remotely. Returns nullptr if it doesn't exist or couldn't be loaded.
WonkoVersionListPtr ensureVersionListLoaded ( const QString & uid , QWidget * parent ) ;
WonkoVersionPtr ensureVersionExists ( const QString & uid , const QString & version , QWidget * parent ) ;
WonkoVersionPtr ensureVersionLoaded ( const QString & uid , const QString & version , QWidget * parent , const UpdateType update = UpdateIfNeeded ) ;
}