Fixes to speed alarm and poi alerts. Added flicker effect. Some new fields to text...
[jspeed] / src / soundselector.cpp
index 1d80dbf..0113032 100644 (file)
 #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);
+    selector_->loadFiles(MediaPlayer::getSoundDir(), patterns);
+    setValue(currentValue);
 }
 
 void SoundSelector::setValue(QString const& value)