File indexing completed on 2024-05-12 05:03:13

0001 /*
0002    SPDX-FileCopyrightText: 2023-2024 Laurent Montel <montel.org>
0003 
0004    SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #include "authenticationoauthwidget.h"
0008 #include "authenticationbutton.h"
0009 #include <QVBoxLayout>
0010 
0011 AuthenticationOauthWidget::AuthenticationOauthWidget(QWidget *parent)
0012     : QWidget{parent}
0013     , mMainLayout(new QVBoxLayout)
0014 {
0015     auto topLayout = new QHBoxLayout(this);
0016     topLayout->setObjectName(QStringLiteral("topLayout"));
0017     topLayout->setContentsMargins({});
0018 
0019     mMainLayout->setObjectName(QStringLiteral("mainLayout"));
0020     mMainLayout->setContentsMargins({});
0021     topLayout->addStretch(0);
0022     topLayout->addLayout(mMainLayout);
0023     topLayout->addStretch(0);
0024     setVisible(false);
0025     mMainLayout->addStretch(1);
0026 }
0027 
0028 AuthenticationOauthWidget::~AuthenticationOauthWidget() = default;
0029 
0030 void AuthenticationOauthWidget::addAuthenticationMethod(const AuthenticationInfo &info)
0031 {
0032     auto button = new AuthenticationButton(this);
0033     button->setObjectName(QStringLiteral("button_%1").arg(info.name()));
0034     connect(button, &AuthenticationButton::authentication, this, &AuthenticationOauthWidget::authentication);
0035     button->setAuthenticationInfo(info);
0036     mMainLayout->addWidget(button);
0037 }
0038 
0039 #include "moc_authenticationoauthwidget.cpp"