feat: use platform native styles when possible
With Qt 6.7+ Light and Dark theme support is now provided by the mac os default theme
This commit is contained in:
parent
77c4707ec5
commit
4359075b06
3 changed files with 9 additions and 66 deletions
|
|
@ -1,30 +0,0 @@
|
||||||
/*
|
|
||||||
* Deskflow -- mouse and keyboard sharing utility
|
|
||||||
* Copyright (C) 2012 Symless Ltd.
|
|
||||||
* Copyright (C) 2008 Volker Lanz (vl@fidra.de)
|
|
||||||
*
|
|
||||||
* This package is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU General Public License
|
|
||||||
* found in the file LICENSE that should have accompanied this file.
|
|
||||||
*
|
|
||||||
* This package is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "DeskflowApplication.h"
|
|
||||||
|
|
||||||
#include "MainWindow.h"
|
|
||||||
|
|
||||||
DeskflowApplication::DeskflowApplication(int &argc, char **argv) : QApplication(argc, argv)
|
|
||||||
{
|
|
||||||
|
|
||||||
if (qEnvironmentVariable("XDG_CURRENT_DESKTOP") != QLatin1String("KDE")) {
|
|
||||||
// causes dark mode to be used on some OS (e.g. Windows)
|
|
||||||
setStyle("fusion");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,30 +0,0 @@
|
||||||
/*
|
|
||||||
* Deskflow -- mouse and keyboard sharing utility
|
|
||||||
* Copyright (C) 2012 Symless Ltd.
|
|
||||||
* Copyright (C) 2008 Volker Lanz (vl@fidra.de)
|
|
||||||
*
|
|
||||||
* This package is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU General Public License
|
|
||||||
* found in the file LICENSE that should have accompanied this file.
|
|
||||||
*
|
|
||||||
* This package is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <QApplication>
|
|
||||||
|
|
||||||
class QSessionManager;
|
|
||||||
|
|
||||||
class DeskflowApplication : public QApplication
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
DeskflowApplication(int &argc, char **argv);
|
|
||||||
~DeskflowApplication() override = default;
|
|
||||||
};
|
|
||||||
|
|
@ -16,7 +16,6 @@
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "DeskflowApplication.h"
|
|
||||||
#include "MainWindow.h"
|
#include "MainWindow.h"
|
||||||
#include "SetupWizard.h"
|
#include "SetupWizard.h"
|
||||||
#include "common/constants.h"
|
#include "common/constants.h"
|
||||||
|
|
@ -83,7 +82,14 @@ int main(int argc, char *argv[])
|
||||||
// used as a prefix for settings paths, and must not be a url.
|
// used as a prefix for settings paths, and must not be a url.
|
||||||
QCoreApplication::setOrganizationDomain(kOrgDomain);
|
QCoreApplication::setOrganizationDomain(kOrgDomain);
|
||||||
|
|
||||||
DeskflowApplication app(argc, argv);
|
QApplication app(argc, argv);
|
||||||
|
|
||||||
|
#if !defined(Q_OS_MAC)
|
||||||
|
// causes dark mode to be used on some DE's
|
||||||
|
if (qEnvironmentVariable("XDG_CURRENT_DESKTOP") != QLatin1String("KDE")) {
|
||||||
|
qApp->setStyle("fusion");
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
qInstallMessageHandler(deskflow::gui::messages::messageHandler);
|
qInstallMessageHandler(deskflow::gui::messages::messageHandler);
|
||||||
QString version = QString::fromStdString(deskflow::version());
|
QString version = QString::fromStdString(deskflow::version());
|
||||||
|
|
@ -136,16 +142,13 @@ int main(int argc, char *argv[])
|
||||||
}
|
}
|
||||||
|
|
||||||
MainWindow mainWindow(configScopes, appConfig);
|
MainWindow mainWindow(configScopes, appConfig);
|
||||||
|
|
||||||
QObject::connect(&app, &DeskflowApplication::aboutToQuit, &mainWindow, &MainWindow::onAppAboutToQuit);
|
|
||||||
|
|
||||||
mainWindow.open();
|
mainWindow.open();
|
||||||
|
|
||||||
#ifdef DESKFLOW_GUI_HOOK_START
|
#ifdef DESKFLOW_GUI_HOOK_START
|
||||||
DESKFLOW_GUI_HOOK_START
|
DESKFLOW_GUI_HOOK_START
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return DeskflowApplication::exec();
|
return qApp->exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(Q_OS_MAC)
|
#if defined(Q_OS_MAC)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue