2024-02-17 22:51:19 +00:00
|
|
|
/*
|
|
|
|
* SPDX-FileCopyrightText: 2014 Hugo Pereira Da Costa <hugo.pereira@free.fr>
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "breezetoolboxengine.h"
|
|
|
|
|
|
|
|
namespace Breeze
|
|
|
|
{
|
|
|
|
//____________________________________________________________
|
|
|
|
bool ToolBoxEngine::registerWidget(QWidget *widget)
|
|
|
|
{
|
|
|
|
if (!widget) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
if (!_data.contains(widget)) {
|
|
|
|
_data.insert(widget, new WidgetStateData(this, widget, duration()), enabled());
|
|
|
|
}
|
|
|
|
|
|
|
|
// connect destruction signal
|
2024-08-09 01:20:25 +00:00
|
|
|
connect(widget, &QObject::destroyed, this, &ToolBoxEngine::unregisterWidget, Qt::UniqueConnection);
|
2024-02-17 22:51:19 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
//____________________________________________________________
|
|
|
|
bool ToolBoxEngine::updateState(const QPaintDevice *object, bool value)
|
|
|
|
{
|
2024-08-09 01:20:25 +00:00
|
|
|
const QPointer<WidgetStateData> data = ToolBoxEngine::data(object);
|
2024-02-17 22:51:19 +00:00
|
|
|
return (data && data.data()->updateState(value));
|
|
|
|
}
|
|
|
|
|
|
|
|
//____________________________________________________________
|
|
|
|
bool ToolBoxEngine::isAnimated(const QPaintDevice *object)
|
|
|
|
{
|
2024-08-09 01:20:25 +00:00
|
|
|
const QPointer<WidgetStateData> data = ToolBoxEngine::data(object);
|
2024-02-17 22:51:19 +00:00
|
|
|
return (data && data.data()->animation() && data.data()->animation().data()->isRunning());
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|