Skip to content

Commit

Permalink
save options only when "save" button is clicked in the config folder+…
Browse files Browse the repository at this point in the history
…a proper fix for removing duplicate download options in the playlist downloader tab
  • Loading branch information
mhogomchungu committed Sep 1, 2024
1 parent 9b55f5d commit 3212cba
Show file tree
Hide file tree
Showing 18 changed files with 196 additions and 72 deletions.
6 changes: 3 additions & 3 deletions src/configure.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ configure::configure( const Context& ctx ) :

connect( m_ui.pbConfigureQuit,&QPushButton::clicked,[ this ](){

this->saveOptions() ;
//this->saveOptions() ;
m_ctx.mainWindow().quitApp() ;
} ) ;

Expand Down Expand Up @@ -583,7 +583,7 @@ configure::configure( const Context& ctx ) :
connect( m_ui.pbConfigureDownloadPath,&QPushButton::clicked,[ this ](){

auto a = tr( "Set Download Folder" ) ;
auto b = QDir::homePath() ;
auto b = m_settings.downloadFolder() ;
auto c = QFileDialog::ShowDirsOnly ;

auto e = QFileDialog::getExistingDirectory( &m_mainWindow,a,b,c ) ;
Expand Down Expand Up @@ -817,7 +817,7 @@ void configure::populateOptionsTable( const engines::engine& s,int selectRow )

void configure::tabExited()
{
this->saveOptions() ;
//this->saveOptions() ;
}

void configure::updateEnginesList( const QStringList& e )
Expand Down
11 changes: 10 additions & 1 deletion src/mainwindow.ui
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
</rect>
</property>
<property name="currentIndex">
<number>3</number>
<number>1</number>
</property>
<widget class="QWidget" name="tabBasickDownloader">
<attribute name="title">
Expand Down Expand Up @@ -1577,6 +1577,9 @@
<height>31</height>
</rect>
</property>
<property name="toolTip">
<string>A Button To Open A Folder To Be Used As A Download Folder</string>
</property>
<property name="text">
<string/>
</property>
Expand Down Expand Up @@ -1748,6 +1751,9 @@
<height>31</height>
</rect>
</property>
<property name="toolTip">
<string>A Button To Open A Folder Where Theme Config Files Are Stored</string>
</property>
<property name="text">
<string/>
</property>
Expand Down Expand Up @@ -1787,6 +1793,9 @@
<height>33</height>
</rect>
</property>
<property name="toolTip">
<string>A Button To Open A Folder Where Extension's Binaries Are Stored</string>
</property>
<property name="text">
<string/>
</property>
Expand Down
71 changes: 3 additions & 68 deletions src/playlistdownloader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -785,7 +785,7 @@ void playlistdownloader::download( const engines::engine& engine )
{
downloadManager::index indexes( m_table,downloadManager::index::tab::playlist ) ;

auto _add = [ & ]( int s,const QString& opts ){
for( int s = 0 ; s < m_table.rowCount() ; s++ ){

auto validUrl = !m_table.url( s ).isEmpty() ;

Expand All @@ -801,79 +801,16 @@ void playlistdownloader::download( const engines::engine& engine )

auto u = m_table.downloadingOptions( s ) ;

auto function = utility::setDownloadOptions ;
auto m = utility::setDownloadOptions( engine,m_table,s,u ) ;

if( u.isEmpty() ){

auto oo = function( engine,m_table,s,opts ) ;

indexes.add( s,oo.move() ) ;
}else{
auto uu = function( engine,m_table,s,u ) ;

indexes.add( s,uu.move() ) ;
}
indexes.add( s,m.move() ) ;
}
}
} ;

auto opts = m_ui.lineEditPLUrlOptions->text() ;

int count = m_table.rowCount() ;

for( int i = 0 ; i < count ; i++ ){

_add( i,opts ) ;
}

this->download( engine,indexes.move() ) ;
}

static void _remove_duplicates( QStringList& opts )
{
class remove
{
public:
remove( QStringList& m ) : m_opts( m )
{
}
void run( int pos )
{
auto m = this->found( pos ) ;

if( m != -1 ){

auto mm = this->found( m + 2 ) ;

if( mm != -1 ){

m_opts.removeAt( m ) ;
m_opts.removeAt( m ) ;

this->run( m ) ;
}
}
}
private:
int found( int pos )
{
for( ; pos < m_opts.size() ; pos++ ){

if( m_opts[ pos ] == "-f" && 1 + pos < m_opts.size() ){

return pos ;
}
}

return -1 ;
}

QStringList& m_opts ;
} ;

remove( opts ).run( 0 ) ;
}

void playlistdownloader::download( const engines::engine& eng,int index )
{
class events
Expand Down Expand Up @@ -978,8 +915,6 @@ void playlistdownloader::download( const engines::engine& eng,int index )
opts.append( m_subscription.archivePath() ) ;
}

_remove_duplicates( opts ) ;

return opts ;
} ;

