refactor: Add deskflow::platform::isMac
This commit is contained in:
parent
5256f05963
commit
f89e857223
4 changed files with 28 additions and 20 deletions
|
|
@ -10,6 +10,7 @@
|
||||||
#include "common/Constants.h"
|
#include "common/Constants.h"
|
||||||
#include "common/ExitCodes.h"
|
#include "common/ExitCodes.h"
|
||||||
#include "common/I18N.h"
|
#include "common/I18N.h"
|
||||||
|
#include "common/PlatformInfo.h"
|
||||||
#include "common/UrlConstants.h"
|
#include "common/UrlConstants.h"
|
||||||
#include "gui/Diagnostic.h"
|
#include "gui/Diagnostic.h"
|
||||||
#include "gui/Logger.h"
|
#include "gui/Logger.h"
|
||||||
|
|
@ -118,12 +119,9 @@ int main(int argc, char *argv[])
|
||||||
return s_exitDuplicate;
|
return s_exitDuplicate;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !defined(Q_OS_MAC)
|
if (!deskflow::platform::isMac() && qEnvironmentVariable("XDG_CURRENT_DESKTOP") != QLatin1String("KDE")) {
|
||||||
// causes dark mode to be used on some DE's
|
|
||||||
if (qEnvironmentVariable("XDG_CURRENT_DESKTOP") != QLatin1String("KDE")) {
|
|
||||||
QApplication::setStyle("fusion");
|
QApplication::setStyle("fusion");
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
// Sets the fallback icon path and fallback theme
|
// Sets the fallback icon path and fallback theme
|
||||||
updateIconTheme();
|
updateIconTheme();
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,15 @@ inline bool isWindows()
|
||||||
return QSysInfo::productType() == QStringLiteral("windows");
|
return QSysInfo::productType() == QStringLiteral("windows");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief isMac
|
||||||
|
* @return Returns true if we are running on mac os
|
||||||
|
*/
|
||||||
|
inline bool isMac()
|
||||||
|
{
|
||||||
|
return QSysInfo::productType() == QStringLiteral("macos");
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief isFlatpak
|
* @brief isFlatpak
|
||||||
* @return Returns true if we are running as flatpak
|
* @return Returns true if we are running as flatpak
|
||||||
|
|
|
||||||
|
|
@ -222,13 +222,13 @@ void MainWindow::setupControls()
|
||||||
ui->lineEditName->setValidator(new QRegularExpressionValidator(m_nameRegEx, this));
|
ui->lineEditName->setValidator(new QRegularExpressionValidator(m_nameRegEx, this));
|
||||||
ui->lineEditName->setVisible(false);
|
ui->lineEditName->setVisible(false);
|
||||||
|
|
||||||
#if defined(Q_OS_MAC)
|
if (deskflow::platform::isMac()) {
|
||||||
ui->rbModeServer->setAttribute(Qt::WA_MacShowFocusRect, 0);
|
ui->rbModeServer->setAttribute(Qt::WA_MacShowFocusRect, false);
|
||||||
ui->rbModeClient->setAttribute(Qt::WA_MacShowFocusRect, 0);
|
ui->rbModeClient->setAttribute(Qt::WA_MacShowFocusRect, false);
|
||||||
ui->btnSaveServerConfig->setFixedWidth(ui->btnSaveServerConfig->height());
|
ui->btnSaveServerConfig->setFixedWidth(ui->btnSaveServerConfig->height());
|
||||||
#else
|
} else {
|
||||||
ui->btnSaveServerConfig->setIconSize(QSize(22, 22));
|
ui->btnSaveServerConfig->setIconSize(QSize(22, 22));
|
||||||
#endif
|
}
|
||||||
|
|
||||||
static const auto btnHeight = ui->statusBar->height() - 2;
|
static const auto btnHeight = ui->statusBar->height() - 2;
|
||||||
static const auto btnSize = QSize(btnHeight, btnHeight);
|
static const auto btnSize = QSize(btnHeight, btnHeight);
|
||||||
|
|
@ -295,10 +295,9 @@ void MainWindow::connectSlots()
|
||||||
|
|
||||||
connect(&m_versionChecker, &VersionChecker::updateFound, this, &MainWindow::versionCheckerUpdateFound);
|
connect(&m_versionChecker, &VersionChecker::updateFound, this, &MainWindow::versionCheckerUpdateFound);
|
||||||
|
|
||||||
// Mac os tray will only show a menu
|
// Mac os tray will only show a menu
|
||||||
#ifndef Q_OS_MAC
|
if (!deskflow::platform::isMac())
|
||||||
connect(m_trayIcon, &QSystemTrayIcon::activated, this, &MainWindow::trayIconActivated);
|
connect(m_trayIcon, &QSystemTrayIcon::activated, this, &MainWindow::trayIconActivated);
|
||||||
#endif
|
|
||||||
|
|
||||||
connect(&m_serverConnection, &ServerConnection::configureClient, this, &MainWindow::serverConnectionConfigureClient);
|
connect(&m_serverConnection, &ServerConnection::configureClient, this, &MainWindow::serverConnectionConfigureClient);
|
||||||
connect(&m_serverConnection, &ServerConnection::clientsChanged, this, &MainWindow::serverClientsChanged);
|
connect(&m_serverConnection, &ServerConnection::clientsChanged, this, &MainWindow::serverClientsChanged);
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "LogWidget.h"
|
#include "LogWidget.h"
|
||||||
|
#include "common/PlatformInfo.h"
|
||||||
|
|
||||||
#include <gui/Logger.h>
|
#include <gui/Logger.h>
|
||||||
|
|
||||||
|
|
@ -19,11 +20,12 @@ LogWidget::LogWidget(QWidget *parent) : QWidget{parent}, m_textLog{new QPlainTex
|
||||||
|
|
||||||
// setup the log font
|
// setup the log font
|
||||||
m_textLog->setFont(QFontDatabase::systemFont(QFontDatabase::FixedFont));
|
m_textLog->setFont(QFontDatabase::systemFont(QFontDatabase::FixedFont));
|
||||||
#ifdef Q_OS_MAC
|
if (deskflow::platform::isMac()) {
|
||||||
auto f = m_textLog->font();
|
auto f = m_textLog->font();
|
||||||
f.setPixelSize(12);
|
f.setPixelSize(12);
|
||||||
m_textLog->setFont(f);
|
m_textLog->setFont(f);
|
||||||
#endif
|
}
|
||||||
|
|
||||||
auto layout = new QVBoxLayout;
|
auto layout = new QVBoxLayout;
|
||||||
layout->setContentsMargins(0, 0, 0, 0);
|
layout->setContentsMargins(0, 0, 0, 0);
|
||||||
layout->addWidget(m_textLog);
|
layout->addWidget(m_textLog);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue