|
@@ -28,7 +28,6 @@
|
|
#include "spinbox-ignorewheel.hpp"
|
|
#include "spinbox-ignorewheel.hpp"
|
|
#include "properties-view.hpp"
|
|
#include "properties-view.hpp"
|
|
#include "properties-view.moc.hpp"
|
|
#include "properties-view.moc.hpp"
|
|
-#include "obs-app.hpp"
|
|
|
|
|
|
|
|
#include <qt-wrappers.hpp>
|
|
#include <qt-wrappers.hpp>
|
|
#include <plain-text-edit.hpp>
|
|
#include <plain-text-edit.hpp>
|
|
@@ -39,6 +38,7 @@
|
|
#include <obs.h>
|
|
#include <obs.h>
|
|
#include <qtimer.h>
|
|
#include <qtimer.h>
|
|
#include <string>
|
|
#include <string>
|
|
|
|
+#include <obs-frontend-api.h>
|
|
|
|
|
|
using namespace std;
|
|
using namespace std;
|
|
|
|
|
|
@@ -106,7 +106,7 @@ void OBSPropertiesView::ReloadProperties()
|
|
RefreshProperties();
|
|
RefreshProperties();
|
|
}
|
|
}
|
|
|
|
|
|
-#define NO_PROPERTIES_STRING QTStr("Basic.PropertiesWindow.NoProperties")
|
|
|
|
|
|
+#define NO_PROPERTIES_STRING QObject::tr("Basic.PropertiesWindow.NoProperties")
|
|
|
|
|
|
void OBSPropertiesView::RefreshProperties()
|
|
void OBSPropertiesView::RefreshProperties()
|
|
{
|
|
{
|
|
@@ -306,7 +306,7 @@ QWidget *OBSPropertiesView::AddText(obs_property_t *prop, QFormLayout *layout,
|
|
QLineEdit *edit = new QLineEdit();
|
|
QLineEdit *edit = new QLineEdit();
|
|
QPushButton *show = new QPushButton();
|
|
QPushButton *show = new QPushButton();
|
|
|
|
|
|
- show->setText(QTStr("Show"));
|
|
|
|
|
|
+ show->setText(tr("Show"));
|
|
show->setCheckable(true);
|
|
show->setCheckable(true);
|
|
edit->setText(QT_UTF8(val));
|
|
edit->setText(QT_UTF8(val));
|
|
edit->setEchoMode(QLineEdit::Password);
|
|
edit->setEchoMode(QLineEdit::Password);
|
|
@@ -318,7 +318,7 @@ QWidget *OBSPropertiesView::AddText(obs_property_t *prop, QFormLayout *layout,
|
|
connect(show, &QAbstractButton::toggled, info,
|
|
connect(show, &QAbstractButton::toggled, info,
|
|
&WidgetInfo::TogglePasswordText);
|
|
&WidgetInfo::TogglePasswordText);
|
|
connect(show, &QAbstractButton::toggled, [=](bool hide) {
|
|
connect(show, &QAbstractButton::toggled, [=](bool hide) {
|
|
- show->setText(hide ? QTStr("Hide") : QTStr("Show"));
|
|
|
|
|
|
+ show->setText(hide ? tr("Hide") : tr("Show"));
|
|
});
|
|
});
|
|
children.emplace_back(info);
|
|
children.emplace_back(info);
|
|
|
|
|
|
@@ -345,7 +345,7 @@ QWidget *OBSPropertiesView::AddText(obs_property_t *prop, QFormLayout *layout,
|
|
label = new QLabel(desc);
|
|
label = new QLabel(desc);
|
|
|
|
|
|
if (long_desc != NULL && !info_label->text().isEmpty()) {
|
|
if (long_desc != NULL && !info_label->text().isEmpty()) {
|
|
- QString file = !App()->IsThemeDark()
|
|
|
|
|
|
+ QString file = !obs_frontend_is_theme_dark()
|
|
? ":/res/images/help.svg"
|
|
? ":/res/images/help.svg"
|
|
: ":/res/images/help_light.svg";
|
|
: ":/res/images/help_light.svg";
|
|
QString lStr = "<html>%1 <img src='%2' style=' \
|
|
QString lStr = "<html>%1 <img src='%2' style=' \
|
|
@@ -391,7 +391,7 @@ void OBSPropertiesView::AddPath(obs_property_t *prop, QFormLayout *layout,
|
|
const char *val = obs_data_get_string(settings, name);
|
|
const char *val = obs_data_get_string(settings, name);
|
|
QLayout *subLayout = new QHBoxLayout();
|
|
QLayout *subLayout = new QHBoxLayout();
|
|
QLineEdit *edit = new QLineEdit();
|
|
QLineEdit *edit = new QLineEdit();
|
|
- QPushButton *button = new QPushButton(QTStr("Browse"));
|
|
|
|
|
|
+ QPushButton *button = new QPushButton(tr("Browse"));
|
|
|
|
|
|
if (!obs_property_enabled(prop)) {
|
|
if (!obs_property_enabled(prop)) {
|
|
edit->setEnabled(false);
|
|
edit->setEnabled(false);
|
|
@@ -682,8 +682,8 @@ QWidget *OBSPropertiesView::AddList(obs_property_t *prop, bool &warning)
|
|
if (id != -1 && id != idx) {
|
|
if (id != -1 && id != idx) {
|
|
QString actual = combo->itemText(id);
|
|
QString actual = combo->itemText(id);
|
|
QString selected = combo->itemText(idx);
|
|
QString selected = combo->itemText(idx);
|
|
- QString combined = QTStr(
|
|
|
|
- "Basic.PropertiesWindow.AutoSelectFormat");
|
|
|
|
|
|
+ QString combined =
|
|
|
|
+ tr("Basic.PropertiesWindow.AutoSelectFormat");
|
|
combo->setItemText(idx,
|
|
combo->setItemText(idx,
|
|
combined.arg(selected).arg(actual));
|
|
combined.arg(selected).arg(actual));
|
|
}
|
|
}
|
|
@@ -797,7 +797,7 @@ void OBSPropertiesView::AddColorInternal(obs_property_t *prop,
|
|
}
|
|
}
|
|
|
|
|
|
button->setProperty("themeID", "settingsButtons");
|
|
button->setProperty("themeID", "settingsButtons");
|
|
- button->setText(QTStr("Basic.PropertiesWindow.SelectColor"));
|
|
|
|
|
|
+ button->setText(tr("Basic.PropertiesWindow.SelectColor"));
|
|
button->setToolTip(QT_UTF8(obs_property_long_description(prop)));
|
|
button->setToolTip(QT_UTF8(obs_property_long_description(prop)));
|
|
|
|
|
|
if (supportAlpha) {
|
|
if (supportAlpha) {
|
|
@@ -899,7 +899,7 @@ void OBSPropertiesView::AddFont(obs_property_t *prop, QFormLayout *layout,
|
|
MakeQFont(font_obj, font, true);
|
|
MakeQFont(font_obj, font, true);
|
|
|
|
|
|
button->setProperty("themeID", "settingsButtons");
|
|
button->setProperty("themeID", "settingsButtons");
|
|
- button->setText(QTStr("Basic.PropertiesWindow.SelectFont"));
|
|
|
|
|
|
+ button->setText(tr("Basic.PropertiesWindow.SelectFont"));
|
|
button->setToolTip(QT_UTF8(obs_property_long_description(prop)));
|
|
button->setToolTip(QT_UTF8(obs_property_long_description(prop)));
|
|
|
|
|
|
fontLabel->setFrameStyle(QFrame::Sunken | QFrame::Panel);
|
|
fontLabel->setFrameStyle(QFrame::Sunken | QFrame::Panel);
|
|
@@ -1165,7 +1165,7 @@ static QWidget *CreateRationalFPS(OBSFrameRatePropertyWidget *fpsProps,
|
|
layout->setContentsMargins(0, 0, 0, 0);
|
|
layout->setContentsMargins(0, 0, 0, 0);
|
|
layout->setSpacing(4);
|
|
layout->setSpacing(4);
|
|
|
|
|
|
- auto str = QTStr("Basic.PropertiesView.FPS.ValidFPSRanges");
|
|
|
|
|
|
+ auto str = QObject::tr("Basic.PropertiesView.FPS.ValidFPSRanges");
|
|
auto rlabel = new QLabel{str};
|
|
auto rlabel = new QLabel{str};
|
|
|
|
|
|
auto combo = fpsProps->fpsRange = new QComboBox();
|
|
auto combo = fpsProps->fpsRange = new QComboBox();
|
|
@@ -1200,8 +1200,9 @@ static QWidget *CreateRationalFPS(OBSFrameRatePropertyWidget *fpsProps,
|
|
den_edit->setValue(current_fps->denominator);
|
|
den_edit->setValue(current_fps->denominator);
|
|
}
|
|
}
|
|
|
|
|
|
- layout->addRow(QTStr("Basic.Settings.Video.Numerator"), num_edit);
|
|
|
|
- layout->addRow(QTStr("Basic.Settings.Video.Denominator"), den_edit);
|
|
|
|
|
|
+ layout->addRow(QObject::tr("Basic.Settings.Video.Numerator"), num_edit);
|
|
|
|
+ layout->addRow(QObject::tr("Basic.Settings.Video.Denominator"),
|
|
|
|
+ den_edit);
|
|
|
|
|
|
widget->setLayout(layout);
|
|
widget->setLayout(layout);
|
|
|
|
|
|
@@ -1220,9 +1221,9 @@ CreateFrameRateWidget(obs_property_t *prop, bool &warning, const char *option,
|
|
swap(widget->fps_ranges, fps_ranges);
|
|
swap(widget->fps_ranges, fps_ranges);
|
|
|
|
|
|
auto combo = widget->modeSelect = new QComboBox();
|
|
auto combo = widget->modeSelect = new QComboBox();
|
|
- combo->addItem(QTStr("Basic.PropertiesView.FPS.Simple"),
|
|
|
|
|
|
+ combo->addItem(QObject::tr("Basic.PropertiesView.FPS.Simple"),
|
|
QVariant::fromValue(frame_rate_tag::simple()));
|
|
QVariant::fromValue(frame_rate_tag::simple()));
|
|
- combo->addItem(QTStr("Basic.PropertiesView.FPS.Rational"),
|
|
|
|
|
|
+ combo->addItem(QObject::tr("Basic.PropertiesView.FPS.Rational"),
|
|
QVariant::fromValue(frame_rate_tag::rational()));
|
|
QVariant::fromValue(frame_rate_tag::rational()));
|
|
|
|
|
|
combo->setToolTip(QT_UTF8(obs_property_long_description(prop)));
|
|
combo->setToolTip(QT_UTF8(obs_property_long_description(prop)));
|
|
@@ -1616,7 +1617,7 @@ void OBSPropertiesView::AddProperty(obs_property_t *property,
|
|
widget->setEnabled(false);
|
|
widget->setEnabled(false);
|
|
|
|
|
|
if (obs_property_long_description(property)) {
|
|
if (obs_property_long_description(property)) {
|
|
- QString file = !App()->IsThemeDark()
|
|
|
|
|
|
+ QString file = !obs_frontend_is_theme_dark()
|
|
? ":/res/images/help.svg"
|
|
? ":/res/images/help.svg"
|
|
: ":/res/images/help_light.svg";
|
|
: ":/res/images/help_light.svg";
|
|
if (label) {
|
|
if (label) {
|
|
@@ -1970,13 +1971,13 @@ bool WidgetInfo::FontChanged(const char *setting)
|
|
QFont initial;
|
|
QFont initial;
|
|
font = QFontDialog::getFont(
|
|
font = QFontDialog::getFont(
|
|
&success, initial, view,
|
|
&success, initial, view,
|
|
- QTStr("Basic.PropertiesWindow.SelectFont.WindowTitle"),
|
|
|
|
|
|
+ tr("Basic.PropertiesWindow.SelectFont.WindowTitle"),
|
|
options);
|
|
options);
|
|
} else {
|
|
} else {
|
|
MakeQFont(font_obj, font);
|
|
MakeQFont(font_obj, font);
|
|
font = QFontDialog::getFont(
|
|
font = QFontDialog::getFont(
|
|
&success, font, view,
|
|
&success, font, view,
|
|
- QTStr("Basic.PropertiesWindow.SelectFont.WindowTitle"),
|
|
|
|
|
|
+ tr("Basic.PropertiesWindow.SelectFont.WindowTitle"),
|
|
options);
|
|
options);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -2042,15 +2043,14 @@ void WidgetInfo::ButtonClicked()
|
|
QUrl url(savedUrl, QUrl::StrictMode);
|
|
QUrl url(savedUrl, QUrl::StrictMode);
|
|
if (url.isValid() && (url.scheme().compare("http") == 0 ||
|
|
if (url.isValid() && (url.scheme().compare("http") == 0 ||
|
|
url.scheme().compare("https") == 0)) {
|
|
url.scheme().compare("https") == 0)) {
|
|
- QString msg(
|
|
|
|
- QTStr("Basic.PropertiesView.UrlButton.Text"));
|
|
|
|
|
|
+ QString msg(tr("Basic.PropertiesView.UrlButton.Text"));
|
|
msg += "\n\n";
|
|
msg += "\n\n";
|
|
- msg += QString(QTStr("Basic.PropertiesView.UrlButton.Text.Url"))
|
|
|
|
|
|
+ msg += QString(tr("Basic.PropertiesView.UrlButton.Text.Url"))
|
|
.arg(savedUrl);
|
|
.arg(savedUrl);
|
|
|
|
|
|
QMessageBox::StandardButton button = OBSMessageBox::question(
|
|
QMessageBox::StandardButton button = OBSMessageBox::question(
|
|
view->window(),
|
|
view->window(),
|
|
- QTStr("Basic.PropertiesView.UrlButton.OpenUrl"),
|
|
|
|
|
|
+ tr("Basic.PropertiesView.UrlButton.OpenUrl"),
|
|
msg, QMessageBox::Yes | QMessageBox::No,
|
|
msg, QMessageBox::Yes | QMessageBox::No,
|
|
QMessageBox::No);
|
|
QMessageBox::No);
|
|
|
|
|
|
@@ -2188,8 +2188,7 @@ class EditableItemDialog : public QDialog {
|
|
if (curPath.isEmpty())
|
|
if (curPath.isEmpty())
|
|
curPath = default_path;
|
|
curPath = default_path;
|
|
|
|
|
|
- QString path = OpenFile(App()->GetMainWindow(), QTStr("Browse"),
|
|
|
|
- curPath, filter);
|
|
|
|
|
|
+ QString path = OpenFile(this, tr("Browse"), curPath, filter);
|
|
if (path.isEmpty())
|
|
if (path.isEmpty())
|
|
return;
|
|
return;
|
|
|
|
|
|
@@ -2214,7 +2213,7 @@ public:
|
|
|
|
|
|
if (browse) {
|
|
if (browse) {
|
|
QPushButton *browseButton =
|
|
QPushButton *browseButton =
|
|
- new QPushButton(QTStr("Browse"));
|
|
|
|
|
|
+ new QPushButton(tr("Browse"));
|
|
browseButton->setProperty("themeID", "settingsButtons");
|
|
browseButton->setProperty("themeID", "settingsButtons");
|
|
topLayout->addWidget(browseButton);
|
|
topLayout->addWidget(browseButton);
|
|
topLayout->setAlignment(browseButton, Qt::AlignVCenter);
|
|
topLayout->setAlignment(browseButton, Qt::AlignVCenter);
|
|
@@ -2259,18 +2258,17 @@ void WidgetInfo::EditListAdd()
|
|
|
|
|
|
QAction *action;
|
|
QAction *action;
|
|
|
|
|
|
- action = new QAction(QTStr("Basic.PropertiesWindow.AddFiles"), this);
|
|
|
|
|
|
+ action = new QAction(tr("Basic.PropertiesWindow.AddFiles"), this);
|
|
connect(action, &QAction::triggered, this,
|
|
connect(action, &QAction::triggered, this,
|
|
&WidgetInfo::EditListAddFiles);
|
|
&WidgetInfo::EditListAddFiles);
|
|
popup.addAction(action);
|
|
popup.addAction(action);
|
|
|
|
|
|
- action = new QAction(QTStr("Basic.PropertiesWindow.AddDir"), this);
|
|
|
|
|
|
+ action = new QAction(tr("Basic.PropertiesWindow.AddDir"), this);
|
|
connect(action, &QAction::triggered, this, &WidgetInfo::EditListAddDir);
|
|
connect(action, &QAction::triggered, this, &WidgetInfo::EditListAddDir);
|
|
popup.addAction(action);
|
|
popup.addAction(action);
|
|
|
|
|
|
if (type == OBS_EDITABLE_LIST_TYPE_FILES_AND_URLS) {
|
|
if (type == OBS_EDITABLE_LIST_TYPE_FILES_AND_URLS) {
|
|
- action = new QAction(QTStr("Basic.PropertiesWindow.AddURL"),
|
|
|
|
- this);
|
|
|
|
|
|
+ action = new QAction(tr("Basic.PropertiesWindow.AddURL"), this);
|
|
connect(action, &QAction::triggered, this,
|
|
connect(action, &QAction::triggered, this,
|
|
&WidgetInfo::EditListAddText);
|
|
&WidgetInfo::EditListAddText);
|
|
popup.addAction(action);
|
|
popup.addAction(action);
|
|
@@ -2285,7 +2283,7 @@ void WidgetInfo::EditListAddText()
|
|
const char *desc = obs_property_description(property);
|
|
const char *desc = obs_property_description(property);
|
|
|
|
|
|
EditableItemDialog dialog(widget->window(), QString(), false);
|
|
EditableItemDialog dialog(widget->window(), QString(), false);
|
|
- auto title = QTStr("Basic.PropertiesWindow.AddEditableListEntry")
|
|
|
|
|
|
+ auto title = tr("Basic.PropertiesWindow.AddEditableListEntry")
|
|
.arg(QT_UTF8(desc));
|
|
.arg(QT_UTF8(desc));
|
|
dialog.setWindowTitle(title);
|
|
dialog.setWindowTitle(title);
|
|
if (dialog.exec() == QDialog::Rejected)
|
|
if (dialog.exec() == QDialog::Rejected)
|
|
@@ -2307,11 +2305,11 @@ void WidgetInfo::EditListAddFiles()
|
|
const char *default_path =
|
|
const char *default_path =
|
|
obs_property_editable_list_default_path(property);
|
|
obs_property_editable_list_default_path(property);
|
|
|
|
|
|
- QString title = QTStr("Basic.PropertiesWindow.AddEditableListFiles")
|
|
|
|
|
|
+ QString title = tr("Basic.PropertiesWindow.AddEditableListFiles")
|
|
.arg(QT_UTF8(desc));
|
|
.arg(QT_UTF8(desc));
|
|
|
|
|
|
- QStringList files = OpenFiles(App()->GetMainWindow(), title,
|
|
|
|
- QT_UTF8(default_path), QT_UTF8(filter));
|
|
|
|
|
|
+ QStringList files =
|
|
|
|
+ OpenFiles(list, title, QT_UTF8(default_path), QT_UTF8(filter));
|
|
#ifdef __APPLE__
|
|
#ifdef __APPLE__
|
|
// TODO: Revisit when QTBUG-42661 is fixed
|
|
// TODO: Revisit when QTBUG-42661 is fixed
|
|
widget->window()->raise();
|
|
widget->window()->raise();
|
|
@@ -2331,11 +2329,10 @@ void WidgetInfo::EditListAddDir()
|
|
const char *default_path =
|
|
const char *default_path =
|
|
obs_property_editable_list_default_path(property);
|
|
obs_property_editable_list_default_path(property);
|
|
|
|
|
|
- QString title = QTStr("Basic.PropertiesWindow.AddEditableListDir")
|
|
|
|
|
|
+ QString title = tr("Basic.PropertiesWindow.AddEditableListDir")
|
|
.arg(QT_UTF8(desc));
|
|
.arg(QT_UTF8(desc));
|
|
|
|
|
|
- QString dir = SelectDirectory(App()->GetMainWindow(), title,
|
|
|
|
- QT_UTF8(default_path));
|
|
|
|
|
|
+ QString dir = SelectDirectory(list, title, QT_UTF8(default_path));
|
|
#ifdef __APPLE__
|
|
#ifdef __APPLE__
|
|
// TODO: Revisit when QTBUG-42661 is fixed
|
|
// TODO: Revisit when QTBUG-42661 is fixed
|
|
widget->window()->raise();
|
|
widget->window()->raise();
|
|
@@ -2377,11 +2374,11 @@ void WidgetInfo::EditListEdit()
|
|
QString path;
|
|
QString path;
|
|
|
|
|
|
if (pathDir.exists())
|
|
if (pathDir.exists())
|
|
- path = SelectDirectory(App()->GetMainWindow(),
|
|
|
|
- QTStr("Browse"), item->text());
|
|
|
|
|
|
+ path = SelectDirectory(list, tr("Browse"),
|
|
|
|
+ item->text());
|
|
else
|
|
else
|
|
- path = OpenFile(App()->GetMainWindow(), QTStr("Browse"),
|
|
|
|
- item->text(), QT_UTF8(filter));
|
|
|
|
|
|
+ path = OpenFile(list, tr("Browse"), item->text(),
|
|
|
|
+ QT_UTF8(filter));
|
|
|
|
|
|
if (path.isEmpty())
|
|
if (path.isEmpty())
|
|
return;
|
|
return;
|
|
@@ -2394,7 +2391,7 @@ void WidgetInfo::EditListEdit()
|
|
EditableItemDialog dialog(widget->window(), item->text(),
|
|
EditableItemDialog dialog(widget->window(), item->text(),
|
|
type != OBS_EDITABLE_LIST_TYPE_STRINGS,
|
|
type != OBS_EDITABLE_LIST_TYPE_STRINGS,
|
|
filter);
|
|
filter);
|
|
- auto title = QTStr("Basic.PropertiesWindow.EditEditableListEntry")
|
|
|
|
|
|
+ auto title = tr("Basic.PropertiesWindow.EditEditableListEntry")
|
|
.arg(QT_UTF8(desc));
|
|
.arg(QT_UTF8(desc));
|
|
dialog.setWindowTitle(title);
|
|
dialog.setWindowTitle(title);
|
|
if (dialog.exec() == QDialog::Rejected)
|
|
if (dialog.exec() == QDialog::Rejected)
|