overview_table_row.hpp 3.08 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 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143
#ifndef CVVISUAL_OVERVIEWTABLEROW_HPP
#define CVVISUAL_OVERVIEWTABLEROW_HPP

#include <vector>

#include <QTableWidget>
#include <QString>
#include <QPixmap>

#include "../impl/call.hpp"
#include "../util/util.hpp"

namespace cvv
{
namespace gui
{

/**
 * @brief A UI wrapper for an impl::Call, providing utility and UI functions.
 *
 * Also allowing it to add its data to a table.
 */
class OverviewTableRow
{

public:
	/**
	 * @brief Constructor of this class.
	 * @param call call this row is based on
	 */
	OverviewTableRow(util::Reference<const impl::Call> call);

	~OverviewTableRow()
	{
	}

	/**
	 * @brief Adds the inherited data set to the given table.
	 * @param table given table
	 * @param row row index at which the data will be shown
	 * @param showImages does the table show images?
	 * @param maxImages the maximum number of images the table shows
	 * @param imgHeight height of the shown images
	 * @param imgWidth width of the shown images
     */
	void addToTable(QTableWidget *table, size_t row, bool showImages,
	                size_t maxImages, int imgHeight = 100,
	                int imgWidth = 100);
	
	/**
	 * @brief Resizes the images in the given row.
	 * Make sure to call this after (!) you called addToTable() with the
	 * same row parameter on this object some time. 
	 * @param table given table
	 * @param row row index at which the data will be shown
	 * @param showImages does the table show images?
	 * @param maxImages the maximum number of images the table shows
	 * @param imgHeight height of the shown images
	 * @param imgWidth width of the shown images
	 */
	void resizeInTable(QTableWidget *table, size_t row, bool showImages,
				  size_t maxImages, int imgHeight = 100,
                  int imgWidth = 100);
	
	/**
	 * @brief Get the inherited call.
	 * @return the inherited call
	 */
	util::Reference<const impl::Call> call() const
	{
		return call_;
	}

	/**
	 * @brief Returns the description of the inherited call.
	 * @return description of the inherited call.
	 */
	QString description() const
	{
		return description_;
	}

	/**
	 * @brief Returns the id of the inherited call.
	 * @return id of the inherited call.
	 */
	size_t id() const
	{
		return id_;
	}

	/**
	 * @brief Returns the function name property of the inherited call.
	 * @return function name property of the inherited call.
	 */
	QString function() const
	{
		return functionStr;
	}

	/**
	 * @brief Returns the file name of the inherited call.
	 * @return file name of the inherited call.
	 */
	QString file() const
	{
		return fileStr;
	}

	/**
	 * @brief Returns the line property of the inherited call.
	 * @return line property of the inherited call.
	 */
	size_t line() const
	{
		return line_;
	}

	/**
	 * @brief Returns the type of the inherited call.
	 * @return type of the inherited call.
	 */
	QString type() const
	{
		return typeStr;
	}

private:
	util::Reference<const impl::Call> call_;
	size_t id_ = 0;
	size_t line_ = 0;
	QString idStr = "";
	QString description_ = "";
	std::vector<QPixmap> imgs{};
	QString functionStr = "";
	QString fileStr = "";
	QString lineStr = "";
	QString typeStr = "";
};
}
}

#endif