#include "view_loggin.h" #include "view_install.h" #include "controller_install.h" #include view_loggin::view_loggin(session_manager *sesi):box_user(Gtk::ORIENTATION_HORIZONTAL), box_pass(Gtk::ORIENTATION_HORIZONTAL),button("check"), box(Gtk::ORIENTATION_VERTICAL) { this->set_title("loggin"); this->sesi=sesi; set_border_width(5); this->user.set_text("user"); this->pass.set_text("pass"); this->button.signal_clicked().connect(sigc::mem_fun(this, &view_loggin::on_button_clicked)); this->box_user.add(user); this->box_user.add(entry_user); this->entry_user.set_hexpand(true); this->box_user.set_spacing(10); this->box_pass.add(pass); this->box_pass.add(entry_pass); this->entry_pass.set_visibility(false); this->entry_pass.set_hexpand(true); this->box_pass.set_spacing(10); this->box.add(box_user); this->box.add(box_pass); this->box.add(button); this->box.set_spacing(10); this->add(box); show_all_children(); } void view_loggin::on_button_clicked(){ std::string user=this->entry_user.get_text();//this->m_refTextBufferUser->get_text(); std::string pass=this->entry_pass.get_text();//this->m_refTextBufferPass->get_text(); if(sesi->loggin(user, pass)){ this->login=true; this->admin=sesi->admin(); this->hide(); }else{ this->login=false; Gtk::MessageDialog err("error", false, Gtk::MessageType::MESSAGE_ERROR, Gtk::BUTTONS_OK, true); err.set_secondary_text("Bad password or username"); err.run(); } }