Home GnuPG

qt: Modernize code

Description

qt: Modernize code

* qt/pinentryconfirm.h, qt/pinentryconfirm.cpp
(PinentryConfirm::PinentryConfirm): Remove timeout argument. Add flags
argument. Rename argument desc to text.
(PinentryConfirm::setTimeout, PinentryConfirm::timeout): New.
(PinentryConfirm::showEvent): Mark as override.
(class PinentryConfirm): Hold field _timer by value instead of by
pointer. Initialize _timed_out in-class. Use Q_SLOTS instead of slots.
* qt/pinentryconfirm.cpp (PinentryConfirm::PinentryConfirm):
Use QTimer::callOnTimeout() for setting the timeout handler. Do not
start the timer.
(PinentryConfirm::showEvent): Make timer a single-shot timer and start it.
* qt/main.cpp (qt_cmd_handler): Set timeout with new setter.

This changes makes the c'tor match the c'tor of QMessageBox and
modernizes the interface for setting the timeout (using std::chrono's
duration instead of int with unspecified unit of duration). Moreover,
it starts the timeout timer when the message box is shown and not when
it's created (which doesn't really make much of a difference in the
current code).

Details