Merge pull request #7935 from JosJuice/cli-arg-movie

DolphinQt: Add support for the --movie parameter
This commit is contained in:
JosJuice 2019-03-27 18:34:24 +01:00 committed by GitHub
commit 6a18bf4d2e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 3 deletions

View File

@ -178,7 +178,7 @@ int main(int argc, char* argv[])
{
DolphinAnalytics::Instance()->ReportDolphinStart("qt");
MainWindow win{std::move(boot)};
MainWindow win{std::move(boot), static_cast<const char*>(options.get("movie"))};
if (options.is_set("debugger"))
Settings::Instance().SetDebugModeEnabled(true);
win.Show();

View File

@ -181,7 +181,9 @@ static std::vector<std::string> StringListToStdVector(QStringList list)
return result;
}
MainWindow::MainWindow(std::unique_ptr<BootParameters> boot_parameters) : QMainWindow(nullptr)
MainWindow::MainWindow(std::unique_ptr<BootParameters> boot_parameters,
const std::string& movie_path)
: QMainWindow(nullptr)
{
setWindowTitle(QString::fromStdString(Common::scm_rev_str));
setWindowIcon(Resources::GetAppIcon());
@ -214,8 +216,16 @@ MainWindow::MainWindow(std::unique_ptr<BootParameters> boot_parameters) : QMainW
#endif
if (boot_parameters)
{
m_pending_boot = std::move(boot_parameters);
if (!movie_path.empty())
{
if (Movie::PlayInput(movie_path, &m_pending_boot->savestate_path))
emit RecordingStatusChanged(true);
}
}
QSettings& settings = Settings::GetQSettings();
restoreState(settings.value(QStringLiteral("mainwindow/state")).toByteArray());

View File

@ -63,7 +63,8 @@ class MainWindow final : public QMainWindow
Q_OBJECT
public:
explicit MainWindow(std::unique_ptr<BootParameters> boot_parameters);
explicit MainWindow(std::unique_ptr<BootParameters> boot_parameters,
const std::string& movie_path);
~MainWindow();
void Show();