/****************************************************************************
**
** Copyright (C) 2012 - 2014 Jolla Ltd.
** Contact: http://jolla.com/
**
** This file is part of Qt Creator.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file.  Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** Other Usage
**
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Digia.
**
****************************************************************************/

#ifndef NXTCONNECTIONMANAGER_H
#define NXTCONNECTIONMANAGER_H

#include <coreplugin/id.h>

#include <QObject>

namespace ProjectExplorer {
class Kit;
class Project;
class Target;
class Task;
}

namespace QSsh {
class SshConnectionParameters;
}

namespace Nxt {
namespace Internal {

class NxtConnectionAction;

class NxtConnectionManager : public QObject
{
    Q_OBJECT
public:
    static NxtConnectionManager* instance();
    ~NxtConnectionManager() override;
    static QString testConnection(const QSsh::SshConnectionParameters &params, bool *ok = nullptr);
private slots:
    void update();
    void handleStartupProjectChanged(ProjectExplorer::Project *project);
    void handleKitUpdated(ProjectExplorer::Kit *kit);
    void handleTargetAdded(ProjectExplorer::Target *target);
    void handleTargetRemoved(ProjectExplorer::Target *target);
private:
    NxtConnectionManager();

private:
    static NxtConnectionManager *m_instance;
    static ProjectExplorer::Project *m_project;
    NxtConnectionAction *m_sdkAction;

    friend class NxtPlugin;
};

} // namespace Internal
} // namespace Nxt

#endif
