mirror of
https://github.com/WarmUpTill/SceneSwitcher.git
synced 2026-03-31 14:25:40 -05:00
Highlight newly added macro segments
This commit is contained in:
parent
8cfed048cc
commit
ab5bdb32f5
|
|
@ -49,6 +49,8 @@ public:
|
|||
bool addNewMacro(std::string &name);
|
||||
Macro *getSelectedMacro();
|
||||
void SetEditMacro(Macro &m);
|
||||
void HighlightAction(int idx);
|
||||
void HighlightCondition(int idx);
|
||||
void ConnectControlSignals(MacroActionEdit *);
|
||||
void ConnectControlSignals(MacroConditionEdit *);
|
||||
void SwapActions(Macro *m, int pos1, int pos2);
|
||||
|
|
|
|||
|
|
@ -45,9 +45,10 @@ void placeWidgets(std::string text, QBoxLayout *layout,
|
|||
bool addStretch = true);
|
||||
void deleteLayoutItem(QLayoutItem *item);
|
||||
void clearLayout(QLayout *layout);
|
||||
QMetaObject::Connection PulseWidget(QWidget *widget, QColor endColor,
|
||||
QMetaObject::Connection PulseWidget(QWidget *widget, QColor startColor,
|
||||
QColor = QColor(0, 0, 0, 0),
|
||||
QString specifier = "QLabel ");
|
||||
QString specifier = "QLabel ",
|
||||
bool once = false);
|
||||
void listAddClicked(QListWidget *list, QWidget *newWidget,
|
||||
QPushButton *addButton = nullptr,
|
||||
QMetaObject::Connection *addHighlight = nullptr);
|
||||
|
|
|
|||
|
|
@ -158,6 +158,7 @@ void AdvSceneSwitcher::AddMacroAction(int idx)
|
|||
//
|
||||
// If performance should become a concern this has to be revisited.
|
||||
SetEditMacro(*macro);
|
||||
HighlightAction(idx);
|
||||
}
|
||||
|
||||
void AdvSceneSwitcher::on_actionAdd_clicked()
|
||||
|
|
|
|||
|
|
@ -282,6 +282,7 @@ void AdvSceneSwitcher::AddMacroCondition(int idx)
|
|||
//
|
||||
// If performance should become a concern this has to be revisited.
|
||||
SetEditMacro(*macro);
|
||||
HighlightCondition(idx);
|
||||
}
|
||||
|
||||
void AdvSceneSwitcher::on_conditionAdd_clicked()
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
#include "headers/name-dialog.hpp"
|
||||
#include "headers/utility.hpp"
|
||||
|
||||
#include <QColor>
|
||||
#include <QMenu>
|
||||
|
||||
static QMetaObject::Connection addPulse;
|
||||
|
|
@ -207,6 +208,34 @@ void AdvSceneSwitcher::SetEditMacro(Macro &m)
|
|||
}
|
||||
}
|
||||
|
||||
void AdvSceneSwitcher::HighlightAction(int idx)
|
||||
{
|
||||
auto item = ui->macroEditActionLayout->itemAt(idx);
|
||||
if (!item) {
|
||||
return;
|
||||
}
|
||||
auto widget = item->widget();
|
||||
if (!widget) {
|
||||
return;
|
||||
}
|
||||
PulseWidget(widget, QColor(Qt::green), QColor(0, 0, 0, 0), "QLabel ",
|
||||
true);
|
||||
}
|
||||
|
||||
void AdvSceneSwitcher::HighlightCondition(int idx)
|
||||
{
|
||||
auto item = ui->macroEditConditionLayout->itemAt(idx);
|
||||
if (!item) {
|
||||
return;
|
||||
}
|
||||
auto widget = item->widget();
|
||||
if (!widget) {
|
||||
return;
|
||||
}
|
||||
PulseWidget(widget, QColor(Qt::green), QColor(0, 0, 0, 0), "QLabel ",
|
||||
true);
|
||||
}
|
||||
|
||||
void AdvSceneSwitcher::ConnectControlSignals(MacroActionEdit *c)
|
||||
{
|
||||
connect(c, &MacroActionEdit::AddAt, this,
|
||||
|
|
|
|||
|
|
@ -813,8 +813,9 @@ void populateSceneItemSelection(QComboBox *list, SceneSelection &s)
|
|||
list->setCurrentIndex(0);
|
||||
}
|
||||
|
||||
QMetaObject::Connection PulseWidget(QWidget *widget, QColor endColor,
|
||||
QColor startColor, QString specifier)
|
||||
QMetaObject::Connection PulseWidget(QWidget *widget, QColor startColor,
|
||||
QColor endColor, QString specifier,
|
||||
bool once)
|
||||
{
|
||||
widget->setStyleSheet(specifier + "{ \
|
||||
border-style: outset; \
|
||||
|
|
@ -830,15 +831,17 @@ QMetaObject::Connection PulseWidget(QWidget *widget, QColor endColor,
|
|||
paAnimation->setStartValue(startColor);
|
||||
paAnimation->setEndValue(endColor);
|
||||
paAnimation->setDuration(1000);
|
||||
// Play backwards to return to original state on timer end
|
||||
paAnimation->setDirection(QAbstractAnimation::Backward);
|
||||
|
||||
auto con = QWidget::connect(
|
||||
paAnimation, &QPropertyAnimation::finished, [paAnimation]() {
|
||||
QTimer::singleShot(1000, [paAnimation] {
|
||||
paAnimation->start();
|
||||
QMetaObject::Connection con;
|
||||
if (!once) {
|
||||
con = QWidget::connect(
|
||||
paAnimation, &QPropertyAnimation::finished,
|
||||
[paAnimation]() {
|
||||
QTimer::singleShot(1000, [paAnimation] {
|
||||
paAnimation->start();
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
paAnimation->start();
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user