mirror of
https://invent.kde.org/network/falkon.git
synced 2024-12-20 02:36:34 +01:00
Remove some Qt 4 specific code
This commit is contained in:
parent
ab506ea83a
commit
8d7cfb0e2a
@ -6,8 +6,8 @@
|
||||
#
|
||||
#-------------------------------------------------
|
||||
|
||||
lessThan(QT_VERSION, 4.7) {
|
||||
error("QupZilla requires at least Qt 4.7!")
|
||||
lessThan(QT_VERSION, 5.4) {
|
||||
error("QupZilla requires at least Qt 5.4!")
|
||||
}
|
||||
|
||||
# Create plugins directory first on Mac / Linux
|
||||
|
@ -60,48 +60,6 @@ haiku-* {
|
||||
DEFINES *= NO_X11
|
||||
}
|
||||
|
||||
# Check for pkg-config availability
|
||||
!mac:unix:system(pkg-config --version > /dev/null) {
|
||||
isEqual(QT_MAJOR_VERSION, 5) {
|
||||
MODNAME = Qt5WebKitWidgets
|
||||
}
|
||||
else {
|
||||
MODNAME = QtWebKit
|
||||
}
|
||||
|
||||
QTWEBKIT_VERSION = $$system(PKG_CONFIG_PATH="$$[QT_INSTALL_LIBS]/pkgconfig" pkg-config --modversion $$MODNAME)
|
||||
QTWEBKIT_VERSION_MAJOR = $$section(QTWEBKIT_VERSION, ".", 0, 0)
|
||||
QTWEBKIT_VERSION_MINOR = $$section(QTWEBKIT_VERSION, ".", 1, 1)
|
||||
|
||||
isEqual(QT_MAJOR_VERSION, 5) {
|
||||
greaterThan(QTWEBKIT_VERSION_MAJOR, 4) {
|
||||
# There is one Qt5WebKitWidgets version now, which has same features as QtWebKit 2.3
|
||||
DEFINES *= USE_QTWEBKIT_2_2 USE_QTWEBKIT_2_3
|
||||
}
|
||||
}
|
||||
else { # Qt 4
|
||||
equals(QTWEBKIT_VERSION_MAJOR, 4):greaterThan(QTWEBKIT_VERSION_MINOR, 8) {
|
||||
# 4.9.x = QtWebKit 2.2
|
||||
DEFINES *= USE_QTWEBKIT_2_2
|
||||
}
|
||||
|
||||
equals(QTWEBKIT_VERSION_MAJOR, 4):greaterThan(QTWEBKIT_VERSION_MINOR, 9) {
|
||||
# 4.10.x = QtWebKit 2.3
|
||||
DEFINES *= USE_QTWEBKIT_2_3
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
isEqual(QT_VERSION, 4.8.0)|greaterThan(QT_VERSION, 4.8.0) {
|
||||
DEFINES *= USE_QTWEBKIT_2_2
|
||||
}
|
||||
|
||||
isEqual(QT_MAJOR_VERSION, 5) {
|
||||
DEFINES *= USE_QTWEBKIT_2_2 USE_QTWEBKIT_2_3
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
!mac:unix {
|
||||
binary_folder = /usr/bin
|
||||
library_folder = /usr/lib
|
||||
@ -140,8 +98,7 @@ isEmpty(QMAKE_LRELEASE) {
|
||||
|
||||
# Try to use lrelease from PATH
|
||||
unix:!exists($$QMAKE_LRELEASE) {
|
||||
isEqual(QT_MAJOR_VERSION, 4): QMAKE_LRELEASE = lrelease-qt4
|
||||
else: QMAKE_LRELEASE = lrelease
|
||||
QMAKE_LRELEASE = lrelease
|
||||
}
|
||||
}
|
||||
|
||||
|
14
src/lib/3rdparty/lineedit.cpp
vendored
14
src/lib/3rdparty/lineedit.cpp
vendored
@ -27,10 +27,6 @@
|
||||
#include <QStyleOption>
|
||||
#include <QApplication>
|
||||
|
||||
#if QT_VERSION < 0x050000
|
||||
#include <QInputContext>
|
||||
#endif
|
||||
|
||||
SideWidget::SideWidget(QWidget* parent)
|
||||
: QWidget(parent)
|
||||
{
|
||||
@ -208,16 +204,6 @@ QMenu* LineEdit::createContextMenu()
|
||||
popup->addSeparator();
|
||||
popup->addAction(m_editActions[SelectAll]);
|
||||
|
||||
#if !defined(QT_NO_IM) && QT_VERSION < 0x050000
|
||||
QInputContext* qic = inputContext();
|
||||
if (qic) {
|
||||
QList<QAction*> imActions = qic->actions();
|
||||
for (int i = 0; i < imActions.size(); ++i) {
|
||||
popup->addAction(imActions.at(i));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// Hack to get QUnicodeControlCharacterMenu
|
||||
QMenu* tmp = createStandardContextMenu();
|
||||
tmp->setParent(popup);
|
||||
|
13
src/lib/3rdparty/qtwin.cpp
vendored
13
src/lib/3rdparty/qtwin.cpp
vendored
@ -84,11 +84,7 @@ public:
|
||||
void removeWidget(QWidget* widget) {
|
||||
widgets.removeAll(widget);
|
||||
}
|
||||
#if (QT_VERSION < 0x050000)
|
||||
bool winEvent(MSG* message, long* result);
|
||||
#else
|
||||
bool nativeEvent(const QByteArray &eventType, void* _message, long* result);
|
||||
#endif
|
||||
|
||||
private:
|
||||
QWidgetList widgets;
|
||||
@ -272,15 +268,10 @@ WindowNotifier* QtWin::windowNotifier()
|
||||
|
||||
|
||||
/* Notify all enabled windows that the DWM state changed */
|
||||
#if (QT_VERSION < 0x050000)
|
||||
bool WindowNotifier::winEvent(MSG* message, long* result)
|
||||
{
|
||||
#else
|
||||
bool WindowNotifier::nativeEvent(const QByteArray &eventType, void* _message, long* result)
|
||||
{
|
||||
Q_UNUSED(eventType)
|
||||
MSG* message = static_cast<MSG*>(_message);
|
||||
#endif
|
||||
if (message && message->message == WM_DWMCOMPOSITIONCHANGED) {
|
||||
bool compositionEnabled = QtWin::isCompositionEnabled();
|
||||
foreach (QWidget* widget, widgets) {
|
||||
@ -296,11 +287,7 @@ bool WindowNotifier::nativeEvent(const QByteArray &eventType, void* _message, lo
|
||||
}
|
||||
}
|
||||
}
|
||||
#if (QT_VERSION < 0x050000)
|
||||
return QWidget::winEvent(message, result);
|
||||
#else
|
||||
return QWidget::nativeEvent(eventType, _message, result);
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef W7API
|
||||
|
@ -59,7 +59,6 @@
|
||||
// count .co.uk (and others) as second-level domain
|
||||
static QString toSecondLevelDomain(const QUrl &url)
|
||||
{
|
||||
#if QT_VERSION >= 0x040800
|
||||
const QString topLevelDomain = url.topLevelDomain();
|
||||
const QString urlHost = url.host();
|
||||
|
||||
@ -78,19 +77,6 @@ static QString toSecondLevelDomain(const QUrl &url)
|
||||
}
|
||||
|
||||
return domain + topLevelDomain;
|
||||
#else
|
||||
QString domain = url.host();
|
||||
|
||||
if (domain.count(QL1C('.')) == 0) {
|
||||
return QString();
|
||||
}
|
||||
|
||||
while (domain.count(QL1C('.')) != 1) {
|
||||
domain = domain.mid(domain.indexOf(QL1C('.')) + 1);
|
||||
}
|
||||
|
||||
return domain;
|
||||
#endif
|
||||
}
|
||||
|
||||
AdBlockRule::AdBlockRule(const QString &filter, AdBlockSubscription* subscription)
|
||||
|
@ -89,10 +89,6 @@
|
||||
#include <QToolTip>
|
||||
#include <QScrollArea>
|
||||
|
||||
#if QT_VERSION < 0x050000
|
||||
#include "qwebkitversion.h"
|
||||
#endif
|
||||
|
||||
#ifdef QZ_WS_X11
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xatom.h>
|
||||
@ -1671,15 +1667,10 @@ void BrowserWindow::applyBlurToMainWindow(bool force)
|
||||
QtWin::extendFrameIntoClientArea(this, leftMargin, topMargin, rightMargin, bottomMargin);
|
||||
}
|
||||
|
||||
#if (QT_VERSION < 0x050000)
|
||||
bool BrowserWindow::winEvent(MSG* message, long* result)
|
||||
{
|
||||
#else
|
||||
bool BrowserWindow::nativeEvent(const QByteArray &eventType, void* _message, long* result)
|
||||
{
|
||||
Q_UNUSED(eventType)
|
||||
MSG* message = static_cast<MSG*>(_message);
|
||||
#endif
|
||||
if (message && message->message == WM_DWMCOMPOSITIONCHANGED) {
|
||||
Settings settings;
|
||||
settings.beginGroup("Browser-View-Settings");
|
||||
@ -1716,11 +1707,7 @@ bool BrowserWindow::nativeEvent(const QByteArray &eventType, void* _message, lon
|
||||
m_useTransparentBackground = false;
|
||||
}
|
||||
}
|
||||
#if (QT_VERSION < 0x050000)
|
||||
return QMainWindow::winEvent(message, result);
|
||||
#else
|
||||
return QMainWindow::nativeEvent(eventType, _message, result);
|
||||
#endif
|
||||
}
|
||||
|
||||
void BrowserWindow::paintEvent(QPaintEvent* event)
|
||||
|
@ -231,11 +231,7 @@ private slots:
|
||||
void applyBlurToMainWindow(bool force = false);
|
||||
|
||||
private:
|
||||
#if (QT_VERSION < 0x050000)
|
||||
bool winEvent(MSG* message, long* result);
|
||||
#else
|
||||
bool nativeEvent(const QByteArray &eventType, void* _message, long* result);
|
||||
#endif
|
||||
|
||||
void paintEvent(QPaintEvent* event);
|
||||
bool eventFilter(QObject* object, QEvent* event);
|
||||
|
@ -21,11 +21,7 @@
|
||||
#include <QApplication>
|
||||
#include <QDir>
|
||||
|
||||
#if QT_VERSION < 0x050000
|
||||
#include <QDesktopServices>
|
||||
#else
|
||||
#include <QStandardPaths>
|
||||
#endif
|
||||
|
||||
Q_GLOBAL_STATIC(DataPaths, qz_data_paths)
|
||||
|
||||
@ -104,11 +100,7 @@ void DataPaths::init()
|
||||
// Config
|
||||
#if defined(Q_OS_WIN) || defined(Q_OS_OS2)
|
||||
// Use %LOCALAPPDATA%/qupzilla as Config path on Windows
|
||||
#if QT_VERSION < 0x050000
|
||||
QString dataLocation = QDesktopServices::storageLocation(QDesktopServices::DataLocation);
|
||||
#else
|
||||
QString dataLocation = QStandardPaths::writableLocation(QStandardPaths::DataLocation);
|
||||
#endif
|
||||
// Backwards compatibility
|
||||
if (dataLocation.isEmpty()) {
|
||||
dataLocation = QDir::homePath() + QLatin1String("/.config/qupzilla");
|
||||
|
@ -62,11 +62,7 @@
|
||||
#include <QTimer>
|
||||
#include <QDir>
|
||||
|
||||
#if QT_VERSION < 0x050000
|
||||
#include "qwebkitversion.h"
|
||||
#else
|
||||
#include <QStandardPaths>
|
||||
#endif
|
||||
|
||||
#if defined(Q_OS_WIN) && !defined(Q_OS_OS2)
|
||||
#include "registerqappassociation.h"
|
||||
@ -101,9 +97,7 @@ MainApplication::MainApplication(int &argc, char** argv)
|
||||
, m_registerQAppAssociation(0)
|
||||
#endif
|
||||
{
|
||||
#if QT_VERSION >= 0x050000
|
||||
setAttribute(Qt::AA_UseHighDpiPixmaps, true);
|
||||
#endif
|
||||
|
||||
setApplicationName(QLatin1String("QupZilla"));
|
||||
setApplicationVersion(Qz::VERSION);
|
||||
|
@ -37,11 +37,7 @@
|
||||
#endif
|
||||
|
||||
#ifndef QSL
|
||||
#if QT_VERSION >= 0x050000
|
||||
#define QSL(x) QStringLiteral(x)
|
||||
#else
|
||||
#define QSL(x) QLatin1String(x)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef QL1S
|
||||
|
@ -32,9 +32,7 @@
|
||||
#include <QXmlStreamReader>
|
||||
#include <QNetworkRequest>
|
||||
|
||||
#if QT_VERSION >= 0x050000
|
||||
#include <QUrlQuery>
|
||||
#endif
|
||||
|
||||
AutoFill::AutoFill(QObject* parent)
|
||||
: QObject(parent)
|
||||
|
@ -19,9 +19,7 @@
|
||||
#include "qzregexp.h"
|
||||
|
||||
#include <QWebEnginePage>
|
||||
#if QT_VERSION >= 0x050000
|
||||
#include <QUrlQuery>
|
||||
#endif
|
||||
|
||||
PageFormCompleter::PageFormCompleter()
|
||||
: m_page(0)
|
||||
@ -247,13 +245,9 @@ PageFormCompleter::QueryItems PageFormCompleter::createQueryItems(QByteArray dat
|
||||
// QUrlQuery/QUrl never encodes/decodes + and spaces
|
||||
data.replace('+', ' ');
|
||||
|
||||
#if QT_VERSION >= 0x050000
|
||||
QUrlQuery query;
|
||||
query.setQuery(data);
|
||||
QueryItems arguments = query.queryItems(QUrl::FullyDecoded);
|
||||
#else
|
||||
QueryItems arguments = QUrl::fromEncoded("http://foo.com/?" + data).queryItems();
|
||||
#endif
|
||||
|
||||
return arguments;
|
||||
}
|
||||
|
@ -34,11 +34,7 @@
|
||||
#include <QWebEngineHistory>
|
||||
#include <QFileDialog>
|
||||
|
||||
#if QT_VERSION >= 0x050000
|
||||
#include <QStandardPaths>
|
||||
#else
|
||||
#include <QDesktopServices>
|
||||
#endif
|
||||
|
||||
DownloadFileHelper::DownloadFileHelper(const QString &lastDownloadPath, const QString &downloadPath, bool useNativeDialog)
|
||||
: QObject()
|
||||
@ -229,22 +225,12 @@ void DownloadFileHelper::optionsDialogAccepted(int finish)
|
||||
dialog->selectFile(m_h_fileName);
|
||||
|
||||
QList<QUrl> urls;
|
||||
urls <<
|
||||
#if QT_VERSION >= 0x050000
|
||||
QUrl::fromLocalFile(QStandardPaths::writableLocation(QStandardPaths::HomeLocation))
|
||||
urls << QUrl::fromLocalFile(QStandardPaths::writableLocation(QStandardPaths::HomeLocation))
|
||||
<< QUrl::fromLocalFile(QStandardPaths::writableLocation(QStandardPaths::DesktopLocation))
|
||||
<< QUrl::fromLocalFile(QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation))
|
||||
<< QUrl::fromLocalFile(QStandardPaths::writableLocation(QStandardPaths::PicturesLocation))
|
||||
<< QUrl::fromLocalFile(QStandardPaths::writableLocation(QStandardPaths::MusicLocation))
|
||||
<< QUrl::fromLocalFile(QStandardPaths::writableLocation(QStandardPaths::MoviesLocation));
|
||||
#else
|
||||
QUrl::fromLocalFile(QDesktopServices::storageLocation(QDesktopServices::HomeLocation))
|
||||
<< QUrl::fromLocalFile(QDesktopServices::storageLocation(QDesktopServices::DesktopLocation))
|
||||
<< QUrl::fromLocalFile(QDesktopServices::storageLocation(QDesktopServices::DocumentsLocation))
|
||||
<< QUrl::fromLocalFile(QDesktopServices::storageLocation(QDesktopServices::PicturesLocation))
|
||||
<< QUrl::fromLocalFile(QDesktopServices::storageLocation(QDesktopServices::MusicLocation))
|
||||
<< QUrl::fromLocalFile(QDesktopServices::storageLocation(QDesktopServices::MoviesLocation));
|
||||
#endif
|
||||
dialog->setSidebarUrls(urls);
|
||||
|
||||
dialog->open();
|
||||
|
@ -201,10 +201,6 @@ void DownloadItem::finished()
|
||||
}
|
||||
|
||||
m_item->setSizeHint(sizeHint());
|
||||
#if QT_VERSION == 0x040700 // Workaround
|
||||
ui->button->show();
|
||||
ui->button->hide();
|
||||
#endif
|
||||
m_downloading = false;
|
||||
|
||||
if (m_openAfterFinish) {
|
||||
@ -353,10 +349,6 @@ void DownloadItem::stop(bool askForDeleteFile)
|
||||
ui->button->hide();
|
||||
m_item->setSizeHint(sizeHint());
|
||||
|
||||
#if QT_VERSION == 0x040700 // Workaround
|
||||
ui->button->show();
|
||||
ui->button->hide();
|
||||
#endif
|
||||
m_downloading = false;
|
||||
|
||||
emit downloadFinished(false);
|
||||
|
@ -123,15 +123,10 @@ void DownloadManager::startExternalManager(const QUrl &url)
|
||||
}
|
||||
|
||||
#ifdef W7TASKBAR
|
||||
#if (QT_VERSION < 0x050000)
|
||||
bool DownloadManager::winEvent(MSG* message, long* result)
|
||||
{
|
||||
#else
|
||||
bool DownloadManager::nativeEvent(const QByteArray &eventType, void* _message, long* result)
|
||||
{
|
||||
Q_UNUSED(eventType)
|
||||
MSG* message = static_cast<MSG*>(_message);
|
||||
#endif
|
||||
return win7.winEvent(message, result);
|
||||
}
|
||||
#endif
|
||||
|
@ -83,12 +83,8 @@ public slots:
|
||||
|
||||
#ifdef W7TASKBAR
|
||||
protected:
|
||||
#if (QT_VERSION < 0x050000)
|
||||
virtual bool winEvent(MSG* message, long* result);
|
||||
#else
|
||||
virtual bool nativeEvent(const QByteArray &eventType, void* _message, long* result);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
private slots:
|
||||
void clearList();
|
||||
|
@ -1,8 +1,4 @@
|
||||
isEqual(QT_MAJOR_VERSION, 5) {
|
||||
QT += webenginewidgets network widgets printsupport sql script gui-private
|
||||
} else {
|
||||
QT += core gui webkit sql network script concurrent
|
||||
}
|
||||
QT += webenginewidgets network widgets printsupport sql script gui-private
|
||||
|
||||
TARGET = QupZilla
|
||||
TEMPLATE = lib
|
||||
@ -231,6 +227,7 @@ SOURCES += \
|
||||
tools/pagethumbnailer.cpp \
|
||||
tools/plaineditwithlines.cpp \
|
||||
tools/progressbar.cpp \
|
||||
tools/qzregexp.cpp \
|
||||
tools/qztools.cpp \
|
||||
tools/sqldatabase.cpp \
|
||||
tools/toolbutton.cpp \
|
||||
@ -434,6 +431,7 @@ HEADERS += \
|
||||
tools/pagethumbnailer.h \
|
||||
tools/plaineditwithlines.h \
|
||||
tools/progressbar.h \
|
||||
tools/qzregexp.h \
|
||||
tools/qztools.h \
|
||||
tools/sqldatabase.h \
|
||||
tools/toolbutton.h \
|
||||
@ -509,14 +507,10 @@ RESOURCES += \
|
||||
data/icons.qrc \
|
||||
data/oxygen-fallback.qrc
|
||||
|
||||
isEqual(QT_MAJOR_VERSION, 5) {
|
||||
qtHaveModule(ftp) {
|
||||
QT *= ftp
|
||||
} else {
|
||||
include(3rdparty/qftp/qftp.pri)
|
||||
}
|
||||
|
||||
SOURCES += tools/qzregexp.cpp
|
||||
qtHaveModule(ftp) {
|
||||
QT *= ftp
|
||||
} else {
|
||||
include(3rdparty/qftp/qftp.pri)
|
||||
}
|
||||
|
||||
!mac:unix {
|
||||
|
@ -28,11 +28,7 @@
|
||||
|
||||
#include <QDateTime>
|
||||
|
||||
#if QT_VERSION >= 0x050000
|
||||
#include <QtConcurrent/QtConcurrentRun>
|
||||
#else
|
||||
#include <QtConcurrentRun>
|
||||
#endif
|
||||
|
||||
LocationCompleterRefreshJob::LocationCompleterRefreshJob(const QString &searchString)
|
||||
: QObject()
|
||||
|
@ -22,9 +22,7 @@
|
||||
#include <QNetworkRequest>
|
||||
#include <QMessageBox>
|
||||
|
||||
#if QT_VERSION >= 0x050000
|
||||
#include <QUrlQuery>
|
||||
#endif
|
||||
|
||||
AdBlockSchemeHandler::AdBlockSchemeHandler()
|
||||
: SchemeHandler()
|
||||
@ -40,12 +38,7 @@ QNetworkReply* AdBlockSchemeHandler::createRequest(QNetworkAccessManager::Operat
|
||||
}
|
||||
|
||||
const QUrl url = request.url();
|
||||
const QList<QPair<QString, QString> > queryItems =
|
||||
#if QT_VERSION >= 0x050000
|
||||
QUrlQuery(url).queryItems();
|
||||
#else
|
||||
url.queryItems();
|
||||
#endif
|
||||
const QList<QPair<QString, QString> > queryItems = QUrlQuery(url).queryItems();
|
||||
|
||||
QString subscriptionTitle;
|
||||
QString subscriptionUrl;
|
||||
|
@ -35,11 +35,7 @@
|
||||
#include <QSettings>
|
||||
#include <QWebSecurityOrigin>
|
||||
|
||||
#if QT_VERSION < 0x050000
|
||||
#include "qwebkitversion.h"
|
||||
#else
|
||||
#include <QWebEnginePage>
|
||||
#endif
|
||||
|
||||
static QString authorString(const char* name, const QString &mail)
|
||||
{
|
||||
|
@ -47,9 +47,7 @@
|
||||
#include <qregexp.h>
|
||||
#include <qstringlist.h>
|
||||
|
||||
#if QT_VERSION >= 0x050000
|
||||
#include <QUrlQuery>
|
||||
#endif
|
||||
|
||||
|
||||
/*!
|
||||
@ -226,22 +224,14 @@ QUrl OpenSearchEngine::searchUrl(const QString &searchTerm) const
|
||||
|
||||
QUrl retVal = QUrl::fromEncoded(parseTemplate(searchTerm, m_searchUrlTemplate).toUtf8());
|
||||
|
||||
#if QT_VERSION >= 0x050000
|
||||
QUrlQuery query(retVal);
|
||||
#endif
|
||||
if (m_searchMethod != QLatin1String("post")) {
|
||||
Parameters::const_iterator end = m_searchParameters.constEnd();
|
||||
Parameters::const_iterator i = m_searchParameters.constBegin();
|
||||
for (; i != end; ++i) {
|
||||
#if QT_VERSION >= 0x050000
|
||||
query.addQueryItem(i->first, parseTemplate(searchTerm, i->second));
|
||||
#else
|
||||
retVal.addQueryItem(i->first, parseTemplate(searchTerm, i->second));
|
||||
#endif
|
||||
}
|
||||
#if QT_VERSION >= 0x050000
|
||||
retVal.setQuery(query);
|
||||
#endif
|
||||
}
|
||||
|
||||
return retVal;
|
||||
@ -255,21 +245,13 @@ QByteArray OpenSearchEngine::getPostData(const QString &searchTerm) const
|
||||
|
||||
QUrl retVal = QUrl("http://foo.bar");
|
||||
|
||||
#if QT_VERSION >= 0x050000
|
||||
QUrlQuery query(retVal);
|
||||
#endif
|
||||
Parameters::const_iterator end = m_searchParameters.constEnd();
|
||||
Parameters::const_iterator i = m_searchParameters.constBegin();
|
||||
for (; i != end; ++i) {
|
||||
#if QT_VERSION >= 0x050000
|
||||
query.addQueryItem(i->first, parseTemplate(searchTerm, i->second));
|
||||
#else
|
||||
retVal.addQueryItem(i->first, parseTemplate(searchTerm, i->second));
|
||||
#endif
|
||||
}
|
||||
#if QT_VERSION >= 0x050000
|
||||
retVal.setQuery(query);
|
||||
#endif
|
||||
|
||||
QByteArray data = retVal.toEncoded(QUrl::RemoveScheme);
|
||||
return data.contains('?') ? data.mid(data.lastIndexOf('?') + 1) : QByteArray();
|
||||
@ -324,22 +306,14 @@ QUrl OpenSearchEngine::suggestionsUrl(const QString &searchTerm) const
|
||||
|
||||
QUrl retVal = QUrl::fromEncoded(parseTemplate(searchTerm, m_suggestionsUrlTemplate).toUtf8());
|
||||
|
||||
#if QT_VERSION >= 0x050000
|
||||
QUrlQuery query(retVal);
|
||||
#endif
|
||||
if (m_suggestionsMethod != QLatin1String("post")) {
|
||||
Parameters::const_iterator end = m_suggestionsParameters.constEnd();
|
||||
Parameters::const_iterator i = m_suggestionsParameters.constBegin();
|
||||
for (; i != end; ++i) {
|
||||
#if QT_VERSION >= 0x050000
|
||||
query.addQueryItem(i->first, parseTemplate(searchTerm, i->second));
|
||||
#else
|
||||
retVal.addQueryItem(i->first, parseTemplate(searchTerm, i->second));
|
||||
#endif
|
||||
}
|
||||
#if QT_VERSION >= 0x050000
|
||||
retVal.setQuery(query);
|
||||
#endif
|
||||
}
|
||||
|
||||
return retVal;
|
||||
|
@ -32,9 +32,7 @@
|
||||
#include <QSqlQuery>
|
||||
#include <QBuffer>
|
||||
|
||||
#if QT_VERSION >= 0x050000
|
||||
#include <QUrlQuery>
|
||||
#endif
|
||||
|
||||
#define ENSURE_LOADED if (!m_settingsLoaded) loadSettings();
|
||||
|
||||
@ -290,7 +288,6 @@ void SearchEnginesManager::addEngineFromForm(const QWebElement &element, WebView
|
||||
parameterUrl = QUrl("http://foo.bar");
|
||||
}
|
||||
|
||||
#if QT_VERSION >= 0x050000
|
||||
QUrlQuery query(parameterUrl);
|
||||
query.addQueryItem(element.attribute("name"), "%s");
|
||||
|
||||
@ -304,28 +301,6 @@ void SearchEnginesManager::addEngineFromForm(const QWebElement &element, WebView
|
||||
}
|
||||
|
||||
parameterUrl.setQuery(query);
|
||||
#else
|
||||
QList<QPair<QByteArray, QByteArray> > queryItems;
|
||||
|
||||
QPair<QByteArray, QByteArray> item;
|
||||
item.first = element.attribute("name").toUtf8();
|
||||
item.second = "%s";
|
||||
queryItems.append(item);
|
||||
|
||||
QWebElementCollection allInputs = formElement.findAll("input");
|
||||
foreach (QWebElement e, allInputs) {
|
||||
if (element == e || !e.hasAttribute("name")) {
|
||||
continue;
|
||||
}
|
||||
|
||||
QPair<QByteArray, QByteArray> item;
|
||||
item.first = QUrl::toPercentEncoding(e.attribute("name").toUtf8());
|
||||
item.second = QUrl::toPercentEncoding(e.evaluateJavaScript("this.value").toByteArray());
|
||||
|
||||
queryItems.append(item);
|
||||
}
|
||||
parameterUrl.setEncodedQueryItems(parameterUrl.encodedQueryItems() + queryItems);
|
||||
#endif
|
||||
|
||||
if (!isPost) {
|
||||
actionUrl = parameterUrl;
|
||||
|
@ -23,11 +23,7 @@
|
||||
#include "webpage.h"
|
||||
#include "qtwin.h"
|
||||
|
||||
#if QT_VERSION < 0x050000
|
||||
#include "qwebkitversion.h"
|
||||
#else
|
||||
#include <QWebEnginePage>
|
||||
#endif
|
||||
|
||||
AboutDialog::AboutDialog(QWidget* parent)
|
||||
: QDialog(parent),
|
||||
|
@ -35,11 +35,7 @@
|
||||
#include <QCloseEvent>
|
||||
#include <QPrinter>
|
||||
|
||||
#if QT_VERSION >= 0x050000
|
||||
#include <QtConcurrent/QtConcurrentRun>
|
||||
#else
|
||||
#include <QtConcurrentRun>
|
||||
#endif
|
||||
|
||||
PageScreen::PageScreen(WebView* view, QWidget* parent)
|
||||
: QDialog(parent)
|
||||
|
@ -25,13 +25,8 @@
|
||||
|
||||
QString CertificateInfoWidget::certificateItemText(const QSslCertificate &cert)
|
||||
{
|
||||
#if QT_VERSION >= 0x050000
|
||||
QString commonName = cert.subjectInfo(QSslCertificate::CommonName).isEmpty() ? QString() : cert.subjectInfo(QSslCertificate::CommonName).at(0);
|
||||
QString organization = cert.subjectInfo(QSslCertificate::Organization).isEmpty() ? QString() : cert.subjectInfo(QSslCertificate::Organization).at(0);
|
||||
#else
|
||||
QString commonName = cert.subjectInfo(QSslCertificate::CommonName);
|
||||
QString organization = cert.subjectInfo(QSslCertificate::Organization);
|
||||
#endif
|
||||
|
||||
if (commonName.isEmpty()) {
|
||||
return clearCertSpecialSymbols(organization);
|
||||
|
@ -26,11 +26,7 @@ HeaderView::HeaderView(QAbstractItemView* parent)
|
||||
, m_menu(0)
|
||||
, m_resizeOnShow(false)
|
||||
{
|
||||
#if QT_VERSION >= 0x050000
|
||||
setSectionsMovable(true);
|
||||
#else
|
||||
setMovable(true);
|
||||
#endif
|
||||
setStretchLastSection(true);
|
||||
setDefaultAlignment(Qt::AlignLeft);
|
||||
setMinimumSectionSize(60);
|
||||
|
@ -18,7 +18,6 @@
|
||||
#include "qzregexp.h"
|
||||
#include "qztools.h"
|
||||
|
||||
#if (QT_VERSION >= 0x050000)
|
||||
QzRegExp::QzRegExp()
|
||||
: QRegularExpression(QString(), QRegularExpression::DotMatchesEverythingOption)
|
||||
, m_matchedLength(-1)
|
||||
@ -83,5 +82,4 @@ QString QzRegExp::cap(int nth) const
|
||||
|
||||
return m_capturedTexts.at(nth);
|
||||
}
|
||||
#endif // (QT_VERSION >= 0x050000)
|
||||
|
||||
|
@ -18,13 +18,6 @@
|
||||
#ifndef QZREGEXP_H
|
||||
#define QZREGEXP_H
|
||||
|
||||
#include <QObject> // Needed for QT_VERSION
|
||||
|
||||
#if (QT_VERSION < 0x050000)
|
||||
// Qt 4 - use QRegExp directly
|
||||
#include <QRegExp>
|
||||
#define QzRegExp QRegExp
|
||||
#else // Qt 5
|
||||
#include <QRegularExpression>
|
||||
#include <QStringList>
|
||||
|
||||
@ -47,6 +40,5 @@ private:
|
||||
int m_matchedLength;
|
||||
|
||||
};
|
||||
#endif // Qt 5
|
||||
|
||||
#endif // QZREGEXP_H
|
||||
|
@ -20,11 +20,7 @@
|
||||
#include <QThread>
|
||||
#include <QMutexLocker>
|
||||
|
||||
#if QT_VERSION >= 0x050000
|
||||
#include <QtConcurrent/QtConcurrentRun>
|
||||
#else
|
||||
#include <QtConcurrentRun>
|
||||
#endif
|
||||
|
||||
Q_GLOBAL_STATIC(SqlDatabase, qz_sql_database)
|
||||
|
||||
|
@ -29,14 +29,7 @@
|
||||
#include <QDir>
|
||||
#include <QDateTime>
|
||||
#include <QTextStream>
|
||||
|
||||
#if QT_VERSION >= 0x050000
|
||||
#include <QWebEnginePage>
|
||||
#else
|
||||
#include "qwebkitversion.h"
|
||||
#endif
|
||||
|
||||
#include <qtwebengineglobal.h>
|
||||
|
||||
void qupzilla_signal_handler(int s)
|
||||
{
|
||||
@ -107,30 +100,6 @@ void qupzilla_signal_handler(int s)
|
||||
#endif // defined(Q_OS_LINUX) || defined(__GLIBC__) || defined(__FreeBSD__)
|
||||
|
||||
#ifndef Q_OS_WIN
|
||||
#if (QT_VERSION < 0x050000)
|
||||
void msgHandler(QtMsgType type, const char* msg)
|
||||
{
|
||||
// Skip this debug message as it may occur in a large amount over time
|
||||
if (strcmp("QFont::setPixelSize: Pixel size <= 0 (0)", msg) == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
switch (type) {
|
||||
case QtDebugMsg:
|
||||
case QtWarningMsg:
|
||||
case QtCriticalMsg:
|
||||
std::cerr << msg << std::endl;
|
||||
break;
|
||||
|
||||
case QtFatalMsg:
|
||||
std::cerr << "Fatal: " << msg << std::endl;
|
||||
abort();
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
#else
|
||||
void msgHandler(QtMsgType type, const QMessageLogContext &context, const QString &msg)
|
||||
{
|
||||
if (msg.startsWith(QL1S("QSslSocket: cannot resolve SSLv2_")))
|
||||
@ -153,24 +122,14 @@ void msgHandler(QtMsgType type, const QMessageLogContext &context, const QString
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
QT_REQUIRE_VERSION(argc, argv, "4.7.0");
|
||||
|
||||
#ifndef Q_OS_WIN
|
||||
#if (QT_VERSION < 0x050000)
|
||||
qInstallMsgHandler(&msgHandler);
|
||||
#else
|
||||
qInstallMessageHandler(&msgHandler);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(QZ_WS_X11) && QT_VERSION < 0x050000
|
||||
// Better overall performance on X11
|
||||
QApplication::setGraphicsSystem(QSL("raster"));
|
||||
#endif
|
||||
|
||||
#if defined(Q_OS_LINUX) || defined(__GLIBC__) || defined(__FreeBSD__)
|
||||
signal(SIGSEGV, qupzilla_signal_handler);
|
||||
|
@ -1,10 +1,6 @@
|
||||
include(../defines.pri)
|
||||
|
||||
isEqual(QT_MAJOR_VERSION, 5) {
|
||||
QT += webengine webenginewidgets network widgets printsupport sql script
|
||||
} else {
|
||||
QT += core gui webkit sql network script
|
||||
}
|
||||
QT += webengine webenginewidgets network widgets printsupport sql script
|
||||
|
||||
TARGET = qupzilla
|
||||
mac: TARGET = QupZilla
|
||||
|
@ -1,11 +1,6 @@
|
||||
include($$PWD/../../src/defines.pri)
|
||||
|
||||
isEqual(QT_MAJOR_VERSION, 5) {
|
||||
QT += webkitwidgets network widgets printsupport sql script gui-private testlib
|
||||
} else {
|
||||
QT += core gui webkit sql network script
|
||||
CONFIG += qtestlib
|
||||
}
|
||||
QT += webenginewidgets network widgets printsupport sql script gui-private testlib
|
||||
|
||||
TARGET = autotests
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user