diff --git a/3rdparty/qtsingleapplication/qtlocalpeer.cpp b/3rdparty/qtsingleapplication/qtlocalpeer.cpp index 837752b63..b3ddc73cd 100644 --- a/3rdparty/qtsingleapplication/qtlocalpeer.cpp +++ b/3rdparty/qtsingleapplication/qtlocalpeer.cpp @@ -54,14 +54,12 @@ static PProcessIdToSessionId pProcessIdToSessionId = 0; #include #endif -namespace QtLP_Private { #include "qtlockedfile.cpp" #if defined(Q_OS_WIN) #include "qtlockedfile_win.cpp" #else #include "qtlockedfile_unix.cpp" #endif -} const char* QtLocalPeer::ack = "ack"; @@ -81,8 +79,7 @@ QtLocalPeer::QtLocalPeer(QObject* parent, const QString &appId) QByteArray idc = id.toUtf8(); quint16 idNum = qChecksum(idc.constData(), idc.size()); - socketName = QLatin1String("qtsingleapp-") + prefix - + QLatin1Char('-') + QString::number(idNum, 16); + socketName = QLatin1String("qtsingleapp-") + prefix + QLatin1Char('-') + QString::number(idNum, 16); #if defined(Q_OS_WIN) if (!pProcessIdToSessionId) { @@ -99,9 +96,7 @@ QtLocalPeer::QtLocalPeer(QObject* parent, const QString &appId) #endif server = new QLocalServer(this); - QString lockName = QDir(QDir::tempPath()).absolutePath() - + QLatin1Char('/') + socketName - + QLatin1String("-lockfile"); + QString lockName = QDir(QDir::tempPath()).absolutePath() + QLatin1Char('/') + socketName + QLatin1String("-lockfile"); lockFile.setFileName(lockName); lockFile.open(QIODevice::ReadWrite); } @@ -113,7 +108,8 @@ bool QtLocalPeer::isClient() if (lockFile.isLocked()) return false; - if (!lockFile.lock(QtLP_Private::QtLockedFile::WriteLock, false)) + //if (!lockFile.lock(QtLP_Private::QtLockedFile::WriteLock, false)) + if (!lockFile.lock(QtLockedFile::WriteLock, false)) return true; bool res = server->listen(socketName); @@ -187,7 +183,8 @@ void QtLocalPeer::receiveConnection() got = ds.readRawData(uMsgBuf, remaining); remaining -= got; uMsgBuf += got; - } while (remaining && got >= 0 && socket->waitForReadyRead(2000)); + } + while (remaining && got >= 0 && socket->waitForReadyRead(2000)); if (got < 0) { qWarning("QtLocalPeer: Message reception failed %s", socket->errorString().toLatin1().constData()); delete socket; diff --git a/3rdparty/qtsingleapplication/qtlocalpeer.h b/3rdparty/qtsingleapplication/qtlocalpeer.h index 7b3fa8159..f3e7ad89c 100644 --- a/3rdparty/qtsingleapplication/qtlocalpeer.h +++ b/3rdparty/qtsingleapplication/qtlocalpeer.h @@ -66,8 +66,8 @@ protected Q_SLOTS: protected: QString id; QString socketName; - QLocalServer* server; - QtLP_Private::QtLockedFile lockFile; + QLocalServer *server; + QtLockedFile lockFile; private: static const char* ack; diff --git a/3rdparty/qtsingleapplication/qtlockedfile.h b/3rdparty/qtsingleapplication/qtlockedfile.h index 2af3e3ea2..3ef0b5c0b 100644 --- a/3rdparty/qtsingleapplication/qtlockedfile.h +++ b/3rdparty/qtsingleapplication/qtlockedfile.h @@ -61,8 +61,6 @@ # define QT_QTLOCKEDFILE_EXPORT #endif -namespace QtLP_Private { - class QT_QTLOCKEDFILE_EXPORT QtLockedFile : public QFile { public: @@ -92,5 +90,5 @@ private: #endif LockMode m_lock_mode; }; -} + #endif diff --git a/3rdparty/qtsingleapplication/qtlockedfile_win.cpp b/3rdparty/qtsingleapplication/qtlockedfile_win.cpp index ed2995f3f..5f5bda50f 100644 --- a/3rdparty/qtsingleapplication/qtlockedfile_win.cpp +++ b/3rdparty/qtsingleapplication/qtlockedfile_win.cpp @@ -58,24 +58,14 @@ Qt::HANDLE QtLockedFile::getMutexHandle(int idx, bool doCreate) Qt::HANDLE mutex; if (doCreate) { -#if (QT_VERSION < 0x050000) - QT_WA( { mutex = CreateMutexW(NULL, FALSE, (TCHAR*)mname.utf16()); }, - { mutex = CreateMutexA(NULL, FALSE, mname.toLocal8Bit().constData()); } ); -#else - mutex = CreateMutexW(NULL, FALSE, (TCHAR*)mname.utf16()); -#endif + mutex = CreateMutexW(NULL, FALSE, (WCHAR*)mname.utf16()); if (!mutex) { qErrnoWarning("QtLockedFile::lock(): CreateMutex failed"); return 0; } } else { -#if (QT_VERSION < 0x050000) - QT_WA( { mutex = OpenMutexW(SYNCHRONIZE | MUTEX_MODIFY_STATE, FALSE, (TCHAR*)mname.utf16()); }, - { mutex = OpenMutexA(SYNCHRONIZE | MUTEX_MODIFY_STATE, FALSE, mname.toLocal8Bit().constData()); } ); -#else - mutex = OpenMutexW(SYNCHRONIZE | MUTEX_MODIFY_STATE, FALSE, (TCHAR*)mname.utf16()); -#endif + mutex = OpenMutexW(SYNCHRONIZE | MUTEX_MODIFY_STATE, FALSE, (WCHAR*)mname.utf16()); if (!mutex) { if (GetLastError() != ERROR_FILE_NOT_FOUND) qErrnoWarning("QtLockedFile::lock(): OpenMutex failed"); diff --git a/CMakeLists.txt b/CMakeLists.txt index c87e562f7..3687d6705 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -105,6 +105,7 @@ pkg_check_modules(LIBVLC libvlc) pkg_check_modules(PHONON phonon4qt5) pkg_check_modules(LIBGPOD libgpod-1.0>=0.7.92) pkg_check_modules(LIBMTP libmtp>=1.0) + pkg_check_modules(LIBPULSE libpulse) pkg_check_modules(LIBXML libxml-2.0) pkg_check_modules(TAGLIB REQUIRED taglib>=1.8) @@ -115,7 +116,6 @@ find_library(PROTOBUF_STATIC_LIBRARY libprotobuf.a libprotobuf) if (WIN32) find_package(ZLIB REQUIRED) - find_library(QTSPARKLE_LIBRARIES qtsparkle-qt5) endif (WIN32) # LASTFM @@ -327,7 +327,6 @@ add_subdirectory(3rdparty/qocoa) add_subdirectory(src) if (WIN32) add_subdirectory(3rdparty/qtwin) - add_subdirectory(3rdparty/tinysvcmdns) endif (WIN32) add_subdirectory(dist) add_subdirectory(ext/libstrawberry-common) diff --git a/dist/strawberry.ico b/dist/strawberry.ico new file mode 100644 index 000000000..5e8dc8bfa Binary files /dev/null and b/dist/strawberry.ico differ diff --git a/dist/strawberry.png b/dist/strawberry.png new file mode 100644 index 000000000..3d0afa0a7 Binary files /dev/null and b/dist/strawberry.png differ diff --git a/dist/windres.rc.in b/dist/windres.rc.in new file mode 100644 index 000000000..09cda2b65 --- /dev/null +++ b/dist/windres.rc.in @@ -0,0 +1,25 @@ +strawberry ICON "${CMAKE_CURRENT_SOURCE_DIR}/../dist/strawberry.ico" +1 VERSIONINFO +FILEVERSION ${STRAWBERRY_VERSION_MAJOR},${STRAWBERRY_VERSION_MINOR},0,0 +PRODUCTVERSION ${STRAWBERRY_VERSION_MAJOR},${STRAWBERRY_VERSION_MINOR},0,0 +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "080904E4" + BEGIN + VALUE "CompanyName", "Strawberry" + VALUE "FileDescription", "Strawberry Music Player" + VALUE "FileVersion", "${STRAWBERRY_VERSION_DISPLAY}" + VALUE "InternalName", "strawberry" + VALUE "LegalCopyright", "David Sansome" + VALUE "OriginalFilename", "strawberry.exe" + VALUE "ProductName", "Strawberry" + VALUE "ProductVersion", "${STRAWBERRY_VERSION_DISPLAY}" + END + END + + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x809, 1252 + END +END diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 8928f3fbe..28bca3153 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -31,6 +31,7 @@ include_directories(${CMAKE_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURR if(WIN32) include_directories(../3rdparty/qtwin) + #include_directories(../3rdparty/qtsparkle) endif(WIN32) # Activate fast QString concatenation @@ -928,8 +929,6 @@ target_link_libraries(strawberry_lib qsqlite) if (WIN32) target_link_libraries(strawberry_lib ${ZLIB_LIBRARIES} - ${QTSPARKLE_LIBRARIES} - tinysvcmdns qtwin dsound ${QT_QTGUI_LIBRARY} @@ -962,10 +961,9 @@ if (NOT CMAKE_BUILD_TYPE STREQUAL "Debug" AND NOT ENABLE_WIN32_CONSOLE) set(STRAWBERRY-WIN32-FLAG WIN32) endif (NOT CMAKE_BUILD_TYPE STREQUAL "Debug" AND NOT ENABLE_WIN32_CONSOLE) -# resource file for windows +# Resource file for windows if(WIN32) - configure_file(${CMAKE_CURRENT_SOURCE_DIR}/../dist/windows/windres.rc.in - ${CMAKE_CURRENT_BINARY_DIR}/windres.rc) + configure_file(${CMAKE_CURRENT_SOURCE_DIR}/../dist/windres.rc.in ${CMAKE_CURRENT_BINARY_DIR}/windres.rc) set(STRAWBERRY-WIN32-RESOURCES windres.rc) endif(WIN32) diff --git a/src/collection/collectionwatcher.cpp b/src/collection/collectionwatcher.cpp index c4a9965df..8ab777f02 100644 --- a/src/collection/collectionwatcher.cpp +++ b/src/collection/collectionwatcher.cpp @@ -23,6 +23,11 @@ #include #include +// This is defined by one of the windows headers that is included by taglib. +#ifdef RemoveDirectory +#undef RemoveDirectory +#endif + #include "collectionwatcher.h" #include "collectionbackend.h" @@ -44,11 +49,6 @@ #include #include -// This is defined by one of the windows headers that is included by taglib. -#ifdef RemoveDirectory -#undef RemoveDirectory -#endif - namespace { static const char *kNoMediaFile = ".nomedia"; static const char *kNoMusicFile = ".nomusic"; @@ -587,7 +587,7 @@ void CollectionWatcher::AddWatch(const Directory &dir, const QString &path) { } -void CollectionWatcher::RemoveDirectory(const Directory& dir) { +void CollectionWatcher::RemoveDirectory(const Directory &dir) { rescan_queue_.remove(dir.id); watched_dirs_.remove(dir.id); diff --git a/src/core/main.cpp b/src/core/main.cpp index 2d6f38e33..0cc7656c8 100644 --- a/src/core/main.cpp +++ b/src/core/main.cpp @@ -19,6 +19,7 @@ */ #include "config.h" +#include "version.h" #include @@ -42,10 +43,11 @@ #endif #ifdef Q_OS_WIN32 - #define _WIN32_WINNT 0x0600 + #ifndef _WIN32_WINNT + #define _WIN32_WINNT 0x0600 + #endif #include #include - #include #endif // Q_OS_WIN32 #include @@ -91,7 +93,7 @@ #ifdef HAVE_GSTREAMER #include "engine/gstengine.h" #endif -#include "version.h" + #include "widgets/osd.h" #include "tagreadermessages.pb.h" @@ -185,8 +187,7 @@ int main(int argc, char* argv[]) { QtSingleApplication a(argc, argv); #ifdef Q_OS_DARWIN - QCoreApplication::setCollectionPaths( - QStringList() << QCoreApplication::applicationDirPath() + "/../PlugIns"); + QCoreApplication::setCollectionPaths(QStringList() << QCoreApplication::applicationDirPath() + "/../PlugIns"); #endif a.setQuitOnLastWindowClosed(false); @@ -224,11 +225,6 @@ int main(int argc, char* argv[]) { // Resources Q_INIT_RESOURCE(data); - -#ifdef Q_OS_WIN32 - // Set the language for qtsparkle - qtsparkle::LoadTranslations(language); -#endif // Icons IconLoader::Init(); diff --git a/src/core/mainwindow.cpp b/src/core/mainwindow.cpp index 70e822d0b..bd075ef9e 100644 --- a/src/core/mainwindow.cpp +++ b/src/core/mainwindow.cpp @@ -49,10 +49,6 @@ #include #include -#ifdef Q_OS_WIN32 - #include -#endif - #include "core/appearance.h" #include "core/application.h" #include "core/commandlineoptions.h" @@ -548,14 +544,6 @@ MainWindow::MainWindow(Application *app, SystemTrayIcon *tray_icon, OSD *osd, co connect(check_updates, SIGNAL(triggered(bool)), SLOT(CheckForUpdates())); #endif -#ifdef Q_OS_WIN32 - qLog(Debug) << "Creating sparkle updater"; - qtsparkle::Updater* updater = new qtsparkle::Updater(QUrl("https://strawberry-data.appspot.com/sparkle-windows"), this); - updater->SetNetworkAccessManager(new NetworkAccessManager(this)); - updater->SetVersion(STRAWBERRY_VERSION_PACKAGE); - connect(check_updates, SIGNAL(triggered()), updater, SLOT(CheckNow())); -#endif - // Global shortcuts connect(global_shortcuts_, SIGNAL(Play()), app_->player(), SLOT(Play())); connect(global_shortcuts_, SIGNAL(Pause()), app_->player(), SLOT(Pause())); diff --git a/src/core/scangiomodulepath.cpp b/src/core/scangiomodulepath.cpp index e0285eda4..635ca64dd 100644 --- a/src/core/scangiomodulepath.cpp +++ b/src/core/scangiomodulepath.cpp @@ -21,7 +21,11 @@ //#ifdef HAVE_GIO //#undef signals // Clashes with GIO, and not needed in this file #include + +#include +#include #include + #include "core/logging.h" //namespace { diff --git a/src/core/windows7thumbbar.cpp b/src/core/windows7thumbbar.cpp index 41a83bf3e..6584e3f7c 100644 --- a/src/core/windows7thumbbar.cpp +++ b/src/core/windows7thumbbar.cpp @@ -28,13 +28,15 @@ #include "core/logging.h" #ifdef Q_OS_WIN32 -# define _WIN32_WINNT 0x0600 -# include -# include -# include + #ifndef _WIN32_WINNT + #define _WIN32_WINNT 0x0600 + #endif + #include + #include + #include +extern HICON qt_pixmapToWinHICON(const QPixmap &p); #endif // Q_OS_WIN32 - const int Windows7ThumbBar::kIconSize = 16; const int Windows7ThumbBar::kMaxButtonCount = 7; @@ -66,7 +68,7 @@ void Windows7ThumbBar::SetActions(const QList& actions) { static void SetupButton(const QAction *action, THUMBBUTTON *button) { if (action) { - button->hIcon = action->icon().pixmap(Windows7ThumbBar::kIconSize).toWinHICON(); + button->hIcon = qt_pixmapToWinHICON(action->icon().pixmap(Windows7ThumbBar::kIconSize)); button->dwFlags = action->isEnabled() ? THBF_ENABLED : THBF_DISABLED; // This is unsafe - doesn't obey 260-char restriction action->text().toWCharArray(button->szTip); @@ -108,8 +110,7 @@ void Windows7ThumbBar::HandleWinEvent(MSG *msg) { // Copied from win7 SDK shobjidl.h static const GUID CLSID_ITaskbarList ={ 0x56FDF344,0xFD6D,0x11d0,{0x95,0x8A,0x00,0x60,0x97,0xC9,0xA0,0x90}}; // Create the taskbar list - hr = CoCreateInstance(CLSID_ITaskbarList, nullptr, CLSCTX_ALL, - IID_ITaskbarList3, (void**)&taskbar_list_); + hr = CoCreateInstance(CLSID_ITaskbarList, nullptr, CLSCTX_ALL, IID_ITaskbarList3, (void**)&taskbar_list_); if (hr != S_OK) { qLog(Warning) << "Error creating the ITaskbarList3 interface" << hex << DWORD (hr); return; @@ -135,7 +136,7 @@ void Windows7ThumbBar::HandleWinEvent(MSG *msg) { } qLog(Debug) << "Adding buttons"; - hr = taskbar_list->ThumbBarAddButtons(widget_->winId(), actions_.count(), buttons); + hr = taskbar_list->ThumbBarAddButtons((HWND)widget_->winId(), actions_.count(), buttons); if (hr != S_OK) qLog(Debug) << "Failed to add buttons" << hex << DWORD (hr); for (int i = 0; i < actions_.count(); i++) { @@ -172,7 +173,7 @@ void Windows7ThumbBar::ActionChanged() { if (buttons->hIcon > 0) DestroyIcon(buttons->hIcon); } - taskbar_list->ThumbBarUpdateButtons(widget_->winId(), actions_.count(), buttons); + taskbar_list->ThumbBarUpdateButtons((HWND)widget_->winId(), actions_.count(), buttons); #endif // Q_OS_WIN32 } diff --git a/src/engine/directsounddevicefinder.cpp b/src/engine/directsounddevicefinder.cpp index 17a9fdcec..e448cfd99 100644 --- a/src/engine/directsounddevicefinder.cpp +++ b/src/engine/directsounddevicefinder.cpp @@ -48,7 +48,7 @@ BOOL DirectSoundDeviceFinder::EnumerateCallback(LPGUID guid, LPCSTR description, Device dev; dev.description = QString::fromUtf8(description); dev.device_property_value = QUuid(*guid).toByteArray(); - dev.icon_name = GuessIconName(dev.plugin_name, dev.description); + dev.iconname = GuessIconName(dev.string, dev.description); state->devices.append(dev); } diff --git a/src/settings/backendsettingspage.cpp b/src/settings/backendsettingspage.cpp index 2a91d66f0..c42d8cf8f 100644 --- a/src/settings/backendsettingspage.cpp +++ b/src/settings/backendsettingspage.cpp @@ -36,8 +36,12 @@ #include "core/iconloader.h" #include "engine/enginetype.h" #include "engine/enginebase.h" +#ifdef HAVE_GSTREAMER #include "engine/gstengine.h" +#endif +#ifdef HAVE_XINE #include "engine/xineengine.h" +#endif #include "engine/devicefinder.h" const char *BackendSettingsPage::kSettingsGroup = "Backend";