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 void initialise()
32 {
33 /* If running as an AppImage, sets GStreamer environment variables to ensure
34 * the plugins contained in the AppImage are found
35 */
36 QString appDir = QString::fromLocal8Bit(qgetenv("APPDIR"));
37 if (!appDir.isEmpty())
38 {
39 bool success = qputenv("GST_PLUGIN_SYSTEM_PATH_1_0",
40 QString("%1/usr/lib/gstreamer-1.0:%2")
41 .arg(appDir, QString::fromLocal8Bit(qgetenv("GST_PLUGIN_SYSTEM_PATH_1_0")))
42 .toLocal8Bit());
43 success = qputenv("GST_PLUGIN_SCANNER_1_0",
44 QString("%1/usr/lib/gstreamer1.0/gstreamer-1.0/gst-plugin-scanner")
45 .arg(appDir).toLocal8Bit()) && success;
46 if (!success)
47 {
48 qWarning() << "Unable to set up GStreamer environment";
49 }
50 }
51
52#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
53 // Temporary solution for high DPI displays
54 // EnableHighDpiScaling is a just in case mechanism in the event that we
55 // want to disable this without recompiling, see #922
56 QSettings settings(PENCIL2D, PENCIL2D);
57 if (settings.value("EnableHighDpiScaling", "true").toBool())
58 {
59 // Enable auto screen scaling on high dpi display, for example, a 4k monitor
60 // This attr has to be set before the QApplication is constructed
61 // Only works on Windows & X11
62 QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
63 }
64#endif // QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
65 }
66}
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 May 8 2025 04:47:53 for Pencil2D by doxygen 1.9.6 based on revision 4513250b1d5b1a3676ec0e67b06b7a885ceaae39