/[svn]/qsampler/trunk/src/qsamplerDeviceForm.cpp
ViewVC logotype

Diff of /qsampler/trunk/src/qsamplerDeviceForm.cpp

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

revision 2388 by capela, Sat Dec 29 19:12:58 2012 UTC revision 3520 by capela, Mon Jul 1 10:53:41 2019 UTC
# Line 1  Line 1 
1  // qsamplerDeviceForm.cpp  // qsamplerDeviceForm.cpp
2  //  //
3  /****************************************************************************  /****************************************************************************
4     Copyright (C) 2004-2012, rncbc aka Rui Nuno Capela. All rights reserved.     Copyright (C) 2004-2019, rncbc aka Rui Nuno Capela. All rights reserved.
5     Copyright (C) 2007, 2008 Christian Schoenebeck     Copyright (C) 2007, 2008 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
# Line 28  Line 28 
28  #include <QHeaderView>  #include <QHeaderView>
29  #include <QMessageBox>  #include <QMessageBox>
30    
31    #include <QCheckBox>
32    
33    
34  namespace QSampler {  namespace QSampler {
35    
# Line 60  DeviceForm::DeviceForm ( QWidget *pParen Line 62  DeviceForm::DeviceForm ( QWidget *pParen
62    
63          m_ui.DeviceParamTable->setModel(&m_deviceParamModel);          m_ui.DeviceParamTable->setModel(&m_deviceParamModel);
64          m_ui.DeviceParamTable->setItemDelegate(&m_deviceParamDelegate);          m_ui.DeviceParamTable->setItemDelegate(&m_deviceParamDelegate);
65  #if QT_VERSION >= 0x050000  #if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
66          m_ui.DeviceParamTable->horizontalHeader()->setSectionResizeMode(2, QHeaderView::Stretch);          m_ui.DeviceParamTable->horizontalHeader()->setSectionResizeMode(2, QHeaderView::Stretch);
67  #else  #else
68          m_ui.DeviceParamTable->horizontalHeader()->setResizeMode(2, QHeaderView::Stretch);          m_ui.DeviceParamTable->horizontalHeader()->setResizeMode(2, QHeaderView::Stretch);
# Line 69  DeviceForm::DeviceForm ( QWidget *pParen Line 71  DeviceForm::DeviceForm ( QWidget *pParen
71    
72          m_ui.DevicePortParamTable->setModel(&m_devicePortParamModel);          m_ui.DevicePortParamTable->setModel(&m_devicePortParamModel);
73          m_ui.DevicePortParamTable->setItemDelegate(&m_devicePortParamDelegate);          m_ui.DevicePortParamTable->setItemDelegate(&m_devicePortParamDelegate);
74  #if QT_VERSION >= 0x050000  #if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
75          m_ui.DevicePortParamTable->horizontalHeader()->setSectionResizeMode(2, QHeaderView::Stretch);          m_ui.DevicePortParamTable->horizontalHeader()->setSectionResizeMode(2, QHeaderView::Stretch);
76  #else  #else
77          m_ui.DevicePortParamTable->horizontalHeader()->setResizeMode(2, QHeaderView::Stretch);          m_ui.DevicePortParamTable->horizontalHeader()->setResizeMode(2, QHeaderView::Stretch);
# Line 281  void DeviceForm::deleteDevice (void) Line 283  void DeviceForm::deleteDevice (void)
283          // Prompt user if this is for real...          // Prompt user if this is for real...
284          Options *pOptions = pMainForm->options();          Options *pOptions = pMainForm->options();
285          if (pOptions && pOptions->bConfirmRemove) {          if (pOptions && pOptions->bConfirmRemove) {
286                  if (QMessageBox::warning(this,                  const QString& sTitle = QSAMPLER_TITLE ": " + tr("Warning");
287                          QSAMPLER_TITLE ": " + tr("Warning"),                  const QString& sText = tr(
288                          tr("About to delete device:\n\n"                          "About to delete device:\n\n"
289                          "%1\n\n"                          "%1\n\n"
290                          "Are you sure?")                          "Are you sure?")
291                          .arg(device.deviceName()),                          .arg(device.deviceName());
292                          QMessageBox::Ok | QMessageBox::Cancel)          #if 0
293                          == QMessageBox::Cancel)                  if (QMessageBox::warning(this, sTitle, sText,
294                            QMessageBox::Ok | QMessageBox::Cancel) == QMessageBox::Cancel)
295                            return;
296            #else
297                    QMessageBox mbox(this);
298                    mbox.setIcon(QMessageBox::Warning);
299                    mbox.setWindowTitle(sTitle);
300                    mbox.setText(sText);
301                    mbox.setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel);
302                    QCheckBox cbox(tr("Don't ask this again"));
303                    cbox.setChecked(false);
304                    cbox.blockSignals(true);
305                    mbox.addButton(&cbox, QMessageBox::ActionRole);
306                    if (mbox.exec() == QMessageBox::Cancel)
307                          return;                          return;
308                    if (cbox.isChecked())
309                            pOptions->bConfirmRemove = false;
310            #endif
311          }          }
312    
313          // Go and destroy...          // Go and destroy...
# Line 406  void DeviceForm::selectDevice () Line 424  void DeviceForm::selectDevice ()
424          QTreeWidgetItem* pItem = m_ui.DeviceListView->currentItem();          QTreeWidgetItem* pItem = m_ui.DeviceListView->currentItem();
425          if (pItem == NULL || pItem->type() != QSAMPLER_DEVICE_ITEM) {          if (pItem == NULL || pItem->type() != QSAMPLER_DEVICE_ITEM) {
426                  m_deviceType = Device::None;                  m_deviceType = Device::None;
427                  m_ui.DeviceNameTextLabel->setText(QString::null);                  m_ui.DeviceNameTextLabel->setText(QString());
428                  m_deviceParamModel.clear();                  m_deviceParamModel.clear();
429                  m_ui.DevicePortComboBox->clear();                  m_ui.DevicePortComboBox->clear();
430                  m_devicePortParamModel.clear();                  m_devicePortParamModel.clear();

Legend:
Removed from v.2388  
changed lines
  Added in v.3520

  ViewVC Help
Powered by ViewVC