From e768a92587d96861f8489df06730309fef675495 Mon Sep 17 00:00:00 2001 From: BreadFish64 Date: Mon, 1 Jan 2018 19:25:38 -0600 Subject: [PATCH] add compatibility reporting to qt frontend --- .travis/linux-frozen/build.sh | 2 +- .travis/linux-frozen/docker.sh | 2 +- .travis/linux/build.sh | 2 +- .travis/linux/docker.sh | 2 +- .travis/macos/build.sh | 2 +- CMakeLists.txt | 4 + appveyor.yml | 5 +- src/citra_qt/CMakeLists.txt | 3 + src/citra_qt/compatdb.cpp | 55 +++++++++ src/citra_qt/compatdb.h | 27 +++++ src/citra_qt/compatdb.ui | 215 +++++++++++++++++++++++++++++++++ src/citra_qt/main.cpp | 26 ++++ src/citra_qt/main.h | 1 + src/citra_qt/main.ui | 15 ++- 14 files changed, 353 insertions(+), 8 deletions(-) create mode 100644 src/citra_qt/compatdb.cpp create mode 100644 src/citra_qt/compatdb.h create mode 100644 src/citra_qt/compatdb.ui diff --git a/.travis/linux-frozen/build.sh b/.travis/linux-frozen/build.sh index 25c655516..25fa0259e 100755 --- a/.travis/linux-frozen/build.sh +++ b/.travis/linux-frozen/build.sh @@ -1,4 +1,4 @@ #!/bin/bash -ex docker pull ubuntu:16.04 -docker run -v $(pwd):/citra ubuntu:16.04 /bin/bash -ex /citra/.travis/linux-frozen/docker.sh +docker run -e ENABLE_COMPATIBILITY_REPORTING -v $(pwd):/citra ubuntu:16.04 /bin/bash -ex /citra/.travis/linux-frozen/docker.sh diff --git a/.travis/linux-frozen/docker.sh b/.travis/linux-frozen/docker.sh index edca9a7a1..f5cb1b0c0 100755 --- a/.travis/linux-frozen/docker.sh +++ b/.travis/linux-frozen/docker.sh @@ -21,7 +21,7 @@ echo y | sh cmake-3.9.0-Linux-x86_64.sh --prefix=cmake export PATH=/citra/cmake/cmake-3.9.0-Linux-x86_64/bin:$PATH mkdir build && cd build -cmake .. -DUSE_SYSTEM_CURL=ON -DCMAKE_BUILD_TYPE=Release +cmake .. -DUSE_SYSTEM_CURL=ON -DCMAKE_BUILD_TYPE=Release -DCITRA_ENABLE_COMPATIBILITY_REPORTING=${ENABLE_COMPATIBILITY_REPORTING:-"OFF"} make -j4 ctest -VV -C Release diff --git a/.travis/linux/build.sh b/.travis/linux/build.sh index 14deaf31c..3e7b212f4 100755 --- a/.travis/linux/build.sh +++ b/.travis/linux/build.sh @@ -1,3 +1,3 @@ #!/bin/bash -ex -docker run -v $(pwd):/citra ubuntu:16.04 /bin/bash -ex /citra/.travis/linux/docker.sh +docker run -e ENABLE_COMPATIBILITY_REPORTING -v $(pwd):/citra ubuntu:16.04 /bin/bash -ex /citra/.travis/linux/docker.sh diff --git a/.travis/linux/docker.sh b/.travis/linux/docker.sh index e27af5600..b03424904 100755 --- a/.travis/linux/docker.sh +++ b/.travis/linux/docker.sh @@ -11,7 +11,7 @@ echo y | sh cmake-3.9.0-Linux-x86_64.sh --prefix=cmake export PATH=/citra/cmake/cmake-3.9.0-Linux-x86_64/bin:$PATH mkdir build && cd build -cmake .. -DUSE_SYSTEM_CURL=ON -DCMAKE_BUILD_TYPE=Release +cmake .. -DUSE_SYSTEM_CURL=ON -DCMAKE_BUILD_TYPE=Release -DCITRA_ENABLE_COMPATIBILITY_REPORTING=${ENABLE_COMPATIBILITY_REPORTING:-"OFF"} make -j4 ctest -VV -C Release diff --git a/.travis/macos/build.sh b/.travis/macos/build.sh index c957cdf21..2930292c2 100755 --- a/.travis/macos/build.sh +++ b/.travis/macos/build.sh @@ -6,7 +6,7 @@ export MACOSX_DEPLOYMENT_TARGET=10.9 export Qt5_DIR=$(brew --prefix)/opt/qt5 mkdir build && cd build -cmake .. -DUSE_SYSTEM_CURL=ON -DCMAKE_OSX_ARCHITECTURES="x86_64;x86_64h" -DCMAKE_BUILD_TYPE=Release +cmake .. -DUSE_SYSTEM_CURL=ON -DCMAKE_OSX_ARCHITECTURES="x86_64;x86_64h" -DCMAKE_BUILD_TYPE=Release -DCITRA_ENABLE_COMPATIBILITY_REPORTING=${ENABLE_COMPATIBILITY_REPORTING:-"OFF"} make -j4 ctest -VV -C Release diff --git a/CMakeLists.txt b/CMakeLists.txt index b7c7c48ab..2a2be43b4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,6 +13,7 @@ option(ENABLE_QT "Enable the Qt frontend" ON) option(CITRA_USE_BUNDLED_QT "Download bundled Qt binaries" OFF) option(ENABLE_WEB_SERVICE "Enable web services (telemetry, etc.)" ON) +option(CITRA_ENABLE_COMPATIBILITY_REPORTING "Enable compatibility reporting" OFF) option(CITRA_USE_BUNDLED_CURL "FOR MINGW ONLY: Download curl configured against winssl instead of openssl" OFF) if (ENABLE_WEB_SERVICE AND CITRA_USE_BUNDLED_CURL AND WINDOWS AND MSVC) message("Turning off use bundled curl as msvc can compile curl on cpr") @@ -235,6 +236,9 @@ endif() if (ENABLE_WEB_SERVICE) add_definitions(-DENABLE_WEB_SERVICE) endif() +if (CITRA_ENABLE_COMPATIBILITY_REPORTING) + add_definitions(-DCITRA_ENABLE_COMPATIBILITY_REPORTING) +endif() # Platform-specific library requirements # ====================================== diff --git a/appveyor.yml b/appveyor.yml index 5fd7c6490..9215bcd40 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -41,11 +41,12 @@ before_build: - mkdir %BUILD_TYPE%_build - cd %BUILD_TYPE%_build - ps: | + $COMPAT = if ($env:ENABLE_COMPATIBILITY_REPORTING -eq $null) {0} else {$env:ENABLE_COMPATIBILITY_REPORTING} if ($env:BUILD_TYPE -eq 'msvc') { # redirect stderr and change the exit code to prevent powershell from cancelling the build if cmake prints a warning - cmd /C 'cmake -G "Visual Studio 15 2017 Win64" -DCITRA_USE_BUNDLED_QT=1 -DCITRA_USE_BUNDLED_SDL2=1 -DCMAKE_USE_OPENSSL=0 .. 2>&1 && exit 0' + cmd /C 'cmake -G "Visual Studio 15 2017 Win64" -DCITRA_USE_BUNDLED_QT=1 -DCITRA_USE_BUNDLED_SDL2=1 -DCMAKE_USE_OPENSSL=0 -DCITRA_ENABLE_COMPATIBILITY_REPORTING=${COMPAT} .. 2>&1 && exit 0' } else { - C:\msys64\usr\bin\bash.exe -lc "cmake -G 'MSYS Makefiles' -DUSE_SYSTEM_CURL=1 -DCITRA_USE_BUNDLED_CURL=1 -DCMAKE_BUILD_TYPE=Release .. 2>&1" + C:\msys64\usr\bin\bash.exe -lc "cmake -G 'MSYS Makefiles' -DUSE_SYSTEM_CURL=1 -DCITRA_USE_BUNDLED_CURL=1 -DCMAKE_BUILD_TYPE=Release -DCITRA_ENABLE_COMPATIBILITY_REPORTING=${COMPAT} .. 2>&1" } - cd .. diff --git a/src/citra_qt/CMakeLists.txt b/src/citra_qt/CMakeLists.txt index 9da384620..56a1eae99 100644 --- a/src/citra_qt/CMakeLists.txt +++ b/src/citra_qt/CMakeLists.txt @@ -65,6 +65,8 @@ add_executable(citra-qt util/spinbox.h util/util.cpp util/util.h + compatdb.cpp + compatdb.h ) set(UIS @@ -80,6 +82,7 @@ set(UIS aboutdialog.ui hotkeys.ui main.ui + compatdb.ui ) file(GLOB_RECURSE ICONS ${CMAKE_SOURCE_DIR}/dist/icons/*) diff --git a/src/citra_qt/compatdb.cpp b/src/citra_qt/compatdb.cpp new file mode 100644 index 000000000..595d57f8c --- /dev/null +++ b/src/citra_qt/compatdb.cpp @@ -0,0 +1,55 @@ +// Copyright 2017 Citra Emulator Project +// Licensed under GPLv2 or any later version +// Refer to the license.txt file included. + +#include +#include +#include "citra_qt/compatdb.h" +#include "common/telemetry.h" +#include "core/core.h" +#include "ui_compatdb.h" + +CompatDB::CompatDB(QWidget* parent) + : QWizard(parent, Qt::WindowTitleHint | Qt::WindowCloseButtonHint | Qt::WindowSystemMenuHint), + ui{std::make_unique()} { + ui->setupUi(this); + connect(ui->radioButton_Perfect, &QRadioButton::clicked, this, &CompatDB::EnableNext); + connect(ui->radioButton_Great, &QRadioButton::clicked, this, &CompatDB::EnableNext); + connect(ui->radioButton_Okay, &QRadioButton::clicked, this, &CompatDB::EnableNext); + connect(ui->radioButton_Bad, &QRadioButton::clicked, this, &CompatDB::EnableNext); + connect(ui->radioButton_IntroMenu, &QRadioButton::clicked, this, &CompatDB::EnableNext); + connect(ui->radioButton_WontBoot, &QRadioButton::clicked, this, &CompatDB::EnableNext); + connect(button(NextButton), &QPushButton::clicked, this, &CompatDB::Submit); +} + +CompatDB::~CompatDB() = default; + +void CompatDB::Submit() { + QButtonGroup* compatibility = new QButtonGroup(this); + compatibility->addButton(ui->radioButton_Perfect, 0); + compatibility->addButton(ui->radioButton_Great, 1); + compatibility->addButton(ui->radioButton_Okay, 2); + compatibility->addButton(ui->radioButton_Bad, 3); + compatibility->addButton(ui->radioButton_IntroMenu, 4); + compatibility->addButton(ui->radioButton_WontBoot, 5); + switch (currentId()) { + case 1: + if (compatibility->checkedId() == -1) { + button(NextButton)->setEnabled(false); + } + break; + case 2: + LOG_DEBUG( + Frontend, + tr("Compatibility Rating: %1").arg(compatibility->checkedId()).toStdString().c_str()); + Core::Telemetry().AddField(Telemetry::FieldType::UserFeedback, "Compatibility", + compatibility->checkedId()); + // the frozen dependency Linux build does not support the "NoCancelButtonOnLastPage" option, + // this is a workaround + button(QWizard::CancelButton)->setVisible(false); + break; + } +} +void CompatDB::EnableNext() { + button(NextButton)->setEnabled(true); +} diff --git a/src/citra_qt/compatdb.h b/src/citra_qt/compatdb.h new file mode 100644 index 000000000..0a0f27cca --- /dev/null +++ b/src/citra_qt/compatdb.h @@ -0,0 +1,27 @@ +// Copyright 2017 Citra Emulator Project +// Licensed under GPLv2 or any later version +// Refer to the license.txt file included. + +#pragma once + +#include +#include + +namespace Ui { +class CompatDB; +} + +class CompatDB : public QWizard { + Q_OBJECT + +public: + explicit CompatDB(QWidget* parent = nullptr); + ~CompatDB(); + +private: + std::unique_ptr ui; + +private slots: + void Submit(); + void EnableNext(); +}; diff --git a/src/citra_qt/compatdb.ui b/src/citra_qt/compatdb.ui new file mode 100644 index 000000000..2e00550f2 --- /dev/null +++ b/src/citra_qt/compatdb.ui @@ -0,0 +1,215 @@ + + + CompatDB + + + + 0 + 0 + 600 + 482 + + + + + 500 + 410 + + + + Report Compatibility + + + QWizard::DisabledBackButtonOnLastPage|QWizard::HelpButtonOnRight|QWizard::NoBackButtonOnStartPage + + + + Report Game Compatibility + + + 0 + + + + + + <html><head/><body><p><span style=" font-size:10pt;">Should you choose to submit a test case to the </span><a href="https://citra-emu.org/game/"><span style=" font-size:10pt; text-decoration: underline; color:#0000ff;">Citra Compatibility List</span></a><span style=" font-size:10pt;">, The following information will be collected and displayed on the site:</span></p><ul style="margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;"><li style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Hardware Information (CPU / GPU / Operating System)</li><li style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Which version of Citra you are running</li><li style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">The connected Citra account</li></ul></body></html> + + + true + + + true + + + + + + + Qt::Vertical + + + + 20 + 0 + + + + + + + + + Report Game Compatibility + + + 1 + + + + + + Perfect + + + + + + + <html><head/><body><p>Game functions flawlessly with no audio or graphical glitches.</p></body></html> + + + true + + + + + + + Great + + + + + + + <html><head/><body><p>Game functions with minor graphical or audio glitches and is playable from start to finish. May require some workarounds.</p></body></html> + + + true + + + + + + + Okay + + + + + + + <html><head/><body><p>Game functions with major graphical or audio glitches, but game is playable from start to finish with workarounds.</p></body></html> + + + true + + + + + + + Bad + + + + + + + <html><head/><body><p>Game functions, but with major graphical or audio glitches. Unable to progress in specific areas due to glitches even with workarounds.</p></body></html> + + + true + + + + + + + Intro/Menu + + + + + + + <html><head/><body><p>Game is completely unplayable due to major graphical or audio glitches. Unable to progress past the Start Screen.</p></body></html> + + + true + + + + + + + Won't Boot + + + true + + + false + + + + + + + <html><head/><body><p>The game crashes when attempting to startup.</p></body></html> + + + + + + + + 10 + + + + <html><head/><body><p>Independent of speed or performance, how well does this game play from start to finish on this version of Citra?</p></body></html> + + + true + + + + + + + Qt::Vertical + + + + 20 + 0 + + + + + + + + + Thank you for your submission! + + + 2 + + + + + + diff --git a/src/citra_qt/main.cpp b/src/citra_qt/main.cpp index e7c327540..bb647098a 100644 --- a/src/citra_qt/main.cpp +++ b/src/citra_qt/main.cpp @@ -48,6 +48,10 @@ #include "core/loader/loader.h" #include "core/settings.h" +#ifdef CITRA_ENABLE_COMPATIBILITY_REPORTING +#include "citra_qt/compatdb.h" +#endif + #ifdef QT_STATICPLUGIN Q_IMPORT_PLUGIN(QWindowsIntegrationPlugin); #endif @@ -144,6 +148,9 @@ GMainWindow::~GMainWindow() { } void GMainWindow::InitializeWidgets() { +#ifdef CITRA_ENABLE_COMPATIBILITY_REPORTING + ui.action_Report_Compatibility->setVisible(true); +#endif render_window = new GRenderWindow(this, emu_thread.get()); render_window->hide(); @@ -359,6 +366,8 @@ void GMainWindow::ConnectMenuEvents() { connect(ui.action_Start, &QAction::triggered, this, &GMainWindow::OnStartGame); connect(ui.action_Pause, &QAction::triggered, this, &GMainWindow::OnPauseGame); connect(ui.action_Stop, &QAction::triggered, this, &GMainWindow::OnStopGame); + connect(ui.action_Report_Compatibility, &QAction::triggered, this, + &GMainWindow::OnMenuReportCompatibility); connect(ui.action_Configure, &QAction::triggered, this, &GMainWindow::OnConfigure); // View @@ -614,6 +623,7 @@ void GMainWindow::ShutdownGame() { ui.action_Start->setText(tr("Start")); ui.action_Pause->setEnabled(false); ui.action_Stop->setEnabled(false); + ui.action_Report_Compatibility->setEnabled(false); render_window->hide(); game_list->show(); game_list->setFilterFocus(); @@ -795,6 +805,7 @@ void GMainWindow::OnStartGame() { ui.action_Pause->setEnabled(true); ui.action_Stop->setEnabled(true); + ui.action_Report_Compatibility->setEnabled(true); } void GMainWindow::OnPauseGame() { @@ -809,6 +820,21 @@ void GMainWindow::OnStopGame() { ShutdownGame(); } +void GMainWindow::OnMenuReportCompatibility() { +#ifdef CITRA_ENABLE_COMPATIBILITY_REPORTING + if (!Settings::values.citra_token.empty() && !Settings::values.citra_username.empty()) { + CompatDB compatdb{this}; + compatdb.exec(); + } else { + QMessageBox::critical( + this, tr("Missing Citra Account"), + tr("In order to submit a game compatibility test case, you must link your Citra " + "account.

To link your Citra account, go to Emulation \> Configuration \> " + "Web.")); + } +#endif +} + void GMainWindow::ToggleFullscreen() { if (!emulation_running) { return; diff --git a/src/citra_qt/main.h b/src/citra_qt/main.h index 70fb309e7..a96a9b061 100644 --- a/src/citra_qt/main.h +++ b/src/citra_qt/main.h @@ -126,6 +126,7 @@ private slots: void OnStartGame(); void OnPauseGame(); void OnStopGame(); + void OnMenuReportCompatibility(); /// Called whenever a user selects a game in the game list widget. void OnGameListLoadFile(QString game_path); void OnGameListOpenSaveFolder(u64 program_id); diff --git a/src/citra_qt/main.ui b/src/citra_qt/main.ui index 1bc071776..901dcd2fe 100644 --- a/src/citra_qt/main.ui +++ b/src/citra_qt/main.ui @@ -45,7 +45,7 @@ 0 0 1081 - 21 + 26 @@ -73,6 +73,7 @@ + @@ -233,6 +234,18 @@ Check for Updates + + + false + + + Report Compatibility + + + false + + +