From: Steinar H. Gunderson Date: Fri, 29 Jul 2016 13:20:24 +0000 (+0200) Subject: Start adding some faders for the miniview (they don't do much yet). X-Git-Tag: 1.4.0~130 X-Git-Url: https://git.sesse.net/?p=nageru;a=commitdiff_plain;h=290811d5f627c6f01e92a09b08cda44cb1cd65b3 Start adding some faders for the miniview (they don't do much yet). --- diff --git a/.gitignore b/.gitignore index 4a08b62..40faeed 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ *.o *.moc.cpp ui_aboutdialog.h +ui_audio_miniview.h ui_display.h ui_mainwindow.h nageru diff --git a/Makefile b/Makefile index 5e9029d..6dc2ade 100644 --- a/Makefile +++ b/Makefile @@ -14,7 +14,7 @@ LDLIBS=$(shell pkg-config --libs $(PKG_MODULES)) -pthread -lva -lva-drm -lva-x11 # Qt objects OBJS=glwidget.o main.o mainwindow.o vumeter.o lrameter.o vu_common.o correlation_meter.o aboutdialog.o -OBJS += glwidget.moc.o mainwindow.moc.o vumeter.moc.o lrameter.moc.o correlation_meter.moc.o aboutdialog.moc.o +OBJS += glwidget.moc.o mainwindow.moc.o vumeter.moc.o lrameter.moc.o correlation_meter.moc.o aboutdialog.moc.o ellipsis_label.moc.o # Mixer objects OBJS += mixer.o pbo_frame_allocator.o context.o ref_counted_frame.o theme.o resampling_queue.o httpd.o ebu_r128_proc.o flags.o image_input.o stereocompressor.o filter.o alsa_output.o correlation_measurer.o disk_space_estimator.o @@ -46,7 +46,7 @@ all: nageru nageru: $(OBJS) $(CXX) -o $@ $^ $(LDFLAGS) $(LDLIBS) -mainwindow.o: mainwindow.cpp ui_mainwindow.h ui_display.h +mainwindow.o: mainwindow.cpp ui_mainwindow.h ui_display.h ui_audio_miniview.h aboutdialog.o: aboutdialog.cpp ui_aboutdialog.h @@ -54,7 +54,7 @@ DEPS=$(OBJS:.o=.d) -include $(DEPS) clean: - $(RM) $(OBJS) $(DEPS) nageru ui_aboutdialog.h ui_mainwindow.h ui_display.h ui_about.h aboutdialog.moc.cpp correlation_meter.moc.cpp lrameter.moc.cpp vumeter.moc.cpp glwidget.moc.cpp mainwindow.moc.cpp window.moc.cpp chain-*.frag *.dot + $(RM) $(OBJS) $(DEPS) nageru ui_aboutdialog.h ui_mainwindow.h ui_display.h ui_about.h ui_audio_miniview.h aboutdialog.moc.cpp correlation_meter.moc.cpp lrameter.moc.cpp vumeter.moc.cpp glwidget.moc.cpp mainwindow.moc.cpp window.moc.cpp chain-*.frag *.dot PREFIX=/usr/local install: diff --git a/ellipsis_label.h b/ellipsis_label.h new file mode 100644 index 0000000..bec3799 --- /dev/null +++ b/ellipsis_label.h @@ -0,0 +1,35 @@ +#ifndef _ELLIPSIS_LABEL_H +#define _ELLIPSIS_LABEL_H 1 + +#include + +class EllipsisLabel : public QLabel { + Q_OBJECT + +public: + EllipsisLabel(QWidget *parent) : QLabel(parent) {} + + void setFullText(const QString &s) + { + full_text = s; + updateEllipsisText(); + } + +protected: + void resizeEvent(QResizeEvent *event) override + { + QLabel::resizeEvent(event); + updateEllipsisText(); + } + +private: + void updateEllipsisText() + { + QFontMetrics metrics(this->font()); + this->setText(metrics.elidedText(full_text, Qt::ElideRight, this->width())); + } + + QString full_text; +}; + +#endif // !defined(_ELLIPSIS_LABEL_H) diff --git a/main.cpp b/main.cpp index dd94d73..37ac4a4 100644 --- a/main.cpp +++ b/main.cpp @@ -53,7 +53,7 @@ int main(int argc, char *argv[]) global_share_widget = new QGLWidget(); MainWindow mainWindow; - mainWindow.resize(QSize(1500, 810)); + mainWindow.resize(QSize(1500, 850)); mainWindow.show(); app.installEventFilter(&mainWindow); // For white balance color picking. diff --git a/mainwindow.cpp b/mainwindow.cpp index 841952f..9ae13fb 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -25,6 +25,7 @@ #include "lrameter.h" #include "mixer.h" #include "post_to_main_thread.h" +#include "ui_audio_miniview.h" #include "ui_display.h" #include "ui_mainwindow.h" #include "vumeter.h" @@ -174,6 +175,21 @@ void MainWindow::mixer_created(Mixer *mixer) connect(ui_display->wb_button, &QPushButton::clicked, bind(&MainWindow::wb_button_clicked, this, i)); } + // Audio miniview: Make some channels! + for (unsigned i = 0; i < num_previews; ++i) { + Mixer::Output output = Mixer::Output(Mixer::OUTPUT_INPUT0 + i); + + QWidget *channel = new QWidget(this); + Ui::AudioMiniView *ui_audio_miniview = new Ui::AudioMiniView; + ui_audio_miniview->setupUi(channel); + ui_audio_miniview->channel_desc_label->setFullText( + QString::fromStdString(mixer->get_channel_name(output))); + ui->faders->addWidget(channel); + + connect(ui_audio_miniview->fader, &QAbstractSlider::valueChanged, + bind(&MainWindow::mini_fader_changed, this, ui_audio_miniview, i, _1)); + } + // TODO: Fetch all of the values these for completeness, // not just the enable knobs implied by flags. ui->locut_enabled->setChecked(global_mixer->get_locut_enabled()); @@ -342,6 +358,15 @@ void MainWindow::compressor_threshold_knob_changed(int value) QString::fromStdString(format_db(threshold_dbfs, DB_WITH_SIGN))); } +void MainWindow::mini_fader_changed(Ui::AudioMiniView *ui, int channel, int value) +{ + float volume_dbfs = value * 0.1f; + + char buf[256]; + snprintf(buf, sizeof(buf), "%+.1f dB", volume_dbfs); + ui->fader_label->setText(buf); +} + void MainWindow::reset_meters_button_clicked() { global_mixer->reset_meters(); @@ -407,8 +432,8 @@ void MainWindow::relayout() } remaining_height -= me_height + ui->vertical_layout->spacing(); - double audiostrip_height = ui->audiostrip->geometry().height(); - remaining_height -= audiostrip_height + ui->vertical_layout->spacing(); + // Space between the M/E displays and the audio strip. + remaining_height -= ui->vertical_layout->spacing(); // The previews will be constrained by the remaining height, and the width. double preview_label_height = previews[0]->title_bar->geometry().height() + @@ -418,9 +443,8 @@ void MainWindow::relayout() remaining_height -= preview_height + preview_label_height + ui->vertical_layout->spacing(); ui->vertical_layout->setStretch(0, lrintf(me_height)); - ui->vertical_layout->setStretch(1, 0); // Don't stretch the audiostrip. - ui->vertical_layout->setStretch(2, max(1, remaining_height)); // Spacer. - ui->vertical_layout->setStretch(3, lrintf(preview_height + preview_label_height)); + ui->vertical_layout->setStretch(1, lrintf(remaining_height)); // Audio strip. + ui->vertical_layout->setStretch(2, lrintf(preview_height + preview_label_height)); // Set the widths for the previews. double preview_width = preview_height * 16.0 / 9.0; diff --git a/mainwindow.h b/mainwindow.h index 89c5e13..c44c0f2 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -13,6 +13,7 @@ class GLWidget; class QResizeEvent; namespace Ui { +class AudioMiniView; class Display; class MainWindow; } // namespace Ui @@ -49,6 +50,7 @@ public slots: void cutoff_knob_changed(int value); void limiter_threshold_knob_changed(int value); void compressor_threshold_knob_changed(int value); + void mini_fader_changed(Ui::AudioMiniView *ui, int channel, int value); void reset_meters_button_clicked(); void relayout(); diff --git a/ui_audio_miniview.ui b/ui_audio_miniview.ui new file mode 100644 index 0000000..25e458c --- /dev/null +++ b/ui_audio_miniview.ui @@ -0,0 +1,345 @@ + + + AudioMiniView + + + + 0 + 0 + 139 + 300 + + + + + 0 + 0 + + + + + 139 + 0 + + + + + 139 + 16777215 + + + + Form + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + 0 + 1 + + + + true + + + QFrame::Panel + + + QFrame::Plain + + + 0 + + + + 6 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + 0 + + + + + 6 + + + + + + 1 + 0 + + + + + 0 + 0 + + + + Channel description + + + Qt::AlignCenter + + + + + + + 0 + + + + + 0 + + + 4 + + + + + 0 + + + 0 + + + + + + 0 + 1 + + + + + 16 + 0 + + + + + 1 + 0 + + + + + 0 + 0 + + + + + + + + + 255 + 255 + 255 + + + + + + + 5 + 239 + 111 + + + + + + + + + 255 + 255 + 255 + + + + + + + 5 + 239 + 111 + + + + + + + + + 5 + 239 + 111 + + + + + + + 5 + 239 + 111 + + + + + + + + true + + + + + + + + + + 30 + 0 + + + + -0.0 + + + Qt::AlignCenter + + + + + + + + + 4 + + + + + 0 + + + + + -390 + + + 60 + + + 10 + + + Qt::Vertical + + + QSlider::TicksBothSides + + + 30 + + + + + + + + + + 0 + 0 + + + + + 30 + 0 + + + + 0 + + + +0.0 dB + + + Qt::AlignCenter + + + + + + + + + + + + + Qt::Vertical + + + + + + + + + + + + + VUMeter + QWidget +
vumeter.h
+ 1 +
+ + EllipsisLabel + QLabel +
ellipsis_label.h
+
+
+ + +
diff --git a/ui_mainwindow.ui b/ui_mainwindow.ui index 8c92311..e006c9a 100644 --- a/ui_mainwindow.ui +++ b/ui_mainwindow.ui @@ -25,7 +25,7 @@ - + @@ -520,60 +520,22 @@ - - + + + 6 + + 0 - - - - - 64 - 64 - - - - - 16777215 - 64 - - - - -300 - - - 300 - - - 60.000000000000000 - - - true - - - - - - - -0.0 dB - - - Qt::AlignCenter - - - - - - - Gain staging - - - Qt::AlignCenter + + + + QLayout::SetFixedSize - + - - + + Qt::Horizontal @@ -585,266 +547,334 @@ - - - - Auto - - - true - - - - - - - - 0 - 0 - - - - - 64 - 64 - - - - - 16777215 - 64 - - - - 60 - - - 26 - - - - - - - Enabled - - - true - - - - - - - Lo-cut (24dB/oct) - - - - - - - 120 Hz - - - Qt::AlignCenter - - - - - - - - 64 - 64 - - - - - 16777215 - 64 - - - - -400 - - - 0 - - - -140 - - - 30.000000000000000 - - - true - - - - - - - Limiter threshold - - - Qt::AlignCenter - - - - - - - Compr. threshold - - - - - - - -14.0 dB - - - Qt::AlignCenter - - - - - - - - 64 - 64 - - - - - 16777215 - 64 - - - - -400 - - + + + 0 - - -260 - - - 30.000000000000000 - - - true - - - - - - - Enabled - - - true - - - - - - - -26.0 dB - - - Qt::AlignCenter - - - - - - - Makeup gain - - - Qt::AlignCenter - - - - - - - - 64 - 64 - - - - - 16777215 - 64 - - - - -300 - - - 300 - - - 60.000000000000000 - - - true - - - - - - - -0.0 dB - - - Qt::AlignCenter - - - - - - - Auto - - - true - - - - - - - Enabled - - - true - - + + + + -0.0 dB + + + Qt::AlignCenter + + + + + + + Enabled + + + true + + + + + + + Enabled + + + true + + + + + + + -0.0 dB + + + Qt::AlignCenter + + + + + + + -14.0 dB + + + Qt::AlignCenter + + + + + + + 120 Hz + + + Qt::AlignCenter + + + + + + + Enabled + + + true + + + + + + + -26.0 dB + + + Qt::AlignCenter + + + + + + + + 64 + 64 + + + + + 16777215 + 64 + + + + -300 + + + 300 + + + 60.000000000000000 + + + true + + + + + + + + 64 + 64 + + + + + 16777215 + 64 + + + + -400 + + + 0 + + + -260 + + + 30.000000000000000 + + + true + + + + + + + Auto + + + true + + + + + + + Auto + + + true + + + + + + + + 64 + 64 + + + + + 16777215 + 64 + + + + -400 + + + 0 + + + -140 + + + 30.000000000000000 + + + true + + + + + + + Makeup gain + + + Qt::AlignCenter + + + + + + + + 0 + 0 + + + + + 64 + 64 + + + + + 16777215 + 64 + + + + 60 + + + 26 + + + + + + + + 64 + 64 + + + + + 16777215 + 64 + + + + -300 + + + 300 + + + 60.000000000000000 + + + true + + + + + + + Limiter threshold + + + Qt::AlignCenter + + + + + + + Compr. threshold + + + + + + + Gain staging + + + Qt::AlignCenter + + + + + + + Lo-cut (24dB/oct) + + + + + + + Qt::Vertical + + + QSizePolicy::Expanding + + + + 20 + 40 + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + - - - - Qt::Vertical - - - QSizePolicy::Preferred - - - - 20 - 40 - - - -