Class: Depot::GUI::SandboxDialog
- Inherits:
-
RubyQt6::Bando::QDialog
- Object
- RubyQt6::Bando::QDialog
- Depot::GUI::SandboxDialog
- Defined in:
- lib/depot/gui/main_window.rb
Instance Attribute Summary collapse
-
#home_combo ⇒ Object
readonly
Returns the value of attribute home_combo.
-
#mode_combo ⇒ Object
readonly
Returns the value of attribute mode_combo.
-
#network_check ⇒ Object
readonly
Returns the value of attribute network_check.
-
#profile_combo ⇒ Object
readonly
Returns the value of attribute profile_combo.
Instance Method Summary collapse
-
#initialize(parent, manifest, settings) ⇒ SandboxDialog
constructor
A new instance of SandboxDialog.
- #values ⇒ Object
Constructor Details
#initialize(parent, manifest, settings) ⇒ SandboxDialog
Returns a new instance of SandboxDialog.
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 |
# File 'lib/depot/gui/main_window.rb', line 64 def initialize(parent, manifest, settings) super(parent) @manifest = Sandbox.normalize(manifest, settings) sandbox = @manifest.fetch("sandbox", {}) set_window_title("Sandbox") set_modal(true) resize(430, 260) layout = QVBoxLayout.new title = QLabel.new("Sandbox #{manifest.fetch("display_name")}") title.set_style_sheet("font-size: 18px; font-weight: 700;") layout.(title) note = QLabel.new(description_text) note.set_word_wrap(true) note.set_object_name("depotInstallSubtitle") layout.(note) form = QFormLayout.new @mode_combo = QComboBox.new %w[inherit enabled disabled].each { |value| @mode_combo.add_item(value) } @profile_combo = QComboBox.new %w[relaxed balanced strict].each { |value| @profile_combo.add_item(value) } @home_combo = QComboBox.new %w[isolated documents full].each { |value| @home_combo.add_item(value) } @network_check = QCheckBox.new("Allow network access") set_combo(@mode_combo, sandbox.fetch("mode", "inherit")) set_combo(@profile_combo, sandbox.fetch("profile", "balanced")) set_combo(@home_combo, sandbox.fetch("home_access", "documents")) @network_check.set_checked(sandbox.fetch("network", true)) form.add_row(QString.new("Mode"), @mode_combo) form.add_row(QString.new("Profile"), @profile_combo) form.add_row(QString.new("Home access"), @home_combo) form.add_row(QString.new("Network"), @network_check) layout.add_layout(form) = QHBoxLayout.new save = QPushButton.new("Save") cancel = QPushButton.new("Cancel") save.clicked.connect(self, :accept) cancel.clicked.connect(self, :reject) .add_stretch .(save) .(cancel) layout.add_layout() set_layout(layout) end |
Instance Attribute Details
#home_combo ⇒ Object (readonly)
Returns the value of attribute home_combo.
62 63 64 |
# File 'lib/depot/gui/main_window.rb', line 62 def home_combo @home_combo end |
#mode_combo ⇒ Object (readonly)
Returns the value of attribute mode_combo.
62 63 64 |
# File 'lib/depot/gui/main_window.rb', line 62 def mode_combo @mode_combo end |
#network_check ⇒ Object (readonly)
Returns the value of attribute network_check.
62 63 64 |
# File 'lib/depot/gui/main_window.rb', line 62 def network_check @network_check end |
#profile_combo ⇒ Object (readonly)
Returns the value of attribute profile_combo.
62 63 64 |
# File 'lib/depot/gui/main_window.rb', line 62 def profile_combo @profile_combo end |
Instance Method Details
#values ⇒ Object
115 116 117 118 119 120 121 122 |
# File 'lib/depot/gui/main_window.rb', line 115 def values { "mode" => @mode_combo.current_text.to_s, "profile" => @profile_combo.current_text.to_s, "home_access" => @home_combo.current_text.to_s, "network" => @network_check.checked? } end |