<commit_before>/**
 * @file
 * @author  Bionus <<EMAIL>>
 *
 * @section LICENSE
 *
 * Copyright 2011 - 2012 Bionus
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *	 http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 * @section DESCRIPTION
 *
 * Batch downloader and viewer for boorus/imageboards.
 */


#include <QApplication>
#include <QDir>
#include <QEventLoop>
#include <QMap>
#include <QNetworkAccessManager>
#include <QNetworkReply>
#include <QNetworkRequest>
#include <QSettings>
#include <QSslSocket>
#include <QString>
#include <QStringList>
#include "analytics.h"
#include "cli/cli.h"
#include "functions.h"
#include "main-window.h"
#include "models/page-api.h"
#include "models/profile.h"
#include "updater/update-dialog.h"
#if !defined(USE_CLI) && defined(USE_BREAKPAD)
	#include <QFileInfo>
	#include "crashhandler/crashhandler.h"
#endif
#if defined(Q_OS_ANDROID)
	#include <QMessageBox>
	#include "android.h"
#endif
#include "custom-buttons.h" // Needed for ButtonSettings registration to work.

#ifdef WIN_FILE_PROPS
	#include "windows-file-property.h"
#endif


int main(int argc, char *argv[])
{
	#ifdef WIN_FILE_PROPS
		initializeWindowsProperties();
	#endif

	QApplication app(argc, argv);
	app.setApplicationName("Grabber");
	app.setApplicationVersion(VERSION);
	app.setOrganizationName("Bionus");
	app.setOrganizationDomain("bionus.fr.cr");

	// Handler for custom URL protocols, redirecting to the main program through HTTP calls
	if (argc == 3 && QString(argv[1]) == "--url-protocol") {
		QNetworkAccessManager manager;
		QNetworkRequest request(QUrl("http://127.0.0.1:58923/" + QString(argv[2])));

		QEventLoop loop;
		QObject::connect(&manager, &QNetworkAccessManager::finished, &loop, &QEventLoop::quit);
		manager.get(request);
		loop.exec();

		return 0;
	}

	qRegisterMetaType<PageApi::LoadResult>("LoadResult");
	qRegisterMetaTypeStreamOperators<QList<ButtonSettings>>("QList<ButtonSettings>");

	// Set window title according to the current build
	#ifdef NIGHTLY
		QString commit(NIGHTLY_COMMIT);
		if (!commit.isEmpty()) {
			app.setApplicationDisplayName("Grabber Nightly - " + commit.left(8));
			app.setApplicationVersion(QString(VERSION) + " - nightly " + commit.left(8));
		} else {
			app.setApplicationDisplayName("Grabber Nightly");
			app.setApplicationVersion(QString(VERSION) + " - nightly");
		}
	#else
		app.setApplicationDisplayName("Grabber");
	#endif

	// Copy settings files to writable directory
	const QStringList toCopy { "sites/", "themes/", "webservices/" };
	for (const QString &tgt : toCopy) {
		const QString from = savePath(tgt, true, false);
		const QString to = savePath(tgt, true, true);
		if (!QDir(to).exists() && QDir(from).exists()) {
			copyRecursively(from, to);
		}
	}
<commit_msg>Fix high-DPI screen scaling (fix #2508)<commit_after>/**
 * @file
 * @author  Bionus <<EMAIL>>
 *
 * @section LICENSE
 *
 * Copyright 2011 - 2012 Bionus
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *	 http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 * @section DESCRIPTION
 *
 * Batch downloader and viewer for boorus/imageboards.
 */


#include <QApplication>
#include <QDir>
#include <QEventLoop>
#include <QMap>
#include <QNetworkAccessManager>
#include <QNetworkReply>
#include <QNetworkRequest>
#include <QSettings>
#include <QSslSocket>
#include <QString>
#include <QStringList>
#include "analytics.h"
#include "cli/cli.h"
#include "functions.h"
#include "main-window.h"
#include "models/page-api.h"
#include "models/profile.h"
#include "updater/update-dialog.h"
#if !defined(USE_CLI) && defined(USE_BREAKPAD)
	#include <QFileInfo>
	#include "crashhandler/crashhandler.h"
#endif
#if defined(Q_OS_ANDROID)
	#include <QMessageBox>
	#include "android.h"
#endif
#include "custom-buttons.h" // Needed for ButtonSettings registration to work.

#ifdef WIN_FILE_PROPS
	#include "windows-file-property.h"
#endif


int main(int argc, char *argv[])
{
	QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);

	#ifdef WIN_FILE_PROPS
		initializeWindowsProperties();
	#endif

	QApplication app(argc, argv);
	app.setApplicationName("Grabber");
	app.setApplicationVersion(VERSION);
	app.setOrganizationName("Bionus");
	app.setOrganizationDomain("bionus.fr.cr");

	// Handler for custom URL protocols, redirecting to the main program through HTTP calls
	if (argc == 3 && QString(argv[1]) == "--url-protocol") {
		QNetworkAccessManager manager;
		QNetworkRequest request(QUrl("http://127.0.0.1:58923/" + QString(argv[2])));

		QEventLoop loop;
		QObject::connect(&manager, &QNetworkAccessManager::finished, &loop, &QEventLoop::quit);
		manager.get(request);
		loop.exec();

		return 0;
	}

	// Use fixed point size for high-DPI screens
	#ifdef Q_OS_WIN
		QFont font = app.font();
		font.setPointSize(10);
		font.setPointSizeF(9.75);
		app.setFont(font);
	#endif

	qRegisterMetaType<PageApi::LoadResult>("LoadResult");
	qRegisterMetaTypeStreamOperators<QList<ButtonSettings>>("QList<ButtonSettings>");

	// Set window title according to the current build
	#ifdef NIGHTLY
		QString commit(NIGHTLY_COMMIT);
		if (!commit.isEmpty()) {
			app.setApplicationDisplayName("Grabber Nightly - " + commit.left(8));
			app.setApplicationVersion(QString(VERSION) + " - nightly " + commit.left(8));
		} else {
			app.setApplicationDisplayName("Grabber Nightly");
			app.setApplicationVersion(QString(VERSION) + " - nightly");
		}
	#else
		app.setApplicationDisplayName("Grabber");
	#endif

	// Copy settings files to writable directory
	const QStringList toCopy { "sites/", "themes/", "webservices/" };
	for (const QString &tgt : toCopy) {
		const QString from = savePath(tgt, true, false);
		const QString to = savePath(tgt, true, true);
		if (!QDir(to).exists() && QDir(from).exists()) {
			copyRecursively(from, to);
		}
	}

{'fraction_non_alphanumeric': 0.13271420011983223, 'fraction_numerical': 0.010035949670461354, 'mean_word_length': 5.058983666061706, 'pattern_counts': {'":': 0, '<': 41, '<?xml version=': 0, '>': 41, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3918359', 'n_tokens_mistral': 2280, 'n_tokens_neox': 2151, 'n_words': 570}