...
 
Commits (30)
......@@ -104,6 +104,8 @@ set(juk_SRCS ${tunepimp_SRCS}
statuslabel.cpp
stringshare.cpp
systemtray.cpp
sync/syncplayer.cpp
sync/synclist.cpp
tag.cpp
tageditor.cpp
tagguesser.cpp
......@@ -143,6 +145,7 @@ if(NOT MSVC AND NOT ( WIN32 AND "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel" ) )
endif(NOT MSVC AND NOT ( WIN32 AND "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel" ) )
target_link_libraries(juk ${LIBMATH} ${KDE4_KHTML_LIBS} ${TAGLIB_LIBRARIES} ${KDE4_KDE3SUPPORT_LIBS} ${KDE4_PHONON_LIBS})
target_link_libraries(juk ${KDE4_SOLID_LIBS})
if(TUNEPIMP_FOUND)
target_link_libraries(juk ${TUNEPIMP_LIBRARIES})
endif(TUNEPIMP_FOUND)
......
......@@ -179,10 +179,14 @@ void JuK::setupLayout()
m_splitter = new PlaylistSplitter(m_player, this);
setCentralWidget(m_splitter);
m_syncList = new SyncList(this);
//m_splitter->addWidget(m_syncList);
m_statusLabel = new StatusLabel(m_splitter->playlist(), statusBar());
connect(CollectionList::instance(), SIGNAL(signalCollectionChanged()),
m_statusLabel, SLOT(updateData()));
statusBar()->addWidget(m_statusLabel, 1);
//statusBar()->addWidget(m_syncList,1);
m_player->setStatusLabel(m_statusLabel);
m_splitter->setFocus();
......@@ -560,6 +564,7 @@ void JuK::slotAboutToQuit()
deleteAndClear(m_splitter);
deleteAndClear(m_player);
deleteAndClear(m_statusLabel);
//deleteAndClear(m_syncList);
// Playlists depend on CoverManager, so CoverManager should shutdown as
// late as possible
......
......@@ -20,6 +20,7 @@
#include <kxmlguiwindow.h>
#include "playermanager.h"
#include "sync/synclist.h"
#include <QKeyEvent>
......@@ -87,6 +88,7 @@ private:
PlaylistSplitter *m_splitter;
StatusLabel *m_statusLabel;
SystemTray *m_systemTray;
SyncList *m_syncList;
KToggleAction *m_randomPlayAction;
KToggleAction *m_toggleSystemTrayAction;
......
......@@ -27,6 +27,7 @@
<Action name="showSearch"/>
<Action name="showEditor"/>
<Action name="showLyrics"/>
<Action name="showPlayers"/>
<Action name="showHistory"/>
<Action name="showUpcoming"/>
<Action name="showColumns"/>
......
......@@ -29,6 +29,7 @@
<Action name="showSearch"/>
<Action name="showEditor"/>
<Action name="showLyrics"/>
<Action name="showPlayers"/>
<Action name="showHistory"/>
<Action name="showUpcoming"/>
<Action name="showColumns"/>
......
......@@ -225,7 +225,7 @@ void PlayerManager::play(const FileHandle &file)
// The "currently playing" media object.
Phonon::MediaObject *mediaObject = m_media[m_curOutputPath];
if(file.isNull()) {
if(paused())
mediaObject->play();
......@@ -540,13 +540,13 @@ void PlayerManager::slotStateChanged(Phonon::State newstate, Phonon::State oldst
action("forwardAlbum")->setEnabled(true);
action("back")->setEnabled(true);
JuK::JuKInstance()->setWindowTitle(i18nc(
"%1 is the artist and %2 is the title of the currently playing track.",
"%1 - %2 :: JuK",
m_file.tag()->artist(),
"%1 is the artist and %2 is the title of the currently playing track.",
"%1 - %2 :: JuK",
m_file.tag()->artist(),
m_file.tag()->title()));
emit signalPlay();
}
}
......
/***************************************************************************
begin : Wed Oct 16 2013
copyright : (C) 2013 by Shubham Chaudhary
email : shubham.chaudhary@kdemail.net
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#include <KDebug>
#include <Solid/Block>
#include <Solid/Device>
#include <Solid/OpticalDisc>
#include <Solid/StorageAccess>
#include <Solid/StorageVolume>
#include <Solid/PortableMediaPlayer>
#include <Solid/DeviceNotifier>
#include "sync/synclist.h"
#include "sync/syncplayer.h"
#include "actioncollection.h"
#include "filehandle.h"
#include "playlist.h"
#include "playlistbox.h"
#include "playermanager.h"
#include "playlistitem.h"
#include "playlistinterface.h"
#include <QStackedWidget>
SyncList::SyncList(QWidget* parent)//: PlaylistBox(player,parent,stack)
{
listDevices();
/*
QStackedWidget *stack = new QStackedWidget();
PlayerManager *playerManager = new PlayerManager();
PlaylistCollection *collection = new PlaylistCollection(playerManager,stack);
Playlist *playlist = new Playlist(collection,"YOYOYO");
PlaylistBox *player = new PlaylistBox(playerManager,this,stack);
//PlaylistBox::Item *itemParent = PlaylistBox::Item::collectionItem();
PlaylistBox::Item *item;
item = new PlaylistBox::Item(player,"media-optical-audio", i18n("Chaudhary"));
*/
}
SyncList::~SyncList()
{
}
void SyncList::setUrl(const KUrl &url){
qDebug()<<url;
}
void SyncList::setUdi(const QString& udi)
{
//setDataValue("udi", udi);
}
QString SyncList::udi() const
{
//return dataValue("udi").toString();
return 0;
}
/*
* Return the selected device
*/
Solid::Device SyncList::device() const
{
return m_device;
}
/*
* Find out all the devices available on the system
*/
void SyncList::listDevices(){
//Solid::DeviceNotifier *notifierObj= Solid::DeviceNotifier::instance();
//Full Device List
//foreach(Solid::Device device, Solid::Device::allDevices()){
//Portable Media Player List
foreach(Solid::Device device, Solid::Device::listFromType(Solid::DeviceInterface::StorageDrive,QString())){
qDebug() << device.udi()<< "Product" << device.product() << "Vendor" << device.vendor() << device.description();
Solid::Block *blk = device.as<Solid::Block>();
qDebug() << "Blk Device: " << blk->device();
}
//Portable Media Player List
foreach(Solid::Device device, Solid::Device::listFromType(Solid::DeviceInterface::PortableMediaPlayer,QString())){
qDebug() << device.udi()<< "Product" << device.product() << "Vendor" << device.vendor() << device.description();
Solid::PortableMediaPlayer *player = device.as<Solid::PortableMediaPlayer>();
qDebug() << "PMediaP Supported Protocols: " << player->supportedProtocols();
}
//temporary
QList<Solid::Device> list = Solid::Device::listFromType(Solid::DeviceInterface::PortableMediaPlayer,QString());
m_player = new SyncPlayer(this,list.first().udi());
}
/*
* Show the available devices in UI
*/
void SyncList::placeDevices(){
//
}
void SyncList::initializeDevice(const QString& udi)
{
m_device = Solid::Device(udi);
if (!m_device.isValid()) {
return;
}
m_access = m_device.as<Solid::StorageAccess>();
m_volume = m_device.as<Solid::StorageVolume>();
m_disc = m_device.as<Solid::OpticalDisc>();
m_mtp = m_device.as<Solid::PortableMediaPlayer>();
//setText(m_device.description());
//setIcon(m_device.icon());
//setIconOverlays(m_device.emblems());
//setUdi(udi);
if (m_access) {
setUrl(m_access->filePath());
//QObject::connect(m_access, SIGNAL(accessibilityChanged(bool,QString)),
// m_signalHandler, SLOT(onAccessibilityChanged()));
} else if (m_disc) {
Solid::Block *block = m_device.as<Solid::Block>();
if (block) {
const QString device = block->device();
setUrl(QString("audiocd:/?device=%1").arg(device));
} else {
setUrl(QString("audiocd:/"));
}
} else if (m_mtp) {
setUrl(QString("mtp:udi=%1").arg(m_device.udi()));
}
}
// vim: set et sw=4 tw=0 sta:
/***************************************************************************
begin : Web Oct 16 2013
copyright : (C) 2013 by Shubham Chaudhary
email : shubham.chaudhary@kdemail.net
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef SYNCLIST_H
#define SYNCLIST_H
#include <QLabel>
#include <QPointer>
#include <Solid/Device>
#include <Solid/OpticalDisc>
#include <Solid/StorageAccess>
#include <Solid/StorageVolume>
#include <Solid/PortableMediaPlayer>
#include <KListWidget>
#include <KUrl>
#include <KVBox>
#include <Solid/Device>
#include <Solid/OpticalDisc>
#include <Solid/StorageAccess>
#include <Solid/StorageVolume>
#include <Solid/PortableMediaPlayer>
#include "sync/syncplayer.h"
#include "playlistbox.h"
class QNetworkAccessManager;
class QNetworkReply;
/*
class SyncListItem : public PlaylistItem
{
};
*/
/*
* Create and maintain list showing available players
*
*/
class SyncList : public QWidget //PlaylistBox
{
Q_OBJECT
public:
explicit SyncList (QWidget *parent=0);
virtual ~SyncList();
QSize minimumSize() const { return QSize(100, 0); }
void displayList();
void setUrl(const KUrl& url);
KUrl url() const;
void setUdi(const QString& udi);
QString udi() const;
Solid::Device device() const; //return m_device
public Q_SLOTS:
//void newDevice();
//void showFiles(QString udi);
void callCopy(){ listDevices(); m_player->sync_in_stub(); }
protected:
private:
void listDevices();
void placeDevices();
void initializeDevice(const QString& udi);
void togglePlayer(bool show);
private:
Solid::Device m_device;
QPointer<Solid::StorageAccess> m_access;
QPointer<Solid::StorageVolume> m_volume;
QPointer<Solid::OpticalDisc> m_disc;
QPointer<Solid::PortableMediaPlayer> m_mtp;
SyncPlayer *m_player;
//temp
PlayerManager *player;
QStackedWidget *stack;
};
#endif//SYNCLIST_H
/***************************************************************************
begin : Wed Oct 16 2013
copyright : (C) 2013 by Shubham Chaudhary
email : shubham.chaudhary@kdemail.net
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#include "sync/syncplayer.h"
SyncPlayer::SyncPlayer(QWidget* parent, QString udi)
{
m_player_udi = udi;
}
SyncPlayer::~SyncPlayer()
{
}
void SyncPlayer::sync_in_stub(){
//PlaylistItem *playingItem = Playlist::playingItem();
//FileHandle playingFile = playingItem->file();
//kDebug()<<"File path: "<<playingFile.absFilePath();
KUrl::List srcList = KFileDialog::getOpenUrls();
KUrl dest = KUrl("file:///tmp/myJuK");
qDebug()<<"Calling through Stub";
}
/*
* Sync Into the computer from device
*/
bool sync_in(PlaylistItem *items){
// foreach(PlaylistItem *item, items) {
// urls << KUrl::fromPath(item->file().absFilePath());
// }
return true;
}
bool copy_in(KUrl src, KUrl dest){
//qDebug() << "src= " << src << "\ndest=" << dest;
KIO::FileCopyJob *theJob = KIO::file_copy(src,dest);
theJob->start();
// foreach(PlaylistItem *item, items) {
// urls << KUrl::fromPath(item->file().absFilePath());
// }
return true;
}
bool copy_in(KUrl::List srcList, KUrl dest){
//qDebug() << "src= " << src << "\ndest=" << dest;
foreach (KUrl src, srcList) {
qDebug()<<"Copying: "<<src;
KIO::FileCopyJob *theJob = KIO::file_copy(src,dest);
theJob->start();
}
// foreach(PlaylistItem *item, items) {
// urls << KUrl::fromPath(item->file().absFilePath());
// }
return true;
}
// vim: set et sw=4 tw=0 sta:
/***************************************************************************
begin : Web Oct 16 2013
copyright : (C) 2013 by Shubham Chaudhary
email : shubham.chaudhary@kdemail.net
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef SYNCPLAYER_H
#define SYNCPLAYER_H
#include <KListWidget>
#include <KAction>
#include <KActionCollection>
#include <KConfigGroup>
#include <KDebug>
#include <KFileDialog>
#include <KIO/Job>
#include <KLocalizedString>
#include <KToggleAction>
#include <KSqueezedTextLabel>
#include <kpushbutton.h>
#include <kiconloader.h>
#include <QLabel>
#include <QFrame>
#include <QVBoxLayout>
#include "actioncollection.h"
#include "filehandle.h"
#include "playlist.h"
#include "playlistitem.h"
#include "playlistinterface.h"
class QNetworkAccessManager;
class QNetworkReply;
/*
* Perform operation on the selected player
*
*/
class SyncPlayer: public QWidget
{
Q_OBJECT
public:
explicit SyncPlayer (QWidget *parent, QString udi);
virtual ~SyncPlayer();
QSize minimumSize() const { return QSize(100, 0); }
KUrl* getSrc();
KUrl* getDest();
bool checkDestSize(KUrl dest);
int copyToDevice(QString udi);
void sync_in(PlaylistItem);
bool copy_in(KUrl,KUrl);
bool copy_in(KUrl::List, KUrl);
public Q_SLOTS:
void sync_in_stub();
protected:
private:
//QString m_currentplayername; //get player name from syncList
QString m_player_udi;
};
#endif//SYNCPLAYER_H