QTfrontend/pages.cpp
changeset 3283 18ee933a5864
parent 3279 88139bfa63c8
child 3284 7ffd0e20ad08
equal deleted inserted replaced
3282:9ca28cef559a 3283:18ee933a5864
  1457 PageAdmin::PageAdmin(QWidget* parent) :
  1457 PageAdmin::PageAdmin(QWidget* parent) :
  1458     AbstractPage(parent)
  1458     AbstractPage(parent)
  1459 {
  1459 {
  1460     QGridLayout * pageLayout = new QGridLayout(this);
  1460     QGridLayout * pageLayout = new QGridLayout(this);
  1461 
  1461 
  1462     QLabel * lblSM = new QLabel(this);
  1462     // 0
  1463     lblSM->setText(tr("Server message:"));
  1463     pbAsk = addButton(tr("Fetch data"), pageLayout, 0, 0, 1, 3);
  1464     pageLayout->addWidget(lblSM, 0, 0);
  1464     connect(pbAsk, SIGNAL(clicked()), this, SIGNAL(askServerVars()));
  1465 
  1465     
  1466     leServerMessage = new QLineEdit(this);
  1466     // 1
  1467     pageLayout->addWidget(leServerMessage, 0, 1);
  1467     QLabel * lblSMN = new QLabel(this);
  1468 
  1468     lblSMN->setText(tr("Server message for latest version:"));
  1469     pbSetSM = addButton(tr("Set message"), pageLayout, 0, 2);
  1469     pageLayout->addWidget(lblSMN, 1, 0);
  1470     pbClearAccountsCache = addButton(tr("Clear Accounts Cache"), pageLayout, 1, 0);
  1470 
  1471 
  1471     leServerMessageNew = new QLineEdit(this);
  1472     BtnBack = addButton(":/res/Exit.png", pageLayout, 2, 0, true);
  1472     pageLayout->addWidget(leServerMessageNew, 1, 1);
       
  1473 
       
  1474     // 2
       
  1475     QLabel * lblSMO = new QLabel(this);
       
  1476     lblSMO->setText(tr("Server message for previous versions:"));
       
  1477     pageLayout->addWidget(lblSMO, 2, 0);
       
  1478 
       
  1479     leServerMessageOld = new QLineEdit(this);
       
  1480     pageLayout->addWidget(leServerMessageOld, 2, 1);
       
  1481 
       
  1482     // 3
       
  1483     QLabel * lblP = new QLabel(this);
       
  1484     lblP->setText(tr("Latest version protocol number:"));
       
  1485     pageLayout->addWidget(lblP, 3, 0);
       
  1486 
       
  1487     sbProtocol = new QSpinBox(this);
       
  1488     pageLayout->addWidget(sbProtocol, 3, 1);
       
  1489 
       
  1490     // 4
       
  1491     QLabel * lblPreview = new QLabel(this);
       
  1492     lblPreview->setText(tr("MOTD preview:"));
       
  1493     pageLayout->addWidget(lblPreview, 4, 0);
       
  1494 
       
  1495     tb = new QTextBrowser(this);
       
  1496     pageLayout->addWidget(tb, 4, 1, 1, 2);
       
  1497     connect(leServerMessageNew, SIGNAL(textEdited(const QString &)), tb, SLOT(setHtml(const QString &)));
       
  1498     connect(leServerMessageOld, SIGNAL(textEdited(const QString &)), tb, SLOT(setHtml(const QString &)));
       
  1499     
       
  1500     // 5
       
  1501     pbClearAccountsCache = addButton(tr("Clear Accounts Cache"), pageLayout, 5, 0);
       
  1502     
       
  1503     // 6
       
  1504     pbSetSM = addButton(tr("Set data"), pageLayout, 6, 0, 1, 3);
       
  1505 
       
  1506     // 7
       
  1507     BtnBack = addButton(":/res/Exit.png", pageLayout, 7, 0, true);
  1473 
  1508 
  1474     connect(pbSetSM, SIGNAL(clicked()), this, SLOT(smChanged()));
  1509     connect(pbSetSM, SIGNAL(clicked()), this, SLOT(smChanged()));
  1475 }
  1510 }
  1476 
  1511 
  1477 void PageAdmin::smChanged()
  1512 void PageAdmin::smChanged()
  1478 {
  1513 {
  1479     emit setServerMessage(leServerMessage->text());
  1514     emit setServerMessageNew(leServerMessageNew->text());
  1480 }
  1515     emit setServerMessageOld(leServerMessageOld->text());
  1481 
  1516     emit setProtocol(sbProtocol->value());
  1482 void PageAdmin::serverMessage(const QString & str)
  1517 }
  1483 {
  1518 
  1484     leServerMessage->setText(str);
  1519 void PageAdmin::serverMessageNew(const QString & str)
       
  1520 {
       
  1521     leServerMessageNew->setText(str);
       
  1522 }
       
  1523 
       
  1524 void PageAdmin::serverMessageOld(const QString & str)
       
  1525 {
       
  1526     leServerMessageOld->setText(str);
       
  1527 }
       
  1528 void PageAdmin::protocol(int proto)
       
  1529 {
       
  1530     sbProtocol->setValue(proto);
  1485 }
  1531 }
  1486 
  1532 
  1487 /////////////////////////////////////////////////
  1533 /////////////////////////////////////////////////
  1488 
  1534 
  1489 PageNetType::PageNetType(QWidget* parent) : AbstractPage(parent)
  1535 PageNetType::PageNetType(QWidget* parent) : AbstractPage(parent)