1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889 |
- /*
- * 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);
- }
|