Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gnu-fm
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
16
Issues
16
List
Boards
Labels
Milestones
Merge Requests
7
Merge Requests
7
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gnu.io
gnu-fm
Commits
3ace5cb6
Commit
3ace5cb6
authored
Jul 01, 2011
by
Mike Sheldon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make the MeeGo client remember user details and login automatically.
parent
5f73243e
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
51 additions
and
25 deletions
+51
-25
clients/meego/librefm/debian/copyright
clients/meego/librefm/debian/copyright
+2
-4
clients/meego/librefm/src/Makefile
clients/meego/librefm/src/Makefile
+3
-13
clients/meego/librefm/src/MenuPage.qml
clients/meego/librefm/src/MenuPage.qml
+1
-1
clients/meego/librefm/src/librefm.qml
clients/meego/librefm/src/librefm.qml
+1
-1
clients/meego/librefm/src/main.cpp
clients/meego/librefm/src/main.cpp
+14
-2
clients/meego/librefm/src/servercomm.cpp
clients/meego/librefm/src/servercomm.cpp
+27
-3
clients/meego/librefm/src/servercomm.h
clients/meego/librefm/src/servercomm.h
+3
-1
No files found.
clients/meego/librefm/debian/copyright
View file @
3ace5cb6
...
...
@@ -4,7 +4,7 @@ This package was debianized by:
It was downloaded from:
<url://example.com or remove>
http://libre.fm
Upstream Author(s):
...
...
@@ -16,11 +16,9 @@ Copyright:
License:
<specify license>
GPL 3.0 or later
The Debian packaging is:
Copyright C) 2011, Michael Sheldon <elleo@gnu.org>
<specify license of debianized version or remove>
clients/meego/librefm/src/Makefile
View file @
3ace5cb6
#############################################################################
# Makefile for building: librefm
# Generated by qmake (2.01a) (Qt 4.7.4) on: Fri Jul 1
02:15:31
2011
# Generated by qmake (2.01a) (Qt 4.7.4) on: Fri Jul 1
12:21:52
2011
# Project: src.pro
# Template: app
# Command: /usr/bin/qmake -o Makefile src.pro
...
...
@@ -243,16 +243,6 @@ uninstall_desktop: FORCE
-
$(DEL_DIR)
$(INSTALL_ROOT)
/usr/share/applications/
install_icon64
:
first FORCE
@
$(CHK_DIR_EXISTS)
$(INSTALL_ROOT)
/usr/share/icons/hicolor/64x64/apps/
||
$(MKDIR)
$(INSTALL_ROOT)
/usr/share/icons/hicolor/64x64/apps/
-
$(INSTALL_FILE)
/scratchbox/users/mike/home/mike/scratchbox/src/Libre.fm/librefm-0.1/data/64x64/librefm.png
$(INSTALL_ROOT)
/usr/share/icons/hicolor/64x64/apps/
uninstall_icon64
:
FORCE
-
$(DEL_FILE)
-r
$(INSTALL_ROOT)
/usr/share/icons/hicolor/64x64/apps/librefm.png
-
$(DEL_DIR)
$(INSTALL_ROOT)
/usr/share/icons/hicolor/64x64/apps/
install_iconScale
:
first FORCE
@
$(CHK_DIR_EXISTS)
$(INSTALL_ROOT)
/usr/share/icons/hicolor/scalable/apps/
||
$(MKDIR)
$(INSTALL_ROOT)
/usr/share/icons/hicolor/scalable/apps/
-
$(INSTALL_FILE)
/scratchbox/users/mike/home/mike/scratchbox/src/Libre.fm/librefm-0.1/data/scalable/librefm.svg
$(INSTALL_ROOT)
/usr/share/icons/hicolor/scalable/apps/
...
...
@@ -279,9 +269,9 @@ uninstall_image: FORCE
-
$(DEL_DIR)
$(INSTALL_ROOT)
/usr/share/librefm/
install
:
install_target install_qmlgui install_desktop install_icon
64 install_icon
Scale install_image FORCE
install
:
install_target install_qmlgui install_desktop install_iconScale install_image FORCE
uninstall
:
uninstall_target uninstall_qmlgui uninstall_desktop uninstall_icon
64 uninstall_icon
Scale uninstall_image FORCE
uninstall
:
uninstall_target uninstall_qmlgui uninstall_desktop uninstall_iconScale uninstall_image FORCE
FORCE
:
clients/meego/librefm/src/MenuPage.qml
View file @
3ace5cb6
...
...
@@ -100,7 +100,7 @@ Page {
anchors.fill
:
background
onClicked
:
{
rootWin
.
openFile
(
"
StationPage.qml
"
)
rootWin
.
launch
Station
(
station
)
rootWin
.
tune
Station
(
station
)
}
}
}
...
...
clients/meego/librefm/src/librefm.qml
View file @
3ace5cb6
...
...
@@ -7,7 +7,7 @@ PageStackWindow {
initialPage
:
LoginPage
{
}
signal
login
(
string
username
,
string
password
)
signal
launch
Station
(
string
station
)
signal
tune
Station
(
string
station
)
function
openFile
(
file
)
{
var
component
=
Qt
.
createComponent
(
file
)
...
...
clients/meego/librefm/src/main.cpp
View file @
3ace5cb6
#include <QApplication>
#include <QDeclarativeContext>
#include <QDeclarativeView>
#include <QDebug>
#include <iostream>
#include "servercomm.h"
void
msgHandler
(
QtMsgType
type
,
const
char
*
msg
)
{
const
char
symbols
[]
=
{
'I'
,
'E'
,
'!'
,
'X'
};
QString
output
=
QString
(
"[%1] %2"
).
arg
(
symbols
[
type
]
).
arg
(
msg
);
std
::
cerr
<<
output
.
toStdString
()
<<
std
::
endl
;
if
(
type
==
QtFatalMsg
)
abort
();
}
int
main
(
int
argc
,
char
*
argv
[])
{
qInstallMsgHandler
(
msgHandler
);
QApplication
app
(
argc
,
argv
);
QDeclarativeView
view
;
view
.
setSource
(
QUrl
::
fromLocalFile
(
"src/librefm.qml"
));
...
...
@@ -15,7 +27,7 @@ int main(int argc, char *argv[])
ServerComm
sc
;
view
.
rootContext
()
->
setContextProperty
(
"serverComm"
,
&
sc
);
QObject
::
connect
(
root
,
SIGNAL
(
login
(
QString
,
QString
)),
&
sc
,
SLOT
(
login
(
QString
,
QString
)));
QObject
::
connect
(
root
,
SIGNAL
(
launchStation
(
QString
,
QString
)),
&
sc
,
SLOT
(
launchStation
(
QString
,
QString
)));
QObject
::
connect
(
root
,
SIGNAL
(
tuneStation
(
QString
)),
&
sc
,
SLOT
(
tuneStation
(
QString
)));
QObject
::
connect
((
QObject
*
)
view
.
engine
(),
SIGNAL
(
quit
()),
&
app
,
SLOT
(
quit
()));
view
.
showFullScreen
();
...
...
clients/meego/librefm/src/servercomm.cpp
View file @
3ace5cb6
...
...
@@ -12,10 +12,23 @@ ServerComm::ServerComm(QObject *parent) :
{
hs_url
=
"http://turtle.libre.fm/"
;
ws_url
=
"http://alpha.libre.fm/2.0/"
;
settings
=
new
QSettings
(
"Libre.fm"
,
"Libre.fm"
);
// Check login details
qDebug
()
<<
"Checking settings..."
;
if
(
settings
->
contains
(
"Auth/username"
)
&&
settings
->
contains
(
"Auth/password"
))
{
qDebug
()
<<
"Logging in..."
;
login
(
settings
->
value
(
"Auth/username"
).
toString
(),
settings
->
value
(
"Auth/password"
).
toString
());
qDebug
()
<<
"Username:"
<<
settings
->
value
(
"Auth/username"
).
toString
();
}
}
void
ServerComm
::
login
(
const
QString
&
username
,
const
QString
&
password
)
{
qDebug
()
<<
"Logging in..."
;
if
(
username
.
isEmpty
()
||
password
.
isEmpty
())
{
loginFailed
();
return
;
}
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
();
...
...
@@ -41,6 +54,10 @@ void ServerComm::login(const QString &username, const QString &password) {
url
.
addQueryItem
(
"authToken"
,
wstoken
);
qDebug
()
<<
"AuthToken:"
<<
wstoken
;
ws_netman
->
get
(
QNetworkRequest
(
url
));
// Save authentication details
settings
->
setValue
(
"Auth/username"
,
username
);
settings
->
setValue
(
"Auth/password"
,
password
);
}
void
ServerComm
::
scrobbleLoginReply
(
QNetworkReply
*
reply
)
{
...
...
@@ -72,7 +89,6 @@ void ServerComm::wsLoginReply(QNetworkReply *reply) {
for
(
QDomNode
n
=
root
.
firstChild
();
!
n
.
isNull
();
n
=
n
.
nextSibling
())
{
QDomElement
e
=
n
.
toElement
();
if
(
!
e
.
isNull
())
{
qDebug
()
<<
"Tag:"
<<
e
.
tagName
();
if
(
e
.
tagName
()
==
"error"
)
{
loginFailed
();
return
;
...
...
@@ -94,6 +110,14 @@ void ServerComm::wsLoginReply(QNetworkReply *reply) {
}
}
void
ServerComm
::
launchStation
(
const
QString
&
station
)
{
qDebug
()
<<
"Launching station: "
<<
station
;
void
ServerComm
::
tuneStation
(
const
QString
&
station
)
{
qDebug
()
<<
"Tuning to station: "
<<
station
;
QNetworkAccessManager
*
tune_netman
=
new
QNetworkAccessManager
(
this
);
connect
(
tune_netman
,
SIGNAL
(
finished
(
QNetworkReply
*
)),
this
,
SLOT
(
tuneReply
(
QNetworkReply
*
)));
QUrl
url
=
QUrl
(
ws_url
);
url
.
addQueryItem
(
"method"
,
"radio.tune"
);
url
.
addQueryItem
(
"sk"
,
ws_sk
);
url
.
addQueryItem
(
"station"
,
station
);
tune_netman
->
get
(
QNetworkRequest
(
url
));
}
clients/meego/librefm/src/servercomm.h
View file @
3ace5cb6
...
...
@@ -3,6 +3,7 @@
#include <QObject>
#include <QString>
#include <QSettings>
#include <QtNetwork/QNetworkAccessManager>
class
ServerComm
:
public
QObject
...
...
@@ -18,6 +19,7 @@ private:
QString
scr_url
;
QString
hs_url
;
QString
ws_url
;
QSettings
*
settings
;
signals:
void
loginFailed
();
...
...
@@ -25,7 +27,7 @@ signals:
public
slots
:
void
login
(
const
QString
&
username
,
const
QString
&
password
);
void
launch
Station
(
const
QString
&
station
);
void
tune
Station
(
const
QString
&
station
);
void
wsLoginReply
(
QNetworkReply
*
reply
);
void
scrobbleLoginReply
(
QNetworkReply
*
reply
);
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment