Commit f20343f5 authored by Mike Sheldon's avatar Mike Sheldon

Add support for orientation changes to the MeeGo client

parent 3f8e8b16
......@@ -18,12 +18,12 @@ Page {
anchors.centerIn: parent
Label {
text: "Libre.fm MeeGo Client Version 0.1"
text: "Libre.fm MeeGo Client 0.1"
font.pixelSize: 34
}
Label {
text: "Released under the GPL, version 3.0 or later."
text: "Released under the GPL 3.0 or later."
}
Label {
......
......@@ -16,6 +16,10 @@ Page {
msg_logging_in.close();
rootWin.openFile("MenuPage.qml");
}
onLoggingIn: {
msg_logging_in.open();
}
}
Image {
......@@ -28,7 +32,8 @@ Page {
Column {
spacing: 10
anchors.centerIn: parent
anchors.verticalCenterOffset: 15
anchors.verticalCenterOffset: 40
width: 400
TextField {
id: txt_username
......@@ -43,21 +48,18 @@ Page {
width: parent.width
}
Row {
spacing: 10
Button {
text: "Login"
onClicked: {
msg_logging_in.open()
rootWin.login(txt_username.text, txt_password.text)
}
Button {
text: "Login"
onClicked: {
rootWin.login(txt_username.text, txt_password.text)
}
width: parent.width
}
Button {
text: "Quit"
onClicked: Qt.quit()
}
Button {
text: "Quit"
onClicked: Qt.quit()
width: parent.width
}
}
......
......@@ -7,18 +7,66 @@ Page {
Image {
id: towerImg
anchors.centerIn: parent
anchors.horizontalCenter: parent.horizontalCenter
source: "librefm-tower.png"
z: -1
}
states: [
State {
name: "inLandscape"
when: !rootWin.inPortrait
PropertyChanges {
target: grid_menus
rows: 1
columns: 2
spacing: 200
anchors.verticalCenterOffset: 50
anchors.horizontalCenterOffset: -60
}
},
State {
name: "inPortrait"
when: rootWin.inPortrait
PropertyChanges {
target: grid_menus
anchors.verticalCenterOffset: -72
anchors.horizontalCenterOffset: 0
rows: 2
columns: 1
spacing: 50
}
}
]
Grid {
rows: screen.orientation == Screen.Landscape || screen.orientation == Screen.LandscapeInverted ? 2 : 1
id: grid_menus
anchors.verticalCenter: parent.verticalCenter
anchors.verticalCenterOffset: 40
anchors.horizontalCenter: parent.horizontalCenter
spacing: 300
Column {
id: col_buttons
spacing: 20
Button {
text: "New Station"
}
Button {
text: "Preferences"
}
Button {
text: "About"
onClicked: rootWin.openFile("About.qml")
}
Button {
text: "Quit"
onClicked: Qt.quit()
}
}
Column {
id: col_recent
......@@ -108,28 +156,5 @@ Page {
}
}
Column {
id: col_buttons
spacing: 20
Button {
text: "New Station"
}
Button {
text: "Preferences"
}
Button {
text: "About"
onClicked: rootWin.openFile("About.qml")
}
Button {
text: "Quit"
onClicked: Qt.quit()
}
}
}
}
......@@ -26,6 +26,42 @@ Page {
}
states: [
State {
name: "inLandscape"
when: !rootWin.inPortrait
PropertyChanges {
target: grid_details
rows: 1
columns: 2
}
PropertyChanges {
target: col_details
anchors.verticalCenterOffset: 0
}
PropertyChanges {
target: imgCover
anchors.horizontalCenterOffset: -250
}
},
State {
name: "inPortrait"
when: rootWin.inPortrait
PropertyChanges {
target: grid_details
rows: 2
columns: 1
}
PropertyChanges {
target: col_details
anchors.verticalCenterOffset: 100
}
PropertyChanges {
target: imgCover
anchors.horizontalCenterOffset: 0
}
}
]
Column {
anchors.horizontalCenter: parent.horizontalCenter
......@@ -48,17 +84,20 @@ Page {
font.pixelSize: 30
}
Row {
Grid {
id: grid_details
spacing: 50
anchors.horizontalCenter: parent.horizontalCenter
Image {
Image {
id: imgCover
anchors.horizontalCenter: parent.horizontalCenter
source: "empty-album.png"
height: 200
width: 200
}
Column {
id: col_details
spacing: 40
anchors.verticalCenter: parent.verticalCenter
Row {
......@@ -83,104 +122,105 @@ Page {
}
ButtonRow {
exclusive: false
}
ButtonRow {
exclusive: false
anchors.bottom: parent.bottom
Button {
id: btnBan
Image {
anchors.centerIn: parent
anchors.verticalCenterOffset: -1
source: "ban.png"
}
onClicked: {
rootWin.ban();
rootWin.next();
}
Button {
id: btnBan
Image {
anchors.centerIn: parent
anchors.verticalCenterOffset: -1
source: "ban.png"
}
onClicked: {
rootWin.ban();
rootWin.next();
}
}
Button {
id: btnTag
Image {
anchors.centerIn: parent
source: "image://theme/icon-m-toolbar-tag" + (theme.inverted ? "-inverse" : "")
}
Button {
id: btnTag
Image {
anchors.centerIn: parent
source: "image://theme/icon-m-toolbar-tag" + (theme.inverted ? "-inverse" : "")
}
}
Button {
id: btnPrevious
Image {
anchors.centerIn: parent
source: "image://theme/icon-m-toolbar-mediacontrol-previous" + (theme.inverted ? "-inverse" : "")
}
onClicked: {
rootWin.prev();
}
Button {
id: btnPrevious
Image {
anchors.centerIn: parent
source: "image://theme/icon-m-toolbar-mediacontrol-previous" + (theme.inverted ? "-inverse" : "")
}
onClicked: {
rootWin.prev();
}
}
Button {
id: btnPlay
property bool playing: false;
Image {
id: imgPlay
anchors.centerIn: parent
visible: false
source: "image://theme/icon-m-toolbar-mediacontrol-play" + (theme.inverted ? "-inverse" : "")
}
Button {
id: btnPlay
property bool playing: false;
Image {
id: imgPlay
anchors.centerIn: parent
visible: false
source: "image://theme/icon-m-toolbar-mediacontrol-play" + (theme.inverted ? "-inverse" : "")
}
Image {
id: imgPause
anchors.centerIn: parent
source: "image://theme/icon-m-toolbar-mediacontrol-pause" + (theme.inverted ? "-inverse" : "")
}
Image {
id: imgPause
anchors.centerIn: parent
source: "image://theme/icon-m-toolbar-mediacontrol-pause" + (theme.inverted ? "-inverse" : "")
onClicked: {
if (imgPlay.visible) {
rootWin.play();
imgPlay.visible = false;
imgPause.visible = true;
} else {
rootWin.pause();
imgPlay.visible = true;
imgPause.visible = false;
}
}
onClicked: {
if (imgPlay.visible) {
rootWin.play();
imgPlay.visible = false;
imgPause.visible = true;
} else {
rootWin.pause();
imgPlay.visible = true;
imgPause.visible = false;
}
}
}
Button {
id: btnNext
Image {
anchors.centerIn: parent
source: "image://theme/icon-m-toolbar-mediacontrol-next" + (theme.inverted ? "-inverse" : "")
}
Button {
id: btnNext
Image {
anchors.centerIn: parent
source: "image://theme/icon-m-toolbar-mediacontrol-next" + (theme.inverted ? "-inverse" : "")
}
onClicked: {
rootWin.next();
}
onClicked: {
rootWin.next();
}
}
Button {
id: btnSave
Image {
anchors.centerIn: parent
source: "image://theme/icon-m-common-save-as" + (theme.inverted ? "-inverse" : "")
scale: 0.8
}
Button {
id: btnSave
Image {
anchors.centerIn: parent
source: "image://theme/icon-m-common-save-as" + (theme.inverted ? "-inverse" : "")
scale: 0.8
}
}
Button {
id: btnLove
Image {
anchors.centerIn: parent
anchors.verticalCenterOffset: -1
source: "love.png"
}
onClicked: {
rootWin.love();
}
Button {
id: btnLove
Image {
anchors.centerIn: parent
anchors.verticalCenterOffset: -1
source: "love.png"
}
onClicked: {
rootWin.love();
}
}
}
......
......@@ -15,6 +15,14 @@ PageStackWindow {
signal love()
signal ban()
Connections {
target: serverComm
onLoginNeeded: {
openFile("LoginPage.qml");
}
}
function openFile(file) {
var component = Qt.createComponent(file)
if (component.status == Component.Ready)
......
......@@ -21,8 +21,8 @@ int main(int argc, char *argv[])
QApplication app(argc, argv);
app.setApplicationName("Libre.fm");
QDeclarativeView view;
view.setSource(QUrl::fromLocalFile("src/librefm.qml"));
//view.setSource(QUrl::fromLocalFile(DATADIR "/librefm/librefm.qml"));
//view.setSource(QUrl::fromLocalFile("src/librefm.qml"));
view.setSource(QUrl::fromLocalFile(DATADIR "/librefm/librefm.qml"));
QObject *root = (QObject*)(view.rootObject());
ServerComm sc;
......
......@@ -29,6 +29,8 @@ ServerComm::ServerComm(QObject *parent) :
qDebug() << "Logging in...";
login(settings->value("Auth/username").toString(), settings->value("Auth/password").toString());
qDebug() << "Username:" << settings->value("Auth/username").toString();
} else {
qDebug() << "Login needed";
}
}
......@@ -38,6 +40,7 @@ void ServerComm::login(const QString &username, const QString &password) {
loginFailed();
return;
}
loggingIn();
QString passMD5 = QCryptographicHash::hash(QByteArray(password.toAscii()), QCryptographicHash::Md5).toHex();
long timestamp = QDateTime::currentDateTime().toTime_t();
QString token = QCryptographicHash::hash(QByteArray(QString(QString(passMD5) + QString::number(timestamp)).toAscii()), QCryptographicHash::Md5).toHex();
......
......@@ -30,8 +30,10 @@ private:
void parseTrack(QDomNode trackNode);
signals:
void loggingIn();
void loginFailed();
void loginSuccessful();
void loginNeeded();
void tuned(QString stationName);
void playing(QString artist, QString album, QString title, QString imageurl);
void positionUpdate(double position);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment