From df3958e43a427b61fa4d28ecd96077e79dabe584 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danilo=20Eg=C3=AAa=20Gondolfo?= Date: Sun, 1 Jul 2018 08:45:49 -0300 Subject: [PATCH] Use defined(Q_OS_LINUX) || defined(Q_OS_UNIX) where applicable to support BSD OSs. (#264) --- src/config/geneneralconf.cpp | 4 ++-- src/core/controller.cpp | 4 ++-- src/main.cpp | 4 ++-- src/tools/pin/pintool.cpp | 2 +- src/utils/confighandler.cpp | 4 ++-- src/utils/pathinfo.cpp | 2 +- src/utils/screengrabber.cpp | 4 ++-- src/utils/systemnotification.cpp | 2 +- 8 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/config/geneneralconf.cpp b/src/config/geneneralconf.cpp index 3534d414..23e64d61 100644 --- a/src/config/geneneralconf.cpp +++ b/src/config/geneneralconf.cpp @@ -48,7 +48,7 @@ void GeneneralConf::updateComponents() { m_sysNotifications->setChecked(config.desktopNotificationValue()); m_autostart->setChecked(config.startupLaunchValue()); -#ifdef Q_OS_LINUX +#if defined(Q_OS_LINUX) || defined(Q_OS_UNIX) m_showTray->setChecked(!config.disabledTrayIconValue()); #endif } @@ -155,7 +155,7 @@ void GeneneralConf::initShowDesktopNotification() { } void GeneneralConf::initShowTrayIcon() { -#ifdef Q_OS_LINUX +#if defined(Q_OS_LINUX) || defined(Q_OS_UNIX) m_showTray = new QCheckBox(tr("Show tray icon"), this); ConfigHandler config; bool checked = !config.disabledTrayIconValue(); diff --git a/src/core/controller.cpp b/src/core/controller.cpp index 12c83d17..0422e286 100644 --- a/src/core/controller.cpp +++ b/src/core/controller.cpp @@ -41,7 +41,7 @@ Controller::Controller() : m_captureWindow(nullptr) { qApp->setQuitOnLastWindowClosed(false); // init tray icon -#if defined(Q_OS_LINUX) +#if defined(Q_OS_LINUX) || defined(Q_OS_UNIX) if (!ConfigHandler().disabledTrayIconValue()) { enableTrayIcon(); } @@ -204,7 +204,7 @@ void Controller::enableTrayIcon() { } void Controller::disableTrayIcon() { -#ifdef Q_OS_LINUX +#if defined(Q_OS_LINUX) || defined(Q_OS_UNIX) if (m_trayIcon) { m_trayIcon->deleteLater(); } diff --git a/src/main.cpp b/src/main.cpp index cfe07587..d1b318ea 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -29,7 +29,7 @@ #include #include -#ifdef Q_OS_LINUX +#if defined(Q_OS_LINUX) || defined(Q_OS_UNIX) #include "src/core/flameshotdbusadapter.h" #include "src/utils/dbusutils.h" #include @@ -64,7 +64,7 @@ int main(int argc, char *argv[]) { app.setOrganizationName("Dharkael"); auto c = Controller::getInstance(); -#ifdef Q_OS_LINUX +#if defined(Q_OS_LINUX) || defined(Q_OS_UNIX) new FlameshotDBusAdapter(c); QDBusConnection dbus = QDBusConnection::sessionBus(); if (!dbus.isConnected()) { diff --git a/src/tools/pin/pintool.cpp b/src/tools/pin/pintool.cpp index 474660be..87831738 100755 --- a/src/tools/pin/pintool.cpp +++ b/src/tools/pin/pintool.cpp @@ -45,7 +45,7 @@ QString PinTool::description() const { QWidget* PinTool::widget() { PinWidget *w = new PinWidget(m_pixmap); const int &&m = w->margin(); -#ifdef Q_OS_LINUX +#if defined(Q_OS_LINUX) || defined(Q_OS_UNIX) QRect adjusted_pos = m_geometry + QMargins(m,-m,-m,-m); #else QRect adjusted_pos = m_geometry + QMargins(m, m, m, m); diff --git a/src/utils/confighandler.cpp b/src/utils/confighandler.cpp index 2c323e98..6eef22a0 100644 --- a/src/utils/confighandler.cpp +++ b/src/utils/confighandler.cpp @@ -240,7 +240,7 @@ void ConfigHandler::setKeepOpenAppLauncher(const bool keepOpen) { bool ConfigHandler::startupLaunchValue() { bool res = false; -#if defined(Q_OS_LINUX) +#if defined(Q_OS_LINUX) || defined(Q_OS_UNIX) QString path = QDir::homePath() + "/.config/autostart/Flameshot.desktop"; res = QFile(path).exists(); #elif defined(Q_OS_WIN) @@ -254,7 +254,7 @@ bool ConfigHandler::startupLaunchValue() { } void ConfigHandler::setStartupLaunch(const bool start) { -#if defined(Q_OS_LINUX) +#if defined(Q_OS_LINUX) || defined(Q_OS_UNIX) QString path = QDir::homePath() + "/.config/autostart/Flameshot.desktop"; QFile file(path); if (start) { diff --git a/src/utils/pathinfo.cpp b/src/utils/pathinfo.cpp index 18340d14..6b50577d 100644 --- a/src/utils/pathinfo.cpp +++ b/src/utils/pathinfo.cpp @@ -41,7 +41,7 @@ QStringList PathInfo::translationsPaths() { QString binaryPath = QFileInfo(qApp->applicationDirPath()) .absoluteFilePath(); QString trPath = QDir::toNativeSeparators(binaryPath + "/translations") ; -#if defined(Q_OS_LINUX) +#if defined(Q_OS_LINUX) || defined(Q_OS_UNIX) return QStringList() << QString(APP_PREFIX) + "/share/flameshot/translations" << trPath diff --git a/src/utils/screengrabber.cpp b/src/utils/screengrabber.cpp index f7d34305..0545d6ae 100644 --- a/src/utils/screengrabber.cpp +++ b/src/utils/screengrabber.cpp @@ -24,7 +24,7 @@ #include #include -#ifdef Q_OS_LINUX +#if defined(Q_OS_LINUX) || defined(Q_OS_UNIX) #include #include #include @@ -36,7 +36,7 @@ ScreenGrabber::ScreenGrabber(QObject *parent) : QObject(parent) { QPixmap ScreenGrabber::grabEntireDesktop(bool &ok) { ok = true; -#ifdef Q_OS_LINUX +#if defined(Q_OS_LINUX) || defined(Q_OS_UNIX) if(m_info.waylandDectected()) { QPixmap res; // handle screenshot based on DE diff --git a/src/utils/systemnotification.cpp b/src/utils/systemnotification.cpp index 7284c626..d2edb364 100644 --- a/src/utils/systemnotification.cpp +++ b/src/utils/systemnotification.cpp @@ -10,7 +10,7 @@ #endif #include "src/core/controller.h" -#ifdef Q_OS_LINUX +#if defined(Q_OS_LINUX) || defined(Q_OS_UNIX) SystemNotification::SystemNotification(QObject *parent) : QObject(parent) { m_interface = new QDBusInterface(QStringLiteral("org.freedesktop.Notifications"), QStringLiteral("/org/freedesktop/Notifications"),