@ -10,15 +10,15 @@
# include "frontend_common/data_manager.h"
# include "frontend_common/data_manager.h"
# include "frontend_common/firmware_manager.h"
# include "frontend_common/firmware_manager.h"
# include "qt_common/qt_common.h"
# include "compress.h"
# include "compress.h"
# include "qt_common/abstract/qt_progress_dialog.h"
# include "qt_common/abstract/qt_frontend_util.h"
# include "qt_common/abstract/qt_frontend_util.h"
# include "qt_common/abstract/qt_progress_dialog.h"
# include "qt_common/qt_common.h"
# include <QFuture>
# include <QFuture>
# include <QFutureWatcher>
# include <QtConcurrentRun>
# include <QtConcurrentRun>
# include <JlCompress.h>
# include <JlCompress.h>
# include <QFutureWatcher>
namespace QtCommon : : Content {
namespace QtCommon : : Content {
@ -68,7 +68,7 @@ void InstallFirmware(const QString& location, bool recursive)
const auto ShowMessage = [ & ] ( ) {
const auto ShowMessage = [ & ] ( ) {
QtCommon : : Frontend : : ShowMessage ( icon ,
QtCommon : : Frontend : : ShowMessage ( icon ,
tr ( failedTitle ) ,
tr ( failedTitle ) ,
tr ( GetFirmwareInstallResultString ( result ) ) ) ;
GetFirmwareInstallResultString ( result ) ) ;
} ;
} ;
LOG_INFO ( Frontend , " Installing firmware from {} " , location . toStdString ( ) ) ;
LOG_INFO ( Frontend , " Installing firmware from {} " , location . toStdString ( ) ) ;
@ -188,10 +188,10 @@ void InstallFirmware(const QString& location, bool recursive)
const std : : string display_version ( firmware_data . display_version . data ( ) ) ;
const std : : string display_version ( firmware_data . display_version . data ( ) ) ;
result = FirmwareInstallResult : : Success ;
result = FirmwareInstallResult : : Success ;
QtCommon : : Frontend : : Information (
rootObject ,
QtCommon : : Frontend : : Information ( rootObject ,
tr ( successTitle ) ,
tr ( successTitle ) ,
tr ( GetFirmwareInstallResultString ( result ) ) . arg ( QString : : fromStdString ( display_version ) ) ) ;
GetFirmwareInstallResultString ( result ) . arg (
QString : : fromStdString ( display_version ) ) ) ;
}
}
QString UnzipFirmwareToTmp ( const QString & location )
QString UnzipFirmwareToTmp ( const QString & location )
@ -277,14 +277,13 @@ void InstallKeys()
system - > GetFileSystemController ( ) . CreateFactories ( * QtCommon : : vfs ) ;
system - > GetFileSystemController ( ) . CreateFactories ( * QtCommon : : vfs ) ;
const QString resMsg = GetKeyInstallResultString ( result ) ;
switch ( result ) {
switch ( result ) {
case FirmwareManager : : KeyInstallResult : : Success :
case FirmwareManager : : KeyInstallResult : : Success :
QtCommon : : Frontend : : Information ( tr ( " Decryption Keys install succeeded " ) ,
tr ( " Decryption Keys were successfully installed " ) ) ;
QtCommon : : Frontend : : Information ( tr ( " Decryption Keys install succeeded " ) , resMsg ) ;
break ;
break ;
default :
default :
QtCommon : : Frontend : : Critical ( tr ( " Decryption Keys install failed " ) ,
tr ( FirmwareManager : : GetKeyInstallResultString ( result ) ) ) ;
QtCommon : : Frontend : : Critical ( tr ( " Decryption Keys install failed " ) , resMsg ) ;
break ;
break ;
}
}
}
}
@ -415,7 +414,9 @@ void ExportDataDir(FrontendCommon::DataManager::DataDir data_dir,
QGuiApplication : : processEvents ( ) ;
QGuiApplication : : processEvents ( ) ;
auto progress_callback = [ = ] ( size_t total_size , size_t processed_size ) {
auto progress_callback = [ = ] ( size_t total_size , size_t processed_size ) {
QMetaObject : : invokeMethod ( progress , " setValue " , Qt : : DirectConnection ,
QMetaObject : : invokeMethod ( progress ,
" setValue " ,
Qt : : DirectConnection ,
Q_ARG ( int , static_cast < int > ( ( processed_size * 100 ) / total_size ) ) ) ;
Q_ARG ( int , static_cast < int > ( ( processed_size * 100 ) / total_size ) ) ) ;
return ! progress - > wasCanceled ( ) ;
return ! progress - > wasCanceled ( ) ;
} ;
} ;
@ -499,8 +500,11 @@ void ImportDataDir(FrontendCommon::DataManager::DataDir data_dir,
QObject : : connect ( delete_watcher , & QFutureWatcher < bool > : : finished , rootObject , [ = ] ( ) {
QObject : : connect ( delete_watcher , & QFutureWatcher < bool > : : finished , rootObject , [ = ] ( ) {
auto progress_callback = [ = ] ( size_t total_size , size_t processed_size ) {
auto progress_callback = [ = ] ( size_t total_size , size_t processed_size ) {
QMetaObject : : invokeMethod ( progress , " setValue " , Qt : : DirectConnection ,
Q_ARG ( int , static_cast < int > ( ( processed_size * 100 ) / total_size ) ) ) ;
QMetaObject : : invokeMethod ( progress ,
" setValue " ,
Qt : : DirectConnection ,
Q_ARG ( int ,
static_cast < int > ( ( processed_size * 100 ) / total_size ) ) ) ;
return ! progress - > wasCanceled ( ) ;
return ! progress - > wasCanceled ( ) ;
} ;
} ;