|
16 | 16 | #include <utility/gamepad.h> |
17 | 17 | #include "../../version.h" |
18 | 18 | #include <tabs/common_ui.h> |
| 19 | +#include <ImGuiNotify.hpp> |
19 | 20 | #include <set> |
20 | 21 |
|
21 | 22 | extern bool allowShortcutCtrlA; |
@@ -100,13 +101,76 @@ SKIF_UI_Tab_DrawSettings (void) |
100 | 101 | ImGuiCol_Text, ImGui::GetStyleColorVec4(ImGuiCol_SKIF_TextBase) |
101 | 102 | ); |
102 | 103 | SKIF_ImGui_Spacing ( ); |
| 104 | + |
| 105 | + static float folderPosX = 0.0f; |
| 106 | + |
| 107 | + ImGui::TextColored ( |
| 108 | + ImGui::GetStyleColorVec4(ImGuiCol_SKIF_TextCaption), |
| 109 | + "Name Pattern: " |
| 110 | + ); |
| 111 | + |
| 112 | + constexpr int maxChars = 50; |
| 113 | + static char pattern[maxChars] = {}; |
| 114 | + static bool warnNonUnique = false; |
| 115 | + bool savePattern = false; |
| 116 | + |
| 117 | + SK_RunOnce (strncpy_s (pattern, maxChars, SK_WideCharToUTF8 (_registry.wsScreenshotsPattern).data(), _TRUNCATE)); |
103 | 118 |
|
104 | | - |
| 119 | + ImGui::SameLine ( ); |
| 120 | + ImGui::SetCursorPosX(folderPosX); |
| 121 | + |
| 122 | + if (ImGui::InputTextEx ("###PatternInput", "<app>_<date>_<time>", pattern, maxChars, ImVec2(250.0f * SKIF_ImGui_GlobalDPIScale, 0.0f), ImGuiInputTextFlags_EnterReturnsTrue)) |
| 123 | + savePattern = true; |
| 124 | + |
| 125 | + if (! ImGui::IsItemActive ()) |
| 126 | + { |
| 127 | + if (pattern[0] == '\0') |
| 128 | + strncpy (pattern, "<app>_<date>_<time>", maxChars); |
| 129 | + } |
| 130 | + else if (ImGui::GetIO().KeyCtrl && ImGui::GetKeyData(ImGuiKey_S)->DownDuration == 0.0f) |
| 131 | + { |
| 132 | + savePattern = true; |
| 133 | + |
| 134 | + if (pattern[0] == '\0') |
| 135 | + ImGui::SetWindowFocus (NULL); |
| 136 | + } |
| 137 | + |
| 138 | + ImGui::SameLine ( ); |
| 139 | + |
| 140 | + ImGui::PushStyleColor (ImGuiCol_Text, ImGui::GetStyleColorVec4 (ImGuiCol_SKIF_Success)); |
| 141 | + if (ImGui::Button (ICON_FA_FLOPPY_DISK)) |
| 142 | + savePattern = true; |
| 143 | + ImGui::PopStyleColor (); |
| 144 | + |
| 145 | + if (savePattern) |
| 146 | + { |
| 147 | + savePattern = false; |
| 148 | + |
| 149 | + if (pattern[0] == '\0') |
| 150 | + strncpy (pattern, "<app>_<date>_<time>", maxChars); |
| 151 | + |
| 152 | + StrTrimA (pattern, " \t\r\n"); |
| 153 | + _registry.wsScreenshotsPattern = SK_UTF8ToWideChar (pattern); |
| 154 | + _registry.regKVScreenshotsPattern.putData (_registry.wsScreenshotsPattern); |
| 155 | + |
| 156 | + ImGui::InsertNotification ({ ImGuiToastType::Success, 1000, "Saved", ""}); |
| 157 | + } |
| 158 | + |
| 159 | + if ((StrStrA (pattern, "<app>") == NULL && StrStrA (pattern, "<date>") == NULL && StrStrA (pattern, "<time>") == NULL)) |
| 160 | + { |
| 161 | + ImGui::TextColored (ImGui::GetStyleColorVec4 (ImGuiCol_SKIF_Yellow), ICON_FA_TRIANGLE_EXCLAMATION); |
| 162 | + ImGui::SameLine ( ); |
| 163 | + ImGui::Text ("Missing <app>, <date>, and <time>. Any captured shot will overwrite the existing file!"); |
| 164 | + } |
| 165 | + |
| 166 | + ImGui::Spacing (); |
| 167 | + |
105 | 168 | ImGui::TextColored ( |
106 | 169 | ImGui::GetStyleColorVec4(ImGuiCol_SKIF_TextCaption), |
107 | 170 | "Screenshots Folder: " |
108 | 171 | ); |
109 | 172 | ImGui::SameLine ( ); |
| 173 | + folderPosX = ImGui::GetCursorPosX(); |
110 | 174 | if (ImGui::Selectable(_path_cache.skiv_screenshotsA)) |
111 | 175 | { |
112 | 176 | std::wstring newPath = SKIF_Util_FileExplorer_BrowseForFolder (_path_cache.skiv_screenshots); |
|
0 commit comments