diff options
| author | Christoph Berg <myon@debian.org> | 2025-01-09 22:12:12 +0100 |
|---|---|---|
| committer | Christoph Berg <myon@debian.org> | 2025-01-09 22:12:12 +0100 |
| commit | 98c02f78b26811ba5d9962ba27ec24cacf82bb22 (patch) | |
| tree | daaf609cde31d8fb3b6c3457c43663d14f0dda80 /GetUserId.cpp | |
| parent | 332d2ce88c2f0bc2908cacdc6707e2f9fa49f26d (diff) | |
| parent | 992d4b4b8d3f3a630a2cf00d593ee4ce4dfa7ce8 (diff) | |
Update upstream source from tag 'upstream/2.7.0_rc8+repack'
Update to upstream version '2.7.0~rc8+repack'
with Debian dir 6fce941c8282d35c8df23d3de779a42e27688bc1
Diffstat (limited to 'GetUserId.cpp')
| -rwxr-xr-x | GetUserId.cpp | 150 |
1 files changed, 75 insertions, 75 deletions
diff --git a/GetUserId.cpp b/GetUserId.cpp index 57d877a9..238c3b5a 100755 --- a/GetUserId.cpp +++ b/GetUserId.cpp @@ -1,75 +1,75 @@ -#include "GetUserId.hpp"
-
-#include <stdexcept>
-
-#include <QApplication>
-#include <QString>
-#include <QDialog>
-#include <QLineEdit>
-#include <QRegExpValidator>
-#include <QDialogButtonBox>
-#include <QFormLayout>
-#include <QVBoxLayout>
-
-//
-// Dialog to get callsign
-//
-class CallsignDialog final
- : public QDialog
-{
- Q_OBJECT;
-
-private:
- Q_DISABLE_COPY (CallsignDialog);
-
-public:
- explicit CallsignDialog (QWidget * parent = nullptr)
- : QDialog {parent}
- {
- setWindowTitle (QApplication::applicationName () + " - " + tr ("Callsign"));
-
- callsign_.setValidator (new QRegExpValidator {QRegExp {"[A-Za-z0-9]+"}, this});
-
- auto form_layout = new QFormLayout ();
- form_layout->addRow ("&Callsign:", &callsign_);
-
- auto main_layout = new QVBoxLayout (this);
- main_layout->addLayout (form_layout);
-
- auto button_box = new QDialogButtonBox {QDialogButtonBox::Ok | QDialogButtonBox::Cancel};
- main_layout->addWidget (button_box);
-
- connect (button_box, &QDialogButtonBox::accepted, this, &CallsignDialog::accept);
- connect (button_box, &QDialogButtonBox::rejected, this, &CallsignDialog::reject);
- }
-
- QString callsign () const {return callsign_.text ();}
-
-private:
- QLineEdit callsign_;
-};
-
-#include "GetUserId.moc"
-
-QString get_user_id ()
-{
- // get the users callsign so we can use it to persist the
- // settings and log file against a unique tag
- QString id;
- {
- CallsignDialog dialog;
- while (id.isEmpty ())
- {
- if (QDialog::Accepted == dialog.exec ())
- {
- id = dialog.callsign ().toUpper ();
- }
- else
- {
- throw std::runtime_error ("Callsign required");
- }
- }
- }
-
- return id;
-}
+#include "GetUserId.hpp" + +#include <stdexcept> + +#include <QApplication> +#include <QString> +#include <QDialog> +#include <QLineEdit> +#include <QRegExpValidator> +#include <QDialogButtonBox> +#include <QFormLayout> +#include <QVBoxLayout> + +// +// Dialog to get callsign +// +class CallsignDialog final + : public QDialog +{ + Q_OBJECT; + +private: + Q_DISABLE_COPY (CallsignDialog); + +public: + explicit CallsignDialog (QWidget * parent = nullptr) + : QDialog {parent} + { + setWindowTitle (QApplication::applicationName () + " - " + tr ("Callsign")); + + callsign_.setValidator (new QRegExpValidator {QRegExp {"[A-Za-z0-9]+"}, this}); + + auto form_layout = new QFormLayout (); + form_layout->addRow ("&Callsign:", &callsign_); + + auto main_layout = new QVBoxLayout (this); + main_layout->addLayout (form_layout); + + auto button_box = new QDialogButtonBox {QDialogButtonBox::Ok | QDialogButtonBox::Cancel}; + main_layout->addWidget (button_box); + + connect (button_box, &QDialogButtonBox::accepted, this, &CallsignDialog::accept); + connect (button_box, &QDialogButtonBox::rejected, this, &CallsignDialog::reject); + } + + QString callsign () const {return callsign_.text ();} + +private: + QLineEdit callsign_; +}; + +#include "GetUserId.moc" + +QString get_user_id () +{ + // get the users callsign so we can use it to persist the + // settings and log file against a unique tag + QString id; + { + CallsignDialog dialog; + while (id.isEmpty ()) + { + if (QDialog::Accepted == dialog.exec ()) + { + id = dialog.callsign ().toUpper (); + } + else + { + throw std::runtime_error ("Callsign required"); + } + } + } + + return id; +} |
