Esempio n. 1
0
void Window_Message::Update() {
	Window_Selectable::Update();
	number_input_window->Update();

	if (visible && !Game_Message::visible) {
		// The Event Page ended but the MsgBox was used in this Event
		// It can be closed now.
		TerminateMessage();
		SetCloseAnimation(5);
		// Remove this when the Close Animation is implemented
		// The close animation must set the visible false flag
		visible = false;
	}
	else if (pause) {
		WaitForInput();
	} else if (active) {
		InputChoice();
	} else if (number_input_window->GetVisible()) {
		InputNumber();
	} else if (!text.empty()) {
		// Output the remaining text for the current page
		UpdateMessage();
	}
	else if (IsNextMessagePossible()) {
		// Output a new page
		StartMessageProcessing();
		//printf("Text: %s\n", text.c_str());
		if (!visible) {
			// The MessageBox is not open yet but text output is needed
			SetOpenAnimation(5);
			visible = true;
		}
		Game_Message::visible = true;
	}
}
Esempio n. 2
0
void DLProcess::parsePBILine(QString line){
  //Quick checks for line formatting
  if( line.startsWith("FETCH:") ){ emit UpdateMessage(tr("Download Starting...")); return; }
  else if( line == "FETCHDONE"){ emit UpdateMessage(tr("Download Finished")); return; }
  else if(!line.startsWith("SIZE:")){ emit UpdateMessage(line); return; }
  //Now parse the PBI download line
  //qDebug() << "parse Download Line:" << line;
  //Line format: SIZE:  <KB> DOWNLOADED:  <KB> SPEED:  <KB/s> KB/s
  line = line.simplified();
  line.replace("SIZE: ","");
  line.replace("DOWNLOADED: ", "");
  line.replace("SPEED: ","");
  line.replace("KB/s","");
  //Now run the calculations and emit the signal
  calculateStats(line.section(" ",1,1), line.section(" ",0,0), line.section(" ",2,2), "");
}
Esempio n. 3
0
bool wxProgressDialog::Pulse(const wxString& newmsg, bool *skip)
{
    if ( !DoBeforeUpdate(skip) )
        return false;

    wxASSERT_MSG( m_gauge, wxT("cannot update non existent dialog") );

    // show a bit of progress
    m_gauge->Pulse();

    UpdateMessage(newmsg);

    if (m_elapsed || m_remaining || m_estimated)
    {
        unsigned long elapsed = wxGetCurrentTime() - m_timeStart;

        SetTimeLabel(elapsed, m_elapsed);
        SetTimeLabel((unsigned long)-1, m_estimated);
        SetTimeLabel((unsigned long)-1, m_remaining);
    }

    DoAfterUpdate();

    return m_state != Canceled;
}
Esempio n. 4
0
bool wxGenericProgressDialog::Pulse(const wxString& newmsg, bool *skip)
{
    if ( !DoBeforeUpdate(skip) )
        return false;

    wxCHECK_MSG( m_gauge, false, "dialog should be fully created" );

    // show a bit of progress
    m_gauge->Pulse();

    UpdateMessage(newmsg);

    if (m_elapsed || m_remaining || m_estimated)
    {
        unsigned long elapsed = wxGetCurrentTime() - m_timeStart;

        SetTimeLabel(elapsed, m_elapsed);
        SetTimeLabel((unsigned long)-1, m_estimated);
        SetTimeLabel((unsigned long)-1, m_remaining);
    }

    DoAfterUpdate();

    return m_state != Canceled;
}
Esempio n. 5
0
 PBIBackend::PBIBackend(QWidget *parent, QSplashScreen *splash) : QObject(){
   parentWidget = parent;
   Splash = splash;
   updateSplashScreen(tr("Initializing"));
   sysArch = Extras::getSystemArch();
   sysUser = Extras::getRegularUser();
   autoDE = false; //automatically create desktop entries after an install
   PKGRUN.clear(); //make sure this is empty initially
   appAvailable  = -1; //quick default
   pkgAvailable = -1; //quick default
	 
   pkgProc = new DLProcess(this);
     pkgProc->setParentWidget(parentWidget);
     pkgProc->setDLType("PKG");
     connect(pkgProc, SIGNAL(UpdateMessage(QString)), this, SLOT(procMessage(QString)) );
     connect(pkgProc, SIGNAL(UpdatePercent(QString,QString,QString)), this, SLOT(procPercent(QString,QString,QString)) );
     connect(pkgProc, SIGNAL(finished(int,QProcess::ExitStatus)), this, SLOT(procFinished(int, QProcess::ExitStatus)) );
     
   sysDB = new PBIDBAccess();
   //Now startup the syncing process
   UpdateIndexFiles(false); //do not force pbi index redownload on startup
   //Done with initial sync - disable splash screen
   updateSplashScreen(tr("Starting UI"));
   Splash = 0;
 }
