Merge branch 'master' of https://code.google.com/p/clementine-player
Conflicts: src/translations/translations.pot
This commit is contained in:
commit
f79d38210c
7
dist/macdeploy.py
vendored
7
dist/macdeploy.py
vendored
@ -61,7 +61,6 @@ GSTREAMER_PLUGINS=[
|
||||
'libgstmusepack.so',
|
||||
'libgstogg.so',
|
||||
'libgstqtdemux.so',
|
||||
'libgstqtwrapper.so',
|
||||
'libgstreplaygain.so',
|
||||
'libgstspeex.so',
|
||||
'libgsttaglib.so',
|
||||
@ -262,7 +261,7 @@ def FixBinary(path):
|
||||
|
||||
def CopyLibrary(path):
|
||||
new_path = os.path.join(frameworks_dir, os.path.basename(path))
|
||||
args = ['ditto', '--arch=i386', path, new_path]
|
||||
args = ['ditto', '--arch=x86_64', path, new_path]
|
||||
commands.append(args)
|
||||
return new_path
|
||||
|
||||
@ -270,7 +269,7 @@ def CopyPlugin(path, subdir):
|
||||
new_path = os.path.join(plugins_dir, subdir, os.path.basename(path))
|
||||
args = ['mkdir', '-p', os.path.dirname(new_path)]
|
||||
commands.append(args)
|
||||
args = ['ditto', '--arch=i386', path, new_path]
|
||||
args = ['ditto', '--arch=x86_64', path, new_path]
|
||||
commands.append(args)
|
||||
return new_path
|
||||
|
||||
@ -282,7 +281,7 @@ def CopyFramework(path):
|
||||
break
|
||||
args = ['mkdir', '-p', full_path]
|
||||
commands.append(args)
|
||||
args = ['ditto', '--arch=i386', path, full_path]
|
||||
args = ['ditto', '--arch=x86_64', path, full_path]
|
||||
commands.append(args)
|
||||
|
||||
menu_nib = os.path.join(os.path.split(path)[0], 'Resources', 'qt_menu.nib')
|
||||
|
@ -128,6 +128,7 @@ set(SOURCES
|
||||
globalsearch/groovesharksearchprovider.cpp
|
||||
globalsearch/icecastsearchprovider.cpp
|
||||
globalsearch/librarysearchprovider.cpp
|
||||
globalsearch/savedradiosearchprovider.cpp
|
||||
globalsearch/searchprovider.cpp
|
||||
globalsearch/simplesearchprovider.cpp
|
||||
globalsearch/somafmsearchprovider.cpp
|
||||
|
@ -24,8 +24,13 @@
|
||||
template <typename T>
|
||||
class CachedList {
|
||||
public:
|
||||
// Use a CachedList when you want to download and save a list of things from a
|
||||
// remote service, updating it only periodically.
|
||||
// T must be a registered metatype and must support being stored in
|
||||
// QSettings. This usually means you have to implement QDataStream streaming
|
||||
// operators, and use qRegisterMetaTypeStreamOperators.
|
||||
|
||||
typedef QList<T> ListType;
|
||||
typedef typename ListType::const_iterator const_iterator;
|
||||
|
||||
CachedList(const char* settings_group, const QString& name,
|
||||
int cache_duration_secs)
|
||||
@ -77,6 +82,8 @@ public:
|
||||
const ListType& Data() const { return data_; }
|
||||
operator ListType() const { return data_; }
|
||||
|
||||
// Q_FOREACH support
|
||||
typedef typename ListType::const_iterator const_iterator;
|
||||
const_iterator begin() const { return data_.begin(); }
|
||||
const_iterator end() const { return data_.end(); }
|
||||
|
||||
|
@ -66,7 +66,6 @@ public:
|
||||
QString get_name_for_new_playlist() {
|
||||
return name_for_new_playlist_.isEmpty() ? tr("Playlist") : name_for_new_playlist_;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
#endif // MIMEDATA_H
|
||||
|
54
src/globalsearch/savedradiosearchprovider.cpp
Normal file
54
src/globalsearch/savedradiosearchprovider.cpp
Normal file
@ -0,0 +1,54 @@
|
||||
/* This file is part of Clementine.
|
||||
Copyright 2011, David Sansome <me@davidsansome.com>
|
||||
|
||||
Clementine 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 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Clementine is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "savedradiosearchprovider.h"
|
||||
#include "core/mimedata.h"
|
||||
#include "internet/savedradio.h"
|
||||
#include "ui/iconloader.h"
|
||||
|
||||
SavedRadioSearchProvider::SavedRadioSearchProvider(SavedRadio* service, QObject* parent)
|
||||
: SimpleSearchProvider(parent),
|
||||
service_(service)
|
||||
{
|
||||
Init(tr("Your radio streams"), "savedradio", IconLoader::Load("document-open-remote"));
|
||||
|
||||
connect(service_, SIGNAL(StreamsChanged()), SLOT(MaybeRecreateItems()));
|
||||
}
|
||||
|
||||
void SavedRadioSearchProvider::RecreateItems() {
|
||||
QList<Item> items;
|
||||
|
||||
foreach (const SavedRadio::Stream& stream, service_->Streams()) {
|
||||
Item item;
|
||||
item.metadata_.set_title(stream.name_);
|
||||
item.metadata_.set_url(stream.url_);
|
||||
item.keyword_ = stream.name_;
|
||||
items << item;
|
||||
}
|
||||
|
||||
SetItems(items);
|
||||
}
|
||||
|
||||
void SavedRadioSearchProvider::LoadTracksAsync(int id, const Result& result) {
|
||||
Song metadata = result.metadata_;
|
||||
metadata.set_filetype(Song::Type_Stream);
|
||||
|
||||
MimeData* mime_data = new MimeData;
|
||||
mime_data->setUrls(QList<QUrl>() << metadata.url());
|
||||
|
||||
emit TracksLoaded(id, mime_data);
|
||||
}
|
38
src/globalsearch/savedradiosearchprovider.h
Normal file
38
src/globalsearch/savedradiosearchprovider.h
Normal file
@ -0,0 +1,38 @@
|
||||
/* This file is part of Clementine.
|
||||
Copyright 2011, David Sansome <me@davidsansome.com>
|
||||
|
||||
Clementine 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 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Clementine is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef SAVEDRADIOSEARCHPROVIDER_H
|
||||
#define SAVEDRADIOSEARCHPROVIDER_H
|
||||
|
||||
#include "simplesearchprovider.h"
|
||||
|
||||
class SavedRadio;
|
||||
|
||||
class SavedRadioSearchProvider : public SimpleSearchProvider {
|
||||
public:
|
||||
SavedRadioSearchProvider(SavedRadio* service, QObject* parent);
|
||||
|
||||
void LoadTracksAsync(int id, const Result& result);
|
||||
|
||||
protected:
|
||||
void RecreateItems();
|
||||
|
||||
private:
|
||||
SavedRadio* service_;
|
||||
};
|
||||
|
||||
#endif // SAVEDRADIOSEARCHPROVIDER_H
|
@ -18,6 +18,8 @@
|
||||
#include "internetmodel.h"
|
||||
#include "savedradio.h"
|
||||
#include "core/mimedata.h"
|
||||
#include "globalsearch/globalsearch.h"
|
||||
#include "globalsearch/savedradiosearchprovider.h"
|
||||
#include "ui/addstreamdialog.h"
|
||||
#include "ui/iconloader.h"
|
||||
|
||||
@ -33,6 +35,8 @@ SavedRadio::SavedRadio(InternetModel* parent)
|
||||
root_(NULL)
|
||||
{
|
||||
LoadStreams();
|
||||
|
||||
model()->global_search()->AddProvider(new SavedRadioSearchProvider(this, this));
|
||||
}
|
||||
|
||||
SavedRadio::~SavedRadio() {
|
||||
@ -84,6 +88,8 @@ void SavedRadio::SaveStreams() {
|
||||
s.setValue("name", streams_[i].name_);
|
||||
}
|
||||
s.endArray();
|
||||
|
||||
emit StreamsChanged();
|
||||
}
|
||||
|
||||
void SavedRadio::ShowContextMenu(const QModelIndex& index,
|
||||
|
@ -37,27 +37,6 @@ class SavedRadio : public InternetService {
|
||||
Type_Stream = 2000,
|
||||
};
|
||||
|
||||
static const char* kServiceName;
|
||||
static const char* kSettingsGroup;
|
||||
|
||||
QStandardItem* CreateRootItem();
|
||||
void LazyPopulate(QStandardItem* item);
|
||||
|
||||
void ShowContextMenu(const QModelIndex& index, const QPoint& global_pos);
|
||||
|
||||
void Add(const QUrl& url, const QString& name = QString());
|
||||
|
||||
signals:
|
||||
void ShowAddStreamDialog();
|
||||
|
||||
protected:
|
||||
QModelIndex GetCurrentIndex();
|
||||
|
||||
private slots:
|
||||
void Remove();
|
||||
void Edit();
|
||||
|
||||
private:
|
||||
struct Stream {
|
||||
Stream(const QUrl& url, const QString& name = QString())
|
||||
: url_(url), name_(name) {}
|
||||
@ -68,7 +47,32 @@ class SavedRadio : public InternetService {
|
||||
QUrl url_;
|
||||
QString name_;
|
||||
};
|
||||
typedef QList<Stream> StreamList;
|
||||
|
||||
static const char* kServiceName;
|
||||
static const char* kSettingsGroup;
|
||||
|
||||
QStandardItem* CreateRootItem();
|
||||
void LazyPopulate(QStandardItem* item);
|
||||
|
||||
void ShowContextMenu(const QModelIndex& index, const QPoint& global_pos);
|
||||
|
||||
void Add(const QUrl& url, const QString& name = QString());
|
||||
|
||||
StreamList Streams() const { return streams_; }
|
||||
|
||||
signals:
|
||||
void ShowAddStreamDialog();
|
||||
void StreamsChanged();
|
||||
|
||||
protected:
|
||||
QModelIndex GetCurrentIndex();
|
||||
|
||||
private slots:
|
||||
void Remove();
|
||||
void Edit();
|
||||
|
||||
private:
|
||||
void LoadStreams();
|
||||
void SaveStreams();
|
||||
void AddStreamToList(const Stream& stream, QStandardItem* parent);
|
||||
@ -81,7 +85,7 @@ class SavedRadio : public InternetService {
|
||||
QAction* remove_action_;
|
||||
QAction* edit_action_;
|
||||
|
||||
QList<Stream> streams_;
|
||||
StreamList streams_;
|
||||
|
||||
boost::scoped_ptr<AddStreamDialog> edit_dialog_;
|
||||
};
|
||||
|
@ -331,7 +331,7 @@ msgstr ""
|
||||
msgid "Add and play now"
|
||||
msgstr ""
|
||||
|
||||
#: internet/savedradio.cpp:97
|
||||
#: internet/savedradio.cpp:103
|
||||
msgid "Add another stream..."
|
||||
msgstr ""
|
||||
|
||||
@ -1484,7 +1484,7 @@ msgstr ""
|
||||
msgid "Edit tracks information..."
|
||||
msgstr ""
|
||||
|
||||
#: internet/savedradio.cpp:95
|
||||
#: internet/savedradio.cpp:101
|
||||
msgid "Edit..."
|
||||
msgstr ""
|
||||
|
||||
@ -4402,7 +4402,7 @@ msgstr ""
|
||||
msgid "Your library is empty!"
|
||||
msgstr ""
|
||||
|
||||
#: internet/savedradio.cpp:44
|
||||
#: globalsearch/savedradiosearchprovider.cpp:27 internet/savedradio.cpp:48
|
||||
msgid "Your radio streams"
|
||||
msgstr ""
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user