diff --git a/functions.cpp b/functions.cpp index 4ec0629..297580e 100644 --- a/functions.cpp +++ b/functions.cpp @@ -12,9 +12,9 @@ #ifdef _WIN32 +#include "resources_windows.h" #include #include -#include "resources_windows.h" #define cout std::wcout #define cerr std::wcerr @@ -24,11 +24,11 @@ constexpr const char_t *dir_divider = L"\\"; #else // UNIX +#include "resources_linux.h" #include #include #include #include -#include "resources_linux.h" #define cout std::cout #define cerr std::cerr @@ -611,7 +611,8 @@ void refreshDB( bool linux, void *progress_ptr ) { #ifndef GUI cleanUpLine(); #endif - p.print( _( REFRESHING ) + string( 1, ' ' ) + show[TEXT( "SHOW" )] ); + p.print( _( REFRESHING ) + string( 1, ' ' ) + + show[TEXT( "SHOW" )] ); p.print( 0 ); std::map< int, std::map< int, string > > seasons; diff --git a/gtk/databasewindow.cpp b/gtk/databasewindow.cpp index 4ecaffd..3c90490 100644 --- a/gtk/databasewindow.cpp +++ b/gtk/databasewindow.cpp @@ -7,13 +7,13 @@ #include #include -#include "databasewindow.hpp" -#include "gtkfunctions.hpp" -#include "progresswindow.hpp" #include "../filesystem.hpp" #include "../functions.hpp" #include "../resources_linux.h" #include "../tv_rename.hpp" +#include "databasewindow.hpp" +#include "gtkfunctions.hpp" +#include "progresswindow.hpp" DatabaseWindow::~DatabaseWindow() { auto children = get_children(); diff --git a/gtk/gui.cpp b/gtk/gui.cpp index aceb7d8..4a7fb07 100644 --- a/gtk/gui.cpp +++ b/gtk/gui.cpp @@ -4,11 +4,11 @@ #include #include -#include "mainwindow.hpp" #include "../filesystem.hpp" #include "../functions.hpp" #include "../resources_linux.h" #include "../tv_rename.hpp" +#include "mainwindow.hpp" #define API_KEY "42B66F5E-C6BF-423F-ADF9-CC97163472F6" #define DOMAIN "tv_rename" diff --git a/gtk/mainwindow.cpp b/gtk/mainwindow.cpp index 88c3ba0..58ee022 100644 --- a/gtk/mainwindow.cpp +++ b/gtk/mainwindow.cpp @@ -8,14 +8,14 @@ #include #include -#include "databasewindow.hpp" -#include "gtkfunctions.hpp" -#include "mainwindow.hpp" -#include "progresswindow.hpp" #include "../filesystem.hpp" #include "../functions.hpp" #include "../resources_linux.h" #include "../tv_rename.hpp" +#include "databasewindow.hpp" +#include "gtkfunctions.hpp" +#include "mainwindow.hpp" +#include "progresswindow.hpp" void MainWindow::chooseFile() { // create a dialog for choosing directory @@ -245,7 +245,7 @@ MainWindow::MainWindow( const Glib::RefPtr< Gtk::Application > &ptr ) box->pack_start( *button_quit, false, true ); auto *item = new Gtk::MenuItem(); - item->set_use_underline(true); + item->set_use_underline( true ); auto *submenu = new Gtk::Menu(); menu->append( *item ); @@ -256,7 +256,7 @@ MainWindow::MainWindow( const Glib::RefPtr< Gtk::Application > &ptr ) // Exit item for File menu item = new Gtk::MenuItem(); - item->set_use_underline(true); + item->set_use_underline( true ); item->set_label( _( EXIT ) ); item->signal_activate().connect( @@ -266,7 +266,7 @@ MainWindow::MainWindow( const Glib::RefPtr< Gtk::Application > &ptr ) // Database menu item = new Gtk::MenuItem(); - item->set_use_underline(true); + item->set_use_underline( true ); submenu = new Gtk::Menu(); item->set_label( _( DATABASE ) ); @@ -275,7 +275,7 @@ MainWindow::MainWindow( const Glib::RefPtr< Gtk::Application > &ptr ) // Update database item = new Gtk::MenuItem(); - item->set_use_underline(true); + item->set_use_underline( true ); item->set_label( _( UPDATE_DB ) ); item->signal_activate().connect( sigc::mem_fun( *this, &MainWindow::dbUpdate ) ); @@ -284,7 +284,7 @@ MainWindow::MainWindow( const Glib::RefPtr< Gtk::Application > &ptr ) // Refresh database item = new Gtk::MenuItem(); - item->set_use_underline(true); + item->set_use_underline( true ); item->set_label( _( REFRESH_DB ) ); item->signal_activate().connect( sigc::mem_fun( *this, &MainWindow::dbRefresh ) ); @@ -293,7 +293,7 @@ MainWindow::MainWindow( const Glib::RefPtr< Gtk::Application > &ptr ) // Clean database item = new Gtk::MenuItem(); - item->set_use_underline(true); + item->set_use_underline( true ); item->set_label( _( CLEAN_DB ) ); item->signal_activate().connect( sigc::mem_fun( *this, &MainWindow::dbClean ) ); @@ -302,7 +302,7 @@ MainWindow::MainWindow( const Glib::RefPtr< Gtk::Application > &ptr ) // Manage database item = new Gtk::MenuItem(); - item->set_use_underline(true); + item->set_use_underline( true ); item->set_label( _( MANAGE_DB ) ); item->signal_activate().connect( sigc::mem_fun( *this, &MainWindow::dbManage ) ); @@ -310,7 +310,7 @@ MainWindow::MainWindow( const Glib::RefPtr< Gtk::Application > &ptr ) submenu->append( *item ); item = new Gtk::MenuItem(); - item->set_use_underline(true); + item->set_use_underline( true ); item->set_label( _( CHANGE_DB_PATTERN ) ); item->signal_activate().connect( sigc::mem_fun( *this, &MainWindow::dbPattern ) ); diff --git a/gtk/mainwindow.hpp b/gtk/mainwindow.hpp index 9b47b8b..8660b12 100644 --- a/gtk/mainwindow.hpp +++ b/gtk/mainwindow.hpp @@ -14,8 +14,8 @@ #include #include -#include "seasonwindow.hpp" #include "../network.hpp" +#include "seasonwindow.hpp" class MainWindow : public Gtk::Window { public: diff --git a/gtk/progresswindow.cpp b/gtk/progresswindow.cpp index b4804d9..c568723 100644 --- a/gtk/progresswindow.cpp +++ b/gtk/progresswindow.cpp @@ -1,7 +1,7 @@ +#include "progresswindow.hpp" #include #include -#include "progresswindow.hpp" #include "../functions.hpp" #include "../resources_linux.h" diff --git a/gtk/progresswindow.hpp b/gtk/progresswindow.hpp index 0283275..f86c883 100644 --- a/gtk/progresswindow.hpp +++ b/gtk/progresswindow.hpp @@ -12,15 +12,16 @@ public: virtual ~ProgressWindow() = default; void setPerc( int perc ) { - pb->set_fraction( perc/100.0 ); + pb->set_fraction( perc / 100.0 ); } void setLabel( const std::string &text ) { label->set_text( text ); } + private: std::unique_ptr< Gtk::Layout > layout{ new Gtk::Layout() }; - std::unique_ptr< Gtk::Label > label { new Gtk::Label() }; - std::unique_ptr< Gtk::ProgressBar > pb { new Gtk::ProgressBar() }; + std::unique_ptr< Gtk::Label > label{ new Gtk::Label() }; + std::unique_ptr< Gtk::ProgressBar > pb{ new Gtk::ProgressBar() }; }; #endif // GTKMM_MAIN_WINDOW diff --git a/gtk/searchwindow.cpp b/gtk/searchwindow.cpp index d8b0db5..0b2c5bf 100644 --- a/gtk/searchwindow.cpp +++ b/gtk/searchwindow.cpp @@ -4,11 +4,11 @@ #include #include -#include "gtkfunctions.hpp" -#include "searchwindow.hpp" #include "../functions.hpp" #include "../resources_linux.h" #include "../tv_rename.hpp" +#include "gtkfunctions.hpp" +#include "searchwindow.hpp" void SearchWindow::search() { language_code = diff --git a/main.cpp b/main.cpp index 88be40c..f61135e 100644 --- a/main.cpp +++ b/main.cpp @@ -4,10 +4,10 @@ #ifdef _WIN32 -#include #include "resources_windows.h" #include #include +#include using char_t = wchar_t; using string = std::wstring; @@ -19,8 +19,8 @@ using string = std::wstring; #else #include "resources_linux.h" -#include #include +#include #include using char_t = char; @@ -38,11 +38,11 @@ using string = std::string; #include "tv_rename.hpp" // DB flags -#define DB_ADD 0x0001 +#define DB_ADD 0x0001 #define DB_REFRESH 0x0002 -#define DB_UPDATE 0x0004 -#define DB_CLEAN 0x0008 -#define DB_REMOVE 0x0010 +#define DB_UPDATE 0x0004 +#define DB_CLEAN 0x0008 +#define DB_REMOVE 0x0010 #define DB_PATTERN 0x0020 #define API_KEY "42B66F5E-C6BF-423F-ADF9-CC97163472F6" diff --git a/progress.cpp b/progress.cpp index d461b19..7ba6992 100644 --- a/progress.cpp +++ b/progress.cpp @@ -8,8 +8,8 @@ #ifdef _WIN32 -#include #include +#include #include #define cout std::wcout diff --git a/sqlitepp.hpp b/sqlitepp.hpp index 153ea7c..fc24ba6 100644 --- a/sqlitepp.hpp +++ b/sqlitepp.hpp @@ -27,7 +27,7 @@ std::wstring _8_2_w( const std::string &utf8 ) { #endif -//TODO maybe split this into hpp/cpp +// TODO maybe split this into hpp/cpp namespace SQLite { @@ -179,7 +179,7 @@ public: } int64_t lastRowID() { - return sqlite3_last_insert_rowid(db); + return sqlite3_last_insert_rowid( db ); } private: diff --git a/tv_rename.cpp b/tv_rename.cpp index 816e471..ce9341b 100644 --- a/tv_rename.cpp +++ b/tv_rename.cpp @@ -17,8 +17,8 @@ #ifdef _WIN32 -#include #include "resources_windows.h" +#include #include #include diff --git a/tv_rename.hpp b/tv_rename.hpp index 60a39ef..62dadbc 100644 --- a/tv_rename.hpp +++ b/tv_rename.hpp @@ -12,7 +12,7 @@ #define TV_CHDIR 0x0100 #define TV_TRUST 0x0200 #define TV_LINUX 0x0400 -#define TV_DVD 0x0800 +#define TV_DVD 0x0800 #ifdef _WIN32 diff --git a/unix/filesystem.cpp b/unix/filesystem.cpp index ffaabfd..706c496 100644 --- a/unix/filesystem.cpp +++ b/unix/filesystem.cpp @@ -20,7 +20,7 @@ FSLib::Directory::Iterator::Iterator( const Directory &d_, : d( opendir( d_.path() ) ), current_entry( current_entry_ ) {} FSLib::Directory::Iterator::~Iterator() { - if( d ) + if ( d ) closedir( d ); } @@ -46,7 +46,7 @@ string FSLib::canonical( const string &path ) { bool FSLib::isDirectory( const string &path ) { struct stat path_stat; - if( stat( path.c_str(), &path_stat ) != 0 ) + if ( stat( path.c_str(), &path_stat ) != 0 ) return false; return S_ISDIR( path_stat.st_mode ); diff --git a/windows/databasewindow.cpp b/windows/databasewindow.cpp index cb11c50..fe587de 100644 --- a/windows/databasewindow.cpp +++ b/windows/databasewindow.cpp @@ -2,12 +2,12 @@ name='Microsoft.Windows.Common-Controls' version='6.0.0.0' \ processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"" ) #include "databasewindow.hpp" -#include "gui_functions.hpp" -#include "progresswindow.hpp" -#include "searchwindow.hpp" #include "../filesystem.hpp" #include "../functions.hpp" #include "../resources_windows.h" +#include "gui_functions.hpp" +#include "progresswindow.hpp" +#include "searchwindow.hpp" #include #include diff --git a/windows/databasewindow.hpp b/windows/databasewindow.hpp index b2c5f58..400a3ed 100644 --- a/windows/databasewindow.hpp +++ b/windows/databasewindow.hpp @@ -1,7 +1,7 @@ -#include #include #include #include +#include class DatabaseWindow { public: diff --git a/windows/filesystem.cpp b/windows/filesystem.cpp index c36fd2c..b30a33f 100644 --- a/windows/filesystem.cpp +++ b/windows/filesystem.cpp @@ -1,7 +1,7 @@ -#include #include "../filesystem.hpp" #include #include +#include FSLib::Directory::Directory( const string &path_ ) : dir_path( path_ ) { // need to append \\* for windows to search files in directory diff --git a/windows/gui_functions.cpp b/windows/gui_functions.cpp index 3ae8371..5fe2578 100644 --- a/windows/gui_functions.cpp +++ b/windows/gui_functions.cpp @@ -1,12 +1,12 @@ #include "gui_functions.hpp" +#include "../functions.hpp" +#include "../resources_windows.h" #include "databasewindow.hpp" #include "mainwindow.hpp" #include "patternwindow.hpp" #include "progresswindow.hpp" #include "searchwindow.hpp" #include "seasonwindow.hpp" -#include "../resources_windows.h" -#include "../functions.hpp" #include diff --git a/windows/gui_functions.hpp b/windows/gui_functions.hpp index f1942ce..c0ba53b 100644 --- a/windows/gui_functions.hpp +++ b/windows/gui_functions.hpp @@ -1,6 +1,6 @@ -#include #include #include +#include void registerWindowClasses( HINSTANCE hInstance ); void centerWindow( HWND hwnd ); diff --git a/windows/mainwindow.cpp b/windows/mainwindow.cpp index 338dc37..fe9015b 100644 --- a/windows/mainwindow.cpp +++ b/windows/mainwindow.cpp @@ -2,16 +2,16 @@ name='Microsoft.Windows.Common-Controls' version='6.0.0.0' \ processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"" ) #include "mainwindow.hpp" +#include "../filesystem.hpp" +#include "../functions.hpp" +#include "../resources_windows.h" +#include "../tv_rename.hpp" #include "databasewindow.hpp" #include "gui_functions.hpp" #include "patternwindow.hpp" #include "progresswindow.hpp" #include "searchwindow.hpp" #include "seasonwindow.hpp" -#include "../filesystem.hpp" -#include "../functions.hpp" -#include "../resources_windows.h" -#include "../tv_rename.hpp" #include #include @@ -101,8 +101,8 @@ MainWindow::MainWindow( HINSTANCE hInstance, int nCmdShow ) hFont ); trust_input = createCheckbox( _( DONT_RENAME_CONFIRM ), 90, 146, 180, 12, ID_RENAME_CHECKBOX, window, hFont ); - dvd_input = createCheckbox( _( USE_DVD ), 5, 170, 180, 12, - ID_DVD_CHECKBOX, window, hFont ); + dvd_input = createCheckbox( _( USE_DVD ), 5, 170, 180, 12, ID_DVD_CHECKBOX, + window, hFont ); possible_input = createCombo( 5, 205, 160, window_height - 220, ID_SHOW_COMBO, window, hFont ); rename_button = createButton( _( RENAME ), 5, 230, 80, 25, ID_RENAME_BUTTON, @@ -126,7 +126,8 @@ MainWindow::MainWindow( HINSTANCE hInstance, int nCmdShow ) _( CHANGE_DB_PATTERN ) ); AppendMenuW( hMenuBar, MF_POPUP, ( UINT_PTR )hMenuFile, _( ID_FILE ) ); - AppendMenuW( hMenuBar, MF_POPUP, ( UINT_PTR )hMenuDatabase, _( DATABASE_MENU ) ); + AppendMenuW( hMenuBar, MF_POPUP, ( UINT_PTR )hMenuDatabase, + _( DATABASE_MENU ) ); SetMenu( window, hMenuBar ); INITCOMMONCONTROLSEX icex; // Structure for control initialization. @@ -234,7 +235,8 @@ void MainWindow::process() { wchar_t show[256]; SendMessage( show_input, WM_GETTEXT, ( WPARAM )255, ( LPARAM )show ); if ( wcslen( show ) == 0 ) { - MessageBox( window, _( SHOW_FIELD_EMPTY ), _( ERROR ), MB_OK | MB_ICONERROR ); + MessageBox( window, _( SHOW_FIELD_EMPTY ), _( ERROR ), + MB_OK | MB_ICONERROR ); return; } diff --git a/windows/patternwindow.hpp b/windows/patternwindow.hpp index b487961..31f67cc 100644 --- a/windows/patternwindow.hpp +++ b/windows/patternwindow.hpp @@ -1,5 +1,5 @@ -#include #include +#include class PatternWindow { public: diff --git a/windows/progresswindow.hpp b/windows/progresswindow.hpp index 6684a4d..53bad5b 100644 --- a/windows/progresswindow.hpp +++ b/windows/progresswindow.hpp @@ -1,5 +1,5 @@ -#include #include +#include class ProgressWindow { public: diff --git a/windows/searchwindow.cpp b/windows/searchwindow.cpp index b17a693..9254daa 100644 --- a/windows/searchwindow.cpp +++ b/windows/searchwindow.cpp @@ -2,10 +2,10 @@ name='Microsoft.Windows.Common-Controls' version='6.0.0.0' \ processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"" ) #include "searchwindow.hpp" -#include "gui_functions.hpp" +#include "../functions.hpp" #include "../resources_windows.h" #include "../tv_rename.hpp" -#include "../functions.hpp" +#include "gui_functions.hpp" #define ID_SHOW_STATIC 0x0001 #define ID_LANG_STATIC 0x0002 @@ -111,7 +111,8 @@ void SearchWindow::process() { wchar_t show[256]; SendMessage( show_input, WM_GETTEXT, ( WPARAM )255, ( LPARAM )show ); if ( wcslen( show ) == 0 ) { - MessageBox( window, _( SHOW_FIELD_EMPTY ), _( ERROR ), MB_OK | MB_ICONERROR ); + MessageBox( window, _( SHOW_FIELD_EMPTY ), _( ERROR ), + MB_OK | MB_ICONERROR ); return; } diff --git a/windows/searchwindow.hpp b/windows/searchwindow.hpp index f37428c..576a088 100644 --- a/windows/searchwindow.hpp +++ b/windows/searchwindow.hpp @@ -1,6 +1,6 @@ -#include #include #include +#include class SearchWindow { public: diff --git a/windows/seasonwindow.cpp b/windows/seasonwindow.cpp index a0f3854..3c0a677 100644 --- a/windows/seasonwindow.cpp +++ b/windows/seasonwindow.cpp @@ -2,9 +2,9 @@ name='Microsoft.Windows.Common-Controls' version='6.0.0.0' \ processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"" ) #include "seasonwindow.hpp" +#include "../functions.hpp" #include "../resources_windows.h" #include "gui_functions.hpp" -#include "../functions.hpp" #define ID_CHECKBOX 0x0001 #define ID_SEASONS_STATIC 0x0001 diff --git a/windows/seasonwindow.hpp b/windows/seasonwindow.hpp index dc0250b..61306d6 100644 --- a/windows/seasonwindow.hpp +++ b/windows/seasonwindow.hpp @@ -1,6 +1,6 @@ -#include #include #include +#include class SeasonWindow { public: