diff --git a/src/qprojectM-pulseaudio/QPulseAudioDeviceChooser.cpp b/src/qprojectM-pulseaudio/QPulseAudioDeviceChooser.cpp index e2d483146..db1461bb4 100644 --- a/src/qprojectM-pulseaudio/QPulseAudioDeviceChooser.cpp +++ b/src/qprojectM-pulseaudio/QPulseAudioDeviceChooser.cpp @@ -1,5 +1,6 @@ #include "QPulseAudioDeviceChooser.hpp" #include +#include void QPulseAudioDeviceChooser::writeSettings() { @@ -21,14 +22,15 @@ this->tryFirstPlayBackMonitorCheckBox->setCheckState QPulseAudioDeviceChooser::QPulseAudioDeviceChooser(const QHash & devices, QWidget * parent = 0, Qt::WindowFlags f) : QDialog(parent, f), m_qpulseAudioDeviceModel(devices, this) { setupUi(this); - readSettings(); + readSettings(); + qDebug() << "setting model"; this->devicesListView->setModel(&m_qpulseAudioDeviceModel); } void QPulseAudioDeviceChooser::open() { this->show(); - this->devicesListView->show(); + //this->devicesListView->show() } diff --git a/src/qprojectM-pulseaudio/QPulseAudioDeviceModel.cpp b/src/qprojectM-pulseaudio/QPulseAudioDeviceModel.cpp index 65282dd46..59a84be41 100644 --- a/src/qprojectM-pulseaudio/QPulseAudioDeviceModel.cpp +++ b/src/qprojectM-pulseaudio/QPulseAudioDeviceModel.cpp @@ -6,47 +6,26 @@ QPulseAudioDeviceModel::QPulseAudioDeviceModel(const QHash & _devices, QObject * parent = 0): devices(_devices) {} -void QPulseAudioDeviceModel::updateItemHighlights() -{ - if ( rowCount() == 0 ) - return; - - emit ( dataChanged ( this->index ( 0,0 ), this->index ( rowCount()-1) ) ) - ; -} - - QVariant QPulseAudioDeviceModel::data ( const QModelIndex & index, int role = Qt::DisplayRole ) const { - if (!index.isValid()) + if (!index.isValid()) return QVariant(); - - if (index.row() >= rowCount()) - return QVariant(); QHash::const_iterator pos; - qDebug() << "role: " << role; switch ( role ) { case Qt::DisplayRole: pos = devices.begin() + index.row(); return *pos; - - case Qt::ToolTip: - return QString("These never show up."); - case Qt::DecorationRole: - return QVariant(); - case Qt::BackgroundRole: -// return Qt::red; -// return Qt::green; - return Qt::white; default: + return QVariant(); } } int QPulseAudioDeviceModel::rowCount ( const QModelIndex & parent) const -{ +{ + return devices.count(); } diff --git a/src/qprojectM-pulseaudio/QPulseAudioDeviceModel.hpp b/src/qprojectM-pulseaudio/QPulseAudioDeviceModel.hpp index 62e47a4fb..8899a7311 100644 --- a/src/qprojectM-pulseaudio/QPulseAudioDeviceModel.hpp +++ b/src/qprojectM-pulseaudio/QPulseAudioDeviceModel.hpp @@ -38,8 +38,6 @@ QVariant data ( const QModelIndex & index, int role) const; int rowCount ( const QModelIndex & parent = QModelIndex()) const ; -public slots: - void updateItemHighlights(); private: const QHash & devices; }; diff --git a/src/qprojectM-pulseaudio/QPulseAudioThread.cpp b/src/qprojectM-pulseaudio/QPulseAudioThread.cpp index b1be5f679..6720080c1 100644 --- a/src/qprojectM-pulseaudio/QPulseAudioThread.cpp +++ b/src/qprojectM-pulseaudio/QPulseAudioThread.cpp @@ -4,7 +4,7 @@ #include #include -QPulseAudioThread::SourceContainer QPulseAudioThread::sourceList; + /* $Id: pacat.c 1426 2007-02-13 15:35:19Z ossman $ */ @@ -72,6 +72,7 @@ static pa_channel_map channel_map; static int channel_map_set = 0; static pa_sample_spec sample_spec ; +QPulseAudioThread::SourceContainer QPulseAudioThread::sourceList; QPulseAudioThread::QPulseAudioThread ( int _argc, char **_argv, projectM * _projectM, QObject * parent ) : QThread ( parent ), argc ( _argc ), argv ( _argv ), m_projectM ( _projectM ), sourceIndex ( -1 ) { @@ -151,20 +152,21 @@ void QPulseAudioThread::connectSource ( int index ) return; } - index = 0; + index = -1; for ( SourceContainer::const_iterator pos = sourceList.begin(); pos != sourceList.end(); ++pos ) { + index++; qDebug() << "Scanning " << *pos; if ( ( *pos).contains ( "monitor" ) ) { qDebug() << "connecting to monitor device" << *pos; break; } - index++; - } + } assert ( !sourceList.empty() ); } + assert (index < sourceList.count()); int r; if ( ( ( r = pa_stream_connect_record ( stream, sourceList[index].toStdString().c_str(), NULL, flags ) ) ) < 0 ) { diff --git a/src/qprojectM-pulseaudio/qprojectM-pulseaudio.cpp b/src/qprojectM-pulseaudio/qprojectM-pulseaudio.cpp index 992be23ed..09947292d 100644 --- a/src/qprojectM-pulseaudio/qprojectM-pulseaudio.cpp +++ b/src/qprojectM-pulseaudio/qprojectM-pulseaudio.cpp @@ -96,7 +96,6 @@ int main ( int argc, char*argv[] ) QProjectM_MainWindow * mainWindow = new QProjectM_MainWindow ( config_file ); - QAction pulseAction("Pulse audio settings...", mainWindow); @@ -119,7 +118,8 @@ int main ( int argc, char*argv[] ) mainWindow->unregisterSettingsAction(&pulseAction); - delete(mainWindow); + /// @bug this blows up the program! + //delete(mainWindow); return ret; }