Merge pull request #82 from Socapex/master

Small usability enhancements.
This commit is contained in:
Jim
2014-05-12 13:05:45 -07:00
7 changed files with 59 additions and 14 deletions
+7
View File
@@ -42,10 +42,17 @@ Basic.DisplayCapture="Display Capture"
Basic.Main.AddSceneDlg.Title="Add Scene"
Basic.Main.AddSceneDlg.Text="Please enter the name of the scene"
# add scene suggested name
Basic.Main.DefaultSceneName.Text="Scene %1"
# add source dialog
Basic.SourceSelect.CreateNew="Create new"
Basic.SourceSelect.AddExisting="Add Existing"
# no scene warning
Basic.Main.AddSourceHelp.Title="Cannot Add Source"
Basic.Main.AddSourceHelp.Text="You need to have at least 1 scene to add a source."
# basic mode main window
Basic.Main.Scenes="Scenes"
Basic.Main.Sources="Sources"
+12 -2
View File
@@ -958,10 +958,14 @@ void OBSBasic::on_scenes_customContextMenuRequested(const QPoint &pos)
void OBSBasic::on_actionAddScene_triggered()
{
string name;
QString format{QTStr("Basic.Main.DefaultSceneName.Text")};
QString placeHolderText = format.arg(ui->scenes->count() + 1);
bool accepted = NameDialog::AskForName(this,
QTStr("MainWindow.AddSceneDlg.Title"),
QTStr("MainWindow.AddSceneDlg.Text"),
name);
name,
placeHolderText);
if (accepted) {
if (name.empty()) {
@@ -1045,8 +1049,14 @@ void OBSBasic::AddSourcePopupMenu(const QPoint &pos)
bool foundValues = false;
size_t idx = 0;
if (!GetCurrentScene())
if (!GetCurrentScene()) {
// Tell the user he needs a scene first (help beginners).
QMessageBox::information(this,
QTStr("Basic.Main.AddSourceHelp.Title"),
QTStr("Basic.Main.AddSourceHelp.Text"));
return;
}
QMenu popup;
while (obs_enum_input_types(idx++, &type)) {
+20 -10
View File
@@ -158,6 +158,9 @@ OBSBasicSettings::OBSBasicSettings(QWidget *parent)
HookWidget(ui->fpsNumerator, SCROLL_CHANGED, VIDEO_CHANGED);
HookWidget(ui->fpsDenominator, SCROLL_CHANGED, VIDEO_CHANGED);
//Apply button disabled until change.
EnableApplyButton(false);
LoadServiceTypes();
LoadServiceInfo();
LoadSettings(false);
@@ -664,11 +667,6 @@ void OBSBasicSettings::on_listWidget_itemSelectionChanged()
if (loading || row == pageIndex)
return;
if (Changed() && !QueryChanges()) {
ui->listWidget->setCurrentRow(pageIndex);
return;
}
pageIndex = row;
}
@@ -744,20 +742,26 @@ void OBSBasicSettings::on_baseResolution_editTextChanged(const QString &text)
void OBSBasicSettings::GeneralChanged()
{
if (!loading)
if (!loading) {
generalChanged = true;
EnableApplyButton(true);
}
}
void OBSBasicSettings::OutputsChanged()
{
if (!loading)
if (!loading) {
outputsChanged = true;
EnableApplyButton(true);
}
}
void OBSBasicSettings::AudioChanged()
{
if (!loading)
if (!loading) {
audioChanged = true;
EnableApplyButton(true);
}
}
void OBSBasicSettings::AudioChangedRestart()
@@ -765,6 +769,7 @@ void OBSBasicSettings::AudioChangedRestart()
if (!loading) {
audioChanged = true;
ui->audioMsg->setText(QTStr("Basic.Settings.ProgramRestart"));
EnableApplyButton(true);
}
}
@@ -773,17 +778,22 @@ void OBSBasicSettings::VideoChangedRestart()
if (!loading) {
videoChanged = true;
ui->videoMsg->setText(QTStr("Basic.Settings.ProgramRestart"));
EnableApplyButton(true);
}
}
void OBSBasicSettings::VideoChangedResolution()
{
if (!loading && ValidResolutions(ui.get()))
if (!loading && ValidResolutions(ui.get())) {
videoChanged = true;
EnableApplyButton(true);
}
}
void OBSBasicSettings::VideoChanged()
{
if (!loading)
if (!loading) {
videoChanged = true;
EnableApplyButton(true);
}
}
+6
View File
@@ -53,12 +53,18 @@ private:
audioChanged || videoChanged;
}
inline void EnableApplyButton(bool en)
{
ui->buttonBox->button(QDialogButtonBox::Apply)->setEnabled(en);
}
inline void ClearChanged()
{
generalChanged = false;
outputsChanged = false;
audioChanged = false;
videoChanged = false;
EnableApplyButton(false);
}
void HookWidget(QWidget *widget, const char *signal, const char *slot);
+9
View File
@@ -18,6 +18,7 @@
#include "window-basic-main.hpp"
#include "window-basic-source-select.hpp"
#include "qt-wrappers.hpp"
#include "obs-app.hpp"
bool OBSBasicSourceSelect::EnumSources(void *data, obs_source_t source)
{
@@ -143,5 +144,13 @@ OBSBasicSourceSelect::OBSBasicSourceSelect(OBSBasic *parent, const char *type_)
{
ui->setupUi(this);
const char *placeHolderText = obs_source_getdisplayname(
OBS_SOURCE_TYPE_INPUT,
type_, App()->GetLocale());
ui->sourceName->setText(QT_UTF8(placeHolderText));
ui->sourceName->setFocus(); //Fixes deselect of text.
ui->sourceName->selectAll();
obs_enum_sources(EnumSources, this);
}
+3 -1
View File
@@ -28,11 +28,13 @@ NameDialog::NameDialog(QWidget *parent)
}
bool NameDialog::AskForName(QWidget *parent, const QString &title,
const QString &text, string &str)
const QString &text, string &str, const QString &placeHolder)
{
NameDialog dialog(parent);
dialog.setWindowTitle(title);
dialog.ui->label->setText(text);
dialog.ui->userText->setText(placeHolder);
dialog.ui->userText->selectAll();
bool accepted = (dialog.exec() == DialogCode::Accepted);
if (accepted)
+2 -1
View File
@@ -33,5 +33,6 @@ public:
NameDialog(QWidget *parent);
static bool AskForName(QWidget *parent, const QString &title,
const QString &text, std::string &str);
const QString &text, std::string &str,
const QString &placeHolder = QString(""));
};