PluginBrowser::PluginBrowser( QWidget * _parent ) : SideBarWidget( tr( "Instrument plugins" ), embed::getIconPixmap( "plugins" ).transformed( QTransform().rotate( 90 ) ), _parent ) { setWindowTitle( tr( "Instrument browser" ) ); m_view = new QWidget( contentParent() ); //m_view->setFrameShape( QFrame::NoFrame ); addContentWidget( m_view ); QVBoxLayout * view_layout = new QVBoxLayout( m_view ); view_layout->setMargin( 5 ); view_layout->setSpacing( 5 ); QLabel * hint = new QLabel( tr( "Drag an instrument " "into either the Song-Editor, the " "Beat+Bassline Editor or into an " "existing instrument track." ), m_view ); hint->setFont( pointSize<8>( hint->font() ) ); hint->setWordWrap( true ); QScrollArea* scrollarea = new QScrollArea( m_view ); PluginDescList* descList = new PluginDescList( m_view ); scrollarea->setWidget(descList); scrollarea->setWidgetResizable(true); view_layout->addWidget(hint); view_layout->addWidget(scrollarea); }
FileBrowser::FileBrowser(const QString & directories, const QString & filter, const QString & title, const QPixmap & pm, QWidget * parent, bool dirs_as_items, bool recurse ) : SideBarWidget( title, pm, parent ), m_directories( directories ), m_filter( filter ), m_dirsAsItems( dirs_as_items ), m_recurse( recurse ) { setWindowTitle( tr( "Browser" ) ); m_l = new FileBrowserTreeWidget( contentParent() ); addContentWidget( m_l ); QWidget * ops = new QWidget( contentParent() ); ops->setFixedHeight( 24 ); QHBoxLayout * opl = new QHBoxLayout( ops ); opl->setMargin( 0 ); opl->setSpacing( 0 ); m_filterEdit = new QLineEdit( ops ); connect( m_filterEdit, SIGNAL( textEdited( const QString & ) ), this, SLOT( filterItems( const QString & ) ) ); QPushButton * reload_btn = new QPushButton( embed::getIconPixmap( "reload" ), QString::null, ops ); connect( reload_btn, SIGNAL( clicked() ), this, SLOT( reloadTree() ) ); opl->addWidget( m_filterEdit ); opl->addSpacing( 5 ); opl->addWidget( reload_btn ); addContentWidget( ops ); // Whenever the FileBrowser has focus, Ctrl+F should direct focus to its filter box. QShortcut *filterFocusShortcut = new QShortcut( QKeySequence( QKeySequence::Find ), this, SLOT(giveFocusToFilter()) ); filterFocusShortcut->setContext(Qt::WidgetWithChildrenShortcut); reloadTree(); show(); }
FileBrowser::FileBrowser(const QString & directories, const QString & filter, const QString & title, const QPixmap & pm, QWidget * parent, bool dirs_as_items ) : SideBarWidget( title, pm, parent ), m_directories( directories ), m_filter( filter ), m_dirsAsItems( dirs_as_items ) { setWindowTitle( tr( "Browser" ) ); m_l = new FileBrowserTreeWidget( contentParent() ); addContentWidget( m_l ); QWidget * ops = new QWidget( contentParent() ); ops->setFixedHeight( 24 ); QHBoxLayout * opl = new QHBoxLayout( ops ); opl->setMargin( 0 ); opl->setSpacing( 0 ); m_filterEdit = new QLineEdit( ops ); connect( m_filterEdit, SIGNAL( textEdited( const QString & ) ), this, SLOT( filterItems( const QString & ) ) ); QPushButton * reload_btn = new QPushButton( embed::getIconPixmap( "reload" ), QString::null, ops ); connect( reload_btn, SIGNAL( clicked() ), this, SLOT( reloadTree() ) ); opl->addWidget( m_filterEdit ); opl->addSpacing( 5 ); opl->addWidget( reload_btn ); addContentWidget( ops ); reloadTree(); show(); }
pluginBrowser::pluginBrowser( QWidget * _parent ) : SideBarWidget( tr( "Instrument plugins" ), embed::getIconPixmap( "plugins" ).transformed( QTransform().rotate( 90 ) ), _parent ) { setWindowTitle( tr( "Instrument browser" ) ); m_view = new QWidget( contentParent() ); //m_view->setFrameShape( QFrame::NoFrame ); addContentWidget( m_view ); QVBoxLayout * view_layout = new QVBoxLayout( m_view ); view_layout->setMargin( 5 ); view_layout->setSpacing( 5 ); QLabel * hint = new QLabel( tr( "Drag an instrument " "into either the Song-Editor, the " "Beat+Bassline Editor or into an " "existing instrument track." ), m_view ); hint->setFont( pointSize<8>( hint->font() ) ); hint->setWordWrap( true ); view_layout->addWidget( hint ); Plugin::getDescriptorsOfAvailPlugins( m_pluginDescriptors ); qSort( m_pluginDescriptors.begin(), m_pluginDescriptors.end(), pluginBefore ); for( Plugin::DescriptorList::ConstIterator it = m_pluginDescriptors.begin(); it != m_pluginDescriptors.end(); ++it ) { if( it->type == Plugin::Instrument ) { pluginDescWidget * p = new pluginDescWidget( *it, m_view ); p->show(); view_layout->addWidget( p ); } } view_layout->addStretch(); show(); }