1 /***************************************************************************
2 * Copyright (C) 2008 by Jean-Baptiste Mardelle (jb@kdenlive.org) *
4 * This program is free software; you can redistribute it and/or modify *
5 * it under the terms of the GNU General Public License as published by *
6 * the Free Software Foundation; either version 2 of the License, or *
7 * (at your option) any later version. *
9 * This program is distributed in the hope that it will be useful, *
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12 * GNU General Public License for more details. *
14 * You should have received a copy of the GNU General Public License *
15 * along with this program; if not, write to the *
16 * Free Software Foundation, Inc., *
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
18 ***************************************************************************/
22 #include <KStandardDirs>
26 #include "kdenlivesettings.h"
27 #include "slideshowclip.h"
34 SlideshowClip::SlideshowClip(QWidget * parent): QDialog(parent), m_count(0) {
35 setFont(KGlobalSettings::toolBarFont());
36 //wsetCaption(i18n("Add Slideshow Clip"));
38 m_view.clip_name->setText(i18n("Slideshow Clip"));
39 m_view.folder_url->setMode(KFile::Directory);
40 m_view.icon_list->setIconSize(QSize(50, 50));
41 connect(m_view.folder_url, SIGNAL(textChanged(const QString &)), this, SLOT(parseFolder()));
42 connect(m_view.image_type, SIGNAL(currentIndexChanged ( int )), this, SLOT(parseFolder()));
43 m_view.image_type->addItem("JPG");
44 m_view.image_type->addItem("PNG");
45 m_view.image_type->addItem("BMP");
46 m_view.image_type->addItem("GIF");
47 m_view.clip_duration->setText("00:00:03:00");
51 void SlideshowClip::parseFolder() {
52 m_view.icon_list->clear();
53 QDir dir(m_view.folder_url->url().path());
55 switch (m_view.image_type->currentIndex()) {
66 filters << "*.jpg" << "*.jpeg";
70 dir.setNameFilters(filters);
71 QStringList result = dir.entryList(QDir::Files);
72 m_count = result.count();
73 m_view.label_info->setText(i18n("%1 images found", m_count));
74 foreach (QString path, result) {
75 QIcon icon(dir.filePath(path));
76 QListWidgetItem *item = new QListWidgetItem(icon, KUrl(path).fileName());
77 m_view.icon_list->addItem(item);
81 QString SlideshowClip::selectedPath() const {
83 switch (m_view.image_type->currentIndex()) {
85 extension = "/.all.png";
88 extension = "/.all.bmp";
91 extension = "/.all.gif";
94 extension = "/.all.jpg";
97 return m_view.folder_url->url().path() + extension;
101 QString SlideshowClip::clipName() const {
102 return m_view.clip_name->text();
105 QString SlideshowClip::clipDuration() const {
106 return m_view.clip_duration->text();
109 int SlideshowClip::imageCount() const {
113 bool SlideshowClip::loop() const {
114 return m_view.slide_loop->isChecked();
116 #include "slideshowclip.moc"