1 |
// qsamplerMainForm.cpp |
// qsamplerMainForm.cpp |
2 |
// |
// |
3 |
/**************************************************************************** |
/**************************************************************************** |
4 |
Copyright (C) 2004-2008, rncbc aka Rui Nuno Capela. All rights reserved. |
Copyright (C) 2004-2015, rncbc aka Rui Nuno Capela. All rights reserved. |
5 |
Copyright (C) 2007, 2008 Christian Schoenebeck |
Copyright (C) 2007,2008,2015 Christian Schoenebeck |
6 |
|
|
7 |
This program is free software; you can redistribute it and/or |
This program is free software; you can redistribute it and/or |
8 |
modify it under the terms of the GNU General Public License |
modify it under the terms of the GNU General Public License |
35 |
#include "qsamplerOptionsForm.h" |
#include "qsamplerOptionsForm.h" |
36 |
#include "qsamplerDeviceStatusForm.h" |
#include "qsamplerDeviceStatusForm.h" |
37 |
|
|
38 |
|
#include <QMdiArea> |
39 |
|
#include <QMdiSubWindow> |
40 |
|
|
41 |
#include <QApplication> |
#include <QApplication> |
|
#include <QWorkspace> |
|
42 |
#include <QProcess> |
#include <QProcess> |
43 |
#include <QMessageBox> |
#include <QMessageBox> |
44 |
|
|
58 |
#include <QTimer> |
#include <QTimer> |
59 |
#include <QDateTime> |
#include <QDateTime> |
60 |
|
|
61 |
|
#if QT_VERSION >= 0x050000 |
62 |
|
#include <QMimeData> |
63 |
|
#endif |
64 |
|
|
65 |
|
#if QT_VERSION < 0x040500 |
66 |
|
namespace Qt { |
67 |
|
const WindowFlags WindowCloseButtonHint = WindowFlags(0x08000000); |
68 |
|
} |
69 |
|
#endif |
70 |
|
|
71 |
#ifdef HAVE_SIGNAL_H |
#ifdef HAVE_SIGNAL_H |
72 |
#include <signal.h> |
#include <signal.h> |
96 |
#endif |
#endif |
97 |
|
|
98 |
|
|
99 |
|
//------------------------------------------------------------------------- |
100 |
|
// LADISH Level 1 support stuff. |
101 |
|
|
102 |
|
#if defined(HAVE_SIGNAL_H) && defined(HAVE_SYS_SOCKET_H) |
103 |
|
|
104 |
|
#include <QSocketNotifier> |
105 |
|
|
106 |
|
#include <sys/types.h> |
107 |
|
#include <sys/socket.h> |
108 |
|
|
109 |
|
#include <signal.h> |
110 |
|
|
111 |
|
// File descriptor for SIGUSR1 notifier. |
112 |
|
static int g_fdUsr1[2]; |
113 |
|
|
114 |
|
// Unix SIGUSR1 signal handler. |
115 |
|
static void qsampler_sigusr1_handler ( int /* signo */ ) |
116 |
|
{ |
117 |
|
char c = 1; |
118 |
|
|
119 |
|
(::write(g_fdUsr1[0], &c, sizeof(c)) > 0); |
120 |
|
} |
121 |
|
|
122 |
|
#endif // HAVE_SIGNAL_H |
123 |
|
|
124 |
|
|
125 |
|
//------------------------------------------------------------------------- |
126 |
|
// qsampler -- namespace |
127 |
|
|
128 |
|
|
129 |
namespace QSampler { |
namespace QSampler { |
130 |
|
|
131 |
// Timer constant stuff. |
// Timer constant stuff. |
138 |
#define QSAMPLER_STATUS_SESSION 3 // Current session modification state. |
#define QSAMPLER_STATUS_SESSION 3 // Current session modification state. |
139 |
|
|
140 |
|
|
141 |
|
// Specialties for thread-callback comunication. |
142 |
|
#define QSAMPLER_LSCP_EVENT QEvent::Type(QEvent::User + 1) |
143 |
|
|
144 |
|
|
145 |
//------------------------------------------------------------------------- |
//------------------------------------------------------------------------- |
146 |
// CustomEvent -- specialty for callback comunication. |
// LscpEvent -- specialty for LSCP callback comunication. |
147 |
|
|
|
#define QSAMPLER_CUSTOM_EVENT QEvent::Type(QEvent::User + 0) |
|
148 |
|
|
149 |
class CustomEvent : public QEvent |
class LscpEvent : public QEvent |
150 |
{ |
{ |
151 |
public: |
public: |
152 |
|
|
153 |
// Constructor. |
// Constructor. |
154 |
CustomEvent(lscp_event_t event, const char *pchData, int cchData) |
LscpEvent(lscp_event_t event, const char *pchData, int cchData) |
155 |
: QEvent(QSAMPLER_CUSTOM_EVENT) |
: QEvent(QSAMPLER_LSCP_EVENT) |
156 |
{ |
{ |
157 |
m_event = event; |
m_event = event; |
158 |
m_data = QString::fromUtf8(pchData, cchData); |
m_data = QString::fromUtf8(pchData, cchData); |
205 |
|
|
206 |
m_iTimerSlot = 0; |
m_iTimerSlot = 0; |
207 |
|
|
208 |
#ifdef HAVE_SIGNAL_H |
#if defined(HAVE_SIGNAL_H) && defined(HAVE_SYS_SOCKET_H) |
209 |
|
|
210 |
// Set to ignore any fatal "Broken pipe" signals. |
// Set to ignore any fatal "Broken pipe" signals. |
211 |
::signal(SIGPIPE, SIG_IGN); |
::signal(SIGPIPE, SIG_IGN); |
212 |
#endif |
|
213 |
|
// LADISH Level 1 suport. |
214 |
|
|
215 |
|
// Initialize file descriptors for SIGUSR1 socket notifier. |
216 |
|
::socketpair(AF_UNIX, SOCK_STREAM, 0, g_fdUsr1); |
217 |
|
m_pUsr1Notifier |
218 |
|
= new QSocketNotifier(g_fdUsr1[1], QSocketNotifier::Read, this); |
219 |
|
|
220 |
|
QObject::connect(m_pUsr1Notifier, |
221 |
|
SIGNAL(activated(int)), |
222 |
|
SLOT(handle_sigusr1())); |
223 |
|
|
224 |
|
// Install SIGUSR1 signal handler. |
225 |
|
struct sigaction usr1; |
226 |
|
usr1.sa_handler = qsampler_sigusr1_handler; |
227 |
|
sigemptyset(&usr1.sa_mask); |
228 |
|
usr1.sa_flags = 0; |
229 |
|
usr1.sa_flags |= SA_RESTART; |
230 |
|
::sigaction(SIGUSR1, &usr1, NULL); |
231 |
|
|
232 |
|
#else // HAVE_SIGNAL_H |
233 |
|
|
234 |
|
m_pUsr1Notifier = NULL; |
235 |
|
|
236 |
|
#endif // !HAVE_SIGNAL_H |
237 |
|
|
238 |
#ifdef CONFIG_VOLUME |
#ifdef CONFIG_VOLUME |
239 |
// Make some extras into the toolbar... |
// Make some extras into the toolbar... |
254 |
QObject::connect(m_pVolumeSlider, |
QObject::connect(m_pVolumeSlider, |
255 |
SIGNAL(valueChanged(int)), |
SIGNAL(valueChanged(int)), |
256 |
SLOT(volumeChanged(int))); |
SLOT(volumeChanged(int))); |
|
//m_ui.channelsToolbar->setHorizontallyStretchable(true); |
|
|
//m_ui.channelsToolbar->setStretchableWidget(m_pVolumeSlider); |
|
257 |
m_ui.channelsToolbar->addWidget(m_pVolumeSlider); |
m_ui.channelsToolbar->addWidget(m_pVolumeSlider); |
258 |
// Volume spin-box |
// Volume spin-box |
259 |
m_ui.channelsToolbar->addSeparator(); |
m_ui.channelsToolbar->addSeparator(); |
260 |
m_pVolumeSpinBox = new QSpinBox(m_ui.channelsToolbar); |
m_pVolumeSpinBox = new QSpinBox(m_ui.channelsToolbar); |
|
m_pVolumeSpinBox->setMaximumHeight(24); |
|
261 |
m_pVolumeSpinBox->setSuffix(" %"); |
m_pVolumeSpinBox->setSuffix(" %"); |
262 |
m_pVolumeSpinBox->setMinimum(0); |
m_pVolumeSpinBox->setMinimum(0); |
263 |
m_pVolumeSpinBox->setMaximum(100); |
m_pVolumeSpinBox->setMaximum(100); |
269 |
#endif |
#endif |
270 |
|
|
271 |
// Make it an MDI workspace. |
// Make it an MDI workspace. |
272 |
m_pWorkspace = new QWorkspace(this); |
m_pWorkspace = new QMdiArea(this); |
273 |
m_pWorkspace->setScrollBarsEnabled(true); |
m_pWorkspace->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded); |
274 |
|
m_pWorkspace->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded); |
275 |
// Set the activation connection. |
// Set the activation connection. |
276 |
QObject::connect(m_pWorkspace, |
QObject::connect(m_pWorkspace, |
277 |
SIGNAL(windowActivated(QWidget *)), |
SIGNAL(subWindowActivated(QMdiSubWindow *)), |
278 |
SLOT(activateStrip(QWidget *))); |
SLOT(activateStrip(QMdiSubWindow *))); |
279 |
// Make it shine :-) |
// Make it shine :-) |
280 |
setCentralWidget(m_pWorkspace); |
setCentralWidget(m_pWorkspace); |
281 |
|
|
392 |
QObject::connect(m_ui.channelsMenu, |
QObject::connect(m_ui.channelsMenu, |
393 |
SIGNAL(aboutToShow()), |
SIGNAL(aboutToShow()), |
394 |
SLOT(channelsMenuAboutToShow())); |
SLOT(channelsMenuAboutToShow())); |
395 |
|
#ifdef CONFIG_VOLUME |
396 |
|
QObject::connect(m_ui.channelsToolbar, |
397 |
|
SIGNAL(orientationChanged(Qt::Orientation)), |
398 |
|
SLOT(channelsToolbarOrientation(Qt::Orientation))); |
399 |
|
#endif |
400 |
} |
} |
401 |
|
|
402 |
// Destructor. |
// Destructor. |
409 |
WSACleanup(); |
WSACleanup(); |
410 |
#endif |
#endif |
411 |
|
|
412 |
|
#if defined(HAVE_SIGNAL_H) && defined(HAVE_SYS_SOCKET_H) |
413 |
|
if (m_pUsr1Notifier) |
414 |
|
delete m_pUsr1Notifier; |
415 |
|
#endif |
416 |
|
|
417 |
// Finally drop any widgets around... |
// Finally drop any widgets around... |
418 |
if (m_pDeviceForm) |
if (m_pDeviceForm) |
419 |
delete m_pDeviceForm; |
delete m_pDeviceForm; |
452 |
|
|
453 |
// What style do we create these forms? |
// What style do we create these forms? |
454 |
Qt::WindowFlags wflags = Qt::Window |
Qt::WindowFlags wflags = Qt::Window |
|
#if QT_VERSION >= 0x040200 |
|
455 |
| Qt::CustomizeWindowHint |
| Qt::CustomizeWindowHint |
|
#endif |
|
456 |
| Qt::WindowTitleHint |
| Qt::WindowTitleHint |
457 |
| Qt::WindowSystemMenuHint |
| Qt::WindowSystemMenuHint |
458 |
| Qt::WindowMinMaxButtonsHint; |
| Qt::WindowMinMaxButtonsHint |
459 |
|
| Qt::WindowCloseButtonHint; |
460 |
if (m_pOptions->bKeepOnTop) |
if (m_pOptions->bKeepOnTop) |
461 |
wflags |= Qt::Tool; |
wflags |= Qt::Tool; |
462 |
|
|
463 |
// Some child forms are to be created right now. |
// Some child forms are to be created right now. |
464 |
m_pMessages = new Messages(this); |
m_pMessages = new Messages(this); |
465 |
m_pDeviceForm = new DeviceForm(this, wflags); |
m_pDeviceForm = new DeviceForm(this, wflags); |
466 |
#ifdef CONFIG_MIDI_INSTRUMENT |
#ifdef CONFIG_MIDI_INSTRUMENT |
467 |
m_pInstrumentListForm = new InstrumentListForm(this, wflags); |
m_pInstrumentListForm = new InstrumentListForm(this, wflags); |
468 |
#else |
#else |
469 |
viewInstrumentsAction->setEnabled(false); |
m_ui.viewInstrumentsAction->setEnabled(false); |
470 |
#endif |
#endif |
471 |
|
|
472 |
// Setup messages logging appropriately... |
// Setup messages logging appropriately... |
473 |
m_pMessages->setLogging( |
m_pMessages->setLogging( |
474 |
m_pOptions->bMessagesLog, |
m_pOptions->bMessagesLog, |
475 |
m_pOptions->sMessagesLogPath); |
m_pOptions->sMessagesLogPath); |
476 |
|
|
477 |
// Set message defaults... |
// Set message defaults... |
478 |
updateMessagesFont(); |
updateMessagesFont(); |
479 |
updateMessagesLimit(); |
updateMessagesLimit(); |
504 |
} |
} |
505 |
|
|
506 |
// Try to restore old window positioning and initial visibility. |
// Try to restore old window positioning and initial visibility. |
507 |
m_pOptions->loadWidgetGeometry(this); |
m_pOptions->loadWidgetGeometry(this, true); |
508 |
m_pOptions->loadWidgetGeometry(m_pInstrumentListForm); |
m_pOptions->loadWidgetGeometry(m_pInstrumentListForm); |
509 |
m_pOptions->loadWidgetGeometry(m_pDeviceForm); |
m_pOptions->loadWidgetGeometry(m_pDeviceForm); |
510 |
|
|
548 |
// And the children, and the main windows state,. |
// And the children, and the main windows state,. |
549 |
m_pOptions->saveWidgetGeometry(m_pDeviceForm); |
m_pOptions->saveWidgetGeometry(m_pDeviceForm); |
550 |
m_pOptions->saveWidgetGeometry(m_pInstrumentListForm); |
m_pOptions->saveWidgetGeometry(m_pInstrumentListForm); |
551 |
m_pOptions->saveWidgetGeometry(this); |
m_pOptions->saveWidgetGeometry(this, true); |
552 |
// Close popup widgets. |
// Close popup widgets. |
553 |
if (m_pInstrumentListForm) |
if (m_pInstrumentListForm) |
554 |
m_pInstrumentListForm->close(); |
m_pInstrumentListForm->close(); |
597 |
QListIterator<QUrl> iter(pMimeData->urls()); |
QListIterator<QUrl> iter(pMimeData->urls()); |
598 |
while (iter.hasNext()) { |
while (iter.hasNext()) { |
599 |
const QString& sPath = iter.next().toLocalFile(); |
const QString& sPath = iter.next().toLocalFile(); |
600 |
if (Channel::isInstrumentFile(sPath)) { |
// if (Channel::isDlsInstrumentFile(sPath)) { |
601 |
|
if (QFileInfo(sPath).exists()) { |
602 |
// Try to create a new channel from instrument file... |
// Try to create a new channel from instrument file... |
603 |
Channel *pChannel = new Channel(); |
Channel *pChannel = new Channel(); |
604 |
if (pChannel == NULL) |
if (pChannel == NULL) |
632 |
|
|
633 |
|
|
634 |
// Custome event handler. |
// Custome event handler. |
635 |
void MainForm::customEvent(QEvent* pCustomEvent) |
void MainForm::customEvent ( QEvent* pEvent ) |
636 |
{ |
{ |
637 |
// For the time being, just pump it to messages. |
// For the time being, just pump it to messages. |
638 |
if (pCustomEvent->type() == QSAMPLER_CUSTOM_EVENT) { |
if (pEvent->type() == QSAMPLER_LSCP_EVENT) { |
639 |
CustomEvent *pEvent = static_cast<CustomEvent *> (pCustomEvent); |
LscpEvent *pLscpEvent = static_cast<LscpEvent *> (pEvent); |
640 |
switch (pEvent->event()) { |
switch (pLscpEvent->event()) { |
641 |
case LSCP_EVENT_CHANNEL_COUNT: |
case LSCP_EVENT_CHANNEL_COUNT: |
642 |
updateAllChannelStrips(true); |
updateAllChannelStrips(true); |
643 |
break; |
break; |
644 |
case LSCP_EVENT_CHANNEL_INFO: { |
case LSCP_EVENT_CHANNEL_INFO: { |
645 |
int iChannelID = pEvent->data().toInt(); |
int iChannelID = pLscpEvent->data().toInt(); |
646 |
ChannelStrip *pChannelStrip = channelStrip(iChannelID); |
ChannelStrip *pChannelStrip = channelStrip(iChannelID); |
647 |
if (pChannelStrip) |
if (pChannelStrip) |
648 |
channelStripChanged(pChannelStrip); |
channelStripChanged(pChannelStrip); |
655 |
break; |
break; |
656 |
case LSCP_EVENT_MIDI_INPUT_DEVICE_INFO: { |
case LSCP_EVENT_MIDI_INPUT_DEVICE_INFO: { |
657 |
if (m_pDeviceForm) m_pDeviceForm->refreshDevices(); |
if (m_pDeviceForm) m_pDeviceForm->refreshDevices(); |
658 |
const int iDeviceID = pEvent->data().section(' ', 0, 0).toInt(); |
const int iDeviceID = pLscpEvent->data().section(' ', 0, 0).toInt(); |
659 |
DeviceStatusForm::onDeviceChanged(iDeviceID); |
DeviceStatusForm::onDeviceChanged(iDeviceID); |
660 |
break; |
break; |
661 |
} |
} |
665 |
case LSCP_EVENT_AUDIO_OUTPUT_DEVICE_INFO: |
case LSCP_EVENT_AUDIO_OUTPUT_DEVICE_INFO: |
666 |
if (m_pDeviceForm) m_pDeviceForm->refreshDevices(); |
if (m_pDeviceForm) m_pDeviceForm->refreshDevices(); |
667 |
break; |
break; |
668 |
#if CONFIG_EVENT_CHANNEL_MIDI |
#if CONFIG_EVENT_CHANNEL_MIDI |
669 |
case LSCP_EVENT_CHANNEL_MIDI: { |
case LSCP_EVENT_CHANNEL_MIDI: { |
670 |
const int iChannelID = pEvent->data().section(' ', 0, 0).toInt(); |
const int iChannelID = pLscpEvent->data().section(' ', 0, 0).toInt(); |
671 |
ChannelStrip *pChannelStrip = channelStrip(iChannelID); |
ChannelStrip *pChannelStrip = channelStrip(iChannelID); |
672 |
if (pChannelStrip) |
if (pChannelStrip) |
673 |
pChannelStrip->midiArrived(); |
pChannelStrip->midiActivityLedOn(); |
674 |
break; |
break; |
675 |
} |
} |
676 |
#endif |
#endif |
677 |
#if CONFIG_EVENT_DEVICE_MIDI |
#if CONFIG_EVENT_DEVICE_MIDI |
678 |
case LSCP_EVENT_DEVICE_MIDI: { |
case LSCP_EVENT_DEVICE_MIDI: { |
679 |
const int iDeviceID = pEvent->data().section(' ', 0, 0).toInt(); |
const int iDeviceID = pLscpEvent->data().section(' ', 0, 0).toInt(); |
680 |
const int iPortID = pEvent->data().section(' ', 1, 1).toInt(); |
const int iPortID = pLscpEvent->data().section(' ', 1, 1).toInt(); |
681 |
DeviceStatusForm* pDeviceStatusForm = |
DeviceStatusForm *pDeviceStatusForm |
682 |
DeviceStatusForm::getInstance(iDeviceID); |
= DeviceStatusForm::getInstance(iDeviceID); |
683 |
if (pDeviceStatusForm) |
if (pDeviceStatusForm) |
684 |
pDeviceStatusForm->midiArrived(iPortID); |
pDeviceStatusForm->midiArrived(iPortID); |
685 |
break; |
break; |
686 |
} |
} |
687 |
#endif |
#endif |
688 |
default: |
default: |
689 |
appendMessagesColor(tr("Notify event: %1 data: %2") |
appendMessagesColor(tr("LSCP Event: %1 data: %2") |
690 |
.arg(::lscp_event_to_text(pEvent->event())) |
.arg(::lscp_event_to_text(pLscpEvent->event())) |
691 |
.arg(pEvent->data()), "#996699"); |
.arg(pLscpEvent->data()), "#996699"); |
692 |
} |
} |
693 |
} |
} |
694 |
} |
} |
695 |
|
|
696 |
void MainForm::updateViewMidiDeviceStatusMenu() { |
|
697 |
|
// LADISH Level 1 -- SIGUSR1 signal handler. |
698 |
|
void MainForm::handle_sigusr1 (void) |
699 |
|
{ |
700 |
|
#if defined(HAVE_SIGNAL_H) && defined(HAVE_SYS_SOCKET_H) |
701 |
|
|
702 |
|
char c; |
703 |
|
|
704 |
|
if (::read(g_fdUsr1[1], &c, sizeof(c)) > 0) |
705 |
|
saveSession(false); |
706 |
|
|
707 |
|
#endif |
708 |
|
} |
709 |
|
|
710 |
|
|
711 |
|
void MainForm::updateViewMidiDeviceStatusMenu (void) |
712 |
|
{ |
713 |
m_ui.viewMidiDeviceStatusMenu->clear(); |
m_ui.viewMidiDeviceStatusMenu->clear(); |
714 |
const std::map<int, DeviceStatusForm*> statusForms = |
const std::map<int, DeviceStatusForm *> statusForms |
715 |
DeviceStatusForm::getInstances(); |
= DeviceStatusForm::getInstances(); |
716 |
for ( |
std::map<int, DeviceStatusForm *>::const_iterator iter |
717 |
std::map<int, DeviceStatusForm*>::const_iterator iter = statusForms.begin(); |
= statusForms.begin(); |
718 |
iter != statusForms.end(); ++iter |
for ( ; iter != statusForms.end(); ++iter) { |
719 |
) { |
DeviceStatusForm *pStatusForm = iter->second; |
|
DeviceStatusForm* pForm = iter->second; |
|
720 |
m_ui.viewMidiDeviceStatusMenu->addAction( |
m_ui.viewMidiDeviceStatusMenu->addAction( |
721 |
pForm->visibleAction() |
pStatusForm->visibleAction()); |
|
); |
|
722 |
} |
} |
723 |
} |
} |
724 |
|
|
725 |
|
|
726 |
// Context menu event handler. |
// Context menu event handler. |
727 |
void MainForm::contextMenuEvent( QContextMenuEvent *pEvent ) |
void MainForm::contextMenuEvent( QContextMenuEvent *pEvent ) |
728 |
{ |
{ |
854 |
"\"%1\"\n\n" |
"\"%1\"\n\n" |
855 |
"Do you want to replace it?") |
"Do you want to replace it?") |
856 |
.arg(sFilename), |
.arg(sFilename), |
857 |
tr("Replace"), tr("Cancel")) > 0) |
QMessageBox::Yes | QMessageBox::No) |
858 |
|
== QMessageBox::No) |
859 |
return false; |
return false; |
860 |
} |
} |
861 |
} |
} |
878 |
"\"%1\"\n\n" |
"\"%1\"\n\n" |
879 |
"Do you want to save the changes?") |
"Do you want to save the changes?") |
880 |
.arg(sessionName(m_sFilename)), |
.arg(sessionName(m_sFilename)), |
881 |
tr("Save"), tr("Discard"), tr("Cancel"))) { |
QMessageBox::Save | |
882 |
case 0: // Save... |
QMessageBox::Discard | |
883 |
|
QMessageBox::Cancel)) { |
884 |
|
case QMessageBox::Save: |
885 |
bClose = saveSession(false); |
bClose = saveSession(false); |
886 |
// Fall thru.... |
// Fall thru.... |
887 |
case 1: // Discard |
case QMessageBox::Discard: |
888 |
break; |
break; |
889 |
default: // Cancel. |
default: // Cancel. |
890 |
bClose = false; |
bClose = false; |
896 |
if (bClose) { |
if (bClose) { |
897 |
// Remove all channel strips from sight... |
// Remove all channel strips from sight... |
898 |
m_pWorkspace->setUpdatesEnabled(false); |
m_pWorkspace->setUpdatesEnabled(false); |
899 |
QWidgetList wlist = m_pWorkspace->windowList(); |
QList<QMdiSubWindow *> wlist = m_pWorkspace->subWindowList(); |
900 |
for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) { |
for (int iChannel = 0; iChannel < (int) wlist.count(); ++iChannel) { |
901 |
ChannelStrip *pChannelStrip = (ChannelStrip*) wlist.at(iChannel); |
ChannelStrip *pChannelStrip = NULL; |
902 |
|
QMdiSubWindow *pMdiSubWindow = wlist.at(iChannel); |
903 |
|
if (pMdiSubWindow) |
904 |
|
pChannelStrip = static_cast<ChannelStrip *> (pMdiSubWindow->widget()); |
905 |
if (pChannelStrip) { |
if (pChannelStrip) { |
906 |
Channel *pChannel = pChannelStrip->channel(); |
Channel *pChannel = pChannelStrip->channel(); |
907 |
if (bForce && pChannel) |
if (bForce && pChannel) |
908 |
pChannel->removeChannel(); |
pChannel->removeChannel(); |
909 |
delete pChannelStrip; |
delete pChannelStrip; |
910 |
} |
} |
911 |
|
if (pMdiSubWindow) |
912 |
|
delete pMdiSubWindow; |
913 |
} |
} |
914 |
m_pWorkspace->setUpdatesEnabled(true); |
m_pWorkspace->setUpdatesEnabled(true); |
915 |
// We're now clean, for sure. |
// We're now clean, for sure. |
1200 |
#endif // CONFIG_MIDI_INSTRUMENT |
#endif // CONFIG_MIDI_INSTRUMENT |
1201 |
|
|
1202 |
// Sampler channel mapping. |
// Sampler channel mapping. |
1203 |
QWidgetList wlist = m_pWorkspace->windowList(); |
QList<QMdiSubWindow *> wlist = m_pWorkspace->subWindowList(); |
1204 |
for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) { |
for (int iChannel = 0; iChannel < (int) wlist.count(); ++iChannel) { |
1205 |
ChannelStrip* pChannelStrip |
ChannelStrip *pChannelStrip = NULL; |
1206 |
= static_cast<ChannelStrip *> (wlist.at(iChannel)); |
QMdiSubWindow *pMdiSubWindow = wlist.at(iChannel); |
1207 |
|
if (pMdiSubWindow) |
1208 |
|
pChannelStrip = static_cast<ChannelStrip *> (pMdiSubWindow->widget()); |
1209 |
if (pChannelStrip) { |
if (pChannelStrip) { |
1210 |
Channel *pChannel = pChannelStrip->channel(); |
Channel *pChannel = pChannelStrip->channel(); |
1211 |
if (pChannel) { |
if (pChannel) { |
1253 |
ts << "SET CHANNEL MUTE " << iChannel << " 1" << endl; |
ts << "SET CHANNEL MUTE " << iChannel << " 1" << endl; |
1254 |
if (pChannel->channelSolo()) |
if (pChannel->channelSolo()) |
1255 |
ts << "SET CHANNEL SOLO " << iChannel << " 1" << endl; |
ts << "SET CHANNEL SOLO " << iChannel << " 1" << endl; |
1256 |
#ifdef CONFIG_MIDI_INSTRUMENT |
#ifdef CONFIG_MIDI_INSTRUMENT |
1257 |
if (pChannel->midiMap() >= 0) { |
if (pChannel->midiMap() >= 0) { |
1258 |
ts << "SET CHANNEL MIDI_INSTRUMENT_MAP " << iChannel |
ts << "SET CHANNEL MIDI_INSTRUMENT_MAP " << iChannel |
1259 |
<< " " << midiInstrumentMap[pChannel->midiMap()] << endl; |
<< " " << midiInstrumentMap[pChannel->midiMap()] << endl; |
1260 |
} |
} |
1261 |
#endif |
#endif |
1262 |
#ifdef CONFIG_FXSEND |
#ifdef CONFIG_FXSEND |
1263 |
int iChannelID = pChannel->channelID(); |
int iChannelID = pChannel->channelID(); |
1264 |
int *piFxSends = ::lscp_list_fxsends(m_pClient, iChannelID); |
int *piFxSends = ::lscp_list_fxsends(m_pClient, iChannelID); |
1265 |
for (int iFxSend = 0; |
for (int iFxSend = 0; |
1283 |
<< " " << iAudioSrc |
<< " " << iAudioSrc |
1284 |
<< " " << piRouting[iAudioSrc] << endl; |
<< " " << piRouting[iAudioSrc] << endl; |
1285 |
} |
} |
1286 |
#ifdef CONFIG_FXSEND_LEVEL |
#ifdef CONFIG_FXSEND_LEVEL |
1287 |
ts << "SET FX_SEND LEVEL " << iChannel |
ts << "SET FX_SEND LEVEL " << iChannel |
1288 |
<< " " << iFxSend |
<< " " << iFxSend |
1289 |
<< " " << pFxSendInfo->level << endl; |
<< " " << pFxSendInfo->level << endl; |
1290 |
#endif |
#endif |
1291 |
} // Check for errors... |
} // Check for errors... |
1292 |
else if (::lscp_client_get_errno(m_pClient)) { |
else if (::lscp_client_get_errno(m_pClient)) { |
1293 |
appendMessagesClient("lscp_get_fxsend_info"); |
appendMessagesClient("lscp_get_fxsend_info"); |
1294 |
iErrors++; |
iErrors++; |
1295 |
} |
} |
1296 |
} |
} |
1297 |
#endif |
#endif |
1298 |
ts << endl; |
ts << endl; |
1299 |
} |
} |
1300 |
} |
} |
1405 |
return; |
return; |
1406 |
|
|
1407 |
// Ask user whether he/she want's an internal sampler reset... |
// Ask user whether he/she want's an internal sampler reset... |
1408 |
if (QMessageBox::warning(this, |
if (m_pOptions && m_pOptions->bConfirmReset) { |
1409 |
QSAMPLER_TITLE ": " + tr("Warning"), |
const QString& sTitle = QSAMPLER_TITLE ": " + tr("Warning"); |
1410 |
tr("Resetting the sampler instance will close\n" |
const QString& sText = tr( |
1411 |
"all device and channel configurations.\n\n" |
"Resetting the sampler instance will close\n" |
1412 |
"Please note that this operation may cause\n" |
"all device and channel configurations.\n\n" |
1413 |
"temporary MIDI and Audio disruption.\n\n" |
"Please note that this operation may cause\n" |
1414 |
"Do you want to reset the sampler engine now?"), |
"temporary MIDI and Audio disruption.\n\n" |
1415 |
tr("Reset"), tr("Cancel")) > 0) |
"Do you want to reset the sampler engine now?"); |
1416 |
return; |
#if 0 |
1417 |
|
if (QMessageBox::warning(this, sTitle, sText, |
1418 |
|
QMessageBox::Ok | QMessageBox::Cancel) == QMessageBox::Cancel) |
1419 |
|
return; |
1420 |
|
#else |
1421 |
|
QMessageBox mbox(this); |
1422 |
|
mbox.setIcon(QMessageBox::Warning); |
1423 |
|
mbox.setWindowTitle(sTitle); |
1424 |
|
mbox.setText(sText); |
1425 |
|
mbox.setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel); |
1426 |
|
QCheckBox cbox(tr("Don't ask this again")); |
1427 |
|
cbox.setChecked(false); |
1428 |
|
cbox.blockSignals(true); |
1429 |
|
mbox.addButton(&cbox, QMessageBox::ActionRole); |
1430 |
|
if (mbox.exec() == QMessageBox::Cancel) |
1431 |
|
return; |
1432 |
|
if (cbox.isChecked()) |
1433 |
|
m_pOptions->bConfirmReset = false; |
1434 |
|
#endif |
1435 |
|
} |
1436 |
|
|
1437 |
// Trye closing the current session, first... |
// Trye closing the current session, first... |
1438 |
if (!closeSession(true)) |
if (!closeSession(true)) |
1464 |
|
|
1465 |
// Ask user whether he/she want's a complete restart... |
// Ask user whether he/she want's a complete restart... |
1466 |
// (if we're currently up and running) |
// (if we're currently up and running) |
1467 |
if (bRestart && m_pClient) { |
if (m_pOptions && m_pOptions->bConfirmRestart) { |
1468 |
bRestart = (QMessageBox::warning(this, |
const QString& sTitle = QSAMPLER_TITLE ": " + tr("Warning"); |
1469 |
QSAMPLER_TITLE ": " + tr("Warning"), |
const QString& sText = tr( |
1470 |
tr("New settings will be effective after\n" |
"New settings will be effective after\n" |
1471 |
"restarting the client/server connection.\n\n" |
"restarting the client/server connection.\n\n" |
1472 |
"Please note that this operation may cause\n" |
"Please note that this operation may cause\n" |
1473 |
"temporary MIDI and Audio disruption.\n\n" |
"temporary MIDI and Audio disruption.\n\n" |
1474 |
"Do you want to restart the connection now?"), |
"Do you want to restart the connection now?"); |
1475 |
tr("Restart"), tr("Cancel")) == 0); |
#if 0 |
1476 |
|
if (QMessageBox::warning(this, sTitle, sText, |
1477 |
|
QMessageBox::Ok | QMessageBox::Cancel) == QMessageBox::Cancel) |
1478 |
|
bRestart = false; |
1479 |
|
#else |
1480 |
|
QMessageBox mbox(this); |
1481 |
|
mbox.setIcon(QMessageBox::Warning); |
1482 |
|
mbox.setWindowTitle(sTitle); |
1483 |
|
mbox.setText(sText); |
1484 |
|
mbox.setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel); |
1485 |
|
QCheckBox cbox(tr("Don't ask this again")); |
1486 |
|
cbox.setChecked(false); |
1487 |
|
cbox.blockSignals(true); |
1488 |
|
mbox.addButton(&cbox, QMessageBox::ActionRole); |
1489 |
|
if (mbox.exec() == QMessageBox::Cancel) |
1490 |
|
bRestart = false; |
1491 |
|
else |
1492 |
|
if (cbox.isChecked()) |
1493 |
|
m_pOptions->bConfirmRestart = false; |
1494 |
|
#endif |
1495 |
} |
} |
1496 |
|
|
1497 |
// Are we still for it? |
// Are we still for it? |
1556 |
if (m_pClient == NULL) |
if (m_pClient == NULL) |
1557 |
return; |
return; |
1558 |
|
|
1559 |
ChannelStrip* pChannelStrip = activeChannelStrip(); |
ChannelStrip *pChannelStrip = activeChannelStrip(); |
1560 |
if (pChannelStrip == NULL) |
if (pChannelStrip == NULL) |
1561 |
return; |
return; |
1562 |
|
|
1566 |
|
|
1567 |
// Prompt user if he/she's sure about this... |
// Prompt user if he/she's sure about this... |
1568 |
if (m_pOptions && m_pOptions->bConfirmRemove) { |
if (m_pOptions && m_pOptions->bConfirmRemove) { |
1569 |
if (QMessageBox::warning(this, |
const QString& sTitle = QSAMPLER_TITLE ": " + tr("Warning"); |
1570 |
QSAMPLER_TITLE ": " + tr("Warning"), |
const QString& sText = tr( |
1571 |
tr("About to remove channel:\n\n" |
"About to remove channel:\n\n" |
1572 |
"%1\n\n" |
"%1\n\n" |
1573 |
"Are you sure?") |
"Are you sure?") |
1574 |
.arg(pChannelStrip->windowTitle()), |
.arg(pChannelStrip->windowTitle()); |
1575 |
tr("OK"), tr("Cancel")) > 0) |
#if 0 |
1576 |
|
if (QMessageBox::warning(this, sTitle, sText, |
1577 |
|
QMessageBox::Ok | QMessageBox::Cancel) == QMessageBox::Cancel) |
1578 |
return; |
return; |
1579 |
|
#else |
1580 |
|
QMessageBox mbox(this); |
1581 |
|
mbox.setIcon(QMessageBox::Warning); |
1582 |
|
mbox.setWindowTitle(sTitle); |
1583 |
|
mbox.setText(sText); |
1584 |
|
mbox.setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel); |
1585 |
|
QCheckBox cbox(tr("Don't ask this again")); |
1586 |
|
cbox.setChecked(false); |
1587 |
|
cbox.blockSignals(true); |
1588 |
|
mbox.addButton(&cbox, QMessageBox::ActionRole); |
1589 |
|
if (mbox.exec() == QMessageBox::Cancel) |
1590 |
|
return; |
1591 |
|
if (cbox.isChecked()) |
1592 |
|
m_pOptions->bConfirmRemove = false; |
1593 |
|
#endif |
1594 |
} |
} |
1595 |
|
|
1596 |
// Remove the existing sampler channel. |
// Remove the existing sampler channel. |
1597 |
if (!pChannel->removeChannel()) |
if (!pChannel->removeChannel()) |
1598 |
return; |
return; |
1599 |
|
|
|
// Just delete the channel strip. |
|
|
delete pChannelStrip; |
|
|
|
|
|
// Do we auto-arrange? |
|
|
if (m_pOptions && m_pOptions->bAutoArrange) |
|
|
channelsArrange(); |
|
|
|
|
1600 |
// We'll be dirty, for sure... |
// We'll be dirty, for sure... |
1601 |
m_iDirtyCount++; |
m_iDirtyCount++; |
1602 |
stabilizeForm(); |
|
1603 |
|
// Just delete the channel strip. |
1604 |
|
destroyChannelStrip(pChannelStrip); |
1605 |
} |
} |
1606 |
|
|
1607 |
|
|
1611 |
if (m_pClient == NULL) |
if (m_pClient == NULL) |
1612 |
return; |
return; |
1613 |
|
|
1614 |
ChannelStrip* pChannelStrip = activeChannelStrip(); |
ChannelStrip *pChannelStrip = activeChannelStrip(); |
1615 |
if (pChannelStrip == NULL) |
if (pChannelStrip == NULL) |
1616 |
return; |
return; |
1617 |
|
|
1626 |
if (m_pClient == NULL) |
if (m_pClient == NULL) |
1627 |
return; |
return; |
1628 |
|
|
1629 |
ChannelStrip* pChannelStrip = activeChannelStrip(); |
ChannelStrip *pChannelStrip = activeChannelStrip(); |
1630 |
if (pChannelStrip == NULL) |
if (pChannelStrip == NULL) |
1631 |
return; |
return; |
1632 |
|
|
1641 |
if (m_pClient == NULL) |
if (m_pClient == NULL) |
1642 |
return; |
return; |
1643 |
|
|
1644 |
ChannelStrip* pChannelStrip = activeChannelStrip(); |
ChannelStrip *pChannelStrip = activeChannelStrip(); |
1645 |
if (pChannelStrip == NULL) |
if (pChannelStrip == NULL) |
1646 |
return; |
return; |
1647 |
|
|
1659 |
// Invoque the channel strip procedure, |
// Invoque the channel strip procedure, |
1660 |
// for all channels out there... |
// for all channels out there... |
1661 |
m_pWorkspace->setUpdatesEnabled(false); |
m_pWorkspace->setUpdatesEnabled(false); |
1662 |
QWidgetList wlist = m_pWorkspace->windowList(); |
QList<QMdiSubWindow *> wlist = m_pWorkspace->subWindowList(); |
1663 |
for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) { |
for (int iChannel = 0; iChannel < (int) wlist.count(); ++iChannel) { |
1664 |
ChannelStrip* pChannelStrip = (ChannelStrip*) wlist.at(iChannel); |
ChannelStrip *pChannelStrip = NULL; |
1665 |
|
QMdiSubWindow *pMdiSubWindow = wlist.at(iChannel); |
1666 |
|
if (pMdiSubWindow) |
1667 |
|
pChannelStrip = static_cast<ChannelStrip *> (pMdiSubWindow->widget()); |
1668 |
if (pChannelStrip) |
if (pChannelStrip) |
1669 |
pChannelStrip->channelReset(); |
pChannelStrip->channelReset(); |
1670 |
} |
} |
1767 |
OptionsForm* pOptionsForm = new OptionsForm(this); |
OptionsForm* pOptionsForm = new OptionsForm(this); |
1768 |
if (pOptionsForm) { |
if (pOptionsForm) { |
1769 |
// Check out some initial nullities(tm)... |
// Check out some initial nullities(tm)... |
1770 |
ChannelStrip* pChannelStrip = activeChannelStrip(); |
ChannelStrip *pChannelStrip = activeChannelStrip(); |
1771 |
if (m_pOptions->sDisplayFont.isEmpty() && pChannelStrip) |
if (m_pOptions->sDisplayFont.isEmpty() && pChannelStrip) |
1772 |
m_pOptions->sDisplayFont = pChannelStrip->displayFont().toString(); |
m_pOptions->sDisplayFont = pChannelStrip->displayFont().toString(); |
1773 |
if (m_pOptions->sMessagesFont.isEmpty() && m_pMessages) |
if (m_pOptions->sMessagesFont.isEmpty() && m_pMessages) |
1805 |
QMessageBox::information(this, |
QMessageBox::information(this, |
1806 |
QSAMPLER_TITLE ": " + tr("Information"), |
QSAMPLER_TITLE ": " + tr("Information"), |
1807 |
tr("Some settings may be only effective\n" |
tr("Some settings may be only effective\n" |
1808 |
"next time you start this program."), tr("OK")); |
"next time you start this program.")); |
1809 |
updateMessagesCapture(); |
updateMessagesCapture(); |
1810 |
} |
} |
1811 |
// Check wheather something immediate has changed. |
// Check wheather something immediate has changed. |
1860 |
void MainForm::channelsArrange (void) |
void MainForm::channelsArrange (void) |
1861 |
{ |
{ |
1862 |
// Full width vertical tiling |
// Full width vertical tiling |
1863 |
QWidgetList wlist = m_pWorkspace->windowList(); |
QList<QMdiSubWindow *> wlist = m_pWorkspace->subWindowList(); |
1864 |
if (wlist.isEmpty()) |
if (wlist.isEmpty()) |
1865 |
return; |
return; |
1866 |
|
|
1867 |
m_pWorkspace->setUpdatesEnabled(false); |
m_pWorkspace->setUpdatesEnabled(false); |
1868 |
int y = 0; |
int y = 0; |
1869 |
for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) { |
for (int iChannel = 0; iChannel < (int) wlist.count(); ++iChannel) { |
1870 |
ChannelStrip* pChannelStrip = (ChannelStrip*) wlist.at(iChannel); |
ChannelStrip *pChannelStrip = NULL; |
1871 |
/* if (pChannelStrip->testWState(WState_Maximized | WState_Minimized)) { |
QMdiSubWindow *pMdiSubWindow = wlist.at(iChannel); |
1872 |
// Prevent flicker... |
if (pMdiSubWindow) |
1873 |
pChannelStrip->hide(); |
pChannelStrip = static_cast<ChannelStrip *> (pMdiSubWindow->widget()); |
1874 |
pChannelStrip->showNormal(); |
if (pChannelStrip) { |
1875 |
} */ |
/* if (pChannelStrip->testWState(WState_Maximized | WState_Minimized)) { |
1876 |
pChannelStrip->adjustSize(); |
// Prevent flicker... |
1877 |
int iWidth = m_pWorkspace->width(); |
pChannelStrip->hide(); |
1878 |
if (iWidth < pChannelStrip->width()) |
pChannelStrip->showNormal(); |
1879 |
iWidth = pChannelStrip->width(); |
} */ |
1880 |
// int iHeight = pChannelStrip->height() |
pChannelStrip->adjustSize(); |
1881 |
// + pChannelStrip->parentWidget()->baseSize().height(); |
int iWidth = m_pWorkspace->width(); |
1882 |
int iHeight = pChannelStrip->parentWidget()->frameGeometry().height(); |
if (iWidth < pChannelStrip->width()) |
1883 |
pChannelStrip->parentWidget()->setGeometry(0, y, iWidth, iHeight); |
iWidth = pChannelStrip->width(); |
1884 |
y += iHeight; |
// int iHeight = pChannelStrip->height() |
1885 |
|
// + pChannelStrip->parentWidget()->baseSize().height(); |
1886 |
|
int iHeight = pChannelStrip->parentWidget()->frameGeometry().height(); |
1887 |
|
pChannelStrip->parentWidget()->setGeometry(0, y, iWidth, iHeight); |
1888 |
|
y += iHeight; |
1889 |
|
} |
1890 |
} |
} |
1891 |
m_pWorkspace->setUpdatesEnabled(true); |
m_pWorkspace->setUpdatesEnabled(true); |
1892 |
|
|
1973 |
sText += tr("Instrument editing support disabled."); |
sText += tr("Instrument editing support disabled."); |
1974 |
sText += "</font></small><br />"; |
sText += "</font></small><br />"; |
1975 |
#endif |
#endif |
1976 |
|
#ifndef CONFIG_EVENT_CHANNEL_MIDI |
1977 |
|
sText += "<small><font color=\"red\">"; |
1978 |
|
sText += tr("Channel MIDI event support disabled."); |
1979 |
|
sText += "</font></small><br />"; |
1980 |
|
#endif |
1981 |
|
#ifndef CONFIG_EVENT_DEVICE_MIDI |
1982 |
|
sText += "<small><font color=\"red\">"; |
1983 |
|
sText += tr("Device MIDI event support disabled."); |
1984 |
|
sText += "</font></small><br />"; |
1985 |
|
#endif |
1986 |
|
#ifndef CONFIG_MAX_VOICES |
1987 |
|
sText += "<small><font color=\"red\">"; |
1988 |
|
sText += tr("Runtime max. voices / disk streams support disabled."); |
1989 |
|
sText += "</font></small><br />"; |
1990 |
|
#endif |
1991 |
sText += "<br />\n"; |
sText += "<br />\n"; |
1992 |
sText += tr("Using") + ": "; |
sText += tr("Using") + ": "; |
1993 |
sText += ::lscp_client_package(); |
sText += ::lscp_client_package(); |
2028 |
setWindowTitle(tr(QSAMPLER_TITLE " - [%1]").arg(sSessionName)); |
setWindowTitle(tr(QSAMPLER_TITLE " - [%1]").arg(sSessionName)); |
2029 |
|
|
2030 |
// Update the main menu state... |
// Update the main menu state... |
2031 |
ChannelStrip* pChannelStrip = activeChannelStrip(); |
ChannelStrip *pChannelStrip = activeChannelStrip(); |
2032 |
bool bHasClient = (m_pOptions != NULL && m_pClient != NULL); |
bool bHasClient = (m_pOptions != NULL && m_pClient != NULL); |
2033 |
bool bHasChannel = (bHasClient && pChannelStrip != NULL); |
bool bHasChannel = (bHasClient && pChannelStrip != NULL); |
2034 |
|
bool bHasChannels = (bHasClient && m_pWorkspace->subWindowList().count() > 0); |
2035 |
m_ui.fileNewAction->setEnabled(bHasClient); |
m_ui.fileNewAction->setEnabled(bHasClient); |
2036 |
m_ui.fileOpenAction->setEnabled(bHasClient); |
m_ui.fileOpenAction->setEnabled(bHasClient); |
2037 |
m_ui.fileSaveAction->setEnabled(bHasClient && m_iDirtyCount > 0); |
m_ui.fileSaveAction->setEnabled(bHasClient && m_iDirtyCount > 0); |
2047 |
m_ui.editEditChannelAction->setEnabled(false); |
m_ui.editEditChannelAction->setEnabled(false); |
2048 |
#endif |
#endif |
2049 |
m_ui.editResetChannelAction->setEnabled(bHasChannel); |
m_ui.editResetChannelAction->setEnabled(bHasChannel); |
2050 |
m_ui.editResetAllChannelsAction->setEnabled(bHasChannel); |
m_ui.editResetAllChannelsAction->setEnabled(bHasChannels); |
2051 |
m_ui.viewMessagesAction->setChecked(m_pMessages && m_pMessages->isVisible()); |
m_ui.viewMessagesAction->setChecked(m_pMessages && m_pMessages->isVisible()); |
2052 |
#ifdef CONFIG_MIDI_INSTRUMENT |
#ifdef CONFIG_MIDI_INSTRUMENT |
2053 |
m_ui.viewInstrumentsAction->setChecked(m_pInstrumentListForm |
m_ui.viewInstrumentsAction->setChecked(m_pInstrumentListForm |
2059 |
m_ui.viewDevicesAction->setChecked(m_pDeviceForm |
m_ui.viewDevicesAction->setChecked(m_pDeviceForm |
2060 |
&& m_pDeviceForm->isVisible()); |
&& m_pDeviceForm->isVisible()); |
2061 |
m_ui.viewDevicesAction->setEnabled(bHasClient); |
m_ui.viewDevicesAction->setEnabled(bHasClient); |
2062 |
m_ui.channelsArrangeAction->setEnabled(bHasChannel); |
m_ui.viewMidiDeviceStatusMenu->setEnabled( |
2063 |
|
DeviceStatusForm::getInstances().size() > 0); |
2064 |
|
m_ui.channelsArrangeAction->setEnabled(bHasChannels); |
2065 |
|
|
2066 |
#ifdef CONFIG_VOLUME |
#ifdef CONFIG_VOLUME |
2067 |
// Toolbar widgets are also affected... |
// Toolbar widgets are also affected... |
2127 |
|
|
2128 |
|
|
2129 |
// Channel change receiver slot. |
// Channel change receiver slot. |
2130 |
void MainForm::channelStripChanged(ChannelStrip* pChannelStrip) |
void MainForm::channelStripChanged ( ChannelStrip *pChannelStrip ) |
2131 |
{ |
{ |
2132 |
// Add this strip to the changed list... |
// Add this strip to the changed list... |
2133 |
if (!m_changedStrips.contains(pChannelStrip)) { |
if (!m_changedStrips.contains(pChannelStrip)) { |
2178 |
m_pDeviceForm->refreshDevices(); |
m_pDeviceForm->refreshDevices(); |
2179 |
} |
} |
2180 |
|
|
2181 |
void MainForm::updateAllChannelStrips(bool bRemoveDeadStrips) { |
|
2182 |
|
void MainForm::updateAllChannelStrips ( bool bRemoveDeadStrips ) |
2183 |
|
{ |
2184 |
// Retrieve the current channel list. |
// Retrieve the current channel list. |
2185 |
int *piChannelIDs = ::lscp_list_channels(m_pClient); |
int *piChannelIDs = ::lscp_list_channels(m_pClient); |
2186 |
if (piChannelIDs == NULL) { |
if (piChannelIDs == NULL) { |
2192 |
} else { |
} else { |
2193 |
// Try to (re)create each channel. |
// Try to (re)create each channel. |
2194 |
m_pWorkspace->setUpdatesEnabled(false); |
m_pWorkspace->setUpdatesEnabled(false); |
2195 |
for (int iChannel = 0; piChannelIDs[iChannel] >= 0; iChannel++) { |
for (int iChannel = 0; piChannelIDs[iChannel] >= 0; ++iChannel) { |
2196 |
// Check if theres already a channel strip for this one... |
// Check if theres already a channel strip for this one... |
2197 |
if (!channelStrip(piChannelIDs[iChannel])) |
if (!channelStrip(piChannelIDs[iChannel])) |
2198 |
createChannelStrip(new Channel(piChannelIDs[iChannel])); |
createChannelStrip(new Channel(piChannelIDs[iChannel])); |
2199 |
} |
} |
|
|
|
2200 |
// Do we auto-arrange? |
// Do we auto-arrange? |
2201 |
if (m_pOptions && m_pOptions->bAutoArrange) |
if (m_pOptions && m_pOptions->bAutoArrange) |
2202 |
channelsArrange(); |
channelsArrange(); |
|
|
|
|
stabilizeForm(); |
|
|
|
|
2203 |
// remove dead channel strips |
// remove dead channel strips |
2204 |
if (bRemoveDeadStrips) { |
if (bRemoveDeadStrips) { |
2205 |
for (int i = 0; channelStripAt(i); ++i) { |
QList<QMdiSubWindow *> wlist = m_pWorkspace->subWindowList(); |
2206 |
ChannelStrip* pChannelStrip = channelStripAt(i); |
for (int iChannel = 0; iChannel < (int) wlist.count(); ++iChannel) { |
2207 |
bool bExists = false; |
ChannelStrip *pChannelStrip = NULL; |
2208 |
for (int j = 0; piChannelIDs[j] >= 0; ++j) { |
QMdiSubWindow *pMdiSubWindow = wlist.at(iChannel); |
2209 |
if (!pChannelStrip->channel()) break; |
if (pMdiSubWindow) |
2210 |
if (piChannelIDs[j] == pChannelStrip->channel()->channelID()) { |
pChannelStrip = static_cast<ChannelStrip *> (pMdiSubWindow->widget()); |
2211 |
// strip exists, don't touch it |
if (pChannelStrip) { |
2212 |
bExists = true; |
bool bExists = false; |
2213 |
break; |
for (int j = 0; piChannelIDs[j] >= 0; ++j) { |
2214 |
|
if (!pChannelStrip->channel()) |
2215 |
|
break; |
2216 |
|
if (piChannelIDs[j] == pChannelStrip->channel()->channelID()) { |
2217 |
|
// strip exists, don't touch it |
2218 |
|
bExists = true; |
2219 |
|
break; |
2220 |
|
} |
2221 |
} |
} |
2222 |
|
if (!bExists) |
2223 |
|
destroyChannelStrip(pChannelStrip); |
2224 |
} |
} |
|
if (!bExists) destroyChannelStrip(pChannelStrip); |
|
2225 |
} |
} |
2226 |
} |
} |
2227 |
m_pWorkspace->setUpdatesEnabled(true); |
m_pWorkspace->setUpdatesEnabled(true); |
2228 |
} |
} |
2229 |
|
|
2230 |
|
stabilizeForm(); |
2231 |
} |
} |
2232 |
|
|
2233 |
|
|
2234 |
// Update the recent files list and menu. |
// Update the recent files list and menu. |
2235 |
void MainForm::updateRecentFiles ( const QString& sFilename ) |
void MainForm::updateRecentFiles ( const QString& sFilename ) |
2236 |
{ |
{ |
2277 |
void MainForm::updateInstrumentNames (void) |
void MainForm::updateInstrumentNames (void) |
2278 |
{ |
{ |
2279 |
// Full channel list update... |
// Full channel list update... |
2280 |
QWidgetList wlist = m_pWorkspace->windowList(); |
QList<QMdiSubWindow *> wlist = m_pWorkspace->subWindowList(); |
2281 |
if (wlist.isEmpty()) |
if (wlist.isEmpty()) |
2282 |
return; |
return; |
2283 |
|
|
2284 |
m_pWorkspace->setUpdatesEnabled(false); |
m_pWorkspace->setUpdatesEnabled(false); |
2285 |
for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) { |
for (int iChannel = 0; iChannel < (int) wlist.count(); ++iChannel) { |
2286 |
ChannelStrip *pChannelStrip = (ChannelStrip *) wlist.at(iChannel); |
ChannelStrip *pChannelStrip = (ChannelStrip *) wlist.at(iChannel); |
2287 |
if (pChannelStrip) |
if (pChannelStrip) |
2288 |
pChannelStrip->updateInstrumentName(true); |
pChannelStrip->updateInstrumentName(true); |
2306 |
return; |
return; |
2307 |
|
|
2308 |
// Full channel list update... |
// Full channel list update... |
2309 |
QWidgetList wlist = m_pWorkspace->windowList(); |
QList<QMdiSubWindow *> wlist = m_pWorkspace->subWindowList(); |
2310 |
if (wlist.isEmpty()) |
if (wlist.isEmpty()) |
2311 |
return; |
return; |
2312 |
|
|
2313 |
m_pWorkspace->setUpdatesEnabled(false); |
m_pWorkspace->setUpdatesEnabled(false); |
2314 |
for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) { |
for (int iChannel = 0; iChannel < (int) wlist.count(); ++iChannel) { |
2315 |
ChannelStrip* pChannelStrip = (ChannelStrip*) wlist.at(iChannel); |
ChannelStrip *pChannelStrip = NULL; |
2316 |
|
QMdiSubWindow *pMdiSubWindow = wlist.at(iChannel); |
2317 |
|
if (pMdiSubWindow) |
2318 |
|
pChannelStrip = static_cast<ChannelStrip *> (pMdiSubWindow->widget()); |
2319 |
if (pChannelStrip) |
if (pChannelStrip) |
2320 |
pChannelStrip->setDisplayFont(font); |
pChannelStrip->setDisplayFont(font); |
2321 |
} |
} |
2327 |
void MainForm::updateDisplayEffect (void) |
void MainForm::updateDisplayEffect (void) |
2328 |
{ |
{ |
2329 |
// Full channel list update... |
// Full channel list update... |
2330 |
QWidgetList wlist = m_pWorkspace->windowList(); |
QList<QMdiSubWindow *> wlist = m_pWorkspace->subWindowList(); |
2331 |
if (wlist.isEmpty()) |
if (wlist.isEmpty()) |
2332 |
return; |
return; |
2333 |
|
|
2334 |
m_pWorkspace->setUpdatesEnabled(false); |
m_pWorkspace->setUpdatesEnabled(false); |
2335 |
for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) { |
for (int iChannel = 0; iChannel < (int) wlist.count(); ++iChannel) { |
2336 |
ChannelStrip* pChannelStrip = (ChannelStrip*) wlist.at(iChannel); |
ChannelStrip *pChannelStrip = NULL; |
2337 |
|
QMdiSubWindow *pMdiSubWindow = wlist.at(iChannel); |
2338 |
|
if (pMdiSubWindow) |
2339 |
|
pChannelStrip = static_cast<ChannelStrip *> (pMdiSubWindow->widget()); |
2340 |
if (pChannelStrip) |
if (pChannelStrip) |
2341 |
pChannelStrip->setDisplayEffect(m_pOptions->bDisplayEffect); |
pChannelStrip->setDisplayEffect(m_pOptions->bDisplayEffect); |
2342 |
} |
} |
2358 |
#endif |
#endif |
2359 |
|
|
2360 |
// Full channel list update... |
// Full channel list update... |
2361 |
QWidgetList wlist = m_pWorkspace->windowList(); |
QList<QMdiSubWindow *> wlist = m_pWorkspace->subWindowList(); |
2362 |
if (wlist.isEmpty()) |
if (wlist.isEmpty()) |
2363 |
return; |
return; |
2364 |
|
|
2365 |
m_pWorkspace->setUpdatesEnabled(false); |
m_pWorkspace->setUpdatesEnabled(false); |
2366 |
for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) { |
for (int iChannel = 0; iChannel < (int) wlist.count(); ++iChannel) { |
2367 |
ChannelStrip* pChannelStrip = (ChannelStrip*) wlist.at(iChannel); |
ChannelStrip *pChannelStrip = NULL; |
2368 |
|
QMdiSubWindow *pMdiSubWindow = wlist.at(iChannel); |
2369 |
|
if (pMdiSubWindow) |
2370 |
|
pChannelStrip = static_cast<ChannelStrip *> (pMdiSubWindow->widget()); |
2371 |
if (pChannelStrip) |
if (pChannelStrip) |
2372 |
pChannelStrip->setMaxVolume(m_pOptions->iMaxVolume); |
pChannelStrip->setMaxVolume(m_pOptions->iMaxVolume); |
2373 |
} |
} |
2401 |
m_pMessages->appendMessagesText(s); |
m_pMessages->appendMessagesText(s); |
2402 |
} |
} |
2403 |
|
|
2404 |
void MainForm::appendMessagesError( const QString& s ) |
void MainForm::appendMessagesError( const QString& sText ) |
2405 |
{ |
{ |
2406 |
if (m_pMessages) |
if (m_pMessages) |
2407 |
m_pMessages->show(); |
m_pMessages->show(); |
2408 |
|
|
2409 |
appendMessagesColor(s.simplified(), "#ff0000"); |
appendMessagesColor(sText.simplified(), "#ff0000"); |
2410 |
|
|
2411 |
// Make it look responsive...:) |
// Make it look responsive...:) |
2412 |
QApplication::processEvents(QEventLoop::ExcludeUserInputEvents); |
QApplication::processEvents(QEventLoop::ExcludeUserInputEvents); |
2413 |
|
|
2414 |
QMessageBox::critical(this, |
if (m_pOptions && m_pOptions->bConfirmError) { |
2415 |
QSAMPLER_TITLE ": " + tr("Error"), s, tr("Cancel")); |
const QString& sTitle = QSAMPLER_TITLE ": " + tr("Error"); |
2416 |
|
#if 0 |
2417 |
|
QMessageBox::critical(this, sTitle, sText, QMessageBox::Cancel); |
2418 |
|
#else |
2419 |
|
QMessageBox mbox(this); |
2420 |
|
mbox.setIcon(QMessageBox::Critical); |
2421 |
|
mbox.setWindowTitle(sTitle); |
2422 |
|
mbox.setText(sText); |
2423 |
|
mbox.setStandardButtons(QMessageBox::Cancel); |
2424 |
|
QCheckBox cbox(tr("Don't show this again")); |
2425 |
|
cbox.setChecked(false); |
2426 |
|
cbox.blockSignals(true); |
2427 |
|
mbox.addButton(&cbox, QMessageBox::ActionRole); |
2428 |
|
if (mbox.exec() && cbox.isChecked()) |
2429 |
|
m_pOptions->bConfirmError = false; |
2430 |
|
#endif |
2431 |
|
} |
2432 |
} |
} |
2433 |
|
|
2434 |
|
|
2491 |
// qsamplerMainForm -- MDI channel strip management. |
// qsamplerMainForm -- MDI channel strip management. |
2492 |
|
|
2493 |
// The channel strip creation executive. |
// The channel strip creation executive. |
2494 |
ChannelStrip* MainForm::createChannelStrip ( Channel *pChannel ) |
ChannelStrip *MainForm::createChannelStrip ( Channel *pChannel ) |
2495 |
{ |
{ |
2496 |
if (m_pClient == NULL || pChannel == NULL) |
if (m_pClient == NULL || pChannel == NULL) |
2497 |
return NULL; |
return NULL; |
2514 |
} |
} |
2515 |
|
|
2516 |
// Add it to workspace... |
// Add it to workspace... |
2517 |
m_pWorkspace->addWindow(pChannelStrip, Qt::FramelessWindowHint); |
m_pWorkspace->addSubWindow(pChannelStrip, |
2518 |
|
Qt::SubWindow | Qt::FramelessWindowHint); |
2519 |
|
|
2520 |
// Actual channel strip setup... |
// Actual channel strip setup... |
2521 |
pChannelStrip->setup(pChannel); |
pChannelStrip->setup(pChannel); |
2522 |
|
|
2523 |
QObject::connect(pChannelStrip, |
QObject::connect(pChannelStrip, |
2524 |
SIGNAL(channelChanged(ChannelStrip*)), |
SIGNAL(channelChanged(ChannelStrip *)), |
2525 |
SLOT(channelStripChanged(ChannelStrip*))); |
SLOT(channelStripChanged(ChannelStrip *))); |
2526 |
|
|
2527 |
// Now we show up us to the world. |
// Now we show up us to the world. |
2528 |
pChannelStrip->show(); |
pChannelStrip->show(); |
2534 |
return pChannelStrip; |
return pChannelStrip; |
2535 |
} |
} |
2536 |
|
|
2537 |
void MainForm::destroyChannelStrip(ChannelStrip* pChannelStrip) { |
|
2538 |
|
void MainForm::destroyChannelStrip ( ChannelStrip *pChannelStrip ) |
2539 |
|
{ |
2540 |
|
QMdiSubWindow *pMdiSubWindow |
2541 |
|
= static_cast<QMdiSubWindow *> (pChannelStrip->parentWidget()); |
2542 |
|
if (pMdiSubWindow == NULL) |
2543 |
|
return; |
2544 |
|
|
2545 |
// Just delete the channel strip. |
// Just delete the channel strip. |
2546 |
delete pChannelStrip; |
delete pChannelStrip; |
2547 |
|
delete pMdiSubWindow; |
2548 |
|
|
2549 |
// Do we auto-arrange? |
// Do we auto-arrange? |
2550 |
if (m_pOptions && m_pOptions->bAutoArrange) |
if (m_pOptions && m_pOptions->bAutoArrange) |
2553 |
stabilizeForm(); |
stabilizeForm(); |
2554 |
} |
} |
2555 |
|
|
2556 |
|
|
2557 |
// Retrieve the active channel strip. |
// Retrieve the active channel strip. |
2558 |
ChannelStrip* MainForm::activeChannelStrip (void) |
ChannelStrip *MainForm::activeChannelStrip (void) |
2559 |
{ |
{ |
2560 |
return static_cast<ChannelStrip *> (m_pWorkspace->activeWindow()); |
QMdiSubWindow *pMdiSubWindow = m_pWorkspace->activeSubWindow(); |
2561 |
|
if (pMdiSubWindow) |
2562 |
|
return static_cast<ChannelStrip *> (pMdiSubWindow->widget()); |
2563 |
|
else |
2564 |
|
return NULL; |
2565 |
} |
} |
2566 |
|
|
2567 |
|
|
2568 |
// Retrieve a channel strip by index. |
// Retrieve a channel strip by index. |
2569 |
ChannelStrip* MainForm::channelStripAt ( int iChannel ) |
ChannelStrip *MainForm::channelStripAt ( int iChannel ) |
2570 |
{ |
{ |
2571 |
if (!m_pWorkspace) return NULL; |
if (!m_pWorkspace) return NULL; |
2572 |
|
|
2573 |
QWidgetList wlist = m_pWorkspace->windowList(); |
QList<QMdiSubWindow *> wlist = m_pWorkspace->subWindowList(); |
2574 |
if (wlist.isEmpty()) |
if (wlist.isEmpty()) |
2575 |
return NULL; |
return NULL; |
2576 |
|
|
2577 |
if (iChannel < 0 || iChannel >= wlist.size()) |
if (iChannel < 0 || iChannel >= wlist.size()) |
2578 |
return NULL; |
return NULL; |
2579 |
|
|
2580 |
return dynamic_cast<ChannelStrip *> (wlist.at(iChannel)); |
QMdiSubWindow *pMdiSubWindow = wlist.at(iChannel); |
2581 |
|
if (pMdiSubWindow) |
2582 |
|
return static_cast<ChannelStrip *> (pMdiSubWindow->widget()); |
2583 |
|
else |
2584 |
|
return NULL; |
2585 |
} |
} |
2586 |
|
|
2587 |
|
|
2588 |
// Retrieve a channel strip by sampler channel id. |
// Retrieve a channel strip by sampler channel id. |
2589 |
ChannelStrip* MainForm::channelStrip ( int iChannelID ) |
ChannelStrip *MainForm::channelStrip ( int iChannelID ) |
2590 |
{ |
{ |
2591 |
QWidgetList wlist = m_pWorkspace->windowList(); |
QList<QMdiSubWindow *> wlist = m_pWorkspace->subWindowList(); |
2592 |
if (wlist.isEmpty()) |
if (wlist.isEmpty()) |
2593 |
return NULL; |
return NULL; |
2594 |
|
|
2595 |
for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) { |
for (int iChannel = 0; iChannel < (int) wlist.count(); ++iChannel) { |
2596 |
ChannelStrip* pChannelStrip |
ChannelStrip *pChannelStrip = NULL; |
2597 |
= static_cast<ChannelStrip*> (wlist.at(iChannel)); |
QMdiSubWindow *pMdiSubWindow = wlist.at(iChannel); |
2598 |
|
if (pMdiSubWindow) |
2599 |
|
pChannelStrip = static_cast<ChannelStrip *> (pMdiSubWindow->widget()); |
2600 |
if (pChannelStrip) { |
if (pChannelStrip) { |
2601 |
Channel *pChannel = pChannelStrip->channel(); |
Channel *pChannel = pChannelStrip->channel(); |
2602 |
if (pChannel && pChannel->channelID() == iChannelID) |
if (pChannel && pChannel->channelID() == iChannelID) |
2616 |
m_ui.channelsMenu->addAction(m_ui.channelsArrangeAction); |
m_ui.channelsMenu->addAction(m_ui.channelsArrangeAction); |
2617 |
m_ui.channelsMenu->addAction(m_ui.channelsAutoArrangeAction); |
m_ui.channelsMenu->addAction(m_ui.channelsAutoArrangeAction); |
2618 |
|
|
2619 |
QWidgetList wlist = m_pWorkspace->windowList(); |
QList<QMdiSubWindow *> wlist = m_pWorkspace->subWindowList(); |
2620 |
if (!wlist.isEmpty()) { |
if (!wlist.isEmpty()) { |
2621 |
m_ui.channelsMenu->addSeparator(); |
m_ui.channelsMenu->addSeparator(); |
2622 |
for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) { |
for (int iChannel = 0; iChannel < (int) wlist.count(); ++iChannel) { |
2623 |
ChannelStrip* pChannelStrip |
ChannelStrip *pChannelStrip = NULL; |
2624 |
= static_cast<ChannelStrip*> (wlist.at(iChannel)); |
QMdiSubWindow *pMdiSubWindow = wlist.at(iChannel); |
2625 |
|
if (pMdiSubWindow) |
2626 |
|
pChannelStrip = static_cast<ChannelStrip *> (pMdiSubWindow->widget()); |
2627 |
if (pChannelStrip) { |
if (pChannelStrip) { |
2628 |
QAction *pAction = m_ui.channelsMenu->addAction( |
QAction *pAction = m_ui.channelsMenu->addAction( |
2629 |
pChannelStrip->windowTitle(), |
pChannelStrip->windowTitle(), |
2645 |
if (pAction == NULL) |
if (pAction == NULL) |
2646 |
return; |
return; |
2647 |
|
|
2648 |
ChannelStrip* pChannelStrip = channelStripAt(pAction->data().toInt()); |
ChannelStrip *pChannelStrip = channelStripAt(pAction->data().toInt()); |
2649 |
if (pChannelStrip) { |
if (pChannelStrip) { |
2650 |
pChannelStrip->showNormal(); |
pChannelStrip->showNormal(); |
2651 |
pChannelStrip->setFocus(); |
pChannelStrip->setFocus(); |
2706 |
if (m_iTimerSlot >= m_pOptions->iAutoRefreshTime) { |
if (m_iTimerSlot >= m_pOptions->iAutoRefreshTime) { |
2707 |
m_iTimerSlot = 0; |
m_iTimerSlot = 0; |
2708 |
// Update the channel stream usage for each strip... |
// Update the channel stream usage for each strip... |
2709 |
QWidgetList wlist = m_pWorkspace->windowList(); |
QList<QMdiSubWindow *> wlist = m_pWorkspace->subWindowList(); |
2710 |
for (int iChannel = 0; |
for (int iChannel = 0; iChannel < (int) wlist.count(); ++iChannel) { |
2711 |
iChannel < (int) wlist.count(); iChannel++) { |
ChannelStrip *pChannelStrip = NULL; |
2712 |
ChannelStrip* pChannelStrip |
QMdiSubWindow *pMdiSubWindow = wlist.at(iChannel); |
2713 |
= (ChannelStrip*) wlist.at(iChannel); |
if (pMdiSubWindow) |
2714 |
|
pChannelStrip = static_cast<ChannelStrip *> (pMdiSubWindow->widget()); |
2715 |
if (pChannelStrip && pChannelStrip->isVisible()) |
if (pChannelStrip && pChannelStrip->isVisible()) |
2716 |
pChannelStrip->updateChannelUsage(); |
pChannelStrip->updateChannelUsage(); |
2717 |
} |
} |
2739 |
|
|
2740 |
// Is the server process instance still here? |
// Is the server process instance still here? |
2741 |
if (m_pServer) { |
if (m_pServer) { |
2742 |
switch (QMessageBox::warning(this, |
if (QMessageBox::warning(this, |
2743 |
QSAMPLER_TITLE ": " + tr("Warning"), |
QSAMPLER_TITLE ": " + tr("Warning"), |
2744 |
tr("Could not start the LinuxSampler server.\n\n" |
tr("Could not start the LinuxSampler server.\n\n" |
2745 |
"Maybe it is already started."), |
"Maybe it is already started."), |
2746 |
tr("Stop"), tr("Kill"), tr("Cancel"))) { |
QMessageBox::Ok | QMessageBox::Cancel) == QMessageBox::Ok) { |
|
case 0: |
|
2747 |
m_pServer->terminate(); |
m_pServer->terminate(); |
|
break; |
|
|
case 1: |
|
2748 |
m_pServer->kill(); |
m_pServer->kill(); |
|
break; |
|
2749 |
} |
} |
2750 |
return; |
return; |
2751 |
} |
} |
2763 |
|
|
2764 |
// Setup stdout/stderr capture... |
// Setup stdout/stderr capture... |
2765 |
// if (m_pOptions->bStdoutCapture) { |
// if (m_pOptions->bStdoutCapture) { |
|
#if QT_VERSION >= 0x040200 |
|
2766 |
m_pServer->setProcessChannelMode(QProcess::ForwardedChannels); |
m_pServer->setProcessChannelMode(QProcess::ForwardedChannels); |
|
#endif |
|
2767 |
QObject::connect(m_pServer, |
QObject::connect(m_pServer, |
2768 |
SIGNAL(readyReadStandardOutput()), |
SIGNAL(readyReadStandardOutput()), |
2769 |
SLOT(readServerStdout())); |
SLOT(readServerStdout())); |
2817 |
"running in the background. The sampler would continue to work\n" |
"running in the background. The sampler would continue to work\n" |
2818 |
"according to your current sampler session and you could alter the\n" |
"according to your current sampler session and you could alter the\n" |
2819 |
"sampler session at any time by relaunching QSampler.\n\n" |
"sampler session at any time by relaunching QSampler.\n\n" |
2820 |
"Do you want LinuxSampler to stop or to keep running in\n" |
"Do you want LinuxSampler to stop?"), |
2821 |
"the background?"), |
QMessageBox::Yes | QMessageBox::No, |
2822 |
tr("Stop"), tr("Keep Running")) == 1) |
QMessageBox::Yes) == QMessageBox::No) |
2823 |
{ |
{ |
2824 |
bForceServerStop = false; |
bForceServerStop = false; |
2825 |
} |
} |
2829 |
if (m_pServer && bForceServerStop) { |
if (m_pServer && bForceServerStop) { |
2830 |
appendMessages(tr("Server is stopping...")); |
appendMessages(tr("Server is stopping...")); |
2831 |
if (m_pServer->state() == QProcess::Running) { |
if (m_pServer->state() == QProcess::Running) { |
2832 |
#if defined(WIN32) |
#if defined(WIN32) |
2833 |
// Try harder... |
// Try harder... |
2834 |
m_pServer->kill(); |
m_pServer->kill(); |
2835 |
#else |
#else |
2836 |
// Try softly... |
// Try softly... |
2837 |
m_pServer->terminate(); |
m_pServer->terminate(); |
2838 |
#endif |
#endif |
2839 |
} |
} |
2840 |
} // Do final processing anyway. |
} // Do final processing anyway. |
2841 |
else processServerExit(); |
else processServerExit(); |
2905 |
// as this is run under some other thread context. |
// as this is run under some other thread context. |
2906 |
// A custom event must be posted here... |
// A custom event must be posted here... |
2907 |
QApplication::postEvent(pMainForm, |
QApplication::postEvent(pMainForm, |
2908 |
new CustomEvent(event, pchData, cchData)); |
new LscpEvent(event, pchData, cchData)); |
2909 |
|
|
2910 |
return LSCP_OK; |
return LSCP_OK; |
2911 |
} |
} |
3064 |
|
|
3065 |
|
|
3066 |
// Channel strip activation/selection. |
// Channel strip activation/selection. |
3067 |
void MainForm::activateStrip ( QWidget *pWidget ) |
void MainForm::activateStrip ( QMdiSubWindow *pMdiSubWindow ) |
3068 |
{ |
{ |
3069 |
ChannelStrip *pChannelStrip |
ChannelStrip *pChannelStrip = NULL; |
3070 |
= static_cast<ChannelStrip *> (pWidget); |
if (pMdiSubWindow) |
3071 |
|
pChannelStrip = static_cast<ChannelStrip *> (pMdiSubWindow->widget()); |
3072 |
if (pChannelStrip) |
if (pChannelStrip) |
3073 |
pChannelStrip->setSelected(true); |
pChannelStrip->setSelected(true); |
3074 |
|
|
3076 |
} |
} |
3077 |
|
|
3078 |
|
|
3079 |
|
// Channel toolbar orientation change. |
3080 |
|
void MainForm::channelsToolbarOrientation ( Qt::Orientation orientation ) |
3081 |
|
{ |
3082 |
|
#ifdef CONFIG_VOLUME |
3083 |
|
m_pVolumeSlider->setOrientation(orientation); |
3084 |
|
if (orientation == Qt::Horizontal) { |
3085 |
|
m_pVolumeSlider->setMinimumHeight(24); |
3086 |
|
m_pVolumeSlider->setMaximumHeight(32); |
3087 |
|
m_pVolumeSlider->setMinimumWidth(120); |
3088 |
|
m_pVolumeSlider->setMaximumWidth(640); |
3089 |
|
m_pVolumeSpinBox->setMaximumWidth(64); |
3090 |
|
m_pVolumeSpinBox->setButtonSymbols(QSpinBox::UpDownArrows); |
3091 |
|
} else { |
3092 |
|
m_pVolumeSlider->setMinimumHeight(120); |
3093 |
|
m_pVolumeSlider->setMaximumHeight(480); |
3094 |
|
m_pVolumeSlider->setMinimumWidth(24); |
3095 |
|
m_pVolumeSlider->setMaximumWidth(32); |
3096 |
|
m_pVolumeSpinBox->setMaximumWidth(32); |
3097 |
|
m_pVolumeSpinBox->setButtonSymbols(QSpinBox::NoButtons); |
3098 |
|
} |
3099 |
|
#endif |
3100 |
|
} |
3101 |
|
|
3102 |
|
|
3103 |
} // namespace QSampler |
} // namespace QSampler |
3104 |
|
|
3105 |
|
|