# CutBox.app

## Coverage Report

#### Created: 2024-03-12 03:40

    .../Source/App/Preferences/PreferencesGeneralView+KeyRecorder.swift

    Line

    Count

    Source (jump to first uncovered line)

    1

    //

    2

    //  PreferencesGeneralView+KeyRecorder.swift

    3

    //  CutBox

    4

    //

    5

    //  Created by Jason Milkins on 11/4/18.

    6

    //  Copyright © 2018-2023 ocodo. All rights reserved.

    7

    //

    8

    9

    import Magnet

    10

    import KeyHolder

    11

    import RxSwift

    12

    13

    extension PreferencesGeneralView {

    14

    15

    49

        func setupKeyRecorders() {

    16

    49

            self.mainKeyRecorder.delegate = self

    17

    49

            self.mainKeyRecorder.clearButtonMode = .never

    18

    49

            self.mainKeyRecorderLabel.stringValue = "preferences_toggle_cutbox".l7n

    19

    49

            self.mainKeyRecorderLabel.toolTip = "preferences_toggle_cutbox_tooltip".l7n

    20

    49

    21

    49

            self.hotKeyService

    22

    49

                .searchKeyCombo

    23

    49

                .subscribe(onNext: { self.mainKeyRecorder.keyCombo = $0 })

    24

    49

                .disposed(by: self.disposeBag)

    25

    49

        }

    26

    }

    27

    28

    extension PreferencesGeneralView: RecordViewDelegate {

    29

    30

    1

        func recordView(_ recordView: RecordView, canRecordKeyCombo keyCombo: KeyCombo) -> Bool {

    31

    1

            return true

    32

    1

        }

    33

    34

    1

        func recordViewShouldBeginRecording(_ recordView: RecordView) -> Bool {

    35

    1

            hotKeyCenter?

    36

    1

                .unregisterHotKey(with: Constants.cutBoxToggleKeyCombo)

    37

    1

            return true

    38

    1

        }

    39

    40

    1

        func recordView(_ recordView: RecordView, didChangeKeyCombo keyCombo: KeyCombo?) {

    41

    1

            switch recordView {

    42

    1

            case mainKeyRecorder: hotKeyService?.searchKeyCombo.onNext(keyCombo!)

    43

    1

            default: break }

    44

    1

        }

    45

    46

    1

        func recordViewDidEndRecording(_ recordView: RecordView) {

    47

    1

        }

    48

    }