add build dialog

This commit is contained in:
Guillermo Roche 2020-06-03 18:59:39 +02:00
parent 44bfd7e606
commit adf1bc70ce
8 changed files with 37 additions and 12 deletions

View File

@ -5,7 +5,7 @@ CONFIG -= qt
CONFIG += link_pkgconfig CONFIG += link_pkgconfig
#PKGCONFIG += gtk+-3.0 #PKGCONFIG += gtk+-3.0
PKGCONFIG += gtkmm-3.0 PKGCONFIG += gtkmm-3.0
LIBS += -lcrypto -lssl LIBS += -lcrypto -lssl -pthread
SOURCES += \ SOURCES += \
main.cpp \ main.cpp \
conexion.cpp \ conexion.cpp \

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject> <!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 4.8.2, 2020-06-02T15:21:19. --> <!-- Written by QtCreator 4.8.2, 2020-06-03T15:11:45. -->
<qtcreator> <qtcreator>
<data> <data>
<variable>EnvironmentId</variable> <variable>EnvironmentId</variable>

View File

@ -6,8 +6,8 @@ container_window::container_window(conexion *con, Glib::RefPtr< Gtk::Application
this->app=app; this->app=app;
this->app->run(loggin); this->app->run(loggin);
if(this->loggin.login){ if(this->loggin.login){
this->cont_inst=new controller_install(&install, sesion.get());
this->cont_info=new controller_info(&info, sesion.get()); this->cont_info=new controller_info(&info, sesion.get());
this->cont_inst=new controller_install(&install, sesion.get(), this->cont_info);
this->app.reset(); this->app.reset();
this->app=Gtk::Application::create( "org.gtkmm.examples.base"); this->app=Gtk::Application::create( "org.gtkmm.examples.base");
this->add(this->book); this->add(this->book);

View File

@ -23,6 +23,7 @@ public:
* @param app App that contains the gtk loop * @param app App that contains the gtk loop
*/ */
container_window(conexion *con, Glib::RefPtr< Gtk::Application > app); container_window(conexion *con, Glib::RefPtr< Gtk::Application > app);
controller_info *cont_info;
private: private:
Glib::RefPtr< Gtk::Application > app; Glib::RefPtr< Gtk::Application > app;
std::unique_ptr<session_manager> sesion; std::unique_ptr<session_manager> sesion;
@ -31,7 +32,6 @@ private:
view_info info; view_info info;
view_user_info uinfo; view_user_info uinfo;
controller_install *cont_inst; controller_install *cont_inst;
controller_info *cont_info;
controller_user_info *con_uinfo; controller_user_info *con_uinfo;
Gtk::Notebook book; Gtk::Notebook book;
}; };

View File

@ -14,14 +14,14 @@ public:
* @param sesion Model to have the funcionality * @param sesion Model to have the funcionality
*/ */
controller_info(view_info *view, session_manager *sesion); controller_info(view_info *view, session_manager *sesion);
private:
view_info *view;
session_manager *sesion;
/** /**
* @brief load_info * @brief load_info
* Load the info in the table * Load the info in the table
*/ */
void load_info(); void load_info();
private:
view_info *view;
session_manager *sesion;
/** /**
* @brief get_first * @brief get_first
* Get the firs string until the special character ":" * Get the firs string until the special character ":"

View File

@ -1,9 +1,12 @@
#include "controller_install.h" #include "controller_install.h"
#include "container_window.h"
controller_install::controller_install(view_install *vis, session_manager *sesi) #include <thread>
#include <gtkmm/messagedialog.h>
controller_install::controller_install(view_install *vis, session_manager *sesi, controller_info* con)
{ {
this->vis=vis; this->vis=vis;
this->sesi=sesi; this->sesi=sesi;
this->con=con;
this->add_controlers(); this->add_controlers();
} }
@ -13,5 +16,24 @@ void controller_install::add_controlers(){
} }
void controller_install::on_button_clicked(){ void controller_install::on_button_clicked(){
this->sesi->install_command(vis->entry.get_text()); std::string n_package = this->vis->entry.get_text();
std::string mesage="Compile the package ";
mesage.append(n_package);
mesage.append("?");
Gtk::MessageDialog mes=Gtk::MessageDialog(mesage,false,Gtk::MessageType::MESSAGE_INFO, Gtk::ButtonsType::BUTTONS_OK_CANCEL);
int result=mes.run();
if(result==-5){
int res=this->sesi->install_command(n_package);
mes.close();
if(res>0){
con->load_info();
Gtk::MessageDialog mesf=Gtk::MessageDialog("Compile end satisfactorily",false,Gtk::MessageType::MESSAGE_INFO, Gtk::ButtonsType::BUTTONS_OK);
mesf.run();
}else{
Gtk::MessageDialog mesf=Gtk::MessageDialog("Compile fail",false,Gtk::MessageType::MESSAGE_ERROR, Gtk::ButtonsType::BUTTONS_OK);
mesf.run();
}
}
} }

View File

@ -3,6 +3,8 @@
#include "view_install.h" #include "view_install.h"
#include "conexion.h" #include "conexion.h"
#include "session_manager.h" #include "session_manager.h"
#include "controller_info.h"
class controller_install class controller_install
{ {
public: public:
@ -11,11 +13,13 @@ public:
* View controler that send a name package to build * View controler that send a name package to build
* @param view View to controle * @param view View to controle
* @param sesion Model to have the funcionality * @param sesion Model to have the funcionality
* @param cont Window that contains these view
*/ */
controller_install(view_install* view, session_manager* sesion); controller_install(view_install* view, session_manager* sesion, controller_info* con);
private: private:
view_install *vis; view_install *vis;
session_manager *sesi; session_manager *sesi;
controller_info *con;
/** /**
* @brief add_controlers * @brief add_controlers
* Add controlers to the bottons * Add controlers to the bottons

View File

@ -8,7 +8,6 @@ view_install::view_install():m_button("build"),m_VBox(Gtk::ORIENTATION_VERTICAL)
add(m_VBox); add(m_VBox);
m_VBox.pack_start(this->entry); m_VBox.pack_start(this->entry);
m_VBox.pack_start(m_ButtonBox, Gtk::PACK_SHRINK); m_VBox.pack_start(m_ButtonBox, Gtk::PACK_SHRINK);
m_ButtonBox.pack_start(m_button, Gtk::PACK_SHRINK); m_ButtonBox.pack_start(m_button, Gtk::PACK_SHRINK);
m_ButtonBox.set_border_width(5); m_ButtonBox.set_border_width(5);