mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-12 09:04:33 +02:00
- make the station stuff adapt to high DPIs
- more work on the config dialog
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
import QtQuick 1.1
|
import QtQuick 1.1
|
||||||
import tomahawk 1.0
|
import tomahawk 1.0
|
||||||
|
import "tomahawkimports"
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: fineTuneView
|
id: fineTuneView
|
||||||
@@ -9,45 +10,53 @@ Item {
|
|||||||
signal done();
|
signal done();
|
||||||
|
|
||||||
Grid {
|
Grid {
|
||||||
anchors.fill: parent
|
anchors.top: parent.top
|
||||||
|
anchors.bottom: parent.bottom
|
||||||
anchors.margins: 50
|
anchors.margins: 50
|
||||||
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
width: scene.width / 2
|
||||||
|
spacing: 50
|
||||||
|
columns: 2
|
||||||
|
|
||||||
Text {
|
Text {
|
||||||
color: fineTuneView.textColor
|
color: fineTuneView.textColor
|
||||||
text: "Name"
|
text: "Name:"
|
||||||
|
|
||||||
}
|
}
|
||||||
TextInput {
|
InputField {
|
||||||
id: stationName
|
|
||||||
width: 200
|
|
||||||
text: echonestStation.name
|
text: echonestStation.name
|
||||||
//onTextChanged: echonestStation.
|
|
||||||
|
onAccepted: {
|
||||||
|
print("text changed!!!")
|
||||||
|
echonestStation.name = text;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Text {
|
||||||
|
text: "Tempo:"
|
||||||
|
color: "white"
|
||||||
|
}
|
||||||
|
DoubleSlider {
|
||||||
|
width: 500
|
||||||
|
}
|
||||||
|
|
||||||
|
Text {
|
||||||
|
text: "Hotness:"
|
||||||
|
color: "white"
|
||||||
|
}
|
||||||
|
DoubleSlider {
|
||||||
|
width: 500
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Rectangle {
|
|
||||||
|
Button {
|
||||||
id: configureButton
|
id: configureButton
|
||||||
|
onClicked: fineTuneView.done();
|
||||||
|
text: "configure"
|
||||||
anchors.bottom: parent.bottom
|
anchors.bottom: parent.bottom
|
||||||
anchors.bottomMargin: 20
|
anchors.bottomMargin: 20
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
color: "gray"
|
|
||||||
height: 20
|
|
||||||
width: 150
|
|
||||||
radius: 10
|
|
||||||
//opacity: 0
|
|
||||||
|
|
||||||
Text {
|
|
||||||
anchors.centerIn: parent
|
|
||||||
text: "configure"
|
|
||||||
color: "white"
|
|
||||||
}
|
|
||||||
|
|
||||||
MouseArea {
|
|
||||||
anchors.fill: parent
|
|
||||||
onClicked: {
|
|
||||||
fineTuneView.done();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -28,7 +28,7 @@ Rectangle {
|
|||||||
}
|
}
|
||||||
|
|
||||||
StationView {
|
StationView {
|
||||||
coverSize: 250
|
coverSize: Math.min(scene.height, scene.width) / 2
|
||||||
height: scene.height
|
height: scene.height
|
||||||
width: scene.width
|
width: scene.width
|
||||||
|
|
||||||
|
@@ -1,5 +1,6 @@
|
|||||||
import QtQuick 1.1
|
import QtQuick 1.1
|
||||||
import tomahawk 1.0
|
import tomahawk 1.0
|
||||||
|
import "tomahawkimports"
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: root
|
id: root
|
||||||
@@ -84,14 +85,14 @@ Item {
|
|||||||
anchors { left: parent.left; top: parent.top; right: parent.right }
|
anchors { left: parent.left; top: parent.top; right: parent.right }
|
||||||
Text {
|
Text {
|
||||||
color: "white"
|
color: "white"
|
||||||
font.pixelSize: 16
|
font.pointSize: 12
|
||||||
width: parent.width
|
width: parent.width
|
||||||
elide: Text.ElideRight
|
elide: Text.ElideRight
|
||||||
text: "Station:"
|
text: "Station:"
|
||||||
}
|
}
|
||||||
Text {
|
Text {
|
||||||
color: "white"
|
color: "white"
|
||||||
font.pixelSize: 24
|
font.pointSize: 14
|
||||||
font.bold: true
|
font.bold: true
|
||||||
width: parent.width
|
width: parent.width
|
||||||
elide: Text.ElideRight
|
elide: Text.ElideRight
|
||||||
@@ -108,16 +109,16 @@ Item {
|
|||||||
|
|
||||||
Text {
|
Text {
|
||||||
color: "white"
|
color: "white"
|
||||||
font.pixelSize: 16
|
font.pointSize: 12
|
||||||
width: parent.width
|
width: parent.width
|
||||||
elide: Text.ElideRight
|
elide: Text.ElideRight
|
||||||
text: "Now Playing:"
|
text: "Now Playing:"
|
||||||
visible: currentlyPlayedIndex !== -1
|
visible: currentlyPlayedIndex !== -1
|
||||||
}
|
}
|
||||||
Rectangle {
|
Rectangle {
|
||||||
height: 64
|
height: image.height + image.height / 5
|
||||||
width: parent.width
|
width: image.width + startPlayingText.width * 1.2
|
||||||
radius: 32
|
radius: height / 2
|
||||||
border.width: 2
|
border.width: 2
|
||||||
border.color: "white"
|
border.color: "white"
|
||||||
color: startPlayingMouseArea.containsMouse ? "blue" : "gray"
|
color: startPlayingMouseArea.containsMouse ? "blue" : "gray"
|
||||||
@@ -131,12 +132,13 @@ Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Text {
|
Text {
|
||||||
|
id: startPlayingText
|
||||||
color: "white"
|
color: "white"
|
||||||
font.pixelSize: 24
|
font.pointSize: 20
|
||||||
anchors.left: image.right
|
anchors.left: image.right
|
||||||
anchors.margins: 10
|
anchors.margins: height / 5
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
width: parent.width - 30 - image.width
|
//width: parent.width - 30 - image.width
|
||||||
elide: Text.ElideRight
|
elide: Text.ElideRight
|
||||||
text: "Start playing"
|
text: "Start playing"
|
||||||
}
|
}
|
||||||
@@ -150,21 +152,21 @@ Item {
|
|||||||
|
|
||||||
Text {
|
Text {
|
||||||
color: "white"
|
color: "white"
|
||||||
font.pixelSize: 24
|
font.pointSize: 16
|
||||||
width: parent.width
|
width: parent.width
|
||||||
elide: Text.ElideRight
|
elide: Text.ElideRight
|
||||||
text: coverView.model.itemFromIndex( currentlyPlayedIndex ).name
|
text: coverView.model.itemFromIndex( currentlyPlayedIndex ).name
|
||||||
}
|
}
|
||||||
Text {
|
Text {
|
||||||
color: "white"
|
color: "white"
|
||||||
font.pixelSize: 20
|
font.pointSize: 14
|
||||||
width: parent.width
|
width: parent.width
|
||||||
elide: Text.ElideRight
|
elide: Text.ElideRight
|
||||||
text: coverView.model.itemFromIndex( currentlyPlayedIndex ).artistName
|
text: coverView.model.itemFromIndex( currentlyPlayedIndex ).artistName
|
||||||
}
|
}
|
||||||
Text {
|
Text {
|
||||||
color: "white"
|
color: "white"
|
||||||
font.pixelSize: 20
|
font.pointSize: 14
|
||||||
width: parent.width
|
width: parent.width
|
||||||
elide: Text.ElideRight
|
elide: Text.ElideRight
|
||||||
text: coverView.model.itemFromIndex( currentlyPlayedIndex ).albumName
|
text: coverView.model.itemFromIndex( currentlyPlayedIndex ).albumName
|
||||||
@@ -172,29 +174,13 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Rectangle {
|
Button {
|
||||||
id: configureButton
|
id: configureButton
|
||||||
anchors.bottom: parent.bottom
|
anchors.bottom: parent.bottom
|
||||||
anchors.bottomMargin: 20
|
anchors.bottomMargin: 20
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
color: "gray"
|
text: "configure"
|
||||||
height: 20
|
onClicked: root.configure();
|
||||||
width: 150
|
|
||||||
radius: 10
|
|
||||||
//opacity: 0
|
|
||||||
|
|
||||||
Text {
|
|
||||||
anchors.centerIn: parent
|
|
||||||
text: "configure"
|
|
||||||
color: "white"
|
|
||||||
}
|
|
||||||
|
|
||||||
MouseArea {
|
|
||||||
anchors.fill: parent
|
|
||||||
onClicked: {
|
|
||||||
root.configure();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
29
data/qml/tomahawkimports/Button.qml
Normal file
29
data/qml/tomahawkimports/Button.qml
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
import QtQuick 1.1
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
id: root
|
||||||
|
color: buttonMouseArea.containsMouse ? "blue" : "gray"
|
||||||
|
border.width: 2
|
||||||
|
border.color: "white"
|
||||||
|
radius: height/2
|
||||||
|
height: buttonText.height * 1.2
|
||||||
|
width: buttonText.width * 1.5
|
||||||
|
|
||||||
|
property alias text: buttonText.text
|
||||||
|
property color textColor: "white"
|
||||||
|
|
||||||
|
signal clicked()
|
||||||
|
|
||||||
|
Text {
|
||||||
|
id: buttonText
|
||||||
|
anchors.centerIn: parent
|
||||||
|
color: root.textColor
|
||||||
|
}
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
id: buttonMouseArea
|
||||||
|
anchors.fill: parent
|
||||||
|
hoverEnabled: true
|
||||||
|
onClicked: root.clicked();
|
||||||
|
}
|
||||||
|
}
|
36
data/qml/tomahawkimports/DoubleSlider.qml
Normal file
36
data/qml/tomahawkimports/DoubleSlider.qml
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
import QtQuick 1.1
|
||||||
|
|
||||||
|
Item {
|
||||||
|
width: 500
|
||||||
|
height: 10
|
||||||
|
|
||||||
|
property int min: 0
|
||||||
|
property int max: 100
|
||||||
|
|
||||||
|
property int lowerSliderPos: 25
|
||||||
|
property int upperSliderPos: 75
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
id: lowerSlider
|
||||||
|
height: parent.height
|
||||||
|
width: height
|
||||||
|
anchors.top: parent.top
|
||||||
|
x: 10
|
||||||
|
}
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
id: upperSlider
|
||||||
|
height: parent.height
|
||||||
|
width: height
|
||||||
|
anchors.top: parent.top
|
||||||
|
x: 50
|
||||||
|
}
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
height: 4
|
||||||
|
color: "white"
|
||||||
|
radius: height / 2
|
||||||
|
width: parent.width
|
||||||
|
anchors.centerIn: parent
|
||||||
|
}
|
||||||
|
}
|
23
data/qml/tomahawkimports/InputField.qml
Normal file
23
data/qml/tomahawkimports/InputField.qml
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
import QtQuick 1.1
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
id: root
|
||||||
|
color: "white"
|
||||||
|
border.color: "black"
|
||||||
|
border.width: 2
|
||||||
|
|
||||||
|
height: textInput.height + 4
|
||||||
|
width: 300
|
||||||
|
|
||||||
|
property alias text: textInput.text
|
||||||
|
|
||||||
|
signal accepted( string text )
|
||||||
|
|
||||||
|
TextInput {
|
||||||
|
id: textInput
|
||||||
|
width: parent.width
|
||||||
|
anchors.centerIn: parent
|
||||||
|
|
||||||
|
onAccepted: root.accepted( text );
|
||||||
|
}
|
||||||
|
}
|
@@ -152,5 +152,8 @@
|
|||||||
<file>data/qml/TagCloud.qml</file>
|
<file>data/qml/TagCloud.qml</file>
|
||||||
<file>data/qml/StationConfig.qml</file>
|
<file>data/qml/StationConfig.qml</file>
|
||||||
<file>data/qml/StationView.qml</file>
|
<file>data/qml/StationView.qml</file>
|
||||||
|
<file>data/qml/tomahawkimports/InputField.qml</file>
|
||||||
|
<file>data/qml/tomahawkimports/Button.qml</file>
|
||||||
|
<file>data/qml/tomahawkimports/DoubleSlider.qml</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
#include "EchonestStation.h"
|
#include "EchonestStation.h"
|
||||||
|
#include "dynamic/DynamicPlaylist.h"
|
||||||
|
|
||||||
#include "PlayableItem.h"
|
#include "PlayableItem.h"
|
||||||
#include "audio/AudioEngine.h"
|
#include "audio/AudioEngine.h"
|
||||||
@@ -6,28 +7,28 @@
|
|||||||
namespace Tomahawk
|
namespace Tomahawk
|
||||||
{
|
{
|
||||||
|
|
||||||
EchonestStation::EchonestStation( PlayableProxyModel *model, geninterface_ptr generator, QObject *parent )
|
EchonestStation::EchonestStation( PlayableProxyModel *model, dynplaylist_ptr playlist, QObject *parent )
|
||||||
: QObject( parent )
|
: QObject( parent )
|
||||||
, m_name( model->sourceModel()->title() )
|
, m_name( model->sourceModel()->title() )
|
||||||
, m_model( model )
|
, m_model( model )
|
||||||
, m_generator( generator )
|
, m_playlist( playlist )
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QString EchonestStation::name() const
|
QString EchonestStation::name() const
|
||||||
{
|
{
|
||||||
return m_name;
|
return m_playlist->title();
|
||||||
}
|
}
|
||||||
|
|
||||||
void EchonestStation::setName(const QString &name)
|
void EchonestStation::setName(const QString &name)
|
||||||
{
|
{
|
||||||
m_name = name;
|
m_playlist->setTitle( name );
|
||||||
emit nameChanged();
|
emit nameChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
Tomahawk::DynamicControl* EchonestStation::mainControl() {
|
Tomahawk::DynamicControl* EchonestStation::mainControl() {
|
||||||
foreach(dyncontrol_ptr control, m_generator->controls()) {
|
foreach(dyncontrol_ptr control, m_playlist->generator()->controls()) {
|
||||||
qDebug() << "got control" << control->selectedType();
|
qDebug() << "got control" << control->selectedType();
|
||||||
if(control->selectedType() == "Artist" || control->selectedType() == "Style") {
|
if(control->selectedType() == "Artist" || control->selectedType() == "Style") {
|
||||||
return control.data();
|
return control.data();
|
||||||
@@ -54,12 +55,12 @@ void EchonestStation::playItem(int row)
|
|||||||
|
|
||||||
void EchonestStation::setMainControl(const QString &type)
|
void EchonestStation::setMainControl(const QString &type)
|
||||||
{
|
{
|
||||||
dyncontrol_ptr control = m_generator->createControl("echonest");
|
dyncontrol_ptr control = m_playlist->generator()->createControl("echonest");
|
||||||
control->setSelectedType("Style");
|
control->setSelectedType("Style");
|
||||||
control->setMatch("1");
|
control->setMatch("1");
|
||||||
control->setInput(type);
|
control->setInput(type);
|
||||||
qDebug() << "created control" << control->type() << control->selectedType() << control->match();
|
qDebug() << "created control" << control->type() << control->selectedType() << control->match();
|
||||||
m_generator->generate(20);
|
m_playlist->generator()->generate(20);
|
||||||
|
|
||||||
emit configuredChanged();
|
emit configuredChanged();
|
||||||
}
|
}
|
||||||
|
@@ -14,7 +14,7 @@ class EchonestStation: public QObject
|
|||||||
Q_PROPERTY( Tomahawk::DynamicControl* mainControl READ mainControl )
|
Q_PROPERTY( Tomahawk::DynamicControl* mainControl READ mainControl )
|
||||||
|
|
||||||
public:
|
public:
|
||||||
EchonestStation( PlayableProxyModel *model, geninterface_ptr generator, QObject *parent = 0);
|
EchonestStation( PlayableProxyModel *model, dynplaylist_ptr playlist, QObject *parent = 0);
|
||||||
|
|
||||||
QString name() const;
|
QString name() const;
|
||||||
void setName( const QString &name );
|
void setName( const QString &name );
|
||||||
@@ -34,7 +34,7 @@ signals:
|
|||||||
private:
|
private:
|
||||||
QString m_name;
|
QString m_name;
|
||||||
PlayableProxyModel *m_model;
|
PlayableProxyModel *m_model;
|
||||||
geninterface_ptr m_generator;
|
dynplaylist_ptr m_playlist;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -71,7 +71,7 @@ DynamicQmlWidget::DynamicQmlWidget( const dynplaylist_ptr& playlist, QWidget* pa
|
|||||||
|
|
||||||
ControlModel *controls = new ControlModel(m_playlist->generator(), this);
|
ControlModel *controls = new ControlModel(m_playlist->generator(), this);
|
||||||
|
|
||||||
EchonestStation *station = new EchonestStation( m_proxyModel, m_playlist->generator(), this);
|
EchonestStation *station = new EchonestStation( m_proxyModel, m_playlist, this);
|
||||||
rootContext()->setContextProperty( "echonestStation", station);
|
rootContext()->setContextProperty( "echonestStation", station);
|
||||||
rootContext()->setContextProperty( "controlModel", controls );
|
rootContext()->setContextProperty( "controlModel", controls );
|
||||||
rootContext()->setContextProperty( "dynamicModel", m_proxyModel );
|
rootContext()->setContextProperty( "dynamicModel", m_proxyModel );
|
||||||
@@ -134,7 +134,6 @@ DynamicQmlWidget::jumpToCurrentTrack()
|
|||||||
void DynamicQmlWidget::currentItemChanged( const QPersistentModelIndex ¤tIndex )
|
void DynamicQmlWidget::currentItemChanged( const QPersistentModelIndex ¤tIndex )
|
||||||
{
|
{
|
||||||
rootContext()->setContextProperty( "currentlyPlayedIndex", m_proxyModel->mapFromSource( currentIndex ).row() );
|
rootContext()->setContextProperty( "currentlyPlayedIndex", m_proxyModel->mapFromSource( currentIndex ).row() );
|
||||||
m_playlist->generator()->fetchNext();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -143,9 +142,6 @@ DynamicQmlWidget::tracksGenerated( const QList< query_ptr >& queries )
|
|||||||
qDebug() << queries.count() << "tracks generated";
|
qDebug() << queries.count() << "tracks generated";
|
||||||
m_model->tracksGenerated( queries, queries.count() );
|
m_model->tracksGenerated( queries, queries.count() );
|
||||||
m_playlist->resolve();
|
m_playlist->resolve();
|
||||||
|
|
||||||
// Ok... we have some intial stuff, switch to dynamic mode
|
|
||||||
//m_model->startOnDemand();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DynamicQmlWidget::nextTrackGenerated(const query_ptr &track)
|
void DynamicQmlWidget::nextTrackGenerated(const query_ptr &track)
|
||||||
|
Reference in New Issue
Block a user