<commit_before>#include "roomslist.h"
#include <QMenu>

RoomsList::RoomsList(QWidget *parent) :
    QListView(parent)
{
    connect(this, SIGNAL(customContextMenuRequested(const QPoint &)),
            this, SLOT(showContextMenu(const QPoint &)));
}

void RoomsList::setWorld(World *world)
{
    this->world = world;
}

void RoomsList::showContextMenu(const QPoint &point)
{
    QMenu *menu = new QMenu;
    menu->addAction(tr("Add a room"), this, SLOT(addRoom()));
    menu->exec(this->mapToGlobal(point));
}

void RoomsList::addRoom()
{
    bool ok = false;
    int suffix_num = 0;
    QString suffix;
    QString name;

    while (!ok)
    {
        suffix.setNum(suffix_num);
        for (int i = 0; i < world->rooms()->count(); i++)
        {
            if (!world->rooms()->at(i)->name().endsWith(suffix))
            {
                name = tr("Room") + " " + suffix;
                ok = true;
            }
        }
        suffix_num++;
    }

    Room *room = new Room(name, world);
    world->rooms()->appendRoom(room);
}<commit_msg>appendRoom() now wants a QString<commit_after>#include "roomslist.h"
#include <QMenu>

RoomsList::RoomsList(QWidget *parent) :
    QListView(parent)
{
    connect(this, SIGNAL(customContextMenuRequested(const QPoint &)),
            this, SLOT(showContextMenu(const QPoint &)));
}

void RoomsList::setWorld(World *world)
{
    this->world = world;
}

void RoomsList::showContextMenu(const QPoint &point)
{
    QMenu *menu = new QMenu;
    menu->addAction(tr("Add a room"), this, SLOT(addRoom()));
    menu->exec(this->mapToGlobal(point));
}

void RoomsList::addRoom()
{
    bool ok = false;
    int suffix_num = 0;
    QString suffix;
    QString name;

    while (!ok)
    {
        suffix.setNum(suffix_num);
        for (int i = 0; i < world->rooms()->count(); i++)
        {
            if (!world->rooms()->at(i)->name().endsWith(suffix))
            {
                name = tr("Room") + " " + suffix;
                ok = true;
            }
        }
        suffix_num++;
    }

    world->rooms()->appendRoom(name);
}
{'fraction_non_alphanumeric': 0.16192771084337348, 'fraction_numerical': 0.0019277108433734939, 'mean_word_length': 2.524617996604414, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 27, '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': '4913274', 'n_tokens_mistral': 698, 'n_tokens_neox': 680, 'n_words': 135}