module Collision

Extended Modules

Defined in:

collision.cr:11
collision.cr:43
collision/functions/about_action.cr
collision/functions/feedback.cr
collision/functions/file_set.cr
collision/functions/generate_hash.cr
collision/functions/hashinfo_action.cr
collision/functions/headbar_gen.cr
collision/views/main.cr
collision/views/tools/compare.cr
collision/views/tools/verify.cr
collision/views/welcomer.cr

Constant Summary

ACTION_ROWS = gen_hash(false)
APP = Adw::Application.new("dev.geopjr.Collision", Gio::ApplicationFlags::None)
ARTICLE = Gettext.gettext("https://en.wikipedia.org/wiki/Comparison_of_cryptographic_hash_functions")
B_FI = Gtk::Builder.new_from_resource("/dev/geopjr/Collision/ui/file_info.ui")
B_HL = Gtk::Builder.new_from_resource("/dev/geopjr/Collision/ui/header_left.ui")
B_HR = Gtk::Builder.new_from_resource("/dev/geopjr/Collision/ui/header_right.ui")
B_HS = Gtk::Builder.new_from_resource("/dev/geopjr/Collision/ui/hash_list.ui")
B_HT = Gtk::Builder.new_from_resource("/dev/geopjr/Collision/ui/switcher.ui")
B_SP = Gtk::Builder.new_from_resource("/dev/geopjr/Collision/ui/spinner.ui")
B_TL = Gtk::Builder.new_from_resource("/dev/geopjr/Collision/ui/tools.ui")
B_UI = Gtk::Builder.new_from_resource("/dev/geopjr/Collision/ui/welcomer.ui")
BOTTOM_TABS = Adw::ViewSwitcherBar.cast(B_HT["switcher_bar"])
CLIPBOARD_HASH = Hash(String, String).new
COPY_BUTTONS = gen_hash(true)
DEFAULT_FEEDBACK_ICON = "dialog-password-symbolic"
FILE_INFO = Adw::StatusPage.cast(B_FI["fileInfo"])
HASH_FUNCTIONS = ["MD5", "SHA1", "SHA256", "SHA512"]
HASH_LIST = Gtk::ListBox.cast(B_HS["hashList"])
HASH_LIST_TITLE = Gettext.gettext("Hash")
HEADER_TITLE = Adw::ViewSwitcherTitle.cast(B_HT["switcher_title"])
HEADERBAR = Adw::HeaderBar.new
LOGGER = Log.for("Collision", ARGV[0]? == "--debug" ? Log::Severity::Debug : Log::Severity::Warn)
MAIN_FILE_CHOOSER_NATIVE = Gtk::FileChooserNative.cast(B_HL["mainFileChooserNative"])
MENU_BUTTON = Gtk::MenuButton.cast(B_HR["menuBtn"])
OPEN_FILE_BUTTON = Gtk::Button.cast(B_HL["openFileBtn"])
RESOURCE = Gio::Resource.new_from_data(GLib::Bytes.new_take(({{ read_file("./data/dev.geopjr.Collision.gresource") }}).bytes))
SPINNER = Gtk::Spinner.new(spinning: true, halign: Gtk::Align::Center, vexpand: true, hexpand: true, width_request: 32, height_request: 32)
STACK = Adw::ViewStack.cast(B_HT["stack"])
TOOL_COMPARE_BUTTON = Gtk::Button.cast(B_TL["compareBtn"])
TOOL_COMPARE_BUTTON_FEEDBACK = Gtk::Box.cast(B_TL["compareBtnFeedback"])
TOOL_COMPARE_BUTTON_IMAGE = Gtk::Image.cast(B_TL["compareBtnImage"])
TOOL_COMPARE_BUTTON_LABEL = Gtk::Label.cast(B_TL["compareBtnLabel"])
TOOL_COMPARE_BUTTON_SPINNER = Gtk::Spinner.new(spinning: true, halign: Gtk::Align::Center, width_request: 36, height_request: 36, visible: false)
TOOL_COMPARE_FILE_CHOOSER_NATIVE = Gtk::FileChooserNative.cast(B_TL["compareFileChooserNative"])
TOOL_VERIFY_FEEDBACK = Gtk::Image.cast(B_TL["verifyFeedback"])
TOOL_VERIFY_INPUT = Gtk::TextView.new(pixels_above_lines: 11, pixels_below_lines: 11, left_margin: 5, right_margin: 5, cursor_visible: false, height_request: 125, wrap_mode: Gtk::WrapMode::Char, accepts_tab: false, css_name: "entry", css_classes: ["card-like", "monospace"], tooltip_text: Gettext.gettext("Insert a MD5/SHA-1/SHA-256/SHA-512 Hash"))
TOOL_VERIFY_OVERLAY = Gtk::Overlay.cast(B_TL["verifyOverlay"])
TOOL_VERIFY_OVERLAY_LABEL = Gtk::Label.cast(B_TL["verifyOverlayLabel"])
TOOLS_GRID = Gtk::Grid.cast(B_TL["tools"])
TOOLS_TITLE = Gettext.gettext("Verify")
VERSION = {{ (((read_file("./shard.yml")).split("version: "))[1].split("\n"))[0] }}
WELCOME_BUTTON = Gtk::Button.cast(B_UI["welcomeBtn"])
WELCOMER_FILE_CHOOSER_NATIVE = Gtk::FileChooserNative.cast(B_UI["welcomerFileChooserNative"])
WINDOW_BOX = Gtk::Box.new(Gtk::Orientation::Vertical, 0)

Instance Method Summary

Instance Method Detail

def about_action(app : Adw::Application) #

[View source]
def activate(app : Adw::Application) #

[View source]
def calculate_hash(type : String, filename : String) : String #

[View source]
def generate_hashes(filename : String, &block) #

[View source]
def generate_headbar #

[View source]
def handle_spawning(&block) #

[View source]
def hashinfo_action(app : Adw::Application, window_id : UInt32) #

[View source]
def icon(success : Bool | Nil = false) #

[View source]
def on_finished(&) #

[View source]
def real_path(filepath : Path) : String | Nil #

[View source]
def reset #

[View source]
def reset_feedback #

[View source]
def set_file(filepath : Path) #

[View source]
def startup(app : Adw::Application) #

[View source]