mirror of
https://github.com/QuasarApp/SoundBand.git
synced 2025-04-28 08:14:31 +00:00
added sliders
This commit is contained in:
parent
3051fdacdc
commit
718b046c42
@ -10,6 +10,8 @@ Item {
|
||||
|
||||
property int currentSongId: 0
|
||||
property string curentSongName: qsTr("Song is not selected")
|
||||
property bool playState: false
|
||||
|
||||
|
||||
function changeSong(id, name){
|
||||
currentSongId = id;
|
||||
@ -48,7 +50,7 @@ Item {
|
||||
GroupBox {
|
||||
|
||||
id: groupBox
|
||||
height: 100
|
||||
height: 120
|
||||
padding: 0;
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: 0
|
||||
@ -68,13 +70,18 @@ Item {
|
||||
width: parent.width/3
|
||||
text: qsTr("<<")
|
||||
anchors.left: parent.left
|
||||
|
||||
onCanceled: {
|
||||
syncEngine.prev();
|
||||
}
|
||||
}
|
||||
|
||||
Button {
|
||||
id: play
|
||||
width: parent.width/3
|
||||
text: qsTr("Play")
|
||||
text: (playState)? qsTr("Pause"): qsTr("Play")
|
||||
anchors.left: prev.right
|
||||
|
||||
}
|
||||
|
||||
Button {
|
||||
@ -82,15 +89,24 @@ Item {
|
||||
width: parent.width/3
|
||||
text: qsTr(">>")
|
||||
anchors.right: parent.right
|
||||
|
||||
onCanceled: {
|
||||
syncEngine.next();
|
||||
}
|
||||
}
|
||||
|
||||
Slider {
|
||||
id: valume
|
||||
value: 0.5
|
||||
from: 0
|
||||
to: 100
|
||||
value: syncEngine.getValume()
|
||||
width: parent.width / 4;
|
||||
anchors.bottom: progress.top
|
||||
anchors.top: next.bottom
|
||||
anchors.left: parent.left
|
||||
onMoved: {
|
||||
syncEngine.setValume(value);
|
||||
}
|
||||
}
|
||||
|
||||
Base.BaseText {
|
||||
@ -107,10 +123,13 @@ Item {
|
||||
|
||||
Slider {
|
||||
id: progress
|
||||
value: 0.5
|
||||
value: syncEngine.pos
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
onMoved:{
|
||||
syncEngine.setPos(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -9,6 +9,12 @@ SyncEngine::SyncEngine()
|
||||
|
||||
connect(sync, SIGNAL(networkStateChange()), this, SIGNAL(serversCountChanged()));
|
||||
connect(sync, SIGNAL(curentPlayListChanged()), this, SIGNAL(curentPlayListCountChanged()));
|
||||
connect(sync, SIGNAL(seekChanged(qint64)), this, SLOT(seekChanged(qint64)));
|
||||
|
||||
}
|
||||
|
||||
void SyncEngine::seekChanged(qint64){
|
||||
emit posChanged();
|
||||
}
|
||||
|
||||
int SyncEngine::curentSongIndex()const{
|
||||
@ -158,12 +164,24 @@ const QString& SyncEngine::lastError() const{
|
||||
return _lastError;
|
||||
}
|
||||
|
||||
void SyncEngine::setPos(double newPos){
|
||||
sync->jump(sync->getEndPoint() * newPos);
|
||||
}
|
||||
|
||||
void SyncEngine::setValume(int valume){
|
||||
sync->setValume(valume);
|
||||
}
|
||||
|
||||
int SyncEngine::getValume()const{
|
||||
return sync->getValume();
|
||||
}
|
||||
|
||||
double SyncEngine::pos()const{
|
||||
|
||||
if(!sync->seek())
|
||||
return 0.0;
|
||||
|
||||
return sync->getEndPoint() / (double)sync->seek();
|
||||
return (double)sync->seek() / sync->getEndPoint();
|
||||
}
|
||||
|
||||
SyncEngine::~SyncEngine(){
|
||||
|
@ -13,7 +13,7 @@ class SyncEngine : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(QString lastError READ lastError NOTIFY error)
|
||||
Q_PROPERTY(double pos READ pos NOTIFY posChanged)
|
||||
Q_PROPERTY(double pos READ pos WRITE setPos NOTIFY posChanged)
|
||||
Q_PROPERTY(int repeat READ repeat WRITE setRepeat NOTIFY repeatChanged)
|
||||
|
||||
enum Repeat{noRepeat, oneMusic, allPlayList};
|
||||
@ -26,6 +26,9 @@ private:
|
||||
Repeat _repeat;
|
||||
QSettings settings;
|
||||
|
||||
private slots:
|
||||
void seekChanged(qint64);
|
||||
|
||||
public:
|
||||
SyncEngine();
|
||||
|
||||
@ -150,6 +153,23 @@ public slots:
|
||||
*/
|
||||
double pos()const;
|
||||
|
||||
/**
|
||||
* @brief setPos
|
||||
* @param newPos
|
||||
*/
|
||||
void setPos(double newPos);
|
||||
|
||||
/**
|
||||
* @brief setValume - set a new valume of playin a song
|
||||
*/
|
||||
void setValume(int);
|
||||
|
||||
/**
|
||||
* @brief getValume
|
||||
* @return valune of song
|
||||
*/
|
||||
int getValume()const;
|
||||
|
||||
/**
|
||||
* @brief getServerList
|
||||
* @return list of servers
|
||||
|
Loading…
x
Reference in New Issue
Block a user