Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
Harinlen committed Dec 7, 2014
2 parents 8674e26 + cb3e77f commit f9a25ca
Show file tree
Hide file tree
Showing 144 changed files with 9,065 additions and 550 deletions.
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ Joe Johnson <[email protected]>

Special Thanks
--------------
Freddie <[email protected]>
5 changes: 0 additions & 5 deletions src/core/knpluginmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -190,11 +190,6 @@ void KNPluginManager::loadPlugins()
loadMainWindowCategorySwitcher(new KNMainWindowCategorySwitcher);
loadPreference(new KNPreference);

//Initial platform plugins.
#ifdef Q_OS_WIN32
loadPlatformExtras(new KNWindowsExtras);
#endif

//Initial category modules.
loadCategoryPlugin(new KNMusicPlugin);
}
Expand Down
307 changes: 240 additions & 67 deletions src/locale/Simplified_Chinese.ts

Large diffs are not rendered by default.

300 changes: 232 additions & 68 deletions src/locale/Traditional_Chinese.ts

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
#include "core/knpluginmanager.h"
#include "core/knexpandmainwindow.h"

#include <QDebug>

int main(int argc, char *argv[])
{
//Create a singleton pattern application.
Expand Down
84 changes: 74 additions & 10 deletions src/mu.pro
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,16 @@ QT += core \
gui \
widgets \
multimedia \
xml \
network

#Enable c++11
CONFIG += c++11

#Enable processor instruction sets when using release mode.
release{
CONFIG += mmx sse sse2 sse3
QMAKE_CXXFLAGS += -mmmx -msse -msse2 -msse3 -finline-functions
CONFIG += mmx sse sse2
QMAKE_CXXFLAGS += -mmmx -msse -msse2 -finline-functions
}

#Windows configure
Expand Down Expand Up @@ -108,16 +109,14 @@ libbass{

#Add translations
TRANSLATIONS += locale/Simplified_Chinese.ts \
locale/Traditional_Chinese.ts \
locale/English.ts
locale/Traditional_Chinese.ts

#Add public path
INCLUDEPATH += public
#Add plugin and sdk path
INCLUDEPATH += plugin \
plugin/sdk \
plugin/module/knmusicplugin/sdk \
plugin/module/knmusicplugin/plugin/knmusicplaylistmanager/sdk
plugin/module/knmusicplugin/sdk

SOURCES += \
main.cpp \
Expand Down Expand Up @@ -170,7 +169,6 @@ SOURCES += \
plugin/base/knpreference/knpreferencecategoryitem.cpp \
plugin/module/knmusicplugin/sdk/knmusicproxymodel.cpp \
plugin/module/knmusicplugin/sdk/knmusicmodel.cpp \
plugin/module/knmusicplugin/sdk/knmusicproxymodelpool.cpp \
plugin/module/knmusicplugin/plugin/knmusicheaderlyrics/knmusicheaderlyrics.cpp \
plugin/module/knmusicplugin/plugin/knmusicheaderlyrics/knmusiclyricsmanager.cpp \
plugin/module/knmusicplugin/plugin/knmusicheaderlyrics/knmusiclrcparser.cpp \
Expand Down Expand Up @@ -240,7 +238,40 @@ SOURCES += \
plugin/module/knmusicplugin/plugin/knmusictagwma/knmusictagwma.cpp \
plugin/sdk/knsearchbox.cpp \
plugin/module/knmusicplugin/plugin/knmusicsearch/knmusicsearch.cpp \
plugin/module/knmusicplugin/plugin/knmusicdetailtooltip/knmusicdetailtooltip.cpp
plugin/module/knmusicplugin/plugin/knmusicdetailtooltip/knmusicdetailtooltip.cpp \
plugin/sdk/knmousedetectheader.cpp \
plugin/module/knmusicplugin/plugin/knmusictagapev2/knmusictagapev2.cpp \
plugin/module/knmusicplugin/plugin/knmusictagid3v2/knmusictagwav.cpp \
plugin/module/knmusicplugin/plugin/knmusiclibrary/knmusiclibrary.cpp \
plugin/module/knmusicplugin/plugin/knmusiclibrary/sdk/knmusiclibrarysongtab.cpp \
plugin/module/knmusicplugin/plugin/knmusiclibrary/sdk/knmusiclibraryartisttab.cpp \
plugin/module/knmusicplugin/plugin/knmusiclibrary/sdk/knmusiclibraryalbumtab.cpp \
plugin/module/knmusicplugin/plugin/knmusiclibrary/sdk/knmusiclibrarygenretab.cpp \
plugin/module/knmusicplugin/plugin/knmusiclibrary/sdk/knmusiclibrarytreeview.cpp \
plugin/module/knmusicplugin/plugin/knmusiclibrary/sdk/knmusiclibrarymodel.cpp \
plugin/module/knmusicplugin/plugin/knmusiclibrary/sdk/knmusiclibrarytab.cpp \
plugin/module/knmusicplugin/plugin/knmusiclibrary/sdk/knmusiccategorymodel.cpp \
plugin/module/knmusicplugin/plugin/knmusiclibrary/sdk/knmusiccategoryproxymodel.cpp \
plugin/module/knmusicplugin/plugin/knmusiclibrary/sdk/knmusiclibrarycategorytab.cpp \
plugin/sdk/knhashpixmaplist.cpp \
plugin/module/knmusicplugin/plugin/knmusiclibrary/sdk/knmusiccategorydisplay.cpp \
plugin/module/knmusicplugin/sdk/knmusicanalysisextend.cpp \
plugin/module/knmusicplugin/plugin/knmusiclibrary/sdk/knmusiclibraryanalysisextend.cpp \
plugin/module/knmusicplugin/plugin/knmusiclibrary/sdk/knmusicgenremodel.cpp \
plugin/module/knmusicplugin/plugin/knmusiclibrary/sdk/knmusicalbumview.cpp \
plugin/module/knmusicplugin/plugin/knmusiclibrary/sdk/knmusicalbummodel.cpp \
plugin/module/knmusicplugin/plugin/knmusicplaylistmanager/plugin/knmusicxspfparser/knmusicxspfparser.cpp \
plugin/module/knmusicplugin/plugin/knmusicplaylistmanager/plugin/knmusicttplparser/knmusicttplparser.cpp \
plugin/module/knmusicplugin/plugin/knmusicplaylistmanager/plugin/knmusicm3uparser/knmusicm3uparser.cpp \
plugin/module/knmusicplugin/plugin/knmusiclibrary/sdk/knmusicalbumdetail.cpp \
plugin/module/knmusicplugin/plugin/knmusiclibrary/sdk/knmusicalbumtreeview.cpp \
plugin/module/knmusicplugin/plugin/knmusiclibrary/sdk/knmusicalbumindexdelegate.cpp \
plugin/module/knmusicplugin/plugin/knmusiclibrary/sdk/knmusicalbumtitle.cpp \
plugin/sdk/knjsondatabase.cpp \
plugin/module/knmusicplugin/plugin/knmusiclibrary/sdk/knmusiclibrarydatabase.cpp \
plugin/module/knmusicplugin/plugin/knmusiclibrary/sdk/knmusiclibraryimagemanager.cpp \
plugin/sdk/knngnlbutton.cpp \
plugin/module/knmusicplugin/plugin/knmusiclibrary/sdk/knmusiclibraryemptyhint.cpp

HEADERS += \
core/knsingleapplication.h \
Expand Down Expand Up @@ -306,7 +337,6 @@ HEADERS += \
plugin/base/knpreference/knpreferencecategoryitem.h \
plugin/module/knmusicplugin/sdk/knmusicproxymodel.h \
plugin/module/knmusicplugin/sdk/knmusicmodel.h \
plugin/module/knmusicplugin/sdk/knmusicproxymodelpool.h \
plugin/module/knmusicplugin/sdk/knmusicheaderlyricsbase.h \
plugin/module/knmusicplugin/plugin/knmusicheaderlyrics/knmusicheaderlyrics.h \
plugin/module/knmusicplugin/plugin/knmusicheaderlyrics/knmusiclyricsmanager.h \
Expand Down Expand Up @@ -386,7 +416,41 @@ HEADERS += \
plugin/module/knmusicplugin/sdk/knmusicsearchbase.h \
plugin/module/knmusicplugin/sdk/knmusicdetailtooltipbase.h \
plugin/module/knmusicplugin/plugin/knmusicdetailtooltip/knmusicdetailtooltip.h \
plugin/sdk/knplatformextras.h
plugin/sdk/knplatformextras.h \
plugin/sdk/knmousedetectheader.h \
plugin/module/knmusicplugin/plugin/knmusictagapev2/knmusictagapev2.h \
plugin/module/knmusicplugin/plugin/knmusictagid3v2/knmusictagwav.h \
plugin/module/knmusicplugin/sdk/knmusiclibrarybase.h \
plugin/module/knmusicplugin/plugin/knmusiclibrary/knmusiclibrary.h \
plugin/module/knmusicplugin/plugin/knmusiclibrary/sdk/knmusiclibrarysongtab.h \
plugin/module/knmusicplugin/plugin/knmusiclibrary/sdk/knmusiclibraryartisttab.h \
plugin/module/knmusicplugin/plugin/knmusiclibrary/sdk/knmusiclibraryalbumtab.h \
plugin/module/knmusicplugin/plugin/knmusiclibrary/sdk/knmusiclibrarygenretab.h \
plugin/module/knmusicplugin/plugin/knmusiclibrary/sdk/knmusiclibrarytreeview.h \
plugin/module/knmusicplugin/plugin/knmusiclibrary/sdk/knmusiclibrarymodel.h \
plugin/module/knmusicplugin/plugin/knmusiclibrary/sdk/knmusiclibrarytab.h \
plugin/module/knmusicplugin/plugin/knmusiclibrary/sdk/knmusiccategorymodel.h \
plugin/module/knmusicplugin/plugin/knmusiclibrary/sdk/knmusiccategoryproxymodel.h \
plugin/module/knmusicplugin/plugin/knmusiclibrary/sdk/knmusiclibrarycategorytab.h \
plugin/sdk/knhashpixmaplist.h \
plugin/module/knmusicplugin/plugin/knmusiclibrary/sdk/knmusiccategorydisplay.h \
plugin/module/knmusicplugin/sdk/knmusicanalysisextend.h \
plugin/module/knmusicplugin/plugin/knmusiclibrary/sdk/knmusiclibraryanalysisextend.h \
plugin/module/knmusicplugin/plugin/knmusiclibrary/sdk/knmusicgenremodel.h \
plugin/module/knmusicplugin/plugin/knmusiclibrary/sdk/knmusicalbumview.h \
plugin/module/knmusicplugin/plugin/knmusiclibrary/sdk/knmusicalbummodel.h \
plugin/module/knmusicplugin/plugin/knmusicplaylistmanager/plugin/knmusicxspfparser/knmusicxspfparser.h \
plugin/module/knmusicplugin/plugin/knmusicplaylistmanager/plugin/knmusicttplparser/knmusicttplparser.h \
plugin/module/knmusicplugin/plugin/knmusicplaylistmanager/plugin/knmusicm3uparser/knmusicm3uparser.h \
plugin/module/knmusicplugin/plugin/knmusiclibrary/sdk/knmusicalbumdetail.h \
plugin/module/knmusicplugin/plugin/knmusiclibrary/sdk/knmusicalbumtreeview.h \
plugin/module/knmusicplugin/plugin/knmusiclibrary/sdk/knmusicalbumindexdelegate.h \
plugin/module/knmusicplugin/plugin/knmusiclibrary/sdk/knmusicalbumtitle.h \
plugin/sdk/knjsondatabase.h \
plugin/module/knmusicplugin/plugin/knmusiclibrary/sdk/knmusiclibrarydatabase.h \
plugin/module/knmusicplugin/plugin/knmusiclibrary/sdk/knmusiclibraryimagemanager.h \
plugin/sdk/knngnlbutton.h \
plugin/module/knmusicplugin/plugin/knmusiclibrary/sdk/knmusiclibraryemptyhint.h

RESOURCES += \
resource/res.qrc
Expand Down
41 changes: 39 additions & 2 deletions src/plugin/module/knmusicplugin/knmusicplugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include <QBoxLayout>
#include <QSignalMapper>

//Music Global.
#include "knmusicglobal.h"
Expand All @@ -30,6 +31,7 @@
#include "knmusicheaderplayerbase.h"
#include "knmusicheaderlyricsbase.h"
#include "knmusicnowplayingbase.h"
#include "knmusiclibrarybase.h"
#include "knmusicplaylistmanagerbase.h"

//Plugins
Expand All @@ -48,6 +50,8 @@
#include "plugin/knmusictagid3v2/knmusictagid3v2.h"
#include "plugin/knmusictagm4a/knmusictagm4a.h"
#include "plugin/knmusictagwma/knmusictagwma.h"
#include "plugin/knmusictagapev2/knmusictagapev2.h"
#include "plugin/knmusictagid3v2/knmusictagwav.h"
#include "plugin/knmusicdetaildialog/knmusicdetaildialog.h"
#include "plugin/knmusicdetailtooltip/knmusicdetailtooltip.h"
#include "plugin/knmusicsearch/knmusicsearch.h"
Expand All @@ -57,10 +61,12 @@
#include "plugin/knmusicmultimenu/knmusicmultimenu.h"
#include "plugin/knmusicheaderlyrics/knmusicheaderlyrics.h"
#include "plugin/knmusicnowplaying/knmusicnowplaying.h"
#include "plugin/knmusiclibrary/knmusiclibrary.h"
#include "plugin/knmusicplaylistmanager/knmusicplaylistmanager.h"

#include "knglobal.h"
#include "knmusictab.h"
#include "knmousedetectheader.h"
#include "knplatformextras.h"
#include "knconnectionhandler.h"
#include "kncategorytabwidget.h"
Expand Down Expand Up @@ -96,6 +102,7 @@ KNMusicPlugin::KNMusicPlugin(QObject *parent) :
loadNowPlaying(new KNMusicNowPlaying);
loadHeaderPlayer(new KNMusicHeaderPlayer);
loadHeaderLyrics(new KNMusicHeaderLyrics);
loadLibrary(new KNMusicLibrary);
loadPlaylistManager(new KNMusicPlaylistManager);

//Connect retranslate request.
Expand Down Expand Up @@ -200,6 +207,11 @@ void KNMusicPlugin::loadHeaderPlayer(KNMusicHeaderPlayerBase *plugin)
m_headerPlayer->restoreConfigure();
//Add plugin to the list.
m_pluginList.append(m_headerPlayer);
//Link player to sense header.
connect(m_headerWidget, &KNMouseDetectHeader::requireActivateWidget,
m_headerPlayer, &KNMusicHeaderPlayerBase::activatePlayer);
connect(m_headerWidget, &KNMouseDetectHeader::requireInactivateWidget,
m_headerPlayer, &KNMusicHeaderPlayerBase::inactivatePlayer);
//Add to main window.
addLeftHeaderWidget(m_headerPlayer);
}
Expand Down Expand Up @@ -231,6 +243,16 @@ void KNMusicPlugin::loadNowPlaying(KNMusicNowPlayingBase *plugin)
}
}

