void STutorialButton::DismissAlert()
{
	RefreshStatus();

	if( FEngineAnalytics::IsAvailable() )
	{
		TArray<FAnalyticsEventAttribute> EventAttributes;
		EventAttributes.Add(FAnalyticsEventAttribute(TEXT("Context"), Context.ToString()));
		EventAttributes.Add(FAnalyticsEventAttribute(TEXT("TimeSinceAlertStarted"), (AlertStartTime != 0.0f && ShouldShowAlert()) ? (FPlatformTime::Seconds() - AlertStartTime) : -1.0f));

		FEngineAnalytics::GetProvider().RecordEvent( TEXT("Rocket.Tutorials.DismissedTutorialAlert"), EventAttributes );
	}

	// If they actually right click and choose "Dismiss Alert", we'll go ahead and suppress the tutorial reminder for this feature for good (all sessions.)
	const bool bDismissAcrossSessions = true;
	if (CachedAttractTutorial != nullptr)
	{
		GetMutableDefault<UTutorialStateSettings>()->DismissTutorial(CachedAttractTutorial, bDismissAcrossSessions);
		CachedAttractTutorial = nullptr;
	}
	if( CachedLaunchTutorial != nullptr)
	{
		GetMutableDefault<UTutorialStateSettings>()->DismissTutorial(CachedLaunchTutorial, bDismissAcrossSessions);
		CachedLaunchTutorial = nullptr;
	}
	GetMutableDefault<UTutorialStateSettings>()->SaveProgress();
	bTutorialDismissed = true;

	RefreshStatus();
}
EActiveTimerReturnType STutorialButton::OpenTutorialPostConstruct( double InCurrentTime, float InDeltaTime )
{
	// Begin playing the pulse animation on a loop
	PulseAnimation.Play(this->AsShared(), true);

	RefreshStatus();

	if (bTutorialAvailable && CachedAttractTutorial != nullptr && !bTutorialDismissed && !bTutorialCompleted && !GetMutableDefault<UTutorialStateSettings>()->AreAllTutorialsDismissed())
	{
		// kick off the attract tutorial if the user hasn't dismissed it and hasn't completed it
		FIntroTutorials& IntroTutorials = FModuleManager::GetModuleChecked<FIntroTutorials>( TEXT( "IntroTutorials" ) );
		const bool bRestart = true;
		IntroTutorials.LaunchTutorial(CachedAttractTutorial, bRestart ? IIntroTutorials::ETutorialStartType::TST_RESTART : IIntroTutorials::ETutorialStartType::TST_CONTINUE, ContextWindow);
	}

	if ( ShouldShowAlert() )
	{
		AlertStartTime = FPlatformTime::Seconds();
	}

	if ( CachedLaunchTutorial != nullptr )
	{
		TutorialTitle = CachedLaunchTutorial->Title;
	}

	return EActiveTimerReturnType::Stop;
}
Esempio n. 3
0
void CBufferOutputAudioEngine::Play()
{
		//BufferTrace("CBufferOutputAudioEngine::Play()....\n");
		if (!m_bFilled && m_mapOutputAudioBuf.size() < (1.0f*BUFFER_PERSEC_AUDIO_NUMBER*BUFFER_OUTPUT_ONMIC_AUDIO_MAX_LIMIT)/1000){
			return ;
		}

		if (!m_bFilled) {
			m_fLastPlayTime = GetTickCount();
			m_iStartPlayCount = 0;
			m_bFilled = true;
		}
		if (m_mapOutputAudioBuf.size() < 1 || (GetTickCount() - m_lastRecvTime) > 1000*10){//10s钟没有收到数据 超时 刷新
			MutexLocker locker(&m_mutex);//播放线程 网络线程 m_mapOutputAudioBuf
			ResetStatus();
			return;
		}

		IsCanCalcRecvRate()?m_fRecvRate = CalcRecevRate():NULL;
		m_fSendRate = CanCalcPlayRate();

		//ErrTrace("CBufferOutputAudioEngine::Play() m_mapOutputAudioBuf.size()=%d,seq=%d,m_fRecvRate=%f,m_fSendRate=%f\n",m_mapOutputAudioBuf.size(),m_iMaxSequenceId - m_iMinSequenceId+1,m_fRecvRate,m_fSendRate);

		unsigned int iLimit = 0;
		DWORD dwCurrTime = GetTickCount();
		while (m_fLastPlayTime < dwCurrTime && ++iLimit<5)
		{
			m_fLastPlayTime += m_fSendRate;
			m_iStartPlayCount++;
			PlayPackets();
			SwitchToThread();
		}
		CheckPacket();
		RefreshStatus();
}
void STutorialButton::LaunchBrowser()
{
	RefreshStatus();

	FIntroTutorials& IntroTutorials = FModuleManager::GetModuleChecked<FIntroTutorials>(TEXT("IntroTutorials"));
	IntroTutorials.SummonTutorialBrowser();
}
Esempio n. 5
0
BOOL USER::GetMemberOf (LPTSTR *ppmsz, ULONG *pStatus)
{
   if (!RefreshStatus (TRUE, pStatus))
      return FALSE;
   *ppmsz = CloneMultiString (m_mszMemberOf);
   return TRUE;
}
FReply STutorialButton::HandleButtonClicked()
{
	if (bPendingClickAction)
	{
		//There's already a click pending
		return FReply::Handled();
	}

	RefreshStatus();

	if (FEngineAnalytics::IsAvailable())
	{
		TArray<FAnalyticsEventAttribute> EventAttributes;
		EventAttributes.Add(FAnalyticsEventAttribute(TEXT("Context"), Context.ToString()));
		EventAttributes.Add(FAnalyticsEventAttribute(TEXT("TimeSinceAlertStarted"), (AlertStartTime != 0.0f && ShouldShowAlert()) ? (FPlatformTime::Seconds() - AlertStartTime) : -1.0f));
		EventAttributes.Add(FAnalyticsEventAttribute(TEXT("LaunchedBrowser"), ShouldLaunchBrowser()));

		FEngineAnalytics::GetProvider().RecordEvent(TEXT("Rocket.Tutorials.ClickedContextButton"), EventAttributes);
	}

	bPendingClickAction = true;
	RegisterActiveTimer(0.f, FWidgetActiveTimerDelegate::CreateSP(this, &STutorialButton::HandleButtonClicked_AssetRegistryChecker));
	FIntroTutorials& IntroTutorials = FModuleManager::GetModuleChecked<FIntroTutorials>(TEXT("IntroTutorials"));
	IntroTutorials.AttachWidget(LoadingWidget);
	return FReply::Handled();
}
Esempio n. 7
0
void CDebugScripts::RefreshList()
{
    int nIndex = m_ScriptList.GetSelectedIndex();

    CPath SearchPath("Scripts", "*");

    if (!SearchPath.FindFirst(CPath::FIND_ATTRIBUTE_ALLFILES))
    {
        return;
    }

    m_ScriptList.SetRedraw(false);
    m_ScriptList.DeleteAllItems();

    do
    {
        stdstr scriptFileName = SearchPath.GetNameExtension();
        m_ScriptList.AddItem(0, 0, scriptFileName.c_str());
    } while (SearchPath.FindNext());

    m_ScriptList.SetRedraw(true);
    m_ScriptList.Invalidate();

    if (nIndex >= 0)
    {
        m_ScriptList.SelectItem(nIndex);
        RefreshStatus();
    }
}
Esempio n. 8
0
BOOL FILESET::GetStatus (LPFILESETSTATUS lpfs, BOOL fNotify, ULONG *pStatus)
{
   if (!RefreshStatus (fNotify, pStatus))
      return FALSE;

   memcpy (lpfs, &m_fs, sizeof(FILESETSTATUS));
   return TRUE;
}
Esempio n. 9
0
BOOL USER::GetStatus (LPUSERSTATUS lpus, BOOL fNotify, ULONG *pStatus)
{
   if (!RefreshStatus (fNotify, pStatus))
      return FALSE;

   memcpy (lpus, &m_us, sizeof(USERSTATUS));
   return TRUE;
}
Esempio n. 10
0
void
TaskClosePanel::Show(const PixelRect &rc)
{
  dlgTaskManager::TaskViewRestore(wTaskView);
  RefreshStatus();

  XMLWidget::Show(rc);
}
Esempio n. 11
0
BOOL SERVICE::GetStatus (LPSERVICESTATUS lpss, BOOL fNotify, ULONG *pStatus)
{
   if (!RefreshStatus (fNotify, pStatus))
      return FALSE;

   memcpy (lpss, &m_ss, sizeof(SERVICESTATUS));
   return TRUE;
}
Esempio n. 12
0
void
TaskClosePanel::Show(const PixelRect &rc)
{
  RefreshStatus();

  const Layout layout(rc, look);
  close_button.MoveAndShow(layout.close_button);
  message.MoveAndShow(layout.message);
  revert_button.MoveAndShow(layout.revert_button);
}
Esempio n. 13
0
BOOL SERVER::GetStatus (LPSERVERSTATUS lpss, BOOL fNotify, ULONG *pStatus)
{
   BOOL rc = TRUE;

   if (m_fMonitor)
      rc = RefreshStatus (fNotify, pStatus);

   memcpy (lpss, &m_ss, sizeof(SERVERSTATUS));
   return rc;
}
Esempio n. 14
0
LRESULT	CDebugScripts::OnScriptListClicked(NMHDR* pNMHDR)
{
    // Select instance for console input
    NMITEMACTIVATE* pIA = reinterpret_cast<NMITEMACTIVATE*>(pNMHDR);
    int nItem = pIA->iItem;

    m_ScriptList.GetItemText(nItem, 0, m_SelectedScriptName, MAX_PATH);

    RefreshStatus();

    return 0;
}
Esempio n. 15
0
void QSerialTerminal::keyPressEvent(QKeyEvent* event)
{
    if(!this->isVisible())
    {
        return;
    }

    if(serial != NULL)
    {
        char data = event->text().toLocal8Bit()[0];
        int key = event->key();

        switch(key)
        {
            case Qt::Key_Return:
            case Qt::Key_Enter:
                data = '\n';
                key = '\n';
                break;
        }

        if(key < 0x100)
        {
            transmitThread->enqueue(data);
            TotalTx++;
            if(serial->QueueReceiveSignals)
            {
                emit RefreshStatus();
                dirty = false;
            }
            else
            {
                dirty = true;
            }
        }

        event->accept();

        if(lastReceive.elapsed() > 200 &&
            serial->QueueReceiveSignals > 0 &&
            serial->bytesAvailable() > 0)
        {
            serialReceive();
        }
    }
    else
    {
        // Not connected to serial port, revert to being a plain text editor widget
        // so that Cut and Paste key shortcuts work.
        QPlainTextEdit::keyPressEvent(event);
    }
}
Esempio n. 16
0
void QSerialTerminal::clear()
{
    TotalRx = 0;
    TotalTx = 0;
    runningAverageDivisor = 1;
    RxPerSecond = 0;

    emit RefreshStatus();
    dirty = false;

    editorCharacterCount = 0;
    QPlainTextEdit::clear();
}
Esempio n. 17
0
void
TaskClosePanel::OnAction(int id) noexcept
{
  switch (id) {
  case CLOSE:
    CommitAndClose();
    break;

  case REVERT:
    dialog.Revert();
    RefreshStatus();
    break;
  }
}
Esempio n. 18
0
LPIDENT FILESET::GetReadWriteIdentifier (ULONG *pStatus)
{
   if (m_lpiThisRW == NULL)
      {
      if (RefreshStatus (TRUE, pStatus))
         {
         if ((m_lpiThisRW = IDENT::FindIdent (this, &m_fs.idReadWrite)) == NULL)
            {
            if (pStatus)
               *pStatus = ERROR_FILE_NOT_FOUND;
            }
         }
      }

   return m_lpiThisRW;
}
Esempio n. 19
0
LPIDENT FILESET::GetCloneIdentifier (ULONG *pStatus)
{
   if (m_lpiThisBK == NULL)
      {
      if (RefreshStatus (TRUE, pStatus))
         {
         if ((m_lpiThisBK = IDENT::FindIdent (this, &m_fs.idClone)) == NULL)
            {
            if (pStatus)
               *pStatus = ERROR_FILE_NOT_FOUND;
            }
         }
      }

   return m_lpiThisBK;
}
EActiveTimerReturnType STutorialButton::HandleButtonClicked_AssetRegistryChecker(double InCurrentTime, float InDeltaTime)
{
	//Force tutorials to load into the asset registry before we proceed any further.
	FAssetRegistryModule& AssetRegistry = FModuleManager::LoadModuleChecked<FAssetRegistryModule>(TEXT("AssetRegistry"));
	bool IsStillLoading = AssetRegistry.Get().IsLoadingAssets();
	if (IsStillLoading)
	{
		//We could tick the asset registry here, but we don't need to.
		return EActiveTimerReturnType::Continue;
	}

	//Sometimes, this gives a false positive because the tutorial we want to launch wasn't loaded into the asset registry when we checked. Opening and closing the tab works around that by letting the browser recheck.
	if (ShouldLaunchBrowser())
	{
		RefreshStatus();
	}

	//Now we know the asset registry is loaded, the tutorial broswer is updated, and we are ready to complete the click and stop this active timer
	FIntroTutorials& IntroTutorials = FModuleManager::GetModuleChecked<FIntroTutorials>(TEXT("IntroTutorials"));
	IntroTutorials.DetachWidget();
	if (ShouldLaunchBrowser())
	{
		IntroTutorials.SummonTutorialBrowser();
	}
	else if (CachedLaunchTutorial != nullptr)
	{
		//If we don't want to launch the browser, and we have a tutorial in mind, launch the tutorial now.
		auto Delegate = FSimpleDelegate::CreateSP(this, &STutorialButton::HandleTutorialExited);

		IntroTutorials.LaunchTutorial(CachedLaunchTutorial, IIntroTutorials::ETutorialStartType::TST_RESTART, ContextWindow, Delegate, Delegate);

		// The user asked to start the tutorial, so we don't need to remind them about it again.
		// We used to remind them in future sessions, but user preference is that we don't.
		const bool bDismissAcrossSessions = true;
		GetMutableDefault<UTutorialStateSettings>()->DismissTutorial(CachedLaunchTutorial, bDismissAcrossSessions);
		GetMutableDefault<UTutorialStateSettings>()->SaveProgress();
		bTutorialDismissed = true;
	}

	bPendingClickAction = false;
	return EActiveTimerReturnType::Stop;
}
Esempio n. 21
0
void QSerialTerminal::timerEvent(QTimerEvent* e)
{
    if(lastReceive.elapsed() > 200 &&
        serial != NULL &&
        serial->QueueReceiveSignals > 0)
    {
        if(serial->bytesAvailable() > 0)
        {
            serialReceive();
        }

        if(dirty)
        {
            emit RefreshStatus();
            dirty = false;
        }
    }

    QPlainTextEdit::timerEvent(e);
}
Esempio n. 22
0
LPIDENT FILESET::GetReadOnlyIdentifier (LPIDENT lpiParent, ULONG *pStatus)
{
   LPIDENT lpiRO = NULL;

   if (RefreshStatus (TRUE, pStatus))
      {
      if (lpiParent == NULL)
         lpiParent = m_lpiCell;

      if (m_fs.idReplica)
         {
         lpiRO = IDENT::FindFileset (lpiParent, &m_fs.idReplica);
         }
      else
         {
         TCHAR szNameRO[ cchNAME ];
         lstrcpy (szNameRO, m_szName);

         LPCTSTR pszExtension;
         if ((pszExtension = lstrrchr (szNameRO, TEXT('.'))) == NULL)
            lstrcat (szNameRO, TEXT(".readonly"));
         else if (lstrcmpi (pszExtension, TEXT(".readonly")) && lstrcmpi (pszExtension, TEXT(".backup")))
            lstrcat (szNameRO, TEXT(".readonly"));

         lpiRO = IDENT::FindFileset (lpiParent, szNameRO);
         }

      if (lpiRO == NULL)
         {
         if (pStatus)
            *pStatus = ERROR_FILE_NOT_FOUND;
         }
      }

   return lpiRO;
}
Esempio n. 23
0
BOOL SERVER::CanTalkToServer (ULONG *pStatus)
{
   // Ensure the server exists in the cell at all--
   // this call just updates the server's IP addresses
   // etc (information it gets from the database servers)
   // and doesn't require talking to the server itself.
   //
   if (!RefreshStatus (FALSE, pStatus))
      return FALSE;

   // Find a new refsec array element to use...
   //
   AfsClass_InitRefreshSections();
   EnterCriticalSection (pcsRefSec);

   int idSection;
   for (idSection = 0; idSection < (int)cRefSec; ++idSection)
      {
      if (!aRefSec[ idSection ].fInUse)
         break;
      }
   if (idSection == (int)cRefSec)
      {
      if (!REALLOC (aRefSec, cRefSec, 1+idSection, 4))
         {
         if (pStatus)
            *pStatus = GetLastError();
         LeaveCriticalSection (pcsRefSec);
         return FALSE;
         }
      }
   aRefSec[ idSection ].fInUse = TRUE;
   aRefSec[ idSection ].fCanceled = FALSE;
   aRefSec[ idSection ].lpServer = this;
   aRefSec[ idSection ].hCell = NULL;

   LPCELL lpCell;
   if ((lpCell = OpenCell()) != NULL)
      {
      aRefSec[ idSection ].hCell = lpCell->GetCellObject();
      lpCell->Close();
      }

   LeaveCriticalSection (pcsRefSec);

   // Until we find out differently, assume that we won't be
   // able to query VOS or BOS on this server.
   //
   m_fCanGetAggregates = FALSE;
   m_fCanGetServices = FALSE;
   m_lastStatus = 0;

   // Fork a separate thread, on which to quickly try to talk
   // to the server.
   //
   DWORD dwThreadID;
   HANDLE hThread;
   if ((hThread = CreateThread (NULL, 0, (LPTHREAD_START_ROUTINE)CanTalkToServer_ThreadProc, IntToPtr(idSection), 0, &dwThreadID)) == NULL)
      {
      EnterCriticalSection (pcsRefSec);
      aRefSec[ idSection ].fInUse = FALSE;
      LeaveCriticalSection (pcsRefSec);
      if (pStatus)
         *pStatus = GetLastError();
      return FALSE;
      }
   SetThreadPriority (hThread, THREAD_PRIORITY_BELOW_NORMAL);

   // Wait for that thread to terminate, or for our
   // newly-allocated RefSec entry to be marked Canceled.
   //
   DWORD dw;
   for (dw = STILL_ACTIVE; dw == STILL_ACTIVE; )
      {
      EnterCriticalSection (pcsRefSec);

      GetExitCodeThread (hThread, &dw);
      if (dw == STILL_ACTIVE)
         {
         if ( (aRefSec[ idSection ].fInUse) &&
              (aRefSec[ idSection ].lpServer == this) &&
              (aRefSec[ idSection ].fCanceled) )
            {
            if (m_lastStatus == 0)
               m_lastStatus = ERROR_CANCELLED;
            dw = 0;
            }
         }

      LeaveCriticalSection (pcsRefSec);

      if (dw == STILL_ACTIVE)
         Sleep(100);	// wait another brief instant
      }

   // dw == 0 : user canceled operation (thread is still running!)
   // dw == 1 : thread completed successfully, and set fCanTalkTo* flags.
   //
   // Note that the thread will clear aRefSec[idSection].fInUse when it
   // terminates (so, if dw!=-1, it has already done so).
   //
   if (pStatus)
      *pStatus = m_lastStatus;
   return (dw == 0) ? FALSE : TRUE;
}
void STutorialButton::HandleTutorialExited()
{
	RefreshStatus();
}
Esempio n. 25
0
void QSerialTerminal::serialReceive()
{
    QString text;
    unsigned char byte;
    int i;
    QByteArray data = serial->read(serial->bytesAvailable());    
    int dataCount = data.count();

    double delta, bitsPerSecond;
    static int rxBytes = 0;
    static double elapsed = 0;

    elapsed = rxTime.elapsed() - elapsed;
    rxBytes += dataCount;
    TotalRx += dataCount;

    lastReceive.start();
    if(editorCharacterCount > 5 * 1024)
    {
        QPlainTextEdit::clear();
        editorCharacterCount = 0;
    }

    if(editorCharacterCount + dataCount > 5 * 1024)
    {
        // We are getting too much data to safely display in the GUI.
        QPlainTextEdit::clear();
        editorCharacterCount = 0;

        // Drop some data to prevent GUI lockup.
        data = data.right(5 * 1024);
        dataCount = data.count();
    }

    editorCharacterCount += dataCount;

    for(i = 0; i < dataCount; i++)
    {
        byte = data[i];
        if(byte == '\r')
        {
            flushText(text, cursor);
            int j = cursor.position() + 1;
            cursor.movePosition(QTextCursor::StartOfLine);
            j -= cursor.position();
            editorCharacterCount -= j;
        }
        else if(byte == '\n')
        {
            flushText(text, cursor);
            cursor.movePosition(QTextCursor::EndOfLine);
            text.append(byte);
        }
/*        else if(byte == 0x07)   // audible bell
        {

        }*/
        else if(byte == 0x08)   // backspace
        {
            flushText(text, cursor);
            if(cursor.columnNumber() != 0)
            {
                cursor.movePosition(QTextCursor::PreviousCharacter);
            }
            editorCharacterCount -= 2;
        }
        else
        {
            if(byte >= ' ' && byte < 127)
            {
                text.append(byte);
            }
            else
            {
                text.append('<');
                text.append(QString::number(byte, 16));
                text.append('>');
            }
        }
    }
    flushText(text, cursor);
    setTextCursor(cursor);
    ensureCursorVisible();

    // calculate incoming data rate
    if(rxTime.elapsed() > 1000)
    {
        bitsPerSecond = ((double)(rxBytes * 10 * 1000)) / rxTime.restart();;
        rxBytes = 0;

        // now average the data rate over time so that the display is easier to read
        delta = bitsPerSecond - RxPerSecond;
        if(elapsed < 500)
        {
            delta /= runningAverageDivisor;
            if(runningAverageDivisor < 100)
            {
                runningAverageDivisor++;
            }
        }
        else
        {
            runningAverageDivisor = 1;
        }
        RxPerSecond += delta;
    }
    elapsed = rxTime.elapsed();

    emit RefreshStatus();
    dirty = false;
    serial->QueueReceiveSignals = 1; // allow serial engine to queue another receive event
}
Esempio n. 26
0
void CMainFrame::OnRefreshStatus(UINT /*wNotifyCode*/, int /*wID*/, HWND /*hwndCtl*/)
{
	RefreshStatus();
}