Skip to content

Commit

Permalink
fix building on OBS master
Browse files Browse the repository at this point in the history
  • Loading branch information
exeldro committed Mar 11, 2024
1 parent 364c32a commit 70f6a4b
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 14 deletions.
33 changes: 20 additions & 13 deletions audio-monitor-dock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,27 @@ MODULE_EXPORT void load_audio_monitor_dock()
const auto main_window =
static_cast<QMainWindow *>(obs_frontend_get_main_window());
obs_frontend_push_ui_translation(obs_module_get_string);
obs_frontend_add_dock(new AudioMonitorDock(main_window));

#if LIBOBS_API_VER >= MAKE_SEMANTIC_VERSION(30, 0, 0)
obs_frontend_add_dock_by_id("AudioMonitorDock",
obs_module_text("AudioMonitor"),
new AudioMonitorDock(main_window));
#else
const auto dock = new QDockWidget(main_window);
dock->setObjectName("AudioMonitorDock");
dock->setWindowTitle(
QString::fromUtf8(obs_module_text("AudioMonitor")));
dock->setWidget(new AudioMonitorDock(main_window));
dock->setFeatures(QDockWidget::DockWidgetMovable |
QDockWidget::DockWidgetFloatable);
dock->setFloating(true);
dock->hide();
obs_frontend_add_dock(dock);
#endif
obs_frontend_pop_ui_translation();
}

AudioMonitorDock::AudioMonitorDock(QWidget *parent) : QDockWidget(parent)
AudioMonitorDock::AudioMonitorDock(QWidget *parent) : QStackedWidget(parent)
{

mainLayout = new QGridLayout;
Expand Down Expand Up @@ -81,12 +97,6 @@ AudioMonitorDock::AudioMonitorDock(QWidget *parent) : QDockWidget(parent)
QSizePolicy::Expanding);
mainLayout->addWidget(control, 1, 1);
}
setFeatures(DockWidgetClosable | DockWidgetMovable |
DockWidgetFloatable);
setWindowTitle(QT_UTF8(obs_module_text("AudioMonitor")));
setObjectName("AudioMonitorDock");
setFloating(true);
hide();

signal_handler_connect_global(obs_get_signal_handler(), OBSSignal,
this);
Expand All @@ -106,9 +116,8 @@ AudioMonitorDock::AudioMonitorDock(QWidget *parent) : QDockWidget(parent)
scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
scrollArea->setWidgetResizable(true);

auto *stackedMixerArea = new QStackedWidget;
stackedMixerArea->setObjectName(QStringLiteral("stackedMixerArea"));
stackedMixerArea->addWidget(scrollArea);
setObjectName(QStringLiteral("stackedMixerArea"));
addWidget(scrollArea);

auto *config = new QPushButton(this);
config->setProperty("themeID", "configIconSmall");
Expand All @@ -124,8 +133,6 @@ AudioMonitorDock::AudioMonitorDock(QWidget *parent) : QDockWidget(parent)

dockWidgetContents->setLayout(mainLayout);
scrollArea->setWidget(dockWidgetContents);

setWidget(stackedMixerArea);
}

AudioMonitorDock::~AudioMonitorDock()
Expand Down
3 changes: 2 additions & 1 deletion audio-monitor-dock.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@
#include <QDockWidget>
#include <QHBoxLayout>
#include <QScrollArea>
#include <QStackedWidget>

#include "obs.h"
#include "audio-control.hpp"
#include "audio-monitor-filter.h"
#include <obs-frontend-api.h>

class AudioMonitorDock : public QDockWidget {
class AudioMonitorDock : public QStackedWidget {
Q_OBJECT

private:
Expand Down

0 comments on commit 70f6a4b

Please sign in to comment.