Merge branch 'master' into qt5

This commit is contained in:
Chocobozzz 2016-12-18 17:04:08 +01:00
commit 2ede85bdcd
6 changed files with 61 additions and 44 deletions

47
dist/macdeploy.py vendored
View File

@ -15,6 +15,7 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with Clementine. If not, see <http://www.gnu.org/licenses/>. # along with Clementine. If not, see <http://www.gnu.org/licenses/>.
from distutils import spawn
import logging import logging
import os import os
import re import re
@ -31,7 +32,7 @@ FRAMEWORK_SEARCH_PATH=[
os.path.join(os.environ['HOME'], 'Library/Frameworks') os.path.join(os.environ['HOME'], 'Library/Frameworks')
] ]
LIBRARY_SEARCH_PATH=['/target/lib', '/usr/local/lib', '/sw/lib'] LIBRARY_SEARCH_PATH=['/target', '/target/lib', '/usr/local/lib', '/sw/lib']
GSTREAMER_PLUGINS=[ GSTREAMER_PLUGINS=[
@ -107,15 +108,18 @@ QT_PLUGINS = [
'imageformats/libqmng.dylib', 'imageformats/libqmng.dylib',
'imageformats/libqsvg.dylib', 'imageformats/libqsvg.dylib',
] ]
QT_PLUGINS_SEARCH_PATH=[ QT_PLUGINS_SEARCH_PATH = [
'/target/plugins', '/target/plugins',
'/usr/local/Trolltech/Qt-4.7.0/plugins', '/usr/local/Trolltech/Qt-4.7.0/plugins',
'/Developer/Applications/Qt/plugins', '/Developer/Applications/Qt/plugins',
] ]
GIO_MODULES_SEARCH_PATH=[ GIO_MODULES_SEARCH_PATH = ['/target/lib/gio/modules',]
'/target/lib/gio/modules',
] INSTALL_NAME_TOOL_APPLE = 'install_name_tool'
INSTALL_NAME_TOOL_CROSS = 'x86_64-apple-darwin-%s' % INSTALL_NAME_TOOL_APPLE
INSTALL_NAME_TOOL = INSTALL_NAME_TOOL_CROSS if spawn.find_executable(
INSTALL_NAME_TOOL_CROSS) else INSTALL_NAME_TOOL_APPLE
class Error(Exception): class Error(Exception):
@ -277,7 +281,7 @@ def FixBinary(path):
def CopyLibrary(path): def CopyLibrary(path):
new_path = os.path.join(frameworks_dir, os.path.basename(path)) new_path = os.path.join(frameworks_dir, os.path.basename(path))
args = ['ditto', '--arch=x86_64', path, new_path] args = ['cp', path, new_path]
commands.append(args) commands.append(args)
LOGGER.info("Copying library '%s'", path) LOGGER.info("Copying library '%s'", path)
return new_path return new_path
@ -286,7 +290,7 @@ def CopyPlugin(path, subdir):
new_path = os.path.join(plugins_dir, subdir, os.path.basename(path)) new_path = os.path.join(plugins_dir, subdir, os.path.basename(path))
args = ['mkdir', '-p', os.path.dirname(new_path)] args = ['mkdir', '-p', os.path.dirname(new_path)]
commands.append(args) commands.append(args)
args = ['ditto', '--arch=x86_64', path, new_path] args = ['cp', path, new_path]
commands.append(args) commands.append(args)
LOGGER.info("Copying plugin '%s'", path) LOGGER.info("Copying plugin '%s'", path)
return new_path return new_path
@ -310,7 +314,7 @@ def CopyFramework(src_binary):
dest_binary = os.path.join(dest_dir, name) dest_binary = os.path.join(dest_dir, name)
commands.append(['mkdir', '-p', dest_dir]) commands.append(['mkdir', '-p', dest_dir])
commands.append(['ditto', '--arch=x86_64', src_binary, dest_binary]) commands.append(['cp', src_binary, dest_binary])
# Copy special files from various places: # Copy special files from various places:
# QtCore has Resources/qt_menu.nib (copy to app's Resources) # QtCore has Resources/qt_menu.nib (copy to app's Resources)
@ -334,34 +338,39 @@ def CopyFramework(src_binary):
# Create symlinks in the Framework to make it look like # Create symlinks in the Framework to make it look like
# https://developer.apple.com/library/mac/documentation/MacOSX/Conceptual/BPFrameworks/Concepts/FrameworkAnatomy.html # https://developer.apple.com/library/mac/documentation/MacOSX/Conceptual/BPFrameworks/Concepts/FrameworkAnatomy.html
commands.append(['ln', '-sfh', commands.append([
'Versions/Current/%s' % name, 'ln', '-sf', 'Versions/Current/%s' % name, os.path.join(dest_base, name)
os.path.join(dest_base, name)]) ])
commands.append(['ln', '-sfh', commands.append([
'Versions/Current/Resources', 'ln', '-sf', 'Versions/Current/Resources',
os.path.join(dest_base, 'Resources')]) os.path.join(dest_base, 'Resources')
commands.append(['ln', '-sfh', ])
version, commands.append(
os.path.join(dest_base, 'Versions/Current')]) ['ln', '-sf', version, os.path.join(dest_base, 'Versions/Current')])
return dest_binary return dest_binary
def FixId(path, library_name): def FixId(path, library_name):
id = '@executable_path/../Frameworks/%s' % library_name id = '@executable_path/../Frameworks/%s' % library_name
args = ['install_name_tool', '-id', id, path] args = [INSTALL_NAME_TOOL, '-id', id, path]
commands.append(args) commands.append(args)
def FixLibraryId(path): def FixLibraryId(path):
library_name = os.path.basename(path) library_name = os.path.basename(path)
FixId(path, library_name) FixId(path, library_name)
def FixFrameworkId(path, id): def FixFrameworkId(path, id):
FixId(path, id) FixId(path, id)
def FixInstallPath(library_path, library, new_path): def FixInstallPath(library_path, library, new_path):
args = ['install_name_tool', '-change', library_path, new_path, library] args = [INSTALL_NAME_TOOL, '-change', library_path, new_path, library]
commands.append(args) commands.append(args)
def FindSystemLibrary(library_name): def FindSystemLibrary(library_name):
for path in ['/lib', '/usr/lib']: for path in ['/lib', '/usr/lib']:
full_path = os.path.join(path, library_name) full_path = os.path.join(path, library_name)

View File

@ -53,7 +53,7 @@ target_link_libraries(clementine-spotifyblob
if(APPLE) if(APPLE)
target_link_libraries(clementine-spotifyblob target_link_libraries(clementine-spotifyblob
/System/Library/Frameworks/Foundation.framework "-framework Foundation"
) )
endif(APPLE) endif(APPLE)

View File

@ -31,6 +31,7 @@ target_link_libraries(clementine-tagreader
libclementine-tagreader libclementine-tagreader
${QT_QTCORE_LIBRARY} ${QT_QTCORE_LIBRARY}
${QT_QTNETWORK_LIBRARY} ${QT_QTNETWORK_LIBRARY}
z
) )
if(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD") if(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
@ -41,7 +42,7 @@ endif(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
if(APPLE) if(APPLE)
target_link_libraries(clementine-tagreader target_link_libraries(clementine-tagreader
/System/Library/Frameworks/Foundation.framework "-framework Foundation"
) )
endif(APPLE) endif(APPLE)

View File

@ -853,7 +853,6 @@ optional_source(APPLE
core/macfslistener.mm core/macfslistener.mm
core/macglobalshortcutbackend.mm core/macglobalshortcutbackend.mm
core/mac_startup.mm core/mac_startup.mm
devices/macdevicelister.mm
engines/osxdevicefinder.cpp engines/osxdevicefinder.cpp
networkremote/bonjour.mm networkremote/bonjour.mm
ui/globalshortcutgrabber.mm ui/globalshortcutgrabber.mm
@ -863,10 +862,18 @@ optional_source(APPLE
HEADERS HEADERS
core/macfslistener.h core/macfslistener.h
core/macglobalshortcutbackend.h core/macglobalshortcutbackend.h
devices/macdevicelister.h
ui/macsystemtrayicon.h ui/macsystemtrayicon.h
) )
if(APPLE)
optional_source(HAVE_LIBMTP
SOURCES
devices/macdevicelister.mm
HEADERS
devices/macdevicelister.h
)
endif()
# Platform specific - Windows # Platform specific - Windows
optional_source(WIN32 optional_source(WIN32
SOURCES SOURCES
@ -1313,13 +1320,13 @@ endif()
if (APPLE) if (APPLE)
target_link_libraries(clementine_lib target_link_libraries(clementine_lib
/System/Library/Frameworks/AppKit.framework "-framework AppKit"
/System/Library/Frameworks/Carbon.framework "-framework Carbon"
/System/Library/Frameworks/CoreAudio.framework "-framework CoreAudio"
/System/Library/Frameworks/DiskArbitration.framework "-framework DiskArbitration"
/System/Library/Frameworks/Foundation.framework "-framework Foundation"
/System/Library/Frameworks/IOKit.framework "-framework IOKit"
/System/Library/Frameworks/ScriptingBridge.framework "-framework ScriptingBridge"
) )
target_link_libraries(clementine_lib ${SPMEDIAKEYTAP_LIBRARIES}) target_link_libraries(clementine_lib ${SPMEDIAKEYTAP_LIBRARIES})
if (HAVE_SPARKLE) if (HAVE_SPARKLE)

View File

@ -29,10 +29,6 @@
#include <QUrl> #include <QUrl>
#include "config.h" #include "config.h"
#include "devicedatabasebackend.h"
#include "devicekitlister.h"
#include "devicestatefiltermodel.h"
#include "filesystemdevice.h"
#include "core/application.h" #include "core/application.h"
#include "core/concurrentrun.h" #include "core/concurrentrun.h"
#include "core/database.h" #include "core/database.h"
@ -40,14 +36,18 @@
#include "core/musicstorage.h" #include "core/musicstorage.h"
#include "core/taskmanager.h" #include "core/taskmanager.h"
#include "core/utilities.h" #include "core/utilities.h"
#include "devicedatabasebackend.h"
#include "devicekitlister.h"
#include "devicestatefiltermodel.h"
#include "filesystemdevice.h"
#include "ui/iconloader.h" #include "ui/iconloader.h"
#ifdef HAVE_AUDIOCD #ifdef HAVE_AUDIOCD
#include "cddalister.h"
#include "cddadevice.h" #include "cddadevice.h"
#include "cddalister.h"
#endif #endif
#ifdef Q_OS_DARWIN #if defined(Q_OS_DARWIN) and defined(HAVE_LIBMTP)
#include "macdevicelister.h" #include "macdevicelister.h"
#endif #endif
#ifdef HAVE_LIBGPOD #ifdef HAVE_LIBGPOD
@ -169,7 +169,8 @@ DeviceManager::DeviceInfo::BestBackend() const {
DeviceManager::DeviceManager(Application* app, QObject* parent) DeviceManager::DeviceManager(Application* app, QObject* parent)
: QAbstractListModel(parent), : QAbstractListModel(parent),
app_(app), app_(app),
not_connected_overlay_(IconLoader::Load("edit-delete", IconLoader::Base)) { not_connected_overlay_(
IconLoader::Load("edit-delete", IconLoader::Base)) {
thread_pool_.setMaxThreadCount(1); thread_pool_.setMaxThreadCount(1);
connect(app_->task_manager(), SIGNAL(TasksChanged()), SLOT(TasksChanged())); connect(app_->task_manager(), SIGNAL(TasksChanged()), SLOT(TasksChanged()));
@ -200,7 +201,7 @@ DeviceManager::DeviceManager(Application* app, QObject* parent)
#ifdef HAVE_GIO #ifdef HAVE_GIO
AddLister(new GioLister); AddLister(new GioLister);
#endif #endif
#ifdef Q_OS_DARWIN #if defined(Q_OS_DARWIN) and defined(HAVE_LIBMTP)
AddLister(new MacDeviceLister); AddLister(new MacDeviceLister);
#endif #endif
@ -322,8 +323,7 @@ QVariant DeviceManager::data(const QModelIndex& index, int role) const {
if (!info.device_) { if (!info.device_) {
if (info.database_id_ == -1 && if (info.database_id_ == -1 &&
!info.BestBackend()->lister_->DeviceNeedsMount( !info.BestBackend()->lister_->DeviceNeedsMount(
info.BestBackend()->unique_id_)) { info.BestBackend()->unique_id_)) {
if (info.BestBackend()->lister_->AskForScan( if (info.BestBackend()->lister_->AskForScan(
info.BestBackend()->unique_id_)) { info.BestBackend()->unique_id_)) {
std::unique_ptr<QMessageBox> dialog(new QMessageBox( std::unique_ptr<QMessageBox> dialog(new QMessageBox(
@ -629,8 +629,8 @@ std::shared_ptr<ConnectedDevice> DeviceManager::Connect(int row) {
return ret; return ret;
} }
std::shared_ptr<ConnectedDevice> DeviceManager::GetConnectedDevice(int row) std::shared_ptr<ConnectedDevice> DeviceManager::GetConnectedDevice(
const { int row) const {
return devices_[row].device_; return devices_[row].device_;
} }

View File

@ -229,7 +229,7 @@ PodcastEpisodeList PodcastBackend::GetEpisodes(int podcast_id) {
" FROM podcast_episodes" " FROM podcast_episodes"
" WHERE podcast_id = :id" " WHERE podcast_id = :id"
" ORDER BY publication_date DESC"); " ORDER BY publication_date DESC");
q.bindValue(":db", podcast_id); q.bindValue(":id", podcast_id);
q.exec(); q.exec();
if (db_->CheckErrors(q)) return ret; if (db_->CheckErrors(q)) return ret;
@ -252,7 +252,7 @@ PodcastEpisode PodcastBackend::GetEpisodeById(int id) {
q.prepare("SELECT ROWID, " + PodcastEpisode::kColumnSpec + q.prepare("SELECT ROWID, " + PodcastEpisode::kColumnSpec +
" FROM podcast_episodes" " FROM podcast_episodes"
" WHERE ROWID = :id"); " WHERE ROWID = :id");
q.bindValue(":db", id); q.bindValue(":id", id);
q.exec(); q.exec();
if (!db_->CheckErrors(q) && q.next()) { if (!db_->CheckErrors(q) && q.next()) {
ret.InitFromQuery(q); ret.InitFromQuery(q);