mirror of
https://github.com/WarmUpTill/SceneSwitcher.git
synced 2026-03-21 17:34:57 -05:00
Collapse time restriction to clock symbol if no restriction is set
This commit is contained in:
parent
38161f63a3
commit
72f67705ed
3
data/res/time.svg
Normal file
3
data/res/time.svg
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" preserveAspectRatio="xMidYMid meet" viewBox="0 0 640 640" width="640" height="640"><defs><path d="M599.62 325.49C599.62 477.26 476.41 600.47 324.64 600.47C172.88 600.47 49.67 477.26 49.67 325.49C49.67 173.73 172.88 50.52 324.64 50.52C476.41 50.52 599.62 173.73 599.62 325.49Z" id="c3Wyq0kfYS"></path><mask id="maskanTyyngos" x="-20.33" y="-19.48" width="689.95" height="689.95" maskUnits="userSpaceOnUse"><rect x="-20.33" y="-19.48" width="689.95" height="689.95" fill="white"></rect><use xlink:href="#c3Wyq0kfYS" opacity="1" fill="black"></use></mask><path d="M334.97 96.07C339.51 96.07 343.2 99.75 343.2 104.3C343.2 151.24 343.2 283.84 343.2 330.78C343.2 335.32 339.51 339 334.97 339C329.2 339 320.09 339 314.31 339C309.77 339 306.09 335.32 306.09 330.78C306.09 283.84 306.09 151.24 306.09 104.3C306.09 99.75 309.77 96.07 314.31 96.07C320.09 96.07 329.2 96.07 334.97 96.07Z" id="fxMeu932c"></path><path d="M471.96 338.21C471.97 341.31 469.46 343.83 466.37 343.84C434.35 343.93 343.92 344.21 311.91 344.31C308.81 344.32 306.3 341.82 306.29 338.72C306.27 332.42 306.23 319.13 306.21 312.83C306.2 309.73 308.7 307.21 311.8 307.2C343.81 307.11 434.24 306.83 466.25 306.73C469.35 306.72 471.87 309.23 471.88 312.32C471.9 318.62 471.94 331.91 471.96 338.21Z" id="h65nGmP2BL"></path></defs><g><g><g><g mask="url(#maskanTyyngos)"><use xlink:href="#c3Wyq0kfYS" opacity="1" fill-opacity="0" stroke="#d2d2d2" stroke-width="70" stroke-opacity="1"></use></g></g><g><use xlink:href="#fxMeu932c" opacity="1" fill="#d2d2d2" fill-opacity="1"></use></g><g><use xlink:href="#h65nGmP2BL" opacity="1" fill="#d2d2d2" fill-opacity="1"></use></g></g></g></svg>
|
||||
|
After Width: | Height: | Size: 1.8 KiB |
|
|
@ -209,21 +209,28 @@ DurationConstraintEdit::DurationConstraintEdit(QWidget *parent)
|
|||
{
|
||||
_condition = new QComboBox(parent);
|
||||
_duration = new DurationSelection(parent);
|
||||
_toggle = new QPushButton(parent);
|
||||
_toggle->setMaximumSize(22, 22);
|
||||
_toggle->setIcon(
|
||||
QIcon(QString::fromStdString(getDataFilePath("res/time.svg"))));
|
||||
populateConditions(_condition);
|
||||
QWidget::connect(_condition, SIGNAL(currentIndexChanged(int)), this,
|
||||
SLOT(_ConditionChanged(int)));
|
||||
|
||||
QObject::connect(_duration, &DurationSelection::DurationChanged, this,
|
||||
&DurationConstraintEdit::DurationChanged);
|
||||
QObject::connect(_duration, &DurationSelection::UnitChanged, this,
|
||||
&DurationConstraintEdit::UnitChanged);
|
||||
QWidget::connect(_toggle, SIGNAL(clicked()), this,
|
||||
SLOT(ToggleClicked()));
|
||||
|
||||
QHBoxLayout *layout = new QHBoxLayout;
|
||||
layout->setContentsMargins(0, 0, 0, 0);
|
||||
layout->setSpacing(11);
|
||||
layout->addWidget(_toggle);
|
||||
layout->addWidget(_condition);
|
||||
layout->addWidget(_duration);
|
||||
setLayout(layout);
|
||||
Collapse(true);
|
||||
}
|
||||
|
||||
void DurationConstraintEdit::SetValue(DurationConstraint &value)
|
||||
|
|
@ -246,6 +253,18 @@ void DurationConstraintEdit::SetDuration(const Duration &d)
|
|||
void DurationConstraintEdit::_ConditionChanged(int value)
|
||||
{
|
||||
auto cond = static_cast<DurationCondition>(value);
|
||||
_duration->setVisible(cond != DurationCondition::NONE);
|
||||
Collapse(cond == DurationCondition::NONE);
|
||||
emit ConditionChanged(cond);
|
||||
}
|
||||
|
||||
void DurationConstraintEdit::ToggleClicked()
|
||||
{
|
||||
Collapse(false);
|
||||
}
|
||||
|
||||
void DurationConstraintEdit::Collapse(bool collapse)
|
||||
{
|
||||
_toggle->setVisible(collapse);
|
||||
_duration->setVisible(!collapse);
|
||||
_condition->setVisible(!collapse);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
#include <QWidget>
|
||||
#include <QDoubleSpinBox>
|
||||
#include <QComboBox>
|
||||
#include <QPushButton>
|
||||
#include <chrono>
|
||||
|
||||
#include "obs-data.h"
|
||||
|
|
@ -94,12 +95,16 @@ public:
|
|||
|
||||
private slots:
|
||||
void _ConditionChanged(int value);
|
||||
void ToggleClicked();
|
||||
signals:
|
||||
void DurationChanged(double value);
|
||||
void UnitChanged(DurationUnit u);
|
||||
void ConditionChanged(DurationCondition value);
|
||||
|
||||
private:
|
||||
void Collapse(bool collapse);
|
||||
|
||||
DurationSelection *_duration;
|
||||
QComboBox *_condition;
|
||||
QPushButton *_toggle;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -10,7 +10,6 @@
|
|||
#include <obs-frontend-api.h>
|
||||
#include <deque>
|
||||
#include <unordered_map>
|
||||
#include <filesystem>
|
||||
#include "scene-group.hpp"
|
||||
|
||||
bool WeakSourceValid(obs_weak_source_t *ws);
|
||||
|
|
@ -23,7 +22,7 @@ OBSWeakSource GetWeakFilterByName(OBSWeakSource source, const char *name);
|
|||
OBSWeakSource GetWeakFilterByQString(OBSWeakSource source, const QString &name);
|
||||
bool compareIgnoringLineEnding(QString &s1, QString &s2);
|
||||
std::string getSourceSettings(OBSWeakSource ws);
|
||||
std::filesystem::path getDataFilePath(const std::string &file);
|
||||
std::string getDataFilePath(const std::string &file);
|
||||
|
||||
/**
|
||||
* Populate layout with labels and widgets based on provided text
|
||||
|
|
|
|||
|
|
@ -218,13 +218,11 @@ std::string getSourceSettings(OBSWeakSource ws)
|
|||
return settings;
|
||||
}
|
||||
|
||||
std::filesystem::path getDataFilePath(const std::string &file)
|
||||
std::string getDataFilePath(const std::string &file)
|
||||
{
|
||||
const char *root_path = obs_get_module_data_path(obs_current_module());
|
||||
if (root_path) {
|
||||
auto ret = std::filesystem::u8path(root_path);
|
||||
ret.append(file.data());
|
||||
return ret;
|
||||
std::string root_path = obs_get_module_data_path(obs_current_module());
|
||||
if (!root_path.empty()) {
|
||||
return root_path + "/" + file;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user