void KNMusicPlugin::loadLibrary(KNMusicLibraryBase *plugin)
{
m_pluginList.append(plugin);
//Add tabs.
addMusicTab(plugin->songTab());
addMusicTab(plugin->artistTab());
addMusicTab(plugin->albumTab());
addMusicTab(plugin->genreTab());
}

void KNMusicPlugin::loadPlaylistManager(KNMusicPlaylistManagerBase *plugin)
{
m_pluginList.append(plugin);
Expand Down Expand Up @@ -302,6 +324,11 @@ void KNMusicPlugin::addRightHeaderWidget(QWidget *widget,
m_headerRightLayout->addWidget(widget, stretch, alignment);
}

void KNMusicPlugin::onActionShowTab(const int &tabIndex)
{
m_centralWidget->setCurrentIndex(tabIndex);
}

void KNMusicPlugin::initialInfrastructure()
{
//Initial the music global.
Expand All @@ -318,7 +345,7 @@ void KNMusicPlugin::initialInfrastructure()
m_centralWidget=new KNCategoryTabWidget;

//Initial header widget.
m_headerWidget=new QWidget;
m_headerWidget=new KNMouseDetectHeader;
//Set header properties.
m_headerWidget->setContentsMargins(0,0,0,0);
//Set header layout.
Expand All @@ -342,6 +369,11 @@ void KNMusicPlugin::initialInfrastructure()

//Initial the extra platform connection handler.
m_extraHandler=new KNConnectionHandler(this);

//Initial the tab switch signal mapper.
m_tabSwitchMapper=new QSignalMapper(this);
connect(m_tabSwitchMapper, SIGNAL(mapped(int)),
this, SLOT(onActionShowTab(int)));
}

void KNMusicPlugin::initialParser()
Expand All @@ -354,10 +386,12 @@ void KNMusicPlugin::initialParser()

//Install all tag parser plugins here.
parser->installTagParser(new KNMusicTagID3v1);
parser->installTagParser(new KNMusicTagAPEv2);
parser->installTagParser(new KNMusicTagFLAC);
parser->installTagParser(new KNMusicTagID3v2);
parser->installTagParser(new KNMusicTagM4A);
parser->installTagParser(new KNMusicTagWMA);
parser->installTagParser(new KNMusicTagWAV);

//Install all analysiser plugins here.
#ifdef ENABLE_LIBBASS
Expand Down Expand Up @@ -401,6 +435,10 @@ void KNMusicPlugin::addMusicTab(KNMusicTab *musicTab)
musicTab->caption(),
musicTab->widget());
currentTab.tab=musicTab;
//Connect show tab request.
connect(musicTab, SIGNAL(requireShowTab()),
m_tabSwitchMapper, SLOT(map()));
m_tabSwitchMapper->setMapping(musicTab, m_tabList.size());
//Add tab to list.
m_tabList.append(currentTab);
//Connect request to the music tab.
Expand All @@ -413,7 +451,6 @@ void KNMusicPlugin::startThreads()
m_parserThread.start();
}


