KviIOGraphWidget::KviIOGraphWidget(QWidget * par) : QWidget(par) { m_uLastSentBytes = g_uOutgoingTraffic; m_uLastRecvBytes = g_uIncomingTraffic; m_maxRate = 1; unsigned int iMax = qMax(m_uLastSentBytes, m_uLastRecvBytes); while(iMax > m_maxRate) m_maxRate *= 2; m_sendRates.prepend(0); m_recvRates.prepend(0); QString tip("<font color=\"#FF0000\">"); tip.append(__tr("Outgoing traffic")); tip.append("</font><br/><font color=\"#0000FF\">"); tip.append(__tr("Incoming traffic")); tip.append("</font>"); this->setToolTip(tip); startTimer(1000); }
static bool mircimport_module_init(KviModule * m) { QString szPath; QPixmap * pix = 0; if(g_pApp->findImage(szPath,"kvi_mircimport.png")) { pix = new QPixmap(szPath); if(pix->isNull()) { delete pix; pix = 0; } } KviModuleExtensionDescriptor * d = m->registerExtension("serverimport", "mIRC servers.ini import filter", __tr("Import from servers.ini"), mircimport_local_filter_alloc); if(d && pix)d->setIcon(*pix); d = m->registerExtension("serverimport", "Remote mIRC servers.ini import filter", __tr("Import from http://www.mirc.co.uk/servers.ini"), mircimport_remote_filter_alloc); if(d && pix)d->setIcon(*pix); if(pix)delete pix; return true; }
void KviRegisteredUserDataBase::load(const QString & filename) { QString szCurrent; KviConfigurationFile cfg(filename, KviConfigurationFile::Read); KviConfigurationFileIterator it(*cfg.dict()); while(it.current()) { cfg.setGroup(it.currentKey()); szCurrent = it.currentKey(); if(KviQString::equalCSN("#Group ", szCurrent, 7)) { szCurrent.remove(0, 7); addGroup(szCurrent); } else { KviRegisteredUser * u = addUser(szCurrent); if(u) { u->setIgnoreEnabled(cfg.readBoolEntry("IgnoreEnabled", false)); u->setIgnoreFlags(cfg.readIntEntry("IgnoreFlags", 0)); KviConfigurationFileGroupIterator sdi(*(it.current())); while(sdi.current()) { QString tmp = sdi.currentKey(); if(KviQString::equalCSN("prop_", tmp, 5)) { tmp.remove(0, 5); u->setProperty(tmp, *(sdi.current())); } else if(KviQString::equalCSN("mask_", tmp, 5)) { KviIrcMask * mask = new KviIrcMask(*(sdi.current())); addMask(u, mask); } else if(KviQString::equalCI(tmp, "Group")) { u->setGroup(*(sdi.current())); } ++sdi; } } } ++it; } if(!m_pGroupDict->find(__tr("Default"))) addGroup(__tr("Default")); }
char * sysTranslate(const char *source, int length, char *trtable, char *xlate_buf) { int i; memcpy(xlate_buf, source, length); /* copy source to target */ i = 0; #if __COMPILER_VER >= 0x41050000 /* If the compiler level supports the fast builtin for translation, use it * on the first n*256 bytes of the string */ for (; length > 255; i += 256, length -= 256) { __tr(xlate_buf + i, trtable, 255); } #endif for (; length > 0; i++, length--) { /* translate */ xlate_buf[i] = trtable[source[i]]; } xlate_buf[i] = '\0'; /* null terminate */ return xlate_buf; }
void KviPixmapSelector::choosePixmap() { QString tmp; if(KviFileDialog::askForOpenFileName(tmp,__tr("Choose an Image File - KVIrc"))) { setImagePath(tmp); } }
void KviMircServersIniImport::start() { //KviCString buffer; QString buffer; if(!KviFileDialog::askForOpenFileName(buffer,__tr("Choose a servers.ini file"),0,KVI_FILTER_INI,false,true,g_pMainWindow))return; doImport(buffer); delete this; }
int main(void) { cgi_init(); cgi_session_save_path("sessions/"); cgi_session_start(); cgi_process_form(); cgi_init_headers(); header("sidebar_download"); menu(); sidebar(); //Beta ! std::cout << "<p class=\"wrn\">Phase de beta !<br />" "Le jeu est en phase de beta, ce qui signifie qu'il " "est fortement possible que des bugs soit présent.<br />" "Le téléchargement d'Okzoniom::Patcher permet de garder le jeu à jour " "par rapport aux dernières modifications mise en ligne." "</p>"; std::cout << "<p class=\"wrn\">" "En cas de problème, vous pouvez me faire parvenir par e-mail " "le fichier Log_Patcher.txt ou Log.txt dans le cas d'un plantage !</p>"; std::cout << "<div class=\"body\"><div class=\"main\">" "<h1>" << __tr("download") << "</h1>" "<div class=\"hr\"></div>" << std::endl; std::map<std::string, std::string> title_file; title_file["Windows"] = "Patcher_Win.exe"; title_file["Linux"] = "Patcher_Linux.tar"; for(auto it = title_file.begin(); it != title_file.end(); ++it) { std::string file = it->second; std::cout << "<h2>" << it->first << "</h2>" "<p>" "<a href=\"download/" << file << "\">" "<strong>> " << file <<" <</strong></a><br />" << infoFile(file) << "</p>" << std::endl; } std::cout << "</div></div>" << std::endl; footer(); return 0; }
int main(void) { cgi_init(); mysqlpp::Connection c(false); if (!c.connect("okzoniom", "localhost", "okzoniom", getDBIdent().c_str())) { cgi_redirect("./error.okz?state=err_db"); return 0; } else { //Set UTF8 mysqlpp::Query q = c.query("SET NAMES utf8"); q.exec(); } initializeFaction(c); cgi_session_save_path("sessions/"); cgi_session_start(); cgi_process_form(); cgi_init_headers(); __tr("your_army"); header("your_army"); menu(); sidebar(); if (cgi_session_var("login") == NULL) { std::cout << "<div class=\"err\">" << __tr("profil_mustlogin") << "</div>"; } else { displayState(); show(cgi_session_var("login"), c); } footer(); return 0; }
int show(const std::string& login, mysqlpp::Connection& c) { std::map<std::string, unsigned int> unitList; int id=0,faction=0,xp=0,level=0; mysqlpp::Query query = c.query("SELECT id,faction,xp,level FROM game_account where login = %0Q;"); query.parse(); mysqlpp::StoreQueryResult r = query.store(login); if (r && r.num_rows() > 0) { //Should only be one account with that name id = r[0]["id"]; faction = r[0]["faction"]; xp = r[0]["xp"]; level = r[0]["level"]; //Now we have the account, get its units and their number query.reset(); query << "select unit_name,unit_number from game_unit_available where id_account = %0;"; query.parse(); mysqlpp::StoreQueryResult u = query.store(id); if (u && u.num_rows() > 0) for (size_t i = 0; i < u.num_rows(); ++i) { int num = u[i]["unit_number"]; if(num > 0) { std::string name; u[i]["unit_name"].to_string(name); unitList[name] = num; } } } //Should never happen, as we are connected ! //Display both form and information std::cout << "<div class=\"body\"><div class=\"main\" >" << "<center>" << __tr("faction") << ": <strong>" << __tr(factionName[faction]) << "</strong><br />" << "<strong>" << __tr("army_composition") << "</strong><br />"; if (unitList.size() > 0) { std::cout << "<table class=\"army\"><tr>" << "<td><strong>" << __tr("unit") << "</strong></td>" << "<td><strong>" << __tr("number") << "</strong></td></tr>"; for (auto it = unitList.begin(); it != unitList.end(); ++it) { std::cout << "<tr><td><strong>" << __tr(it->first) << "</strong></td>" << "<td><strong>" << it->second << "</strong></td></tr>"; } std::cout << "</table>"; } else std::cout << "<em>" << __tr("army_empty") << "</em>"; std::cout << "</center></div>"; std::cout << "</div></div>" << std::endl; return 0; }
void createRSS(const std::string& locale, mysqlpp::Connection& c) { std::ofstream f("rss/"+locale+".xml"); if(f) { f << "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n" "<rss version=\"2.0\">\n" " <channel>\n" " <description>" << __tr("description") << "</description>\n" " <link>http://okzoniom.fr</link>\n" " <title>Okzoniom::RPG</title>\n"; //write all mysqlpp::Query query = c.query(); query << "SELECT * FROM web_news WHERE locale='" << locale << "'ORDER BY date DESC"; mysqlpp::StoreQueryResult r = query.store(); if(r && r.num_rows() > 0) { for(int i = 0; i < r.num_rows(); ++i) { std::string title, titleLink; std::string content; std::string date; std::string id; r[i]["id"].to_string(id); r[i]["title"].to_string(title); r[i]["content"].to_string(content); r[i]["date"].to_string(date); titleLink = title; f << " <item>\n" " <title>" << title << "</title>\n" " <link>" << "http://okzoniom.fr/index-"+id+"-"+urlHTML(titleLink) << "</link>\n" " <description>" << "<![CDATA[<p>" << content << "</p>]]>"<< " </description>\n" " <pubDate>" << date << "</pubDate>\n" " </item>\n"; } } f << " </channel>\n" "</rss>\n"; f.close(); } }
int main(void) { //Redirect before initializing headers mysqlpp::Connection c(false); if (!c.connect("okzoniom", "localhost", "okzoniom", getDBIdent().c_str())) { cgi_redirect("./error.okz?state=err_db"); return 0; } else { //Set UTF8 mysqlpp::Query q = c.query("SET NAMES utf8"); q.exec(); } cgi_init(); cgi_session_save_path("sessions/"); cgi_session_start(); cgi_process_form(); std::string login = getParam("n"); cgi_init_headers(); header("sidebar_profil", ", "+login); menu(); sidebar(); std::cout << "<div class=\"body\"><div class=\"main\">"; initializeFaction(c); int id,faction, xp, level; mysqlpp::Query query = c.query("SELECT id,faction,xp,level FROM game_account where login = %0Q;"); query.parse(); mysqlpp::StoreQueryResult r = query.store(login); if (r && r.num_rows() > 0) { //Should only be one account with that name id = r[0]["id"]; //Will be used to get the number of units faction = r[0]["faction"]; xp = r[0]["xp"]; level = r[0]["level"]; std::cout << "<p>" << __tr("account") << ": <strong>" << login << "</strong><br />" << __tr("xp") << ": <strong>" << xp << "</strong><br />" << __tr("level") << ": <strong>" << level << "</strong><br />" << __tr("faction") << ": <strong>" << __tr(factionName[faction]) << "</strong>" "<div class=\"hr\"></div>" "<center><p><strong>" << __tr("army_composition") << ":</strong></p>"; //Now we have the account, get its units and their number query.reset(); query << "select unit_name,unit_number from game_unit_available where id_account = %0;"; query.parse(); mysqlpp::StoreQueryResult u = query.store(id); if (u && u.num_rows() > 0) { std::cout << "<table class=\"army\"><tr>" << "<td><strong>" << __tr("unit") << "</strong></td>" << "<td><strong>" << __tr("number") << "</strong></td></tr>"; for (size_t i = 0; i < u.num_rows(); ++i) { int num = u[i]["unit_number"]; if( num > 0) { std::string name; u[i]["unit_name"].to_string(name); std::cout << "<tr><td><strong>" << __tr(name) << "</strong></td>" << "<td><strong>" << num << "</strong></td></tr>"; } } std::cout << "</table></center>"; } else { std::cout << "<center><em>" << __tr("army_empty") << "</em></center>"; } std::cout << "</p>" << std::endl; } else { std::cout << "<p>" << __tr("player_notfound") << "</p>" << std::endl; } std::cout << "</div></div>"; footer(); return 0; }
bool KviWatchNotifyListManager::doMatchUser(KviIrcMessage * msg, const QString & notifyString, const KviIrcMask & mask) { QString * nam = m_pRegUserDict->find(notifyString); if(nam) { // ok...find the user if(KviRegisteredUser * u = g_pRegisteredUserDataBase->findUserByName(*nam)) { // ok ... match the user if(u->matchesFixed(mask)) { // new user online if(!(m_pConsole->notifyListView()->findEntry(mask.nick()))) { notifyOnLine(mask.nick(), mask.user(), mask.host(), "watch"); } else { // else already online, and matching...all ok if(msg->numeric() == RPL_NOWON) { // This is a reply to a /watch +something (should not happen, unless the user is messing) or to /watch l (user requested) notifyOnLine(mask.nick(), mask.user(), mask.host(), __tr2qs("watch entry listing requested by user"), false); } else { // This is a RPL_LOGON....we're desynched ? notifyOnLine(mask.nick(), mask.user(), mask.host(), __tr2qs("possible watch list desync"), false); } } } else { // not matched.... has he been online before ? if(m_pConsole->notifyListView()->findEntry(mask.nick())) { // has been online just a sec ago, but now the mask does not match // prolly the reguserdb has been changed notifyOffLine(mask.nick(), mask.user(), mask.host(), __tr2qs("registration mask changed or desync with the watch service")); } else { // has never been online if(_OUTPUT_VERBOSE) m_pConsole->output(KVI_OUT_SYSTEMMESSAGE, __tr("Notify list: \r!n\r%Q\r appears to be online, but the mask [%Q@\r!h\r%Q\r] does not match (watch: registration mask does not match, or nickname is being used by someone else)"), &(mask.nick()), &(mask.user()), &(mask.host())); } } } else { // ops... unexpected inconsistency .... reguser db modified ? m_pConsole->output(KVI_OUT_SYSTEMWARNING, __tr2qs("Notify list: Unexpected inconsistency, registered user DB modified? (watch: restarting)")); stop(); start(); return false; // critical ... exit from the call stack } } else { // not in our dictionary // prolly someone used /WATCH behind our back... bad boy! if(!(m_pConsole->notifyListView()->findEntry(mask.nick()))) { notifyOnLine(mask.nick(), mask.user(), mask.host(), __tr2qs("watch entry added by user")); } } return true; }
void TermWindow::fillCaptionBuffers() { m_szPlainTextCaption = __tr("Terminal"); }
KviTalWizard::KviTalWizard(QWidget * pParent) : QDialog(pParent) { m_p = new KviTalWizardPrivate; m_p->pPageList = new KviPointerList<KviTalWizardPageData>; m_p->pPageList->setAutoDelete(true); m_p->pCurrentPage = NULL; m_p->iEnabledPageCount = 0; m_p->pLayout = new QGridLayout(this); m_p->pTitleLabel = new QLabel(this); m_p->pLayout->addWidget(m_p->pTitleLabel,0,0,1,3); m_p->pStepsLabel = new QLabel(this); m_p->pStepsLabel->setMinimumWidth(80); m_p->pStepsLabel->setAlignment(Qt::AlignRight); m_p->pLayout->addWidget(m_p->pStepsLabel,0,4,1,3); QFrame * f1 = new QFrame(this); f1->setFrameStyle(QFrame::Sunken | QFrame::HLine); m_p->pLayout->addWidget(f1,1,0,1,7); m_p->pWidgetStack = new QStackedWidget(this); m_p->pLayout->addWidget(m_p->pWidgetStack,2,0,1,7); QFrame * f2 = new QFrame(this); f2->setFrameStyle(QFrame::Sunken | QFrame::HLine); m_p->pLayout->addWidget(f2,3,0,1,7); KviTalHBox * pButtonBox = new KviTalHBox(this); m_p->pLayout->addWidget(pButtonBox,4,0,1,7); pButtonBox->setMargin(0); pButtonBox->setSpacing(0); m_p->pCancelButton = new QPushButton(__tr("Cancel"),pButtonBox); m_p->pCancelButton->setMinimumWidth(80); QObject::connect( m_p->pCancelButton, SIGNAL(clicked()), this, SLOT(cancelButtonClicked()) ); QWidget * pSpacer = new QWidget(pButtonBox); pSpacer->setFixedWidth(4); m_p->pHelpButton = new QPushButton(__tr("Help"),pButtonBox); m_p->pHelpButton->setMinimumWidth(80); QObject::connect( m_p->pHelpButton, SIGNAL(clicked()), this, SLOT(helpButtonClicked()) ); QWidget * pLargeSpacer = new QWidget(pButtonBox); pLargeSpacer->setMinimumWidth(50); pButtonBox->setStretchFactor(pLargeSpacer,100); QString szText = "< "; szText += __tr("Back"); m_p->pBackButton = new QPushButton(szText,pButtonBox); m_p->pBackButton->setMinimumWidth(80); QObject::connect( m_p->pBackButton, SIGNAL(clicked()), this, SLOT(backButtonClicked()) ); m_p->pNextSpacer = new QWidget(pButtonBox); m_p->pNextSpacer->setFixedWidth(4); szText = __tr("Next"); szText += " >"; m_p->pNextButton = new QPushButton(szText,pButtonBox); m_p->pNextButton->setMinimumWidth(80); QObject::connect( m_p->pNextButton, SIGNAL(clicked()), this, SLOT(nextButtonClicked()) ); m_p->pFinishSpacer = new QWidget(pButtonBox); m_p->pFinishSpacer->setFixedWidth(4); m_p->pFinishButton = new QPushButton(__tr("Finish"),pButtonBox); m_p->pFinishButton->setMinimumWidth(80); QObject::connect( m_p->pFinishButton, SIGNAL(clicked()), this, SLOT(finishButtonClicked()) ); m_p->pLayout->setMargin(8); m_p->pLayout->setSpacing(4); m_p->pLayout->setRowStretch(2,1); m_p->pLayout->setColumnStretch(0,1); }
void sidebar() { std::cout << "<div class=\"sidebar\"> "; std::cout << "<h2 id=\"first_header_sidebar\">" << __tr("sidebar_header_information") << "</h2>" "<ul>" "<li><a href=\"index.okz\">" << __tr("sidebar_index") << "</a></li>" "<li><a href=\"list.okz\">" << __tr("sidebar_player_list") << "</a></li>" "</ul>"; std::cout << "<h2>" << __tr("sidebar_header_account") << "</h2>" "<ul>"; if (cgi_session_var_exists("login")) { std::cout << "<li><a href=\"profil.okz\">" << __tr("sidebar_profil") << "</a></li>" "<li><a href=\"army.okz\">" << __tr("sidebar_army") << "</a></li>" "<li><a href=\"login.okz?c=0\">" << __tr("sidebar_logout") << "</a></li>"; } else { std::cout << "<li><a href=\"register.okz\">" << __tr("sidebar_register") << "</a></li>" "<li><a href=\"login.okz\">" << __tr("sidebar_login") << "</a></li>"; } std::cout << "</ul>"; std::cout << "<h2>" << __tr("sidebar_header_game") << "</h2>" "<ul>" //"<li><a href=\"game.okz\">" << __tr("sidebar_game_info") << "</a></li>" //"<li><a href=\"screenshot.okz\">" << __tr("sidebar_screenshot") << "</a></li>" "<li><a href=\"download.okz\">" << __tr("sidebar_download") << "</a></li>" "<li><a href=\"statistics.okz\">" << __tr("sidebar_statistics") << "</a></li>" "</ul>"; //Empty header with specific id std::cout << "<h2 id=\"last_header_sidebar\"></h2>"; std::cout << "</div>"; }