core: De-globalize movie (#6659)
This commit is contained in:
@@ -15,8 +15,9 @@
|
||||
#include "core/movie.h"
|
||||
#include "ui_movie_play_dialog.h"
|
||||
|
||||
MoviePlayDialog::MoviePlayDialog(QWidget* parent, GameList* game_list_)
|
||||
: QDialog(parent), ui(std::make_unique<Ui::MoviePlayDialog>()), game_list(game_list_) {
|
||||
MoviePlayDialog::MoviePlayDialog(QWidget* parent, GameList* game_list_, const Core::System& system_)
|
||||
: QDialog(parent),
|
||||
ui(std::make_unique<Ui::MoviePlayDialog>()), game_list{game_list_}, system{system_} {
|
||||
ui->setupUi(this);
|
||||
|
||||
ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
|
||||
@@ -26,10 +27,10 @@ MoviePlayDialog::MoviePlayDialog(QWidget* parent, GameList* game_list_)
|
||||
connect(ui->buttonBox, &QDialogButtonBox::accepted, this, &MoviePlayDialog::accept);
|
||||
connect(ui->buttonBox, &QDialogButtonBox::rejected, this, &MoviePlayDialog::reject);
|
||||
|
||||
if (Core::System::GetInstance().IsPoweredOn()) {
|
||||
if (system.IsPoweredOn()) {
|
||||
QString note_text;
|
||||
note_text = tr("Current running game will be stopped.");
|
||||
if (Core::Movie::GetInstance().GetPlayMode() == Core::Movie::PlayMode::Recording) {
|
||||
if (system.Movie().GetPlayMode() == Core::Movie::PlayMode::Recording) {
|
||||
note_text.append(tr("<br>Current recording will be discarded."));
|
||||
}
|
||||
ui->note2Label->setText(note_text);
|
||||
@@ -43,7 +44,7 @@ QString MoviePlayDialog::GetMoviePath() const {
|
||||
}
|
||||
|
||||
QString MoviePlayDialog::GetGamePath() const {
|
||||
const auto metadata = Core::Movie::GetInstance().GetMovieMetadata(GetMoviePath().toStdString());
|
||||
const auto metadata = system.Movie().GetMovieMetadata(GetMoviePath().toStdString());
|
||||
return game_list->FindGameByProgramID(metadata.program_id, GameListItemPath::FullPathRole);
|
||||
}
|
||||
|
||||
@@ -67,9 +68,10 @@ void MoviePlayDialog::UpdateUIDisplay() {
|
||||
ui->lengthLineEdit->clear();
|
||||
ui->note1Label->setVisible(true);
|
||||
|
||||
const auto& movie = system.Movie();
|
||||
const auto path = GetMoviePath().toStdString();
|
||||
|
||||
const auto validation_result = Core::Movie::GetInstance().ValidateMovie(path);
|
||||
const auto validation_result = movie.ValidateMovie(path);
|
||||
if (validation_result == Core::Movie::ValidationResult::Invalid) {
|
||||
ui->note1Label->setText(tr("Invalid movie file."));
|
||||
ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
|
||||
@@ -94,7 +96,7 @@ void MoviePlayDialog::UpdateUIDisplay() {
|
||||
UNREACHABLE();
|
||||
}
|
||||
|
||||
const auto metadata = Core::Movie::GetInstance().GetMovieMetadata(path);
|
||||
const auto metadata = movie.GetMovieMetadata(path);
|
||||
|
||||
// Format game title
|
||||
const auto title =
|
||||
|
||||
@@ -11,11 +11,15 @@ namespace Ui {
|
||||
class MoviePlayDialog;
|
||||
}
|
||||
|
||||
namespace Core {
|
||||
class System;
|
||||
}
|
||||
|
||||
class MoviePlayDialog : public QDialog {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit MoviePlayDialog(QWidget* parent, GameList* game_list);
|
||||
explicit MoviePlayDialog(QWidget* parent, GameList* game_list, const Core::System& system);
|
||||
~MoviePlayDialog() override;
|
||||
|
||||
QString GetMoviePath() const;
|
||||
@@ -27,4 +31,5 @@ private:
|
||||
|
||||
std::unique_ptr<Ui::MoviePlayDialog> ui;
|
||||
GameList* game_list;
|
||||
const Core::System& system;
|
||||
};
|
||||
|
||||
@@ -10,8 +10,8 @@
|
||||
#include "core/movie.h"
|
||||
#include "ui_movie_record_dialog.h"
|
||||
|
||||
MovieRecordDialog::MovieRecordDialog(QWidget* parent)
|
||||
: QDialog(parent), ui(std::make_unique<Ui::MovieRecordDialog>()) {
|
||||
MovieRecordDialog::MovieRecordDialog(QWidget* parent, const Core::System& system_)
|
||||
: QDialog(parent), ui(std::make_unique<Ui::MovieRecordDialog>()), system{system_} {
|
||||
ui->setupUi(this);
|
||||
|
||||
ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
|
||||
@@ -23,9 +23,9 @@ MovieRecordDialog::MovieRecordDialog(QWidget* parent)
|
||||
connect(ui->buttonBox, &QDialogButtonBox::rejected, this, &MovieRecordDialog::reject);
|
||||
|
||||
QString note_text;
|
||||
if (Core::System::GetInstance().IsPoweredOn()) {
|
||||
if (system.IsPoweredOn()) {
|
||||
note_text = tr("Current running game will be restarted.");
|
||||
if (Core::Movie::GetInstance().GetPlayMode() == Core::Movie::PlayMode::Recording) {
|
||||
if (system.Movie().GetPlayMode() == Core::Movie::PlayMode::Recording) {
|
||||
note_text.append(tr("<br>Current recording will be discarded."));
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -9,11 +9,15 @@ namespace Ui {
|
||||
class MovieRecordDialog;
|
||||
}
|
||||
|
||||
namespace Core {
|
||||
class System;
|
||||
}
|
||||
|
||||
class MovieRecordDialog : public QDialog {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit MovieRecordDialog(QWidget* parent);
|
||||
explicit MovieRecordDialog(QWidget* parent, const Core::System& system);
|
||||
~MovieRecordDialog() override;
|
||||
|
||||
QString GetPath() const;
|
||||
@@ -24,4 +28,5 @@ private:
|
||||
void UpdateUIDisplay();
|
||||
|
||||
std::unique_ptr<Ui::MovieRecordDialog> ui;
|
||||
const Core::System& system;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user