New upstream version 25.0.3+dfsg1

This commit is contained in:
Sebastian Ramacher 2020-03-25 09:07:22 +01:00
parent 04fe0efc67
commit 8b2e5f2130
569 changed files with 62491 additions and 5875 deletions

View file

@ -57,6 +57,28 @@ SourceTreeItem::SourceTreeItem(SourceTree *tree_, OBSSceneItem sceneitem_)
obs_data_release(privData);
OBSBasic *main = reinterpret_cast<OBSBasic *>(App()->GetMainWindow());
const char *id = obs_source_get_id(source);
QLabel *iconLabel = nullptr;
if (tree->iconsVisible) {
QIcon icon;
if (strcmp(id, "scene") == 0)
icon = main->GetSceneIcon();
else if (strcmp(id, "group") == 0)
icon = main->GetGroupIcon();
else
icon = main->GetSourceIcon(id);
QPixmap pixmap = icon.pixmap(QSize(16, 16));
iconLabel = new QLabel();
iconLabel->setPixmap(pixmap);
iconLabel->setFixedSize(16, 16);
iconLabel->setStyleSheet("background: none");
}
vis = new VisibilityCheckBox();
vis->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum);
vis->setFixedSize(16, 16);
@ -80,11 +102,15 @@ SourceTreeItem::SourceTreeItem(SourceTree *tree_, OBSSceneItem sceneitem_)
#endif
boxLayout = new QHBoxLayout();
boxLayout->setContentsMargins(1, 1, 1, 1);
boxLayout->setSpacing(1);
boxLayout->setContentsMargins(0, 0, 0, 0);
if (iconLabel) {
boxLayout->addWidget(iconLabel);
boxLayout->addSpacing(2);
}
boxLayout->addWidget(label);
boxLayout->addWidget(vis);
boxLayout->setSpacing(2);
boxLayout->addSpacing(1);
boxLayout->addWidget(lock);
#ifdef __APPLE__
/* Hack: Fixes a bug where scrollbars would be above the lock icon */
@ -292,12 +318,13 @@ bool SourceTreeItem::IsEditing()
void SourceTreeItem::EnterEditMode()
{
setFocusPolicy(Qt::StrongFocus);
int index = boxLayout->indexOf(label);
boxLayout->removeWidget(label);
editor = new QLineEdit(label->text());
editor->setStyleSheet("background: none");
editor->selectAll();
editor->installEventFilter(this);
boxLayout->insertWidget(1, editor);
boxLayout->insertWidget(index, editor);
setFocusProxy(editor);
}
@ -312,11 +339,12 @@ void SourceTreeItem::ExitEditMode(bool save)
std::string newName = QT_TO_UTF8(editor->text());
setFocusProxy(nullptr);
int index = boxLayout->indexOf(editor);
boxLayout->removeWidget(editor);
delete editor;
editor = nullptr;
setFocusPolicy(Qt::NoFocus);
boxLayout->insertWidget(1, label);
boxLayout->insertWidget(index, label);
/* ----------------------------------------- */
/* check for empty string */
@ -943,6 +971,21 @@ SourceTree::SourceTree(QWidget *parent_) : QListView(parent_)
UpdateNoSourcesMessage();
connect(App(), &OBSApp::StyleChanged, this,
&SourceTree::UpdateNoSourcesMessage);
connect(App(), &OBSApp::StyleChanged, this, &SourceTree::UpdateIcons);
}
void SourceTree::UpdateIcons()
{
SourceTreeModel *stm = GetStm();
stm->SceneChanged();
}
void SourceTree::SetIconsVisible(bool visible)
{
SourceTreeModel *stm = GetStm();
iconsVisible = visible;
stm->SceneChanged();
}
void SourceTree::ResetWidgets()