51 Drumkit( std::shared_ptr<Drumkit> other );
72 static std::shared_ptr<Drumkit>
load(
const QString& dk_dir,
74 bool* pLegacyFormatEncountered =
nullptr,
75 bool bSilent =
false );
111 QString
getExportName(
const QString& sComponentName,
bool bRecentVersion )
const;
119 const QString& dk_path,
120 bool bSilent =
false );
138 bool save(
const QString& sDrumkitPath =
"",
139 int nComponentID = -1,
140 bool bRecentVersion =
true,
141 bool bSilent =
false );
164 static bool install(
const QString& sSourcePath,
165 const QString& sTargetPath =
"",
166 QString* pInstalledPath =
nullptr,
167 bool* pEncodingIssuesDetected =
nullptr,
168 bool bSilent =
false );
193 bool exportTo(
const QString& sTargetDir,
const QString& sComponentName =
"",
194 bool bRecentVersion =
true,
bool* pUtf8Encoded =
nullptr,
195 bool bSilent =
false );
202 static bool remove(
const QString& sDrumkitDir );
210 void set_path(
const QString& path );
214 void set_name(
const QString& name );
222 void set_info(
const QString& info );
240 std::shared_ptr<DrumkitComponent>
getComponent(
int nID )
const;
243 void addComponent( std::shared_ptr<DrumkitComponent> pComponent );
246 void addInstrument( std::shared_ptr<Instrument> pInstrument );
248 std::shared_ptr<std::vector<std::shared_ptr<DrumkitComponent>>>
get_components();
249 void set_components( std::shared_ptr<std::vector<std::shared_ptr<DrumkitComponent>>> components );
260 std::vector<std::shared_ptr<InstrumentList::Content>>
summarizeContent()
const;
270 QString
toQString(
const QString& sPrefix =
"",
bool bShort =
true )
const override;
283 std::shared_ptr<std::vector<std::shared_ptr<DrumkitComponent>>>
__components;
292 bool save_image(
const QString& dk_dir,
bool bSilent =
false )
const;
300 bool save_samples(
const QString& dk_dir,
bool bSilent =
false )
const;
309 void save_to(
XMLNode* node,
int component_id=-1,
bool bRecentVersion =
true,
bool bSilent =
false )
const;
320 static std::shared_ptr<Drumkit>
load_from(
322 const QString& dk_path,
323 bool* pLegacyFormatEncountered =
nullptr,
324 bool bSilent =
false );
332 static bool loadDoc(
const QString& sDrumkitDir,
XMLDoc* pDoc,
bool bSilent =
false );
QString __name
drumkit name
int findUnusedComponentId() const
static bool loadDoc(const QString &sDrumkitDir, XMLDoc *pDoc, bool bSilent=false)
Loads the drumkit stored in sDrumkitDir into pDoc and takes care of all the error handling.
const QString & get_info() const
__info accessor
void set_image_license(const License &imageLicense)
__imageLicense setter
std::shared_ptr< InstrumentList > get_instruments() const
returns __instruments
void set_name(const QString &name)
__name setter
const License & get_license() const
__license accessor
const QString & get_name() const
__name accessor
void save_to(XMLNode *node, int component_id=-1, bool bRecentVersion=true, bool bSilent=false) const
static bool install(const QString &sSourcePath, const QString &sTargetPath="", QString *pInstalledPath=nullptr, bool *pEncodingIssuesDetected=nullptr, bool bSilent=false)
Extract a .h2drumkit file.
bool exportTo(const QString &sTargetDir, const QString &sComponentName="", bool bRecentVersion=true, bool *pUtf8Encoded=nullptr, bool bSilent=false)
Compresses the drumkit into a .h2drumkit file.
bool save_image(const QString &dk_dir, bool bSilent=false) const
save the drumkit image into the new directory
std::shared_ptr< std::vector< std::shared_ptr< DrumkitComponent > > > __components
list of drumkit component
const QString & get_image() const
__image accessor
void propagateLicense()
Assign the license stored in #m_license to all samples contained in the kit.
License __imageLicense
drumkit image license
~Drumkit()
drumkit destructor, delete __instruments
static void upgrade_drumkit(std::shared_ptr< Drumkit > pDrumkit, const QString &dk_path, bool bSilent=false)
Saves the current drumkit to dk_path, but makes a backup.
std::shared_ptr< std::vector< std::shared_ptr< DrumkitComponent > > > get_components()
std::shared_ptr< InstrumentList > __instruments
the list of instruments
QString __info
drumkit free text
void set_info(const QString &info)
__info setter
void set_path(const QString &path)
__path setter
bool save_samples(const QString &dk_dir, bool bSilent=false) const
save a drumkit instruments samples into a directory
void load_samples()
Calls the InstrumentList::load_samples() member function of __instruments.
QString __author
drumkit author
static bool remove(const QString &sDrumkitDir)
remove a drumkit from the disk
static std::shared_ptr< Drumkit > load(const QString &dk_dir, bool bUpgrade=true, bool *pLegacyFormatEncountered=nullptr, bool bSilent=false)
Load drumkit information from a directory.
const QString & get_author() const
__author accessor
std::shared_ptr< DrumkitComponent > getComponent(int nID) const
void set_license(const License &license)
__license setter
std::vector< std::shared_ptr< InstrumentList::Content > > summarizeContent() const
Returns vector of lists containing instrument name, component name, file name, the license of all ass...
QString __image
drumkit image filename
void addComponent(std::shared_ptr< DrumkitComponent > pComponent)
static std::shared_ptr< Drumkit > load_from(XMLNode *node, const QString &dk_path, bool *pLegacyFormatEncountered=nullptr, bool bSilent=false)
load a drumkit from an XMLNode
static License loadLicenseFrom(const QString &sDrumkitDir, bool bSilent=false)
Loads the license information of a drumkit contained in directory sDrumkitDir.
QString getExportName(const QString &sComponentName, bool bRecentVersion) const
Returns the base name used when exporting the drumkit.
QString toQString(const QString &sPrefix="", bool bShort=true) const override
Formatted string version for debugging purposes.
void set_image(const QString &image)
__image setter
const bool samples_loaded() const
return true if the samples are loaded
void addInstrument(std::shared_ptr< Instrument > pInstrument)
Adds an instrument and takes care of registering DrumkitComponents missing for contained InstrumentCo...
QString __path
absolute drumkit path
void unload_samples()
Calls the InstrumentList::unload_samples() member function of __instruments.
const QString & get_path() const
__path accessor
Drumkit()
drumkit constructor, does nothing
bool __samples_loaded
true if the instrument samples are loaded
bool save(const QString &sDrumkitPath="", int nComponentID=-1, bool bRecentVersion=true, bool bSilent=false)
Save a drumkit to disk.
QString getFolderName() const
Returns a version of __name stripped of all whitespaces and other characters which would prevent its ...
void set_components(std::shared_ptr< std::vector< std::shared_ptr< DrumkitComponent > > > components)
void set_instruments(std::shared_ptr< InstrumentList > instruments)
set __instruments, delete existing one
License __license
drumkit license description
void set_author(const QString &author)
__author setter
const License & get_image_license() const
__imageLicense accessor
Wrapper class to help Hydrogen deal with the license information specified in a drumkit.
XMLDoc is a subclass of QDomDocument with read and write methods.
XMLNode is a subclass of QDomNode with read and write values methods.