summaryrefslogtreecommitdiffstats
path: root/noatun/modules/marquis
diff options
context:
space:
mode:
Diffstat (limited to 'noatun/modules/marquis')
-rw-r--r--noatun/modules/marquis/Makefile.am15
-rw-r--r--noatun/modules/marquis/marquis.cpp186
-rw-r--r--noatun/modules/marquis/marquis.h52
-rw-r--r--noatun/modules/marquis/marquis.plugin83
-rw-r--r--noatun/modules/marquis/plugin.cpp9
5 files changed, 345 insertions, 0 deletions
diff --git a/noatun/modules/marquis/Makefile.am b/noatun/modules/marquis/Makefile.am
new file mode 100644
index 00000000..a2fc3e3f
--- /dev/null
+++ b/noatun/modules/marquis/Makefile.am
@@ -0,0 +1,15 @@
+INCLUDES= -I$(top_srcdir)/noatun/library $(all_includes)
+kde_module_LTLIBRARIES = noatun_marquis.la
+
+noatun_marquis_la_SOURCES = marquis.cpp plugin.cpp
+
+noatun_marquis_la_LDFLAGS = $(all_libraries) -module -avoid-version -no-undefined
+noatun_marquis_la_LIBADD = $(LIB_KFILE) $(top_builddir)/noatun/library/libnoatun.la \
+ -lqtmcop -lkmedia2_idl -lsoundserver_idl
+
+noatun_marquis_la_METASOURCES = AUTO
+
+noinst_HEADERS = marquis.h
+
+noatun_modules_marquis_DATA = marquis.plugin
+noatun_modules_marquisdir = $(kde_datadir)/noatun
diff --git a/noatun/modules/marquis/marquis.cpp b/noatun/modules/marquis/marquis.cpp
new file mode 100644
index 00000000..29ca7364
--- /dev/null
+++ b/noatun/modules/marquis/marquis.cpp
@@ -0,0 +1,186 @@
+// marquis.cpp
+//
+// Copyright (C) 2000 Neil Stevens <multivac@fcmail.com>
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// THE AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+// AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+// Except as contained in this notice, the name(s) of the author(s) shall not be
+// used in advertising or otherwise to promote the sale, use or other dealings
+// in this Software without prior written authorization from the author(s).
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <kconfig.h>
+#include <kdebug.h>
+#include <kmessagebox.h>
+#include <klocale.h>
+#include <noatun/pluginloader.h>
+#include "marquis.h"
+#include <noatun/player.h>
+#include <noatun/engine.h>
+#include <kaction.h>
+
+static int getPlayStatus( Player *player )
+{
+ if ( player->isPlaying() )
+ return 1;
+ if ( player->isPaused() )
+ return 2;
+ return 0;
+}
+
+static void setPlayStatus( Player *player, int status )
+{
+ switch( status )
+ {
+ default:
+ case 0:
+ player->stop();
+ break;
+ case 1:
+ player->play();
+ break;
+ case 2:
+ if ( !player->isPaused() )
+ {
+ player->play();
+ player->playpause();
+ }
+ break;
+ }
+}
+
+
+Marquis::Marquis()
+ : KMainWindow(0, "Marquis")
+ , SessionManagement()
+{
+ hide();
+ kdDebug(66666) << k_funcinfo << "number of members == " << memberList->count() << endl;
+
+// for testing: uncomment this and use
+// dcop `dcop | grep noatun` Marquis activateAction dynamicRestore
+// and dynamicSave accordingly.
+// (void) new KAction("Restore", 0, this, SLOT( dynamicRestore() ), actionCollection(), "dynamicRestore" );
+// (void) new KAction("Save", 0, this, SLOT( dynamicSave() ), actionCollection(), "dynamicSave" );
+ connect( napp, SIGNAL( saveYourself() ), SLOT( dynamicSave() ));
+}
+
+Marquis::~Marquis()
+{
+}
+
+void Marquis::restore(void)
+{
+ kdDebug(66666) << k_funcinfo << endl;
+ dynamicRestore();
+}
+
+// unload every window, and save the config as QStringList of those loaded
+void Marquis::saveSessionConfig(KConfig *c)
+{
+ kdDebug(66666) << k_funcinfo << endl;
+
+ Player *player = napp->player();
+ c->writeEntry("Volume", player->volume());
+ c->writeEntry("Loop Style", player->loopStyle());
+ if ( napp->playlist() )
+ c->writeEntry("Playlist Visible", napp->playlist()->listVisible());
+
+ if ( !player->current().isNull() )
+ {
+ KURL songURL = player->current().url();
+ songURL.setPass( QString::null ); // don't save passwords
+ c->writePathEntry("Current Song", songURL.url());
+ }
+ else
+ c->writePathEntry("Current Song", QString::null);
+
+ c->writeEntry("Current Position", player->getTime());
+ c->writeEntry("PlayStatus", getPlayStatus( player ));
+
+ // borrowed from Plugin config dialog
+ QStringList specList;
+
+ QValueList<NoatunLibraryInfo> loaded = napp->libraryLoader()->loaded();
+ for( QValueList<NoatunLibraryInfo>::Iterator i = loaded.begin(); i != loaded.end(); ++i)
+ {
+ if(!specList.contains((*i).specfile)
+ && napp->libraryLoader()->isLoaded((*i).specfile)
+ && (*i).specfile != "marquis.plugin")
+ {
+ specList += (*i).specfile;
+ napp->libraryLoader()->remove((*i).specfile, false);
+ }
+ }
+
+ c->writeEntry("Loaded Plugins", specList);
+}
+
+// get the list of loaded plugins from the config, and load them
+void Marquis::readSessionConfig(KConfig *c)
+{
+ Player *player = napp->player();
+
+ c->setGroup(QString::null);
+
+ // First set volume, then load modules, some module could start
+ // playback and that would be with 100% volume!
+ player->setVolume( c->readNumEntry("Volume", 100) );
+ //player->setVolume( 0 );
+ player->loop( c->readNumEntry("Loop Style", (int) Player::None) );
+
+ QStringList list = c->readListEntry("Loaded Plugins");
+ /*
+ kdDebug(66666) << "Marquis::readSessionConfig()" << endl;
+ for(QStringList::ConstIterator i=list.begin(); i!=list.end(); ++i)
+ kdDebug(66666) << *i << endl;
+ kdDebug(66666) << "Marquis::readSessionConfig() there we go" << endl;
+ */
+ napp->libraryLoader()->loadAll(list);
+
+ if (!napp->playlist())
+ {
+ KMessageBox::error(0,i18n("No playlist plugin was found. " \
+ "Please make sure that Noatun was installed correctly."));
+ napp->quit();
+ return;
+ }
+
+ if ( c->readBoolEntry( "Playlist Visible", false ))
+ napp->playlist()->showList();
+
+ napp->player()->engine()->setInitialized();
+ // TODO: restore the playback state (also save it ;)
+}
+
+void Marquis::dynamicSave()
+{
+ KConfig config( "marquisrc" );
+ saveSessionConfig( &config );
+}
+
+void Marquis::dynamicRestore()
+{
+ KConfig config( "marquisrc" );
+ readSessionConfig( &config );
+}
+
+#include "marquis.moc"
diff --git a/noatun/modules/marquis/marquis.h b/noatun/modules/marquis/marquis.h
new file mode 100644
index 00000000..5b166d57
--- /dev/null
+++ b/noatun/modules/marquis/marquis.h
@@ -0,0 +1,52 @@
+// marquis.h
+//
+// Copyright (C) 2000 Neil Stevens <multivac@fcmail.com>
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// THE AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+// AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+// Except as contained in this notice, the name(s) of the author(s) shall not be
+// used in advertising or otherwise to promote the sale, use or other dealings
+// in this Software without prior written authorization from the author(s).
+
+#ifndef MARQUIS_H
+#define MARQUIS_H
+
+#include <noatun/plugin.h>
+#include <noatun/app.h>
+#include <kmainwindow.h>
+
+class Player;
+
+class Marquis : public KMainWindow, public SessionManagement
+{
+Q_OBJECT
+NOATUNPLUGIND
+public:
+ Marquis();
+ virtual ~Marquis();
+
+ virtual void restore(void);
+private:
+ void saveSessionConfig(KConfig *);
+ void readSessionConfig(KConfig *);
+private slots:
+ void dynamicSave();
+ void dynamicRestore();
+};
+
+#endif
diff --git a/noatun/modules/marquis/marquis.plugin b/noatun/modules/marquis/marquis.plugin
new file mode 100644
index 00000000..7987d7b2
--- /dev/null
+++ b/noatun/modules/marquis/marquis.plugin
@@ -0,0 +1,83 @@
+Filename=noatun_marquis.la
+Author=Neil Stevens
+Site=http://www.derkarl.org/noatun
+Email=neil@qualityassistant.com
+Type=sm
+License=X11-like
+Name=Marquis
+Name[af]=Markies
+Name[ar]=ماركيس
+Name[cs]=Markýz
+Name[eo]=Markizo
+Name[es]=Marqués
+Name[hi]=मरक्यू
+Name[lt]=Markizas
+Name[lv]=Marķīzs
+Name[mk]=Маркиз
+Name[mt]=Markis
+Name[ne]=मार्किज
+Name[ru]=Маркиз
+Name[zh_CN]=侯爵
+Name[zh_HK]=侯爵
+Name[zh_TW]=侯爵
+Comment=Plugin to interact with the Session Manager
+Comment[af]=Inplak na interaksie het met die Sessie Bestuurder
+Comment[az]=İclas idarəcisi ilə interaksiya əlavəsi
+Comment[bg]=Взаимодействие с мениджъра на сесии
+Comment[bs]=Dodatak za interakciju sa upraviteljem sesija
+Comment[ca]=Connector per interactuar amb el gestor de sessió
+Comment[cs]=Modul pro spolupráci se správcem relace
+Comment[cy]=Atodyn i ryngweithredu efo'r Rheolwr Sesiynau
+Comment[da]=Plugin til at fungere sammen med sessionshåndteringen
+Comment[de]=Modul zur Kommunikation mit dem Sitzungsmanager
+Comment[el]=Πρόσθετο για αλληλεπίδραση με το διαχειριστή συνεδρίας
+Comment[eo]=Kromaĵo por interago kun la seancokonservilo
+Comment[es]=Plugin para interactuar con el Administrador de sesiones
+Comment[et]=Seansihalduriga suhtlemise plugin
+Comment[eu]=Sesio kudeatzailearekin komunikatzeko plugin-a
+Comment[fa]=وصله، برای کنش با مدیر نشست
+Comment[fi]=Sovelma istunnonhallinnan ohjaamiseen
+Comment[fr]=Un module pour interagir avec le gestionnaire de session
+Comment[gl]=Extensión para interaccionar co Xestor de Sesións
+Comment[he]=תוסף לתקשורת עם מנהל ההפעלה
+Comment[hi]=सत्र प्रबंधक से इंटरेक्ट करने का प्लगइन
+Comment[hr]=Dodatak za interakciju sa upravljačem seansa
+Comment[hu]=Beépülő modul a munkafolyamat-kezelő beállításához
+Comment[is]=Viðbót til að hafa samband við setustjórann
+Comment[it]=Plugin per interagire con la gestione delle sessioni
+Comment[ja]=セッションマネージャと情報をやり取りするためのプラグイン
+Comment[kk]=Сеанс менеджерімен әрекеттесу плагин модулі
+Comment[km]=កម្មវិធី​ជំនួយ​ដើម្បី​ធ្វើ​អន្តរកម្ម​ជាមួយ​កម្មវិធី​គ្រប់គ្រង​សម័យ
+Comment[ko]=세션 관리자와 작동하는 플러그인
+Comment[lt]=Sąveikos su sesijos tvarkykle priemonė
+Comment[lv]=Iespraudnis sadarbībai ar Sesiju Menedžeri
+Comment[mk]=Приклучок за содејство со менаџерот на сесијата
+Comment[ms]=Plug masuk untuk berinteraksi dengan Pengurus Sesi
+Comment[mt]=Plugin biex jaqbad mal-Manager tas-Sessjoni
+Comment[nb]=Programtillegg for å kommunisere med øktbehandleren
+Comment[nds]=Moduul för't Tosamenwerken mit den Törnpleger
+Comment[ne]=सत्र प्रबन्धकसँग अन्तरक्रिया गर्न प्लगइन
+Comment[nl]=Plugin om te communiceren met de sessiebeheerder
+Comment[nn]=Tilleggsmodul for å kommunisera med økthandsamaren
+Comment[pl]=Wtyczka do współpracy z menedżerem sesji
+Comment[pt]=Um 'plugin' para interagir com o gestor de sessões
+Comment[pt_BR]=Plug-in para interagir com o gerenciador de sessão
+Comment[ro]=Modul de interacţiune cu managerul de sesiune
+Comment[ru]=Модуль взаимодействия с менеджером сеанса
+Comment[se]=Lassemoduvla mainna gulahalla bargovuorrugieđahalliin
+Comment[sk]=Modul pre spoluprácu so Správcom sedenia
+Comment[sl]=Vstavek za delovanje z Upravljalnikom sej
+Comment[sr]=Прикључак за интеракцију са менаџером сесије
+Comment[sr@Latn]=Priključak za interakciju sa menadžerom sesije
+Comment[sv]=Insticksprogram för att samverka med sessionshanteraren
+Comment[ta]=அமர்வு மேலாளருடன் தொடர்பாடும் சொருகுப்பொருள்
+Comment[tg]=Модул барои амали мутақобила бо Мудири Сеанс
+Comment[th]=ปลั๊กอินสำหรับโต้ตอบกับตัวจัดการโปรเซส
+Comment[tr]=Oturum yöneticisi ile etkileşim eklentisi
+Comment[uk]=Втулок для взаємодії з Менеджером сеансів
+Comment[ven]=U plaga u itela u tangana na mulanguli wa tshitenwa
+Comment[xh]=Faka iplagi ukusebenza ngaphakathi noMphathi weNtlanganiso
+Comment[zh_CN]=和会话管理器交互的插件
+Comment[zh_HK]=用於和工作階段管理員互動的插件
+Comment[zh_TW]=用來給工作階段管理程式使用的外掛程式
+Comment[zu]=Faka iplagi ukusebenza ngaphakathi noMphathi weNhlanganiso
diff --git a/noatun/modules/marquis/plugin.cpp b/noatun/modules/marquis/plugin.cpp
new file mode 100644
index 00000000..146b0979
--- /dev/null
+++ b/noatun/modules/marquis/plugin.cpp
@@ -0,0 +1,9 @@
+#include "marquis.h"
+
+extern "C"
+{
+ KDE_EXPORT Plugin *create_plugin()
+ {
+ return new Marquis();
+ }
+}