Files
qt5-legatus-legacy/Lts/Common/LtsTimelineClassic/Item.h
T
2026-08-13 18:33:10 +02:00

180 lines
5.0 KiB
C++
Executable File

/**
* @RDE_HEADER@
* manages & represents a row in view and contains children items & events
* $Id$
* $HeadURL$
* $Author$
* Created by Mike Wille, SLSE, 2014-10-01
*/
#pragma once
#include <LtsTimelineClassic/ltstimelineclassic_export.h>
#include "EventList.h"
#include "PassiveEventContainer.h"
namespace LtsTimelineClassic
{
class Item; // predefine to use Item in itself
using ItemList = QList<Item *>;
/**
* @brief manages & represents a row in view and contains children items & events
* contains a list of events and is used to describe the tree of the treeview
* can be a Player ("BlueRecon 75") or a Group ("Recons")
*/
class LTSTIMELINECLASSIC_EXPORT Item
{
// NOT WORKING! JUST PUTS EGLs ON TOP OF EACH OTHER! const EventGraphicList getEventGraphicsRecursive() const;
public:
// DISALLOW COPY OF ITEM (create a pointer of item instead)
Item(const Item &) = delete;
Item &operator=(const Item &) = delete;
const EventGraphicList getEventGraphics() const; // create active events and group events if they overlap in timeline view old: //void groupEventsRecursive();
/**
* @brief creates this class with a user-readable name
* @param name user-readable name
*/
explicit Item(const QString &name, const QString &identifier = QString());
/**
* @brief ???
*
*/
~Item();
/**
* @brief adds a item to this item (for tree view)
* @param item item to add to this item
*/
void addItem(Item *item);
bool removeEvent(int eventId);
void setEventListChanged();
const QString path() const;
/**
* @brief triggers the timeline (if it has the command to repaint) to redraw this item - must be called when event data is changed from outside (e.g. event data's end time has changed)
*/
//void dataChanged();
/**
* @brief get event pevcon pointer
* @return pevcon pointer of row (/item)
*/
PassiveEventContainer *getPevcon();
const EventGraphicList getCurrentEGLFromPevcon() const; // .. without recreating one or refresh them
/*
* @brief sets pevcon pointer
* @pevcon new pevcon pointer of row (/item)
*
void setPevcon(PassiveEventContainer* pevcon);*/
/**
* @brief sets item pointer
* @parent new item pointer parent
*/
void setParent(Item *parent);
/**
* @brief get event name
* @return event name of row (/item)
*/
const QString &getName() const;
void setName(const QString &name) { m_name = name; }
const QString &getIdentifier() const { return m_identifier; }
/**
* @brief get event children pointer
* @return event children reference of row (/item)
*/
ItemList *getChildren();
/*/** USE GETFULLEVENTLIST(false) INSTEAD !!
* @brief get event list
* @return event list of row (/item)
*/
//EventList getEventList();*/
/**
* @brief get event parent pointer
* @return event parent pointer of row (/item)
*/
Item *getParent() const;
/**
* @brief class which MUST NOT be called by the user
* only allow to be called by addEventToItem !!!
* @param event event to add to this item
*/
void addEvent(Event *event);
/**
* @brief get event list of this item (of ALL event lists of all children if recursive = true)
* @param recursive search recursivly in this item and it's children
* @param get events that are even hidden ones (which are not marked to be shown)
* @return event list with events of all children
*/
EventList getFullEventList(bool recursive = true, bool getHiddenEvents = false) const;
/**
* @brief get item list of all items (of ALL items of all children if recursive = true)
* @param recursive search recursivly in this item and it's children
* @return item list
*/
ItemList getFullItemList(bool recursive = true) const;
/**
* @brief returns the item's children at row x
* @param row children of which row
* @return children of row x
*/
Item *child(int row) const;
/**
* @brief returns the row number of the parent's children list of this item
* @return row number
*/
int indexOfParent() const;
/*
* @brief returns the row count of all this item's children
* @return row count
*
int rowCountOfAllItsChildren() const;*/
/**
* @brief get count of children of this item
* @return children count of this item
*/
int childCount() const;
int visibleChildCount() const;
bool hasVisibleEvents() const;
// OLD!!void groupEvents(bool recursive = true); // group events if they overlap in timeline view
private:
QString m_name; // displayed in the treeview to indicate the player for the user
QString m_identifier;
ItemList *m_children; // list of all children
Item *m_parent; // parent item, 1 level higher
PassiveEventContainer *m_pevcon; // every item has to own a pevcon, because no other class can hold scope on an pevcon !
EventList m_eventList; // lsit of all events of the item
//EventList m_originalEventList;
bool m_eventListChanged; // say that the list has been changed and new event list has to be created when asked
};
}