[*] Remove pre-Qt-5.15 compatibility ifdefs
This commit is contained in:
parent
2ea4d365f9
commit
fd2610c739
@ -115,13 +115,8 @@ LocaleTests::testLanguageScripts()
|
||||
void
|
||||
LocaleTests::testEsperanto()
|
||||
{
|
||||
#if QT_VERSION < QT_VERSION_CHECK( 5, 12, 2 )
|
||||
QCOMPARE( QLocale( "eo" ).language(), QLocale::C );
|
||||
QCOMPARE( QLocale( QLocale::Esperanto ).language(), QLocale::English );
|
||||
#else
|
||||
QCOMPARE( QLocale( "eo" ).language(), QLocale::Esperanto );
|
||||
QCOMPARE( QLocale( QLocale::Esperanto ).language(), QLocale::Esperanto ); // Probably fails on 5.12, too
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -216,12 +216,6 @@ Manager::Private::checkHasInternet()
|
||||
// It's possible that access was switched off (see below, if the check
|
||||
// fails) so we want to turn it back on first. Otherwise all the
|
||||
// checks will fail **anyway**, defeating the point of the checks.
|
||||
#if ( QT_VERSION < QT_VERSION_CHECK( 5, 15, 0 ) )
|
||||
if ( !m_hasInternet )
|
||||
{
|
||||
threadNAM->setNetworkAccessible( QNetworkAccessManager::Accessible );
|
||||
}
|
||||
#endif
|
||||
if ( m_lastCheckedUrlIndex < 0 )
|
||||
{
|
||||
m_lastCheckedUrlIndex = 0;
|
||||
@ -245,17 +239,6 @@ Manager::Private::checkHasInternet()
|
||||
attempts++;
|
||||
} while ( !m_hasInternet && ( attempts < m_hasInternetUrls.size() ) );
|
||||
|
||||
// For earlier Qt versions (< 5.15.0), set the accessibility flag to
|
||||
// NotAccessible if synchronous ping has failed, so that any module
|
||||
// using Qt's networkAccessible method to determine whether or not
|
||||
// internet connection is actually available won't get confused.
|
||||
#if ( QT_VERSION < QT_VERSION_CHECK( 5, 15, 0 ) )
|
||||
if ( !m_hasInternet )
|
||||
{
|
||||
threadNAM->setNetworkAccessible( QNetworkAccessManager::NotAccessible );
|
||||
}
|
||||
#endif
|
||||
|
||||
return m_hasInternet;
|
||||
}
|
||||
|
||||
|
@ -26,21 +26,9 @@
|
||||
* To avoid overly-many warnings related to the API change, introduce
|
||||
* Calamares-specific constants that pull from the correct enum.
|
||||
*/
|
||||
constexpr static const auto SplitSkipEmptyParts =
|
||||
#if QT_VERSION < QT_VERSION_CHECK( 5, 14, 0 )
|
||||
QString::SkipEmptyParts
|
||||
#else
|
||||
Qt::SkipEmptyParts
|
||||
#endif
|
||||
;
|
||||
constexpr static const auto SplitSkipEmptyParts = Qt::SkipEmptyParts;
|
||||
|
||||
constexpr static const auto SplitKeepEmptyParts =
|
||||
#if QT_VERSION < QT_VERSION_CHECK( 5, 14, 0 )
|
||||
QString::KeepEmptyParts
|
||||
#else
|
||||
Qt::KeepEmptyParts
|
||||
#endif
|
||||
;
|
||||
constexpr static const auto SplitKeepEmptyParts = Qt::KeepEmptyParts;
|
||||
|
||||
namespace Calamares
|
||||
{
|
||||
|
@ -122,12 +122,8 @@ System::createTargetFile( const QString& path, const QByteArray& contents, Write
|
||||
return CreationResult( CreationResult::Code::AlreadyExists );
|
||||
}
|
||||
|
||||
QIODevice::OpenMode m =
|
||||
#if QT_VERSION >= QT_VERSION_CHECK( 5, 11, 0 )
|
||||
// New flag from Qt 5.11, implies WriteOnly
|
||||
( mode == WriteMode::KeepExisting ? QIODevice::NewOnly : QIODevice::WriteOnly ) |
|
||||
#endif
|
||||
QIODevice::WriteOnly | QIODevice::Truncate;
|
||||
QIODevice::OpenMode m
|
||||
= ( mode == WriteMode::KeepExisting ? QIODevice::NewOnly : QIODevice::WriteOnly ) | QIODevice::Truncate;
|
||||
|
||||
if ( !f.open( m ) )
|
||||
{
|
||||
|
@ -8,10 +8,10 @@
|
||||
|
||||
/**@file Handle compatibility and deprecations across Qt versions
|
||||
*
|
||||
* Since Calamares is supposed to work with Qt 5.9 or later, it covers a
|
||||
* lot of changes in the Qt API. Especially the later Qt 5.15 (last LTS)
|
||||
* versions deprecate a number of enum values and parts of the QWidgets
|
||||
* API. This file adjusts for that by introducing suitable aliases
|
||||
* Since Calamares is supposed to work with Qt 5.15 or Qt 6 or later, it
|
||||
* covers a lot of changes in the Qt API.
|
||||
*
|
||||
* This file adjusts for that by introducing suitable aliases
|
||||
* and workaround-functions.
|
||||
*
|
||||
* For a similar approach for QtCore, see libcalamares/utils/String.h
|
||||
@ -23,20 +23,8 @@
|
||||
#include <QPalette>
|
||||
|
||||
/* Avoid warnings about QPalette changes */
|
||||
constexpr static const auto WindowBackground =
|
||||
#if QT_VERSION < QT_VERSION_CHECK( 5, 15, 0 )
|
||||
QPalette::Background
|
||||
#else
|
||||
QPalette::Window
|
||||
#endif
|
||||
;
|
||||
constexpr static const auto WindowBackground = QPalette::Window;
|
||||
|
||||
constexpr static const auto WindowText =
|
||||
#if QT_VERSION < QT_VERSION_CHECK( 5, 15, 0 )
|
||||
QPalette::Foreground
|
||||
#else
|
||||
QPalette::WindowText
|
||||
#endif
|
||||
;
|
||||
constexpr static const auto WindowText = QPalette::WindowText;
|
||||
|
||||
#endif
|
||||
|
@ -54,9 +54,7 @@ SlideshowQML::SlideshowQML( QWidget* parent )
|
||||
m_qmlShow->engine()->addImportPath( Calamares::qmlModulesDir().absolutePath() );
|
||||
|
||||
cDebug() << "QML import paths:" << Logger::DebugList( m_qmlShow->engine()->importPathList() );
|
||||
#if QT_VERSION >= QT_VERSION_CHECK( 5, 10, 0 )
|
||||
CALAMARES_RETRANSLATE( if ( m_qmlShow ) { m_qmlShow->engine()->retranslate(); } );
|
||||
#endif
|
||||
|
||||
if ( Branding::instance()->slideshowAPI() == 2 )
|
||||
{
|
||||
|
@ -137,14 +137,8 @@ TimeZoneWidget::paintEvent( QPaintEvent* )
|
||||
painter.drawImage( point.x() - pin.width() / 2, point.y() - pin.height() / 2, pin );
|
||||
|
||||
// Draw text and box
|
||||
// .. the lambda manages deprecations: the old one works in Qt 5.9 and Qt 5.10,
|
||||
// while the new one avoids deprecation messages in Qt 5.13 and later.
|
||||
#if QT_VERSION >= QT_VERSION_CHECK( 5, 11, 0 )
|
||||
auto textwidth = [ & ]( const QString& s ) { return fontMetrics.horizontalAdvance( s ); };
|
||||
#else
|
||||
auto textwidth = [ & ]( const QString& s ) { return fontMetrics.width( s ); };
|
||||
#endif
|
||||
const int textWidth = textwidth( m_currentLocation ? m_currentLocation->translated() : QString() );
|
||||
const int textWidth
|
||||
= fontMetrics.horizontalAdvance( m_currentLocation ? m_currentLocation->translated() : QString() );
|
||||
const int textHeight = fontMetrics.height();
|
||||
|
||||
QRect rect = QRect( point.x() - textWidth / 2 - 5, point.y() - textHeight - 8, textWidth + 10, textHeight - 2 );
|
||||
@ -170,7 +164,8 @@ TimeZoneWidget::paintEvent( QPaintEvent* )
|
||||
painter.setBrush( QColor( 40, 40, 40 ) );
|
||||
painter.drawRoundedRect( rect, 3, 3 );
|
||||
painter.setPen( Qt::white );
|
||||
painter.drawText( rect.x() + 5, rect.bottom() - 4, m_currentLocation ? m_currentLocation->translated() : QString() );
|
||||
painter.drawText(
|
||||
rect.x() + 5, rect.bottom() - 4, m_currentLocation ? m_currentLocation->translated() : QString() );
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -196,12 +196,7 @@ getPVGroups( const QString& deviceName )
|
||||
|
||||
vgSet.insert( vgName );
|
||||
}
|
||||
// toList() was deprecated, but old-old versions don't support QStringList construction like this
|
||||
#if QT_VERSION < QT_VERSION_CHECK( 5, 15, 0 )
|
||||
return vgSet.toList();
|
||||
#else
|
||||
return QStringList { vgSet.cbegin(), vgSet.cend() };
|
||||
#endif
|
||||
}
|
||||
}
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user