Mainwindow: formatting

This commit is contained in:
zvon 2020-01-17 14:14:24 +01:00
parent d3a4ee8b0c
commit 100834c01f
2 changed files with 90 additions and 88 deletions

View File

@ -8,10 +8,10 @@
#include <iostream>
#include <thread>
#include "databasewindow.hpp"
#include "filesystem.hpp"
#include "functions.hpp"
#include "mainwindow.hpp"
#include "databasewindow.hpp"
#include "progresswindow.hpp"
#include "tv_rename.hpp"
@ -76,8 +76,8 @@ void MainWindow::process() {
( *m_combo_language->get_active() )[m_columns_language.m_col_code];
// fill up m_combo_possible with possible tv shows
auto possible_shows = searchShow(
std::string( m_entry_show->get_text() ), language_code );
auto possible_shows =
searchShow( std::string( m_entry_show->get_text() ), language_code );
// if no possible shows were found, tell the user
if ( possible_shows.size() == 0 ) {
@ -154,15 +154,16 @@ void MainWindow::getNames() {
* renamed - renamed filenames (sorted in the same order as `orig`)
*/
void renameFiles(
const std::vector<
std::pair< std::pair< int, std::string >, std::pair< std::string, std::string > > >
const std::vector< std::pair< std::pair< int, std::string >,
std::pair< std::string, std::string > > >
&renamed ) {
for ( auto renamed_it = renamed.begin(); renamed_it != renamed.end();
++renamed_it ) {
std::cout << renamed_it->first.second << "/" << renamed_it->second.first
<< " --> " << renamed_it->first.second << "/"
<< renamed_it->second.second << std::endl;
FSLib::rename( renamed_it->first.second + "/" + renamed_it->second.first,
FSLib::rename(
renamed_it->first.second + "/" + renamed_it->second.first,
renamed_it->first.second + "/" + renamed_it->second.second );
}
}
@ -199,7 +200,8 @@ void MainWindow::finishedSelection() {
for ( auto &x : selected ) {
// get renamed files for given season
auto renamed_files = getRenamedFiles(
static_cast< Glib::ustring >( ( *iter )[m_columns_show.m_col_show] ),
static_cast< Glib::ustring >(
( *iter )[m_columns_show.m_col_show] ),
x, show_id, language_code,
( input_pattern.empty() ? default_pattern : input_pattern ),
!m_check_linux->get_active(), files[x], m_check_dvd->get_active() );
@ -214,7 +216,8 @@ void MainWindow::finishedSelection() {
}
// create a custom dialog box with textview of new episode names
std::unique_ptr<Gtk::Dialog> dialog( new Gtk::Dialog( "Rename confirmation", *this ) );
std::unique_ptr< Gtk::Dialog > dialog(
new Gtk::Dialog( "Rename confirmation", *this ) );
dialog->set_default_size( 550, 350 );
dialog->set_resizable( false );
auto content = dialog->get_content_area();
@ -323,7 +326,6 @@ MainWindow::MainWindow( const Glib::RefPtr< Gtk::Application > &ptr )
item->signal_activate().connect(
sigc::mem_fun( *this, &MainWindow::quit ) );
submenu->append( *item );
// Database menu
@ -373,11 +375,11 @@ MainWindow::MainWindow( const Glib::RefPtr< Gtk::Application > &ptr )
submenu->append( *item );
std::vector<Gtk::Widget*> left_aligned_widgets = {m_label_show,
m_label_language, m_entry_show, m_combo_language, m_label_dir,
m_entry_dir, m_label_pattern, m_entry_pattern, m_button_pattern,
m_button_process, m_check_linux, m_check_trust, m_check_dvd,
m_label_possible, m_combo_possible, m_button_rename,
std::vector< Gtk::Widget * > left_aligned_widgets = {
m_label_show, m_label_language, m_entry_show, m_combo_language,
m_label_dir, m_entry_dir, m_label_pattern, m_entry_pattern,
m_button_pattern, m_button_process, m_check_linux, m_check_trust,
m_check_dvd, m_label_possible, m_combo_possible, m_button_rename,
m_button_db_add, m_button_dir
};
@ -504,8 +506,7 @@ void MainWindow::dbUpdate() {
app->add_window( *pw );
auto app_ptr = app;
pw->signal_hide().connect(
[pw, app_ptr](){
pw->signal_hide().connect( [pw, app_ptr]() {
app_ptr->remove_window( *pw );
delete pw;
} );
@ -523,8 +524,7 @@ void MainWindow::dbRefresh() {
app->add_window( *pw );
auto app_ptr = app;
pw->signal_hide().connect(
[pw, app_ptr](){
pw->signal_hide().connect( [pw, app_ptr]() {
app_ptr->remove_window( *pw );
delete pw;
} );
@ -550,9 +550,12 @@ void MainWindow::dbAdd() {
auto iter = m_combo_possible->get_active();
std::string input_pattern = m_entry_pattern->get_text();
std::string show = static_cast< Glib::ustring >( ( *iter )[m_columns_show.m_col_show] );
std::string language_code = static_cast< Glib::ustring >( ( *m_combo_language->get_active() )[m_columns_language.m_col_code] );
std::string show_id = static_cast< Glib::ustring >( ( *iter )[m_columns_show.m_col_id] );
std::string show =
static_cast< Glib::ustring >( ( *iter )[m_columns_show.m_col_show] );
std::string language_code = static_cast< Glib::ustring >(
( *m_combo_language->get_active() )[m_columns_language.m_col_code] );
std::string show_id =
static_cast< Glib::ustring >( ( *iter )[m_columns_show.m_col_id] );
std::cout << show << " " << language_code << " " << show_id << std::endl;
@ -560,8 +563,7 @@ void MainWindow::dbAdd() {
app->add_window( *pw );
auto app_ptr = app;
pw->signal_hide().connect(
[pw, app_ptr](){
pw->signal_hide().connect( [pw, app_ptr]() {
app_ptr->remove_window( *pw );
delete pw;
} );
@ -579,8 +581,7 @@ void MainWindow::dbManage() {
app->add_window( *dbWindow );
auto app_ptr = app;
dbWindow->signal_hide().connect(
[dbWindow, app_ptr](){
dbWindow->signal_hide().connect( [dbWindow, app_ptr]() {
app_ptr->remove_window( *dbWindow );
delete dbWindow;
} );
@ -590,7 +591,8 @@ void MainWindow::dbManage() {
void MainWindow::dbPattern() {
// Create a custom dialog box for pattern change
std::unique_ptr<Gtk::Dialog> dialog( new Gtk::Dialog( "Change pattern", *this ) );
std::unique_ptr< Gtk::Dialog > dialog(
new Gtk::Dialog( "Change pattern", *this ) );
dialog->set_default_size( 350, 0 );
auto content = dialog->get_content_area();

View File

@ -12,8 +12,8 @@
#include <gtkmm/menubar.h>
#include <gtkmm/menuitem.h>
#include <gtkmm/window.h>
#include <set>
#include <iostream>
#include <set>
#include "network.hpp"
#include "seasonwindow.hpp"