Beispiel #1
0
void OmegleProto::NewChat()
{
	if (facy.state_ == STATE_WAITING)
	{
		UpdateChat(NULL, TranslateT("We are already waiting for new stranger..."), false);
		return;
	}
	else if (facy.state_ == STATE_ACTIVE || facy.state_ == STATE_SPY)
	{
		UpdateChat(NULL, TranslateT("Disconnecting..."), true);

		if (facy.stop())
			debugLogA("***** Disconnected from stranger %s", facy.chat_id_.c_str());
		else
			debugLogA("***** Error in disconnecting from stranger %s", facy.chat_id_.c_str());

		if (facy.state_ == STATE_SPY) {
			DeleteChatContact(TranslateT("Stranger 1"));
			DeleteChatContact(TranslateT("Stranger 2"));
		}
		else {
			DeleteChatContact(TranslateT("Stranger"));
		}

		SetTopic(); // reset topic content

		ClearChat();

		UpdateChat(NULL, TranslateT("Connecting..."), true);

		facy.state_ = STATE_WAITING;

		if (facy.start())
		{
			UpdateChat(NULL, TranslateT("Waiting for Stranger..."), true);
			debugLogA("***** Waiting for stranger %s", facy.chat_id_.c_str());
		}
	}
	else if (facy.state_ == STATE_DISCONNECTING)
	{
		//UpdateChat(NULL, TranslateT("We are disconnecting now, wait..."), false);
		return;
	}
	else
	{
		ClearChat();
		UpdateChat(NULL, TranslateT("Connecting..."), true);

		facy.state_ = STATE_WAITING;

		if (facy.start())
		{
			UpdateChat(NULL, TranslateT("Waiting for Stranger..."), true);
			debugLogA("***** Waiting for stranger %s", facy.chat_id_.c_str());

			ForkThread(&OmegleProto::EventsLoop, this);
		}
	}

}
Beispiel #2
0
void TopicItem::handleGotTopic(const TopicPtr& topic)
{
    if (!topic || (m_TopicId != topic->GetId() && !m_TopicId.startsWith(topic->GetId()))) {
        return;
    }
    m_TopicId = topic->GetId();
    emit topicIdChanged();
    SetTopic(topic);
}
void MainWindow::test()
{
    for(int i=0;i<3;i++){
        if((i%2)==0){
             printf("aaaaaaaaa");

        }
        else{
             printf("nnnnnnnnnn \n");
        }
        SetTopic("dsfdfsdfs");
        Display_1("On");
    }


}
Beispiel #4
0
void OmegleProto::StopChat(bool disconnect)
{
	if (facy.state_ == STATE_WAITING) {
		UpdateChat(NULL, TranslateT("Connecting canceled."), false);
	}
	else if (facy.state_ == STATE_ACTIVE || facy.state_ == STATE_SPY) {
		bool spy = facy.state_ == STATE_SPY;

		if (disconnect)
		{
			facy.state_ = STATE_DISCONNECTING;
			UpdateChat(NULL, TranslateT("Disconnecting..."), true);

			if (facy.stop())
				debugLogA("***** Disconnected from stranger %s", facy.chat_id_.c_str());
			else
				debugLogA("***** Error in disconnecting from stranger %s", facy.chat_id_.c_str());
		}

		if (spy) {
			DeleteChatContact(TranslateT("Stranger 1"));
			DeleteChatContact(TranslateT("Stranger 2"));
		}
		else {
			DeleteChatContact(TranslateT("Stranger"));
		}

		SetTopic(); // reset topic content

		CallService(MS_MSG_SETSTATUSTEXT, (WPARAM)GetChatHandle(), NULL);
	}
	else
	{ // disconnecting or inactive
		return;
	}

	facy.state_ = STATE_INACTIVE;
	facy.chat_id_.clear();
}
void UfopaediaCategory::Begin()
{
	Label* infolabel = ((Label*)menuform->FindControl("TEXT_INFO"));
	ListBox* entrylist = ((ListBox*)menuform->FindControl("LISTBOX_SHORTCUTS"));
	entrylist->Clear();
	entrylist->ItemHeight = infolabel->GetFont()->GetFontHeight() + 2;
	int idx = 1;
	for( auto entry = Entries.begin(); entry != Entries.end(); entry++ )
	{
		std::shared_ptr<UfopaediaEntry> e = (std::shared_ptr<UfopaediaEntry>)*entry;
		TextButton* tb = new TextButton( fw, nullptr, fw.gamecore->GetString(e->Title), infolabel->GetFont() );
		tb->Name = "Index" + Strings::FromInteger( idx );
		tb->RenderStyle = TextButton::TextButtonRenderStyles::SolidButtonStyle;
		tb->TextHAlign = HorizontalAlignment::Left;
		tb->TextVAlign = VerticalAlignment::Centre;
		tb->BackgroundColour.a = 0;
		entrylist->AddItem( tb );
		idx++;
	}

	SetupForm();
	SetTopic( 0 );
}
void UfopaediaCategory::EventOccurred(Event *e)
{
	menuform->EventOccured( e );
	fw.gamecore->MouseCursor->EventOccured( e );

	if( e->Type == EVENT_KEY_DOWN )
	{
		if( e->Data.Keyboard.KeyCode == ALLEGRO_KEY_ESCAPE )
		{
			stageCmd.cmd = StageCmd::Command::POP;
			return;
		}
	}

	if( e->Type == EVENT_FORM_INTERACTION && e->Data.Forms.EventFlag == FormEventType::ButtonClick )
	{
		if( e->Data.Forms.RaisedBy->Name == "BUTTON_QUIT" )
		{
			menuform->FindControl("INFORMATION_PANEL")->Visible = false;
			stageCmd.cmd = StageCmd::Command::POP;
			return;
		}
		else if( e->Data.Forms.RaisedBy->Name == "BUTTON_INFORMATION" )
		{
			menuform->FindControl("INFORMATION_PANEL")->Visible = !menuform->FindControl("INFORMATION_PANEL")->Visible;
		}
		else if( e->Data.Forms.RaisedBy->Name == "BUTTON_NEXT_SECTION" )
		{
			menuform->FindControl("INFORMATION_PANEL")->Visible = false;
			SetNextCat();
			return;
		}
		else if( e->Data.Forms.RaisedBy->Name == "BUTTON_NEXT_TOPIC" )
		{
			menuform->FindControl("INFORMATION_PANEL")->Visible = false;
			if( ViewingEntry < Entries.size() )
			{
				SetTopic( ViewingEntry + 1 );
			} else {
				SetNextCat();
			}
			return;
		}
		else if( e->Data.Forms.RaisedBy->Name == "BUTTON_PREVIOUS_TOPIC" )
		{
			menuform->FindControl("INFORMATION_PANEL")->Visible = false;
			if( ViewingEntry > 0 )
			{
				SetTopic( ViewingEntry - 1 );
			} else {
				SetPrevCat();
			}
			return;
		}
		else if( e->Data.Forms.RaisedBy->Name == "BUTTON_PREVIOUS_SECTION" )
		{
			menuform->FindControl("INFORMATION_PANEL")->Visible = false;
			SetPrevCat();
			return;
		}
		else if( e->Data.Forms.RaisedBy->Name.substr( 0, 5 ) == "Index" )
		{
			UString nameidx = e->Data.Forms.RaisedBy->Name.substr( 5, e->Data.Forms.RaisedBy->Name.length() - 5 );
			int idx = Strings::ToInteger( nameidx );
			SetTopic( idx );
			menuform->FindControl("INFORMATION_PANEL")->Visible = false;
			return;
		}
		else
		{
			return;
		}
	}
}
Beispiel #7
0
    HelpPaneImpl(Modeler* pmodeler, const ZString& strTopic, PagePaneIncluder* ppagePageIncluder) :
        m_pmodeler(pmodeler)
    {
        //
        // Exports
        //

		m_pmodeler->SetColorKeyHint( true );

        m_pnsData = pmodeler->CreateNameSpace("helpdata");

        //
        // Exports
        //

        m_pns = pmodeler->GetNameSpace("helppane");

        //
        // The Help pane
        //

        TRef<Pane> ppane;
        CastTo(ppane, m_pns->FindMember("helpPane"));
        InsertAtBottom(ppane);

        //
        // Buttons
        //

        CastTo(m_pbuttonBack, m_pns->FindMember("backButton"   ));
		// mdvalley: OnButtonBack now pointered and with class named.
		AddEventTarget(&HelpPaneImpl::OnButtonBack, m_pbuttonBack->GetEventSource());

        CastTo(m_pbuttonClose, m_pns->FindMember("closeButton"));

        //
        // Default attributes
        //

        TRef<FontValue>  pfont;
        TRef<ColorValue> pcolor;
        TRef<ColorValue> pcolorMain;
        TRef<ColorValue> pcolorSecondary;
        TRef<ColorValue> pcolorHighlight;

        CastTo(pfont,           m_pns->FindMember("helpFont"          ));
        CastTo(pcolor,          m_pns->FindMember("helpColor"         ));
        CastTo(pcolorMain,      m_pns->FindMember("mainLinkColor"     ));
        CastTo(pcolorSecondary, m_pns->FindMember("secondaryLinkColor"));
        CastTo(pcolorHighlight, m_pns->FindMember("highlightColor"    ));

        //
        // The Nav pane
        //

        CastTo(m_pnavPane,       m_pns->FindMember("navPane"      ));

        //
        // PagePanes
        //

        CastTo(m_ppageMain,      m_pns->FindMember("mainPage"     ));
        CastTo(m_ppageSecondary, m_pns->FindMember("secondaryPage"));

        m_ppageMain->SetAttributes(
            pfont->GetValue(),
            pcolor->GetValue(),
            pcolorMain->GetValue(),
            pcolorSecondary->GetValue(),
            pcolorHighlight->GetValue()
        );

        m_ppageSecondary->SetAttributes(
            pfont->GetValue(),
            pcolor->GetValue(),
            pcolorMain->GetValue(),
            pcolorSecondary->GetValue(),
            pcolorHighlight->GetValue()
        );

        //
        // Includer
        //

        m_ppageMain     ->SetPagePaneIncluder(ppagePageIncluder);
        m_ppageSecondary->SetPagePaneIncluder(ppagePageIncluder);

        //
        // Scroll Bars
        //

        CastTo(m_pscrollMain,      (Pane*)m_pns->FindMember("mainPageScrollBar"));
        CastTo(m_pscrollSecondary, (Pane*)m_pns->FindMember("secondaryPageScrollBar"));
        
        //
        // Sink topic event
        //

        TRef<MainSink> psinkMain = new MainSink(this);

        m_ppageMain     ->GetMainLinkEventSource()->AddSink(psinkMain);
        m_ppageSecondary->GetMainLinkEventSource()->AddSink(psinkMain);
        m_pnavPane      ->GetEventSource()        ->AddSink(psinkMain);

        TRef<SecondarySink> psinkSecondary = new SecondarySink(this);

        m_ppageMain     ->GetSecondaryLinkEventSource()->AddSink(psinkSecondary);
        m_ppageSecondary->GetSecondaryLinkEventSource()->AddSink(psinkSecondary);

        //
        // Set the initial page
        //

        SetTopic(strTopic);
    }