Databasewindow: formatting
This commit is contained in:
parent
b8906467fc
commit
a93cff77d9
@ -1,10 +1,9 @@
|
||||
#include <algorithm>
|
||||
#include <gtkmm/box.h>
|
||||
#include <gtkmm/button.h>
|
||||
#include <gtkmm/liststore.h>
|
||||
#include <gtkmm/messagedialog.h>
|
||||
#include <gtkmm/scrolledwindow.h>
|
||||
#include <iostream>
|
||||
#include <thread>
|
||||
|
||||
#include "databasewindow.hpp"
|
||||
#include "filesystem.hpp"
|
||||
@ -47,9 +46,6 @@ DatabaseWindow::DatabaseWindow( bool _linux,
|
||||
auto *button_remove = new Gtk::Button();
|
||||
auto *button_quit = new Gtk::Button();
|
||||
|
||||
scrolled_window->set_size_request( 550, 300 );
|
||||
scrolled_window->add( *m_tree_database );
|
||||
|
||||
// pack boxes
|
||||
box->pack_start( *scrolled_window, Gtk::PACK_EXPAND_WIDGET );
|
||||
box->pack_start( *buttons, Gtk::PACK_SHRINK );
|
||||
@ -62,11 +58,13 @@ DatabaseWindow::DatabaseWindow( bool _linux,
|
||||
buttons->set_margin_top( 5 );
|
||||
buttons->set_margin_bottom( 5 );
|
||||
|
||||
scrolled_window->add( *m_tree_database );
|
||||
|
||||
buttons->pack_start( *button_save, Gtk::PACK_SHRINK );
|
||||
buttons->pack_start( *button_remove, Gtk::PACK_SHRINK );
|
||||
buttons->pack_end( *button_quit, Gtk::PACK_SHRINK );
|
||||
|
||||
button_save->set_margin_right(5);
|
||||
button_save->set_margin_right( 5 );
|
||||
|
||||
// set button texts
|
||||
button_save->set_label( "Save" );
|
||||
@ -120,7 +118,6 @@ DatabaseWindow::DatabaseWindow( bool _linux,
|
||||
void DatabaseWindow::save() {
|
||||
if ( changed_rows.size() == 0 )
|
||||
return;
|
||||
std::cout << "Starting for" << std::endl;
|
||||
for ( auto &x : m_model->children() ) {
|
||||
auto index = static_cast< size_t >( x[m_columns_database.m_col_id] );
|
||||
if ( changed_rows.find( index ) != changed_rows.end() ) {
|
||||
@ -132,8 +129,6 @@ void DatabaseWindow::save() {
|
||||
std::transform( dvd_string.begin(), dvd_string.end(),
|
||||
dvd_string.begin(), ::tolower );
|
||||
bool dvd = dvd_string == "yes";
|
||||
std::cout << index << " " << path << " " << lang << " " << show_id
|
||||
<< " " << dvd_string << std::endl;
|
||||
changeDB( index, path, lang, show_id, dvd );
|
||||
}
|
||||
}
|
||||
@ -141,7 +136,7 @@ void DatabaseWindow::save() {
|
||||
auto *pw = new ProgressWindow;
|
||||
app->add_window( *pw );
|
||||
|
||||
t = std::thread( refreshSelectDB, changed_rows, linux, pw );
|
||||
std::thread t = std::thread( refreshSelectDB, changed_rows, linux, pw );
|
||||
t.detach();
|
||||
|
||||
// lambda capture
|
||||
@ -159,9 +154,6 @@ void DatabaseWindow::save() {
|
||||
|
||||
void DatabaseWindow::remove() {
|
||||
auto selected = m_tree_database->get_selection()->get_selected();
|
||||
std::cout << static_cast< size_t >(
|
||||
( *selected )[m_columns_database.m_col_id] )
|
||||
<< std::endl;
|
||||
removeFromDB( static_cast< std::string >(
|
||||
( *selected )[m_columns_database.m_col_path] ) );
|
||||
m_model->erase( selected );
|
||||
|
@ -4,11 +4,8 @@
|
||||
#include <gtkmm/liststore.h>
|
||||
#include <gtkmm/treeview.h>
|
||||
#include <gtkmm/window.h>
|
||||
#include <thread>
|
||||
#include <unordered_set>
|
||||
|
||||
#include "network.hpp"
|
||||
|
||||
class DatabaseWindow : public Gtk::Window {
|
||||
public:
|
||||
DatabaseWindow() = delete;
|
||||
@ -54,7 +51,6 @@ protected:
|
||||
|
||||
bool linux;
|
||||
Glib::RefPtr< Gtk::Application > app;
|
||||
std::thread t;
|
||||
};
|
||||
|
||||
#endif // GTKMM_MAIN_WINDOW
|
||||
|
Loading…
Reference in New Issue
Block a user