45 Daemon(QObject* parent = nullptr) : QObject(parent) { |
45 Daemon(QObject* parent = nullptr) : QObject(parent) { |
46 } |
46 } |
47 |
47 |
48 Q_PROPERTY(bool devicePresent READ devicePresent) |
48 Q_PROPERTY(bool devicePresent READ devicePresent) |
49 bool devicePresent() { |
49 bool devicePresent() { |
50 std::wcout << L"checking mouse presence" << std::endl; |
50 std::wcout << L"checking mouse presence: "; |
51 try { |
51 try { |
52 getMouse(); |
52 getMouse(); |
|
53 std::wcout << L"present" << std::endl; |
53 return true; |
54 return true; |
54 } catch (const HIDException& e) { |
55 } catch (const HIDException& e) { |
|
56 std::wcout << std::endl; |
55 logException(e); |
57 logException(e); |
56 return false; |
58 return false; |
57 } |
59 } |
58 } |
60 } |
59 |
61 |
60 Q_PROPERTY(QString deviceName READ deviceName) |
62 Q_PROPERTY(QString deviceName READ deviceName) |
61 QString deviceName() { |
63 QString deviceName() { |
62 std::wcout << L"reading mouse name" << std::endl; |
64 std::wcout << L"reading mouse name: "; |
63 try { |
65 try { |
64 return QString::fromStdWString(getMouse().getProductName()); |
66 auto productName = getMouse().getProductName(); |
|
67 std::wcout << productName << std::endl; |
|
68 return QString::fromStdWString(productName); |
65 } catch (HIDException& e) { |
69 } catch (HIDException& e) { |
|
70 std::wcout << std::endl; |
66 logException(e); |
71 logException(e); |
67 return QString(); |
72 return QString(); |
68 } |
73 } |
69 } |
74 } |
70 |
75 |
71 void configure(bool liftOffDetection, bool smartScrolling, bool remapWheelPress, bool remapGestureButton, int frequency) { |
76 void configure(bool liftOffDetection, bool smartScrolling, bool remapWheelPress, bool remapGestureButton, int frequency) { |
72 std::wcout << L"configuring mouse" << std::endl; |
77 std::wcout << L"configuring mouse:" |
|
78 << L" liftOffDetection=" << liftOffDetection |
|
79 << L" smartScrolling=" << smartScrolling |
|
80 << L" remapWheelPress=" << remapWheelPress |
|
81 << L" remapGestureButton=" << remapGestureButton |
|
82 << L" frequency=" << frequency |
|
83 << std::endl; |
73 try { |
84 try { |
74 CadMouseConfig config; |
85 CadMouseConfig config; |
75 config.setLiftOffDetection(liftOffDetection); |
86 config.setLiftOffDetection(liftOffDetection); |
76 config.setSmartScrolling(smartScrolling); |
87 config.setSmartScrolling(smartScrolling); |
77 config.setWheelPressRemapped(remapWheelPress); |
88 config.setWheelPressRemapped(remapWheelPress); |