eden-miror/src/yuzu/migration_dialog.cpp
crueter 8678cb06eb
Some checks failed
tx-src / sources (push) Has been cancelled
Check Strings / check-strings (push) Has been cancelled
[meta] clang-format literally all of the Qt code (#3706)
I'm tired of dealing with this tbh

Signed-off-by: crueter <crueter@eden-emu.dev>
Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/3706
Reviewed-by: Lizzie <lizzie@eden-emu.dev>
2026-03-10 06:51:08 +01:00

56 lines
1.3 KiB
C++

// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
#include "migration_dialog.h"
#include <QApplication>
#include <QCheckBox>
#include <QLabel>
#include <QPushButton>
#include <QStyle>
MigrationDialog::MigrationDialog(QWidget* parent) : QDialog(parent) {
QVBoxLayout* layout = new QVBoxLayout(this);
m_text = new QLabel(this);
m_boxes = new QVBoxLayout;
m_buttons = new QHBoxLayout;
layout->addWidget(m_text, 1);
layout->addLayout(m_boxes, 1);
layout->addLayout(m_buttons, 1);
}
MigrationDialog::~MigrationDialog() {
m_boxes->deleteLater();
m_buttons->deleteLater();
}
void MigrationDialog::setText(const QString& text) {
m_text->setText(text);
}
void MigrationDialog::addBox(QWidget* box) {
m_boxes->addWidget(box);
}
QAbstractButton* MigrationDialog::addButton(const QString& text, const bool reject) {
QAbstractButton* button = new QPushButton(this);
button->setText(text);
m_buttons->addWidget(button, 1);
connect(button, &QAbstractButton::clicked, this, [this, button, reject]() {
m_clickedButton = button;
if (reject) {
this->reject();
} else {
this->accept();
}
});
return button;
}
QAbstractButton* MigrationDialog::clickedButton() const {
return m_clickedButton;
}