// Copyright 2017 Dolphin Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later

#pragma once

#include <QGroupBox>
#include <QWidget>

class ConfigBool;
class ConfigChoice;
class ConfigInteger;
class GraphicsPane;

namespace Config
{
class Layer;
}  // namespace Config

class AdvancedWidget final : public QWidget
{
  Q_OBJECT
public:
  explicit AdvancedWidget(GraphicsPane* gfx_pane);

private:
  void CreateWidgets();
  void ConnectWidgets();
  void AddDescriptions();
  void OnBackendChanged();
  void OnEmulationStateChanged(bool running);

  // Debugging
  ConfigBool* m_enable_wireframe;
  ConfigBool* m_enable_format_overlay;
  ConfigBool* m_enable_api_validation;
  ConfigBool* m_log_render_time;

  // Utility
  ConfigBool* m_prefetch_custom_textures;
  ConfigBool* m_dump_efb_target;
  ConfigBool* m_dump_xfb_target;
  ConfigBool* m_disable_vram_copies;
  ConfigBool* m_load_custom_textures;
  ConfigBool* m_enable_graphics_mods;

  // Texture dumping
  ConfigBool* m_dump_textures;
  ConfigBool* m_dump_mip_textures;
  ConfigBool* m_dump_base_textures;

  // Frame dumping
  ConfigBool* m_dump_use_lossless;
  ConfigChoice* m_frame_dumps_resolution_type;
  ConfigInteger* m_dump_bitrate;
  ConfigInteger* m_png_compression_level;

  // Misc
  ConfigBool* m_enable_prog_scan;
  ConfigBool* m_backend_multithreading;
  ConfigBool* m_prefer_vs_for_point_line_expansion;
  ConfigBool* m_cpu_cull;
  ConfigBool* m_borderless_fullscreen;

  // Misc (Cropping)
  ConfigBool* m_crop_to_aspect_ratio;
  ConfigBool* m_crop_custom;
  QGroupBox* m_crop_custom_box;
  ConfigInteger* m_crop_custom_left;
  ConfigInteger* m_crop_custom_top;
  ConfigInteger* m_crop_custom_right;
  ConfigInteger* m_crop_custom_bottom;

  // Experimental
  ConfigBool* m_defer_efb_access_invalidation;
  ConfigBool* m_manual_texture_sampling;

  Config::Layer* m_game_layer = nullptr;
};
