Files
o3de/Code/Editor/Plugins/PerforcePlugin/PerforceSourceControl.cpp
T
Scott Romero 9a8a411a0b [development] removal of unused and low stakes code related to Cry-threading (#2896)
Removal highlights include:
 - File indexer (used CryThread<>) linked to long gone asset browser
 - Producer/consumer queues from CryMT
 - set/vector/CLocklessPointerQueue containers also from CryMT
 - Cry interlocked linked list and _InterlockedCompareExchange128
 - CryThread type
 - SAtomicVar types
 - CryAutoSet type
 - Various unused lock types
 -- AutoLockModify
 -- AutoLockRead
 -- CryOptionalAutoLock
 -- CryReadModifyLock
 -- CryRWLock
 -- ReadLock
 -- ReadLockCond
 -- WriteAfterReadLock
 - Misc. unused functions
 -- CryInterLockedAdd (not to be confused with CryInterlockedAdd, using a lower case "locked")
 -- CryInterlockedExchange64 (which was only defined for unix platforms)
 -- SpinLock
 -- JobSpinLock
 -- AtomicAdd
 -- JobAtomicAdd

Signed-off-by: AMZN-ScottR <24445312+AMZN-ScottR@users.noreply.github.com>
2021-08-06 13:23:14 -07:00

90 lines
2.0 KiB
C++

/*
* Copyright (c) Contributors to the Open 3D Engine Project.
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
*
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
#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)
{
CryAutoLock<CryCriticalSection> 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);
}