Skip to content

Commit

Permalink
do not add empty json entries when saving playlist downloader tab ent…
Browse files Browse the repository at this point in the history
…ries
  • Loading branch information
mhogomchungu committed Aug 3, 2024
1 parent 6312c0b commit a704140
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 13 deletions.
6 changes: 3 additions & 3 deletions src/networkAccess.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -235,9 +235,9 @@ void networkAccess::uMediaDownloaderM( networkAccess::updateMDOptions& md,
}else{
md.file.write( p.data() ) ;

auto perc = double( p.received() ) * 100 / md.size ;
auto totalSize = md.locale.formattedDataSize( qint64( md.size ) ) ;
auto current = md.locale.formattedDataSize( p.received() ) ;
auto perc = double( p.received() ) * 100 / md.size ;
auto totalSize = md.locale.formattedDataSize( qint64( md.size ) ) ;
auto current = md.locale.formattedDataSize( p.received() ) ;
auto percentage = QString::number( perc,'f',2 ) ;

auto m = QString( "%1 / %2 (%3%)" ).arg( current,totalSize,percentage ) ;
Expand Down
2 changes: 1 addition & 1 deletion src/tabmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ tabManager::tabManager( settings& s,
m_playlistdownloader( m_ctx ),
m_library( m_ctx )
{
t.setContext( &m_ctx ) ;
t.setContext( m_ctx ) ;

qRegisterMetaType< QClipboard::Mode >() ;

Expand Down
4 changes: 2 additions & 2 deletions src/translator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ translator::translator( settings& s,QApplication& app ) : m_qapp( app ),m_settin
this->setDefaultLanguage() ;
}

void translator::setContext( Context * ctx )
void translator::setContext( Context& ctx )
{
m_ctx = ctx ;
m_ctx = &ctx ;

this->setDefaultLanguage() ;
}
Expand Down
4 changes: 2 additions & 2 deletions src/translator.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class translator
{
public:
translator( settings&,QApplication& ) ;
void setContext( Context * ) ;
void setContext( Context& ) ;
void setLanguage( const QString& e ) ;
void setDefaultLanguage() ;
~translator() ;
Expand All @@ -61,7 +61,7 @@ class translator
void addString( const QString& translatedString,
const char * untranslatedString,
const QString& internalName ) ;
void clear( void ) ;
void clear() ;
QApplication& m_qapp ;
QTranslator * m_translator = nullptr ;
Context * m_ctx = nullptr ;
Expand Down
17 changes: 12 additions & 5 deletions src/utility.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1050,17 +1050,24 @@ static QJsonArray _saveDownloadList( tableWidget& tableWidget,bool noFinishedSuc

if( title == url ){

obj.insert( "title","" ) ;
obj.remove( "title" ) ;
}
}

obj.insert( "runningState",e.runningState ) ;
if( !e.downloadingOptions.isEmpty() ){

obj.insert( "downloadOptions",e.downloadingOptions ) ;
obj.insert( "downloadOptions",e.downloadingOptions ) ;
}

if( !e.engineName.isEmpty() ){

obj.insert( "engineName",e.engineName ) ;
obj.insert( "engineName",e.engineName ) ;
}

obj.insert( "downloadExtraOptions",e.extraDownloadingOptions ) ;
if( !e.extraDownloadingOptions.isEmpty() ){

obj.insert( "downloadExtraOptions",e.extraDownloadingOptions ) ;
}

arr.append( obj ) ;
} ;
Expand Down

0 comments on commit a704140

Please sign in to comment.