X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=mainwindow.cpp;h=9bac15a822c46d46d830a9047221144b0b8dbe69;hb=7dec19543c858de7247f64f6c82f613f9fe05825;hp=2d2f52e20d3639b75127dd3291807e959d15c5e8;hpb=5c6163ad5daa01b486e44c394dd7cc9878ec5df5;p=nageru diff --git a/mainwindow.cpp b/mainwindow.cpp index 2d2f52e..9bac15a 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -30,6 +30,7 @@ class QResizeEvent; using namespace std; using namespace std::placeholders; +Q_DECLARE_METATYPE(std::string); Q_DECLARE_METATYPE(std::vector); MainWindow *global_mainwindow = nullptr; @@ -72,6 +73,7 @@ MainWindow::MainWindow() transition_btn1 = ui->transition_btn1; transition_btn2 = ui->transition_btn2; transition_btn3 = ui->transition_btn3; + qRegisterMetaType("std::string"); qRegisterMetaType>("std::vector"); connect(ui->me_preview, &GLWidget::transition_names_updated, this, &MainWindow::set_transition_names); qRegisterMetaType("Mixer::Output"); @@ -106,7 +108,7 @@ void MainWindow::mixer_created(Mixer *mixer) connect(ui_display->display, &GLWidget::clicked, bind(&MainWindow::channel_clicked, this, i)); // Let the theme update the text whenever the resolution or color changed. - connect(ui_display->display, &GLWidget::resolution_updated, this, &MainWindow::update_channel_name); + connect(ui_display->display, &GLWidget::name_updated, this, &MainWindow::update_channel_name); connect(ui_display->display, &GLWidget::color_updated, this, &MainWindow::update_channel_color); // Hook up the keyboard key. @@ -351,19 +353,18 @@ void MainWindow::set_transition_names(vector transition_names) } } -void MainWindow::update_channel_name(Mixer::Output output) +void MainWindow::update_channel_name(Mixer::Output output, const string &name) { if (output >= Mixer::OUTPUT_INPUT0) { unsigned channel = output - Mixer::OUTPUT_INPUT0; - previews[channel]->label->setText(global_mixer->get_channel_name(output).c_str()); + previews[channel]->label->setText(name.c_str()); } } -void MainWindow::update_channel_color(Mixer::Output output) +void MainWindow::update_channel_color(Mixer::Output output, const string &color) { if (output >= Mixer::OUTPUT_INPUT0) { unsigned channel = output - Mixer::OUTPUT_INPUT0; - string color = global_mixer->get_channel_color(output); previews[channel]->frame->setStyleSheet(QString::fromStdString("background-color:" + color)); } }