<commit_before>//==============================================================================
// File browser widget
//==============================================================================

#include "filebrowserwidget.h"

//==============================================================================

#include <QApplication>
#include <QDesktopServices>
#include <QFileSystemModel>
#include <QHeaderView>
#include <QHelpEvent>
#include <QSettings>
#include <QUrl>

//==============================================================================

namespace OpenCOR {
namespace FileBrowser {

//==============================================================================

FileBrowserModel::FileBrowserModel(QObject *pParent) :
    QFileSystemModel(pParent)
{
    // We want acces to the full file system

    setRootPath("");
}

//==============================================================================

Qt::ItemFlags FileBrowserModel::flags(const QModelIndex &pIndex) const
{
    // Specify the supported features for the current item

    Qt::ItemFlags res = QFileSystemModel::flags(pIndex);

    // Prevent some features for the item in case it's a folder

    if (QFileInfo(filePath(pIndex)).isDir())
        // We don't want a folder to be draggable

        res &= ~Qt::ItemIsDragEnabled;

    // We are all done, so...

    return res;
}

//==============================================================================

static const QString HomeFolder = QDir::homePath();

//==============================================================================

FileBrowserWidget::FileBrowserWidget(const QString &pName, QWidget *pParent) :
    TreeView(pName, this, pParent),
    mNeedDefColWidth(true),
    mInitPathDirs(QStringList()),
    mInitPathDir(QString()),
    mInitPath(QString()),
    mPreviousItems(QStringList()),
    mNextItems(QStringList())
{
    // Create an instance of the file system model that we want to view

    mDataModel = new FileBrowserModel;

    // Set some properties for the file browser widget itself

    setDragDropMode(QAbstractItemView::DragOnly);
    setModel(mDataModel);
    setSortingEnabled(true);

    // Some connections

    connect(selectionModel(), SIGNAL(currentChanged(const QModelIndex &, const QModelIndex &)),
            this, SLOT(itemChanged(const QModelIndex &, const QModelIndex &)));

    connect(mDataModel, SIGNAL(directoryLoaded(const QString &)),<commit_msg>Minor cleaning up (#57).<commit_after>//==============================================================================
// File browser widget
//==============================================================================

#include "filebrowserwidget.h"

//==============================================================================

#include <QApplication>
#include <QDesktopServices>
#include <QFileSystemModel>
#include <QHeaderView>
#include <QHelpEvent>
#include <QSettings>
#include <QUrl>

//==============================================================================

namespace OpenCOR {
namespace FileBrowser {

//==============================================================================

FileBrowserModel::FileBrowserModel(QObject *pParent) :
    QFileSystemModel(pParent)
{
    // We want acces to the full file system

    setRootPath("");
}

//==============================================================================

Qt::ItemFlags FileBrowserModel::flags(const QModelIndex &pIndex) const
{
    // Specify the supported features for the current item

    Qt::ItemFlags res = QFileSystemModel::flags(pIndex);

    // Prevent some features for the item in case it's a folder

    if (QFileInfo(filePath(pIndex)).isDir())
        // We don't want a folder to be draggable

        res &= ~Qt::ItemIsDragEnabled;

    // We are all done, so...

    return res;
}

//==============================================================================

static const QString HomeFolder = QDir::homePath();

//==============================================================================

FileBrowserWidget::FileBrowserWidget(const QString &pName, QWidget *pParent) :
    TreeView(pName, this, pParent),
    mNeedDefColWidth(true),
    mInitPathDirs(QStringList()),
    mInitPathDir(QString()),
    mInitPath(QString()),
    mPreviousItems(QStringList()),
    mNextItems(QStringList())
{
    // Create an instance of the file system model that we want to view

    mDataModel = new FileBrowserModel(this);

    // Set some properties for the file browser widget itself

    setDragDropMode(QAbstractItemView::DragOnly);
    setModel(mDataModel);
    setSortingEnabled(true);

    // Some connections

    connect(selectionModel(), SIGNAL(currentChanged(const QModelIndex &, const QModelIndex &)),
            this, SLOT(itemChanged(const QModelIndex &, const QModelIndex &)));

    connect(mDataModel, SIGNAL(directoryLoaded(const QString &)),
{'fraction_non_alphanumeric': 0.3403301406154473, 'fraction_numerical': 0.0004075810067250866, 'mean_word_length': 5.587919463087248, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, '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': '6344989', 'n_tokens_mistral': 1233, 'n_tokens_neox': 1128, 'n_words': 291}