From 641f626593b6007c3be0d935a718387ca181fb89 Mon Sep 17 00:00:00 2001 From: HomeWorld Date: Mon, 16 Feb 2015 19:31:00 +0200 Subject: [PATCH] UI: Display message if no properties available Display "No properties available" text in the property view if there are no properties available. Closes Pull Request #377 --- obs/data/locale/en-US.ini | 1 + obs/properties-view.cpp | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/obs/data/locale/en-US.ini b/obs/data/locale/en-US.ini index 778a0cbf0..228bcc54b 100644 --- a/obs/data/locale/en-US.ini +++ b/obs/data/locale/en-US.ini @@ -118,6 +118,7 @@ Basic.PropertiesWindow.SelectColor="Select color" Basic.PropertiesWindow.SelectFont="Select font" Basic.PropertiesWindow.ConfirmTitle="Settings Changed" Basic.PropertiesWindow.Confirm="There are unsaved changes. Do you want to keep them?" +Basic.PropertiesWindow.NoProperties="No properties available" # interaction window Basic.InteractionWindow="Interacting with '%1'" diff --git a/obs/properties-view.cpp b/obs/properties-view.cpp index 17220763b..db8e74a19 100644 --- a/obs/properties-view.cpp +++ b/obs/properties-view.cpp @@ -53,6 +53,8 @@ void OBSPropertiesView::ReloadProperties() RefreshProperties(); } +#define NO_PROPERTIES_STRING QTStr("Basic.PropertiesWindow.NoProperties") + void OBSPropertiesView::RefreshProperties() { int h, v; @@ -75,6 +77,7 @@ void OBSPropertiesView::RefreshProperties() layout->setLabelAlignment(Qt::AlignRight); obs_property_t *property = obs_properties_first(properties.get()); + bool hasNoProperties = !property; while (property) { AddProperty(property, layout); @@ -91,6 +94,11 @@ void OBSPropertiesView::RefreshProperties() lastWidget->setFocus(Qt::OtherFocusReason); lastWidget = nullptr; } + + if (hasNoProperties) { + QLabel *noPropertiesLabel = new QLabel(NO_PROPERTIES_STRING); + layout->addWidget(noPropertiesLabel); + } } void OBSPropertiesView::SetScrollPos(int h, int v)