Skip to content

Commit

Permalink
add a button to play downloaded media in basic tab+update translatabl…
Browse files Browse the repository at this point in the history
…e strings
  • Loading branch information
mhogomchungu committed Aug 27, 2024
1 parent 864e351 commit 10127b4
Show file tree
Hide file tree
Showing 21 changed files with 244 additions and 20 deletions.
47 changes: 28 additions & 19 deletions src/basicdownloader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,14 @@ basicdownloader::basicdownloader( const Context& ctx ) :
m_ui( m_ctx.Ui() ),
m_tabManager( m_ctx.TabManager() ),
m_tableList( *m_ui.bdTableWidgetList,m_ctx.mainWidget().font() ),
m_bogusTable( m_bogusTableOriginal,m_ctx.mainWidget().font(),0,m_settings.textAlignment() )
m_hiddenTable( m_bogusTableOriginal,m_ctx.mainWidget().font(),0,m_settings.textAlignment() )
{
m_ui.pbPasteClipboard->setIcon( m_settings.getIcon( "clipboard" ) ) ;
m_ui.pbOptionsHistory->setIcon( m_settings.getIcon( "recentlyUsed" ) ) ;
m_ui.pbOptionsDownloadOptions->setIcon( m_settings.getIcon( "downloadOptions" ) ) ;
m_ui.pbOptionsDownloadOptions->setIcon( m_settings.getIcon( "downloadOptions" ) ) ;
m_ui.pbBasicDownloaderPlay->setIcon( m_settings.getIcon( "video" ) ) ;

m_hiddenTable.setColumnNumbersTo( 3 ) ;

this->setAsActive() ;

Expand All @@ -59,6 +62,22 @@ basicdownloader::basicdownloader( const Context& ctx ) :
m_ui.lineEditURL->setText( utility::clipboardText() ) ;
} ) ;

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

if( m_hiddenTable.rowCount() ){

int row = 0 ;

const auto& e = this->defaultEngine().engine ;

const auto& engines = m_ctx.Engines() ;

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

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

m_tableList.connect( &QTableWidget::itemSelectionChanged,[ this ](){

auto& a = *m_ui.lineEditOptions ;
Expand Down Expand Up @@ -139,17 +158,7 @@ basicdownloader::basicdownloader( const Context& ctx ) :
m_ui.lineEditOptions->clear() ;
this->changeDefaultEngine( s ) ;
}
} ) ;

auto& table = m_bogusTable.get() ;

table.insertRow( 0 ) ;

for( int s = 0 ; s < 3 ; s++ ){

table.insertColumn( s ) ;
table.setItem( 0,s,new QTableWidgetItem ) ;
}
} ) ;
}

void basicdownloader::init_done()
Expand Down Expand Up @@ -354,7 +363,7 @@ void basicdownloader::download( const QString& url )

const auto& engine = this->defaultEngine() ;

m_bogusTable.clear() ;
m_hiddenTable.clear() ;

auto uiText = m.last() ;
auto state = downloadManager::finishedStatus::notStarted() ;
Expand All @@ -365,15 +374,15 @@ void basicdownloader::download( const QString& url )
entry.url = uiText ;
entry.runningState = state ;

m_bogusTable.addItem( entry.move() ) ;
m_hiddenTable.addItem( entry.move() ) ;

auto e = m_extraOptions.downloadOptions ;

m_bogusTable.setDownloadingOptions( tableWidget::type::DownloadOptions,0,e ) ;
m_hiddenTable.setDownloadingOptions( tableWidget::type::DownloadOptions,0,e ) ;

m_ctx.TabManager().Configure().setDownloadOptions( 0,m_bogusTable ) ;
m_ctx.TabManager().Configure().setDownloadOptions( 0,m_hiddenTable ) ;

auto s = utility::setDownloadOptions( engine.engine,m_bogusTable,0 ).downloadOptions ;
auto s = utility::setDownloadOptions( engine.engine,m_hiddenTable,0 ).downloadOptions ;

auto mm = m_ui.lineEditOptions->text() ;

Expand Down Expand Up @@ -464,7 +473,7 @@ void basicdownloader::run( const basicdownloader::engine& eng,

auto& s = m_parent.m_ctx.Settings() ;

auto& t = m_parent.m_bogusTable ;
auto& t = m_parent.m_hiddenTable ;

utility::updateFinishedState( m_engine,s,t,a.move(),fileNames ) ;

Expand Down
2 changes: 1 addition & 1 deletion src/basicdownloader.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ class basicdownloader : public QObject
tableMiniWidget< engines::engine::baseEngine::mediaInfo,5 > m_tableList ;
QStringList m_optionsList ;
QTableWidget m_bogusTableOriginal ;
tableWidget m_bogusTable ;
tableWidget m_hiddenTable ;
utility::downLoadOptions m_extraOptions ;
utility::Terminator m_terminator ;

Expand Down
16 changes: 16 additions & 0 deletions src/mainwindow.ui
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,22 @@
<string/>
</property>
</widget>
<widget class="QPushButton" name="pbBasicDownloaderPlay">
<property name="geometry">
<rect>
<x>700</x>
<y>330</y>
<width>31</width>
<height>33</height>
</rect>
</property>
<property name="toolTip">
<string>Play Downloaded Media</string>
</property>
<property name="text">
<string/>
</property>
</widget>
</widget>
<widget class="QWidget" name="tabBatchDownloader">
<attribute name="title">
Expand Down
13 changes: 13 additions & 0 deletions src/tableWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -542,3 +542,16 @@ QTableWidget& tableWidget::get()
{
return m_table ;
}

void tableWidget::setColumnNumbersTo( int m )
{
while( m_table.columnCount() ){

m_table.removeColumn( 0 ) ;
}

for( int s = 0 ; s < m ; s++ ){

m_table.insertColumn( 0 ) ;
}
}
2 changes: 2 additions & 0 deletions src/tableWidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,8 @@ class tableWidget

QTableWidget& get() ;

void setColumnNumbersTo( int ) ;

template< typename MemberFunction,typename Callback >
void connect( MemberFunction m,Callback c )
{
Expand Down
4 changes: 4 additions & 0 deletions src/utility.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2353,6 +2353,10 @@ QString utility::rename( QTableWidgetItem& item,
return newName ;
}
}

item.setText( newName ) ;

return newName ;
}
}

