<commit_before>#include <BALL/VIEW/WIDGETS/HTMLView.h>

#include<BALL/VIEW/RENDERING/RENDERERS/glRenderer.h>
#include <BALL/VIEW/WIDGETS/HTMLPage.h>


namespace BALL
{
	namespace VIEW
	{
		HTMLView::HTMLView(QWidget* parent)
			: QWebEngineView(parent)
		{
			setPage(new HTMLPage(this));
			setAttribute(Qt::WA_DontCreateNativeAncestors);
			hide();	// hiding WebEngine widgets seems to be sufficient to prevent nouveau-related crashes
		}

		HTMLView::~HTMLView()
		{}

		HTMLViewDock::HTMLViewDock(HTMLView* view, QWidget* parent, const char* title)
			: DockWidget(parent, title),
			  skip_checks_(false),
			  show_error_(false),
			  html_view_(0)
		{
			checkForIncompatibleDrivers_();
			setHTMLView(view);
			registerWidget(this);
		}

		HTMLViewDock::HTMLViewDock(QWidget* parent, const char* title)
			: DockWidget(parent, title),
			  skip_checks_(false),
			  show_error_(false),
			  html_view_(0)
		{
			checkForIncompatibleDrivers_();
			setHTMLView(new HTMLView(this));
			registerWidget(this);
		}

		void HTMLViewDock::setHTMLView(HTMLView* html_view) {
			if (!html_view)
			{
				return;
			}

			if (html_view != html_view_)
			{
				delete html_view_;
				html_view_ = html_view;
			}

			if (!skip_checks_ && show_error_)
			{
				// In case of an error, replace the original widget with an error message
				// but still keep it as a member (hidden!) so that it can be restored if
				// the user decides to disable the driver checks.
				setWidget(new HTMLViewErrorWidget(this));
				return;
			}

			setWidget(html_view_);
		}

		void HTMLViewDock::resetHTMLView(bool skip_checks)
		{
			skip_checks_ = skip_checks;
			setHTMLView(html_view_);
		}

		void HTMLViewDock::checkForIncompatibleDrivers_()
		{
			GLRenderer glr();
			String vendor = glr.getVendor();

			if (!vendor.empty() && vendor == "nouveau")
			{
				show_error_ = true;
			}
		}
	}
}<commit_msg>Fix GL redefintion errors on MSVC<commit_after>#include <BALL/VIEW/WIDGETS/HTMLView.h>

#include<BALL/VIEW/RENDERING/RENDERERS/glRenderer.h>
#include <BALL/VIEW/WIDGETS/HTMLPage.h>


namespace BALL
{
	namespace VIEW
	{
		HTMLView::HTMLView(QWidget* parent)
			: QWebEngineView(parent)
		{
			setPage(new HTMLPage(this));
			setAttribute(Qt::WA_DontCreateNativeAncestors);
			hide();	// hiding WebEngine widgets seems to be sufficient to prevent nouveau-related crashes
		}

		HTMLView::~HTMLView()
		{}

		HTMLViewDock::HTMLViewDock(HTMLView* view, QWidget* parent, const char* title)
			: DockWidget(parent, title),
			  skip_checks_(false),
			  show_error_(false),
			  html_view_(0)
		{
			checkForIncompatibleDrivers_();
			setHTMLView(view);
			registerWidget(this);
		}

		HTMLViewDock::HTMLViewDock(QWidget* parent, const char* title)
			: DockWidget(parent, title),
			  skip_checks_(false),
			  show_error_(false),
			  html_view_(0)
		{
			checkForIncompatibleDrivers_();
			setHTMLView(new HTMLView(this));
			registerWidget(this);
		}

		void HTMLViewDock::setHTMLView(HTMLView* html_view) {
			if (!html_view)
			{
				return;
			}

			if (html_view != html_view_)
			{
				delete html_view_;
				html_view_ = html_view;
			}

			if (!skip_checks_ && show_error_)
			{
				// In case of an error, replace the original widget with an error message
				// but still keep it as a member (hidden!) so that it can be restored if
				// the user decides to disable the driver checks.
				setWidget(new HTMLViewErrorWidget(this));
				return;
			}

			setWidget(html_view_);
		}

		void HTMLViewDock::resetHTMLView(bool skip_checks)
		{
			skip_checks_ = skip_checks;
			setHTMLView(html_view_);
		}

		void HTMLViewDock::checkForIncompatibleDrivers_()
		{
			GLRenderer glr = GLRenderer();
			String vendor = glr.getVendor();

			if (!vendor.empty() && vendor == "nouveau")
			{
				show_error_ = true;
			}
		}
	}
}
{'fraction_non_alphanumeric': 0.11448781765784648, 'fraction_numerical': 0.001047943411055803, 'mean_word_length': 3.6904176904176906, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1982564', 'n_tokens_mistral': 1599, 'n_tokens_neox': 1314, 'n_words': 270}