interactiveterminal: prepare for Qt6
- Try to build with KF6 - Bodge out the actual loading-of-konsole-part
This commit is contained in:
parent
f4a80c1a01
commit
766c28ca82
@ -3,19 +3,12 @@
|
|||||||
# SPDX-FileCopyrightText: 2020 Adriaan de Groot <groot@kde.org>
|
# SPDX-FileCopyrightText: 2020 Adriaan de Groot <groot@kde.org>
|
||||||
# SPDX-License-Identifier: BSD-2-Clause
|
# SPDX-License-Identifier: BSD-2-Clause
|
||||||
#
|
#
|
||||||
if(WITH_QT6)
|
find_package(${kfname}Service ${KF_VERSION})
|
||||||
calamares_skip_module( "interactiveterminal (KDE Frameworks 5 only)" )
|
find_package(${kfname}Parts ${KF_VERSION})
|
||||||
return()
|
set_package_properties(${kfname}Service PROPERTIES PURPOSE "For finding KDE services at runtime")
|
||||||
endif()
|
set_package_properties(${kfname}Parts PROPERTIES PURPOSE "For finding KDE parts at runtime")
|
||||||
|
|
||||||
set(kf5_ver 5.41)
|
if(${kfname}Parts_FOUND AND ${kfname}Service_FOUND)
|
||||||
|
|
||||||
find_package(KF5Service ${kf5_ver})
|
|
||||||
find_package(KF5Parts ${kf5_ver})
|
|
||||||
set_package_properties(KF5Service PROPERTIES PURPOSE "For finding KDE services at runtime")
|
|
||||||
set_package_properties(KF5Parts PROPERTIES PURPOSE "For finding KDE parts at runtime")
|
|
||||||
|
|
||||||
if(KF5Parts_FOUND AND KF5Service_FOUND)
|
|
||||||
calamares_add_plugin(interactiveterminal
|
calamares_add_plugin(interactiveterminal
|
||||||
TYPE viewmodule
|
TYPE viewmodule
|
||||||
EXPORT_MACRO PLUGINDLLEXPORT_PRO
|
EXPORT_MACRO PLUGINDLLEXPORT_PRO
|
||||||
@ -23,8 +16,8 @@ if(KF5Parts_FOUND AND KF5Service_FOUND)
|
|||||||
InteractiveTerminalViewStep.cpp
|
InteractiveTerminalViewStep.cpp
|
||||||
InteractiveTerminalPage.cpp
|
InteractiveTerminalPage.cpp
|
||||||
LINK_LIBRARIES
|
LINK_LIBRARIES
|
||||||
KF5::Service
|
${kfname}::Service
|
||||||
KF5::Parts
|
${kfname}::Parts
|
||||||
SHARED_LIB
|
SHARED_LIB
|
||||||
)
|
)
|
||||||
else()
|
else()
|
||||||
|
@ -16,7 +16,11 @@
|
|||||||
#include "widgets/TranslationFix.h"
|
#include "widgets/TranslationFix.h"
|
||||||
|
|
||||||
#include <KParts/ReadOnlyPart>
|
#include <KParts/ReadOnlyPart>
|
||||||
|
#if QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 )
|
||||||
#include <KParts/kde_terminal_interface.h>
|
#include <KParts/kde_terminal_interface.h>
|
||||||
|
#else
|
||||||
|
#include <kde_terminal_interface.h>
|
||||||
|
#endif
|
||||||
#include <KService>
|
#include <KService>
|
||||||
#include <kcoreaddons_version.h>
|
#include <kcoreaddons_version.h>
|
||||||
|
|
||||||
@ -26,7 +30,6 @@
|
|||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
|
|
||||||
|
|
||||||
InteractiveTerminalPage::InteractiveTerminalPage( QWidget* parent )
|
InteractiveTerminalPage::InteractiveTerminalPage( QWidget* parent )
|
||||||
: QWidget( parent )
|
: QWidget( parent )
|
||||||
, m_layout( new QVBoxLayout( this ) )
|
, m_layout( new QVBoxLayout( this ) )
|
||||||
@ -58,10 +61,12 @@ InteractiveTerminalPage::onActivate()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if KCOREADDONS_VERSION_MAJOR != 5
|
#if KCOREADDONS_VERSION_MAJOR > 5 || KCOREADDONS_VERSION_MINOR > 200
|
||||||
#error Incompatible with not-KF5
|
#warning Using KF6
|
||||||
#endif
|
errorKonsoleNotInstalled();
|
||||||
#if KCOREADDONS_VERSION_MINOR >= 86
|
return;
|
||||||
|
KParts::ReadOnlyPart* p = nullptr;
|
||||||
|
#elif KCOREADDONS_VERSION_MINOR >= 86
|
||||||
// 5.86 deprecated a bunch of KService and PluginFactory and related methods
|
// 5.86 deprecated a bunch of KService and PluginFactory and related methods
|
||||||
auto md = KPluginMetaData::findPluginById( QString(), "konsolepart" );
|
auto md = KPluginMetaData::findPluginById( QString(), "konsolepart" );
|
||||||
if ( !md.isValid() )
|
if ( !md.isValid() )
|
||||||
@ -109,7 +114,6 @@ InteractiveTerminalPage::onActivate()
|
|||||||
t->sendInput( QString( "%1\n" ).arg( m_command ) );
|
t->sendInput( QString( "%1\n" ).arg( m_command ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
InteractiveTerminalPage::setCommand( const QString& command )
|
InteractiveTerminalPage::setCommand( const QString& command )
|
||||||
{
|
{
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
|
|
||||||
#include "InteractiveTerminalPage.h"
|
#include "InteractiveTerminalPage.h"
|
||||||
|
|
||||||
|
#include "compat/Variant.h"
|
||||||
#include "utils/Logger.h"
|
#include "utils/Logger.h"
|
||||||
|
|
||||||
#include <QVariant>
|
#include <QVariant>
|
||||||
@ -25,7 +26,6 @@ InteractiveTerminalViewStep::InteractiveTerminalViewStep( QObject* parent )
|
|||||||
emit nextStatusChanged( true );
|
emit nextStatusChanged( true );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
InteractiveTerminalViewStep::~InteractiveTerminalViewStep()
|
InteractiveTerminalViewStep::~InteractiveTerminalViewStep()
|
||||||
{
|
{
|
||||||
if ( m_widget && m_widget->parent() == nullptr )
|
if ( m_widget && m_widget->parent() == nullptr )
|
||||||
@ -34,49 +34,42 @@ InteractiveTerminalViewStep::~InteractiveTerminalViewStep()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QString
|
QString
|
||||||
InteractiveTerminalViewStep::prettyName() const
|
InteractiveTerminalViewStep::prettyName() const
|
||||||
{
|
{
|
||||||
return tr( "Script" );
|
return tr( "Script" );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QWidget*
|
QWidget*
|
||||||
InteractiveTerminalViewStep::widget()
|
InteractiveTerminalViewStep::widget()
|
||||||
{
|
{
|
||||||
return m_widget;
|
return m_widget;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
InteractiveTerminalViewStep::isNextEnabled() const
|
InteractiveTerminalViewStep::isNextEnabled() const
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
InteractiveTerminalViewStep::isBackEnabled() const
|
InteractiveTerminalViewStep::isBackEnabled() const
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
InteractiveTerminalViewStep::isAtBeginning() const
|
InteractiveTerminalViewStep::isAtBeginning() const
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
InteractiveTerminalViewStep::isAtEnd() const
|
InteractiveTerminalViewStep::isAtEnd() const
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QList< Calamares::job_ptr >
|
QList< Calamares::job_ptr >
|
||||||
InteractiveTerminalViewStep::jobs() const
|
InteractiveTerminalViewStep::jobs() const
|
||||||
{
|
{
|
||||||
@ -84,7 +77,6 @@ InteractiveTerminalViewStep::jobs() const
|
|||||||
return QList< Calamares::job_ptr >();
|
return QList< Calamares::job_ptr >();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
InteractiveTerminalViewStep::onActivate()
|
InteractiveTerminalViewStep::onActivate()
|
||||||
{
|
{
|
||||||
@ -92,11 +84,11 @@ InteractiveTerminalViewStep::onActivate()
|
|||||||
m_widget->onActivate();
|
m_widget->onActivate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
InteractiveTerminalViewStep::setConfigurationMap( const QVariantMap& configurationMap )
|
InteractiveTerminalViewStep::setConfigurationMap( const QVariantMap& configurationMap )
|
||||||
{
|
{
|
||||||
if ( configurationMap.contains( "command" ) && configurationMap.value( "command" ).type() == QVariant::String )
|
if ( configurationMap.contains( "command" )
|
||||||
|
&& Calamares::typeOf( configurationMap.value( "command" ) ) == Calamares::StringVariantType )
|
||||||
{
|
{
|
||||||
m_widget->setCommand( configurationMap.value( "command" ).toString() );
|
m_widget->setCommand( configurationMap.value( "command" ).toString() );
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user