Commitet pa gastar el Cppcheck

This commit is contained in:
2024-10-08 20:32:24 +02:00
parent c00f4326ae
commit 3e3d764b25
12 changed files with 241 additions and 405 deletions

View File

@@ -14,72 +14,45 @@ struct JA_Sound_t;
class Notify
{
private:
enum notification_state_e
enum class NotificationStatus
{
ns_rising,
ns_stay,
ns_vanishing,
ns_finished
RISING,
STAY,
VANISHING,
FINISHED,
};
enum notification_position_e
enum class NotificationPosition
{
upperLeft,
upperCenter,
upperRight,
middleLeft,
middleRight,
bottomLeft,
bottomCenter,
bottomRight
UPPERLEFT,
UPPERCENTER,
UPPERRIGHT,
MIDDLELEFT,
MIDDLERIGHT,
BOTTOMLEFT,
BOTTOMCENTER,
BOTTOMRIGHT,
};
enum notification_shape_t
enum class NotificationShape
{
notification_shape_rounded,
notification_shape_squared,
ROUNDED,
SQUARED,
};
struct notification_t
struct Notification
{
std::unique_ptr<Texture> texture;
std::unique_ptr<Sprite> sprite;
Texture *texture;
Sprite *sprite;
std::string text1;
std::string text2;
int counter;
notification_state_e state;
notification_position_e position;
NotificationStatus status;
NotificationPosition position;
NotificationShape shape;
SDL_Rect rect;
int y;
int travelDist;
notification_shape_t shape;
// Constructor
notification_t(std::unique_ptr<Texture> texture, std::unique_ptr<Sprite> sprite)
: texture(std::move(texture)), sprite(std::move(sprite)) {}
// Constructor de movimiento
notification_t(notification_t &&other) noexcept
: texture(std::move(other.texture)), sprite(std::move(other.sprite))
{
// Mover otros miembros si es necesario
}
// Operador de asignación por movimiento
notification_t &operator=(notification_t &&other) noexcept
{
if (this != &other)
{
texture = std::move(other.texture);
sprite = std::move(other.sprite);
// Mover otros miembros si es necesario
}
return *this;
}
// Deshabilitar el constructor de copia y operador de asignación por copia
notification_t(const notification_t &) = delete;
notification_t &operator=(const notification_t &) = delete;
};
// Objetos y punteros
@@ -89,12 +62,12 @@ private:
std::unique_ptr<Text> text; // Objeto para dibujar texto
// Variables
color_t bgColor; // Color de fondo de las notificaciones
int waitTime; // Tiempo que se ve la notificación
std::vector<notification_t> notifications; // La lista de notificaciones activas
JA_Sound_t *sound; // Sonido a reproducir cuando suena la notificación
bool stack; // Indica si las notificaciones se apilan
bool hasIcons; // Indica si el notificador tiene textura para iconos
color_t bgColor; // Color de fondo de las notificaciones
int waitTime; // Tiempo que se ve la notificación
std::vector<Notification> notifications; // La lista de notificaciones activas
JA_Sound_t *sound; // Sonido a reproducir cuando suena la notificación
bool stack; // Indica si las notificaciones se apilan
bool hasIcons; // Indica si el notificador tiene textura para iconos
// Elimina las notificaciones finalizadas
void clearFinishedNotifications();