2023-01-20 07:09:01 +01:00
|
|
|
// Copyright (C) 2023 The Qt Company Ltd.
|
|
|
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include "copilotclient.h"
|
|
|
|
|
|
|
|
|
|
#include <utils/progressindicator.h>
|
|
|
|
|
|
|
|
|
|
#include <QLabel>
|
|
|
|
|
#include <QPushButton>
|
|
|
|
|
#include <QWidget>
|
|
|
|
|
|
|
|
|
|
namespace LanguageClient {
|
|
|
|
|
class Client;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
namespace Copilot {
|
|
|
|
|
|
|
|
|
|
class AuthWidget : public QWidget
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
enum class Status { SignedIn, SignedOut, Unknown };
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
explicit AuthWidget(QWidget *parent = nullptr);
|
2023-03-09 12:26:42 +01:00
|
|
|
void updateClient(const Utils::FilePath &nodeJs, const Utils::FilePath &agent);
|
2023-01-20 07:09:01 +01:00
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
void setState(const QString &buttonText, bool working);
|
2023-03-09 12:26:42 +01:00
|
|
|
void checkStatus();
|
|
|
|
|
|
2023-01-20 07:09:01 +01:00
|
|
|
|
|
|
|
|
void signIn();
|
|
|
|
|
void signOut();
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
Status m_status = Status::Unknown;
|
|
|
|
|
QPushButton *m_button = nullptr;
|
|
|
|
|
QLabel *m_statusLabel = nullptr;
|
|
|
|
|
Utils::ProgressIndicator *m_progressIndicator = nullptr;
|
2023-03-09 12:26:42 +01:00
|
|
|
Internal::CopilotClient *m_client = nullptr;
|
2023-01-20 07:09:01 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace Copilot
|