void Tell::tellCmd(const QString& from, const QStringList& list) { octAssert(list.count() == 2); QStringList tmp = list[0].split(",",QString::SkipEmptyParts); QStringList dest, ok, ko; for(QStringList::Iterator it = tmp.begin(); it != tmp.end(); ++it) dest << manager()->databasePlugin()->canonicalName(*it); QString cc = dest.join(",") + ","; for(QStringList::Iterator it = dest.begin(); it != dest.end(); ++it) { QString cc_tmp(cc); cc_tmp.replace(*it + ",",""); cc_tmp = cc_tmp.left(cc_tmp.length() - 1); QString txt1(from + " tells you" + (dest.count() > 1 ? ("(CC: " + cc_tmp + ")") : "") + ": " + list[1]); if(manager()->connectionPlugin()->serverSend(*it,txt1)) ok << *it; else ko << *it; } if(ok.count()){ QString txt2("You tell " + (ok.join(",")) + ": " + list[1]); manager()->connectionPlugin()->serverSend(from,txt2); } if(ko.count()) { QString txt2((ko.join(",")) + (ko.count() > 1 ? " are" : " is") + " not connected!"); manager()->connectionPlugin()->serverSend(from,txt2); } }
void createEncryptedEpubWarningDocument(ldomDocument * m_doc) { CRLog::error("EPUB document contains encrypted items"); ldomDocumentWriter writer(m_doc); writer.OnTagOpenNoAttr(NULL, L"body"); writer.OnTagOpenNoAttr(NULL, L"h3"); lString16 hdr(L"Encrypted content"); writer.OnText(hdr.c_str(), hdr.length(), 0); writer.OnTagClose(NULL, L"h3"); writer.OnTagOpenAndClose(NULL, L"hr"); writer.OnTagOpenNoAttr(NULL, L"p"); lString16 txt(L"This document is encrypted (has DRM protection)."); writer.OnText(txt.c_str(), txt.length(), 0); writer.OnTagClose(NULL, L"p"); writer.OnTagOpenNoAttr(NULL, L"p"); lString16 txt2(L"Cool Reader doesn't support reading of DRM protected books."); writer.OnText(txt2.c_str(), txt2.length(), 0); writer.OnTagClose(NULL, L"p"); writer.OnTagOpenNoAttr(NULL, L"p"); lString16 txt3(L"To read this book, please use software recommended by book seller."); writer.OnText(txt3.c_str(), txt3.length(), 0); writer.OnTagClose(NULL, L"p"); writer.OnTagOpenAndClose(NULL, L"hr"); writer.OnTagOpenNoAttr(NULL, L"p"); lString16 txt4(L""); writer.OnText(txt4.c_str(), txt4.length(), 0); writer.OnTagClose(NULL, L"p"); writer.OnTagClose(NULL, L"body"); }
void Wall::wallCmd(const QString &from, const QStringList& list) { octAssert(list.size() < 2); if(list.size() != 0 && list[0] != "") { QString message(QDate::currentDate().toString("dd/MM/yyyy ") + QTime::currentTime().toString("hh:mm:ss ") + from); for(int i=from.length(); i<=manager()->databasePlugin()->validLoginLength(); i++) message += " "; message += list[0]; addToWall(message); manager()->logPlugin()->write("wall", message); QString txt1(from + " writes to the wall: " + list[0]); manager()->connectionPlugin()->serverBroadcastOthers(from, txt1); QString txt2("You write to the wall: " + list[0]); manager()->connectionPlugin()->serverSend(from, txt2); } else { QString wall_lines = getWall(from); QString txt; if (wall_lines == "") txt = "Wall is empty"; else txt = "Wall :\n" + wall_lines; manager()->connectionPlugin()->serverSend(from, txt); if (wall_lines != "") manager()->connectionPlugin()->serverSend(from, "End of Wall"); } }
void Tell::senddataCmd(const QString& from, const QStringList& list) { octAssert(list.count() == 2); QString to = manager()->databasePlugin()->canonicalName(list[0]); QString txt1("|" + from + "| " + list[1]); if(!manager()->connectionPlugin()->send(to,txt1)) { QString txt2(to + " is not connected!"); manager()->connectionPlugin()->serverSend(from,txt2); } }
void Msg::sendmsgUser(const QString& from, const QStringList& list, bool quiet) { QString txt1(from + " sends a message to you: " + list[1]); QString message(QDate::currentDate().toString("dd/MM/yyyy ") + QTime::currentTime().toString("hh:mm:ss ") + from + " : " + list[1]); QString to(manager()->databasePlugin()->canonicalName(list[0])); if((manager()->connectionPlugin()->serverSend(to,txt1) || manager()->databasePlugin()->isRegisteredUser(to)) && writeMsg(to,message) && !quiet) { QString txt2("You send a message to " + to + ": " + list[1]); manager()->connectionPlugin()->serverSend(from,txt2); } else if(!quiet) { QString error("Invalid user"); manager()->connectionPlugin()->serverSend(from,error); } }
void wxHtmlWinParser::AddText(const wxString& txt) { #if !wxUSE_UNICODE if ( m_nbsp == 0 ) m_nbsp = GetEntitiesParser()->GetCharForCode(NBSP_UNICODE_VALUE); #endif if ( m_whitespaceMode == Whitespace_Normal ) { int templen = 0; size_t lng = txt.length(); if (lng+1 > m_tmpStrBufSize) { delete[] m_tmpStrBuf; m_tmpStrBuf = new wxChar[lng+1]; m_tmpStrBufSize = lng+1; } wxChar *temp = m_tmpStrBuf; wxString::const_iterator i = txt.begin(); const wxString::const_iterator end = txt.end(); if (m_tmpLastWasSpace) { while ( (i < end) && (*i == wxT('\n') || *i == wxT('\r') || *i == wxT(' ') || *i == wxT('\t')) ) { ++i; } } while (i < end) { size_t x = 0; const wxChar d = temp[templen++] = *i; if ((d == wxT('\n')) || (d == wxT('\r')) || (d == wxT(' ')) || (d == wxT('\t'))) { ++i, ++x; while ( (i < end) && (*i == wxT('\n') || *i == wxT('\r') || *i == wxT(' ') || *i == wxT('\t')) ) { ++i; ++x; } } else { ++i; } if (x) { temp[templen-1] = wxT(' '); FlushWordBuf(temp, templen); m_tmpLastWasSpace = true; } } if (templen && (templen > 1 || temp[0] != wxT(' '))) { FlushWordBuf(temp, templen); m_tmpLastWasSpace = false; } } else // m_whitespaceMode == Whitespace_Pre { if ( txt.find(CUR_NBSP_VALUE) != wxString::npos ) { // we need to substitute spaces for here just like we // did in the Whitespace_Normal branch above wxString txt2(txt); txt2.Replace(CUR_NBSP_VALUE, ' '); AddPreBlock(txt2); } else { AddPreBlock(txt); } // don't eat any whitespace in <pre> block m_tmpLastWasSpace = false; } }
void draw_plots(){ CreateCanvas(Form("Limit_Plot"),"",600,600); CName["Limit_Plot"]->cd(); gPad->SetLogy(); grName["squark_xs"]->SetLineColor(kBlack); grName["squark_xs"]->SetLineStyle(kDotted); grName["squark_xs"]->SetFillColor(46); grName["xs_exp_combined"]->SetLineColor(kBlack); grName["xs_obs_combined"]->SetLineColor(kBlack); grName["xs_exp_combined"]->SetLineStyle(kDashed); grName["xs_exp_combined_1sigma"]->SetFillStyle(1001); grName["xs_exp_combined_2sigma"]->SetFillStyle(1001); grName["xs_exp_combined_1sigma"]->SetFillColor(3); grName["xs_exp_combined_2sigma"]->SetFillColor(5); grName["xs_exp_combined_1sigma"]->Draw("a3"); grName["xs_exp_combined_2sigma"]->Draw("a3"); grName["xs_exp_combined_1sigma"]->GetXaxis()->SetRangeUser(300,900); grName["xs_exp_combined_2sigma"]->GetXaxis()->SetRangeUser(300,900); grName["xs_exp_combined_1sigma"]->GetYaxis()->SetRangeUser(5,1.5*grName["squark_xs"]->Eval(300)); grName["xs_exp_combined_2sigma"]->GetYaxis()->SetRangeUser(5,1.5*grName["squark_xs"]->Eval(300)); grName["xs_exp_combined_1sigma"]->GetXaxis()->SetTitle("M_{#tilde{q}} (GeV)"); grName["xs_exp_combined_1sigma"]->GetYaxis()->SetTitle("#sigma (fb)"); grName["xs_exp_combined_2sigma"]->GetXaxis()->SetTitle("M_{#tilde{q}} (GeV)"); grName["xs_exp_combined_2sigma"]->GetYaxis()->SetTitle("#sigma (fb)"); //grName["xs_exp_combined_2sigma"]->Draw("a3 same"); grName["xs_exp_combined_1sigma"]->Draw("a3"); grName["xs_exp_combined"]->Draw("l same"); grName["xs_obs_combined"]->Draw("l same"); grName["squark_xs"]->Draw("3 same"); grName["squark_xs"]->Draw("cx0 same"); grName["xs_exp_combined"]->Draw("l same"); grName["xs_obs_combined"]->Draw("l same"); TLegend Leg(0.6,0.5,0.85,0.67); Leg.SetFillColor(10); Leg.SetBorderSize(0); Leg.SetLineColor(10); Leg.AddEntry(grName["xs_exp_combined"],"Expected","L" ); Leg.AddEntry(grName["xs_obs_combined"],"Observed","L"); Leg.AddEntry(grName["xs_exp_combined_1sigma"],"#pm 1 #sigma_{ex}","f"); // Leg.AddEntry(grName["xs_exp_combined_2sigma"],"#pm 2 SD","f"); Leg.AddEntry(grName["squark_xs"],"#sigma_{#tilde{q}#tilde{q}} #pm 1 #sigma_{th} ","LF"); Leg.DrawClone(); //TLatex txt(0.4,0.85,"M_{#tilde{#chi}_{1}^{#pm}}=1/2#timesM_{#tilde{q}}, Br(#tilde{#chi}_{1}^{#pm}#rightarrowW^{#pm},#tilde{S})=1"); TLatex txt(0.6,0.85,"pp #rightarrow #tilde{q}_{L}#tilde{q}_{L}"); //TLatex txt1(0.2,0.3,"M_{ #tilde{#chi}_{1}^{#pm} }=1/2#timesM_{ #tilde{q} }"); TLatex txt1(0.2,0.3,"M_{ #tilde{#chi}_{1}^{#pm} }=1/2#timesM_{ #tilde{q} }"); TLatex txt2(0.2,0.2,"M_{#tilde{S}} = 100 GeV, M_{S} = 90 GeV"); //, Br(#tilde{#chi}_{1}^{#pm}#rightarrowW^{#pm},#tilde{S})=1"); txt.SetTextSize(0.045); txt.SetNDC(kTRUE); txt.DrawClone(); txt.DrawLatex(0.6,0.77,"#tilde{q}_{L}#rightarrow q #tilde{#chi}_{1}^{#pm}"); txt.DrawLatex(0.6,0.69,"#tilde{#chi}_{1}^{#pm}#rightarrow W^{#pm} #tilde{S}"); txt.DrawLatex(0.2,0.4,"#tilde{q}_{L}: #tilde{u}, #tilde{d}, #tilde{s}, #tilde{c}"); txt1.SetTextSize(0.045); txt1.SetNDC(kTRUE); txt2.SetTextSize(0.045); txt2.SetNDC(kTRUE); txt1.DrawClone(); txt2.DrawClone(); //txt.DrawLatex(0.4,0.75,"M_{#tilde{S}}=100 GeV, M_{S}=90 GeV"); CMS_lumi(CName["Limit_Plot"],2,10); //draw_header(); gPad->RedrawAxis(); }