overview_table.hpp 1.84 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90
#ifndef CVVISUAL_OVERVIEWTABLE_HPP
#define CVVISUAL_OVERVIEWTABLE_HPP

#include <vector>

#include <QWidget>
#include <QList>

#include "overview_panel.hpp"
#include "overview_table_row.hpp"
#include "../stfl/element_group.hpp"
#include "../qtutil/accordion.hpp"
#include "../util/util.hpp"
#include "../controller/view_controller.hpp"
#include "overview_group_subtable.hpp"

namespace cvv
{
namespace gui
{

class OverviewPanel;
class OverviewTableRow;

/**
 * @brief A table displaying the different calls in the overview.
 * It's actually an accordion of subtables to support grouping.
 */
class OverviewTable : public QWidget
{
	Q_OBJECT

      public:
	/**
	 * @brief Constructs a new OverviewTable.
	 * @param controller it's ViewController
	 */
	OverviewTable(util::Reference<controller::ViewController> controller);

	~OverviewTable()
	{
	}

	/**
	 * @brief Update the inherited groups of rows and rebuild the UI fully.
	 * @param newGroups new groups for this table
	 */
	void updateRowGroups(
	    const std::vector<stfl::ElementGroup<OverviewTableRow>> newGroups);

	/**
	 * @brief Hide the thumbnail images in the tables.
	 */
	void hideImages();

	/**
	 * @brief Show thumbnail images in the tables.
	 */
	void showImages();

	/**
	 * @brief Does this the tables show thumbnail images?
	 */
	bool isShowingImages();

	/**
	 * @brief Updates the UI.
	 * Updates all subtables.
	 */
	void updateUI();

	/**
	 * @brief Removes the table element with the given id.
	 * @param id given element id
	 */
	void removeElement(size_t id);

      private:
	util::Reference<controller::ViewController> controller;
	bool doesShowImages = true;
	qtutil::Accordion *subtableAccordion;
	std::vector<OverviewGroupSubtable *> subTables{};
	std::vector<stfl::ElementGroup<OverviewTableRow>> groups;

	void appendRowGroupToTable(stfl::ElementGroup<OverviewTableRow> group);
};
}
}

#endif