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 |
|
|
56 |
refreshDevices(); |
refreshDevices(); |
57 |
// Try to restore normal window positioning. |
// Try to restore normal window positioning. |
58 |
adjustSize(); |
adjustSize(); |
59 |
|
|
60 |
|
QObject::connect(ui.DeviceListView, |
61 |
|
SIGNAL(itemSelectionChanged()), |
62 |
|
SLOT(selectDevice())); |
63 |
|
QObject::connect(ui.DeviceListView, |
64 |
|
SIGNAL(customContextMenuRequested(const QPoint&)), |
65 |
|
SLOT(deviceListViewContextMenu(const QPoint&))); |
66 |
|
QObject::connect(ui.RefreshDevicesPushButton, |
67 |
|
SIGNAL(clicked()), |
68 |
|
SLOT(refreshDevices())); |
69 |
|
QObject::connect(ui.DriverNameComboBox, |
70 |
|
SIGNAL(activated(const QString&)), |
71 |
|
SLOT(selectDriver(const QString&))); |
72 |
|
QObject::connect(ui.DevicePortComboBox, |
73 |
|
SIGNAL(activated(int)), |
74 |
|
SLOT(selectDevicePort(int))); |
75 |
|
QObject::connect(ui.CreateDevicePushButton, |
76 |
|
SIGNAL(clicked()), |
77 |
|
SLOT(createDevice())); |
78 |
|
QObject::connect(ui.DeleteDevicePushButton, |
79 |
|
SIGNAL(clicked()), |
80 |
|
SLOT(deleteDevice())); |
81 |
|
QObject::connect(ui.ClosePushButton, |
82 |
|
SIGNAL(clicked()), |
83 |
|
SLOT(close())); |
84 |
} |
} |
85 |
|
|
86 |
DeviceForm::~DeviceForm() { |
DeviceForm::~DeviceForm() { |
135 |
// Device driver name setup formal initializer. |
// Device driver name setup formal initializer. |
136 |
void DeviceForm::setDriverName ( const QString& sDriverName ) |
void DeviceForm::setDriverName ( const QString& sDriverName ) |
137 |
{ |
{ |
138 |
if (ui.DriverNameComboBox->findText(sDriverName) == 0) { |
if (ui.DriverNameComboBox->findText(sDriverName) < 0) { |
139 |
ui.DriverNameComboBox->insertItem(sDriverName); |
ui.DriverNameComboBox->insertItem(sDriverName); |
140 |
} |
} |
141 |
ui.DriverNameComboBox->setCurrentText(sDriverName); |
ui.DriverNameComboBox->setCurrentText(sDriverName); |
554 |
|
|
555 |
|
|
556 |
// Device list view context menu handler. |
// Device list view context menu handler. |
557 |
void DeviceForm::contextMenu ( QTreeWidgetItem* pItem, const QPoint& pos, int ) |
void DeviceForm::deviceListViewContextMenu ( const QPoint& pos ) |
558 |
{ |
{ |
559 |
MainForm *pMainForm = MainForm::getInstance(); |
MainForm *pMainForm = MainForm::getInstance(); |
560 |
if (pMainForm == NULL) |
if (pMainForm == NULL) |
561 |
return; |
return; |
562 |
|
|
563 |
|
QTreeWidgetItem* pItem = ui.DeviceListView->itemAt(pos); |
564 |
|
if (pItem == NULL) |
565 |
|
return; |
566 |
|
|
567 |
int iItemID; |
int iItemID; |
568 |
|
|
569 |
// Build the device context menu... |
// Build the device context menu... |
608 |
} |
} |
609 |
|
|
610 |
} // namespace QSampler |
} // namespace QSampler |
611 |
|
|
612 |
|
|
613 |
|
// end of qsamplerDeviceForm.cpp |