-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
133 lines (86 loc) · 4.63 KB
/
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
#include <QApplication>
#include <FelgoApplication>
#include <QtQml>
#include <QQmlApplicationEngine>
#include <QDir>
#include "src/adapters/tracksadpater.h"
#include "src/adapters/ptracksadapter.h"
#include "src/adapters/musicfoldermodel.h"
#include <src/adapters/mtracksadapter.h>
#include "src/controllers/maincontroller.h"
#include <src/adapters/queueadapter.h>
#include "src/adapters/searchadapter.h"
#include "src/adapters/playlistadapter.h"
#include "src/audio/jaudio.h"
#include <QString>
#include <src/utils/thumbnailprovider.h>
#include <src/utils/playergimageprovider.h>
#include <src/utils/particleimageprovider.h>
#include <src/utils/trackthumbnailprovider.h>
#include <src/graphics/colorgenerator.h>
//#include <VLCQtQml/QmlPlayer.h>
//#include <VLCQtCore/Common.h>
// uncomment this line to add the Live Client Module and use live reloading with your custom C++ code
//#include <FelgoLiveClient>
QString formatTrackTime(QTime time){
QString timeFormat;
if(time.hour()==0){
timeFormat="mm:ss ";
}else{
timeFormat="hh:mm:ss";
}
return time.toString( timeFormat);
}
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QCoreApplication::setOrganizationName("AfrikTek");
QCoreApplication::setOrganizationDomain("afriktek.com");
QCoreApplication::setApplicationName("AfriPlayer");
// VlcCommon::setPluginPath(app.applicationDirPath()+"plugins");
qputenv("QML_DISABLE_DISK_CACHE","1");
FelgoApplication felgo;
// Use platform-specific fonts instead of Felgo's default font
felgo.setPreservePlatformFonts(true);
QQmlApplicationEngine engine;
engine.addImageProvider(QLatin1String("thumbnail"),new ThumbnailProvider);
engine.addImageProvider(QLatin1String("playerthumbnail"),new PlayerGImageProvider);
engine.addImageProvider(QLatin1String("particle"),new ParticleImageProvider);
engine.addImageProvider(QLatin1String("gthumbnail"),new TrackThumbnailProvider);
felgo.initialize(&engine);
// Set an optional license key from project file
// This does not work if using Felgo Live, only for Felgo Cloud Builds and local builds
felgo.setLicenseKey(PRODUCT_LICENSE_KEY);
qmlRegisterSingletonType(QUrl("qrc:///qml/libraries/Constants.qml"),"com.afriktek.qplayer",1,0,"Constants");
qmlRegisterSingletonType(QUrl("qrc:///qml/libraries/JColors.qml"),"com.afriktek.qplayer",1,0,"JColors");
qmlRegisterSingletonType(QUrl("qrc:///qml/data/JQTrack.qml"),"com.afriktek.qplayer",1,0,"JQTrack");
// qmlRegisterSingletonType(QUrl("qrc:///qml/libraries/JQMusicController.qml"),"com.afriktek.qplayer",1,0,"JMuzik");
// qmlRegisterType<BaseDataEntryModel>("com.afriktek.qplayer",1,0,"BaseDataEntryModel");
qmlRegisterType<MTracksAdapter>("com.afriktek.qplayer",1,0,"TracksAdapter");
//qmlRegisterType<JPlaylistDataEntry>("com.afriktek.qplayer",1,0,"JPlaylistModel");
qmlRegisterType<MusicFolderModel>("com.afriktek.qplayer",1,0,"FolderDataEntry");
qmlRegisterType<JAudio>("com.afriktek.qplayer",1,0,"JAudio");
qmlRegisterType<MainController>("com.afriktek.qplayer",1,0,"MainController");
qmlRegisterType<QueueAdapter>("com.afriktek.qplayer",1,0,"QueueAdapter");
qmlRegisterType<PTracksAdapter>("com.afriktek.qplayer",1,0,"PlaylistTracksAdapter");
qmlRegisterType<SearchAdapter>("com.afriktek.qplayer",1,0,"SearchAdapter");
qmlRegisterType<PlaylistAdapter>("com.afriktek.qplayer",1,0,"PlaylistAdapter");
// qmlRegisterType<VlcQmlPlayer>("com.afriktek.qplayer",1,0,"JAudioPlayer");
// qmlRegisterType<QmlPlayer>("com.afriktek.qplayer",1,0,"JAudio");
qRegisterMetaType<JTrack>("JTrack");
qRegisterMetaType<JPlaylist>("JPlaylist");
qRegisterMetaType<QDir>("QDir");
// use this during development
// for PUBLISHING, use the entry point below
felgo.setMainQmlFileName(QStringLiteral("qrc:/qml/Main.qml"));
// use this instead of the above call to avoid deployment of the qml files and compile them into the binary with qt's resource system qrc
// this is the preferred deployment option for publishing games to the app stores, because then your qml files and js files are protected
// to avoid deployment of your qml files and images, also comment the DEPLOYMENTFOLDERS command in the .pro file
// also see the .pro file for more details
//felgo.setMainQmlFileName(QStringLiteral("qrc:/qml/Main.qml"));
engine.load(QUrl(felgo.mainQmlFileName()));
// to start your project as Live Client, comment (remove) the lines "felgo.setMainQmlFileName ..." & "engine.load ...",
// and uncomment the line below
//FelgoLiveClient client (&engine);
return app.exec();
}