mirror of
https://github.com/kunkundi/crossdesk.git
synced 2025-10-26 20:25:34 +08:00
Add about window
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -59,6 +59,8 @@ static std::vector<std::string> p2p_disconnected = {u8"对等连接已断开",
|
||||
static std::vector<std::string> p2p_connecting = {u8"正在建立对等连接",
|
||||
"P2P Connecting"};
|
||||
|
||||
static std::vector<std::string> about = {u8"关于", "About"};
|
||||
|
||||
} // namespace localization
|
||||
|
||||
#endif
|
||||
@@ -1,4 +1,6 @@
|
||||
#include "IconsFontAwesome6.h"
|
||||
#include "layout_style.h"
|
||||
#include "localization.h"
|
||||
#include "rd_log.h"
|
||||
#include "render.h"
|
||||
|
||||
@@ -15,11 +17,10 @@ int Render::MenuWindow() {
|
||||
if (ImGui::BeginMenuBar()) {
|
||||
if (ImGui::BeginMenu(ICON_FA_BARS, true)) {
|
||||
ImGui::SetWindowFontScale(0.5f);
|
||||
ImGui::MenuItem("Auto-resizing window", NULL, &a);
|
||||
ImGui::MenuItem("Constrained-resizing window", NULL, &b);
|
||||
ImGui::MenuItem("Fullscreen window", NULL, &c);
|
||||
ImGui::MenuItem("Long text display", NULL, &d);
|
||||
ImGui::MenuItem("Manipulating window titles", NULL, &e);
|
||||
if (ImGui::MenuItem(
|
||||
localization::about[localization_language_index_].c_str())) {
|
||||
show_about_window_ = true;
|
||||
}
|
||||
ImGui::SetWindowFontScale(1.0f);
|
||||
ImGui::EndMenu();
|
||||
}
|
||||
@@ -27,10 +28,47 @@ int Render::MenuWindow() {
|
||||
ImGui::Dummy(ImVec2(main_window_width_ - 97, 0));
|
||||
|
||||
SettingButton();
|
||||
|
||||
if (show_about_window_) {
|
||||
AboutWindow();
|
||||
}
|
||||
}
|
||||
|
||||
ImGui::PopStyleColor();
|
||||
ImGui::EndChild();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int Render::AboutWindow() {
|
||||
const ImGuiViewport *viewport = ImGui::GetMainViewport();
|
||||
|
||||
ImGui::SetNextWindowPos(ImVec2(
|
||||
(viewport->WorkSize.x - viewport->WorkPos.x - about_window_width_) / 2,
|
||||
(viewport->WorkSize.y - viewport->WorkPos.y - about_window_height_) / 2));
|
||||
|
||||
ImGui::SetNextWindowSize(ImVec2(about_window_width_, about_window_height_));
|
||||
|
||||
// ImGui::PushStyleColor(ImGuiCol_WindowBg, ImVec4(1.0, 1.0, 1.0, 1.0));
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowBorderSize, 1.0f);
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, 5.0f);
|
||||
ImGui::Begin(localization::about[localization_language_index_].c_str(),
|
||||
nullptr,
|
||||
ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoCollapse |
|
||||
ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoSavedSettings);
|
||||
ImGui::SetWindowFontScale(0.6f);
|
||||
std::string text = "Version 0.0.1";
|
||||
ImGui::Text("%s", text.c_str());
|
||||
|
||||
ImGui::SetCursorPosX(about_window_width_ * 0.4f);
|
||||
ImGui::SetCursorPosY(about_window_height_ * 0.75f);
|
||||
// OK
|
||||
if (ImGui::Button(localization::ok[localization_language_index_].c_str())) {
|
||||
show_about_window_ = false;
|
||||
}
|
||||
|
||||
ImGui::SetWindowFontScale(1.0f);
|
||||
ImGui::End();
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -38,6 +38,7 @@ class Render {
|
||||
int ControlWindow();
|
||||
int ControlBar();
|
||||
int MenuWindow();
|
||||
int AboutWindow();
|
||||
int StatusBar();
|
||||
int ConnectionStatusWindow();
|
||||
|
||||
@@ -135,6 +136,8 @@ class Render {
|
||||
int connection_status_window_height_ = 150;
|
||||
int notification_window_width_ = 200;
|
||||
int notification_window_height_ = 80;
|
||||
int about_window_width_ = 200;
|
||||
int about_window_height_ = 150;
|
||||
|
||||
int main_window_width_real_ = 960;
|
||||
int main_window_height_real_ = 540;
|
||||
@@ -172,6 +175,7 @@ class Render {
|
||||
bool password_inited_ = false;
|
||||
bool regenerate_password_ = false;
|
||||
bool streaming_ = false;
|
||||
bool show_about_window_ = false;
|
||||
|
||||
double copy_start_time_ = 0;
|
||||
double regenerate_password_start_time_ = 0;
|
||||
|
||||
Reference in New Issue
Block a user