<commit_before>#include "musicapplicationobject.h"
#include "musicmobiledeviceswidget.h"
#include "musictimerwidget.h"
#include "musictimerautoobject.h"
#include "musicmessagebox.h"
#include "musicequalizerdialog.h"
#include "musicsettingmanager.h"
#include "musicregeditmanager.h"
#include "musicsourceupdatewidget.h"
#include "musicsoundeffectswidget.h"
#include "musicmessageaboutdialog.h"
#include "musicnumberdefine.h"
#include "musicapplication.h"
#include "musictopareawidget.h"
#include "musicwidgetutils.h"
#include "musicgiflabelwidget.h"

#include "qdevicewatcher.h"

#include <QApplication>
#include <QDesktopWidget>
#include <QPropertyAnimation>

#define MARGIN_SIDE     5
#define MARGIN_SIDE_BY  1

MusicApplicationObject *MusicApplicationObject::m_instance = nullptr;

MusicApplicationObject::MusicApplicationObject(QObject *parent)
    : QObject(parent)
{
    Q_INIT_RESOURCE(MusicPlayer);
    m_instance = this;

    musicResetWindow();

    m_quitAnimation = new QPropertyAnimation(this);
    m_sideAnimation = new QPropertyAnimation(parent, "geometry", this);;
    m_quitAnimation->setTargetObject(parent);
    m_sideAnimation->setDuration(250*MT_MS);

    m_musicTimerAutoObj = new MusicTimerAutoObject(this);
    m_setWindowToTop = false;
    m_mobileDeviceWidget = nullptr;
    m_quitContainer = nullptr;

    m_deviceWatcher = new QDeviceWatcher(this);
    connect(m_deviceWatcher, SIGNAL(deviceChanged(bool)), SLOT(musicDeviceChanged(bool)));
    connect(m_deviceWatcher, SIGNAL(deviceAdded(QString)), SLOT(musicDeviceNameChanged(QString)));
    m_deviceWatcher->appendEventReceiver(this);
    m_deviceWatcher->start();

    musicToolSetsParameter();
}

MusicApplicationObject::~MusicApplicationObject()
{
    Q_CLEANUP_RESOURCE(MusicPlayer);
    delete m_musicTimerAutoObj;
    delete m_quitAnimation;
    delete m_sideAnimation;
    delete m_deviceWatcher;
    delete m_mobileDeviceWidget;
    delete m_quitContainer;
}

QString MusicApplicationObject::getClassName()
{
    return staticMetaObject.className();
}

MusicApplicationObject *MusicApplicationObject::instance()
{
    return m_instance;
}

void MusicApplicationObject::getParameterSetting()
{
#ifdef Q_OS_WIN
    if(M_SETTING_PTR->value(MusicSettingManager::FileAssociationChoiced).toInt())
    {
        MusicRegeditManager regeditManager;
        regeditManager.setMusicRegeditAssociateFileIcon();
    }
#endif
}

void MusicApplicationObject::windowCloseAnimation()
{
    if(M_SETTING_PTR->value(MusicSettingManager::WindowQuitModeChoiced).toBool())
    {
        MusicApplication *w = MusicApplication::instance();
        w->setMinimumSize(0, 0); ///remove fixed size

        m_quitAnimation->stop();
        m_quitAnimation->setPropertyName("geometry");
        m_quitAnimation->setDuration(250*MT_MS);
        m_quitAnimation->setStartValue(w->geometry());
        m_quitAnimation->setEndValue(QRect(w->x(), w->geometry().center().y(), w->width(), 0));<commit_msg>Stop background animation while app closed[245688]<commit_after>#include "musicapplicationobject.h"
#include "musicmobiledeviceswidget.h"
#include "musictimerwidget.h"
#include "musictimerautoobject.h"
#include "musicmessagebox.h"
#include "musicequalizerdialog.h"
#include "musicsettingmanager.h"
#include "musicregeditmanager.h"
#include "musicsourceupdatewidget.h"
#include "musicsoundeffectswidget.h"
#include "musicmessageaboutdialog.h"
#include "musicnumberdefine.h"
#include "musicapplication.h"
#include "musictopareawidget.h"
#include "musicwidgetutils.h"
#include "musicgiflabelwidget.h"

#include "qdevicewatcher.h"

#include <QApplication>
#include <QDesktopWidget>
#include <QPropertyAnimation>

#define MARGIN_SIDE     5
#define MARGIN_SIDE_BY  1

MusicApplicationObject *MusicApplicationObject::m_instance = nullptr;

MusicApplicationObject::MusicApplicationObject(QObject *parent)
    : QObject(parent)
{
    Q_INIT_RESOURCE(MusicPlayer);
    m_instance = this;

    musicResetWindow();

    m_quitAnimation = new QPropertyAnimation(this);
    m_sideAnimation = new QPropertyAnimation(parent, "geometry", this);;
    m_quitAnimation->setTargetObject(parent);
    m_sideAnimation->setDuration(250*MT_MS);

    m_musicTimerAutoObj = new MusicTimerAutoObject(this);
    m_setWindowToTop = false;
    m_mobileDeviceWidget = nullptr;
    m_quitContainer = nullptr;

    m_deviceWatcher = new QDeviceWatcher(this);
    connect(m_deviceWatcher, SIGNAL(deviceChanged(bool)), SLOT(musicDeviceChanged(bool)));
    connect(m_deviceWatcher, SIGNAL(deviceAdded(QString)), SLOT(musicDeviceNameChanged(QString)));
    m_deviceWatcher->appendEventReceiver(this);
    m_deviceWatcher->start();

    musicToolSetsParameter();
}

MusicApplicationObject::~MusicApplicationObject()
{
    Q_CLEANUP_RESOURCE(MusicPlayer);
    delete m_musicTimerAutoObj;
    delete m_quitAnimation;
    delete m_sideAnimation;
    delete m_deviceWatcher;
    delete m_mobileDeviceWidget;
    delete m_quitContainer;
}

QString MusicApplicationObject::getClassName()
{
    return staticMetaObject.className();
}

MusicApplicationObject *MusicApplicationObject::instance()
{
    return m_instance;
}

void MusicApplicationObject::getParameterSetting()
{
#ifdef Q_OS_WIN
    if(M_SETTING_PTR->value(MusicSettingManager::FileAssociationChoiced).toInt())
    {
        MusicRegeditManager regeditManager;
        regeditManager.setMusicRegeditAssociateFileIcon();
    }
#endif
}

void MusicApplicationObject::windowCloseAnimation()
{
    if(M_SETTING_PTR->value(MusicSettingManager::WindowQuitModeChoiced).toBool())
    {
        MusicTopAreaWidget::instance()->setTimerStop();
        MusicApplication *w = MusicApplication::instance();
        w->setMinimumSize(0, 0); ///remove fixed size

        m_quitAnimation->stop();
        m_quitAnimation->setPropertyName("geometry");
        m_quitAnimation->setDuration(250*MT_MS);
        m_quitAnimation->setStartValue(w->geometry());
        m_quitAnimation->setEndValue(QRect(w->x(), w->geometry().center().y(), w->width(), 0));
{'fraction_non_alphanumeric': 0.11166583458146113, 'fraction_numerical': 0.004659677150940256, 'mean_word_length': 5.956018518518518, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 42, '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': '7639555', 'n_tokens_mistral': 1896, 'n_tokens_neox': 1810, 'n_words': 279}