forked from qt-creator/qt-creator
Utils: Introduce a central porting.h for "simple porting stuff"
I figured it might be easier to keep track of active hack here and also recognized includes that only exist for that reasons in user code if it's always the same. Change-Id: I4bf6af493443148cf30a6903d541cd9dc58946da Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -27,6 +27,7 @@
|
|||||||
#include "qmldebugclient.h"
|
#include "qmldebugclient.h"
|
||||||
#include "qpacketprotocol.h"
|
#include "qpacketprotocol.h"
|
||||||
|
|
||||||
|
#include <utils/porting.h>
|
||||||
#include <utils/temporaryfile.h>
|
#include <utils/temporaryfile.h>
|
||||||
|
|
||||||
#include <QLocalServer>
|
#include <QLocalServer>
|
||||||
|
@@ -108,6 +108,7 @@ add_qtc_library(Utils
|
|||||||
persistentsettings.cpp persistentsettings.h
|
persistentsettings.cpp persistentsettings.h
|
||||||
pointeralgorithm.h
|
pointeralgorithm.h
|
||||||
port.cpp port.h
|
port.cpp port.h
|
||||||
|
porting.h
|
||||||
portlist.cpp portlist.h
|
portlist.cpp portlist.h
|
||||||
predicates.h
|
predicates.h
|
||||||
processhandle.cpp processhandle.h
|
processhandle.cpp processhandle.h
|
||||||
|
40
src/libs/utils/porting.h
Normal file
40
src/libs/utils/porting.h
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
**
|
||||||
|
** Copyright (C) 2020 The Qt Company Ltd.
|
||||||
|
** Contact: https://www.qt.io/licensing/
|
||||||
|
**
|
||||||
|
** This file is part of Qt Creator.
|
||||||
|
**
|
||||||
|
** Commercial License Usage
|
||||||
|
** Licensees holding valid commercial Qt licenses may use this file in
|
||||||
|
** accordance with the commercial license agreement provided with the
|
||||||
|
** Software or, alternatively, in accordance with the terms contained in
|
||||||
|
** a written agreement between you and The Qt Company. For licensing terms
|
||||||
|
** and conditions see https://www.qt.io/terms-conditions. For further
|
||||||
|
** information use the contact form at https://www.qt.io/contact-us.
|
||||||
|
**
|
||||||
|
** GNU General Public License Usage
|
||||||
|
** Alternatively, this file may be used under the terms of the GNU
|
||||||
|
** General Public License version 3 as published by the Free Software
|
||||||
|
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
||||||
|
** included in the packaging of this file. Please review the following
|
||||||
|
** information to ensure the GNU General Public License requirements will
|
||||||
|
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
||||||
|
**
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "utils_global.h"
|
||||||
|
|
||||||
|
#include <QString>
|
||||||
|
|
||||||
|
namespace Utils {
|
||||||
|
|
||||||
|
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
|
||||||
|
constexpr QString::SplitBehavior SkipEmptyParts = QString::SkipEmptyParts;
|
||||||
|
#else
|
||||||
|
constexpr Qt::SplitBehaviorFlags SkipEmptyParts = Qt::SkipEmptyParts;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
} // namespace Utils
|
@@ -27,6 +27,8 @@
|
|||||||
|
|
||||||
#include "utils_global.h"
|
#include "utils_global.h"
|
||||||
|
|
||||||
|
#include "porting.h"
|
||||||
|
|
||||||
#include <QList>
|
#include <QList>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
|
||||||
@@ -36,12 +38,6 @@ QT_END_NAMESPACE
|
|||||||
|
|
||||||
namespace Utils {
|
namespace Utils {
|
||||||
|
|
||||||
#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
|
|
||||||
constexpr QString::SplitBehavior SkipEmptyParts = QString::SkipEmptyParts;
|
|
||||||
#else
|
|
||||||
constexpr Qt::SplitBehaviorFlags SkipEmptyParts = Qt::SkipEmptyParts;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Create a usable settings key from a category,
|
// Create a usable settings key from a category,
|
||||||
// for example Editor|C++ -> Editor_C__
|
// for example Editor|C++ -> Editor_C__
|
||||||
QTCREATOR_UTILS_EXPORT QString settingsKey(const QString &category);
|
QTCREATOR_UTILS_EXPORT QString settingsKey(const QString &category);
|
||||||
|
@@ -289,7 +289,8 @@ HEADERS += \
|
|||||||
$$PWD/overlaywidget.h \
|
$$PWD/overlaywidget.h \
|
||||||
$$PWD/archive.h \
|
$$PWD/archive.h \
|
||||||
$$PWD/id.h \
|
$$PWD/id.h \
|
||||||
$$PWD/infobar.h
|
$$PWD/infobar.h \
|
||||||
|
$$PWD/porting.h
|
||||||
|
|
||||||
FORMS += $$PWD/filewizardpage.ui \
|
FORMS += $$PWD/filewizardpage.ui \
|
||||||
$$PWD/projectintropage.ui \
|
$$PWD/projectintropage.ui \
|
||||||
|
@@ -198,6 +198,7 @@ Project {
|
|||||||
"pointeralgorithm.h",
|
"pointeralgorithm.h",
|
||||||
"port.cpp",
|
"port.cpp",
|
||||||
"port.h",
|
"port.h",
|
||||||
|
"porting.h",
|
||||||
"portlist.cpp",
|
"portlist.cpp",
|
||||||
"portlist.h",
|
"portlist.h",
|
||||||
"processhandle.cpp",
|
"processhandle.cpp",
|
||||||
|
Reference in New Issue
Block a user