|
1 |
| - |
2 |
| - |
3 |
| -# **Simple file dialog C++ library** |
4 |
| - |
5 |
| -**v1.0.0** |
6 |
| - |
7 |
| ------- |
8 |
| - |
9 |
| -# Overview |
10 |
| - |
11 |
| -**SimpleFileDialog** C++ library provides simple dialog to chose file in Windows and Linux (tested for Ubuntu 22.04, 22.10 and Windows 11). The library used in projects when simple file chose dialog needed. To provide dialog in Linux the library calls "**zenity**" application. The library doesn't have third-party dependencies. **SimpleFileDialog.h** file includes declaration of **SimpleFileDialog** class. **SimpleFileDialog** class includes only one simple static method **dialod()**; |
12 |
| - |
13 |
| -# Versions |
14 |
| - |
15 |
| -**Table 1** - Library versions. |
16 |
| - |
17 |
| -| Version | Release date | What's new | |
18 |
| -| ------- | ------------ | -------------- | |
19 |
| -| 1.0.0 | 20.07.2023 | First version. | |
20 |
| - |
21 |
| -# Class description |
22 |
| - |
23 |
| -**SimpleDileDialog** class declared in **SimpleFileDialog.h** file. Class declaration: |
24 |
| - |
25 |
| -```cpp |
26 |
| -namespace cr |
27 |
| -{ |
28 |
| -namespace utils |
29 |
| -{ |
30 |
| -/// @brief File dialog class. |
31 |
| -class SimpleFileDialog |
32 |
| -{ |
33 |
| -public: |
34 |
| - /// @brief Dialog function. |
35 |
| - static std::string dialog(); |
36 |
| -}; |
37 |
| -} |
38 |
| -} |
39 |
| -``` |
40 |
| - |
41 |
| -**SimpleFileDialog** class includes only one static method **dialog()** which shows file chose dialog to user. Method used without **SimpleFileDialog** class instance. Example: |
42 |
| - |
43 |
| -```cpp |
44 |
| -#include <iostream> |
45 |
| -#include "SimpleFileDialog.h" |
46 |
| - |
47 |
| -int main(void) |
48 |
| -{ |
49 |
| - // Open file dialog. |
50 |
| - std::string file = cr::utils::SimpleFileDialog::dialog(); |
51 |
| - std::cout << "File: " << file << std::endl; |
52 |
| - |
53 |
| - return -1; |
54 |
| -} |
55 |
| -``` |
56 |
| -
|
57 |
| -# Build and connect to your project |
58 |
| -
|
59 |
| -Typical commands to build **SimpleFileDialog** library: |
60 |
| -
|
61 |
| -```bash |
62 |
| -git clone https://github.com/ConstantRobotics-Ltd/SimpleFileDialog.git |
63 |
| -cd SimpleFileDialog |
64 |
| -mkdir build |
65 |
| -cd build |
66 |
| -cmake .. |
67 |
| -make |
68 |
| -``` |
69 |
| - |
70 |
| -If you want connect **SimpleFileDialog** library to your CMake project as source code you can make follow. For example, if your repository has structure: |
71 |
| - |
72 |
| -```bash |
73 |
| -CMakeLists.txt |
74 |
| -src |
75 |
| - CMakeList.txt |
76 |
| - yourLib.h |
77 |
| - yourLib.cpp |
78 |
| -``` |
79 |
| - |
80 |
| -You can add repository **SimpleFileDialog** as submodule by commands: |
81 |
| - |
82 |
| -```bash |
83 |
| -cd <your respository folder> |
84 |
| -git submodule add https://github.com/ConstantRobotics-Ltd/SimpleFileDialog.git 3rdparty/SimpleFileDialog |
85 |
| -``` |
86 |
| - |
87 |
| -In you repository folder will be created folder **3rdparty/SimpleFileDialog** which contains all library files. New structure of your repository: |
88 |
| - |
89 |
| -```bash |
90 |
| -CMakeLists.txt |
91 |
| -src |
92 |
| - CMakeList.txt |
93 |
| - yourLib.h |
94 |
| - yourLib.cpp |
95 |
| -3rdparty |
96 |
| - SimpleFileDialog |
97 |
| -``` |
98 |
| - |
99 |
| -Create CMakeLists.txt file in **3rdparty** folder. CMakeLists.txt should contain: |
100 |
| - |
101 |
| -```cmake |
102 |
| -cmake_minimum_required(VERSION 3.13) |
103 |
| -
|
104 |
| -################################################################################ |
105 |
| -## 3RD-PARTY |
106 |
| -## dependencies for the project |
107 |
| -################################################################################ |
108 |
| -project(3rdparty LANGUAGES CXX) |
109 |
| -
|
110 |
| -################################################################################ |
111 |
| -## SETTINGS |
112 |
| -## basic 3rd-party settings before use |
113 |
| -################################################################################ |
114 |
| -# To inherit the top-level architecture when the project is used as a submodule. |
115 |
| -SET(PARENT ${PARENT}_YOUR_PROJECT_3RDPARTY) |
116 |
| -# Disable self-overwriting of parameters inside included subdirectories. |
117 |
| -SET(${PARENT}_SUBMODULE_CACHE_OVERWRITE OFF CACHE BOOL "" FORCE) |
118 |
| -
|
119 |
| -################################################################################ |
120 |
| -## CONFIGURATION |
121 |
| -## 3rd-party submodules configuration |
122 |
| -################################################################################ |
123 |
| -SET(${PARENT}_SUBMODULE_SIMPLE_FILE_DIALOG ON CACHE BOOL "" FORCE) |
124 |
| -if (${PARENT}_SUBMODULE_SIMPLE_FILE_DIALOG) |
125 |
| - SET(${PARENT}_SIMPLE_FILE_DIALOG ON CACHE BOOL "" FORCE) |
126 |
| - SET(${PARENT}_SIMPLE_FILE_DIALOG_TEST OFF CACHE BOOL "" FORCE) |
127 |
| -endif() |
128 |
| -
|
129 |
| -################################################################################ |
130 |
| -## INCLUDING SUBDIRECTORIES |
131 |
| -## Adding subdirectories according to the 3rd-party configuration |
132 |
| -################################################################################ |
133 |
| -if (${PARENT}_SUBMODULE_SIMPLE_FILE_DIALOG) |
134 |
| - add_subdirectory(SimpleFileDialog) |
135 |
| -endif() |
136 |
| -``` |
137 |
| - |
138 |
| -File **3rdparty/CMakeLists.txt** adds folder **SimpleFileDialog** to your project and excludes test application (SimpleFileDialog class test applications) from compiling. Your repository new structure will be: |
139 |
| - |
140 |
| -```bash |
141 |
| -CMakeLists.txt |
142 |
| -src |
143 |
| - CMakeList.txt |
144 |
| - yourLib.h |
145 |
| - yourLib.cpp |
146 |
| -3rdparty |
147 |
| - CMakeLists.txt |
148 |
| - SimpleFileDialog |
149 |
| -``` |
150 |
| - |
151 |
| -Next you need include folder 3rdparty in main **CMakeLists.txt** file of your repository. Add string at the end of your main **CMakeLists.txt**: |
152 |
| - |
153 |
| -```cmake |
154 |
| -add_subdirectory(3rdparty) |
155 |
| -``` |
156 |
| - |
157 |
| -Next you have to include SimpleFileDialog library in your **src/CMakeLists.txt** file: |
158 |
| - |
159 |
| -```cmake |
160 |
| -target_link_libraries(${PROJECT_NAME} SimpleFileDialog) |
161 |
| -``` |
162 |
| - |
163 |
| -Done! |
| 1 | + |
| 2 | + |
| 3 | + |
| 4 | + |
| 5 | +# **Simple file dialog C++ library** |
| 6 | + |
| 7 | +**v1.0.1** |
| 8 | + |
| 9 | + |
| 10 | + |
| 11 | +# Overview |
| 12 | + |
| 13 | +**SimpleFileDialog** C++ library provides simple dialog to chose file in Windows and Linux (tested for Ubuntu 22.04, 22.10 and Windows 11). The library used in projects when simple file chose dialog needed. To provide dialog in Linux the library calls "**zenity**" application. The library doesn't have third-party dependencies. **SimpleFileDialog.h** file includes declaration of **SimpleFileDialog** class. **SimpleFileDialog** class includes only one simple static method **dialod()**; |
| 14 | + |
| 15 | + |
| 16 | + |
| 17 | +# Versions |
| 18 | + |
| 19 | +**Table 1** - Library versions. |
| 20 | + |
| 21 | +| Version | Release date | What's new | |
| 22 | +| ------- | ------------ | ---------------------------------------------- | |
| 23 | +| 1.0.0 | 20.07.2023 | First version. | |
| 24 | +| 1.0.1 | 02.08.2023 | - Fixed std::string compiling error for Linux. | |
| 25 | + |
| 26 | + |
| 27 | + |
| 28 | +# Class description |
| 29 | + |
| 30 | +**SimpleDileDialog** class declared in **SimpleFileDialog.h** file. Class declaration: |
| 31 | + |
| 32 | +```cpp |
| 33 | +namespace cr |
| 34 | +{ |
| 35 | +namespace utils |
| 36 | +{ |
| 37 | +/// @brief File dialog class. |
| 38 | +class SimpleFileDialog |
| 39 | +{ |
| 40 | +public: |
| 41 | + /// @brief Dialog function. |
| 42 | + static std::string dialog(); |
| 43 | +}; |
| 44 | +} |
| 45 | +} |
| 46 | +``` |
| 47 | + |
| 48 | +**SimpleFileDialog** class includes only one static method **dialog()** which shows file chose dialog to user. Method used without **SimpleFileDialog** class instance. Example: |
| 49 | + |
| 50 | +```cpp |
| 51 | +#include <iostream> |
| 52 | +#include "SimpleFileDialog.h" |
| 53 | + |
| 54 | +int main(void) |
| 55 | +{ |
| 56 | + // Open file dialog. |
| 57 | + std::string file = cr::utils::SimpleFileDialog::dialog(); |
| 58 | + std::cout << "File: " << file << std::endl; |
| 59 | + |
| 60 | + return -1; |
| 61 | +} |
| 62 | +``` |
| 63 | +
|
| 64 | +
|
| 65 | +
|
| 66 | +# Build and connect to your project |
| 67 | +
|
| 68 | +Typical commands to build **SimpleFileDialog** library: |
| 69 | +
|
| 70 | +```bash |
| 71 | +git clone https://github.com/ConstantRobotics-Ltd/SimpleFileDialog.git |
| 72 | +cd SimpleFileDialog |
| 73 | +mkdir build |
| 74 | +cd build |
| 75 | +cmake .. |
| 76 | +make |
| 77 | +``` |
| 78 | + |
| 79 | +If you want connect **SimpleFileDialog** library to your CMake project as source code you can make follow. For example, if your repository has structure: |
| 80 | + |
| 81 | +```bash |
| 82 | +CMakeLists.txt |
| 83 | +src |
| 84 | + CMakeList.txt |
| 85 | + yourLib.h |
| 86 | + yourLib.cpp |
| 87 | +``` |
| 88 | + |
| 89 | +You can add repository **SimpleFileDialog** as submodule by commands: |
| 90 | + |
| 91 | +```bash |
| 92 | +cd <your respository folder> |
| 93 | +git submodule add https://github.com/ConstantRobotics-Ltd/SimpleFileDialog.git 3rdparty/SimpleFileDialog |
| 94 | +``` |
| 95 | + |
| 96 | +In you repository folder will be created folder **3rdparty/SimpleFileDialog** which contains all library files. New structure of your repository: |
| 97 | + |
| 98 | +```bash |
| 99 | +CMakeLists.txt |
| 100 | +src |
| 101 | + CMakeList.txt |
| 102 | + yourLib.h |
| 103 | + yourLib.cpp |
| 104 | +3rdparty |
| 105 | + SimpleFileDialog |
| 106 | +``` |
| 107 | + |
| 108 | +Create CMakeLists.txt file in **3rdparty** folder. CMakeLists.txt should contain: |
| 109 | + |
| 110 | +```cmake |
| 111 | +cmake_minimum_required(VERSION 3.13) |
| 112 | +
|
| 113 | +################################################################################ |
| 114 | +## 3RD-PARTY |
| 115 | +## dependencies for the project |
| 116 | +################################################################################ |
| 117 | +project(3rdparty LANGUAGES CXX) |
| 118 | +
|
| 119 | +################################################################################ |
| 120 | +## SETTINGS |
| 121 | +## basic 3rd-party settings before use |
| 122 | +################################################################################ |
| 123 | +# To inherit the top-level architecture when the project is used as a submodule. |
| 124 | +SET(PARENT ${PARENT}_YOUR_PROJECT_3RDPARTY) |
| 125 | +# Disable self-overwriting of parameters inside included subdirectories. |
| 126 | +SET(${PARENT}_SUBMODULE_CACHE_OVERWRITE OFF CACHE BOOL "" FORCE) |
| 127 | +
|
| 128 | +################################################################################ |
| 129 | +## CONFIGURATION |
| 130 | +## 3rd-party submodules configuration |
| 131 | +################################################################################ |
| 132 | +SET(${PARENT}_SUBMODULE_SIMPLE_FILE_DIALOG ON CACHE BOOL "" FORCE) |
| 133 | +if (${PARENT}_SUBMODULE_SIMPLE_FILE_DIALOG) |
| 134 | + SET(${PARENT}_SIMPLE_FILE_DIALOG ON CACHE BOOL "" FORCE) |
| 135 | + SET(${PARENT}_SIMPLE_FILE_DIALOG_TEST OFF CACHE BOOL "" FORCE) |
| 136 | +endif() |
| 137 | +
|
| 138 | +################################################################################ |
| 139 | +## INCLUDING SUBDIRECTORIES |
| 140 | +## Adding subdirectories according to the 3rd-party configuration |
| 141 | +################################################################################ |
| 142 | +if (${PARENT}_SUBMODULE_SIMPLE_FILE_DIALOG) |
| 143 | + add_subdirectory(SimpleFileDialog) |
| 144 | +endif() |
| 145 | +``` |
| 146 | + |
| 147 | +File **3rdparty/CMakeLists.txt** adds folder **SimpleFileDialog** to your project and excludes test application (SimpleFileDialog class test applications) from compiling. Your repository new structure will be: |
| 148 | + |
| 149 | +```bash |
| 150 | +CMakeLists.txt |
| 151 | +src |
| 152 | + CMakeList.txt |
| 153 | + yourLib.h |
| 154 | + yourLib.cpp |
| 155 | +3rdparty |
| 156 | + CMakeLists.txt |
| 157 | + SimpleFileDialog |
| 158 | +``` |
| 159 | + |
| 160 | +Next you need include folder 3rdparty in main **CMakeLists.txt** file of your repository. Add string at the end of your main **CMakeLists.txt**: |
| 161 | + |
| 162 | +```cmake |
| 163 | +add_subdirectory(3rdparty) |
| 164 | +``` |
| 165 | + |
| 166 | +Next you have to include SimpleFileDialog library in your **src/CMakeLists.txt** file: |
| 167 | + |
| 168 | +```cmake |
| 169 | +target_link_libraries(${PROJECT_NAME} SimpleFileDialog) |
| 170 | +``` |
| 171 | + |
| 172 | +Done! |
0 commit comments