1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ 2 3 /* 4 Rosegarden 5 A MIDI and audio sequencer and musical notation editor. 6 Copyright 2000-2021 the Rosegarden development team. 7 8 Other copyrights also apply to some parts of this work. Please 9 see the AUTHORS file and individual file headers for details. 10 11 This program is free software; you can redistribute it and/or 12 modify it under the terms of the GNU General Public License as 13 published by the Free Software Foundation; either version 2 of the 14 License, or (at your option) any later version. See the file 15 COPYING included with this distribution for more information. 16 */ 17 18 19 #include "InstrumentParameterPanel.h" 20 21 #include "base/Instrument.h" 22 #include "gui/widgets/SqueezedLabel.h" 23 #include "gui/application/RosegardenMainWindow.h" 24 25 #include <QFrame> 26 #include <QWidget> 27 28 29 namespace Rosegarden 30 { 31 32 InstrumentParameterPanel::InstrumentParameterPanel(QWidget *parent) : 33 QFrame(parent), 34 m_instrumentLabel(new SqueezedLabel(this)), 35 m_selectedInstrument(nullptr) 36 { 37 } 38 39 void 40 InstrumentParameterPanel::setSelectedInstrument(Instrument *instrument) 41 { 42 m_selectedInstrument = instrument; 43 if (instrument) { 44 // Make instrument tell us if it gets destroyed. 45 connect(instrument, &QObject::destroyed, 46 this, &InstrumentParameterPanel::slotInstrumentGone); 47 } 48 } 49 50 Instrument * 51 InstrumentParameterPanel::getSelectedInstrument() 52 { 53 return m_selectedInstrument; 54 } 55 56 void 57 InstrumentParameterPanel:: 58 slotInstrumentGone() 59 { 60 m_selectedInstrument = nullptr; 61 m_instrumentLabel->setText(tr("none")); 62 } 63 64 65 } 66 67