diff options
Diffstat (limited to 'renamedlgplugins')
-rw-r--r-- | renamedlgplugins/Makefile.am | 3 | ||||
-rw-r--r-- | renamedlgplugins/README | 7 | ||||
-rw-r--r-- | renamedlgplugins/audio/Makefile.am | 16 | ||||
-rw-r--r-- | renamedlgplugins/audio/TODO | 9 | ||||
-rw-r--r-- | renamedlgplugins/audio/audio_plugin.cpp | 104 | ||||
-rw-r--r-- | renamedlgplugins/audio/audiopreview.cpp | 135 | ||||
-rw-r--r-- | renamedlgplugins/audio/audiopreview.h | 75 | ||||
-rw-r--r-- | renamedlgplugins/audio/renaudiodlg.desktop | 63 | ||||
-rw-r--r-- | renamedlgplugins/images/Makefile.am | 21 | ||||
-rw-r--r-- | renamedlgplugins/images/image_plugin.cpp | 85 | ||||
-rw-r--r-- | renamedlgplugins/images/imagevisualizer.cpp | 83 | ||||
-rw-r--r-- | renamedlgplugins/images/imagevisualizer.h | 66 | ||||
-rw-r--r-- | renamedlgplugins/images/renimagedlg.desktop | 66 |
13 files changed, 733 insertions, 0 deletions
diff --git a/renamedlgplugins/Makefile.am b/renamedlgplugins/Makefile.am new file mode 100644 index 0000000..d78920c --- /dev/null +++ b/renamedlgplugins/Makefile.am @@ -0,0 +1,3 @@ +SUBDIRS = images audio + + diff --git a/renamedlgplugins/README b/renamedlgplugins/README new file mode 100644 index 0000000..2b2ea6b --- /dev/null +++ b/renamedlgplugins/README @@ -0,0 +1,7 @@ +Here you willl find plugins for the RenameDlg + +images This module will show the two different pictures/images + to let you better decide what you want to do + +audio This module will show you some information on the audio + files to make it easier to decide what to do. diff --git a/renamedlgplugins/audio/Makefile.am b/renamedlgplugins/audio/Makefile.am new file mode 100644 index 0000000..d9a228f --- /dev/null +++ b/renamedlgplugins/audio/Makefile.am @@ -0,0 +1,16 @@ +INCLUDES = $(all_includes) +METASOURCES = AUTO + + +# Install this plugin in the KDE modules directory +kde_module_LTLIBRARIES = librenaudioplugin.la + +librenaudioplugin_la_SOURCES = audiopreview.cpp audio_plugin.cpp +librenaudioplugin_la_LIBADD = $(LIB_KIO) -lkmediaplayer +librenaudioplugin_la_LDFLAGS = -module $(KDE_PLUGIN) $(all_libraries) + +pluginsdir = $(kde_servicesdir) +plugins_DATA = renaudiodlg.desktop + +messages: rc.cpp + $(XGETTEXT) *.cpp -o $(podir)/audiorename_plugin.pot diff --git a/renamedlgplugins/audio/TODO b/renamedlgplugins/audio/TODO new file mode 100644 index 0000000..453c700 --- /dev/null +++ b/renamedlgplugins/audio/TODO @@ -0,0 +1,9 @@ +Some ideas on what would be nice if implemented... + +* Start playing the audio file when icon is hovered. +* Colorize differences in file information +* On remote files: load file when label is clicked +* Tell if source or destination file is broken +* Tell if they're different or the same, not taking e.g. the IDtag into + account, only the actual audio data. +* ... diff --git a/renamedlgplugins/audio/audio_plugin.cpp b/renamedlgplugins/audio/audio_plugin.cpp new file mode 100644 index 0000000..f8114bd --- /dev/null +++ b/renamedlgplugins/audio/audio_plugin.cpp @@ -0,0 +1,104 @@ +/* This file is part of the KDE project + Copyright (C) 2003 Fabian Wolf <fabianw@gmx.net> + + image_plugin.cpp (also Part of the KDE Project) used as template + + 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; version 2 + of the License. + + 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 the file COPYING. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include <kgenericfactory.h> +#include <renamedlgplugin.h> +#include <kio/renamedlg.h> +#include <qlabel.h> +#include <qdialog.h> +#include <qwidget.h> +#include <qstringlist.h> +#include <kio/global.h> +#include <qlayout.h> + +#include <sys/types.h> + +#include "audiopreview.h" + +class AudioPlugin : public RenameDlgPlugin{ +public: + AudioPlugin( QDialog *dialog, const char *name, const QStringList & ); + ~AudioPlugin(); + virtual bool initialize( KIO::RenameDlg_Mode /*mod*/, const QString &/*_src*/, const QString &/*_dest*/, + const QString &/*mimeSrc*/, + const QString &/*mimeDest*/, + KIO::filesize_t /*sizeSrc*/, + KIO::filesize_t /*sizeDest*/, + time_t /*ctimeSrc*/, + time_t /*ctimeDest*/, + time_t /*mtimeSrc*/, + time_t /*mtimeDest*/ ); +}; + +AudioPlugin::AudioPlugin( QDialog *dialog, const char *name, const QStringList &list ) : RenameDlgPlugin( dialog, name, list) { + qWarning("loaded" ); +} +AudioPlugin::~AudioPlugin() +{ +} +bool AudioPlugin::initialize( KIO::RenameDlg_Mode mode, const QString &_src, const QString &_dest, + const QString &mimeSrc, + const QString &mimeDest, + KIO::filesize_t /*sizeSrc*/, + KIO::filesize_t /*sizeDest*/, + time_t /*ctimeSrc*/, + time_t /*ctimeDest*/, + time_t mtimeSrc, + time_t mtimeDest ) { + QGridLayout *lay = new QGridLayout(this, 4, 3, 5); + if( mode & KIO::M_OVERWRITE ){ + QLabel *label_head = new QLabel(this); + QLabel *label_src = new QLabel(this); + QLabel *label_dst = new QLabel(this); + QLabel *label_ask = new QLabel(this); + + QString sentence1; + QString dest = KURL::fromPathOrURL(_dest).pathOrURL(); + if (mtimeDest < mtimeSrc) + sentence1 = i18n("An older file named '%1' already exists.\n").arg(dest); + else if (mtimeDest == mtimeSrc) + sentence1 = i18n("A similar file named '%1' already exists.\n").arg(dest); + else + sentence1 = i18n("A newer file named '%1' already exists.\n").arg(dest); + label_head->setText(sentence1); + label_src->setText(i18n("Source File")); + label_dst->setText(i18n("Existing File")); + label_ask->setText(i18n("Would you like to replace the existing file with the one on the right?") ); + label_head->adjustSize(); + label_src->adjustSize(); + label_dst->adjustSize(); + label_ask->adjustSize(); + lay->addMultiCellWidget(label_head, 0, 0, 0, 2, Qt::AlignLeft); + lay->addWidget(label_dst, 1, 0, Qt::AlignLeft); + lay->addWidget(label_src, 1, 2, Qt::AlignLeft); + lay->addMultiCellWidget(label_ask, 3, 3, 0, 2, Qt::AlignLeft); + adjustSize(); + } + AudioPreview *left= new AudioPreview(this, "Preview Left", _dest, mimeDest ); + AudioPreview *right = new AudioPreview( this, "Preview Right", _src, mimeSrc); + lay->addWidget(left, 2, 0 ); + lay->addWidget(right, 2, 2 ); + adjustSize(); + return true; +} + +typedef KGenericFactory<AudioPlugin, QDialog> AudioPluginFactory; +K_EXPORT_COMPONENT_FACTORY( librenaudioplugin, AudioPluginFactory("audiorename_plugin") ) diff --git a/renamedlgplugins/audio/audiopreview.cpp b/renamedlgplugins/audio/audiopreview.cpp new file mode 100644 index 0000000..e9c6f26 --- /dev/null +++ b/renamedlgplugins/audio/audiopreview.cpp @@ -0,0 +1,135 @@ +/* This file is part of the KDE project + Copyright (C) 2003 Fabian Wolf <fabianw@gmx.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; version 2 + of the License. + + 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 the file COPYING. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include <kfilemetainfo.h> +#include <klocale.h> +#include <kmimetype.h> +#include <kurl.h> +#include <qvbox.h> +#include <qlabel.h> +#include <qpixmap.h> +#include <kio/netaccess.h> +#include <kurllabel.h> +#include <kmimetype.h> +#include <kmediaplayer/player.h> +#include <kparts/componentfactory.h> +#include <ksqueezedtextlabel.h> + +#include "audiopreview.h" + +AudioPreview::AudioPreview( QWidget *parent, const char *name, const QString &fileName, const QString &mimeType) + : QVBox( parent, name ) +{ + m_isTempFile = false; + pic = 0; + m_player = 0L; + description = 0; + // fileName is created by KUrl::prettyURL() + KURL url( fileName ); + setSpacing( 0 ); + if( url.isValid() && url.isLocalFile() ) { + m_localFile = url.path(); + pic = new QLabel(this); + pic->setPixmap(KMimeType::pixmapForURL( url )); + pic->adjustSize(); + initView( mimeType ); + } else if( !url.isLocalFile() ) { + KURLLabel *label = new KURLLabel( this ); + label->setText(i18n("This audio file isn't stored\non the local host.\nClick on this label to load it.\n" ) ); + label->setURL( url.prettyURL() ); + connect(label, SIGNAL(leftClickedURL(const QString&)), SLOT(downloadFile(const QString&))); + pic = label; + } else { + description = new QLabel(this ); + description->setText(i18n("Unable to load audio file") ); + } +} + +AudioPreview::~AudioPreview() +{ + if ( m_isTempFile ) + KIO::NetAccess::removeTempFile( m_localFile ); + + delete m_player; +} + +void AudioPreview::initView( const QString& mimeType ) +{ + KURL url = KURL::fromPathOrURL( m_localFile ); + pic->setText( QString::null ); + pic->setPixmap(KMimeType::pixmapForURL( url )); + pic->adjustSize(); + + KFileMetaInfo info(m_localFile); + KMimeType::Ptr mimeptr = KMimeType::mimeType(mimeType); + + QString desc; + if (info.isValid()) + { + if (mimeptr->is("audio/x-mp3") || mimeptr->is("application/ogg")) + { + // following 3 infos might be very long; make sure they get squeezed + // TODO: when string-freeze is over, eliminate trailing '\n' as it's no longer needed + KSqueezedTextLabel *sl; + + sl = new KSqueezedTextLabel(this); + sl->setText(i18n("Artist: %1\n").arg(info.item("Artist").value().toString())); + + sl = new KSqueezedTextLabel(this); + sl->setText(i18n("Title: %1\n").arg(info.item("Title").value().toString())); + + sl = new KSqueezedTextLabel(this); + sl->setText(i18n("Comment: %1\n").arg(info.item("Comment").value().toString())); + + desc.append(i18n("Biterate: 160 kbits/s", "Bitrate: %1 %2\n").arg( info.item("Bitrate").value().toString() ).arg( info.item("Bitrate").suffix() )); + } + desc.append(i18n("Sample rate: %1 %2\n").arg( info.item("Sample Rate").value().toString() ).arg( info.item("Sample Rate").suffix() )); + desc.append(i18n("Length: ")); + + /* Calculate length in mm:ss format */ + int length = info.item("Length").value().toInt(); + if (length/60 < 10) + desc.append("0"); + desc.append(QString("%1:").arg(length/60, 0, 10)); + if (length%60 < 10) + desc.append("0"); + desc.append(QString("%1\n").arg(length%60, 0, 10)); + } + + description = new QLabel(this); + description->setText( desc ); + description->adjustSize(); + m_player = KParts::ComponentFactory::createInstanceFromQuery<KMediaPlayer::Player>( "KMediaPlayer/Player", QString::null, this ); + if ( m_player ) + { + static_cast<KParts::ReadOnlyPart*>(m_player)->openURL( url ); + m_player->widget()->show(); + } +} + +void AudioPreview::downloadFile( const QString& url ) +{ + if( KIO::NetAccess::download( KURL::fromPathOrURL( url ), m_localFile , topLevelWidget()) ) + { + m_isTempFile = true; + initView( KMimeType::findByPath( m_localFile )->name() ); + } +} + +#include <audiopreview.moc> diff --git a/renamedlgplugins/audio/audiopreview.h b/renamedlgplugins/audio/audiopreview.h new file mode 100644 index 0000000..635a81b --- /dev/null +++ b/renamedlgplugins/audio/audiopreview.h @@ -0,0 +1,75 @@ +/* This file is part of the KDE project + Copyright (C) 2003 Fabian Wolf <fabianw@gmx.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; version 2 + of the License. + + 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 the file COPYING. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef audiopreview_h +#define audiopreview_h + +#include <qvbox.h> + +namespace KMediaPlayer +{ + class Player; +} + +class QPixmap; +class QLabel; +class AudioPreview : public QVBox +{ + Q_OBJECT +public: + AudioPreview(QWidget *parent, const char *name, const QString &fileName, const QString &mimeType); + ~AudioPreview(); + +private slots: + void downloadFile(const QString& url); + +private: + void initView(const QString& mimeType); + + QLabel *pic; + QLabel *description; + QString m_localFile; + bool m_isTempFile; + + KMediaPlayer::Player *m_player; +}; +#endif + + + + + + + + + + + + + + + + + + + + + + + diff --git a/renamedlgplugins/audio/renaudiodlg.desktop b/renamedlgplugins/audio/renaudiodlg.desktop new file mode 100644 index 0000000..cee4bdd --- /dev/null +++ b/renamedlgplugins/audio/renaudiodlg.desktop @@ -0,0 +1,63 @@ +[Desktop Entry] +Type=Service +Name=Audio Preview +Name[ar]=معاينة صوتية +Name[az]=Audio Nümayişi +Name[bg]=Прослушване на аудио +Name[br]=Rakgwel klevet +Name[bs]=Audio pregled +Name[ca]=Escolta una mostra de so +Name[cs]=Náhled zvuku +Name[cy]=Rhagolwg Sain +Name[da]=Lydforhåndsvisning +Name[de]=Audio-Vorschau +Name[el]=Προεπισκόπηση ήχου +Name[eo]=Sonantaŭrigardo +Name[es]=Reproducir audio +Name[et]=Audiofailide eelvaatlus +Name[eu]=Audio aurrebista +Name[fa]=پیشنمایش صوتی +Name[fi]=Musiikkiesikatselu +Name[fr]=Aperçu audio +Name[fy]=Audiofoarbyld +Name[ga]=Réamhléargas Fuaime +Name[gl]=Antevisión Áudio +Name[he]=תצוגה מקדימה של שמע +Name[hi]=आडियो पूर्वावलोकन +Name[hr]=Pregled zvučne datoteke +Name[hu]=Hangos betekintő +Name[is]=Hljóðforsýn +Name[it]=Anteprima audio +Name[ja]=オーディオプレビュー +Name[ka]=აუდიო წინასწარ ნახვა +Name[kk]=Аудио файлымен алдын ала таңыстыру +Name[km]= មើលជាមុនដោយស្វ័យប្រវត្តិ +Name[lt]=Audio perklausaa +Name[mk]=Преглед на звук +Name[nb]=Lydforhåndsvisning +Name[nds]=Klang-Vöransicht +Name[ne]=अडियो पूर्वावलोकन +Name[nl]=Audiovoorbeeld +Name[nn]=Lydførehandsvisning +Name[pa]=ਆਡੀਓ ਝਲਕ +Name[pl]=Podgląd plików audio +Name[pt]=Previsão Áudio +Name[pt_BR]=Previsão de Áudio +Name[ro]=Previzualizare audio +Name[ru]=Аудиоознакомление +Name[sk]=Automatický náhľad +Name[sl]=Ogled zvoka +Name[sr]=Преглед аудија +Name[sr@Latn]=Pregled audija +Name[sv]=Ljudförhandsgranskning +Name[ta]=ஒலி முன்னோட்டம் +Name[tg]=Аудиошиносоӣ +Name[tr]=Audio Önizleme +Name[uk]=Перегляд аудіо +Name[uz]=Audio koʻrib chiqish +Name[uz@cyrillic]=Аудио кўриб чиқиш +Name[vi]=Xem thử âm thanh +Name[zh_CN]=音频预览 +Name[zh_TW]=音效預覽 +X-KDE-Library=librenaudioplugin +ServiceTypes=RenameDlg/Plugin,audio/x-mp3,audio/x-wav,application/ogg diff --git a/renamedlgplugins/images/Makefile.am b/renamedlgplugins/images/Makefile.am new file mode 100644 index 0000000..1c07171 --- /dev/null +++ b/renamedlgplugins/images/Makefile.am @@ -0,0 +1,21 @@ +#SUBDIRS= kcmimage + +INCLUDES = $(all_includes) +METASOURCES = AUTO + + +# Install this plugin in the KDE modules directory +kde_module_LTLIBRARIES = librenimageplugin.la + +librenimageplugin_la_SOURCES = imagevisualizer.cpp image_plugin.cpp +librenimageplugin_la_LIBADD = $(LIB_KIO) +librenimageplugin_la_LDFLAGS = -module $(KDE_PLUGIN) $(all_libraries) + +pluginsdir = $(kde_servicesdir) +plugins_DATA = renimagedlg.desktop + +# Install the .rc file in the Part's directory (in this case, the part +# is KHTMLPart) + +messages: rc.cpp + $(XGETTEXT) *.cpp -o $(podir)/imagerename_plugin.pot diff --git a/renamedlgplugins/images/image_plugin.cpp b/renamedlgplugins/images/image_plugin.cpp new file mode 100644 index 0000000..7c347ea --- /dev/null +++ b/renamedlgplugins/images/image_plugin.cpp @@ -0,0 +1,85 @@ +/* This file is part of the KDE project + Copyright (C) 2001 Holger Freyther <freyther@yahoo.com> + + 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; version 2 + of the License. + + 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 the file COPYING. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +//#include "image_plugin.moc" + +#include <kdebug.h> +#include <kgenericfactory.h> +#include <kiconloader.h> +#include <renamedlgplugin.h> +#include <kio/renamedlg.h> +#include <qlabel.h> +#include <qdialog.h> +#include <qwidget.h> +#include <qstringlist.h> +#include <kio/global.h> +#include <qlayout.h> + +#include <sys/types.h> + +#include "imagevisualizer.h" + +class ImagePlugin : public RenameDlgPlugin{ +public: + ImagePlugin( QDialog *dialog, const char *name, const QStringList & ); + virtual bool initialize( KIO::RenameDlg_Mode /*mod*/, const QString &/*_src*/, const QString &/*_dest*/, + const QString &/*mimeSrc*/, + const QString &/*mimeDest*/, + KIO::filesize_t /*sizeSrc*/, + KIO::filesize_t /*sizeDest*/, + time_t /*ctimeSrc*/, + time_t /*ctimeDest*/, + time_t /*mtimeSrc*/, + time_t /*mtimeDest*/ ); +}; + +ImagePlugin::ImagePlugin( QDialog *dialog, const char *name, const QStringList &list ) + : RenameDlgPlugin( dialog, name, list) +{ +} + +bool ImagePlugin::initialize( KIO::RenameDlg_Mode mode, const QString &_src, const QString &_dest, + const QString &/*mimeSrc*/, + const QString &/*mimeDest*/, + KIO::filesize_t /*sizeSrc*/, + KIO::filesize_t /*sizeDest*/, + time_t /*ctimeSrc*/, + time_t /*ctimeDest*/, + time_t /*mtimeSrc*/, + time_t /*mtimeDest*/ ) +{ + QGridLayout *lay = new QGridLayout(this, 2, 3, 5 ); + if( mode & KIO::M_OVERWRITE ) + { + QLabel *label = new QLabel(this ); + label->setText(i18n("You want to overwrite the left picture with the one on the right.") ); + label->adjustSize(); + lay->addMultiCellWidget(label, 1, 1, 0, 2, Qt::AlignHCenter ); + adjustSize(); + } + ImageVisualizer *left= new ImageVisualizer(this, "Visualizer Left", _dest ); + ImageVisualizer *right = new ImageVisualizer( this, "Visualizer Right", _src ); + lay->addWidget(left, 2, 0 ); + lay->addWidget(right, 2, 2 ); + adjustSize(); + return true; +} + +typedef KGenericFactory<ImagePlugin, QDialog> ImagePluginFactory; +K_EXPORT_COMPONENT_FACTORY( librenimageplugin, ImagePluginFactory("imagerename_plugin") ) diff --git a/renamedlgplugins/images/imagevisualizer.cpp b/renamedlgplugins/images/imagevisualizer.cpp new file mode 100644 index 0000000..cb890c5 --- /dev/null +++ b/renamedlgplugins/images/imagevisualizer.cpp @@ -0,0 +1,83 @@ +/* This file is part of the KDE project + Copyright (C) 2002 Holger Freyther <freyther@yahoo.com> + 2003 Carsten Pfeiffer <pfeiffer@kde.org> + + 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; version 2 + of the License. + + 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 the file COPYING. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include <klocale.h> +#include <kurl.h> +#include <kurllabel.h> +#include <qvbox.h> +#include <qlabel.h> +#include <qpixmap.h> +#include <qimage.h> + +#include <kio/netaccess.h> + +#include "imagevisualizer.h" + +ImageVisualizer::ImageVisualizer( QWidget *parent, const char *name, const QString &fileName ) + : QVBox( parent, name ) +{ + pic = 0; + description = 0; + KURL url=KURL::fromPathOrURL( fileName ); + setSpacing( 0 ); + if( url.isValid() && url.isLocalFile() ) { + pic = new QLabel(this ); + description = new QLabel( this ); + loadImage( url.path() ); + } else if( !url.isLocalFile() ) { + KURLLabel *label = new KURLLabel( this ); + label->setText(i18n("This picture isn't stored\non the local host.\nClick on this label to load it.\n" ) ); + label->setURL( url.prettyURL() ); + connect(label, SIGNAL(leftClickedURL(const QString&)), SLOT(downloadImage(const QString&))); + pic = label; + description = new QLabel(this); + description->adjustSize( ); + } else { + description = new QLabel(this ); + description->setText(i18n("Unable to load image") ); + } +} + +void ImageVisualizer::loadImage( const QString& path ) +{ + QImage img(path); + QPixmap pixmap(img.smoothScale(180,200, QImage::ScaleMin) ); + pic->setText( QString::null ); + pic->setPixmap(pixmap ); + pic->adjustSize(); + + QString desc; + desc.append(i18n("The color depth of an image", "Depth: %1\n").arg( img.depth() )); + desc.append(i18n("The dimensions of an image", "Dimensions: %1x%1").arg(img.width()).arg(img.height() )); + description->setText(desc ); + description->adjustSize(); +} + +void ImageVisualizer::downloadImage(const QString& url) +{ + QString tmpFile; + if( KIO::NetAccess::download( KURL::fromPathOrURL( url ), tmpFile , topLevelWidget()) ) + { + loadImage( tmpFile ); + KIO::NetAccess::removeTempFile( tmpFile ); + } +} + +#include "imagevisualizer.moc" diff --git a/renamedlgplugins/images/imagevisualizer.h b/renamedlgplugins/images/imagevisualizer.h new file mode 100644 index 0000000..391fad2 --- /dev/null +++ b/renamedlgplugins/images/imagevisualizer.h @@ -0,0 +1,66 @@ +/* This file is part of the KDE project + Copyright (C) 2002 Holger Freyther <freyther@yahoo.com> + + 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; version 2 + of the License. + + 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 the file COPYING. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef imagevisualizer_h +#define imagevisualizer_h + +#include <qvbox.h> + +class QPixmap; +class QLabel; +class ImageVisualizer : public QVBox +{ + Q_OBJECT +public: + ImageVisualizer(QWidget *parent, const char *name, const QString &fileName ); + +private: + void loadImage( const QString& path ); + +private slots: + void downloadImage( const QString& url ); + +private: + QLabel *pic; + QLabel *description; +}; +#endif + + + + + + + + + + + + + + + + + + + + + + + diff --git a/renamedlgplugins/images/renimagedlg.desktop b/renamedlgplugins/images/renimagedlg.desktop new file mode 100644 index 0000000..c96622b --- /dev/null +++ b/renamedlgplugins/images/renimagedlg.desktop @@ -0,0 +1,66 @@ +[Desktop Entry] +Type=Service +Name=Image Displayer +Name[ar]=عارض الصور +Name[az]=Rəsm Nümayişçisi +Name[bg]=Показване на изображения +Name[bs]=Preglednik slika +Name[ca]=Visor d'imatges +Name[cs]=Prohlížeč obrázků +Name[cy]=Arddangosydd Delweddau +Name[da]=Billedfremviser +Name[de]=Bildbetrachter +Name[el]=Προβολή εικόνων +Name[eo]=Bildprezentilo +Name[es]=Muestra imágenes +Name[et]=Pildifailide näitaja +Name[eu]=Irudi bistaratzailea +Name[fa]=نمایشدهندۀ تصویر +Name[fi]=Kuvannäyttäjä +Name[fo]=Myndaframvísari +Name[fr]=Afficheur d'images +Name[fy]=Ofbylden werjefteprogramma +Name[ga]=Amharcán Íomhánna +Name[gl]=Visor de Imaxes +Name[he]=מציג תמונות +Name[hi]=छवि प्रदर्शक +Name[hr]=Preglednik slika +Name[hu]=Képmegjelenítő +Name[is]=Myndsjá +Name[it]=Visualizzatore di immagini +Name[ja]=イメージ表示ツール +Name[ka]=გამოსახულებთა ამსახავი +Name[kk]=Кескін көрсеткіш +Name[km]=កម្មវិធីបង្ហាញរូបភាព +Name[lt]=Paveikslėlių rodytojas +Name[lv]=Attēlu Rādītājs +Name[mk]=Прикажувач на слики +Name[mt]=Werrej ta' Stampi +Name[nb]=Bildeviser +Name[nds]=Bildwieser +Name[ne]=छवि प्रदर्शक +Name[nl]=Afbeeldingenweergaveprogramma +Name[nn]=Biletvisar +Name[nso]=Sebontshi sa Ponagalo +Name[pa]=ਚਿੱਤਰ ਦਰਸ਼ਕ +Name[pl]=Program wyświetlający obrazki +Name[pt]=Visualizador de Imagens +Name[pt_BR]=Visualizador de Imagens +Name[ro]=Vizualizor imagini +Name[ru]=просмотр изображений +Name[sk]=Prehliadač obrázkov +Name[sl]=Prikazovalnik slik +Name[sr]=Приказивач слика +Name[sr@Latn]=Prikazivač slika +Name[sv]=Bildvisare +Name[ta]=பிம்பக் காட்டி +Name[tg]=тамошои тасвир +Name[th]=เครื่องมือแสดงภาพ +Name[tr]=Resim Gösterici +Name[uk]=Перегляд зображень +Name[vi]=Bộ hiển thị ảnh +Name[xh]=Umbonisi wo Mfanekiso +Name[zh_CN]=图像显示器 +Name[zh_TW]=影像顯示器 +X-KDE-Library=librenimageplugin +ServiceTypes=RenameDlg/Plugin,image/jpeg,image/png |