void NotificationWnd::UpdateProgress(int current, int total)
{
    CrashIf(total <= 0);
    if (total <= 0)
        total = 1;
    progress = limitValue(100 * current / total, 0, 100);
    if (hasProgress && progressMsg) {
        ScopedMem<WCHAR> message(str::Format(progressMsg, current, total));
        UpdateMessage(message);
    }
}
Esempio n. 7
0
CAbstractUpdateController::CAbstractUpdateController()
{
    mCurrentState= eNOT_INITIALIZED;
    mUpdProc.setProcessChannelMode(QProcess::MergedChannels);
    connect(&mUpdProc, SIGNAL(UpdateMessage(QString)),
            this, SLOT(slotProcessRead(QString)));
    connect(&mUpdProc, SIGNAL(finished(int,QProcess::ExitStatus)),
            this, SLOT(slotProcessFinished(int,QProcess::ExitStatus)));
    connect(&mUpdProc, SIGNAL(UpdatePercent(QString, QString, QString)),
            this, SLOT(slotDLProcUpdatePercent(QString, QString, QString)));
}
Esempio n. 8
0
/*
========================
idMenuScreen_HUD::UpdateGameTime
========================
*/
void idMenuScreen_HUD::UpdateGameTime( const char * time ) {

	if ( !mpTime ) {
		return;
	}

	UpdateMessage( false, "" );

	mpTime->SetText( time );
	mpTime->SetStrokeInfo( true, 0.75f, 1.5f );

}
M_RESULT SnarlInterface::UpdateMessage(LONG32 id, LPCWSTR szTitle, LPCWSTR szText, LPCWSTR szIconPath)
{
	LPSTR szParam1 = WideToUTF8(szTitle);
	LPSTR szParam2 = WideToUTF8(szText);
	LPSTR szParam3 = WideToUTF8(szIconPath);
	
	M_RESULT result = UpdateMessage(id, szParam1, szParam2, szParam3);
	
	delete [] szParam1;
	delete [] szParam2;
	delete [] szParam3;
	
	return result;
}
void Window_Message::Update() {
	Window_Selectable::Update();
	number_input_window->Update();
	gold_window->Update();

	if (pause) {
		WaitForInput();
	} else if (active) {
		InputChoice();
	} else if (number_input_window->GetVisible()) {
		InputNumber();
	} else if (!text.empty()) {
		// Output the remaining text for the current page
		UpdateMessage();
	} else if (IsNextMessagePossible()) {
		// Output a new page
		if (Game_Temp::inn_calling) {
			ShowGoldWindow();
		}

		StartMessageProcessing();
		//printf("Text: %s\n", text.c_str());
		if (!visible) {
			// The MessageBox is not open yet but text output is needed
			// Open and Close Animations are skipped in battle
			SetOpenAnimation(Game_Temp::battle_running ? 0 : 5);
		} else if (closing) {
			// Cancel closing animation
			SetOpenAnimation(0);
		}
		Game_Message::visible = true;
	} else if (!Game_Message::message_waiting && Game_Message::visible) {
		if (visible && !closing) {
			// Start the closing animation
			SetCloseAnimation(Game_Temp::battle_running ? 0 : 5);
		} else if (!visible) {
			// The closing animation has finished
			Game_Message::visible = false;
			Game_Message::owner_id = 0;
		}
	}
}
Esempio n. 11
0
void DLProcess::newProcessMessage()
{
    while(this->canReadLine()){
      QString line = this->readLine().simplified();
      if(line.isEmpty()){ continue; }
      if(DLTYPE == 0){ 
        // PBI Download format
        parsePBILine(line);
      }else if(DLTYPE == 1){
      	//PKG Download format
      	//qDebug() << "pkg message: "<< line;
      	parsePKGLine(line);
      }else if(DLTYPE == 2){
        // CDN Download format
        parsePBILine(line); //same parser as PBI's at the moment
      }else{
        //Don't have parsing rules for this type: just spit it out
        emit UpdateMessage(line);
      }
    }//End of loop over main process lines
}
Esempio n. 12
0
void CASW_VGUI_Info_Message::OnThink()
{
	UpdateMessage();

	int x,y,w,t;
	GetBounds(x,y,w,t);
	
	InvalidateLayout(true);

	if (m_pOkayButton->IsCursorOver())
	{
		m_pOkayButton->SetBgColor(Color(255,255,255,200));
		m_pOkayButton->SetFgColor(Color(0,0,0,255));
	}
	else
	{
		m_pOkayButton->SetBgColor(Color(19,20,40,200));
		m_pOkayButton->SetFgColor(Color(255,255,255,255));
	}

	if (m_pLogButton)
	{
		if (m_pLogButton->IsCursorOver())
		{
			m_pLogButton->SetBgColor(Color(255,255,255,200));
			m_pLogButton->SetFgColor(Color(0,0,0,255));
		}
		else
		{
			m_pLogButton->SetBgColor(Color(19,20,40,200));
			m_pLogButton->SetFgColor(Color(255,255,255,255));
		}
	}
	
	if (m_bClosingMessage && GetAlpha() <= 0)
	{
		SetVisible(false);
		MarkForDeletion();
	}
}
Esempio n. 13
0
bool
wxProgressDialog::Update(int value, const wxString& newmsg, bool *skip)
{
    wxASSERT_MSG( value == -1 || m_gauge, wxT("cannot update non existent dialog") );

#ifdef __WXMSW__
    value /= m_factor;
#endif // __WXMSW__

    wxASSERT_MSG( value <= m_maximum, wxT("invalid progress value") );

    if ( m_gauge )
        m_gauge->SetValue(value);

    UpdateMessage(newmsg);

    if ( (m_elapsed || m_remaining || m_estimated) && (value != 0) )
    {
        unsigned long elapsed = wxGetCurrentTime() - m_timeStart;
        if (    m_last_timeupdate < elapsed
             || value == m_maximum
           )
        {
            m_last_timeupdate = elapsed;
            unsigned long estimated = m_break +
                  (unsigned long)(( (double) (elapsed-m_break) * m_maximum ) / ((double)value)) ;
            if (    estimated > m_display_estimated
                 && m_ctdelay >= 0
               )
            {
                ++m_ctdelay;
            }
            else if (    estimated < m_display_estimated
                      && m_ctdelay <= 0
                    )
            {
                --m_ctdelay;
            }
            else
            {
                m_ctdelay = 0;
            }
            if (    m_ctdelay >= m_delay          // enough confirmations for a higher value
                 || m_ctdelay <= (m_delay*-1)     // enough confirmations for a lower value
                 || value == m_maximum            // to stay consistent
                 || elapsed > m_display_estimated // to stay consistent
                 || ( elapsed > 0 && elapsed < 4 ) // additional updates in the beginning
               )
            {
                m_display_estimated = estimated;
                m_ctdelay = 0;
            }
        }

        long display_remaining = m_display_estimated - elapsed;
        if ( display_remaining < 0 )
        {
            display_remaining = 0;
        }

        SetTimeLabel(elapsed, m_elapsed);
        SetTimeLabel(m_display_estimated, m_estimated);
        SetTimeLabel(display_remaining, m_remaining);
    }

    if ( value == m_maximum )
    {
        if ( m_state == Finished )
        {
            // ignore multiple calls to Update(m_maximum): it may sometimes be
            // troublesome to ensure that Update() is not called twice with the
            // same value (e.g. because of the rounding errors) and if we don't
            // return now we're going to generate asserts below
            return true;
        }

        // so that we return true below and that out [Cancel] handler knew what
        // to do
        m_state = Finished;
        if( !(GetWindowStyle() & wxPD_AUTO_HIDE) )
        {
            EnableClose();
            DisableSkip();
#if defined(__WXMSW__) && !defined(__WXUNIVERSAL__)
            EnableCloseButton();
#endif // __WXMSW__

            if ( newmsg.empty() )
            {
                // also provide the finishing message if the application didn't
                m_msg->SetLabel(_("Done."));
            }

            wxYieldIfNeeded() ;

            (void)ShowModal();
        }
        else // auto hide
        {
            // reenable other windows before hiding this one because otherwise
            // Windows wouldn't give the focus back to the window which had
            // been previously focused because it would still be disabled
            ReenableOtherWindows();

            Hide();
        }
    }
    else // not at maximum yet
    {
        return DoAfterUpdate(skip);
    }

    // update the display in case yielding above didn't do it
    Update();

    return m_state != Canceled;
}
Esempio n. 14
0
byte LunaticRun(int *lastTime)
{
	numRunsToMakeUp = 0;
	if (*lastTime > TIME_PER_FRAME * 30)
		*lastTime = TIME_PER_FRAME * 30;

	while (*lastTime >= TIME_PER_FRAME)
	{
		if (!gamemgl->Process())
		{
			mapToGoTo = 255;
			return LEVEL_ABORT;
		}

		if (gameMode == GAMEMODE_PLAY)
		{
			// update everything here
			if (!windingDown)
			{
				if (windingUp)
				{
					curMap->Update(UPDATE_FADEIN, &curWorld);
					EditorUpdateGuys(curMap);
					windingUp--;
				}
				else
				{
					curMap->Update(UPDATE_GAME, &curWorld);
					UpdateGuys(curMap, &curWorld);
					UpdateBullets(curMap, &curWorld);
					SpecialAnytimeCheck(curMap);
				}
			}
			else
			{
				curMap->Update(UPDATE_FADE, &curWorld);
				EditorUpdateGuys(curMap);
			}
			UpdateParticles(curMap);
			UpdateMessage();

			if (curMap->flags & MAP_SNOWING)
				MakeItSnow(curMap);

			if (windingDown)
			{
				windingDown--;
				if (!windingDown)
					return windDownReason;
			}
		}
		else if (gameMode == GAMEMODE_MENU)
		{
			switch (UpdatePauseMenu(gamemgl)) {
				case 0:
					lastKey = 0;
					gameMode = GAMEMODE_PLAY;
					break;
				case 1:
					break;
				case 2:
					if (mapNum)
						mapToGoTo = 0;
					else
						mapToGoTo = 255;
					lastKey = 0;
					return LEVEL_ABORT;
					break;
				case 3:
					mapToGoTo = 255;
					lastKey = 0;
					return WORLD_QUITGAME; // dump out altogether
					break;
			}
		}
		else if (gameMode == GAMEMODE_PIC) // gamemode_pic
		{
			if (GetTaps()&(CONTROL_B1 | CONTROL_B2))
			{
				gameMode = GAMEMODE_PLAY;
				// restore the palette
				gamemgl->LoadBMP("graphics\\title.bmp");
			}
		}
		else // gamemode_rage
		{
			UpdateRage(gamemgl);
			if (player.rageClock)
				player.rageClock--;
			else
			{
				gameMode = GAMEMODE_PLAY;
				StartRaging();
			}
			if (goodguy)
				goodguy->facing = (goodguy->facing + 1)&7;
		}

		if (msgFromOtherModules == MSG_NEWFEATURE)
		{
			NewMessage("** NEW FEATURE ADDED!! **", 120, 1);
			msgFromOtherModules = MSG_NONE;
		}
		else if (msgFromOtherModules == MSG_GOTOMAP)
		{
			mapToGoTo = msgContent;
			windingDown = 30;
			windDownReason = LEVEL_ABORT;
			msgFromOtherModules = MSG_NONE;
		}
		else if (msgFromOtherModules == MSG_WINLEVEL)
		{
			mapToGoTo = msgContent;
			windingDown = 40;
			windDownReason = LEVEL_WIN;
			msgFromOtherModules = MSG_NONE;
			if (player.worldNum == 4 && player.levelNum == 6)
			{

				ShowVictoryAnim(4); // you killed him.
				SendMessageToGame(MSG_WINGAME, 0);
			}
			player.boredom = 0;
		}
		else if (msgFromOtherModules == MSG_RESET)
		{
			if (opt.youSuck)
				NewBigMessage("You Suck", 30);
			else
				NewBigMessage("Try Again!", 30);
			windingDown = 30;
			windDownReason = LEVEL_RESET;
			msgFromOtherModules = MSG_NONE;
		}
		else if (msgFromOtherModules == MSG_LOADGAME)
		{
			NewBigMessage("Loading Game", 30);
			windingDown = 30;
			windDownReason = LEVEL_LOADING;
			msgFromOtherModules = MSG_NONE;
		}
		else if (msgFromOtherModules == MSG_WINGAME)
		{
			dword CDtime;

			mapToGoTo = 0;
			windingDown = 1;
			windDownReason = LEVEL_WIN;
			msgFromOtherModules = MSG_NONE;
			CDtime = timeGetTime();
			VictoryText(gamemgl);
			Credits(gamemgl);
			garbageTime += timeGetTime() - CDtime;
			player.boredom = 0;
		}
		*lastTime -= TIME_PER_FRAME;
		numRunsToMakeUp++;
		updFrameCount++;
	}
	HandleCDMusic();
	garbageTime = 0;
	JamulSoundUpdate();

	return LEVEL_PLAYING;
}
Esempio n. 15
0
static cv::Mat RunLoopyBPOnGrideGraph(std::string rootFolder, MCImg<float> &unaryCosts, cv::Mat &imL)
{
	struct LoopyBPOnGridGraphEvalParams {
		MCImg<float> *allMessages;
		MCImg<float> *allBeliefs;
		MCImg<float> *unaryCosts;
		LoopyBPOnGridGraphEvalParams() : allMessages(0), allBeliefs(0), unaryCosts(0) {}
	};

	int numRows = unaryCosts.h, numCols = unaryCosts.w, numDisps = unaryCosts.n;
	std::vector<cv::Point2i> pixelList(numRows * numCols);
	for (int y = 0, id = 0; y < numRows; y++) {
		for (int x = 0; x < numCols; x++, id++) {
			pixelList[id] = cv::Point2i(x, y);
		}
	}
	
	MCImg<float> oldMessages(numRows, numCols, 4 * numDisps);
	MCImg<float> newMessages(numRows, numCols, 4 * numDisps);
	MCImg<float> allBeliefs(numRows, numCols, numDisps);

	// Step 1 - Initialize messages
	memset(oldMessages.data, 0, 4 * numRows * numCols * numDisps * sizeof(float));
	memset(newMessages.data, 0, 4 * numRows * numCols * numDisps * sizeof(float));
	for (int i = 0; i < numRows * numCols * numDisps; i++) {
		allBeliefs.data[i] = 1.f / numDisps;
	}

	// Step 2 - Update messages
	float maxBeliefDiff = FLT_MAX;
	const int maxBPRound = 100;
	for (int round = 0; round < maxBPRound && maxBeliefDiff > 1e-7; round++) {
		int tic = clock();
		if (round % 1 == 0) {
			cv::Mat dispMap = DecodeDisparityFromBeliefs(allBeliefs);
			
			//std::vector<std::pair<std::string, void*>> auxParams;
			//auxParams.push_back(std::pair<std::string, void*>("allMessages", &oldMessages));
			//auxParams.push_back(std::pair<std::string, void*>("allBeliefs",  &allBeliefs));
			//auxParams.push_back(std::pair<std::string, void*>("unaryCosts",   &unaryCosts));
			//EvaluateDisparity(rootFolder, dispMap, 1.f, auxParams, "OnMouseLoopyBPOnGridGraph");

			LoopyBPOnGridGraphEvalParams evalParams;
			evalParams.allMessages = &oldMessages;
			evalParams.allBeliefs  = &allBeliefs;
			evalParams.unaryCosts  = &unaryCosts;
			EvaluateDisparity(rootFolder, dispMap, 1.f, &evalParams, "OnMouseLoopyBPOnGridGraph");
		}


		printf("Doing round %d ...\n", round);
		std::random_shuffle(pixelList.begin(), pixelList.end());
		//printf("pixelList.size() = %d\n", pixelList.size());
		//printf("numDisps = %d\n", numDisps);
		int numPixels = pixelList.size();

		// update messages
		#pragma omp parallel for
		for (int i = 0; i < numPixels; i++) {
			if (i % 1000 == 0) {
				//printf("i = %d\n", i);
			}

			cv::Point2i s = pixelList[i];
			for (int k = 0; k < 4; k++) {
				cv::Point2i t = s + dirDelta[k];
				
				UpdateMessage(s, t, oldMessages, newMessages, unaryCosts, imL);
				
			}
		}
		memcpy(oldMessages.data, newMessages.data, 4 * numRows * numCols * numDisps * sizeof(float));

		// update beliefs
		maxBeliefDiff = -1;
		for (int i = 0; i < pixelList.size(); i++) {
			cv::Point2i t = pixelList[i];
			float maxDiff = UpdateBelief(t, allBeliefs, oldMessages, unaryCosts);
			maxBeliefDiff = std::max(maxBeliefDiff, maxDiff);
		}
		printf("maxBeliefDiff = %f\n", maxBeliefDiff);
		printf("%.2fs\n", (clock() - tic) / 1000.f);

		cv::Mat dispMap = DecodeDisparityFromBeliefs(allBeliefs);
		cv::cvtColor(dispMap, dispMap, CV_GRAY2BGR);
		int maxDisp, visualizeScale;
		SetupStereoParameters(rootFolder, numDisps, maxDisp, visualizeScale);
		dispMap.convertTo(dispMap, CV_8UC3, visualizeScale);
		char filePath[1024];
		sprintf(filePath, "d:/data/tmpResults/iter=%d.png", round);
		cv::imwrite(filePath, dispMap);
	}


	// Step 3 - Collect Beliefs
	cv::Mat dispMap = DecodeDisparityFromBeliefs(allBeliefs);
	EvaluateDisparity(rootFolder, dispMap);
	return dispMap;
}
Esempio n. 16
0
void KeyDown_1(void)
{
	UpdateMessage("Updating emitter rate");
	g_iMode = 1;
}
M_RESULT SnarlInterface::UpdateMessage(LPCWSTR szTitle, LPCWSTR szText, LPCWSTR szIconPath)
{
	return UpdateMessage(m_nLastMessageId, szTitle, szText, szIconPath);
}
Esempio n. 18
0
bool
wxGenericProgressDialog::Update(int value, const wxString& newmsg, bool *skip)
{
    if ( !DoBeforeUpdate(skip) )
        return false;

    wxCHECK_MSG( m_gauge, false, "dialog should be fully created" );

#ifdef __WXMSW__
    value /= m_factor;
#endif // __WXMSW__

    wxASSERT_MSG( value <= m_maximum, wxT("invalid progress value") );

    m_gauge->SetValue(value);

    UpdateMessage(newmsg);

    if ( (m_elapsed || m_remaining || m_estimated) && (value != 0) )
    {
        unsigned long elapsed;
        unsigned long display_remaining;

        UpdateTimeEstimates( value,
                             elapsed,
                             m_display_estimated,
                             display_remaining );

        SetTimeLabel(elapsed, m_elapsed);
        SetTimeLabel(m_display_estimated, m_estimated);
        SetTimeLabel(display_remaining, m_remaining);
    }

    if ( value == m_maximum )
    {
        if ( m_state == Finished )
        {
            // ignore multiple calls to Update(m_maximum): it may sometimes be
            // troublesome to ensure that Update() is not called twice with the
            // same value (e.g. because of the rounding errors) and if we don't
            // return now we're going to generate asserts below
            return true;
        }

        // so that we return true below and that out [Cancel] handler knew what
        // to do
        m_state = Finished;
        if( !HasPDFlag(wxPD_AUTO_HIDE) )
        {
            EnableClose();
            DisableSkip();
#if defined(__WXMSW__) && !defined(__WXUNIVERSAL__)
            EnableCloseButton();
#endif // __WXMSW__

            if ( newmsg.empty() )
            {
                // also provide the finishing message if the application didn't
                m_msg->SetLabel(_("Done."));
            }

            // allow the window to repaint:
            // NOTE: since we yield only for UI events with this call, there
            //       should be no side-effects
            wxEventLoopBase::GetActive()->YieldFor(wxEVT_CATEGORY_UI);

            // NOTE: this call results in a new event loop being created
            //       and to a call to ProcessPendingEvents() (which may generate
            //       unwanted re-entrancies).
            (void)ShowModal();
        }
        else // auto hide
        {
            // reenable other windows before hiding this one because otherwise
            // Windows wouldn't give the focus back to the window which had
            // been previously focused because it would still be disabled
            ReenableOtherWindows();

            Hide();
        }
    }
    else // not at maximum yet
    {
        DoAfterUpdate();
    }

    // update the display in case yielding above didn't do it
    Update();

    return m_state != Canceled;
}
Esempio n. 19
0
void KeyDown_2(void)
{
	UpdateMessage("Updating emitter theta");
	g_iMode = 2;
}
Esempio n. 20
0
void KeyDown_3(void)
{
	UpdateMessage("Updating particle speed");
	g_iMode = 3;
}
Esempio n. 21
0
void KeyDown_4(void)
{
	UpdateMessage("Updating particle size");
	g_iMode = 4;
}
Esempio n. 22
0
void KeyDown_5(void)
{
	UpdateMessage("Updating force");
	g_iMode = 5;
}
Esempio n. 23
0
void DLProcess::parsePKGLine(QString line){
     // KPM!!
     // TODO 12-12-2013
     // No JSON in Qt4, once we move to Qt5, replace this hack
     // with the new JSON parser
     // Moved 2/18/14 to this class from pc-pkgmanager by Ken Moore
     //qDebug() << " -- pkg line:" << line;
     // Look for a download status update
     if ( line.indexOf("\"INFO_FETCH") != -1 && line.indexOf("\"url\"") != -1 ) {
       QString file, dl, tot;
          line.remove(0, line.indexOf("\"url") + 8);
          line.truncate(line.lastIndexOf("}"));

          // Get the file basename
          file = line;
	  //qDebug() << "DL File:" << file;
          file.truncate(line.indexOf("\""));
	  file = file.section("/",-1).section(".txz",0,0); //replace the QFileInfo method below (Ken)
          //QFileInfo tFile;
          //tFile.setFile(file);
          //file = tFile.baseName();

          // Get the download / total
          dl = line.section(":", 2, 2).section(",", 0, 0);
          tot = line.section(":", 3, 3).section("}", 0, 0);
          dl = dl.simplified();
          tot = tot.simplified();
	     
	  //These are in bytes, need to convert to kilobytes before sending it on...
	  dl = QString::number( dl.toLongLong()/1024 );
	  tot = QString::number( tot.toLongLong()/1024 );
	     
        //Now calculate the stats and emit the signal
	calculateStats(dl, tot, "", file);
     }
     else if ( line.indexOf("PKGCONFLICTS: ") == 0 ) {
	QString tmp = line; 
     	tmp.replace("PKGCONFLICTS: ", "");
        ConflictList = tmp;
     }
     else if ( line.indexOf("PKGREPLY: ") == 0 ) {
	QString ans;
	QString tmp = line; 
     	tmp.replace("PKGREPLY: ", "");
        QMessageBox msgBox(parentW);
 	msgBox.setText(tr("The following packages are causing conflicts with the selected changes and can be automatically removed. Continue?") + "\n" + ConflictList);
        msgBox.setStandardButtons(QMessageBox::Yes|QMessageBox::No);
   	msgBox.setDetailedText(getConflictDetailText());
        msgBox.setDefaultButton(QMessageBox::No);
        if ( msgBox.exec() == QMessageBox::Yes) {
	  // We will try to fix conflicts
	  ans="yes";
        } else {
	  // We will fail :(
          QMessageBox::warning(parentW, tr("Package Conflicts"),
          tr("You may need to manually fix the conflicts before trying again."),
          QMessageBox::Ok,
          QMessageBox::Ok);
	  ans="no";
        }

        QFile pkgTrig( tmp );
        if ( pkgTrig.open( QIODevice::WriteOnly ) ) {
           QTextStream streamTrig( &pkgTrig );
           streamTrig << ans;
	   pkgTrig.close();
	   ConflictList.clear(); //already sent an answer - clear the internal list
	}
     }else{
     	  //Just emit the message
          //line.remove(0, line.indexOf("\"msg") + 8);
          //line.truncate(line.lastIndexOf("\""));
	  emit UpdateMessage(line);
	  return;
     }
}
Esempio n. 24
0
CASW_VGUI_Info_Message::CASW_VGUI_Info_Message( vgui::Panel *pParent, const char *pElementName, C_ASW_Info_Message* pMessage ) 
:	vgui::Panel( pParent, pElementName ),
	CASW_VGUI_Ingame_Panel()
{	
	//input->MouseEvent(0, false);	// unclick all our mouse buttons when this panel pops up (so firing doesn't get stuck on)

	if (g_hCurrentInfoPanel.Get())
	{
		g_hCurrentInfoPanel->MarkForDeletion();
		g_hCurrentInfoPanel->SetVisible(false);
	}
	g_hCurrentInfoPanel = this;
	m_hMessage = pMessage;
	for (int i=0;i<4;i++)
	{
		m_pLine[i] = new vgui::WrappedLabel(this, "InfoMessageLabel", "");
		m_pLine[i]->SetContentAlignment(vgui::Label::a_northwest);
		m_pLine[i]->SetMouseInputEnabled(false);
	}	
	m_pOkayButton = new ImageButton(this, "OkayButton", "#asw_close");
	m_pOkayButton->AddActionSignalTarget(this);
	KeyValues *msg = new KeyValues("Command");	
	msg->SetString("command", "OkayButton");
	m_pOkayButton->SetCommand(msg);

	m_pMessageImage = new vgui::ImagePanel(this, "MessageImage");
	m_pMessageImage->SetVisible(false);
	m_pMessageImage->SetShouldScaleImage(true);
	m_szImageName[0] = '\0';
	
	if (ShouldAddLogButton())
	{
		m_pLogButton = new ImageButton(this, "LogButton", "#asw_message_log");
		m_pLogButton->AddActionSignalTarget(this);
		KeyValues *msg = new KeyValues("Command");	
		msg->SetString("command", "MessageLog");
		m_pLogButton->SetCommand(msg);
	}
	else
	{
		Msg("  so not adding it\n");
		m_pLogButton = NULL;
	}

	// find use key bind	
	char lkeybuffer[12];
	Q_snprintf(lkeybuffer, sizeof(lkeybuffer), "%s", ASW_FindKeyBoundTo("+use"));
	Q_strupr(lkeybuffer);

	// copy the found key into wchar_t format (localize it if it's a token rather than a normal keyname)
	wchar_t keybuffer[24];
	if (lkeybuffer[0] == '#')
	{
		const wchar_t *pLocal = g_pVGuiLocalize->Find(lkeybuffer);
		if (pLocal)
			wcsncpy(keybuffer, pLocal, 24);
		else
			g_pVGuiLocalize->ConvertANSIToUnicode(lkeybuffer, keybuffer, sizeof(keybuffer));
	}
	else
		g_pVGuiLocalize->ConvertANSIToUnicode(lkeybuffer, keybuffer, sizeof(keybuffer));

	// look up close text localised
	const wchar_t *pLocal = g_pVGuiLocalize->Find("#asw_close");
	
	if (pLocal)
	{
		// join use key and close text together
		wchar_t buffer[ 256 ];
		g_pVGuiLocalize->ConstructString( buffer, sizeof(buffer), g_pVGuiLocalize->Find("#asw_use_icon_format"), 2, keybuffer, pLocal );
		// set label
		m_pOkayButton->SetText(buffer);
	}

	if (GetControllerFocus())
	{
		GetControllerFocus()->AddToFocusList(m_pOkayButton);
		GetControllerFocus()->SetFocusPanel(m_pOkayButton);
		if (m_pLogButton)
		{
			GetControllerFocus()->AddToFocusList(m_pLogButton);
		}
	}

	m_bClosingMessage = false;	
	
	CLocalPlayerFilter filter;

	// check for a special sound in the info message
	const char *pszSound = pMessage ? pMessage->GetSound() : NULL;	
	if (pszSound && Q_strlen(pszSound) > 0)
	{
		StopInfoMessageSound();

		EmitSound_t ep;
		ep.m_pSoundName = pszSound;
		ep.m_flVolume = 1.0f;
		ep.m_nPitch = PITCH_NORM;
		ep.m_SoundLevel = SNDLVL_NONE;
		ep.m_nChannel = CHAN_STATIC;

		C_BaseEntity::EmitSound( filter, SOUND_FROM_LOCAL_PLAYER, ep ); 
		g_LastInfoSoundGUID = enginesound->GetGuidForLastSoundEmitted();
	}

	UpdateMessage();

	SetAlpha(0);
	vgui::GetAnimationController()->RunAnimationCommand(this, "Alpha", 255, 0.0f, 0.3f, vgui::AnimationController::INTERPOLATOR_LINEAR);	

	SetKeyBoardInputEnabled(true);
	SetMouseInputEnabled(true);
	RequestFocus();

	ASWInput()->SetCameraFixed( true );

	g_asw_iGUIWindowsOpen++;		
}