From 63fb6ad59dbdf6dfd6ae4e183c23444856897a88 Mon Sep 17 00:00:00 2001 From: Pedro Bianchini de Quadros Date: Mon, 25 Dec 2023 21:21:46 -0300 Subject: [PATCH] =?UTF-8?q?Corre=C3=A7=C3=A3o?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CMakeLists.txt | 4 ++-- CopyFiles.cmake | 3 +++ gui/MainWindow.cpp | 2 +- options/ReaderFacesInFolder.cpp | 4 ++-- util/FolderManagment.cpp | 5 +++++ util/FolderManagment.hpp | 1 + 6 files changed, 14 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a335008..a8ff33e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,8 +3,8 @@ project(OpenCV_Learn) set(CMAKE_CXX_STANDARD 17) -# include(CopyFiles.cmake) -# copy_files_to_destination() +include(CopyFiles.cmake) +copy_files_to_destination() # Adiciona as flags de compilação add_compile_options(-Wall -g -MMD) diff --git a/CopyFiles.cmake b/CopyFiles.cmake index b8e8e39..a82318a 100644 --- a/CopyFiles.cmake +++ b/CopyFiles.cmake @@ -25,6 +25,7 @@ function(copy_files_to_destination) # Caminho completo para o arquivo config.ini dentro de .visualisador-rostos set(CONFIG_FILE "${HIDDEN_FOLDER_PATH}/config.ini") + set(IMAGE_FILE "${HIDDEN_FOLDER_PATH}/id-do-rosto.ico") # Verifica se a pasta oculta já existe file(MAKE_DIRECTORY ${HIDDEN_FOLDER_PATH} EXIST_OK ERROR_VARIABLE MAKE_DIRECTORY_ERROR) @@ -38,8 +39,10 @@ function(copy_files_to_destination) # Copia o arquivo config.ini para o diretório desejado configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.ini "${CONFIG_FILE}" COPYONLY) + configure_file(${CMAKE_CURRENT_SOURCE_DIR}/id-do-rosto.ico "${IMAGE_FILE}" COPYONLY) message(STATUS "Subpastas 'model' e 'img' copiadas para: ${HIDDEN_FOLDER_PATH}") message(STATUS "Arquivo 'config.ini' copiado para: ${HIDDEN_FOLDER_PATH}") + message(STATUS "Arquivo 'id-do-rosto.ico' copiado para: ${HIDDEN_FOLDER_PATH}") endif() endfunction() \ No newline at end of file diff --git a/gui/MainWindow.cpp b/gui/MainWindow.cpp index 8b3ed74..f7e3822 100644 --- a/gui/MainWindow.cpp +++ b/gui/MainWindow.cpp @@ -38,7 +38,7 @@ void MainWindow::draw_widgets() { set_title("Leitor de rostos"); set_default_size(300, 400); - const std::string icon_path = "../id-do-rosto.ico"; + const std::string icon_path = FolderManagment::get_image_ico(); set_icon_from_file(icon_path); // Fixed diff --git a/options/ReaderFacesInFolder.cpp b/options/ReaderFacesInFolder.cpp index 6afe1d0..26f449f 100644 --- a/options/ReaderFacesInFolder.cpp +++ b/options/ReaderFacesInFolder.cpp @@ -18,8 +18,8 @@ namespace ReaderFacesFolder { int maxHeight = 1200; // Paths - string folder_img_path = "../"; - string classifier_path = "../model/"; + string folder_img_path = FolderManagment::get_img_folder(); + string classifier_path = FolderManagment::get_model_folder() + "/"; if (readConfig["Images"]["Folder_path"].find('/') == 0) { // Pegando pela raiz do cliente diff --git a/util/FolderManagment.cpp b/util/FolderManagment.cpp index d70372f..0816da7 100644 --- a/util/FolderManagment.cpp +++ b/util/FolderManagment.cpp @@ -19,6 +19,11 @@ std::string FolderManagment::get_config_file() { return home_folder + "/config.ini"; } +std::string FolderManagment::get_image_ico() { + auto home_folder = get_home_folder(); + return home_folder + "/id-do-rosto.ico"; +} + std::string FolderManagment::get_home_folder() { std::string homeDir = getenv("HOME"); diff --git a/util/FolderManagment.hpp b/util/FolderManagment.hpp index 09259e5..f707956 100644 --- a/util/FolderManagment.hpp +++ b/util/FolderManagment.hpp @@ -15,6 +15,7 @@ class FolderManagment { static std::string get_model_folder(); static std::string get_img_folder(); static std::string get_config_file(); + static std::string get_image_ico(); static std::string get_home_folder(); };