Skip to content

Commit

Permalink
Merge pull request #560 from kenrap/add-freebsd-support
Browse files Browse the repository at this point in the history
Add FreeBSD Support
  • Loading branch information
easymodo authored Jul 27, 2024
2 parents 5dc2978 + 6b79c6e commit 82e6b75
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -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"
Expand Down Expand Up @@ -34,7 +34,7 @@ DirectoryWatcher *DirectoryWatcher::newInstance()
{
DirectoryWatcher* watcher;

#ifdef __linux__
#if defined(__linux__) || defined(__FreeBSD__)
watcher = new LinuxWatcher();
#elif _WIN32
watcher = new WindowsWatcher();
Expand Down
2 changes: 1 addition & 1 deletion qimgv/core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
6 changes: 4 additions & 2 deletions qimgv/settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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";
Expand Down Expand Up @@ -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 = "";
Expand Down
2 changes: 1 addition & 1 deletion qimgv/shortcutbuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion qimgv/utils/inputmap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion qimgv/utils/stuff.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion qimgv/utils/wallpapersetter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 82e6b75

Please # to comment.