void KNMusicPlugin::setPlatformExtras(KNPlatformExtras *plugin)
{
m_platformExtras=plugin;
Expand Down
10 changes: 9 additions & 1 deletion src/plugin/module/knmusicplugin/knmusicplugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,11 @@
#include "knabstractmusicplugin.h"

class QBoxLayout;
class QSignalMapper;
class KNCategoryTabWidget;
class KNPreferenceWidgetsPanel;
class KNConnectionHandler;
class KNMouseDetectHeader;
class KNMusicTab;
class KNMusicBackend;
class KNMusicGlobal;
Expand All @@ -34,6 +36,7 @@ class KNMusicDetailTooltipBase;
class KNMusicHeaderPlayerBase;
class KNMusicHeaderLyricsBase;
class KNMusicNowPlayingBase;
class KNMusicLibraryBase;
class KNMusicPlaylistManagerBase;
class KNMusicSoloMenuBase;
class KNMusicMultiMenuBase;
Expand All @@ -59,6 +62,7 @@ class KNMusicPlugin : public KNAbstractMusicPlugin
void loadHeaderPlayer(KNMusicHeaderPlayerBase *plugin);
void loadHeaderLyrics(KNMusicHeaderLyricsBase *plugin);
void loadNowPlaying(KNMusicNowPlayingBase *plugin);
void loadLibrary(KNMusicLibraryBase *plugin);
void loadPlaylistManager(KNMusicPlaylistManagerBase *plugin);

signals:
Expand All @@ -80,6 +84,9 @@ protected slots:
int stretch=0,
Qt::Alignment alignment=0);

