1
mirror of https://invent.kde.org/network/falkon.git synced 2024-11-11 01:22:10 +01:00

Show Mac OS X version in QzTool::operatingSystem.

It now also supports Windows 8 detection.

Function have been renamed from buildSystem to operatingSystem
as it does not really returns build system anymore.
This commit is contained in:
nowrep 2013-02-24 23:02:55 +01:00
parent 41fb5bfcc6
commit 3e74b18622
7 changed files with 44 additions and 17 deletions

View File

@ -461,6 +461,8 @@ win32 {
mac {
HEADERS += other/macmenureceiver.h
SOURCES += other/macmenureceiver.cpp
LIBS +=- framework CoreServices
}
message(===========================================)

View File

@ -157,7 +157,7 @@ QString QupZillaSchemeReply::reportbugPage()
"bug report <a href=%1>here</a> first.").arg("https://github.com/QupZilla/qupzilla/wiki/Bug-Reports target=_blank"));
bPage.replace(QLatin1String("%FIELDS-ARE-REQUIRED%"), tr("Please fill out all required fields!"));
bPage.replace(QLatin1String("%INFO_OS%"), QzTools::buildSystem());
bPage.replace(QLatin1String("%INFO_OS%"), QzTools::operatingSystem());
bPage.replace(QLatin1String("%INFO_APP%"), QupZilla::VERSION
#ifdef GIT_REVISION
+ " (" + GIT_REVISION + ")"
@ -382,7 +382,7 @@ QString QupZillaSchemeReply::configPage()
QString("<dt>%1</dt><dd>%2<dd>").arg(tr("Qt version"), QT_VERSION_STR) +
QString("<dt>%1</dt><dd>%2<dd>").arg(tr("WebKit version"), QupZilla::WEBKITVERSION) +
QString("<dt>%1</dt><dd>%2<dd>").arg(tr("Build time"), QupZilla::BUILDTIME) +
QString("<dt>%1</dt><dd>%2<dd>").arg(tr("Platform"), QzTools::buildSystem()));
QString("<dt>%1</dt><dd>%2<dd>").arg(tr("Platform"), QzTools::operatingSystem()));
cPage.replace(QLatin1String("%PATHS-TEXT%"),
QString("<dt>%1</dt><dd>%2<dd>").arg(tr("Profile"), mApp->currentProfilePath()) +

View File

@ -96,7 +96,7 @@ void Updater::start()
{
QUrl url = QUrl(QString("%1/update.php?v=%2&os=%3").arg(QupZilla::WWWADDRESS,
QupZilla::VERSION,
QzTools::buildSystem()));
QzTools::operatingSystem()));
startDownloadingUpdateInfo(url);
}

View File

@ -1,6 +1,6 @@
/* ============================================================
* QupZilla - WebKit based browser
* Copyright (C) 2010-2012 David Rosca <nowrep@gmail.com>
* Copyright (C) 2010-2013 David Rosca <nowrep@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -24,7 +24,7 @@
UserAgentManager::UserAgentManager()
{
m_fakeUserAgent = QString("Mozilla/5.0 (%1) AppleWebKit/%2 (KHTML, like Gecko) Chrome/10.0 Safari/%2").arg(QzTools::buildSystem(), QupZilla::WEBKITVERSION);
m_fakeUserAgent = QString("Mozilla/5.0 (%1) AppleWebKit/%2 (KHTML, like Gecko) Chrome/10.0 Safari/%2").arg(QzTools::operatingSystem(), QupZilla::WEBKITVERSION);
}
void UserAgentManager::loadSettings()

View File

@ -1,6 +1,6 @@
/* ============================================================
* QupZilla - WebKit based browser
* Copyright (C) 2010-2012 David Rosca <nowrep@gmail.com>
* Copyright (C) 2010-2013 David Rosca <nowrep@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -33,7 +33,7 @@ UserAgentDialog::UserAgentDialog(QWidget* parent)
{
ui->setupUi(this);
const QString &os = QzTools::buildSystem();
const QString &os = QzTools::operatingSystem();
m_knownUserAgents << QString("Opera/9.80 (%1) Presto/2.10.229 Version/11.61").arg(os)
<< QString("Mozilla/5.0 (%1) AppleWebKit/535.7 (KHTML, like Gecko) Chrome/16.0.912.77 Safari/535.7").arg(os)
<< QString("Mozilla/5.0 (%1) AppleWebKit/533.21.1 (KHTML, like Gecko) Version/5.0.5 Safari/533.21.1").arg(os)

View File

@ -46,6 +46,14 @@
#include <QX11Info>
#endif
#ifdef Q_OS_WIN
#include <windows.h>
#endif
#ifdef Q_OS_MAC
#include <CoreServices/CoreServices.h>
#endif
QByteArray QzTools::pixmapToByteArray(const QPixmap &pix)
{
QByteArray bytes;
@ -603,7 +611,7 @@ void* QzTools::X11Display(const QWidget* widget)
}
#endif
QString QzTools::buildSystem()
QString QzTools::operatingSystem()
{
#ifdef Q_OS_LINUX
return "Linux";
@ -626,9 +634,6 @@ QString QzTools::buildSystem()
#ifdef Q_OS_LYNX
return "LynxOS";
#endif
#ifdef Q_OS_MAC
return "MAC OS";
#endif
#ifdef Q_OS_NETBSD
return "NetBSD";
#endif
@ -647,6 +652,12 @@ QString QzTools::buildSystem()
#ifdef Q_OS_UNIXWARE
return "UnixWare 7 / Open UNIX 8";
#endif
#ifdef Q_OS_UNIX
return "Unix";
#endif
#ifdef Q_OS_HAIKU
return "Haiku";
#endif
#ifdef Q_OS_WIN32
QString str = "Windows";
@ -675,15 +686,29 @@ QString QzTools::buildSystem()
break;
default:
OSVERSIONINFO osvi;
ZeroMemory(&osvi, sizeof(OSVERSIONINFO));
osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
GetVersionEx(&osvi);
if (osvi.dwMajorVersion == 6 && osvi.dwMinorVersion == 2) {
str.append(" 8");
}
break;
}
return str;
#endif
#ifdef Q_OS_UNIX
return "Unix";
#endif
#ifdef Q_OS_HAIKU
return "Haiku";
#ifdef Q_OS_MAC
QString str = "Mac OS X";
SInt32 majorVersion;
SInt32 minorVersion;
if (Gestalt(gestaltSystemVersionMajor, &majorVersion) == noErr && Gestalt(gestaltSystemVersionMinor, &minorVersion) == noErr) {
str.append(QString(" %1.%2").arg(majorVersion, minorVersion));
}
return str;
#endif
}

View File

@ -63,7 +63,7 @@ bool QT_QUPZILLA_EXPORT startExternalProcess(const QString &executable, const QS
QIcon QT_QUPZILLA_EXPORT iconFromFileName(const QString &fileName);
bool QT_QUPZILLA_EXPORT isUtf8(const char* string);
QString QT_QUPZILLA_EXPORT buildSystem();
QString QT_QUPZILLA_EXPORT operatingSystem();
// Qt5 migration help functions
bool QT_QUPZILLA_EXPORT isCertificateValid(const QSslCertificate &cert);