本文整理汇总了C++中Pattern::set_name方法的典型用法代码示例。如果您正苦于以下问题:C++ Pattern::set_name方法的具体用法?C++ Pattern::set_name怎么用?C++ Pattern::set_name使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pattern
的用法示例。
在下文中一共展示了Pattern::set_name方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: load_from
Pattern* Pattern::load_from( XMLNode* node, InstrumentList* instruments )
{
Pattern* pattern = new Pattern(
node->read_string( "name", NULL, false, false ),
node->read_string( "info", "", false, false ),
node->read_string( "category", "unknown", false, false ),
node->read_int( "size", -1, false, false )
);
// FIXME support legacy xml element pattern_name, should once be removed
if ( pattern->get_name().isEmpty() ) {
pattern->set_name( node->read_string( "pattern_name", "unknown", false, false ) );
}
XMLNode note_list_node = node->firstChildElement( "noteList" );
if ( !note_list_node.isNull() ) {
XMLNode note_node = note_list_node.firstChildElement( "note" );
while ( !note_node.isNull() ) {
Note* note = Note::load_from( ¬e_node, instruments );
if( note ) {
pattern->insert_note( note );
}
note_node = note_node.nextSiblingElement( "note" );
}
}
return pattern;
}
示例2: action_file_export_pattern_as
void MainForm::action_file_export_pattern_as()
{
if ( ( Hydrogen::get_instance()->getState() == STATE_PLAYING ) )
{
Hydrogen::get_instance()->sequencer_stop();
}
Hydrogen *engine = Hydrogen::get_instance();
int selectedpattern = engine->getSelectedPatternNumber();
Song *song = engine->getSong();
Pattern *pat = song->get_pattern_list()->get ( selectedpattern );
Instrument *instr = song->get_instrument_list()->get ( 0 );
assert ( instr );
QDir dir = Preferences::get_instance()->__lastspatternDirectory;
QFileDialog fd(this);
fd.setFileMode ( QFileDialog::AnyFile );
fd.setFilter ( trUtf8 ( "Hydrogen Pattern (*.h2pattern)" ) );
fd.setAcceptMode ( QFileDialog::AcceptSave );
fd.setWindowTitle ( trUtf8 ( "Save Pattern as ..." ) );
fd.setDirectory ( dir );
fd.setSidebarUrls( fd.sidebarUrls() << QUrl::fromLocalFile( Filesystem::patterns_dir() ) );
QString defaultPatternname = QString ( pat->get_name() );
fd.selectFile ( defaultPatternname );
LocalFileMng fileMng;
QString filename;
if ( fd.exec() == QDialog::Accepted )
{
filename = fd.selectedFiles().first();
QString tmpfilename = filename;
QString toremove = tmpfilename.section( '/', -1 );
QString newdatapath = tmpfilename.replace( toremove, "" );
Preferences::get_instance()->__lastspatternDirectory = newdatapath;
}
if ( !filename.isEmpty() )
{
QString sNewFilename = filename;
if(sNewFilename.endsWith( ".h2pattern" ) ){
sNewFilename += "";
}
else{
sNewFilename += ".h2pattern";
}
QString patternname = sNewFilename;
QString realpatternname = filename;
QString realname = realpatternname.mid( realpatternname.lastIndexOf( "/" ) + 1 );
if ( realname.endsWith( ".h2pattern" ) )
realname.replace( ".h2pattern", "" );
pat->set_name(realname);
HydrogenApp::get_instance()->getSongEditorPanel()->updateAll();
int err = fileMng.savePattern ( song, engine->getCurrentDrumkitname(), selectedpattern, patternname, realname, 2 );
if ( err != 0 )
{
QMessageBox::warning( this, "Hydrogen", trUtf8("Could not export pattern.") );
_ERRORLOG ( "Error saving the pattern" );
}
}
h2app->setStatusBarMessage ( trUtf8 ( "Pattern saved." ), 10000 );
//update SoundlibraryPanel
HydrogenApp::get_instance()->getInstrumentRack()->getSoundLibraryPanel()->test_expandedItems();
HydrogenApp::get_instance()->getInstrumentRack()->getSoundLibraryPanel()->updateDrumkitList();
}