Files
raDIYo/swcontrol.h
2025-08-05 22:36:00 +02:00

67 lines
1.6 KiB
C++

/***************************************************************************
source::worx raDIYo
Copyright © 2020-2022 c.holzheuer
chris@sourceworx.org
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
***************************************************************************/
#ifndef SWCONTROL_H
#define SWCONTROL_H
#include <QSettings>
#include <QWidget>
#include <QPropertyAnimation>
#include <QGraphicsOpacityEffect>
#include <swdialhandler.h>
/**
* @brief Basisklasse für alle 'Controls'. Erbt von QWidget und stellt
* die Basisfunktionalität aller Controls zur Verfügung:
* - Animiertes Ein- und Ausblenden der Benutzeroberfläche
* - Automatischen Laden und Sichern der Nutzerdaten beim Aktivieren und Deaktivieren.
* @see SWClockControl etc.
*/
class SWControl : public QWidget, public SWDialHandler
{
Q_OBJECT
public:
explicit SWControl( QWidget* parent, QSettings* settings );
virtual ~SWControl();
virtual void fadeIn();
virtual void fadeOut();
public slots:
virtual void onShow();
virtual void onHide();
protected:
QSettings& settings();
static const int SWFadingDuration = 650;
QSettings* _settings = nullptr;
QGraphicsOpacityEffect* _effect = nullptr;
QPropertyAnimation* _animFadeIn = nullptr;
QPropertyAnimation* _animFadeOut = nullptr;
};
#endif // SWCONTROL_H