From kde-panel-devel Sun Jul 27 13:56:45 2008 From: Mathias Kraus Date: Sun, 27 Jul 2008 13:56:45 +0000 To: kde-panel-devel Subject: New comic for comic plasmoid Message-Id: <200807271556.45923.k.matze () gmx ! net> X-MARC-Message: https://marc.info/?l=kde-panel-devel&m=121717507315939 MIME-Version: 1 Content-Type: multipart/mixed; boundary="--Boundary-00=_d6HjI3OAy+neCcU" --Boundary-00=_d6HjI3OAy+neCcU Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline Hi, I'm a big fan of the comic at sinfest.net and therefore I added it to the comic plasmoid. I thought there might be others who also would enjoy this comic. I wrote the author an e-mail and asked for permission to include it into KDE. I hope I get soon an answer from him. The patch is in the attachment. Actually it is the garfield provider and I just changed the names and the url. What do you think? I'm not sure what to do with the copyright, because I didn't do very much. Shall I put my name into the files or use the name in the garfield files? Best regards, Mathias Kraus --Boundary-00=_d6HjI3OAy+neCcU Content-Type: text/x-patch; charset="us-ascii"; name="patch.diff" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="patch.diff" Index: pics/plasma_comic_sinfest.png =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Kann nicht anzeigen: Dateityp ist als bin=C3=A4r angegeben. svn:mime-type =3D application/octet-stream Eigenschafts=C3=A4nderungen: pics/plasma_comic_sinfest.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Index: sinfestprovider.desktop =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =2D-- sinfestprovider.desktop (Revision 0) +++ sinfestprovider.desktop (Revision 0) @@ -0,0 +1,10 @@ +[Desktop Entry] +Type=3DService +X-KDE-ServiceTypes=3DPlasmaComic/Plugin +X-KDE-Library=3Dplasma_comic_sinfestprovider +X-KDE-PlasmaComicProvider-SuffixType=3DDate +X-KDE-PlasmaComicProvider-Identifier=3Dsinfest +Icon=3Dplasma_comic_sinfest + +Name=3DSinfest +Comment=3DSinfest Index: sinfestprovider.h =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =2D-- sinfestprovider.h (Revision 0) +++ sinfestprovider.h (Revision 0) @@ -0,0 +1,74 @@ +/* + * Copyright (C) 2008 Mathias Kraus + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Library 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 Library 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 SINFESTPROVIDER_H +#define SINFESTPROVIDER_H + +#include "comicprovider.h" + +/** + * This class provides the comic strip image for sinfest.net. + */ +class SinfestProvider : public ComicProvider +{ + Q_OBJECT + + public: + /** + * Creates a new sinfest provider. + * + * @param parent The parent object. + */ + SinfestProvider( QObject *parent, const QVariantList& ); + + /** + * Destroys the sinfest provider. + */ + ~SinfestProvider(); + + /** + * Returns the identifier type. + */ + IdentifierType identifierType() const; + + /** + * Returns the requested image. + * + * Note: This method returns only a valid image after the + * finished() signal has been emitted. + */ + virtual QImage image() const; + + /** + * Returns the identifier of the comic request (name + date). + */ + virtual QString identifier() const; + + /** + * Returns the website of the comic. + */ + virtual KUrl websiteUrl() const; + + private: + class Private; + Private* const d; + + Q_PRIVATE_SLOT( d, void imageRequestFinished( bool ) ) +}; + +#endif Index: CMakeLists.txt =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =2D-- CMakeLists.txt (Revision 838079) +++ CMakeLists.txt (Arbeitskopie) @@ -108,3 +108,15 @@ install( TARGETS plasma_comic_phdprovider DESTINATION ${PLUGIN_INSTALL_DIR= } ) install( FILES phdprovider.desktop DESTINATION ${SERVICES_INSTALL_DIR} ) install( FILES pics/plasma_comic_phd.png DESTINATION ${DATA_INSTALL_DIR}/p= lasma-comic ) + +#### next #### + +set( comic_sinfest_provider_SRCS + sinfestprovider.cpp +) + +kde4_add_plugin( plasma_comic_sinfestprovider ${comic_sinfest_provider_SRC= S} ) +target_link_libraries( plasma_comic_sinfestprovider plasmacomicprovidercor= e ${KDE4_KDECORE_LIBS} ${QT_QTGUI_LIBRARY} ${QT_QTNETWORK_LIBRARY}) +install( TARGETS plasma_comic_sinfestprovider DESTINATION ${PLUGIN_INSTALL= _DIR} ) +install( FILES sinfestprovider.desktop DESTINATION ${SERVICES_INSTALL_DIR}= ) +install( FILES pics/plasma_comic_sinfest.png DESTINATION ${DATA_INSTALL_DI= R}/plasma-comic ) Index: sinfestprovider.cpp =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =2D-- sinfestprovider.cpp (Revision 0) +++ sinfestprovider.cpp (Revision 0) @@ -0,0 +1,93 @@ +/* + * Copyright (C) 2008 Mathias Kraus + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Library 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 Library 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 +#include +#include +#include + +#include + +#include "sinfestprovider.h" + +COMICPROVIDER_EXPORT_PLUGIN( SinfestProvider, "SinfestProvider", "" ) + +class SinfestProvider::Private +{ + public: + Private( SinfestProvider *parent ) + : mParent( parent ) + { + mHttp =3D new QHttp( "sinfest.net", 80, mParent ); + connect( mHttp, SIGNAL( done( bool ) ), mParent, SLOT( imageRe= questFinished( bool ) ) ); + } + + void imageRequestFinished( bool ); + + SinfestProvider *mParent; + QImage mImage; + + QHttp *mHttp; +}; + +void SinfestProvider::Private::imageRequestFinished( bool error ) +{ + if ( error ) { + emit mParent->error( mParent ); + return; + } + + mImage =3D QImage::fromData( mHttp->readAll() ); + emit mParent->finished( mParent ); +} + +SinfestProvider::SinfestProvider( QObject *parent, const QVariantList &arg= s ) + : ComicProvider( parent, args ), d( new Private( this ) ) +{ + KUrl url( QString( "http://www.sinfest.net/comikaze/comics/%1.gif" ).a= rg( requestedDate().toString( "yyyy-MM-dd" ) ) ); + + d->mHttp->setHost( url.host() ); + d->mHttp->get( url.path() ); +} + +SinfestProvider::~SinfestProvider() +{ + delete d; +} + +ComicProvider::IdentifierType SinfestProvider::identifierType() const +{ + return DateIdentifier; +} + +QImage SinfestProvider::image() const +{ + return d->mImage; +} + +QString SinfestProvider::identifier() const +{ + return QString( "sinfest:%1" ).arg( requestedDate().toString( Qt::ISOD= ate ) ); +} + +KUrl SinfestProvider::websiteUrl() const +{ + return QString( "http://www.sinfest.net/archive_page.php?comicID=3D%1"= ).arg( 2309 - requestedDate().daysTo( QDate( 2007, 1, 1 ) ) ); +} + +#include "sinfestprovider.moc" --Boundary-00=_d6HjI3OAy+neCcU Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Plasma-devel mailing list Plasma-devel@kde.org https://mail.kde.org/mailman/listinfo/plasma-devel --Boundary-00=_d6HjI3OAy+neCcU--