From f6fe2a16ad2afe8e7b394e24f479f5492651e657 Mon Sep 17 00:00:00 2001 From: Tobias Doerffel Date: Wed, 3 Jun 2009 14:30:58 +0200 Subject: [PATCH] ResourcesBrowser: new class providing a view for browsing resources Added a new class ResourcesBrowser which represents a complete view for browsing all available resources. It only allows filtering at the moment but more features will follow soon. Signed-off-by: Tobias Doerffel --- data/themes/default/resources_browser.png | Bin 0 -> 1273 bytes include/resources_browser.h | 49 +++++++++++++++ src/gui/resources_browser.cpp | 72 ++++++++++++++++++++++ 3 files changed, 121 insertions(+) create mode 100644 data/themes/default/resources_browser.png create mode 100644 include/resources_browser.h create mode 100644 src/gui/resources_browser.cpp diff --git a/data/themes/default/resources_browser.png b/data/themes/default/resources_browser.png new file mode 100644 index 0000000000000000000000000000000000000000..c095d42d5b9a4a8e72302cd5d3b17602bf16db62 GIT binary patch literal 1273 zcmV6v@ss+=c1PQ?e zx=#rep+y3M_~c87kcVQMw;BYc_~4TiB!Uk@(D#CUk_hR8NtIIZ4^W^3yk~xX z{;P?JiPxk;N+~#w1CedpiKr!Gq9~Ga66Ibz4^~!I&M=la=5D3|^N?LGmp_`Go<8Y$ z9)w&jmqZfCI0&)9AP7*a)dc<7#Idol<5N>pA9L)x92;dC7#J8hyRfiurmwHhk>sxH zLZVba5~mTxE0?6c@2Ab!b8~a2*Vos-2k_+s4bbJ#^78We!NI}qWD;IamRn<19$yoQ zSurZtW5h&vcX!v~;^H~Z^8?5J`k)FtH$Fc8?AF#6+M(nQo1C0{M&>7J1C1YCT3SN8 zG&3`ky$#c@uUK#4jaQH1PzmVi0J`!(hX-8!<`OP`IEzNQaPbn#Z_h$Szy1wh(EJm(9YIC|^^A_W8y$C6qA z>{Rx7KTqn}2GVjY;MP4R2!Vk^z*CO^M~;u;g_EQ3T)=g-0i|@pAkc(L6Nm{yHTMbx zQQl$MIl^YV?*o6{2kz0#!zG}*2o#vyvw2^hBg$f8kh)GB8aQ85ub@sWZ9wA?m*iZH z#m|cDMjBCd4+wmYi};MCS8r&k2lP#w35lc8MvRHHctB#02DWIVQlSX|UA$Inx&lU) z4&y(Jr6OS4Y16DmmB|zMK8i5lyboHY>9kb7E5H+#4-^|t`SIb zO+-Q^vH62YWC5}Ti38lN@cJE^=%Qwsf4KvkXpT|KrH%;kDOyClmI3%ekL6D$kqA&Aj8Tf--HrJgLw!t!_ jTTzj^K^dYHdr0X&aDGda>0MUx00000NkvXXu0mjf6BbAj literal 0 HcmV?d00001 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" +