Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Qt: Implement graphics window #5615

Merged
merged 9 commits into from
Jun 28, 2017
Merged

Conversation

spycrab
Copy link
Contributor

@spycrab spycrab commented Jun 15, 2017

Screenshots:
General
Enhancements
Hacks
Advanced
TODO:

  • Fix the windows build
  • Implement blocking options when a game is running
  • Fix that certain options aren't disabled when they should be
  • Implement Software Rendering dialogue
  • Implement Shader Configuration Window (Low priority; Separate PR?) (Currently not testable on my end).

Testing:

  • Test if every element has a description
  • Check if there are any mistakes in those descriptions
  • Check if all options behave as they should (All do except two; Though seemingly not the fault of this PR, has to be investigated)
  • Check if you can crash Dolphin by changing certain settings

@spycrab
Copy link
Contributor Author

spycrab commented Jun 15, 2017

@ligfx @Starsam80 @MayImilae

@ligfx
Copy link
Contributor

ligfx commented Jun 15, 2017

Could you break this into separate commits, please? 1,700 LOC is a lot to review at once :(

@spycrab
Copy link
Contributor Author

spycrab commented Jun 15, 2017

@ligfx I would. Except for the fact that reverting past commits that are buried under commits you don't want to touch, is not something I have figured out yet.

@Helios747
Copy link
Contributor

Kinda bugs me that we went with a sidebar tab system for Config, but a topbar tab system for Graphics.

Ultimately I don't really care enough for this to block this PR, but grr.

@spycrab
Copy link
Contributor Author

spycrab commented Jun 15, 2017

@Helios747 I discussed this on #dolphin-dev: Although there is a plan to integrate it into the Settings Dialog later down the line, that's not happening right now as we want Qt to get up to speed. (Atleast that was the consensus).

@MayImilae
Copy link
Contributor

MayImilae commented Jun 16, 2017

Some small nitpicks:

The backend/fullscreen res/aspect ratio etc settings are divided a bit differently than WX. And eeeh, it matches the other windows more so I don't really care. Just noting it.

blahs

The hacks tab Texture Cache setting is missing the "Accuracy:" line. It's kind of important to say what safe and fast are related to!

texturecacheaccuracy

In the XFB section, please don't have XFB in the individual setting names, it's already stated at the top, and it's only there so users know what devs are talking about when they talk about XFB. Also, please place Virtual on the left, for the whole left is less right is more thing.

And if you are about to say that Texture Cache Accuracy has more accurate to the left... you're right! And it bugs me. It should be the other way around. But if you just copy what WX does or address it, it's fine. Just don't make it worse please!

@spycrab @Helios747 I don't think graphics should be integrated with the main settings, honestly, because divisions like that really help keep it from being intimidating. But that's an argument for another time!

return SConfig::GetInstance().bRenderToMain;
}

void Settings::SetRenderToMain(bool rendertomain)

This comment was marked as off-topic.

return SConfig::GetInstance().bRenderWindowAutoSize;
}

void Settings::SetAutoadjustWindowSize(bool autoadjust)

This comment was marked as off-topic.

@@ -70,10 +70,22 @@ class Settings final : public QSettings, NonCopyable

// Graphics
bool GetRenderToMain() const;
void SetRenderToMain(bool rendertomain);

This comment was marked as off-topic.

public:
explicit GraphicsWidget(QWidget* parent);

bool eventFilter(QObject* obj, QEvent* event);

This comment was marked as off-topic.

#include <QDir>
#include <QFileDialog>
#include <QIcon>
#include <QMessageBox>

#include <qpa/qplatformnativeinterface.h>

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

