4
0
mirror of https://github.com/QuasarApp/SoundBand.git synced 2025-05-11 14:39:33 +00:00

alpha struct of project

This commit is contained in:
Andrei Yankovich 2018-08-17 16:06:14 +03:00
parent 120ff19a84
commit c581fbebc8
42 changed files with 278 additions and 188 deletions

3
.gitignore vendored

@ -12,6 +12,9 @@
# Qt-es
installer/packages/app/data
installer/packages/app/data/*
*.qmake.stash
*.qmake.cache
/.qmake.cache

3
.gitmodules vendored

@ -1,3 +1,6 @@
[submodule "deploy"]
path = deploy
url = git@github.com:QuasarApp/QtDeployTemplate.git
[submodule "QuasarAppLib"]
path = QuasarAppLib
url = git@github.com:QuasarApp/QuasarAppLib.git

1
QuasarAppLib Submodule

@ -0,0 +1 @@
Subproject commit 920ca5e046dea200682dbc1a2a0be931468e8d72

@ -5,9 +5,11 @@ include($$PWD/installer/deploy/deployFiles.pri)
message( DEPLOY_FILES_MASTER = $$DEPLOY_FILES)
SUBDIRS += SoundBand \
tests
SUBDIRS += Sync \
QuasarAppLib/QuasarApp.pro \
SoundBand
SoundBand.depends = Sync QuasarAppLib/QuasarApp.pro
CONFIG(release, debug|release): {

@ -20,25 +20,12 @@ TARGET = SoundBand
SOURCES += main.cpp \
syncengine.cpp \
../sync/chronotime.cpp \
../sync/ETcpSocket.cpp \
../sync/LocalScanner.cpp \
../sync/mysql.cpp \
../sync/node.cpp \
../sync/player.cpp \
../sync/song.cpp \
../sync/sync.cpp \
../sync/Log.cpp\
../sync/exaptions.cpp \
imageprovider.cpp \
app.cpp \
playlistmodel.cpp \
serverlistmodel.cpp \
playlistsmodel.cpp \
currentplaylistmodel.cpp \
../sync/playlist.cpp \
../sync/syncpackage.cpp \
../sync/basepackage.cpp
currentplaylistmodel.cpp
RESOURCES += qml.qrc
@ -58,25 +45,14 @@ DISTFILES +=
HEADERS += \
syncengine.h \
../sync/chronotime.h \
../sync/config.h \
../sync/ETcpSocket.h \
../sync/exaptions.h \
../sync/LocalScanner.h \
../sync/mysql.h \
../sync/node.h \
../sync/player.h \
../sync/song.h \
../sync/sync.h \
../sync/Log.h \
imageprovider.h \
app.h \
playlistmodel.h \
serverlistmodel.h \
playlistsmodel.h \
currentplaylistmodel.h \
../sync/playlist.h \
../sync/syncpackage.h \
../sync/basepackage.h
currentplaylistmodel.h
include($$PWD/../installer/deploy/deployFiles.pri)
include($$PWD/../Sync/Sync.pri)
QMAKE_LFLAGS += -Wl,-rpath,"'$$DESTDIR'"

@ -1,6 +1,6 @@
#include "syncengine.h"
#include <QPicture>
#include "../sync/exaptions.h"
#include "exaptions.h"
SyncEngine::SyncEngine()
{

@ -1,6 +1,6 @@
#ifndef SYNCENGINE_H
#define SYNCENGINE_H
#include "../sync/sync.h"
#include "sync.h"
#include <QObject>
#include <QPixmap>
#include <QSettings>

16
Sync/Sync.pri Normal file

@ -0,0 +1,16 @@
#
# Copyright (C) 2018 QuasarApp.
# Distributed under the lgplv3 software license, see the accompanying
# Everyone is permitted to copy and distribute verbatim copies
# of this license document, but changing it is not allowed.
#
!isEmpty(SYNC_LIB):error("Sync.pri already included")
SYNC_LIB = 1
include($$PWD/../installer/deploy/deployFiles.pri)
#DEPENDS
LIBS += -L"$$DESTDIR/" -lSync
INCLUDEPATH += "$$PWD/"

46
Sync/Sync.pro Normal file

@ -0,0 +1,46 @@
QT += core network multimedia sql
android: QT += androidextras
mac: QT += macextras
CONFIG += c++14
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = Sync
TEMPLATE = lib
include($$PWD/../installer/deploy/deployFiles.pri)
DISTFILES += \
sql/InitLacaleDataBase.sql
HEADERS += \
basepackage.h \
chronotime.h \
config.h \
ETcpSocket.h \
exaptions.h \
LocalScanner.h \
Log.h \
mysql.h \
node.h \
player.h \
playlist.h \
song.h \
sync.h \
syncpackage.h \
sync_global.h
SOURCES += \
basepackage.cpp \
chronotime.cpp \
ETcpSocket.cpp \
exaptions.cpp \
LocalScanner.cpp \
Log.cpp \
mysql.cpp \
node.cpp \
player.cpp \
playlist.cpp \
song.cpp \
sync.cpp \
syncpackage.cpp

77
Sync/exaptions.cpp Normal file

@ -0,0 +1,77 @@
#include "exaptions.h"
#ifdef LOGER
Log debug_log(LOG_FILE);
#endif
const char *BaseException::what() {
return _what.toLatin1().data();
}
void BaseException::log() const{
#ifdef LOGER
debug_log.write(_what, ERROR);
#endif
return;
}
MediaException::MediaException(){
_what = QObject::tr("Your operating system or platform has not supported media files.");
log();
}
AddNodeExaption::AddNodeExaption(){
_what = QObject::tr("Address not available");
log();
}
initNodeError::initNodeError(){
_what = QObject::tr("The node on this device could not be deployed.");
log();
}
CreatePackageExaption::CreatePackageExaption(){
_what = QObject::tr("Сould not generate network packet");
log();
}
SyncCountError::SyncCountError(){
_what = QObject::tr("Could not sync audio.");
log();
}
BadAnswerExaption::BadAnswerExaption(){
_what = QObject::tr("could not parse message nodes.");
log();
}
BrodcastConflict::BrodcastConflict(){
_what = QObject::tr("The server received the packet from the server.");
log();
}
SyncError::SyncError(){
_what = QObject::tr("The playlist is empty, the player has nothing to play.");
log();
}
InitDBError::InitDBError(){
_what = QObject::tr("Error creating database.");
log();
}
NetworkError::NetworkError(){
_what = QObject::tr("There was an error on the socket, the connection will be closed.");
log();
}
DataBaseError::DataBaseError(){
_what = QObject::tr("Find duplicate of database item.");
log();
}
NotSupported::NotSupported(){
_what = QObject::tr("This option not supported.");
log();
}

107
Sync/exaptions.h Normal file

@ -0,0 +1,107 @@
#ifndef EXAPTIONS_H
#define EXAPTIONS_H
#include <exception>
#include <QString>
#include <QTranslator>
#include "config.h"
#include "sync_global.h"
#ifdef LOGER
#include "Log.h"
#endif
#ifdef LOGER
extern Log debug_log;
#endif
/**
* @brief The MediaException class
*/
class SYNCSHARED_EXPORT BaseException
{
protected:
QString _what;
public:
virtual const char* what();
void log()const;
virtual ~BaseException() {}
};
class SYNCSHARED_EXPORT MediaException:public BaseException
{
public:
MediaException();
};
class SYNCSHARED_EXPORT AddNodeExaption:public BaseException
{
public:
AddNodeExaption();
};
class SYNCSHARED_EXPORT initNodeError:public BaseException
{
public:
initNodeError();
};
class SYNCSHARED_EXPORT CreatePackageExaption:public BaseException
{
public:
CreatePackageExaption();
};
class SYNCSHARED_EXPORT SyncCountError:public BaseException
{
public:
SyncCountError();
};
class SYNCSHARED_EXPORT BadAnswerExaption:public BaseException
{
public:
BadAnswerExaption();
};
class SYNCSHARED_EXPORT BrodcastConflict:public BaseException
{
public:
BrodcastConflict();
};
class SYNCSHARED_EXPORT SyncError:public BaseException
{
public:
SyncError();
};
class SYNCSHARED_EXPORT InitDBError:public BaseException
{
public:
InitDBError();
};
class SYNCSHARED_EXPORT NetworkError:public BaseException
{
public:
NetworkError();
};
class SYNCSHARED_EXPORT DataBaseError:public BaseException
{
public:
DataBaseError();
};
class SYNCSHARED_EXPORT NotSupported:public BaseException
{
public:
NotSupported();
};
#endif // EXAPTIONS_H

