Qt: Add file patcher

This commit is contained in:
wheremyfoodat 2024-05-07 23:08:24 +03:00
parent 70f443b06e
commit 66bcf384f3
9 changed files with 206 additions and 2 deletions

View file

@ -0,0 +1,21 @@
#pragma once
#include <QFontMetrics>
#include <QLabel>
#include <QString>
#include <QWidget>
class EllidedLabel : public QLabel {
Q_OBJECT
public:
explicit EllidedLabel(Qt::TextElideMode elideMode = Qt::ElideLeft, QWidget* parent = nullptr);
explicit EllidedLabel(QString text, Qt::TextElideMode elideMode = Qt::ElideLeft, QWidget* parent = nullptr);
void setText(QString text);
protected:
void resizeEvent(QResizeEvent* event);
private:
void updateText();
QString m_text;
Qt::TextElideMode m_elideMode;
};

View file

@ -17,6 +17,7 @@
#include "panda_qt/about_window.hpp"
#include "panda_qt/cheats_window.hpp"
#include "panda_qt/config_window.hpp"
#include "panda_qt/patch_window.hpp"
#include "panda_qt/screen.hpp"
#include "panda_qt/text_editor.hpp"
#include "services/hid.hpp"
@ -90,13 +91,14 @@ class MainWindow : public QMainWindow {
std::mutex messageQueueMutex;
std::vector<EmulatorMessage> messageQueue;
QMenuBar* menuBar = nullptr;
InputMappings keyboardMappings;
ScreenWidget screen;
AboutWindow* aboutWindow;
ConfigWindow* configWindow;
CheatsWindow* cheatsEditor;
TextEditorWindow* luaEditor;
QMenuBar* menuBar = nullptr;
PatchWindow* patchWindow;
// We use SDL's game controller API since it's the sanest API that supports as many controllers as possible
SDL_GameController* gameController = nullptr;
@ -110,6 +112,7 @@ class MainWindow : public QMainWindow {
void dumpRomFS();
void openLuaEditor();
void openCheatsEditor();
void openPatchWindow();
void showAboutMenu();
void initControllers();
void pollControllers();

View file

@ -0,0 +1,21 @@
#pragma once
#include <QLabel>
#include <QWidget>
#include <filesystem>
#include "panda_qt/ellided_label.hpp"
class PatchWindow final : public QWidget {
Q_OBJECT
public:
PatchWindow(QWidget* parent = nullptr);
~PatchWindow() = default;
private:
std::filesystem::path inputPath = "";
std::filesystem::path patchPath = "";
EllidedLabel* inputPathLabel = nullptr;
EllidedLabel* patchPathLabel = nullptr;
};