diff --git a/app/Makefile b/app/Makefile
index 1d33540ac9872d118faa66ff5b379dbcbea1d143..24054b695b56f9b8962c93259ba7abe47e613d94 100644
--- a/app/Makefile
+++ b/app/Makefile
@@ -1,7 +1,15 @@
+LIBPATH=../../build
+SUBDIR=SandboxSetup
 
-all:
-	$(shell cd SandboxSetup && qmake *.pro)
-	$(MAKE) -C SandboxSetup
+all: 
+	$(MAKE) genMakefile
+	$(MAKE) genExe
+
+genMakefile:
+	$(shell cd $(SUBDIR) && qmake *.pro)
+
+genExe:
+	$(shell cd $(SUBDIR) && export LD_LIBRARY_PATH=$(pwd)/$(LIBPATH) && make)
 
 clean:
 	$(MAKE) distclean -C SandboxSetup
diff --git a/app/SandboxSetup/SandboxSetup.pro b/app/SandboxSetup/SandboxSetup.pro
index e9dad85fab974ea71c9e7b46ba5ec4f2ec5b4a5b..993e819d16bf11a536059b88e5f426d7ab9220d0 100644
--- a/app/SandboxSetup/SandboxSetup.pro
+++ b/app/SandboxSetup/SandboxSetup.pro
@@ -25,13 +25,13 @@ DEFINES += QT_DEPRECATED_WARNINGS
 
 SOURCES += \
         main.cpp \
-        mainwindow.cpp
+    monitorgui.cpp
 
 HEADERS += \
-        mainwindow.h
+    monitorgui.h
 
 FORMS += \
-        mainwindow.ui
+    monitorgui.ui
 
 
 
diff --git a/app/SandboxSetup/main.cpp b/app/SandboxSetup/main.cpp
index 945ee5e3b1b9eafde7e7bf1062509b163ace5c4b..1dc01ad75310ff0f59c928e1d46fc0654e5593e3 100644
--- a/app/SandboxSetup/main.cpp
+++ b/app/SandboxSetup/main.cpp
@@ -1,4 +1,4 @@
-#include "mainwindow.h"
+#include "monitorgui.h"
 #include <QApplication>
 
 #include <sandboxSetup.h>
@@ -8,15 +8,15 @@ int main(int argc, char *argv[])
 
     SandboxSetup setup;
     QApplication a(argc, argv);
-    MainWindow w;
-    w.show();
+    MonitorGui m;
+    m.show();
     a.exec();
 
