Remove non-moc headers from makefile +++

This commit is contained in:
Jonas Kvinge 2018-03-18 18:39:30 +01:00
parent 2bbcf819c8
commit bd163f989e
7 changed files with 61 additions and 194 deletions

View File

@ -18,7 +18,7 @@
project(strawberry) project(strawberry)
cmake_minimum_required(VERSION 2.8.11) cmake_minimum_required(VERSION 2.8.11)
cmake_policy(SET CMP0011 OLD) #cmake_policy(SET CMP0011 OLD)
#aux_source_directory(. SRC_LIST) #aux_source_directory(. SRC_LIST)
@ -78,10 +78,8 @@ endif(APPLE)
find_package(OpenGL REQUIRED) find_package(OpenGL REQUIRED)
find_package(Boost REQUIRED) find_package(Boost REQUIRED)
find_package(Gettext REQUIRED)
find_package(PkgConfig REQUIRED) find_package(PkgConfig REQUIRED)
find_package(Protobuf REQUIRED) find_package(Protobuf REQUIRED)
find_package(FFTW3)
find_package(Threads) find_package(Threads)
if(LINUX) if(LINUX)
find_package(ALSA REQUIRED) find_package(ALSA REQUIRED)
@ -193,20 +191,6 @@ endif(WIN32)
add_definitions(-DQT_NO_CAST_TO_ASCII -DQT_STRICT_ITERATORS) add_definitions(-DQT_NO_CAST_TO_ASCII -DQT_STRICT_ITERATORS)
# Translations stuff
find_program(GETTEXT_XGETTEXT_EXECUTABLE xgettext PATHS /target/bin)
if(NOT GETTEXT_XGETTEXT_EXECUTABLE)
message(FATAL_ERROR "Could not find xgettext executable")
endif(NOT GETTEXT_XGETTEXT_EXECUTABLE)
find_program(GETTEXT_MSGMERGE_EXECUTABLE msgmerge PATHS /target/bin)
if(NOT GETTEXT_MSGMERGE_EXECUTABLE)
message(FATAL_ERROR "Could not find msgmerge executable")
endif(NOT GETTEXT_MSGMERGE_EXECUTABLE)
find_program(GETTEXT_MSGFMT_EXECUTABLE msgfmt PATHS /target/bin)
if(NOT GETTEXT_MSGFMT_EXECUTABLE)
message(FATAL_ERROR "Could not find msgfmt executable")
endif(NOT GETTEXT_MSGFMT_EXECUTABLE)
# Optional bits # Optional bits
if(WIN32) if(WIN32)
option(ENABLE_WIN32_CONSOLE "Show the windows console even outside Debug mode" OFF) option(ENABLE_WIN32_CONSOLE "Show the windows console even outside Debug mode" OFF)
@ -276,28 +260,23 @@ else(WIN32)
set(QT_LIBRARIES Qt5::Core Qt5::OpenGL Qt5::Sql Qt5::Network Qt5::Xml Qt5::Widgets Qt5::Concurrent Qt5::X11Extras Qt5::DBus) set(QT_LIBRARIES Qt5::Core Qt5::OpenGL Qt5::Sql Qt5::Network Qt5::Xml Qt5::Widgets Qt5::Concurrent Qt5::X11Extras Qt5::DBus)
endif(WIN32) endif(WIN32)
# Remove GLU and GL from the link line - they're not really required # Remove GLU and GL from the link line - they're not really required and don't exist on my mingw toolchain
# and don't exist on my mingw toolchain #list(REMOVE_ITEM QT_LIBRARIES "-lGLU -lGL")
list(REMOVE_ITEM QT_LIBRARIES "-lGLU -lGL")
# SQLITE # QSqlLiteDriver:
#find_path(SQLITE_INCLUDE_DIRS sqlite.h) # We do this because we can't guarantee that the driver shipped with Qt exposes the raw sqlite3 functions required for FTS support.
#find_library(SQLITE_LIBRARIES sqlite) # This way we know that those symbols exist at compile-time and that our code links to the same sqlite library as the Qt driver.
#if(SQLITE_LIBRARIES AND SQLITE_INCLUDE_DIRS) option(USE_SYSTEM_QSQLITE "Don't set this unless you can guarantee that the driver shipped with Qt exposes the raw sqlite3 functions required for FTS support" OFF)
# message(STATUS "Using system sqlite library") if(USE_SYSTEM_QSQLITE)
# set(USE_SYSTEM_SQLITE ON) message(STATUS "Using system qsqlite driver")
#endif () else(USE_SYSTEM_QSQLITE)
message(STATUS "Using builtin qsqlite driver")
add_subdirectory(3rdparty/qsqlite)
set(QSQLITE_LIBRARIES qsqlite)
set(QSQLITE_INCLUDE_DIRS "3rdparty/qsqlite")
endif(USE_SYSTEM_QSQLITE)
# Build our copy of QSqlLiteDriver. # When/if upstream accepts our patches then these options can be used to link to system installed qtsingleapplication instead.
# We do this because we can't guarantee that the driver shipped with Qt exposes the
# raw sqlite3_ functions required for FTS support. This way we know that those symbols
# exist at compile-time and that our code links to the same sqlite library as the
# Qt driver.
add_subdirectory(3rdparty/qsqlite)
include_directories("3rdparty/qsqlite")
# When/if upstream accepts our patches then these options can be used to link
# to system installed qtsingleapplication instead.
option(USE_SYSTEM_QTSINGLEAPPLICATION "Don't set this option unless your system QtSingleApplication library has been compiled with the Strawberry patches in 3rdparty" OFF) option(USE_SYSTEM_QTSINGLEAPPLICATION "Don't set this option unless your system QtSingleApplication library has been compiled with the Strawberry patches in 3rdparty" OFF)
if(USE_SYSTEM_QTSINGLEAPPLICATION) if(USE_SYSTEM_QTSINGLEAPPLICATION)
find_path(QTSINGLEAPPLICATION_INCLUDE_DIRS qtsingleapplication.h PATH_SUFFIXES QtSolutions) find_path(QTSINGLEAPPLICATION_INCLUDE_DIRS qtsingleapplication.h PATH_SUFFIXES QtSolutions)
@ -309,17 +288,7 @@ else(USE_SYSTEM_QTSINGLEAPPLICATION)
set(QTSINGLEAPPLICATION_LIBRARIES qtsingleapplication) set(QTSINGLEAPPLICATION_LIBRARIES qtsingleapplication)
endif(USE_SYSTEM_QTSINGLEAPPLICATION) endif(USE_SYSTEM_QTSINGLEAPPLICATION)
# QtIoCompressor isn't patched, so we can use a system version if it's available # When/if upstream accepts our or reimplement our patches then these options can be used to link to system installed qxt instead.
#find_path(QTIOCOMPRESSOR_INCLUDE_DIRS qtiocompressor.h PATH_SUFFIXES QtSolutions)
#find_library(QTIOCOMPRESSOR_LIBRARIES QtSolutions_IOCompressor-2.3)
#if(NOT QTIOCOMPRESSOR_INCLUDE_DIRS OR NOT QTIOCOMPRESSOR_LIBRARIES)
# add_subdirectory(3rdparty/qtiocompressor)
# set(QTIOCOMPRESSOR_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/qtiocompressor)
# set(QTIOCOMPRESSOR_LIBRARIES qtiocompressor)
#endif(NOT QTIOCOMPRESSOR_INCLUDE_DIRS OR NOT QTIOCOMPRESSOR_LIBRARIES)
# When/if upstream accepts our or reimplement our patches then these options can be
# used to link to system installed qxt instead.
option(USE_SYSTEM_QXT "Don't set this option unless your system Qxt library has been compiled with the Strawberry patches in 3rdparty" OFF) option(USE_SYSTEM_QXT "Don't set this option unless your system Qxt library has been compiled with the Strawberry patches in 3rdparty" OFF)
if (USE_SYSTEM_QXT) if (USE_SYSTEM_QXT)
find_path(QXTCORE_INCLUDE_DIRS qxtglobal.h PATH_SUFFIXES QxtCore) find_path(QXTCORE_INCLUDE_DIRS qxtglobal.h PATH_SUFFIXES QxtCore)
@ -373,7 +342,6 @@ if (WIN32)
add_subdirectory(3rdparty/qtwin) add_subdirectory(3rdparty/qtwin)
add_subdirectory(3rdparty/tinysvcmdns) add_subdirectory(3rdparty/tinysvcmdns)
endif (WIN32) endif (WIN32)
#add_subdirectory(tests)
add_subdirectory(dist) add_subdirectory(dist)
add_subdirectory(ext/libstrawberry-common) add_subdirectory(ext/libstrawberry-common)
add_subdirectory(ext/libstrawberry-tagreader) add_subdirectory(ext/libstrawberry-tagreader)