private slots:
void onActionShowTab(const int &tabIndex);

private:
void initialInfrastructure();
void initialParser();
Expand All @@ -96,10 +103,11 @@ protected slots:
QLinkedList<MusicTabItem> m_tabList;
QString m_caption;
KNCategoryTabWidget *m_centralWidget=nullptr;
QWidget *m_headerWidget=nullptr;
KNMouseDetectHeader *m_headerWidget=nullptr;
KNPreferenceWidgetsPanel *m_preferencePanel;
QBoxLayout *m_headerLeftLayout, *m_headerRightLayout;
QThread m_parserThread, m_backendThread;
QSignalMapper *m_tabSwitchMapper;
KNMusicGlobal *m_musicGlobal;

KNMusicDetailDialogBase *m_detailDialog=nullptr;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,12 @@ void KNMusicBackendBassThread::clear()
m_totalDuration=0;
//Reset thread data.
resetState();
//Reset the state to stopped.
if(m_playingState!=StoppedState)
{
m_playingState=StoppedState;
emit stateChanged(m_playingState);
}
}

void KNMusicBackendBassThread::resetState()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ KNMusicDetailTooltip::KNMusicDetailTooltip(QWidget *parent) :
//Initial the layout and widget.
QBoxLayout *mainLayout=new QBoxLayout(QBoxLayout::TopToBottom,
this);
mainLayout->setContentsMargins(11,11,11,6);
mainLayout->setSpacing(6);
setLayout(mainLayout);
QBoxLayout *albumLayout=new QBoxLayout(QBoxLayout::LeftToRight,
mainLayout->widget());
Expand Down
Loading

0 comments on commit f9a25ca

Please sign in to comment.