// We need QObject::tr
#if defined(_WIN32)
static const QString TR_BACKEND_DESCRIPTION =
tr("Selects what graphics API to use internally.\nThe software renderer is extremely "

This comment was marked as off-topic.

QCheckBox* m_show_fps;
QCheckBox* m_show_ping;
QCheckBox* m_log_rendertime;
QCheckBox* m_autoadjust_windowsize;

This comment was marked as off-topic.

// Options
QCheckBox* m_show_fps;
QCheckBox* m_show_ping;
QCheckBox* m_log_rendertime;

This comment was marked as off-topic.

QCheckBox* m_show_messages;
QCheckBox* m_keep_window_top;
QCheckBox* m_hide_cursor;
QCheckBox* m_render_mainwindow;

This comment was marked as off-topic.

void HacksWidget::AddDescriptions()
{
static const QString TR_SKIP_EFB_CPU_ACCESS_DESCRIPTION =
tr("Ignore any requests from the CPU to read from or write to the EFB.\nImproves "

This comment was marked as off-topic.

@spycrab spycrab force-pushed the qt_graphics branch 2 times, most recently from 8d2eed6 to ec40213 Compare June 16, 2017 00:59
@@ -0,0 +1,73 @@
#include "VideoCommon/VideoUtils.h"

This comment was marked as off-topic.

@@ -0,0 +1,15 @@
#pragma once

This comment was marked as off-topic.


namespace VideoUtils
{
std::vector<std::string> GetAvailableResolutions(X11Utils::XRRConfiguration* xrr_config);

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

namespace VideoUtils
{
std::vector<std::string> GetAvailableResolutions(X11Utils::XRRConfiguration* xrr_config);
std::vector<std::string> GetAvailableAntialiasingModes(int& m_msaa_modes);

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

return SConfig::GetInstance().bRenderToMain;
}

void Settings::SetRenderToMain(bool rendertomain)

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

@ghost
Copy link

ghost commented Jun 16, 2017

About textures, one small thing, keep in mind to make some space for the "Preload custom textures to VRAM" that I talked about with Stenzek, no I didn't mention to be an option at the time, but I can see it now that with bigger custom texture packs, it could be hitting over VRAM for some mid-to-lower end cards, certainly 3GB or lower of VRAM won't be enough for Hypatia's Zelda WW HD pack, which is at 3 GB (there's at least 150-300 MB VRAM overhead from browsers/desktop/etc)

This option would would be more suited to be where the "Prefetch custom Textures" (to RAM) is, but now I seem to not agree where it is currently in 5.0 - Advanced Tab in the Utilities group, for some reason it just doesn't agree with my taste, since "dumping textures" and wireframe mode are more developer oriented things, but using the custom textures is meant for end users so it just doesn't fit imo.

There should also be a debate wether to unify this "Prefetch custom textures to RAM/VRAM" from being two checkboxes to double radiobuttons in one line as in "Prefetch custom textures to: o RAM o VRAM"

Also the current description should be updated, since Native custom texture support is here, there is no more exponential memory requirement. The exponential part should be removed and the sentence rewritten.

Sidenote: "prefetching" more fits for usually system/OS cache stuff, the term "preload" may be more fitting as the textures become a solid part of the program and will never get flushed out in a session.

TODO: Need to resolve potential conflict with "Texture Cache" ...

m_graphics_window = new GraphicsWindow(
this,
new X11Utils::XRRConfiguration(
static_cast<Display*>(QGuiApplication::platformNativeInterface()->nativeResourceForWindow(

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

#include <QDir>
#include <QFileDialog>
#include <QIcon>
#include <QMessageBox>

#include <qpa/qplatformnativeinterface.h>

This comment was marked as off-topic.

{
Q_OBJECT
public:
explicit GraphicsWindow(QWidget* parent, X11Utils::XRRConfiguration* xrr_config);

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

main_layout->addWidget(m_tab_widget);
main_layout->addWidget(m_button_box);

auto* general_widget = new GeneralWidget(this, m_xrr_config);

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

ConnectWidgets();

setWindowTitle(tr("Graphics"));
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

@@ -0,0 +1,23 @@
// Copyright 2017 Dolphin Emulator Project

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

class QGroupBox;
class QLabel;

class GraphicsWidget : public QWidget

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

@MayImilae
Copy link
Contributor

@ZexaronS Please keep the bikeshedding away from Qt work, we're trying to get what we have in WX copied over to Qt, and bikeshedding subjective UI elements is a deathkneel for UI PRs!

@spycrab spycrab force-pushed the qt_graphics branch 7 times, most recently from 4edf65a to d5fd043 Compare June 16, 2017 13:46
@spycrab
Copy link
Contributor Author

spycrab commented Jun 16, 2017

@MayImilae Implemented the changes you requested.

@spycrab spycrab force-pushed the qt_graphics branch 3 times, most recently from 478a230 to 86fcf42 Compare June 16, 2017 17:16
void EnhancementsWidget::SaveSettings()
{
bool is_ssaa = m_aa_combo->currentText().startsWith(QStringLiteral("SSAA"));
g_Config.iMultisamples = m_aa_combo->currentIndex() - (is_ssaa ? m_msaa_modes : 0);

This comment was marked as off-topic.

This comment was marked as off-topic.

bool is_ssaa = m_aa_combo->currentText().startsWith(QStringLiteral("SSAA"));
g_Config.iMultisamples = m_aa_combo->currentIndex() - (is_ssaa ? m_msaa_modes : 0);

g_Config.sPostProcessingShader = m_pp_effect->currentText().toStdString();

This comment was marked as off-topic.

This comment was marked as off-topic.

@shuffle2
Copy link
Contributor

Sorry looks like there's another conflict?

@shuffle2
Copy link
Contributor

per irc there is some disagreement...

@mimimi085181
Copy link
Contributor

Did you fix saving the wireframe option? It seems to be working now, and the info about it being broken could be removed. The only thing i don't like is the inconsistency on the spacing of the checkboxes, especially on the last tab. But that's not a blocker for me, it could be addressed later in another pr.

Copy link
Contributor

@ligfx ligfx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall comments:

  1. A more appropriate place for the BackendChanged signals is in a model like Settings, rather than connecting all the views correctly (which is prone to mistakes).
  2. The XRRConfiguration stuff still looks weird to me. I don't think non-X11 platforms should have to pass around XRRConfiguration pointers, or even know they exist.
  3. Signals sent from parent objects to children, like the EmulationStarted/Stopped signals, should be hooked up in the parents, not the children (happens in constructors).
  4. Rows and indices for QGridLayout should start at 0.
  5. Labels before comboboxes and sliders need to be suffixed with colons.
  6. Lambdas that are used to drop arguments from signals can be replaced with direct pointer functions, since Qt knows how to drop arguments already.
  7. The common pattern combobox->setCurrentIndex(combobox->findItem(text)) (or the variant, finding the item manually as part of a loop) can be replaced with combobox->setCurrentText.


m_enable_cropping = new GraphicsBool(tr("Crop"), Config::GFX_CROP);
m_enable_prog_scan = new QCheckBox(tr("Enable Progressive Scan (Currently broken)"));
m_borderless_fullscreen =

This comment was marked as off-topic.

{
connect(m_enable_prog_scan, &QCheckBox::toggled, this, &AdvancedWidget::SaveSettings);
connect(m_load_custom_textures, &QCheckBox::toggled, this, &AdvancedWidget::SaveSettings);
connect(m_enable_prog_scan, &QCheckBox::toggled, this, &AdvancedWidget::SaveSettings);

This comment was marked as off-topic.

misc_box->setLayout(misc_layout);

m_enable_cropping = new GraphicsBool(tr("Crop"), Config::GFX_CROP);
m_enable_prog_scan = new QCheckBox(tr("Enable Progressive Scan (Currently broken)"));

This comment was marked as off-topic.

SConfig::GetInstance().bProgressive = m_enable_prog_scan->isChecked();
const auto hires_enabled = Config::Get(Config::GFX_HIRES_TEXTURES);
m_prefetch_custom_textures->setEnabled(hires_enabled);
if (!hires_enabled)

This comment was marked as off-topic.


void AdvancedWidget::OnBackendChanged()
{
const auto supports_fr_framedumps = g_Config.backend_info.bSupportsInternalResolutionFrameDumps;

This comment was marked as off-topic.

This comment was marked as off-topic.


void EnhancementsWidget::LoadSettings()
{
m_block_save = true;

This comment was marked as off-topic.

This comment was marked as off-topic.


GraphicsWidget::GraphicsWidget(GraphicsWindow* parent)
{
parent->RegisterWidget(this);

This comment was marked as off-topic.

This comment was marked as off-topic.

parent->RegisterWidget(this);
}

void GraphicsWidget::AddDescription(QWidget* widget, const char* description)

This comment was marked as off-topic.


// Video Section
auto* m_video_box = new QGroupBox(tr("Video"));
m_video_layout = new QFormLayout();

This comment was marked as off-topic.

void GraphicsWindow::OnBackendChanged(const QString& backend)
{
setWindowTitle(tr("Dolphin %1 Graphics Configuration").arg(backend));
if (backend == QStringLiteral("Software Renderer") && m_tab_widget->count() > 1)

This comment was marked as off-topic.

This comment was marked as off-topic.

@spycrab spycrab force-pushed the qt_graphics branch 2 times, most recently from e5d4b5c to eb30e29 Compare June 27, 2017 23:08
@@ -0,0 +1,208 @@
// Copyright 2017 Dolphin5~ Emulator Project

This comment was marked as off-topic.

@spycrab spycrab force-pushed the qt_graphics branch 2 times, most recently from 16a5865 to 26f4845 Compare June 28, 2017 12:16
Copy link
Contributor

@sepalani sepalani left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feel free to ignore these comments if these modifications were done by Visual Studio itself. If so, I'll have to check my config. If not, revert them please otherwise they'll be reverted by anyone else using VS even if they aren't planning to modify these files.

@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>

This comment was marked as off-topic.

@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>

This comment was marked as off-topic.

</Project>

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

@shuffle2
Copy link
Contributor

Lets just get this merged, and iterations on it can be done in successive prs? This is looking to become the victim of bike shedding.

@@ -0,0 +1,301 @@
// Copyright 2015~7 Dolphin Emulator Project

This comment was marked as off-topic.

@shuffle2 shuffle2 merged commit c29c1f9 into dolphin-emu:master Jun 28, 2017
@spycrab spycrab deleted the qt_graphics branch June 28, 2017 19:16
@leoetlino leoetlino modified the milestone: Qt Sep 13, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.