Merge remote-tracking branch 'upstream/master'

This commit is contained in:
Vindicus999
2025-10-31 01:47:49 +00:00
10 changed files with 851 additions and 1748 deletions
-1
View File
@@ -15,7 +15,6 @@ add_executable(wivrn-dashboard
dashboard_utils.cpp
escape_string.cpp
settings.cpp
rectangle_partitionner.cpp
adb.cpp
apk_installer.cpp
firewall.cpp
+81 -172
View File
@@ -35,7 +35,7 @@ Kirigami.ScrollablePage {
Controls.CheckBox {
id: manual_foveation
checked: true
checked: config.scale != -1
Layout.row: 0
Layout.column: 0
text: i18nc("automatic foveation setup", "Manual foveation")
@@ -96,6 +96,7 @@ Kirigami.ScrollablePage {
Kirigami.FormData.label: i18n("Bitrate:")
from: 1
to: 200
value: config.bitrate
textFromValue: (value, locale) => i18nc("bitrate", "%1 Mbit/s", value)
valueFromText: function (text, locale) {
@@ -105,155 +106,59 @@ Kirigami.ScrollablePage {
}
return Number.fromLocaleString(text);
}
onValueModified: config.bitrate = value
}
Controls.ComboBox {
id: encoder_layout
Kirigami.FormData.label: i18n("Encoder layout:")
model: [
{
label: i18nc("encoder preset", "Automatic"),
value: null
},
{
label: i18nc("encoder preset", "Manual"),
value: null
},
{
label: i18nc("encoder preset", "Default preset"),
value: [
{
width: 0.5,
height: 1,
offset_x: 0,
offset_y: 0
},
{
width: 0.5,
height: 1,
offset_x: 0.5,
offset_y: 0
}
]
},
{
label: i18nc("encoder preset", "Low latency preset"),
value: [
{
width: 0.5,
height: 1,
offset_x: 0.5,
offset_y: 0,
encoder: 'x264',
codec: 'h264'
},
{
width: 0.5,
height: 1,
offset_x: 0,
offset_y: 0
}
]
},
{
label: i18nc("encoder preset", "Safe preset"),
value: [
{
width: 1,
height: 1,
offset_x: 0,
offset_y: 0
}]
Kirigami.InlineMessage {
Layout.fillWidth: true
text: i18n("The current encoder configuration is not supported")
type: Kirigami.MessageType.Information
visible: !config.simpleConfig
actions: [
Kirigami.Action {
text: i18n("Reset")
onTriggered: config.encoder = Settings.EncoderAuto
}
]
textRole: "label"
valueRole: "value"
onCurrentValueChanged: {
if (currentValue)
{
config.set_encoder_preset(currentValue);
partitionner.currentIndex = -1;
}
}
}
Controls.Label {
visible: encoder_layout.currentIndex > 0
text: i18n("To add a new encoder, split an existing encoder by clicking near an edge.\nDrag an edge to resize or remove encoders.")
wrapMode: Text.WordWrap
Layout.fillWidth: true
}
RectanglePartitionner {
id: partitionner
implicitWidth: 600
implicitHeight: 300
visible: encoder_layout.currentIndex > 0
settings: config
onCodecChanged: {
for (var i = 0; i < codec_combo.model.length; i++) {
if (codec_combo.model[i].name == codec)
codec_combo.currentIndex = i;
}
}
onEncoderChanged: {
for (var i = 0; i < encoder_combo.model.length; i++) {
if (encoder_combo.model[i].name == encoder)
encoder_combo.currentIndex = i;
}
}
onEncoderLayoutChanged: encoder_layout.currentIndex = 1 // Manual layout
}
RowLayout {
Kirigami.FormData.label: i18n("Encoder:")
enabled: partitionner.selected
visible: encoder_layout.currentIndex > 0
enabled: config.simpleConfig
Controls.ComboBox {
id: encoder_combo
model: [
// Keep it in sync with rectangle_partitionner.h (encoder_name_from_setting)
{
name: "auto",
label: i18nc("automatic encoder setup", "Auto"),
codecs: "auto"
encoder: Settings.EncoderAuto
},
{
name: "nvenc",
label: i18n("nvenc (NVIDIA GPUs)"),
codecs: "auto,h264,h265,av1"
encoder: Settings.Nvenc
},
{
name: "vaapi",
label: i18n("vaapi (AMD and Intel GPUs)"),
codecs: "auto,h264,h265,av1"
encoder: Settings.Vaapi
},
{
name: "x264",
label: i18n("x264 (software encoding)"),
codecs: "h264"
},
{
name: "vulkan",
label: i18n("Vulkan (Vulkan Video)"),
codecs: "h264"
encoder: Settings.Vulkan
},
{
label: i18n("x264 (software encoding)"),
encoder: Settings.X264
}
]
onCurrentIndexChanged: config.encoder = model[currentIndex].encoder
textRole: "label"
onCurrentIndexChanged: {
partitionner.encoder = encoder_combo.model[currentIndex].name;
// Check if the currently selected codec is supported by the new encoder
var supported_codecs = model[currentIndex].codecs.split(",");
var current_codec = codec_combo.model[codec_combo.currentIndex].name;
if (!supported_codecs.includes(current_codec)) {
for (var i = 0; i < codec_combo.model.length; i++) {
if (supported_codecs.includes(codec_combo.model[i].name)) {
codec_combo.currentIndex = i;
break;
}
}
Connections {
target: config
function onEncoderChanged() {
var encoder = config.encoder;
var i = encoder_combo.model.findIndex( item => item.encoder == encoder)
if (i > -1)
encoder_combo.currentIndex = i
}
}
}
@@ -262,44 +167,62 @@ Kirigami.ScrollablePage {
}
}
Controls.ComboBox {
id: codec_combo
RowLayout {
Kirigami.FormData.label: i18n("Codec:")
enabled: partitionner.selected
visible: encoder_layout.currentIndex > 0
model: [
// Keep it in sync with rectangle_partitionner.h (codec_name_from_setting)
{
name: "auto",
label: i18nc("automatic codec setup", "Auto")
},
{
name: "h264",
label: i18n("H.264")
},
{
name: "h265",
label: i18n("H.265")
},
{
name: "av1",
label: i18n("AV1")
Controls.ComboBox {
id: codec_combo
enabled: config.simpleConfig && config.encoder != Settings.EncoderAuto
model: [
{
label: i18nc("automatic codec setup", "Auto"),
codec: Settings.CodecAuto
},
{
label: i18n("H.264"),
codec: Settings.H264
},
{
label: i18n("H.265"),
codec: Settings.H265
},
{
label: i18n("AV1"),
codec: Settings.Av1
}
]
onCurrentIndexChanged: config.codec = model[currentIndex].codec
textRole: "label"
delegate: Controls.ItemDelegate {
required property string label
required property var codec
width: codec_combo.width
text: i18n(label)
highlighted: ListView.isCurrentItem
enabled: config.allowedCodecs.includes(codec)
}
]
textRole: "label"
onCurrentIndexChanged: partitionner.codec = model[currentIndex].name
delegate: Controls.ItemDelegate {
required property string label
required property string name
width: codec_combo.width
text: i18n(label)
highlighted: ListView.isCurrentItem
enabled: encoder_combo.model[encoder_combo.currentIndex].codecs.split(",").includes(name)
Connections {
target: config
function onCodecChanged() {
var codec = config.codec;
var i = codec_combo.model.findIndex( item => item.codec == codec)
if (i > -1)
codec_combo.currentIndex = i
}
}
}
Controls.CheckBox {
enabled: config.can10bit
text: i18n("10-bits")
checked: config.tenbit
}
Kirigami.ContextualHelpButton {
toolTipText: i18n("10-bit encoding improves image quality but is not supported by all codecs and hardware")
}
}
Kirigami.Separator {
Kirigami.FormData.isSection: true
}
@@ -453,9 +376,7 @@ Kirigami.ScrollablePage {
}
function save() {
config.bitrate = bitrate.value * 1000000;
config.scale = manual_foveation.checked ? 1 - scale_slider.value / 100.0 : -1;
config.manualEncoders = encoder_layout.currentIndex > 0;
let openvr = openvr_combobox.model.get(openvr_combobox.currentIndex)
if (openvr.is_custom) {
config.openvr = openvr_text.text;
@@ -471,22 +392,10 @@ Kirigami.ScrollablePage {
}
function load() {
bitrate.value = config.bitrate / 1000000;
if (config.scale > 0) {
scale_slider.value = Math.round(100 - config.scale * 100);
manual_foveation.checked = true;
} else {
scale_slider.value = 50;
manual_foveation.checked = false;
}
if (config.manualEncoders) {
// auto_encoders.checked = false;
encoder_layout.currentIndex = 1;
} else {
// auto_encoders.checked = true;
encoder_layout.currentIndex = 0;
}
debug_gui.checked = config.debugGui;
-21
View File
@@ -1,21 +0,0 @@
/*
* WiVRn VR streaming
* Copyright (C) 2024 Guillaume Meunier <guillaume.meunier@centraliens.net>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include "rectangle_partitionner.h"
#include "moc_rectangle_partitionner.cpp"
-935
View File
@@ -1,935 +0,0 @@
/*
* WiVRn VR streaming
* Copyright (C) 2024 Guillaume Meunier <guillaume.meunier@centraliens.net>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include <KLocalization>
#include <PlatformTheme>
#include <QApplication>
#include <QCursor>
#include <QObject>
#include <QPainter>
#include <QPalette>
#include <QPen>
#include <QQuickPaintedItem>
#include <platformtheme.h>
#include <qqmlengine.h>
#include "settings.h"
#include <ranges>
enum class side
{
top,
bottom,
left,
right
};
struct edge
{
side edge_side;
int rectangle_index;
bool operator==(const edge & other) const noexcept
{
return edge_side == other.edge_side and rectangle_index == other.rectangle_index;
}
double position = 0;
double min = std::numeric_limits<double>::max();
double max = std::numeric_limits<double>::lowest();
};
namespace
{
const double split_edge_threshold = 0.05;
const double move_edge_threshold = 0.02;
const double magnetism_threshold = 0.05;
const int num_subdiv = 20;
const double epsilon = 1.0 / (2 * num_subdiv);
QRectF rectangle_from_encoder(const encoder & enc)
{
QRectF r;
r.setX(enc.offset_x);
r.setY(enc.offset_y);
r.setWidth(enc.width);
r.setHeight(enc.height);
return r;
}
int hovered_rectangle(QPointF position, const std::vector<encoder> & encoders)
{
for (const auto [i, enc]: std::views::enumerate(encoders))
{
if (rectangle_from_encoder(enc).contains(position))
return i;
}
return -1;
}
Qt::CursorShape get_cursor_shape(QPointF position, const std::vector<encoder> & rectangles)
{
for (const encoder & i: rectangles)
{
QRectF r = rectangle_from_encoder(i);
if (r.contains(position))
{
QPointF rel_pos = position - r.topLeft();
double dx = std::min(rel_pos.x(), r.width() - rel_pos.x());
double dy = std::min(rel_pos.y(), r.height() - rel_pos.y());
if (dx < move_edge_threshold and position.x() >= epsilon and position.x() <= 1 - epsilon)
return Qt::SizeHorCursor;
else if (dy < move_edge_threshold and position.y() >= epsilon and position.y() <= 1 - epsilon)
return Qt::SizeVerCursor;
else if (dx < split_edge_threshold and position.y() >= epsilon and position.y() <= 1 - epsilon)
return Qt::SplitVCursor;
else if (dy < split_edge_threshold and position.x() >= epsilon and position.x() <= 1 - epsilon)
return Qt::SplitHCursor;
else
return Qt::ArrowCursor;
break;
}
}
return Qt::ArrowCursor;
}
std::vector<edge> horizontal_edges(const std::vector<encoder> & rectangles)
{
std::vector<edge> edges;
for (const auto & [i, enc]: std::views::enumerate(rectangles))
{
if (enc.top() > epsilon)
{
edges.emplace_back(side::top, i, enc.top(), enc.left(), enc.right());
}
if (rectangles[i].bottom() < 1 - epsilon)
{
edges.emplace_back(side::bottom, i, enc.bottom(), enc.left(), enc.right());
}
}
return edges;
}
std::vector<edge> vertical_edges(const std::vector<encoder> & rectangles)
{
std::vector<edge> edges;
for (const auto & [i, enc]: std::views::enumerate(rectangles))
{
if (enc.left() > epsilon)
{
edges.emplace_back(side::left, i, enc.left(), enc.top(), enc.bottom());
}
if (enc.right() < 1 - epsilon)
{
edges.emplace_back(side::right, i, enc.right(), enc.top(), enc.bottom());
}
}
return edges;
}
std::vector<std::vector<edge>> partition_edges(std::vector<edge> edges)
{
auto comp = [](const edge & a, const edge & b) {
if (a.position < b.position)
return true;
if (a.position > b.position)
return false;
if (a.min < b.min)
return true;
if (a.min > b.min)
return false;
if (a.max < b.max)
return true;
return false;
};
std::ranges::sort(edges, comp);
std::vector<std::vector<edge>> partitionned;
double current_position = std::numeric_limits<double>::lowest();
double current_max = 0;
for (auto & e: edges)
{
if (e.position != current_position)
{
current_position = e.position;
current_max = e.max;
partitionned.push_back({e});
}
else
{
if (e.min >= current_max)
{
// All the following edges will be after the last partition
current_max = e.max;
partitionned.push_back({e});
}
else
{
// Add the edge to the current partition
current_max = std::max(current_max, e.max);
partitionned.back().push_back(e);
}
}
}
return partitionned;
}
std::vector<edge> hovered_edges(QPointF position, const std::vector<std::vector<edge>> & partitionned_edges, bool horizontal)
{
if (horizontal)
position = position.transposed();
for (const auto & edge_list: partitionned_edges)
{
for (const auto & edge: edge_list)
{
if (std::abs(position.x() - edge.position) < move_edge_threshold and position.y() >= edge.min and position.y() <= edge.max)
{
return edge_list;
}
}
}
return {};
}
bool assert_rectangle_list_is_partition(const std::vector<encoder> & rectangles)
{
return true;
bool ok = true;
QRectF bounding_box{0, 0, 1, 1};
for (const auto & i: rectangles)
{
if (i.width < 0 or i.height < 0)
{
qDebug() << "Invalid rectangle" /*<< i*/;
ok = false;
}
}
std::vector<double> rectangle_y_boundaries;
for (auto & i: rectangles)
{
rectangle_y_boundaries.push_back(i.top());
rectangle_y_boundaries.push_back(i.bottom());
}
for (double y: rectangle_y_boundaries)
{
if (y < bounding_box.top())
continue;
if (y >= bounding_box.bottom())
continue;
qDebug() << "Checking line" << y;
std::vector<std::pair<double, double>> horizontal_segments;
for (const auto & i: rectangles)
{
if (y >= i.top() and y < i.bottom())
{
horizontal_segments.emplace_back(i.left(), i.right());
qDebug() << " Adding segment" << i.left() << "-" << i.right();
}
}
std::ranges::sort(horizontal_segments);
if (horizontal_segments.empty())
{
qDebug() << "Line" << y << "empty";
ok = false;
}
if (horizontal_segments.front().first != bounding_box.left())
{
qDebug() << "Line" << y << "does not start at the left of the bounding box" << (horizontal_segments.front().first - bounding_box.left());
ok = false;
}
if (horizontal_segments.back().second != bounding_box.right())
{
qDebug() << "Last rectangle of line" << y << "does not end at the right of the bounding box" << (horizontal_segments.back().second - bounding_box.right());
ok = false;
}
for (int i = 1; i < horizontal_segments.size(); ++i)
{
if (horizontal_segments[i - 1].second < horizontal_segments[i].first)
{
qDebug() << "Overlap in line" << y << (horizontal_segments[i - 1].second - horizontal_segments[i].first);
ok = false;
}
else if (horizontal_segments[i - 1].second > horizontal_segments[i].first)
{
qDebug() << "Gap in line" << y << (horizontal_segments[i - 1].second - horizontal_segments[i].first);
ok = false;
}
}
}
return ok;
}
} // namespace
class RectanglePartitionner : public QQuickPaintedItem
{
Q_OBJECT
QML_ELEMENT
Q_PROPERTY(Settings * settings READ settings WRITE setSettings NOTIFY settingsChanged)
Q_PROPERTY(bool selected READ selected NOTIFY selectedChanged)
Q_PROPERTY(QString encoder READ encoder WRITE setEncoder NOTIFY encoderChanged)
Q_PROPERTY(QString codec READ codec WRITE setCodec NOTIFY codecChanged)
Q_PROPERTY(int currentIndex READ currentIndex WRITE setCurrentIndex NOTIFY currentIndexChanged)
int m_currentIndex = -1;
Settings * m_settings = nullptr;
std::vector<edge> selection;
std::vector<edge> hovered;
double min_drag_position;
double max_drag_position;
QLine split_line;
QRect split_clip_rect;
Qt::CursorShape cursor_shape = Qt::ArrowCursor;
enum class mouse_event_type
{
move,
press,
release
};
Kirigami::Platform::PlatformTheme theme;
public:
RectanglePartitionner(QQuickItem * parent = nullptr) :
QQuickPaintedItem(parent),
theme(this)
{
setFlag(ItemHasContents);
setAcceptedMouseButtons(Qt::LeftButton);
setAcceptHoverEvents(true);
theme.setColorSet(Kirigami::Platform::PlatformTheme::View);
setFillColor(theme.backgroundColor());
connect(&theme, &Kirigami::Platform::PlatformTheme::colorsChanged, this, [&]() {
setFillColor(theme.backgroundColor());
update();
});
// connect(this, &QQuickItem::enabledChanged, this, [&](){
// if (isEnabled())
// theme.setColorGroup(Kirigami::Platform::PlatformTheme::Active);
// else
// theme.setColorGroup(Kirigami::Platform::PlatformTheme::Disabled);
// });
}
int currentIndex() const
{
return m_currentIndex;
}
bool selected() const
{
return m_currentIndex >= 0 and m_currentIndex < m_settings->encoders().size();
}
void setCurrentIndex(int value)
{
if (m_currentIndex != value)
{
m_currentIndex = value;
currentIndexChanged(value);
selectedChanged(selected());
encoderChanged(encoder());
codecChanged(codec());
update();
}
}
Settings * settings() const
{
return m_settings;
}
void onEncodersChanged()
{
update();
}
void setSettings(Settings * value)
{
if (m_settings != value)
{
if (m_settings)
disconnect(m_settings, &Settings::encodersChanged, this, &RectanglePartitionner::onEncodersChanged);
settingsChanged(m_settings = value);
if (m_settings)
connect(m_settings, &Settings::encodersChanged, this, &RectanglePartitionner::onEncodersChanged);
}
}
QString encoder() const
{
if (not m_settings or m_currentIndex < 0 or m_currentIndex >= m_settings->encoders().size())
return "";
return QString::fromStdString(Settings::encoder_from_id(m_settings->encoders()[m_currentIndex].name));
}
QString codec() const
{
if (not m_settings or m_currentIndex < 0 or m_currentIndex >= m_settings->encoders().size())
return "";
return QString::fromStdString(Settings::codec_from_id(m_settings->encoders()[m_currentIndex].codec));
}
void setEncoder(QString value)
{
qDebug() << "Setting encoder to " << value;
auto encoders = m_settings->encoders();
auto converted_value = Settings::encoder_id_from_string(value.toStdString());
if (not m_settings or m_currentIndex < 0 or m_currentIndex >= encoders.size())
return;
if (encoders[m_currentIndex].name == converted_value)
return;
encoders[m_currentIndex].name = converted_value;
m_settings->set_encoders(encoders);
update();
encoderLayoutChanged();
}
void setCodec(QString value)
{
qDebug() << "Setting codec to " << value;
auto encoders = m_settings->encoders();
auto converted_value = Settings::codec_id_from_string(value.toStdString());
if (not m_settings or m_currentIndex < 0 or m_currentIndex >= encoders.size())
return;
if (encoders[m_currentIndex].codec == converted_value)
return;
encoders[m_currentIndex].codec = Settings::codec_id_from_string(value.toStdString());
m_settings->set_encoders(encoders);
update();
encoderLayoutChanged();
}
QRect frameRect()
{
return {0, 0, (int)width() - 1, (int)height() - 1};
}
QPointF from_position(QPoint position)
{
auto r = frameRect();
return QPointF{
std::clamp(double(position.x() - r.x()) / (r.width() - 1), 0., 1.),
std::clamp(double(position.y() - r.y()) / (r.height() - 1), 0., 1.),
};
}
QPoint to_position(QPointF position)
{
auto r = frameRect();
return QPoint(
std::round(r.x() + position.x() * (r.width() - 1)),
std::round(r.y() + position.y() * (r.height() - 1)));
}
QRect to_position(QRectF position)
{
return QRect{to_position(position.topLeft()), to_position(position.bottomRight())};
}
QRect rectangle_position(int index)
{
return to_position(rectangle_from_encoder(m_settings->encoders().at(index)));
}
// Keep it in sync with SettingsPage.qml (codec_combo.model)
QString codec_name_from_setting(QString value)
{
if (value == "h264")
return i18n("H.264");
if (value == "h265")
return i18n("H.265");
if (value == "av1")
return i18n("AV1");
return i18nc("automatic codec setup", "Auto");
}
// Keep it in sync with SettingsPage.qml (encoder_combo.model)
QString encoder_name_from_setting(QString value)
{
if (value == "nvenc")
return i18n("nvenc");
if (value == "vaapi")
return i18n("vaapi");
if (value == "x264")
return i18n("x264");
if (value == "vulkan")
return i18n("Vulkan");
return i18nc("automatic encoder setup", "Auto");
}
// BEGIN Painting functions
void paint_single_rectangle_border(QPainter * painter, const ::encoder & enc)
{
QRectF r = rectangle_from_encoder(enc);
QRect rect = to_position(r);
QPen pen = painter->pen();
painter->setPen(QPen{theme.disabledTextColor()});
painter->drawRect(rect);
painter->setPen(pen);
}
void paint_single_rectangle(QPainter * painter, const ::encoder & enc, bool selected)
{
QRectF r = rectangle_from_encoder(enc);
QRect rect = to_position(r);
if (selected)
{
painter->fillRect(rect.adjusted(1, 1, 0, 0), theme.focusColor());
}
QString codec = QString::fromStdString(Settings::codec_from_id(enc.codec));
QString encoder = QString::fromStdString(Settings::encoder_from_id(enc.name));
QFont font = painter->font();
QFont font2 = font;
font2.setPixelSize(24);
QString text = QString("%1\n%2").arg(encoder_name_from_setting(encoder), codec_name_from_setting(codec));
QFontMetrics metrics{font2};
QSize size = metrics.size(0, text);
if (double ratio = std::max((double)size.width() / rect.width(), (double)size.height() / rect.height()); ratio > 1)
{
int pixel_size = font2.pixelSize() / ratio;
if (pixel_size > 0)
font2.setPixelSize(pixel_size);
}
QPen pen = painter->pen();
painter->setPen(QPen{theme.textColor()});
painter->setFont(font2);
painter->drawText(rect, Qt::AlignCenter, text);
painter->setFont(font);
painter->setPen(pen);
}
void paint(QPainter * painter) override
{
if (not m_settings)
return;
for (auto [i, enc]: std::views::enumerate(m_settings->encoders()))
{
bool is_selected = i == m_currentIndex and isEnabled();
paint_single_rectangle(painter, enc, is_selected);
}
if (not hovered.empty() and selection.empty())
{
for (auto & enc: m_settings->encoders())
{
paint_single_rectangle_border(painter, enc);
}
painter->setPen(QPen(Qt::blue, 3, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
auto r = frameRect();
QList<QLine> lines;
lines.reserve(hovered.size());
for (const edge & i: hovered)
{
QLineF line;
switch (i.edge_side)
{
case side::top:
case side::bottom:
line = QLineF(i.min, i.position, i.max, i.position);
break;
case side::left:
case side::right:
line = QLineF(i.position, i.min, i.position, i.max);
break;
}
int x1 = std::round(r.x() + line.x1() * (r.width() - 1));
int x2 = std::round(r.x() + line.x2() * (r.width() - 1));
int y1 = std::round(r.y() + line.y1() * (r.height() - 1));
int y2 = std::round(r.y() + line.y2() * (r.height() - 1));
lines.emplace_back(x1, y1, x2, y2);
}
painter->drawLines(lines);
auto horz_partitionned = partition_edges(horizontal_edges(m_settings->encoders()));
auto vert_partitionned = partition_edges(vertical_edges(m_settings->encoders()));
}
else if ((cursor_shape == Qt::SplitHCursor or cursor_shape == Qt::SplitVCursor) and not split_line.isNull())
{
auto now = std::chrono::duration_cast<std::chrono::duration<double>>(std::chrono::steady_clock::now().time_since_epoch()).count();
QPen pen(theme.disabledTextColor(), 2, Qt::DashLine, Qt::RoundCap, Qt::RoundJoin);
pen.setDashPattern({5, 5});
pen.setDashOffset(-now * 15);
painter->setPen(pen);
painter->setClipping(true);
painter->setClipRect(split_clip_rect.adjusted(1, 1, 0, 0));
painter->drawLine(split_line);
painter->setClipping(false);
update();
for (auto & enc: m_settings->encoders())
{
paint_single_rectangle_border(painter, enc);
}
}
else
{
for (auto & enc: m_settings->encoders())
{
paint_single_rectangle_border(painter, enc);
}
}
}
// END Painting functions
// BEGIN Mouse callbacks
void mouseMoveEvent(QMouseEvent * event) override
{
auto pos = event->position().toPoint();
auto encoders = m_settings->encoders();
if (not selection.empty())
{
double position;
if (selection.front().edge_side == side::top or selection.front().edge_side == side::bottom)
position = from_position(pos).y();
else
position = from_position(pos).x();
position = std::clamp(position, min_drag_position, max_drag_position);
position = std::round(position * num_subdiv) / num_subdiv; // magnetism
for (edge & e: selection)
{
switch (e.edge_side)
{
case side::top:
encoders[e.rectangle_index].set_top(position);
break;
case side::bottom:
encoders[e.rectangle_index].set_bottom(position);
break;
case side::left:
encoders[e.rectangle_index].set_left(position);
break;
case side::right:
encoders[e.rectangle_index].set_right(position);
break;
}
}
update();
m_settings->set_encoders(encoders);
encoderLayoutChanged();
}
}
void hoverMoveEvent(QHoverEvent * event) override
{
if (not m_settings)
return;
QPoint pos = event->position().toPoint();
const auto & encoders = m_settings->encoders();
hovered.clear();
if (auto horz_edges = hovered_edges(from_position(pos), partition_edges(horizontal_edges(encoders)), true); not horz_edges.empty())
{
hovered = std::move(horz_edges);
update();
}
else if (auto vert_edges = hovered_edges(from_position(pos), partition_edges(vertical_edges(encoders)), false); not vert_edges.empty())
{
hovered = std::move(vert_edges);
update();
}
else
{
int n = hovered_rectangle(from_position(pos), encoders);
}
Qt::CursorShape new_cursor = get_cursor_shape(from_position(pos), encoders);
if (new_cursor != cursor_shape)
{
update();
cursor_shape = new_cursor;
setCursor(QCursor(new_cursor));
}
if (cursor_shape == Qt::SplitHCursor)
{
int n = hovered_rectangle(from_position(pos), encoders);
double x = std::round(from_position(pos).x() * num_subdiv) / num_subdiv; // magnetism
int px = to_position({x, 0}).x();
split_line = {px, rectangle_position(n).top(), px, rectangle_position(n).bottom()};
split_clip_rect = rectangle_position(n);
update();
}
else if (cursor_shape == Qt::SplitVCursor)
{
int n = hovered_rectangle(from_position(pos), encoders);
double y = std::round(from_position(pos).y() * num_subdiv) / num_subdiv; // magnetism
int py = to_position({0, y}).y();
split_line = {rectangle_position(n).left(), py, rectangle_position(n).right(), py};
split_clip_rect = rectangle_position(n);
update();
}
else
{
split_line = {0, 0, 0, 0};
split_clip_rect = {0, 0, 0, 0};
}
}
void mousePressEvent(QMouseEvent * event) override
{
if (not m_settings)
return;
selection.clear();
split_line = {0, 0, 0, 0};
auto encoders = m_settings->encoders();
if (auto horz_edges = hovered_edges(from_position(event->pos()), partition_edges(horizontal_edges(encoders)), true); not horz_edges.empty())
{
selection = std::move(horz_edges);
}
else if (auto vert_edges = hovered_edges(from_position(event->pos()), partition_edges(vertical_edges(encoders)), false); not vert_edges.empty())
{
selection = std::move(vert_edges);
}
else if (int n = hovered_rectangle(from_position(event->pos()), encoders); n >= 0)
{
::encoder & hovered = encoders[n];
// Compute distance to edges
auto pos = from_position(event->pos());
double dx = std::min(pos.x() - hovered.left(), hovered.right() - pos.x());
double dy = std::min(pos.y() - hovered.top(), hovered.bottom() - pos.y());
if (dx < split_edge_threshold)
{
qDebug() << "Splitting rectangle " << n << " vertically";
double y = std::round(pos.y() * num_subdiv) / num_subdiv; // magnetism
// Split vertically
::encoder new_rectangle = hovered;
hovered.set_bottom(y);
new_rectangle.set_top(hovered.bottom());
encoders.push_back(new_rectangle);
update();
m_settings->set_encoders(encoders);
encoderLayoutChanged();
if (not assert_rectangle_list_is_partition(encoders))
abort();
}
else if (dy < split_edge_threshold)
{
qDebug() << "Splitting rectangle " << n << " horizontally";
double x = std::round(pos.x() * num_subdiv) / num_subdiv; // magnetism
// Split horizontally
::encoder new_rectangle = hovered;
hovered.set_right(x);
new_rectangle.set_left(hovered.right());
encoders.push_back(new_rectangle);
update();
m_settings->set_encoders(encoders);
encoderLayoutChanged();
if (not assert_rectangle_list_is_partition(encoders))
abort();
}
else
{
qDebug() << "Selecting rectangle " << n;
setCurrentIndex(n);
}
}
if (not selection.empty())
{
hovered.clear();
min_drag_position = std::numeric_limits<double>::lowest();
max_drag_position = std::numeric_limits<double>::max();
for (auto & e: selection)
{
switch (e.edge_side)
{
case side::top:
max_drag_position = std::min(max_drag_position, encoders[e.rectangle_index].bottom());
break;
case side::bottom:
min_drag_position = std::max(min_drag_position, encoders[e.rectangle_index].top());
break;
case side::left:
max_drag_position = std::min(max_drag_position, encoders[e.rectangle_index].right());
break;
case side::right:
min_drag_position = std::max(min_drag_position, encoders[e.rectangle_index].left());
break;
}
}
}
}
void mouseReleaseEvent(QMouseEvent * event) override
{
if (not m_settings)
return;
selection.clear();
auto encoders = m_settings->encoders();
// Delete empty rectangles
bool changed = false;
for (int i = 0; i < encoders.size();)
{
if (encoders[i].width <= 0.0001 or encoders[i].height <= 0.0001) // TODO configurable thresholds
{
qDebug() << "Removing rectangle " << i;
encoders.erase(encoders.begin() + i);
changed = true;
if (m_currentIndex > i)
m_currentIndex--;
else if (m_currentIndex == i)
{
m_currentIndex = -1;
}
}
else
{
++i;
}
}
if (changed)
{
if (not assert_rectangle_list_is_partition(encoders))
abort();
m_settings->set_encoders(encoders);
setCurrentIndex(m_currentIndex);
update();
encoderLayoutChanged();
}
}
void hoverLeaveEvent(QHoverEvent * event) override
{
hovered.clear();
split_line = {0, 0, 0, 0};
split_clip_rect = {0, 0, 0, 0};
update();
}
// END Mouse callbacks
Q_SIGNALS:
void settingsChanged(Settings *);
void selectedChanged(bool);
void encoderChanged(QString);
void codecChanged(QString);
void currentIndexChanged(int);
void encoderLayoutChanged();
};
+391 -263
View File
@@ -24,90 +24,112 @@
#include "wivrn_server.h"
#include <QList>
#include <QObject>
#include <QPointF>
#include <QRectF>
#include <QSizeF>
#include <cassert>
#include <nlohmann/json.hpp>
#include <qqmlintegration.h>
namespace
{
const std::vector<std::pair<encoder::encoder_name, std::string>> encoder_ids{
{encoder::encoder_name::nvenc, "nvenc"},
{encoder::encoder_name::vaapi, "vaapi"},
{encoder::encoder_name::x264, "x264"},
{encoder::encoder_name::vulkan, "vulkan"},
const std::vector<std::pair<Settings::encoder_name, std::string>> encoder_ids{
{Settings::encoder_name::Nvenc, "nvenc"},
{Settings::encoder_name::Vaapi, "vaapi"},
{Settings::encoder_name::X264, "x264"},
{Settings::encoder_name::Vulkan, "vulkan"},
};
const std::vector<std::pair<encoder::video_codec, std::string>> codec_ids{
{encoder::video_codec::h264, "h264"},
{encoder::video_codec::h264, "avc"},
{encoder::video_codec::h265, "h265"},
{encoder::video_codec::h265, "hevc"},
{encoder::video_codec::av1, "av1"},
{encoder::video_codec::av1, "AV1"},
const std::vector<std::tuple<Settings::video_codec, std::string>> codec_ids{
{Settings::video_codec::H264, "h264"},
{Settings::video_codec::H264, "avc"},
{Settings::video_codec::H265, "h265"},
{Settings::video_codec::H265, "hevc"},
{Settings::video_codec::Av1, "av1"},
{Settings::video_codec::Av1, "AV1"},
};
bool can10bit(Settings::video_codec c)
{
switch (c)
{
case Settings::CodecAuto:
case Settings::H264:
return false;
case Settings::H265:
case Settings::Av1:
return true;
}
return false;
}
} // namespace
std::optional<encoder::encoder_name> Settings::encoder_id_from_string(std::string_view s)
Settings::encoder_name Settings::encoder_id_from_string(std::string_view s)
{
for (auto & [i, j]: encoder_ids)
{
if (j == s)
return i;
}
return std::nullopt;
return Settings::encoder_name::EncoderAuto;
}
std::optional<encoder::video_codec> Settings::codec_id_from_string(std::string_view s)
Settings::video_codec Settings::codec_id_from_string(std::string_view s)
{
for (auto & [i, j]: codec_ids)
{
if (j == s)
return i;
}
return std::nullopt;
return Settings::video_codec::CodecAuto;
}
const std::string & Settings::encoder_from_id(std::optional<encoder::encoder_name> id)
const std::string & Settings::encoder_from_id(Settings::encoder_name id)
{
static const std::string default_value = "auto";
if (not id)
return default_value;
for (auto & [i, j]: encoder_ids)
{
if (i == *id)
if (i == id)
return j;
}
return default_value;
}
const std::string & Settings::codec_from_id(std::optional<encoder::video_codec> id)
const std::string & Settings::codec_from_id(Settings::video_codec id)
{
static const std::string default_value = "auto";
if (not id)
return default_value;
for (auto & [i, j]: codec_ids)
{
if (i == *id)
if (i == id)
return j;
}
return default_value;
}
void Settings::emitAllChanged()
{
simpleConfigChanged();
encoderChanged();
codecChanged();
tenbitChanged();
bitrateChanged();
scaleChanged();
tcpOnlyChanged();
applicationChanged();
openvrChanged();
debugGuiChanged();
steamVrLhChanged();
}
void Settings::load(const wivrn_server * server)
{
// Encoders configuration
nlohmann::json json_doc;
try
{
auto conf = server->jsonConfiguration();
json_doc = nlohmann::json::parse(conf.toUtf8());
m_jsonSettings = nlohmann::json::parse(conf.toUtf8());
emitAllChanged();
}
catch (std::exception & e)
{
@@ -115,260 +137,366 @@ void Settings::load(const wivrn_server * server)
restore_defaults();
return;
}
}
std::vector<encoder> new_encoders;
bool Settings::simpleConfig() const
{
// Simple configuration: either unset, or all encoders + codecs are the same
try
{
nlohmann::json json_encoders;
if (json_doc.contains("encoders"))
auto it = m_jsonSettings.find("encoders");
if (it == m_jsonSettings.end())
return true;
std::optional<encoder_name> encoder;
std::optional<video_codec> codec;
for (const auto & item: *it)
{
json_encoders = json_doc["encoders"];
set_manualEncoders(true);
}
else if (json_doc.contains("encoders.disabled"))
{
json_encoders = json_doc["encoders.disabled"];
set_manualEncoders(false);
}
else
{
set_manualEncoders(false);
}
for (auto & i: json_encoders)
{
encoder enc;
enc.name = encoder_id_from_string(i.value("encoder", "auto"));
enc.codec = codec_id_from_string(i.value("codec", "auto"));
enc.width = i.value("width", 1.0);
enc.height = i.value("height", 1.0);
enc.offset_x = i.value("offset_x", 0.0);
enc.offset_y = i.value("offset_y", 0.0);
enc.group = i.value("group", 0); // TODO: handle groups
new_encoders.push_back(enc);
}
}
catch (...)
{
// QMessageBox msgbox{QMessageBox::Information, tr("Invalid settings"), tr("The encoder configuration is invalid, the default values will be restored."), QMessageBox::Close, this};
// msgbox.exec();
new_encoders.clear();
}
set_encoders(new_encoders);
if (encoders().empty())
{
set_manualEncoders(false);
std::vector<encoder> new_encoders;
new_encoders.push_back(encoder{
.width = 1,
.height = 1,
.offset_x = 0,
.offset_y = 0,
});
set_encoders(new_encoders);
}
// Foveation
try
{
if (json_doc.contains("scale"))
{
set_scale(json_doc.value("scale", 1.0));
}
else
{
set_scale(-1);
}
}
catch (...)
{
set_scale(-1);
}
// Bitrate
try
{
set_bitrate(json_doc.value("bitrate", 50'000'000));
}
catch (...)
{
set_bitrate(50'000'000);
}
// Automatically started application
std::vector<std::string> application;
try
{
if (json_doc["application"].is_array())
application = json_doc.value<std::vector<std::string>>("application", {});
else if (json_doc["application"].is_string())
application.push_back(json_doc["application"]);
set_application(escape_string(application));
}
catch (...)
{
set_application("");
}
// Advanced options (debug window, steamvr_lh)
try
{
set_debugGui(json_doc.value("debug-gui", false));
}
catch (...)
{
set_debugGui(false);
}
try
{
set_steamVrLh(json_doc.value("use-steamvr-lh", false));
}
catch (...)
{
set_steamVrLh(false);
}
// OpenVR compat library
try
{
if (auto it = json_doc.find("openvr-compat-path"); it != json_doc.end())
{
if (it->is_null())
set_openvr("-");
if (auto it = item.find("encoder"); it != item.end())
{
auto e = encoder_id_from_string(std::string(*it));
if (encoder and e != encoder)
return false;
encoder = e;
}
else
set_openvr(QString::fromStdString(*it));
{
encoder = encoder_name::EncoderAuto;
}
if (auto it = item.find("codec"); it != item.end())
{
auto e = codec_id_from_string(std::string(*it));
if (codec and e != codec)
return false;
codec = e;
}
else
{
codec = video_codec::CodecAuto;
}
}
else
return true;
}
catch (...)
{
return false;
}
}
Settings::encoder_name Settings::encoder() const
{
try
{
auto it = m_jsonSettings.find("encoders");
if (it == m_jsonSettings.end())
return encoder_name::EncoderAuto;
for (const auto & item: *it)
{
set_openvr("");
if (auto it = item.find("encoder"); it != item.end())
return encoder_id_from_string(std::string(*it));
return encoder_name::EncoderAuto;
}
}
catch (...)
{
set_openvr("");
}
return encoder_name::EncoderAuto;
}
void Settings::set_encoder(const encoder_name & value)
{
auto old = encoder();
switch (value)
{
case EncoderAuto:
m_jsonSettings.erase("encoders");
break;
case Nvenc:
case Vaapi:
case Vulkan: {
auto & enc = m_jsonSettings["encoders"] = nlohmann::json::array();
for (float offset: {0.f, 0.5f})
{
auto obj = nlohmann::json::object({
{"width", 0.5},
{"encoder", encoder_from_id(value)},
});
if (offset)
obj["offset_x"] = offset;
if (value == Vulkan)
obj["codec"] = "h264";
enc.push_back(obj);
}
}
break;
case encoder_name::X264:
m_jsonSettings["encoders"] =
nlohmann::json::parse(R"([{"encoder": "x264", "codec": "h264"}])");
break;
}
if (value != old)
{
encoderChanged();
codecChanged();
if (not can10bit())
set_tenbit(false);
}
simpleConfigChanged();
}
Settings::video_codec Settings::codec() const
{
try
{
auto it = m_jsonSettings.find("encoders");
if (it == m_jsonSettings.end())
return video_codec::CodecAuto;
for (const auto & item: *it)
{
if (auto it = item.find("codec"); it != item.end())
return codec_id_from_string(std::string(*it));
return video_codec::CodecAuto;
}
}
catch (...)
{
}
return video_codec::CodecAuto;
}
void Settings::set_codec(const video_codec & value)
{
auto old = codec();
auto it = m_jsonSettings.find("encoders");
if (it == m_jsonSettings.end() or not it->is_array())
return;
for (auto & item: *it)
{
if (not item.is_object())
continue;
if (value == CodecAuto)
item.erase("codec");
else
item["codec"] = codec_from_id(value);
}
if (value != old)
{
if (::can10bit(value) != ::can10bit(old))
set_tenbit(::can10bit(value));
codecChanged();
}
}
bool Settings::tenbit() const
{
try
{
return m_jsonSettings.value("bit-depth", 8) == 10;
}
catch (...)
{}
return false;
}
void Settings::set_tenbit(const bool & value)
{
auto old = tenbit();
m_jsonSettings["bit-depth"] = value ? 10 : 8;
if (value != old)
tenbitChanged();
}
int Settings::bitrate() const
{
try
{
return m_jsonSettings.value("bitrate", 50'000'000) / 1'000'000;
}
catch (...)
{
return 50;
}
}
void Settings::set_bitrate(const int & value)
{
auto old = bitrate();
m_jsonSettings["bitrate"] = value * 1'000'000;
if (old != value)
bitrateChanged();
}
float Settings::scale() const
{
// Foveation
auto it = m_jsonSettings.find("scale");
if (it != m_jsonSettings.end() and it->is_number())
return *it;
return -1;
}
void Settings::set_scale(const float & value)
{
auto old = scale();
if (value == -1)
m_jsonSettings.erase("scale");
else
m_jsonSettings["scale"] = value;
if (old != value)
scaleChanged();
}
QString Settings::application() const
{
// Automatically started application
try
{
std::vector<std::string> application;
auto it = m_jsonSettings.find("application");
if (it == m_jsonSettings.end())
return "";
if (it->is_array())
application = *it;
else if (it->is_string())
application.push_back(*it);
return escape_string(application);
}
catch (...)
{
return "";
}
}
void Settings::set_application(const QString & value)
{
auto old = application();
if (value.isEmpty())
m_jsonSettings.erase("application");
else
m_jsonSettings["application"] = unescape_string(value);
if (old != value)
applicationChanged();
}
bool Settings::debugGui() const
{
// Advanced options (debug window, steamvr_lh)
auto it = m_jsonSettings.find("debug-gui");
if (it != m_jsonSettings.end() and it->is_boolean())
return *it;
return false;
}
void Settings::set_debugGui(const bool & value)
{
auto old = debugGui();
m_jsonSettings["debug-gui"] = value;
if (old != value)
debugGuiChanged();
}
bool Settings::steamVrLh() const
{
auto it = m_jsonSettings.find("use-steamvr-lh");
if (it != m_jsonSettings.end() and it->is_boolean())
return *it;
return false;
}
void Settings::set_steamVrLh(const bool & value)
{
auto old = steamVrLh();
m_jsonSettings["use-steamvr-lh"] = value;
if (old != value)
steamVrLhChanged();
}
bool Settings::tcpOnly() const
{
auto it = m_jsonSettings.find("tcp-only");
if (it != m_jsonSettings.end() and it->is_boolean())
return *it;
return false;
}
void Settings::set_tcpOnly(const bool & value)
{
auto old = tcpOnly();
m_jsonSettings["tcp-only"] = value;
if (old != value)
tcpOnlyChanged();
}
QString Settings::openvr() const
{
// OpenVR compat library
if (auto it = m_jsonSettings.find("openvr-compat-path"); it != m_jsonSettings.end())
{
if (it->is_null())
return "-";
if (it->is_string())
return QString::fromStdString(*it);
}
return "";
}
void Settings::set_openvr(const QString & value)
{
auto old = openvr();
if (value == "-")
m_jsonSettings["openvr-compat-path"] = nullptr;
else if (value == "")
m_jsonSettings.erase("openvr-compat-path");
else
m_jsonSettings["openvr-compat-path"] = value.toStdString();
if (old != value)
tcpOnlyChanged();
}
QList<Settings::video_codec> Settings::allowedCodecs() const
{
switch (encoder())
{
case encoder_name::EncoderAuto:
return {video_codec::CodecAuto};
case encoder_name::Nvenc:
case encoder_name::Vaapi:
return {
video_codec::CodecAuto,
video_codec::H264,
video_codec::H265,
video_codec::Av1,
};
case encoder_name::X264:
case encoder_name::Vulkan:
return {video_codec::H264};
}
return {video_codec::CodecAuto};
}
bool Settings::can10bit() const
{
return ::can10bit(codec());
}
void Settings::save(wivrn_server * server)
{
nlohmann::json json_doc;
try
{
auto conf = server->jsonConfiguration();
json_doc = nlohmann::json::parse(conf.toUtf8());
}
catch (...)
{
}
// Remove all optional keys that might not be overwritten
auto it = json_doc.find("scale");
if (it != json_doc.end())
json_doc.erase(it);
it = json_doc.find("encoders.disabled");
if (it != json_doc.end())
json_doc.erase(it);
it = json_doc.find("encoders");
if (it != json_doc.end())
json_doc.erase(it);
it = json_doc.find("application");
if (it != json_doc.end())
json_doc.erase(it);
if (scale() > 0)
json_doc["scale"] = scale();
json_doc["bitrate"] = bitrate();
std::vector<nlohmann::json> encoders;
for (auto & enc: m_encoders)
{
nlohmann::json encoder;
if (auto value = encoder_from_id(enc.name); value != "auto")
encoder["encoder"] = value;
if (auto value = codec_from_id(enc.codec); value != "auto")
encoder["codec"] = value;
encoder["width"] = enc.width;
encoder["height"] = enc.height;
encoder["offset_x"] = enc.offset_x;
encoder["offset_y"] = enc.offset_y;
// TODO encoder groups
encoders.push_back(encoder);
}
std::ranges::stable_sort(encoders, [](const nlohmann::json & i, const nlohmann::json & j) {
double size_i = i.value("width", 0.0) * i.value("height", 0.0);
double size_j = j.value("width", 0.0) * j.value("height", 0.0);
return size_i < size_j;
});
if (manualEncoders())
json_doc["encoders"] = encoders;
else
json_doc["encoders.disabled"] = encoders;
if (application() != "")
json_doc["application"] = unescape_string(application());
json_doc["debug-gui"] = debugGui();
json_doc["use-steamvr-lh"] = steamVrLh();
if (openvr() == "-")
json_doc["openvr-compat-path"] = nullptr;
else if (openvr() == "")
json_doc.erase("openvr-compat-path");
else
json_doc["openvr-compat-path"] = openvr().toStdString();
server->setJsonConfiguration(QString::fromStdString(json_doc.dump(2)));
server->setJsonConfiguration(QString::fromStdString(m_jsonSettings.dump(2)));
}
void Settings::restore_defaults()
{
set_encoders({});
set_encoderPassthrough({});
set_bitrate(50'000'000);
set_scale(-1);
set_application("");
set_debugGui(false);
set_steamVrLh(false);
set_tcpOnly(false);
}
void Settings::set_encoder_preset(QJSValue preset)
{
QJSEngine engine;
const QJsonArray json_encoders = engine.fromScriptValue<QJsonValue>(preset).toArray();
std::vector<encoder> encoders;
for (const QJsonValue & json_encoder_value: json_encoders)
{
QJsonObject json_encoder = json_encoder_value.toObject();
encoders.push_back(encoder{
.name = encoder_id_from_string(json_encoder["encoder"].toString("auto").toStdString()),
.width = json_encoder["width"].toDouble(),
.height = json_encoder["height"].toDouble(),
.offset_x = json_encoder["offset_x"].toDouble(),
.offset_y = json_encoder["offset_y"].toDouble(),
.codec = codec_id_from_string(json_encoder["codec"].toString("auto").toStdString()),
});
}
set_manualEncoders(true);
set_encoders(encoders);
m_jsonSettings.erase("encoders");
m_jsonSettings.erase("encoder-passthrough");
m_jsonSettings.erase("scale");
m_jsonSettings.erase("bitrate");
m_jsonSettings.erase("application");
m_jsonSettings.erase("debug-gui");
m_jsonSettings.erase("use-steamvr-lh");
m_jsonSettings.erase("tcp-only");
m_jsonSettings.erase("application");
emitAllChanged();
}
bool Settings::flatpak() const
+49 -95
View File
@@ -26,114 +26,63 @@
#include <nlohmann/json.hpp>
#include <qqmlintegration.h>
#define SETTER_GETTER_NOTIFY(type, prop_name) \
private: \
type m_##prop_name; \
\
public: \
const type & prop_name() const \
{ \
return m_##prop_name; \
} \
void set_##prop_name(const type & value) \
{ \
m_##prop_name = value; \
prop_name##Changed(value); \
} \
Q_SIGNALS: \
void prop_name##Changed(const type &);
#define SETTER_GETTER_NOTIFY(type, prop_name) \
public: \
type prop_name() const; \
void set_##prop_name(const type & value); \
Q_SIGNALS: \
void prop_name##Changed();
class wivrn_server;
struct encoder
{
enum class video_codec
{
h264,
h265,
av1,
};
enum class encoder_name
{
nvenc,
vaapi,
x264,
vulkan
};
std::optional<encoder_name> name;
double width;
double height;
double offset_x;
double offset_y;
std::optional<int> group;
std::optional<video_codec> codec;
std::map<std::string, std::string> options;
std::optional<std::string> device;
double top() const
{
return offset_y;
}
void set_top(double value)
{
height = bottom() - value;
offset_y = value;
}
double bottom() const
{
return offset_y + height;
}
void set_bottom(double value)
{
height = value - top();
}
double left() const
{
return offset_x;
}
void set_left(double value)
{
width = right() - value;
offset_x = value;
}
double right() const
{
return offset_x + width;
}
void set_right(double value)
{
width = value - left();
}
};
class Settings : public QObject
{
Q_OBJECT
QML_ELEMENT
public:
enum encoder_name
{
EncoderAuto,
Nvenc,
Vaapi,
X264,
Vulkan,
};
Q_ENUM(encoder_name)
Q_PROPERTY(bool manualEncoders READ manualEncoders WRITE set_manualEncoders NOTIFY manualEncodersChanged)
Q_PROPERTY(std::vector<encoder> encoders READ encoders WRITE set_encoders NOTIFY encodersChanged)
Q_PROPERTY(encoder encoderPassthrough READ encoderPassthrough WRITE set_encoderPassthrough NOTIFY encoderPassthroughChanged)
enum video_codec
{
CodecAuto,
H264,
H265,
Av1,
};
Q_ENUM(video_codec)
Q_PROPERTY(bool simpleConfig READ simpleConfig NOTIFY simpleConfigChanged)
Q_PROPERTY(encoder_name encoder READ encoder WRITE set_encoder NOTIFY encoderChanged)
Q_PROPERTY(video_codec codec READ codec WRITE set_codec NOTIFY codecChanged)
Q_PROPERTY(QList<video_codec> allowedCodecs READ allowedCodecs NOTIFY encoderChanged)
Q_PROPERTY(bool can10bit READ can10bit NOTIFY codecChanged)
Q_PROPERTY(bool tenbit READ tenbit WRITE set_tenbit NOTIFY tenbitChanged)
Q_PROPERTY(int bitrate READ bitrate WRITE set_bitrate NOTIFY bitrateChanged)
Q_PROPERTY(float scale READ scale WRITE set_scale NOTIFY scaleChanged)
Q_PROPERTY(bool tcpOnly READ tcpOnly WRITE set_tcpOnly NOTIFY tcpOnlyChanged)
Q_PROPERTY(QString application READ application WRITE set_application NOTIFY applicationChanged)
Q_PROPERTY(QString openvr READ openvr WRITE set_openvr NOTIFY openvrChanged)
Q_PROPERTY(bool debugGui READ debugGui WRITE set_debugGui NOTIFY debugGuiChanged)
Q_PROPERTY(bool steamVrLh READ steamVrLh WRITE set_steamVrLh NOTIFY steamVrLhChanged)
Q_PROPERTY(bool tcpOnly READ tcpOnly WRITE set_tcpOnly NOTIFY tcpOnlyChanged)
Q_PROPERTY(QString openvr READ openvr WRITE set_openvr NOTIFY openvrChanged)
Q_PROPERTY(bool flatpak READ flatpak CONSTANT)
Q_PROPERTY(bool debug_gui_supported READ debug_gui CONSTANT)
Q_PROPERTY(bool steamvr_lh_supported READ steamvr_lh CONSTANT)
SETTER_GETTER_NOTIFY(bool, manualEncoders)
SETTER_GETTER_NOTIFY(std::vector<encoder>, encoders)
SETTER_GETTER_NOTIFY(encoder, encoderPassthrough)
SETTER_GETTER_NOTIFY(bool, simpleConfig)
SETTER_GETTER_NOTIFY(encoder_name, encoder)
SETTER_GETTER_NOTIFY(video_codec, codec)
SETTER_GETTER_NOTIFY(bool, tenbit)
SETTER_GETTER_NOTIFY(int, bitrate)
SETTER_GETTER_NOTIFY(float, scale)
SETTER_GETTER_NOTIFY(QString, application)
@@ -141,6 +90,9 @@ class Settings : public QObject
SETTER_GETTER_NOTIFY(bool, steamVrLh)
SETTER_GETTER_NOTIFY(bool, tcpOnly)
SETTER_GETTER_NOTIFY(QString, openvr)
private:
nlohmann::json m_jsonSettings = nlohmann::json::object();
void emitAllChanged();
public:
Settings(QObject * parent = nullptr) :
@@ -149,16 +101,18 @@ public:
Q_INVOKABLE void load(const wivrn_server * server);
Q_INVOKABLE void save(wivrn_server * server);
Q_INVOKABLE void restore_defaults();
Q_INVOKABLE void set_encoder_preset(QJSValue preset);
QList<video_codec> allowedCodecs() const;
bool can10bit() const;
bool flatpak() const;
bool debug_gui() const;
bool steamvr_lh() const;
static std::optional<encoder::encoder_name> encoder_id_from_string(std::string_view s);
static std::optional<encoder::video_codec> codec_id_from_string(std::string_view s);
static const std::string & encoder_from_id(std::optional<encoder::encoder_name> id);
static const std::string & codec_from_id(std::optional<encoder::video_codec> id);
static encoder_name encoder_id_from_string(std::string_view s);
static video_codec codec_id_from_string(std::string_view s);
static const std::string & encoder_from_id(encoder_name id);
static const std::string & codec_from_id(video_codec id);
};
#undef SETTER_GETTER_NOTIFY
+90 -72
View File
@@ -8,8 +8,8 @@ msgid ""
msgstr ""
"Project-Id-Version: WiVRn-dashboard\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-10-26 13:46+0100\n"
"PO-Revision-Date: 2025-10-29 00:22+0100\n"
"POT-Creation-Date: 2025-10-29 23:59+0100\n"
"PO-Revision-Date: 2025-10-30 23:00+0100\n"
"Last-Translator: Álvaro De Quinta <blackcherry@danwin1210.de>\n"
"Language-Team: Spanish\n"
"Language: es\n"
@@ -451,140 +451,119 @@ msgstr "Más fuerte"
msgid "Bitrate:"
msgstr "Tasa de bits:"
#: dashboard/qml/SettingsPage.qml:100 dashboard/qml/SettingsPage.qml:102
#: dashboard/qml/SettingsPage.qml:101 dashboard/qml/SettingsPage.qml:103
#, kde-format
msgctxt "bitrate"
msgid "%1 Mbit/s"
msgstr "%1 Mbit/s"
#: dashboard/qml/SettingsPage.qml:112
#, kde-format
msgid "Encoder layout:"
msgstr "Configuración del codificador:"
#: dashboard/qml/SettingsPage.qml:115
#, kde-format
msgctxt "encoder preset"
msgid "Automatic"
msgstr "Automático"
msgid "The current encoder configuration is not supported"
msgstr "La configuración actual del codificador no está soportada"
#: dashboard/qml/SettingsPage.qml:119
#: dashboard/qml/SettingsPage.qml:120
#, kde-format
msgctxt "encoder preset"
msgid "Manual"
msgstr "Manual"
msgid "Reset"
msgstr "Restablecer"
#: dashboard/qml/SettingsPage.qml:123
#, kde-format
msgctxt "encoder preset"
msgid "Default preset"
msgstr "Preajuste predeterminado"
#: dashboard/qml/SettingsPage.qml:140
#, kde-format
msgctxt "encoder preset"
msgid "Low latency preset"
msgstr "Preajuste de baja latencia"
#: dashboard/qml/SettingsPage.qml:159
#, kde-format
msgctxt "encoder preset"
msgid "Safe preset"
msgstr "Preajuste seguro"
#: dashboard/qml/SettingsPage.qml:182
#, kde-format
msgid ""
"To add a new encoder, split an existing encoder by clicking near an edge.\n"
"Drag an edge to resize or remove encoders."
msgstr ""
"Para agregar un nuevo codificador, divide un codificador existente haciendo "
"clic cerca de un borde.\n"
"Arrastra un borde para cambiar el tamaño o eliminar codificadores."
#: dashboard/qml/SettingsPage.qml:209
#: dashboard/qml/SettingsPage.qml:127
#, kde-format
msgid "Encoder:"
msgstr "Codificador"
#: dashboard/qml/SettingsPage.qml:218
#: dashboard/qml/SettingsPage.qml:133
#, kde-format
msgctxt "automatic encoder setup"
msgid "Auto"
msgstr "Automático"
#: dashboard/qml/SettingsPage.qml:223
#: dashboard/qml/SettingsPage.qml:137
#, kde-format
msgid "nvenc (NVIDIA GPUs)"
msgstr "nvenc (NVIDIA GPUs)"
#: dashboard/qml/SettingsPage.qml:228
#: dashboard/qml/SettingsPage.qml:141
#, kde-format
msgid "vaapi (AMD and Intel GPUs)"
msgstr "vaapi (AMD y Intel GPUs)"
#: dashboard/qml/SettingsPage.qml:233
#, kde-format
msgid "x264 (software encoding)"
msgstr "x264 (codificación por software)"
#: dashboard/qml/SettingsPage.qml:238
#: dashboard/qml/SettingsPage.qml:145
#, kde-format
msgid "Vulkan (Vulkan Video)"
msgstr "Vulkan (Vulkan Video)"
#: dashboard/qml/SettingsPage.qml:261
#: dashboard/qml/SettingsPage.qml:149
#, kde-format
msgid "x264 (software encoding)"
msgstr "x264 (codificación por software)"
#: dashboard/qml/SettingsPage.qml:166
#, kde-format
msgid "\"Auto\" will use hardware acceleration if it is available"
msgstr "\"Auto\" utilizará aceleración por hardware si está disponible"
#: dashboard/qml/SettingsPage.qml:267
#: dashboard/qml/SettingsPage.qml:171
#, kde-format
msgid "Codec:"
msgstr "Códec"
#: dashboard/qml/SettingsPage.qml:274
#: dashboard/qml/SettingsPage.qml:177
#, kde-format
msgctxt "automatic codec setup"
msgid "Auto"
msgstr "Automático"
#: dashboard/qml/SettingsPage.qml:278
#: dashboard/qml/SettingsPage.qml:181
#, kde-format
msgid "H.264"
msgstr "H.264"
#: dashboard/qml/SettingsPage.qml:282
#: dashboard/qml/SettingsPage.qml:185
#, kde-format
msgid "H.265"
msgstr "H.265"
#: dashboard/qml/SettingsPage.qml:286
#: dashboard/qml/SettingsPage.qml:189
#, kde-format
msgid "AV1"
msgstr "AV1"
#: dashboard/qml/SettingsPage.qml:308
#: dashboard/qml/SettingsPage.qml:217
#, kde-format
msgid "10-bits"
msgstr "10-bits"
#: dashboard/qml/SettingsPage.qml:221
#, kde-format
msgid ""
"10-bit encoding improves image quality but is not supported by all codecs "
"and hardware"
msgstr ""
"La codificación de 10-bit mejora la calidad de imagen pero no está soportada "
"por todos los codecs ni hardware"
#: dashboard/qml/SettingsPage.qml:231
#, kde-format
msgid "Advanced options"
msgstr "Opciones avanzadas"
#: dashboard/qml/SettingsPage.qml:314
#: dashboard/qml/SettingsPage.qml:237
#, kde-format
msgid "Check system configuration on start"
msgstr "Comprobar configuración del sistema al iniciar"
#: dashboard/qml/SettingsPage.qml:318
#: dashboard/qml/SettingsPage.qml:241
#, kde-format
msgid "Enable debug window"
msgstr "Habilitar ventana de depuración"
#: dashboard/qml/SettingsPage.qml:325
#: dashboard/qml/SettingsPage.qml:248
#, kde-format
msgid "Enable SteamVR tracked devices support"
msgstr "Habilitar soporte para dispositivos de seguimiento a través de SteamVR"
#: dashboard/qml/SettingsPage.qml:328
#: dashboard/qml/SettingsPage.qml:251
#, kde-format
msgid ""
"Allows the use of lighthouse-based controllers and trackers.\n"
@@ -598,44 +577,44 @@ msgstr ""
"Los dispositivos deben de estar encendidos antes de conectarte a WiVRn.\n"
"Una herramienta externa como motoc será necesaria para la calibración."
#: dashboard/qml/SettingsPage.qml:336
#: dashboard/qml/SettingsPage.qml:259
#, kde-format
msgid "Custom adb location"
msgstr "Ruta de adb personalizada"
#: dashboard/qml/SettingsPage.qml:347
#: dashboard/qml/SettingsPage.qml:270
#, kde-format
msgid "Adb location:"
msgstr "Ruta de adb:"
#: dashboard/qml/SettingsPage.qml:356
#: dashboard/qml/SettingsPage.qml:279
#, kde-format
msgctxt "browse a file to choose the adb binary"
msgid "Browse"
msgstr "Explorar"
#: dashboard/qml/SettingsPage.qml:366
#: dashboard/qml/SettingsPage.qml:289
#, kde-format
msgid "Default"
msgstr "Por defecto"
#: dashboard/qml/SettingsPage.qml:380
#: dashboard/qml/SettingsPage.qml:303
#, kde-format
msgctxt "set a custom OpenVR compatibility library"
msgid "Custom"
msgstr "Personalizado"
#: dashboard/qml/SettingsPage.qml:385
#: dashboard/qml/SettingsPage.qml:308
#, kde-format
msgid "Disabled"
msgstr "Deshabilitado"
#: dashboard/qml/SettingsPage.qml:393
#: dashboard/qml/SettingsPage.qml:316
#, kde-format
msgid "OpenVR compatibility library:"
msgstr "Librería de compatibilidad para OpenVR:"
#: dashboard/qml/SettingsPage.qml:419
#: dashboard/qml/SettingsPage.qml:342
#, kde-format
msgid "Library path, excluding bin/linux64/vrclient.so"
msgstr "Ruta de librería, excluyendo bin/linux64/vrclient.so"
@@ -987,6 +966,45 @@ msgstr "xrizer"
msgid "Open Composite"
msgstr "Open Composite"
#, kde-format
#~ msgid "Encoder layout:"
#~ msgstr "Configuración del codificador:"
#, kde-format
#~ msgctxt "encoder preset"
#~ msgid "Automatic"
#~ msgstr "Automático"
#, kde-format
#~ msgctxt "encoder preset"
#~ msgid "Manual"
#~ msgstr "Manual"
#, kde-format
#~ msgctxt "encoder preset"
#~ msgid "Default preset"
#~ msgstr "Preajuste predeterminado"
#, kde-format
#~ msgctxt "encoder preset"
#~ msgid "Low latency preset"
#~ msgstr "Preajuste de baja latencia"
#, kde-format
#~ msgctxt "encoder preset"
#~ msgid "Safe preset"
#~ msgstr "Preajuste seguro"
#, kde-format
#~ msgid ""
#~ "To add a new encoder, split an existing encoder by clicking near an "
#~ "edge.\n"
#~ "Drag an edge to resize or remove encoders."
#~ msgstr ""
#~ "Para agregar un nuevo codificador, divide un codificador existente "
#~ "haciendo clic cerca de un borde.\n"
#~ "Arrastra un borde para cambiar el tamaño o eliminar codificadores."
#, kde-format
#~ msgid ""
#~ "If the server is not visible or the connection fails, check that port "
+90 -72
View File
@@ -5,8 +5,8 @@ msgid ""
msgstr ""
"Project-Id-Version: WiVRn-dashboard\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-10-26 13:46+0100\n"
"PO-Revision-Date: 2025-10-26 13:47+0100\n"
"POT-Creation-Date: 2025-10-30 09:53+0100\n"
"PO-Revision-Date: 2025-10-30 09:55+0100\n"
"Last-Translator: Guillaume Meunier <guillaume.meunier@centraliens.net>\n"
"Language-Team: French <>\n"
"Language: French\n"
@@ -445,141 +445,120 @@ msgstr "Fort"
msgid "Bitrate:"
msgstr "Débit :"
#: dashboard/qml/SettingsPage.qml:100 dashboard/qml/SettingsPage.qml:102
#: dashboard/qml/SettingsPage.qml:101 dashboard/qml/SettingsPage.qml:103
#, kde-format
msgctxt "bitrate"
msgid "%1 Mbit/s"
msgstr "%1 Mbit/s"
#: dashboard/qml/SettingsPage.qml:112
#, kde-format
msgid "Encoder layout:"
msgstr "Disposition :"
#: dashboard/qml/SettingsPage.qml:115
#, kde-format
msgctxt "encoder preset"
msgid "Automatic"
msgstr "Automatique"
msgid "The current encoder configuration is not supported"
msgstr "La configuration actuelle des encodeurs n'est pas prise en charge"
#: dashboard/qml/SettingsPage.qml:119
#: dashboard/qml/SettingsPage.qml:120
#, kde-format
msgctxt "encoder preset"
msgid "Manual"
msgstr "Manuelle"
msgid "Reset"
msgstr "Réinitialiser"
#: dashboard/qml/SettingsPage.qml:123
#, kde-format
msgctxt "encoder preset"
msgid "Default preset"
msgstr "Configuration prédéfinie : par défaut"
#: dashboard/qml/SettingsPage.qml:140
#, kde-format
msgctxt "encoder preset"
msgid "Low latency preset"
msgstr "Configuration prédéfinie : basse latence"
#: dashboard/qml/SettingsPage.qml:159
#, kde-format
msgctxt "encoder preset"
msgid "Safe preset"
msgstr "Configuration prédéfinie : sure"
#: dashboard/qml/SettingsPage.qml:182
#, kde-format
msgid ""
"To add a new encoder, split an existing encoder by clicking near an edge.\n"
"Drag an edge to resize or remove encoders."
msgstr ""
"Pour ajouter un encodeur, découpez un encodeur existant en cliquant près "
"d'un bord.\n"
"Déplacez un bord pour redimensionner ou supprimer un encodeur."
#: dashboard/qml/SettingsPage.qml:209
#: dashboard/qml/SettingsPage.qml:127
#, kde-format
msgid "Encoder:"
msgstr "Encodeur :"
#: dashboard/qml/SettingsPage.qml:218
#: dashboard/qml/SettingsPage.qml:133
#, kde-format
msgctxt "automatic encoder setup"
msgid "Auto"
msgstr "Automatique"
#: dashboard/qml/SettingsPage.qml:223
#: dashboard/qml/SettingsPage.qml:137
#, kde-format
msgid "nvenc (NVIDIA GPUs)"
msgstr "nvenc (GPUs NVIDIA)"
#: dashboard/qml/SettingsPage.qml:228
#: dashboard/qml/SettingsPage.qml:141
#, kde-format
msgid "vaapi (AMD and Intel GPUs)"
msgstr "vaapi (GPUs AMD et Intel)"
#: dashboard/qml/SettingsPage.qml:233
#, kde-format
msgid "x264 (software encoding)"
msgstr "x264 (encodage logiciel)"
#: dashboard/qml/SettingsPage.qml:238
#: dashboard/qml/SettingsPage.qml:145
#, kde-format
msgid "Vulkan (Vulkan Video)"
msgstr "Vulkan (Vulkan Vidéo)"
#: dashboard/qml/SettingsPage.qml:261
#: dashboard/qml/SettingsPage.qml:149
#, kde-format
msgid "x264 (software encoding)"
msgstr "x264 (encodage logiciel)"
#: dashboard/qml/SettingsPage.qml:166
#, kde-format
msgid "\"Auto\" will use hardware acceleration if it is available"
msgstr ""
"« Automatique » utilisera l'accélération matérielle si elle est disponible"
#: dashboard/qml/SettingsPage.qml:267
#: dashboard/qml/SettingsPage.qml:171
#, kde-format
msgid "Codec:"
msgstr "Codec :"
#: dashboard/qml/SettingsPage.qml:274
#: dashboard/qml/SettingsPage.qml:177
#, kde-format
msgctxt "automatic codec setup"
msgid "Auto"
msgstr "Automatique"
#: dashboard/qml/SettingsPage.qml:278
#: dashboard/qml/SettingsPage.qml:181
#, kde-format
msgid "H.264"
msgstr "H.264"
#: dashboard/qml/SettingsPage.qml:282
#: dashboard/qml/SettingsPage.qml:185
#, kde-format
msgid "H.265"
msgstr "H.265"
#: dashboard/qml/SettingsPage.qml:286
#: dashboard/qml/SettingsPage.qml:189
#, kde-format
msgid "AV1"
msgstr "AV1"
#: dashboard/qml/SettingsPage.qml:308
#: dashboard/qml/SettingsPage.qml:217
#, kde-format
msgid "10-bits"
msgstr "10 bits"
#: dashboard/qml/SettingsPage.qml:221
#, kde-format
msgid ""
"10-bit encoding improves image quality but is not supported by all codecs "
"and hardware"
msgstr ""
"L'encodage 10 bits améliore la qualité d'image mais n'est pas pris en charge "
"part tous les codecs et matériel"
#: dashboard/qml/SettingsPage.qml:231
#, kde-format
msgid "Advanced options"
msgstr "Paramètres avancés"
#: dashboard/qml/SettingsPage.qml:314
#: dashboard/qml/SettingsPage.qml:237
#, kde-format
msgid "Check system configuration on start"
msgstr "Vérifier les paramètres système au démarrage"
#: dashboard/qml/SettingsPage.qml:318
#: dashboard/qml/SettingsPage.qml:241
#, kde-format
msgid "Enable debug window"
msgstr "Activer la fenêtre de débogage"
#: dashboard/qml/SettingsPage.qml:325
#: dashboard/qml/SettingsPage.qml:248
#, kde-format
msgid "Enable SteamVR tracked devices support"
msgstr "Activer le support des manettes SteamVR"
#: dashboard/qml/SettingsPage.qml:328
#: dashboard/qml/SettingsPage.qml:251
#, kde-format
msgid ""
"Allows the use of lighthouse-based controllers and trackers.\n"
@@ -593,44 +572,44 @@ msgstr ""
"WiVRn.\n"
"Un utilitaire tiers tel que motoc est nécessaire pour la calibration."
#: dashboard/qml/SettingsPage.qml:336
#: dashboard/qml/SettingsPage.qml:259
#, kde-format
msgid "Custom adb location"
msgstr "Spécifier l'emplacement d'adb"
#: dashboard/qml/SettingsPage.qml:347
#: dashboard/qml/SettingsPage.qml:270
#, kde-format
msgid "Adb location:"
msgstr "Emplacement d'adb"
#: dashboard/qml/SettingsPage.qml:356
#: dashboard/qml/SettingsPage.qml:279
#, kde-format
msgctxt "browse a file to choose the adb binary"
msgid "Browse"
msgstr "Parcourir"
#: dashboard/qml/SettingsPage.qml:366
#: dashboard/qml/SettingsPage.qml:289
#, kde-format
msgid "Default"
msgstr "Par défaut"
#: dashboard/qml/SettingsPage.qml:380
#: dashboard/qml/SettingsPage.qml:303
#, kde-format
msgctxt "set a custom OpenVR compatibility library"
msgid "Custom"
msgstr "Personnalisé"
#: dashboard/qml/SettingsPage.qml:385
#: dashboard/qml/SettingsPage.qml:308
#, kde-format
msgid "Disabled"
msgstr "Désactivé"
#: dashboard/qml/SettingsPage.qml:393
#: dashboard/qml/SettingsPage.qml:316
#, kde-format
msgid "OpenVR compatibility library:"
msgstr "Compatibilité OpenVR :"
#: dashboard/qml/SettingsPage.qml:419
#: dashboard/qml/SettingsPage.qml:342
#, kde-format
msgid "Library path, excluding bin/linux64/vrclient.so"
msgstr "Chemin de la bibliothèque, en enlevant bin/linux64/vrclient.so"
@@ -984,3 +963,42 @@ msgstr "xrizer"
#, kde-format
msgid "Open Composite"
msgstr "Open Composite"
#, kde-format
#~ msgid "Encoder layout:"
#~ msgstr "Disposition :"
#, kde-format
#~ msgctxt "encoder preset"
#~ msgid "Automatic"
#~ msgstr "Automatique"
#, kde-format
#~ msgctxt "encoder preset"
#~ msgid "Manual"
#~ msgstr "Manuelle"
#, kde-format
#~ msgctxt "encoder preset"
#~ msgid "Default preset"
#~ msgstr "Configuration prédéfinie : par défaut"
#, kde-format
#~ msgctxt "encoder preset"
#~ msgid "Low latency preset"
#~ msgstr "Configuration prédéfinie : basse latence"
#, kde-format
#~ msgctxt "encoder preset"
#~ msgid "Safe preset"
#~ msgstr "Configuration prédéfinie : sure"
#, kde-format
#~ msgid ""
#~ "To add a new encoder, split an existing encoder by clicking near an "
#~ "edge.\n"
#~ "Drag an edge to resize or remove encoders."
#~ msgstr ""
#~ "Pour ajouter un encodeur, découpez un encodeur existant en cliquant près "
#~ "d'un bord.\n"
#~ "Déplacez un bord pour redimensionner ou supprimer un encodeur."
+150 -115
View File
@@ -10,8 +10,8 @@ msgid ""
msgstr ""
"Project-Id-Version: WiVRn-dashboard\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-10-20 20:55+0200\n"
"PO-Revision-Date: 2025-10-20 21:18+0200\n"
"POT-Creation-Date: 2025-10-29 23:59+0100\n"
"PO-Revision-Date: 2025-10-30 11:31+0100\n"
"Last-Translator: Claudio Sampaio (Patola) <patola@gmail.com>\n"
"Language-Team: Portuguese <>\n"
"Language: pt_BR\n"
@@ -21,47 +21,52 @@ msgstr ""
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Generator: Lokalize 25.08.2\n"
#: dashboard/apk_installer.cpp:165
#: dashboard/apk_installer.cpp:137
#, kde-format
msgid "Cannot save APK file: %1"
msgstr "Não foi possível salvar arquivo APK: %1"
#: dashboard/apk_installer.cpp:171
#, kde-format
msgid "Downloading APK: %1 MB / %2 MB"
msgstr "Baixando APK: %1 MB / %2 MB"
#: dashboard/apk_installer.cpp:167
#: dashboard/apk_installer.cpp:173
#, kde-format
msgid "Downloading APK: %1 MB"
msgstr "Baixando APK: %1 MB"
#: dashboard/apk_installer.cpp:176
#: dashboard/apk_installer.cpp:182
#, kde-format
msgid "Download cancelled"
msgstr "Download cancelado"
#: dashboard/apk_installer.cpp:192
#: dashboard/apk_installer.cpp:198
#, kde-format
msgid "Cannot download APK: %1"
msgstr "Não é possível baixar o APK: %1"
#: dashboard/apk_installer.cpp:215
#: dashboard/apk_installer.cpp:221
#, kde-format
msgid "Installing APK"
msgstr "Instalando APK"
#: dashboard/apk_installer.cpp:219
#: dashboard/apk_installer.cpp:225
#, kde-format
msgid "adb failed to start: %1"
msgstr "O adb não conseguiu iniciar: %1"
#: dashboard/apk_installer.cpp:229
#: dashboard/apk_installer.cpp:235
#, kde-format
msgid "adb exited abnormally: %1"
msgstr "adb saiu anormalmente: %1"
#: dashboard/apk_installer.cpp:237
#: dashboard/apk_installer.cpp:243
#, kde-format
msgid "The 'adb install' command failed: exit code %1"
msgstr "O comando 'adb install' falhou: código de saída %1"
#: dashboard/apk_installer.cpp:242
#: dashboard/apk_installer.cpp:248
#, kde-format
msgid "Installation successful"
msgstr "Instalação bem-sucedida"
@@ -87,6 +92,12 @@ msgstr "Verificando a última versão..."
msgid "No APK is available for this version"
msgstr "Nenhum APK está disponível para esta versão"
#: dashboard/qml/ApkInstallPage.qml:45 dashboard/qml/Main.qml:311
#: dashboard/qml/Main.qml:396 dashboard/qml/WizardPage.qml:211
#, kde-format
msgid "ADB is not installed"
msgstr "ABD não está instalado"
#: dashboard/qml/ApkInstallPage.qml:47
#, kde-format
msgid "Connect a headset and make sure developer mode is enabled"
@@ -131,7 +142,7 @@ msgstr "Reinstalar WiVRn"
msgid "Install WiVRn"
msgstr "Instalar WiVRn"
#: dashboard/qml/HeadsetsPage.qml:12 dashboard/qml/Main.qml:375
#: dashboard/qml/HeadsetsPage.qml:12 dashboard/qml/Main.qml:401
#, kde-format
msgid "Headsets"
msgstr "Headsets"
@@ -227,45 +238,56 @@ msgstr "Parear um novo headset"
msgid "Headset statistics"
msgstr "Estatísticas do headset"
#: dashboard/qml/Main.qml:129
#: dashboard/qml/Main.qml:130
#, kde-format
msgid "The server does not have CAP_SYS_NICE capabilities"
msgstr "O servidor não tem capabilities CAP_SYS_NICE"
msgid "Avahi daemon is not installed"
msgstr "Avahi daemon não está instalado"
#: dashboard/qml/Main.qml:136 dashboard/qml/Main.qml:150
#: dashboard/qml/Main.qml:138
#, kde-format
msgid "Avahi daemon is not started"
msgstr "Avahi daemon não foi iniciado"
#: dashboard/qml/Main.qml:145 dashboard/qml/Main.qml:160
#: dashboard/qml/Main.qml:174
#, kde-format
msgid "Fix it"
msgstr "Conserte"
#: dashboard/qml/Main.qml:144
#: dashboard/qml/Main.qml:153
#, kde-format
msgid "The server does not have CAP_SYS_NICE capabilities"
msgstr "O servidor não tem capabilities CAP_SYS_NICE"
#: dashboard/qml/Main.qml:168
#, kde-format
msgid "Firewall may not allow port 9757"
msgstr "O firewall pode não permitir a porta 9757"
#: dashboard/qml/Main.qml:159
#: dashboard/qml/Main.qml:183
#, kde-format
msgid "The CAP_SYS_NICE capability will be used when the server is restarted"
msgstr "A capability CAP_SYS_NICE será usada quando o servidor for reiniciado"
#: dashboard/qml/Main.qml:165
#: dashboard/qml/Main.qml:189
#, kde-format
msgctxt "restart the server"
msgid "Restart now"
msgstr "Reiniciar agora"
#: dashboard/qml/Main.qml:176
#: dashboard/qml/Main.qml:200
#, kde-format
msgid ""
"NVIDIA GPUs require at least driver version 565.77, current version is %1"
msgstr ""
"GPUs NVIDIA requerem pelo menos o driver versão 565.77, a versão atual é %1"
#: dashboard/qml/Main.qml:182
#: dashboard/qml/Main.qml:206
#, kde-format
msgid "More info"
msgstr "Mais informações"
#: dashboard/qml/Main.qml:190
#: dashboard/qml/Main.qml:214
#, kde-format
msgid ""
"Use the Mesa (radv) driver for AMD GPUs\n"
@@ -274,7 +296,7 @@ msgstr ""
"Use o driver Mesa (radv) para GPUs AMD\n"
"Codificação de hardware com a vaapi não funciona com AMDVLK e AMDGPU-PRO"
#: dashboard/qml/Main.qml:198
#: dashboard/qml/Main.qml:222
#, kde-format
msgid ""
"No OpenVR compatibility detected, Steam games won't be able to load VR.\n"
@@ -284,76 +306,76 @@ msgstr ""
"conseguirão carregar em VR.\n"
"Instale o xrizer ou o OpenComposite."
#: dashboard/qml/Main.qml:207
#: dashboard/qml/Main.qml:231
#, kde-format
msgid "Server failed to start"
msgstr "Servidor falhou em iniciar"
#: dashboard/qml/Main.qml:213 dashboard/qml/TroubleshootPage.qml:85
#: dashboard/qml/Main.qml:237 dashboard/qml/TroubleshootPage.qml:85
#, kde-format
msgid "Open server logs"
msgstr "Abrir logs do servidor"
#: dashboard/qml/Main.qml:242
#: dashboard/qml/Main.qml:266
#, kde-format
msgctxt "whether the server is running, displayed in front of a checkbox"
msgid "Running"
msgstr "Rodando"
#: dashboard/qml/Main.qml:257
#: dashboard/qml/Main.qml:281
#, kde-format
msgctxt "whether pairing is enabled, displayed in front of a checkbox"
msgid "Pairing"
msgstr "Pareando"
#: dashboard/qml/Main.qml:270
#: dashboard/qml/Main.qml:294
#, kde-format
msgid "PIN: %1"
msgstr "PIN: %1"
#: dashboard/qml/Main.qml:278 dashboard/qml/WizardPage.qml:374
#: dashboard/qml/Main.qml:302 dashboard/qml/WizardPage.qml:374
#, kde-format
msgid "Connect by USB"
msgstr "Conectar pela USB"
#: dashboard/qml/Main.qml:289
#: dashboard/qml/Main.qml:313
#, kde-format
msgid "No headset is connected or your headset is not in developer mode"
msgstr ""
"Nenhum headset está conectado ou seu headset não está em modo desenvolvedor"
#: dashboard/qml/Main.qml:297
#: dashboard/qml/Main.qml:321
#, kde-format
msgid "Disconnect"
msgstr "Desconectar"
#: dashboard/qml/Main.qml:314
#: dashboard/qml/Main.qml:338
#, kde-format
msgctxt "automatically started application"
msgid "Application"
msgstr "Aplicativo"
#: dashboard/qml/Main.qml:335
#: dashboard/qml/Main.qml:359
#, kde-format
msgid "Steam information"
msgstr "Informações da Steam"
#: dashboard/qml/Main.qml:354
#: dashboard/qml/Main.qml:380
#, kde-format
msgid "Wizard"
msgstr "Assistente"
#: dashboard/qml/Main.qml:361
#: dashboard/qml/Main.qml:387
#, kde-format
msgid "Install the app"
msgstr "Instalar o aplicativo"
#: dashboard/qml/Main.qml:382 dashboard/qml/SettingsPage.qml:14
#: dashboard/qml/Main.qml:408 dashboard/qml/SettingsPage.qml:14
#, kde-format
msgid "Settings"
msgstr "Ajustes"
#: dashboard/qml/Main.qml:389 dashboard/qml/TroubleshootPage.qml:10
#: dashboard/qml/Main.qml:415 dashboard/qml/TroubleshootPage.qml:10
#, kde-format
msgid "Troubleshoot"
msgstr "Resolver problemas"
@@ -430,140 +452,120 @@ msgstr "Mais forte"
msgid "Bitrate:"
msgstr "Taxa de bits:"
#: dashboard/qml/SettingsPage.qml:100 dashboard/qml/SettingsPage.qml:102
#: dashboard/qml/SettingsPage.qml:101 dashboard/qml/SettingsPage.qml:103
#, kde-format
msgctxt "bitrate"
msgid "%1 Mbit/s"
msgstr "%1 Mbit/s"
#: dashboard/qml/SettingsPage.qml:112
#, kde-format
msgid "Encoder layout:"
msgstr "Layout do codificador:"
#: dashboard/qml/SettingsPage.qml:115
#, kde-format
msgctxt "encoder preset"
msgid "Automatic"
msgstr "Automático"
msgid "The current encoder configuration is not supported"
msgstr "A configuração de codificador atual não é suportada"
#: dashboard/qml/SettingsPage.qml:119
#: dashboard/qml/SettingsPage.qml:120
#, kde-format
msgctxt "encoder preset"
msgid "Manual"
msgstr "Manual"
msgid "Reset"
msgstr "Resetar"
#: dashboard/qml/SettingsPage.qml:123
#, kde-format
msgctxt "encoder preset"
msgid "Default preset"
msgstr "Predefinição padrão"
#: dashboard/qml/SettingsPage.qml:140
#, kde-format
msgctxt "encoder preset"
msgid "Low latency preset"
msgstr "Predefinição de baixa latência"
#: dashboard/qml/SettingsPage.qml:159
#, kde-format
msgctxt "encoder preset"
msgid "Safe preset"
msgstr "Predefinição segura"
#: dashboard/qml/SettingsPage.qml:182
#, kde-format
msgid ""
"To add a new encoder, split an existing encoder by clicking near an edge.\n"
"Drag an edge to resize or remove encoders."
msgstr ""
"Para adicionar um novo codificador, divida um codificador existente clicando "
"perto de uma aresta.\n"
"Arraste a aresta para redimensionar ou remover codificadores."
#: dashboard/qml/SettingsPage.qml:209
#: dashboard/qml/SettingsPage.qml:127
#, kde-format
msgid "Encoder:"
msgstr "Codificador:"
#: dashboard/qml/SettingsPage.qml:218
#: dashboard/qml/SettingsPage.qml:133
#, kde-format
msgctxt "automatic encoder setup"
msgid "Auto"
msgstr "Auto"
#: dashboard/qml/SettingsPage.qml:223
#: dashboard/qml/SettingsPage.qml:137
#, kde-format
msgid "nvenc (NVIDIA GPUs)"
msgstr "nvenc (GPUs NVIDIA)"
#: dashboard/qml/SettingsPage.qml:228
#: dashboard/qml/SettingsPage.qml:141
#, kde-format
msgid "vaapi (AMD and Intel GPUs)"
msgstr "vaapi (GPUs AMD e Intel)"
#: dashboard/qml/SettingsPage.qml:233
#, kde-format
msgid "x264 (software encoding)"
msgstr "x264 (codificação por software)"
#: dashboard/qml/SettingsPage.qml:238
#: dashboard/qml/SettingsPage.qml:145
#, kde-format
msgid "Vulkan (Vulkan Video)"
msgstr "Vulkan (Vídeo Vulkan)"
#: dashboard/qml/SettingsPage.qml:261
#: dashboard/qml/SettingsPage.qml:149
#, kde-format
msgid "x264 (software encoding)"
msgstr "x264 (codificação por software)"
#: dashboard/qml/SettingsPage.qml:166
#, kde-format
msgid "\"Auto\" will use hardware acceleration if it is available"
msgstr "\"Auto\" usará aceleração de hardware se disponível"
#: dashboard/qml/SettingsPage.qml:267
#: dashboard/qml/SettingsPage.qml:171
#, kde-format
msgid "Codec:"
msgstr "Codec:"
#: dashboard/qml/SettingsPage.qml:274
#: dashboard/qml/SettingsPage.qml:177
#, kde-format
msgctxt "automatic codec setup"
msgid "Auto"
msgstr "Auto"
#: dashboard/qml/SettingsPage.qml:278
#: dashboard/qml/SettingsPage.qml:181
#, kde-format
msgid "H.264"
msgstr "H.264"
#: dashboard/qml/SettingsPage.qml:282
#: dashboard/qml/SettingsPage.qml:185
#, kde-format
msgid "H.265"
msgstr "H.265"
#: dashboard/qml/SettingsPage.qml:286
#: dashboard/qml/SettingsPage.qml:189
#, kde-format
msgid "AV1"
msgstr "AV1"
#: dashboard/qml/SettingsPage.qml:308
#: dashboard/qml/SettingsPage.qml:217
#, kde-format
msgid "10-bits"
msgstr "10-bits"
#: dashboard/qml/SettingsPage.qml:221
#, kde-format
msgid ""
"10-bit encoding improves image quality but is not supported by all codecs "
"and hardware"
msgstr ""
"Codificação de 10-bit melhora a qualidade de imagem mas não é suportada por to"
"dos "
"os codecs e hardware"
#: dashboard/qml/SettingsPage.qml:231
#, kde-format
msgid "Advanced options"
msgstr "Opções avançadas"
#: dashboard/qml/SettingsPage.qml:314
#: dashboard/qml/SettingsPage.qml:237
#, kde-format
msgid "Check system configuration on start"
msgstr "Verificar configuração do sistema ao iniciar"
#: dashboard/qml/SettingsPage.qml:318
#: dashboard/qml/SettingsPage.qml:241
#, kde-format
msgid "Enable debug window"
msgstr "Ativar janela de depuração"
#: dashboard/qml/SettingsPage.qml:325
#: dashboard/qml/SettingsPage.qml:248
#, kde-format
msgid "Enable SteamVR tracked devices support"
msgstr "Ativar suporte a dispositivos rastreados pelo SteamVR"
#: dashboard/qml/SettingsPage.qml:328
#: dashboard/qml/SettingsPage.qml:251
#, kde-format
msgid ""
"Allows the use of lighthouse-based controllers and trackers.\n"
@@ -576,44 +578,44 @@ msgstr ""
"Os dispositivos precisam estar ligados antes de se conectar ao WiVRn.\n"
"Uma ferramenta externa como o motoc é necessária para calibração."
#: dashboard/qml/SettingsPage.qml:336
#: dashboard/qml/SettingsPage.qml:259
#, kde-format
msgid "Custom adb location"
msgstr "Caminho personalizado do adb"
#: dashboard/qml/SettingsPage.qml:347
#: dashboard/qml/SettingsPage.qml:270
#, kde-format
msgid "Adb location:"
msgstr "Caminho do adb:"
#: dashboard/qml/SettingsPage.qml:356
#: dashboard/qml/SettingsPage.qml:279
#, kde-format
msgctxt "browse a file to choose the adb binary"
msgid "Browse"
msgstr "Navegar"
#: dashboard/qml/SettingsPage.qml:366
#: dashboard/qml/SettingsPage.qml:289
#, kde-format
msgid "Default"
msgstr "Default"
#: dashboard/qml/SettingsPage.qml:380
#: dashboard/qml/SettingsPage.qml:303
#, kde-format
msgctxt "set a custom OpenVR compatibility library"
msgid "Custom"
msgstr "Personalizado"
#: dashboard/qml/SettingsPage.qml:385
#: dashboard/qml/SettingsPage.qml:308
#, kde-format
msgid "Disabled"
msgstr "Desativado"
#: dashboard/qml/SettingsPage.qml:393
#: dashboard/qml/SettingsPage.qml:316
#, kde-format
msgid "OpenVR compatibility library:"
msgstr "Biblioteca de compatibilidade OpenVR:"
#: dashboard/qml/SettingsPage.qml:419
#: dashboard/qml/SettingsPage.qml:342
#, kde-format
msgid "Library path, excluding bin/linux64/vrclient.so"
msgstr "Caminho da biblioteca, excluindo bin/linux64/vrclient.so"
@@ -851,11 +853,6 @@ msgstr "Ou"
msgid "Install over USB"
msgstr "Instalar pela USB"
#: dashboard/qml/WizardPage.qml:211
#, kde-format
msgid "ADB is not installed"
msgstr "ABD não está instalado"
#: dashboard/qml/WizardPage.qml:219
#, kde-format
msgid ""
@@ -925,9 +922,8 @@ msgid ""
"If the server is not visible or the connection fails, check that ports 5353 "
"(UDP) and 9757 (TCP and UDP) are open in your firewall."
msgstr ""
"Se o servidor não estiver visível ou a conexão falhar, verifique se as portas "
"5353 "
"(UDP) e 9757 (TCP e UDP) estão abertas no seu firewall."
"Se o servidor não estiver visível ou a conexão falhar, verifique se as "
"portas 5353 (UDP) e 9757 (TCP e UDP) estão abertas no seu firewall."
#: dashboard/qml/WizardPage.qml:406
#, kde-format
@@ -973,6 +969,45 @@ msgstr "xrizer"
msgid "Open Composite"
msgstr "Open Composite"
#, kde-format
#~ msgid "Encoder layout:"
#~ msgstr "Layout do codificador:"
#, kde-format
#~ msgctxt "encoder preset"
#~ msgid "Automatic"
#~ msgstr "Automático"
#, kde-format
#~ msgctxt "encoder preset"
#~ msgid "Manual"
#~ msgstr "Manual"
#, kde-format
#~ msgctxt "encoder preset"
#~ msgid "Default preset"
#~ msgstr "Predefinição padrão"
#, kde-format
#~ msgctxt "encoder preset"
#~ msgid "Low latency preset"
#~ msgstr "Predefinição de baixa latência"
#, kde-format
#~ msgctxt "encoder preset"
#~ msgid "Safe preset"
#~ msgstr "Predefinição segura"
#, kde-format
#~ msgid ""
#~ "To add a new encoder, split an existing encoder by clicking near an "
#~ "edge.\n"
#~ "Drag an edge to resize or remove encoders."
#~ msgstr ""
#~ "Para adicionar um novo codificador, divida um codificador existente "
#~ "clicando perto de uma aresta.\n"
#~ "Arraste a aresta para redimensionar ou remover codificadores."
#, kde-format
#~ msgid ""
#~ "If the server is not visible or the connection fails, check that port "
-2
View File
@@ -206,8 +206,6 @@ configuration::configuration()
if (auto it = json.find("tcp-only"); it != json.end())
tcp_only = *it;
else if (auto it = json.find("tcp_only"); it != json.end())
tcp_only = *it;
if (auto it = json.find("publish-service"); it != json.end())
{