-    setup.setBeamerResolution(cv::Size(w.getWidth(), w.getHeight()));
-    if(w.getWidth()==0 || w.getHeight()==0){
+    if(!m.getState()){
         std::cout << "Cancel Resolution" << std::endl;
         return 1;
     }
+    setup.setBeamerResolution(cv::Size(m.getWidth(), m.getHeight()));
 
     if(setup.setupProjection()){
         std::cout << "Cancel calibration" << std::endl;
diff --git a/app/SandboxSetup/mainwindow.ui b/app/SandboxSetup/mainwindow.ui
deleted file mode 100644
index fe361ad7db031a3af6caa2d4d3e2a1d962ba4b0c..0000000000000000000000000000000000000000
--- a/app/SandboxSetup/mainwindow.ui
+++ /dev/null
@@ -1,100 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>MainWindow</class>
- <widget class="QMainWindow" name="MainWindow">
-  <property name="geometry">
-   <rect>
-    <x>0</x>
-    <y>0</y>
-    <width>400</width>
-    <height>300</height>
-   </rect>
-  </property>
-  <property name="windowTitle">
-   <string>MainWindow</string>
-  </property>
-  <widget class="QWidget" name="centralWidget">
-   <widget class="QComboBox" name="cbxOutputs">
-    <property name="geometry">
-     <rect>
-      <x>50</x>
-      <y>40</y>
-      <width>141</width>
-      <height>25</height>
-     </rect>
-    </property>
-   </widget>
-   <widget class="QComboBox" name="cbxResolutions">
-    <property name="geometry">
-     <rect>
-      <x>50</x>
-      <y>130</y>
-      <width>181</width>
-      <height>25</height>
-     </rect>
-    </property>
-   </widget>
-   <widget class="QPushButton" name="btnOutputs">
-    <property name="geometry">
-     <rect>
-      <x>270</x>
-      <y>180</y>
-      <width>89</width>
-      <height>25</height>
-     </rect>
-    </property>
-    <property name="text">
-     <string>Valide</string>
-    </property>
-   </widget>
-   <widget class="QLabel" name="label">
-    <property name="geometry">
-     <rect>
-      <x>10</x>
-      <y>10</y>
-      <width>101</width>
-      <height>21</height>
-     </rect>
-    </property>
-    <property name="text">
-     <string>Choose output</string>
-    </property>
-   </widget>
-   <widget class="QLabel" name="label_2">
-    <property name="geometry">
-     <rect>
-      <x>10</x>
-      <y>100</y>
-      <width>131</width>
-      <height>17</height>
-     </rect>
-    </property>
-    <property name="text">
-     <string>Choose resolution</string>
-    </property>
-   </widget>
-  </widget>
-  <widget class="QMenuBar" name="menuBar">
-   <property name="geometry">
-    <rect>
-     <x>0</x>
-     <y>0</y>
-     <width>400</width>
-     <height>22</height>
-    </rect>
-   </property>
-  </widget>
-  <widget class="QToolBar" name="mainToolBar">
-   <attribute name="toolBarArea">
-    <enum>TopToolBarArea</enum>
-   </attribute>
-   <attribute name="toolBarBreak">
-    <bool>false</bool>
-   </attribute>
-  </widget>
-  <widget class="QStatusBar" name="statusBar"/>
- </widget>
- <layoutdefault spacing="6" margin="11"/>
- <resources/>
- <connections/>
-</ui>
diff --git a/app/SandboxSetup/mainwindow.cpp b/app/SandboxSetup/monitorgui.cpp
similarity index 77%
rename from app/SandboxSetup/mainwindow.cpp
rename to app/SandboxSetup/monitorgui.cpp
index 4522900f8642360a9502e424d833c23ee4ba2ed0..17c43a320f4622cc0ceab16c59ce4970fc02d917 100644
--- a/app/SandboxSetup/mainwindow.cpp
+++ b/app/SandboxSetup/monitorgui.cpp
@@ -1,22 +1,15 @@
-#include "mainwindow.h"
-#include "ui_mainwindow.h"
+#include "monitorgui.h"
+#include "ui_monitorgui.h"
 
-MainWindow::MainWindow(QWidget *parent) :
-    QMainWindow(parent),
-    ui(new Ui::MainWindow)
+MonitorGui::MonitorGui(QWidget *parent) :
+    QDialog(parent),
+    ui(new Ui::MonitorGui)
 {
     ui->setupUi(this);
 
     std::string path = ".monitors.tmp";
     monitors = std::map<std::string, std::vector<std::string>>();
-
-
-    // Save in file the monitors and their resolutions
-    system( ("xrandr -d :0 | sed -n '1!p' > " + path).c_str() );
-
-    loadResolutionsFromFile(path);
-
-
+    initMonitorMapWithFile(path);
     QList<QScreen*> screens = QApplication::screens();
 
     for(int i=0; i<screens.size(); i++){
@@ -27,25 +20,40 @@ MainWindow::MainWindow(QWidget *parent) :
     if(screens.size() > 0){
         loadResolutionsOf(screens[0]);
     }
-
-    std::remove(path.c_str());
-
 }
 
-MainWindow::~MainWindow()
+MonitorGui::~MonitorGui()
 {
     delete ui;
 }
 
-void MainWindow::on_cbxOutputs_currentIndexChanged(int index){
+void MonitorGui::on_cbxOutputs_currentIndexChanged(int index)
+{
     QList<QScreen*> screens = QApplication::screens();
     loadResolutionsOf(screens[index]);
 }
 
+void MonitorGui::on_btnbxMonitors_accepted()
+{
+    valideState = true;
+    QString selectedRes = ui->cbxResolutions->currentText();
+    std::vector<std::string> res = splitResolution(selectedRes.toStdString());
+    width = std::stoi(res[0]);
+    height = std::stoi(res[1]);
+}
+
+
 
+void MonitorGui::initMonitorMapWithFile(std::string path){
+
+    // Save in file the monitors and their resolutions
+    system( ("xrandr -d :0 | sed -n '1!p' > " + path).c_str() );
+    loadResolutionsFromFile(path);
+    std::remove(path.c_str());
+}
 
 // load resolutions into GUI
-void MainWindow::loadResolutionsOf(QScreen* sc){
+void MonitorGui::loadResolutionsOf(QScreen* sc){
     ui->cbxResolutions->clear();
     const char *key = sc->name().toStdString().c_str();
     std::vector<std::string> resolutions = monitors[key];
@@ -58,7 +66,7 @@ void MainWindow::loadResolutionsOf(QScreen* sc){
 
 // Get height and width from the string "_width_x_height_"
 // http://www.martinbroadhurst.com/how-to-split-a-string-in-c.html
-std::vector<std::string> MainWindow::splitResolution(std::string s){
+std::vector<std::string> MonitorGui::splitResolution(std::string s){
     char delim = 'x';
     std::vector<std::string> res;
     std::stringstream ss(s);
@@ -70,11 +78,11 @@ std::vector<std::string> MainWindow::splitResolution(std::string s){
     return res;
 }
 
-bool MainWindow::isResolution(std::string s){
+bool MonitorGui::isResolution(std::string s){
     return splitResolution(s).size() == 2;
 }
 
-void MainWindow::loadResolutionsFromFile(std::string path){
+void MonitorGui::loadResolutionsFromFile(std::string path){
     // Get monitors and their resolutions into a Map
     std::ifstream infile(path);
     std::string line;
@@ -94,13 +102,3 @@ void MainWindow::loadResolutionsFromFile(std::string path){
         }
     }
 }
-
-
-void MainWindow::on_btnOutputs_clicked()
-{
-    QString selectedRes = ui->cbxResolutions->currentText();
-    std::vector<std::string> res = splitResolution(selectedRes.toStdString());
-    width = std::stoi(res[0]);
-    height = std::stoi(res[1]);
-    this->close();
-}
diff --git a/app/SandboxSetup/mainwindow.h b/app/SandboxSetup/monitorgui.h
similarity index 54%
rename from app/SandboxSetup/mainwindow.h
rename to app/SandboxSetup/monitorgui.h
index 67067d3ead090e348e5b68c5a387a6ca1d91b341..c00d886ad6e7a6c4b3b264af537b169c320c5ab3 100644
--- a/app/SandboxSetup/mainwindow.h
+++ b/app/SandboxSetup/monitorgui.h
@@ -1,7 +1,7 @@
-#ifndef MAINWINDOW_H
-#define MAINWINDOW_H
+#ifndef MONITORGUI_H
+#define MONITORGUI_H
 
-#include <QMainWindow>
+#include <QDialog>
 #include <QtWidgets>
 #include <string>
 #include <sstream>
@@ -11,34 +11,36 @@
 #include <iostream>
 
 namespace Ui {
-class MainWindow;
+class MonitorGui;
 }
 
-class MainWindow : public QMainWindow
+class MonitorGui : public QDialog
 {
     Q_OBJECT
 
 public:
-    explicit MainWindow(QWidget *parent = 0);
-    ~MainWindow();
-    int getHeight(){ return height; }
-    int getWidth(){ return width; }
+    explicit MonitorGui(QWidget *parent = 0);
+    ~MonitorGui();
+
+    int getHeight(){ return height; };
+    int getWidth(){ return width; };
+    bool getState(){ return valideState; };
 
 private slots:
     void on_cbxOutputs_currentIndexChanged(int index);
-
-    void on_btnOutputs_clicked();
+    void on_btnbxMonitors_accepted();
 
 private:
-    Ui::MainWindow *ui;
+    Ui::MonitorGui *ui;
     int height = 0;
     int width = 0;
+    bool valideState = false;
     std::map<std::string, std::vector<std::string>> monitors;
     void loadResolutionsOf(QScreen* screen);
     std::vector<std::string> splitResolution(std::string s);
     bool isResolution(std::string s);
     void loadResolutionsFromFile(std::string path);
-
+    void initMonitorMapWithFile(std::string path);
 };
 
-#endif // MAINWINDOW_H
+#endif // MONITORGUI_H
diff --git a/app/SandboxSetup/monitorgui.ui b/app/SandboxSetup/monitorgui.ui
new file mode 100644
index 0000000000000000000000000000000000000000..2feee9db8b62dfde0bc15950531dee59c7161191
--- /dev/null
+++ b/app/SandboxSetup/monitorgui.ui
@@ -0,0 +1,114 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>MonitorGui</class>
+ <widget class="QDialog" name="MonitorGui">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>400</width>
+    <height>300</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>Dialog</string>
+  </property>
+  <widget class="QDialogButtonBox" name="btnbxMonitors">
+   <property name="geometry">
+    <rect>
+     <x>30</x>
+     <y>240</y>
+     <width>341</width>
+     <height>32</height>
+    </rect>
+   </property>
+   <property name="orientation">
+    <enum>Qt::Horizontal</enum>
+   </property>
+   <property name="standardButtons">
+    <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
+   </property>
+  </widget>
+  <widget class="QLabel" name="label">
+   <property name="geometry">
+    <rect>
+     <x>40</x>
+     <y>40</y>
+     <width>101</width>
+     <height>21</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>Choose output</string>
+   </property>
+  </widget>
+  <widget class="QComboBox" name="cbxOutputs">
+   <property name="geometry">
+    <rect>
+     <x>40</x>
+     <y>70</y>
+     <width>141</width>
+     <height>25</height>
+    </rect>
+   </property>
+  </widget>
+  <widget class="QLabel" name="label_2">
+   <property name="geometry">
+    <rect>
+     <x>40</x>
+     <y>130</y>
+     <width>131</width>
+     <height>17</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>Choose resolution</string>
+   </property>
+  </widget>
+  <widget class="QComboBox" name="cbxResolutions">
+   <property name="geometry">
+    <rect>
+     <x>40</x>
+     <y>160</y>
+     <width>181</width>
+     <height>25</height>
+    </rect>
+   </property>
+  </widget>
+ </widget>
+ <resources/>
+ <connections>
+  <connection>
+   <sender>btnbxMonitors</sender>
+   <signal>accepted()</signal>
+   <receiver>MonitorGui</receiver>
+   <slot>accept()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>248</x>
+     <y>254</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>157</x>
+     <y>274</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>btnbxMonitors</sender>
+   <signal>rejected()</signal>
+   <receiver>MonitorGui</receiver>
+   <slot>reject()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>316</x>
+     <y>260</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>286</x>
+     <y>274</y>
+    </hint>
+   </hints>
+  </connection>
+ </connections>
+</ui>