From e2de64d6f1beb9e492daf5b886e19933c1fa41dd Mon Sep 17 00:00:00 2001 From: toma Date: Wed, 25 Nov 2009 17:56:58 +0000 Subject: 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 --- arts/tools/Makefile.am | 82 +++++++ arts/tools/artsactions.cpp | 191 ++++++++++++++++ arts/tools/artsactions.h | 117 ++++++++++ arts/tools/artscontrol.desktop | 136 +++++++++++ arts/tools/artscontrol.rc | 17 ++ arts/tools/artscontrolapplet.cpp | 163 ++++++++++++++ arts/tools/artscontrolapplet.desktop | 109 +++++++++ arts/tools/artscontrolapplet.h | 132 +++++++++++ arts/tools/artscontrolapplet_private.h | 122 ++++++++++ arts/tools/artsmidimanagerview.rc | 9 + arts/tools/audiomanager.cpp | 198 ++++++++++++++++ arts/tools/audiomanager.h | 79 +++++++ arts/tools/choosebusdlg.cpp | 184 +++++++++++++++ arts/tools/choosebusdlg.h | 49 ++++ arts/tools/environmentview.cpp | 171 ++++++++++++++ arts/tools/environmentview.h | 57 +++++ arts/tools/fftscopeview.cpp | 163 ++++++++++++++ arts/tools/fftscopeview.h | 81 +++++++ arts/tools/levelmeters.cpp | 239 ++++++++++++++++++++ arts/tools/levelmeters.h | 168 ++++++++++++++ arts/tools/main.cpp | 211 ++++++++++++++++++ arts/tools/main.h | 110 +++++++++ arts/tools/mediatypesview.cpp | 76 +++++++ arts/tools/mediatypesview.h | 36 +++ arts/tools/midiinstdlg.cpp | 179 +++++++++++++++ arts/tools/midiinstdlg.h | 38 ++++ arts/tools/midimanagerdlg.ui | 151 +++++++++++++ arts/tools/midimanagerview.cpp | 260 ++++++++++++++++++++++ arts/tools/midimanagerview.h | 61 +++++ arts/tools/midimanagerwidget.ui | 135 +++++++++++ arts/tools/midiportdlg.cpp | 111 +++++++++ arts/tools/midiportdlg.h | 42 ++++ arts/tools/pics/Makefile.am | 2 + arts/tools/pics/cr128-action-artsaudiomanager.png | Bin 0 -> 8472 bytes arts/tools/pics/cr128-action-artsenvironment.png | Bin 0 -> 12033 bytes arts/tools/pics/cr128-action-artsfftscope.png | Bin 0 -> 3077 bytes arts/tools/pics/cr128-action-artsmediatypes.png | Bin 0 -> 6904 bytes arts/tools/pics/cr128-action-artsmidimanager.png | Bin 0 -> 16951 bytes arts/tools/pics/cr16-action-artsaudiomanager.png | Bin 0 -> 815 bytes arts/tools/pics/cr16-action-artsenvironment.png | Bin 0 -> 1008 bytes arts/tools/pics/cr16-action-artsfftscope.png | Bin 0 -> 790 bytes arts/tools/pics/cr16-action-artsmediatypes.png | Bin 0 -> 795 bytes arts/tools/pics/cr16-action-artsmidimanager.png | Bin 0 -> 854 bytes arts/tools/pics/cr22-action-artsaudiomanager.png | Bin 0 -> 1145 bytes arts/tools/pics/cr22-action-artsenvironment.png | Bin 0 -> 1465 bytes arts/tools/pics/cr22-action-artsfftscope.png | Bin 0 -> 1193 bytes arts/tools/pics/cr22-action-artsmediatypes.png | Bin 0 -> 1082 bytes arts/tools/pics/cr22-action-artsmidimanager.png | Bin 0 -> 1061 bytes arts/tools/pics/cr32-action-artsaudiomanager.png | Bin 0 -> 1742 bytes arts/tools/pics/cr32-action-artsenvironment.png | Bin 0 -> 2415 bytes arts/tools/pics/cr32-action-artsfftscope.png | Bin 0 -> 1494 bytes arts/tools/pics/cr32-action-artsmediatypes.png | Bin 0 -> 1597 bytes arts/tools/pics/cr32-action-artsmidimanager.png | Bin 0 -> 2688 bytes arts/tools/pics/cr48-action-artsaudiomanager.png | Bin 0 -> 2918 bytes arts/tools/pics/cr48-action-artsenvironment.png | Bin 0 -> 4131 bytes arts/tools/pics/cr48-action-artsfftscope.png | Bin 0 -> 1578 bytes arts/tools/pics/cr48-action-artsmediatypes.png | Bin 0 -> 2396 bytes arts/tools/pics/cr48-action-artsmidimanager.png | Bin 0 -> 4681 bytes arts/tools/pics/cr64-action-artsaudiomanager.png | Bin 0 -> 4165 bytes arts/tools/pics/cr64-action-artsenvironment.png | Bin 0 -> 5671 bytes arts/tools/pics/cr64-action-artsfftscope.png | Bin 0 -> 2003 bytes arts/tools/pics/cr64-action-artsmediatypes.png | Bin 0 -> 3245 bytes arts/tools/pics/cr64-action-artsmidimanager.png | Bin 0 -> 6910 bytes arts/tools/pics/crsc-action-artsaudiomanager.svgz | Bin 0 -> 2150 bytes arts/tools/pics/crsc-action-artsenvironment.svgz | Bin 0 -> 2019 bytes arts/tools/pics/crsc-action-artsfftscope.svgz | Bin 0 -> 1203 bytes arts/tools/pics/crsc-action-artsmediatypes.svgz | Bin 0 -> 3323 bytes arts/tools/pics/crsc-action-artsmidimanager.svgz | Bin 0 -> 1746 bytes arts/tools/pics/hi128-app-artscontrol.png | Bin 0 -> 7551 bytes arts/tools/pics/hi16-app-artscontrol.png | Bin 0 -> 845 bytes arts/tools/pics/hi22-app-artscontrol.png | Bin 0 -> 1172 bytes arts/tools/pics/hi32-app-artscontrol.png | Bin 0 -> 1745 bytes arts/tools/pics/hi48-app-artscontrol.png | Bin 0 -> 2642 bytes arts/tools/pics/hi64-app-artscontrol.png | Bin 0 -> 3540 bytes arts/tools/pics/hisc-app-artscontrol.svgz | Bin 0 -> 2410 bytes arts/tools/statusview.cpp | 95 ++++++++ arts/tools/statusview.h | 52 +++++ arts/tools/templateview.cpp | 39 ++++ arts/tools/templateview.h | 39 ++++ 79 files changed, 4104 insertions(+) create mode 100644 arts/tools/Makefile.am create mode 100644 arts/tools/artsactions.cpp create mode 100644 arts/tools/artsactions.h create mode 100644 arts/tools/artscontrol.desktop create mode 100644 arts/tools/artscontrol.rc create mode 100644 arts/tools/artscontrolapplet.cpp create mode 100644 arts/tools/artscontrolapplet.desktop create mode 100644 arts/tools/artscontrolapplet.h create mode 100644 arts/tools/artscontrolapplet_private.h create mode 100644 arts/tools/artsmidimanagerview.rc create mode 100644 arts/tools/audiomanager.cpp create mode 100644 arts/tools/audiomanager.h create mode 100644 arts/tools/choosebusdlg.cpp create mode 100644 arts/tools/choosebusdlg.h create mode 100644 arts/tools/environmentview.cpp create mode 100644 arts/tools/environmentview.h create mode 100644 arts/tools/fftscopeview.cpp create mode 100644 arts/tools/fftscopeview.h create mode 100644 arts/tools/levelmeters.cpp create mode 100644 arts/tools/levelmeters.h create mode 100644 arts/tools/main.cpp create mode 100644 arts/tools/main.h create mode 100644 arts/tools/mediatypesview.cpp create mode 100644 arts/tools/mediatypesview.h create mode 100644 arts/tools/midiinstdlg.cpp create mode 100644 arts/tools/midiinstdlg.h create mode 100644 arts/tools/midimanagerdlg.ui create mode 100644 arts/tools/midimanagerview.cpp create mode 100644 arts/tools/midimanagerview.h create mode 100644 arts/tools/midimanagerwidget.ui create mode 100644 arts/tools/midiportdlg.cpp create mode 100644 arts/tools/midiportdlg.h create mode 100644 arts/tools/pics/Makefile.am create mode 100644 arts/tools/pics/cr128-action-artsaudiomanager.png create mode 100644 arts/tools/pics/cr128-action-artsenvironment.png create mode 100644 arts/tools/pics/cr128-action-artsfftscope.png create mode 100644 arts/tools/pics/cr128-action-artsmediatypes.png create mode 100644 arts/tools/pics/cr128-action-artsmidimanager.png create mode 100644 arts/tools/pics/cr16-action-artsaudiomanager.png create mode 100644 arts/tools/pics/cr16-action-artsenvironment.png create mode 100644 arts/tools/pics/cr16-action-artsfftscope.png create mode 100644 arts/tools/pics/cr16-action-artsmediatypes.png create mode 100644 arts/tools/pics/cr16-action-artsmidimanager.png create mode 100644 arts/tools/pics/cr22-action-artsaudiomanager.png create mode 100644 arts/tools/pics/cr22-action-artsenvironment.png create mode 100644 arts/tools/pics/cr22-action-artsfftscope.png create mode 100644 arts/tools/pics/cr22-action-artsmediatypes.png create mode 100644 arts/tools/pics/cr22-action-artsmidimanager.png create mode 100644 arts/tools/pics/cr32-action-artsaudiomanager.png create mode 100644 arts/tools/pics/cr32-action-artsenvironment.png create mode 100644 arts/tools/pics/cr32-action-artsfftscope.png create mode 100644 arts/tools/pics/cr32-action-artsmediatypes.png create mode 100644 arts/tools/pics/cr32-action-artsmidimanager.png create mode 100644 arts/tools/pics/cr48-action-artsaudiomanager.png create mode 100644 arts/tools/pics/cr48-action-artsenvironment.png create mode 100644 arts/tools/pics/cr48-action-artsfftscope.png create mode 100644 arts/tools/pics/cr48-action-artsmediatypes.png create mode 100644 arts/tools/pics/cr48-action-artsmidimanager.png create mode 100644 arts/tools/pics/cr64-action-artsaudiomanager.png create mode 100644 arts/tools/pics/cr64-action-artsenvironment.png create mode 100644 arts/tools/pics/cr64-action-artsfftscope.png create mode 100644 arts/tools/pics/cr64-action-artsmediatypes.png create mode 100644 arts/tools/pics/cr64-action-artsmidimanager.png create mode 100644 arts/tools/pics/crsc-action-artsaudiomanager.svgz create mode 100644 arts/tools/pics/crsc-action-artsenvironment.svgz create mode 100644 arts/tools/pics/crsc-action-artsfftscope.svgz create mode 100644 arts/tools/pics/crsc-action-artsmediatypes.svgz create mode 100644 arts/tools/pics/crsc-action-artsmidimanager.svgz create mode 100644 arts/tools/pics/hi128-app-artscontrol.png create mode 100644 arts/tools/pics/hi16-app-artscontrol.png create mode 100644 arts/tools/pics/hi22-app-artscontrol.png create mode 100644 arts/tools/pics/hi32-app-artscontrol.png create mode 100644 arts/tools/pics/hi48-app-artscontrol.png create mode 100644 arts/tools/pics/hi64-app-artscontrol.png create mode 100644 arts/tools/pics/hisc-app-artscontrol.svgz create mode 100644 arts/tools/statusview.cpp create mode 100644 arts/tools/statusview.h create mode 100644 arts/tools/templateview.cpp create mode 100644 arts/tools/templateview.h (limited to 'arts/tools') 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 + + 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 +#include +#include +#include +#include +//#include + +#include + +#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()<insertCatalogue( "artscontrol" ); + if ( !_kartsserver ) _kartsserver = new KArtsServer( this ); +} + +ArtsActions::~ArtsActions() { + //kdDebug()<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 + + 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 +#include +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 @@ + + + + &View + + + + + + + + + + + + + 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 +#include +#include +#include +#include +#include +#include +#include + +#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& "<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."< +#include + +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()<layout->sizeHint().width(); +} + +int ArtsControlApplet::heightForWidth( int w ) const { +kdDebug()<<"ArtsControlApplet::heightForWidth( int "<layout->sizeHint().height(); +} + +void ArtsControlApplet::resizeEvent( QResizeEvent * /*_Event*/ ) { + kdDebug()<<"ArtsControlApplet::resizeEvent( QResizeEvent * )"<button() /*|| Qt::LeftButton == ev->button()*/ ) + p->menu->exec( QCursor::pos() ); +} + +void ArtsControlApplet::positionChange( Position ) { + kdDebug() << k_funcinfo << endl; + resetLayout(); +} + +void ArtsControlApplet::resetLayout() { +kdDebug()< +#endif + +#include +#include +#include + +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 + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#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 @@ + + + + &Add + + + + + 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 +#include + +#include +#include +#include + +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 *acs = AudioManager.clients(); + + unsigned long c; + for(c=0;csize();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 +#include +#include + +#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 + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +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 *destinations = aman.destinations(); + unsigned long i; + for(i=0;isize();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 + +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 + + 2003 Matthias Kretz + 2003 Arnold Krille + + 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 +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include + +#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(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(listBox->item(i)); + container.removeItem(iv->item); + update(); +} + +void EnvironmentView::update() +{ + listBox->clear(); + + std::vector *items = container.items(); + for(std::vector::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 strseq; + + while(getline(infile,line)) + strseq.push_back(line); + + defaultEnvironment().loadFromList(strseq); +} + +void EnvironmentView::save() +{ + std::vector *strseq; + strseq = defaultEnvironment().saveToList(); + + std::ofstream outfile(QFile::encodeName(defaultEnvFileName).data()); + for(std::vector::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 + + 2003 Matthias Kretz + 2003 Arnold Krille + 2003 Arnold Krille + + 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 +#include +#include +#include +#include +#include +#include +#include +#include + +#include "artsactions.h" + +using namespace std; +using namespace Arts; + +FFTScopeView::FFTScopeView( SimpleSoundServer server, QWidget* parent ) + : Template_ArtsView( parent ) + , server( server ) + , scopeData( 0 ) +{ +kdDebug()<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;isize();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()"<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..."<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;isize();i++ ) + scopeScales[ i ].count( bars ); +} + +void FFTScopeView::lessBars() { + int bars = scopeScales[ 0 ].count() - 10; + for ( unsigned int i=0;isize();i++ ) + scopeScales[ i ].count( bars ); +} + +void FFTScopeView::setStyle( Arts::LevelMeterStyle style ) { + for ( uint i=0; i + +void FFTScopeView::substyle() { + int _substyle = KInputDialog::getInteger( i18n("Substyle"), i18n("Please enter substyle:"), 0, 0, 10, 1, 0, this ); + for ( unsigned int i=0; isize(); 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 + + 2003 Arnold Krille + + 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 +#include +#include + +#include "templateview.h" + +#include +#include + +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 *scopeData; + std::vector scopeDraw; + std::vector scopeScales; + std::vector 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 +#include +#include +#include +#include +#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 it(lastValues); it.current(); ++it) { + float value= it.current()->value; + if (value>maxValue) + maxValue= 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 + + + 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 +#include +#include +#include +#include + +// helper functions +const float LEVEL_MIN= 1.f/(1<<20); // minimal positive sample for 20 bit resolution +inline float levelToDB(float level) { + if (level 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 + + 2003 Arnold Krille + + 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 +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#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 + + 2003 Arnold Krille +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +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 + + 2003 Arnold Krille + + + 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 +#include +#include +#include +#include +#include + +#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 *results = q.query(); + std::map done; + QString str; + + for(std::vector::iterator i = results->begin(); i != results->end(); i++) + { + std::vector *ext = (*i).getProperty("Extension"); + + for(vector::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 + + 2003 Arnold Krille + + + 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 +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +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 +#include +#include + +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 @@ + +MidiManagerDlg + + + MidiManagerDlg + + + + 0 + 0 + 462 + 266 + + + + MIDI Manager + + + + unnamed + + + 11 + + + 6 + + + + TextLabel1 + + + MIDI inputs: + + + + + TextLabel1_2 + + + MIDI outputs: + + + + + inputsListBox + + + + + outputsListBox + + + + + Frame5 + + + StyledPanel + + + Raised + + + 0 + + + + + + + + unnamed + + + 0 + + + 6 + + + + AddButton_2 + + + &Add... + + + + + RemoveButton_2 + + + &Remove + + + + + connectButton + + + &Connect + + + + + disconnectButton + + + &Disconnect + + + + + + + connectionFrame + + + + 5 + 5 + 0 + 0 + + + + StyledPanel + + + Raised + + + 0 + + + + unnamed + + + 0 + + + 6 + + + + + + + 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include "artsmidi.h" +#include "artsmodules.h" +#include "midiportdlg.h" +#include "midiinstdlg.h" + +#include + +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::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 *clients = manager.clients(); + vector::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 +#include "artsmidi.h" +#include + +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 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 @@ + +MidiManagerWidget + + + MidiManagerWidget + + + + 0 + 0 + 454 + 266 + + + + MIDI Manager + + + + unnamed + + + 11 + + + 6 + + + + TextLabel1 + + + MIDI inputs: + + + + + TextLabel1_2 + + + MIDI outputs: + + + + + inputsListBox + + + + + outputsListBox + + + + + Frame5 + + + StyledPanel + + + Raised + + + 0 + + + + + + + + unnamed + + + 0 + + + 6 + + + + connectButton + + + &Connect + + + + + disconnectButton + + + &Disconnect + + + + + + + connectionFrame + + + + 5 + 5 + 0 + 0 + + + + StyledPanel + + + Raised + + + 0 + + + + unnamed + + + 0 + + + 6 + + + + + + + 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 + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +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 +#include +#include +#include +#include +#include + +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 new file mode 100644 index 00000000..d659b4b5 Binary files /dev/null and b/arts/tools/pics/cr128-action-artsaudiomanager.png differ diff --git a/arts/tools/pics/cr128-action-artsenvironment.png b/arts/tools/pics/cr128-action-artsenvironment.png new file mode 100644 index 00000000..5075c8cc Binary files /dev/null and b/arts/tools/pics/cr128-action-artsenvironment.png differ diff --git a/arts/tools/pics/cr128-action-artsfftscope.png b/arts/tools/pics/cr128-action-artsfftscope.png new file mode 100644 index 00000000..0e1b512b Binary files /dev/null and b/arts/tools/pics/cr128-action-artsfftscope.png differ diff --git a/arts/tools/pics/cr128-action-artsmediatypes.png b/arts/tools/pics/cr128-action-artsmediatypes.png new file mode 100644 index 00000000..877bf20a Binary files /dev/null and b/arts/tools/pics/cr128-action-artsmediatypes.png differ diff --git a/arts/tools/pics/cr128-action-artsmidimanager.png b/arts/tools/pics/cr128-action-artsmidimanager.png new file mode 100644 index 00000000..ab5b672a Binary files /dev/null and b/arts/tools/pics/cr128-action-artsmidimanager.png differ diff --git a/arts/tools/pics/cr16-action-artsaudiomanager.png b/arts/tools/pics/cr16-action-artsaudiomanager.png new file mode 100644 index 00000000..43e287cd Binary files /dev/null and b/arts/tools/pics/cr16-action-artsaudiomanager.png differ diff --git a/arts/tools/pics/cr16-action-artsenvironment.png b/arts/tools/pics/cr16-action-artsenvironment.png new file mode 100644 index 00000000..62b04e42 Binary files /dev/null and b/arts/tools/pics/cr16-action-artsenvironment.png differ diff --git a/arts/tools/pics/cr16-action-artsfftscope.png b/arts/tools/pics/cr16-action-artsfftscope.png new file mode 100644 index 00000000..4ef12da5 Binary files /dev/null and b/arts/tools/pics/cr16-action-artsfftscope.png differ diff --git a/arts/tools/pics/cr16-action-artsmediatypes.png b/arts/tools/pics/cr16-action-artsmediatypes.png new file mode 100644 index 00000000..592e300b Binary files /dev/null and b/arts/tools/pics/cr16-action-artsmediatypes.png differ diff --git a/arts/tools/pics/cr16-action-artsmidimanager.png b/arts/tools/pics/cr16-action-artsmidimanager.png new file mode 100644 index 00000000..44948a1e Binary files /dev/null and b/arts/tools/pics/cr16-action-artsmidimanager.png differ diff --git a/arts/tools/pics/cr22-action-artsaudiomanager.png b/arts/tools/pics/cr22-action-artsaudiomanager.png new file mode 100644 index 00000000..9a103e73 Binary files /dev/null and b/arts/tools/pics/cr22-action-artsaudiomanager.png differ diff --git a/arts/tools/pics/cr22-action-artsenvironment.png b/arts/tools/pics/cr22-action-artsenvironment.png new file mode 100644 index 00000000..3e4c3a04 Binary files /dev/null and b/arts/tools/pics/cr22-action-artsenvironment.png differ diff --git a/arts/tools/pics/cr22-action-artsfftscope.png b/arts/tools/pics/cr22-action-artsfftscope.png new file mode 100644 index 00000000..1104ab76 Binary files /dev/null and b/arts/tools/pics/cr22-action-artsfftscope.png differ diff --git a/arts/tools/pics/cr22-action-artsmediatypes.png b/arts/tools/pics/cr22-action-artsmediatypes.png new file mode 100644 index 00000000..271de38e Binary files /dev/null and b/arts/tools/pics/cr22-action-artsmediatypes.png differ diff --git a/arts/tools/pics/cr22-action-artsmidimanager.png b/arts/tools/pics/cr22-action-artsmidimanager.png new file mode 100644 index 00000000..2d21c16a Binary files /dev/null and b/arts/tools/pics/cr22-action-artsmidimanager.png differ diff --git a/arts/tools/pics/cr32-action-artsaudiomanager.png b/arts/tools/pics/cr32-action-artsaudiomanager.png new file mode 100644 index 00000000..1ce95887 Binary files /dev/null and b/arts/tools/pics/cr32-action-artsaudiomanager.png differ diff --git a/arts/tools/pics/cr32-action-artsenvironment.png b/arts/tools/pics/cr32-action-artsenvironment.png new file mode 100644 index 00000000..78b9936c Binary files /dev/null and b/arts/tools/pics/cr32-action-artsenvironment.png differ diff --git a/arts/tools/pics/cr32-action-artsfftscope.png b/arts/tools/pics/cr32-action-artsfftscope.png new file mode 100644 index 00000000..a70320f8 Binary files /dev/null and b/arts/tools/pics/cr32-action-artsfftscope.png differ diff --git a/arts/tools/pics/cr32-action-artsmediatypes.png b/arts/tools/pics/cr32-action-artsmediatypes.png new file mode 100644 index 00000000..8f44fe1a Binary files /dev/null and b/arts/tools/pics/cr32-action-artsmediatypes.png differ diff --git a/arts/tools/pics/cr32-action-artsmidimanager.png b/arts/tools/pics/cr32-action-artsmidimanager.png new file mode 100644 index 00000000..90d6c565 Binary files /dev/null and b/arts/tools/pics/cr32-action-artsmidimanager.png differ diff --git a/arts/tools/pics/cr48-action-artsaudiomanager.png b/arts/tools/pics/cr48-action-artsaudiomanager.png new file mode 100644 index 00000000..048a567e Binary files /dev/null and b/arts/tools/pics/cr48-action-artsaudiomanager.png differ diff --git a/arts/tools/pics/cr48-action-artsenvironment.png b/arts/tools/pics/cr48-action-artsenvironment.png new file mode 100644 index 00000000..f12b27da Binary files /dev/null and b/arts/tools/pics/cr48-action-artsenvironment.png differ diff --git a/arts/tools/pics/cr48-action-artsfftscope.png b/arts/tools/pics/cr48-action-artsfftscope.png new file mode 100644 index 00000000..c5d832af Binary files /dev/null and b/arts/tools/pics/cr48-action-artsfftscope.png differ diff --git a/arts/tools/pics/cr48-action-artsmediatypes.png b/arts/tools/pics/cr48-action-artsmediatypes.png new file mode 100644 index 00000000..7f297365 Binary files /dev/null and b/arts/tools/pics/cr48-action-artsmediatypes.png differ diff --git a/arts/tools/pics/cr48-action-artsmidimanager.png b/arts/tools/pics/cr48-action-artsmidimanager.png new file mode 100644 index 00000000..cdec56ba Binary files /dev/null and b/arts/tools/pics/cr48-action-artsmidimanager.png differ diff --git a/arts/tools/pics/cr64-action-artsaudiomanager.png b/arts/tools/pics/cr64-action-artsaudiomanager.png new file mode 100644 index 00000000..088969ac Binary files /dev/null and b/arts/tools/pics/cr64-action-artsaudiomanager.png differ diff --git a/arts/tools/pics/cr64-action-artsenvironment.png b/arts/tools/pics/cr64-action-artsenvironment.png new file mode 100644 index 00000000..13a79a9b Binary files /dev/null and b/arts/tools/pics/cr64-action-artsenvironment.png differ diff --git a/arts/tools/pics/cr64-action-artsfftscope.png b/arts/tools/pics/cr64-action-artsfftscope.png new file mode 100644 index 00000000..53627e6f Binary files /dev/null and b/arts/tools/pics/cr64-action-artsfftscope.png differ diff --git a/arts/tools/pics/cr64-action-artsmediatypes.png b/arts/tools/pics/cr64-action-artsmediatypes.png new file mode 100644 index 00000000..b5969d0f Binary files /dev/null and b/arts/tools/pics/cr64-action-artsmediatypes.png differ diff --git a/arts/tools/pics/cr64-action-artsmidimanager.png b/arts/tools/pics/cr64-action-artsmidimanager.png new file mode 100644 index 00000000..e363de1e Binary files /dev/null and b/arts/tools/pics/cr64-action-artsmidimanager.png differ diff --git a/arts/tools/pics/crsc-action-artsaudiomanager.svgz b/arts/tools/pics/crsc-action-artsaudiomanager.svgz new file mode 100644 index 00000000..fa7c0105 Binary files /dev/null and b/arts/tools/pics/crsc-action-artsaudiomanager.svgz differ diff --git a/arts/tools/pics/crsc-action-artsenvironment.svgz b/arts/tools/pics/crsc-action-artsenvironment.svgz new file mode 100644 index 00000000..7fa3fc30 Binary files /dev/null and b/arts/tools/pics/crsc-action-artsenvironment.svgz differ diff --git a/arts/tools/pics/crsc-action-artsfftscope.svgz b/arts/tools/pics/crsc-action-artsfftscope.svgz new file mode 100644 index 00000000..e0938861 Binary files /dev/null and b/arts/tools/pics/crsc-action-artsfftscope.svgz differ diff --git a/arts/tools/pics/crsc-action-artsmediatypes.svgz b/arts/tools/pics/crsc-action-artsmediatypes.svgz new file mode 100644 index 00000000..46fbdd30 Binary files /dev/null and b/arts/tools/pics/crsc-action-artsmediatypes.svgz differ diff --git a/arts/tools/pics/crsc-action-artsmidimanager.svgz b/arts/tools/pics/crsc-action-artsmidimanager.svgz new file mode 100644 index 00000000..9ca209dc Binary files /dev/null and b/arts/tools/pics/crsc-action-artsmidimanager.svgz differ diff --git a/arts/tools/pics/hi128-app-artscontrol.png b/arts/tools/pics/hi128-app-artscontrol.png new file mode 100644 index 00000000..c6586076 Binary files /dev/null and b/arts/tools/pics/hi128-app-artscontrol.png differ diff --git a/arts/tools/pics/hi16-app-artscontrol.png b/arts/tools/pics/hi16-app-artscontrol.png new file mode 100644 index 00000000..b39d4682 Binary files /dev/null and b/arts/tools/pics/hi16-app-artscontrol.png differ diff --git a/arts/tools/pics/hi22-app-artscontrol.png b/arts/tools/pics/hi22-app-artscontrol.png new file mode 100644 index 00000000..dcb1d88c Binary files /dev/null and b/arts/tools/pics/hi22-app-artscontrol.png differ diff --git a/arts/tools/pics/hi32-app-artscontrol.png b/arts/tools/pics/hi32-app-artscontrol.png new file mode 100644 index 00000000..98525ed1 Binary files /dev/null and b/arts/tools/pics/hi32-app-artscontrol.png differ diff --git a/arts/tools/pics/hi48-app-artscontrol.png b/arts/tools/pics/hi48-app-artscontrol.png new file mode 100644 index 00000000..14549fbf Binary files /dev/null and b/arts/tools/pics/hi48-app-artscontrol.png differ diff --git a/arts/tools/pics/hi64-app-artscontrol.png b/arts/tools/pics/hi64-app-artscontrol.png new file mode 100644 index 00000000..f9064f92 Binary files /dev/null and b/arts/tools/pics/hi64-app-artscontrol.png differ diff --git a/arts/tools/pics/hisc-app-artscontrol.svgz b/arts/tools/pics/hisc-app-artscontrol.svgz new file mode 100644 index 00000000..7763a33a Binary files /dev/null and b/arts/tools/pics/hisc-app-artscontrol.svgz differ 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 + + 2003 Arnold Krille + + + 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 +#include +#include +#include +#include +#include + +#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 + + 2003 Arnold Krille + + + 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 +#include + +#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 + + 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 + +Template_ArtsView::Template_ArtsView( QWidget* parent, const char* name ) : QFrame( parent,name ){ + //kdDebug()<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 + + 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 +#include + +class Template_ArtsView : public QFrame +{ + Q_OBJECT +public: + Template_ArtsView( QWidget* =0, const char* =0 ); + ~Template_ArtsView(); + + void closeEvent( QCloseEvent* ); +signals: + void closed(); +}; + +#endif -- cgit v1.2.1