Skip to content

Commit

Permalink
Client|Audio|UI: Show audio information in the About dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
skyjake committed Aug 24, 2013
1 parent 585fac3 commit b47daf4
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 6 deletions.
5 changes: 5 additions & 0 deletions doomsday/client/include/audio/audiodriver.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@
#include "api_audiod_mus.h"

#ifdef __cplusplus

#include <de/String>

de::String AudioDriver_InterfaceDescription();

extern "C" {
#endif

Expand Down
1 change: 1 addition & 0 deletions doomsday/client/include/ui/widgets/aboutdialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ class AboutDialog : public DialogWidget

protected slots:
void showGLInfo();
void showAudioInfo();

private:
DENG2_PRIVATE(d)
Expand Down
12 changes: 8 additions & 4 deletions doomsday/client/src/audio/audiodriver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -413,13 +413,13 @@ static void selectInterfaces(audiodriverid_t defaultDriverId)
AudioDriver_Music_Set(AUDIOP_SFX_INTERFACE, AudioDriver_SFX());
}

void AudioDriver_PrintInterfaces(void)
de::String AudioDriver_InterfaceDescription()
{
LOG_INFO(_E(b) "Audio configuration" _E(2) " (by decreasing priority):");

de::String str;
QTextStream os(&str);

os << _E(b) "Audio configuration" _E(2) " (by decreasing priority):\n" _E(.)_E(.);

for(int i = MAX_AUDIO_INTERFACES - 1; i >= 0; --i)
{
audiointerface_t* a = &activeInterfaces[i];
Expand All @@ -434,8 +434,12 @@ void AudioDriver_PrintInterfaces(void)
<< Str_Text(AudioDriver_InterfaceName(a->i.sfx)) << "\n";
}
}
return str.rightStrip();
}

LOG_MSG("%s") << str.rightStrip();
void AudioDriver_PrintInterfaces(void)
{
LOG_MSG("%s") << AudioDriver_InterfaceDescription();
}

/*
Expand Down
21 changes: 19 additions & 2 deletions doomsday/client/src/ui/widgets/aboutdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include "ui/style.h"
#include "ui/signalaction.h"
#include "gl/sys_opengl.h"
#include "audio/audiodriver.h"
#include "clientapp.h"
#include "versioninfo.h"

Expand All @@ -37,6 +38,7 @@ using namespace de;
DENG2_PIMPL(AboutDialog)
{
PopupWidget *glPopup;
PopupWidget *audioPopup;

Instance(Public *i) : Base(i)
{
Expand All @@ -47,6 +49,14 @@ DENG2_PIMPL(AboutDialog)
doc->setText(Sys_GLDescription());
glPopup->setContent(doc);
self.add(glPopup);

// Popup with audio info.
audioPopup = new PopupWidget;
audioPopup->useInfoStyle();
doc = new DocumentWidget;
doc->setText(AudioDriver_InterfaceDescription());
audioPopup->setContent(doc);
self.add(audioPopup);
}
};

Expand Down Expand Up @@ -107,13 +117,20 @@ AboutDialog::AboutDialog() : DialogWidget("about"), d(new Instance(this))

buttons().items()
<< new DialogButtonItem(DialogWidget::Accept | DialogWidget::Default, tr("Close"))
<< new DialogButtonItem(DialogWidget::Action, tr("GL"), new SignalAction(this, SLOT(showGLInfo())));
<< new DialogButtonItem(DialogWidget::Action, tr("GL"), new SignalAction(this, SLOT(showGLInfo())))
<< new DialogButtonItem(DialogWidget::Action, tr("Audio"), new SignalAction(this, SLOT(showAudioInfo())));

// The GL popup is anchored to the button.
// The popups are anchored to their button.
d->glPopup->setAnchorAndOpeningDirection(buttons().organizer().itemWidget(tr("GL"))->rule(), ui::Up);
d->audioPopup->setAnchorAndOpeningDirection(buttons().organizer().itemWidget(tr("Audio"))->rule(), ui::Up);
}

void AboutDialog::showGLInfo()
{
d->glPopup->open();
}

void AboutDialog::showAudioInfo()
{
d->audioPopup->open();
}

0 comments on commit b47daf4

Please sign in to comment.