mirror of
https://github.com/QuasarApp/SoundBand.git
synced 2025-04-26 07:14:31 +00:00
qulib integration
This commit is contained in:
parent
09be71c9ec
commit
0953e4289f
@ -54,5 +54,6 @@ HEADERS += \
|
||||
|
||||
include($$PWD/../deploy.pri)
|
||||
include($$PWD/../Sync/Sync.pri)
|
||||
include('$$PWD/../QuasarAppLib/QuasarLib.pri');
|
||||
|
||||
QMAKE_LFLAGS += -Wl,-rpath,"'$$DESTDIR'"
|
||||
|
@ -1,5 +1,7 @@
|
||||
#include "syncengine.h"
|
||||
#include <QPicture>
|
||||
#include <quasarapp.h>
|
||||
|
||||
#include "exaptions.h"
|
||||
|
||||
SyncEngine::SyncEngine()
|
||||
@ -38,8 +40,9 @@ int SyncEngine::currentSongId()const{
|
||||
return song->id;
|
||||
}
|
||||
|
||||
bool SyncEngine::init(){
|
||||
sync->updatePlayList(settings.value(CURRENT_PLAYLIST_KEY, ALL_SONGS_LIST).toString());
|
||||
bool SyncEngine::init() {
|
||||
|
||||
sync->updatePlayList(QuasarAppUtils::Settings::get()->getStrValue(CURRENT_PLAYLIST_KEY, ALL_SONGS_LIST));
|
||||
emit currentPlayListNameChanged();
|
||||
return true;
|
||||
}
|
||||
@ -59,6 +62,9 @@ void SyncEngine::allPlayLists(QStringList &playList)const{
|
||||
|
||||
bool SyncEngine::songImageById(int id , QPixmap & image) {
|
||||
|
||||
Q_UNUSED(id);
|
||||
Q_UNUSED(image);
|
||||
|
||||
_lastError = tr("This option not supported.");
|
||||
emit error();
|
||||
|
||||
@ -67,6 +73,9 @@ bool SyncEngine::songImageById(int id , QPixmap & image) {
|
||||
|
||||
bool SyncEngine::songImageByName(const QString& name, QPixmap &image) {
|
||||
|
||||
Q_UNUSED(name);
|
||||
Q_UNUSED(image);
|
||||
|
||||
_lastError = tr("This option not supported.");
|
||||
emit error();
|
||||
|
||||
@ -142,7 +151,7 @@ int SyncEngine::repeat()const{
|
||||
}
|
||||
|
||||
void SyncEngine::setRepeat(int flag){
|
||||
sync->setRepeat((QMediaPlaylist::PlaybackMode)flag);
|
||||
sync->setRepeat(static_cast<QMediaPlaylist::PlaybackMode>(flag));
|
||||
}
|
||||
|
||||
bool SyncEngine::setPlayList(const QString& name){
|
||||
@ -152,7 +161,8 @@ bool SyncEngine::setPlayList(const QString& name){
|
||||
emit error();
|
||||
return false;
|
||||
}
|
||||
settings.setValue(CURRENT_PLAYLIST_KEY, name);
|
||||
|
||||
QuasarAppUtils::Settings::get()->setValue(CURRENT_PLAYLIST_KEY, name);
|
||||
|
||||
emit currentPlayListNameChanged();
|
||||
return true;
|
||||
@ -168,14 +178,14 @@ const QString& SyncEngine::lastError() const{
|
||||
}
|
||||
|
||||
void SyncEngine::setPos(double newPos){
|
||||
sync->jump(sync->getEndPoint() * newPos);
|
||||
sync->jump(static_cast<qint64>(sync->getEndPoint() * newPos));
|
||||
}
|
||||
|
||||
void SyncEngine::setValume(int valume){
|
||||
void SyncEngine::setValume(unsigned int valume){
|
||||
sync->setValume(valume);
|
||||
}
|
||||
|
||||
int SyncEngine::getValume()const{
|
||||
unsigned int SyncEngine::getValume() const{
|
||||
return sync->getValume();
|
||||
}
|
||||
|
||||
@ -184,7 +194,7 @@ double SyncEngine::pos()const{
|
||||
if(!sync->seek())
|
||||
return 0.0;
|
||||
|
||||
return (double)sync->seek() / sync->getEndPoint();
|
||||
return static_cast<double>(sync->seek()) / sync->getEndPoint();
|
||||
}
|
||||
|
||||
bool SyncEngine::addSong(const QString &songUrl){
|
||||
|
@ -3,7 +3,6 @@
|
||||
#include "sync.h"
|
||||
#include <QObject>
|
||||
#include <QPixmap>
|
||||
#include <QSettings>
|
||||
|
||||
|
||||
/**
|
||||
@ -23,7 +22,6 @@ private:
|
||||
Sync *sync;
|
||||
MySql * sqlApi;
|
||||
QString _lastError;
|
||||
QSettings settings;
|
||||
|
||||
private slots:
|
||||
void seekChanged(qint64);
|
||||
@ -162,13 +160,13 @@ public slots:
|
||||
/**
|
||||
* @brief setValume - set a new valume of playin a song
|
||||
*/
|
||||
void setValume(int);
|
||||
void setValume(unsigned int);
|
||||
|
||||
/**
|
||||
* @brief getValume
|
||||
* @return valune ofsong
|
||||
*/
|
||||
int getValume()const;
|
||||
unsigned int getValume()const;
|
||||
|
||||
/**
|
||||
* @brief getServerList
|
||||
|
@ -2,8 +2,8 @@
|
||||
#include <QSqlQuery>
|
||||
#include <QtSql>
|
||||
#include "exaptions.h"
|
||||
#include <QSettings>
|
||||
#include "playlist.h"
|
||||
#include <quasarapp.h>
|
||||
|
||||
MySql::MySql(const QString &databasename):
|
||||
db(nullptr),
|
||||
@ -44,8 +44,9 @@ bool MySql::exec(QSqlQuery *sq,const QString& sqlFile){
|
||||
void MySql::initDB(const QString &database){
|
||||
if(db) return;
|
||||
dataBaseName = database;
|
||||
QSettings settings;
|
||||
songDir = settings.value(MAIN_FOLDER_KEY, MAIN_FOLDER).toString();
|
||||
|
||||
songDir = QuasarAppUtils::Settings::get()->getStrValue(MAIN_FOLDER_KEY, MAIN_FOLDER);
|
||||
|
||||
db = new QSqlDatabase();
|
||||
*db = QSqlDatabase::addDatabase("QSQLITE", database);
|
||||
QDir d(MAIN_FOLDER + "/" + dataBaseName);
|
||||
@ -132,7 +133,8 @@ bool MySql::find(const SongHeader &song, SongStorage &response){
|
||||
|
||||
void MySql::setSoundDir(const QString &str){
|
||||
songDir = str;
|
||||
QSettings().setValue(MAIN_FOLDER_KEY, songDir);
|
||||
|
||||
QuasarAppUtils::Settings::get()->setValue(MAIN_FOLDER_KEY, songDir);
|
||||
}
|
||||
|
||||
bool MySql::saveToStorage(QUrl &url, const Song &song) const{
|
||||
|
Loading…
x
Reference in New Issue
Block a user