UI: Run Autoconfig Wizard on New Profile Creation
New profile state is similar to first start: settings are wiped, encoders not setup. It may make sense to show the auto configuration wizard when a new profile is made as well. There is a checkbox option to show the wizard. If a profile is created with the checkbox off, the checkbox will remain defaulted to off next prompt.master
parent
c16517ca83
commit
ade4c4cf49
|
@ -345,7 +345,6 @@ set(obs_UI
|
||||||
forms/source-toolbar/color-source-toolbar.ui
|
forms/source-toolbar/color-source-toolbar.ui
|
||||||
forms/source-toolbar/text-source-toolbar.ui
|
forms/source-toolbar/text-source-toolbar.ui
|
||||||
forms/source-toolbar/media-controls.ui
|
forms/source-toolbar/media-controls.ui
|
||||||
forms/NameDialog.ui
|
|
||||||
forms/AutoConfigStartPage.ui
|
forms/AutoConfigStartPage.ui
|
||||||
forms/AutoConfigVideoPage.ui
|
forms/AutoConfigVideoPage.ui
|
||||||
forms/AutoConfigStreamPage.ui
|
forms/AutoConfigStreamPage.ui
|
||||||
|
|
|
@ -430,6 +430,7 @@ Basic.Main.RenameSceneCollection.Title="Rename Scene Collection"
|
||||||
# add profile dialog
|
# add profile dialog
|
||||||
AddProfile.Title="Add Profile"
|
AddProfile.Title="Add Profile"
|
||||||
AddProfile.Text="Please enter the name of the profile"
|
AddProfile.Text="Please enter the name of the profile"
|
||||||
|
AddProfile.WizardCheckbox="Show auto-configuration wizard"
|
||||||
|
|
||||||
# rename profile dialog
|
# rename profile dialog
|
||||||
RenameProfile.Title="Rename Profile"
|
RenameProfile.Title="Rename Profile"
|
||||||
|
|
|
@ -1,105 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<ui version="4.0">
|
|
||||||
<class>NameDialog</class>
|
|
||||||
<widget class="QDialog" name="NameDialog">
|
|
||||||
<property name="windowModality">
|
|
||||||
<enum>Qt::WindowModal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>0</x>
|
|
||||||
<y>0</y>
|
|
||||||
<width>555</width>
|
|
||||||
<height>102</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<property name="windowTitle">
|
|
||||||
<string notr="true">Dialog</string>
|
|
||||||
</property>
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="label">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string notr="true">TextLabel</string>
|
|
||||||
</property>
|
|
||||||
<property name="wordWrap">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QLineEdit" name="userText">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string notr="true"/>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QDialogButtonBox" name="buttonBox">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Maximum">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="standardButtons">
|
|
||||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
|
||||||
</property>
|
|
||||||
<property name="centerButtons">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
<resources/>
|
|
||||||
<connections>
|
|
||||||
<connection>
|
|
||||||
<sender>buttonBox</sender>
|
|
||||||
<signal>accepted()</signal>
|
|
||||||
<receiver>NameDialog</receiver>
|
|
||||||
<slot>accept()</slot>
|
|
||||||
<hints>
|
|
||||||
<hint type="sourcelabel">
|
|
||||||
<x>257</x>
|
|
||||||
<y>94</y>
|
|
||||||
</hint>
|
|
||||||
<hint type="destinationlabel">
|
|
||||||
<x>157</x>
|
|
||||||
<y>274</y>
|
|
||||||
</hint>
|
|
||||||
</hints>
|
|
||||||
</connection>
|
|
||||||
<connection>
|
|
||||||
<sender>buttonBox</sender>
|
|
||||||
<signal>rejected()</signal>
|
|
||||||
<receiver>NameDialog</receiver>
|
|
||||||
<slot>reject()</slot>
|
|
||||||
<hints>
|
|
||||||
<hint type="sourcelabel">
|
|
||||||
<x>325</x>
|
|
||||||
<y>94</y>
|
|
||||||
</hint>
|
|
||||||
<hint type="destinationlabel">
|
|
||||||
<x>286</x>
|
|
||||||
<y>274</y>
|
|
||||||
</hint>
|
|
||||||
</hints>
|
|
||||||
</connection>
|
|
||||||
</connections>
|
|
||||||
</ui>
|
|
|
@ -1257,6 +1257,8 @@ void OBSApp::AppInit()
|
||||||
Str("Untitled"));
|
Str("Untitled"));
|
||||||
config_set_default_string(globalConfig, "Basic", "SceneCollectionFile",
|
config_set_default_string(globalConfig, "Basic", "SceneCollectionFile",
|
||||||
Str("Untitled"));
|
Str("Untitled"));
|
||||||
|
config_set_default_bool(globalConfig, "Basic", "ConfigOnNewProfile",
|
||||||
|
true);
|
||||||
|
|
||||||
if (!config_has_user_value(globalConfig, "Basic", "Profile")) {
|
if (!config_has_user_value(globalConfig, "Basic", "Profile")) {
|
||||||
config_set_string(globalConfig, "Basic", "Profile",
|
config_set_string(globalConfig, "Basic", "Profile",
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
#include <QVariant>
|
#include <QVariant>
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
#include "window-basic-main.hpp"
|
#include "window-basic-main.hpp"
|
||||||
|
#include "window-basic-auto-config.hpp"
|
||||||
#include "window-namedialog.hpp"
|
#include "window-namedialog.hpp"
|
||||||
#include "qt-wrappers.hpp"
|
#include "qt-wrappers.hpp"
|
||||||
|
|
||||||
|
@ -93,14 +94,25 @@ static bool ProfileExists(const char *findName)
|
||||||
|
|
||||||
static bool GetProfileName(QWidget *parent, std::string &name,
|
static bool GetProfileName(QWidget *parent, std::string &name,
|
||||||
std::string &file, const char *title,
|
std::string &file, const char *title,
|
||||||
const char *text, const char *oldName = nullptr)
|
const char *text, const bool showWizard,
|
||||||
|
bool &wizardChecked, const char *oldName = nullptr)
|
||||||
{
|
{
|
||||||
char path[512];
|
char path[512];
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
bool success = NameDialog::AskForName(parent, title, text, name,
|
bool success = false;
|
||||||
QT_UTF8(oldName));
|
|
||||||
|
if (showWizard) {
|
||||||
|
success = NameDialog::AskForNameWithOption(
|
||||||
|
parent, title, text, name,
|
||||||
|
QTStr("AddProfile.WizardCheckbox"),
|
||||||
|
wizardChecked, QT_UTF8(oldName));
|
||||||
|
} else {
|
||||||
|
success = NameDialog::AskForName(
|
||||||
|
parent, title, text, name, QT_UTF8(oldName));
|
||||||
|
}
|
||||||
|
|
||||||
if (!success) {
|
if (!success) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -193,9 +205,18 @@ bool OBSBasic::AddProfile(bool create_new, const char *title, const char *text,
|
||||||
std::string newPath;
|
std::string newPath;
|
||||||
ConfigFile config;
|
ConfigFile config;
|
||||||
|
|
||||||
if (!GetProfileName(this, newName, newDir, title, text, init_text))
|
bool showWizardChecked = config_get_bool(App()->GlobalConfig(), "Basic",
|
||||||
|
"ConfigOnNewProfile");
|
||||||
|
|
||||||
|
if (!GetProfileName(this, newName, newDir, title, text, create_new,
|
||||||
|
showWizardChecked, init_text))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
if (create_new) {
|
||||||
|
config_set_bool(App()->GlobalConfig(), "Basic",
|
||||||
|
"ConfigOnNewProfile", showWizardChecked);
|
||||||
|
}
|
||||||
|
|
||||||
std::string curDir =
|
std::string curDir =
|
||||||
config_get_string(App()->GlobalConfig(), "Basic", "ProfileDir");
|
config_get_string(App()->GlobalConfig(), "Basic", "ProfileDir");
|
||||||
|
|
||||||
|
@ -258,6 +279,15 @@ bool OBSBasic::AddProfile(bool create_new, const char *title, const char *text,
|
||||||
config_save_safe(App()->GlobalConfig(), "tmp", nullptr);
|
config_save_safe(App()->GlobalConfig(), "tmp", nullptr);
|
||||||
UpdateTitleBar();
|
UpdateTitleBar();
|
||||||
|
|
||||||
|
// Run auto configuration setup wizard when a new profile is made to assist
|
||||||
|
// setting up blank settings
|
||||||
|
if (create_new && showWizardChecked) {
|
||||||
|
AutoConfig wizard(this);
|
||||||
|
wizard.setModal(true);
|
||||||
|
wizard.show();
|
||||||
|
wizard.exec();
|
||||||
|
}
|
||||||
|
|
||||||
if (api) {
|
if (api) {
|
||||||
api->on_event(OBS_FRONTEND_EVENT_PROFILE_LIST_CHANGED);
|
api->on_event(OBS_FRONTEND_EVENT_PROFILE_LIST_CHANGED);
|
||||||
api->on_event(OBS_FRONTEND_EVENT_PROFILE_CHANGED);
|
api->on_event(OBS_FRONTEND_EVENT_PROFILE_CHANGED);
|
||||||
|
|
|
@ -617,37 +617,35 @@ void OBSBasic::RenameTransition()
|
||||||
QTStr("TransitionNameDlg.Text"),
|
QTStr("TransitionNameDlg.Text"),
|
||||||
name, placeHolderText);
|
name, placeHolderText);
|
||||||
|
|
||||||
if (accepted) {
|
if (!accepted)
|
||||||
if (name.empty()) {
|
return;
|
||||||
OBSMessageBox::warning(this,
|
if (name.empty()) {
|
||||||
QTStr("NoNameEntered.Title"),
|
OBSMessageBox::warning(this, QTStr("NoNameEntered.Title"),
|
||||||
QTStr("NoNameEntered.Text"));
|
QTStr("NoNameEntered.Text"));
|
||||||
RenameTransition();
|
RenameTransition();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
source = FindTransition(name.c_str());
|
source = FindTransition(name.c_str());
|
||||||
if (source) {
|
if (source) {
|
||||||
OBSMessageBox::warning(this, QTStr("NameExists.Title"),
|
OBSMessageBox::warning(this, QTStr("NameExists.Title"),
|
||||||
QTStr("NameExists.Text"));
|
QTStr("NameExists.Text"));
|
||||||
|
|
||||||
RenameTransition();
|
RenameTransition();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
obs_source_set_name(transition, name.c_str());
|
obs_source_set_name(transition, name.c_str());
|
||||||
int idx = ui->transitions->findData(variant);
|
int idx = ui->transitions->findData(variant);
|
||||||
if (idx != -1) {
|
if (idx != -1) {
|
||||||
ui->transitions->setItemText(idx,
|
ui->transitions->setItemText(idx, QT_UTF8(name.c_str()));
|
||||||
QT_UTF8(name.c_str()));
|
|
||||||
|
|
||||||
if (api)
|
if (api)
|
||||||
api->on_event(
|
api->on_event(
|
||||||
OBS_FRONTEND_EVENT_TRANSITION_LIST_CHANGED);
|
OBS_FRONTEND_EVENT_TRANSITION_LIST_CHANGED);
|
||||||
|
|
||||||
ClearQuickTransitionWidgets();
|
ClearQuickTransitionWidgets();
|
||||||
RefreshQuickTransitions();
|
RefreshQuickTransitions();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,17 +17,37 @@
|
||||||
|
|
||||||
#include "window-namedialog.hpp"
|
#include "window-namedialog.hpp"
|
||||||
#include "qt-wrappers.hpp"
|
#include "qt-wrappers.hpp"
|
||||||
#include "ui_NameDialog.h"
|
|
||||||
#include "obs-app.hpp"
|
#include "obs-app.hpp"
|
||||||
|
|
||||||
using namespace std;
|
#include <QVBoxLayout>
|
||||||
|
|
||||||
NameDialog::NameDialog(QWidget *parent)
|
NameDialog::NameDialog(QWidget *parent) : QDialog(parent)
|
||||||
: QDialog(parent), ui(new Ui::NameDialog)
|
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
|
||||||
|
|
||||||
installEventFilter(CreateShortcutFilter());
|
installEventFilter(CreateShortcutFilter());
|
||||||
|
setModal(true);
|
||||||
|
setWindowModality(Qt::WindowModality::WindowModal);
|
||||||
|
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
|
||||||
|
setFixedWidth(555);
|
||||||
|
setMinimumHeight(100);
|
||||||
|
QVBoxLayout *layout = new QVBoxLayout;
|
||||||
|
setLayout(layout);
|
||||||
|
|
||||||
|
label = new QLabel(this);
|
||||||
|
layout->addWidget(label);
|
||||||
|
label->setText("Set Text");
|
||||||
|
|
||||||
|
userText = new QLineEdit(this);
|
||||||
|
layout->addWidget(userText);
|
||||||
|
|
||||||
|
checkbox = new QCheckBox(this);
|
||||||
|
layout->addWidget(checkbox);
|
||||||
|
|
||||||
|
QDialogButtonBox *buttonbox = new QDialogButtonBox(
|
||||||
|
QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
|
||||||
|
layout->addWidget(buttonbox);
|
||||||
|
buttonbox->setCenterButtons(true);
|
||||||
|
connect(buttonbox, &QDialogButtonBox::accepted, this, &QDialog::accept);
|
||||||
|
connect(buttonbox, &QDialogButtonBox::rejected, this, &QDialog::reject);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool IsWhitespace(char ch)
|
static bool IsWhitespace(char ch)
|
||||||
|
@ -35,8 +55,16 @@ static bool IsWhitespace(char ch)
|
||||||
return ch == ' ' || ch == '\t';
|
return ch == ' ' || ch == '\t';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void CleanWhitespace(std::string &str)
|
||||||
|
{
|
||||||
|
while (str.size() && IsWhitespace(str.back()))
|
||||||
|
str.erase(str.end() - 1);
|
||||||
|
while (str.size() && IsWhitespace(str.front()))
|
||||||
|
str.erase(str.begin());
|
||||||
|
}
|
||||||
|
|
||||||
bool NameDialog::AskForName(QWidget *parent, const QString &title,
|
bool NameDialog::AskForName(QWidget *parent, const QString &title,
|
||||||
const QString &text, string &str,
|
const QString &text, std::string &userTextInput,
|
||||||
const QString &placeHolder, int maxSize)
|
const QString &placeHolder, int maxSize)
|
||||||
{
|
{
|
||||||
if (maxSize <= 0 || maxSize > 32767)
|
if (maxSize <= 0 || maxSize > 32767)
|
||||||
|
@ -44,22 +72,43 @@ bool NameDialog::AskForName(QWidget *parent, const QString &title,
|
||||||
|
|
||||||
NameDialog dialog(parent);
|
NameDialog dialog(parent);
|
||||||
dialog.setWindowTitle(title);
|
dialog.setWindowTitle(title);
|
||||||
dialog.setWindowFlags(dialog.windowFlags() &
|
|
||||||
~Qt::WindowContextHelpButtonHint);
|
|
||||||
dialog.ui->label->setText(text);
|
|
||||||
dialog.ui->userText->setMaxLength(maxSize);
|
|
||||||
dialog.ui->userText->setText(placeHolder);
|
|
||||||
dialog.ui->userText->selectAll();
|
|
||||||
|
|
||||||
bool accepted = (dialog.exec() == DialogCode::Accepted);
|
dialog.checkbox->setHidden(true);
|
||||||
if (accepted) {
|
dialog.label->setText(text);
|
||||||
str = QT_TO_UTF8(dialog.ui->userText->text());
|
dialog.userText->setMaxLength(maxSize);
|
||||||
|
dialog.userText->setText(placeHolder);
|
||||||
|
dialog.userText->selectAll();
|
||||||
|
|
||||||
while (str.size() && IsWhitespace(str.back()))
|
if (dialog.exec() != DialogCode::Accepted) {
|
||||||
str.erase(str.end() - 1);
|
return false;
|
||||||
while (str.size() && IsWhitespace(str.front()))
|
}
|
||||||
str.erase(str.begin());
|
userTextInput = dialog.userText->text().toUtf8().constData();
|
||||||
|
CleanWhitespace(userTextInput);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool NameDialog::AskForNameWithOption(QWidget *parent, const QString &title,
|
||||||
|
const QString &text,
|
||||||
|
std::string &userTextInput,
|
||||||
|
const QString &optionLabel,
|
||||||
|
bool &optionChecked,
|
||||||
|
const QString &placeHolder)
|
||||||
|
{
|
||||||
|
NameDialog dialog(parent);
|
||||||
|
dialog.setWindowTitle(title);
|
||||||
|
|
||||||
|
dialog.label->setText(text);
|
||||||
|
dialog.userText->setMaxLength(170);
|
||||||
|
dialog.userText->setText(placeHolder);
|
||||||
|
dialog.checkbox->setText(optionLabel);
|
||||||
|
dialog.checkbox->setChecked(optionChecked);
|
||||||
|
|
||||||
|
if (dialog.exec() != DialogCode::Accepted) {
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return accepted;
|
userTextInput = dialog.userText->text().toUtf8().constData();
|
||||||
|
CleanWhitespace(userTextInput);
|
||||||
|
optionChecked = dialog.checkbox->isChecked();
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,22 +18,37 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
|
#include <QLabel>
|
||||||
|
#include <QLineEdit>
|
||||||
|
#include <QCheckBox>
|
||||||
|
#include <QDialogButtonBox>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
#include "ui_NameDialog.h"
|
|
||||||
|
|
||||||
class NameDialog : public QDialog {
|
class NameDialog : public QDialog {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
private:
|
|
||||||
std::unique_ptr<Ui::NameDialog> ui;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
NameDialog(QWidget *parent);
|
NameDialog(QWidget *parent);
|
||||||
|
|
||||||
|
// Returns true if user clicks OK, false otherwise
|
||||||
|
// userTextInput returns string that user typed into dialog
|
||||||
static bool AskForName(QWidget *parent, const QString &title,
|
static bool AskForName(QWidget *parent, const QString &title,
|
||||||
const QString &text, std::string &str,
|
const QString &text, std::string &userTextInput,
|
||||||
const QString &placeHolder = QString(""),
|
const QString &placeHolder = QString(""),
|
||||||
int maxSize = 170);
|
int maxSize = 170);
|
||||||
|
|
||||||
|
// Returns true if user clicks OK, false otherwise
|
||||||
|
// userTextInput returns string that user typed into dialog
|
||||||
|
// userOptionReturn the checkbox was ticked user accepted
|
||||||
|
static bool
|
||||||
|
AskForNameWithOption(QWidget *parent, const QString &title,
|
||||||
|
const QString &text, std::string &userTextInput,
|
||||||
|
const QString &optionLabel, bool &optionChecked,
|
||||||
|
const QString &placeHolder = QString(""));
|
||||||
|
|
||||||
|
private:
|
||||||
|
QLabel *label;
|
||||||
|
QLineEdit *userText;
|
||||||
|
QCheckBox *checkbox;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue