mirror of
https://github.com/WarmUpTill/SceneSwitcher.git
synced 2026-06-14 04:41:46 -05:00
Display next match time if repeat is selected
This commit is contained in:
parent
9105087036
commit
d47b878b56
|
|
@ -270,6 +270,7 @@ AdvSceneSwitcher.condition.date.showSimpleSettings="Show simple settings"
|
|||
AdvSceneSwitcher.condition.date.entry.simple="On {{dayOfWeek}} at {{weekTime}}"
|
||||
AdvSceneSwitcher.condition.date.entry.advanced="{{condition}} {{ignoreDate}}{{date}} {{ignoreTime}}{{time}} {{separator}} {{date2}} {{time2}}"
|
||||
AdvSceneSwitcher.condition.date.entry.repeat="{{repeat}} Repeat every {{duration}} on date match"
|
||||
AdvSceneSwitcher.condition.date.entry.nextMatchDate="Next match at: %1"
|
||||
AdvSceneSwitcher.condition.date.entry.updateOnRepeat="{{updateOnRepeat}} On repeat update selected date to repeat date"
|
||||
AdvSceneSwitcher.condition.sceneTransform="Scene item transform"
|
||||
AdvSceneSwitcher.condition.sceneTransform.getTransform="Get transform"
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
#include <QCheckBox>
|
||||
#include <QDateTimeEdit>
|
||||
#include <QComboBox>
|
||||
#include <QTimer>
|
||||
|
||||
enum class DateCondition {
|
||||
AT,
|
||||
|
|
@ -43,6 +44,7 @@ public:
|
|||
void SetTime2(const QTime &time);
|
||||
QDateTime GetDateTime1();
|
||||
QDateTime GetDateTime2();
|
||||
QDateTime GetNextMatchDateTime();
|
||||
|
||||
DayOfWeekSelection _dayOfWeek = DayOfWeekSelection::ANY;
|
||||
bool _ignoreDate = false;
|
||||
|
|
@ -97,6 +99,7 @@ private slots:
|
|||
void DurationChanged(double seconds);
|
||||
void DurationUnitChanged(DurationUnit unit);
|
||||
void AdvancedSettingsToggleClicked();
|
||||
void ShowNextMatch();
|
||||
signals:
|
||||
void HeaderInfoChanged(const QString &);
|
||||
|
||||
|
|
@ -113,6 +116,7 @@ protected:
|
|||
QCheckBox *_ignoreDate;
|
||||
QCheckBox *_ignoreTime;
|
||||
QCheckBox *_repeat;
|
||||
QLabel *_nextMatchDate;
|
||||
QCheckBox *_updateOnRepeat;
|
||||
DurationSelection *_duration;
|
||||
|
||||
|
|
@ -127,5 +131,6 @@ protected:
|
|||
private:
|
||||
void SetWidgetStatus();
|
||||
void ShowSecondDateSelection(bool visible);
|
||||
QTimer _timer;
|
||||
bool _loading = true;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -211,6 +211,11 @@ QDateTime MacroConditionDate::GetDateTime2()
|
|||
return _updateOnRepeat ? _dateTime2 : _origDateTime2;
|
||||
}
|
||||
|
||||
QDateTime MacroConditionDate::GetNextMatchDateTime()
|
||||
{
|
||||
return _dateTime;
|
||||
}
|
||||
|
||||
static inline void populateDaySelection(QComboBox *list)
|
||||
{
|
||||
for (auto entry : dayOfWeekNames) {
|
||||
|
|
@ -240,6 +245,7 @@ MacroConditionDateEdit::MacroConditionDateEdit(
|
|||
_ignoreDate(new QCheckBox()),
|
||||
_ignoreTime(new QCheckBox()),
|
||||
_repeat(new QCheckBox()),
|
||||
_nextMatchDate(new QLabel()),
|
||||
_updateOnRepeat(new QCheckBox()),
|
||||
_duration(new DurationSelection()),
|
||||
_advancedSettingsTooggle(new QPushButton(obs_module_text(
|
||||
|
|
@ -327,6 +333,7 @@ MacroConditionDateEdit::MacroConditionDateEdit(
|
|||
"AdvSceneSwitcher.condition.date.entry.updateOnRepeat"),
|
||||
_repeatUpdateLayout, widgetPlaceholders);
|
||||
_repeatLayout->addLayout(repeatLayout);
|
||||
_repeatLayout->addWidget(_nextMatchDate);
|
||||
_repeatLayout->addLayout(_repeatUpdateLayout);
|
||||
|
||||
auto *mainLayout = new QVBoxLayout;
|
||||
|
|
@ -339,6 +346,11 @@ MacroConditionDateEdit::MacroConditionDateEdit(
|
|||
mainLayout->addLayout(_advancedToggleLayout);
|
||||
setLayout(mainLayout);
|
||||
|
||||
_timer.setInterval(3000);
|
||||
QWidget::connect(&_timer, SIGNAL(timeout()), this,
|
||||
SLOT(ShowNextMatch()));
|
||||
_timer.start();
|
||||
|
||||
_entryData = entryData;
|
||||
UpdateEntryData();
|
||||
_loading = false;
|
||||
|
|
@ -491,6 +503,18 @@ void MacroConditionDateEdit::AdvancedSettingsToggleClicked()
|
|||
QString::fromStdString(_entryData->GetShortDesc()));
|
||||
}
|
||||
|
||||
void MacroConditionDateEdit::ShowNextMatch()
|
||||
{
|
||||
if (!_entryData || _entryData->_dayOfWeekCheck ||
|
||||
!_entryData->_repeat) {
|
||||
return;
|
||||
}
|
||||
QString format(obs_module_text(
|
||||
"AdvSceneSwitcher.condition.date.entry.nextMatchDate"));
|
||||
_nextMatchDate->setText(
|
||||
format.arg(_entryData->GetNextMatchDateTime().toString()));
|
||||
}
|
||||
|
||||
void MacroConditionDateEdit::UpdateEntryData()
|
||||
{
|
||||
if (!_entryData) {
|
||||
|
|
@ -511,6 +535,7 @@ void MacroConditionDateEdit::UpdateEntryData()
|
|||
_updateOnRepeat->setChecked(_entryData->_updateOnRepeat);
|
||||
_duration->SetDuration(_entryData->_duration);
|
||||
_duration->setDisabled(!_entryData->_repeat);
|
||||
ShowNextMatch();
|
||||
SetWidgetStatus();
|
||||
}
|
||||
|
||||
|
|
@ -523,6 +548,8 @@ void MacroConditionDateEdit::SetWidgetStatus()
|
|||
setLayoutVisible(_simpleLayout, _entryData->_dayOfWeekCheck);
|
||||
setLayoutVisible(_advancedLayout, !_entryData->_dayOfWeekCheck);
|
||||
setLayoutVisible(_repeatLayout, !_entryData->_dayOfWeekCheck);
|
||||
_nextMatchDate->setVisible(!_entryData->_dayOfWeekCheck &&
|
||||
_entryData->_repeat);
|
||||
setLayoutVisible(_repeatUpdateLayout,
|
||||
!_entryData->_dayOfWeekCheck && _entryData->_repeat);
|
||||
if (_entryData->_dayOfWeekCheck) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user