/********************************************************************** ... ***********************************************************************/ const char *freeciv_name_version(void) { static char msgbuf[128]; #if IS_BETA_VERSION fc_snprintf(msgbuf, sizeof (msgbuf), _("Freeciv version %s %s"), VERSION_STRING, _("(beta version)")); #elif defined(SVNREV) && !defined(FC_SVNREV_OFF) fc_snprintf(msgbuf, sizeof (msgbuf), _("Freeciv version %s (%s)"), VERSION_STRING, fc_svn_revision()); #else fc_snprintf(msgbuf, sizeof (msgbuf), _("Freeciv version %s"), VERSION_STRING); #endif return msgbuf; }
/************************************************************************** Creates buttons and layouts for start page. **************************************************************************/ void fc_client::create_main_page(void) { QPixmap main_graphics(tileset_main_intro_filename(tileset)); QLabel* free_main_pic = new QLabel; QPainter painter(&main_graphics); QStringList buttons_names; int buttons_nr; char msgbuf[128]; const char *rev_ver; QFont f = QApplication::font(); QFontMetrics fm(f); pages_layout[PAGE_MAIN] = new QGridLayout; rev_ver = fc_svn_revision(); if (rev_ver == NULL) { /* TRANS: "version 2.6.0, Qt client" */ fc_snprintf(msgbuf, sizeof(msgbuf), _("%s%s, Qt client"), word_version(), VERSION_STRING); } else { /* TRANS: "version 2.6.0 (r25000), Qt client" */ fc_snprintf(msgbuf, sizeof(msgbuf), _("%s%s (%s), Qt client"), word_version(), VERSION_STRING, rev_ver); } painter.setPen(Qt::white); painter.drawText(main_graphics.width()-fm.width(msgbuf)-10, main_graphics.height()-fm.descent(), msgbuf); free_main_pic->setPixmap(main_graphics); pages_layout[PAGE_MAIN]->addWidget(free_main_pic, 0, 0, 1, 2, Qt::AlignCenter); buttons_names << _("Start new game") << _("Start scenario game") << _("Load saved game") << _("Connect to network game") << _("Options") << _("Quit"); buttons_nr = buttons_names.count(); for (int iter = 0; iter < buttons_nr; iter++) { button = new QPushButton(buttons_names[iter]); switch (iter) { case 0: pages_layout[PAGE_MAIN]->addWidget(button, 1, 0); break; case 1: pages_layout[PAGE_MAIN]->addWidget(button, 2, 0); connect(button, SIGNAL(clicked()), switch_page_mapper, SLOT(map())); switch_page_mapper->setMapping(button, PAGE_SCENARIO); break; case 2: pages_layout[PAGE_MAIN]->addWidget(button, 3, 0); connect(button, SIGNAL(clicked()), switch_page_mapper, SLOT(map())); switch_page_mapper->setMapping(button, PAGE_LOAD); break; case 3: pages_layout[PAGE_MAIN]->addWidget(button, 1, 1); connect(button, SIGNAL(clicked()), switch_page_mapper, SLOT(map())); switch_page_mapper->setMapping(button, PAGE_NETWORK); break; case 4: pages_layout[PAGE_MAIN]->addWidget(button, 2, 1); connect(button, SIGNAL(clicked()), this, SLOT(popup_client_options())); break; case 5: pages_layout[PAGE_MAIN]->addWidget(button, 3, 1); QObject::connect(button, SIGNAL(clicked()), this, SLOT(quit())); break; default: break; } } }