X-Git-Url: http://git.maemo.org/git/?p=jspeed;a=blobdiff_plain;f=src%2Fsoundselector.cpp;h=1e26eed109f6a4362c1aa875e5b7d96ea180474f;hp=1d80dbfb15c660fe1232a1b1aa55a2e56f6bc86e;hb=9fb36f56fc5255d0375e9233670da753572bc207;hpb=28cb8747756c4270e5bb6cd8585685e7ed234aef diff --git a/src/soundselector.cpp b/src/soundselector.cpp index 1d80dbf..1e26eed 100644 --- a/src/soundselector.cpp +++ b/src/soundselector.cpp @@ -22,15 +22,13 @@ #include "fileselector.h" #include "mediaplayer.h" -SoundSelector::SoundSelector(QWidget* parent): QWidget(parent) +SoundSelector::SoundSelector(QWidget* parent): QHBoxLayout(parent) { selector_ = new FileSelector(tr("Sound")); QPushButton* playButton = new QPushButton(tr("Play")); connect(playButton, SIGNAL(clicked(bool)), this, SLOT(playSound())); - QHBoxLayout* layout = new QHBoxLayout; - layout->addWidget(selector_, Qt::AlignLeft); - layout->addWidget(playButton); - setLayout(layout); + addWidget(selector_, Qt::AlignLeft); + addWidget(playButton); } void SoundSelector::playSound() @@ -55,19 +53,14 @@ void SoundSelector::playSound() } } -void SoundSelector::setVisible(bool visible) +void SoundSelector::load() { - if(visible) - { - QString currentValue = selector_->value().toString(); - selector_->clear(); - QString pattern = MediaPlayer::getFormatPattern(); - selector_->loadFiles(MediaPlayer::getLocalSoundDir(), pattern); - selector_->loadFiles(MediaPlayer::getSoundDir(), pattern); - setValue(currentValue); - } - - QWidget::setVisible(visible); + QString currentValue = selector_->value().toString(); + selector_->clear(); + QStringList patterns = MediaPlayer::getFormatPatterns(); + selector_->loadFiles(MediaPlayer::getLocalSoundDir(), patterns, true); + selector_->loadFiles(MediaPlayer::getSoundDir(), patterns, true); + setValue(currentValue); } void SoundSelector::setValue(QString const& value)