ResourceBrowser: added a PianoView widget
Added a PianoView widget to ResourceBrowser so one can easily preview selected preset, sample etc. Signed-off-by: Tobias Doerffel <tobias.doerffel@gmail.com>
This commit is contained in:
@@ -28,6 +28,7 @@
|
||||
|
||||
#include "track_container.h"
|
||||
|
||||
class Piano;
|
||||
class ResourceItem;
|
||||
class instrumentTrack;
|
||||
|
||||
@@ -41,6 +42,8 @@ public:
|
||||
void preview( ResourceItem * _item );
|
||||
void stopPreview();
|
||||
|
||||
Piano * pianoModel();
|
||||
|
||||
|
||||
private:
|
||||
class PreviewTrackContainer : public trackContainer
|
||||
|
||||
@@ -45,6 +45,8 @@ ResourcePreviewer::ResourcePreviewer() :
|
||||
m_previewTrack = dynamic_cast<instrumentTrack *>(
|
||||
track::create( track::InstrumentTrack,
|
||||
&m_previewTrackContainer ) );
|
||||
// make sure a default instrument is loaded
|
||||
m_previewTrack->loadInstrument( "tripleoscillator" );
|
||||
m_previewTrack->setJournalling( false );
|
||||
|
||||
}
|
||||
@@ -121,5 +123,13 @@ void ResourcePreviewer::stopPreview()
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
Piano * ResourcePreviewer::pianoModel()
|
||||
{
|
||||
return m_previewTrack->pianoModel();
|
||||
}
|
||||
|
||||
|
||||
#include "moc_ResourcePreviewer.cxx"
|
||||
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
#include "UnifiedResourceProvider.h"
|
||||
#include "engine.h"
|
||||
#include "embed.h"
|
||||
#include "piano.h"
|
||||
|
||||
|
||||
struct ActionDesc
|
||||
@@ -107,9 +108,13 @@ ResourceBrowser::ResourceBrowser( QWidget * _parent ) :
|
||||
SIGNAL( clicked( const QModelIndex & ) ),
|
||||
this, SLOT( stopItemPreview( const QModelIndex & ) ) );
|
||||
|
||||
PianoView * pianoView = new PianoView( contentParent() );
|
||||
pianoView->setModel( m_previewer.pianoModel() );
|
||||
|
||||
// add widgets/layouts to us (we're a SideBarWidget)
|
||||
addContentLayout( filterLayout );
|
||||
addContentWidget( m_treeView );
|
||||
addContentWidget( pianoView );
|
||||
|
||||
|
||||
// instantly apply filter when typing into filterEdit
|
||||
|
||||
Reference in New Issue
Block a user