Highlight recently executed action and true conditions

This commit is contained in:
WarmUpTill
2022-03-06 19:57:23 +01:00
committed by WarmUpTill
parent 001d8b4714
commit 428e114a0a
7 changed files with 93 additions and 11 deletions

View File

@@ -2,6 +2,7 @@
#include <QWidget>
#include <QFrame>
#include <QVBoxLayout>
#include <QTimer>
#include <obs.hpp>
class Macro;
@@ -18,10 +19,14 @@ public:
virtual bool Load(obs_data_t *obj) = 0;
virtual std::string GetShortDesc();
virtual std::string GetId() = 0;
void SetHighlight();
bool Highlight();
protected:
int _idx = 0;
bool _collapsed = false;
// UI helper
bool _highlight = false;
private:
Macro *_macro = nullptr;
@@ -34,7 +39,7 @@ class MacroSegmentEdit : public QWidget {
Q_OBJECT
public:
MacroSegmentEdit(QWidget *parent = nullptr);
MacroSegmentEdit(bool highlight, QWidget *parent = nullptr);
// Use this function to avoid accidental edits when scrolling through
// list of actions and conditions
void SetFocusPolicyOfWidgets();
@@ -44,6 +49,8 @@ public:
protected slots:
void HeaderInfoChanged(const QString &);
void Collapsed(bool);
void Highlight();
void EnableHighlight(bool);
signals:
void MacroAdded(const QString &name);
void MacroRemoved(const QString &name);
@@ -59,10 +66,13 @@ protected:
Section *_section;
QLabel *_headerInfo;
QFrame *_frame;
QVBoxLayout *_highLightFrameLayout;
QVBoxLayout *_selectionFrameLayout;
private:
virtual MacroSegment *Data() = 0;
bool _showHighlight;
QTimer _timer;
};
class MouseWheelWidgetAdjustmentGuard : public QObject {

View File

@@ -110,6 +110,7 @@ public:
// UI helpers for the macro tab
bool WasExecutedRecently();
void ResetUIHelpers();
private:
void SetupHotkeys();