]> git.sesse.net Git - ultimatescore/blobdiff - client/mainwindow.cpp
Add some support in the client for reading key events from a non-core IPv6 Buddy.
[ultimatescore] / client / mainwindow.cpp
index 3dd371516f8d6c13e2202bdc4de352569263a2d8..af7ee4b05695f616f533047c43b9b4348b70174a 100644 (file)
@@ -120,7 +120,14 @@ MainWindow::MainWindow(QWidget *parent) :
        connect(ui->show_lower_third_btn, &QPushButton::clicked, this, &MainWindow::show_lower_third_clicked);
        connect(ui->hide_lower_third_btn, &QPushButton::clicked, this, &MainWindow::hide_lower_third_clicked);
 
+       connect(ui->quick_lower_third_edit, &QLineEdit::returnPressed, this, &MainWindow::quick_lower_third_activate);
+       connect(ui->show_quick_lower_third_btn, &QPushButton::clicked, this, &MainWindow::quick_lower_third_activate);
+
        autocomment_update();
+
+       const set<pair<unsigned, unsigned>> usb{{ 0x0e8f, 0x0041 }};
+       event_device = new EventDevice(usb, ui->quick_lower_third_edit);
+       event_device->start_thread();
 }
 
 MainWindow::~MainWindow()
@@ -244,6 +251,15 @@ void MainWindow::hide_lower_third_clicked()
        acmp->send_command("cg 1 invoke 1 hidelowerthird");
 }
 
+void MainWindow::quick_lower_third_activate()
+{
+       map<string, string> param;
+       param["code"] = ui->quick_lower_third_edit->text().toStdString();
+       acmp->send_command("cg 1 update 1 \"" + escape_quotes(serialize_as_json(param)) + "\"");
+       acmp->send_command("cg 1 invoke 1 quicklowerthird");
+       ui->quick_lower_third_edit->clear();
+}
+
 void MainWindow::autocomment_update()
 {
        int score1 = ui->score_1_box->value();