From 3468aa5b18f40f294657a3b52a2bb49521d6476e Mon Sep 17 00:00:00 2001 From: "Steinar H. Gunderson" Date: Fri, 15 Apr 2016 22:35:41 +0200 Subject: [PATCH] Make it possible to schedule cuts using SIGHUP. --- mainwindow.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/mainwindow.cpp b/mainwindow.cpp index 0f54b5b..0b1ad4a 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -2,6 +2,7 @@ #include #include +#include #include #include #include @@ -31,6 +32,15 @@ using namespace std::placeholders; Q_DECLARE_METATYPE(std::vector); +namespace { + +void schedule_cut_signal(int ignored) +{ + global_mixer->schedule_cut(); +} + +} // namespace + MainWindow *global_mainwindow = nullptr; MainWindow::MainWindow() @@ -135,6 +145,11 @@ void MainWindow::mixer_created(Mixer *mixer) }); connect(ui->reset_meters_button, &QPushButton::clicked, this, &MainWindow::reset_meters_button_clicked); mixer->set_audio_level_callback(bind(&MainWindow::audio_level_callback, this, _1, _2, _3, _4, _5, _6, _7, _8)); + + struct sigaction act; + act.sa_handler = schedule_cut_signal; + act.sa_flags = SA_RESTART; + sigaction(SIGHUP, &act, nullptr); } void MainWindow::mixer_shutting_down() -- 2.39.2