diff --git a/data/themes/default/resources_browser.png b/data/themes/default/resources_browser.png new file mode 100644 index 000000000..c095d42d5 Binary files /dev/null and b/data/themes/default/resources_browser.png differ diff --git a/include/resources_browser.h b/include/resources_browser.h new file mode 100644 index 000000000..dbc92335c --- /dev/null +++ b/include/resources_browser.h @@ -0,0 +1,49 @@ +/* + * resources_browser.h - header file for ResourcesBrowser + * + * Copyright (c) 2009 Tobias Doerffel + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ + + +#ifndef _RESOURCES_BROWSER_H +#define _RESOURCES_BROWSER_H + +#include "side_bar_widget.h" + +class ResourcesTreeModel; +class ResourcesTreeView; + + +class ResourcesBrowser : public sideBarWidget +{ +public: + ResourcesBrowser( QWidget * _parent ); + virtual ~ResourcesBrowser(); + + +private: + ResourcesTreeModel * m_treeModel; + ResourcesTreeView * m_treeView; + +} ; + + +#endif diff --git a/src/gui/resources_browser.cpp b/src/gui/resources_browser.cpp new file mode 100644 index 000000000..90d572f7e --- /dev/null +++ b/src/gui/resources_browser.cpp @@ -0,0 +1,72 @@ +/* + * resources_browser.cpp - implementation of ResourcesBrowser + * + * Copyright (c) 2009 Tobias Doerffel + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ + +#include + +#include "resources_browser.h" +#include "resources_tree_model.h" +#include "resources_tree_view.h" +#include "unified_resources_provider.h" +#include "engine.h" +#include "embed.h" + + + +ResourcesBrowser::ResourcesBrowser( QWidget * _parent ) : + sideBarWidget( tr( "Resources Browser" ), + embed::getIconPixmap( "resources_browser" ), + _parent ) +{ + // create a model which represents our database as a tree + m_treeModel = new ResourcesTreeModel( + engine::getResourcesProvider()->database() ); + + // create an according tree-view for our tree-model + m_treeView = new ResourcesTreeView( m_treeModel, contentParent() ); + + QLineEdit * filterEdit = new QLineEdit ( contentParent() ); + + // add widgets to us (we're a SideBarWidget) + addContentWidget( m_treeView ); + addContentWidget( filterEdit ); + + + // instantly apply filter when typing into filterEdit + connect( filterEdit, SIGNAL( textChanged( const QString & ) ), + m_treeView, SLOT( setFilter( const QString & ) ) ); +} + + + + +ResourcesBrowser::~ResourcesBrowser() +{ + delete m_treeView; + delete m_treeModel; +} + + + +#include "moc_resources_browser.cxx" +