Пример #1
0
void KNMusicGlobal::onActionLibraryMoved(const QString &originalPath,
                                         const QString &currentPath)
{
    Q_UNUSED(originalPath)
    //Backup the original library path.
    QString originalLibraryPath=musicLibraryPath();
    //Set the new path of the music library.
    setMusicLibraryPath(currentPath+"/Music");
    //Emit music library changed signal.
    emit musicLibraryMoved(originalLibraryPath, musicLibraryPath());
}
Пример #2
0
KNMusicGlobal::KNMusicGlobal(QObject *parent) :
    QObject(parent),
    m_suffixs(QStringList()),
    m_listSuffixs(QStringList()),
    m_suffixDescription(QStringList()),
    m_listSuffixDescription(QStringList()),
    m_indexedGenres(QStringList()),
    m_noAlbumArt(QPixmap(":/plugin/music/public/noalbum.png")),
    m_musicLibPath(QString()),
    m_parentWidget(static_cast<QWidget *>(parent)),
    m_detailDialog(new KNMusicDetailDialog(knGlobal->mainWindow())),
    m_lyricsManager(new KNMusicLyricsManager(this)),
    m_parser(new KNMusicParser),
    m_soloMenu(nullptr),
    m_multiMenu(nullptr),
    m_search(nullptr),
    m_backend(nullptr),
    m_nowPlaying(nullptr),
    m_detailTooltip(nullptr),
    m_lyricsDownloadDialog(nullptr),
    m_searcherThread(new QThread(this)),
    m_analysisThread(new QThread(this)),
    m_musicConfigure(knGlobal->userConfigure()->getConfigure("Music"))
{
    //Initial the file type.
    initialFileType();
    //Initial the genere.
    initialGenre();
    //Register the queue arguments.
    qRegisterMetaType<KNMusicAnalysisItem>("KNMusicAnalysisItem");
    qRegisterMetaType<KNMusicDetailInfo>("KNMusicDetailInfo");
    qRegisterMetaType<QList<KNMusicLyricsDownloader::KNMusicLyricsDetails>>(
                "QList<KNMusicLyricsDownloader::KNMusicLyricsDetails>");

    //Set the library path.
    setMusicLibPath(knGlobal->dirPath(KNGlobal::LibraryDir) + "/Music");

    //Update the lyrics path.
    m_lyricsManager->setLyricsDirectory(musicLibraryPath() + "/Lyrics");

    //Link to retranslate.
    knI18n->link(this, &KNMusicGlobal::retranslate);
    retranslate();
}