You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
o3de/Code/Sandbox/Plugins/PerforcePlugin/PerforceSourceControl.h

71 lines
2.1 KiB
C++

/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
// Original file Copyright Crytek GMBH or its affiliates, used under license.
#pragma once
#include "IEditorClassFactory.h"
#include "Include/IEditorClassFactory.h"
#include "Include/ISourceControl.h"
class CPerforceSourceControl
: public ISourceControl
, public IClassDesc
{
public:
// constructor
CPerforceSourceControl() = default;
virtual ~CPerforceSourceControl() = default;
void Init();
// ISourceControl
void SetSourceControlState(SourceControlState state) override;
ConnectivityState GetConnectivityState() override { return m_connectionState; };
void ShowSettings() override;
// from IClassDesc
virtual ESystemClassID SystemClassID() { return ESYSTEM_CLASS_SCM_PROVIDER; };
REFGUID ClassID()
{
// {3c209e66-0728-4d43-897d-168962d5c8b5}
static const GUID guid = {
0x3c209e66, 0x0728, 0x4d43, { 0x89, 0x7d, 0x16, 0x89, 0x62, 0xd5, 0xc8, 0xb5 }
};
return guid;
}
virtual QString ClassName() { return "Perforce source control"; };
virtual QString Category() { return "SourceControl"; };
virtual void ShowAbout() {};
// from IUnknown
HRESULT STDMETHODCALLTYPE QueryInterface(const IID& riid, void** ppvObj)
{
if (riid == __uuidof(ISourceControl) /* && m_pIntegrator*/)
{
*ppvObj = this;
return S_OK;
}
return E_NOINTERFACE;
}
ULONG STDMETHODCALLTYPE AddRef() { return ++m_ref; };
ULONG STDMETHODCALLTYPE Release();
private:
void UpdateSourceControlState();
ULONG m_ref{ 0 };
ConnectivityState m_connectionState{ ConnectivityState::Disconnected };
};