1 |
|
// qsamplerDeviceForm.cpp |
2 |
|
// |
3 |
|
/**************************************************************************** |
4 |
|
Copyright (C) 2004-2007, rncbc aka Rui Nuno Capela. All rights reserved. |
5 |
|
Copyright (C) 2007, Christian Schoenebeck |
6 |
|
|
7 |
|
This program is free software; you can redistribute it and/or |
8 |
|
modify it under the terms of the GNU General Public License |
9 |
|
as published by the Free Software Foundation; either version 2 |
10 |
|
of the License, or (at your option) any later version. |
11 |
|
|
12 |
|
This program is distributed in the hope that it will be useful, |
13 |
|
but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 |
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15 |
|
GNU General Public License for more details. |
16 |
|
|
17 |
|
You should have received a copy of the GNU General Public License along |
18 |
|
with this program; if not, write to the Free Software Foundation, Inc., |
19 |
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
20 |
|
|
21 |
|
*****************************************************************************/ |
22 |
|
|
23 |
#include "qsamplerDeviceForm.h" |
#include "qsamplerDeviceForm.h" |
24 |
|
|
25 |
#include "qsamplerAbout.h" |
#include "qsamplerAbout.h" |
26 |
|
#include "qsamplerMainForm.h" |
27 |
|
|
28 |
namespace QSampler { |
namespace QSampler { |
29 |
|
|
40 |
// No exclusive mode as default. |
// No exclusive mode as default. |
41 |
m_deviceTypeMode = qsamplerDevice::None; |
m_deviceTypeMode = qsamplerDevice::None; |
42 |
|
|
43 |
|
ui.DeviceListView->header()->hide(); |
44 |
|
|
45 |
ui.DeviceParamTable->setModel(&deviceParamModel); |
ui.DeviceParamTable->setModel(&deviceParamModel); |
46 |
ui.DeviceParamTable->setItemDelegate(&deviceParamDelegate); |
ui.DeviceParamTable->setItemDelegate(&deviceParamDelegate); |
47 |
|
|
58 |
refreshDevices(); |
refreshDevices(); |
59 |
// Try to restore normal window positioning. |
// Try to restore normal window positioning. |
60 |
adjustSize(); |
adjustSize(); |
61 |
|
|
62 |
|
QObject::connect(ui.DeviceListView, |
63 |
|
SIGNAL(itemSelectionChanged()), |
64 |
|
SLOT(selectDevice())); |
65 |
|
QObject::connect(ui.DeviceListView, |
66 |
|
SIGNAL(customContextMenuRequested(const QPoint&)), |
67 |
|
SLOT(deviceListViewContextMenu(const QPoint&))); |
68 |
|
QObject::connect(ui.RefreshDevicesPushButton, |
69 |
|
SIGNAL(clicked()), |
70 |
|
SLOT(refreshDevices())); |
71 |
|
QObject::connect(ui.DriverNameComboBox, |
72 |
|
SIGNAL(activated(const QString&)), |
73 |
|
SLOT(selectDriver(const QString&))); |
74 |
|
QObject::connect(ui.DevicePortComboBox, |
75 |
|
SIGNAL(activated(int)), |
76 |
|
SLOT(selectDevicePort(int))); |
77 |
|
QObject::connect(ui.CreateDevicePushButton, |
78 |
|
SIGNAL(clicked()), |
79 |
|
SLOT(createDevice())); |
80 |
|
QObject::connect(ui.DeleteDevicePushButton, |
81 |
|
SIGNAL(clicked()), |
82 |
|
SLOT(deleteDevice())); |
83 |
|
QObject::connect(ui.ClosePushButton, |
84 |
|
SIGNAL(clicked()), |
85 |
|
SLOT(close())); |
86 |
} |
} |
87 |
|
|
88 |
DeviceForm::~DeviceForm() { |
DeviceForm::~DeviceForm() { |
137 |
// Device driver name setup formal initializer. |
// Device driver name setup formal initializer. |
138 |
void DeviceForm::setDriverName ( const QString& sDriverName ) |
void DeviceForm::setDriverName ( const QString& sDriverName ) |
139 |
{ |
{ |
140 |
if (ui.DriverNameComboBox->findText(sDriverName) == 0) { |
if (ui.DriverNameComboBox->findText(sDriverName) < 0) { |
141 |
ui.DriverNameComboBox->insertItem(sDriverName); |
ui.DriverNameComboBox->insertItem(sDriverName); |
142 |
} |
} |
143 |
ui.DriverNameComboBox->setCurrentText(sDriverName); |
ui.DriverNameComboBox->setCurrentText(sDriverName); |
352 |
|
|
353 |
|
|
354 |
// Device selection slot. |
// Device selection slot. |
355 |
void DeviceForm::selectDevice (void) |
void DeviceForm::selectDevice () |
356 |
{ |
{ |
357 |
MainForm *pMainForm = MainForm::getInstance(); |
MainForm *pMainForm = MainForm::getInstance(); |
358 |
if (pMainForm == NULL) |
if (pMainForm == NULL) |
423 |
QPixmap pixmap; |
QPixmap pixmap; |
424 |
switch (device.deviceType()) { |
switch (device.deviceType()) { |
425 |
case qsamplerDevice::Audio: |
case qsamplerDevice::Audio: |
426 |
pixmap = QPixmap(":/qsampler/pixmaps/audio2.png"); |
pixmap = QPixmap(":/icons/audio2.png"); |
427 |
break; |
break; |
428 |
case qsamplerDevice::Midi: |
case qsamplerDevice::Midi: |
429 |
pixmap = QPixmap(":/qsampler/pixmaps/midi2.png"); |
pixmap = QPixmap(":/icons/midi2.png"); |
430 |
break; |
break; |
431 |
case qsamplerDevice::None: |
case qsamplerDevice::None: |
432 |
break; |
break; |
556 |
|
|
557 |
|
|
558 |
// Device list view context menu handler. |
// Device list view context menu handler. |
559 |
void DeviceForm::contextMenu ( QTreeWidgetItem* pItem, const QPoint& pos, int ) |
void DeviceForm::deviceListViewContextMenu ( const QPoint& pos ) |
560 |
{ |
{ |
561 |
MainForm *pMainForm = MainForm::getInstance(); |
MainForm *pMainForm = MainForm::getInstance(); |
562 |
if (pMainForm == NULL) |
if (pMainForm == NULL) |
563 |
return; |
return; |
564 |
|
|
565 |
|
QTreeWidgetItem* pItem = ui.DeviceListView->itemAt(pos); |
566 |
|
if (pItem == NULL) |
567 |
|
return; |
568 |
|
|
569 |
int iItemID; |
int iItemID; |
570 |
|
|
571 |
// Build the device context menu... |
// Build the device context menu... |
610 |
} |
} |
611 |
|
|
612 |
} // namespace QSampler |
} // namespace QSampler |
613 |
|
|
614 |
|
|
615 |
|
// end of qsamplerDeviceForm.cpp |