mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-11 16:44:05 +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 tomahawk 1.0
|
||||
import "tomahawkimports"
|
||||
|
||||
Item {
|
||||
id: fineTuneView
|
||||
@@ -9,45 +10,53 @@ Item {
|
||||
signal done();
|
||||
|
||||
Grid {
|
||||
anchors.fill: parent
|
||||
anchors.top: parent.top
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.margins: 50
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
width: scene.width / 2
|
||||
spacing: 50
|
||||
columns: 2
|
||||
|
||||
Text {
|
||||
color: fineTuneView.textColor
|
||||
text: "Name"
|
||||
text: "Name:"
|
||||
|
||||
}
|
||||
TextInput {
|
||||
id: stationName
|
||||
width: 200
|
||||
InputField {
|
||||
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
|
||||
onClicked: fineTuneView.done();
|
||||
text: "configure"
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.bottomMargin: 20
|
||||
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 {
|
||||
coverSize: 250
|
||||
coverSize: Math.min(scene.height, scene.width) / 2
|
||||
height: scene.height
|
||||
width: scene.width
|
||||
|
||||
|
@@ -1,5 +1,6 @@
|
||||
import QtQuick 1.1
|
||||
import tomahawk 1.0
|
||||
import "tomahawkimports"
|
||||
|
||||
Item {
|
||||
id: root
|
||||
@@ -84,14 +85,14 @@ Item {
|
||||
anchors { left: parent.left; top: parent.top; right: parent.right }
|
||||
Text {
|
||||
color: "white"
|
||||
font.pixelSize: 16
|
||||
font.pointSize: 12
|
||||
width: parent.width
|
||||
elide: Text.ElideRight
|
||||
text: "Station:"
|
||||
}
|
||||
Text {
|
||||
color: "white"
|
||||
font.pixelSize: 24
|
||||
font.pointSize: 14
|
||||
font.bold: true
|
||||
width: parent.width
|
||||
elide: Text.ElideRight
|
||||
@@ -108,16 +109,16 @@ Item {
|
||||
|
||||
Text {
|
||||
color: "white"
|
||||
font.pixelSize: 16
|
||||
font.pointSize: 12
|
||||
width: parent.width
|
||||
elide: Text.ElideRight
|
||||
text: "Now Playing:"
|
||||
visible: currentlyPlayedIndex !== -1
|
||||
}
|
||||
Rectangle {
|
||||
height: 64
|
||||
width: parent.width
|
||||
radius: 32
|
||||
height: image.height + image.height / 5
|
||||
width: image.width + startPlayingText.width * 1.2
|
||||
radius: height / 2
|
||||
border.width: 2
|
||||
border.color: "white"
|
||||
color: startPlayingMouseArea.containsMouse ? "blue" : "gray"
|
||||
@@ -131,12 +132,13 @@ Item {
|
||||
}
|
||||
|
||||
Text {
|
||||
id: startPlayingText
|
||||
color: "white"
|
||||
font.pixelSize: 24
|
||||
font.pointSize: 20
|
||||
anchors.left: image.right
|
||||
anchors.margins: 10
|
||||
anchors.margins: height / 5
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
width: parent.width - 30 - image.width
|
||||
//width: parent.width - 30 - image.width
|
||||
elide: Text.ElideRight
|
||||
text: "Start playing"
|
||||
}
|
||||
@@ -150,21 +152,21 @@ Item {
|
||||
|
||||
Text {
|
||||
color: "white"
|
||||
font.pixelSize: 24
|
||||
font.pointSize: 16
|
||||
width: parent.width
|
||||
elide: Text.ElideRight
|
||||
text: coverView.model.itemFromIndex( currentlyPlayedIndex ).name
|
||||
}
|
||||
Text {
|
||||
color: "white"
|
||||
font.pixelSize: 20
|
||||
font.pointSize: 14
|
||||
width: parent.width
|
||||
elide: Text.ElideRight
|
||||
text: coverView.model.itemFromIndex( currentlyPlayedIndex ).artistName
|
||||
}
|
||||
Text {
|
||||
color: "white"
|
||||
font.pixelSize: 20
|
||||
font.pointSize: 14
|
||||
width: parent.width
|
||||
elide: Text.ElideRight
|
||||
text: coverView.model.itemFromIndex( currentlyPlayedIndex ).albumName
|
||||
@@ -172,29 +174,13 @@ Item {
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
Button {
|
||||
id: configureButton
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.bottomMargin: 20
|
||||
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: {
|
||||
root.configure();
|
||||
}
|
||||
}
|
||||
text: "configure"
|
||||
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/StationConfig.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>
|
||||
</RCC>
|
||||
|
@@ -1,4 +1,5 @@
|
||||
#include "EchonestStation.h"
|
||||
#include "dynamic/DynamicPlaylist.h"
|
||||
|
||||
#include "PlayableItem.h"
|
||||
#include "audio/AudioEngine.h"
|
||||
@@ -6,28 +7,28 @@
|
||||
namespace Tomahawk
|
||||
{
|
||||
|
||||
EchonestStation::EchonestStation( PlayableProxyModel *model, geninterface_ptr generator, QObject *parent )
|
||||
EchonestStation::EchonestStation( PlayableProxyModel *model, dynplaylist_ptr playlist, QObject *parent )
|
||||
: QObject( parent )
|
||||
, m_name( model->sourceModel()->title() )
|
||||
, m_model( model )
|
||||
, m_generator( generator )
|
||||
, m_playlist( playlist )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
QString EchonestStation::name() const
|
||||
{
|
||||
return m_name;
|
||||
return m_playlist->title();
|
||||
}
|
||||
|
||||
void EchonestStation::setName(const QString &name)
|
||||
{
|
||||
m_name = name;
|
||||
m_playlist->setTitle( name );
|
||||
emit nameChanged();
|
||||
}
|
||||
|
||||
Tomahawk::DynamicControl* EchonestStation::mainControl() {
|
||||
foreach(dyncontrol_ptr control, m_generator->controls()) {
|
||||
foreach(dyncontrol_ptr control, m_playlist->generator()->controls()) {
|
||||
qDebug() << "got control" << control->selectedType();
|
||||
if(control->selectedType() == "Artist" || control->selectedType() == "Style") {
|
||||
return control.data();
|
||||
@@ -54,12 +55,12 @@ void EchonestStation::playItem(int row)
|
||||
|
||||
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->setMatch("1");
|
||||
control->setInput(type);
|
||||
qDebug() << "created control" << control->type() << control->selectedType() << control->match();
|
||||
m_generator->generate(20);
|
||||
m_playlist->generator()->generate(20);
|
||||
|
||||
emit configuredChanged();
|
||||
}
|
||||
|
@@ -14,7 +14,7 @@ class EchonestStation: public QObject
|
||||
Q_PROPERTY( Tomahawk::DynamicControl* mainControl READ mainControl )
|
||||
|
||||
public:
|
||||
EchonestStation( PlayableProxyModel *model, geninterface_ptr generator, QObject *parent = 0);
|
||||
EchonestStation( PlayableProxyModel *model, dynplaylist_ptr playlist, QObject *parent = 0);
|
||||
|
||||
QString name() const;
|
||||
void setName( const QString &name );
|
||||
@@ -34,7 +34,7 @@ signals:
|
||||
private:
|
||||
QString m_name;
|
||||
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);
|
||||
|
||||
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( "controlModel", controls );
|
||||
rootContext()->setContextProperty( "dynamicModel", m_proxyModel );
|
||||
@@ -134,7 +134,6 @@ DynamicQmlWidget::jumpToCurrentTrack()
|
||||
void DynamicQmlWidget::currentItemChanged( const QPersistentModelIndex ¤tIndex )
|
||||
{
|
||||
rootContext()->setContextProperty( "currentlyPlayedIndex", m_proxyModel->mapFromSource( currentIndex ).row() );
|
||||
m_playlist->generator()->fetchNext();
|
||||
}
|
||||
|
||||
void
|
||||
@@ -143,9 +142,6 @@ DynamicQmlWidget::tracksGenerated( const QList< query_ptr >& queries )
|
||||
qDebug() << queries.count() << "tracks generated";
|
||||
m_model->tracksGenerated( queries, queries.count() );
|
||||
m_playlist->resolve();
|
||||
|
||||
// Ok... we have some intial stuff, switch to dynamic mode
|
||||
//m_model->startOnDemand();
|
||||
}
|
||||
|
||||
void DynamicQmlWidget::nextTrackGenerated(const query_ptr &track)
|
||||
|
Reference in New Issue
Block a user