first commit, base client with gtk3

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

26
ClienteTFG.pro Normal file
View File

@ -0,0 +1,26 @@
TEMPLATE = app
CONFIG += console c++11
CONFIG -= app_bundle
CONFIG -= qt
CONFIG += link_pkgconfig
#PKGCONFIG += gtk+-3.0
PKGCONFIG += gtkmm-3.0
LIBS += -lcrypto -lssl
SOURCES += \
main.cpp \
conexion.cpp \
conexion_ssl.cpp \
config_reader.cpp \
vista.cpp \
controlador.cpp \
view_loggin.cpp \
read_uses.cpp
HEADERS += \
conexion.h \
conexion_ssl.h \
config_reader.h \
vista.h \
controlador.h \
view_loggin.h \
read_uses.h

292
ClienteTFG.pro.user Normal file
View File

@ -0,0 +1,292 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 4.8.2, 2020-05-07T01:46:57. -->
<qtcreator>
<data>
<variable>EnvironmentId</variable>
<value type="QByteArray">{6372de0b-6c3f-4b3a-9367-dde6c2574520}</value>
</data>
<data>
<variable>ProjectExplorer.Project.ActiveTarget</variable>
<value type="int">0</value>
</data>
<data>
<variable>ProjectExplorer.Project.EditorSettings</variable>
<valuemap type="QVariantMap">
<value type="bool" key="EditorConfiguration.AutoIndent">true</value>
<value type="bool" key="EditorConfiguration.AutoSpacesForTabs">false</value>
<value type="bool" key="EditorConfiguration.CamelCaseNavigation">true</value>
<valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.0">
<value type="QString" key="language">Cpp</value>
<valuemap type="QVariantMap" key="value">
<value type="QByteArray" key="CurrentPreferences">CppGlobal</value>
</valuemap>
</valuemap>
<valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.1">
<value type="QString" key="language">QmlJS</value>
<valuemap type="QVariantMap" key="value">
<value type="QByteArray" key="CurrentPreferences">QmlJSGlobal</value>
</valuemap>
</valuemap>
<value type="int" key="EditorConfiguration.CodeStyle.Count">2</value>
<value type="QByteArray" key="EditorConfiguration.Codec">UTF-8</value>
<value type="bool" key="EditorConfiguration.ConstrainTooltips">false</value>
<value type="int" key="EditorConfiguration.IndentSize">4</value>
<value type="bool" key="EditorConfiguration.KeyboardTooltips">false</value>
<value type="int" key="EditorConfiguration.MarginColumn">80</value>
<value type="bool" key="EditorConfiguration.MouseHiding">true</value>
<value type="bool" key="EditorConfiguration.MouseNavigation">true</value>
<value type="int" key="EditorConfiguration.PaddingMode">1</value>
<value type="bool" key="EditorConfiguration.ScrollWheelZooming">true</value>
<value type="bool" key="EditorConfiguration.ShowMargin">false</value>
<value type="int" key="EditorConfiguration.SmartBackspaceBehavior">0</value>
<value type="bool" key="EditorConfiguration.SmartSelectionChanging">true</value>
<value type="bool" key="EditorConfiguration.SpacesForTabs">true</value>
<value type="int" key="EditorConfiguration.TabKeyBehavior">0</value>
<value type="int" key="EditorConfiguration.TabSize">8</value>
<value type="bool" key="EditorConfiguration.UseGlobal">true</value>
<value type="int" key="EditorConfiguration.Utf8BomBehavior">1</value>
<value type="bool" key="EditorConfiguration.addFinalNewLine">true</value>
<value type="bool" key="EditorConfiguration.cleanIndentation">true</value>
<value type="bool" key="EditorConfiguration.cleanWhitespace">true</value>
<value type="bool" key="EditorConfiguration.inEntireDocument">false</value>
</valuemap>
</data>
<data>
<variable>ProjectExplorer.Project.PluginSettings</variable>
<valuemap type="QVariantMap">
<valuelist type="QVariantList" key="ClangCodeModel.CustomCommandLineKey"/>
<value type="bool" key="ClangCodeModel.UseGlobalConfig">true</value>
</valuemap>
</data>
<data>
<variable>ProjectExplorer.Project.Target.0</variable>
<valuemap type="QVariantMap">
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{dd182432-2a2f-4b92-8ddc-d07764586196}</value>
<value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
<value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
<value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/roche/Cosas/C++/build-ClienteTFG-Desktop-Debug</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">true</value>
<value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.SeparateDebugInfo">false</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.UseQtQuickCompiler">false</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.BuildTargets"/>
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
<value type="bool" key="Qt4ProjectManager.MakeStep.OverrideMakeflags">false</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.BuildTargets"/>
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
<value type="bool" key="Qt4ProjectManager.MakeStep.OverrideMakeflags">false</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Debug</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Debug</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">2</value>
<value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1">
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/roche/Cosas/C++/build-ClienteTFG-Desktop-Release</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value>
<value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.SeparateDebugInfo">false</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.UseQtQuickCompiler">true</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.BuildTargets"/>
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
<value type="bool" key="Qt4ProjectManager.MakeStep.OverrideMakeflags">false</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.BuildTargets"/>
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
<value type="bool" key="Qt4ProjectManager.MakeStep.OverrideMakeflags">false</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Release</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Release</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
<value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.2">
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/roche/Cosas/C++/build-ClienteTFG-Desktop-Profile</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">true</value>
<value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.SeparateDebugInfo">true</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.UseQtQuickCompiler">true</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.BuildTargets"/>
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
<value type="bool" key="Qt4ProjectManager.MakeStep.OverrideMakeflags">false</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.BuildTargets"/>
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
<value type="bool" key="Qt4ProjectManager.MakeStep.OverrideMakeflags">false</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Profile</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Profile</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
<value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>
</valuemap>
<value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">3</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy Configuration</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value>
</valuemap>
<value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.PluginSettings"/>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
<value type="bool" key="Analyzer.QmlProfiler.AggregateTraces">false</value>
<value type="bool" key="Analyzer.QmlProfiler.FlushEnabled">false</value>
<value type="uint" key="Analyzer.QmlProfiler.FlushInterval">1000</value>
<value type="QString" key="Analyzer.QmlProfiler.LastTraceFile"></value>
<value type="bool" key="Analyzer.QmlProfiler.Settings.UseGlobalSettings">true</value>
<value type="int" key="PE.EnvironmentAspect.Base">2</value>
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">ClienteTFG</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:/home/roche/Cosas/C++/ClienteTFG/ClienteTFG.pro</value>
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">ClienteTFG.pro</value>
<value type="QString" key="RunConfiguration.Arguments"></value>
<value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
<value type="bool" key="RunConfiguration.UseCppDebugger">false</value>
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
<value type="bool" key="RunConfiguration.UseLibrarySearchPath">true</value>
<value type="bool" key="RunConfiguration.UseMultiProcess">false</value>
<value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
<value type="QString" key="RunConfiguration.WorkingDirectory"></value>
<value type="QString" key="RunConfiguration.WorkingDirectory.default">/home/roche/Cosas/C++/build-ClienteTFG-Desktop-Debug</value>
</valuemap>
<value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
</valuemap>
</data>
<data>
<variable>ProjectExplorer.Project.TargetCount</variable>
<value type="int">1</value>
</data>
<data>
<variable>ProjectExplorer.Project.Updater.FileVersion</variable>
<value type="int">20</value>
</data>
<data>
<variable>Version</variable>
<value type="int">20</value>
</data>
</qtcreator>

56
conexion.cpp Normal file
View File

@ -0,0 +1,56 @@
#include "conexion.h"
#include <arpa/inet.h>
#include <sys/socket.h>
#include <memory.h>
#include <unistd.h>
#define CHK_ERR(err,s) if ((err)==-1) { perror(s); exit(1); }
conexion::conexion(config_reader &conf)
{
config=&conf;
int err;
struct sockaddr_in server_address;
this->fd = socket (AF_INET, SOCK_STREAM, 0);
CHK_ERR(this->fd, "error initial conexion")
std::string port;
if(!this->config->get_param("port",port)){
perror("error to acces the port in the config");
}
std::string host;
if(!this->config->get_param("host",host)){
perror("error to accest to the host in the config");
}
memset(&server_address, 0, sizeof(server_address));
server_address.sin_family = AF_INET;
server_address.sin_addr.s_addr = inet_addr (host.data()); /* Server IP */
server_address.sin_port = htons (atoi(port.data())); /* Server Port number */
err = connect(this->fd, (struct sockaddr*) &server_address,
sizeof(server_address));
CHK_ERR(err, "error in connexion")
}
ssize_t conexion::read_string(std::string &entrada, int size){
char* buffer = new char[size+1];
ssize_t ret=read(this->fd,buffer,size);
buffer[ret]='\0';
entrada = buffer;
return ret;
}
ssize_t conexion::write_string(std::string entrada){
return write(this->fd,entrada.data(),entrada.size());
}
bool conexion::check_pass(std::string usernem, std::string pass){
this->write_string(usernem);
this->write_string(pass);
std::string result;
this->read_string(result,4);
return result=="pass";
}

18
conexion.h Normal file
View File

