git mv Code\Sandbox\Plugins Code/Editor/Plugins
Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com>
This commit is contained in:
@@ -0,0 +1,90 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#include "PerforcePlugin_precompiled.h"
|
||||
#include "CryFile.h"
|
||||
#include "PerforceSourceControl.h"
|
||||
#include "PasswordDlg.h"
|
||||
|
||||
#include <QSettings>
|
||||
#include <QDir>
|
||||
#include <QFile>
|
||||
#include <QProcess>
|
||||
#include <QApplication>
|
||||
#include <QTimer>
|
||||
|
||||
#include <Util/PathUtil.h>
|
||||
#include <AzCore/base.h>
|
||||
|
||||
namespace
|
||||
{
|
||||
CryCriticalSection g_cPerforceValues;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
ULONG STDMETHODCALLTYPE CPerforceSourceControl::Release()
|
||||
{
|
||||
if ((--m_ref) == 0)
|
||||
{
|
||||
g_cPerforceValues.Lock();
|
||||
delete this;
|
||||
g_cPerforceValues.Unlock();
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
return m_ref;
|
||||
}
|
||||
}
|
||||
|
||||
void CPerforceSourceControl::Init()
|
||||
{
|
||||
UpdateSourceControlState();
|
||||
}
|
||||
|
||||
void CPerforceSourceControl::ShowSettings()
|
||||
{
|
||||
if (PerforceConnection::OpenPasswordDlg())
|
||||
{
|
||||
UpdateSourceControlState();
|
||||
}
|
||||
}
|
||||
|
||||
void CPerforceSourceControl::SetSourceControlState(SourceControlState state)
|
||||
{
|
||||
AUTO_LOCK(g_cPerforceValues);
|
||||
|
||||
switch (state)
|
||||
{
|
||||
case SourceControlState::Disabled:
|
||||
m_connectionState = ConnectivityState::Disconnected;
|
||||
break;
|
||||
|
||||
case SourceControlState::Active:
|
||||
m_connectionState = ConnectivityState::Connected;
|
||||
break;
|
||||
|
||||
case SourceControlState::ConfigurationInvalid:
|
||||
m_connectionState = ConnectivityState::BadConfiguration;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void CPerforceSourceControl::UpdateSourceControlState()
|
||||
{
|
||||
using namespace AzToolsFramework;
|
||||
|
||||
SourceControlState state = SourceControlState::Disabled;
|
||||
SourceControlConnectionRequestBus::BroadcastResult(state,
|
||||
&SourceControlConnectionRequestBus::Events::GetSourceControlState);
|
||||
|
||||
SetSourceControlState(state);
|
||||
}
|
||||
Reference in New Issue
Block a user