Skip to content

Commit

Permalink
add context menu entry to hide media list in the basic downloader tab
Browse files Browse the repository at this point in the history
  • Loading branch information
mhogomchungu committed Aug 29, 2024
1 parent e20f4e3 commit a6972ce
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 14 deletions.
15 changes: 13 additions & 2 deletions src/basicdownloader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ basicdownloader::basicdownloader( const Context& ctx ) :

const auto& engine = utility::resolveEngine( m_hiddenTable,e,engines,row ) ;

m_ctx.Engines().openUrls( m_hiddenTable,row,engine ) ;
engines.openUrls( m_hiddenTable,row,engine ) ;
}
} ) ;

Expand All @@ -94,7 +94,18 @@ basicdownloader::basicdownloader( const Context& ctx ) :

const auto& obj = m_tableList.stuffAt( row ).toqJsonObject() ;

utility::contextMenuForDirectUrl( obj,m_ctx ) ;
QMenu m ;

utility::contextMenuForDirectUrl( m,obj,m_ctx ) ;

m.addSeparator() ;

connect( m.addAction( tr( "Hide List" ) ),&QAction::triggered,[ this ](){

m_tableList.setVisible( false ) ;
} ) ;

m.exec( QCursor::pos() ) ;
}
} ) ;

Expand Down
6 changes: 5 additions & 1 deletion src/batchdownloader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,11 @@ batchdownloader::batchdownloader( const Context& ctx ) :

const auto& obj = m_tableWidgetBDList.stuffAt( row ) ;

utility::contextMenuForDirectUrl( obj,m_ctx ) ;
QMenu m ;

utility::contextMenuForDirectUrl( m,obj,m_ctx ) ;

m.exec( QCursor::pos() ) ;
}

}else if( m_listType == batchdownloader::listType::SUBTITLES ){
Expand Down
8 changes: 3 additions & 5 deletions src/configure.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,9 @@ configure::configure( const Context& ctx ) :

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

auto m = QFileDialog::getOpenFileName( &m_ctx.mainWidget(),tr( "Select A Cookie File" ),utility::homePath() ) ;
auto mm = tr( "Select A Cookie File" ) ;

auto m = QFileDialog::getOpenFileName( &m_ctx.mainWidget(),mm,utility::homePath() ) ;

if( !m.isEmpty() ){

Expand Down Expand Up @@ -753,10 +755,6 @@ void configure::setUpdateMenu()
}
}

m_menu.addSeparator() ;

m_menu.addAction( tr( "Cancel" ) ) ;

m_ui.pbConfigureDownload->setMenu( &m_menu ) ;
}

Expand Down
6 changes: 1 addition & 5 deletions src/utility.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2176,12 +2176,10 @@ bool utility::addData( const QByteArray& e )
}
}

void utility::contextMenuForDirectUrl( const QJsonObject& obj,const Context& ctx )
void utility::contextMenuForDirectUrl( QMenu& m,const QJsonObject& obj,const Context& ctx )
{
auto arr = obj.value( "urls" ).toArray() ;

QMenu m ;

auto mediaPlayer = ctx.Settings().openWith( ctx.logger() ) ;

if( arr.size() == 0 ){
Expand Down Expand Up @@ -2269,8 +2267,6 @@ void utility::contextMenuForDirectUrl( const QJsonObject& obj,const Context& ctx
}
}
}

m.exec( QCursor::pos() ) ;
}

void utility::deleteTmpFiles( const QString& df,std::vector< QByteArray > files )
Expand Down
2 changes: 1 addition & 1 deletion src/utility.h
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,7 @@ namespace utility
bool platformisFlatPak() ;
bool addData( const QByteArray& ) ;
QString rename( QTableWidgetItem&,const QString&,const QString&,const QString& ) ;
void contextMenuForDirectUrl( const QJsonObject&,const Context& ) ;
void contextMenuForDirectUrl( QMenu&,const QJsonObject&,const Context& ) ;
void deleteTmpFiles( const QString&,std::vector< QByteArray > ) ;
QString OSXApplicationDirPath() ;
QString OSXtranslationFilesPath() ;
Expand Down

0 comments on commit a6972ce

Please sign in to comment.