mirror of
https://github.com/qgis/QGIS.git
synced 2025-10-08 00:05:09 -04:00
support platforms that does not have QProcess support (iOS)
This commit is contained in:
parent
bfdb3ec489
commit
1559013270
@ -26,8 +26,12 @@ task. This can be used to draw maps without blocking the QGIS interface.
|
||||
|
||||
enum ErrorType
|
||||
{
|
||||
//! Image allocation failure
|
||||
ImageAllocationFail,
|
||||
ImageSaveFail
|
||||
//! Image save failure
|
||||
ImageSaveFail,
|
||||
|
||||
ImageUnsupportedFormat
|
||||
};
|
||||
|
||||
QgsMapRendererTask( const QgsMapSettings &ms,
|
||||
|
@ -17,6 +17,9 @@ class QgsRunProcess: QObject /NoDefaultCtors/
|
||||
A class that executes an external program/script.
|
||||
It can optionally capture the standard output and error from the
|
||||
process and displays them in a dialog box.
|
||||
|
||||
On some platforms (e.g. iOS) , the process execution is skipped
|
||||
https://lists.qt-project.org/pipermail/development/2015-July/022205.html
|
||||
%End
|
||||
|
||||
%TypeHeaderCode
|
||||
@ -26,16 +29,15 @@ process and displays them in a dialog box.
|
||||
|
||||
static QgsRunProcess *create( const QString &action, bool capture ) /Factory/;
|
||||
|
||||
private:
|
||||
QgsRunProcess( const QString &action, bool capture );
|
||||
~QgsRunProcess();
|
||||
public slots:
|
||||
void stdoutAvailable();
|
||||
void stderrAvailable();
|
||||
void processError( QProcess::ProcessError );
|
||||
void processExit( int, QProcess::ExitStatus );
|
||||
void dialogGone();
|
||||
|
||||
private:
|
||||
QgsRunProcess( const QString &action, bool capture );
|
||||
~QgsRunProcess();
|
||||
};
|
||||
|
||||
/************************************************************************
|
||||
|
@ -61,6 +61,7 @@
|
||||
#include <QMessageBox>
|
||||
#include <QPalette>
|
||||
#include <QProcess>
|
||||
#include <QProcessEnvironment>
|
||||
#include <QIcon>
|
||||
#include <QPixmap>
|
||||
#include <QThreadPool>
|
||||
@ -270,7 +271,9 @@ void QgsApplication::init( QString profileFolder )
|
||||
// store system environment variables passed to application, before they are adjusted
|
||||
QMap<QString, QString> systemEnvVarMap;
|
||||
QString passfile( QStringLiteral( "QGIS_AUTH_PASSWORD_FILE" ) ); // QString, for comparison
|
||||
Q_FOREACH ( const QString &varStr, QProcess::systemEnvironment() )
|
||||
|
||||
const auto systemEnvironment = QProcessEnvironment::systemEnvironment().toStringList();
|
||||
for ( const QString &varStr : systemEnvironment )
|
||||
{
|
||||
int pos = varStr.indexOf( QLatin1Char( '=' ) );
|
||||
if ( pos == -1 )
|
||||
@ -947,7 +950,7 @@ QString QgsApplication::userLoginName()
|
||||
sUserName = QString( name );
|
||||
}
|
||||
|
||||
#else
|
||||
#elseif QT_CONFIG(process)
|
||||
QProcess process;
|
||||
|
||||
process.start( QStringLiteral( "whoami" ) );
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include <QTextCodec>
|
||||
#include <QMessageBox>
|
||||
|
||||
#if QT_CONFIG(process)
|
||||
QgsRunProcess::QgsRunProcess( const QString &action, bool capture )
|
||||
|
||||
{
|
||||
@ -162,3 +163,13 @@ void QgsRunProcess::processError( QProcess::ProcessError err )
|
||||
QgsDebugMsg( "Got error: " + QString( "%d" ).arg( err ) );
|
||||
}
|
||||
}
|
||||
#else
|
||||
QgsRunProcess::QgsRunProcess( const QString &action, bool )
|
||||
{
|
||||
QgsDebugMsg( "Skipping command: " + action );
|
||||
}
|
||||
|
||||
QgsRunProcess::~QgsRunProcess()
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
@ -28,12 +28,14 @@
|
||||
#include "qgis_sip.h"
|
||||
|
||||
class QgsMessageOutput;
|
||||
|
||||
/**
|
||||
* \ingroup core
|
||||
* A class that executes an external program/script.
|
||||
* It can optionally capture the standard output and error from the
|
||||
* process and displays them in a dialog box.
|
||||
*
|
||||
* On some platforms (e.g. iOS) , the process execution is skipped
|
||||
* https://lists.qt-project.org/pipermail/development/2015-July/022205.html
|
||||
*/
|
||||
class CORE_EXPORT QgsRunProcess: public QObject SIP_NODEFAULTCTORS
|
||||
{
|
||||
@ -50,23 +52,25 @@ class CORE_EXPORT QgsRunProcess: public QObject SIP_NODEFAULTCTORS
|
||||
static QgsRunProcess *create( const QString &action, bool capture ) SIP_FACTORY
|
||||
{ return new QgsRunProcess( action, capture ); }
|
||||
|
||||
public slots:
|
||||
void stdoutAvailable();
|
||||
void stderrAvailable();
|
||||
void processError( QProcess::ProcessError );
|
||||
void processExit( int, QProcess::ExitStatus );
|
||||
void dialogGone();
|
||||
|
||||
private:
|
||||
QgsRunProcess( const QString &action, bool capture ) SIP_FORCE;
|
||||
~QgsRunProcess() override SIP_FORCE;
|
||||
|
||||
#if QT_CONFIG(process)
|
||||
// Deletes the instance of the class
|
||||
void die();
|
||||
|
||||
QProcess *mProcess = nullptr;
|
||||
QgsMessageOutput *mOutput = nullptr;
|
||||
QString mCommand;
|
||||
|
||||
public slots:
|
||||
void stdoutAvailable();
|
||||
void stderrAvailable();
|
||||
void processError( QProcess::ProcessError );
|
||||
void processExit( int, QProcess::ExitStatus );
|
||||
void dialogGone();
|
||||
#endif // !(QT_CONFIG(process)
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -196,6 +196,7 @@ QgsUserProfile *QgsUserProfileManager::userProfile()
|
||||
|
||||
void QgsUserProfileManager::loadUserProfile( const QString &name )
|
||||
{
|
||||
#if QT_CONFIG(process)
|
||||
QString path = QDir::toNativeSeparators( QCoreApplication::applicationFilePath() );
|
||||
QStringList arguments;
|
||||
arguments << QCoreApplication::arguments();
|
||||
@ -203,10 +204,13 @@ void QgsUserProfileManager::loadUserProfile( const QString &name )
|
||||
// on Windows this might not be case so we need to handle that
|
||||
// http://doc.qt.io/qt-5/qcoreapplication.html#arguments
|
||||
arguments.removeFirst();
|
||||
|
||||
arguments << QStringLiteral( "--profile" ) << name;
|
||||
QgsDebugMsg( QStringLiteral( "Starting instance from %1 with %2" ).arg( path ).arg( arguments.join( " " ) ) );
|
||||
QProcess::startDetached( path, arguments, QDir::toNativeSeparators( QCoreApplication::applicationDirPath() ) );
|
||||
#else
|
||||
Q_UNUSED( name )
|
||||
Q_ASSERT( "Starting the user profile is not supported on the platform" );
|
||||
#endif //QT_CONFIG(process)
|
||||
}
|
||||
|
||||
void QgsUserProfileManager::setActiveUserProfile( const QString &profile )
|
||||
|
Loading…
x
Reference in New Issue
Block a user