<commit_before>#ifndef SETUP_H
#define SETUP_H

#include "mainwindow.h"
#include <QHBoxLayout>

void MainWindow::setupButtons()
{
    QHBoxLayout * buttons = new QHBoxLayout;
    buttons->addWidget(_prevButton);
    buttons->addWidget(_playButton);
    buttons->addWidget(_nextButton);

    //Setup signals
    connect(_prevButton, SIGNAL(clicked()), this, SLOT(_prevButtonIsPressed()));
    connect(_playButton, SIGNAL(clicked()), this, SLOT(_playButtonIsPressed()));
    connect(_nextButton, SIGNAL(clicked()), this, SLOT(_nextButtonIsPressed()));

    //Setup icons
    _prevButton->setIcon(_prevButtonIcon);
    _prevButton->setIconSize(QSize(_prevButton->height(),_prevButton->height()));

    _playButton->setIcon(_playButtonPlayIcon);
    _playButton->setIconSize(QSize(_playButton->height(),_playButton->height()));

    _nextButton->setIcon(_nextButtonIcon);
    _nextButton->setIconSize(QSize(_nextButton->height(),_nextButton->height()));

    _mainLayout->addLayout(buttons);
}

void MainWindow::setupMenus()
{
    createActions();
    createMenus();
}

void MainWindow::setupMetadataLabel()
{
    QHBoxLayout * metadata = new QHBoxLayout;
    metadata->addWidget(_fileMetadata);
    _mainLayout->addLayout(metadata);
}

void MainWindow::setupProgressBar()
{
    QHBoxLayout * progBar = new QHBoxLayout;
    progBar->addWidget(_progressBar);

    _progressBar->setValue(0);

    _progressBar->setTextVisible(false);

    connect(_currentPlayer, SIGNAL(positionChanged(qint64)), this, SLOT(playbackPositionChanged(qint64)));
    connect(_currentPlayer, SIGNAL(durationChanged(qint64)),this, SLOT(durationHasChanged(qint64)));

    _mainLayout->addLayout(progBar);
}

void MainWindow::setupPlaylistViewConnections(const QListWidget * playlistView)
{
    connect
            (
                playlistView,
                SIGNAL(itemDoubleClicked(QListWidgetItem*)),
                this,
                SLOT(playlistItemHasBeenClicked(QListWidgetItem*))
            );

    connect
            (
                playlistView,
                SIGNAL(itemActivated(QListWidgetItem*)),
                this,
                SLOT(resetPlaylistViewFunctionality(QListWidgetItem*))
            );

    connect
            (
                playlistView,
                SIGNAL(itemClicked(QListWidgetItem*)),
                this,
                SLOT(resetPlaylistViewFunctionality(QListWidgetItem*))
            );

    connect
            (
                playlistView,
                SIGNAL(itemPressed(QListWidgetItem*)),
                this,
                SLOT(resetPlaylistViewFunctionality(QListWidgetItem*))
            );
}

void MainWindow::setupPlaylistTabs()
{
    _playlistViews->push_back(_currentPlaylistView);
    setupPlaylistViewConnections(_playlistViews->at(_playlistViews->count()-1));

    _playlistTabs->addTab(_currentPlaylistView, "Playlist");
    _playlistTabs->setTabsClosable(true);

    connect(_playlistTabs,SIGNAL(tabCloseRequested(int)),this,SLOT(_tabCloseRequested(int)));
    connect(_playlistTabs,SIGNAL(currentChanged(int)),this,SLOT(_currentTabIndexHasChanged(int)));

    _players->push_back(_currentPlayer);
    _currentPlayer->setPlaylist(new QMediaPlaylist);

    _mainLayout->addWidget(_playlistTabs);
}

void MainWindow::setupOptionDash()
{
    QHBoxLayout * optionDash = new QHBoxLayout;
    optionDash->addWidget(_newPlaylistTabButton);
    optionDash->addWidget(_shuffleButton);
    optionDash->addWidget(_loopCheckbox);
    optionDash->addWidget(_volumeLabel);
    optionDash->addWidget(_volumeSlider);

    connect(_newPlaylistTabButton,SIGNAL(clicked()),this,SLOT(_newPlaylistTabButtonIsPressed()));

    connect(_shuffleButton,SIGNAL(clicked()),this,SLOT(_shuffleButtonHasBeenPressed()));

    _loopCheckbox->setText("Loop");
    connect(_loopCheckbox, SIGNAL(stateChanged(int)), this, SLOT(_loopCheckboxStateHasChanged(int)));

    _shuffleButton->setText("Shuffle");

    _volumeLabel->setText(tr("<b>Volume:</b>"));
    _volumeSlider->setRange(0,100);
    _volumeSlider->setSliderPosition(_currentPlayer->volume());
    connect(_volumeSlider,SIGNAL(valueChanged(int)),this,SLOT(_volumeSliderValueChanged()));

    _mainLayout->addLayout(optionDash);
}

void MainWindow::setup()
{
#ifdef __ANDROID__
    qDebug() << "Do Android stuff here!";
#else
    setupMenus();
#endif
    setupPlaylistTabs();
    setupProgressBar();
    setupMetadataLabel();
    setupOptionDash();
    setupButtons();
}

#endif // SETUP_H<commit_msg>Android devices now display buttons at the top of the screen instead of a menu.<commit_after>#ifndef SETUP_H
#define SETUP_H

#include "mainwindow.h"
#include <QHBoxLayout>

