]> git.sesse.net Git - nageru/blobdiff - mainwindow.cpp
Hook up the channel click events.
[nageru] / mainwindow.cpp
index f3c674d269b4b3611e98799f999b2c5a09a48a28..99b7974e4abcb07461460e5701a409e95e36354e 100644 (file)
@@ -1,6 +1,7 @@
 #include "mainwindow.h"
 #include "window.h"
 #include <thread>
+#include <QSignalMapper>
 
 #include "context.h"
 #include "mixer.h"
@@ -17,11 +18,28 @@ MainWindow::MainWindow()
 
        ui->me_live->set_output(Mixer::OUTPUT_LIVE);
        ui->me_preview->set_output(Mixer::OUTPUT_PREVIEW);
+
+       // TODO: Ask for the real number.
        ui->preview1->set_output(Mixer::OUTPUT_INPUT0);
        ui->preview2->set_output(Mixer::OUTPUT_INPUT1);
+       ui->preview3->set_output(Mixer::OUTPUT_INPUT2);
+
+       QSignalMapper *mapper = new QSignalMapper(this);
+       mapper->setMapping(ui->preview1, 0),
+       mapper->setMapping(ui->preview2, 1);
+       mapper->setMapping(ui->preview3, 2);
+       connect(ui->preview1, SIGNAL(clicked()), mapper, SLOT(map()));
+       connect(ui->preview2, SIGNAL(clicked()), mapper, SLOT(map()));
+       connect(ui->preview3, SIGNAL(clicked()), mapper, SLOT(map()));
+       connect(mapper, SIGNAL(mapped(int)), this, SLOT(channel_clicked(int)));
 }
 
 void MainWindow::cut()
 {
-       global_mixer->transition_clicked(0, 0.0f);  // FIXME: real values
+       global_mixer->transition_clicked(0);  // FIXME: real value
+}
+
+void MainWindow::channel_clicked(int channel_number)
+{
+       global_mixer->channel_clicked(channel_number);
 }