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