Pencil2D Animation
Download Community News Docs Contribute
  • Overview
  • Articles
  • Code
  •  
  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • File List
Loading...
Searching...
No Matches
  • core_lib
  • src
  • external
  • linux
linux.cpp
1/*
2
3Pencil2D - Traditional Animation Software
4Copyright (C) 2005-2007 Patrick Corrieri & Pascal Naidon
5Copyright (C) 2009 Mj Mendoza IV
6Copyright (C) 2012-2020 Matthew Chiawen Chang
7
8This program is free software; you can redistribute it and/or
9modify it under the terms of the GNU General Public License
10as published by the Free Software Foundation; version 2 of the License.
11
12This program is distributed in the hope that it will be useful,
13but WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15GNU General Public License for more details.
16
17*/
18
19#include "platformhandler.h"
20
21#include <QCoreApplication>
22#include <QDebug>
23#include <QSettings>
24
25#include "pencildef.h"
26
27namespace PlatformHandler
28{
29 void configurePlatformSpecificSettings() {}
30
31 bool isDarkMode() { return false; }
32
33 void initialise()
34 {
35 /* If running as an AppImage, sets GStreamer environment variables to ensure
36 * the plugins contained in the AppImage are found
37 */
38 QString appDir = QString::fromLocal8Bit(qgetenv("APPDIR"));
39 if (!appDir.isEmpty())
40 {
41 bool success = qputenv("GST_PLUGIN_SYSTEM_PATH_1_0",
42 QString("%1/usr/lib/gstreamer-1.0:%2")
43 .arg(appDir, QString::fromLocal8Bit(qgetenv("GST_PLUGIN_SYSTEM_PATH_1_0")))
44 .toLocal8Bit());
45 success = qputenv("GST_PLUGIN_SCANNER_1_0",
46 QString("%1/usr/lib/gstreamer1.0/gstreamer-1.0/gst-plugin-scanner")
47 .arg(appDir).toLocal8Bit()) && success;
48 if (!success)
49 {
50 qWarning() << "Unable to set up GStreamer environment";
51 }
52 }
53
54#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
55 // Temporary solution for high DPI displays
56 // EnableHighDpiScaling is a just in case mechanism in the event that we
57 // want to disable this without recompiling, see #922
58 QSettings settings(PENCIL2D, PENCIL2D);
59 if (settings.value("EnableHighDpiScaling", "true").toBool())
60 {
61 // Enable auto screen scaling on high dpi display, for example, a 4k monitor
62 // This attr has to be set before the QApplication is constructed
63 // Only works on Windows & X11
64 QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
65 }
66#endif // QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
67 }
68}
QCoreApplication::setAttribute
void setAttribute(Qt::ApplicationAttribute attribute, bool on)
QSettings
QString
QString::fromLocal8Bit
QString fromLocal8Bit(const char *str, int size)
QString::isEmpty
bool isEmpty() const const
Qt::AA_EnableHighDpiScaling
AA_EnableHighDpiScaling
Generated on Thu Jun 5 2025 14:06:43 for Pencil2D by doxygen 1.9.6 based on revision 4c63407997b2c03e5048716586dec6fbbb755173