@ -0,0 +1,18 @@
#ifndef CONEXION_H
#define CONEXION_H
#include "config_reader.h"
class conexion
{
public:
conexion(config_reader &conf);
virtual ssize_t read_string(std::string &entrada, int size);
virtual ssize_t write_string(std::string entrada);
bool check_pass(std::string usernem, std::string pass);
protected:
config_reader *config;
int fd;
};
#endif // CONEXION_H

39
conexion_ssl.cpp Normal file
View File

@ -0,0 +1,39 @@
#include "conexion_ssl.h"
#include <openssl/crypto.h>
#include <openssl/x509.h>
#include <openssl/pem.h>
#include <openssl/err.h>
#define CHK_NULL(x) if ((x)==NULL) exit (1)
#define CHK_ERR(err,s) if ((err)==-1) { perror(s); exit(1); }
#define CHK_SSL(err) if ((err)==-1) { ERR_print_errors_fp(stderr); exit(2); }
conexion_ssl::conexion_ssl(config_reader &conf) : conexion(conf)
{
int err;
SSL_CTX* ctx;
const SSL_METHOD *meth;
OpenSSL_add_ssl_algorithms();
meth = TLS_client_method();
SSL_load_error_strings();
ctx = SSL_CTX_new (meth);
CHK_NULL(ctx);
this->ssl=SSL_new(ctx);
SSL_set_fd(this->ssl,this->fd);
err = SSL_connect (ssl);
CHK_SSL(err)
}
ssize_t conexion_ssl::read_string(std::string &entrada, int size){
char* buffer = new char[size+1];
ssize_t ret = SSL_read (this->ssl, buffer, size);
buffer[ret]='\0';
entrada = std::string(buffer);
return ret;
}
ssize_t conexion_ssl::write_string(std::string entrada){
return SSL_write(this->ssl,entrada.data(),sizeof (entrada.data()));
}

16
conexion_ssl.h Normal file
View File

@ -0,0 +1,16 @@
#ifndef CONEXION_SSL_H
#define CONEXION_SSL_H
#include "conexion.h"
#include <openssl/ssl.h>
class conexion_ssl : public conexion
{
public:
conexion_ssl(config_reader &conf);
ssize_t read_string(std::string &entrada, int size);
ssize_t write_string(std::string entrada);
private:
SSL* ssl;
};
#endif // CONEXION_SSL_H

27
config_reader.cpp Normal file
View File

@ -0,0 +1,27 @@
#include "config_reader.h"
#include <iostream>
config_reader::config_reader(std::string dir)
{
this->file.open(dir, std::ios::in);
std::string prueba;
std::getline(file, prueba);
}
bool config_reader::get_param(std::string variable, std::string &value){
this->file.clear();
this->file.seekg(0, file.beg);
std::string line;
while(std::getline(file, line)){
std::string no_coment=line.substr(0,line.find("#"));
std::size_t found=no_coment.find(variable);
if(found!=std::string::npos){
no_coment=no_coment.substr(found+variable.length(), no_coment.length());
found=no_coment.find("=");
if(found!=std::string::npos){
value=no_coment.substr(found+1, no_coment.length());
return true;
}
}
}
return false;
}

15
config_reader.h Normal file
View File

@ -0,0 +1,15 @@
#ifndef CONFIG_READER_H
#define CONFIG_READER_H
#include <string>
#include <fstream>
class config_reader
{
public:
config_reader(std::string);
bool get_param(std::string variable, std::string &value);
private:
std::ifstream file;
};
#endif // CONFIG_READER_H

24
controlador.cpp Normal file
View File

@ -0,0 +1,24 @@
#include "controlador.h"
#include <iostream>
controlador::controlador(vista *vis, conexion *con)
{
this->vis=vis;
this->con=con;
this->add_controlers();
}
void controlador::add_controlers(){
vis->m_button.signal_clicked().connect(sigc::mem_fun(this,
&controlador::on_button_clicked));
}
void controlador::on_button_clicked(){
std::string text = vis->m_refTextBuffer1->get_text();
std::cout << text << std::endl;
this->con->write_string("exec");
this->con->write_string(text);
this->con->read_string(text,10);
std::cout << text << std::endl;
}

16
controlador.h Normal file
View File

@ -0,0 +1,16 @@
#ifndef CONTROLADOR_H
#define CONTROLADOR_H
#include "vista.h"
#include "conexion.h"
class controlador
{
public:
controlador(vista*, conexion*);
private:
vista *vis;
conexion *con;
void add_controlers();
void on_button_clicked();
};
#endif // CONTROLADOR_H

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;
}

32
read_uses.cpp Normal file
View File

