mirror of
https://github.com/WarmUpTill/SceneSwitcher.git
synced 2026-09-02 06:36:06 -05:00
add generic PulseWidget function to highlight widgets
This commit is contained in:
@@ -2,8 +2,6 @@
|
||||
#include <QFileDialog>
|
||||
#include <QTextStream>
|
||||
#include <QMessageBox>
|
||||
#include <QPropertyAnimation>
|
||||
#include <QGraphicsColorizeEffect>
|
||||
|
||||
#include "headers/advanced-scene-switcher.hpp"
|
||||
|
||||
@@ -81,52 +79,19 @@ void SceneSwitcher::on_checkInterval_valueChanged(int value)
|
||||
switcher->interval = value;
|
||||
}
|
||||
|
||||
void SceneSwitcher::StartInactivePulse()
|
||||
{
|
||||
ui->pluginRunningText->setStyleSheet("QLabel { \
|
||||
border-style: outset; \
|
||||
border-width: 2px; \
|
||||
border-radius: 10px; \
|
||||
border-color: rgb(0,0,0,0) \
|
||||
}");
|
||||
|
||||
QGraphicsColorizeEffect *eEffect =
|
||||
new QGraphicsColorizeEffect(ui->pluginRunningText);
|
||||
ui->pluginRunningText->setGraphicsEffect(eEffect);
|
||||
QPropertyAnimation *paAnimation =
|
||||
new QPropertyAnimation(eEffect, "color");
|
||||
paAnimation->setStartValue(QColor(0, 0, 0, 0));
|
||||
paAnimation->setEndValue(QColor(Qt::red));
|
||||
paAnimation->setDuration(1000);
|
||||
|
||||
connect(paAnimation, &QPropertyAnimation::finished, [paAnimation]() {
|
||||
if (switcher->stop)
|
||||
QTimer::singleShot(1000, [paAnimation] {
|
||||
paAnimation->start();
|
||||
});
|
||||
});
|
||||
|
||||
paAnimation->start();
|
||||
}
|
||||
|
||||
void SceneSwitcher::ResetInactivePulse()
|
||||
{
|
||||
ui->pluginRunningText->setStyleSheet(
|
||||
"QLabel { background-color: rgb(0,0,0,0); }");
|
||||
}
|
||||
|
||||
void SceneSwitcher::SetStarted()
|
||||
{
|
||||
ui->toggleStartButton->setText("Stop");
|
||||
ui->pluginRunningText->setText("Active");
|
||||
ResetInactivePulse();
|
||||
ui->pluginRunningText->disconnect(inactivePluse);
|
||||
}
|
||||
|
||||
void SceneSwitcher::SetStopped()
|
||||
{
|
||||
ui->toggleStartButton->setText("Start");
|
||||
ui->pluginRunningText->setText("Inactive");
|
||||
StartInactivePulse();
|
||||
inactivePluse = PulseWidget(ui->pluginRunningText, QColor(Qt::red),
|
||||
QColor(0, 0, 0, 0), "QLabel ");
|
||||
}
|
||||
|
||||
void SceneSwitcher::on_toggleStartButton_clicked()
|
||||
|
||||
Reference in New Issue
Block a user