Skip to content
Permalink
Browse files

Open soundfile selection dialog with current path

  • Loading branch information...
Kissaki committed Aug 19, 2013
1 parent 6e09508 commit 7c2d1a3f890c4f8862ec344776ae199eb71c2016
Showing with 10 additions and 7 deletions.
  1. +4 −2 src/mumble/AudioConfigDialog.cpp
  2. +2 −2 src/mumble/AudioOutputSample.cpp
  3. +1 −1 src/mumble/AudioOutputSample.h
  4. +3 −2 src/mumble/Log.cpp
@@ -306,13 +306,15 @@ void AudioInputDialog::on_qcbPushClick_clicked(bool b) {
}

void AudioInputDialog::on_qpbPushClickBrowseOn_clicked() {
QString qsnew = AudioOutputSample::browseForSndfile();
QString defaultpath(qlePushClickPathOn->text());
QString qsnew = AudioOutputSample::browseForSndfile(defaultpath);
if (!qsnew.isEmpty())
qlePushClickPathOn->setText(qsnew);
}

void AudioInputDialog::on_qpbPushClickBrowseOff_clicked() {
QString qsnew = AudioOutputSample::browseForSndfile();
QString defaultpath(qlePushClickPathOff->text());
QString qsnew = AudioOutputSample::browseForSndfile(defaultpath);
if (!qsnew.isEmpty())
qlePushClickPathOff->setText(qsnew);
}
@@ -207,8 +207,8 @@ SoundFile* AudioOutputSample::loadSndfile(const QString &filename) {
return sf;
}

QString AudioOutputSample::browseForSndfile() {
QString file = QFileDialog::getOpenFileName(NULL, tr("Choose sound file"), QString(), QLatin1String("*.wav *.ogg *.ogv *.oga *.flac"));
QString AudioOutputSample::browseForSndfile(QString defaultpath) {
QString file = QFileDialog::getOpenFileName(NULL, tr("Choose sound file"), defaultpath, QLatin1String("*.wav *.ogg *.ogv *.oga *.flac"));
if (! file.isEmpty()) {
SoundFile *sf = AudioOutputSample::loadSndfile(file);
if (sf == NULL) {
@@ -84,7 +84,7 @@ class AudioOutputSample : public AudioOutputUser {
void playbackFinished();
public:
static SoundFile* loadSndfile(const QString &filename);
static QString browseForSndfile();
static QString browseForSndfile(QString defaultpath=QString());
virtual bool needSamples(unsigned int snum);
AudioOutputSample(const QString &name, SoundFile *psndfile, bool repeat, unsigned int freq);
~AudioOutputSample();
@@ -188,9 +188,10 @@ void LogConfig::on_qtwMessages_itemDoubleClicked(QTreeWidgetItem * item, int col
}

void LogConfig::browseForAudioFile() {
QString file = AudioOutputSample::browseForSndfile();
QTreeWidgetItem *i = qtwMessages->selectedItems()[0];
QString defaultpath(i->text(ColStaticSoundPath));
QString file = AudioOutputSample::browseForSndfile(defaultpath);
if (!file.isEmpty()) {
QTreeWidgetItem *i = qtwMessages->selectedItems()[0];
i->setText(ColStaticSoundPath, file);
i->setCheckState(ColStaticSound, Qt::Checked);
}

0 comments on commit 7c2d1a3

Please sign in to comment.
You can’t perform that action at this time.