diff options
author | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
---|---|---|
committer | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
commit | 47d455dd55be855e4cc691c32f687f723d9247ee (patch) | |
tree | 52e236aaa2576bdb3840ebede26619692fed6d7d /kview/modules/presenter | |
download | tdegraphics-47d455dd55be855e4cc691c32f687f723d9247ee.tar.gz tdegraphics-47d455dd55be855e4cc691c32f687f723d9247ee.zip |
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdegraphics@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kview/modules/presenter')
-rw-r--r-- | kview/modules/presenter/DESIGN | 42 | ||||
-rw-r--r-- | kview/modules/presenter/Makefile.am | 17 | ||||
-rw-r--r-- | kview/modules/presenter/config/Makefile.am | 17 | ||||
-rw-r--r-- | kview/modules/presenter/config/kviewpresenterconfig.cpp | 72 | ||||
-rw-r--r-- | kview/modules/presenter/config/kviewpresenterconfig.desktop | 120 | ||||
-rw-r--r-- | kview/modules/presenter/config/kviewpresenterconfig.h | 46 | ||||
-rw-r--r-- | kview/modules/presenter/imagelistdialog.ui | 289 | ||||
-rw-r--r-- | kview/modules/presenter/imagelistdialog.ui.h | 23 | ||||
-rw-r--r-- | kview/modules/presenter/imagelistitem.cpp | 82 | ||||
-rw-r--r-- | kview/modules/presenter/imagelistitem.h | 49 | ||||
-rw-r--r-- | kview/modules/presenter/kviewpresenter.cpp | 492 | ||||
-rw-r--r-- | kview/modules/presenter/kviewpresenter.desktop | 118 | ||||
-rw-r--r-- | kview/modules/presenter/kviewpresenter.h | 103 | ||||
-rw-r--r-- | kview/modules/presenter/kviewpresenter.rc | 20 | ||||
-rw-r--r-- | kview/modules/presenter/kviewpresenterconfmodule.cpp | 60 | ||||
-rw-r--r-- | kview/modules/presenter/kviewpresenterconfmodule.h | 49 |
16 files changed, 1599 insertions, 0 deletions
diff --git a/kview/modules/presenter/DESIGN b/kview/modules/presenter/DESIGN new file mode 100644 index 00000000..11d77121 --- /dev/null +++ b/kview/modules/presenter/DESIGN @@ -0,0 +1,42 @@ +Presenter Plugin: +- Features: + - a playlist with image infos: + - possibly get info from KFileMetaInfo + - image infos are readable for the user + - image infos for the program + - keeps track of images that were opened + - new action to load multiple files into the 'playlist' + - shuffle functions: + - shuffle the playlist + - load a random picture from the list (don't show the same image + again, though) + - order the items in the list via DnD + - order items alphabetically + - slideshow: + - configurable interval between images (in msecs) + - blending effects (put those effects in the imagecanvas) + - optionally keep image size <= canvas size + - preload next image (optionally) + +- Implementation: + - Playlist: + - KListView + - Items: + - derived from KListViewItem + - load Info in the background + - keep local copy of downloaded files + - delete local copy on destruction + - API: + QImage * image(); + KURL url(); + QString file(); //returns local filename or QString::null + - when loading an item from the playlist first ask for a + QImage, if that's not available ask for a local file, if + that's also not available take the url. + - API: + QImage * image(); + QString file(); + KURL url(); + void setRandom(bool); + void randomizeList(); + void orderAlphabetically(); diff --git a/kview/modules/presenter/Makefile.am b/kview/modules/presenter/Makefile.am new file mode 100644 index 00000000..905bd1fc --- /dev/null +++ b/kview/modules/presenter/Makefile.am @@ -0,0 +1,17 @@ +SUBDIRS = . + +INCLUDES = -I$(top_srcdir)/kview $(all_includes) + +kde_module_LTLIBRARIES = kview_presenterplugin.la + +kview_presenterplugin_la_SOURCES = imagelistitem.cpp imagelistdialog.ui kviewpresenter.cpp +kview_presenterplugin_la_LIBADD = $(LIB_KIO) $(LIB_KPARTS) +kview_presenterplugin_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN) + +plugdir = $(kde_datadir)/kview/kpartplugins +plug_DATA = kviewpresenter.desktop kviewpresenter.rc + +METASOURCES = AUTO + +messages: rc.cpp + $(XGETTEXT) *.cpp *.h -o $(podir)/kviewpresenterplugin.pot diff --git a/kview/modules/presenter/config/Makefile.am b/kview/modules/presenter/config/Makefile.am new file mode 100644 index 00000000..8c212e7f --- /dev/null +++ b/kview/modules/presenter/config/Makefile.am @@ -0,0 +1,17 @@ +INCLUDES = $(all_includes) + +kde_module_LTLIBRARIES = kcm_kviewpresenterconfig.la + +noinst_HEADERS = kviewpresenterconfig.h + +kcm_kviewpresenterconfig_la_SOURCES = kviewpresenterconfig.cpp +kcm_kviewpresenterconfig_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN) +kcm_kviewpresenterconfig_la_LIBADD = $(LIB_KUTILS) + +kcm_kviewpresenterconfig_DATA = kviewpresenterconfig.desktop +kcm_kviewpresenterconfigdir = $(kde_servicesdir)/kconfiguredialog + +METASOURCES = AUTO + +messages: rc.cpp + $(XGETTEXT) *.cpp *.h -o $(podir)/kcm_kviewpresenterconfig.pot diff --git a/kview/modules/presenter/config/kviewpresenterconfig.cpp b/kview/modules/presenter/config/kviewpresenterconfig.cpp new file mode 100644 index 00000000..92dd8627 --- /dev/null +++ b/kview/modules/presenter/config/kviewpresenterconfig.cpp @@ -0,0 +1,72 @@ +/* This file is part of the KDE project + Copyright (C) 2002-2003 Matthias Kretz <[email protected]> + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 + as published by the Free Software Foundation. + + 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; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +*/ + +#include "kviewpresenterconfig.h" + +#include <qlayout.h> +#include <qcheckbox.h> +#include <qframe.h> + +#include <klocale.h> +#include <kdialog.h> +#include <kglobal.h> +#include <kconfig.h> +#include <kgenericfactory.h> + +typedef KGenericFactory<KViewPresenterConfig, QWidget> KViewPresenterConfigFactory; +K_EXPORT_COMPONENT_FACTORY( kcm_kviewpresenterconfig, KViewPresenterConfigFactory( "kcm_kviewpresenterconfig" ) ) + +KViewPresenterConfig::KViewPresenterConfig( QWidget * parent, const char *, const QStringList & args ) + : KCModule( KViewPresenterConfigFactory::instance(), parent, args ) +{ + QBoxLayout * layout = new QVBoxLayout( this, KDialog::marginHint(), KDialog::spacingHint() ); + layout->setAutoAdd( true ); + + m_pCheckBox = new QCheckBox( "This is only for testing...", this ); + connect( m_pCheckBox, SIGNAL( clicked() ), this, SLOT( checkChanged() ) ); +} + +KViewPresenterConfig::~KViewPresenterConfig() +{ +} + +void KViewPresenterConfig::checkChanged() +{ + if( m_pCheckBox->isChecked() ) + emit changed( true ); + else + emit changed( false ); +} + +void KViewPresenterConfig::load() +{ + emit changed( false ); +} + +void KViewPresenterConfig::save() +{ + emit changed( false ); +} + +void KViewPresenterConfig::defaults() +{ +} + +// vim:sw=4:ts=4 + +#include "kviewpresenterconfig.moc" diff --git a/kview/modules/presenter/config/kviewpresenterconfig.desktop b/kview/modules/presenter/config/kviewpresenterconfig.desktop new file mode 100644 index 00000000..77bb3481 --- /dev/null +++ b/kview/modules/presenter/config/kviewpresenterconfig.desktop @@ -0,0 +1,120 @@ +[Desktop Entry] +Icon=kpresenter +Type=Service +ServiceTypes=KCModule + +X-KDE-ModuleType=Library +X-KDE-Library=kviewpresenterconfig +X-KDE-FactoryName=KViewPresenterConfigFactory +X-KDE-ParentComponents=kviewpresenter + +Name=Name +Name[ar]=اسم +Name[bg]=Име +Name[br]=Anv +Name[bs]=Ime +Name[ca]=Nom +Name[cy]=Enw +Name[da]=Navn +Name[el]=Όνομα +Name[eo]=Nomo +Name[es]=Nombre +Name[et]=Nimi +Name[eu]=Izena +Name[fa]=نام +Name[fi]=Nimi +Name[fr]=Nom +Name[ga]=Ainm +Name[gl]=Nome +Name[he]=שם +Name[hi]=नाम +Name[hu]=Név +Name[is]=Heiti +Name[it]=Nome +Name[ja]=名前 +Name[kk]=Атауы +Name[km]=ឈ្មោះ +Name[lt]=Pavadinimas +Name[ms]=Nama +Name[nb]=Navn +Name[nds]=Naam +Name[ne]=नाम +Name[nl]=Naam +Name[nn]=Namn +Name[pa]=ਨਾਂ +Name[pl]=Nazwa +Name[pt]=Nome +Name[pt_BR]=Nome +Name[ro]=Nume +Name[ru]=Имя +Name[se]=Namma +Name[sk]=Meno +Name[sl]=Ime +Name[sr]=Име +Name[sr@Latn]=Ime +Name[sv]=Namn +Name[ta]=பெயர் +Name[tg]=Ном +Name[uk]=Назва +Name[uz]=Nomi +Name[uz@cyrillic]=Номи +Name[wa]=No +Name[zh_CN]=名称 +Name[zh_HK]=名稱 +Name[zh_TW]=名稱 +Comment=Comment +Comment[ar]=تعليق +Comment[bg]=Коментар +Comment[br]=Askelenn +Comment[bs]=Komentar +Comment[ca]=Comentari +Comment[cy]=Sylwad +Comment[da]=Kommentar +Comment[de]=Kommentar +Comment[el]=Σχόλιο +Comment[eo]=Komento +Comment[es]=Comentario +Comment[et]=Kommentaar +Comment[eu]=Iruzkina +Comment[fa]=توضیح +Comment[fi]=Kommentti +Comment[fr]=Commentaire +Comment[ga]=Nóta +Comment[gl]=Comentario +Comment[he]=הערה +Comment[hi]=टिप्पणी +Comment[hu]=Megjegyzés +Comment[is]=Athugasemd +Comment[it]=Commento +Comment[ja]=コメント +Comment[kk]=Түсініктемесі +Comment[km]=សេចក្ដីអធិប្បាយ +Comment[lt]=Komentaras +Comment[ms]=Komen +Comment[nb]=Kommentar +Comment[nds]=Kommentar +Comment[ne]=टिप्पणी +Comment[nl]=Omschrijving +Comment[nn]=Kommentar +Comment[pa]=ਟਿੱਪਣੀ +Comment[pl]=Komentarz +Comment[pt]=Comentário +Comment[pt_BR]=Comentário +Comment[ro]=Comentariu +Comment[ru]=Комментарий +Comment[se]=Kommeanta +Comment[sk]=Komentár +Comment[sl]=Komentar +Comment[sr]=Коментар +Comment[sr@Latn]=Komentar +Comment[sv]=Kommentar +Comment[ta]=குறிப்பு +Comment[tg]=Эзоҳ +Comment[tr]=Açıklama +Comment[uk]=Коментар +Comment[uz]=Izoh +Comment[uz@cyrillic]=Изоҳ +Comment[wa]=Rawete +Comment[zh_CN]=注释 +Comment[zh_HK]=註解 +Comment[zh_TW]=註解 diff --git a/kview/modules/presenter/config/kviewpresenterconfig.h b/kview/modules/presenter/config/kviewpresenterconfig.h new file mode 100644 index 00000000..c839690a --- /dev/null +++ b/kview/modules/presenter/config/kviewpresenterconfig.h @@ -0,0 +1,46 @@ +/* This file is part of the KDE project + Copyright (C) 2002-2003 Matthias Kretz <[email protected]> + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 + as published by the Free Software Foundation. + + 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; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +*/ + +#ifndef KVIEWPRESENTERCONFIG_H +#define KVIEWPRESENTERCONFIG_H + +#include <kcmodule.h> + +class QCheckBox; + +class KViewPresenterConfig : public KCModule +{ + Q_OBJECT + public: + KViewPresenterConfig( QWidget * parent, const char * name = 0, const QStringList & args = QStringList() ); + ~KViewPresenterConfig(); + + virtual void load(); + virtual void save(); + virtual void defaults(); + + private slots: + void checkChanged(); + + private: + QCheckBox * m_pCheckBox; +}; + +// vim:sw=4:ts=4 + +#endif // KVIEWPRESENTERCONFIG_H diff --git a/kview/modules/presenter/imagelistdialog.ui b/kview/modules/presenter/imagelistdialog.ui new file mode 100644 index 00000000..66d9e9b5 --- /dev/null +++ b/kview/modules/presenter/imagelistdialog.ui @@ -0,0 +1,289 @@ +<!DOCTYPE UI><UI version="3.2" stdsetdef="1"> +<class>ImageListDialog</class> +<author>Matthias Kretz <[email protected]></author> +<widget class="KDialog"> + <property name="name"> + <cstring>ImageListDialog</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>724</width> + <height>409</height> + </rect> + </property> + <property name="caption"> + <string>Image List</string> + </property> + <property name="acceptDrops"> + <bool>true</bool> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="KListView"> + <column> + <property name="text"> + <string>URL</string> + </property> + <property name="clickable"> + <bool>true</bool> + </property> + <property name="resizable"> + <bool>true</bool> + </property> + </column> + <column> + <property name="text"> + <string>Size</string> + </property> + <property name="clickable"> + <bool>true</bool> + </property> + <property name="resizable"> + <bool>true</bool> + </property> + </column> + <column> + <property name="text"> + <string>Dimensions</string> + </property> + <property name="clickable"> + <bool>true</bool> + </property> + <property name="resizable"> + <bool>true</bool> + </property> + </column> + <property name="name"> + <cstring>m_pListView</cstring> + </property> + <property name="minimumSize"> + <size> + <width>400</width> + <height>0</height> + </size> + </property> + <property name="acceptDrops"> + <bool>true</bool> + </property> + <property name="allColumnsShowFocus"> + <bool>true</bool> + </property> + <property name="showSortIndicator"> + <bool>true</bool> + </property> + <property name="fullWidth"> + <bool>true</bool> + </property> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>Layout4</cstring> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>Layout2</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="KPushButton"> + <property name="name"> + <cstring>m_pPrevious</cstring> + </property> + <property name="text"> + <string>&Previous</string> + </property> + <property name="autoDefault"> + <bool>false</bool> + </property> + </widget> + <widget class="KPushButton"> + <property name="name"> + <cstring>m_pNext</cstring> + </property> + <property name="text"> + <string>&Next</string> + </property> + <property name="autoDefault"> + <bool>false</bool> + </property> + </widget> + </hbox> + </widget> + <widget class="KPushButton"> + <property name="name"> + <cstring>m_pShuffle</cstring> + </property> + <property name="text"> + <string>Shu&ffle</string> + </property> + <property name="autoDefault"> + <bool>false</bool> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>Spacer3</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Fixed</enum> + </property> + <property name="sizeHint"> + <size> + <width>16</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="KPushButton"> + <property name="name"> + <cstring>m_pSlideshow</cstring> + </property> + <property name="text"> + <string>Start &Slideshow</string> + </property> + <property name="toggleButton"> + <bool>true</bool> + </property> + <property name="autoDefault"> + <bool>false</bool> + </property> + </widget> + <widget class="KIntNumInput"> + <property name="name"> + <cstring>m_pInterval</cstring> + </property> + <property name="label"> + <string>Slideshow interval:</string> + </property> + <property name="value"> + <number>5000</number> + </property> + <property name="suffix"> + <string> ms</string> + </property> + <property name="whatsThis" stdset="0"> + <string>This is the interval the program will wait before showing the next image in the slideshow.</string> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>Spacer4</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>MinimumExpanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>80</height> + </size> + </property> + </spacer> + <widget class="KPushButton"> + <property name="name"> + <cstring>m_pCloseAll</cstring> + </property> + <property name="text"> + <string>&Close All</string> + </property> + <property name="autoDefault"> + <bool>false</bool> + </property> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>Layout4</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="KPushButton"> + <property name="name"> + <cstring>m_pSave</cstring> + </property> + <property name="text"> + <string>Sa&ve List...</string> + </property> + <property name="autoDefault"> + <bool>false</bool> + </property> + </widget> + <widget class="KPushButton"> + <property name="name"> + <cstring>m_pLoad</cstring> + </property> + <property name="text"> + <string>&Load List...</string> + </property> + <property name="autoDefault"> + <bool>false</bool> + </property> + </widget> + </hbox> + </widget> + </vbox> + </widget> + </hbox> +</widget> +<customwidgets> +</customwidgets> +<connections> + <connection> + <sender>m_pListView</sender> + <signal>aboutToMove()</signal> + <receiver>ImageListDialog</receiver> + <slot>noSort()</slot> + </connection> +</connections> +<includes> + <include location="global" impldecl="in declaration">kdialog.h</include> + <include location="global" impldecl="in implementation">kdebug.h</include> + <include location="global" impldecl="in implementation">kimageviewer/viewer.h</include> + <include location="global" impldecl="in implementation">kio/netaccess.h</include> + <include location="global" impldecl="in implementation">kurl.h</include> + <include location="global" impldecl="in implementation">kfiledialog.h</include> + <include location="global" impldecl="in implementation">qstring.h</include> + <include location="global" impldecl="in implementation">kmessagebox.h</include> + <include location="local" impldecl="in implementation">imagelistitem.h</include> + <include location="local" impldecl="in implementation">imagelistdialog.ui.h</include> +</includes> +<forwards> + <forward>class KURL</forward> +</forwards> +<slots> + <slot access="private" specifier="non virtual">init()</slot> + <slot specifier="non virtual">noSort()</slot> +</slots> +<layoutdefaults spacing="6" margin="11"/> +<layoutfunctions spacing="KDialog::spacingHint" margin="KDialog::marginHint"/> +<includehints> + <includehint>kdialog.h</includehint> + <includehint>klistview.h</includehint> + <includehint>kpushbutton.h</includehint> + <includehint>kpushbutton.h</includehint> + <includehint>kpushbutton.h</includehint> + <includehint>kpushbutton.h</includehint> + <includehint>knuminput.h</includehint> + <includehint>knuminput.h</includehint> + <includehint>kpushbutton.h</includehint> + <includehint>kpushbutton.h</includehint> + <includehint>kpushbutton.h</includehint> +</includehints> +</UI> diff --git a/kview/modules/presenter/imagelistdialog.ui.h b/kview/modules/presenter/imagelistdialog.ui.h new file mode 100644 index 00000000..ce97754e --- /dev/null +++ b/kview/modules/presenter/imagelistdialog.ui.h @@ -0,0 +1,23 @@ +/**************************************************************************** +** ui.h extension file, included from the uic-generated form implementation. +** +** If you wish to add, delete or rename slots use Qt Designer which will +** update this file, preserving your code. Create an init() slot in place of +** a constructor, and a destroy() slot in place of a destructor. +*****************************************************************************/ + +void ImageListDialog::init() +{ + kdDebug( 4630 ) << k_funcinfo << endl; + m_pInterval->setRange( 0, 60000, 1000 ); + noSort(); +} + + +void ImageListDialog::noSort() +{ + kdDebug( 4630 ) << k_funcinfo << endl; + m_pListView->setSorting( 1000 ); +} + + diff --git a/kview/modules/presenter/imagelistitem.cpp b/kview/modules/presenter/imagelistitem.cpp new file mode 100644 index 00000000..4236dfe7 --- /dev/null +++ b/kview/modules/presenter/imagelistitem.cpp @@ -0,0 +1,82 @@ +/* This file is part of the KDE project + Copyright (C) 2002 Matthias Kretz <[email protected]> + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 + as published by the Free Software Foundation. + + 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; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +*/ + +// $Id$ + +#include "imagelistitem.h" + +#include <qimage.h> + +#include <klistview.h> + +ImageListItem::ImageListItem( KListView * parent, const KURL & url ) + : KListViewItem( parent, parent->lastItem(), url.prettyURL() ) + , m_pImage( 0 ) + , m_filename( QString::null ) + , m_url( url ) +{ + setDragEnabled( true ); + if( m_url.isLocalFile() ) + { + m_filename = m_url.path(); + } + else + { + // download file + /* + QString extension; + QString fileName = m_url.fileName(); + int extensionPos = fileName.findRev( '.' ); + if ( extensionPos != -1 ) + extension = fileName.mid( extensionPos ); // keep the '.' + delete m_pTempFile; + m_pTempFile = new KTempFile( QString::null, extension ); + m_filename = m_pTempFile->name(); + + m_pJob = KIO::get( m_url, m_pExtension->urlArgs().reload, false ); + */ + } +} + +ImageListItem::~ImageListItem() +{ + if( ! m_url.isLocalFile() ) + { + // remove downloaded tempfile + //KIO::NetAccess::removeTempFile( m_filename ); + } +} + +const QImage * ImageListItem::image() const +{ + return m_pImage; +} + +const QString & ImageListItem::file() const +{ + if( m_url.isLocalFile() ) + return QString::null; + return m_filename; +} + +const KURL & ImageListItem::url() const +{ + return m_url; +} + +// vim:sw=4:ts=4 diff --git a/kview/modules/presenter/imagelistitem.h b/kview/modules/presenter/imagelistitem.h new file mode 100644 index 00000000..63761af8 --- /dev/null +++ b/kview/modules/presenter/imagelistitem.h @@ -0,0 +1,49 @@ +/* This file is part of the KDE project + Copyright (C) 2002 Matthias Kretz <[email protected]> + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 + as published by the Free Software Foundation. + + 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; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +*/ + +// $Id$ + +#ifndef IMAGELISTITEM_H +#define IMAGELISTITEM_H + +#include <klistview.h> +#include <kurl.h> +#include <qstring.h> + +class QImage; + +class ImageListItem : public KListViewItem +{ + public: + ImageListItem( KListView * parent, const KURL & url ); + ~ImageListItem(); + + const QImage * image() const; + const QString & file() const; + const KURL & url() const; + + virtual int rtti() const { return 48294; } + + private: + QImage * m_pImage; + QString m_filename; + KURL m_url; +}; + +// vim:sw=4:ts=4 +#endif // IMAGELISTITEM_H diff --git a/kview/modules/presenter/kviewpresenter.cpp b/kview/modules/presenter/kviewpresenter.cpp new file mode 100644 index 00000000..bbc5e8eb --- /dev/null +++ b/kview/modules/presenter/kviewpresenter.cpp @@ -0,0 +1,492 @@ +/* This file is part of the KDE project + Copyright (C) 2002 Matthias Kretz <[email protected]> + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 + as published by the Free Software Foundation. + + 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; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +*/ + +/* $Id$ */ + +#include "kviewpresenter.h" +#include "imagelistdialog.h" +#include "imagelistitem.h" + +#include <qvbox.h> +#include <qobjectlist.h> +#include <qsignalslotimp.h> +#include <qtimer.h> +#include <qevent.h> +#include <qdragobject.h> +#include <qstringlist.h> + +#include <kpushbutton.h> +#include <kapplication.h> +#include <kaction.h> +#include <klocale.h> +#include <kgenericfactory.h> +#include <kdebug.h> +#include <kglobal.h> +#include <kiconloader.h> +#include <knuminput.h> +#include <kfiledialog.h> +#include <kimageio.h> +#include <kimageviewer/viewer.h> +#include <kimageviewer/canvas.h> +#include <kio/netaccess.h> +#include <kmessagebox.h> +#include <ktempfile.h> +#include <kurldrag.h> + +typedef KGenericFactory<KViewPresenter> KViewPresenterFactory; +K_EXPORT_COMPONENT_FACTORY( kview_presenterplugin, KViewPresenterFactory( "kviewpresenterplugin" ) ) + +KViewPresenter::KViewPresenter( QObject* parent, const char* name, const QStringList & ) + : Plugin( parent, name ) + , m_pImageList( new ImageListDialog() ) + , m_paFileOpen( 0 ) + , m_bDontAdd( false ) + , m_pCurrentItem( 0 ) + , m_pSlideshowTimer( new QTimer( this ) ) +{ + kdDebug( 4630 ) << k_funcinfo << endl; + m_imagelist.setAutoDelete( true ); + + QObjectList * viewerList = parent->queryList( 0, "KImageViewer Part", false, false ); + m_pViewer = static_cast<KImageViewer::Viewer *>( viewerList->getFirst() ); + delete viewerList; + if( m_pViewer ) + { + ( void ) new KAction( i18n( "&Image List..." ), 0, 0, + this, SLOT( slotImageList() ), + actionCollection(), "plugin_presenter_imageList" ); + m_paSlideshow = new KToggleAction( i18n( "Start &Slideshow" ), Key_S, actionCollection(), "plugin_presenter_slideshow" ); + ( void ) new KAction( i18n( "&Previous Image in List" ), "previous", ALT+Key_Left, + this, SLOT( prev() ), + actionCollection(), "plugin_presenter_prev" ); + ( void ) new KAction( i18n( "&Next Image in List" ), "next", ALT+Key_Right, + this, SLOT( next() ), + actionCollection(), "plugin_presenter_next" ); + + connect( m_paSlideshow, SIGNAL( toggled( bool ) ), m_pImageList->m_pSlideshow, SLOT( setOn( bool ) ) ); + connect( m_pImageList->m_pSlideshow, SIGNAL( toggled( bool ) ), m_paSlideshow, SLOT( setChecked( bool ) ) ); + + // search for file_open action + KXMLGUIClient * parentClient = static_cast<KXMLGUIClient*>( parent->qt_cast( "KXMLGUIClient" ) ); + if( parentClient ) + { + m_paFileOpen = parentClient->actionCollection()->action( "file_open" ); + m_paFileClose = parentClient->actionCollection()->action( "file_close" ); + } + if( m_paFileClose ) + connect( m_paFileClose, SIGNAL( activated() ), this, SLOT( slotClose() ) ); + if( m_paFileOpen ) + { + disconnect( m_paFileOpen, SIGNAL( activated() ), parent, SLOT( slotOpenFile() ) ); + connect( m_paFileOpen, SIGNAL( activated() ), this, SLOT( slotOpenFiles() ) ); + } + else + { + (void) new KAction( i18n( "Open &Multiple Files..." ), "queue", CTRL+SHIFT+Key_O, + this, SLOT( slotOpenFiles() ), + actionCollection(), "plugin_presenter_openFiles" ); + } + connect( m_pViewer, SIGNAL( imageOpened( const KURL & ) ), + SLOT( slotImageOpened( const KURL & ) ) ); + } + else + kdWarning( 4630 ) << "no KImageViewer interface found - the presenter plugin won't work" << endl; + + //( void )new KViewPresenterConfModule( this ); + + connect( m_pImageList->m_pListView, SIGNAL( executed( QListViewItem* ) ), + this, SLOT( changeItem( QListViewItem* ) ) ); + connect( m_pImageList->m_pPrevious, SIGNAL( clicked() ), + this, SLOT( prev() ) ); + connect( m_pImageList->m_pNext, SIGNAL( clicked() ), + this, SLOT( next() ) ); + connect( m_pImageList->m_pListView, SIGNAL( spacePressed( QListViewItem* ) ), + this, SLOT( changeItem( QListViewItem* ) ) ); + connect( m_pImageList->m_pListView, SIGNAL( returnPressed( QListViewItem* ) ), + this, SLOT( changeItem( QListViewItem* ) ) ); + connect( m_pImageList->m_pSlideshow, SIGNAL( toggled( bool ) ), + this, SLOT( slideshow( bool ) ) ); + connect( m_pImageList->m_pInterval, SIGNAL( valueChanged( int ) ), + this, SLOT( setSlideshowInterval( int ) ) ); + connect( m_pImageList->m_pShuffle, SIGNAL( clicked() ), + this, SLOT( shuffle() ) ); + connect( m_pImageList->m_pLoad, SIGNAL( clicked() ), + this, SLOT( loadList() ) ); + connect( m_pImageList->m_pSave, SIGNAL( clicked() ), + this, SLOT( saveList() ) ); + connect( m_pImageList->m_pCloseAll, SIGNAL( clicked() ), + this, SLOT( closeAll() ) ); + + // allow drop on the dialog + m_pImageList->installEventFilter( this ); + m_pImageList->m_pListView->installEventFilter( this ); + m_pImageList->m_pListView->viewport()->installEventFilter( this ); + + // grab drops on the main view + m_pViewer->widget()->installEventFilter( this ); + + connect( m_pSlideshowTimer, SIGNAL( timeout() ), + this, SLOT( next() ) ); +} + +KViewPresenter::~KViewPresenter() +{ + kdDebug( 4630 ) << k_funcinfo << endl; + if( m_paFileOpen ) + { + disconnect( m_paFileOpen, SIGNAL( activated() ), this, SLOT( slotOpenFiles() ) ); + // If the parent() doesn't exist we either leave the "File Open" action + // in an unusable state or KView was just shutting down and therefor we + // can ignore this. I've only seen the second one happening and to get + // rid of the QObject::connect warning we do the parent() check. + if( parent() ) + connect( m_paFileOpen, SIGNAL( activated() ), parent(), SLOT( slotOpenFile() ) ); + } +} + +bool KViewPresenter::eventFilter( QObject *obj, QEvent *ev ) +{ + if( obj == m_pImageList || obj == m_pImageList->m_pListView || obj == m_pImageList->m_pListView->viewport() || obj == m_pViewer->widget() ) + { + switch( ev->type() ) + { + case QEvent::DragEnter: + case QEvent::DragMove: + { + // drag enter event in the image list + //kdDebug( 4630 ) << "DragEnterEvent in the image list: " << obj->className() << endl; + QDragEnterEvent * e = static_cast<QDragEnterEvent*>( ev ); + //for( int i = 0; e->format( i ); ++i ) + //kdDebug( 4630 ) << " - " << e->format( i ) << endl; + if( KURLDrag::canDecode( e ) )// || QImageDrag::canDecode( e ) ) + { + e->accept(); + return true; + } + } + case QEvent::Drop: + { + // drop event in the image list + kdDebug( 4630 ) << "DropEvent in the image list: " << obj->className() << endl; + QDropEvent * e = static_cast<QDropEvent*>( ev ); + QStringList l; + //QImage image; + if( KURLDrag::decodeToUnicodeUris( e, l ) ) + { + for( QStringList::const_iterator it = l.begin(); it != l.end(); ++it ) + { + ImageInfo * info = new ImageInfo( KURL( *it ) ); + if( ! m_imagelist.contains( info ) ) + { + m_imagelist.inSort( info ); + ( void )new ImageListItem( m_pImageList->m_pListView, KURL( *it ) ); + } + else + delete info; + } + return true; + } + //else if( QImageDrag::decode( e, image ) ) + //newImage( image ); + } + default: // do nothing + break; + } + } + return KParts::Plugin::eventFilter( obj, ev ); +} + +void KViewPresenter::slotImageOpened( const KURL & url ) +{ + kdDebug( 4630 ) << k_funcinfo << endl; + if( ! m_bDontAdd ) + { + kdDebug( 4630 ) << k_funcinfo << "imagelist:" << endl; + ImageInfo * info = new ImageInfo( url ); + if( ! m_imagelist.contains( info ) ) + { + m_imagelist.inSort( info ); + QListViewItem * item = new ImageListItem( m_pImageList->m_pListView, url ); + makeCurrent( item ); + } + else + delete info; + } +} + +void KViewPresenter::slotImageList() +{ + kdDebug( 4630 ) << k_funcinfo << endl; + m_pImageList->show(); +} + +void KViewPresenter::slotOpenFiles() +{ + kdDebug( 4630 ) << k_funcinfo << endl; + KURL::List urls = KFileDialog::getOpenURLs( ":load_image", KImageIO::pattern( KImageIO::Reading ), m_pViewer->widget() ); + + if( urls.isEmpty() ) + return; + + KURL::List::Iterator it = urls.begin(); + m_pViewer->openURL( *it ); + for( ++it; it != urls.end(); ++it ) + { + ImageInfo * info = new ImageInfo( *it ); + if( ! m_imagelist.contains( info ) ) + { + m_imagelist.inSort( info ); + ( void )new ImageListItem( m_pImageList->m_pListView, *it ); + } + else + delete info; + } +} + +void KViewPresenter::slotClose() +{ + QListViewItem * next = m_pCurrentItem->itemBelow() ? m_pCurrentItem->itemBelow() : m_pImageList->m_pListView->firstChild(); + if( next == m_pCurrentItem ) + next = 0; + + ImageInfo info( m_pCurrentItem->url() ); + m_imagelist.remove( &info ); + delete m_pCurrentItem; + m_pCurrentItem = 0; + + if( next ) + changeItem( next ); +} + +void KViewPresenter::changeItem( QListViewItem * qitem ) +{ + kdDebug( 4630 ) << k_funcinfo << endl; + if( qitem->rtti() == 48294 ) + { + ImageListItem * item = static_cast<ImageListItem*>( qitem ); + if( ! item->url().isEmpty() ) + { + if( item->url().isLocalFile() && ! QFile::exists( item->url().path() ) ) + { + kdDebug( 4630 ) << "file doesn't exist. removed." << endl; + ImageInfo info( item->url() ); + m_imagelist.remove( &info ); + if( m_pCurrentItem == item ) + { + QListViewItem * next = m_pCurrentItem->itemBelow() ? m_pCurrentItem->itemBelow() : m_pImageList->m_pListView->firstChild(); + if( next->rtti() != 48294 ) + kdWarning( 4630 ) << "unknown ListView item" << endl; + else + m_pCurrentItem = static_cast<ImageListItem*>( next ); + + if( m_pCurrentItem == item ) + m_pCurrentItem = 0; // don't create a dangling pointer + delete item; + if( m_pCurrentItem ) + changeItem( m_pCurrentItem ); + } + else + { + delete item; + next(); + } + return; + } + kdDebug( 4630 ) << "got url" << endl; + makeCurrent( qitem ); + + bool dontadd = m_bDontAdd; + m_bDontAdd = true; + m_pViewer->openURL( item->url() ); + m_bDontAdd = dontadd; + } + else + kdWarning( 4630 ) << "got nothing" << endl; + } + else + kdWarning( 4630 ) << "unknown ListView item" << endl; +} + +void KViewPresenter::prev() +{ + kdDebug( 4630 ) << k_funcinfo << endl; + if( m_pCurrentItem ) + { + QListViewItem * prev = m_pCurrentItem->itemAbove() ? m_pCurrentItem->itemAbove() : m_pImageList->m_pListView->lastItem(); + if( prev ) + changeItem( prev ); + } +} + +void KViewPresenter::next() +{ + kdDebug( 4630 ) << k_funcinfo << endl; + if( m_pCurrentItem ) + { + QListViewItem * next = m_pCurrentItem->itemBelow() ? m_pCurrentItem->itemBelow() : m_pImageList->m_pListView->firstChild(); + if( next ) + changeItem( next ); + } +} + +void KViewPresenter::makeCurrent( QListViewItem * item ) +{ + if( m_pCurrentItem ) + m_pCurrentItem->setPixmap( 0, QPixmap() ); + if( item->rtti() != 48294 ) + kdWarning( 4630 ) << "unknown ListView item" << endl; + else + { + m_pCurrentItem = static_cast<ImageListItem*>( item ); + m_pCurrentItem->setPixmap( 0, KGlobal::iconLoader()->loadIcon( "1rightarrow", KIcon::Small ) ); + m_pImageList->m_pListView->ensureItemVisible( m_pCurrentItem ); + } +} + +void KViewPresenter::slideshow( bool running ) +{ + if( running ) + { + m_pSlideshowTimer->start( m_pImageList->m_pInterval->value() ); + actionCollection()->action( "plugin_presenter_slideshow" )->setText( i18n( "Stop &Slideshow" ) ); + m_pImageList->m_pSlideshow->setText( i18n( "Stop &Slideshow" ) ); + } + else + { + m_pSlideshowTimer->stop(); + actionCollection()->action( "plugin_presenter_slideshow" )->setText( i18n( "Start &Slideshow" ) ); + m_pImageList->m_pSlideshow->setText( i18n( "Start &Slideshow" ) ); + } +} + +void KViewPresenter::setSlideshowInterval( int msec ) +{ + if( m_pSlideshowTimer->isActive() ) + m_pSlideshowTimer->changeInterval( msec ); +} + +void KViewPresenter::shuffle() +{ + m_pImageList->noSort(); + KListView * listview = m_pImageList->m_pListView; + QPtrList<QListViewItem> items; + for( QListViewItem * item = listview->firstChild(); item; item = listview->firstChild() ) + { + items.append( item ); + listview->takeItem( item ); + } + while( ! items.isEmpty() ) + listview->insertItem( items.take( KApplication::random() % items.count() ) ); +} + +void KViewPresenter::closeAll() +{ + m_imagelist.clear(); + m_pImageList->m_pListView->clear(); + m_pCurrentItem = 0; + if( m_pViewer->closeURL() ) + m_pViewer->canvas()->clear(); +} + +void KViewPresenter::loadList() +{ + KURL url = KFileDialog::getOpenURL( ":load_list", QString::null, m_pImageList ); + if( url.isEmpty() ) + return; + + QString tempfile; + if( ! KIO::NetAccess::download( url, tempfile, m_pViewer->widget() ) ) + { + KMessageBox::error( m_pImageList, i18n( "Could not load\n%1" ).arg( url.prettyURL() ) ); + return; + } + QFile file( tempfile ); + if( file.open( IO_ReadOnly ) ) + { + QTextStream t( &file ); + if( t.readLine() == "[KView Image List]" ) + { + //clear old image list + closeAll(); + + QStringList list; + if( ! t.eof() ) + m_pViewer->openURL( KURL( t.readLine() ) ); + while( ! t.eof() ) + { + KURL url ( t.readLine() ); + ImageInfo * info = new ImageInfo( url ); + if( ! m_imagelist.contains( info ) ) + { + m_imagelist.inSort( info ); + ( void )new ImageListItem( m_pImageList->m_pListView, url ); + } + else + delete info; + } + } + else + { + KMessageBox::error( m_pImageList, i18n( "Wrong format\n%1" ).arg( url.prettyURL() ) ); + } + file.close(); + } + KIO::NetAccess::removeTempFile( tempfile ); +} + +void KViewPresenter::saveList() +{ + KURL url = KFileDialog::getSaveURL( ":save_list", QString::null, m_pImageList ); + + if( url.isEmpty() ) + return; + + QString tempfile; + if( url.isLocalFile() ) + tempfile = url.path(); + else + { + KTempFile ktempf; + tempfile = ktempf.name(); + } + + QFile file( tempfile ); + if( file.open( IO_WriteOnly ) ) + { + QTextStream t( &file ); + // write header + t << "[KView Image List]" << endl; + QListViewItem * item = m_pImageList->m_pListView->firstChild(); + while( item ) + { + if( item->rtti() == 48294 ) + t << static_cast<ImageListItem*>( item )->url().url() << endl; + item = item->itemBelow(); + } + file.close(); + + if( ! url.isLocalFile() ) + { + KIO::NetAccess::upload( tempfile, url, m_pViewer->widget() ); + KIO::NetAccess::removeTempFile( tempfile ); + } + } +} + +// vim:sw=4:ts=4 +#include "kviewpresenter.moc" diff --git a/kview/modules/presenter/kviewpresenter.desktop b/kview/modules/presenter/kviewpresenter.desktop new file mode 100644 index 00000000..7059caba --- /dev/null +++ b/kview/modules/presenter/kviewpresenter.desktop @@ -0,0 +1,118 @@ +[Desktop Entry] +Icon=presenter +Type=Service +ServiceTypes=KPluginInfo + +X-KDE-PluginInfo-Author=Matthias Kretz +X-KDE-PluginInfo-Name=kviewpresenter +X-KDE-PluginInfo-Version=1.1 +X-KDE-PluginInfo-License=GPL +X-KDE-PluginInfo-EnabledByDefault=true + +Name=Presenter +Name[ar]=المقدّم +Name[bg]=Презентация +Name[br]=Emginniger +Name[bs]=Prezentator +Name[ca]=Presentador +Name[cs]=Prezentace +Name[cy]=Cyflwynydd +Name[de]=Präsentationsprogramm +Name[el]=Παρουσιαστής +Name[eo]=Prezentilo +Name[et]=Esitleja +Name[eu]=Aurkezlea +Name[fa]=ارائهکننده +Name[fi]=Esitysohjelma +Name[fr]=Présentateur +Name[ga]=Láithreoir +Name[gl]=Escaparate +Name[he]=מצגות +Name[hi]=प्रस्तुतकर्ता +Name[hr]=Prezentator +Name[hu]=Bemutató +Name[it]=Presentazione +Name[ja]=プレゼンタ +Name[kk]=Презентатор +Name[km]=កម្មវិធីបង្ហាញ +Name[lt]=Pristatytojas +Name[ms]=Penyampai +Name[nds]=Präsentatschoonprogramm +Name[ne]=प्रस्तोता +Name[nl]=Presentatieprogramma +Name[nso]=Mohlagisi +Name[pa]=ਪੇਸ਼ਕਾਰ +Name[pl]=Prezenter +Name[pt]=Apresentador +Name[pt_BR]=Apresentador +Name[ro]=Prezentare +Name[ru]=Презентатор +Name[sk]=Vytvorenie prezentácie +Name[sl]=Predstavitelj +Name[sr]=Презентер +Name[sr@Latn]=Prezenter +Name[sv]=Presentationer +Name[ta]=வழங்குபவர் +Name[tg]=Презентатор +Name[tr]=Sunum Aracı +Name[ven]=Mulanguli +Name[xh]=Umbonisi +Name[zh_CN]=演示板 +Name[zh_HK]=簡報器 +Name[zh_TW]=簡報 +Name[zu]=Umnikeli +Comment=Creates an imagelist and enables you to create a slideshow +Comment[ar]=ينشئ قائمة صور ويمكنك من استعراض الصور تلقائيا +Comment[bg]=Създаване на списък с изображения и слайдшоу от тях +Comment[bs]=Pravi listu slika i omogućuje vam da napravite slide show +Comment[ca]=Crea una llista d'imatges i us permet crear un passi de diapositives +Comment[cs]=Vytvoří seznam obrázků a umožní vám z nich vytvořit slideshow. +Comment[cy]=Creu rhestr delweddau ac alluogi i chi greu sioe haenluniau +Comment[da]=Laver en billedliste og giver dig muligheden for at lave et diasshow +Comment[de]=Erzeugt eine Bilderliste und ermöglicht das Erstellen von Diashows +Comment[el]=Δημιουργεί μια λίστα εικόνων και σας επιτρέπει να δημιουργήσετε μια προβολή σλάιντ +Comment[es]=Crea una lista de imágenes ofreciendole la posibilidad de crear una animación de diapositivas +Comment[et]=Loob piltide nimekirja ja laseb selle põhjal luua slaidiseansi +Comment[eu]=Irudi-zerrenda bat sortzen du eta diapositiba-aurkezpena egiten du +Comment[fa]=یک فهرست تصویر ایجاد میکند و شما را قادر به ایجاد یک نمایش اسلاید میکند +Comment[fi]=Luo kuvalistan ja mahdollistaa esityksen luomisen +Comment[fr]=Crée une liste d'images et vous permet de créer un diaporama +Comment[gl]=Crea unha lista de imaxes e permite crear unha moviola +Comment[he]=יוצר רשימת תמונות ומאפשר לך ליצור מצגת שקופיות +Comment[hi]=एक छवि-सूची बनाता है तथा आपको एक स्लाइड-शो तैयार करने में सक्षम बनाता है +Comment[hu]=Képsorozat összeállítását és bemutatását teszi lehetővé +Comment[is]=Býr til myndlista og gerir þér kleyft að búa til myndsýningu +Comment[it]=Crea una lista di immagini e permette di creare una presentazione +Comment[ja]=画像リストを作成し、スライドショーを作成します +Comment[kk]=Слайд-шоу көрсетуге кескіндер тізімін дайындау +Comment[km]=បង្កើតបញ្ជីរូបភាព ហើយអាចឲ្យអ្នកបង្កើតជាការបញ្ចាំងស្លាយ +Comment[lt]=Sukuria paveikslėlių sąrašą ir leidžia jums sukurti skaidrių peržiūrą +Comment[ms]=Cipta senarai imej dan membolehkan anda mencipta tayangan slaid +Comment[nb]=Oppretter en bildeliste og lar deg lage en lysbildeserie +Comment[nds]=Stellt en Bildlist op un lett Di en Diaschau opstellen +Comment[ne]=छवि सूची सिर्जना गर्दछ र तपाईँलाई स्लाइड प्रर्दशन सिर्जना गर्न सक्षम पार्दछ +Comment[nl]=Maakt een afbeeldingenlijst waarmee u een diashow kunt maken +Comment[nn]=Lagar ei biletliste du kan bruka til framvising +Comment[nso]=Hlagisa palo ya ponagalo gape ego dumelela go hlagisa slidesshow +Comment[pl]=Tworzy listę obrazków i umożliwia tworzenie z niej pokazu slajdów +Comment[pt]=Cria uma lista de imagens e permite-lhe criar uma apresentação +Comment[pt_BR]=Cria uma lista de imagens e habilita você a criar uma exibição de slides +Comment[ro]=Creează o listă de imagini şi vă permite să reallizaţi o succesiune de imagini +Comment[ru]=Создание галерей изображений и просмотр их в качестве слайдов +Comment[se]=Ráhkada govvalisttu ja diktá du ráhkadit govvačájeheami +Comment[sk]=Vytvorí zoznam obrázok a umožní z nich vytvoriť prezentáciu +Comment[sl]=Ustvari seznam slik in vam omogoča ustvariti predstavitev +Comment[sr]=Прави листу слика и омогућава вам да направите слајд-шоу +Comment[sr@Latn]=Pravi listu slika i omogućava vam da napravite slajd-šou +Comment[sv]=Skapar en bildlista och ger dig möjlighet att göra ett bildspel +Comment[ta]=திரைக் காட்சிக்கான பிம்ப பட்டியலை உருவாக்கலாம் +Comment[tg]=Эҷоди нигористони тасвирот ва намоиши онҳо ҳамчун слайд +Comment[tr]=Bir resim listesi oluşturur ve slayt gösterisi yapmanıza olanak tanır +Comment[uk]=Створює список зображень та дозволяє створювати презентацію слайдів +Comment[ven]=Iita mutevhe wa tshifanyiso ya dovha yani tendela uita tsumbedzo ya tshilaidi +Comment[xh]=Yenza uluhlu lwemifanekiso ekuvumela ukwazi ukwenza umboniso wotyibiliko +Comment[zh_CN]=创建图像列表,并能为您创建幻灯片 +Comment[zh_HK]=建立圖像清單並讓您能建立幻燈片式放映 +Comment[zh_TW]=建立影像清單並讓您能建立幻燈片式放映 +Comment[zu]=Idala uhlu lwesithombe futhi ikuvumela wena ukuba udale umbukiso wesithombe esishibilikayo diff --git a/kview/modules/presenter/kviewpresenter.h b/kview/modules/presenter/kviewpresenter.h new file mode 100644 index 00000000..29fc106b --- /dev/null +++ b/kview/modules/presenter/kviewpresenter.h @@ -0,0 +1,103 @@ +/* This file is part of the KDE project + Copyright (C) 2002 Matthias Kretz <[email protected]> + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 + as published by the Free Software Foundation. + + 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; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +*/ + +/* $Id$ */ + +#ifndef __kviewpresenter_h +#define __kviewpresenter_h + +#include <kparts/plugin.h> +#include <kurl.h> + +#include <qsortedlist.h> + +namespace KImageViewer { class Viewer; } + +class ImageListDialog; +class ImageListItem; +class QListViewItem; +class QTimer; +class KToggleAction; +class KAction; + +class KViewPresenter : public KParts::Plugin +{ + Q_OBJECT +public: + KViewPresenter( QObject* parent, const char* name, const QStringList & ); + virtual ~KViewPresenter(); + +protected: + struct ImageInfo + { + KURL url; + ImageInfo( const KURL & url ) + : url( url ) + { + } + bool operator==( const ImageInfo & i1 ) + { + return url.prettyURL() == i1.url.prettyURL(); + } + bool operator!=( const ImageInfo & i1 ) + { + return url.prettyURL() == i1.url.prettyURL(); + } + bool operator>( const ImageInfo & i1 ) + { + return url.prettyURL() > i1.url.prettyURL(); + } + bool operator<( const ImageInfo & i1 ) + { + return url.prettyURL() < i1.url.prettyURL(); + } + }; + bool eventFilter( QObject *, QEvent * ); + +private slots: + void slotImageOpened( const KURL & ); + void slotImageList(); + void slotOpenFiles(); + void slotClose(); + void changeItem( QListViewItem * ); + void prev(); + void next(); + void slideshow( bool ); + void setSlideshowInterval( int ); + void shuffle(); + void closeAll(); + void loadList(); + void saveList(); + +private: + void makeCurrent( QListViewItem * ); + + KImageViewer::Viewer * m_pViewer; + ImageListDialog * m_pImageList; + KToggleAction * m_paSlideshow; + KAction * m_paFileOpen; + KAction * m_paFileClose; + + QSortedList<ImageInfo> m_imagelist; + bool m_bDontAdd; + ImageListItem * m_pCurrentItem; + QTimer * m_pSlideshowTimer; +}; + +// vim:sw=4:ts=4:cindent +#endif diff --git a/kview/modules/presenter/kviewpresenter.rc b/kview/modules/presenter/kviewpresenter.rc new file mode 100644 index 00000000..92879d02 --- /dev/null +++ b/kview/modules/presenter/kviewpresenter.rc @@ -0,0 +1,20 @@ +<!DOCTYPE kpartgui> +<kpartplugin name="kviewpresenter" library="kview_presenterplugin" version="3"> + <MenuBar> + <Menu name="file"><text>&File</text> + <Action name="plugin_presenter_openFiles" group="open_merge_group"/> + </Menu> + <Menu name="view"><text>&View</text> + </Menu> + + <Menu name="go_document"><Text>&Go</Text> + <Action name="plugin_presenter_imageList"/> + <Action name="plugin_presenter_slideshow"/> + <Action name="plugin_presenter_prev"/> + <Action name="plugin_presenter_next"/> + </Menu> + </MenuBar> + <Menu name="popupmenu"> + <Action name="plugin_presenter_slideshow"/> + </Menu> +</kpartplugin> diff --git a/kview/modules/presenter/kviewpresenterconfmodule.cpp b/kview/modules/presenter/kviewpresenterconfmodule.cpp new file mode 100644 index 00000000..a39ea378 --- /dev/null +++ b/kview/modules/presenter/kviewpresenterconfmodule.cpp @@ -0,0 +1,60 @@ +/* This file is part of the KDE project + Copyright (C) 2002 Matthias Kretz <[email protected]> + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 + as published by the Free Software Foundation. + + 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; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +*/ + +// $Id$ + +#include "kviewpresenterconfmodule.h" + +#include <qlayout.h> +#include <qcheckbox.h> +#include <qframe.h> + +#include <klocale.h> +#include <kdialog.h> +#include <kglobal.h> +#include <kconfig.h> + +KViewPresenterConfModule::KViewPresenterConfModule( QObject * parent ) + : KPreferencesModule( "kviewpresenter", parent, "KView Presenter Config Module" ) +{ +} + +KViewPresenterConfModule::~KViewPresenterConfModule() +{ +} + +void KViewPresenterConfModule::applyChanges() +{ + emit configChanged(); +} + +void KViewPresenterConfModule::reset() +{ +} + +void KViewPresenterConfModule::createPage( QFrame * page ) +{ + QBoxLayout * layout = new QVBoxLayout( page, KDialog::marginHint(), KDialog::spacingHint() ); + layout->setAutoAdd( true ); + + m_pCheckBox = new QCheckBox( "This is only for testing...", page ); +} + +// vim:sw=4:ts=4 + +#include "kviewpresenterconfmodule.moc" diff --git a/kview/modules/presenter/kviewpresenterconfmodule.h b/kview/modules/presenter/kviewpresenterconfmodule.h new file mode 100644 index 00000000..dd7e5cf2 --- /dev/null +++ b/kview/modules/presenter/kviewpresenterconfmodule.h @@ -0,0 +1,49 @@ +/* This file is part of the KDE project + Copyright (C) 2002 Matthias Kretz <[email protected]> + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 + as published by the Free Software Foundation. + + 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; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +*/ + +// $Id$ + +#ifndef KVIEWPRESENTERCONFMODULE_H +#define KVIEWPRESENTERCONFMODULE_H + +#include "kpreferencesmodule.h" + +class QCheckBox; + +class KViewPresenterConfModule : public KPreferencesModule +{ + Q_OBJECT + public: + KViewPresenterConfModule( QObject * parent ); + ~KViewPresenterConfModule(); + + signals: + void configChanged(); + + protected: + virtual void applyChanges(); + virtual void reset(); + virtual void createPage( QFrame * page ); + + private: + QCheckBox * m_pCheckBox; +}; + +// vim:sw=4:ts=4 + +#endif // KVIEWPRESENTERCONFMODULE_H |