mirror of
https://github.com/TimeCrafters/timecrafters_configuration_tool_desktop.git
synced 2025-12-15 21:32:35 +00:00
32 lines
706 B
Ruby
32 lines
706 B
Ruby
module TAC
|
|
class Window < CyberarmEngine::Window
|
|
attr_reader :backend
|
|
def initialize(**args)
|
|
super(**args)
|
|
|
|
self.caption = "#{TAC::NAME} v#{TAC::VERSION} (#{TAC::RELEASE_NAME})"
|
|
@backend = Backend.new
|
|
push_state(TAC::States::Editor)
|
|
end
|
|
|
|
def needs_cursor?
|
|
true
|
|
end
|
|
|
|
def close
|
|
if @backend.config_changed?
|
|
push_state(Dialog::ConfirmDialog, title: "Are you sure?", message: "Config has unsaved changes!", callback_method: proc { cleanup_and_close })
|
|
else
|
|
cleanup_and_close
|
|
end
|
|
end
|
|
|
|
def cleanup_and_close
|
|
if @backend.tacnet.connected?
|
|
@backend.tacnet.close
|
|
end
|
|
|
|
close!
|
|
end
|
|
end
|
|
end |