mirror of
https://github.com/QuasarApp/SoundBand.git
synced 2025-05-09 21:49:34 +00:00
Merge branch 'qmlLogic'
Conflicts: SoundBand/SoundBand.pro
This commit is contained in:
commit
f2b7935f53
SoundBand
@ -28,7 +28,8 @@ SOURCES += main.cpp \
|
||||
../sync/sync.cpp \
|
||||
../sync/Log.cpp\
|
||||
../sync/exaptions.cpp \
|
||||
imageprovider.cpp
|
||||
imageprovider.cpp \
|
||||
app.cpp
|
||||
|
||||
|
||||
RESOURCES += qml.qrc
|
||||
@ -59,5 +60,6 @@ HEADERS += \
|
||||
../sync/song.h \
|
||||
../sync/sync.h \
|
||||
../sync/Log.h \
|
||||
imageprovider.h
|
||||
imageprovider.h \
|
||||
app.h
|
||||
|
||||
|
26
SoundBand/app.cpp
Normal file
26
SoundBand/app.cpp
Normal file
@ -0,0 +1,26 @@
|
||||
#include "app.h"
|
||||
#include <QQmlApplicationEngine>
|
||||
#include "syncengine.h"
|
||||
|
||||
App::App(QObject* ptr):
|
||||
QObject(ptr)
|
||||
{
|
||||
qmlEngine = new QQmlApplicationEngine();
|
||||
syncEngine = new SyncEngine();
|
||||
}
|
||||
|
||||
bool App::run(){
|
||||
qmlRegisterType<SyncEngine>("SyncEngine",1,0,"SyncEngine");
|
||||
|
||||
qmlEngine->load(QUrl(QStringLiteral("qrc:/main.qml")));
|
||||
if (qmlEngine->rootObjects().isEmpty())
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
App::~App(){
|
||||
delete syncEngine;
|
||||
delete qmlEngine;
|
||||
}
|
||||
|
30
SoundBand/app.h
Normal file
30
SoundBand/app.h
Normal file
@ -0,0 +1,30 @@
|
||||
#ifndef APP_H
|
||||
#define APP_H
|
||||
|
||||
#include <QObject>
|
||||
#include "syncengine.h"
|
||||
|
||||
class SyncEngine;
|
||||
class QQmlApplicationEngine;
|
||||
|
||||
/**
|
||||
* @brief The App class
|
||||
* general application object
|
||||
*/
|
||||
class App : public QObject
|
||||
{
|
||||
private:
|
||||
SyncEngine *syncEngine;
|
||||
QQmlApplicationEngine *qmlEngine;
|
||||
public:
|
||||
explicit App(QObject *ptr = nullptr);
|
||||
|
||||
/**
|
||||
* @brief run app
|
||||
* @return false if app not running, true if all done
|
||||
*/
|
||||
bool run();
|
||||
~App();
|
||||
};
|
||||
|
||||
#endif // APP_H
|
@ -1,6 +1,6 @@
|
||||
#include <QApplication>
|
||||
#include <QQmlApplicationEngine>
|
||||
#include "syncengine.h"
|
||||
#include "app.h"
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
@ -9,12 +9,9 @@ int main(int argc, char *argv[])
|
||||
#endif
|
||||
|
||||
QApplication app(argc, argv);
|
||||
|
||||
QQmlApplicationEngine engine;
|
||||
qmlRegisterType<SyncEngine>("SyncEngine",1,0,"SyncEngine");
|
||||
|
||||
engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
|
||||
if (engine.rootObjects().isEmpty())
|
||||
App soundBand;
|
||||
if(!soundBand.run())
|
||||
return -1;
|
||||
|
||||
return app.exec();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user