Files
eden/src/qt_common/qt_common.h
T
crueter 9c3bdeffc0 [desktop] Prefer X11, but allow Wayland (with a warning) (#4579)
Use `xcb;wayland` as the default value for `QT_QPA_PLATFORM` which will
always try X11 first, then only fallback to Wayland if, for some reason,
X11 is unavailable or unable to initialize.

This also prints a warning to the log if the backend is wayland. Might
be promoted to a warning dialog if this becomes a consistent-enough
issue to warrant a more obvious warning.

Requires removing the wayland hook from the AppImage

Signed-off-by: crueter <crueter@eden-emu.dev>

- [x] I have read and followed the [Contribution Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/CONTRIBUTING.md#code-contributions).
- [x] I have read and followed the [AI Policy](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/AI.md).
- [x] I have read and followed the [Coding Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/Coding.md) to the best of my ability.

-------------------

Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/4579
Reviewed-by: lizzie <lizzie@eden-emu.dev>
2026-11-02 23:40:12 +01:00

67 lines
1.7 KiB
C++

// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
#pragma once
#include <memory>
#include <QWindow>
#include "core/core.h"
#include "core/file_sys/registered_cache.h"
#include "core/frontend/emu_window.h"
#include "qt_common/render/emu_thread.h"
#include "core/file_sys/vfs/vfs_real.h"
enum class StartGameType {
Normal, // Can use custom configuration
Global, // Only uses global configuration
};
namespace QtCommon {
// TODO: Remove QWidget dependency
extern QWidget* rootObject;
extern std::unique_ptr<Core::System> system;
extern std::shared_ptr<FileSys::RealVfsFilesystem> vfs;
extern std::unique_ptr<FileSys::ManualContentProvider> provider;
extern std::unique_ptr<EmuThread> emu_thread;
extern const QStringList supported_file_extensions;
typedef std::function<bool(std::size_t, std::size_t)> QtProgressCallback;
Core::Frontend::WindowSystemType GetWindowSystemType();
Core::Frontend::EmuWindow::WindowSystemInfo GetWindowSystemInfo(QWindow* window);
void Init(QWidget* root);
void SetupContentProviders();
void SetupHID();
// setup env vars, scaling, and app attributes
void SetupApplication();
const QString tr(const char* str);
const QString tr(const std::string& str);
// TODO: Find a better place for these
/// Convert a size in bytes into a readable format (KiB, MiB, etc.)
[[nodiscard]] QString ReadableByteSize(qulonglong size);
/**
* Creates a circle pixmap from a specified color
* @param color The color the pixmap shall have
* @return QPixmap circle pixmap
*/
[[nodiscard]] QPixmap CreateCirclePixmapFromColor(const QColor& color);
std::filesystem::path GetEdenCommand();
} // namespace QtCommon