summaryrefslogtreecommitdiffstats
path: root/demos
diff options
context:
space:
mode:
Diffstat (limited to 'demos')
-rw-r--r--demos/embedded/desktopservices/contenttab.cpp6
-rw-r--r--demos/embedded/desktopservices/contenttab.h1
-rw-r--r--demos/embedded/desktopservices/desktopwidget.cpp10
3 files changed, 13 insertions, 4 deletions
diff --git a/demos/embedded/desktopservices/contenttab.cpp b/demos/embedded/desktopservices/contenttab.cpp
index 12e80f6..450a080 100644
--- a/demos/embedded/desktopservices/contenttab.cpp
+++ b/demos/embedded/desktopservices/contenttab.cpp
@@ -66,9 +66,13 @@ ContentTab::~ContentTab()
// NEW PUBLIC METHODS
void ContentTab::init(const QDesktopServices::StandardLocation &location,
+ const QString &filter,
const QString &icon)
{
setContentDir(location);
+ QStringList filterList;
+ filterList = filter.split(";");
+ m_ContentDir.setNameFilters(filterList);
setIcon(icon);
connect(this, SIGNAL(itemClicked(QListWidgetItem *)),
@@ -90,7 +94,7 @@ void ContentTab::setIcon(const QString &icon)
void ContentTab::populateListWidget()
{
- QFileInfoList fileList = m_ContentDir.entryInfoList(QStringList(), QDir::Files, QDir::Time);
+ QFileInfoList fileList = m_ContentDir.entryInfoList(QDir::Files, QDir::Time);
foreach(QFileInfo item, fileList) {
new QListWidgetItem(m_Icon, itemName(item), this);
}
diff --git a/demos/embedded/desktopservices/contenttab.h b/demos/embedded/desktopservices/contenttab.h
index af1b7bb..a5a402e 100644
--- a/demos/embedded/desktopservices/contenttab.h
+++ b/demos/embedded/desktopservices/contenttab.h
@@ -74,6 +74,7 @@ public: // Constructors & Destructors
public: // New Methods
virtual void init(const QDesktopServices::StandardLocation &location,
+ const QString &filter,
const QString &icon);
protected: // New Methods
diff --git a/demos/embedded/desktopservices/desktopwidget.cpp b/demos/embedded/desktopservices/desktopwidget.cpp
index e8a654e..3abe591 100644
--- a/demos/embedded/desktopservices/desktopwidget.cpp
+++ b/demos/embedded/desktopservices/desktopwidget.cpp
@@ -59,18 +59,22 @@ DesktopWidget::DesktopWidget(QWidget *parent) : QWidget(parent)
// Images
ContentTab* imageTab = new ContentTab(tabWidget);
- imageTab->init(QDesktopServices::PicturesLocation, ":/resources/photo.png");
+ imageTab->init(QDesktopServices::PicturesLocation,
+ "*.png;*.jpg;*.jpeg;*.bmp;*.gif",
+ ":/resources/photo.png");
tabWidget->addTab(imageTab, tr("Images"));
// Music
ContentTab* musicTab = new ContentTab(tabWidget);
- musicTab->init(QDesktopServices::MusicLocation, ":/resources/music.png");
+ musicTab->init(QDesktopServices::MusicLocation,
+ "*.wav;*.mp3;*.mp4",
+ ":/resources/music.png");
tabWidget->addTab(musicTab, tr("Music"));
// Links
LinkTab* othersTab = new LinkTab(tabWidget);;
// Given icon file will be overriden by LinkTab
- othersTab->init(QDesktopServices::PicturesLocation, "");
+ othersTab->init(QDesktopServices::PicturesLocation, "", "");
tabWidget->addTab(othersTab, tr("Links"));
// Layout