mirror of
https://github.com/kunkundi/crossdesk.git
synced 2025-10-28 20:06:14 +08:00
Compare commits
7 Commits
v1.0.1-bet
...
911dce2e71
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
911dce2e71 | ||
|
|
9f80d4f69d | ||
|
|
cba644f055 | ||
|
|
f733fe9e49 | ||
|
|
27263fe1db | ||
|
|
698bf72a6c | ||
|
|
b2ab940f20 |
2
.github/workflows/close-issue.yml
vendored
2
.github/workflows/close-issue.yml
vendored
@@ -63,3 +63,5 @@ jobs:
|
||||
console.log(`Skipping issue #${issue.number} (Active within 7 days).`);
|
||||
}
|
||||
}
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
@@ -453,10 +453,10 @@ int Render::CreateConnectionPeer() {
|
||||
sizeof(params_.turn_server_ip) - 1);
|
||||
params_.turn_server_ip[sizeof(params_.turn_server_ip) - 1] = '\0';
|
||||
params_.turn_server_port = 3478;
|
||||
strncpy((char*)params_.turn_server_username, "dijunkun",
|
||||
strncpy((char*)params_.turn_server_username, "crossdesk",
|
||||
sizeof(params_.turn_server_username) - 1);
|
||||
params_.turn_server_username[sizeof(params_.turn_server_username) - 1] = '\0';
|
||||
strncpy((char*)params_.turn_server_password, "dijunkunpw",
|
||||
strncpy((char*)params_.turn_server_password, "crossdeskpw",
|
||||
sizeof(params_.turn_server_password) - 1);
|
||||
params_.turn_server_password[sizeof(params_.turn_server_password) - 1] = '\0';
|
||||
strncpy(params_.tls_cert_path, server_cert_path.c_str(),
|
||||
|
||||
@@ -458,6 +458,7 @@ class Render {
|
||||
bool self_hosted_server_config_window_pos_reset_ = true;
|
||||
std::string selected_current_file_path_ = "";
|
||||
std::string selected_file_ = "";
|
||||
bool show_file_browser_ = true;
|
||||
/* ------ main window property end ------ */
|
||||
|
||||
/* ------ sub stream window property start ------ */
|
||||
|
||||
@@ -28,6 +28,11 @@ std::vector<std::string> GetRootEntries() {
|
||||
|
||||
int Render::ShowSimpleFileBrowser() {
|
||||
std::string display_text;
|
||||
|
||||
if (selected_current_file_path_.empty()) {
|
||||
selected_current_file_path_ = std::filesystem::current_path().string();
|
||||
}
|
||||
|
||||
if (!selected_file_.empty()) {
|
||||
display_text = std::filesystem::path(selected_file_).filename().string();
|
||||
} else if (selected_current_file_path_ != "Root") {
|
||||
@@ -43,11 +48,21 @@ int Render::ShowSimpleFileBrowser() {
|
||||
localization::select_a_file[localization_language_index_].c_str();
|
||||
}
|
||||
|
||||
if (ImGui::BeginCombo("##select_a_file", display_text.c_str())) {
|
||||
if (show_file_browser_) {
|
||||
ImGui::PushItemFlag(ImGuiItemFlags_AutoClosePopups, false);
|
||||
|
||||
float fixed_width = 130.0f;
|
||||
ImGui::SetNextItemWidth(fixed_width);
|
||||
ImGui::SetNextWindowSizeConstraints(ImVec2(fixed_width, 0),
|
||||
ImVec2(fixed_width, 100.0f));
|
||||
|
||||
if (ImGui::BeginCombo("##select_a_file", display_text.c_str(), 0)) {
|
||||
bool file_selected = false;
|
||||
|
||||
auto roots = GetRootEntries();
|
||||
if (selected_current_file_path_ == "Root" ||
|
||||
!std::filesystem::exists(selected_current_file_path_) ||
|
||||
!std::filesystem::is_directory(selected_current_file_path_)) {
|
||||
auto roots = GetRootEntries();
|
||||
for (const auto& root : roots) {
|
||||
if (ImGui::Selectable(root.c_str())) {
|
||||
selected_current_file_path_ = root;
|
||||
@@ -58,16 +73,20 @@ int Render::ShowSimpleFileBrowser() {
|
||||
std::filesystem::path p(selected_current_file_path_);
|
||||
|
||||
if (ImGui::Selectable("..")) {
|
||||
if (p.has_parent_path() && p != p.root_path())
|
||||
selected_current_file_path_ = p.parent_path().string();
|
||||
else
|
||||
if (std::find(roots.begin(), roots.end(),
|
||||
selected_current_file_path_) != roots.end()) {
|
||||
selected_current_file_path_ = "Root";
|
||||
} else if (p.has_parent_path()) {
|
||||
selected_current_file_path_ = p.parent_path().string();
|
||||
} else {
|
||||
selected_current_file_path_ = "Root";
|
||||
}
|
||||
selected_file_.clear();
|
||||
}
|
||||
|
||||
try {
|
||||
for (const auto& entry :
|
||||
std::filesystem::directory_iterator(selected_current_file_path_)) {
|
||||
for (const auto& entry : std::filesystem::directory_iterator(
|
||||
selected_current_file_path_)) {
|
||||
std::string name = entry.path().filename().string();
|
||||
if (entry.is_directory()) {
|
||||
if (ImGui::Selectable(name.c_str())) {
|
||||
@@ -77,6 +96,8 @@ int Render::ShowSimpleFileBrowser() {
|
||||
} else {
|
||||
if (ImGui::Selectable(name.c_str())) {
|
||||
selected_file_ = entry.path().string();
|
||||
file_selected = true;
|
||||
show_file_browser_ = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -87,6 +108,10 @@ int Render::ShowSimpleFileBrowser() {
|
||||
|
||||
ImGui::EndCombo();
|
||||
}
|
||||
ImGui::PopItemFlag();
|
||||
} else {
|
||||
show_file_browser_ = true;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user