mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-21 22:24:07 +01:00
Flatten util/IncognitoBrowser.{h,c}pp (#4280)
This commit is contained in:
parent
1043f9f803
commit
e48945e370
2 changed files with 66 additions and 57 deletions
|
@ -1,12 +1,14 @@
|
||||||
#include "IncognitoBrowser.hpp"
|
#include "util/IncognitoBrowser.hpp"
|
||||||
|
|
||||||
#include <QProcess>
|
#include <QProcess>
|
||||||
#include <QRegularExpression>
|
#include <QRegularExpression>
|
||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
#include <QVariant>
|
#include <QVariant>
|
||||||
|
|
||||||
namespace chatterino {
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
|
using namespace chatterino;
|
||||||
|
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
QString injectPrivateSwitch(QString command)
|
QString injectPrivateSwitch(QString command)
|
||||||
{
|
{
|
||||||
|
@ -55,18 +57,22 @@ namespace {
|
||||||
.toString();
|
.toString();
|
||||||
|
|
||||||
// get default browser start command
|
// get default browser start command
|
||||||
auto command = QSettings("HKEY_CLASSES_ROOT\\" + browserId +
|
auto command =
|
||||||
"\\shell\\open\\command",
|
QSettings("HKEY_CLASSES_ROOT\\" + browserId + "\\shell\\open\\command",
|
||||||
QSettings::NativeFormat)
|
QSettings::NativeFormat)
|
||||||
.value("Default")
|
.value("Default")
|
||||||
.toString();
|
.toString();
|
||||||
if (command.isNull())
|
if (command.isNull())
|
||||||
|
{
|
||||||
return QString();
|
return QString();
|
||||||
|
}
|
||||||
|
|
||||||
// inject switch to enable private browsing
|
// inject switch to enable private browsing
|
||||||
command = injectPrivateSwitch(command);
|
command = injectPrivateSwitch(command);
|
||||||
if (command.isNull())
|
if (command.isNull())
|
||||||
|
{
|
||||||
return QString();
|
return QString();
|
||||||
|
}
|
||||||
|
|
||||||
// link
|
// link
|
||||||
command += " " + link;
|
command += " " + link;
|
||||||
|
@ -74,8 +80,11 @@ namespace {
|
||||||
return command;
|
return command;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
|
namespace chatterino {
|
||||||
|
|
||||||
bool supportsIncognitoLinks()
|
bool supportsIncognitoLinks()
|
||||||
{
|
{
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <QtGlobal>
|
#include <QString>
|
||||||
|
|
||||||
namespace chatterino {
|
namespace chatterino {
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue