diff options
author | A. Wilcox <AWilcox@Wilcox-Tech.com> | 2019-11-29 17:18:58 -0600 |
---|---|---|
committer | A. Wilcox <AWilcox@Wilcox-Tech.com> | 2019-11-29 17:18:58 -0600 |
commit | c6771c06689dfb49b8050e99b9c3572c27a8cb3e (patch) | |
tree | fa7a5d1c9fe7dddcb1478d3ebe6d22babe1c2300 /ui/qt5/accountpage.cc | |
parent | b9fad79ccf775de757997f532a45d6c300ae2a73 (diff) | |
download | horizon-c6771c06689dfb49b8050e99b9c3572c27a8cb3e.tar.gz horizon-c6771c06689dfb49b8050e99b9c3572c27a8cb3e.tar.bz2 horizon-c6771c06689dfb49b8050e99b9c3572c27a8cb3e.tar.xz horizon-c6771c06689dfb49b8050e99b9c3572c27a8cb3e.zip |
Qt UI: Add Accounts page, still in progress
Diffstat (limited to 'ui/qt5/accountpage.cc')
-rw-r--r-- | ui/qt5/accountpage.cc | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/ui/qt5/accountpage.cc b/ui/qt5/accountpage.cc new file mode 100644 index 0000000..0541b60 --- /dev/null +++ b/ui/qt5/accountpage.cc @@ -0,0 +1,53 @@ +/* + * accountpage.cc - Implementation of the UI.Accounts.UserAcct page + * horizon-qt5, the Qt 5 user interface for + * Project Horizon + * + * Copyright (c) 2019 Adélie Linux and contributors. All rights reserved. + * This code is licensed under the AGPL 3.0 license, as noted in the + * LICENSE-code file in the root directory of this repository. + * + * SPDX-License-Identifier: AGPL-3.0-only + */ + +#include "accountpage.hh" + +#include <algorithm> +#include <QLabel> +#include <QVBoxLayout> + +AccountPage::AccountPage(QWidget *parent) : HorizonWizardPage(parent) { + setTitle(tr("User Accounts")); + loadWatermark("acct"); + QLabel *descLabel = new QLabel(tr( + "Enter the details of up to four people who will use this computer. " + "You can add more later with the User Manager. " + "For more information, consult the User's Handbook.")); + descLabel->setWordWrap(true); + + QVBoxLayout *layout = new QVBoxLayout; + layout->addWidget(descLabel); + + accountWidgets[0] = new UserAccountWidget; + accountWidgets[0]->setAdmin(true); + accountWidgets[1] = new UserAccountWidget; + accountWidgets[2] = new UserAccountWidget; + accountWidgets[3] = new UserAccountWidget; + + for(auto &widget : accountWidgets) { + connect(widget, &UserAccountWidget::validityChanged, + this, &AccountPage::completeChanged); + layout->addStretch(); + layout->addWidget(widget); + } + + setLayout(layout); +} + +bool AccountPage::isComplete() const { + return std::all_of(accountWidgets.begin(), accountWidgets.end(), + [](UserAccountWidget *widget) { + if(widget == nullptr) return true; + return widget->isValid(); + }); +} |