Create a AudioView widget for audio-only streams
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 <stigma@disroot.org>
(cherry picked from commit 5cfecec409
)
r14.1.x
parent
3f8d1f80ca
commit
b8894a29b2
@ -0,0 +1,31 @@
|
|||||||
|
// SPDX-FileCopyrightText: 2025 mio <stigma@disroot.org>
|
||||||
|
//
|
||||||
|
// SPDX-License-Identifier: GPL-2.0-or-later.
|
||||||
|
|
||||||
|
#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);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,24 @@
|
|||||||
|
// SPDX-FileCopyrightText: 2025 mio <stigma@disroot.org>
|
||||||
|
//
|
||||||
|
// SPDX-License-Identifier: GPL-2.0-or-later.
|
||||||
|
|
||||||
|
#ifndef CODEINE_AUDIOVIEW_H
|
||||||
|
#define CODEINE_AUDIOVIEW_H
|
||||||
|
|
||||||
|
#include <tqframe.h>
|
||||||
|
|
||||||
|
namespace Codeine
|
||||||
|
{
|
||||||
|
|
||||||
|
class AudioView : public TQFrame
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
AudioView(TQWidget *parent, const char *name = nullptr);
|
||||||
|
|
||||||
|
private:
|
||||||
|
TQWidget *m_analyzer;
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* CODEINE_AUDIOVIEW_H */
|
Loading…
Reference in New Issue