tv_rename/databasewindow.hpp

85 lines
2.5 KiB
C++
Raw Normal View History

2019-07-12 21:10:40 +00:00
#ifndef GTKMM_DATABASE_WINDOW
#define GTKMM_DATABASE_WINDOW
2020-02-12 10:44:34 +00:00
#include <gtkmm/cellrenderercombo.h>
#include <gtkmm/treestore.h>
2019-07-12 21:10:40 +00:00
#include <gtkmm/treeview.h>
#include <gtkmm/window.h>
#include <unordered_set>
2020-02-12 10:44:34 +00:00
#include "searchwindow.hpp"
2019-07-12 21:10:40 +00:00
class DatabaseWindow : public Gtk::Window {
public:
DatabaseWindow() = delete;
2020-02-12 10:44:34 +00:00
DatabaseWindow( bool _linux,
std::map< std::string, std::string > &_language_map,
Glib::RefPtr< Gtk::Application > _app );
2019-07-12 21:10:40 +00:00
virtual ~DatabaseWindow();
private:
void save();
void remove();
void changed( const Gtk::TreeModel::Path & /*UNUSED*/,
const Gtk::TreeModel::iterator &row );
void quit();
2020-02-12 10:44:34 +00:00
bool treeViewClick( GdkEventButton *event );
void languageChange( const Glib::ustring &str, const Gtk::TreeIter &it );
void finishedSearch();
void errorPath( const std::string &path );
void errorID( const std::string &show_id );
void errorLanguage( const std::string &lang );
2019-07-12 21:10:40 +00:00
std::unordered_set< size_t > changed_rows;
protected:
Gtk::TreeView *m_tree_database = new Gtk::TreeView();
2020-02-12 10:44:34 +00:00
class LanguageColumns : public Gtk::TreeModel::ColumnRecord {
public:
LanguageColumns() {
add( m_col_code );
add( m_col_language );
}
Gtk::TreeModelColumn< std::string > m_col_code;
Gtk::TreeModelColumn< std::string > m_col_language;
};
2019-07-12 21:10:40 +00:00
class DatabaseColumns : public Gtk::TreeModel::ColumnRecord {
public:
DatabaseColumns() {
add( m_col_id );
add( m_col_show );
add( m_col_path );
add( m_col_lang );
2020-02-12 10:44:34 +00:00
add( m_col_lang_full );
add( m_col_show_id );
add( m_col_dvd );
2019-07-12 21:10:40 +00:00
}
Gtk::TreeModelColumn< size_t > m_col_id;
Gtk::TreeModelColumn< std::string > m_col_show;
Gtk::TreeModelColumn< std::string > m_col_path;
Gtk::TreeModelColumn< std::string > m_col_lang;
2020-02-12 10:44:34 +00:00
Gtk::TreeModelColumn< std::string > m_col_lang_full;
2020-01-16 10:12:22 +00:00
Gtk::TreeModelColumn< std::string > m_col_show_id;
Gtk::TreeModelColumn< bool > m_col_dvd;
2019-07-12 21:10:40 +00:00
};
DatabaseColumns m_columns_database;
2020-02-12 10:44:34 +00:00
LanguageColumns m_columns_language;
Glib::RefPtr< Gtk::TreeStore > m_model;
2020-02-12 10:44:34 +00:00
Gtk::CellRendererCombo m_combo_language;
2019-07-12 21:10:40 +00:00
bool linux;
2020-02-12 10:44:34 +00:00
std::map< std::string, std::string > &language_map;
Glib::RefPtr< Gtk::Application > app;
2020-02-12 10:44:34 +00:00
std::unique_ptr< SearchWindow > sw{ nullptr };
std::string show_search;
std::string id_search;
std::string lang_search;
2019-07-12 21:10:40 +00:00
};
#endif // GTKMM_MAIN_WINDOW