void MainWindow::setupButtons()
{
    QHBoxLayout * buttons = new QHBoxLayout;
    buttons->addWidget(_prevButton);
    buttons->addWidget(_playButton);
    buttons->addWidget(_nextButton);

    //Setup signals
    connect(_prevButton, SIGNAL(clicked()), this, SLOT(_prevButtonIsPressed()));
    connect(_playButton, SIGNAL(clicked()), this, SLOT(_playButtonIsPressed()));
    connect(_nextButton, SIGNAL(clicked()), this, SLOT(_nextButtonIsPressed()));

    //Setup icons
    _prevButton->setIcon(_prevButtonIcon);
    _prevButton->setIconSize(QSize(_prevButton->height(),_prevButton->height()));

    _playButton->setIcon(_playButtonPlayIcon);
    _playButton->setIconSize(QSize(_playButton->height(),_playButton->height()));

    _nextButton->setIcon(_nextButtonIcon);
    _nextButton->setIconSize(QSize(_nextButton->height(),_nextButton->height()));

    _mainLayout->addLayout(buttons);
}

void MainWindow::setupMenus()
{
    createActions();
#ifdef __ANDROID__
    QHBoxLayout * androidButtonLayout = new QHBoxLayout(this);

    QPushButton * androidOpenButton = new QPushButton("Open Music", this);
    QPushButton * androidAddButton = new QPushButton("Add Music", this);

    connect(androidOpenButton, SIGNAL(clicked()), this, SLOT(open()));
    connect(androidAddButton, SIGNAL(clicked()), this, SLOT(addMedia()));

    androidButtonLayout->addWidget(androidOpenButton);
    androidButtonLayout->addWidget(androidAddButton);

    _mainLayout->addLayout(androidButtonLayout);
#else
    createMenus();
#endif
}

void MainWindow::setupMetadataLabel()
{
    QHBoxLayout * metadata = new QHBoxLayout;
    metadata->addWidget(_fileMetadata);
    _mainLayout->addLayout(metadata);
}

void MainWindow::setupProgressBar()
{
    QHBoxLayout * progBar = new QHBoxLayout;
    progBar->addWidget(_progressBar);

    _progressBar->setValue(0);

    _progressBar->setTextVisible(false);

    connect(_currentPlayer, SIGNAL(positionChanged(qint64)), this, SLOT(playbackPositionChanged(qint64)));
    connect(_currentPlayer, SIGNAL(durationChanged(qint64)),this, SLOT(durationHasChanged(qint64)));

    _mainLayout->addLayout(progBar);
}

void MainWindow::setupPlaylistViewConnections(const QListWidget * playlistView)
{
    connect
            (
                playlistView,
                SIGNAL(itemDoubleClicked(QListWidgetItem*)),
                this,
                SLOT(playlistItemHasBeenClicked(QListWidgetItem*))
            );

    connect
            (
                playlistView,
                SIGNAL(itemActivated(QListWidgetItem*)),
                this,
                SLOT(resetPlaylistViewFunctionality(QListWidgetItem*))
            );

    connect
            (
                playlistView,
                SIGNAL(itemClicked(QListWidgetItem*)),
                this,
                SLOT(resetPlaylistViewFunctionality(QListWidgetItem*))
            );

    connect
            (
                playlistView,
                SIGNAL(itemPressed(QListWidgetItem*)),
                this,
                SLOT(resetPlaylistViewFunctionality(QListWidgetItem*))
            );
}

void MainWindow::setupPlaylistTabs()
{
    _playlistViews->push_back(_currentPlaylistView);
    setupPlaylistViewConnections(_playlistViews->at(_playlistViews->count()-1));

    _playlistTabs->addTab(_currentPlaylistView, "Playlist");
    _playlistTabs->setTabsClosable(true);

    connect(_playlistTabs,SIGNAL(tabCloseRequested(int)),this,SLOT(_tabCloseRequested(int)));
    connect(_playlistTabs,SIGNAL(currentChanged(int)),this,SLOT(_currentTabIndexHasChanged(int)));

    _players->push_back(_currentPlayer);
    _currentPlayer->setPlaylist(new QMediaPlaylist);

    _mainLayout->addWidget(_playlistTabs);
}

void MainWindow::setupOptionDash()
{
    QHBoxLayout * optionDash = new QHBoxLayout;
    optionDash->addWidget(_newPlaylistTabButton);
    optionDash->addWidget(_shuffleButton);
    optionDash->addWidget(_loopCheckbox);
    optionDash->addWidget(_volumeLabel);
    optionDash->addWidget(_volumeSlider);

    connect(_newPlaylistTabButton,SIGNAL(clicked()),this,SLOT(_newPlaylistTabButtonIsPressed()));

    connect(_shuffleButton,SIGNAL(clicked()),this,SLOT(_shuffleButtonHasBeenPressed()));

    _loopCheckbox->setText("Loop");
    connect(_loopCheckbox, SIGNAL(stateChanged(int)), this, SLOT(_loopCheckboxStateHasChanged(int)));

    _shuffleButton->setText("Shuffle");

    _volumeLabel->setText(tr("<b>Volume:</b>"));
    _volumeSlider->setRange(0,100);
    _volumeSlider->setSliderPosition(_currentPlayer->volume());
    connect(_volumeSlider,SIGNAL(valueChanged(int)),this,SLOT(_volumeSliderValueChanged()));

    _mainLayout->addLayout(optionDash);
}

void MainWindow::setup()
{
    setupMenus();
    setupPlaylistTabs();
    setupProgressBar();
    setupMetadataLabel();
    setupOptionDash();
    setupButtons();
}

#endif // SETUP_H
{'fraction_non_alphanumeric': 0.12473728457335015, 'fraction_numerical': 0.0029424127784783522, 'mean_word_length': 4.211938663745893, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 96, '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': '2284973', 'n_tokens_mistral': 2907, 'n_tokens_neox': 2804, 'n_words': 333}