Ejemplo n.º 1
0
KNMusicMainPlayerContent::KNMusicMainPlayerContent(QWidget *parent) :
    QWidget(parent),
    m_singleIn(generateAnime()),
    m_singleOut(generateAnime()),
    m_doublePlaylist(generateAnime()),
    m_singleAnime(new QParallelAnimationGroup(this)),
    m_singleSwitcher(new KNMusicMainPlayerContentSwitcher(this)),
    m_columnCount(1),
    m_currentIndex(-1),
    m_movingPrevious(false)
{
    //Clear up the widget pointer array.
    m_columnWidgets[0]=nullptr;
    m_columnWidgets[1]=nullptr;
    m_columnWidgets[2]=nullptr;
    //Add animations to anime group.
    m_singleAnime->addAnimation(m_singleIn);
    m_singleAnime->addAnimation(m_singleOut);
    //Link the contect switcher to the content widget.
    connect(m_singleSwitcher, &KNMusicMainPlayerContentSwitcher::requireNext,
            this, &KNMusicMainPlayerContent::onActionSingleToNext);
    connect(m_singleSwitcher,
            &KNMusicMainPlayerContentSwitcher::requirePrevious,
            this, &KNMusicMainPlayerContent::onActionSingleToPrevious);
    connect(m_singleAnime, &QParallelAnimationGroup::finished,
            this, &KNMusicMainPlayerContent::onActionSingleFinished);
}
Ejemplo n.º 2
0
KNMainWindowContainer::KNMainWindowContainer(QWidget *parent) :
    QWidget(parent),
    m_preferenceAnimeGroup(new QParallelAnimationGroup(this)),
    m_mainPlayerAnimeGroup(new QParallelAnimationGroup(this)),
    m_preferenceOpacity(generateAnime("opacity")),
    m_preferenceOpacityEffect(new QGraphicsOpacityEffect(this)),
    m_headerHeight(-1)
{
    //Set properties.
    setContentsMargins(0,0,0,0);
    //Reset the widgets pointer, initial the animation.
    QByteArray propertyList[ContainerAnimeCount];
    propertyList[AnimeHeader]="pos";
    propertyList[AnimeMainWidget]="pos";
    propertyList[AnimeMainPlayerHeader]="pos";
    propertyList[AnimeMainPlayer]="pos";
    propertyList[AnimePreferencePanel]="geometry";
    for(int i=0; i<ContainerWidgetCount; ++i)
    {
        //Reset the pointer.
        m_elementWidget[i]=nullptr;
    }

    //Initial the preference animations.
    for(int i=0; i<ContainerAnimeCount; ++i)
    {
        //Initial the animation.
        m_elementAnime[i]=generateAnime(propertyList[i]);
    }
    //Add animations to preference anime group.
    m_preferenceAnimeGroup->addAnimation(m_elementAnime[AnimeHeader]);
    m_preferenceAnimeGroup->addAnimation(m_elementAnime[AnimeMainWidget]);
    m_preferenceAnimeGroup->addAnimation(m_elementAnime[AnimePreferencePanel]);
    //Add opacity animation to anime group.
    m_preferenceAnimeGroup->addAnimation(m_preferenceOpacity);
    //Configure the opacity animation.
    m_preferenceOpacity->setTargetObject(m_preferenceOpacityEffect);
    //Configure the default effect.
    m_preferenceOpacityEffect->setOpacity(0.0);

    //Add animations to main player anime group.
    m_mainPlayerAnimeGroup->addAnimation(m_elementAnime[AnimeMainPlayer]);
    m_mainPlayerAnimeGroup->addAnimation(m_elementAnime[AnimeMainPlayerHeader]);
}
Ejemplo n.º 3
0
KNMusicAlbumDetail::KNMusicAlbumDetail(QWidget *parent, KNMusicTab *tab) :
    QWidget(parent),
    m_currentIndex(QModelIndex()),
    m_inCurve(QEasingCurve(QEasingCurve::OutCubic)),
    m_animeStartRect(QRect()),
    m_albumContent(new KNMouseUnclickableWidget(this)),
    m_albumArt(new KNMusicAlbumTitle(this)),
    m_rightShadow(new KNSideShadowWidget(KNSideShadowWidget::RightShadow,
                                         this)),
    m_leftShadow(new KNSideShadowWidget(KNSideShadowWidget::LeftShadow,
                                        this)),
    m_albumTitle(new KNScrollLabel(this)),
    m_albumDetails(new KNScrollLabel(this)),
    m_albumListView(new KNMusicAlbumListView(this, tab)),
    m_libraryModel(nullptr),
    m_expandAnime(new QSequentialAnimationGroup(this)),
    m_expandStep1(new QParallelAnimationGroup(this)),
    m_expandStep2(new QParallelAnimationGroup(this)),
    m_foldAnime(new QParallelAnimationGroup(this)),
    m_showAlbumArt(new QParallelAnimationGroup(this)),
    m_hideAlbumArt(new QParallelAnimationGroup(this)),
    m_flyAwayAnime(new QParallelAnimationGroup(this)),
    m_albumArtIn1(generateAnime(m_albumArt)),
    m_albumContentIn1(generateAnime(m_albumContent)),
    m_albumArtIn2(generateAnime(m_albumArt)),
    m_albumContentIn2(generateAnime(m_albumContent)),
    m_albumArtOut(generateAnime(m_albumArt)),
    m_albumContentOut(generateAnime(m_albumContent)),
    m_albumArtFlyAway(generateAnime(m_albumArt)),
    m_albumContentFlyAway(generateAnime(m_albumContent)),
    m_showAlbumArtLabel(generateAnime(m_albumArt)),
    m_showAlbumContent(generateAnime(m_albumContent)),
    m_hideAlbumArtLabel(generateAnime(m_albumArt)),
    m_hideAlbumContent(generateAnime(m_albumContent)),
    m_iconSize(0),
    m_panelSize(0),
    m_backgroundAnime(true),
    m_pressed(false)
{
    //Set properties.
    setAutoFillBackground(true);
    setFocusPolicy(Qt::WheelFocus);
    //Set the background color.
    QPalette pal=palette();
    pal.setColor(QPalette::Base, QColor(0,0,0,0));
    pal.setColor(QPalette::Window, QColor(0,0,0,0));
    setPalette(pal);

    //Configure the album content.
    m_albumContent->setAutoFillBackground(true);
    m_albumContent->setFocusPolicy(Qt::StrongFocus);
    QPalette contentPalette=m_albumContent->palette();
    contentPalette.setColor(QPalette::Window, QColor(255,255,255,240));
    m_albumContent->setPalette(contentPalette);
    //Configure the album title label.
    m_albumTitle->setObjectName("MusicAlbumTitleLabel");
    m_albumTitle->setGlowRadius(4.0);
    knTheme->registerWidget(m_albumTitle);
    // Set the font.
    QFont captionFont=m_albumTitle->font();
    captionFont.setBold(true);
    captionFont.setPixelSize(21);
    m_albumTitle->setFont(captionFont);
    //Configure the album artist label.
    m_albumDetails->setObjectName("MusicAlbumDetailLabel");
    m_albumDetails->setGlowRadius(4.0);
    knTheme->registerWidget(m_albumDetails);
    //Link signals.
    connect(m_expandAnime, &QSequentialAnimationGroup::finished,
            this, &KNMusicAlbumDetail::onActionExpandFinished);
    connect(m_albumContentIn1, &QPropertyAnimation::valueChanged,
            this, &KNMusicAlbumDetail::onActionExpandStep1);
    connect(m_expandStep1, &QParallelAnimationGroup::finished,
            this, &KNMusicAlbumDetail::onActionExpandStep1InFinished);
    connect(m_albumContentIn2, &QPropertyAnimation::valueChanged,
            this, &KNMusicAlbumDetail::onActionContentMove);
    connect(m_foldAnime, &QParallelAnimationGroup::finished,
            this, &KNMusicAlbumDetail::onActionFoldFinished);
    connect(m_albumArtOut, &QPropertyAnimation::valueChanged,
            this, &KNMusicAlbumDetail::onActionFold);
    connect(m_flyAwayAnime, &QParallelAnimationGroup::finished,
            this, &KNMusicAlbumDetail::onActionFlyAwayFinished);
    connect(m_albumArtFlyAway, &QPropertyAnimation::valueChanged,
            this, &KNMusicAlbumDetail::onActionFlyAway);
    connect(m_showAlbumContent, &QPropertyAnimation::valueChanged,
            this, &KNMusicAlbumDetail::onActionContentMove);
    connect(m_hideAlbumContent, &QPropertyAnimation::valueChanged,
            this, &KNMusicAlbumDetail::onActionContentMove);
    //Configure the animation groups.
    m_expandStep1->addAnimation(m_albumArtIn1);
    m_expandStep1->addAnimation(m_albumContentIn1);
    m_expandAnime->addAnimation(m_expandStep1);
    m_expandStep2->addAnimation(m_albumArtIn2);
    m_expandStep2->addAnimation(m_albumContentIn2);
    m_expandAnime->addAnimation(m_expandStep2);
    m_foldAnime->addAnimation(m_albumArtOut);
    m_foldAnime->addAnimation(m_albumContentOut);
    m_flyAwayAnime->addAnimation(m_albumArtFlyAway);
    m_flyAwayAnime->addAnimation(m_albumContentFlyAway);
    m_showAlbumArt->addAnimation(m_showAlbumArtLabel);
    m_showAlbumArt->addAnimation(m_showAlbumContent);
    m_hideAlbumArt->addAnimation(m_hideAlbumArtLabel);
    m_hideAlbumArt->addAnimation(m_hideAlbumContent);

    //Initial the content layout for album content.
    QBoxLayout *contentLayout=new QBoxLayout(QBoxLayout::TopToBottom,
                                             m_albumContent);
    contentLayout->setContentsMargins(0,0,0,0);
    contentLayout->setSpacing(0);
    m_albumContent->setLayout(contentLayout);
    //Initial the caption layout for the title and detail label.
    QBoxLayout *captionLayout=new QBoxLayout(QBoxLayout::TopToBottom,
                                             contentLayout->widget());
    captionLayout->setContentsMargins(21,21,21,14);
    captionLayout->setSpacing(0);
    contentLayout->addLayout(captionLayout);
    //Add widget to caption layout.
    captionLayout->addWidget(m_albumTitle);
    captionLayout->addWidget(m_albumDetails);
    //Add the tree view to content layout.
    contentLayout->addWidget(m_albumListView, 1);
}
Ejemplo n.º 4
0
KNMusicHeaderPlayer::KNMusicHeaderPlayer(QWidget *parent) :
    KNMusicHeaderPlayerBase(parent),
    m_headerLyrics(new KNMusicScrollLyrics(this)),
    m_previous(generateControlButton(
                   ":/plugin/music/player/previous_light.png")),
    m_playNPause(generateControlButton(":/plugin/music/player/play_light.png")),
    m_next(generateControlButton(":/plugin/music/player/next_light.png")),
    m_showMainPlayer(generateAppendButton(
                         ":/plugin/music/player/fullscreen.png")),
    m_showAppendMenu(generateAppendButton(
                         ":/plugin/music/player/menu.png")),
    m_albumArt(new KNHighLightLabel(this)),
    m_title(new KNScrollLabel(this)),
    m_artistAlbum(new KNScrollLabel(this)),
    m_progressSlider(new KNProgressSlider(this)),
    m_volumeSlider(new KNVolumeSlider(this)),
    m_duration(new QLabel(this)),
    m_position(new KNEditableLabel(this)),
    m_loopState(new KNOpacityButton(this)),
    m_volumeIndicator(new KNOpacityButton(this)),
    m_controlPanel(new QWidget(this)),
    m_volumePanel(new QWidget(this)),
    m_appendPanel(new QWidget(this)),
    m_appendMenu(new KNSaoSubMenu(m_showAppendMenu)),
    m_actionTrigger(new QSignalMapper(this)),
    m_informationEffect(new QGraphicsOpacityEffect(this)),
    m_iconPlay(QIcon(":/plugin/music/player/play_light.png")),
    m_iconPause(QIcon(":/plugin/music/player/pause_light.png")),
    m_mouseIn(new QParallelAnimationGroup(this)),
    m_mouseOut(new QParallelAnimationGroup(this)),
    m_showControl(generateAnime(m_controlPanel)),
    m_hideControl(generateAnime(m_controlPanel)),
    m_showVolume(generateAnime(m_volumePanel)),
    m_hideVolume(generateAnime(m_volumePanel)),
    m_showAppend(generateAnime(m_appendPanel)),
    m_hideAppend(generateAnime(m_appendPanel)),
    m_backend(nullptr),
    m_nowPlaying(nullptr),
    m_cacheConfigure(
        knGlobal->cacheConfigure()->getConfigure("MusicHeaderPlayer")),
    m_musicConfigure(
        knMusicGlobal->configure()->getConfigure("MusicHeaderPlayer")),
    m_appendMenuShown(false),
    m_progressPressed(false)
{
    //Set properties.
    setContentsMargins(0, 0, 0, 0);
    setFixedSize(302, 66);

    //Initial the image sources.
    //--Loop State--
    m_iconLoopState[NoRepeat]=QIcon(":/plugin/music/player/NoRepeat.png");
    m_iconLoopState[RepeatAll]=QIcon(":/plugin/music/player/Repeat.png");
    m_iconLoopState[RepeatTrack]=
            QIcon(":/plugin/music/player/RepeatSingle.png");
    m_iconLoopState[Shuffle]=QIcon(":/plugin/music/player/Random.png");
    //--Mute State--
    m_iconMute[false]=QIcon(":/plugin/music/player/mute_false.png");
    m_iconMute[true]=QIcon(":/plugin/music/player/mute_true.png");
    //Initial the UI elements.
    //--Graphics Effect--
    //Configure opacity effect.
    m_informationEffect->setOpacity(1.0);
    // Album Art Label;
    m_albumArt->setFixedSize(AlbumArtSize, AlbumArtSize);
    m_albumArt->move(13, 4);
    m_albumArt->setGraphicsEffect(m_informationEffect);

    //--Title Label--
    QFont labelFont=m_title->font();
    labelFont.setPixelSize(13);
    m_title->setObjectName("HeaderPlayerLabel");
    knTheme->registerWidget(m_title);
    m_title->setFont(labelFont);
    m_title->setGeometry(80, 5, 215, m_title->sizeHint().height());
    //Generate the glow effect for title text.
    KNGraphicsGlowEffect *glowEffect=new KNGraphicsGlowEffect(this);
    glowEffect->setColor(QColor(0,0,0));
    glowEffect->setRadius(GlowRadius);
    m_title->setGraphicsEffect(glowEffect);

    //--Artist - Album Label--
    m_artistAlbum->setObjectName("HeaderPlayerLabel");
    knTheme->registerWidget(m_artistAlbum);
    m_artistAlbum->setFont(labelFont);
    m_artistAlbum->setGeometry(80, 25, 215, m_artistAlbum->sizeHint().height());
    //Generate the glow effect for artist and album text.
    glowEffect=new KNGraphicsGlowEffect(this);
    glowEffect->setColor(QColor(0,0,0));
    glowEffect->setRadius(GlowRadius);
    m_artistAlbum->setGraphicsEffect(glowEffect);

    //Append panel.
    //Initial layout of the append panel.
    QBoxLayout *appendLayout=new QBoxLayout(QBoxLayout::LeftToRight,
                                            m_appendPanel);
    appendLayout->setContentsMargins(0,0,0,0);
    appendLayout->setSpacing(9);
    m_appendPanel->setLayout(appendLayout);
    appendLayout->addStretch();
    //Configure the main player button.
    connect(m_showMainPlayer, &KNOpacityButton::clicked,
            this, &KNMusicHeaderPlayer::requireShowMainPlayer);
    //Add to append panel.
    appendLayout->addWidget(m_showMainPlayer);
    //Configure the append menu button.
    connect(m_showAppendMenu, &KNOpacityAnimeButton::clicked,
            this, &KNMusicHeaderPlayer::showAppendMenu);
    appendLayout->addWidget(m_showAppendMenu);
    appendLayout->addStretch();
    //Reset the append panel geometry.
    m_appendPanel->setGeometry(QRect(-m_appendPanel->width(),
                                     panelY,
                                     m_appendPanel->width(),
                                     m_appendPanel->height()));

    //Control panel.
    m_controlPanel->setGeometry(generateOutPosition());
    //Initial layout of the control panel.
    QBoxLayout *panelLayout=new QBoxLayout(QBoxLayout::LeftToRight,
                                           m_controlPanel);
    panelLayout->setContentsMargins(0,0,0,0);
    panelLayout->setSpacing(0);
    m_controlPanel->setLayout(panelLayout);
    panelLayout->addStretch();
    //--Previous Button--
    panelLayout->addWidget(m_previous, 0, Qt::AlignCenter);
    //--Play and Pause Button--
    panelLayout->addWidget(m_playNPause, 0, Qt::AlignCenter);
    //--Next Button--
    panelLayout->addWidget(m_next, 0, Qt::AlignCenter);
    panelLayout->addStretch();

    //Volume Panel.
    m_volumePanel->setFixedWidth(85);
    m_volumePanel->move(width(), 10);
    //Initial layout of the volume panel.
    QBoxLayout *volumeLayout=new QBoxLayout(QBoxLayout::LeftToRight,
                                            m_volumePanel);
    volumeLayout->setContentsMargins(0,0,0,0);
    volumeLayout->setSpacing(0);
    m_volumePanel->setLayout(volumeLayout);
    //Configure the volume indicator.
    m_volumeIndicator->setIcon(m_iconMute[false]);
    m_volumeIndicator->setFixedSize(13,13);
    volumeLayout->addWidget(m_volumeIndicator);
    //Configure the volume slider.
    connect(m_volumeSlider, &KNVolumeSlider::valueChanged,
            this, &KNMusicHeaderPlayer::onActionVolumeChanged);
    volumeLayout->addWidget(m_volumeSlider, 1);

    //Generate a progress panel.
    QWidget *progressPanel=new QWidget(this);
    progressPanel->move(0, 45);
    progressPanel->setFixedWidth(302);
    //Initial layout of the progress panel.
    QBoxLayout *progressLayout=new QBoxLayout(QBoxLayout::LeftToRight,
                                              progressPanel);
    progressLayout->setContentsMargins(0,0,0,0);
    progressLayout->setSpacing(0);
    progressPanel->setLayout(progressLayout);
    //Configure a font class.
    QFont timeFont=font();
    timeFont.setFamily("096MKSD");
    //--Duration Label--
    m_duration->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
    m_duration->setContentsMargins(0,0,0,0);
    m_duration->setFixedWidth(71);
    m_duration->setFont(timeFont);
    m_duration->setObjectName("HeaderPlayerLabel");
    //Link the theme manager.
    connect(knTheme, &KNThemeManager::themeChange,
            [=]
            {
                //Backup the alpha.
                int textColorAlpha=
                        m_duration->palette().color(
                            QPalette::WindowText).alpha();
                //Set the palette.
                m_duration->setPalette(
                            knTheme->getPalette(m_duration->objectName()));
                //Update the alpha.
                updateDurationPalette(textColorAlpha);
            });
    //Set the palette.
    m_duration->setPalette(
                knTheme->getPalette(m_duration->objectName()));
    //Initial the alpha.
    updateDurationPalette(0);
    progressLayout->addWidget(m_duration);
    progressLayout->addSpacing(5);
    //--Progress Bar--
    m_progressSlider->setWheelStep(1000);
    m_progressSlider->setMaximum(0);
    connect(m_progressSlider, &KNProgressSlider::sliderPressed,
            [=]{m_progressPressed=true;});
    connect(m_progressSlider, &KNProgressSlider::sliderReleased,
            [=]{m_progressPressed=false;});
    connect(m_progressSlider, &KNProgressSlider::sliderMoved,
            this, &KNMusicHeaderPlayer::setPosition);
    connect(m_progressSlider, &KNProgressSlider::valueChanged,
            this, &KNMusicHeaderPlayer::updatePositionText);
    progressLayout->addWidget(m_progressSlider);
    //--Position Label--
    m_position->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
    m_position->setFont(timeFont);
    m_position->setFixedWidth(
                    m_position->fontMetrics().width('6')*5+
                    m_position->fontMetrics().width(':'));
    m_position->setObjectName("HeaderPlayerLabel");
    knTheme->registerWidget(m_position);
    //Link the position edit signal with player.
    connect(m_position, &KNEditableLabel::contentChanged,
            this, &KNMusicHeaderPlayer::onActionPositionEdited);
    //Set default text.
    updatePositionText(0);
    progressLayout->addWidget(m_position);
    //--Loop State--
    m_loopState->setFixedSize(16, 16);
    //Set the default state of the loop state.
    onActionLoopStateChange(NoRepeat);
    progressLayout->addSpacing(5);
    progressLayout->addWidget(m_loopState);

    //Configure the append menu.
    m_appendMenu->setFocusProxy(this);
    //Generate the sub menus.
    for(int i=0; i<SubMenuCount; i++)
    {
        m_subMenus[i]=new KNSaoSubMenu(m_appendMenu);
    }
    //Set the icons.
    m_subMenus[SubMenuRating]->menuAction()->setIcon(
                QIcon("://saomenuicons/rating.png"));
    m_subMenus[SubMenuLocate]->menuAction()->setIcon(
                QIcon("://saomenuicons/locate_original.png"));
    //Link the action mapper.
    connect(m_actionTrigger, SIGNAL(mapped(int)),
            this, SLOT(appendActionTriggered(int)));
    //Generate the actions.
    for(int i=0; i<MenuActionsCount; i++)
    {
        //Generate the action.
        m_menuActions[i]=new QAction(this);
        //Link to the action trigger.
        connect(m_menuActions[i], SIGNAL(triggered()),
                m_actionTrigger, SLOT(map()));
        //Mapped the action.
        m_actionTrigger->setMapping(m_menuActions[i], i);
    }
    //Configure the rating menu.
    QIcon ratingIcon=QIcon("://saomenuicons/rating.png");
    QByteArray starTextData;
    starTextData.append((char)226);
    starTextData.append((char)152);
    starTextData.append((char)133);
    QString starText=starTextData;
    for(int i=AppendRatingNoStar; i<=AppendRatingFiveStar; i++)
    {
        //Set action properties
        m_menuActions[i]->setIcon(ratingIcon);
        m_menuActions[i]->setText(starText.repeated(i-AppendRatingNoStar));
        //Add to rating menu.
        m_subMenus[SubMenuRating]->addAction(m_menuActions[i]);
    }
    m_appendMenu->addMenu(m_subMenus[SubMenuRating]);
    //Configure the get info menu.
    m_menuActions[AppendShowDetail]->setIcon(
                QIcon("://saomenuicons/get_info.png"));
    m_appendMenu->addAction(m_menuActions[AppendShowDetail]);
    //Configure the show in graphics menu
    m_menuActions[AppendShowInGraphicShell]->setIcon(
                QIcon("://saomenuicons/showInGraphicsShell.png"));
    m_appendMenu->addAction(m_menuActions[AppendShowInGraphicShell]);
    //Add actions to locate menu.
    m_menuActions[AppendLocateNowPlaying]->setIcon(
                QIcon("://saomenuicons/locate_original.png"));
    m_subMenus[SubMenuLocate]->addAction(m_menuActions[AppendLocateNowPlaying]);
    m_menuActions[AppendShowInSongs]->setIcon(
                QIcon("://saomenuicons/locate_songs.png"));
    m_subMenus[SubMenuLocate]->addAction(m_menuActions[AppendShowInSongs]);
    m_menuActions[AppendShowInArtists]->setIcon(
                QIcon("://saomenuicons/locate_artists.png"));
    m_subMenus[SubMenuLocate]->addAction(m_menuActions[AppendShowInArtists]);
    m_menuActions[AppendShowInAlbums]->setIcon(
                QIcon("://saomenuicons/locate_albums.png"));
    m_subMenus[SubMenuLocate]->addAction(m_menuActions[AppendShowInAlbums]);
    m_menuActions[AppendShowInGenres]->setIcon(
                QIcon("://saomenuicons/locate_genres.png"));
    m_subMenus[SubMenuLocate]->addAction(m_menuActions[AppendShowInGenres]);
    //Append locate menu.
    m_appendMenu->addMenu(m_subMenus[SubMenuLocate]);

    //Configure the lyrics.
    //Use the lyrics manager backend.
    m_headerLyrics->setObjectName("HeaderLyrics");
    knTheme->registerWidget(m_headerLyrics);
    m_headerLyrics->setBackend(knMusicGlobal->lyricsManager()->backend());

    //Configure the animations.
    //Link the value changed signals.
    connect(m_showControl, &QPropertyAnimation::valueChanged,
            this, &KNMusicHeaderPlayer::onActionMouseInOut);
    connect(m_hideControl, &QPropertyAnimation::valueChanged,
            this, &KNMusicHeaderPlayer::onActionMouseInOut);
    //Set the end values.
    m_showControl->setEndValue(generateInPosition());
    m_hideControl->setEndValue(generateOutPosition());
    m_showVolume->setEndValue(QRect(212,
                                    10,
                                    m_volumePanel->width(),
                                    m_volumePanel->height()));
    m_hideVolume->setEndValue(QRect(width(),
                                    10,
                                    m_volumePanel->width(),
                                    m_volumePanel->height()));
    m_showAppend->setEndValue(QRect(8,
                                    panelY,
                                    m_appendPanel->width(),
                                    m_appendPanel->height()));
    m_hideAppend->setEndValue(QRect(-m_appendPanel->width(),
                                    panelY,
                                    m_appendPanel->width(),
                                    m_appendPanel->height()));
    //Configure the animation group.
    m_mouseIn->addAnimation(m_showVolume);
    m_mouseIn->addAnimation(m_showControl);
    m_mouseIn->addAnimation(m_showAppend);
    m_mouseOut->addAnimation(m_hideVolume);
    m_mouseOut->addAnimation(m_hideControl);
    m_mouseOut->addAnimation(m_hideAppend);

    //Link the restranslate of the locale.
    knI18n->link(this, &KNMusicHeaderPlayer::retranslate);
    retranslate();
}