Expand Down
12 changes: 12 additions & 0 deletions translations/ar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,14 @@ Exampe 2: ${gateway}:8080</source>
<source>About</source>
<translation>معلومات</translation>
</message>
<message>
<source>Play Downloaded Media</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Set New File Name Below</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>QObject</name>
Expand Down Expand Up @@ -1013,6 +1021,10 @@ Exampe 2: ${gateway}:8080</source>
<source>Sort By Likes</source>
<translation>الترتيب حسب عدد مرات الإعجاب</translation>
</message>
<message>
<source>Rename</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>configure</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 @@ -349,6 +349,14 @@ Exampe 2: ${gateway}:8080</source>
<source>About</source>
<translation>Über</translation>
</message>
<message>
<source>Play Downloaded Media</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Set New File Name Below</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>QObject</name>
Expand Down Expand Up @@ -1011,6 +1019,10 @@ Exampe 2: ${gateway}:8080</source>
<source>Sort By Likes</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Rename</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>configure</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 @@ -349,6 +349,14 @@ Exampe 2: ${gateway}:8080</source>
<source>About</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Play Downloaded Media</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Set New File Name Below</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>QObject</name>
Expand Down Expand Up @@ -1011,6 +1019,10 @@ Exampe 2: ${gateway}:8080</source>
<source>Sort By Likes</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Rename</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>configure</name>
Expand Down
12 changes: 12 additions & 0 deletions translations/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,14 @@ Ejemplo 2: ${gateway}:8080</translation>
<source>About</source>
<translation>Acerca</translation>
</message>
<message>
<source>Play Downloaded Media</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Set New File Name Below</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>QObject</name>
Expand Down Expand Up @@ -1013,6 +1021,10 @@ Ejemplo 2: ${gateway}:8080</translation>
<source>Sort By Likes</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Rename</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>configure</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 @@ -349,6 +349,14 @@ Exampe 2: ${gateway}:8080</source>
<source>About</source>
<translation>À propos</translation>
</message>
<message>
<source>Play Downloaded Media</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Set New File Name Below</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>QObject</name>
Expand Down Expand Up @@ -1011,6 +1019,10 @@ Exampe 2: ${gateway}:8080</source>
<source>Sort By Likes</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Rename</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>configure</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 @@ -351,6 +351,14 @@ Esempio 2: ${gateway}:8080</translation>
<source>Enable Library Tab</source>
<translation>Abilita scheda Libreria</translation>
</message>
<message>
<source>Play Downloaded Media</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Set New File Name Below</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>QObject</name>
Expand Down Expand Up @@ -1015,6 +1023,10 @@ Per maggiori dettagli vedi la GNU General Public License .</translation>
<source>Sort By Likes</source>
<translation>Ordina per n. Mi piace</translation>
</message>
<message>
<source>Rename</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>configure</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 @@ -349,6 +349,14 @@ Exampe 2: ${gateway}:8080</source>
<source>About</source>
<translation>バージョン情報</translation>
</message>
<message>
<source>Play Downloaded Media</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Set New File Name Below</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>QObject</name>
Expand Down Expand Up @@ -1011,6 +1019,10 @@ Exampe 2: ${gateway}:8080</source>
<source>Sort By Likes</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Rename</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>configure</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 @@ -351,6 +351,14 @@ Exampe 2: ${gateway}:8080</source>
<source>No Proxy</source>
<translation>프록시 없음</translation>
</message>
<message>
<source>Play Downloaded Media</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Set New File Name Below</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>QObject</name>
Expand Down Expand Up @@ -1013,6 +1021,10 @@ Exampe 2: ${gateway}:8080</source>
<source>Downloading subtitles</source>
<translation>자막 다운로드 중</translation>
</message>
<message>
<source>Rename</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>configure</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 @@ -349,6 +349,14 @@ Exampe 2: ${gateway}:8080</source>
<source>Enable Library Tab</source>
<translation>Tabblad Bibliotheek inschakelen</translation>
</message>
<message>
<source>Play Downloaded Media</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Set New File Name Below</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>QObject</name>
Expand Down Expand Up @@ -1011,6 +1019,10 @@ Exampe 2: ${gateway}:8080</source>
<source>Sort By Likes</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Rename</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>configure</name>
Expand Down
Loading

0 comments on commit 10127b4

Please sign in to comment.