diff options
author | mio <[email protected]> | 2024-11-10 19:39:43 +1000 |
---|---|---|
committer | mio <[email protected]> | 2024-12-21 10:32:07 +1000 |
commit | b244f506a26fa4b009d060ec7f5d6c62f1c72a22 (patch) | |
tree | 8c82b9834f7121c68774b6c8ed81091984d530de /src/app/audioView.cpp | |
parent | 684ee3e2826a93cfc412b71138c1d1dd458549ce (diff) | |
download | codeine-b244f506a26fa4b009d060ec7f5d6c62f1c72a22.tar.gz codeine-b244f506a26fa4b009d060ec7f5d6c62f1c72a22.zip |
Create a AudioView widget for audio-only streamsissue/23/add-audio-view
Currently Codeine will show a blank area when playing an audio-only
file, such as music. This patch adds a new widget that contains an
instance of the Analyzer::Block class, so instead of a blank area it
contains a "visualizer" of sorts.
Signed-off-by: mio <[email protected]>
Diffstat (limited to 'src/app/audioView.cpp')
-rw-r--r-- | src/app/audioView.cpp | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/app/audioView.cpp b/src/app/audioView.cpp new file mode 100644 index 0000000..ec97217 --- /dev/null +++ b/src/app/audioView.cpp @@ -0,0 +1,31 @@ +// SPDX-FileCopyrightText: 2024 mio <[email protected]> +// +// SPDX-License-Identifier: GPL-3.0-only. + +#include "audioView.h" + +#include <tqlayout.h> + +#include "analyzer.h" + +namespace Codeine +{ + +AudioView::AudioView(TQWidget *parent, const char *name) + : TQFrame(parent, name) +{ + auto *layout = new TQHBoxLayout(this); + m_analyzer = new Analyzer::Block(this); + + // We subtract one from the below to remove excess padding. + // 36 blocks for the max/min height is arbitrary, but looks okay. + m_analyzer->setMaximumSize((Analyzer::Block::MAX_COLUMNS / 2) * (Analyzer::Block::WIDTH + 1) - 1, + 36 * (Analyzer::Block::HEIGHT + 1) - 1); + + m_analyzer->setMinimumSize(Analyzer::Block::WIDTH * Analyzer::Block::MIN_COLUMNS, + 36 * (Analyzer::Block::HEIGHT + 1) - 1); + + layout->addWidget(m_analyzer); +} + +} |