<commit_before>#include "application.h"

#include <QtQml>
#include <QScreen>
#include <QKeyEvent>
#include <QQuickView>
#include <QStandardPaths>
#include <QDebug>
#include <QDir>

#include "quick/quicktrackinfo.h"
#include "quick/quicksearch.h"
#include "imageprovider.h"

#include "models/albumlistmodel.h"
#include "models/albumbrowsemodel.h"

#include "quick/enums.h"
#include "quick/models.h"

#include "../appkey.c"

namespace sp = Spotinetta;

namespace Sonetta {

Application::Application(int &argc, char **argv)
    :   QGuiApplication(argc, argv), m_view(nullptr), m_nav(0), m_exiting(false)
{
    m_output = new AudioOutput(this);

    sp::SessionConfig config;
    config.applicationKey = sp::ApplicationKey(g_appkey, g_appkey_size);
    config.userAgent = "Sonetta";
    config.audioOutput = m_output;

    config.settingsLocation = QStandardPaths::writableLocation(QStandardPaths::ConfigLocation) + "/libspotify";
    config.cacheLocation = QStandardPaths::writableLocation(QStandardPaths::CacheLocation) + "/libspotify";

    // Create directories if they don't exist
    QDir dir;
    dir.mkpath(config.settingsLocation);
    dir.mkpath(config.cacheLocation);

    m_session = new sp::Session(config, this);
    m_player = new Player(m_session, m_output, this);
    m_ui = new UIStateCoordinator(this);
    m_search = new SearchEngine(m_session, this);

    // Parent output to session so that Session is destroyed before output
    m_output->setParent(m_output);

    connect(m_session, &sp::Session::loggedOut, this, &Application::onLogout);
    connect(m_session, &sp::Session::log, [] (const QString &msg) { qDebug() << msg; });
}

Application::~Application()
{
    delete m_view;
}
<commit_msg>Added notification about a memory leak that needs to bef ixed at some point<commit_after>#include "application.h"

#include <QtQml>
#include <QScreen>
#include <QKeyEvent>
#include <QQuickView>
#include <QStandardPaths>
#include <QDebug>
#include <QDir>

#include "quick/quicktrackinfo.h"
#include "quick/quicksearch.h"
#include "imageprovider.h"

#include "models/albumlistmodel.h"
#include "models/albumbrowsemodel.h"

#include "quick/enums.h"
#include "quick/models.h"

#include "../appkey.c"

namespace sp = Spotinetta;

namespace Sonetta {

Application::Application(int &argc, char **argv)
    :   QGuiApplication(argc, argv), m_view(nullptr), m_nav(0), m_exiting(false)
{
    m_output = new AudioOutput(this);

    sp::SessionConfig config;
    config.applicationKey = sp::ApplicationKey(g_appkey, g_appkey_size);
    config.userAgent = "Sonetta";
    config.audioOutput = m_output;

    config.settingsLocation = QStandardPaths::writableLocation(QStandardPaths::ConfigLocation) + "/libspotify";
    config.cacheLocation = QStandardPaths::writableLocation(QStandardPaths::CacheLocation) + "/libspotify";

    // Create directories if they don't exist
    QDir dir;
    dir.mkpath(config.settingsLocation);
    dir.mkpath(config.cacheLocation);

    m_session = new sp::Session(config, this);
    m_player = new Player(m_session, m_output, this);
    m_ui = new UIStateCoordinator(this);
    m_search = new SearchEngine(m_session, this);

    // Parent output to session so that Session is destroyed before output
    // THIS IS A BUG. It will leak, but it doesn't crash. Will rewrite session to take
    // a shared pointer to audio output interface anyway
    m_output->setParent(m_output);

    connect(m_session, &sp::Session::loggedOut, this, &Application::onLogout);
    connect(m_session, &sp::Session::log, [] (const QString &msg) { qDebug() << msg; });
}

Application::~Application()
{
    delete m_view;
}

{'fraction_non_alphanumeric': 0.12926292629262925, 'fraction_numerical': 0.00055005500550055, 'mean_word_length': 5.0016501650165015, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 19, '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': '4511451', 'n_tokens_mistral': 1177, 'n_tokens_neox': 1163, 'n_words': 269}