Preferences dialog redesign / improvements / fixes (#10665)

* init

* update

* update

* update

* update

* tooltips

* update

* fix tab colors

* update

* Update Preferences.cpp

* Update Preferences.cpp

* Update Preferences.cpp

* Update Preferences.cpp

* update "Auto backup" and "Downloads folder"

* cleanup

* update

* update

* update

* update

* update

* update

* Update Preferences.cpp

* update

* update

* update

* update

* Update MainFrame.cpp

* Update text.js

* log level selection

* move NetworkTestDialog to cpp

* Update Preferences.cpp

* Update Preferences.hpp

* cleanup create_item_switch

---------

Co-authored-by: Noisyfox <timemanager.rick@gmail.com>
This commit is contained in:
yw4z
2025-10-15 12:34:08 +03:00
committed by GitHub
parent 4e79527bf8
commit 0493ed03a5
24 changed files with 1267 additions and 1013 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -4,7 +4,6 @@
#include "GUI.hpp"
#include "GUI_Utils.hpp"
#include <wx/simplebook.h>
#include <wx/dialog.h>
#include <wx/timer.h>
#include <vector>
@@ -13,48 +12,23 @@
#include "Widgets/ComboBox.hpp"
#include "Widgets/CheckBox.hpp"
#include "Widgets/TextInput.hpp"
#include "Widgets/TabCtrl.hpp"
namespace Slic3r { namespace GUI {
#define DESIGN_GRAY900_COLOR wxColour("#363636") // Label color
#define DESIGN_GRAY600_COLOR wxColour("#ACACAC") // Dimmed text color
#define DESIGN_SELECTOR_NOMORE_COLOR wxColour(248, 248, 248)
#define DESIGN_GRAY900_COLOR wxColour(38, 46, 48)
#define DESIGN_GRAY800_COLOR wxColour(50, 58, 61)
#define DESIGN_GRAY600_COLOR wxColour(144, 144, 144)
#define DESIGN_GRAY400_COLOR wxColour(166, 169, 170)
#define DESIGN_WINDOW_SIZE wxSize(FromDIP(640), FromDIP(640))
#define DESIGN_TITLE_SIZE wxSize(FromDIP(280), -1)
#define DESIGN_COMBOBOX_SIZE wxSize(FromDIP(120), -1)
#define DESIGN_LARGE_COMBOBOX_SIZE wxSize(FromDIP(120), -1)
#define DESIGN_INPUT_SIZE wxSize(FromDIP(120), -1)
#define DESIGN_LEFT_MARGIN 25
class Selector
{
public:
int m_index;
wxWindow *m_tab_button;
wxWindow *m_tab_text;
};
WX_DECLARE_HASH_MAP(int, Selector *, wxIntegerHash, wxIntegerEqual, SelectorHash);
class RadioBox;
class RadioSelector
{
public:
wxString m_param_name;
int m_groupid;
RadioBox *m_radiobox;
bool m_selected = false;
};
WX_DECLARE_LIST(RadioSelector, RadioSelectorList);
class CheckBox;
class TextInput;
#define DESIGN_RESOUTION_PREFERENCES wxSize(FromDIP(540), -1)
#define DESIGN_TITLE_SIZE wxSize(FromDIP(100), -1)
#define DESIGN_COMBOBOX_SIZE wxSize(FromDIP(140), -1)
#define DESIGN_LARGE_COMBOBOX_SIZE wxSize(FromDIP(160), -1)
#define DESIGN_INPUT_SIZE wxSize(FromDIP(100), -1)
class PreferencesDialog : public DPIDialog
{
private:
@@ -62,7 +36,8 @@ private:
protected:
wxBoxSizer * m_sizer_body;
wxScrolledWindow* m_scrolledWindow;
wxScrolledWindow* m_parent;
TabCtrl* m_pref_tabs;
// bool m_settings_layout_changed {false};
bool m_seq_top_layer_only_changed{false};
@@ -86,7 +61,6 @@ public:
wxString m_backup_interval_time;
void create();
wxWindow *create_tab_button(int id, wxString text);
// debug mode
::CheckBox * m_developer_mode_ckeckbox = {nullptr};
@@ -100,56 +74,43 @@ public:
wxString m_backup_interval_def;
wxString m_iot_environment_def;
SelectorHash m_hash_selector;
RadioSelectorList m_radio_group;
// ComboBoxSelectorList m_comxbo_group;
std::vector<wxFlexGridSizer*> f_sizers;
wxBoxSizer *create_item_title(wxString title, wxWindow *parent, wxString tooltip);
wxBoxSizer *create_item_combobox(wxString title, wxWindow *parent, wxString tooltip, std::string param, std::vector<wxString> vlist);
wxBoxSizer *create_item_combobox(wxString title, wxWindow *parent, wxString tooltip, std::string param, std::vector<wxString> vlist, std::vector<std::string> config_name_index);
wxBoxSizer *create_item_region_combobox(wxString title, wxWindow *parent, wxString tooltip, std::vector<wxString> vlist);
wxBoxSizer *create_item_language_combobox(wxString title, wxWindow *parent, wxString tooltip, int padding_left, std::string param, std::vector<const wxLanguageInfo *> vlist);
wxBoxSizer *create_item_loglevel_combobox(wxString title, wxWindow *parent, wxString tooltip, std::vector<wxString> vlist);
wxBoxSizer *create_item_checkbox(wxString title, wxWindow *parent, wxString tooltip, int padding_left, std::string param);
wxBoxSizer *create_item_darkmode_checkbox(wxString title, wxWindow *parent, wxString tooltip, int padding_left, std::string param);
wxBoxSizer *create_item_title(wxString title);
wxBoxSizer *create_item_combobox(wxString title, wxString tooltip, std::string param, std::vector<wxString> vlist);
wxBoxSizer *create_item_combobox(wxString title, wxString tooltip, std::string param, std::vector<wxString> vlist, std::vector<std::string> config_name_index);
wxBoxSizer *create_item_region_combobox(wxString title, wxString tooltip);
wxBoxSizer *create_item_language_combobox(wxString title, wxString tooltip);
wxBoxSizer *create_item_autoflush(wxString title, wxString tooltip);
wxBoxSizer *create_item_loglevel_combobox(wxString title, wxString tooltip, std::vector<wxString> vlist);
wxBoxSizer *create_item_checkbox(wxString title, wxString tooltip, std::string param, const wxString secondary_title = "");
wxBoxSizer *create_item_darkmode(wxString title,wxString tooltip, std::string param);
void set_dark_mode();
wxBoxSizer *create_item_button(wxString title, wxString title2, wxWindow *parent, wxString tooltip, wxString tooltip2, std::function<void()> onclick, bool button_on_left = false);
wxWindow* create_item_downloads(wxWindow* parent, int padding_left, std::string param);
wxBoxSizer *create_item_input(wxString title, wxString title2, wxWindow *parent, wxString tooltip, std::string param, std::function<void(wxString)> onchange = {});
wxBoxSizer *create_camera_orbit_mult_input(wxString title, wxWindow *parent, wxString tooltip);
wxBoxSizer *create_item_backup_input(wxString title, wxWindow *parent, wxString tooltip, std::string param);
wxBoxSizer *create_item_multiple_combobox(
wxString title, wxWindow *parent, wxString tooltip, int padding_left, std::string parama, std::vector<wxString> vlista, std::vector<wxString> vlistb);
wxBoxSizer *create_item_switch(wxString title, wxWindow *parent, wxString tooltip, std::string param);
wxWindow * create_item_radiobox(wxString title, wxWindow *parent, wxString tooltip, int padding_left, int groupid, std::string param);
wxBoxSizer *create_item_button(wxString title, wxString title2, wxString tooltip, wxString tooltip2, std::function<void()> onclick);
wxBoxSizer *create_item_downloads(wxString title, wxString tooltip);
wxBoxSizer *create_item_input(wxString title, wxString title2, wxString tooltip, std::string param, std::function<void(wxString)> onchange = {});
wxBoxSizer *create_camera_orbit_mult_input(wxString title, wxString tooltip);
wxBoxSizer *create_item_backup(wxString title, wxString tooltip);
wxBoxSizer *create_item_multiple_combobox(wxString title, wxString tooltip, std::string parama, std::vector<wxString> vlista, std::vector<wxString> vlistb);
#ifdef WIN32
wxBoxSizer* create_item_link_association(wxWindow* parent, wxString url_prefix, wxString website_name);
wxBoxSizer *create_item_link_association(wxString url_prefix, wxString website_name);
#endif // WIN32
wxWindow* create_general_page();
void create_gui_page();
void create_items();
void create_sync_page();
void create_shortcuts_page();
wxWindow* create_debug_page();
wxBoxSizer* create_debug_page();
void on_select_radio(std::string param);
wxString get_select_radio(int groupid);
// BBS
void create_select_domain_widget();
void Split(const std::string &src, const std::string &separator, std::vector<wxString> &dest);
int m_current_language_selected = {0};
protected:
void OnSelectTabel(wxCommandEvent &event);
void OnSelectRadio(wxMouseEvent &event);
private:
std::tuple<wxBoxSizer*, ComboBox*> create_item_combobox_base(wxString title, wxWindow* parent, wxString tooltip, std::string param, std::vector<wxString> vlist, unsigned int current_index);
std::tuple<wxBoxSizer*, ComboBox*> create_item_combobox_base(wxString title, wxString tooltip, std::string param, std::vector<wxString> vlist, unsigned int current_index);
};
wxDECLARE_EVENT(EVT_PREFERENCES_SELECT_TAB, wxCommandEvent);
}} // namespace Slic3r::GUI
#endif /* slic3r_Preferences_hpp_ */