diff options
Diffstat (limited to 'sigmodr/widgets/SoundUI.cpp')
| -rw-r--r-- | sigmodr/widgets/SoundUI.cpp | 41 |
1 files changed, 22 insertions, 19 deletions
diff --git a/sigmodr/widgets/SoundUI.cpp b/sigmodr/widgets/SoundUI.cpp index 985879e5..a4dd5047 100644 --- a/sigmodr/widgets/SoundUI.cpp +++ b/sigmodr/widgets/SoundUI.cpp @@ -42,22 +42,25 @@ #include <QtGui/QLabel> #include <QtUiTools/QUiLoader> -Sigmodr::Widgets::SoundUI::SoundUI(Sigmod::Sound* sound, QWidget* parent) : +using namespace Sigmod; +using namespace Sigmodr::Widgets; + +SoundUI::SoundUI(Sound* sound, QWidget* parent) : ObjectUI(parent), m_output(new Phonon::AudioOutput(Phonon::MusicCategory, this)), m_media(new Phonon::MediaObject(this)), m_buffer(new QBuffer) { - setObjects(sound, new Sigmod::Sound(*sound)); + setObjects(sound, new Sound(*sound)); } -Sigmodr::Widgets::SoundUI::~SoundUI() +SoundUI::~SoundUI() { delete m_media; delete m_buffer; } -void Sigmodr::Widgets::SoundUI::initGui() +void SoundUI::initGui() { QFile file(":/gui/sound.ui"); file.open(QFile::ReadOnly); @@ -80,48 +83,48 @@ void Sigmodr::Widgets::SoundUI::initGui() buttonBrowse->setIcon(KIcon("document-open")); } -void Sigmodr::Widgets::SoundUI::refreshGui() +void SoundUI::refreshGui() { resetAudioData(); } -void Sigmodr::Widgets::SoundUI::setGui() +void SoundUI::setGui() { - ui_name->setText(qobject_cast<Sigmod::Sound*>(modified())->name()); + ui_name->setText(qobject_cast<Sound*>(modified())->name()); } -void Sigmodr::Widgets::SoundUI::apply() +void SoundUI::apply() { - *qobject_cast<Sigmod::Sound*>(original()) = *qobject_cast<Sigmod::Sound*>(modified()); + *qobject_cast<Sound*>(original()) = *qobject_cast<Sound*>(modified()); emit(changed(false)); } -void Sigmodr::Widgets::SoundUI::discard() +void SoundUI::discard() { - *qobject_cast<Sigmod::Sound*>(modified()) = *qobject_cast<Sigmod::Sound*>(original()); + *qobject_cast<Sound*>(modified()) = *qobject_cast<Sound*>(original()); setGui(); emit(changed(false)); } -void Sigmodr::Widgets::SoundUI::nameChanged(const QString& name) +void SoundUI::nameChanged(const QString& name) { const int cursor = ui_name->cursorPosition(); - qobject_cast<Sigmod::Sound*>(modified())->setName(name); + qobject_cast<Sound*>(modified())->setName(name); ui_name->setCursorPosition(cursor); } -void Sigmodr::Widgets::SoundUI::browse() +void SoundUI::browse() { QFile file(KFileDialog::getOpenFileName(KUrl("kfiledialog:///audio"), "audio/*|Audio files", this)); if (file.open(QIODevice::ReadOnly)) { - qobject_cast<Sigmod::Sound*>(modified())->setData(file.readAll()); + qobject_cast<Sound*>(modified())->setData(file.readAll()); file.close(); resetAudioData(); } } -void Sigmodr::Widgets::SoundUI::stateChanged(Phonon::State newState) +void SoundUI::stateChanged(Phonon::State newState) { switch (newState) { @@ -157,15 +160,15 @@ void Sigmodr::Widgets::SoundUI::stateChanged(Phonon::State newState) } } -void Sigmodr::Widgets::SoundUI::resetAudioData() +void SoundUI::resetAudioData() { m_media->stop(); - m_buffer->setData(qobject_cast<Sigmod::Sound*>(modified())->data()); + m_buffer->setData(qobject_cast<Sound*>(modified())->data()); m_media->setCurrentSource(m_buffer); tick(0); } -void Sigmodr::Widgets::SoundUI::tick(qint64 time) +void SoundUI::tick(qint64 time) { QTime currentTime(0, (time / 60000) % 60, (time / 1000) % 60, time % 1000); qint64 total = m_media->totalTime(); |
