diff options
author | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
---|---|---|
committer | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
commit | e2de64d6f1beb9e492daf5b886e19933c1fa41dd (patch) | |
tree | 9047cf9e6b5c43878d5bf82660adae77ceee097a /noatun/modules/dcopiface | |
download | tdemultimedia-e2de64d6f1beb9e492daf5b886e19933c1fa41dd.tar.gz tdemultimedia-e2de64d6f1beb9e492daf5b886e19933c1fa41dd.zip |
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdemultimedia@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'noatun/modules/dcopiface')
-rw-r--r-- | noatun/modules/dcopiface/Makefile.am | 16 | ||||
-rw-r--r-- | noatun/modules/dcopiface/dcopiface.cpp | 250 | ||||
-rw-r--r-- | noatun/modules/dcopiface/dcopiface.h | 104 | ||||
-rw-r--r-- | noatun/modules/dcopiface/dcopiface.plugin | 137 |
4 files changed, 507 insertions, 0 deletions
diff --git a/noatun/modules/dcopiface/Makefile.am b/noatun/modules/dcopiface/Makefile.am new file mode 100644 index 00000000..6d55fc72 --- /dev/null +++ b/noatun/modules/dcopiface/Makefile.am @@ -0,0 +1,16 @@ +INCLUDES= -I$(top_builddir)/noatun/library -I$(top_srcdir)/noatun/library -I$(kde_includes)/arts $(all_includes) +kde_module_LTLIBRARIES = noatun_dcopiface.la + +noatun_dcopiface_la_SOURCES = dcopiface.cpp dcopiface.skel + +noatun_dcopiface_la_LDFLAGS = $(all_libraries) -module -avoid-version -no-undefined +noatun_dcopiface_la_LIBADD = $(LIB_KFILE) $(top_builddir)/noatun/library/libnoatun.la + +noatun_dcopiface_la_METASOURCES = AUTO + +noinst_HEADERS = dcopiface.h + +noatun_modules_dcopiface_DATA = dcopiface.plugin +noatun_modules_dcopifacedir = $(kde_datadir)/noatun + +dcopiface.lo: ../../library/noatunarts/noatunarts.h diff --git a/noatun/modules/dcopiface/dcopiface.cpp b/noatun/modules/dcopiface/dcopiface.cpp new file mode 100644 index 00000000..93ef6160 --- /dev/null +++ b/noatun/modules/dcopiface/dcopiface.cpp @@ -0,0 +1,250 @@ +#include "dcopiface.h" + +#include <noatun/player.h> +#include <noatun/app.h> +#include <noatunarts/noatunarts.h> +#include <noatun/engine.h> + +#include <dcopclient.h> + +extern "C" +{ + KDE_EXPORT NIF *create_plugin() + { + return new NIF(); + } +} + + +NIF::NIF() : Plugin(), DCOPObject("Noatun") +{ + mLastVolume = 0; +// connect(napp->player(), SIGNAL(newSong()), SLOT(newSongPlaying())); +} + +NIF::~NIF() +{ + kapp->dcopClient()->emitDCOPSignal("exiting()", QByteArray()); +} + +void NIF::toggleListView() +{ + napp->player()->toggleListView(); +} + +void NIF::handleButtons() +{ + napp->player()->handleButtons(); +} + +void NIF::removeCurrent() +{ + napp->player()->removeCurrent(); +} + +void NIF::back() +{ + napp->player()->back(); +} + +void NIF::stop() +{ + napp->player()->stop(); +} + +void NIF::play() +{ + napp->player()->play(); +} + +void NIF::playpause() +{ + napp->player()->playpause(); +} + +void NIF::forward() +{ + napp->player()->forward(); +} + +void NIF::skipTo(int msec) +{ + napp->player()->skipTo(msec); +} + +void NIF::loop() +{ + napp->player()->loop(); +} + +void NIF::setVolume(int i) +{ + napp->player()->setVolume(i); +} + +int NIF::volume() +{ + return napp->player()->volume(); +} + +void NIF::volumeUp() +{ + napp->player()->setVolume(napp->player()->volume() + 5); +} + +void NIF::volumeDown() +{ + napp->player()->setVolume(napp->player()->volume() - 5); +} + +void NIF::toggleMute() +{ + int currVol = napp->player()->volume(); + if (currVol == 0) + { + napp->player()->setVolume(mLastVolume); + } + else + { + mLastVolume = currVol; + napp->player()->setVolume(0); + } +} + +int NIF::length() // returns -1 if there's no playobject +{ + return napp->player()->getLength(); +} + +int NIF::position() // returns -1 if there's no playobject +{ + return napp->player()->getTime(); +} + +int NIF::state() +{ + if (napp->player()->isPlaying()) + return 2; + if (napp->player()->isPaused()) + return 1; + + return 0; // default to stopped +} + +QString NIF::lengthString() +{ + return napp->player()->current() ? napp->player()->current().lengthString() : ""; +} + +QString NIF::timeString() +{ + return napp->player()->lengthString(); +} + +QString NIF::title() +{ + return napp->player()->current() ? napp->player()->current().title() : ""; +} + +void NIF::setCurrentProperty(const QString &key, const QString &value) +{ + if (!napp->player()->current()) return; + + napp->player()->current().setProperty(key, value); +} + +QString NIF::currentProperty(const QString &key) +{ + if (!napp->player()->current()) return ""; + + return napp->player()->current().property(key); +} + +void NIF::clearCurrentProperty(const QString &key) +{ + if (!napp->player()->current()) return; + + return napp->player()->current().clearProperty(key); +} + + +QCString NIF::visStack() +{ + return napp->player()->engine()->visualizationStack()->toString().c_str(); +} + +QCString NIF::session() +{ + return napp->player()->engine()->session()->toString().c_str(); +} + +// adds one file to the playlist +void NIF::addFile(const QString& f, bool autoplay) +{ + napp->player()->openFile(f, false, autoplay); +} + +// Adds a bunch of files to the playlist +void NIF::addFile(const QStringList &f, bool autoplay) +{ + for (QStringList::ConstIterator it = f.begin(); it != f.end(); ++it ) + napp->player()->openFile(*it, false, autoplay); +} + +void NIF::loadPlugin(const QString &spec) +{ + napp->libraryLoader()->add(spec); +} + +QStringList NIF::availablePlugins() { + QStringList available_spec_files; + QValueList<NoatunLibraryInfo> available; + + available = napp->libraryLoader()->available(); + + QValueList<NoatunLibraryInfo>::iterator it; + for (it = available.begin();it != available.end();it++) { + available_spec_files += (*it).specfile; + } + + return available_spec_files; +} + +QStringList NIF::loadedPlugins() { + QStringList loaded_spec_files; + QValueList<NoatunLibraryInfo> loaded; + + loaded = napp->libraryLoader()->loaded(); + + QValueList<NoatunLibraryInfo>::iterator it; + for (it = loaded.begin();it != loaded.end();it++) { + loaded_spec_files += (*it).specfile; + } + + return loaded_spec_files; +} + +bool NIF::unloadPlugin(const QString &spec) +{ + return napp->libraryLoader()->remove(spec); +} + +QStringList NIF::mimeTypes() +{ + return napp->mimeTypes(); +} + +QCString NIF::version() +{ + return napp->version(); +} + +void NIF::newSongPlaying() +{ + kapp->dcopClient()->emitDCOPSignal("newFile()", QByteArray()); +} + +void NIF::clear() +{ + napp->playlist()->clear(); +} diff --git a/noatun/modules/dcopiface/dcopiface.h b/noatun/modules/dcopiface/dcopiface.h new file mode 100644 index 00000000..4b9fe5e7 --- /dev/null +++ b/noatun/modules/dcopiface/dcopiface.h @@ -0,0 +1,104 @@ +#ifndef DCOPIFACE_H +#define DCOPIFACE_H + +#include <noatun/player.h> +#include <noatun/plugin.h> + +#include <dcopobject.h> +#include <kdemacros.h> + +class KDE_EXPORT NIF : public Plugin, public DCOPObject +{ +K_DCOP + +public: + NIF(); + ~NIF(); + +private slots: + void newSongPlaying(); + +k_dcop: + void toggleListView(); + void handleButtons(); + void removeCurrent(); + + void back(); + void stop(); + void play(); + void playpause(); + void forward(); + void skipTo(int); + void loop(); + + void setVolume(int); + int volume(); + void volumeUp(); + void volumeDown(); + void toggleMute(); + + /** + * length in milliseconds + **/ + int length(); + /** + * position in milliseconds + **/ + int position(); + + /** + * 0 stopped + * 1 paused + * 2 playing + **/ + int state(); + + QString lengthString(); + QString timeString(); + + QString title(); + + /** + * set a property for the current song + **/ + void setCurrentProperty(const QString &key, const QString &value); + /** + * get a property from the current song + **/ + QString currentProperty(const QString &key); + /** + * clear a property from the current song + **/ + void clearCurrentProperty(const QString &key); + + QCString visStack(); + QCString session(); + + void addFile(const QString& f, bool autoplay); + void addFile(const QStringList &f, bool autoplay); + + void loadPlugin(const QString &specFile); + QStringList availablePlugins(); + QStringList loadedPlugins(); + bool unloadPlugin(const QString &specFile); + + QStringList mimeTypes(); + QCString version(); + + /** + * clear the playlist + **/ + void clear(); +private: + int mLastVolume; // remember volume for mute/unmute + +#ifdef DOCUMENTATION_BLEH_BLEH_DONT_TRY_COMPILING_THIS +signals: + void exiting(); + void newFile(); + +#endif +}; + +#endif + diff --git a/noatun/modules/dcopiface/dcopiface.plugin b/noatun/modules/dcopiface/dcopiface.plugin new file mode 100644 index 00000000..d98a661f --- /dev/null +++ b/noatun/modules/dcopiface/dcopiface.plugin @@ -0,0 +1,137 @@ +Filename=noatun_dcopiface.la +Author=Charles Samuels +Site=http://www.derkarl.org/noatun +Email=charles@kde.org +Type=hidden +License=Artistic +Name=DCOP Interface +Name[af]=Dcop Koppelvlak +Name[ar]=واجهة DCOP +Name[az]=DCOP Ara üzü +Name[bn]=ডিকপ ইন্টারফেস +Name[br]=Etrefas DCOP +Name[ca]=Interfície DCOP +Name[cs]=Rozhraní DCOP +Name[cy]=Rhyngwyneb DCOP +Name[da]=DCOP-grænseflade +Name[de]=DCOP-Schnittstelle +Name[el]=Διασύνδεση DCOP +Name[eo]=DCOP-interfaco +Name[es]=Interfaz de DCOP +Name[et]=DCOP liides +Name[eu]=DCOP interfazea +Name[fa]=واسط DCOP +Name[fi]=DCOP-rajapinta +Name[fr]=Interface DCOP +Name[ga]=Comhéadan DCOP +Name[gl]=Interface DCOP +Name[he]=ממשק DCOP +Name[hi]= डीकॉप इंटरफेस +Name[hr]=DCOP sučelje +Name[hu]=DCOP-felület +Name[is]=DCOP aðgangur +Name[it]=Interfaccia DCOP +Name[ja]=DCOP インターフェース +Name[kk]=DCOP интерфейсі +Name[km]=ចំណុចប្រទាក់ DCOP +Name[ko]=DCOP 인터페이스 +Name[lt]=DCOP sąsaja +Name[lv]=DCOP Starpseja +Name[mk]=Интерфејс DCOP +Name[ms]=Antaramuka DCOP +Name[mt]=Interfaċċja DCOP +Name[nb]=DCOP-grensesnitt +Name[nds]=DCOP-Koppelsteed +Name[ne]=DCOP इन्टरफेस +Name[nl]=DCOP-interface +Name[nn]=DCOP-grensesnitt +Name[pa]=DCOP ਇੰਟਰਫੇਸ +Name[pl]=Interfejs DCOP +Name[pt]=Interface do DCOP +Name[pt_BR]=Interface DCOP +Name[ro]=Interfaţă DCOP +Name[ru]=Интерфейс DCOP +Name[se]=DCOP-lakta +Name[sk]=Rozhranie DCOP +Name[sl]=Vmesnik DCOP +Name[sr]=DCOP интерфејс +Name[sr@Latn]=DCOP interfejs +Name[sv]=DCOP-gränssnitt +Name[ta]=DCOP இடைமுகம் +Name[tg]=Интерфейси DCOP +Name[th]=ส่วนติดต่อ DCOP +Name[tr]=DCOP Arayüzü +Name[uk]=Інтерфейс DCOP +Name[uz]=DCOP interfeysi +Name[uz@cyrillic]=DCOP интерфейси +Name[xh]=Ujongano lwe DCOP +Name[zh_CN]=DCOP 接口 +Name[zh_HK]=DCOP 介面 +Name[zh_TW]=DCOP 介面 +Name[zu]=Uxhumano olubhekeneyo lwe DCOP +Comment=DCOP Interface for Inter-Process Communication +Comment[af]=Dcop Koppelvlak vir Inter-Process Kommunikasie +Comment[ar]=واجهة DCOP لإستعراض تواصل عمليات النظام مع بعضها +Comment[az]=IPC üçün DCOP Ara üzü +Comment[bg]=Интерфейс за комуникация между процесите +Comment[bn]=আন্তঃপ্রক্রিয়া যোগাযোগের জন্য ডিকপ ইন্টারফেস +Comment[bs]=DCOP interfejs za međuprocesnu komunikaciju +Comment[ca]=Interfície DCOP per la comunicació entre processos +Comment[cs]=Rozhraní DCOP pro mezi procesovou komunikaci +Comment[cy]=Rhyngwyneb DCOP ar gyfer Cyfathrebu Rhyngbrosesol +Comment[da]=DCOP-grænseflade for interproceskommunikation +Comment[de]=DCOP-Schnittstelle für die Kommunikation zwischen Prozessen +Comment[el]=Διασύνδεση DCOP για επικοινωνία μεταξύ διεργασιών (IPC) +Comment[eo]=DCOP-interfaco por interproceza komunikado +Comment[es]=Interfaz de DCOP para comunicaciones entre procesos (IPC) +Comment[et]=DCOP liides protsessidevahelise ühenduse loomiseks +Comment[eu]=DCOP interfazea prozesuen arteko komunikaziorako +Comment[fa]=واسط DCOP برای ارتباط درون فرایند +Comment[fi]=DCOP-rajapinta sisäiseen kommunikointiin +Comment[fr]=Interface DCOP pour les communications entre processus +Comment[ga]=Comhéadan DCOP le haghaidh cumarsáide idirphróiseas +Comment[gl]=Interface DCOP para Comuicación Entre Procesos +Comment[he]=ממשק DCOP לתקשורת בין-תהליכית +Comment[hi]=इंटर-प्रोसेस कम्यूनिकेशन के लिए डीकॉप इंटरफेस +Comment[hr]=DCOP sučelje za komunikaciju među procesima +Comment[hu]=DCOP-felület IPC-hívásokhoz +Comment[is]=DCOP aðgangur svo ferlin geti talað saman +Comment[it]=Interfaccia DCOP per le comunicazioni tra processi (IPC) +Comment[ja]=プロセス間通信に使われる DCOP インターフェース +Comment[kk]=Процесаралық қатынаудың DCOP интерфейсі +Comment[km]=ចំណុចប្រទាក់ DCOP សម្រាប់ការទំនាក់ទំនងខាងក្នុងដំណើរការ +Comment[ko]=프로세스 사이에 통신을 주고 받을 수 있게 해주는 DCOP 인터페이스 +Comment[lt]=DCOP sąsaja tarpprocesiniam ryšiui +Comment[lv]=DCOP Starpseja Iekšējo-Procesu komunikācijām +Comment[mk]=Интерфејс DCOP за комуникација помеѓу процесите +Comment[ms]=Antaramuka DCOP untuk Komunikasi Antara Proses +Comment[mt]=Interfaċċja DCOP għal komunikazzjoni bejn proċessi (IPC) +Comment[nb]=DCOP grensesnitt for interprosesskommunikasjon +Comment[nds]=DCOP-Koppelsteed för Kommunikatschoon twischen Perzessen +Comment[ne]=आन्तरिक-प्रक्रिया सञ्चारका लागि DCOP इन्टरफेस +Comment[nl]=DCOP-interface voor interprocescommunicatie +Comment[nn]=DCOP-grensesnitt for interprosesskommunikasjon +Comment[pl]=Interfejs DCOP dla Komunikacji Międzyprocesowej (IPC) +Comment[pt]=Interface do DCOP para a comunicação entre os processos +Comment[pt_BR]=Interface DCOP para comunicações inter-processos +Comment[ro]=Interfaţă DCOP pentru comunicaţie interprocese +Comment[ru]=Интерфейс с DCOP для межпроцессного взаимодействия +Comment[se]=DCOP-lakta proseassaidgaskkasaš gulahallama dihte +Comment[sk]=Rozhranie DCOP pre komunikáciu medzi procesmi +Comment[sl]=Vmesnik DCOP za medprocesno komunikacijo +Comment[sr]=DCOP интерфејс за међупроцесну комуникацју +Comment[sr@Latn]=DCOP interfejs za međuprocesnu komunikacju +Comment[sv]=DCOP-gränssnitt för kommunikation mellan processer +Comment[ta]=செயல்களுக்கிடைப்பட்ட தகவல் பரிவர்த்தனைக்கான ODBC இடைமுகம் +Comment[tg]=Интерфейси DCOP барои Алоқаи Ҷараёни Интернет +Comment[th]=ส่วนติดต่อ DCOP สำหรับการสื่อสารระหว่างโปรเซส +Comment[tr]=IPC için DCOP Arayüzü +Comment[uk]=Інтерфейс DCOP для взаємодії процесів (IPC) +Comment[uz]=Jarayonlararo bogʻlanish uchun DCOP interfeysi +Comment[uz@cyrillic]=Жараёнлараро боғланиш учун DCOP интерфейси +Comment[ven]=DCOP Interface ya tshitenwa tsha vhudavhudzani +Comment[xh]=Ujongano lwe DCOP-lothungelwano lwangaphakathi oluqhubekayo +Comment[zh_CN]=进程间通信的 DCOP 接口 +Comment[zh_HK]=用於行程間通訊的 DCOP 介面 +Comment[zh_TW]=程序程式間通訊的 DCOP 介面 +Comment[zu]=Uxhumano olubhekene lwe DCOP-lothungelwano lwangaphakathi oluqhubekayo |