View File

@ -56,6 +56,7 @@ include_directories(${QTSINGLEAPPLICATION_INCLUDE_DIRS})
include_directories(${QXT_INCLUDE_DIRS}) include_directories(${QXT_INCLUDE_DIRS})
include_directories(${SHA2_INCLUDE_DIRS}) include_directories(${SHA2_INCLUDE_DIRS})
include_directories(${CHROMAPRINT_INCLUDE_DIRS}) include_directories(${CHROMAPRINT_INCLUDE_DIRS})
include_directories(${QSQLITE_INCLUDE_DIRS})
find_package(OpenGL) find_package(OpenGL)
include_directories(${OPENGL_INCLUDE_DIR}) include_directories(${OPENGL_INCLUDE_DIR})
@ -265,58 +266,26 @@ set(SOURCES
set(HEADERS set(HEADERS
core/mainwindow.h core/mainwindow.h
core/application.h core/application.h
core/appearance.h
core/player.h core/player.h
core/commandlineoptions.h
core/database.h core/database.h
core/metatypes.h
core/deletefiles.h core/deletefiles.h
core/filesystemmusicstorage.h
core/filesystemwatcherinterface.h core/filesystemwatcherinterface.h
core/mergedproxymodel.h core/mergedproxymodel.h
core/multisortfilterproxy.h
core/musicstorage.h
core/network.h core/network.h
core/networkproxyfactory.h
core/qtfslistener.h core/qtfslistener.h
core/settingsprovider.h
core/signalchecker.h
core/song.h
core/songloader.h core/songloader.h
core/stylesheetloader.h
core/tagreaderclient.h core/tagreaderclient.h
core/taskmanager.h core/taskmanager.h
core/thread.h
core/urlhandler.h core/urlhandler.h
core/utilities.h
core/scangiomodulepath.h
core/flowlayout.h
core/iconloader.h
core/qtsystemtrayicon.h core/qtsystemtrayicon.h
core/standarditemiconloader.h core/standarditemiconloader.h
core/systemtrayicon.h core/systemtrayicon.h
core/windows7thumbbar.h core/windows7thumbbar.h
core/screensaver.h
core/cachedlist.h
core/mimedata.h core/mimedata.h
core/qhash_qurl.h
core/simpletreeitem.h
core/simpletreemodel.h
core/timeconstants.h
core/qt_blurimage.h
core/scopedtransaction.h
core/scopedgobject.h
core/scoped_cftyperef.h
core/scoped_nsautorelease_pool.h
core/scoped_nsobject.h
engine/enginetype.h
engine/enginebase.h engine/enginebase.h
engine/enginedevice.h engine/enginedevice.h
engine/devicefinder.h
engine/engine_fwd.h
analyzer/fht.h
analyzer/analyzerbase.h analyzer/analyzerbase.h
analyzer/analyzercontainer.h analyzer/analyzercontainer.h
analyzer/blockanalyzer.h analyzer/blockanalyzer.h
@ -332,12 +301,7 @@ set(HEADERS
collection/collectionviewcontainer.h collection/collectionviewcontainer.h
collection/collectiondirectorymodel.h collection/collectiondirectorymodel.h
collection/collectionfilterwidget.h collection/collectionfilterwidget.h
collection/collectionplaylistitem.h
collection/collectionquery.h
collection/collectionitem.h
collection/sqlrow.h
collection/savedgroupingmanager.h collection/savedgroupingmanager.h
collection/directory.h
collection/groupbydialog.h collection/groupbydialog.h
playlist/playlist.h playlist/playlist.h
@ -345,7 +309,6 @@ set(HEADERS
playlist/playlistcontainer.h playlist/playlistcontainer.h
playlist/playlistdelegates.h playlist/playlistdelegates.h
playlist/playlistfilter.h playlist/playlistfilter.h
playlist/playlistfilterparser.h
playlist/playlistheader.h playlist/playlistheader.h
playlist/playlistlistcontainer.h playlist/playlistlistcontainer.h
playlist/playlistlistmodel.h playlist/playlistlistmodel.h
@ -354,14 +317,12 @@ set(HEADERS
playlist/playlistsaveoptionsdialog.h playlist/playlistsaveoptionsdialog.h
playlist/playlistsequence.h playlist/playlistsequence.h
playlist/playlisttabbar.h playlist/playlisttabbar.h
playlist/playlistundocommands.h
playlist/playlistview.h playlist/playlistview.h
playlist/playlistitemmimedata.h playlist/playlistitemmimedata.h
playlist/queue.h playlist/queue.h
playlist/queuemanager.h playlist/queuemanager.h
playlist/songloaderinserter.h playlist/songloaderinserter.h
playlist/songmimedata.h playlist/songmimedata.h
playlist/songplaylistitem.h
playlistparsers/asxiniparser.h playlistparsers/asxiniparser.h
playlistparsers/asxparser.h playlistparsers/asxparser.h
@ -370,14 +331,11 @@ set(HEADERS
playlistparsers/parserbase.h playlistparsers/parserbase.h
playlistparsers/playlistparser.h playlistparsers/playlistparser.h
playlistparsers/plsparser.h playlistparsers/plsparser.h
playlistparsers/wplparser.h
playlistparsers/xmlparser.h
playlistparsers/xspfparser.h playlistparsers/xspfparser.h
covermanager/albumcovermanager.h covermanager/albumcovermanager.h
covermanager/albumcovermanagerlist.h covermanager/albumcovermanagerlist.h
covermanager/albumcoverloader.h covermanager/albumcoverloader.h
covermanager/albumcoverloaderoptions.h
covermanager/albumcoverfetcher.h covermanager/albumcoverfetcher.h
covermanager/albumcoverfetchersearch.h covermanager/albumcoverfetchersearch.h
covermanager/albumcoversearcher.h covermanager/albumcoversearcher.h
@ -387,7 +345,6 @@ set(HEADERS
covermanager/coverprovider.h covermanager/coverprovider.h
covermanager/coverproviders.h covermanager/coverproviders.h
covermanager/coversearchstatisticsdialog.h covermanager/coversearchstatisticsdialog.h
covermanager/coversearchstatistics.h
covermanager/coverexportrunnable.h covermanager/coverexportrunnable.h
covermanager/currentartloader.h covermanager/currentartloader.h
covermanager/coverfromurldialog.h covermanager/coverfromurldialog.h
@ -422,7 +379,6 @@ set(HEADERS
widgets/favoritewidget.h widgets/favoritewidget.h
widgets/fileview.h widgets/fileview.h
widgets/fileviewlist.h widgets/fileviewlist.h
widgets/forcescrollperpixel.h
widgets/freespacebar.h widgets/freespacebar.h
widgets/groupediconview.h widgets/groupediconview.h
widgets/lineedit.h widgets/lineedit.h
@ -440,7 +396,6 @@ set(HEADERS
widgets/sliderwidget.h widgets/sliderwidget.h
widgets/stickyslider.h widgets/stickyslider.h
widgets/stretchheaderview.h widgets/stretchheaderview.h
widgets/stylehelper.h
widgets/trackslider.h widgets/trackslider.h
widgets/tracksliderpopup.h widgets/tracksliderpopup.h
widgets/tracksliderslider.h widgets/tracksliderslider.h
@ -452,7 +407,6 @@ set(HEADERS
globalshortcuts/globalshortcutbackend.h globalshortcuts/globalshortcutbackend.h
globalshortcuts/globalshortcuts.h globalshortcuts/globalshortcuts.h
globalshortcuts/gnomeglobalshortcutbackend.h globalshortcuts/gnomeglobalshortcutbackend.h
globalshortcuts/qxtglobalshortcutbackend.h
globalshortcuts/globalshortcutgrabber.h globalshortcuts/globalshortcutgrabber.h
device/connecteddevice.h device/connecteddevice.h
@ -532,17 +486,17 @@ option(USE_INSTALL_PREFIX "Look for data in CMAKE_INSTALL_PREFIX" ON)
# Engines # Engines
set(GST_ENGINE_SRC engine/gstengine.cpp engine/gstenginepipeline.cpp engine/gstelementdeleter.cpp) set(GST_ENGINE_SRC engine/gstengine.cpp engine/gstenginepipeline.cpp engine/gstelementdeleter.cpp)
set(GST_ENGINE_MOC engine/gstengine.h engine/gstenginepipeline.h engine/gstelementdeleter.h engine/bufferconsumer.h) set(GST_ENGINE_MOC engine/gstengine.h engine/gstenginepipeline.h engine/gstelementdeleter.h)
#set(GST_ENGINE_LIB GSTREAMER GSTREAMER_BASE GSTREAMER_APP GSTREAMER_AUDIO GSTREAMER_TAG GSTREAMER_PBUTILS GSTREAMER_QTGLIB GSTREAMER_QTGST GSTREAMER_QTGSTUI GSTREAMER_QTGSTUTILS) #set(GST_ENGINE_LIB GSTREAMER GSTREAMER_BASE GSTREAMER_APP GSTREAMER_AUDIO GSTREAMER_TAG GSTREAMER_PBUTILS GSTREAMER_QTGLIB GSTREAMER_QTGST GSTREAMER_QTGSTUI GSTREAMER_QTGSTUTILS)
set(GST_ENGINE_LIB GSTREAMER GSTREAMER_BASE GSTREAMER_APP GSTREAMER_AUDIO GSTREAMER_TAG GSTREAMER_PBUTILS) set(GST_ENGINE_LIB GSTREAMER GSTREAMER_BASE GSTREAMER_APP GSTREAMER_AUDIO GSTREAMER_TAG GSTREAMER_PBUTILS)
#set(GST_ENGINE_LIB gstreamer-1.0 gstreamer-base-1.0 gstreamer-app-1.0 streamer-audio-1.0 gstreamer-tag-1.0 gstreamer-pbutils-1.0) #set(GST_ENGINE_LIB gstreamer-1.0 gstreamer-base-1.0 gstreamer-app-1.0 streamer-audio-1.0 gstreamer-tag-1.0 gstreamer-pbutils-1.0)
#set(GST_ENGINE_LIB ${GSTREAMER_BASE_LIBRARIES} ${GSTREAMER_LIBRARIES} ${GSTREAMER_APP_LIBRARIES} ${GSTREAMER_TAG_LIBRARIES} ${GSTREAMER_PBUTILS_LIBRARIES}) #set(GST_ENGINE_LIB ${GSTREAMER_BASE_LIBRARIES} ${GSTREAMER_LIBRARIES} ${GSTREAMER_APP_LIBRARIES} ${GSTREAMER_TAG_LIBRARIES} ${GSTREAMER_PBUTILS_LIBRARIES})
set(XINE_ENGINE_SRC engine/xineengine.cpp engine/xinescope.c) set(XINE_ENGINE_SRC engine/xineengine.cpp engine/xinescope.c)
set(XINE_ENGINE_MOC engine/xineengine.h engine/xinescope.h) set(XINE_ENGINE_MOC engine/xineengine.h)
set(VLC_ENGINE_SRC engine/vlcengine.cpp) set(VLC_ENGINE_SRC engine/vlcengine.cpp)
set(VLC_ENGINE_MOC engine/vlcengine.h engine/vlcscopedref.h) set(VLC_ENGINE_MOC engine/vlcengine.h)
set(PHONON_ENGINE_SRC engine/phononengine.cpp) set(PHONON_ENGINE_SRC engine/phononengine.cpp)
set(PHONON_ENGINE_MOC engine/phononengine.h) set(PHONON_ENGINE_MOC engine/phononengine.h)
@ -561,15 +515,12 @@ optional_source(HAVE_LIBLASTFM
covermanager/lastfmcompat.cpp covermanager/lastfmcompat.cpp
HEADERS HEADERS
covermanager/lastfmcoverprovider.h covermanager/lastfmcoverprovider.h
covermanager/lastfmcompat.h
) )
# Platform specific - Linux # Platform specific - Linux
optional_source(LINUX optional_source(LINUX
SOURCES SOURCES
engine/alsadevicefinder.cpp engine/alsadevicefinder.cpp
HEADERS
engine/alsadevicefinder.h
) )
# Platform specific - OS X # Platform specific - OS X
@ -742,8 +693,6 @@ optional_source(HAVE_DBUS
HEADERS HEADERS
core/mpris.h core/mpris.h
core/mpris2.h core/mpris2.h
core/mpris_common.h
core/dbusscreensaver.h
) )
optional_source(HAVE_DEVICEKIT optional_source(HAVE_DEVICEKIT
@ -804,7 +753,6 @@ optional_source(HAVE_LIBMTP
HEADERS HEADERS
device/mtpdevice.h device/mtpdevice.h
device/mtploader.h device/mtploader.h
device/mtpconnection.h
) )
# Pulse audio integration # Pulse audio integration
@ -813,8 +761,6 @@ optional_source(HAVE_LIBPULSE
${LIBPULSE_INCLUDE_DIRS} ${LIBPULSE_INCLUDE_DIRS}
SOURCES SOURCES
engine/pulsedevicefinder.cpp engine/pulsedevicefinder.cpp
HEADERS
engine/pulsedevicefinder.h
) )
optional_source(HAVE_GSTREAMER optional_source(HAVE_GSTREAMER
@ -838,23 +784,14 @@ SOURCES
transcoder/transcoderoptionswma.cpp transcoder/transcoderoptionswma.cpp
HEADERS HEADERS
core/organise.h core/organise.h
core/organiseformat.h
settings/transcodersettingspage.h settings/transcodersettingspage.h
dialogs/organisedialog.h dialogs/organisedialog.h
dialogs/organiseerrordialog.h dialogs/organiseerrordialog.h
musicbrainz/chromaprinter.h
musicbrainz/tagfetcher.h musicbrainz/tagfetcher.h
transcoder/transcoder.h transcoder/transcoder.h
transcoder/transcodedialog.h transcoder/transcodedialog.h
transcoder/transcoderoptionsaac.h
transcoder/transcoderoptionsdialog.h transcoder/transcoderoptionsdialog.h
transcoder/transcoderoptionsflac.h
transcoder/transcoderoptionsinterface.h
transcoder/transcoderoptionsmp3.h transcoder/transcoderoptionsmp3.h
transcoder/transcoderoptionsopus.h
transcoder/transcoderoptionsspeex.h
transcoder/transcoderoptionsvorbis.h
transcoder/transcoderoptionswma.h
UI UI
settings/transcodersettingspage.ui settings/transcodersettingspage.ui
dialogs/organisedialog.ui dialogs/organisedialog.ui
@ -986,7 +923,6 @@ else (APPLE)
target_link_libraries(strawberry_lib ${QXT_LIBRARIES}) target_link_libraries(strawberry_lib ${QXT_LIBRARIES})
endif (APPLE) endif (APPLE)
set(3RDPARTY_SQLITE_LIBRARY qsqlite)
target_link_libraries(strawberry_lib qsqlite) target_link_libraries(strawberry_lib qsqlite)
if (WIN32) if (WIN32)
@ -1014,7 +950,7 @@ if (UNIX AND NOT APPLE)
endif () endif ()
endif () endif ()
#add_dependencies(strawberry_lib qtsingleapplication) add_dependencies(strawberry_lib qtsingleapplication)
############################################################################### ###############################################################################

View File

@ -23,14 +23,14 @@
#include "config.h" #include "config.h"
#include <QObject>
#include <QColor> #include <QColor>
#include <QPalette> #include <QPalette>
class Appearance : public QObject { class Appearance : public QObject {
public: public:
explicit Appearance(QObject* parent = nullptr); explicit Appearance(QObject* parent = nullptr);
// Load the user preferred theme, which could the default system theme or a // Load the user preferred theme, which could the default system theme or a custom set of colors that user has chosen
// custom set of colors that user has chosen
void LoadUserTheme(); void LoadUserTheme();
void ResetToSystemDefaultTheme(); void ResetToSystemDefaultTheme();
void ChangeForegroundColor(const QColor& color); void ChangeForegroundColor(const QColor& color);

View File

@ -26,6 +26,8 @@
#include <memory> #include <memory>
#include <QObject> #include <QObject>
#include <QString>
#include <QThread>
#include "settings/settingsdialog.h" #include "settings/settingsdialog.h"

View File

@ -36,13 +36,6 @@
#include <unistd.h> #include <unistd.h>
#endif // Q_OS_UNIX #endif // Q_OS_UNIX
#ifdef HAVE_DBUS
#include "core/mpris.h"
#include "core/mpris2.h"
#include <QDBusArgument>
#include <QImage>
#endif
#ifdef Q_OS_DARWIN #ifdef Q_OS_DARWIN
#include <sys/resource.h> #include <sys/resource.h>
#include <sys/sysctl.h> #include <sys/sysctl.h>
@ -55,7 +48,10 @@
#include <qtsparkle/Updater> #include <qtsparkle/Updater>
#endif // Q_OS_WIN32 #endif // Q_OS_WIN32
#include <QObject>
#include <QFile>
#include <QString> #include <QString>
#include <QStringList>
#include <QDir> #include <QDir>
#include <QFont> #include <QFont>
#include <QLibraryInfo> #include <QLibraryInfo>
@ -65,10 +61,18 @@
#include <QSqlQuery> #include <QSqlQuery>
#include <QSysInfo> #include <QSysInfo>
#include <QTextCodec> #include <QTextCodec>
#include <QTranslator>
#include <QtConcurrentRun> #include <QtConcurrentRun>
#include <QtDebug> #include <QtDebug>
#include <QSettings>
#ifdef HAVE_DBUS
#include <QDBusArgument>
#include <QImage>
#endif
#ifdef HAVE_DBUS
#include "core/mpris.h"
#include "core/mpris2.h"
#endif
#include "core/application.h" #include "core/application.h"
#include "core/mainwindow.h" #include "core/mainwindow.h"
#include "core/commandlineoptions.h" #include "core/commandlineoptions.h"
@ -89,15 +93,6 @@
#endif #endif
#include "version.h" #include "version.h"
#include "widgets/osd.h" #include "widgets/osd.h"
#if 0
#ifdef HAVE_LIBLASTFM
#include "covermanager/lastfmcoverprovider.h"
#endif
#include "covermanager/amazoncoverprovider.h"
#include "covermanager/coverproviders.h"
#include "covermanager/musicbrainzcoverprovider.h"
#include "covermanager/discogscoverprovider.h"
#endif
#include "tagreadermessages.pb.h" #include "tagreadermessages.pb.h"
@ -145,24 +140,19 @@ int main(int argc, char* argv[]) {
RegisterMetaTypes(); RegisterMetaTypes();
// Initialise logging. Log levels are set after the commandline options are // Initialise logging. Log levels are set after the commandline options are parsed below.
// parsed below.
logging::Init(); logging::Init();
g_log_set_default_handler(reinterpret_cast<GLogFunc>(&logging::GLog), nullptr); g_log_set_default_handler(reinterpret_cast<GLogFunc>(&logging::GLog), nullptr);
CommandlineOptions options(argc, argv); CommandlineOptions options(argc, argv);
{ {
// Only start a core application now so we can check if there's another // Only start a core application now so we can check if there's another Strawberry running without needing an X server.
// Strawberry running without needing an X server. // This MUST be done before parsing the commandline options so QTextCodec gets the right system locale for filenames.
// This MUST be done before parsing the commandline options so QTextCodec
// gets the right system locale for filenames.
QtSingleCoreApplication a(argc, argv); QtSingleCoreApplication a(argc, argv);
Utilities::CheckPortable(); Utilities::CheckPortable();
//crash_reporting.SetApplicationPath(a.applicationFilePath());
// Parse commandline options - need to do this before starting the // Parse commandline options - need to do this before starting the full QApplication so it works without an X server
// full QApplication so it works without an X server
if (!options.Parse()) return 1; if (!options.Parse()) return 1;
logging::SetLevels(options.log_levels()); logging::SetLevels(options.log_levels());
@ -182,8 +172,7 @@ int main(int argc, char* argv[]) {
setenv("XDG_CONFIG_HOME", Utilities::GetConfigPath(Utilities::Path_Root).toLocal8Bit().constData(), 1); setenv("XDG_CONFIG_HOME", Utilities::GetConfigPath(Utilities::Path_Root).toLocal8Bit().constData(), 1);
#endif #endif
// Output the version, so when people attach log output to bug reports they // Output the version, so when people attach log output to bug reports they don't have to tell us which version they're using.
// don't have to tell us which version they're using.
qLog(Info) << "Strawberry" << STRAWBERRY_VERSION_DISPLAY; qLog(Info) << "Strawberry" << STRAWBERRY_VERSION_DISPLAY;
// Seed the random number generators. // Seed the random number generators.
@ -195,14 +184,6 @@ int main(int argc, char* argv[]) {
QtSingleApplication a(argc, argv); QtSingleApplication a(argc, argv);
// A bug in Qt means the wheel_scroll_lines setting gets ignored and replaced
// with the default value of 3 in QApplicationPrivate::initialize.
{
QSettings qt_settings(QSettings::UserScope, "Trolltech");
qt_settings.beginGroup("Qt");
QApplication::setWheelScrollLines(qt_settings.value("wheelScrollLines", QApplication::wheelScrollLines()).toInt());
}
#ifdef Q_OS_DARWIN #ifdef Q_OS_DARWIN
QCoreApplication::setCollectionPaths( QCoreApplication::setCollectionPaths(
QStringList() << QCoreApplication::applicationDirPath() + "/../PlugIns"); QStringList() << QCoreApplication::applicationDirPath() + "/../PlugIns");
@ -216,8 +197,7 @@ int main(int argc, char* argv[]) {
} }
#ifndef Q_OS_DARWIN #ifndef Q_OS_DARWIN
// Gnome on Ubuntu has menu icons disabled by default. I think that's a bad // Gnome on Ubuntu has menu icons disabled by default. I think that's a bad idea, and makes some menus in Strawberry look confusing.
// idea, and makes some menus in Strawberry look confusing.
QCoreApplication::setAttribute(Qt::AA_DontShowIconsInMenus, false); QCoreApplication::setAttribute(Qt::AA_DontShowIconsInMenus, false);
#else #else
QCoreApplication::setAttribute(Qt::AA_DontShowIconsInMenus, true); QCoreApplication::setAttribute(Qt::AA_DontShowIconsInMenus, true);
@ -225,8 +205,7 @@ int main(int argc, char* argv[]) {
QCoreApplication::setAttribute(Qt::AA_NativeWindows, true); QCoreApplication::setAttribute(Qt::AA_NativeWindows, true);
#endif #endif
// Set the permissions on the config file on Unix - it can contain passwords // Set the permissions on the config file on Unix - it can contain passwords for internet services so it's important that other users can't read it.
// for internet services so it's important that other users can't read it.
// On Windows these are stored in the registry instead. // On Windows these are stored in the registry instead.
#ifdef Q_OS_UNIX #ifdef Q_OS_UNIX
{ {
@ -254,25 +233,11 @@ int main(int argc, char* argv[]) {
// Icons // Icons
IconLoader::Init(); IconLoader::Init();
// This is a nasty hack to ensure that everything in libprotobuf is
// initialised in the main thread. It fixes issue 3265 but nobody knows why.
// Don't remove this unless you can reproduce the error that it fixes.
//ParseAProto();
//QtConcurrent::run(&ParseAProto);
Application app; Application app;
// Network proxy // Network proxy
QNetworkProxyFactory::setApplicationProxyFactory(NetworkProxyFactory::Instance()); QNetworkProxyFactory::setApplicationProxyFactory(NetworkProxyFactory::Instance());
#if 0
//#ifdef HAVE_LIBLASTFM
app.cover_providers()->AddProvider(new LastFmCoverProvider);
app.cover_providers()->AddProvider(new AmazonCoverProvider);
app.cover_providers()->AddProvider(new DiscogsCoverProvider);
app.cover_providers()->AddProvider(new MusicbrainzCoverProvider);
#endif
// Create the tray icon and OSD // Create the tray icon and OSD
std::unique_ptr<SystemTrayIcon> tray_icon(SystemTrayIcon::CreateSystemTrayIcon()); std::unique_ptr<SystemTrayIcon> tray_icon(SystemTrayIcon::CreateSystemTrayIcon());
OSD osd(tray_icon.get(), &app); OSD osd(tray_icon.get(), &app);

View File

@ -85,6 +85,7 @@ void OSD::ReloadSettings() {
if (!SupportsTrayPopups() && behaviour_ == TrayPopup) behaviour_ = Disabled; if (!SupportsTrayPopups() && behaviour_ == TrayPopup) behaviour_ = Disabled;
ReloadPrettyOSDSettings(); ReloadPrettyOSDSettings();
} }
// Reload just Pretty OSD settings, not everything // Reload just Pretty OSD settings, not everything

View File

@ -35,6 +35,7 @@
#include <QTextDocument> #include <QTextDocument>
QDBusArgument& operator<<(QDBusArgument& arg, const QImage& image) { QDBusArgument& operator<<(QDBusArgument& arg, const QImage& image) {
if (image.isNull()) { if (image.isNull()) {
// Sometimes this gets called with a null QImage for no obvious reason. // Sometimes this gets called with a null QImage for no obvious reason.
arg.beginStructure(); arg.beginStructure();
@ -74,6 +75,7 @@ QDBusArgument& operator<<(QDBusArgument& arg, const QImage& image) {
arg << QByteArray(reinterpret_cast<const char*>(i.bits()), i.byteCount()); arg << QByteArray(reinterpret_cast<const char*>(i.bits()), i.byteCount());
arg.endStructure(); arg.endStructure();
return arg; return arg;
} }
const QDBusArgument& operator>>(const QDBusArgument& arg, QImage& image) { const QDBusArgument& operator>>(const QDBusArgument& arg, QImage& image) {
@ -84,31 +86,32 @@ const QDBusArgument& operator>>(const QDBusArgument& arg, QImage& image) {
#endif // HAVE_DBUS #endif // HAVE_DBUS
void OSD::Init() { void OSD::Init() {
#ifdef HAVE_DBUS #ifdef HAVE_DBUS
notification_id_ = 0; notification_id_ = 0;
interface_.reset(new OrgFreedesktopNotificationsInterface( interface_.reset(new OrgFreedesktopNotificationsInterface(OrgFreedesktopNotificationsInterface::staticInterfaceName(), "/org/freedesktop/Notifications", QDBusConnection::sessionBus()));
OrgFreedesktopNotificationsInterface::staticInterfaceName(),
"/org/freedesktop/Notifications",
QDBusConnection::sessionBus()));
if (!interface_->isValid()) { if (!interface_->isValid()) {
qLog(Warning) << "Error connecting to notifications service."; qLog(Warning) << "Error connecting to notifications service.";
} }
#endif // HAVE_DBUS #endif // HAVE_DBUS
} }
bool OSD::SupportsNativeNotifications() { bool OSD::SupportsNativeNotifications() {
#ifdef HAVE_DBUS #ifdef HAVE_DBUS
return true; return true;
#else #else
return false; return false;
#endif #endif
} }
bool OSD::SupportsTrayPopups() { return true; } bool OSD::SupportsTrayPopups() { return true; }
void OSD::ShowMessageNative(const QString& summary, const QString& message, void OSD::ShowMessageNative(const QString& summary, const QString& message, const QString& icon, const QImage& image) {
const QString& icon, const QImage& image) {
#ifdef HAVE_DBUS #ifdef HAVE_DBUS
if (!interface_) return; if (!interface_) return;
@ -118,33 +121,25 @@ void OSD::ShowMessageNative(const QString& summary, const QString& message,
} }
int id = 0; int id = 0;
if (last_notification_time_.secsTo(QDateTime::currentDateTime()) * 1000 if (last_notification_time_.secsTo(QDateTime::currentDateTime()) * 1000 < timeout_msec_) {
< timeout_msec_) {
// Reuse the existing popup if it's still open. The reason we don't always // Reuse the existing popup if it's still open. The reason we don't always
// reuse the popup is because the notification daemon on KDE4 won't re-show // reuse the popup is because the notification daemon on KDE4 won't re-show
// the bubble if it's already gone to the tray. See issue #118 // the bubble if it's already gone to the tray. See issue #118
id = notification_id_; id = notification_id_;
} }
QDBusPendingReply<uint> reply = interface_->Notify( QDBusPendingReply<uint> reply = interface_->Notify(QCoreApplication::applicationName(), id, icon, summary, message, QStringList(), hints, timeout_msec_);
QCoreApplication::applicationName(),
id,
icon,
summary,
message,
QStringList(),
hints,
timeout_msec_);
QDBusPendingCallWatcher* watcher = new QDBusPendingCallWatcher(reply, this); QDBusPendingCallWatcher* watcher = new QDBusPendingCallWatcher(reply, this);
connect(watcher, SIGNAL(finished(QDBusPendingCallWatcher*)), connect(watcher, SIGNAL(finished(QDBusPendingCallWatcher*)), SLOT(CallFinished(QDBusPendingCallWatcher*)));
SLOT(CallFinished(QDBusPendingCallWatcher*)));
#else // HAVE_DBUS #else // HAVE_DBUS
qLog(Warning) << "not implemented"; qLog(Warning) << "not implemented";
#endif // HAVE_DBUS #endif // HAVE_DBUS
} }
#ifdef HAVE_DBUS #ifdef HAVE_DBUS
void OSD::CallFinished(QDBusPendingCallWatcher* watcher) { void OSD::CallFinished(QDBusPendingCallWatcher* watcher) {
std::unique_ptr<QDBusPendingCallWatcher> w(watcher); std::unique_ptr<QDBusPendingCallWatcher> w(watcher);
QDBusPendingReply<uint> reply = *watcher; QDBusPendingReply<uint> reply = *watcher;