From 8f82aac3616133df4c550270ffa3f23e1697e53c Mon Sep 17 00:00:00 2001 From: Gerasim Troeglazov <3dEyes@gmail.com> Date: Sun, 19 Apr 2020 15:30:42 +1000 Subject: Fix build for Haiku diff --git a/CMakeLists.txt b/CMakeLists.txt index 600dc6e..e414a18 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -49,7 +49,7 @@ find_package(PkgConfig REQUIRED) find_package(Protobuf REQUIRED) find_package(FFTW3) find_package(ALSA) -if (NOT APPLE) +if (NOT APPLE AND NOT HAIKU) find_package(X11) endif() if(X11_FOUND) @@ -398,6 +398,7 @@ if(NOT QTIOCOMPRESSOR_INCLUDE_DIRS OR NOT QTIOCOMPRESSOR_LIBRARIES) set(QTIOCOMPRESSOR_LIBRARIES qtiocompressor) endif(NOT QTIOCOMPRESSOR_INCLUDE_DIRS OR NOT QTIOCOMPRESSOR_LIBRARIES) +if (NOT HAIKU) # 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 Clementine patches in 3rdparty" OFF) @@ -415,6 +416,7 @@ else (USE_SYSTEM_QXT) add_subdirectory(3rdparty/qxt) endif (NOT APPLE) endif (USE_SYSTEM_QXT) +endif (NOT HAIKU) # Use system gmock if it's available # We need to look for both gmock and gtest diff --git a/data/data.qrc b/data/data.qrc index 757a575..a6b0a8b 100644 --- a/data/data.qrc +++ b/data/data.qrc @@ -102,6 +102,9 @@ icons/22x22/x-clementine-artist.png icons/22x22/x-clementine-shuffle.png icons/22x22/zoom-in.png + icons/22x22/folder-network.png + icons/22x22/folder-open.png + icons/22x22/folder-text.png icons/32x32/application-exit.png icons/32x32/applications-internet.png icons/32x32/audio-volume-medium.png @@ -188,6 +191,9 @@ icons/32x32/x-clementine-artist.png icons/32x32/x-clementine-shuffle.png icons/32x32/zoom-in.png + icons/32x32/folder-network.png + icons/32x32/folder-open.png + icons/32x32/folder-text.png icons/48x48/application-exit.png icons/48x48/applications-internet.png icons/48x48/audio-volume-medium.png @@ -269,6 +275,9 @@ icons/48x48/x-clementine-artist.png icons/48x48/x-clementine-shuffle.png icons/48x48/zoom-in.png + icons/48x48/folder-network.png + icons/48x48/folder-open.png + icons/48x48/folder-text.png last.fm/as_disabled.png last.fm/as_light.png last.fm/as.png diff --git a/data/icons/22x22/folder-network.png b/data/icons/22x22/folder-network.png new file mode 120000 index 0000000..b2eb970 --- /dev/null +++ b/data/icons/22x22/folder-network.png @@ -0,0 +1 @@ +applications-internet.png \ No newline at end of file diff --git a/data/icons/22x22/folder-open.png b/data/icons/22x22/folder-open.png new file mode 120000 index 0000000..f58170c --- /dev/null +++ b/data/icons/22x22/folder-open.png @@ -0,0 +1 @@ +document-open.png \ No newline at end of file diff --git a/data/icons/22x22/folder-text.png b/data/icons/22x22/folder-text.png new file mode 120000 index 0000000..fcdd6f2 --- /dev/null +++ b/data/icons/22x22/folder-text.png @@ -0,0 +1 @@ +view-media-playlist.png \ No newline at end of file diff --git a/data/icons/32x32/folder-network.png b/data/icons/32x32/folder-network.png new file mode 120000 index 0000000..b2eb970 --- /dev/null +++ b/data/icons/32x32/folder-network.png @@ -0,0 +1 @@ +applications-internet.png \ No newline at end of file diff --git a/data/icons/32x32/folder-open.png b/data/icons/32x32/folder-open.png new file mode 120000 index 0000000..f58170c --- /dev/null +++ b/data/icons/32x32/folder-open.png @@ -0,0 +1 @@ +document-open.png \ No newline at end of file diff --git a/data/icons/32x32/folder-text.png b/data/icons/32x32/folder-text.png new file mode 120000 index 0000000..fcdd6f2 --- /dev/null +++ b/data/icons/32x32/folder-text.png @@ -0,0 +1 @@ +view-media-playlist.png \ No newline at end of file diff --git a/data/icons/48x48/folder-network.png b/data/icons/48x48/folder-network.png new file mode 120000 index 0000000..b2eb970 --- /dev/null +++ b/data/icons/48x48/folder-network.png @@ -0,0 +1 @@ +applications-internet.png \ No newline at end of file diff --git a/data/icons/48x48/folder-open.png b/data/icons/48x48/folder-open.png new file mode 120000 index 0000000..f58170c --- /dev/null +++ b/data/icons/48x48/folder-open.png @@ -0,0 +1 @@ +document-open.png \ No newline at end of file diff --git a/data/icons/48x48/folder-text.png b/data/icons/48x48/folder-text.png new file mode 120000 index 0000000..fcdd6f2 --- /dev/null +++ b/data/icons/48x48/folder-text.png @@ -0,0 +1 @@ +view-media-playlist.png \ No newline at end of file diff --git a/ext/libclementine-common/core/logging.cpp b/ext/libclementine-common/core/logging.cpp index 8012c0c..89b6ab2 100644 --- a/ext/libclementine-common/core/logging.cpp +++ b/ext/libclementine-common/core/logging.cpp @@ -315,7 +315,7 @@ QString DemangleSymbol(const QString& symbol) { } void DumpStackTrace() { -#ifdef Q_OS_UNIX +#if defined(Q_OS_UNIX) && !defined(Q_OS_HAIKU) void* callstack[128]; int callstack_size = backtrace(reinterpret_cast(&callstack), sizeof(callstack)); diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 627b2e7..eb4e239 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -912,6 +912,14 @@ optional_source(WIN32 ${CMAKE_SOURCE_DIR}/3rdparty/tinysvcmdns ) +# Platform specific - Haiku +optional_source(HAIKU + SOURCES + widgets/osd_win.cpp + INCLUDE_DIRECTORIES + ${CMAKE_SOURCE_DIR}/3rdparty/tinysvcmdns +) + # Platform specific - X11 optional_source(HAVE_X11 SOURCES widgets/osd_x11.cpp) @@ -1379,7 +1387,7 @@ if (WIN32) ) endif (WIN32) -if (UNIX AND NOT APPLE) +if (UNIX AND NOT APPLE AND NOT HAIKU) # Hack: the Gold linker pays attention to the order that libraries are # specified on the link line. -lX11 and -ldl are provided earlier in the link # command but they're actually used by libraries that appear after them, so diff --git a/src/core/backgroundstreams.cpp b/src/core/backgroundstreams.cpp index 2e6ac60..9ac5b59 100644 --- a/src/core/backgroundstreams.cpp +++ b/src/core/backgroundstreams.cpp @@ -44,7 +44,7 @@ void BackgroundStreams::LoadStreams() { int version = s.value("version", 0).toInt(); if (version < 1) { AddStream(QT_TR_NOOP("Hypnotoad"), QUrl(kHypnotoadUrl)); - AddStream(QT_TR_NOOP("Rain"), QUrl(kRainUrl)); +// AddStream(QT_TR_NOOP("Rain"), QUrl(kRainUrl)); } if (version < kVersion) { diff --git a/src/core/qxtglobalshortcutbackend.cpp b/src/core/qxtglobalshortcutbackend.cpp index 1acd08a..44ef7b3 100644 --- a/src/core/qxtglobalshortcutbackend.cpp +++ b/src/core/qxtglobalshortcutbackend.cpp @@ -25,12 +25,15 @@ #include "core/logging.h" #include "globalshortcuts.h" +#ifndef Q_OS_HAIKU #include "qxtglobalshortcut.h" +#endif QxtGlobalShortcutBackend::QxtGlobalShortcutBackend(GlobalShortcuts* parent) : GlobalShortcutBackend(parent) {} bool QxtGlobalShortcutBackend::DoRegister() { +#ifndef Q_OS_HAIKU if (QGuiApplication::platformName() == "wayland") { qLog(Warning) << "No support for Wayland in qxt."; return false; @@ -40,19 +43,23 @@ bool QxtGlobalShortcutBackend::DoRegister() { manager_->shortcuts().values()) { AddShortcut(shortcut.action); } - +#endif return true; } void QxtGlobalShortcutBackend::AddShortcut(QAction* action) { +#ifndef Q_OS_HAIKU if (action->shortcut().isEmpty()) return; QxtGlobalShortcut* shortcut = new QxtGlobalShortcut(action->shortcut(), this); connect(shortcut, SIGNAL(activated()), action, SLOT(trigger())); shortcuts_ << shortcut; +#endif } void QxtGlobalShortcutBackend::DoUnregister() { +#ifndef Q_OS_HAIKU qLog(Debug) << "unregistering"; qDeleteAll(shortcuts_); shortcuts_.clear(); +#endif } diff --git a/src/core/utilities.cpp b/src/core/utilities.cpp index ddbdb53..d0b97a9 100644 --- a/src/core/utilities.cpp +++ b/src/core/utilities.cpp @@ -350,6 +350,9 @@ QString GetConfigPath(ConfigPath config) { #ifdef Q_OS_DARWIN return mac::GetApplicationSupportPath() + "/" + QCoreApplication::organizationName(); +#elif defined(Q_OS_HAIKU) + return QString("%1/config/settings/%2") + .arg(QDir::homePath(), QCoreApplication::organizationName()); #else return QString("%1/%2").arg( QStandardPaths::writableLocation(QStandardPaths::ConfigLocation), @@ -361,7 +364,7 @@ QString GetConfigPath(ConfigPath config) { if (Application::kIsPortable) { return GetConfigPath(Path_Root) + "/cache"; } -#if defined(Q_OS_UNIX) && !defined(Q_OS_DARWIN) +#if defined(Q_OS_UNIX) && !defined(Q_OS_DARWIN) && !defined(Q_OS_HAIKU) return QString("%1/%2").arg(QStandardPaths::writableLocation( QStandardPaths::GenericCacheLocation), QCoreApplication::organizationName()); diff --git a/src/library/librarysettingspage.cpp b/src/library/librarysettingspage.cpp index 91a8614..3ca9eee 100644 --- a/src/library/librarysettingspage.cpp +++ b/src/library/librarysettingspage.cpp @@ -132,7 +132,7 @@ void LibrarySettingsPage::Load() { s.beginGroup(LibraryWatcher::kSettingsGroup); ui_->startup_scan->setChecked(s.value("startup_scan", true).toBool()); - ui_->monitor->setChecked(s.value("monitor", true).toBool()); + ui_->monitor->setChecked(s.value("monitor", false).toBool()); QStringList filters = s.value("cover_art_patterns", QStringList() << "front" << "cover") diff --git a/src/main.cpp b/src/main.cpp index ec1e1f0..05fc675 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -462,5 +462,9 @@ int main(int argc, char* argv[]) { int ret = a.exec(); +#ifdef Q_OS_HAIKU + kill(::getpid(), SIGKILL); +#endif + return ret; } diff --git a/src/ui/appearancesettingspage.cpp b/src/ui/appearancesettingspage.cpp index 9f99f20..72af21d 100644 --- a/src/ui/appearancesettingspage.cpp +++ b/src/ui/appearancesettingspage.cpp @@ -108,7 +108,11 @@ void AppearanceSettingsPage::Load() { current_background_color_ = original_background_color_; InitColorSelectorsColors(); +#ifdef Q_OS_HAIKU + ui_->b_use_sys_icons->setChecked(s.value("b_use_sys_icons", true).toBool()); +#else ui_->b_use_sys_icons->setChecked(s.value("b_use_sys_icons", false).toBool()); +#endif ui_->b_hide_filter_toolbar->setChecked( s.value("b_hide_filter_toolbar", false).toBool()); s.endGroup(); diff --git a/src/ui/iconloader.cpp b/src/ui/iconloader.cpp index 8508e02..5c51a65 100644 --- a/src/ui/iconloader.cpp +++ b/src/ui/iconloader.cpp @@ -42,7 +42,11 @@ void IconLoader::Init() { << ""; QSettings settings; settings.beginGroup(Appearance::kSettingsGroup); +#ifdef Q_OS_HAIKU + use_sys_icons_ = settings.value("b_use_sys_icons", true).toBool(); +#else use_sys_icons_ = settings.value("b_use_sys_icons", false).toBool(); +#endif } QIcon IconLoader::Load(const QString& name, const IconType& icontype) { diff --git a/src/ui/mainwindow.cpp b/src/ui/mainwindow.cpp index 7f72f32..08c5a80 100644 --- a/src/ui/mainwindow.cpp +++ b/src/ui/mainwindow.cpp @@ -268,13 +268,13 @@ MainWindow::MainWindow(Application* app, SystemTrayIcon* tray_icon, OSD* osd, IconLoader::Load("folder-sound", IconLoader::Base), tr("Library")); ui_->tabs->addTab(file_view_, - IconLoader::Load("document-open", IconLoader::Base), + IconLoader::Load("folder-open", IconLoader::Base), tr("Files")); ui_->tabs->addTab(playlist_list_, - IconLoader::Load("view-media-playlist", IconLoader::Base), + IconLoader::Load("folder-text", IconLoader::Base), tr("Playlists")); ui_->tabs->addTab(internet_view_, - IconLoader::Load("applications-internet", IconLoader::Base), + IconLoader::Load("folder-network", IconLoader::Base), tr("Internet")); ui_->tabs->addTab( device_view_container_, @@ -389,8 +389,8 @@ MainWindow::MainWindow(Application* app, SystemTrayIcon* tray_icon, OSD* osd, IconLoader::Load("document-save", IconLoader::Base)); ui_->action_full_library_scan->setIcon( IconLoader::Load("view-refresh", IconLoader::Base)); - ui_->action_rain->setIcon( - IconLoader::Load("weather-showers-scattered", IconLoader::Base)); +// ui_->action_rain->setIcon( +// IconLoader::Load("weather-showers-scattered", IconLoader::Base)); ui_->action_hypnotoad->setIcon( IconLoader::Load("hypnotoad", IconLoader::Base)); ui_->action_kittens->setIcon(IconLoader::Load("kittens", IconLoader::Base)); @@ -486,7 +486,7 @@ MainWindow::MainWindow(Application* app, SystemTrayIcon* tray_icon, OSD* osd, connect(ui_->action_view_stream_details, SIGNAL(triggered()), SLOT(DiscoverStreamDetails())); - background_streams_->AddAction("Rain", ui_->action_rain); +// background_streams_->AddAction("Rain", ui_->action_rain); background_streams_->AddAction("Hypnotoad", ui_->action_hypnotoad); background_streams_->AddAction("Make it so!", ui_->action_enterprise); diff --git a/src/ui/mainwindow.ui b/src/ui/mainwindow.ui index bef7b14..0faf4dc 100644 --- a/src/ui/mainwindow.ui +++ b/src/ui/mainwindow.ui @@ -532,7 +532,6 @@ &Extras - @@ -726,14 +725,6 @@ Cover Manager - - - true - - - Rain - - true diff --git a/src/ui/notificationssettingspage.cpp b/src/ui/notificationssettingspage.cpp index 75733d3..5fca7e0 100644 --- a/src/ui/notificationssettingspage.cpp +++ b/src/ui/notificationssettingspage.cpp @@ -99,7 +99,9 @@ NotificationsSettingsPage::NotificationsSettingsPage(SettingsDialog* dialog) if (!OSD::SupportsNativeNotifications()) ui_->notifications_native->setEnabled(false); if (!OSD::SupportsTrayPopups()) ui_->notifications_tray->setEnabled(false); - +#ifdef Q_OS_HAIKU + ui_->notifications_pretty->setEnabled(false); +#endif connect(ui_->notifications_pretty, SIGNAL(toggled(bool)), SLOT(UpdatePopupVisible())); @@ -135,7 +137,11 @@ void NotificationsSettingsPage::Load() { s.beginGroup(OSD::kSettingsGroup); OSD::Behaviour osd_behaviour = +#ifdef Q_OS_HAIKU + OSD::Behaviour(s.value("Behaviour", OSD::TrayPopup).toInt()); +#else OSD::Behaviour(s.value("Behaviour", OSD::Native).toInt()); +#endif switch (osd_behaviour) { case OSD::Native: if (OSD::SupportsNativeNotifications()) { @@ -180,6 +186,11 @@ void NotificationsSettingsPage::Load() { ui_->notifications_pretty->isChecked()); #endif +#ifdef Q_OS_HAIKU + ui_->notifications_options->setEnabled( + ui_->notifications_tray->isChecked()); +#endif + // Pretty OSD pretty_popup_->ReloadSettings(); ui_->notifications_opacity->setValue(pretty_popup_->background_opacity() * diff --git a/src/widgets/osd.cpp b/src/widgets/osd.cpp index 5cdea66..064bce7 100644 --- a/src/widgets/osd.cpp +++ b/src/widgets/osd.cpp @@ -65,7 +65,11 @@ OSD::~OSD() { delete pretty_popup_; } void OSD::ReloadSettings() { QSettings s; s.beginGroup(kSettingsGroup); +#ifdef Q_OS_HAIKU + behaviour_ = OSD::Behaviour(s.value("Behaviour", TrayPopup).toInt()); +#else behaviour_ = OSD::Behaviour(s.value("Behaviour", Native).toInt()); +#endif timeout_msec_ = s.value("Timeout", 5000).toInt(); show_on_volume_change_ = s.value("ShowOnVolumeChange", false).toBool(); show_art_ = s.value("ShowArt", true).toBool(); -- 2.28.0