From 4acab35a099e9f6834432e7e89dee716c41549ba Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Tue, 24 Feb 2009 21:21:41 -0500 Subject: Fixed Sigmodr widgets to use namespaces in sources --- sigmodr/widgets/SoundUI.cpp | 41 ++++++++++++++++++++++------------------- 1 file changed, 22 insertions(+), 19 deletions(-) (limited to 'sigmodr/widgets/SoundUI.cpp') 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 #include -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(modified())->name()); + ui_name->setText(qobject_cast(modified())->name()); } -void Sigmodr::Widgets::SoundUI::apply() +void SoundUI::apply() { - *qobject_cast(original()) = *qobject_cast(modified()); + *qobject_cast(original()) = *qobject_cast(modified()); emit(changed(false)); } -void Sigmodr::Widgets::SoundUI::discard() +void SoundUI::discard() { - *qobject_cast(modified()) = *qobject_cast(original()); + *qobject_cast(modified()) = *qobject_cast(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(modified())->setName(name); + qobject_cast(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(modified())->setData(file.readAll()); + qobject_cast(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(modified())->data()); + m_buffer->setData(qobject_cast(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(); -- cgit