24 |
#include <qfiledialog.h> |
#include <qfiledialog.h> |
25 |
#include <qfileinfo.h> |
#include <qfileinfo.h> |
26 |
#include <qlistbox.h> |
#include <qlistbox.h> |
27 |
|
#include <qpopupmenu.h> |
28 |
|
|
29 |
#include "qsamplerMainForm.h" |
#include "qsamplerMainForm.h" |
30 |
|
|
123 |
int iDeviceID = -1; |
int iDeviceID = -1; |
124 |
switch (device.deviceType()) { |
switch (device.deviceType()) { |
125 |
case qsamplerDevice::Audio: |
case qsamplerDevice::Audio: |
126 |
pRootItem = m_pAudioItems; |
pRootItem = m_pAudioItems; |
127 |
if ((iDeviceID = ::lscp_create_audio_device(m_pClient, |
if ((iDeviceID = ::lscp_create_audio_device(m_pClient, |
128 |
device.driverName().latin1(), pParams)) < 0) |
device.driverName().latin1(), pParams)) < 0) |
129 |
m_pMainForm->appendMessagesClient("lscp_create_audio_device"); |
m_pMainForm->appendMessagesClient("lscp_create_audio_device"); |
130 |
break; |
break; |
131 |
case qsamplerDevice::Midi: |
case qsamplerDevice::Midi: |
132 |
pRootItem = m_pMidiItems; |
pRootItem = m_pMidiItems; |
133 |
if ((iDeviceID = ::lscp_create_midi_device(m_pClient, |
if ((iDeviceID = ::lscp_create_midi_device(m_pClient, |
134 |
device.driverName().latin1(), pParams)) < 0) |
device.driverName().latin1(), pParams)) < 0) |
135 |
m_pMainForm->appendMessagesClient("lscp_create_midi_device"); |
m_pMainForm->appendMessagesClient("lscp_create_midi_device"); |
168 |
|
|
169 |
// Prompt user if this is for real... |
// Prompt user if this is for real... |
170 |
qsamplerOptions *pOptions = m_pMainForm->options(); |
qsamplerOptions *pOptions = m_pMainForm->options(); |
171 |
if (pOptions && pOptions->bConfirmRemove) { |
if (pOptions && pOptions->bConfirmRemove) { |
172 |
if (QMessageBox::warning(this, tr("Warning"), |
if (QMessageBox::warning(this, tr("Warning"), |
173 |
tr("Delete %1 device:\n\n" |
tr("Delete %1 device:\n\n" |
174 |
"%2\n\n" |
"%2\n\n" |
175 |
"Are you sure?") |
"Are you sure?") |
176 |
.arg(device.deviceTypeName()) |
.arg(device.deviceTypeName()) |
177 |
.arg(device.deviceName()), |
.arg(device.deviceName()), |
178 |
tr("OK"), tr("Cancel")) > 0) |
tr("OK"), tr("Cancel")) > 0) |
179 |
return; |
return; |
180 |
} |
} |
181 |
|
|
182 |
// Now it depends on the device type... |
// Now it depends on the device type... |
183 |
lscp_status_t ret = LSCP_FAILED; |
lscp_status_t ret = LSCP_FAILED; |
311 |
m_bNewDevice = (device.deviceID() < 0); |
m_bNewDevice = (device.deviceID() < 0); |
312 |
|
|
313 |
// Fill the device/driver heading... |
// Fill the device/driver heading... |
314 |
DeviceNameTextLabel->setText(device.deviceTypeName() + ' ' + device.deviceName()); |
QString sPrefix; |
315 |
|
if (!m_bNewDevice) |
316 |
|
sPrefix += device.deviceTypeName() + ' '; |
317 |
|
DeviceNameTextLabel->setText(sPrefix + device.deviceName()); |
318 |
// The driver combobox is only rebuilt if device type has changed... |
// The driver combobox is only rebuilt if device type has changed... |
319 |
if (device.deviceType() != m_deviceType) { |
if (device.deviceType() != m_deviceType) { |
320 |
DriverNameComboBox->clear(); |
DriverNameComboBox->clear(); |
343 |
void qsamplerDeviceForm::changeValue ( int iRow, int iCol ) |
void qsamplerDeviceForm::changeValue ( int iRow, int iCol ) |
344 |
{ |
{ |
345 |
if (m_iDirtySetup > 0) |
if (m_iDirtySetup > 0) |
346 |
return; |
return; |
347 |
if (iRow < 0 || iCol < 0) |
if (iRow < 0 || iCol < 0) |
348 |
return; |
return; |
349 |
|
|
350 |
// |
// |
351 |
// Device parameter change... |
// Device parameter change... |
352 |
// |
// |
401 |
} |
} |
402 |
|
|
403 |
|
|
404 |
|
// Device list view context menu handler. |
405 |
|
void qsamplerDeviceForm::contextMenu ( QListViewItem *pItem, const QPoint& pos, int ) |
406 |
|
{ |
407 |
|
int iItemID; |
408 |
|
|
409 |
|
// Build the device context menu... |
410 |
|
QPopupMenu* pContextMenu = new QPopupMenu(this); |
411 |
|
|
412 |
|
bool bClient = (m_pClient != NULL); |
413 |
|
bool bEnabled = (pItem != NULL); |
414 |
|
iItemID = pContextMenu->insertItem( |
415 |
|
QIconSet(QPixmap::fromMimeSource("deviceCreate.png")), |
416 |
|
tr("&Create"), this, SLOT(createDevice())); |
417 |
|
pContextMenu->setItemEnabled(iItemID, bEnabled || (bClient && m_bNewDevice)); |
418 |
|
iItemID = pContextMenu->insertItem( |
419 |
|
QIconSet(QPixmap::fromMimeSource("deviceDelete.png")), |
420 |
|
tr("&Delete"), this, SLOT(deleteDevice())); |
421 |
|
pContextMenu->setItemEnabled(iItemID, bEnabled && !m_bNewDevice); |
422 |
|
pContextMenu->insertSeparator(); |
423 |
|
iItemID = pContextMenu->insertItem( |
424 |
|
QIconSet(QPixmap::fromMimeSource("formRefresh.png")), |
425 |
|
tr("&Refresh"), this, SLOT(refreshDevices())); |
426 |
|
pContextMenu->setItemEnabled(iItemID, bClient); |
427 |
|
|
428 |
|
pContextMenu->exec(pos); |
429 |
|
|
430 |
|
delete pContextMenu; |
431 |
|
} |
432 |
|
|
433 |
|
|
434 |
// Stabilize current form state. |
// Stabilize current form state. |
435 |
void qsamplerDeviceForm::stabilizeForm (void) |
void qsamplerDeviceForm::stabilizeForm (void) |
436 |
{ |
{ |
437 |
QListViewItem *pItem = DeviceListView->selectedItem(); |
QListViewItem *pItem = DeviceListView->selectedItem(); |
438 |
|
bool bClient = (m_pClient != NULL); |
439 |
bool bEnabled = (pItem != NULL); |
bool bEnabled = (pItem != NULL); |
440 |
DeviceNameTextLabel->setEnabled(bEnabled && !m_bNewDevice); |
DeviceNameTextLabel->setEnabled(bEnabled && !m_bNewDevice); |
441 |
DriverNameTextLabel->setEnabled(bEnabled && m_bNewDevice); |
DriverNameTextLabel->setEnabled(bEnabled && m_bNewDevice); |
442 |
DriverNameComboBox->setEnabled(bEnabled && m_bNewDevice); |
DriverNameComboBox->setEnabled(bEnabled && m_bNewDevice); |
443 |
DeviceParamTable->setEnabled(bEnabled); |
DeviceParamTable->setEnabled(bEnabled); |
444 |
CreateDevicePushButton->setEnabled(bEnabled || m_bNewDevice); |
RefreshDevicesPushButton->setEnabled(bClient); |
445 |
|
CreateDevicePushButton->setEnabled(bEnabled || (bClient && m_bNewDevice)); |
446 |
DeleteDevicePushButton->setEnabled(bEnabled && !m_bNewDevice); |
DeleteDevicePushButton->setEnabled(bEnabled && !m_bNewDevice); |
447 |
} |
} |
448 |
|
|