New upstream version 26.0.0+dfsg1

This commit is contained in:
Sebastian Ramacher 2020-10-01 22:15:25 +02:00
parent 8e020cdacb
commit 240080891f
837 changed files with 41275 additions and 9196 deletions

View file

@ -114,8 +114,6 @@ void OBSPropertiesView::RefreshProperties()
widget->setLayout(layout);
QSizePolicy mainPolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
QSizePolicy policy(QSizePolicy::Preferred, QSizePolicy::Preferred);
//widget->setSizePolicy(policy);
layout->setLabelAlignment(Qt::AlignRight);
@ -596,6 +594,13 @@ void OBSPropertiesView::AddEditableList(obs_property_t *prop,
WidgetInfo *info = new WidgetInfo(this, prop, list);
list->setDragDropMode(QAbstractItemView::InternalMove);
connect(list->model(),
SIGNAL(rowsMoved(QModelIndex, int, int, QModelIndex, int)),
info,
SLOT(EditListReordered(const QModelIndex &, int, int,
const QModelIndex &, int)));
QVBoxLayout *sideLayout = new QVBoxLayout();
NewButton(sideLayout, info, "addIconSmall", &WidgetInfo::EditListAdd);
NewButton(sideLayout, info, "removeIconSmall",
@ -652,14 +657,15 @@ void OBSPropertiesView::AddColor(obs_property_t *prop, QFormLayout *layout,
QPalette palette = QPalette(color);
colorLabel->setFrameStyle(QFrame::Sunken | QFrame::Panel);
colorLabel->setText(color.name(QColor::HexArgb));
// The picker doesn't have an alpha option, show only RGB
colorLabel->setText(color.name(QColor::HexRgb));
colorLabel->setPalette(palette);
colorLabel->setStyleSheet(
QString("background-color :%1; color: %2;")
.arg(palette.color(QPalette::Window)
.name(QColor::HexArgb))
.name(QColor::HexRgb))
.arg(palette.color(QPalette::WindowText)
.name(QColor::HexArgb)));
.name(QColor::HexRgb)));
colorLabel->setAutoFillBackground(true);
colorLabel->setAlignment(Qt::AlignCenter);
colorLabel->setToolTip(QT_UTF8(obs_property_long_description(prop)));
@ -678,7 +684,7 @@ void OBSPropertiesView::AddColor(obs_property_t *prop, QFormLayout *layout,
layout->addRow(label, subLayout);
}
static void MakeQFont(obs_data_t *font_obj, QFont &font, bool limit = false)
void MakeQFont(obs_data_t *font_obj, QFont &font, bool limit = false)
{
const char *face = obs_data_get_string(font_obj, "face");
const char *style = obs_data_get_string(font_obj, "style");
@ -1437,28 +1443,42 @@ void OBSPropertiesView::AddProperty(obs_property_t *property,
return;
if (obs_property_long_description(property)) {
QString lStr = "<html>%1 <img src='%2' style=' \
vertical-align: bottom; \
' /></html>";
bool lightTheme = palette().text().color().redF() < 0.5;
QString file = lightTheme ? ":/res/images/help.svg"
: ":/res/images/help_light.svg";
if (label) {
QString lStr = "<html>%1 <img src='%2' style=' \
vertical-align: bottom; \
' /></html>";
label->setText(lStr.arg(label->text(), file));
label->setToolTip(
obs_property_long_description(property));
} else if (type == OBS_PROPERTY_BOOL) {
QString bStr = "<html> <img src='%1' style=' \
vertical-align: bottom; \
' /></html>";
const char *desc = obs_property_description(property);
QWidget *newWidget = new QWidget();
QHBoxLayout *boxLayout = new QHBoxLayout(newWidget);
boxLayout->setContentsMargins(0, 0, 0, 0);
boxLayout->setAlignment(Qt::AlignLeft);
boxLayout->setSpacing(0);
QCheckBox *check = qobject_cast<QCheckBox *>(widget);
QLabel *help =
new QLabel(lStr.arg(check->text(), file));
check->setText(desc);
check->setToolTip(
obs_property_long_description(property));
QLabel *help = new QLabel(check);
help->setText(bStr.arg(file));
help->setToolTip(
obs_property_long_description(property));
check->setText("");
boxLayout->addWidget(check);
boxLayout->addWidget(help);
widget = newWidget;
@ -1625,18 +1645,14 @@ bool WidgetInfo::PathChanged(const char *setting)
QString path;
if (type == OBS_PATH_DIRECTORY)
path = QFileDialog::getExistingDirectory(
view, QT_UTF8(desc), QT_UTF8(default_path),
QFileDialog::ShowDirsOnly |
QFileDialog::DontResolveSymlinks);
path = SelectDirectory(view, QT_UTF8(desc),
QT_UTF8(default_path));
else if (type == OBS_PATH_FILE)
path = QFileDialog::getOpenFileName(view, QT_UTF8(desc),
QT_UTF8(default_path),
QT_UTF8(filter));
path = OpenFile(view, QT_UTF8(desc), QT_UTF8(default_path),
QT_UTF8(filter));
else if (type == OBS_PATH_FILE_SAVE)
path = QFileDialog::getSaveFileName(view, QT_UTF8(desc),
QT_UTF8(default_path),
QT_UTF8(filter));
path = SaveFile(view, QT_UTF8(desc), QT_UTF8(default_path),
QT_UTF8(filter));
if (path.isEmpty())
return false;
@ -1688,7 +1704,7 @@ bool WidgetInfo::ColorChanged(const char *setting)
long long val = obs_data_get_int(view->settings, setting);
QColor color = color_from_int(val);
QColorDialog::ColorDialogOptions options = 0;
QColorDialog::ColorDialogOptions options;
/* The native dialog on OSX has all kinds of problems, like closing
* other open QDialogs on exit, and
@ -1705,14 +1721,14 @@ bool WidgetInfo::ColorChanged(const char *setting)
return false;
QLabel *label = static_cast<QLabel *>(widget);
label->setText(color.name(QColor::HexArgb));
label->setText(color.name(QColor::HexRgb));
QPalette palette = QPalette(color);
label->setPalette(palette);
label->setStyleSheet(QString("background-color :%1; color: %2;")
.arg(palette.color(QPalette::Window)
.name(QColor::HexArgb))
.name(QColor::HexRgb))
.arg(palette.color(QPalette::WindowText)
.name(QColor::HexArgb)));
.name(QColor::HexRgb)));
obs_data_set_int(view->settings, setting, color_to_int(color));
@ -1776,6 +1792,19 @@ void WidgetInfo::GroupChanged(const char *setting)
: true);
}
void WidgetInfo::EditListReordered(const QModelIndex &parent, int start,
int end, const QModelIndex &destination,
int row)
{
UNUSED_PARAMETER(parent);
UNUSED_PARAMETER(start);
UNUSED_PARAMETER(end);
UNUSED_PARAMETER(destination);
UNUSED_PARAMETER(row);
EditableListChanged();
}
void WidgetInfo::EditableListChanged()
{
const char *setting = obs_property_name(property);
@ -1886,9 +1915,8 @@ class EditableItemDialog : public QDialog {
if (curPath.isEmpty())
curPath = default_path;
QString path = QFileDialog::getOpenFileName(
App()->GetMainWindow(), QTStr("Browse"), curPath,
filter);
QString path = OpenFile(App()->GetMainWindow(), QTStr("Browse"),
curPath, filter);
if (path.isEmpty())
return;
@ -2007,9 +2035,8 @@ void WidgetInfo::EditListAddFiles()
QString title = QTStr("Basic.PropertiesWindow.AddEditableListFiles")
.arg(QT_UTF8(desc));
QStringList files = QFileDialog::getOpenFileNames(
App()->GetMainWindow(), title, QT_UTF8(default_path),
QT_UTF8(filter));
QStringList files = OpenFiles(App()->GetMainWindow(), title,
QT_UTF8(default_path), QT_UTF8(filter));
if (files.count() == 0)
return;
@ -2028,8 +2055,8 @@ void WidgetInfo::EditListAddDir()
QString title = QTStr("Basic.PropertiesWindow.AddEditableListDir")
.arg(QT_UTF8(desc));
QString dir = QFileDialog::getExistingDirectory(
App()->GetMainWindow(), title, QT_UTF8(default_path));
QString dir = SelectDirectory(App()->GetMainWindow(), title,
QT_UTF8(default_path));
if (dir.isEmpty())
return;
@ -2067,15 +2094,11 @@ void WidgetInfo::EditListEdit()
QString path;
if (pathDir.exists())
path = QFileDialog::getExistingDirectory(
App()->GetMainWindow(), QTStr("Browse"),
item->text(),
QFileDialog::ShowDirsOnly |
QFileDialog::DontResolveSymlinks);
path = SelectDirectory(App()->GetMainWindow(),
QTStr("Browse"), item->text());
else
path = QFileDialog::getOpenFileName(
App()->GetMainWindow(), QTStr("Browse"),
item->text(), QT_UTF8(filter));
path = OpenFile(App()->GetMainWindow(), QTStr("Browse"),
item->text(), QT_UTF8(filter));
if (path.isEmpty())
return;