Mixxx

/home/maxime/Projets/Mixxx/1.10/mixxx/src/dlgpreferences.cpp

Go to the documentation of this file.
00001 /***************************************************************************
00002                       dlgpreferences.cpp  -  description
00003                          -------------------
00004    begin                : Sun Jun 30 2002
00005    copyright            : (C) 2002 by Tue & Ken Haste Andersen
00006    email                : haste@diku.dk
00007 ***************************************************************************/
00008 
00009 /***************************************************************************
00010 *                                                                         *
00011 *   This program is free software; you can redistribute it and/or modify  *
00012 *   it under the terms of the GNU General Public License as published by  *
00013 *   the Free Software Foundation; either version 2 of the License, or     *
00014 *   (at your option) any later version.                                   *
00015 *                                                                         *
00016 ***************************************************************************/
00017 
00018 
00019 #ifdef __VINYLCONTROL__
00020 #include "dlgprefvinyl.h"
00021 #else
00022 #include "dlgprefnovinyl.h"
00023 #endif
00024 
00025 #ifdef __SHOUTCAST__
00026 #include "dlgprefshoutcast.h"
00027 #endif
00028 
00029 #include "dlgprefbpm.h"
00030 #include "dlgpreferences.h"
00031 #include "dlgprefsound.h"
00032 #include "dlgprefmidibindings.h"
00033 #include "dlgprefplaylist.h"
00034 #include "dlgprefnomidi.h"
00035 #include "dlgprefcontrols.h"
00036 #include "dlgprefeq.h"
00037 #include "dlgprefcrossfader.h"
00038 #include "dlgprefrecord.h"
00039 #include "dlgprefreplaygain.h"
00040 #include "mixxx.h"
00041 #include "midi/mididevicemanager.h"
00042 #include "midi/mididevice.h"
00043 #include "skin/skinloader.h"
00044 #include <QTabWidget>
00045 
00046 #include <QTabBar>
00047 #include <QDialog>
00048 #include <QtGui>
00049 #include <QEvent>
00050 #include <QScrollArea>
00051 
00052 DlgPreferences::DlgPreferences(MixxxApp * mixxx, SkinLoader* pSkinLoader,
00053                                SoundManager * soundman, PlayerManager* pPlayerManager,
00054                                MidiDeviceManager * midi, VinylControlManager *pVCManager,
00055                                ConfigObject<ConfigValue> * _config)
00056         :  QDialog(), Ui::DlgPreferencesDlg() {
00057     m_pMixxx = mixxx;
00058     m_pMidiDeviceManager = midi;
00059 
00060     setupUi(this);
00061 #if QT_VERSION >= 0x040400 //setHeaderHidden is a qt4.4 addition so having it in the .ui file breaks the build on OpenBSD4.4 (FIXME: revisit this when OpenBSD4.5 comes out?)
00062     contentsTreeWidget->setHeaderHidden(true);
00063 #endif
00064 
00065     setWindowTitle(tr("Preferences"));
00066     config = _config;
00067 
00068     createIcons();
00069     //contentsTreeWidget->setCurrentRow(0);
00070 
00071     while (pagesWidget->count() > 0)
00072     {
00073         pagesWidget->removeWidget(pagesWidget->currentWidget());
00074     }
00075     m_pageSizeHint = QSize(0,0);
00076 
00077     // Construct widgets for use in tabs
00078     m_wsound = new DlgPrefSound(this, soundman, pPlayerManager, config);
00079     addPageWidget(m_wsound);
00080     m_wplaylist = new DlgPrefPlaylist(this, config);
00081     addPageWidget(m_wplaylist);
00082     m_wcontrols = new DlgPrefControls(this, mixxx, pSkinLoader, pPlayerManager, config);
00083     addPageWidget(m_wcontrols);
00084     m_weq = new DlgPrefEQ(this, config);
00085     addPageWidget(m_weq);
00086     m_wcrossfader = new DlgPrefCrossfader(this, config);
00087     addPageWidget(m_wcrossfader);
00088     m_wbpm = new DlgPrefBpm(this, config);
00089     addPageWidget(m_wbpm);
00090     m_wreplaygain = new DlgPrefReplayGain(this, config);
00091     addPageWidget(m_wreplaygain);
00092     m_wrecord = new DlgPrefRecord(this, config);
00093     addPageWidget(m_wrecord);
00094 #ifdef __VINYLCONTROL__
00095     m_wvinylcontrol = new DlgPrefVinyl(this, pVCManager, config);
00096     addPageWidget(m_wvinylcontrol);
00097 #else
00098     m_wnovinylcontrol = new DlgPrefNoVinyl(this, soundman, config);
00099     addPageWidget(m_wnovinylcontrol);
00100 #endif
00101 #ifdef __SHOUTCAST__
00102     m_wshoutcast = new DlgPrefShoutcast(this, config);
00103     addPageWidget(m_wshoutcast);
00104 #endif
00105     m_wNoMidi = new DlgPrefNoMidi(this, config);
00106     addPageWidget(m_wNoMidi);
00107     setupMidiWidgets();
00108 
00109 
00110     // Install event handler to generate closeDlg signal
00111     installEventFilter(this);
00112 
00113     // Connections
00114     connect(this, SIGNAL(showDlg()), this,      SLOT(slotShow()));
00115     connect(this, SIGNAL(closeDlg()), this,      SLOT(slotHide()));
00116     connect(m_pMidiDeviceManager, SIGNAL(devicesChanged()), this, SLOT(rescanMidi()));
00117 
00118     connect(this, SIGNAL(showDlg()), m_wsound,     SLOT(slotUpdate()));
00119     connect(this, SIGNAL(showDlg()), m_wplaylist,  SLOT(slotUpdate()));
00120     connect(this, SIGNAL(showDlg()), m_wcontrols,  SLOT(slotUpdate()));
00121     connect(this, SIGNAL(showDlg()), m_weq,        SLOT(slotUpdate()));
00122     connect(this, SIGNAL(showDlg()), m_wcrossfader, SLOT(slotUpdate()));
00123     connect(this, SIGNAL(showDlg()), m_wbpm,       SLOT(slotUpdate()));
00124     connect(this, SIGNAL(showDlg()), m_wreplaygain,SLOT(slotUpdate()));
00125 
00126     connect(this, SIGNAL(showDlg()), m_wrecord,    SLOT(slotUpdate()));
00127 #ifdef __VINYLCONTROL__
00128     connect(this, SIGNAL(showDlg()), m_wvinylcontrol, SLOT(slotShow()));
00129     connect(this, SIGNAL(closeDlg()), m_wvinylcontrol,SLOT(slotClose()));
00130     connect(this, SIGNAL(showDlg()), m_wvinylcontrol,    SLOT(slotUpdate()));
00131     //connect(ComboBoxSoundApi,             SIGNAL(activated(int)),    this, SLOT(slotApplyApi()));
00132 #endif
00133 #ifdef __SHOUTCAST__
00134     connect(this, SIGNAL(showDlg()), m_wshoutcast,SLOT(slotUpdate()));
00135 #endif
00136 
00137 #ifdef __VINYLCONTROL__
00138     connect(buttonBox, SIGNAL(accepted()), m_wvinylcontrol,    SLOT(slotApply())); //It's important for this to be before the
00139                                                                                  //connect for wsound...
00140 #endif
00141     connect(buttonBox, SIGNAL(accepted()), m_wsound,    SLOT(slotApply()));
00142     connect(buttonBox, SIGNAL(accepted()), m_wplaylist, SLOT(slotApply()));
00143     connect(buttonBox, SIGNAL(accepted()), m_wcontrols, SLOT(slotApply()));
00144     connect(buttonBox, SIGNAL(accepted()), m_weq,       SLOT(slotApply()));
00145     connect(buttonBox, SIGNAL(accepted()), m_wcrossfader,SLOT(slotApply()));
00146     connect(buttonBox, SIGNAL(accepted()), this,      SLOT(slotApply()));
00147     connect(buttonBox, SIGNAL(accepted()), m_wbpm,      SLOT(slotApply()));
00148     connect(buttonBox, SIGNAL(accepted()), m_wreplaygain,SLOT(slotApply()));
00149     connect(buttonBox, SIGNAL(accepted()), m_wrecord,   SLOT(slotApply()));
00150 #ifdef __SHOUTCAST__
00151     connect(buttonBox, SIGNAL(accepted()), m_wshoutcast,SLOT(slotApply()));
00152 #endif
00153 
00154     //Update the library when you change the options
00155     /*if (m_pTrack && wplaylist)
00156     {
00157         connect(wplaylist, SIGNAL(apply()), m_pTrack, SLOT(slotScanLibrary()));
00158     }*/
00159     //FIXME: Disabled due to library reworking
00160 }
00161 
00162 DlgPreferences::~DlgPreferences()
00163 {
00164     destroyMidiWidgets();
00165 }
00166 
00167 void DlgPreferences::createIcons()
00168 {
00169     m_pSoundButton = new QTreeWidgetItem(contentsTreeWidget, QTreeWidgetItem::Type);
00170     m_pSoundButton->setIcon(0, QIcon(":/images/preferences/ic_preferences_soundhardware.png"));
00171     m_pSoundButton->setText(0, tr("Sound Hardware"));
00172     m_pSoundButton->setTextAlignment(0, Qt::AlignLeft | Qt::AlignVCenter);
00173     m_pSoundButton->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
00174 
00175 /*
00176     QTreeWidgetItem * midiButton = new QTreeWidgetItem(contentsTreeWidget);
00177     midiButton->setIcon(0, QIcon(":/images/preferences/controllers.png"));
00178     midiButton->setText(tr("Input Controllers"));
00179     midiButton->setTextAlignment(Qt::AlignLeft | Qt::AlignVCenter);
00180     midiButton->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
00181 */
00182     m_pMIDITreeItem = new QTreeWidgetItem(contentsTreeWidget, QTreeWidgetItem::Type);
00183     m_pMIDITreeItem->setIcon(0, QIcon(":/images/preferences/ic_preferences_controllers.png"));
00184     m_pMIDITreeItem->setText(0, tr("MIDI Controllers"));
00185     m_pMIDITreeItem->setTextAlignment(0, Qt::AlignLeft | Qt::AlignVCenter);
00186     m_pMIDITreeItem->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
00187 
00188 /*
00189     QTreeWidgetItem * midiBindingsButton = new QTreeWidgetItem(m_pMIDITreeItem, QTreeWidgetItem::Type);
00190     midiBindingsButton->setIcon(0, QIcon(":/images/preferences/controllers.png"));
00191     midiBindingsButton->setText(0, tr("MIDI Bindings"));
00192     midiBindingsButton->setTextAlignment(0, Qt::AlignLeft | Qt::AlignVCenter);
00193     midiBindingsButton->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
00194 */
00195 
00196     m_pPlaylistButton = new QTreeWidgetItem(contentsTreeWidget, QTreeWidgetItem::Type);
00197     m_pPlaylistButton->setIcon(0, QIcon(":/images/preferences/ic_preferences_library.png"));
00198     m_pPlaylistButton->setText(0, tr("Library"));
00199     m_pPlaylistButton->setTextAlignment(0, Qt::AlignLeft | Qt::AlignVCenter);
00200     m_pPlaylistButton->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
00201 
00202     m_pControlsButton = new QTreeWidgetItem(contentsTreeWidget, QTreeWidgetItem::Type);
00203     m_pControlsButton->setIcon(0, QIcon(":/images/preferences/ic_preferences_interface.png"));
00204     m_pControlsButton->setText(0, tr("Interface"));
00205     m_pControlsButton->setTextAlignment(0, Qt::AlignLeft | Qt::AlignVCenter);
00206     m_pControlsButton->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
00207 
00208     m_pEqButton = new QTreeWidgetItem(contentsTreeWidget, QTreeWidgetItem::Type);
00209     m_pEqButton->setIcon(0, QIcon(":/images/preferences/ic_preferences_equalizers.png"));
00210     m_pEqButton->setText(0, tr("Equalizers"));
00211     m_pEqButton->setTextAlignment(0, Qt::AlignLeft | Qt::AlignVCenter);
00212     m_pEqButton->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
00213 
00214     m_pCrossfaderButton = new QTreeWidgetItem(contentsTreeWidget, QTreeWidgetItem::Type);
00215     m_pCrossfaderButton->setIcon(0, QIcon(":/images/preferences/ic_preferences_crossfader.png"));
00216     m_pCrossfaderButton->setText(0, tr("Crossfader"));
00217     m_pCrossfaderButton->setTextAlignment(0, Qt::AlignLeft | Qt::AlignVCenter);
00218     m_pCrossfaderButton->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
00219 
00220     m_pRecordingButton = new QTreeWidgetItem(contentsTreeWidget, QTreeWidgetItem::Type);
00221     m_pRecordingButton->setIcon(0, QIcon(":/images/preferences/ic_preferences_recording.png"));
00222     m_pRecordingButton->setText(0, tr("Recording"));
00223     m_pRecordingButton->setTextAlignment(0, Qt::AlignLeft | Qt::AlignVCenter);
00224     m_pRecordingButton->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
00225 
00226     m_pBPMdetectButton = new QTreeWidgetItem(contentsTreeWidget, QTreeWidgetItem::Type);
00227     m_pBPMdetectButton->setIcon(0, QIcon(":/images/preferences/ic_preferences_bpmdetect.png"));
00228     m_pBPMdetectButton->setText(0, tr("BPM Detection"));
00229     m_pBPMdetectButton->setTextAlignment(0, Qt::AlignLeft | Qt::AlignVCenter);
00230     m_pBPMdetectButton->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
00231 
00232     m_pReplayGainButton = new QTreeWidgetItem(contentsTreeWidget, QTreeWidgetItem::Type);
00233     m_pReplayGainButton->setIcon(0, QIcon(":/images/preferences/ic_preferences_replaygain.png"));
00234     m_pReplayGainButton->setText(0, tr("Normalization"));
00235     m_pReplayGainButton->setTextAlignment(0, Qt::AlignLeft | Qt::AlignVCenter);
00236     m_pReplayGainButton->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
00237 
00238 #ifdef __VINYLCONTROL__
00239     m_pVinylControlButton = new QTreeWidgetItem(contentsTreeWidget, QTreeWidgetItem::Type);
00240     //QT screws up my nice vinyl svg for some reason, so we'll use a PNG version
00241     //instead...
00242     m_pVinylControlButton->setIcon(0, QIcon(":/images/preferences/ic_preferences_vinyl.png"));
00243     m_pVinylControlButton->setText(0, tr("Vinyl Control"));
00244     m_pVinylControlButton->setTextAlignment(0, Qt::AlignLeft | Qt::AlignVCenter);
00245     m_pVinylControlButton->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
00246 #else
00247     m_pVinylControlButton = new QTreeWidgetItem(contentsTreeWidget, QTreeWidgetItem::Type);
00248     //QT screws up my nice vinyl svg for some reason, so we'll use a PNG version
00249     //instead...
00250     m_pVinylControlButton->setIcon(0, QIcon(":/images/preferences/ic_preferences_vinyl.png"));
00251     m_pVinylControlButton->setText(0, tr("Vinyl Control"));
00252     m_pVinylControlButton->setTextAlignment(0, Qt::AlignLeft | Qt::AlignVCenter);
00253     m_pVinylControlButton->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
00254 #endif
00255 
00256 #ifdef __SHOUTCAST__
00257     m_pShoutcastButton = new QTreeWidgetItem(contentsTreeWidget, QTreeWidgetItem::Type);
00258     m_pShoutcastButton->setIcon(0, QIcon(":/images/preferences/ic_preferences_broadcast.png"));
00259     m_pShoutcastButton->setText(0, tr("Live Broadcasting"));
00260     m_pShoutcastButton->setTextAlignment(0, Qt::AlignLeft | Qt::AlignVCenter);
00261     m_pShoutcastButton->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
00262 #endif
00263     connect(contentsTreeWidget,
00264             SIGNAL(currentItemChanged(QTreeWidgetItem *, QTreeWidgetItem *)),
00265             this, SLOT(changePage(QTreeWidgetItem *, QTreeWidgetItem*)));
00266 }
00267 
00268 void DlgPreferences::changePage(QTreeWidgetItem * current, QTreeWidgetItem * previous)
00269 {
00270     if (!current)
00271         current = previous;
00272 
00273     if (current == m_pSoundButton) {
00274         m_wsound->slotUpdate();
00275         pagesWidget->setCurrentWidget(m_wsound->parentWidget()->parentWidget());
00276     } else if (current == m_pPlaylistButton) {
00277         pagesWidget->setCurrentWidget(m_wplaylist->parentWidget()->parentWidget());
00278     } else if (current == m_pControlsButton) {
00279         pagesWidget->setCurrentWidget(m_wcontrols->parentWidget()->parentWidget());
00280     } else if (current == m_pEqButton) {
00281         pagesWidget->setCurrentWidget(m_weq->parentWidget()->parentWidget());
00282     } else if (current == m_pCrossfaderButton) {
00283         pagesWidget->setCurrentWidget(m_wcrossfader->parentWidget()->parentWidget());
00284     } else if (current == m_pRecordingButton) {
00285         pagesWidget->setCurrentWidget(m_wrecord->parentWidget()->parentWidget());
00286     } else if (current == m_pBPMdetectButton) {
00287         pagesWidget->setCurrentWidget(m_wbpm->parentWidget()->parentWidget());
00288     } else if (current == m_pReplayGainButton) {
00289         pagesWidget->setCurrentWidget(m_wreplaygain->parentWidget()->parentWidget());
00290 
00291 #ifdef __VINYLCONTROL__
00292     } else if (current == m_pVinylControlButton) {
00293         pagesWidget->setCurrentWidget(m_wvinylcontrol->parentWidget()->parentWidget());
00294 #else
00295     } else if (current == m_pVinylControlButton) {
00296            pagesWidget->setCurrentWidget(m_wnovinylcontrol->parentWidget()->parentWidget());
00297 #endif
00298 #ifdef __SHOUTCAST__
00299     } else if (current == m_pShoutcastButton) {
00300            pagesWidget->setCurrentWidget(m_wshoutcast->parentWidget()->parentWidget());
00301 #endif
00302 
00303        //Handle selection of midi device items
00304     } else if (m_midiBindingsButtons.indexOf(current) >= 0) {
00305         int index = m_midiBindingsButtons.indexOf(current);
00306         pagesWidget->setCurrentWidget(m_wmidiBindingsForDevice.value(index)->parentWidget()->parentWidget());
00307         //Manually fire this slot since it doesn't work right...
00308         m_wmidiBindingsForDevice.value(index)->slotUpdate();
00309     } else if (current == m_pMIDITreeItem) {
00310         //If the root "MIDI Device" item is clicked, select the first MIDI device instead.
00311         //If there is no first MIDI device, display a page that says so (just so we don't not change the page)
00312         if (m_wmidiBindingsForDevice.count() > 0) {
00313             //Expand the MIDI subtree
00314             contentsTreeWidget->setItemExpanded(m_pMIDITreeItem, true);
00315 
00316             // FIXME: None of the following works right, for some reason. - Albert Feb 9/09
00317 
00318             //Select the first MIDI device
00319             //contentsTreeWidget->setItemSelected(m_pMIDITreeItem, false);
00320             /*
00321               foreach(QTreeWidgetItem* item, contentsTreeWidget->selectedItems())
00322               {
00323               contentsTreeWidget->setItemSelected(item, false);
00324               }*/
00325             //contentsTreeWidget->setItemSelected(m_midiBindingsButtons.value(0), true);
00326         } else {
00327             pagesWidget->setCurrentWidget(m_wNoMidi->parentWidget()->parentWidget());
00328         }
00329     }
00330 }
00331 
00332 void DlgPreferences::showSoundHardwarePage()
00333 {
00334     pagesWidget->setCurrentWidget(m_wsound->parentWidget()->parentWidget());
00335     contentsTreeWidget->setCurrentItem(m_pSoundButton);
00336 }
00337 
00338 bool DlgPreferences::eventFilter(QObject * o, QEvent * e)
00339 {
00340     // Send a close signal if dialog is closing
00341     if (e->type() == QEvent::Hide)
00342         emit(closeDlg());
00343 
00344     if (e->type() == QEvent::Show)
00345         emit(showDlg());
00346 
00347     // Standard event processing
00348     return QWidget::eventFilter(o,e);
00349 }
00350 
00351 void DlgPreferences::slotHide()
00352 {
00353 }
00354 
00355 
00356 void DlgPreferences::slotShow()
00357 {
00358     //m_pMixxx->releaseKeyboard();
00359 
00360     QSize optimumSize;
00361     QSize deltaSize;
00362     QSize pagesSize;
00363     QSize saSize;
00364 
00365     adjustSize();
00366 
00367     optimumSize = qApp->desktop()->availableGeometry(this).size();
00368 
00369     if (frameSize() == size()) {
00370         // This code is reached in Gnome 2.3
00371         qDebug() << "guess the size of the window decoration";
00372         optimumSize -= QSize(2,30);
00373     } else {
00374         optimumSize -= (frameSize() - size());
00375     }
00376 
00377     QSize staticSize = size() - pagesWidget->size();
00378     optimumSize = optimumSize.boundedTo(staticSize + m_pageSizeHint);
00379 
00380     QRect optimumRect = geometry();
00381     optimumRect.setSize(optimumSize);
00382     setGeometry(optimumRect);
00383 }
00384 
00385 void DlgPreferences::rescanMidi()
00386 {
00387     destroyMidiWidgets();
00388     setupMidiWidgets();
00389 }
00390 
00391 void DlgPreferences::destroyMidiWidgets()
00392 {
00393     //XXX this, and the corresponding code over in onShow(), is pretty bad and messy; it should be wrapped up in a class so that constructors and destructors can handle this setup/teardown
00394 
00395     m_midiBindingsButtons.clear();
00396 
00397     while (!m_wmidiBindingsForDevice.isEmpty())
00398     {
00399         DlgPrefMidiBindings* midiDlg = m_wmidiBindingsForDevice.takeLast();
00400         pagesWidget->removeWidget(midiDlg);
00401         delete midiDlg;
00402     }
00403 
00404     while(m_pMIDITreeItem->childCount() > 0)
00405     {
00406         QTreeWidgetItem* midiBindingsButton = m_pMIDITreeItem->takeChild(0);
00407         //qDebug() << " Q|T|r\e\eWidgetItem point is " << midiBindingsButton;
00408         m_pMIDITreeItem->removeChild(midiBindingsButton);
00409         delete midiBindingsButton;
00410     }
00411 }
00412 
00413 void DlgPreferences::setupMidiWidgets()
00414 {
00415     //For each MIDI device, create a MIDI dialog and put a little link to it in the treepane on the left
00416     QList<MidiDevice*> deviceList = m_pMidiDeviceManager->getDeviceList(false, true);
00417     QListIterator<MidiDevice*> it(deviceList);
00418 
00419     while (it.hasNext())
00420     {
00421         MidiDevice* currentDevice = it.next();
00422         QString curDeviceName = currentDevice->getName();
00423         //qDebug() << "curDeviceName: " << curDeviceName;
00424         DlgPrefMidiBindings* midiDlg = new DlgPrefMidiBindings(this, currentDevice, m_pMidiDeviceManager, config);
00425         m_wmidiBindingsForDevice.append(midiDlg);
00426         addPageWidget(midiDlg);
00427         connect(this, SIGNAL(showDlg()), midiDlg, SLOT(slotUpdate()));
00428         connect(buttonBox, SIGNAL(accepted()), midiDlg, SLOT(slotApply()));
00429         connect(midiDlg, SIGNAL(deviceStateChanged(DlgPrefMidiBindings*,bool)), this, SLOT(slotHighlightDevice(DlgPrefMidiBindings*,bool)));
00430 
00431         QTreeWidgetItem * midiBindingsButton = new QTreeWidgetItem(QTreeWidgetItem::Type);
00432         //qDebug() << curDeviceName << " QTreeWidgetItem point is " << midiBindingsButton;
00433         midiBindingsButton->setIcon(0, QIcon(":/images/preferences/ic_preferences_controllers.png"));
00434         midiBindingsButton->setText(0, curDeviceName);
00435         midiBindingsButton->setTextAlignment(0, Qt::AlignLeft | Qt::AlignVCenter);
00436         midiBindingsButton->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
00437         m_pMIDITreeItem->addChild(midiBindingsButton);
00438         m_midiBindingsButtons.append(midiBindingsButton);
00439 
00440         // Set the font correctly
00441         QFont temp = midiBindingsButton->font(0);
00442         if (currentDevice->isOpen()) temp.setBold(true);
00443         else temp.setBold(false);
00444         midiBindingsButton->setFont(0,temp);
00445     }
00446 }
00447 
00448 void DlgPreferences::slotApply()
00449 {
00450     m_pMidiDeviceManager->saveMappings();
00451     //m_pMixxx->grabKeyboard();
00452 }
00453 
00454 void DlgPreferences::slotHighlightDevice(DlgPrefMidiBindings* dialog, bool enabled)
00455 {
00456     QTreeWidgetItem* midiBindingsButton = m_midiBindingsButtons.at(m_wmidiBindingsForDevice.indexOf(dialog));
00457     QFont temp = midiBindingsButton->font(0);
00458     if (enabled) temp.setBold(true);
00459     else temp.setBold(false);
00460     midiBindingsButton->setFont(0,temp);
00461 }
00462 
00463 int DlgPreferences::addPageWidget(QWidget* w) {
00464     int iret;
00465 
00466     QScrollArea* sa = new QScrollArea(pagesWidget);
00467     sa->setWidgetResizable(true);
00468 
00469     sa->setWidget(w);
00470     iret = pagesWidget->addWidget(sa);
00471 
00472     int iframe = 2 * sa->frameWidth();
00473     m_pageSizeHint = m_pageSizeHint.expandedTo(w->sizeHint()+QSize(iframe, iframe));
00474 
00475     return iret;
00476 }
00477 
00478 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines