diff --git a/kdeplasma-addons/CMakeLists.txt b/kdeplasma-addons/CMakeLists.txt index c7fc3dd6..839a856d 100644 --- a/kdeplasma-addons/CMakeLists.txt +++ b/kdeplasma-addons/CMakeLists.txt @@ -11,7 +11,6 @@ if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR}) endif() add_subdirectory(applets) -add_subdirectory(dataengines) add_subdirectory(runners) add_subdirectory(wallpapers) diff --git a/kdeplasma-addons/dataengines/CMakeLists.txt b/kdeplasma-addons/dataengines/CMakeLists.txt deleted file mode 100644 index 0b73117a..00000000 --- a/kdeplasma-addons/dataengines/CMakeLists.txt +++ /dev/null @@ -1 +0,0 @@ -add_subdirectory(potd) diff --git a/kdeplasma-addons/dataengines/potd/CMakeLists.txt b/kdeplasma-addons/dataengines/potd/CMakeLists.txt deleted file mode 100644 index 0c042b3a..00000000 --- a/kdeplasma-addons/dataengines/potd/CMakeLists.txt +++ /dev/null @@ -1,104 +0,0 @@ -set(potd_engine_SRCS - cachedprovider.cpp - potd.cpp -) - -kde4_add_plugin(plasma_engine_potd ${potd_engine_SRCS}) -target_link_libraries(plasma_engine_potd - KDE4::kdeui - KDE4::plasma - plasmapotdprovidercore -) - -install( - TARGETS plasma_engine_potd - DESTINATION ${KDE4_PLUGIN_INSTALL_DIR} -) -install( - FILES plasma-dataengine-potd.desktop - DESTINATION ${KDE4_SERVICES_INSTALL_DIR} -) - -########### plugin core library ############ - -set(potd_provider_core_SRCS - potdprovider.cpp -) - -add_library(plasmapotdprovidercore SHARED ${potd_provider_core_SRCS}) -target_link_libraries(plasmapotdprovidercore KDE4::kdeui) - -generate_export_header(plasmapotdprovidercore BASE_NAME plasma_potd) - -install( - TARGETS plasmapotdprovidercore - DESTINATION ${KDE4_LIB_INSTALL_DIR} -) -install( - FILES plasma_potdprovider.desktop - DESTINATION ${KDE4_SERVICETYPES_INSTALL_DIR} -) - -########### plugins ############### - -set( potd_flickr_provider_SRCS - flickrprovider.cpp -) - -kde4_add_plugin(plasma_potd_flickrprovider ${potd_flickr_provider_SRCS}) -target_link_libraries(plasma_potd_flickrprovider - KDE4::kio - KDE4::kdecore - ${QT_QTGUI_LIBRARY} - plasmapotdprovidercore -) -install( - TARGETS plasma_potd_flickrprovider - DESTINATION ${KDE4_PLUGIN_INSTALL_DIR} -) -install( - FILES flickrprovider.desktop - DESTINATION ${KDE4_SERVICES_INSTALL_DIR} -) - - -set(potd_apod_provider_SRCS - apodprovider.cpp -) - -kde4_add_plugin(plasma_potd_apodprovider ${potd_apod_provider_SRCS}) -target_link_libraries(plasma_potd_apodprovider - KDE4::kio - KDE4::kdecore - ${QT_QTGUI_LIBRARY} - plasmapotdprovidercore -) -install( - TARGETS plasma_potd_apodprovider - DESTINATION ${KDE4_PLUGIN_INSTALL_DIR} -) -install( - FILES apodprovider.desktop - DESTINATION ${KDE4_SERVICES_INSTALL_DIR} -) - - -set(potd_pexels_provider_SRCS - pexelsprovider.cpp -) - -kde4_add_plugin(plasma_potd_pexelsprovider ${potd_pexels_provider_SRCS}) -target_link_libraries(plasma_potd_pexelsprovider - KDE4::kio - KDE4::kdecore - ${QT_QTGUI_LIBRARY} - plasmapotdprovidercore -) -install( - TARGETS plasma_potd_pexelsprovider - DESTINATION ${KDE4_PLUGIN_INSTALL_DIR} -) -install( - FILES pexelsprovider.desktop - DESTINATION ${KDE4_SERVICES_INSTALL_DIR} -) diff --git a/kdeplasma-addons/dataengines/potd/HowToAddProvider.txt b/kdeplasma-addons/dataengines/potd/HowToAddProvider.txt deleted file mode 100644 index 03eaf173..00000000 --- a/kdeplasma-addons/dataengines/potd/HowToAddProvider.txt +++ /dev/null @@ -1,20 +0,0 @@ -HOW TO ADD A NEW PICTURE OF THE DAY AND HOW TO USE THE ENGINE - -- in the data engine "apod" -Add your provider in the Potd class, updateSource( const QString &identifier ) method - -- in the applet, you get a QImage and you can call the provider with - - Plasma::DataEngine *engine = dataEngine( "potd" ); - QDate mCurrentDate = QDate::currentDate(); - const QString identifier = QString("apod") + ":" + mCurrentDate.toString( Qt::ISODate ); - - engine->disconnectSource( identifier, this ); - engine->connectSource( identifier, this ); - const Plasma::DataEngine::Data data = engine->query( identifier ); - QImage mImage = data[ identifier ].value(); - -- TO DEBUG your new provider you need to comment the lines about caching the pic in -potd.cpp at the beginning of the -bool PotdEngine::updateSource( const QString &identifier ) -method. diff --git a/kdeplasma-addons/dataengines/potd/PoTD-list.txt b/kdeplasma-addons/dataengines/potd/PoTD-list.txt deleted file mode 100644 index 0b2f7b12..00000000 --- a/kdeplasma-addons/dataengines/potd/PoTD-list.txt +++ /dev/null @@ -1,54 +0,0 @@ -LIST OF POSSIBLE PROVIDERS --------------------------- - -* NASA Astronomy Picture of the Day (APOD) ----------- DONE -http://antwrp.gsfc.nasa.gov/apod/astropix.html -Each day can be reached via the URL http://antwrp.gsfc.nasa.gov/apod/apYYMMDD.html -where YY is the 2 digits year, MM is the 2 digits month and DD is the 2 digits day. - -* Flickr Interestingness ---------------------------- DONE -http://www.flickr.com/explore/interesting/ -API http://www.flickr.com/services/api/flickr.interestingness.getList.html - -* Botanical PoTD -http://www.ubcbotanicalgarden.org/potd/ - -* EPOD - Earth Science Picture of the Day ----------- DONE -http://epod.usra.edu/ -RSS feed http://interglacial.com/rss/epod.rss - -* OSEI (Operational Significant Event Imagery) -Image Of the Day ------------------------------------- DONE -http://www.osei.noaa.gov/OSEIiod.html - -* WCPoTD Wikimedia Commons Picture of The Day ---------- almost DONE (need to add the Credits URL below the pic) -http://tools.wikimedia.de/~daniel/potd/potd.php -http://en.wikipedia.org/wiki/Wikipedia:Picture_of_the_day#Including_the_POTD_on_your_user_page -http://en.wikipedia.org/w/index.php?title=Template:POTD/2008-02-03&action=render - -Feed for Commons Featured Pictures -http://tools.wikimedia.de/~magnus/catfood.php?category=Featured_pictures - -* http://interfacelift.com/wallpaper/ -RSS feed: http://feeds.feedburner.com/InterfaceliftNewestWallpaper - -* HackADay.com -http://www.hackaday.com/ -RSS: http://www.hackaday.com/rss.xml - -* Radiology Picture of the Day -http://www.radpod.org/ - -* Taiwan Picture of the Day -http://fotozon.com/daily/taiwan/ - -* Space.com Image of the day -http://www.space.com/imageoftheday/ - -* Animal of the Day -http://www.thewebsiteofeverything.com/weblog/ -http://archive.dailypicture.net/animal_picture_of_the_day__daily_animal_photograph.htm - -* A list of PoTD: -http://www.w3streams.com/ - diff --git a/kdeplasma-addons/dataengines/potd/apodprovider.cpp b/kdeplasma-addons/dataengines/potd/apodprovider.cpp deleted file mode 100644 index f5f7bf0a..00000000 --- a/kdeplasma-addons/dataengines/potd/apodprovider.cpp +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Copyright (C) 2007 Tobias Koenig - * Copyright 2008 by Anne-Marie Mahfouf - * - * 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; either version 2 of the License, or - * (at your option) any later version. - * - * 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 "apodprovider.h" - -#include -#include - -#include -#include - -POTDPROVIDER_EXPORT_PLUGIN(ApodProvider, "ApodProvider", "") - -class ApodProvider::Private -{ -public: - Private(ApodProvider *parent) - : mParent(parent) - { - } - - void pageRequestFinished(KJob*); - void imageRequestFinished(KJob*); - void parsePage(); - - ApodProvider *mParent; - QImage mImage; -}; - -void ApodProvider::Private::pageRequestFinished(KJob *_job) -{ - KIO::StoredTransferJob *job = static_cast(_job); - if (job->error()) { - emit mParent->error(mParent); - return; - } - - const QByteArray jobdata = job->data(); - const QString data = QString::fromUtf8(jobdata.constData(), jobdata.size()); - - const QString pattern(QLatin1String("connect(imageJob, SIGNAL(finished(KJob*)), SLOT(imageRequestFinished(KJob*))); - } else { - emit mParent->error(mParent); - } -} - -void ApodProvider::Private::imageRequestFinished(KJob *_job ) -{ - KIO::StoredTransferJob *job = static_cast(_job); - if (job->error()) { - emit mParent->error(mParent); - return; - } - - mImage = QImage::fromData(job->data()); - emit mParent->finished( mParent ); -} - -ApodProvider::ApodProvider(QObject *parent, const QVariantList &args) - : PotdProvider(parent, args), - d(new Private(this)) -{ - KUrl url(QString::fromLatin1("https://antwrp.gsfc.nasa.gov/apod/")); - KIO::StoredTransferJob *job = KIO::storedGet(url, KIO::HideProgressInfo); - connect(job, SIGNAL(finished(KJob*)), SLOT(pageRequestFinished(KJob*))); -} - -ApodProvider::~ApodProvider() -{ - delete d; -} - -QImage ApodProvider::image() const -{ - return d->mImage; -} - -#include "moc_apodprovider.cpp" diff --git a/kdeplasma-addons/dataengines/potd/apodprovider.desktop b/kdeplasma-addons/dataengines/potd/apodprovider.desktop deleted file mode 100644 index 762be4de..00000000 --- a/kdeplasma-addons/dataengines/potd/apodprovider.desktop +++ /dev/null @@ -1,104 +0,0 @@ -[Desktop Entry] -Type=Service -X-KDE-ServiceTypes=PlasmaPoTD/Plugin -X-KDE-Library=plasma_potd_apodprovider -X-KDE-PlasmaPoTDProvider-Identifier=apod -Icon= - -Name=Astronomy Picture of the Day -Name[ar]=الصورة الفضائية اليومية -Name[bs]=Astronomska slika dana -Name[ca]=Imatge astronòmica del dia -Name[ca@valencia]=Imatge astronòmica del dia -Name[cs]=Obrázek dne z Astronomie -Name[da]=Dagens astronomibillede -Name[de]=Bild des Tages der Astronomie -Name[el]=Αστρονομική φωτογραφία της ημέρας -Name[en_GB]=Astronomy Picture of the Day -Name[es]=Imagen astronómica del día -Name[et]=Astronoomia päevapilt -Name[fi]=Päivän tähtitiedekuva -Name[fr]=Image du jour d'astronomie -Name[ga]=Grianghraf Réalteolaíochta an Lae -Name[gl]=Imaxe do día de astronomía -Name[hr]=Slika dana na Astronomy -Name[hu]=A nap csillagászati képe -Name[it]=Astronomy Picture of the Day -Name[ja]=今日の天体写真 -Name[kk]=Астрономиялық "Тәулік суреті" (Apod) -Name[km]=រូប​ភាព​ប្រ​ចាំ​ថ្ងៃ Astronomy -Name[ko]=오늘의 천문학 사진 -Name[lv]=Astronomijas dienas attēls -Name[mr]=खगोलशास्त्र दिवसाचे चित्र -Name[nb]=Dagens astronomibilde -Name[nds]=Astronoomsch Bild för Vundaag -Name[nl]=Astronomische afbeelding van de dag -Name[nn]=Dagens astronomibilete -Name[pa]=ਅੱਜ ਦੀ ਖਗੋਲੀ ਤਸਵੀਰ -Name[pl]=Astronomiczny obraz dnia -Name[pt]=Imagem do Dia na Astronomia -Name[pt_BR]=Imagem astronômica do dia -Name[ro]=Imaginea zilei din astronomie -Name[ru]=Астрономический снимок дня -Name[sk]=Obrázok dňa z Astronómie -Name[sl]=Astronomska slika dneva -Name[sr]=астрономска слика дана -Name[sr@ijekavian]=астрономска слика дана -Name[sr@ijekavianlatin]=astronomska slika dana -Name[sr@latin]=astronomska slika dana -Name[sv]=Dagens astronomiska bild -Name[th]=ภาพดาราศาสตร์ประจำวัน -Name[tr]=Günün Astronomik Fotoğrafı -Name[uk]=Зображення дня Astronomy -Name[x-test]=xxAstronomy Picture of the Dayxx -Name[zh_CN]=每日一图(天文) -Name[zh_TW]=本日天文圖片 -Comment=Apod Provider -Comment[ar]=المزود Apod -Comment[ast]=Fornidor d'Apod -Comment[bs]=Dobavljač Apod-a -Comment[ca]=Proveïdor Apod -Comment[ca@valencia]=Proveïdor Apod -Comment[cs]=Poskytovatel Apodu -Comment[da]=Apod-udbyder. -Comment[de]=Apod-Anbieter -Comment[el]=Πάροχος Apod -Comment[en_GB]=Apod Provider -Comment[es]=Proveedor de Apod -Comment[et]=Apodi pakkuja -Comment[fi]=Apod-tarjoaja -Comment[fr]=Fournisseur « APOD » -Comment[ga]=Soláthraí Apod -Comment[gl]=Fornecedor de Apod -Comment[hr]=Pružatelj Apoda -Comment[hu]=Apod-szolgáltató -Comment[is]=Apod þjónusta -Comment[it]=Fornitore Apod -Comment[ja]=Apod のプロバイダ -Comment[kk]=Apod таратушысы -Comment[km]=ក្រុមហ៊ុន​ផ្ដល់ Apod -Comment[ko]=천문학 사진 공급자 -Comment[lt]=Apod tiekėjas -Comment[lv]=Apod piegādātājs -Comment[mr]=एपोड पुरविठाकर्ता -Comment[nb]=Apod-leverandør -Comment[nds]=ABifV-Anbeder -Comment[nl]=Apod-provider -Comment[nn]=Apod-tilbydar -Comment[pl]=Usługodawca Apod -Comment[pt]=Fornecedor do Apod -Comment[pt_BR]=Fornecedor Apod -Comment[ro]=Furnizor Apod -Comment[ru]=Источник данных Apod -Comment[sk]=Poskytovateľ Apod -Comment[sl]=Ponudnik Apod -Comment[sr]=Добављач АПОД‑а -Comment[sr@ijekavian]=Добављач АПОД‑а -Comment[sr@ijekavianlatin]=Dobavljač APOD‑a -Comment[sr@latin]=Dobavljač APOD‑a -Comment[sv]=Tillhandahåll från Apod -Comment[tr]=Apod Sağlayıcı -Comment[uk]=Постачальник даних Apod -Comment[x-test]=xxApod Providerxx -Comment[zh_CN]=Apod 提供方 -Comment[zh_TW]=Apod 提供者 diff --git a/kdeplasma-addons/dataengines/potd/apodprovider.h b/kdeplasma-addons/dataengines/potd/apodprovider.h deleted file mode 100644 index 28790070..00000000 --- a/kdeplasma-addons/dataengines/potd/apodprovider.h +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (C) 2007 Tobias Koenig - * Copyright 2008 by Anne-Marie Mahfouf - * - * 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; either version 2 of the License, or - * (at your option) any later version. - * - * 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 APODPROVIDER_H -#define APODPROVIDER_H - -#include "potdprovider.h" - -/** - * This class provides the image for APOD - * "Astronomy Picture Of the Day" - * located at http://antwrp.gsfc.nasa.gov/apod. - * Direct link to the picture of the day page is - * http://antwrp.gsfc.nasa.gov/apod/apYYMMDD.html - * where YY is the year last 2 digits, - * MM is the month and DD the day, in 2 digits. - */ -class ApodProvider : public PotdProvider -{ - Q_OBJECT - - public: - /** - * Creates a new APOD provider. - * - * @param date The date for which the image shall be fetched. - * @param parent The parent object. - */ - ApodProvider( QObject *parent, const QVariantList &args ); - - /** - * Destroys the APOD provider. - */ - ~ApodProvider(); - - /** - * Returns the requested image. - * - * Note: This method returns only a valid image after the - * finished() signal has been emitted. - */ - virtual QImage image() const; - - private: - class Private; - Private* const d; - - Q_PRIVATE_SLOT( d, void pageRequestFinished( KJob* ) ) - Q_PRIVATE_SLOT( d, void imageRequestFinished( KJob* ) ) -}; - -#endif diff --git a/kdeplasma-addons/dataengines/potd/cachedprovider.cpp b/kdeplasma-addons/dataengines/potd/cachedprovider.cpp deleted file mode 100644 index 1884cd47..00000000 --- a/kdeplasma-addons/dataengines/potd/cachedprovider.cpp +++ /dev/null @@ -1,113 +0,0 @@ -/* - * Copyright (C) 2007 Tobias Koenig - * - * 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; either version 2 of the License, or - * (at your option) any later version. - * - * 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 "cachedprovider.h" - -#include -#include -#include -#include -#include -#include - -#include -#include - -static const QByteArray imageFormat = QImageWriter::defaultImageFormat(); - -LoadImageThread::LoadImageThread(const QString &filePath) - : m_filePath(filePath) -{ -} - -void LoadImageThread::run() -{ - QImage image; - image.load(m_filePath, imageFormat); - emit done(image); -} - -SaveImageThread::SaveImageThread(const QString &identifier, const QImage &image) - : m_image(image), - m_identifier(identifier) -{ -} - -void SaveImageThread::run() -{ - const QString path = CachedProvider::identifierToPath( m_identifier ); - m_image.save(path, imageFormat); - emit done( m_identifier, path, m_image ); -} - -QString CachedProvider::identifierToPath( const QString &identifier ) -{ - const QString dataDir = KStandardDirs::locateLocal( "cache", QLatin1String("plasma_engine_podt/") ); - return QString( dataDir + identifier ); -} - - -CachedProvider::CachedProvider( const QString &identifier, QObject *parent ) - : PotdProvider( parent ), mIdentifier( identifier ) -{ - LoadImageThread *thread = new LoadImageThread( identifierToPath( mIdentifier ) ); - connect(thread, SIGNAL(done(QImage)), this, SLOT(triggerFinished(QImage))); - QThreadPool::globalInstance()->start(thread); -} - -CachedProvider::~CachedProvider() -{ -} - -QImage CachedProvider::image() const -{ - return mImage; -} - -QString CachedProvider::identifier() const -{ - return mIdentifier; -} - -void CachedProvider::triggerFinished(const QImage &image) -{ - mImage = image; - emit finished( this ); -} - -bool CachedProvider::isCached( const QString &identifier, bool ignoreAge ) -{ - const QString path = identifierToPath( identifier ); - if (!QFile::exists( path ) ) { - return false; - } - - if (!ignoreAge && !identifier.contains( ':' ) ) { - // no date in the identifier, so it's a daily; check to see ifthe modification time is today - QFileInfo info( path ); - if ( info.lastModified().daysTo( QDateTime::currentDateTime() ) > 1 ) { - return false; - } - } - - return true; -} - -#include "moc_cachedprovider.cpp" - diff --git a/kdeplasma-addons/dataengines/potd/cachedprovider.h b/kdeplasma-addons/dataengines/potd/cachedprovider.h deleted file mode 100644 index b562acf4..00000000 --- a/kdeplasma-addons/dataengines/potd/cachedprovider.h +++ /dev/null @@ -1,111 +0,0 @@ -/* - * Copyright (C) 2007 Tobias Koenig - * - * 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; either version 2 of the License, or - * (at your option) any later version. - * - * 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 CACHEDPROVIDER_H -#define CACHEDPROVIDER_H - -#include -#include - -#include "potdprovider.h" - -/** - * This class provides pictures from the local cache. - */ -class CachedProvider : public PotdProvider -{ - Q_OBJECT - - public: - /** - * Creates a new cached provider. - * - * @param identifier The identifier of the cached picture. - * @param parent The parent object. - */ - CachedProvider( const QString &identifier, QObject *parent ); - - /** - * Destroys the cached provider. - */ - ~CachedProvider(); - - /** - * 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 picture request (name + date). - */ - virtual QString identifier() const; - - /** - * Returns whether a picture with the given @p identifier is cached. - */ - static bool isCached( const QString &identifier, bool ignoreAge = false ); - - /** - * Returns a path for the given identifier - */ - static QString identifierToPath( const QString &identifier ); - - private Q_SLOTS: - void triggerFinished(const QImage &image); - - private: - QString mIdentifier; - QImage mImage; -}; - -class LoadImageThread : public QObject, public QRunnable -{ - Q_OBJECT - -public: - LoadImageThread(const QString &filePath); - void run(); - -Q_SIGNALS: - void done(const QImage &pixmap); - -private: - QString m_filePath; -}; - -class SaveImageThread : public QObject, public QRunnable -{ - Q_OBJECT - -public: - SaveImageThread(const QString &identifier, const QImage &image); - void run(); - -Q_SIGNALS: - void done( const QString &source, const QString &path, const QImage &img ); - -private: - QImage m_image; - QString m_identifier; -}; - -#endif diff --git a/kdeplasma-addons/dataengines/potd/flickrprovider.cpp b/kdeplasma-addons/dataengines/potd/flickrprovider.cpp deleted file mode 100644 index d3434222..00000000 --- a/kdeplasma-addons/dataengines/potd/flickrprovider.cpp +++ /dev/null @@ -1,171 +0,0 @@ -/* - * Copyright (C) 2007 Tobias Koenig - * Copyright 2008 by Anne-Marie Mahfouf - * Copyright 2008 by Georges Toth - * - * 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; either version 2 of the License, or - * (at your option) any later version. - * - * 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 "flickrprovider.h" - -#include -#include - -#include -#include -#include - -// for reference: -// https://www.flickr.com/services/api/misc.urls.html -// https://www.flickr.com/services/api/explore/flickr.interestingness.getList - -static const QString s_flickrapiurl = QString::fromLatin1( - "https://api.flickr.com/services/rest/?api_key=31f4917c363e2f76b9fc944790dcc338&format=json&method=flickr.interestingness.getList&date=" -); -static const QString s_flickrimageurl = QString::fromLatin1( - "https://live.staticflickr.com/%1/%2_%3_b.jpg" -); - -POTDPROVIDER_EXPORT_PLUGIN(FlickrProvider, "FlickrProvider", "") - -class FlickrProvider::Private -{ - public: - Private(FlickrProvider *parent) - : mParent(parent) - { - } - - void pageRequestFinished(KJob*); - void imageRequestFinished(KJob*); - void parsePage(); - - FlickrProvider *mParent; - QDate mActualDate; - QImage mImage; - - private: - QStringList m_photoList; -}; - -void FlickrProvider::Private::pageRequestFinished(KJob *kjob) -{ - KIO::StoredTransferJob* kstoredjob = qobject_cast(kjob); - if (kstoredjob->error()) { - kWarning() << "request error" << kstoredjob->url(); - kstoredjob->deleteLater(); - emit mParent->error(mParent); - return; - } - - m_photoList.clear(); - - // HACK: fix the data to be valid JSON - QByteArray jsondata = kstoredjob->data(); - if (jsondata.startsWith("jsonFlickrApi(") && jsondata.endsWith(')')) { - jsondata = jsondata.mid(14, jsondata.size() - 15); - } - kstoredjob->deleteLater(); - - const QJsonDocument jsondoc = QJsonDocument::fromJson(jsondata); - if (jsondoc.isNull()) { - kWarning() << "JSON error" << jsondoc.errorString(); - return; - } - - const QVariantMap jsonmap = jsondoc.toVariant().toMap(); - const QString apistat = jsonmap["stat"].toString(); - if (apistat == QLatin1String("fail")) { - // No pictures available for the specified parameters, decrement the date to two days earlier... - mActualDate = mActualDate.addDays(-2); - - const KUrl queryurl(s_flickrapiurl + mActualDate.toString(Qt::ISODate)); - kDebug() << "stat fail, retrying with" << queryurl.prettyUrl(); - kstoredjob->deleteLater(); - kstoredjob = KIO::storedGet(queryurl, KIO::HideProgressInfo); - kstoredjob->setAutoDelete(false); - mParent->connect(kstoredjob, SIGNAL(finished(KJob*)), SLOT(pageRequestFinished(KJob*))); - return; - } - - foreach (const QVariant &photo, jsonmap["photos"].toMap()["photo"].toList()) { - const QVariantMap photomap = photo.toMap(); - const QString photoispublic = photomap["ispublic"].toString(); - if (photoispublic != QLatin1String("1")) { - kDebug() << "skipping non-public photo"; - continue; - } - const QString photoserver = photomap["server"].toString(); - const QString photoid = photomap["id"].toString(); - const QString photosecret = photomap["secret"].toString(); - const QString photourl = s_flickrimageurl.arg(photoserver, photoid, photosecret); - kDebug() << "photo" << photourl; - m_photoList.append(photourl); - } - - if (m_photoList.isEmpty()) { - kWarning() << "empty photo list"; - return; - } - - const KUrl photourl(m_photoList.at(KRandom::randomMax(m_photoList.size()))); - kDebug() << "chosen photo" << photourl.prettyUrl(); - kstoredjob = KIO::storedGet(photourl, KIO::HideProgressInfo); - kstoredjob->setAutoDelete(false); - mParent->connect(kstoredjob, SIGNAL(finished(KJob*)), SLOT(imageRequestFinished(KJob*))); -} - -void FlickrProvider::Private::imageRequestFinished(KJob *kjob) -{ - KIO::StoredTransferJob* kstoredjob = qobject_cast(kjob); - if (kstoredjob->error()) { - kWarning() << "image job error" << kstoredjob->url(); - kstoredjob->deleteLater(); - emit mParent->error(mParent); - return; - } - - mImage = QImage::fromData(kstoredjob->data()); - if (mImage.isNull()) { - kWarning() << "null image for" << kstoredjob->url(); - } - kstoredjob->deleteLater(); - emit mParent->finished(mParent); -} - -FlickrProvider::FlickrProvider(QObject *parent, const QVariantList &args) - : PotdProvider(parent, args), - d(new Private(this)) -{ - d->mActualDate = date(); - const KUrl queryurl(s_flickrapiurl + d->mActualDate.toString(Qt::ISODate)); - kDebug() << "starting job for" << queryurl.prettyUrl(); - KIO::StoredTransferJob *kstoredjob = KIO::storedGet(queryurl, KIO::HideProgressInfo); - kstoredjob->setAutoDelete(false); - connect(kstoredjob, SIGNAL(finished(KJob*)), SLOT(pageRequestFinished(KJob*))); -} - -FlickrProvider::~FlickrProvider() -{ - delete d; -} - -QImage FlickrProvider::image() const -{ - return d->mImage; -} - -#include "moc_flickrprovider.cpp" diff --git a/kdeplasma-addons/dataengines/potd/flickrprovider.desktop b/kdeplasma-addons/dataengines/potd/flickrprovider.desktop deleted file mode 100644 index 49f208eb..00000000 --- a/kdeplasma-addons/dataengines/potd/flickrprovider.desktop +++ /dev/null @@ -1,106 +0,0 @@ -[Desktop Entry] -Type=Service -X-KDE-ServiceTypes=PlasmaPoTD/Plugin -X-KDE-Library=plasma_potd_flickrprovider -X-KDE-PlasmaPoTDProvider-Identifier=flickr -Icon= - -Name=Flickr Picture of the Day -Name[ar]=صورة فليكر اليومية -Name[bs]=Flickr slika dana -Name[ca]=Imatge Flickr del dia -Name[ca@valencia]=Imatge Flickr del dia -Name[cs]=Obrázek dne z Flickru -Name[da]=Dagens Flickr-billede -Name[de]=Bild des Tages von Flickr -Name[el]=Flickr φωτογραφία της ημέρας -Name[en_GB]=Flickr Picture of the Day -Name[es]=Imagen de Flickr del día -Name[et]=Flickri päevapilt -Name[fi]=Päivän Flickr-kuva -Name[fr]=Image du jour « Flickr » -Name[ga]=Grianghraf an Lae ó Flickr -Name[gl]=Imaxe do día de Flickr -Name[hr]=Slika dana na Flickru -Name[hu]=A nap képe a Flickr-ön -Name[it]=Immagine del giorno di Flickr -Name[ja]=Flickr 今日の写真 -Name[kk]=Flickr "Тәулік суреті" (Apod) -Name[km]=រូប​ភាព​ប្រចាំថ្ងៃ Flickr -Name[ko]=오늘의 Flickr 그림 -Name[lv]=Flickr dienas attēls -Name[mr]=फ्लिकर दिवसाचे चित्र -Name[nb]=Dagens Flickr-bilde -Name[nds]=Flickr-Bild för Vundaag -Name[nl]=Flickr-afbeelding van de dag -Name[nn]=Dagens bilete frå Flickr -Name[pa]=ਫਲਿੱਕਰ ਅੱਜ ਦੀ ਤਸਵੀਰ -Name[pl]=Obraz dnia Flickr -Name[pt]=Imagem do Dia no Flickr -Name[pt_BR]=Imagem do dia do Flickr -Name[ro]=Imaginea zilei de pe Flickr -Name[ru]=Изображение дня Flickr -Name[sk]=Obrázok dňa z Flickr -Name[sl]=Flickr-jeva slika dneva -Name[sr]=слика дана са Фликра -Name[sr@ijekavian]=слика дана са Фликра -Name[sr@ijekavianlatin]=slika dana sa Flickra -Name[sr@latin]=slika dana sa Flickra -Name[sv]=Dagens bild från Flickr -Name[th]=ภาพประจำวันจาก Flickr -Name[tr]=Günün Flickr Resmi -Name[uk]=Зображення дня Flickr -Name[x-test]=xxFlickr Picture of the Dayxx -Name[zh_CN]=每日一图(Flickr) -Name[zh_TW]=本日 Flickr 圖片 -Comment=Flickr Provider -Comment[ar]=الموزد Flickr -Comment[ast]=Fornidor de Flickr -Comment[bs]=Dobavljac Flickr-a -Comment[ca]=Proveïdor Flickr -Comment[ca@valencia]=Proveïdor Flickr -Comment[cs]=Poskytovatel Flickru -Comment[da]=Flickr-udbyder. -Comment[de]=Flickr-Anbieter -Comment[el]=Πάροχος Flickr -Comment[en_GB]=Flickr Provider -Comment[es]=Proveedor de Flickr -Comment[et]=Flickri pakkuja -Comment[fi]=Flickr-tarjoaja -Comment[fr]=Fournisseur « Flickr » -Comment[ga]=Soláthraí Flickr -Comment[gl]=Fornecedor de Flickr -Comment[hr]=Pružatelj Flickra -Comment[hu]=Flickr-szolgáltató -Comment[is]=Flickr þjónusta -Comment[it]=Fornitore Flickr -Comment[ja]=Flickr のプロバイダ -Comment[kk]=Flickr таратушысы -Comment[km]=ក្រុមហ៊ុន​ផ្ដល់ Flickr -Comment[ko]=Flickr 공급자 -Comment[lt]=Flickr tiekėjas -Comment[lv]=Flickr piegādātājs -Comment[mr]=फ्लिकर पुरवठाकर्ता -Comment[nb]=Flickr-leverandør -Comment[nds]=Flickr-Anbeder -Comment[nl]=Flickr-provider -Comment[nn]=Flickr-tilbydar -Comment[pa]=ਫਲਿੱਕਰ ਦੇਣ ਵਾਲੇ -Comment[pl]=Usługodawca Flickr -Comment[pt]=Fornecedor do Flickr -Comment[pt_BR]=Fornecedor Flickr -Comment[ro]=Furnizor Flickr -Comment[ru]=Источник данных Flickr -Comment[sk]=Poskytovateľ Flickr -Comment[sl]=Ponudnik Flickr -Comment[sr]=Добављач Фликра -Comment[sr@ijekavian]=Добављач Фликра -Comment[sr@ijekavianlatin]=Dobavljač Flickra -Comment[sr@latin]=Dobavljač Flickra -Comment[sv]=Tillhandahåll från Flickr -Comment[tr]=Flickr Sağlayıcı -Comment[uk]=Постачальник даних Flickr -Comment[wa]=Ahesseu d' Flickr -Comment[x-test]=xxFlickr Providerxx -Comment[zh_CN]=Flickr 提供方 -Comment[zh_TW]=Flickr 提供者 diff --git a/kdeplasma-addons/dataengines/potd/flickrprovider.h b/kdeplasma-addons/dataengines/potd/flickrprovider.h deleted file mode 100644 index 2e1f0c5e..00000000 --- a/kdeplasma-addons/dataengines/potd/flickrprovider.h +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (C) 2007 Tobias Koenig - * Copyright 2008 by Anne-Marie Mahfouf - * Copyright 2008 by Georges Toth - * - * 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; either version 2 of the License, or - * (at your option) any later version. - * - * 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 FLICKRPROVIDER_H -#define FLICKRPROVIDER_H - -#include "potdprovider.h" - -/** -* This class grabs a random image from the flickr -* interestingness stream of pictures, for the given date. -* Should there be no image for the current date, it tries -* to grab one from the day before yesterday. - */ -class FlickrProvider : public PotdProvider -{ - Q_OBJECT -public: - /** - * Creates a new flickr provider. - * - * @param date The date for which the image shall be fetched. - * @param parent The parent object. - */ - FlickrProvider(QObject *parent, const QVariantList &args); - - /** - * Destroys the flickr provider. - */ - ~FlickrProvider(); - - /** - * Returns the requested image. - * - * Note: This method returns only a valid image after the - * finished() signal has been emitted. - */ - virtual QImage image() const; - -private: - class Private; - Private* const d; - - Q_PRIVATE_SLOT(d, void pageRequestFinished(KJob* )) - Q_PRIVATE_SLOT(d, void imageRequestFinished(KJob*)) -}; - -#endif diff --git a/kdeplasma-addons/dataengines/potd/pexelsprovider.cpp b/kdeplasma-addons/dataengines/potd/pexelsprovider.cpp deleted file mode 100644 index 308d99bf..00000000 --- a/kdeplasma-addons/dataengines/potd/pexelsprovider.cpp +++ /dev/null @@ -1,143 +0,0 @@ -/* - * Copyright (C) 2023 Ivailo Monev - * - * 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; either version 2 of the License, or - * (at your option) any later version. - * - * 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 "pexelsprovider.h" - -#include -#include - -#include -#include -#include - -// for reference: -// https://www.pexels.com/api/documentation/#photos-curated - -static const QString s_pexelsapikey = QString::fromLatin1("WeDUAEYr4oV9211fAie7Jcwat6tNlkrW0BTx7kaoiyITGWp7WMcxpSoM"); -static const QString s_pexelsapiurl = QString::fromLatin1("https://api.pexels.com/v1/curated"); - -POTDPROVIDER_EXPORT_PLUGIN(PexelsProvider, "PexelsProvider", "") - -class PexelsProvider::Private -{ -public: - Private(PexelsProvider *parent) - : mParent(parent) - { - } - - void pageRequestFinished(KJob*); - void imageRequestFinished(KJob*); - void parsePage(); - - PexelsProvider *mParent; - QImage mImage; - -private: - QStringList m_photoList; -}; - -void PexelsProvider::Private::pageRequestFinished(KJob *kjob) -{ - KIO::StoredTransferJob* kstoredjob = qobject_cast(kjob); - if (kstoredjob->error()) { - kWarning() << "request error" << kstoredjob->url(); - kstoredjob->deleteLater(); - emit mParent->error(mParent); - return; - } - - m_photoList.clear(); - - const QByteArray jsondata = kstoredjob->data(); - kstoredjob->deleteLater(); - - const QJsonDocument jsondoc = QJsonDocument::fromJson(jsondata); - if (jsondoc.isNull()) { - kWarning() << "JSON error" << jsondoc.errorString(); - return; - } - - const QVariantMap jsonmap = jsondoc.toVariant().toMap(); - const QVariantList jsonphotoslist = jsonmap["photos"].toList(); - foreach (const QVariant &photo, jsonphotoslist) { - const QVariantMap photomap = photo.toMap()["src"].toMap(); - const QString photourl = photomap["landscape"].toString(); - if (photourl.isEmpty()) { - kDebug() << "skipping photo without landscape url"; - continue; - } - kDebug() << "photo" << photourl; - m_photoList.append(photourl); - } - - if (m_photoList.isEmpty()) { - kWarning() << "empty photo list"; - return; - } - - const KUrl photourl(m_photoList.at(KRandom::randomMax(m_photoList.size()))); - kDebug() << "chosen photo" << photourl.prettyUrl(); - kstoredjob = KIO::storedGet(photourl, KIO::HideProgressInfo); - kstoredjob->setAutoDelete(false); - kstoredjob->addMetaData("Authorization", s_pexelsapikey); - mParent->connect(kstoredjob, SIGNAL(finished(KJob*)), SLOT(imageRequestFinished(KJob*))); -} - -void PexelsProvider::Private::imageRequestFinished(KJob *kjob) -{ - KIO::StoredTransferJob* kstoredjob = qobject_cast(kjob); - if (kstoredjob->error()) { - kWarning() << "image job error" << kstoredjob->url(); - kstoredjob->deleteLater(); - emit mParent->error(mParent); - return; - } - - mImage = QImage::fromData(kstoredjob->data()); - if (mImage.isNull()) { - kWarning() << "null image for" << kstoredjob->url(); - } - kstoredjob->deleteLater(); - emit mParent->finished(mParent); -} - -PexelsProvider::PexelsProvider(QObject *parent, const QVariantList &args) - : PotdProvider(parent, args), - d(new Private(this)) -{ - const KUrl queryurl(s_pexelsapiurl); - kDebug() << "starting job for" << queryurl.prettyUrl(); - KIO::StoredTransferJob *kstoredjob = KIO::storedGet(queryurl, KIO::HideProgressInfo); - kstoredjob->setAutoDelete(false); - kstoredjob->addMetaData("Authorization", s_pexelsapikey); - connect(kstoredjob, SIGNAL(finished(KJob*)), SLOT(pageRequestFinished(KJob*))); -} - -PexelsProvider::~PexelsProvider() -{ - delete d; -} - -QImage PexelsProvider::image() const -{ - return d->mImage; -} - -#include "moc_pexelsprovider.cpp" diff --git a/kdeplasma-addons/dataengines/potd/pexelsprovider.desktop b/kdeplasma-addons/dataengines/potd/pexelsprovider.desktop deleted file mode 100644 index dc02437a..00000000 --- a/kdeplasma-addons/dataengines/potd/pexelsprovider.desktop +++ /dev/null @@ -1,9 +0,0 @@ -[Desktop Entry] -Type=Service -X-KDE-ServiceTypes=PlasmaPoTD/Plugin -X-KDE-Library=plasma_potd_pexelsprovider -X-KDE-PlasmaPoTDProvider-Identifier=pexels -Icon= - -Name=Pexels Picture of the Day -Comment=Pexels Provider diff --git a/kdeplasma-addons/dataengines/potd/pexelsprovider.h b/kdeplasma-addons/dataengines/potd/pexelsprovider.h deleted file mode 100644 index 0fdc774d..00000000 --- a/kdeplasma-addons/dataengines/potd/pexelsprovider.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (C) 2023 Ivailo Monev - * - * 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; either version 2 of the License, or - * (at your option) any later version. - * - * 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 PEXELSPROVIDER_H -#define PEXELSPROVIDER_H - -#include "potdprovider.h" - -class PexelsProvider : public PotdProvider -{ - Q_OBJECT -public: - PexelsProvider(QObject *parent, const QVariantList &args); - ~PexelsProvider(); - - virtual QImage image() const; - -private: - class Private; - Private* const d; - - Q_PRIVATE_SLOT(d, void pageRequestFinished(KJob *)) - Q_PRIVATE_SLOT(d, void imageRequestFinished(KJob *)) -}; - -#endif diff --git a/kdeplasma-addons/dataengines/potd/plasma-dataengine-potd.desktop b/kdeplasma-addons/dataengines/potd/plasma-dataengine-potd.desktop deleted file mode 100644 index 8bb10eaf..00000000 --- a/kdeplasma-addons/dataengines/potd/plasma-dataengine-potd.desktop +++ /dev/null @@ -1,112 +0,0 @@ -[Desktop Entry] -Encoding=UTF-8 -Name=Picture of the Day -Name[ar]=صورة اليوم -Name[ast]=Imaxe del día -Name[bs]=Slika dana -Name[ca]=Imatge del dia -Name[ca@valencia]=Imatge del dia -Name[cs]=Obrázek dne -Name[da]=Dagens billede -Name[de]=Bild des Tages -Name[el]=Φωτογραφία της ημέρας -Name[en_GB]=Picture of the Day -Name[es]=Imagen del día -Name[et]=Päevapilt -Name[fi]=Päivän kuva -Name[fr]=Image du jour -Name[ga]=Grianghraf an Lae -Name[gl]=Imaxe do día -Name[hr]=Slika dana -Name[hu]=A nap képe -Name[is]=Myndir dagsins -Name[it]=Immagine del giorno -Name[ja]=今日の写真 -Name[kk]=Тәулік суреті -Name[km]=រូបភាព​ប្រចាំ​ថ្ងៃ -Name[ko]=오늘의 그림 -Name[lt]=Dienos paveiksliukas -Name[lv]=Dienas attēls -Name[mr]=दिवसाचे चित्र -Name[nb]=Dagens bilde -Name[nds]=Bild för Vundaag -Name[nl]=Afbeelding van de dag -Name[nn]=Dagens bilete -Name[pa]=ਅੱਜ ਦੀ ਤਸਵੀਰ -Name[pl]=Obraz dnia -Name[pt]=Imagem do Dia -Name[pt_BR]=Imagem do dia -Name[ro]=Imaginea zilei -Name[ru]=Изображение дня -Name[sk]=Obrázok dňa -Name[sl]=Slika dneva -Name[sr]=слика дана -Name[sr@ijekavian]=слика дана -Name[sr@ijekavianlatin]=slika dana -Name[sr@latin]=slika dana -Name[sv]=Dagens bild -Name[tr]=Günün Resmi -Name[uk]=Картинка дня -Name[wa]=Imådje do djoû -Name[x-test]=xxPicture of the Dayxx -Name[zh_CN]=每日一图 -Name[zh_TW]=本日圖片 -Comment=Data Engine for getting various online Pictures of The Day. -Comment[ar]=محرك بيانات للحصول على مختلف صور هذا اليوم من الإنترنت. -Comment[ast]=Motor de datos pa obtener delles imáxenes del día de la rede. -Comment[bs]=Pogon podataka za dobivanje različitih slika dana sa veze -Comment[ca]=Motor de dades per accedir a diverses «imatges del dia» en línia. -Comment[ca@valencia]=Motor de dades per accedir a diverses «imatges del dia» en línia. -Comment[cs]=Mechanismus pro získávání různých obrázků dne ze sítě. -Comment[da]=Datamotor der henter diverse online dagens billede. -Comment[de]=Daten-Treiber zum Holen verschiedener Bilder des Tages. -Comment[el]=Μηχανή δεδομένων για ανάκτηση διαφόρων διαδικτυακών φωτογραφιών της ημέρας. -Comment[en_GB]=Data Engine for getting various online Pictures of The Day. -Comment[es]=Motor de datos para obtener diversas imágenes del día de la red. -Comment[et]=Andmete mootor internetis leiduvate päevapiltide hankimiseks. -Comment[fi]=Tietomoottori erilaisten päivän kuvien noutamiseksi verkosta -Comment[fr]=Moteur de données permettant l'accès à divers sites d'images du jour. -Comment[gl]=Motor de datos para obter varias Imaxes do día en liña. -Comment[hr]=Podatkovni mehanizam za dohvaćanje raznih Slika dana na Internetu -Comment[hu]=Adatmotor különböző online „A nap képe” szolgáltatásokhoz. -Comment[is]=Gagnavél til að ná í ýmsar 'Myndir dagsins' á netinu. -Comment[it]=Motore dati per ottenere numerose immagini del giorno dalla rete. -Comment[ja]=インターネット上のさまざまな今日の写真を取得するデータエンジン -Comment[kk]=Түрлі онлайн Күнделікті суреттерді қабылдайтын тетігі -Comment[km]=ម៉ាស៊ីន​​ទិន្នន័យ​សម្រាប់​ទទួល​យក​រូបភាព​ប្រចាំ​ថ្ងៃ​លើ​បណ្ដាញ​ផ្សេងៗ ។ -Comment[ko]=다양한 오늘의 그림 데이터 엔진입니다. -Comment[lv]=Datu dzinējs, kas ielādē dažādus dienas attēlus. -Comment[mr]=विविध दिवसाचे चित्र प्राप्त करण्याकरिता डेटा इंजिन -Comment[nb]=Datamotor for å hente forskjellige Dagens Bilder fra nettverket. -Comment[nds]=Datenkarn för't Halen vun verscheden Biller för Vundaag ut't Internet. -Comment[nl]=Gegevensengine voor het verkrijgen van online afbeeldingen-van-de-dag. -Comment[nn]=Datamotor for henting av dagens bilete -Comment[pl]=Silnik danych do pobierania różnych "obrazów dnia". -Comment[pt]=Motor de dados para obter diversas Imagens do Dia a nível 'online'. -Comment[pt_BR]=Mecanismo de dados para obter várias imagens do dia online. -Comment[ro]=Motor de date pentru obținerea Imaginii zilei din diverse locuri. -Comment[ru]=Источник различных "изображений дня" из сети -Comment[sk]=Nástroj na získavanie rôznych online obrázkov dňa. -Comment[sl]=Podatkovni pogon za pridobivanje raznih slik dneva s spleta. -Comment[sr]=Датомотор за добављање разних слика дана на вези. -Comment[sr@ijekavian]=Датомотор за добављање разних слика дана на вези. -Comment[sr@ijekavianlatin]=Datomotor za dobavljanje raznih slika dana na vezi. -Comment[sr@latin]=Datomotor za dobavljanje raznih slika dana na vezi. -Comment[sv]=Datagränssnitt för att hämta diverse dagens bilder från nätet. -Comment[tr]=Çeşitli çevrim içi Günün Resimleri için veri motoru. -Comment[uk]=Рушій даних для отримання різноманітних мережевих «Зображень дня» -Comment[wa]=Éndjin di dnêyes pos awè sacwantès Imådjes do djoû so fyis. -Comment[x-test]=xxData Engine for getting various online Pictures of The Day.xx -Comment[zh_CN]=获得各种在线每日一图的数据引擎。 -Comment[zh_TW]=取得多種線上本日圖片的資料引擎 -X-KDE-ServiceTypes=Plasma/DataEngine -Type=Service -Icon=image-jpeg2000 -X-KDE-Library=plasma_engine_potd - -X-KDE-PluginInfo-Author= -X-KDE-PluginInfo-Email= -X-KDE-PluginInfo-Name=potd -X-KDE-PluginInfo-Version= -X-KDE-PluginInfo-Website= -X-KDE-PluginInfo-Category= diff --git a/kdeplasma-addons/dataengines/potd/plasma_potdprovider.desktop b/kdeplasma-addons/dataengines/potd/plasma_potdprovider.desktop deleted file mode 100644 index c9394a57..00000000 --- a/kdeplasma-addons/dataengines/potd/plasma_potdprovider.desktop +++ /dev/null @@ -1,55 +0,0 @@ -[Desktop Entry] -Type=ServiceType -X-KDE-ServiceType=PlasmaPoTD/Plugin -Comment=Plugin for Plasma PoTD Engine -Comment[ar]=ملحق لمحرك PoTD -Comment[ast]=Complementu pal motor d'imaxe del día de Plasma -Comment[bs]=Dodaci za plazma PoTD motor -Comment[ca]=Connector per al motor PoTD del plasma -Comment[ca@valencia]=Connector per al motor PoTD del plasma -Comment[cs]=Modul pro Plasma PoTD engine -Comment[da]=Plugin til Plasmas dagens billede-motor. -Comment[de]=Modul für den Plasma-Datentreiber „Bilder des Tages“ -Comment[el]=Πρόσθετο της μηχανής Plasma PoTD -Comment[en_GB]=Plugin for Plasma PoTD Engine -Comment[es]=Complemento para el motor de imagen del día de Plasma -Comment[et]=Plasma päevapildi mootori plugin -Comment[fi]=Liitännäinen Plasman Päivän kuva -moottorille -Comment[fr]=Module externe Plasma pour le moteur « PoTD » -Comment[ga]=Breiseán le haghaidh inneall PoTD Plasma -Comment[gl]=Extensión para o motor PoTD de Plasma -Comment[hr]=Priključak za Plasmin mehanizam PoTD -Comment[hu]=Bővítmény a Plazma PoTD-motorhoz -Comment[is]=Íforrit fyrir PoTD plasmavél -Comment[it]=Estensione per il motore PoTD di Plasma -Comment[ja]=Plasma PoTD (今日の写真) エンジンのためのプラグイン -Comment[kk]=Plasma PoTD (Күнделікті сурет) тетігінің плагині -Comment[km]=កម្មវិធី​ជំនួយ​សម្រាប់​ប្លាស្មា​ម៉ាស៊ីន PoTD -Comment[ko]=Plasma 오늘의 그림 엔진 플러그인 -Comment[lv]=Spraudnis Plasma PoTD dzinējam -Comment[mr]=प्लाज्मा पीओटीडी इंजिनाकरिता प्लगइन -Comment[nb]=Programtillegg for Plasma-motor Dagens Bilde -Comment[nds]=Moduul för Plasma sien BifV-Karn -Comment[nl]=Plug-in voor Plasma-PoTD-engine -Comment[nn]=Programtillegg for Plasma PoTD-motoren -Comment[pa]=ਪਲਾਜ਼ਮਾ PoTD ਇੰਜਣ ਲਈ ਪਲੱਗਇਨ -Comment[pl]=Wtyczka silnika PoTD Plazmy -Comment[pt]='Plugin' do Motor da Imagem do Dia do Plasma -Comment[pt_BR]=Plugin para o mecanismo PoTD do Plasma -Comment[ro]=Modul pentru motorul de imagine a zilei Plasma -Comment[ru]=Поддержка картинки дня для Plasma -Comment[sk]=Modul pre Plasma PoTD nástroj -Comment[sl]=Vstavek za pogon Slika dneva za Plasmo -Comment[sr]=Прикључак за Плазминог мотор слика дана -Comment[sr@ijekavian]=Прикључак за Плазминог мотор слика дана -Comment[sr@ijekavianlatin]=Priključak za Plasminog motor slika dana -Comment[sr@latin]=Priključak za Plasminog motor slika dana -Comment[sv]=Insticksprogram för Plasma gränssnitt till dagens bild -Comment[tr]=Plasma PoTD Motoru için Eklenti -Comment[uk]=Додаток для рушія Плазми PoTD -Comment[x-test]=xxPlugin for Plasma PoTD Enginexx -Comment[zh_CN]=Plasma 每日一图引擎插件 -Comment[zh_TW]=Plasma PoTD 引擎的外掛程式 - -[PropertyDef::X-KDE-PlasmaPoTDProvider-Identifier] -Type=QString diff --git a/kdeplasma-addons/dataengines/potd/potd.cpp b/kdeplasma-addons/dataengines/potd/potd.cpp deleted file mode 100644 index 2827d046..00000000 --- a/kdeplasma-addons/dataengines/potd/potd.cpp +++ /dev/null @@ -1,187 +0,0 @@ -/* - * Copyright (C) 2007 Tobias Koenig - * - * 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; either version 2 of the License, or - * (at your option) any later version. - * - * 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 "potd.h" - -#include -#include -#include -#include -#include - -#include -#include - -#include - -#include "cachedprovider.h" -#include "kstandarddirs.h" - -PotdEngine::PotdEngine( QObject* parent, const QVariantList& args ) - : Plasma::DataEngine( parent, args ) -{ - // set polling to every 5 minutes - setMinimumPollingInterval(5 * 60 * 1000); - m_checkDatesTimer = new QTimer( this );//change picture after 24 hours - connect( m_checkDatesTimer, SIGNAL(timeout()), this, SLOT(checkDayChanged()) ); - //FIXME: would be nice to stop and start this timer ONLY as needed, e.g. only when there are - // time insensitive sources to serve; still, this is better than how i found it, checking - // every 2 seconds (!) - m_checkDatesTimer->setInterval( 10 * 60 * 1000 ); // check every 10 minutes - m_checkDatesTimer->start(); -} - -PotdEngine::~PotdEngine() -{ -} - -void PotdEngine::init() -{ - KService::List services = KServiceTypeTrader::self()->query(QLatin1String( "PlasmaPoTD/Plugin" )); - Q_FOREACH ( const KService::Ptr &service, services ) { - QString provider = service->property(QLatin1String( "X-KDE-PlasmaPoTDProvider-Identifier" ), QVariant::String).toString(); - mFactories.insert(provider, service); - setData( QLatin1String( "Providers" ), provider, service->name() ); - } -} - -bool PotdEngine::updateSourceEvent( const QString &identifier ) -{ - return updateSource( identifier, false ); -} - -bool PotdEngine::updateSource( const QString &identifier, bool loadCachedAlways ) -{ - // check whether it is cached already... - if ( CachedProvider::isCached( identifier, loadCachedAlways ) ) { - QVariantList args; - args << QLatin1String( "String" ) << identifier; - - CachedProvider *provider = new CachedProvider( identifier, this ); - connect( provider, SIGNAL(finished(PotdProvider*)), this, SLOT(finished(PotdProvider*)) ); - connect( provider, SIGNAL(error(PotdProvider*)), this, SLOT(error(PotdProvider*)) ); - - m_canDiscardCache = loadCachedAlways; - if (!loadCachedAlways) { - return true; - } - } - - const QStringList parts = identifier.split( QLatin1Char( ':' ), QString::SkipEmptyParts ); - const QString providerName = parts[ 0 ]; - if ( !mFactories.contains( providerName ) ) { - kDebug() << "invalid provider: " << parts[ 0 ]; - return false; - } - - QVariantList args; - args << providerName; - if ( parts.count() > 1 ) { - const QDate date = QDate::fromString( parts[ 1 ], Qt::ISODate ); - if ( !date.isValid() ) { - kDebug() << "invalid date:" << parts[1]; - return false; - } - - args << date; - } - - PotdProvider *provider = qobject_cast( mFactories[ providerName ]->createInstance( this, args ) ); - if (provider) { - connect( provider, SIGNAL(finished(PotdProvider*)), this, SLOT(finished(PotdProvider*)) ); - connect( provider, SIGNAL(error(PotdProvider*)), this, SLOT(error(PotdProvider*)) ); - return true; - } - - return false; -} - -bool PotdEngine::sourceRequestEvent( const QString &identifier ) -{ - if ( updateSource( identifier, true ) ) { - setData( identifier, "Image", QImage() ); - return true; - } - - return false; -} - -void PotdEngine::finished( PotdProvider *provider ) -{ - if ( m_canDiscardCache && qobject_cast( provider ) ) { - Plasma::DataContainer *source = containerForSource( provider->identifier() ); - if ( source && !source->data().value( "Image" ).value().isNull() ) { - provider->deleteLater(); - return; - } - } - - QImage img(provider->image()); - // store in cache if it's not the response of a CachedProvider - if ( qobject_cast( provider ) == 0 && !img.isNull() ) { - SaveImageThread *thread = new SaveImageThread( provider->identifier(), img ); - connect(thread, SIGNAL(done(QString,QString,QImage)), this, SLOT(cachingFinished(QString,QString,QImage))); - QThreadPool::globalInstance()->start(thread); - } else { - setData( provider->identifier(), "Image", img ); - setData( provider->identifier(), "Url", CachedProvider::identifierToPath( provider->identifier()) ); - } - - provider->deleteLater(); -} - -void PotdEngine::cachingFinished( const QString &source, const QString &path, const QImage &img ) -{ - setData( source, "Image", img ); - setData( source, "Url", path ); -} - -void PotdEngine::error( PotdProvider *provider ) -{ - provider->disconnect(this); - provider->deleteLater(); -} - -void PotdEngine::checkDayChanged() -{ - SourceDict dict = containerDict(); - QHashIterator it( dict ); - while ( it.hasNext() ) { - it.next(); - - if ( it.key() == "Providers" ) { - continue; - } - - if ( !it.key().contains(':') ) { - const QString path = CachedProvider::identifierToPath( it.key() ); - if ( !QFile::exists(path) ) { - updateSourceEvent( it.key() ); - } else { - QFileInfo info( path ); - if ( info.lastModified().daysTo( QDateTime::currentDateTime() ) > 1 ) { - updateSourceEvent( it.key() ); - } - } - } - } -} - - -#include "moc_potd.cpp" diff --git a/kdeplasma-addons/dataengines/potd/potd.h b/kdeplasma-addons/dataengines/potd/potd.h deleted file mode 100644 index 7c9218d7..00000000 --- a/kdeplasma-addons/dataengines/potd/potd.h +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (C) 2007 Tobias Koenig - * - * 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; either version 2 of the License, or - * (at your option) any later version. - * - * 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 POTD_DATAENGINE_H -#define POTD_DATAENGINE_H - -#include "plasma/dataengine.h" - -class PotdProvider; - -#include - -/** - * This class provides the Pictures of The Day from various online websites. - * - * The query keys have the following structure: - * : - * e.g. - * apod:2007-07-19 - * - */ -class PotdEngine : public Plasma::DataEngine -{ - Q_OBJECT - - public: - PotdEngine( QObject* parent, const QVariantList& args ); - ~PotdEngine(); - - protected: - void init(); - bool sourceRequestEvent( const QString &identifier ); - - protected Q_SLOTS: - bool updateSourceEvent( const QString &identifier ); - - private Q_SLOTS: - void finished( PotdProvider* ); - void error( PotdProvider* ); - void checkDayChanged(); - void cachingFinished( const QString &source, const QString &path, const QImage &img ); - - private: - bool updateSource( const QString &identifier, bool loadCachedAlways ); - - QMap mFactories; - QTimer *m_checkDatesTimer; - bool m_canDiscardCache; -}; - -K_EXPORT_PLASMA_DATAENGINE(potd, PotdEngine) - -#endif diff --git a/kdeplasma-addons/dataengines/potd/potdprovider.cpp b/kdeplasma-addons/dataengines/potd/potdprovider.cpp deleted file mode 100644 index ccfa27bc..00000000 --- a/kdeplasma-addons/dataengines/potd/potdprovider.cpp +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (C) 2007 Tobias Koenig - * - * 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; either version 2 of the License, or - * (at your option) any later version. - * - * 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 "potdprovider.h" - -class PotdProvider::Private -{ -public: - QString name; - QDate date; -}; - -PotdProvider::PotdProvider( QObject *parent, const QVariantList &args ) - : QObject( parent ), - d(new Private) -{ - if ( args.count() > 0 ) { - d->name = args[ 0 ].toString(); - - if ( args.count() > 1 && args[ 1 ].canConvert( QVariant::Date ) ) { - d->date = args[ 1 ].toDate(); - } - } else { - d->name = "Unknown"; - } -} - -PotdProvider::~PotdProvider() -{ -} - -QString PotdProvider::name() const -{ - return d->name; -} - -QDate PotdProvider::date() const -{ - return d->date.isNull() ? QDate::currentDate() : d->date; -} - -bool PotdProvider::isFixedDate() const -{ - return !d->date.isNull(); -} - -QString PotdProvider::identifier() const -{ - if (isFixedDate()) { - return QString( QLatin1String( "%1:%2" ) ).arg( d->name, d->date.toString( Qt::ISODate )); - } - - return d->name; -} - - -#include "moc_potdprovider.cpp" diff --git a/kdeplasma-addons/dataengines/potd/potdprovider.h b/kdeplasma-addons/dataengines/potd/potdprovider.h deleted file mode 100644 index 4ae947c3..00000000 --- a/kdeplasma-addons/dataengines/potd/potdprovider.h +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright (C) 2007 Tobias Koenig - * - * 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; either version 2 of the License, or - * (at your option) any later version. - * - * 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 POTDPROVIDER_H -#define POTDPROVIDER_H - -#include -#include - -#include - -#include "plasma_potd_export.h" - -#include - -#define POTDPROVIDER_EXPORT_PLUGIN( classname, componentName, catalogName ) \ - K_PLUGIN_FACTORY( classname ## Factory, registerPlugin< classname >(); ) \ - K_EXPORT_PLUGIN( classname ## Factory( componentName, catalogName ) ) - -/** - * This class is an interface for PoTD providers. - */ -class PLASMA_POTD_EXPORT PotdProvider : public QObject -{ - Q_OBJECT - - public: - /** - * Creates a new PoTD provider. - * - * @param parent The parent object. - */ - PotdProvider( QObject *parent, const QVariantList &args = QVariantList() ); - - /** - * Destroys the PoTD provider. - */ - virtual ~PotdProvider(); - - /** - * Returns the requested image. - * - * Note: This method returns only a valid image after the - * finished() signal has been emitted. - */ - virtual QImage image() const = 0; - - /** - * Returns the identifier of the PoTD request (name + date). - */ - virtual QString identifier() const; - - /** - * @return the name of this provider (equiv to X-KDE-PlasmaPoTDProvider-Identifier) - */ - QString name() const; - - /** - * @reutrn the date to load for this item, if any - */ - QDate date() const; - - /** - * @return if the date is fixed, or if it should always be "today" - */ - bool isFixedDate() const; - - Q_SIGNALS: - /** - * This signal is emitted whenever a request has been finished - * successfully. - * - * @param provider The provider which emitted the signal. - */ - void finished( PotdProvider *provider ); - - /** - * This signal is emitted whenever an error has occurred. - * - * @param provider The provider which emitted the signal. - */ - void error( PotdProvider *provider ); - - private: - class Private; - Private * const d; -}; - -#endif diff --git a/kdeplasma-addons/wallpapers/CMakeLists.txt b/kdeplasma-addons/wallpapers/CMakeLists.txt index f08a2070..71f5df97 100644 --- a/kdeplasma-addons/wallpapers/CMakeLists.txt +++ b/kdeplasma-addons/wallpapers/CMakeLists.txt @@ -1,3 +1,2 @@ -add_subdirectory(potd) add_subdirectory(virus) add_subdirectory(pattern) diff --git a/kdeplasma-addons/wallpapers/potd/CMakeLists.txt b/kdeplasma-addons/wallpapers/potd/CMakeLists.txt deleted file mode 100644 index d6adc59b..00000000 --- a/kdeplasma-addons/wallpapers/potd/CMakeLists.txt +++ /dev/null @@ -1,12 +0,0 @@ -project(plasma-wallpaper-potd) - -set(potd_SRCS - potd.cpp - config.ui -) - -kde4_add_plugin(plasma_wallpaper_potd ${potd_SRCS}) -target_link_libraries(plasma_wallpaper_potd KDE4::plasma KDE4::kdeui KDE4::kio) - -install(TARGETS plasma_wallpaper_potd DESTINATION ${KDE4_PLUGIN_INSTALL_DIR}) -install(FILES plasma-wallpaper-potd.desktop DESTINATION ${KDE4_SERVICES_INSTALL_DIR}) diff --git a/kdeplasma-addons/wallpapers/potd/Messages.sh b/kdeplasma-addons/wallpapers/potd/Messages.sh deleted file mode 100755 index 05fab068..00000000 --- a/kdeplasma-addons/wallpapers/potd/Messages.sh +++ /dev/null @@ -1,5 +0,0 @@ -#! /usr/bin/env bash -$EXTRACTRC *.ui >> rc.cpp -$XGETTEXT *.cpp -o $podir/plasma_wallpaper_potd.pot -rm -f rc.cpp - diff --git a/kdeplasma-addons/wallpapers/potd/config.ui b/kdeplasma-addons/wallpapers/potd/config.ui deleted file mode 100644 index 0dada345..00000000 --- a/kdeplasma-addons/wallpapers/potd/config.ui +++ /dev/null @@ -1,76 +0,0 @@ - - - Configuration - - - - 0 - 0 - 390 - 228 - - - - - - - Source: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - providers - - - - - - - - 0 - 0 - - - - - - - - P&ositioning - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - resizeMethod - - - - - - - - 0 - 0 - - - - - - - - Qt::Vertical - - - - 324 - 186 - - - - - - - - diff --git a/kdeplasma-addons/wallpapers/potd/plasma-wallpaper-potd.desktop b/kdeplasma-addons/wallpapers/potd/plasma-wallpaper-potd.desktop deleted file mode 100644 index 847e2985..00000000 --- a/kdeplasma-addons/wallpapers/potd/plasma-wallpaper-potd.desktop +++ /dev/null @@ -1,105 +0,0 @@ -[Desktop Entry] -Name=Picture of the Day -Name[ar]=صورة اليوم -Name[ast]=Imaxe del día -Name[bs]=Slika dana -Name[ca]=Imatge del dia -Name[ca@valencia]=Imatge del dia -Name[cs]=Obrázek dne -Name[da]=Dagens billede -Name[de]=Bild des Tages -Name[el]=Φωτογραφία της ημέρας -Name[en_GB]=Picture of the Day -Name[es]=Imagen del día -Name[et]=Päevapilt -Name[fi]=Päivän kuva -Name[fr]=Image du jour -Name[ga]=Grianghraf an Lae -Name[gl]=Imaxe do día -Name[hr]=Slika dana -Name[hu]=A nap képe -Name[is]=Myndir dagsins -Name[it]=Immagine del giorno -Name[ja]=今日の写真 -Name[kk]=Тәулік суреті -Name[km]=រូបភាព​ប្រចាំ​ថ្ងៃ -Name[ko]=오늘의 그림 -Name[lt]=Dienos paveiksliukas -Name[lv]=Dienas attēls -Name[mr]=दिवसाचे चित्र -Name[nb]=Dagens bilde -Name[nds]=Bild för Vundaag -Name[nl]=Afbeelding van de dag -Name[nn]=Dagens bilete -Name[pa]=ਅੱਜ ਦੀ ਤਸਵੀਰ -Name[pl]=Obraz dnia -Name[pt]=Imagem do Dia -Name[pt_BR]=Imagem do dia -Name[ro]=Imaginea zilei -Name[ru]=Изображение дня -Name[sk]=Obrázok dňa -Name[sl]=Slika dneva -Name[sr]=слика дана -Name[sr@ijekavian]=слика дана -Name[sr@ijekavianlatin]=slika dana -Name[sr@latin]=slika dana -Name[sv]=Dagens bild -Name[tr]=Günün Resmi -Name[uk]=Картинка дня -Name[wa]=Imådje do djoû -Name[x-test]=xxPicture of the Dayxx -Name[zh_CN]=每日一图 -Name[zh_TW]=本日圖片 -Comment=A new picture from the Internet each day -Comment[ar]=صورة من السابكة كل يوم -Comment[bs]=Nova slika sa Interneta svaki dan -Comment[ca]=Una imatge nova des d'Internet cada dia -Comment[ca@valencia]=Una imatge nova des d'Internet cada dia -Comment[cs]=Nový obrázek z internetu denně -Comment[da]=Et nyt billede fra internettet hver dag -Comment[de]=Täglich ein Bild aus dem Internet anzeigen -Comment[el]=Κάθε μέρα μια νέα εικόνα από το διαδίκτυο -Comment[en_GB]=A new picture from the Internet each day -Comment[es]=Una nueva imagen desde Internet cada día -Comment[et]=Iga päev uus pilt internetist -Comment[fi]=Joka päivä uusi kuva Internetistä -Comment[fr]=Une nouvelle image chaque jour provenant d'Internet -Comment[gl]=Mostra imaxes de internet cada día. -Comment[hu]=Minden nap új kép az internetről -Comment[it]=Una nuova immagine ogni giorno da Internet. -Comment[kk]=Күнде Интернеттен жаңа сурет -Comment[ko]=인터넷에서 매일 새 그림 가져오기 -Comment[nb]=Et nytt bilde fra Internett hver dag -Comment[nds]=Elk Dag en nieg Bild ut dat Internet halen -Comment[nl]=Elke dag een nieuw plaatje uit het internet -Comment[pl]=Każdego dnia nowe zdjęcie z internetu -Comment[pt]=Uma nova imagem diária da Internet -Comment[pt_BR]=Uma nova imagem diária da Internet -Comment[ro]=O nouă imagine din Internet în fiecare zi -Comment[ru]=Новое изображение из Интернета каждый день -Comment[sk]=Nový obrázok z Internetu každý deň -Comment[sl]=Nova slika z interneta vsak dan -Comment[sr]=Сваки дан нова слика са Интернета -Comment[sr@ijekavian]=Сваки дан нова слика са Интернета -Comment[sr@ijekavianlatin]=Svaki dan nova slika sa Interneta -Comment[sr@latin]=Svaki dan nova slika sa Interneta -Comment[sv]=En ny bild från Internet varje dag -Comment[tr]=Her gün İnternet'ten yeni bir resim göster -Comment[uk]=Нове зображення з інтернету щодня -Comment[x-test]=xxA new picture from the Internet each dayxx -Comment[zh_CN]=每天从互联网获取新图片 -Comment[zh_TW]=網際網路上的每日新圖片 -Type=Service -Icon=office-calendar -ServiceTypes=Plasma/Wallpaper - -X-KDE-Library=plasma_wallpaper_potd -X-KDE-PluginInfo-Author=Aaron Seigo -X-KDE-PluginInfo-Email=aseigo@kde.org -X-KDE-PluginInfo-Name=org.kde.potd -X-KDE-PluginInfo-Version=0.1 -X-KDE-PluginInfo-Website= -X-KDE-PluginInfo-Depends= -X-KDE-PluginInfo-License=GPL -X-KDE-PluginInfo-EnabledByDefault=true - diff --git a/kdeplasma-addons/wallpapers/potd/potd.cpp b/kdeplasma-addons/wallpapers/potd/potd.cpp deleted file mode 100644 index cefbc96b..00000000 --- a/kdeplasma-addons/wallpapers/potd/potd.cpp +++ /dev/null @@ -1,237 +0,0 @@ -/* - * Copyright 2011 Aaron Seigo - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, or - * (at your option) any later version. - * - * 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 "potd.h" - -#include -#include - -#include -#include -#include -#include -#include - -static const QString DEFAULT_PROVIDER("apod"); -static const int DEFAULT_RESIZE_METHOD = Plasma::Wallpaper::ScaledResize; - -SaveRunnable::SaveRunnable(Plasma::DataEngine *dataEngine, const QString &provider, const QString &path) - : m_dataEngine(dataEngine), - m_path(path) -{ - dataEngine->connectSource(provider, this); - kDebug() << "saving to" << m_path; - setAutoDelete(true); -} - -void SaveRunnable::run() -{ - kDebug() << "saving?"; - if (m_image.isNull() || m_path.isEmpty()) { - return; - } - - kDebug() << "saving!"; - m_image.save(m_path); -} - -void SaveRunnable::dataUpdated(const QString &source, const Plasma::DataEngine::Data &data) -{ - if (!m_dataEngine) { - deleteLater(); - return; - } - - m_image = data["Image"].value(); - m_dataEngine.data()->disconnectSource(source, this); - QThreadPool::globalInstance()->start(this); -} - -PoTD::PoTD(QObject *parent, const QVariantList &args) - : Plasma::Wallpaper(parent, args) -{ - m_resizeMethod = DEFAULT_RESIZE_METHOD; - m_configResizeMethod = -1; - connect(this, SIGNAL(renderCompleted(QImage)), this, SLOT(wallpaperRendered(QImage))); - dataEngine(QLatin1String("potd"))->connectSource(QLatin1String("Providers"), this); - setUsingRenderingCache(false); - - QAction *saveFile = KStandardAction::save(this, SLOT(getSaveFileLocation()), this); - saveFile->setText(i18n("Save wallpaper image...")); - saveFile->setShortcut(QKeySequence()); - setContextualActions(QList() << saveFile); -} - -void PoTD::init(const KConfigGroup &config) -{ - QString provider = config.readEntry(QLatin1String("provider"), DEFAULT_PROVIDER); - int resizeMethod = config.readEntry("wallpaperposition", DEFAULT_RESIZE_METHOD); - if (provider.isEmpty() || (!m_providers.isEmpty() && !m_providers.contains(provider))) { - provider = DEFAULT_PROVIDER; - } - - if (provider != m_provider || m_resizeMethod != resizeMethod) { - if (!m_provider.isEmpty()) { - dataEngine(QLatin1String("potd"))->disconnectSource(m_provider, this); - } - - m_provider = provider; - m_resizeMethod = resizeMethod; - - if (!isPreviewing()) { - dataEngine(QLatin1String("potd"))->connectSource(m_provider, this); - } - } -} - -void PoTD::wallpaperRendered(const QImage &image) -{ - m_image = image; - emit update(boundingRect()); -} - -void PoTD::dataUpdated(const QString &source, const Plasma::DataEngine::Data &data) -{ - if (source == QLatin1String("Providers")) { - m_providers = data; - if (!m_provider.isEmpty() && !m_providers.contains(m_provider)) { - Plasma::DataEngine *engine = dataEngine(QLatin1String("potd")); - engine->disconnectSource(m_provider, this); - m_provider = DEFAULT_PROVIDER; - engine->connectSource(m_provider, this); - } - } else if (source == m_provider) { - QImage image = data["Image"].value(); - render(image, boundingRect().size().toSize(), (ResizeMethod)m_resizeMethod); - } else { - dataEngine(QLatin1String("potd"))->disconnectSource(source, this); - } -} - -void PoTD::getSaveFileLocation() -{ - if (m_provider.isNull()) { - return; - } - - KFileDialog *fd = new KFileDialog( - KUrl("kfiledialog:///potdwallpaper"), - KImageIO::pattern(KImageIO::Writing), - 0 - ); - fd->setOperationMode(KFileDialog::Saving); - fd->setMode(KFile::LocalOnly); - fd->setAttribute(Qt::WA_DeleteOnClose, true); - connect(fd, SIGNAL(okClicked()), this, SLOT(saveFile())); - fd->show(); -} - -void PoTD::saveFile() -{ - KFileDialog *fd = qobject_cast(sender()); - const QString &path = fd->selectedFile(); - if (path.isEmpty() || m_provider.isEmpty()) { - return; - } - - new SaveRunnable(dataEngine(QLatin1String("potd")), m_provider, path); -} - -void PoTD::paint(QPainter *painter, const QRectF& exposedRect) -{ - if (m_image.isNull()) { - painter->fillRect(exposedRect, QBrush(Qt::black)); - const QString provider = m_providers.isEmpty() || m_provider.isEmpty() ? QString() - : m_providers.value(m_provider).toString(); - const QString text = provider.isEmpty() ? i18n("Loading the picture of the day...") - : i18n("Loading the picture of the day from %1...", provider); - QRect textRect = painter->fontMetrics().boundingRect(text); - textRect.moveCenter(boundingRect().center().toPoint()); - painter->setPen(Qt::white); - painter->drawText(textRect.topLeft(), text); - } else { - if (m_image.size() != boundingRect().size().toSize()) { - Plasma::DataEngine *engine = dataEngine(QLatin1String("potd")); - // refresh the data which will trigger a re-render - engine->disconnectSource(m_provider, this); - engine->connectSource(m_provider, this); - } - painter->drawImage(exposedRect, m_image, exposedRect); - } -} - -QWidget* PoTD::createConfigurationInterface(QWidget* parent) -{ - QWidget *widget = new QWidget(parent); - m_ui.setupUi(widget); - m_configProvider.clear(); - m_configResizeMethod = -1; - - Plasma::DataEngine::DataIterator it(m_providers); - while (it.hasNext()) { - it.next(); - m_ui.providers->addItem(it.value().toString(), it.key()); - if (m_provider == it.key()) { - m_ui.providers->setCurrentIndex(m_ui.providers->count() - 1); - } - } - connect(m_ui.providers, SIGNAL(currentIndexChanged(int)), this, SLOT(settingsModified())); - connect(this, SIGNAL(settingsChanged(bool)), parent, SLOT(settingsChanged(bool))); - - m_ui.resizeMethod->addItem(i18n("Scaled & Cropped"), ScaledAndCroppedResize); - m_ui.resizeMethod->addItem(i18n("Scaled"), ScaledResize); - m_ui.resizeMethod->addItem(i18n("Scaled, keep proportions"), MaxpectResize); - m_ui.resizeMethod->addItem(i18n("Centered"), CenteredResize); - m_ui.resizeMethod->addItem(i18n("Tiled"), TiledResize); - m_ui.resizeMethod->addItem(i18n("Center Tiled"), CenterTiledResize); - for (int i = 0; i < m_ui.resizeMethod->count(); ++i) { - if (m_resizeMethod == m_ui.resizeMethod->itemData(i).value()) { - m_ui.resizeMethod->setCurrentIndex(i); - break; - } - } - connect(m_ui.resizeMethod, SIGNAL(currentIndexChanged(int)), this, SLOT(settingsModified())); - - return widget; -} - -void PoTD::save(KConfigGroup &config) -{ - if (m_configProvider.isEmpty()) { - config.writeEntry("provider", m_provider); - } else { - config.writeEntry("provider", m_configProvider); - m_configProvider.clear(); - } - if (m_configResizeMethod == -1) { - config.writeEntry("wallpaperposition", m_resizeMethod); - } else { - config.writeEntry("wallpaperposition", m_configResizeMethod); - m_configResizeMethod = -1; - } -} - -void PoTD::settingsModified() -{ - m_configProvider = m_ui.providers->itemData(m_ui.providers->currentIndex()).toString(); - m_configResizeMethod = m_ui.resizeMethod->itemData(m_ui.resizeMethod->currentIndex()).value(); - emit settingsChanged(true); -} - -#include "moc_potd.cpp" diff --git a/kdeplasma-addons/wallpapers/potd/potd.h b/kdeplasma-addons/wallpapers/potd/potd.h deleted file mode 100644 index 400f76cd..00000000 --- a/kdeplasma-addons/wallpapers/potd/potd.h +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright 2011 Aaron Seigo - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, or - * (at your option) any later version. - * - * 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 COLOR_HEADER -#define COLOR_HEADER - -#include -#include - -#include -#include - -#include "ui_config.h" - -class SaveRunnable : public QObject, QRunnable -{ - Q_OBJECT -public: - SaveRunnable(Plasma::DataEngine *dataEngine, const QString &provider, const QString &path); - void run(); - -public Q_SLOTS: - void dataUpdated(const QString &source, const Plasma::DataEngine::Data &data); - -private: - QWeakPointer m_dataEngine; - QImage m_image; - QString m_path; -}; - -class PoTD : public Plasma::Wallpaper -{ - Q_OBJECT - -public: - PoTD(QObject* parent, const QVariantList& args); - - void save(KConfigGroup &config); - void paint(QPainter* painter, const QRectF& exposedRect); - QWidget *createConfigurationInterface(QWidget* parent); - -public Q_SLOTS: - void wallpaperRendered(const QImage &image); - void dataUpdated(const QString &source, const Plasma::DataEngine::Data &data); - -Q_SIGNALS: - void settingsChanged(bool modified); - -protected: - virtual void init(const KConfigGroup &config); - -protected slots: - void settingsModified(); - void getSaveFileLocation(); - void saveFile(); - -private: - Ui::Configuration m_ui; - Plasma::DataEngine::Data m_providers; - QString m_provider; - QString m_configProvider; - int m_resizeMethod; - int m_configResizeMethod; - QImage m_image; -}; - -K_EXPORT_PLASMA_WALLPAPER(potd, PoTD) - -#endif