Formatting

This commit is contained in:
zvon 2020-04-01 16:13:39 +02:00
parent aa049ff203
commit 991a21af4e
26 changed files with 68 additions and 63 deletions

View File

@ -12,9 +12,9 @@
#ifdef _WIN32
#include "resources_windows.h"
#include <codecvt>
#include <shlobj.h>
#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 <pwd.h>
#include <stdio.h>
#include <sys/ioctl.h>
#include <unistd.h>
#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;

View File

@ -7,13 +7,13 @@
#include <iostream>
#include <thread>
#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();

View File

@ -4,11 +4,11 @@
#include <libintl.h>
#include <locale.h>
#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"

View File

@ -8,14 +8,14 @@
#include <iostream>
#include <thread>
#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 ) );

View File

@ -14,8 +14,8 @@
#include <gtkmm/window.h>
#include <set>
#include "seasonwindow.hpp"
#include "../network.hpp"
#include "seasonwindow.hpp"
class MainWindow : public Gtk::Window {
public:

View File

@ -1,7 +1,7 @@
#include "progresswindow.hpp"
#include <gtkmm/liststore.h>
#include <mutex>
#include "progresswindow.hpp"
#include "../functions.hpp"
#include "../resources_linux.h"

View File

@ -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

View File

@ -4,11 +4,11 @@
#include <gtkmm/messagedialog.h>
#include <iostream>
#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 =

View File

@ -4,10 +4,10 @@
#ifdef _WIN32
#include <windows.h>
#include "resources_windows.h"
#include <fcntl.h>
#include <io.h>
#include <windows.h>
using char_t = wchar_t;
using string = std::wstring;
@ -19,8 +19,8 @@ using string = std::wstring;
#else
#include "resources_linux.h"
#include <error.h>
#include <errno.h>
#include <error.h>
#include <getopt.h>
using char_t = char;

View File

@ -8,8 +8,8 @@
#ifdef _WIN32
#include <windows.h>
#include <conio.h>
#include <windows.h>
#include <winuser.h>
#define cout std::wcout

View File

@ -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:

View File

@ -17,8 +17,8 @@
#ifdef _WIN32
#include <windows.h>
#include "resources_windows.h"
#include <windows.h>
#include <codecvt>
#include <fcntl.h>

View File

@ -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 );

View File

@ -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 <commctrl.h>
#include <fstream>

View File

@ -1,7 +1,7 @@
#include <windows.h>
#include <string>
#include <tuple>
#include <vector>
#include <windows.h>
class DatabaseWindow {
public:

View File

@ -1,7 +1,7 @@
#include <windows.h>
#include "../filesystem.hpp"
#include <Shlwapi.h>
#include <cstring>
#include <windows.h>
FSLib::Directory::Directory( const string &path_ ) : dir_path( path_ ) {
// need to append \\* for windows to search files in directory

View File

@ -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 <shlobj.h>

View File

@ -1,6 +1,6 @@
#include <windows.h>
#include <commctrl.h>
#include <string>
#include <windows.h>
void registerWindowClasses( HINSTANCE hInstance );
void centerWindow( HWND hwnd );

View File

@ -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 <fstream>
#include <thread>
@ -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;
}

View File

@ -1,5 +1,5 @@
#include <windows.h>
#include <string>
#include <windows.h>
class PatternWindow {
public:

View File

@ -1,5 +1,5 @@
#include <windows.h>
#include <string>
#include <windows.h>
class ProgressWindow {
public:

View File

@ -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;
}

View File

@ -1,6 +1,6 @@
#include <windows.h>
#include <string>
#include <vector>
#include <windows.h>
class SearchWindow {
public:

View File

@ -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

View File

@ -1,6 +1,6 @@
#include <windows.h>
#include <string>
#include <vector>
#include <windows.h>
class SeasonWindow {
public: