X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=mainwindow.cpp;h=0b1ad4a93eefc193f1d418d5a502825b1d676f49;hb=3468aa5b18f40f294657a3b52a2bb49521d6476e;hp=0f54b5b74297720e5e57906201361bcf3d034fd4;hpb=288a03c8054f20dd554b2250cedbae845442e7b6;p=nageru 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()