*.d
*.o
*.moc.cpp
+ui_display.h
ui_mainwindow.h
nageru
nageru: $(OBJS)
$(CXX) $(LDFLAGS) -o $@ $^
-mainwindow.o: mainwindow.cpp ui_mainwindow.h
+mainwindow.o: mainwindow.cpp ui_mainwindow.h ui_display.h
DEPS=$(OBJS:.o=.d)
-include $(DEPS)
clean:
- $(RM) $(OBJS) $(DEPS) nageru ui_mainwindow.h glwidget.moc.cpp mainwindow.moc.cpp window.moc.cpp chain-*.frag *.dot
+ $(RM) $(OBJS) $(DEPS) nageru ui_mainwindow.h ui_display.h glwidget.moc.cpp mainwindow.moc.cpp window.moc.cpp chain-*.frag *.dot
global_share_widget = new QGLWidget();
MainWindow mainWindow;
- mainWindow.resize(QSize(1500, 606));
+ mainWindow.resize(QSize(1500, 685));
mainWindow.show();
int rc = app.exec();
#include "glwidget.h"
#include "lrameter.h"
#include "mixer.h"
+#include "ui_display.h"
#include "ui_mainwindow.h"
#include "vumeter.h"
QSignalMapper *mapper = new QSignalMapper(this);
for (unsigned i = 0; i < num_previews; ++i) {
- GLWidget *preview = new GLWidget(this);
- preview->set_output(Mixer::Output(Mixer::OUTPUT_INPUT0 + i));
+ Mixer::Output output = Mixer::Output(Mixer::OUTPUT_INPUT0 + i);
+
+ QWidget *preview = new QWidget(this);
+ Ui::Display *ui_display = new Ui::Display;
+ ui_display->setupUi(preview);
+ ui_display->label->setText(mixer->get_channel_name(output).c_str());
+ ui_display->wb_button->setVisible(mixer->get_supports_set_wb(output));
+ ui_display->display->set_output(output);
ui->preview_displays->insertWidget(previews.size(), preview, 1);
- previews.push_back(preview);
+ previews.push_back(ui_display);
// Hook up the click.
- mapper->setMapping(preview, i);
- connect(preview, SIGNAL(clicked()), mapper, SLOT(map()));
+ mapper->setMapping(ui_display->display, i);
+ connect(ui_display->display, SIGNAL(clicked()), mapper, SLOT(map()));
// Hook up the keyboard key.
QShortcut *shortcut = new QShortcut(QKeySequence(Qt::Key_1 + i), this);
// The previews will be constrained by the remaining height, and the width.
// FIXME: spacing?
- double preview_height = std::min(height - me_height, (width / double(previews.size())) * 9.0 / 16.0);
+ double preview_label_height = previews[0]->label->height();
+ double preview_height = std::min(height - me_height - preview_label_height, (width / double(previews.size())) * 9.0 / 16.0);
ui->vertical_layout->setStretch(0, lrintf(me_height));
ui->vertical_layout->setStretch(1, std::max<int>(1, lrintf(height - me_height - preview_height)));
- ui->vertical_layout->setStretch(2, lrintf(preview_height));
+ 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; // FIXME: spacing?
class QResizeEvent;
namespace Ui {
+class Display;
class MainWindow;
} // namespace Ui
private:
Ui::MainWindow *ui;
QPushButton *transition_btn1, *transition_btn2, *transition_btn3;
- std::vector<GLWidget *> previews;
+ std::vector<Ui::Display *> previews;
};
extern MainWindow *global_mainwindow;
return theme->get_num_channels();
}
+ std::string get_channel_name(unsigned channel) const
+ {
+ return theme->get_channel_name(channel);
+ }
+
+ bool get_supports_set_wb(unsigned channel) const
+ {
+ return theme->get_supports_set_wb(channel);
+ }
+
private:
void bm_frame(unsigned card_index, uint16_t timecode,
FrameAllocator::Frame video_frame, size_t video_offset, uint16_t video_format,
});
}
+std::string Theme::get_channel_name(unsigned channel)
+{
+ unique_lock<mutex> lock(m);
+ lua_getglobal(L, "channel_name");
+ lua_pushnumber(L, channel);
+ if (lua_pcall(L, 1, 1, 0) != 0) {
+ fprintf(stderr, "error running function `channel_nam': %s\n", lua_tostring(L, -1));
+ exit(1);
+ }
+
+ std::string ret = lua_tostring(L, -1);
+ lua_pop(L, 1);
+ assert(lua_gettop(L) == 0);
+ return ret;
+}
+
+bool Theme::get_supports_set_wb(unsigned channel)
+{
+ unique_lock<mutex> lock(m);
+ lua_getglobal(L, "supports_set_wb");
+ lua_pushnumber(L, channel);
+ if (lua_pcall(L, 1, 1, 0) != 0) {
+ fprintf(stderr, "error running function `supports_set_wb': %s\n", lua_tostring(L, -1));
+ exit(1);
+ }
+
+ bool ret = checkbool(L, -1);
+ lua_pop(L, 1);
+ assert(lua_gettop(L) == 0);
+ return ret;
+}
+
std::vector<std::string> Theme::get_transition_names(float t)
{
unique_lock<mutex> lock(m);
input_textures[signal_num].tex_cbcr = tex_cbcr;
}
int get_num_channels() { return num_channels; }
+ std::string get_channel_name(unsigned channel);
+ bool get_supports_set_wb(unsigned channel);
std::vector<std::string> get_transition_names(float t);
return 3
end
+-- Returns the name for each additional channel (starting from 2).
+-- Called only once for each channel, at the start of the program.
+function channel_name(channel)
+ if channel == 2 then
+ return "Input 1"
+ elseif channel == 3 then
+ return "Input 2"
+ else
+ return "Side-by-side"
+ end
+end
+
+-- Returns if a given channel supports setting white balance (starting from 2).
+-- Called only once for each channel, at the start of the program.
+function supports_set_wb(channel)
+ return channel == 2 or channel == 3
+end
+
function finish_transitions(t)
-- If live is 2 (SBS) but de-facto single, make it so.
if live_signal_num == 2 and t >= transition_end and zoom_dst == 1.0 then
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>Display</class>
+ <widget class="QWidget" name="Display">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>606</width>
+ <height>433</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Form</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout_2">
+ <property name="leftMargin">
+ <number>0</number>
+ </property>
+ <property name="topMargin">
+ <number>0</number>
+ </property>
+ <property name="rightMargin">
+ <number>0</number>
+ </property>
+ <property name="bottomMargin">
+ <number>0</number>
+ </property>
+ <item>
+ <widget class="GLWidget" name="display" native="true">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>1</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="title_bar">
+ <item>
+ <widget class="QLabel" name="label">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
+ <horstretch>1</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>0</width>
+ <height>24</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>TextLabel</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignCenter</set>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="wb_button">
+ <property name="text">
+ <string>Set WB</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ <customwidgets>
+ <customwidget>
+ <class>GLWidget</class>
+ <extends>QWidget</extends>
+ <header>glwidget.h</header>
+ </customwidget>
+ </customwidgets>
+ <resources/>
+ <connections/>
+</ui>