Expand Down
12 changes: 12 additions & 0 deletions translations/ar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,18 @@ Exampe 2: ${gateway}:8080</source>
<source>Rename File To Below Text</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>A Button To Open A Folder To Be Used As A Download Folder</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>A Button To Open A Folder Where Theme Config Files Are Stored</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>A Button To Open A Folder Where Extension&apos;s Binaries Are Stored</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>QObject</name>
Expand Down
12 changes: 12 additions & 0 deletions translations/de_DE.ts
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,18 @@ Exampe 2: ${gateway}:8080</source>
<source>Rename File To Below Text</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>A Button To Open A Folder To Be Used As A Download Folder</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>A Button To Open A Folder Where Theme Config Files Are Stored</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>A Button To Open A Folder Where Extension&apos;s Binaries Are Stored</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>QObject</name>
Expand Down
12 changes: 12 additions & 0 deletions translations/en_US.ts
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,18 @@ Exampe 2: ${gateway}:8080</source>
<source>Rename File To Below Text</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>A Button To Open A Folder To Be Used As A Download Folder</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>A Button To Open A Folder Where Theme Config Files Are Stored</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>A Button To Open A Folder Where Extension&apos;s Binaries Are Stored</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>QObject</name>
Expand Down
12 changes: 12 additions & 0 deletions translations/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,18 @@ Ejemplo 2: ${gateway}:8080</translation>
<source>Rename File To Below Text</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>A Button To Open A Folder To Be Used As A Download Folder</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>A Button To Open A Folder Where Theme Config Files Are Stored</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>A Button To Open A Folder Where Extension&apos;s Binaries Are Stored</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>QObject</name>
Expand Down
12 changes: 12 additions & 0 deletions translations/fr_FR.ts
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,18 @@ Exampe 2: ${gateway}:8080</source>
<source>Rename File To Below Text</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>A Button To Open A Folder To Be Used As A Download Folder</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>A Button To Open A Folder Where Theme Config Files Are Stored</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>A Button To Open A Folder Where Extension&apos;s Binaries Are Stored</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>QObject</name>
Expand Down
12 changes: 12 additions & 0 deletions translations/it_IT.ts
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,18 @@ Esempio 2: ${gateway}:8080</translation>
<source>Rename File To Below Text</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>A Button To Open A Folder To Be Used As A Download Folder</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>A Button To Open A Folder Where Theme Config Files Are Stored</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>A Button To Open A Folder Where Extension&apos;s Binaries Are Stored</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>QObject</name>
Expand Down
12 changes: 12 additions & 0 deletions translations/ja_JP.ts
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,18 @@ Exampe 2: ${gateway}:8080</source>
<source>Rename File To Below Text</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>A Button To Open A Folder To Be Used As A Download Folder</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>A Button To Open A Folder Where Theme Config Files Are Stored</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>A Button To Open A Folder Where Extension&apos;s Binaries Are Stored</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>QObject</name>
Expand Down
12 changes: 12 additions & 0 deletions translations/ko_KR.ts
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,18 @@ Exampe 2: ${gateway}:8080</source>
<source>Rename File To Below Text</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>A Button To Open A Folder To Be Used As A Download Folder</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>A Button To Open A Folder Where Theme Config Files Are Stored</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>A Button To Open A Folder Where Extension&apos;s Binaries Are Stored</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>QObject</name>
Expand Down
12 changes: 12 additions & 0 deletions translations/nl_NL.ts
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,18 @@ Exampe 2: ${gateway}:8080</source>
<source>Rename File To Below Text</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>A Button To Open A Folder To Be Used As A Download Folder</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>A Button To Open A Folder Where Theme Config Files Are Stored</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>A Button To Open A Folder Where Extension&apos;s Binaries Are Stored</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>QObject</name>
Expand Down
12 changes: 12 additions & 0 deletions translations/pl_PL.ts
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,18 @@ Exampe 2: ${gateway}:8080</source>
<source>Rename File To Below Text</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>A Button To Open A Folder To Be Used As A Download Folder</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>A Button To Open A Folder Where Theme Config Files Are Stored</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>A Button To Open A Folder Where Extension&apos;s Binaries Are Stored</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>QObject</name>
Expand Down
12 changes: 12 additions & 0 deletions translations/pt_BR.ts
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,18 @@ Exampe 2: ${gateway}:8080</source>
<source>Rename File To Below Text</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>A Button To Open A Folder To Be Used As A Download Folder</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>A Button To Open A Folder Where Theme Config Files Are Stored</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>A Button To Open A Folder Where Extension&apos;s Binaries Are Stored</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>QObject</name>
Expand Down
12 changes: 12 additions & 0 deletions translations/ru_RU.ts
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,18 @@ Exampe 2: ${gateway}:8080</source>
<source>Rename File To Below Text</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>A Button To Open A Folder To Be Used As A Download Folder</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>A Button To Open A Folder Where Theme Config Files Are Stored</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>A Button To Open A Folder Where Extension&apos;s Binaries Are Stored</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>QObject</name>
Expand Down
Loading

0 comments on commit 3212cba

Please sign in to comment.