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 /arts/tools | |
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 'arts/tools')
79 files changed, 4104 insertions, 0 deletions
diff --git a/arts/tools/Makefile.am b/arts/tools/Makefile.am new file mode 100644 index 00000000..e503d54a --- /dev/null +++ b/arts/tools/Makefile.am @@ -0,0 +1,82 @@ + +SUBDIRS= . pics + +INCLUDES = \ + -I$(top_srcdir)/arts/gui/kde \ + -I$(top_builddir)/arts/gui/common \ + -I$(top_builddir)/arts/modules \ + -I$(top_builddir)/arts/modules/common \ + -I$(top_builddir)/arts/modules/synth \ + -I$(top_builddir)/arts/modules/mixers \ + -I$(top_builddir)/arts/modules/effects \ + -I$(top_builddir)/arts/midi \ + -I$(kde_includes)/arts \ + $(all_includes) + + +lib_LTLIBRARIES = libartscontrolsupport.la libartscontrolapplet.la + +libartscontrolapplet_la_SOURCES = \ + artscontrolapplet.cpp + +libartscontrolsupport_la_SOURCES = \ + templateview.cpp artsactions.cpp \ + audiomanager.cpp choosebusdlg.cpp \ + midimanagerview.cpp midimanagerdlg.ui midimanagerwidget.ui \ + midiportdlg.cpp midiinstdlg.cpp environmentview.cpp \ + fftscopeview.cpp mediatypesview.cpp statusview.cpp + +METASOURCES = AUTO + +SOMAJOR = 1 +SOMINOR = 0 +SOSUBMINOR = 0 + +libartscontrolapplet_la_LDFLAGS = $(all_libraries) -version-info $(SOMAJOR):$(SOMINOR):$(SOSUBMINOR) -no-undefined -module +libartscontrolsupport_la_LDFLAGS = $(all_libraries) -version-info $(SOMAJOR):$(SOMINOR):$(SOSUBMINOR) -no-undefined + +libartscontrolapplet_la_LIBADD = \ + -lartsflow -lartsflow_idl -lmcop -lqtmcop $(LIBDL) -lsoundserver_idl -lartskde \ + $(LIB_KDEUI) ./libartscontrolsupport.la + +# Arnolds version with dynamic-linking for testing. +# +#libartscontrolsupport_la_LIBADD = \ +# -lartsflow -lartsflow_idl -lmcop -lqtmcop $(LIBDL) -lsoundserver_idl -lartskde \ +# $(top_builddir)/arts/gui/common/libartsgui_idl.la \ +# -L$(top_builddir)/arts/gui/kde -lartsgui_kde \ +# -L$(top_builddir)/arts/modules -lartsmodules \ +# $(LIB_KDEUI) + +libartscontrolsupport_la_LIBADD = \ + -lartsflow -lartsflow_idl -lmcop -lqtmcop $(LIBDL) -lsoundserver_idl -lartskde \ + $(top_builddir)/arts/gui/common/libartsgui_idl.la \ + $(top_builddir)/arts/gui/kde/libartsgui_kde.la \ + $(top_builddir)/arts/modules/libartsmodules.la \ + $(LIB_KDEUI) + +bin_PROGRAMS = artscontrol +artscontrol_SOURCES = main.cpp levelmeters.cpp +artscontrol_LDFLAGS = $(all_libraries) $(KDE_RPATH) +artscontrol_LDADD = libartscontrolsupport.la \ + $(LIB_KDEUI) $(LIB_KSYCOCA) $(LIB_KFILE) \ + -lqtmcop -lartsflow_idl -lsoundserver_idl -lartskde + +xdg_apps_DATA = artscontrol.desktop + +lnkdir = $(kde_datadir)/kicker/applets +lnk_DATA = artscontrolapplet.desktop + +rcdir = $(kde_datadir)/artscontrol +rc_DATA = artscontrol.rc artsmidimanagerview.rc + +messages: rc.cpp + $(XGETTEXT) *.h *.cpp -o $(podir)/artscontrol.pot + +artsactions.lo: ../modules/artsmodules.h ../midi/artsmidi.h ../gui/common/artsgui.h ../modules/common/artsmodulescommon.h ../modules/synth/artsmodulessynth.h ../modules/effects/artsmoduleseffects.h ../modules/mixers/artsmodulesmixers.h +artscontrolapplet.lo: ../gui/common/artsgui.h ../modules/effects/artsmoduleseffects.h ../modules/common/artsmodulescommon.h ../midi/artsmidi.h ../modules/synth/artsmodulessynth.h ../modules/artsmodules.h ../modules/mixers/artsmodulesmixers.h +environmentview.lo: ../modules/artsmodules.h ../midi/artsmidi.h ../gui/common/artsgui.h ../modules/common/artsmodulescommon.h ../modules/synth/artsmodulessynth.h ../modules/effects/artsmoduleseffects.h ../modules/mixers/artsmodulesmixers.h +fftscopeview.lo: ../modules/artsmodules.h ../midi/artsmidi.h ../gui/common/artsgui.h ../modules/common/artsmodulescommon.h ../modules/synth/artsmodulessynth.h ../modules/effects/artsmoduleseffects.h ../modules/mixers/artsmodulesmixers.h +main.o: ../gui/common/artsgui.h ../modules/artsmodules.h ../midi/artsmidi.h ../modules/common/artsmodulescommon.h ../modules/synth/artsmodulessynth.h ../modules/effects/artsmoduleseffects.h ../modules/mixers/artsmodulesmixers.h +midimanagerview.lo: ../midi/artsmidi.h ../modules/artsmodules.h ../gui/common/artsgui.h ../modules/common/artsmodulescommon.h ../modules/synth/artsmodulessynth.h ../modules/effects/artsmoduleseffects.h ../modules/mixers/artsmodulesmixers.h + diff --git a/arts/tools/artsactions.cpp b/arts/tools/artsactions.cpp new file mode 100644 index 00000000..b75de027 --- /dev/null +++ b/arts/tools/artsactions.cpp @@ -0,0 +1,191 @@ +/* + + Copyright (C) 2003 Arnold Krille <arnold@arnoldarts.de> + + 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 General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + */ + +#include "artsactions.h" + +#include <kaction.h> +#include <kactioncollection.h> +#include <kpopupmenu.h> +#include <klocale.h> +#include <kglobal.h> +//#include <kdebug.h> + +#include <kartsserver.h> + +#include "fftscopeview.h" +#include "audiomanager.h" +#include "statusview.h" +#include "midimanagerview.h" +#include "environmentview.h" +#include "mediatypesview.h" + +ArtsActions::ArtsActions( KArtsServer* server, KActionCollection* col, QWidget* parent, const char* name ) + : QObject( parent,name ) + , _kartsserver( server ) + , _actioncollection( col ) + , _a_sv( 0 ), _a_am( 0 ), _a_asv( 0 ), _a_mmv( 0 ), _a_ev( 0 ), _a_mtv( 0 ) +// , _a_morebars( 0 ), _a_lessbars( 0 ) + , _a_style_normal( 0 ), _a_style_fire( 0 ), _a_style_line( 0 ), _a_style_led( 0 ), _a_style_analog( 0 ), _a_style_small( 0 ) + , _stylemenu( 0 ) + , _sv( 0 ), _am( 0 ), _asv( 0 ), _mmv( 0 ), _ev( 0 ), _mtv( 0 ) +{ + //kdDebug()<<k_funcinfo<<endl; + KGlobal::locale()->insertCatalogue( "artscontrol" ); + if ( !_kartsserver ) _kartsserver = new KArtsServer( this ); +} + +ArtsActions::~ArtsActions() { + //kdDebug()<<k_funcinfo<<endl; + if ( _sv ) viewScopeView(); + if ( _am ) viewAudioManager(); + if ( _asv ) viewArtsStatusView(); + if ( _mmv ) viewMidiManagerView(); + if ( _ev ) viewEnvironmentView(); + if ( _mtv ) viewMediaTypesView(); +} + +KAction* ArtsActions::actionScopeView() { + if ( !_a_sv ) _a_sv = new KAction( i18n( "&FFT Scope" ), "artsfftscope", KShortcut(), this, SLOT( viewScopeView() ), _actioncollection, "artssupport_view_scopeview" ); + return _a_sv; +} +KAction* ArtsActions::actionAudioManager() { + if ( !_a_am ) _a_am = new KAction( i18n( "&Audio Manager" ), "artsaudiomanager", KShortcut(), this, SLOT( viewAudioManager() ), _actioncollection, "artssupport_view_audiomanager" ); + return _a_am; +} +KAction* ArtsActions::actionArtsStatusView() { + if ( !_a_asv ) _a_asv = new KAction( i18n( "aRts &Status" ), "artscontrol", KShortcut(), this, SLOT( viewArtsStatusView() ), _actioncollection, "artssupport_view_artsstatus" ); + return _a_asv; +} +KAction* ArtsActions::actionMidiManagerView() { + if ( !_a_mmv ) _a_mmv = new KAction( i18n( "&MIDI Manager" ), "artsmidimanager", KShortcut(), this, SLOT( viewMidiManagerView() ), _actioncollection, "artssupport_view_midimanager" ); + return _a_mmv; +} +KAction* ArtsActions::actionEnvironmentView() { + if ( !_a_ev ) _a_ev = new KAction( i18n( "&Environment" ), "artsenvironment", KShortcut(), this, SLOT( viewEnvironmentView() ), _actioncollection, "artssupport_view_environment" ); + return _a_ev; +} +KAction* ArtsActions::actionMediaTypesView() { + if ( !_a_mtv ) _a_mtv = new KAction( i18n( "Available Media &Types" ), "artsmediatypes", KShortcut(), this, SLOT( viewMediaTypesView() ), _actioncollection, "artssupport_view_mediatypes" ); + return _a_mtv; +} + +KAction* ArtsActions::actionStyleNormal() { + if ( !_a_style_normal ) _a_style_normal = new KAction( i18n( "Style: NormalBars" ), "", KShortcut(), this, SLOT( _p_style_normal() ), _actioncollection, "artssupport_style_normal" ); + return _a_style_normal; +} +KAction* ArtsActions::actionStyleFire() { + if ( !_a_style_fire ) _a_style_fire = new KAction( i18n( "Style: FireBars" ), "", KShortcut(), this, SLOT( _p_style_fire() ), _actioncollection, "artssupport_style_fire" ); + return _a_style_fire; +} +KAction* ArtsActions::actionStyleLine() { + if ( !_a_style_line ) _a_style_line = new KAction( i18n( "Style: LineBars" ), "", KShortcut(), this, SLOT( _p_style_line() ), _actioncollection, "artssupport_style_line" ); + return _a_style_line; +} +KAction* ArtsActions::actionStyleLED() { + if ( !_a_style_led ) _a_style_led = new KAction( i18n( "Style: LEDs" ), "", KShortcut(), this, SLOT( _p_style_led() ), _actioncollection, "artssupport_style_led" ); + return _a_style_led; +} +KAction* ArtsActions::actionStyleAnalog() { + if ( !_a_style_analog ) _a_style_analog = new KAction( i18n( "Style: Analog" ), "", KShortcut(), this, SLOT( _p_style_analog() ), _actioncollection, "artssupport_style_analog" ); + return _a_style_analog; +} +KAction* ArtsActions::actionStyleSmall() { + if ( !_a_style_small ) _a_style_small = new KAction( i18n( "Style: Small" ), "", KShortcut(), this, SLOT( _p_style_small() ), _actioncollection, "artssupport_style_small" ); + return _a_style_small; +} +KPopupMenu* ArtsActions::stylemenu() { + if ( !_stylemenu ) { + _stylemenu = new KPopupMenu(); + KAction *tmp; + tmp = actionStyleNormal(); tmp->plug( _stylemenu ); + tmp = actionStyleFire(); tmp->plug( _stylemenu ); + tmp = actionStyleLine(); tmp->plug( _stylemenu ); + tmp = actionStyleLED(); tmp->plug( _stylemenu ); + tmp = actionStyleAnalog(); tmp->plug( _stylemenu ); + tmp = actionStyleSmall(); tmp->plug( _stylemenu ); + } + return _stylemenu; +} + +KAction* ArtsActions::actionMoreBars( const QObject* receiver, const char* slot, KActionCollection *actioncollection ) { + static KAction *_a_morebars = new KAction( i18n( "More Bars in VU-Meters" ), "up", KShortcut(), receiver, slot, actioncollection, "artssupport_morebars" ); + return _a_morebars; +} +KAction* ArtsActions::actionLessBars( const QObject* receiver, const char* slot, KActionCollection *actioncollection ) { + static KAction *_a_lessbars = new KAction( i18n( "Less Bars in VU-Meters" ), "down", KShortcut(), receiver, slot, actioncollection, "artssupport_lessbars" ); + return _a_lessbars; +} + +void ArtsActions::viewScopeView() { + if ( !_sv ) { + _sv = new FFTScopeView( _kartsserver->server() ); + connect( _sv, SIGNAL( closed() ), this, SLOT( viewScopeView() ) ); + } else { + delete _sv; + _sv = 0; + } +} +void ArtsActions::viewAudioManager() { + if ( !_am ) { + _am = new Gui_AUDIO_MANAGER(); + connect( _am, SIGNAL( closed() ), this, SLOT( viewAudioManager() ) ); + } else { + delete _am; + _am = 0; + } +} +void ArtsActions::viewArtsStatusView() { + if ( !_asv ) { + _asv = new ArtsStatusView( _kartsserver->server() ); + connect( _asv, SIGNAL( closed() ), this, SLOT( viewArtsStatusView() ) ); + } else { + delete _asv; + _asv = 0; + } +} +void ArtsActions::viewMidiManagerView() { + if ( !_mmv ) { + _mmv = new MidiManagerView(); + connect( _mmv, SIGNAL( closed() ), this, SLOT( viewMidiManagerView() ) ); + } else { + delete _mmv; + _mmv = 0; + } +} +void ArtsActions::viewEnvironmentView() { + if ( !_ev ) { + _ev = new EnvironmentView( defaultEnvironment() ); + connect( _ev, SIGNAL( closed() ), this, SLOT( viewEnvironmentView() ) ); + } else { + delete _ev; + _ev = 0; + } +} +void ArtsActions::viewMediaTypesView() { + if ( !_mtv ) { + _mtv = new MediaTypesView(); + connect( _mtv, SIGNAL( closed() ), this, SLOT( viewMediaTypesView() ) ); + } else { + delete _mtv; + _mtv = 0; + } +} + +#include "artsactions.moc" diff --git a/arts/tools/artsactions.h b/arts/tools/artsactions.h new file mode 100644 index 00000000..c87945c2 --- /dev/null +++ b/arts/tools/artsactions.h @@ -0,0 +1,117 @@ +/* + + Copyright (C) 2003 Arnold Krille <arnold@arnoldarts.de> + + 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 General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + */ + +#ifndef ARTS_ACTIONS_H +#define ARTS_ACTIONS_H + +#include <qwidget.h> +#include <kdelibs_export.h> +class KArtsServer; +class KAction; +class KActionCollection; +class KPopupMenu; +class FFTScopeView; +class Gui_AUDIO_MANAGER; +class ArtsStatusView; +class MidiManagerView; +class EnvironmentView; +class MediaTypesView; + +class KDE_EXPORT ArtsActions : public QObject +{ + Q_OBJECT +public: + /** + Constructs a ArtsActions-object. + + Use the KActions you get from it to obtain a unique Style for all menus. + + It also provides an easy way to have FFT-ScopeView, Audiomanager and other things available. + + @param artsserver a pointer to a existing KArtsServer. If 0 a new is created. + @param actioncollection the KActionCollection all the actions should belong to. Names of the actions are then: artssupport_* + @param qwidget the parent QWidget + @param name the name of the object + */ + ArtsActions( KArtsServer* artsserver, KActionCollection* actioncollection, QWidget* qwidget, const char* name=0 ); + /** Destructor */ + ~ArtsActions(); + + /** Returns an Action for showing the ScopeView. Unless otherwise connected it also toggles a ScopeView. */ + KAction* actionScopeView(); + /** Returns an Action for showing the Audiomanager. Unless otherwise connected it also toggles a Audiomanager. */ + KAction* actionAudioManager(); + /** Returns an Action for showing the StatusView. Unless otherwise connected it also toggles a StatusView. */ + KAction* actionArtsStatusView(); + /** Returns an Action for showing the MidiManager. Unless otherwise connected it also toggles a MidiManager. */ + KAction* actionMidiManagerView(); + /** Returns an Action for showing the EnvironmentView. Unless otherwise connected it also toggles a EnvironmentView. */ + KAction* actionEnvironmentView(); + /** Returns an Action for showing the MediaTypesView. Unless otherwise connected it also toggles a MediaTypesView. */ + KAction* actionMediaTypesView(); + + KAction* actionStyleNormal(); + KAction* actionStyleFire(); + KAction* actionStyleLine(); + KAction* actionStyleLED(); + KAction* actionStyleAnalog(); + KAction* actionStyleSmall(); + KPopupMenu* stylemenu(); + + static KAction* actionMoreBars( const QObject*, const char*, KActionCollection* ); + static KAction* actionLessBars( const QObject*, const char*, KActionCollection* ); + +public slots: + void viewScopeView(); + void viewAudioManager(); + void viewArtsStatusView(); + void viewMidiManagerView(); + void viewEnvironmentView(); + void viewMediaTypesView(); +private slots: + void _p_style_normal() { emit styleNormal(); } + void _p_style_fire() { emit styleFire(); } + void _p_style_line() { emit styleLine(); } + void _p_style_led() { emit styleLED(); } + void _p_style_analog() { emit styleAnalog(); } + void _p_style_small() { emit styleSmall(); } +signals: + void styleNormal(); + void styleFire(); + void styleLine(); + void styleLED(); + void styleAnalog(); + void styleSmall(); +private: + KArtsServer* _kartsserver; + KActionCollection* _actioncollection; + KAction *_a_sv, *_a_am, *_a_asv, *_a_mmv, *_a_ev, *_a_mtv; + //KAction *_a_morebars, *_a_lessbars; + KAction *_a_style_normal, *_a_style_fire, *_a_style_line, *_a_style_led, *_a_style_analog, *_a_style_small; + KPopupMenu* _stylemenu; + FFTScopeView *_sv; + Gui_AUDIO_MANAGER *_am; + ArtsStatusView *_asv; + MidiManagerView *_mmv; + EnvironmentView *_ev; + MediaTypesView *_mtv; +}; + +#endif diff --git a/arts/tools/artscontrol.desktop b/arts/tools/artscontrol.desktop new file mode 100644 index 00000000..4c7068d8 --- /dev/null +++ b/arts/tools/artscontrol.desktop @@ -0,0 +1,136 @@ +[Desktop Entry] +Name=aRts Control Tool +Name[af]=Arts Kontrole Program +Name[ar]=أداة aRts للتحكم +Name[bn]=আর্ট্স্ নিয়ন্ত্রণ টুল +Name[br]=Ostilh renadur aRts +Name[bs]=Alat za podešavanje aRts-a +Name[ca]=Eina de control de aRts +Name[cs]=Ovládání programu aRts +Name[cy]=Erfyn Rheoli aRts +Name[da]=aRts-kontrolværktøj +Name[de]=aRts-Steuerung +Name[el]=Εργαλείο ελέγχου aRts +Name[eo]=Sonservostirilo +Name[et]=aRts'i juhtimine +Name[eu]=aRts-en kontrol tresna +Name[fa]=ابزار کنترل aRts +Name[fi]=aRts-asetustyökalu +Name[fr]=aRtsControl +Name[ga]=Uirlis Rialaithe aRts +Name[gl]=Ferramenta de Control de aRts +Name[hi]=एआरटीएस नियंत्रक औज़ार +Name[hr]=Podešavanje aRts-a +Name[hu]=aRts vezérlőprogram +Name[is]=Stjórnborð aRts +Name[it]=Strumento di controllo di aRts +Name[ja]=aRts コントロールツール +Name[kk]=aRts басқару құралы +Name[km]=ឧបករណ៍បញ្ជា aRts +Name[ko]=aRts 설정 도구 +Name[lt]=aRts valdymo įrankis +Name[lv]=aRts Vadības Rīks +Name[mk]=Контролна алатка на aRts +Name[nb]=aRts-kontrollverktøy +Name[nds]=aRts-Kuntrullwarktüüch +Name[ne]=aRts नियन्त्रण उपकरण +Name[nl]=aRts bedieningshulpprogramma +Name[nn]=aRts-kontrollverktøy +Name[pa]=aRts ਕੰਟਰੋਲ ਸੰਦ +Name[pl]=Sterowanie aRts +Name[pt]=Ferramenta de Controlo do aRts +Name[pt_BR]=Ferramenta de Controle do aRts +Name[ro]=Utilitar control aRts +Name[ru]=artscontrol +Name[se]=aRts-stivrenreaidu +Name[sk]=Ovládací nástroj aRts +Name[sl]=Orodje za nadzor aRts +Name[sr]=Контролни алат aRts-а +Name[sr@Latn]=Kontrolni alat aRts-a +Name[sv]=Arts-kontrollverktyg +Name[ta]=aRts கட்டுப்பாட்டுக் கருவி +Name[tg]=aRts Асбоби Идоракунӣ +Name[th]=เครื่องมือควบคุม aRts +Name[tr]=aRts Denetim Aracı +Name[uk]=Керування aRts +Name[uz]=aRts boshqaruv vositasi +Name[uz@cyrillic]=aRts бошқарув воситаси +Name[ven]=Tshishumiswa tshau langula aRTs +Name[xh]=Ulawulo Lwemizobo +Name[zh_CN]=aRts 控制工具 +Name[zh_HK]=aRts 控制工具 +Name[zh_TW]=aRts 控制工具 +Name[zu]=Ithuluazi Lokuphatha le aRts +GenericName=Sound Server Control +GenericName[af]=Klank Bediener Kontrole +GenericName[bg]=Контрол на аудио сървъра +GenericName[bn]=সাউণ্ড সার্ভার নিয়ন্ত্রণ +GenericName[br]=Kefluniañ ar Servijer Son +GenericName[bs]=Kontrola sound servera +GenericName[ca]=Control del servidor de so +GenericName[cs]=Ovládání zvukového serveru +GenericName[cy]=Rheoli Gweinydd Sain +GenericName[da]=Lydserverkontrol +GenericName[de]=Soundserver-Steuerung +GenericName[el]=Έλεγχος εξυπηρετητή ήχου +GenericName[eo]=Agordo de la sonservo +GenericName[es]=Control del servidor de sonido +GenericName[et]=Heliserveri seadistamine +GenericName[eu]=Soinu zerbitzariaren kontrola +GenericName[fa]=کنترل کارساز صدا +GenericName[fi]=Äänipalvelimen hallinta +GenericName[fr]=Contrôle du serveur de son +GenericName[ga]=Rialú Freastalaí Fuaime +GenericName[gl]=Control do Servidor de Son +GenericName[he]=שליטה בשרת הצליל +GenericName[hi]=ध्वनि सर्वर नियंत्रक +GenericName[hr]=Kontrola zvučnog poslužitelja +GenericName[hu]=Hangszolgáltatás-vezérlő +GenericName[is]=Stillingar hljóðmiðlarans +GenericName[it]=Controllo del server sonoro +GenericName[ja]=サウンドサーバのコントロール +GenericName[kk]=Дыбыс серверін басқару +GenericName[km]=ឧបករណ៍បញ្ជាម៉ាស៊ីនបម្រើសំឡេង +GenericName[ko]=소리 서버 설정 +GenericName[lt]=Garsų serverio valdymas +GenericName[mk]=Контрола на серверот за звук +GenericName[ms]=Kawalan Pelayan Bunyi +GenericName[nb]=Lydtjenerkontroll +GenericName[nds]=Klangserverstüern +GenericName[ne]=ध्वनि सर्भर नियन्त्रण +GenericName[nl]=Geluidsserverbediening +GenericName[nn]=Lydtenarstyring +GenericName[pa]=ਸਾਊਂਡ ਸਰਵਰ ਕੰਟਰੋਲ +GenericName[pl]=Sterowanie serwerem dźwięku +GenericName[pt]=Controlo do Servidor de Som +GenericName[pt_BR]=Controle do servidor de som +GenericName[ro]=Control server de sunet +GenericName[ru]=Управление звуковым сервером +GenericName[se]=Jietnabálvástivren +GenericName[sk]=Nastavenie zvukového servera +GenericName[sl]=Nadzor zvočnega strežnika +GenericName[sr]=Контрола звучног сервера +GenericName[sr@Latn]=Kontrola zvučnog servera +GenericName[sv]=Inställning av ljudserver +GenericName[ta]=ஒலி சேவையக கட்டுப்பாடு +GenericName[tg]=Идоракунии Хидматрасони Овоз +GenericName[th]=ควบคุมเซิร์ฟเวอร์เสียง +GenericName[tr]=Ses Sunucu Yöneticisi +GenericName[uk]=Керування сервером звуку +GenericName[uz]=Tovush serverini boshqarish +GenericName[uz@cyrillic]=Товуш серверини бошқариш +GenericName[ven]=Ndangulo ya siva ya mubvumo +GenericName[wa]=Contrôle do sierveu di sons +GenericName[xh]=Ulawulo Lomncedisi Wesandi +GenericName[zh_CN]=声音服务器控制 +GenericName[zh_HK]=聲音伺服器控制器 +GenericName[zh_TW]=聲音伺服器控制器 +GenericName[zu]=Ukulawila Lomlekeleli Womsindo +Exec=artscontrol -caption "%c" +Icon=artscontrol +Type=Application +Terminal=false +X-DCOP-ServiceType=Multi +DocPath=artsbuilder/index.html +OnlyShowIn=KDE; +Categories=Qt;KDE;AudioVideo;X-KDE-More; diff --git a/arts/tools/artscontrol.rc b/arts/tools/artscontrol.rc new file mode 100644 index 00000000..5c1c0368 --- /dev/null +++ b/arts/tools/artscontrol.rc @@ -0,0 +1,17 @@ +<!DOCTYPE kpartgui> +<kpartgui name="artscontrol" version="3"> +<MenuBar> + <Menu name="view"><text>&View</text> + <Action name="artssupport_view_scopeview"/> + <Action name="artssupport_view_audiomanager"/> + <Action name="artssupport_view_artsstatus"/> + <Action name="artssupport_view_midimanager"/> + <Action name="artssupport_view_environment"/> + <Action name="artssupport_view_mediatypes"/> + <Action name="view_freeverb"/> + <Action name="old_volume_display"/> + <Separator /> + <Action name="quit_artscontrol"/> + </Menu> +</MenuBar> +</kpartgui> diff --git a/arts/tools/artscontrolapplet.cpp b/arts/tools/artscontrolapplet.cpp new file mode 100644 index 00000000..a178c2d3 --- /dev/null +++ b/arts/tools/artscontrolapplet.cpp @@ -0,0 +1,163 @@ +/*************************************************************************** + artscontrolapplet.cpp - description + ------------------- + begin : Don Jan 30 20:42:53 CET 2003 + copyright : (C) 2003 by Arnold Krille + email : arnold@arnoldarts.de + ***************************************************************************/ + +/*************************************************************************** + * * + * 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. * + * * + ***************************************************************************/ + +#include <kglobal.h> +#include <klocale.h> +#include <kconfig.h> +#include <kapplication.h> +#include <kmessagebox.h> +#include <kdebug.h> +#include <qcursor.h> +#include <qtimer.h> + +#include "artscontrolapplet.h" +#include "artscontrolapplet_private.h" + +extern "C" +{ + KDE_EXPORT KPanelApplet* init( QWidget *parent, const QString configFile) + { + KGlobal::locale()->insertCatalogue("artscontrol"); + return new ArtsControlApplet(configFile, KPanelApplet::Normal, + KPanelApplet::About /*| KPanelApplet::Help | KPanelApplet::Preferences*/, + parent, "artscontrolapplet"); + } +} + +ArtsControlApplet::ArtsControlApplet(const QString& configFile, Type type, int actions, QWidget *parent, const char *name) : KPanelApplet(configFile, type, actions, parent, name) +{ + //kdDebug()<<"ArtsControlApplet::ArtsControlApplet( const QString& "<<configFile<<", Type "<<type<<", int "<<actions<<", QWidget* "<<parent<<", const char* "<<name<<" )"<<endl; + // Get the current application configuration handle + ksConfig = config(); + + p = new ArtsControlAppletPrivate( this ); + if( !p->barts ) KMessageBox::information(0, i18n("Something with the ArtsServer went wrong. You probably need to restart aRts and then reload this applet.")); + setCustomMenu(p->menu); + + p->layout = new QBoxLayout( this, QBoxLayout::LeftToRight ); + p->layout->setSpacing( 2 ); + + if( p->barts ) { + p->vu = Arts::StereoVolumeControlGui( p->volume ); + p->vu.label().fontsize( 8 ); + p->vuw = new KArtsWidget( p->vu, this ); + p->vuw->setMinimumSize( 16,16 ); + p->layout->addWidget( p->vuw ); + } + + p->layout->activate(); + + QTimer::singleShot( 100, this, SLOT( supdatelayout() ) ); + +kdDebug()<<"ArtsControlApplet::ArtsControlApplet() finished."<<endl; +} + +ArtsControlApplet::~ArtsControlApplet() { +kdDebug()<<k_funcinfo<<endl; +} + +#include <kaboutdata.h> +#include <kaboutapplication.h> + +void ArtsControlApplet::about() { + KAboutData about( "artscontrolapplet", I18N_NOOP( "aRts Control Applet" ), "0.5", + I18N_NOOP( "A kickerapplet to control aRts." ), + KAboutData::License_GPL, I18N_NOOP( "(c) 2003 by Arnold Krille" ) ); + about.addAuthor( "Arnold Krille", I18N_NOOP( "Author of the Applet" ), "arnold@arnoldarts.de" ); + about.addCredit( "Stefan Westerfeld", I18N_NOOP( "Thanks for creating aRts!" ) ); + KAboutApplication a( &about, this ); + a.exec(); +} + +void ArtsControlApplet::help() { +kdDebug()<<k_funcinfo<<endl; +} + +void ArtsControlApplet::preferences() { +kdDebug()<<k_funcinfo<<endl; +} + +int ArtsControlApplet::widthForHeight( int h ) const { +kdDebug()<<"ArtsControlApplet::widthForHeight( int "<<h<<" )"<<endl; + return p->layout->sizeHint().width(); +} + +int ArtsControlApplet::heightForWidth( int w ) const { +kdDebug()<<"ArtsControlApplet::heightForWidth( int "<<w<<" )"<<endl; + return p->layout->sizeHint().height(); +} + +void ArtsControlApplet::resizeEvent( QResizeEvent * /*_Event*/ ) { + kdDebug()<<"ArtsControlApplet::resizeEvent( QResizeEvent * )"<<endl; +} + +void ArtsControlApplet::mousePressEvent( QMouseEvent* ev ) { + //kdDebug()<<"ArtsControlApplet::mousePressEvent( QMouseEvent* "<<ev<<" )"<<endl; + if ( Qt::RightButton == ev->button() /*|| Qt::LeftButton == ev->button()*/ ) + p->menu->exec( QCursor::pos() ); +} + +void ArtsControlApplet::positionChange( Position ) { + kdDebug() << k_funcinfo << endl; + resetLayout(); +} + +void ArtsControlApplet::resetLayout() { +kdDebug()<<k_funcinfo<<" position()="<<position()<<endl; + switch ( position() ) + { + case pTop: + case pBottom: + p->layout->setDirection( QBoxLayout::LeftToRight ); + if ( p->barts ) p->vu.direction( Arts::LeftToRight ); + break; + case pRight: + case pLeft: + p->layout->setDirection( QBoxLayout::TopToBottom ); + if ( p->barts ) p->vu.direction( Arts::TopToBottom ); + break; + default: break; + } +} + +void ArtsControlAppletPrivate::SVinline() { +kdDebug() << k_funcinfo << endl; + if ( !svinline ) { + svinline = new FFTScopeView( arts->server(), _parent ); + svinline->setMargin( 2 ); svinline->setLineWidth( 2 ); svinline->setFrameStyle( QFrame::Panel|QFrame::Sunken ); + connect( svinline, SIGNAL( closed() ), this, SLOT( SVinline() ) ); + layout->addWidget( svinline ); + } else { + delete svinline; + svinline = 0; + } + _parent->supdatelayout(); +} + +void ArtsControlAppletPrivate::moreBars() { vu.left().count( vu.left().count()+10 ); vu.right().count( vu.right().count()+10 ); } +void ArtsControlAppletPrivate::lessBars() { vu.left().count( vu.left().count()-10 ); vu.right().count( vu.right().count()-10 ); } + +void ArtsControlAppletPrivate::styleNormalBars() { vu.left().style( Arts::lmNormalBars ); vu.right().style( Arts::lmNormalBars ); _parent->supdatelayout(); } +void ArtsControlAppletPrivate::styleFireBars() { vu.left().style( Arts::lmFireBars ); vu.right().style( Arts::lmFireBars ); _parent->supdatelayout(); } +void ArtsControlAppletPrivate::styleLineBars() { vu.left().style( Arts::lmLineBars ); vu.right().style( Arts::lmLineBars ); _parent->supdatelayout(); } +void ArtsControlAppletPrivate::styleLEDs() { vu.left().style( Arts::lmLEDs ); vu.right().style( Arts::lmLEDs ); _parent->supdatelayout(); } +void ArtsControlAppletPrivate::styleAnalog() { vu.left().style( Arts::lmAnalog ); vu.right().style( Arts::lmAnalog ); _parent->supdatelayout(); } +void ArtsControlAppletPrivate::styleSmall() { vu.left().style( Arts::lmSmall ); vu.right().style( Arts::lmSmall ); _parent->supdatelayout(); } + +// vim: sw=4 ts=4 +#include "artscontrolapplet.moc" +#include "artscontrolapplet_private.moc" diff --git a/arts/tools/artscontrolapplet.desktop b/arts/tools/artscontrolapplet.desktop new file mode 100644 index 00000000..d43517f7 --- /dev/null +++ b/arts/tools/artscontrolapplet.desktop @@ -0,0 +1,109 @@ +[Desktop Entry] +Type=Plugin +Comment=Control the aRts sound server +Comment[ar]=تحكّم بخادم الصوت aRts +Comment[bg]=Управление на аудио сървъра aRts +Comment[bn]=আর্ট্স্ সাউন্ড সার্ভার নিয়ন্ত্রণ করুন +Comment[br]=A ren servijer klevet aRts +Comment[bs]=Kontrolišite aRts server zvuka +Comment[ca]=Control del servidor de so aRts +Comment[cs]=Ovládání zvukového serveru aRts +Comment[da]=Kontrollér aRts-lydserveren +Comment[de]=Kontrolle über den aRts-Soundserver +Comment[el]=Διαχείριση του εξυπηρετητή ήχου aRts +Comment[eo]=Stiru la aRts-sonservilon +Comment[es]=Controla el servidor de sonido aRts +Comment[et]=aRts heliserveri juhtimine +Comment[eu]=Kontrolatu aRts soinu-zerbitzaria +Comment[fa]=کنترل کارساز صدای aRts +Comment[fi]=Hallitse aRts-äänipalvelinta +Comment[fr]=Contrôlez le serveur de son aRts +Comment[ga]=Rialaigh freastalaí fuaime aRts +Comment[gl]=Controla o servidor de son aRts +Comment[he]=שליטה בשרת הצליל של aRts +Comment[hu]=Az aRts hangszolgáltatás kezelése +Comment[is]=Stjórnaðu aRts hljóðþjóninum +Comment[it]=Controlla il server sonoro aRts +Comment[ja]=aRts サウンドサーバを制御 +Comment[kk]=aRts дыбыс серверін басқару +Comment[km]=បញ្ជាម៉ាស៊ីនបម្រើសំឡេង aRts +Comment[ko]=aRts 소리 서버를 조정합니다 +Comment[lt]=Valdyti aRts garsų serverį +Comment[mk]=Го контролира звучниот сервер aRts +Comment[nb]=Styr lydtjeneren aRts +Comment[nds]=aRts-Klangserverkuntrull +Comment[ne]=aRts ध्वनि सर्भर नियन्त्रण गर्नुहोस् +Comment[nl]=Bedien de aRts geluidsserver +Comment[nn]=Styr aRts-lydtenaren +Comment[pl]=Sterowanie serwerem dźwięku aRts +Comment[pt]=Controlar o servidor de som aRts +Comment[pt_BR]=Controlar o servidor de som aRTs +Comment[ru]=Управление звуковым сервером aRts +Comment[sk]=Ovládanie zvukového servera aRts +Comment[sl]=Nadzorujte zvočni strežnik aRts +Comment[sr]=Контролише aRts звучни сервер +Comment[sr@Latn]=Kontroliše aRts zvučni server +Comment[sv]=Styr ljudservern aRts +Comment[th]=ควบคุมเซิร์ฟเวอร์เสียง aRTs +Comment[tr]=Arts ses sunucusunu konrtol edin +Comment[uk]=Керує звуковим сервером aRts +Comment[zh_CN]=控制 aRts 声音服务器 +Comment[zh_HK]=控制 aRts 聲音伺服器 +Comment[zh_TW]=控制 aRts 聲音伺服器 +Name=aRts Control +Name[ar]=التحكم بـ aRts +Name[bn]=আর্ট্স নিয়ন্ত্রণ +Name[br]=Renadur aRts +Name[bs]=aRts kontrola +Name[ca]=Control d'aRts +Name[cs]=Ovládání programu aRts +Name[cy]=Rheoli aRts +Name[da]=aRts-kontrol +Name[de]=aRts-Steuerung +Name[el]=Έλεγχος aRts +Name[eo]=aRts-stirilo +Name[es]=Control de aRts +Name[et]=aRtsi juhtimine +Name[eu]=aRts-en kontrola +Name[fa]=کنترل aRts +Name[fi]=aRts-hallinta +Name[ga]=Rialú aRts +Name[gl]=Control do aRts +Name[hi]=एआरटीएस नियंत्रण +Name[hu]=aRts vezérlő +Name[is]=Stjórnborð aRts +Name[it]=Controllo di aRts +Name[ja]=aRts コントロール +Name[kk]=aRts басқару құралы +Name[km]=ឧបករណ៍បញ្ជា aRts +Name[ko]=aRts 설정 +Name[lt]=aRts valdymas +Name[mk]=Контрола на aRts +Name[nb]=aRts-kontrollverktøy +Name[nds]=aRts-Kuntrull +Name[ne]=aRts नियन्त्रण +Name[nl]=aRts bediening +Name[nn]=aRts-kontroll +Name[pa]=aRts ਕੰਟਰੋਲ +Name[pl]=Sterowanie aRts +Name[pt]=Controlo do aRts +Name[pt_BR]=Controle do aRts +Name[ro]=Control aRts +Name[ru]=Утилита управления aRts +Name[sk]=Ovládanie aRts +Name[sl]=Nadzor aRts +Name[sr]=Контрола aRts-а +Name[sr@Latn]=Kontrola aRts-a +Name[sv]=Arts-kontroll +Name[ta]=aRts கட்டுப்பாடு +Name[tg]=aRts Идоракунӣ +Name[tr]=aRts Kontrol +Name[uk]=Керування aRts +Name[uz]=aRts boshqaruvi +Name[uz@cyrillic]=aRts бошқаруви +Name[zh_CN]=aRts 控制 +Name[zh_HK]=aRts 控制器 +Name[zh_TW]=aRts 控制 +X-KDE-Library=libartscontrolapplet +Icon=artscontrol +OnlyShowIn=KDE; diff --git a/arts/tools/artscontrolapplet.h b/arts/tools/artscontrolapplet.h new file mode 100644 index 00000000..09ff15fe --- /dev/null +++ b/arts/tools/artscontrolapplet.h @@ -0,0 +1,132 @@ +/*************************************************************************** + artscontrolapplet.h - description + ------------------- + begin : Don Jan 30 20:42:53 CET 2003 + copyright : (C) 2003 by Arnold Krille + email : arnold@arnoldarts.de + ***************************************************************************/ + +/*************************************************************************** + * * + * 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. * + * * + ***************************************************************************/ + +#ifndef ARTSCONTROLAPPLET_H +#define ARTSCONTROLAPPLET_H + +#ifdef HAVE_CONFIG_H + #include <config.h> +#endif + +#include <kpanelapplet.h> +#include <qstring.h> +#include <kconfig.h> + +class ArtsControlAppletPrivate; + +class ArtsControlApplet : public KPanelApplet +{ + Q_OBJECT +public: + /** + * Construct a @ref KPanelApplet just like any other widget. + * + * @param configFile The configFile handed over in the factory function. + * @param Type The applet @ref type(). + * @param actions Standard RMB menu actions supported by the applet (see @ref action() ). + * @param parent The pointer to the parent widget handed over in the factory function. + * @param name A Qt object name for your applet. + **/ + ArtsControlApplet(const QString& configFile, Type t = Normal, int = 0, + QWidget * = 0, const char * = 0); + /** destructor */ + ~ArtsControlApplet(); + /** + * Retrieve a suggested width for a given height. + * + * Every applet should reimplement this function. + * + * Depending on the panel orientation the height (horizontal panel) or the + * width (vertical panel) of the applets is fixed. + * The exact values of the fixed size component depend on the panel size. + * + * On a horizontal panel the applet height is fixed, the panel will + * call @ref widthForHeight(int height) with @p height + * equal to 'the fixed applet height' + * when laying out the applets. + * + * The applet can now choose the other size component (width) + * based on the given height. + * + * The width you return is granted. + **/ + int widthForHeight( int ) const; + /** + * @return A suggested height for a given width. + * + * Every applet should reimplement this function. + * + * Depending on the panel orientation the height (horizontal panel) or the + * width (vertical panel) of the applets is fixed. + * The exact values of the fixed size component depend on the panel size. + * + * On a vertical panel the applet width is fixed, the panel will + * call @ref heightForWidth(int width) with @p width + * equal to 'the fixed applet width' + * when laying out the applets. + * + * The applet can now choose the other size component (height) + * based on the given width. + * + * The height you return is granted. + **/ + int heightForWidth( int ) const; + /** + * Is called when the user selects "About" from the applets RMB menu. + * Reimplement this function to launch a about dialog. + * + * Note that this is called only when your applet supports the About action. + * See @ref Action and @ref KPanelApplet(). + **/ + void about(); + /** + * Is called when the user selects "Help" from the applets RMB menu. + * Reimplement this function to launch a manual or help page. + * + * Note that this is called only when your applet supports the Help action. + * See @ref Action and @ref KPanelApplet(). + **/ + void help(); + /** + * Is called when the user selects "Preferences" from the applets RMB menu. + * Reimplement this function to launch a preferences dialog or kcontrol module. + * + * Note that this is called only when your applet supports the preferences action. + * See @ref Action and @ref KPanelApplet(). + **/ + void preferences(); + +protected: + + void resizeEvent( QResizeEvent* ); + + virtual void mousePressEvent( QMouseEvent* ); + + void positionChange( Position ); + +public slots: + void supdatelayout() { emit updateLayout(); } + +protected slots: + void resetLayout(); + +private: + KConfig *ksConfig; + ArtsControlAppletPrivate *p; +}; + +#endif diff --git a/arts/tools/artscontrolapplet_private.h b/arts/tools/artscontrolapplet_private.h new file mode 100644 index 00000000..044a156b --- /dev/null +++ b/arts/tools/artscontrolapplet_private.h @@ -0,0 +1,122 @@ +/*************************************************************************** + artscontrolapplet_private.h - description + ------------------- + begin : Don Jan 30 2003 + copyright : (C) 2003 by Arnold Krille + email : arnold@arnoldarts.de + ***************************************************************************/ + +/*************************************************************************** + * * + * 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. * + * * + ***************************************************************************/ + +#ifndef ARTSCONTROLAPPLET_PRIVATE_H +#define ARTSCONTROLAPPLET_PRIVATE_H + +#include "artscontrolapplet.h" + +#include <qobject.h> + +#include <qlayout.h> +#include <qlabel.h> +#include <qslider.h> +#include <qpushbutton.h> +#include <kpopupmenu.h> +#include <kaction.h> +#include <qfont.h> + +#include <kartsserver.h> +#include <kartsdispatcher.h> +#include <kartsfloatwatch.h> +#include <kartswidget.h> +#include <artsflow.h> +#include <connect.h> +#include <artsmoduleseffects.h> +#include <kdelibs_export.h> + +#include "artsactions.h" + +#include "fftscopeview.h" + +class VolumeSlider; + +class KDE_EXPORT ArtsControlAppletPrivate : public QObject { + Q_OBJECT +private: + ArtsControlApplet *_parent; + ArtsActions* _artsactions; +public: + QBoxLayout *layout; + KArtsServer *arts; + KArtsDispatcher *dispatcher; + Arts::StereoVolumeControl volume; + bool barts, bInUpdate; + FFTScopeView *svinline; + + KArtsWidget *vuw; + Arts::StereoVolumeControlGui vu; + + KPopupMenu *menu; + KAction *_showSV, *_showSVinline, *_showAM, *_showArtsStatus, *_showMidiManager, *_showEnvironment, *_showMediaTypes, *_moreBars, *_lessBars; + KAction *_styleNormalBars, *_styleFireBars, *_styleLineBars, *_styleLEDs, *_styleAnalog, *_styleSmall; + + ArtsControlAppletPrivate( ArtsControlApplet *parent ) + : QObject(parent) + , _parent( parent ) + , barts( false ) + , bInUpdate( false ) + { + arts = new KArtsServer( 0 ); + dispatcher = new KArtsDispatcher( 0 ); + if( ! arts->server().isNull() ) barts = true; + if( barts ) volume = arts->server().outVolume(); + svinline=0; + + _artsactions = new ArtsActions( arts, 0, parent ); + + menu = new KPopupMenu( 0 ); + _showSV = _artsactions->actionScopeView(); + _showSV->plug( menu ); + _showSVinline = new KAction( i18n( "Toggle &Inline FFT Scope" ), "artscontrol", KShortcut(), this, SLOT( SVinline() ), this ); + _showSVinline->plug( menu ); + _showAM = _artsactions->actionAudioManager(); + _showAM->plug( menu ); + _showArtsStatus = _artsactions->actionArtsStatusView(); + _showArtsStatus->plug( menu ); + _showMidiManager = _artsactions->actionMidiManagerView(); + _showMidiManager->plug( menu ); + _showEnvironment = _artsactions->actionEnvironmentView(); + _showEnvironment->plug( menu ); + _showMediaTypes = _artsactions->actionMediaTypesView(); + _showMediaTypes->plug( menu ); + menu->insertSeparator(); + menu->insertItem( i18n( "VU-Style" ), _artsactions->stylemenu() ); + connect( _artsactions, SIGNAL( styleNormal() ), this, SLOT( styleNormalBars() ) ); + connect( _artsactions, SIGNAL( styleFire() ), this, SLOT( styleFireBars() ) ); + connect( _artsactions, SIGNAL( styleLine() ), this, SLOT( styleLineBars() ) ); + connect( _artsactions, SIGNAL( styleLED() ), this, SLOT( styleLEDs() ) ); + connect( _artsactions, SIGNAL( styleAnalog() ), this, SLOT( styleAnalog() ) ); + connect( _artsactions, SIGNAL( styleSmall() ), this, SLOT( styleSmall() ) ); + } + ~ArtsControlAppletPrivate() { + if ( svinline ) SVinline(); + } +public slots: + void SVinline(); // ScopeView inline + void moreBars(); + void lessBars(); + void styleNormalBars(); + void styleFireBars(); + void styleLineBars(); + void styleLEDs(); + void styleAnalog(); + void styleSmall(); +}; + +// vim: sw=4 ts=4 +#endif diff --git a/arts/tools/artsmidimanagerview.rc b/arts/tools/artsmidimanagerview.rc new file mode 100644 index 00000000..6bd743e6 --- /dev/null +++ b/arts/tools/artsmidimanagerview.rc @@ -0,0 +1,9 @@ +<!DOCTYPE kpartgui> +<kpartgui name="artsmidimanager.rc" version="1"> +<MenuBar> + <Menu name="add"><text>&Add</text> + <Action name="add_oss_midi_port"/> + <Action name="add_arts_midi_output"/> + </Menu> +</MenuBar> +</kpartgui> diff --git a/arts/tools/audiomanager.cpp b/arts/tools/audiomanager.cpp new file mode 100644 index 00000000..d250e37f --- /dev/null +++ b/arts/tools/audiomanager.cpp @@ -0,0 +1,198 @@ +/* + + Copyright (C) 1999 Stefan Westerfeld + stefan@space.twc.de + 2003 Arnold Krille + arnold@arnoldarts.de + + 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 General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + */ + +#include "audiomanager.h" +#include "choosebusdlg.h" + +#include <qtimer.h> +#include <qlayout.h> + +#include <klocale.h> +#include <klistview.h> +#include <kiconloader.h> + +using namespace std; + +/* + * as this is an 1:1 port of an old arts-0.3.4.1 artsbuilable visual widget, + * you'll see some porting artefacts, and it's not elegance itself ;) + */ +Gui_AUDIO_MANAGER::Gui_AUDIO_MANAGER( QWidget* parent, const char* name ) : Template_ArtsView( parent,name ) +{ + this->setCaption( i18n( "Audio Manager" ) ); + this->setIcon( MainBarIcon( "artsaudiomanager", 32 ) ); + //printf("constructor\n"); + ParentWidget = 0; + listview = 0; + inDialog = false; + proxy = new GuiAudioManagerProxy(this); + + AudioManager = Arts::Reference("global:Arts_AudioManager"); + changes = AudioManager.changes()-1; + setParent(this,0); + tick(); + show(); + + QTimer *updatetimer = new QTimer(this); + updatetimer->start(500); + QObject::connect(updatetimer,SIGNAL(timeout()),this,SLOT(tick())); +} + +Gui_AUDIO_MANAGER::~Gui_AUDIO_MANAGER() +{ + if(listview) delete listview; + delete proxy; +} + +#if 0 +void Gui_AUDIO_MANAGER::widgetDestroyed(QWidget *widget) +{ + assert(widget == listview); + listview = 0; +} +#endif + +void Gui_AUDIO_MANAGER::setParent(QWidget *parent, QBoxLayout * /*layout*/) +{ +/************************************************************************ + * From Gui_INSTRUMENT_MAPPER: + * + * I am still not sure wether this kind of putting yourself into a parent + * widget (with own layout etc.) is a good idea (there may not even be + * a singe call to setParent, because there is no parent). + * + * But the "how to write aRts widgets"-stuff will need some experiments, + * so lets try that method... + * + * ---- + * + * But perhaps here (since only one widget Listview is used) something + * else would be appropriate. Check that. FIXME + ************************************************************************/ + + QVBoxLayout *mainlayout = new QVBoxLayout(parent); + /*QHBoxLayout *contentslayout = new QHBoxLayout;*/ + +// list + + listview = new KListView(parent); + + listview->addColumn(i18n("Title"),175); + listview->addColumn(i18n("Type"),50); + listview->addColumn(i18n("Bus"),75); + + listview->setMinimumSize(300,100); + + QObject::connect(listview,SIGNAL(executed(QListViewItem *)),proxy, + SLOT(edit(QListViewItem *))); + + mainlayout->addWidget(listview); + + mainlayout->activate(); + //mainlayout->freeze(); + ParentWidget = parent; +} + +void Gui_AUDIO_MANAGER::tick() +{ + unsigned long newChanges = AudioManager.changes(); + if(inDialog) return; + if(changes == newChanges) return; + + changes = newChanges; + + listview->clear(); + vector<Arts::AudioManagerInfo> *acs = AudioManager.clients(); + + unsigned long c; + for(c=0;c<acs->size();c++) + { + //char status[2][10] = {"init","running"}; + QString description = QString::fromUtf8( (*acs)[c].title.c_str() ); + QString type; + if((*acs)[c].direction == Arts::amPlay) + type = i18n("play"); + else + type = i18n("record"); + QString destination = QString::fromUtf8( (*acs)[c].destination.c_str() ); + long ID = (*acs)[c].ID; + + (void)new AudioManagerItem(listview, description, type, destination, ID); + } + delete acs; + //Widget->show(); +} + +void Gui_AUDIO_MANAGER::edit(QListViewItem *item) +{ + AudioManagerItem *ai = (AudioManagerItem *)item; + ChooseBusDlg *cd = new ChooseBusDlg(0); + assert(cd); + + inDialog = true; + int accept = cd->exec(); + inDialog = false; + + if( accept == QDialog::Accepted ) + { + QString result = cd->result(); + if(!result.isNull()) + { + //lukas: I hope UTF-8 is OK here... + AudioManager.setDestination(ai->ID(),result.utf8().data()); + // refresh: + changes = 0; + tick(); + } + } + delete cd; +} + +GuiAudioManagerProxy::GuiAudioManagerProxy(Gui_AUDIO_MANAGER *gim) +{ + this->gim = gim; +} + +void GuiAudioManagerProxy::edit(QListViewItem *item) +{ + gim->edit(item); +} + +AudioManagerItem::AudioManagerItem(QListView *parent, QString a, + QString b, QString c, long ID) :QListViewItem(parent,a,b,c) +{ + _ID = ID; +} + +long AudioManagerItem::ID() +{ + return _ID; +} + +AudioManagerItem::~AudioManagerItem() +{ + // +} +#include "audiomanager.moc" + +// vim: sw=4 ts=4 diff --git a/arts/tools/audiomanager.h b/arts/tools/audiomanager.h new file mode 100644 index 00000000..202c454c --- /dev/null +++ b/arts/tools/audiomanager.h @@ -0,0 +1,79 @@ +/* + + Copyright (C) 1999 Stefan Westerfeld + stefan@space.twc.de + 2003 Arnold Krille + arnold@arnoldarts.de + + 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 General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + */ + +#ifndef _AUDIOMANAGER_H_ +#define _AUDIOMANAGER_H_ + +#include <artsflow.h> +#include <qwidget.h> +#include <qlistview.h> + +#include "templateview.h" + +class KListView; +class GuiAudioManagerProxy; +class QBoxLayout; + +class Gui_AUDIO_MANAGER : public Template_ArtsView +{ + Q_OBJECT +protected: + QWidget *ParentWidget; + KListView *listview; + GuiAudioManagerProxy *proxy; + Arts::AudioManager AudioManager; + + bool inDialog; + unsigned long changes; + int x,y; +public: + Gui_AUDIO_MANAGER( QWidget* =0, const char* =0 ); + ~Gui_AUDIO_MANAGER(); + + void setParent(QWidget *Parent,QBoxLayout *layout); + + void edit(QListViewItem *item); +public slots: + void tick(); +}; + +class GuiAudioManagerProxy :public QObject { + Q_OBJECT + Gui_AUDIO_MANAGER *gim; +public: + GuiAudioManagerProxy(Gui_AUDIO_MANAGER *gim); +public slots: + void edit(QListViewItem *item); +}; + +class AudioManagerItem : public QListViewItem { + long _ID; +public: + AudioManagerItem(QListView *parent, QString a, QString b, + QString c, long ID); + ~AudioManagerItem(); + + long ID(); +}; + +#endif diff --git a/arts/tools/choosebusdlg.cpp b/arts/tools/choosebusdlg.cpp new file mode 100644 index 00000000..77e439ee --- /dev/null +++ b/arts/tools/choosebusdlg.cpp @@ -0,0 +1,184 @@ +/* + + Copyright (C) 1998 Stefan Westerfeld + stefan@space.twc.de + + 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 General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + */ + +#include "choosebusdlg.h" + +#include <artsflow.h> + +#include <qlayout.h> +#include <qlabel.h> +#include <qlistbox.h> +#include <qpushbutton.h> + +#include <kbuttonbox.h> +#include <kseparator.h> +#include <klineedit.h> +#include <klocale.h> +#include <kapplication.h> +#include <kdebug.h> +#include <kstdguiitem.h> + +using namespace std; + +static void min_size(QWidget *w) { + w->setMinimumSize(w->sizeHint()); +} + +ChooseBusDlg::ChooseBusDlg(QWidget *parent) + : KDialog(parent,"X", TRUE) + , _newbusitemindex( -1 ) +{ + setCaption(i18n("Choose Bus")); + + QVBoxLayout *mainlayout = new QVBoxLayout(this); + +// caption label: "Synthesis running..." + + mainlayout->addSpacing(5); + QLabel *captionlabel = new QLabel(this); + QFont labelfont(captionlabel->font()); + labelfont.setPointSize(labelfont.pointSize()*3/2); + captionlabel->setFont(labelfont); + captionlabel->setText(QString(" ")+i18n("Available busses:")+QString(" ")); + captionlabel->setAlignment(AlignCenter); + min_size(captionlabel); + mainlayout->addWidget(captionlabel); + +// hruler + + mainlayout->addSpacing(5); + KSeparator *ruler2 = new KSeparator( KSeparator::HLine, this); + mainlayout->addWidget(ruler2); + + mainlayout->addSpacing(5); + +// listwidget + + + listbox = new QListBox(this); + listbox->setMinimumSize(300,200); + + Arts::AudioManager aman = Arts::Reference("global:Arts_AudioManager"); + + if(!aman.isNull()) + { + vector<string> *destinations = aman.destinations(); + unsigned long i; + for(i=0;i<destinations->size();i++) + listbox->insertItem((*destinations)[i].c_str()); + delete destinations; + } + if( listbox->count() > 0 ) + listbox->setCurrentItem( 0 ); + + mainlayout->addWidget(listbox); + +// hruler + + mainlayout->addSpacing(5); + KSeparator *ruler = new KSeparator( KSeparator::HLine, this); + mainlayout->addWidget(ruler); + mainlayout->addSpacing(5); + +// new bus lineedit + + QBoxLayout * layout2 = new QHBoxLayout( mainlayout ); + //mainlayout->addLayout( layout2 ); + QLabel * newbuslabel = new QLabel( i18n( "New bus:" ), this ); + layout2->addWidget( newbuslabel ); + lineedit = new KLineEdit( this ); + connect( lineedit, SIGNAL( textChanged( const QString & ) ), SLOT( textChanged( const QString & ) ) ); + layout2->addWidget( lineedit ); + +// hruler + + mainlayout->addSpacing(5); + KSeparator *ruler3 = new KSeparator( KSeparator::HLine, this); + mainlayout->addWidget(ruler3); + + mainlayout->addSpacing(5); + +// buttons + + mainlayout->addSpacing(5); + QHBoxLayout *buttonlayout = new QHBoxLayout( mainlayout ); + //mainlayout->addLayout(buttonlayout); + mainlayout->addSpacing(5); + + buttonlayout->addSpacing(5); + KButtonBox *bbox = new KButtonBox(this); + + bbox->addButton(KStdGuiItem::help(), this, SLOT( help() )); + bbox->addStretch(1); + + QPushButton * okbutton = bbox->addButton(KStdGuiItem::ok()); + okbutton->setDefault( true ); + connect( okbutton, SIGNAL( clicked() ), SLOT(accept() ) ); + + QButton *cancelbutton = bbox->addButton(KStdGuiItem::cancel()); + connect( cancelbutton, SIGNAL( clicked() ), SLOT(reject() ) ); + + bbox->layout(); + + buttonlayout->addWidget(bbox); + buttonlayout->addSpacing(5); + + mainlayout->freeze(); +} + +QString ChooseBusDlg::result() +{ + if(listbox->currentItem() != -1) + { + return(listbox->text(listbox->currentItem())); + } + return(0); +} + +void ChooseBusDlg::help() +{ + KApplication::kApplication()->invokeHelp("", "artsbuilder"); +} + +void ChooseBusDlg::textChanged( const QString & busname ) +{ + if( ! busname.isEmpty() ) + { + if( _newbusitemindex > -1 ) + listbox->changeItem( busname, _newbusitemindex ); + else + { + _newbusitemindex = listbox->count(); + listbox->insertItem( busname, _newbusitemindex ); + listbox->setCurrentItem( _newbusitemindex ); + } + } + else + { + listbox->removeItem( _newbusitemindex ); + listbox->setCurrentItem( _newbusitemindex - 1 ); + _newbusitemindex = -1; + } +} + +#include "choosebusdlg.moc" + +// vim: sw=4 ts=4 diff --git a/arts/tools/choosebusdlg.h b/arts/tools/choosebusdlg.h new file mode 100644 index 00000000..40c48603 --- /dev/null +++ b/arts/tools/choosebusdlg.h @@ -0,0 +1,49 @@ +/* + + Copyright (C) 1998 Stefan Westerfeld + stefan@space.twc.de + + 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 General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + */ + +#ifndef __CHOOSEBUSDLG_H_ +#define __CHOOSEBUSDLG_H_ + +#include <kdialog.h> + +class QListBox; +class KLineEdit; +class QPushButton; + +class ChooseBusDlg :public KDialog { + Q_OBJECT + QListBox *listbox; + KLineEdit * lineedit; + + int _newbusitemindex; +public: + ChooseBusDlg(QWidget *parent); + +public slots: + QString result(); + void help(); + +protected slots: + void textChanged( const QString & ); +}; +#endif + +// vim: sw=4 ts=4 diff --git a/arts/tools/environmentview.cpp b/arts/tools/environmentview.cpp new file mode 100644 index 00000000..e2074b5f --- /dev/null +++ b/arts/tools/environmentview.cpp @@ -0,0 +1,171 @@ +/* + + Copyright (C) 2001 Stefan Westerfeld + <stefan@space.twc.de> + 2003 Matthias Kretz <kretz@kde.org> + 2003 Arnold Krille <arnold@arnoldarts.de> + + 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 General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + */ + +#include "environmentview.h" +#include <qdir.h> +#include <qfile.h> +#include <qpushbutton.h> + +#include <klistbox.h> +#include <kartswidget.h> +#include <klocale.h> +#include <kiconloader.h> +#include <stdio.h> +#include <fstream> +#include <vector> + +#include <qlayout.h> + +#define DEFAULT_ENV_FILENAME "~/default.arts-env" + +using namespace Arts; +using Environment::Container; +using Environment::Item; + +class ItemView : public QListBoxText { +public: + Item item; + KArtsWidget *widget; + ItemView(QListBox *listBox, Item item) + : QListBoxText(listBox), item(item), widget(0) + { + } + ~ItemView() + { + delete widget; + widget = 0; + printf("~ItemView()\n"); + } + QString text() const { + return QString::fromLatin1(item._interfaceName().c_str()); + } +}; + +EnvironmentView::EnvironmentView( Container container, QWidget* parent, const char* name ) : Template_ArtsView( parent,name ), container(container) +{ + this->setCaption( i18n( "Environment" ) ); + this->setIcon( MainBarIcon( "artsenvironment", 32 ) ); + QVBoxLayout* _layout = new QVBoxLayout( this ); + _layout->setAutoAdd( true ); + defaultEnvFileName = DEFAULT_ENV_FILENAME; + defaultEnvFileName.replace('~', QDir::homeDirPath()); + listBox = new KListBox(this); + update(); + connect(listBox,SIGNAL(executed(QListBoxItem*)), + this,SLOT(view(QListBoxItem*))); + + QPushButton *mixerButton = new QPushButton(i18n("Add Mixer"), this); + connect(mixerButton, SIGNAL(clicked()), this, SLOT(addMixer())); + + QPushButton *effectRackButton = new QPushButton(i18n("Add Effect Rack"), this); + connect(effectRackButton, SIGNAL(clicked()), this, SLOT(addEffectRack())); + + QPushButton *delButton = new QPushButton(i18n("Delete Item"), this); + connect(delButton, SIGNAL(clicked()), this, SLOT(delItem())); + + QPushButton *loadButton = new + QPushButton(i18n("Load %1").arg(DEFAULT_ENV_FILENAME), this); + connect(loadButton, SIGNAL(clicked()), this, SLOT(load())); + + QPushButton *saveButton = new + QPushButton(i18n("Save %1").arg(DEFAULT_ENV_FILENAME), this); + connect(saveButton, SIGNAL(clicked()), this, SLOT(save())); + show(); +} + +void EnvironmentView::view(QListBoxItem *i) +{ + ItemView *iv = static_cast<ItemView*>(i); + + if(!iv->widget) + { + GenericGuiFactory gf; + Widget w = gf.createGui(iv->item); + if(!w.isNull()) + { + iv->widget = new KArtsWidget(w); + } + else + { + printf("no gui for %s\n",iv->text().ascii()); + } + } + if(iv->widget) + iv->widget->show(); +} + +void EnvironmentView::addMixer() +{ + container.createItem("Arts::Environment::MixerItem"); + update(); +} + +void EnvironmentView::addEffectRack() +{ + container.createItem("Arts::Environment::EffectRackItem"); + update(); +} + +void EnvironmentView::delItem() +{ + int i = listBox->currentItem(); + if(i < 0) return; /* nothing selected */ + + ItemView *iv = static_cast<ItemView*>(listBox->item(i)); + container.removeItem(iv->item); + update(); +} + +void EnvironmentView::update() +{ + listBox->clear(); + + std::vector<Item> *items = container.items(); + for(std::vector<Item>::iterator i = items->begin(); i != items->end(); i++) + (void)new ItemView(listBox, *i); + delete items; +} + +void EnvironmentView::load() +{ + std::ifstream infile(QFile::encodeName(defaultEnvFileName).data()); + std::string line; + std::vector<std::string> strseq; + + while(getline(infile,line)) + strseq.push_back(line); + + defaultEnvironment().loadFromList(strseq); +} + +void EnvironmentView::save() +{ + std::vector<std::string> *strseq; + strseq = defaultEnvironment().saveToList(); + + std::ofstream outfile(QFile::encodeName(defaultEnvFileName).data()); + for(std::vector<std::string>::iterator i = strseq->begin(); i != strseq->end(); i++) + outfile << ( *i ) << std::endl; + delete strseq; +} +#include "environmentview.moc" diff --git a/arts/tools/environmentview.h b/arts/tools/environmentview.h new file mode 100644 index 00000000..535fcc98 --- /dev/null +++ b/arts/tools/environmentview.h @@ -0,0 +1,57 @@ + /* + + Copyright (C) 2001 Stefan Westerfeld + <stefan@space.twc.de> + 2003 Matthias Kretz <kretz@kde.org> + 2003 Arnold Krille <arnold@arnoldarts.de + + 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 General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + */ + +#ifndef ARTS_ENVIRONMENT_VIEW_H +#define ARTS_ENVIRONMENT_VIEW_H + +#include "artsmodules.h" + +#include "templateview.h" + +class QListBoxItem; +class KListBox; + +class EnvironmentView : public Template_ArtsView { + Q_OBJECT +protected: + Arts::Environment::Container container; + KListBox *listBox; + QString defaultEnvFileName; + +public: + EnvironmentView( Arts::Environment::Container container, QWidget* =0, const char* =0 ); + +public slots: + void view(QListBoxItem *i); + void addMixer(); + void addEffectRack(); + void delItem(); + void update(); + void load(); + void save(); + +}; + +Arts::Environment::Container defaultEnvironment(); + +#endif /* ARTS_ENVIRONMENT_VIEW_H */ diff --git a/arts/tools/fftscopeview.cpp b/arts/tools/fftscopeview.cpp new file mode 100644 index 00000000..cb4c2acc --- /dev/null +++ b/arts/tools/fftscopeview.cpp @@ -0,0 +1,163 @@ +/* + + Copyright ( C ) 2000-2001 Stefan Westerfeld + <stefan@space.twc.de> + 2003 Arnold Krille <arnold@arnoldarts.de> + + 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 General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + */ + +#include "fftscopeview.h" + +#include <qlayout.h> +#include <qcursor.h> +#include <qtimer.h> +#include <kaction.h> +#include <kpopupmenu.h> +#include <kartswidget.h> +#include <kdebug.h> +#include <klocale.h> +#include <kiconloader.h> + +#include "artsactions.h" + +using namespace std; +using namespace Arts; + +FFTScopeView::FFTScopeView( SimpleSoundServer server, QWidget* parent ) + : Template_ArtsView( parent ) + , server( server ) + , scopeData( 0 ) +{ +kdDebug()<<k_funcinfo<<endl; + this->setCaption( i18n( "FFT Scope View" ) ); + this->setIcon( MainBarIcon( "artsfftscope", 32 ) ); + /* + create a stereo fft scope on the server and push it into the + effect chain + */ + { + scopefx = DynamicCast( server.createObject( "Arts::StereoFFTScope" ) ); + assert( !scopefx.isNull() ); + scopefx.start(); + + // put it into the effect chain + effectID = server.outstack().insertBottom( scopefx,"FFT Scope" ); + } + + updateScopeData(); + QBoxLayout * l = new QHBoxLayout( this ); + l->setAutoAdd( TRUE ); + + for ( unsigned int i=0;i<scopeData->size();i++ ) + { + LevelMeter tmp; + tmp.count( 20 ); + scopeScales.push_back( tmp ); + scopeDraw.push_back( 0.0 ); + KArtsWidget *w = new KArtsWidget( tmp, this ); + aw.push_back( w ); + } + + l->activate(); + show(); + + updatetimer = new QTimer( this ); + updatetimer->start( 100 ); + connect( updatetimer,SIGNAL( timeout() ),this,SLOT( updateScope() ) ); + + _artsactions = new ArtsActions( 0, 0, this ); + _moreBars = ArtsActions::actionMoreBars( this, SLOT( moreBars() ), 0 ); + _lessBars = ArtsActions::actionLessBars( this, SLOT( lessBars() ), 0 ); + _menu = new KPopupMenu( 0 ); + _moreBars->plug( _menu ); _lessBars->plug( _menu ); + _substyle = new KAction( i18n( "Substyle" ), "", KShortcut(), this, SLOT( substyle() ), this ); + _substyle->plug( _menu ); + _menu->insertItem( i18n("VU-Style"), _artsactions->stylemenu() ); + + connect( _artsactions, SIGNAL( styleNormal() ), this, SLOT( styleNormalBars() ) ); + connect( _artsactions, SIGNAL( styleFire() ), this, SLOT( styleFireBars() ) ); + connect( _artsactions, SIGNAL( styleLine() ), this, SLOT( styleLineBars() ) ); + connect( _artsactions, SIGNAL( styleLED() ), this, SLOT( styleLEDs() ) ); + connect( _artsactions, SIGNAL( styleAnalog() ), this, SLOT( styleAnalog() ) ); + connect( _artsactions, SIGNAL( styleSmall() ), this, SLOT( styleSmall() ) ); +} + +FFTScopeView::~FFTScopeView() { +kdDebug()<<"FFTScopeView::~FFTScopeView()"<<endl; + updatetimer->stop(); + for ( int i=int( aw.size() )-1; i>=0; i-- ) { scopeScales[ i ].hide(); delete aw[ i ]; aw.pop_back(); scopeScales.pop_back(); } + server.outstack().remove( effectID ); +kdDebug()<<"FFTScopeView is gone..."<<endl; +} + +void FFTScopeView::updateScopeData() { + if ( scopeData ) delete scopeData; + scopeData = scopefx.scope(); +} + +void FFTScopeView::updateScope() { + updateScopeData(); + + for ( unsigned int i=0;i<scopeData->size();i++ ) + { +// scopeDraw[ i ] /= 1.25; +// if ( ( *scopeData )[ i ] > scopeDraw[ i ] ) scopeDraw[ i ] = ( *scopeData )[ i ]; + scopeDraw[ i ] = ( *scopeData )[ i ]; + scopeScales[ i ].invalue( scopeDraw[ i ] ); + } +} + +void FFTScopeView::mousePressEvent( QMouseEvent* ev ) { + if ( Qt::RightButton == ev->button() /*|| Qt::LeftButton == ev->button()*/ ) + _menu->exec( QCursor::pos() ); +} + +void FFTScopeView::moreBars() { + int bars = scopeScales[ 0 ].count() + 10; + for ( unsigned int i=0;i<scopeData->size();i++ ) + scopeScales[ i ].count( bars ); +} + +void FFTScopeView::lessBars() { + int bars = scopeScales[ 0 ].count() - 10; + for ( unsigned int i=0;i<scopeData->size();i++ ) + scopeScales[ i ].count( bars ); +} + +void FFTScopeView::setStyle( Arts::LevelMeterStyle style ) { + for ( uint i=0; i<scopeScales.size(); i++ ) + scopeScales[ i ].style( style ); +} + +void FFTScopeView::styleNormalBars() { setStyle( Arts::lmNormalBars ); } +void FFTScopeView::styleFireBars() { setStyle( Arts::lmFireBars ); } +void FFTScopeView::styleLineBars() { setStyle( Arts::lmLineBars ); } +void FFTScopeView::styleLEDs() { setStyle( Arts::lmLEDs ); } +void FFTScopeView::styleAnalog() { setStyle( Arts::lmAnalog ); } +void FFTScopeView::styleSmall() { setStyle( Arts::lmSmall ); } + +#include <kinputdialog.h> + +void FFTScopeView::substyle() { + int _substyle = KInputDialog::getInteger( i18n("Substyle"), i18n("Please enter substyle:"), 0, 0, 10, 1, 0, this ); + for ( unsigned int i=0; i<scopeData->size(); i++ ) + scopeScales[ i ].substyle( _substyle ); +} + +#include "fftscopeview.moc" +// vim: sw=4 ts=4 + diff --git a/arts/tools/fftscopeview.h b/arts/tools/fftscopeview.h new file mode 100644 index 00000000..d01b6c3c --- /dev/null +++ b/arts/tools/fftscopeview.h @@ -0,0 +1,81 @@ +/* + + Copyright ( C ) 2000-2001 Stefan Westerfeld + <stefan@space.twc.de> + 2003 Arnold Krille <arnold@arnoldarts.de> + + 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 General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + */ + +#ifndef ARTSCONTROLLIB_FFTSCOPEVIEW_H +#define ARTSCONTROLLIB_FFTSCOPEVIEW_H + +#include <artsmodules.h> +#include <flowsystem.h> +#include <kartsserver.h> + +#include "templateview.h" + +#include <artsgui.h> +#include <kdelibs_export.h> + +class QTimer; +class KPopupMenu; +class KAction; +class KArtsWidget; +class ArtsActions; + +class KDE_EXPORT FFTScopeView : public Template_ArtsView { + Q_OBJECT +protected: + Arts::StereoFFTScope scopefx; + Arts::SimpleSoundServer server; + long effectID; + + std::vector<float> *scopeData; + std::vector<float> scopeDraw; + std::vector<Arts::LevelMeter> scopeScales; + std::vector<KArtsWidget*> aw; + QTimer *updatetimer; + + ArtsActions* _artsactions; + KPopupMenu *_menu, *_stylemenu; + KAction *_moreBars, *_lessBars; + KAction *_styleNormalBars, *_styleFireBars, *_styleLineBars, *_styleLEDs, *_styleAnalog, *_styleSmall; + KAction *_substyle; + + void mousePressEvent( QMouseEvent* ); +public: + void updateScopeData(); + FFTScopeView( Arts::SimpleSoundServer server, QWidget* =0 ); + ~FFTScopeView(); + +public slots: + void updateScope(); + void moreBars(); + void lessBars(); + void setStyle( Arts::LevelMeterStyle style ); + void styleNormalBars(); + void styleFireBars(); + void styleLineBars(); + void styleLEDs(); + void styleAnalog(); + void styleSmall(); + void substyle(); +}; + +// vim: sw=4 ts=4 +#endif diff --git a/arts/tools/levelmeters.cpp b/arts/tools/levelmeters.cpp new file mode 100644 index 00000000..3b2ca1ac --- /dev/null +++ b/arts/tools/levelmeters.cpp @@ -0,0 +1,239 @@ +#include <qlayout.h> +#include <qpainter.h> +#include <qfontmetrics.h> +#include <qptrlist.h> +#include <kled.h> +#include "levelmeters.h" + +const int PeakBar::peakMillis=1500; + +PeakBar::PeakBar(QWidget *parent) + : ACLevelMeter(parent) + , maxValue( 0.0f ) + , minValue( 0.0f ) +{ + clipped = false; + displayMinPeak= false; + horizontalMode= false; + currentValue= 0.0f; + + lastValues.setAutoDelete( TRUE ); + + setFrameStyle(QFrame::StyledPanel | QFrame::Sunken); + setSizePolicy(QSizePolicy(QSizePolicy::Maximum, QSizePolicy::Preferred)); + setBackgroundMode(NoBackground); + setMinimumSize(frameWidth()+7, 70); +} + +void PeakBar::frameChanged() { + setMinimumSize(frameWidth()+7, 70); + QFrame::frameChanged(); +} + +QSize PeakBar::sizeHint() const { + return QSize(13, 250); +} + +void PeakBar::checkMinMax() { + int mustRecheck= 0; // bool + Observation *o; + + while ((o= lastValues.first()) && o->time.elapsed() > peakMillis) { + lastValues.removeFirst(); + mustRecheck= 1; + } + + if (mustRecheck) { + maxValue= 0.f; + minValue= 1.f; + clipped = false; + for (QPtrListIterator<Observation> it(lastValues); it.current(); ++it) { + float value= it.current()->value; + if (value>maxValue) + maxValue= value; + if (value<minValue) + minValue= value; + if (value > 1.f) + clipped = true; + } + } +} + +void PeakBar::drawContents(QPainter *p) +{ + QRect size= contentsRect(); + + checkMinMax(); + + p->setBrush(clipped ? darkRed : darkBlue); + p->setPen(NoPen); + p->drawRect(size); + + QRect bar= size; + p->setBrush(clipped ? red : blue); + if (horizontalMode) { + bar.setWidth((int)(bar.width()*currentValue)); + } else { + int newHeight= (int)(bar.height()*currentValue); + bar.moveBy(0, bar.height()-newHeight); + bar.setHeight(newHeight); + } + p->drawRect(bar); + + int y; + // TODO: if (horizontalMode) + if (displayMinPeak) { + y= frameWidth()+size.height()-((int)(size.height()*minValue)); + p->setPen(white); + p->drawLine(frameWidth(), y, frameWidth()+size.width()-1, y); + } + y= frameWidth()+size.height()-((int)(size.height()*maxValue)); + p->setPen(white); + p->drawLine(frameWidth(), y, frameWidth()+size.width()-1, y); +} + +void PeakBar::setValue(float f) { + if (f > 1.f) + clipped = true; + + currentValue= f; + if (f>=maxValue) + maxValue= f; + if (displayMinPeak && (f<=minValue)) + minValue= f; + + lastValues.append(new Observation(f)); + + repaint(); +} + +// ------------------------------------------------------------- + +PeakLevelMeters::PeakLevelMeters(QWidget *parent): + StereoLevelMeter(parent), left(this), right(this), scaleView(this) +{ + QBoxLayout *layout= new QHBoxLayout(this); + layout->addWidget(&left); + // layout->setStretchFactor(&left, 0); + layout->addWidget(&right); + // layout->setStretchFactor(&right, 0); + layout->addWidget(&scaleView); + // layout->setStretchFactor(&scaleView, 0); + left.setLineWidth(2); + right.setLineWidth(2); + scaleView.setScaleMargins(right.frameWidth()); + setSizePolicy(QSizePolicy(QSizePolicy::Maximum, QSizePolicy::Preferred)); + + setDbRange(36); +} + +void PeakLevelMeters::setDbRange(int db) { + dbRange= db; + scaleView.setDbRange(db); +} + +void PeakLevelMeters::setValues(float leftVal, float rightVal) { + float f= 1.0f+levelToDB(leftVal)/dbRange; + if (f<0.f) f= 0.f; + left.setValue(f); + + f= 1.0f+levelToDB(rightVal)/dbRange; + if (f<0.f) f= 0.f; + right.setValue(f); +} + +ScaleView::ScaleView(QWidget *parent): QFrame(parent) { + font.setPixelSize(10); + setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Preferred)); +} + +void ScaleView::setDbRange(int db) { + dbRange= db; + repaint(); +} + +QSize ScaleView::sizeHint() const { + return QSize(QFontMetrics(font).width("-88")+8, 250); +} + +void ScaleView::drawContents(QPainter *p) { + QRect size= contentsRect(); + size.rTop()+= upperMargin; + size.rBottom()-= lowerMargin; + + QFrame::drawContents(p); // clear background + + int step=3; + while (dbRange/step*20>size.height()) + step*=2; + + /* float offset= ((float)size.height()*step)/dbRange, pos=0.f; + p->setPen(black); + p->drawLine(0, (, size.width()*3/5, y);*/ + + p->setPen(black); + p->setFont(font); + QString numStr; + for (int i=0; i<=dbRange; i++) { + int y= size.top()+(size.height()-1)*i/dbRange; + if (i%step==0) { + p->drawLine(0, y, 4, y); + numStr.setNum(-i); + p->drawText(8, y+5, numStr); + } else + p->drawLine(0, y, 2, y); + } +} + +// ------------------------------------------------------------- + +LedMeter::LedMeter(QWidget *parent, bool blueState) : ACLevelMeter(parent) { + setBackgroundColor(black); + QBoxLayout * l = new QVBoxLayout( this ); + l->setAutoAdd(TRUE); + for(int i=0;i<12;i++) { + QColor c; + if(blueState) + c = blue; + else { + c = red; + if(i>=2) c = yellow; + if(i>=5) c = green; + } + + // put each led in its own frame, since it seems to be broken + QFrame *lframe = new QFrame(this); + QBoxLayout *lfl = new QVBoxLayout( lframe ); + lfl->setAutoAdd(TRUE); + leds[i] = + new KLed(c,KLed::Off, KLed::Sunken, KLed::Circular,lframe); + } +} + +void LedMeter::setValue(float f) +{ + //printf("value %f\n",f); + for(int i=11;i>=0;i--) + { + if(f > 0.06) leds[i]->setState(KLed::On); + else leds[i]->setState(KLed::Off); + f /= 1.25; + } +} + +// ------------------------------------------------------------- + +StereoLedMeters::StereoLedMeters(QWidget *parent) + : StereoLevelMeter(parent), left(this), right(this) +{ + QBoxLayout *layout= new QHBoxLayout(this); + layout->addWidget(&left); + layout->addWidget(&right); +} + +void StereoLedMeters::setValues(float leftVal, float rightVal) { + left.setValue(leftVal); + right.setValue(rightVal); +} + +#include "levelmeters.moc" diff --git a/arts/tools/levelmeters.h b/arts/tools/levelmeters.h new file mode 100644 index 00000000..42ef0fae --- /dev/null +++ b/arts/tools/levelmeters.h @@ -0,0 +1,168 @@ + /* + + Copyright (C) 2000 Hans Meine + <hans_meine@gmx.net> + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; 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 General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + */ + +#ifndef ARTS_TOOLS_LEVELMETERS_H +#define ARTS_TOOLS_LEVELMETERS_H + +#include <qobject.h> +#include <qframe.h> +#include <qdatetime.h> +#include <qptrlist.h> +#include <math.h> + +// helper functions +const float LEVEL_MIN= 1.f/(1<<20); // minimal positive sample for 20 bit resolution +inline float levelToDB(float level) { + if (level<LEVEL_MIN) level=LEVEL_MIN; // prevent from div by 0 + return (6.f/log(2.f))*log(level); +} + +inline float DBToLevel(float db) { + return exp(db/(log(2.f)/6.f)); +} + +/** + * Base class for a single volume / value bar. + */ +class ACLevelMeter : public QFrame { + Q_OBJECT +public: + ACLevelMeter(QWidget *parent): QFrame(parent) {} +public slots: + virtual void setValue(float f) = 0; +}; + +/** + * Base class for a pair of volume / value bars. + */ +class StereoLevelMeter : public QFrame { + Q_OBJECT +public: + StereoLevelMeter(QWidget *parent): QFrame(parent) {} +public slots: + virtual void setValues(float left, float right) = 0; +}; + +/** + * Special LevelMeter which remembers min and max of the last [peakMillis] + * milliseconds and displays a full bar with optional max/min markers. + */ +class PeakBar : public ACLevelMeter { + Q_OBJECT + bool clipped; + +protected: + static const int peakMillis; // how long do the peaks stay at their max? + + class Observation { + public: + QTime time; + float value; + Observation(float aValue): value(aValue) { time.start(); } + }; + QPtrList<Observation> lastValues; + + float currentValue, maxValue, minValue; + void checkMinMax(); + + bool displayMinPeak; + bool horizontalMode; + + void frameChanged(); + +public: + PeakBar(QWidget *parent); + + QSize sizeHint() const; + + void drawContents(QPainter *p); + virtual void setValue(float f); +}; + +/** + * Special class which draws the Db scale with ticks, numbers and so on. + */ +class ScaleView : public QFrame { + Q_OBJECT +protected: + QFont font; + int dbRange; + int upperMargin, lowerMargin; +public: + ScaleView(QWidget *parent); + void setDbRange(int db); + void setScaleMargins(int margins) { upperMargin= margins; lowerMargin=margins; } + QSize sizeHint() const; + void drawContents(QPainter *p); +}; + +/** + * Reusable class which displays two volume bars (left/right) with a Db scale + * and clip indicators. Supports / will have a context menu with some display + * options like Db range, whether minimal values are also shown and others. + */ +class PeakLevelMeters : public StereoLevelMeter { + Q_OBJECT +protected: + int dbRange; + PeakBar left, right; + ScaleView scaleView; + +public: + PeakLevelMeters(QWidget *parent); + +public slots: + void setValues(float leftVal, float rightVal); + void setDbRange(int db); +}; + +class KLed; + +/** + * Simple LevelMeter implementation with 12 KLeds. + * Shows them in green/yellow/red combi if not blueState set, in which + * case it's all blue. (Original artscontrol widget by stw.) + */ +class LedMeter : public ACLevelMeter { + Q_OBJECT +protected: + KLed *leds[12]; + +public: + LedMeter(QWidget *parent, bool blueState = false); + void setValue(float f); +}; + +/** + * A simple pair of LedMeters. + */ +class StereoLedMeters : public StereoLevelMeter { + Q_OBJECT +protected: + LedMeter left, right; + +public: + StereoLedMeters(QWidget *parent); +public slots: + void setValues(float left, float right); +}; + +#endif /* ARTS_TOOLS_LEVELMETERS_H */ diff --git a/arts/tools/main.cpp b/arts/tools/main.cpp new file mode 100644 index 00000000..5961dfcd --- /dev/null +++ b/arts/tools/main.cpp @@ -0,0 +1,211 @@ +/* + + Copyright (C) 2000-2001 Stefan Westerfeld + <stefan@space.twc.de> + 2003 Arnold Krille <arnold@arnoldarts.de> + + 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 General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + */ + +#include "main.h" +#include "environmentview.h" +#include "main.moc" +#include "levelmeters.h" +#include "midimanagerview.h" +#include "audiomanager.h" +#include "fftscopeview.h" +#include "mediatypesview.h" +#include "statusview.h" + +#include <objectmanager.h> +#include <debug.h> +#include <artsversion.h> +#include <kartsfloatwatch.h> + +#include <qlabel.h> +#include <qslider.h> +#include <qpushbutton.h> +#include <kaction.h> +#include <kled.h> +#include <kmessagebox.h> +#include <kdebug.h> +#include <kartsserver.h> + +#include <kstdaction.h> + +#include "kartswidget.h" + +using namespace std; +using namespace Arts; + +void FreeVerbView::closeEvent(QCloseEvent *e) { + e->accept(); + emit closed(); +} + +FreeVerbView::FreeVerbView(SimpleSoundServer server) : server(server) { + freeverb = DynamicCast(server.createObject("Arts::Synth_FREEVERB")); + arts_assert(!freeverb.isNull()); + freeverb.start(); + + // put it into the effect chain + effectID = server.outstack().insertTop(freeverb,"FreeVerb"); + + GenericGuiFactory factory; + Widget gui = factory.createGui(freeverb); + + QBoxLayout * l = new QHBoxLayout( this ); + if(!gui.isNull()) + l->add(new KArtsWidget(gui, this)); + else + l->add(new QLabel(i18n("No GUI found for this effect."), this)); + l->freeze(); + show(); +} + +FreeVerbView::~FreeVerbView() { + // remove effect + server.outstack().remove(effectID); +} + + +VControl::VControl( KArtsServer* artsserver, QWidget *parent) : QFrame(parent) + , freeVerbView(0) + , server( artsserver ) +{ + + connect( server, SIGNAL( restartedServer() ), this, SLOT( initaRtsConnections() ) ); +/* if(server.isNull()) + { + KMessageBox::error( 0, i18n("Connection to the soundserver failed - make sure that artsd is really running and that your kdelibs version is not older than kdemultimedia.")); + exit(1); + }*/ + boxLayout = new QHBoxLayout( this ); + + // 0 => 4.0 + // 200 => 2.0 + // 400 => 1.0 + // 600 => 0.5 + // 800 => 0.25 + // 1000 => 0.125 + // 1200 => 0.0 (forced) + + svcguiw = new KArtsWidget( this ); + boxLayout->addWidget( svcguiw ); + + boxLayout->activate(); + show(); + + initaRtsConnections(); +} +VControl::~VControl() { + if ( freeVerbView ) showFreeVerbView(); +} + +void VControl::useOldVolumeBar(int old) { +/* delete stereoMeter; + if (old) { + stereoMeter= new StereoLedMeters(this); + } else { + stereoMeter= new PeakLevelMeters(this); + } + boxLayout->insertWidget(0, stereoMeter); + stereoMeter->show();*/ + if ( old ) { + svcgui.left().substyle( 3 ); + svcgui.right().substyle( 3 ); + } else { + svcgui.left().substyle( 2 ); + svcgui.right().substyle( 2 ); + } +} + +void VControl::showFreeVerbView() { + if(!freeVerbView) { + freeVerbView = new FreeVerbView(server->server()); + connect(freeVerbView,SIGNAL(closed()),this,SLOT(showFreeVerbView())); + } else { + delete freeVerbView; + freeVerbView = 0; + } +} + +void VControl::initaRtsConnections() { +kdDebug() << k_funcinfo << endl; + svcgui = Arts::StereoVolumeControlGui::null(); + svcgui = Arts::StereoVolumeControlGui( server->server().outVolume() ); + svcgui.title( i18n( "aRts Master Volume" ).utf8().data() ); + svcguiw->setContent( Arts::Widget() ); + svcguiw->setContent( svcgui ); + useOldVolumeBar( false ); +kdDebug() << k_funcinfo << "done." << endl; +} + +void MainWindow::toggleVolumeBar() { + vc->useOldVolumeBar(showOldVolumeDisplay->isChecked()); +} + +MainWindow::MainWindow() : KMainWindow(0), kartsserver( new KArtsServer( this ) ) { +kdDebug() << k_funcinfo << endl; + connect( kartsserver, SIGNAL( restartedServer() ), this, SLOT( serverRestarted() ) ); + + vc = new VControl( kartsserver, this ); + setCentralWidget( vc ); + artsactions = new ArtsActions( kartsserver, actionCollection(), this ); + + ( void ) artsactions->actionScopeView(); + ( void ) artsactions->actionAudioManager(); + ( void ) artsactions->actionArtsStatusView(); + ( void ) artsactions->actionMidiManagerView(); + ( void ) artsactions->actionEnvironmentView(); + ( void ) artsactions->actionMediaTypesView(); + ( void ) new KAction( i18n("Toggle Free&Verb"), 0, vc, SLOT( showFreeVerbView() ), actionCollection(), "view_freeverb" ); + showOldVolumeDisplay= + new KToggleAction( i18n( "Old aRts-Control-Style for VU-Meter" /*"&LED-Style Volume Display"*/ ), 0, this, + SLOT( toggleVolumeBar() ), actionCollection(), "old_volume_display" ); + ( void ) KStdAction::quit( this, SLOT( close() ), actionCollection(), "quit_artscontrol" ); + + createGUI("artscontrol.rc"); + resize(20,300); + show(); +} + +void MainWindow::serverRestarted() { +kdDebug() << k_funcinfo << endl; + KMessageBox::sorry( this, "aRts had to restart!" ); +} + +int main(int argc, char **argv) { + KAboutData aboutData( "artscontrol", I18N_NOOP("aRts control"), + ARTS_VERSION, I18N_NOOP("Control tool for the aRts server"), + KAboutData::License_GPL, I18N_NOOP("(c) 2000 Stefan Westerfeld\n(c) 2003 Arnold Krille") ); + aboutData.addAuthor( "Stefan Westerfeld", I18N_NOOP( "Author and aRts maintainer" ), "stefan@space.twc.de" ); + aboutData.addAuthor( "Arnold Krille", I18N_NOOP( "Some improvements" ), "arnold@arnoldarts.de" ); + + KCmdLineArgs::init( argc, argv, &aboutData ); + + KApplication app(argc, argv); + + // setup mcop communication + QIOManager qiomanager; + Dispatcher dispatcher(&qiomanager); + + ObjectManager::the()->provideCapability("kdegui"); + + app.setMainWidget(new MainWindow); + app.setName("artsbuilder"); + return app.exec(); +} diff --git a/arts/tools/main.h b/arts/tools/main.h new file mode 100644 index 00000000..818e3e89 --- /dev/null +++ b/arts/tools/main.h @@ -0,0 +1,110 @@ +/* + + Copyright (C) 2000-2001 Stefan Westerfeld + <stefan@space.twc.de> + 2003 Arnold Krille <arnold@arnoldarts.de + + 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 General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + */ + +#ifndef MAIN_H +#define MAIN_H +#include <qiomanager.h> +#include <dispatcher.h> +#include <qmessagebox.h> +#include <kapplication.h> +#include <qframe.h> +#include <kmainwindow.h> +#include <kcmdlineargs.h> +#include <kaboutdata.h> +#include <klocale.h> +#include <kstdaction.h> +#include <qlayout.h> +#include <qpushbutton.h> +#include <artsflow.h> +#include <soundserver.h> +#include <qobject.h> +#include <kartswidget.h> +#include <flowsystem.h> +#include <artsmodules.h> +#include <kartsserver.h> + +class LevelMeter; +class PeakBar; +class PeakLevelMeter; +class VScale; + +class FreeVerbView : public QWidget { + Q_OBJECT +protected: + Arts::Synth_FREEVERB freeverb; + Arts::SimpleSoundServer server; + long effectID; + + void closeEvent(QCloseEvent *e); +public: + FreeVerbView(Arts::SimpleSoundServer server); + ~FreeVerbView(); +signals: + void closed(); +}; + +class KArtsWidget; + +class VControl : public QFrame { + Q_OBJECT +protected: + class StereoLevelMeter *stereoMeter; + FreeVerbView *freeVerbView; + Arts::StereoVolumeControl svc; + Arts::StereoVolumeControlGui svcgui; + KArtsWidget *svcguiw; + KArtsServer *server; + + QBoxLayout *boxLayout; + +public: + VControl( KArtsServer*, QWidget *parent); + ~VControl(); + +public slots: + void useOldVolumeBar(int old); + void showFreeVerbView(); +private slots: + void initaRtsConnections(); +}; + +#include "artsactions.h" + +class MainWindow : public KMainWindow { + Q_OBJECT +protected: + VControl *vc; + KToggleAction *showOldVolumeDisplay; + ArtsActions* artsactions; + KArtsServer *kartsserver; + +public slots: + void toggleVolumeBar(); + + void serverRestarted(); +public: + MainWindow(); +}; + +//Arts::Environment::Container defaultEnvironment(); + +#endif /* MAIN_H */ diff --git a/arts/tools/mediatypesview.cpp b/arts/tools/mediatypesview.cpp new file mode 100644 index 00000000..b54d2dd1 --- /dev/null +++ b/arts/tools/mediatypesview.cpp @@ -0,0 +1,76 @@ +/* + + Copyright (C) 2000-2001 Stefan Westerfeld + <stefan@space.twc.de> + 2003 Arnold Krille + <arnold@arnoldarts.de> + + 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 General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + */ + +#include <qlayout.h> +#include <klistview.h> +#include <klocale.h> +#include <kartsserver.h> +#include <map> +#include <kiconloader.h> + +#include "mediatypesview.h" + +using namespace std; +using namespace Arts; + +MediaTypesView::MediaTypesView( QWidget* parent, const char* name ) : Template_ArtsView( parent,name ) +{ + this->setCaption( i18n( "Available Media Types" ) ); + this->setIcon( MainBarIcon( "artsmediatypes", 32 ) ); + QBoxLayout *l= new QHBoxLayout(this); + l->setAutoAdd(true); + + KListView *listView = new KListView(this); + listView->addColumn(i18n("Media Type")); + + Arts::TraderQuery q; + std::vector<Arts::TraderOffer> *results = q.query(); + std::map<std::string, bool> done; + QString str; + + for(std::vector<Arts::TraderOffer>::iterator i = results->begin(); i != results->end(); i++) + { + std::vector<string> *ext = (*i).getProperty("Extension"); + + for(vector<string>::iterator it = ext->begin(); it != ext->end(); it++) + { + if(!(*it).length() || done[*it]) + continue; + + done[*it] = true; + (void) new QListViewItem(listView, (*it).c_str()); + } + delete ext; + } + delete results; + + l->activate(); + show(); + setBaseSize(300,200); +} + +MediaTypesView::~MediaTypesView() +{ +} + +#include "mediatypesview.moc" diff --git a/arts/tools/mediatypesview.h b/arts/tools/mediatypesview.h new file mode 100644 index 00000000..a55e44a3 --- /dev/null +++ b/arts/tools/mediatypesview.h @@ -0,0 +1,36 @@ +/* + + Copyright (C) 2000-2001 Stefan Westerfeld + <stefan@space.twc.de> + 2003 Arnold Krille + <arnold@arnoldarts.de> + + 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 General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + */ + +#ifndef MEDIATYPESVIEW_H +#define MEDIATYPESVIEW_H + +#include "templateview.h" + +class MediaTypesView : public Template_ArtsView { + Q_OBJECT +public: + MediaTypesView( QWidget* =0, const char* =0 ); + ~MediaTypesView(); +}; + +#endif diff --git a/arts/tools/midiinstdlg.cpp b/arts/tools/midiinstdlg.cpp new file mode 100644 index 00000000..ef98f299 --- /dev/null +++ b/arts/tools/midiinstdlg.cpp @@ -0,0 +1,179 @@ +/* + + Copyright (C) 1998 Stefan Westerfeld + stefan@space.twc.de + + 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 General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + */ + +#include "midiinstdlg.h" +#include <klocale.h> +#include <kstandarddirs.h> + +#include <kapplication.h> +#include <qlayout.h> +#include <qlabel.h> +#include <qfile.h> +#include <qdir.h> +#include <kbuttonbox.h> +#include <kseparator.h> +#include <kdebug.h> +#include <qbutton.h> +#include <qpushbutton.h> +#include <kstdguiitem.h> + +static QStringList getArtsPath() +{ + QStringList artsPath; + QString dir = locate("data", "artsbuilder/examples/"); + artsPath += dir; + QString home = QDir::homeDirPath() + "/arts/structures/"; + artsPath += home; + return artsPath; +} + +static QStringList listFiles(QString directory, QString extension) +{ + QStringList result; + QStringList artsPath = getArtsPath(); + + QStringList::Iterator it; + for ( it = artsPath.begin(); it != artsPath.end(); it++ ) { + QString pathname = *it + "/" + directory; + QDir dir(pathname, extension); + if (dir.exists()) { + //kdDebug() << "found dir " << dir.absPath() << endl; + result += dir.entryList(); + } + } + + return result; +} + +MidiInstDlg::MidiInstDlg(QWidget *parent) + :QDialog(parent,"instrument",TRUE) +{ + QVBoxLayout *mainlayout = new QVBoxLayout(this); + +// caption label: title + + mainlayout->addSpacing(5); + QLabel *captionlabel = new QLabel(this); + QFont labelfont(captionlabel->font()); + labelfont.setPointSize(labelfont.pointSize()*3/2); + captionlabel->setFont(labelfont); + captionlabel->setText(QString(" ")+i18n("Instrument")+QString(" ")); + captionlabel->setAlignment(AlignCenter); + //min_size(captionlabel); + mainlayout->addWidget(captionlabel); + +// hruler + + mainlayout->addSpacing(5); + KSeparator *ruler2 = new KSeparator( KSeparator::HLine, this); + mainlayout->addWidget(ruler2); + mainlayout->addSpacing(5); + +// combobox + + box = new QComboBox(this); + + QStringList instruments = listFiles(".","*.arts"); + QStringList::Iterator it; + for ( it = instruments.begin(); it != instruments.end(); it++ ) { + QString modname = *it; + QString prefix = QString::fromLatin1("instrument_"); + if (modname.length() > 5) + modname.truncate(modname.length()-5); // kill .arts extension + if ( (modname.startsWith(prefix)) && (!modname.contains("_GUI")) ) + box->insertItem(modname.mid(prefix.length())); + //kdDebug() << "inserted instrument: " << modname.mid(prefix.length()) << endl; + } + + + QStringList maps = listFiles(".","*.arts-map"); + + for ( it = maps.begin(); it != maps.end(); it++ ) { + QString modname = *it; + QString prefix = QString::fromLatin1("instrument_"); + if (modname.length() > 9) + modname.truncate(modname.length()-9); // kill .arts-map extension + if (modname.startsWith(prefix)) + box->insertItem(modname.mid(prefix.length())); + //kdDebug() << "inserted map: " << modname.mid(prefix.length()) << endl; + } + + mainlayout->addWidget(box); + +// hruler + + mainlayout->addSpacing(5); + KSeparator *ruler = new KSeparator( KSeparator::HLine, this); + mainlayout->addWidget(ruler); + mainlayout->addSpacing(5); + +// buttons + + QHBoxLayout *buttonlayout = new QHBoxLayout; + mainlayout->addSpacing(5); + mainlayout->addLayout(buttonlayout); + mainlayout->addSpacing(5); + + buttonlayout->addSpacing(5); + KButtonBox *bbox = new KButtonBox(this); + + bbox->addButton(KStdGuiItem::help(), this, SLOT( help() )); + bbox->addStretch(1); + + QButton *okbutton = bbox->addButton(KStdGuiItem::ok()); + connect( okbutton, SIGNAL( clicked() ), SLOT(accept() ) ); + + bbox->layout(); + + buttonlayout->addWidget(bbox); + buttonlayout->addSpacing(5); + + mainlayout->freeze(); +} + +QCString MidiInstDlg::filename() +{ + QStringList artsPath = getArtsPath(); + QString instrument = box->currentText(); + + QStringList::Iterator it; + + for ( it = artsPath.begin(); it != artsPath.end(); it++ ) { + QString pathname = *it + QString::fromLatin1("/instrument_") + instrument + QString::fromLatin1(".arts"); + QFileInfo fi(pathname); + if (fi.exists() && fi.isReadable()) + return QFile::encodeName(pathname); + + pathname = *it + QString::fromLatin1("/instrument_") + instrument + QString::fromLatin1(".arts-map"); + fi.setFile(pathname); + if (fi.exists() && fi.isReadable()) + return QFile::encodeName(pathname); + } + + return ""; +} + +void MidiInstDlg::help() +{ + KApplication::kApplication()->invokeHelp("", "artsbuilder"); +} + +#include "midiinstdlg.moc" diff --git a/arts/tools/midiinstdlg.h b/arts/tools/midiinstdlg.h new file mode 100644 index 00000000..95d7b677 --- /dev/null +++ b/arts/tools/midiinstdlg.h @@ -0,0 +1,38 @@ +/* + + Copyright (C) 1998 Stefan Westerfeld + stefan@space.twc.de + + 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 General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + */ + +#ifndef ARTS_TOOLS_MIDIINSTDLG_H +#define ARTS_TOOLS_MIDIINSTDLG_H + +#include <qdialog.h> +#include <qcombobox.h> +#include <qcstring.h> + +class MidiInstDlg :public QDialog { + Q_OBJECT + QComboBox *box; +public: + MidiInstDlg(QWidget *parent); + QCString filename(); +public slots: + void help(); +}; +#endif diff --git a/arts/tools/midimanagerdlg.ui b/arts/tools/midimanagerdlg.ui new file mode 100644 index 00000000..78941e4c --- /dev/null +++ b/arts/tools/midimanagerdlg.ui @@ -0,0 +1,151 @@ +<!DOCTYPE UI><UI version="3.0" stdsetdef="1"> +<class>MidiManagerDlg</class> +<widget class="QDialog"> + <property name="name"> + <cstring>MidiManagerDlg</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>462</width> + <height>266</height> + </rect> + </property> + <property name="caption"> + <string>MIDI Manager</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>11</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <widget class="QLabel" row="0" column="0"> + <property name="name"> + <cstring>TextLabel1</cstring> + </property> + <property name="text"> + <string>MIDI inputs:</string> + </property> + </widget> + <widget class="QLabel" row="0" column="2"> + <property name="name"> + <cstring>TextLabel1_2</cstring> + </property> + <property name="text"> + <string>MIDI outputs:</string> + </property> + </widget> + <widget class="QListBox" row="1" column="0"> + <property name="name"> + <cstring>inputsListBox</cstring> + </property> + </widget> + <widget class="QListBox" row="1" column="2"> + <property name="name"> + <cstring>outputsListBox</cstring> + </property> + </widget> + <widget class="QFrame" row="2" column="0" rowspan="1" colspan="3"> + <property name="name"> + <cstring>Frame5</cstring> + </property> + <property name="frameShape"> + <enum>StyledPanel</enum> + </property> + <property name="frameShadow"> + <enum>Raised</enum> + </property> + <property name="lineWidth"> + <number>0</number> + </property> + <property name="layoutMargin" stdset="0"> + </property> + <property name="layoutSpacing" stdset="0"> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <widget class="QPushButton" row="0" column="0"> + <property name="name"> + <cstring>AddButton_2</cstring> + </property> + <property name="text"> + <string>&Add...</string> + </property> + </widget> + <widget class="QPushButton" row="0" column="1"> + <property name="name"> + <cstring>RemoveButton_2</cstring> + </property> + <property name="text"> + <string>&Remove</string> + </property> + </widget> + <widget class="QPushButton" row="0" column="2"> + <property name="name"> + <cstring>connectButton</cstring> + </property> + <property name="text"> + <string>&Connect</string> + </property> + </widget> + <widget class="QPushButton" row="0" column="3"> + <property name="name"> + <cstring>disconnectButton</cstring> + </property> + <property name="text"> + <string>&Disconnect</string> + </property> + </widget> + </grid> + </widget> + <widget class="QFrame" row="1" column="1"> + <property name="name"> + <cstring>connectionFrame</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="frameShape"> + <enum>StyledPanel</enum> + </property> + <property name="frameShadow"> + <enum>Raised</enum> + </property> + <property name="lineWidth"> + <number>0</number> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + </grid> + </widget> + </grid> +</widget> +<layoutdefaults spacing="6" margin="11"/> +</UI> diff --git a/arts/tools/midimanagerview.cpp b/arts/tools/midimanagerview.cpp new file mode 100644 index 00000000..764f4ee5 --- /dev/null +++ b/arts/tools/midimanagerview.cpp @@ -0,0 +1,260 @@ +/* + + Copyright (C) 2000 Stefan Westerfeld + stefan@space.twc.de + + 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 General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + Permission is also granted to link this program with the Qt + library, treating Qt like a library that normally accompanies the + operating system kernel, whether or not that is in fact the case. + + */ + +#include "midimanagerview.h" +#define protected public +#include "midimanagerwidget.h" +#undef protected +#include <qpushbutton.h> +#include <qlistbox.h> +#include <qlayout.h> +#include <qpainter.h> +#include <stdio.h> +#include <kaction.h> +#include <klocale.h> +#include <kiconloader.h> +#include <soundserver.h> +#include "artsmidi.h" +#include "artsmodules.h" +#include "midiportdlg.h" +#include "midiinstdlg.h" + +#include <kstdaction.h> + +using namespace Arts; +using namespace std; + +/* quick hack as long as the sound server doesn't support environments */ +Arts::Environment::Container defaultEnvironment() +{ + Arts::SimpleSoundServer server = Reference("global:Arts_SimpleSoundServer"); + Arts::Environment::Container d = + Arts::DynamicCast(server._getChild("defaultEnvironment")); + + if(d.isNull()) + { + d = Arts::DynamicCast( + server.createObject("Arts::Environment::Container")); + server._addChild(d,"defaultEnvironment"); + } + return d; +} + +class MidiManagerItem : public QListBoxText { +public: + MidiClientInfo info; + + MidiManagerItem(const MidiClientInfo &info) :info(info) + { + } + QString text () const { + return QString::fromUtf8(info.title.c_str()); + } + +}; + +class ConnectionWidget : public QWidget { +public: + MidiManagerView *v; + ConnectionWidget(MidiManagerView *v, QWidget *parent) : QWidget(parent), v(v) + { + } + void paintEvent(QPaintEvent * /*event*/) + { + QPainter painter; + painter.begin(this); +// painter.fillRect(event->rect(),white); + + unsigned int in; + for(in = 0; in < v->widget->inputsListBox->count(); in++) + { + vector<long>::iterator conn; + MidiManagerItem *item = (MidiManagerItem *)v->widget->inputsListBox->item(in); + for(conn = item->info.connections.begin(); + conn != item->info.connections.end(); conn++) + { + MidiManagerItem *outitem = v->itemMap[*conn]; + QRect r1 = v->widget->inputsListBox->itemRect(item); + QRect r2 = v->widget->outputsListBox->itemRect(outitem); + + if(r1.height() > 0 && r2.height() > 0) + { + painter.drawLine(0,(r1.top()+r1.bottom()) / 2, + width(), (r2.top()+r2.bottom())/2); + } + } + } + painter.end(); + } +}; + +MidiManagerView::MidiManagerView() + : manager(Reference("global:Arts_MidiManager")) +{ + QTimer *updatetimer = new QTimer(this); + updatetimer->start(5000); + connect(updatetimer,SIGNAL(timeout()),this,SLOT(updateLists())); + + widget = new MidiManagerWidget(this); + setCentralWidget(widget); + setCaption(i18n("MIDI Manager")); + setIcon( MainBarIcon( "artsfftscope", 32 ) ); + + (void)new KAction(i18n("&System MIDI Port (OSS)"), 0, this, SLOT(addOSSMidiPort()), + actionCollection(), "add_oss_midi_port"); + (void)new KAction(i18n("&aRts Synthesis MIDI Output"), 0, this, + SLOT(addArtsMidiOutput()), actionCollection(), "add_arts_midi_output"); + + (void) KStdAction::quit( this, SLOT(close()), actionCollection()); + connect(widget->connectButton,SIGNAL(clicked()), this, SLOT(slotConnect())); + connect(widget->disconnectButton,SIGNAL(clicked()), this, SLOT(slotDisconnect())); + + connectionWidget = new ConnectionWidget(this, widget->connectionFrame); + connectionWidget->setMinimumSize(60,10); + widget->connectionFrameLayout->addWidget( connectionWidget, 0, 0 ); + + updateLists(); + createGUI( "artsmidimanagerview.rc"); + show(); + setCaption(i18n("MIDI Manager")); + setIcon( MainBarIcon( "artsfftscope", 32 ) ); +} + +void MidiManagerView::closeEvent(QCloseEvent *e) +{ + e->accept(); + emit closed(); +} + +void MidiManagerView::updateLists() +{ + vector<MidiClientInfo> *clients = manager.clients(); + vector<MidiClientInfo>::iterator i; + +// keep selection over updating + MidiManagerItem *src = + (MidiManagerItem *)widget->inputsListBox->item(widget->inputsListBox->currentItem()); + MidiManagerItem *dest = + (MidiManagerItem *)widget->outputsListBox->item(widget->outputsListBox->currentItem()); + + long srcID = src?src->info.ID:0; + long destID = dest?dest->info.ID:0; + +// clear everything, and rebuild + itemMap.clear(); + widget->inputsListBox->clear(); + widget->outputsListBox->clear(); + for(i = clients->begin(); i != clients->end(); i++) + { + QListBox *box; + if(i->direction == mcdPlay) + box = widget->inputsListBox; + else + box = widget->outputsListBox; + + MidiManagerItem *item = new MidiManagerItem(*i); + itemMap[item->info.ID] = item; + box->insertItem(item); + } + delete clients; + +// restore selection + if(srcID && itemMap[srcID]) + widget->inputsListBox->setSelected(itemMap[srcID],true); + if(destID && itemMap[destID]) + widget->outputsListBox->setSelected(itemMap[destID],true); + connectionWidget->repaint(); +} + +void MidiManagerView::slotConnect() +{ + MidiManagerItem *src = + (MidiManagerItem *)widget->inputsListBox->item(widget->inputsListBox->currentItem()); + MidiManagerItem *dest = + (MidiManagerItem *)widget->outputsListBox->item(widget->outputsListBox->currentItem()); + if(src && dest) + { + manager.connect(src->info.ID,dest->info.ID); + updateLists(); + } +} + +void MidiManagerView::slotDisconnect() +{ + MidiManagerItem *src = + (MidiManagerItem *)widget->inputsListBox->item(widget->inputsListBox->currentItem()); + MidiManagerItem *dest = + (MidiManagerItem *)widget->outputsListBox->item(widget->outputsListBox->currentItem()); + if(src && dest) + { + manager.disconnect(src->info.ID,dest->info.ID); + updateLists(); + } +} + +void MidiManagerView::addOSSMidiPort() +{ + //lukas: no i18n here, QDialog's CTOR doesn't know about QString + //lukas: can't use that with const char *, i18n()'ed in the dialog itself + MidiPortDlg *dlg = new MidiPortDlg(0,"/dev/midi","OSS Midi Port"); + + if(dlg->exec()) + { + SoundServer s = Reference("global:Arts_SoundServer"); + if(!s.isNull()) + { + RawMidiPort p = DynamicCast(s.createObject("Arts::RawMidiPort")); + p.device(dlg->device()); + if(p.open()) + p._addChild(p,"avoid_delete"); + } + } + delete dlg; +} + +void MidiManagerView::addArtsMidiOutput() +{ + MidiInstDlg *dlg = new MidiInstDlg(0); + + if(dlg->exec()) + { + SoundServer s = Reference("global:Arts_SoundServer"); + if(!s.isNull()) + { + /* + Synth_MIDI_TEST t + = DynamicCast(s.createObject("Arts::Synth_MIDI_TEST")); + t.filename(dlg->filename().data()); + t.start(); + t._addChild(t,"avoid_delete"); + */ + Environment::InstrumentItem item = DynamicCast( + defaultEnvironment().createItem("Arts::Environment::InstrumentItem")); + if(!item.isNull()) + item.filename(dlg->filename().data()); + } + } +} +#include "midimanagerview.moc" diff --git a/arts/tools/midimanagerview.h b/arts/tools/midimanagerview.h new file mode 100644 index 00000000..7ab9d7ff --- /dev/null +++ b/arts/tools/midimanagerview.h @@ -0,0 +1,61 @@ +/* + + Copyright (C) 2000 Stefan Westerfeld + stefan@space.twc.de + + 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 General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + Permission is also granted to link this program with the Qt + library, treating Qt like a library that normally accompanies the + operating system kernel, whether or not that is in fact the case. + + */ + +#ifndef ARTS_TOOLS_MIDIMANAGERVIEW_H +#define ARTS_TOOLS_MIDIMANAGERVIEW_H + +#include <kmainwindow.h> +#include "artsmidi.h" +#include <map> + +class ConnectionWidget; +class MidiManagerItem; +class MidiManagerWidget; + +class MidiManagerView : public KMainWindow { + Q_OBJECT +protected: + friend class ConnectionWidget; + Arts::MidiManager manager; + MidiManagerWidget *widget; + ConnectionWidget *connectionWidget; + std::map<long, MidiManagerItem *> itemMap; + +public: + MidiManagerView(); + + void closeEvent(QCloseEvent *e); +public slots: + void updateLists(); + void slotConnect(); + void slotDisconnect(); + void addOSSMidiPort(); + void addArtsMidiOutput(); + +signals: + void closed(); +}; + +#endif diff --git a/arts/tools/midimanagerwidget.ui b/arts/tools/midimanagerwidget.ui new file mode 100644 index 00000000..115626d0 --- /dev/null +++ b/arts/tools/midimanagerwidget.ui @@ -0,0 +1,135 @@ +<!DOCTYPE UI><UI version="3.0" stdsetdef="1"> +<class>MidiManagerWidget</class> +<widget class="QWidget"> + <property name="name"> + <cstring>MidiManagerWidget</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>454</width> + <height>266</height> + </rect> + </property> + <property name="caption"> + <string>MIDI Manager</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>11</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <widget class="QLabel" row="0" column="0"> + <property name="name"> + <cstring>TextLabel1</cstring> + </property> + <property name="text"> + <string>MIDI inputs:</string> + </property> + </widget> + <widget class="QLabel" row="0" column="2"> + <property name="name"> + <cstring>TextLabel1_2</cstring> + </property> + <property name="text"> + <string>MIDI outputs:</string> + </property> + </widget> + <widget class="QListBox" row="1" column="0"> + <property name="name"> + <cstring>inputsListBox</cstring> + </property> + </widget> + <widget class="QListBox" row="1" column="2"> + <property name="name"> + <cstring>outputsListBox</cstring> + </property> + </widget> + <widget class="QFrame" row="2" column="0" rowspan="1" colspan="3"> + <property name="name"> + <cstring>Frame5</cstring> + </property> + <property name="frameShape"> + <enum>StyledPanel</enum> + </property> + <property name="frameShadow"> + <enum>Raised</enum> + </property> + <property name="lineWidth"> + <number>0</number> + </property> + <property name="layoutMargin" stdset="0"> + </property> + <property name="layoutSpacing" stdset="0"> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <widget class="QPushButton" row="0" column="2"> + <property name="name"> + <cstring>connectButton</cstring> + </property> + <property name="text"> + <string>&Connect</string> + </property> + </widget> + <widget class="QPushButton" row="0" column="3"> + <property name="name"> + <cstring>disconnectButton</cstring> + </property> + <property name="text"> + <string>&Disconnect</string> + </property> + </widget> + </grid> + </widget> + <widget class="QFrame" row="1" column="1"> + <property name="name"> + <cstring>connectionFrame</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="frameShape"> + <enum>StyledPanel</enum> + </property> + <property name="frameShadow"> + <enum>Raised</enum> + </property> + <property name="lineWidth"> + <number>0</number> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + </grid> + </widget> + </grid> +</widget> +<layoutdefaults spacing="6" margin="11"/> +</UI> diff --git a/arts/tools/midiportdlg.cpp b/arts/tools/midiportdlg.cpp new file mode 100644 index 00000000..c7e61e03 --- /dev/null +++ b/arts/tools/midiportdlg.cpp @@ -0,0 +1,111 @@ +/* + + Copyright (C) 1998 Stefan Westerfeld + stefan@space.twc.de + + 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 General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + */ + +#include "midiportdlg.h" +#include <klocale.h> + +#include <kapplication.h> +#include <qlayout.h> +#include <qlabel.h> +#include <kseparator.h> +#include <kbuttonbox.h> +#include <qlineedit.h> +#include <qbutton.h> +#include <qpushbutton.h> +#include <kstdguiitem.h> + +MidiPortDlg::MidiPortDlg(QWidget *parent, const char *oldname, const char *title) :QDialog(parent,title,TRUE) +{ + QVBoxLayout *mainlayout = new QVBoxLayout(this); + +// caption label: title + + mainlayout->addSpacing(5); + QLabel *captionlabel = new QLabel(this); + QFont labelfont(captionlabel->font()); + labelfont.setPointSize(labelfont.pointSize()*3/2); + captionlabel->setFont(labelfont); + captionlabel->setText(i18n("OSS MIDI Port")); + captionlabel->setAlignment(AlignCenter); + //min_size(captionlabel); + mainlayout->addWidget(captionlabel); + +// hruler + + mainlayout->addSpacing(5); + KSeparator *ruler2 = new KSeparator( KSeparator::HLine, this); + mainlayout->addWidget(ruler2); + mainlayout->addSpacing(5); + +// editwidget + + edit = new QLineEdit(this); + edit->setText(oldname); + //min_size(edit); + + mainlayout->addWidget(edit); + +// hruler + + mainlayout->addSpacing(5); + KSeparator *ruler = new KSeparator( KSeparator::HLine, this); + mainlayout->addWidget(ruler); + mainlayout->addSpacing(5); + +// buttons + + QHBoxLayout *buttonlayout = new QHBoxLayout; + mainlayout->addSpacing(5); + mainlayout->addLayout(buttonlayout); + mainlayout->addSpacing(5); + + buttonlayout->addSpacing(5); + KButtonBox *bbox = new KButtonBox(this); + + QPushButton *helpbutton = bbox->addButton(KStdGuiItem::help(), this, SLOT( help() )); + bbox->addStretch(1); + helpbutton->setAutoDefault( true ); + helpbutton->setDefault( true ); + + QPushButton *okbutton = bbox->addButton(KStdGuiItem::ok()); + connect( okbutton, SIGNAL( clicked() ), SLOT(accept() ) ); + okbutton->setAutoDefault( true ); + okbutton->setDefault( true ); + + bbox->layout(); + + buttonlayout->addWidget(bbox); + buttonlayout->addSpacing(5); + + mainlayout->freeze(); +} + +const char *MidiPortDlg::device() +{ + return edit->text().ascii(); +} + +void MidiPortDlg::help() +{ + KApplication::kApplication()->invokeHelp("", "artsbuilder"); +} + +#include "midiportdlg.moc" diff --git a/arts/tools/midiportdlg.h b/arts/tools/midiportdlg.h new file mode 100644 index 00000000..4664bebc --- /dev/null +++ b/arts/tools/midiportdlg.h @@ -0,0 +1,42 @@ +/* + + Copyright (C) 1998 Stefan Westerfeld + stefan@space.twc.de + + 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 General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + */ + +#ifndef ARTS_TOOLS_MIDIPORTDLG_H +#define ARTS_TOOLS_MIDIPORTDLG_H + +#include <qdialog.h> +#include <qtimer.h> +#include <qlabel.h> +#include <qscrollbar.h> +#include <qlineedit.h> +#include <qlayout.h> + +class MidiPortDlg :public QDialog { + Q_OBJECT + QLineEdit *edit; +public: + MidiPortDlg(QWidget *parent, const char *device, const char *title); + const char *device(); + +public slots: + void help(); +}; +#endif diff --git a/arts/tools/pics/Makefile.am b/arts/tools/pics/Makefile.am new file mode 100644 index 00000000..779ff362 --- /dev/null +++ b/arts/tools/pics/Makefile.am @@ -0,0 +1,2 @@ +KDE_ICON = AUTO + diff --git a/arts/tools/pics/cr128-action-artsaudiomanager.png b/arts/tools/pics/cr128-action-artsaudiomanager.png Binary files differnew file mode 100644 index 00000000..d659b4b5 --- /dev/null +++ b/arts/tools/pics/cr128-action-artsaudiomanager.png diff --git a/arts/tools/pics/cr128-action-artsenvironment.png b/arts/tools/pics/cr128-action-artsenvironment.png Binary files differnew file mode 100644 index 00000000..5075c8cc --- /dev/null +++ b/arts/tools/pics/cr128-action-artsenvironment.png diff --git a/arts/tools/pics/cr128-action-artsfftscope.png b/arts/tools/pics/cr128-action-artsfftscope.png Binary files differnew file mode 100644 index 00000000..0e1b512b --- /dev/null +++ b/arts/tools/pics/cr128-action-artsfftscope.png diff --git a/arts/tools/pics/cr128-action-artsmediatypes.png b/arts/tools/pics/cr128-action-artsmediatypes.png Binary files differnew file mode 100644 index 00000000..877bf20a --- /dev/null +++ b/arts/tools/pics/cr128-action-artsmediatypes.png diff --git a/arts/tools/pics/cr128-action-artsmidimanager.png b/arts/tools/pics/cr128-action-artsmidimanager.png Binary files differnew file mode 100644 index 00000000..ab5b672a --- /dev/null +++ b/arts/tools/pics/cr128-action-artsmidimanager.png diff --git a/arts/tools/pics/cr16-action-artsaudiomanager.png b/arts/tools/pics/cr16-action-artsaudiomanager.png Binary files differnew file mode 100644 index 00000000..43e287cd --- /dev/null +++ b/arts/tools/pics/cr16-action-artsaudiomanager.png diff --git a/arts/tools/pics/cr16-action-artsenvironment.png b/arts/tools/pics/cr16-action-artsenvironment.png Binary files differnew file mode 100644 index 00000000..62b04e42 --- /dev/null +++ b/arts/tools/pics/cr16-action-artsenvironment.png diff --git a/arts/tools/pics/cr16-action-artsfftscope.png b/arts/tools/pics/cr16-action-artsfftscope.png Binary files differnew file mode 100644 index 00000000..4ef12da5 --- /dev/null +++ b/arts/tools/pics/cr16-action-artsfftscope.png diff --git a/arts/tools/pics/cr16-action-artsmediatypes.png b/arts/tools/pics/cr16-action-artsmediatypes.png Binary files differnew file mode 100644 index 00000000..592e300b --- /dev/null +++ b/arts/tools/pics/cr16-action-artsmediatypes.png diff --git a/arts/tools/pics/cr16-action-artsmidimanager.png b/arts/tools/pics/cr16-action-artsmidimanager.png Binary files differnew file mode 100644 index 00000000..44948a1e --- /dev/null +++ b/arts/tools/pics/cr16-action-artsmidimanager.png diff --git a/arts/tools/pics/cr22-action-artsaudiomanager.png b/arts/tools/pics/cr22-action-artsaudiomanager.png Binary files differnew file mode 100644 index 00000000..9a103e73 --- /dev/null +++ b/arts/tools/pics/cr22-action-artsaudiomanager.png diff --git a/arts/tools/pics/cr22-action-artsenvironment.png b/arts/tools/pics/cr22-action-artsenvironment.png Binary files differnew file mode 100644 index 00000000..3e4c3a04 --- /dev/null +++ b/arts/tools/pics/cr22-action-artsenvironment.png diff --git a/arts/tools/pics/cr22-action-artsfftscope.png b/arts/tools/pics/cr22-action-artsfftscope.png Binary files differnew file mode 100644 index 00000000..1104ab76 --- /dev/null +++ b/arts/tools/pics/cr22-action-artsfftscope.png diff --git a/arts/tools/pics/cr22-action-artsmediatypes.png b/arts/tools/pics/cr22-action-artsmediatypes.png Binary files differnew file mode 100644 index 00000000..271de38e --- /dev/null +++ b/arts/tools/pics/cr22-action-artsmediatypes.png diff --git a/arts/tools/pics/cr22-action-artsmidimanager.png b/arts/tools/pics/cr22-action-artsmidimanager.png Binary files differnew file mode 100644 index 00000000..2d21c16a --- /dev/null +++ b/arts/tools/pics/cr22-action-artsmidimanager.png diff --git a/arts/tools/pics/cr32-action-artsaudiomanager.png b/arts/tools/pics/cr32-action-artsaudiomanager.png Binary files differnew file mode 100644 index 00000000..1ce95887 --- /dev/null +++ b/arts/tools/pics/cr32-action-artsaudiomanager.png diff --git a/arts/tools/pics/cr32-action-artsenvironment.png b/arts/tools/pics/cr32-action-artsenvironment.png Binary files differnew file mode 100644 index 00000000..78b9936c --- /dev/null +++ b/arts/tools/pics/cr32-action-artsenvironment.png diff --git a/arts/tools/pics/cr32-action-artsfftscope.png b/arts/tools/pics/cr32-action-artsfftscope.png Binary files differnew file mode 100644 index 00000000..a70320f8 --- /dev/null +++ b/arts/tools/pics/cr32-action-artsfftscope.png diff --git a/arts/tools/pics/cr32-action-artsmediatypes.png b/arts/tools/pics/cr32-action-artsmediatypes.png Binary files differnew file mode 100644 index 00000000..8f44fe1a --- /dev/null +++ b/arts/tools/pics/cr32-action-artsmediatypes.png diff --git a/arts/tools/pics/cr32-action-artsmidimanager.png b/arts/tools/pics/cr32-action-artsmidimanager.png Binary files differnew file mode 100644 index 00000000..90d6c565 --- /dev/null +++ b/arts/tools/pics/cr32-action-artsmidimanager.png diff --git a/arts/tools/pics/cr48-action-artsaudiomanager.png b/arts/tools/pics/cr48-action-artsaudiomanager.png Binary files differnew file mode 100644 index 00000000..048a567e --- /dev/null +++ b/arts/tools/pics/cr48-action-artsaudiomanager.png diff --git a/arts/tools/pics/cr48-action-artsenvironment.png b/arts/tools/pics/cr48-action-artsenvironment.png Binary files differnew file mode 100644 index 00000000..f12b27da --- /dev/null +++ b/arts/tools/pics/cr48-action-artsenvironment.png diff --git a/arts/tools/pics/cr48-action-artsfftscope.png b/arts/tools/pics/cr48-action-artsfftscope.png Binary files differnew file mode 100644 index 00000000..c5d832af --- /dev/null +++ b/arts/tools/pics/cr48-action-artsfftscope.png diff --git a/arts/tools/pics/cr48-action-artsmediatypes.png b/arts/tools/pics/cr48-action-artsmediatypes.png Binary files differnew file mode 100644 index 00000000..7f297365 --- /dev/null +++ b/arts/tools/pics/cr48-action-artsmediatypes.png diff --git a/arts/tools/pics/cr48-action-artsmidimanager.png b/arts/tools/pics/cr48-action-artsmidimanager.png Binary files differnew file mode 100644 index 00000000..cdec56ba --- /dev/null +++ b/arts/tools/pics/cr48-action-artsmidimanager.png diff --git a/arts/tools/pics/cr64-action-artsaudiomanager.png b/arts/tools/pics/cr64-action-artsaudiomanager.png Binary files differnew file mode 100644 index 00000000..088969ac --- /dev/null +++ b/arts/tools/pics/cr64-action-artsaudiomanager.png diff --git a/arts/tools/pics/cr64-action-artsenvironment.png b/arts/tools/pics/cr64-action-artsenvironment.png Binary files differnew file mode 100644 index 00000000..13a79a9b --- /dev/null +++ b/arts/tools/pics/cr64-action-artsenvironment.png diff --git a/arts/tools/pics/cr64-action-artsfftscope.png b/arts/tools/pics/cr64-action-artsfftscope.png Binary files differnew file mode 100644 index 00000000..53627e6f --- /dev/null +++ b/arts/tools/pics/cr64-action-artsfftscope.png diff --git a/arts/tools/pics/cr64-action-artsmediatypes.png b/arts/tools/pics/cr64-action-artsmediatypes.png Binary files differnew file mode 100644 index 00000000..b5969d0f --- /dev/null +++ b/arts/tools/pics/cr64-action-artsmediatypes.png diff --git a/arts/tools/pics/cr64-action-artsmidimanager.png b/arts/tools/pics/cr64-action-artsmidimanager.png Binary files differnew file mode 100644 index 00000000..e363de1e --- /dev/null +++ b/arts/tools/pics/cr64-action-artsmidimanager.png diff --git a/arts/tools/pics/crsc-action-artsaudiomanager.svgz b/arts/tools/pics/crsc-action-artsaudiomanager.svgz Binary files differnew file mode 100644 index 00000000..fa7c0105 --- /dev/null +++ b/arts/tools/pics/crsc-action-artsaudiomanager.svgz diff --git a/arts/tools/pics/crsc-action-artsenvironment.svgz b/arts/tools/pics/crsc-action-artsenvironment.svgz Binary files differnew file mode 100644 index 00000000..7fa3fc30 --- /dev/null +++ b/arts/tools/pics/crsc-action-artsenvironment.svgz diff --git a/arts/tools/pics/crsc-action-artsfftscope.svgz b/arts/tools/pics/crsc-action-artsfftscope.svgz Binary files differnew file mode 100644 index 00000000..e0938861 --- /dev/null +++ b/arts/tools/pics/crsc-action-artsfftscope.svgz diff --git a/arts/tools/pics/crsc-action-artsmediatypes.svgz b/arts/tools/pics/crsc-action-artsmediatypes.svgz Binary files differnew file mode 100644 index 00000000..46fbdd30 --- /dev/null +++ b/arts/tools/pics/crsc-action-artsmediatypes.svgz diff --git a/arts/tools/pics/crsc-action-artsmidimanager.svgz b/arts/tools/pics/crsc-action-artsmidimanager.svgz Binary files differnew file mode 100644 index 00000000..9ca209dc --- /dev/null +++ b/arts/tools/pics/crsc-action-artsmidimanager.svgz diff --git a/arts/tools/pics/hi128-app-artscontrol.png b/arts/tools/pics/hi128-app-artscontrol.png Binary files differnew file mode 100644 index 00000000..c6586076 --- /dev/null +++ b/arts/tools/pics/hi128-app-artscontrol.png diff --git a/arts/tools/pics/hi16-app-artscontrol.png b/arts/tools/pics/hi16-app-artscontrol.png Binary files differnew file mode 100644 index 00000000..b39d4682 --- /dev/null +++ b/arts/tools/pics/hi16-app-artscontrol.png diff --git a/arts/tools/pics/hi22-app-artscontrol.png b/arts/tools/pics/hi22-app-artscontrol.png Binary files differnew file mode 100644 index 00000000..dcb1d88c --- /dev/null +++ b/arts/tools/pics/hi22-app-artscontrol.png diff --git a/arts/tools/pics/hi32-app-artscontrol.png b/arts/tools/pics/hi32-app-artscontrol.png Binary files differnew file mode 100644 index 00000000..98525ed1 --- /dev/null +++ b/arts/tools/pics/hi32-app-artscontrol.png diff --git a/arts/tools/pics/hi48-app-artscontrol.png b/arts/tools/pics/hi48-app-artscontrol.png Binary files differnew file mode 100644 index 00000000..14549fbf --- /dev/null +++ b/arts/tools/pics/hi48-app-artscontrol.png diff --git a/arts/tools/pics/hi64-app-artscontrol.png b/arts/tools/pics/hi64-app-artscontrol.png Binary files differnew file mode 100644 index 00000000..f9064f92 --- /dev/null +++ b/arts/tools/pics/hi64-app-artscontrol.png diff --git a/arts/tools/pics/hisc-app-artscontrol.svgz b/arts/tools/pics/hisc-app-artscontrol.svgz Binary files differnew file mode 100644 index 00000000..7763a33a --- /dev/null +++ b/arts/tools/pics/hisc-app-artscontrol.svgz diff --git a/arts/tools/statusview.cpp b/arts/tools/statusview.cpp new file mode 100644 index 00000000..7606b3ef --- /dev/null +++ b/arts/tools/statusview.cpp @@ -0,0 +1,95 @@ +/* + + Copyright (C) 2000-2001 Stefan Westerfeld + <stefan@space.twc.de> + 2003 Arnold Krille + <arnold@arnoldarts.de> + + 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 General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + */ + +#include <qlayout.h> +#include <klocale.h> +#include <qpushbutton.h> +#include <qwidget.h> +#include <qtimer.h> +#include <qlabel.h> + +#include "statusview.h" + +using namespace std; +using namespace Arts; + +ArtsStatusView::ArtsStatusView(Arts::SoundServer a_server, QWidget* parent, const char* name ) + : Template_ArtsView( parent,name ) + , server(a_server) +{ + this->setCaption( i18n( "aRts Status" ) ); + QBoxLayout *l= new QVBoxLayout(this); + //l->setAutoAdd(TRUE); + + RealtimeStatus rs= server.realtimeStatus(); + l->addWidget(new QLabel(rs==rtRealtime? + i18n("Artsd is running with realtime scheduling."): + rs==rtNoSupport? + i18n("Your system does not support realtime scheduling."): + rs==rtNoWrapper? + i18n("Artsd is not configured for realtime scheduling\n " + "or was manually started without artswrapper."): + i18n("Artsd should run with realtime scheduling,\n but it " + "does not (Is artswrapper suid root?)."), + this, "realtimeLabel")); + l->addSpacing(10); + + suspendLabel= new QLabel(i18n("Determining suspend status..."), + this, "suspendLabel"); + l->addWidget(suspendLabel); + l->addSpacing(6); + l->setMargin(6); + + suspendButton= new QPushButton(this, "suspendButton"); + suspendButton->setText(i18n("&Suspend Now")); + l->addWidget(suspendButton); + connect(suspendButton, SIGNAL(clicked()), this, SLOT(suspendButtonClicked())); + + artsPollStatusTimer= new QTimer(this); + connect(artsPollStatusTimer, SIGNAL(timeout()), this, SLOT(updateStatus())); + artsPollStatusTimer->start(1000); + //l->activate(); + show(); +} + +void ArtsStatusView::suspendButtonClicked() +{ + (void)server.suspend(); // TODO: error msg if suspend not possible? +} + +void ArtsStatusView::updateStatus() +{ + long seconds= server.secondsUntilSuspend(); + if (seconds<0) + suspendLabel->setText(i18n("The aRts sound daemon will not autosuspend right\n" + "now since there are active modules.")); + else if (seconds==0) + suspendLabel->setText(i18n("The aRts sound daemon is suspended. Legacy\n " + "applications can use the sound card now.")); + else + suspendLabel->setText(i18n("Autosuspend will happen in %1 seconds."). + arg(seconds)); + suspendButton->setEnabled(seconds>0); +} + +#include "statusview.moc" diff --git a/arts/tools/statusview.h b/arts/tools/statusview.h new file mode 100644 index 00000000..6ded00af --- /dev/null +++ b/arts/tools/statusview.h @@ -0,0 +1,52 @@ +/* + + Copyright (C) 2000-2001 Stefan Westerfeld + <stefan@space.twc.de> + 2003 Arnold Krille + <arnold@arnoldarts.de> + + 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 General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + */ + +#ifndef STATUSVIEW_H +#define STATUSVIEW_H + +#include <qwidget.h> +#include <arts/soundserver.h> + +#include "templateview.h" + +class QButton; +class QTimer; +class QLabel; + +class ArtsStatusView : public Template_ArtsView { + Q_OBJECT +public: + ArtsStatusView(Arts::SoundServer server, QWidget* =0, const char* =0 ); + +public slots: + void updateStatus(); + void suspendButtonClicked(); + +protected: + QTimer *artsPollStatusTimer; + Arts::SoundServer server; + QLabel *suspendLabel; + QButton *suspendButton; +}; + +#endif diff --git a/arts/tools/templateview.cpp b/arts/tools/templateview.cpp new file mode 100644 index 00000000..ecf7a0e8 --- /dev/null +++ b/arts/tools/templateview.cpp @@ -0,0 +1,39 @@ +/* + + Copyright (C) 2003 Arnold Krille <arnold@arnoldarts.de> + + 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 General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + */ + +#include "templateview.h" + +//#include <kdebug.h> + +Template_ArtsView::Template_ArtsView( QWidget* parent, const char* name ) : QFrame( parent,name ){ + //kdDebug()<<k_funcinfo<<endl; +} + +Template_ArtsView::~Template_ArtsView() { + //kdDebug()<<k_funcinfo<<endl; +} + +void Template_ArtsView::closeEvent( QCloseEvent *e ) { + //kdDebug()<<k_funcinfo<<endl; + e->accept(); + emit closed(); +} + +#include "templateview.moc" diff --git a/arts/tools/templateview.h b/arts/tools/templateview.h new file mode 100644 index 00000000..e101aa85 --- /dev/null +++ b/arts/tools/templateview.h @@ -0,0 +1,39 @@ +/* + + Copyright (C) 2003 Arnold Krille <arnold@arnoldarts.de> + + 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 General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + */ + +#ifndef ARTS_TEMPLATEVIEW_H +#define ARTS_TEMPLATEVIEW_H + +//#include <artsflow.h> +#include <qframe.h> + +class Template_ArtsView : public QFrame +{ + Q_OBJECT +public: + Template_ArtsView( QWidget* =0, const char* =0 ); + ~Template_ArtsView(); + + void closeEvent( QCloseEvent* ); +signals: + void closed(); +}; + +#endif |