Skip to content

Commit

Permalink
update build system to make it compile on Qt6
Browse files Browse the repository at this point in the history
  • Loading branch information
mhogomchungu committed Jun 7, 2024
1 parent 9ca7758 commit c1fbb4a
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 25 deletions.
5 changes: 4 additions & 1 deletion external_libraries/lxqt_wallet/frontend/lxqt_wallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,10 @@ void LXQt::Wallet::setTranslationLanguage(const QString &language)
QCoreApplication::installTranslator([&]()
{
auto e = new QTranslator();
e->load(l, TRANSLATIONS_PATH);
auto m = e->load(l, TRANSLATIONS_PATH);
if (!m){
//???
}
return e;
}());
}
Expand Down
80 changes: 57 additions & 23 deletions external_libraries/tasks/task.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@
#include <utility>
#include <future>
#include <functional>
#include <memory>

#include <QThread>
#include <QEventLoop>
#include <QMutex>
Expand Down Expand Up @@ -193,7 +195,7 @@ namespace Task
{
}
std::pair< std::function< void() >,std::function< void() > > value ;
};
};
template< typename E,
typename F,
Task::detail::not_copyable<E> = 0,
Expand Down Expand Up @@ -1278,43 +1280,75 @@ namespace Task
{
return Task::run( [ = ](){

class Process : public QProcess{
public:
Process( std::function< void() > function,
const QProcessEnvironment& env ) :
m_function( std::move( function ) )
{
this->setProcessEnvironment( env ) ;
}
protected:
void setupChildProcess()
#if QT_VERSION < QT_VERSION_CHECK( 6,0,0 )
class Process : public QProcess
{
m_function() ;
}
private:
std::function< void() > m_function ;
public:
Process( std::function< void() > function,
const QProcessEnvironment& env ) :
m_function( std::move( function ) )
{
this->setProcessEnvironment( env ) ;
}
void setupChildProcess() override
{
m_function() ;
}
private:
std::function< void() > m_function ;
} ;
#else
#ifdef Q_OS_WIN

struct Process : public QProcess
{
Process( std::function< void( QProcess::CreateProcessArguments * ) > function,
const QProcessEnvironment& env )
{
this->setProcessEnvironment( env ) ;

this->setCreateProcessArgumentsModifier( function ) ;
}
Process( std::function< void() >,const QProcessEnvironment& env )
{
this->setProcessEnvironment( env ) ;
}
} ;
#else
struct Process : public QProcess
{
Process( std::function< void() > function,const QProcessEnvironment& env )
{
this->setProcessEnvironment( env ) ;

this->setChildProcessModifier( function ) ;
}
} ;
#endif

#endif

} exe( std::move( setUp_child_process ),env ) ;
auto exe = std::make_unique< Process >( std::move( setUp_child_process ),env ) ;

if( args.isEmpty() ){

#if QT_VERSION < QT_VERSION_CHECK( 5,15,0 )
exe.start( cmd ) ;
exe->start( cmd ) ;
#else
exe.start( cmd,args ) ;
exe->start( cmd,args ) ;
#endif
}else{
exe.start( cmd,args ) ;
exe->start( cmd,args ) ;
}

if( !password.isEmpty() ){

exe.waitForStarted( waitTime ) ;
exe.write( password ) ;
exe.closeWriteChannel() ;
exe->waitForStarted( waitTime ) ;
exe->write( password ) ;
exe->closeWriteChannel() ;
}

return result( exe,waitTime ) ;
return result( *exe,waitTime ) ;
} ) ;
}

Expand Down
2 changes: 1 addition & 1 deletion zuluCrypt-gui/json_parser.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ class SirikaliJson
}
void operator=( int value )
{
m_json.insert( m_key,QString( value ) ) ;
m_json.insert( m_key,QString::number( value ) ) ;
}
void operator=( const QStringList& value )
{
Expand Down

0 comments on commit c1fbb4a

Please sign in to comment.