first commit, base client with gtk3

This commit is contained in:
2020-05-08 12:42:02 +02:00
commit f9cdde7008
17 changed files with 777 additions and 0 deletions

51
main.cpp Normal file
View File

@@ -0,0 +1,51 @@
#include "conexion_ssl.h"
#include "vista.h"
#include "controlador.h"
#include "view_loggin.h"
#include <iostream>
#include "read_uses.h"
#define FILE_CONFIG "config"
using namespace std;
int main(int argc, char *argv[])
{
auto app = Gtk::Application::create(argc, argv, "org.gtkmm.example");
config_reader conf = config_reader(FILE_CONFIG);
conexion* con;
string option;
if(conf.get_param("security", option)){
if(option=="yes"){
con = new conexion_ssl(conf);
}else if(option=="no"){
con = new conexion(conf);
}else{
perror("invalid option in security");
}
}else{
perror("no securty option found in config");
}
/*if(con->check_pass("test","ok")){
con->write_string("algo");
string salida;
con->read_string(salida,10);
cout << salida << endl;
}else{
cout << "contrasenia incorrecta" << endl;
}*/
view_loggin login(con);
//Shows the window and returns when it is closed.
//app->add_window(vis);
app->run(login);
if(login.login){
vista vis;
controlador cont(&vis, con);
app.reset();
app = Gtk::Application::create(argc, argv, "org.gtkmm.example");
app->run(vis);
}
return 0;
}