/[svn]/qsampler/trunk/src/qsamplerDeviceForm.ui.h
ViewVC logotype

Diff of /qsampler/trunk/src/qsamplerDeviceForm.ui.h

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 448 by capela, Thu Mar 10 21:40:11 2005 UTC revision 452 by capela, Sun Mar 13 22:06:59 2005 UTC
# Line 24  Line 24 
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    
# Line 310  void qsamplerDeviceForm::selectDevice (v Line 311  void qsamplerDeviceForm::selectDevice (v
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();
# Line 397  void qsamplerDeviceForm::changeValue ( i Line 401  void qsamplerDeviceForm::changeValue ( i
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    

Legend:
Removed from v.448  
changed lines
  Added in v.452

  ViewVC Help
Powered by ViewVC