From a6999553ecf649d365c81f763bafa7d4d52cecc8 Mon Sep 17 00:00:00 2001 From: zvon Date: Tue, 25 Feb 2020 10:08:34 +0100 Subject: [PATCH] Mainwindow,functions: move renameFiles to functions, fix dbGetShows declaration --- functions.cpp | 13 +++++++++++++ functions.hpp | 4 +++- mainwindow.cpp | 14 -------------- 3 files changed, 16 insertions(+), 15 deletions(-) diff --git a/functions.cpp b/functions.cpp index 0866378..5382fcf 100644 --- a/functions.cpp +++ b/functions.cpp @@ -915,3 +915,16 @@ string getDBPattern() { pattern ); return pattern; } + +/* change names of original files to generated new names + * orig - original filenames + * renamed - renamed filenames (sorted in the same order as `orig`) + */ +void renameFiles( const std::vector< std::tuple< int, string, string, string > > + &renamed_files ) { + for ( const auto &renamed : renamed_files ) { + FSLib::rename( + std::get< 1 >( renamed ) + TEXT( "/" ) + std::get< 2 >( renamed ), + std::get< 1 >( renamed ) + TEXT( "/" ) + std::get< 3 >( renamed ) ); + } +} diff --git a/functions.hpp b/functions.hpp index a7c7a90..c2f7ac3 100644 --- a/functions.hpp +++ b/functions.hpp @@ -65,11 +65,13 @@ void updateDB( bool linux, void *progress_ptr ); void cleanDB(); #ifdef GUI -std::vector< std::unordered_map< std::string, std::string > > dbGetShows(); +std::vector< std::unordered_map< string, string > > dbGetShows(); void changeDB( size_t index, const string &path, const string &language, const string &id, bool dvd ); void refreshSelectDB( std::unordered_set< size_t > indexes, bool linux, void *progress_ptr ); +void renameFiles( const std::vector< std::tuple< int, string, string, string > > + &renamed_files ); #endif void iterateFS( std::map< int, std::map< int, string > > &seasons, diff --git a/mainwindow.cpp b/mainwindow.cpp index 0db0790..f75168b 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -108,20 +108,6 @@ void MainWindow::getNames() { sw->show(); } -/* change names of original files to generated new names - * orig - original filenames - * renamed - renamed filenames (sorted in the same order as `orig`) - */ -void renameFiles( const std::vector< - std::tuple< int, std::string, std::string, std::string > > - &renamed_files ) { - for ( const auto &renamed : renamed_files ) { - FSLib::rename( - std::get< 1 >( renamed ) + "/" + std::get< 2 >( renamed ), - std::get< 1 >( renamed ) + "/" + std::get< 3 >( renamed ) ); - } -} - void MainWindow::finishedSelection() { // remove created SeasonWindow and delete it from memory app->remove_window( *sw );