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/modules/common/env_instrumentitem_impl.cc | 113 +++++++++++++++++++++++++ 1 file changed, 113 insertions(+) create mode 100644 arts/modules/common/env_instrumentitem_impl.cc (limited to 'arts/modules/common/env_instrumentitem_impl.cc') diff --git a/arts/modules/common/env_instrumentitem_impl.cc b/arts/modules/common/env_instrumentitem_impl.cc new file mode 100644 index 00000000..17959ca0 --- /dev/null +++ b/arts/modules/common/env_instrumentitem_impl.cc @@ -0,0 +1,113 @@ +#include +#include "artsmodulescommon.h" +#include "debug.h" +#include "env_item_impl.h" +#include "connect.h" +#include "../runtime/sequenceutils.h" + +namespace Arts { +namespace Environment { + +class InstrumentItem_impl : virtual public InstrumentItem_skel, + virtual public Item_impl +{ +protected: + Synth_MIDI_TEST instrument; + bool running; + +public: + InstrumentItem_impl() : running(false) + { + } + ~InstrumentItem_impl() + { + /* this will allow freeing the instrument */ + if(running) + instrument.stop(); + } + void filename(const std::string& newFilename) + { + if(newFilename != instrument.filename()) + { + instrument.filename(newFilename); + filename_changed(newFilename); + + if(!running) { + instrument.start(); + running = true; + } + } + } + std::string filename() + { + return instrument.filename(); + } + void busname(const std::string& newBusname) + { + if(newBusname != instrument.busname()) + { + instrument.busname(newBusname); + busname_changed(newBusname); + } + } + std::string busname() + { + return instrument.busname(); + } + MidiPort port() + { + return instrument; + } + void loadFromList(const std::vector& list) + { + unsigned long i; + std::string cmd,param; + for(i=0;i *saveToList() + { + std::vector *result = new std::vector; + sqprintf(result,"filename=%s",filename().c_str()); + return result; + } +}; +REGISTER_IMPLEMENTATION(InstrumentItem_impl); + +class InstrumentItemGuiFactory_impl + : virtual public InstrumentItemGuiFactory_skel +{ +public: + Widget createGui(Object object) + { + arts_return_val_if_fail(!object.isNull(), Arts::Widget::null()); + + InstrumentItem instrument = DynamicCast(object); + arts_return_val_if_fail(!instrument.isNull(), Arts::Widget::null()); + + Widget panel; + panel.width(150); panel.height(60); panel.show(); + + LineEdit edit; + edit.x(20); edit.y(10); edit.width(120); edit.height(40); + edit.text(instrument.filename()); + edit.parent(panel); + edit.show(); + connect(edit,"text_changed", instrument, "filename"); + panel._addChild(edit,"editWidget"); + + return panel; + } +}; + +REGISTER_IMPLEMENTATION(InstrumentItemGuiFactory_impl); + +} +} -- cgit v1.2.1