<commit_before>#include "bookmarkitem.h"
#include <opencv2/highgui/highgui.hpp>
#include <QDebug>

/**
 * @brief BookmarkItem::BookmarkItem
 * @param bookmrk Bookmark containing relevant.
 * @param view Parent widget of the bookmark.
 */
QString BookmarkItem::getDescription() const
{
    return QString::fromStdString(bookmark->get_description());
}

BookmarkItem::BookmarkItem(Bookmark* bookmark,int type) : QListWidgetItem(QString::fromStdString(bookmark->get_description()), nullptr, type) {
    QString frame = QString::number(bookmark->get_frame_number());
    QString v_name = QString::fromStdString(bookmark->get_video_project()->get_video()->get_name());
    hover_text = "Source: " + v_name + "\nFrame: " + frame + "\nTime: " + QString::number(bookmark->get_time()) + "\nDescription: ";
    QString description = QString::fromStdString(bookmark->get_description());
    setToolTip(hover_text + description);
    //this->setText(frame + "@" + v_name);
    this->bookmark = bookmark;
}

/**
 * @brief BookmarkItem::~BookmarkItem
 * Destructor, no memory allocated.
 */
BookmarkItem::~BookmarkItem() {
}

/**
 * @brief BookmarkItem::create_thumbnail
 * Creates and adds a thumbnail.
 * @param frame The image for the thumbnail.
 */
void BookmarkItem::set_thumbnail(std::string thum_path) {
    QIcon icon(QString::fromStdString(thum_path));
    setIcon(icon);
}

/**
 * @brief BookmarkItem::copy
 * Returns a new BookmarkItem with the same bookmark pointer
 * @return
 */
BookmarkItem *BookmarkItem::copy() {
    BookmarkItem* new_bm_item = new BookmarkItem(bookmark, 0);
    new_bm_item->setIcon(icon());
    return new_bm_item;
}

/**
 * @brief BookmarkItem::get_bookmark
 * @return Returns the bookmark representation.
 */
Bookmark* BookmarkItem::get_bookmark() {
    return bookmark;
}

/**
 * @brief BookmarkItem::get_frame_number
 * @return Returns the frame number that the bookmark points to.
 */
int BookmarkItem::get_frame_number() {
    return bookmark->get_frame_number();
}

QString BookmarkItem::get_file_path()
{
    return QString::fromStdString(bookmark->m_file);
}

/**
 * @brief Bookmark::update_description
 * Sets the text description of the bookmark to the specified string,
 * and updates the text shown in the widget item.
 * @param text
 */
void BookmarkItem::update_description(const QString& text) {
    this->bookmark->set_description(text.toStdString());
    setToolTip(hover_text + text);
}<commit_msg>set bookmarks text when chaning description<commit_after>#include "bookmarkitem.h"
#include <opencv2/highgui/highgui.hpp>
#include <QDebug>

/**
 * @brief BookmarkItem::BookmarkItem
 * @param bookmrk Bookmark containing relevant.
 * @param view Parent widget of the bookmark.
 */
QString BookmarkItem::getDescription() const
{
    return QString::fromStdString(bookmark->get_description());
}

BookmarkItem::BookmarkItem(Bookmark* bookmark,int type) : QListWidgetItem(QString::fromStdString(bookmark->get_description()), nullptr, type) {
    QString frame = QString::number(bookmark->get_frame_number());
    QString v_name = QString::fromStdString(bookmark->get_video_project()->get_video()->get_name());
    hover_text = "Source: " + v_name + "\nFrame: " + frame + "\nTime: " + QString::number(bookmark->get_time()) + "\nDescription: ";
    QString description = QString::fromStdString(bookmark->get_description());
    setToolTip(hover_text + description);
    //this->setText(frame + "@" + v_name);
    this->bookmark = bookmark;
}

/**
 * @brief BookmarkItem::~BookmarkItem
 * Destructor, no memory allocated.
 */
BookmarkItem::~BookmarkItem() {
}

/**
 * @brief BookmarkItem::create_thumbnail
 * Creates and adds a thumbnail.
 * @param frame The image for the thumbnail.
 */
void BookmarkItem::set_thumbnail(std::string thum_path) {
    QIcon icon(QString::fromStdString(thum_path));
    setIcon(icon);
}

/**
 * @brief BookmarkItem::copy
 * Returns a new BookmarkItem with the same bookmark pointer
 * @return
 */
BookmarkItem *BookmarkItem::copy() {
    BookmarkItem* new_bm_item = new BookmarkItem(bookmark, 0);
    new_bm_item->setIcon(icon());
    return new_bm_item;
}

/**
 * @brief BookmarkItem::get_bookmark
 * @return Returns the bookmark representation.
 */
Bookmark* BookmarkItem::get_bookmark() {
    return bookmark;
}

/**
 * @brief BookmarkItem::get_frame_number
 * @return Returns the frame number that the bookmark points to.
 */
int BookmarkItem::get_frame_number() {
    return bookmark->get_frame_number();
}

QString BookmarkItem::get_file_path()
{
    return QString::fromStdString(bookmark->m_file);
}

/**
 * @brief Bookmark::update_description
 * Sets the text description of the bookmark to the specified string,
 * and updates the text shown in the widget item.
 * @param text
 */
void BookmarkItem::update_description(const QString& text) {
    this->bookmark->set_description(text.toStdString());
    setText(text);
    setToolTip(hover_text + text);
}
{'fraction_non_alphanumeric': 0.13578242338136798, 'fraction_numerical': 0.0008118530545971179, 'mean_word_length': 5.21437578814628, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 37, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4534037', 'n_tokens_mistral': 1533, 'n_tokens_neox': 1538, 'n_words': 336}