未验证 提交 3881f9de 编写于 作者: J Jim 提交者: GitHub

Merge pull request #1859 from cg2121/remove-settings-lines

UI: Various visual improvements
...@@ -985,3 +985,11 @@ VisibilityCheckBox::indicator:checked:hover { ...@@ -985,3 +985,11 @@ VisibilityCheckBox::indicator:checked:hover {
VisibilityCheckBox::indicator:unchecked:hover { VisibilityCheckBox::indicator:unchecked:hover {
image: url(:res/images/invisible.svg); image: url(:res/images/invisible.svg);
} }
* [themeID="trashIcon"] {
qproperty-icon: url(./Dark/trash.svg);
}
* [themeID="revertIcon"] {
qproperty-icon: url(./Dark/revert.svg);
}
...@@ -119,12 +119,7 @@ QListWidget QLineEdit { ...@@ -119,12 +119,7 @@ QListWidget QLineEdit {
QDockWidget::title { QDockWidget::title {
text-align: center; text-align: center;
background-color: QLinearGradient(x1: 0, y1: 0, x2: 0, y2: 1, background-color: rgb(70,69,70);
stop: 0 rgb(86,85,86),
stop: 0.1 rgb(82,81,82),
stop: 0.5 rgb(78,77,78),
stop: 0.9 rgb(74,73,74),
stop: 1 rgb(70,69,70));
} }
QDockWidget::close-button, QDockWidget::float-button { QDockWidget::close-button, QDockWidget::float-button {
...@@ -158,21 +153,18 @@ QGroupBox { ...@@ -158,21 +153,18 @@ QGroupBox {
} }
QScrollBar:vertical { QScrollBar:vertical {
background-color: rgb(58,57,58); /* dark */ background-color: rgb(58,57,58);
width: 14px; width: 14px;
margin: 0px; margin: 0px;
} }
QScrollBar::handle:vertical { QScrollBar::handle:vertical {
background-color: QLinearGradient(x1: 0, y1: 0, x2: 1, y2: 0, background-color: rgb(76,76,76);
stop: 0 rgb(122,121,122), /* light */
stop: 0.25 rgb(100, 99, 100),
stop: 1 rgb(88,87,88)); /* kindaDark */
min-height: 20px; min-height: 20px;
margin: 2px; margin: 2px;
border-radius: 5px; border-radius: 5px;
border-width: 1px; border-width: 1px;
border: 1px solid rgb(31,30,31); /* veryDark */ border: 1px solid rgb(76,76,76);
} }
QScrollBar::add-line:vertical, QScrollBar::sub-line:vertical { QScrollBar::add-line:vertical, QScrollBar::sub-line:vertical {
...@@ -194,15 +186,12 @@ QScrollBar:horizontal { ...@@ -194,15 +186,12 @@ QScrollBar:horizontal {
} }
QScrollBar::handle:horizontal { QScrollBar::handle:horizontal {
background-color: QLinearGradient(x1: 0, y1: 0, x2: 0, y2: 1, background-color: rgb(76,76,76);
stop: 0 rgb(122,121,122), /* light */
stop: 0.25 rgb(100, 99, 100),
stop: 1 rgb(88,87,88)); /* kindaDark */
min-width: 20px; min-width: 20px;
margin: 2px; margin: 2px;
border-radius: 5px; border-radius: 5px;
border-width: 1px; border-width: 1px;
border: 1px solid rgb(31,30,31); /* veryDark */ border: 1px solid rgb(76,76,76);
} }
QScrollBar::add-line:horizontal, QScrollBar::sub-line:horizontal { QScrollBar::add-line:horizontal, QScrollBar::sub-line:horizontal {
...@@ -271,11 +260,11 @@ QTabWidget::pane { /* The tab widget frame */ ...@@ -271,11 +260,11 @@ QTabWidget::pane { /* The tab widget frame */
} }
QTabWidget::tab-bar { QTabWidget::tab-bar {
alignment: center; alignment: left;
} }
QTabBar::tab { QTabBar::tab {
background-color: rgb(88,87,88); /* kindaDark */ background-color: rgb(76,76,76);
border: none; border: none;
padding: 5px; padding: 5px;
min-width: 50px; min-width: 50px;
...@@ -284,16 +273,16 @@ QTabBar::tab { ...@@ -284,16 +273,16 @@ QTabBar::tab {
QTabBar::tab:top { QTabBar::tab:top {
border-bottom: 1px transparent; border-bottom: 1px transparent;
border-top-left-radius: 5px; border-top-left-radius: 3px;
border-top-right-radius: 5px; border-top-right-radius: 3px;
} }
QTabBar::tab:bottom { QTabBar::tab:bottom {
padding-top: 1px; padding-top: 1px;
margin-bottom: 4px; margin-bottom: 4px;
border-bottom-left-radius: 5px; border-bottom-left-radius: 3px;
border-bottom-right-radius: 5px; border-bottom-right-radius: 3px;
height: 14px; height: 14px;
} }
...@@ -313,25 +302,17 @@ QTabBar::tab:pressed { ...@@ -313,25 +302,17 @@ QTabBar::tab:pressed {
/* ComboBox */ /* ComboBox */
QComboBox { QComboBox {
background-color: QLinearGradient(x1: 0, y1: 0, x2: 0, y2: 1, background-color: rgb(76,76,76);
stop: 0 rgb(86,85,86),
stop: 0.1 rgb(82,81,82),
stop: 0.5 rgb(78,77,78),
stop: 0.9 rgb(74,73,74),
stop: 1 rgb(70,69,70));
border-style: solid; border-style: solid;
border: 1px; border: 1px;
border-radius: 3px; border-radius: 3px;
border-color: rgb(31,30,31); /* veryDark */ border-color: rgb(76,76,76); /* veryDark */
padding: 2px; padding: 2px;
padding-left: 10px; padding-left: 10px;
} }
QComboBox:hover { QComboBox:hover {
background-color: QLinearGradient(x1: 0, y1: 0, x2: 0, y2: 1, background-color: rgb(88,87,88);
stop: 0 rgb(111, 110, 101),
stop: 0.25 rgb(100, 99, 100),
stop: 1 rgb(88,87,88));
} }
QComboBox::drop-down { QComboBox::drop-down {
...@@ -395,7 +376,7 @@ QSpinBox::up-button, QDoubleSpinBox::up-button { ...@@ -395,7 +376,7 @@ QSpinBox::up-button, QDoubleSpinBox::up-button {
subcontrol-origin: margin; subcontrol-origin: margin;
subcontrol-position: top right; /* position at the top right corner */ subcontrol-position: top right; /* position at the top right corner */
background-color: rgb(88,87,88); /* kindaDark */ background-color: rgb(76,76,76);
border: 1px solid rgb(31,30,31); /* veryDark */ border: 1px solid rgb(31,30,31); /* veryDark */
border-radius: 3px; border-radius: 3px;
border-width: 0; border-width: 0;
...@@ -407,7 +388,7 @@ QSpinBox::up-button, QDoubleSpinBox::up-button { ...@@ -407,7 +388,7 @@ QSpinBox::up-button, QDoubleSpinBox::up-button {
QSpinBox::down-button, QDoubleSpinBox::down-button { QSpinBox::down-button, QDoubleSpinBox::down-button {
subcontrol-origin: margin; subcontrol-origin: margin;
subcontrol-position: bottom right; /* position at the top right corner */ subcontrol-position: bottom right; /* position at the top right corner */
background-color: rgb(88,87,88); /* kindaDark */ background-color: rgb(76,76,76);
border: 1px solid rgb(31,30,31); /* veryDark */ border: 1px solid rgb(31,30,31); /* veryDark */
border-radius: 3px; border-radius: 3px;
border-width: 0; border-width: 0;
...@@ -447,7 +428,7 @@ QSpinBox::down-arrow, QDoubleSpinBox::down-arrow { ...@@ -447,7 +428,7 @@ QSpinBox::down-arrow, QDoubleSpinBox::down-arrow {
QPushButton { QPushButton {
color: rgb(225,224,225); /* veryLight */ color: rgb(225,224,225); /* veryLight */
background-color: rgb(88,87,88); /* kindaDark */ background-color: rgb(76,76,76);
border: none; border: none;
border-radius: 3px; border-radius: 3px;
padding: 4px; padding: 4px;
...@@ -485,20 +466,15 @@ QPushButton[themeID="hotkeyButtons"] { ...@@ -485,20 +466,15 @@ QPushButton[themeID="hotkeyButtons"] {
/* Sliders */ /* Sliders */
QSlider::groove:horizontal { QSlider::groove:horizontal {
background-color: QLinearGradient(x1: 0, y1: 1, x2: 0, y2: 0, background-color: rgb(76,76,76);
stop: 0 rgb(50, 49, 50), /* dark */
stop: 0.75 rgb(88,87,88)); /* kindaDark */
height: 4px; height: 4px;
border: none; border: none;
border-radius: 2px; border-radius: 2px;
} }
QSlider::handle:horizontal { QSlider::handle:horizontal {
background-color: QLinearGradient(x1: 0, y1: 0, x2: 0, y2: 1, background-color: #d2d2d2;
stop: 0 rgb(240,239,240), /* lighter */ border: 1px solid rgb(58,57,58);
stop: 0.25 rgb(200,199,200),
stop: 1 rgb(162,161,162)); /* light */
border: 1px solid rgb(58,57,58); /* dark */
border-radius: 3px; border-radius: 3px;
height: 10px; height: 10px;
width: 18px; width: 18px;
...@@ -506,10 +482,7 @@ QSlider::handle:horizontal { ...@@ -506,10 +482,7 @@ QSlider::handle:horizontal {
} }
QSlider::handle:horizontal:pressed { QSlider::handle:horizontal:pressed {
background-color: QLinearGradient(x1: 0, y1: 1, x2: 0, y2: 0, background-color: #d2d2d2;
stop: 0 rgb(240,239,240), /* lighter */
stop: 0.25 rgb(200,199,200),
stop: 1 rgb(162,161,162)); /* light */
} }
QSlider::sub-page:horizontal { QSlider::sub-page:horizontal {
...@@ -518,27 +491,20 @@ QSlider::sub-page:horizontal { ...@@ -518,27 +491,20 @@ QSlider::sub-page:horizontal {
} }
QSlider::sub-page:horizontal:disabled { QSlider::sub-page:horizontal:disabled {
background-color: QLinearGradient(x1: 0, y1: 1, x2: 0, y2: 0, background-color: rgb(50, 49, 50); /* dark */
stop: 0 rgb(31,30,31), /* veryDark */
stop: 0.75 rgb(50, 49, 50)); /* dark */
border-radius: 2px; border-radius: 2px;
} }
QSlider::groove:vertical { QSlider::groove:vertical {
background-color: QLinearGradient(x1: 1, y1: 0, x2: 0, y2: 0, background-color: rgb(76,76,76);
stop: 0 rgb(50, 49, 50), /* dark */
stop: 0.75 rgb(88,87,88)); /* kindaDark */
width: 4px; width: 4px;
border: none; border: none;
border-radius: 2px; border-radius: 2px;
} }
QSlider::handle:vertical { QSlider::handle:vertical {
background-color: QLinearGradient(x1: 1, y1: 0, x2: 0, y2: 0, background-color: #d2d2d2;
stop: 0 rgb(240,239,240), /* lighter */ border: 1px solid rgb(58,57,58);
stop: 0.25 rgb(200,199,200),
stop: 1 rgb(162,161,162)); /* light */
border: 1px solid rgb(58,57,58); /* dark */
border-radius: 3px; border-radius: 3px;
width: 10px; width: 10px;
height: 18px; height: 18px;
...@@ -546,10 +512,7 @@ QSlider::handle:vertical { ...@@ -546,10 +512,7 @@ QSlider::handle:vertical {
} }
QSlider::handle:vertical:pressed { QSlider::handle:vertical:pressed {
background-color: QLinearGradient(x1: 1, y1: 0, x2: 0, y2: 0, background-color: #d2d2d2;
stop: 0 rgb(240,239,240), /* lighter */
stop: 0.25 rgb(200,199,200),
stop: 1 rgb(162,161,162)); /* light */
} }
QSlider::add-page:vertical { QSlider::add-page:vertical {
...@@ -558,9 +521,7 @@ QSlider::add-page:vertical { ...@@ -558,9 +521,7 @@ QSlider::add-page:vertical {
} }
QSlider::add-page:vertical:disabled { QSlider::add-page:vertical:disabled {
background-color: QLinearGradient(x1: 1, y1: 0, x2: 0, y2: 0, background-color: rgb(50, 49, 50); /* dark */
stop: 0 rgb(31,30,31), /* veryDark */
stop: 0.75 rgb(50, 49, 50)); /* dark */
border-radius: 2px; border-radius: 2px;
} }
...@@ -747,3 +708,11 @@ VisibilityCheckBox::indicator:checked { ...@@ -747,3 +708,11 @@ VisibilityCheckBox::indicator:checked {
VisibilityCheckBox::indicator:unchecked { VisibilityCheckBox::indicator:unchecked {
image: url(:res/images/invisible.svg); image: url(:res/images/invisible.svg);
} }
* [themeID="trashIcon"] {
qproperty-icon: url(./Dark/trash.svg);
}
* [themeID="revertIcon"] {
qproperty-icon: url(./Dark/revert.svg);
}
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="#d2d2d2" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-rotate-ccw"><polyline points="1 4 1 10 7 10"></polyline><path d="M3.51 15a9 9 0 1 0 2.13-9.36L1 10"></path></svg>
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="#d2d2d2" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-trash-2"><polyline points="3 6 5 6 21 6"></polyline><path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"></path><line x1="10" y1="11" x2="10" y2="17"></line><line x1="14" y1="11" x2="14" y2="17"></line></svg>
...@@ -1339,3 +1339,11 @@ VisibilityCheckBox::indicator:checked:hover { ...@@ -1339,3 +1339,11 @@ VisibilityCheckBox::indicator:checked:hover {
VisibilityCheckBox::indicator:unchecked:hover { VisibilityCheckBox::indicator:unchecked:hover {
image: url(:res/images/invisible.svg); image: url(:res/images/invisible.svg);
} }
* [themeID="trashIcon"] {
qproperty-icon: url(./Dark/trash.svg);
}
* [themeID="revertIcon"] {
qproperty-icon: url(./Dark/revert.svg);
}
...@@ -191,3 +191,11 @@ VisibilityCheckBox::indicator:checked { ...@@ -191,3 +191,11 @@ VisibilityCheckBox::indicator:checked {
VisibilityCheckBox::indicator:unchecked { VisibilityCheckBox::indicator:unchecked {
image: url(:res/images/invisible.svg); image: url(:res/images/invisible.svg);
} }
* [themeID="trashIcon"] {
qproperty-icon: url(:res/images/trash.svg);
}
* [themeID="revertIcon"] {
qproperty-icon: url(:res/images/revert.svg);
}
...@@ -1250,13 +1250,6 @@ ...@@ -1250,13 +1250,6 @@
</layout> </layout>
</widget> </widget>
</item> </item>
<item>
<widget class="Line" name="line_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item> <item>
<widget class="QStackedWidget" name="outputModePages"> <widget class="QStackedWidget" name="outputModePages">
<property name="currentIndex"> <property name="currentIndex">
...@@ -2030,13 +2023,6 @@ ...@@ -2030,13 +2023,6 @@
</layout> </layout>
</widget> </widget>
</item> </item>
<item>
<widget class="Line" name="line_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item> <item>
<widget class="QStackedWidget" name="stackedWidget"> <widget class="QStackedWidget" name="stackedWidget">
<property name="currentIndex"> <property name="currentIndex">
...@@ -3497,13 +3483,6 @@ ...@@ -3497,13 +3483,6 @@
</property> </property>
</widget> </widget>
</item> </item>
<item>
<widget class="Line" name="line_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item> <item>
<widget class="QGroupBox" name="advReplayBufferGroupBox"> <widget class="QGroupBox" name="advReplayBufferGroupBox">
<property name="sizePolicy"> <property name="sizePolicy">
......
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="#000000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-rotate-ccw"><polyline points="1 4 1 10 7 10"></polyline><path d="M3.51 15a9 9 0 1 0 2.13-9.36L1 10"></path></svg>
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="#000000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-trash-2"><polyline points="3 6 5 6 21 6"></polyline><path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"></path><line x1="10" y1="11" x2="10" y2="17"></line><line x1="14" y1="11" x2="14" y2="17"></line></svg>
...@@ -14,6 +14,8 @@ ...@@ -14,6 +14,8 @@
<file>images/locked.svg</file> <file>images/locked.svg</file>
<file>images/invisible.svg</file> <file>images/invisible.svg</file>
<file>images/visible.svg</file> <file>images/visible.svg</file>
<file>images/trash.svg</file>
<file>images/revert.svg</file>
</qresource> </qresource>
<qresource prefix="/settings"> <qresource prefix="/settings">
<file>images/settings/output.svg</file> <file>images/settings/output.svg</file>
......
...@@ -272,13 +272,17 @@ void OBSHotkeyWidget::AddEdit(obs_key_combination combo, int idx) ...@@ -272,13 +272,17 @@ void OBSHotkeyWidget::AddEdit(obs_key_combination combo, int idx)
edit->setToolTip(toolTip); edit->setToolTip(toolTip);
auto revert = new QPushButton; auto revert = new QPushButton;
revert->setProperty("themeID", "hotkeyButtons"); revert->setProperty("themeID", "revertIcon");
revert->setText(QTStr("Revert")); revert->setToolTip(QTStr("Revert"));
revert->setFixedSize(24, 24);
revert->setStyleSheet("background: transparent; border: none;");
revert->setEnabled(false); revert->setEnabled(false);
auto clear = new QPushButton; auto clear = new QPushButton;
clear->setProperty("themeID", "hotkeyButtons"); clear->setProperty("themeID", "trashIcon");
clear->setText(QTStr("Clear")); clear->setToolTip(QTStr("Clear"));
clear->setFixedSize(24, 24);
clear->setStyleSheet("background: transparent; border: none;");
clear->setEnabled(!obs_key_combination_is_empty(combo)); clear->setEnabled(!obs_key_combination_is_empty(combo));
QObject::connect(edit, &OBSHotkeyEdit::KeyChanged, QObject::connect(edit, &OBSHotkeyEdit::KeyChanged,
...@@ -289,15 +293,15 @@ void OBSHotkeyWidget::AddEdit(obs_key_combination combo, int idx) ...@@ -289,15 +293,15 @@ void OBSHotkeyWidget::AddEdit(obs_key_combination combo, int idx)
}); });
auto add = new QPushButton; auto add = new QPushButton;
add->setProperty("themeID", "hotkeyButtons"); add->setProperty("themeID", "addIconSmall");
add->setText("+"); add->setFixedSize(24, 24);
add->setMinimumWidth(50); add->setStyleSheet("background: transparent; border: none;");
auto remove = new QPushButton; auto remove = new QPushButton;
remove->setProperty("themeID", "hotkeyButtons"); remove->setProperty("themeID", "removeIconSmall");
remove->setText("-");
remove->setEnabled(removeButtons.size() > 0); remove->setEnabled(removeButtons.size() > 0);
remove->setMinimumWidth(50); remove->setFixedSize(24, 24);
remove->setStyleSheet("background: transparent; border: none;");
auto CurrentIndex = [&, remove] auto CurrentIndex = [&, remove]
{ {
......
...@@ -333,12 +333,14 @@ void OBSPropertiesView::AddInt(obs_property_t *prop, QFormLayout *layout, ...@@ -333,12 +333,14 @@ void OBSPropertiesView::AddInt(obs_property_t *prop, QFormLayout *layout,
int minVal = obs_property_int_min(prop); int minVal = obs_property_int_min(prop);
int maxVal = obs_property_int_max(prop); int maxVal = obs_property_int_max(prop);
int stepVal = obs_property_int_step(prop); int stepVal = obs_property_int_step(prop);
const char *suffix = obs_property_int_suffix(prop);
spin->setMinimum(minVal); spin->setMinimum(minVal);
spin->setMaximum(maxVal); spin->setMaximum(maxVal);
spin->setSingleStep(stepVal); spin->setSingleStep(stepVal);
spin->setValue(val); spin->setValue(val);
spin->setToolTip(QT_UTF8(obs_property_long_description(prop))); spin->setToolTip(QT_UTF8(obs_property_long_description(prop)));
spin->setSuffix(QT_UTF8(suffix));
WidgetInfo *info = new WidgetInfo(this, prop, spin); WidgetInfo *info = new WidgetInfo(this, prop, spin);
children.emplace_back(info); children.emplace_back(info);
...@@ -382,12 +384,14 @@ void OBSPropertiesView::AddFloat(obs_property_t *prop, QFormLayout *layout, ...@@ -382,12 +384,14 @@ void OBSPropertiesView::AddFloat(obs_property_t *prop, QFormLayout *layout,
double minVal = obs_property_float_min(prop); double minVal = obs_property_float_min(prop);
double maxVal = obs_property_float_max(prop); double maxVal = obs_property_float_max(prop);
double stepVal = obs_property_float_step(prop); double stepVal = obs_property_float_step(prop);
const char *suffix = obs_property_float_suffix(prop);
spin->setMinimum(minVal); spin->setMinimum(minVal);
spin->setMaximum(maxVal); spin->setMaximum(maxVal);
spin->setSingleStep(stepVal); spin->setSingleStep(stepVal);
spin->setValue(val); spin->setValue(val);
spin->setToolTip(QT_UTF8(obs_property_long_description(prop))); spin->setToolTip(QT_UTF8(obs_property_long_description(prop)));
spin->setSuffix(QT_UTF8(suffix));
WidgetInfo *info = new WidgetInfo(this, prop, spin); WidgetInfo *info = new WidgetInfo(this, prop, spin);
children.emplace_back(info); children.emplace_back(info);
......
...@@ -463,7 +463,10 @@ OBSBasicSettings::OBSBasicSettings(QWidget *parent) ...@@ -463,7 +463,10 @@ OBSBasicSettings::OBSBasicSettings(QWidget *parent)
HookWidget(ui->autoRemux, CHECK_CHANGED, ADV_CHANGED); HookWidget(ui->autoRemux, CHECK_CHANGED, ADV_CHANGED);
ui->simpleOutputVBitrate->setSingleStep(50); ui->simpleOutputVBitrate->setSingleStep(50);
ui->simpleOutputVBitrate->setSuffix(" Kbps");
ui->advOutFFVBitrate->setSingleStep(50); ui->advOutFFVBitrate->setSingleStep(50);
ui->advOutFFVBitrate->setSuffix(" Kbps");
ui->advOutFFABitrate->setSuffix(" Kbps");
#if !defined(_WIN32) && !defined(__APPLE__) #if !defined(_WIN32) && !defined(__APPLE__)
delete ui->enableAutoUpdates; delete ui->enableAutoUpdates;
...@@ -725,6 +728,10 @@ OBSBasicSettings::OBSBasicSettings(QWidget *parent) ...@@ -725,6 +728,10 @@ OBSBasicSettings::OBSBasicSettings(QWidget *parent)
this, SLOT(AdvOutRecCheckWarnings())); this, SLOT(AdvOutRecCheckWarnings()));
AdvOutRecCheckWarnings(); AdvOutRecCheckWarnings();
ui->buttonBox->button(QDialogButtonBox::Apply)->setIcon(QIcon());
ui->buttonBox->button(QDialogButtonBox::Ok)->setIcon(QIcon());
ui->buttonBox->button(QDialogButtonBox::Cancel)->setIcon(QIcon());
SimpleRecordingQualityChanged(); SimpleRecordingQualityChanged();
UpdateAutomaticReplayBufferCheckboxes(); UpdateAutomaticReplayBufferCheckboxes();
...@@ -2322,12 +2329,22 @@ void OBSBasicSettings::LoadAdvancedSettings() ...@@ -2322,12 +2329,22 @@ void OBSBasicSettings::LoadAdvancedSettings()
loading = false; loading = false;
} }
#define TRUNCATE_TEXT_LENGTH 80
template <typename Func> template <typename Func>
static inline void LayoutHotkey(obs_hotkey_id id, obs_hotkey_t *key, Func &&fun, static inline void LayoutHotkey(obs_hotkey_id id, obs_hotkey_t *key, Func &&fun,
const map<obs_hotkey_id, vector<obs_key_combination_t>> &keys) const map<obs_hotkey_id, vector<obs_key_combination_t>> &keys)
{ {
auto *label = new OBSHotkeyLabel; auto *label = new OBSHotkeyLabel;
label->setText(obs_hotkey_get_description(key)); QString text = QT_UTF8(obs_hotkey_get_description(key));
if (text.length() > TRUNCATE_TEXT_LENGTH) {
label->setProperty("fullName", text);
text = text.left(TRUNCATE_TEXT_LENGTH);
text += "...'";
}
label->setText(text);
OBSHotkeyWidget *hw = nullptr; OBSHotkeyWidget *hw = nullptr;
...@@ -2353,7 +2370,19 @@ static QLabel *makeLabel(T &t, Func &&getName) ...@@ -2353,7 +2370,19 @@ static QLabel *makeLabel(T &t, Func &&getName)
template <typename Func> template <typename Func>
static QLabel *makeLabel(const OBSSource &source, Func &&) static QLabel *makeLabel(const OBSSource &source, Func &&)
{ {
return new OBSSourceLabel(source); OBSSourceLabel *label = new OBSSourceLabel(source);
label->setStyleSheet("font-weight: bold;");
QString name = QT_UTF8(obs_source_get_name(source));
if (name.length() > TRUNCATE_TEXT_LENGTH) {
label->setToolTip(name);
name = name.left(TRUNCATE_TEXT_LENGTH);
name += "...";
}
label->setText(name);
return label;
} }
template <typename Func, typename T> template <typename Func, typename T>
...@@ -2365,13 +2394,8 @@ static inline void AddHotkeys(QFormLayout &layout, ...@@ -2365,13 +2394,8 @@ static inline void AddHotkeys(QFormLayout &layout,
if (hotkeys.empty()) if (hotkeys.empty())
return; return;
auto line = new QFrame();
line->setFrameShape(QFrame::HLine);
line->setFrameShadow(QFrame::Sunken);
layout.setItem(layout.rowCount(), QFormLayout::SpanningRole, layout.setItem(layout.rowCount(), QFormLayout::SpanningRole,
new QSpacerItem(0, 10)); new QSpacerItem(0, 10));
layout.addRow(line);
using tuple_type = using tuple_type =
std::tuple<T, QPointer<QLabel>, QPointer<QWidget>>; std::tuple<T, QPointer<QLabel>, QPointer<QWidget>>;
...@@ -2632,7 +2656,12 @@ void OBSBasicSettings::LoadHotkeySettings(obs_hotkey_id ignoreKey) ...@@ -2632,7 +2656,12 @@ void OBSBasicSettings::LoadHotkeySettings(obs_hotkey_id ignoreKey)
auto Update = [&](OBSHotkeyLabel *label, const QString &name, auto Update = [&](OBSHotkeyLabel *label, const QString &name,
OBSHotkeyLabel *other, const QString &otherName) OBSHotkeyLabel *other, const QString &otherName)
{ {
label->setToolTip(tt.arg(otherName)); QString string = other->property("fullName").value<QString>();
if (string.isEmpty() || string.isNull())
string = otherName;
label->setToolTip(tt.arg(string));
label->setText(name + " *"); label->setText(name + " *");
label->pairPartner = other; label->pairPartner = other;
}; };
...@@ -4323,7 +4352,6 @@ void OBSBasicSettings::AdvReplayBufferChanged() ...@@ -4323,7 +4352,6 @@ void OBSBasicSettings::AdvReplayBufferChanged()
ui->advRBEstimate->setText(QTStr(ESTIMATE_UNKNOWN_STR)); ui->advRBEstimate->setText(QTStr(ESTIMATE_UNKNOWN_STR));
ui->advReplayBufferGroupBox->setVisible(!lossless && replayBufferEnabled); ui->advReplayBufferGroupBox->setVisible(!lossless && replayBufferEnabled);
ui->line_4->setVisible(!lossless && replayBufferEnabled);
ui->advReplayBuf->setEnabled(!lossless); ui->advReplayBuf->setEnabled(!lossless);
UpdateAutomaticReplayBufferCheckboxes(); UpdateAutomaticReplayBufferCheckboxes();
......
...@@ -27,11 +27,13 @@ static inline void *get_property_data(struct obs_property *prop); ...@@ -27,11 +27,13 @@ static inline void *get_property_data(struct obs_property *prop);
struct float_data { struct float_data {
double min, max, step; double min, max, step;
enum obs_number_type type; enum obs_number_type type;
char *suffix;
}; };
struct int_data { struct int_data {
int min, max, step; int min, max, step;
enum obs_number_type type; enum obs_number_type type;
char *suffix;
}; };
struct list_item { struct list_item {
...@@ -149,6 +151,16 @@ static inline void group_data_free(struct group_data *data) { ...@@ -149,6 +151,16 @@ static inline void group_data_free(struct group_data *data) {
obs_properties_destroy(data->content); obs_properties_destroy(data->content);
} }
static inline void int_data_free(struct int_data *data) {
if (data->suffix)
bfree(data->suffix);
}
static inline void float_data_free(struct int_data *data) {
if (data->suffix)
bfree(data->suffix);
}
struct obs_properties; struct obs_properties;
struct obs_property { struct obs_property {
...@@ -235,6 +247,10 @@ static void obs_property_destroy(struct obs_property *property) ...@@ -235,6 +247,10 @@ static void obs_property_destroy(struct obs_property *property)
frame_rate_data_free(get_property_data(property)); frame_rate_data_free(get_property_data(property));
else if (property->type == OBS_PROPERTY_GROUP) else if (property->type == OBS_PROPERTY_GROUP)
group_data_free(get_property_data(property)); group_data_free(get_property_data(property));
else if (property->type == OBS_PROPERTY_INT)
int_data_free(get_property_data(property));
else if (property->type == OBS_PROPERTY_FLOAT)
float_data_free(get_property_data(property));
bfree(property->name); bfree(property->name);
bfree(property->desc); bfree(property->desc);
...@@ -855,6 +871,12 @@ enum obs_number_type obs_property_int_type(obs_property_t *p) ...@@ -855,6 +871,12 @@ enum obs_number_type obs_property_int_type(obs_property_t *p)
return data ? data->type : OBS_NUMBER_SCROLLER; return data ? data->type : OBS_NUMBER_SCROLLER;
} }
const char *obs_property_int_suffix(obs_property_t *p)
{
struct int_data *data = get_type_data(p, OBS_PROPERTY_INT);
return data ? data->suffix : NULL;
}
double obs_property_float_min(obs_property_t *p) double obs_property_float_min(obs_property_t *p)
{ {
struct float_data *data = get_type_data(p, OBS_PROPERTY_FLOAT); struct float_data *data = get_type_data(p, OBS_PROPERTY_FLOAT);
...@@ -873,6 +895,12 @@ double obs_property_float_step(obs_property_t *p) ...@@ -873,6 +895,12 @@ double obs_property_float_step(obs_property_t *p)
return data ? data->step : 0; return data ? data->step : 0;
} }
const char *obs_property_float_suffix(obs_property_t *p)
{
struct int_data *data = get_type_data(p, OBS_PROPERTY_FLOAT);
return data ? data->suffix : NULL;
}
enum obs_number_type obs_property_float_type(obs_property_t *p) enum obs_number_type obs_property_float_type(obs_property_t *p)
{ {
struct float_data *data = get_type_data(p, OBS_PROPERTY_FLOAT); struct float_data *data = get_type_data(p, OBS_PROPERTY_FLOAT);
...@@ -939,6 +967,26 @@ void obs_property_float_set_limits(obs_property_t *p, ...@@ -939,6 +967,26 @@ void obs_property_float_set_limits(obs_property_t *p,
data->step = step; data->step = step;
} }
void obs_property_int_set_suffix(obs_property_t *p, const char *suffix)
{
struct int_data *data = get_type_data(p, OBS_PROPERTY_INT);
if (!data)
return;
bfree(data->suffix);
data->suffix = bstrdup(suffix);
}
void obs_property_float_set_suffix(obs_property_t *p, const char *suffix)
{
struct float_data *data = get_type_data(p, OBS_PROPERTY_FLOAT);
if (!data)
return;
bfree(data->suffix);
data->suffix = bstrdup(suffix);
}
void obs_property_list_clear(obs_property_t *p) void obs_property_list_clear(obs_property_t *p)
{ {
struct list_data *data = get_list_data(p); struct list_data *data = get_list_data(p);
......
...@@ -286,10 +286,12 @@ EXPORT int obs_property_int_min(obs_property_t *p); ...@@ -286,10 +286,12 @@ EXPORT int obs_property_int_min(obs_property_t *p);
EXPORT int obs_property_int_max(obs_property_t *p); EXPORT int obs_property_int_max(obs_property_t *p);
EXPORT int obs_property_int_step(obs_property_t *p); EXPORT int obs_property_int_step(obs_property_t *p);
EXPORT enum obs_number_type obs_property_int_type(obs_property_t *p); EXPORT enum obs_number_type obs_property_int_type(obs_property_t *p);
EXPORT const char * obs_property_int_suffix(obs_property_t *p);
EXPORT double obs_property_float_min(obs_property_t *p); EXPORT double obs_property_float_min(obs_property_t *p);
EXPORT double obs_property_float_max(obs_property_t *p); EXPORT double obs_property_float_max(obs_property_t *p);
EXPORT double obs_property_float_step(obs_property_t *p); EXPORT double obs_property_float_step(obs_property_t *p);
EXPORT enum obs_number_type obs_property_float_type(obs_property_t *p); EXPORT enum obs_number_type obs_property_float_type(obs_property_t *p);
EXPORT const char * obs_property_float_suffix(obs_property_t *p);
EXPORT enum obs_text_type obs_property_text_type(obs_property_t *p); EXPORT enum obs_text_type obs_property_text_type(obs_property_t *p);
EXPORT enum obs_path_type obs_property_path_type(obs_property_t *p); EXPORT enum obs_path_type obs_property_path_type(obs_property_t *p);
EXPORT const char * obs_property_path_filter(obs_property_t *p); EXPORT const char * obs_property_path_filter(obs_property_t *p);
...@@ -301,6 +303,8 @@ EXPORT void obs_property_int_set_limits(obs_property_t *p, ...@@ -301,6 +303,8 @@ EXPORT void obs_property_int_set_limits(obs_property_t *p,
int min, int max, int step); int min, int max, int step);
EXPORT void obs_property_float_set_limits(obs_property_t *p, EXPORT void obs_property_float_set_limits(obs_property_t *p,
double min, double max, double step); double min, double max, double step);
EXPORT void obs_property_int_set_suffix(obs_property_t *p, const char *suffix);
EXPORT void obs_property_float_set_suffix(obs_property_t *p, const char *suffix);
EXPORT void obs_property_list_clear(obs_property_t *p); EXPORT void obs_property_list_clear(obs_property_t *p);
......
...@@ -874,14 +874,18 @@ static obs_properties_t *vt_h264_properties(void *unused) ...@@ -874,14 +874,18 @@ static obs_properties_t *vt_h264_properties(void *unused)
obs_properties_t *props = obs_properties_create(); obs_properties_t *props = obs_properties_create();
obs_property_t *p; obs_property_t *p;
obs_properties_add_int(props, "bitrate", TEXT_BITRATE, 50, 10000000, 50); p = obs_properties_add_int(props, "bitrate",
TEXT_BITRATE, 50, 10000000, 50);
obs_property_int_set_suffix(p, " Kbps");
p = obs_properties_add_bool(props, "limit_bitrate", p = obs_properties_add_bool(props, "limit_bitrate",
TEXT_USE_MAX_BITRATE); TEXT_USE_MAX_BITRATE);
obs_property_set_modified_callback(p, limit_bitrate_modified); obs_property_set_modified_callback(p, limit_bitrate_modified);
obs_properties_add_int(props, "max_bitrate", TEXT_MAX_BITRATE, 50, p = obs_properties_add_int(props, "max_bitrate", TEXT_MAX_BITRATE, 50,
10000000, 50); 10000000, 50);
obs_property_int_set_suffix(p, " Kbps");
obs_properties_add_float(props, "max_bitrate_window", obs_properties_add_float(props, "max_bitrate_window",
TEXT_MAX_BITRATE_WINDOW, 0.10f, 10.0f, 0.25f); TEXT_MAX_BITRATE_WINDOW, 0.10f, 10.0f, 0.25f);
......
...@@ -451,10 +451,12 @@ obs_properties_t *nvenc_properties_internal(bool ffmpeg) ...@@ -451,10 +451,12 @@ obs_properties_t *nvenc_properties_internal(bool ffmpeg)
obs_property_set_modified_callback(p, rate_control_modified); obs_property_set_modified_callback(p, rate_control_modified);
obs_properties_add_int(props, "bitrate", p = obs_properties_add_int(props, "bitrate",
obs_module_text("Bitrate"), 50, 300000, 50); obs_module_text("Bitrate"), 50, 300000, 50);
obs_properties_add_int(props, "max_bitrate", obs_property_int_set_suffix(p, " Kbps");
p = obs_properties_add_int(props, "max_bitrate",
obs_module_text("MaxBitrate"), 50, 300000, 50); obs_module_text("MaxBitrate"), 50, 300000, 50);
obs_property_int_set_suffix(p, " Kbps");
obs_properties_add_int(props, "cqp", obs_module_text("NVENC.CQLevel"), obs_properties_add_int(props, "cqp", obs_module_text("NVENC.CQLevel"),
1, 30, 1); 1, 30, 1);
......
...@@ -490,8 +490,10 @@ static obs_properties_t *vaapi_properties(void *unused) ...@@ -490,8 +490,10 @@ static obs_properties_t *vaapi_properties(void *unused)
obs_property_list_add_int(list, "720p60/1080p30 (4.1)", 41); obs_property_list_add_int(list, "720p60/1080p30 (4.1)", 41);
obs_property_list_add_int(list, "1080p60 (4.2)", 42); obs_property_list_add_int(list, "1080p60 (4.2)", 42);
obs_properties_add_int(props, "bitrate", obs_module_text("Bitrate"), 0, obs_property_t *p;
p = obs_properties_add_int(props, "bitrate", obs_module_text("Bitrate"), 0,
300000, 50); 300000, 50);
obs_property_int_set_suffix(p, " Kbps");
obs_properties_add_int(props, "keyint_sec", obs_properties_add_int(props, "keyint_sec",
obs_module_text("Keyframe Interval (seconds)"), 0, 20, obs_module_text("Keyframe Interval (seconds)"), 0, 20,
......
...@@ -260,10 +260,15 @@ static obs_properties_t *obs_qsv_props(void *unused) ...@@ -260,10 +260,15 @@ static obs_properties_t *obs_qsv_props(void *unused)
add_rate_controls(list, qsv_ratecontrols); add_rate_controls(list, qsv_ratecontrols);
obs_property_set_modified_callback(list, rate_control_modified); obs_property_set_modified_callback(list, rate_control_modified);
obs_properties_add_int(props, "bitrate", TEXT_TARGET_BITRATE, 50, obs_property_t *p;
p = obs_properties_add_int(props, "bitrate", TEXT_TARGET_BITRATE, 50,
10000000, 50); 10000000, 50);
obs_properties_add_int(props, "max_bitrate", TEXT_MAX_BITRATE, 50, obs_property_int_set_suffix(p, " Kbps");
p = obs_properties_add_int(props, "max_bitrate", TEXT_MAX_BITRATE, 50,
10000000, 50); 10000000, 50);
obs_property_int_set_suffix(p, " Kbps");
obs_properties_add_int(props, "accuracy", TEXT_ACCURACY, 0, 10000, 1); obs_properties_add_int(props, "accuracy", TEXT_ACCURACY, 0, 10000, 1);
obs_properties_add_int(props, "convergence", TEXT_CONVERGENCE, 0, 10, 1); obs_properties_add_int(props, "convergence", TEXT_CONVERGENCE, 0, 10, 1);
obs_properties_add_int(props, "qpi", "QPI", 1, 51, 1); obs_properties_add_int(props, "qpi", "QPI", 1, 51, 1);
......
...@@ -179,7 +179,9 @@ static obs_properties_t *obs_x264_props(void *unused) ...@@ -179,7 +179,9 @@ static obs_properties_t *obs_x264_props(void *unused)
obs_property_set_modified_callback(list, rate_control_modified); obs_property_set_modified_callback(list, rate_control_modified);
obs_properties_add_int(props, "bitrate", TEXT_BITRATE, 50, 10000000, 50); p = obs_properties_add_int(props, "bitrate",
TEXT_BITRATE, 50, 10000000, 50);
obs_property_int_set_suffix(p, " Kbps");
p = obs_properties_add_bool(props, "use_bufsize", TEXT_CUSTOM_BUF); p = obs_properties_add_bool(props, "use_bufsize", TEXT_CUSTOM_BUF);
obs_property_set_modified_callback(p, use_bufsize_modified); obs_property_set_modified_callback(p, use_bufsize_modified);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册