@ -0,0 +1,32 @@
#include "read_uses.h"
read_uses::read_uses(std::string name)
{
size_t pos=name.find("/");
if(pos==std::string::npos){
this->short_name=name;
}else{
this->short_name=name.substr(pos, name.size());
}
this->file=std::ifstream("/etc/portage/package.use/"+this->short_name, std::ifstream::in);
this->exist = file.good();
}
std::string* read_uses::get_uses(){
std::string *ret=nullptr;
if(this->exist){
ret=new std::string;
std::string line;
while(std::getline(file, line)){
std::string no_coment=line.substr(0,line.find("#"));
std::size_t found=no_coment.find(this->short_name);
if(found!=std::string::npos){
found=no_coment.find(this->short_name);
if(found!=std::string::npos){
*ret=no_coment.substr(0, no_coment.length());
}
}
}
}
return ret;
}

18
read_uses.h Normal file
View File

@ -0,0 +1,18 @@
#ifndef READ_USES_H
#define READ_USES_H
#include <string>
#include <fstream>
#include <list>
class read_uses
{
public:
read_uses(std::string name);
std::string* get_uses();
private:
std::ifstream file;
std::string short_name;
bool exist;
};
#endif // READ_USES_H

55
view_loggin.cpp Normal file
View File

@ -0,0 +1,55 @@
#include "view_loggin.h"
#include "vista.h"
#include "controlador.h"
#include <gtkmm/messagedialog.h>
view_loggin::view_loggin(conexion *con):button("check"),box(Gtk::ORIENTATION_VERTICAL),
box_user(Gtk::ORIENTATION_HORIZONTAL), box_pass(Gtk::ORIENTATION_HORIZONTAL)
{
this->con=con;
set_title("loggin");
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(con->check_pass(user,pass)){
this->login=true;
this->hide();
}else{
this->login=false;
Gtk::MessageDialog err(*this,"error", false, Gtk::MessageType::MESSAGE_ERROR, Gtk::BUTTONS_OK, true);
err.set_secondary_text("Bad password or username");
err.run();
}
}

33
view_loggin.h Normal file
View File

@ -0,0 +1,33 @@
#ifndef VIEW_LOGGIN_H
#define VIEW_LOGGIN_H
#include <gtkmm/window.h>
#include <gtkmm/button.h>
#include <gtkmm/box.h>
#include <gtkmm/label.h>
#include <gtkmm/entry.h>
#include "conexion.h"
class view_loggin : public Gtk::Window
{
public:
view_loggin(conexion *con);
conexion *con;
Gtk::Label user;
Gtk::Entry entry_user;
Gtk::Box box_user;
Gtk::Label pass;
Gtk::Entry entry_pass;
Gtk::Box box_pass;
Gtk::Button button;
Gtk::Box box;
void on_button_clicked();
bool login;
};
#endif // VIEW_LOGGIN_H

37
vista.cpp Normal file
View File

@ -0,0 +1,37 @@
#include "vista.h"
#include <iostream>
vista::vista():m_button("send"),m_VBox(Gtk::ORIENTATION_VERTICAL)
{
set_title("remote instaler");
set_border_width(5);
add(m_VBox);
m_ScrolledWindow.add(m_TextView);
m_ScrolledWindow.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
m_VBox.pack_start(m_ScrolledWindow);
//Add buttons:
m_VBox.pack_start(m_ButtonBox, Gtk::PACK_SHRINK);
m_ButtonBox.pack_start(m_button, Gtk::PACK_SHRINK);
m_ButtonBox.set_border_width(5);
m_ButtonBox.set_spacing(5);
m_ButtonBox.set_layout(Gtk::BUTTONBOX_END);
// When the button receives the "clicked" signal, it will call the
// on_button_clicked() method defined below.
/*m_button.signal_clicked().connect(sigc::mem_fun(*this,
&vista::on_button_clicked));*/
m_refTextBuffer1 = Gtk::TextBuffer::create();
//m_refTextBuffer1->set_text("This is the text from TextBuffer #1.");
m_TextView.set_buffer(m_refTextBuffer1);
// The final step is to display this newly created widget...
show_all_children();
}
/*void vista::on_button_clicked(){
std::string salida = m_refTextBuffer1->get_text();
std::cout << salida << std::endl;
}*/

22
vista.h Normal file
View File

@ -0,0 +1,22 @@
#ifndef VISTA_H
#define VISTA_H
#include <gtkmm/button.h>
#include <gtkmm/window.h>
#include <gtkmm/textview.h>
#include <gtkmm/buttonbox.h>
#include <gtkmm/scrolledwindow.h>
#include <gtkmm/box.h>
class vista : public Gtk::Window
{
public:
vista();
Gtk::Button m_button;
Gtk::Box m_VBox;
Gtk::ScrolledWindow m_ScrolledWindow;
Gtk::TextView m_TextView;
Gtk::ButtonBox m_ButtonBox;
Glib::RefPtr<Gtk::TextBuffer> m_refTextBuffer1;
};
#endif // VISTA_H