@ -9,6 +9,7 @@
#include <QMediaPlaylist>
#include "player.h"
#include "playlist.h"
#include "sync_global.h"
typedef std::chrono::time_point<std::chrono::high_resolution_clock> Clock;
@ -19,7 +20,7 @@ class Node;
* @brief The Sync class is main class of this library.
* the 'sync' has supported synced playning media files on network and saving media data into local database.
*/
class Sync : public QObject
class SYNCSHARED_EXPORT Sync : public QObject
{
Q_OBJECT
private:

12
Sync/sync_global.h Normal file

@ -0,0 +1,12 @@
#ifndef SYNC_GLOBAL_H
#define SYNC_GLOBAL_H
#include <QtCore/qglobal.h>
#if defined(SYNC_LIBRARY)
# define SYNCSHARED_EXPORT Q_DECL_EXPORT
#else
# define SYNCSHARED_EXPORT Q_DECL_IMPORT
#endif
#endif // SYNC_GLOBAL_H

Binary file not shown.

@ -1,5 +0,0 @@
#include "exaptions.h"
#ifdef LOGER
Log debug_log(LOG_FILE);
#endif

@ -1,149 +0,0 @@
#ifndef EXAPTIONS_H
#define EXAPTIONS_H
#include <exception>
#include <QString>
#include <QTranslator>
#include "config.h"
#ifdef LOGER
#include "Log.h"
#endif
#ifdef LOGER
extern Log debug_log;
#endif
/**
* @brief The MediaException class
*/
class BaseException
{
protected:
QString _what;
public:
virtual const char* what()
{
return _what.toLatin1().data();
}
void log()const{
#ifdef LOGER
debug_log.write(_what, ERROR);
#endif
return;
}
};
class MediaException:public BaseException
{
public:
MediaException(){
_what = QObject::tr("Your operating system or platform has not supported media files.");
log();
}
};
class AddNodeExaption:public BaseException
{
public:
AddNodeExaption(){
_what = QObject::tr("Address not available");
log();
}
};
class initNodeError:public BaseException
{
public:
initNodeError(){
_what = QObject::tr("The node on this device could not be deployed.");
log();
}
};
class CreatePackageExaption:public BaseException
{
public:
CreatePackageExaption(){
_what = QObject::tr("Сould not generate network packet");
log();
}
};
class SyncCountError:public BaseException
{
public:
SyncCountError(){
_what = QObject::tr("Could not sync audio.");
log();
}
};
class BadAnswerExaption:public BaseException
{
public:
BadAnswerExaption(){
_what = QObject::tr("could not parse message nodes.");
log();
}
};
class BrodcastConflict:public BaseException
{
public:
BrodcastConflict(){
_what = QObject::tr("The server received the packet from the server.");
log();
}
};
class SyncError:public BaseException
{
public:
SyncError(){
_what = QObject::tr("The playlist is empty, the player has nothing to play.");
log();
}
};
class InitDBError:public BaseException
{
public:
InitDBError(){
_what = QObject::tr("Error creating database.");
log();
}
};
class NetworkError:public BaseException
{
public:
NetworkError(){
_what = QObject::tr("There was an error on the socket, the connection will be closed.");
log();
}
};
class DataBaseError:public BaseException
{
public:
DataBaseError(){
_what = QObject::tr("Find duplicate of database item.");
log();
}
};
class NotSupported:public BaseException
{
public:
NotSupported(){
_what = QObject::tr("This option not supported.");
log();
}
};
#endif // EXAPTIONS_H