diff --git a/qimgv/components/directorymanager/watchers/directorywatcher.cpp b/qimgv/components/directorymanager/watchers/directorywatcher.cpp index eddd81ab..4013e81c 100644 --- a/qimgv/components/directorymanager/watchers/directorywatcher.cpp +++ b/qimgv/components/directorymanager/watchers/directorywatcher.cpp @@ -1,6 +1,6 @@ #include "directorywatcher_p.h" -#ifdef __linux__ +#if defined(__linux__) || defined(__FreeBSD__) #include "linux/linuxwatcher.h" #elif _WIN32 #include "windows/windowswatcher.h" @@ -34,7 +34,7 @@ DirectoryWatcher *DirectoryWatcher::newInstance() { DirectoryWatcher* watcher; -#ifdef __linux__ +#if defined(__linux__) || defined(__FreeBSD__) watcher = new LinuxWatcher(); #elif _WIN32 watcher = new WindowsWatcher(); diff --git a/qimgv/core.cpp b/qimgv/core.cpp index 15d6e11a..a7d747e5 100644 --- a/qimgv/core.cpp +++ b/qimgv/core.cpp @@ -728,7 +728,7 @@ void Core::showInDirectory() { QDesktopServices::openUrl(QUrl::fromLocalFile(model->directoryPath())); return; } -#ifdef __linux__ +#if defined(__linux__) || defined(__FreeBSD__) QString fm = ScriptManager::runCommand("xdg-mime query default inode/directory"); if(fm.contains("dolphin")) ScriptManager::runCommandDetached("dolphin --select " + selectedPath()); diff --git a/qimgv/settings.cpp b/qimgv/settings.cpp index 98863dba..45cbc9cc 100644 --- a/qimgv/settings.cpp +++ b/qimgv/settings.cpp @@ -3,7 +3,7 @@ Settings *settings = nullptr; Settings::Settings(QObject *parent) : QObject(parent) { -#ifdef __linux__ +#if defined(__linux__) || defined(__FreeBSD__) // config files QSettings::setDefaultFormat(QSettings::NativeFormat); settingsConf = new QSettings(); @@ -38,7 +38,7 @@ Settings *Settings::getInstance() { } //------------------------------------------------------------------------------ void Settings::setupCache() { -#ifdef __linux__ +#if defined(__linux__) || defined(__FreeBSD__) QString genericCacheLocation = QStandardPaths::writableLocation(QStandardPaths::GenericCacheLocation); if(genericCacheLocation.isEmpty()) genericCacheLocation = QDir::homePath() + "/.cache"; @@ -294,6 +294,8 @@ QString Settings::mpvBinary() { mpvPath = QCoreApplication::applicationDirPath() + "/mpv.exe"; #elif defined __linux__ mpvPath = "/usr/bin/mpv"; + #elif defined __FreeBSD__ + mpvPath = "/usr/local/bin/mpv"; #endif if(!QFile::exists(mpvPath)) mpvPath = ""; diff --git a/qimgv/shortcutbuilder.cpp b/qimgv/shortcutbuilder.cpp index 0d3d2e64..5fa89ef5 100644 --- a/qimgv/shortcutbuilder.cpp +++ b/qimgv/shortcutbuilder.cpp @@ -64,7 +64,7 @@ QString ShortcutBuilder::processMouseEvent(QMouseEvent *event) { QString ShortcutBuilder::processKeyEvent(QKeyEvent *event) { if(event->type() != QEvent::KeyPress || isModifier(Qt::Key(event->key()))) return ""; -#if defined(__linux__) || defined(_WIN32) +#if defined(__linux__) || defined(__FreeBSD__) || defined(_WIN32) return fromEventNativeScanCode(event); #else return fromEventText(event); diff --git a/qimgv/utils/inputmap.cpp b/qimgv/utils/inputmap.cpp index 0eaa0142..5b2559d9 100644 --- a/qimgv/utils/inputmap.cpp +++ b/qimgv/utils/inputmap.cpp @@ -162,7 +162,7 @@ void InputMap::initKeyMap() { keyMap.insert( 57397 , "/" ); keyMap.insert( 57372 , "Enter" ); -#elif defined __linux__ +#elif defined(__linux__) || defined(__FreeBSD__) // linux keymap for qimgv // row 1 diff --git a/qimgv/utils/stuff.cpp b/qimgv/utils/stuff.cpp index d4b28950..2c240437 100644 --- a/qimgv/utils/stuff.cpp +++ b/qimgv/utils/stuff.cpp @@ -8,7 +8,7 @@ int clamp(int x, int lower, int upper) { int probeOS() { #ifdef TARGET_OS_MAC return 0; -#elif defined __linux__ +#elif defined(__linux__) || defined(__FreeBSD__) return 1; #elif defined _WIN32 || defined _WIN64 return 2; diff --git a/qimgv/utils/wallpapersetter.cpp b/qimgv/utils/wallpapersetter.cpp index f144e5e0..16f825f1 100644 --- a/qimgv/utils/wallpapersetter.cpp +++ b/qimgv/utils/wallpapersetter.cpp @@ -11,7 +11,7 @@ void WallpaperSetter::setWallpaper(QString path) { (PVOID) path.utf16(), SPIF_UPDATEINIFILE | SPIF_SENDWININICHANGE); qDebug() << "wallpaper changed:" << (ok ? "true" : "false"); -#elif defined __linux__ +#elif defined(__linux__) || defined(__FreeBSD__) QString command; command = "qdbus org.kde.plasmashell /PlasmaShell org.kde.PlasmaShell.evaluateScript \'var allDesktops = desktops(); print (allDesktops); for (i = 0; i < allDesktops.length; i++) { d = allDesktops[i]; d.wallpaperPlugin = \"org.kde.image\"; d.currentConfigGroup = Array(\"Wallpaper\", \"org.kde.image\", \"General\"); d.writeConfig(\"Image\", \"" + path + "\") } \'"; QProcess process;