QTfrontend/pageadmin.cpp
changeset 6042 8b5345758f62
parent 6010 10913a80cb50
equal deleted inserted replaced
6040:a740069c21e3 6042:8b5345758f62
    24 #include <QTextBrowser>
    24 #include <QTextBrowser>
    25 
    25 
    26 #include "pageadmin.h"
    26 #include "pageadmin.h"
    27 #include "chatwidget.h"
    27 #include "chatwidget.h"
    28 
    28 
    29 PageAdmin::PageAdmin(QWidget* parent) :
    29 QLayout * PageAdmin::bodyLayoutDefinition()
    30     AbstractPage(parent)
       
    31 {
    30 {
    32     QGridLayout * pageLayout = new QGridLayout(this);
    31     QGridLayout * pageLayout = new QGridLayout();
    33 
    32 
    34     // 0
    33     // 0
    35     pbAsk = addButton(tr("Fetch data"), pageLayout, 0, 0, 1, 3);
    34     pbAsk = addButton(tr("Fetch data"), pageLayout, 0, 0, 1, 3);
    36     connect(pbAsk, SIGNAL(clicked()), this, SIGNAL(askServerVars()));
       
    37     
    35     
    38     // 1
    36     // 1
    39     QLabel * lblSMN = new QLabel(this);
    37     QLabel * lblSMN = new QLabel(this);
    40     lblSMN->setText(tr("Server message for latest version:"));
    38     lblSMN->setText(tr("Server message for latest version:"));
    41     pageLayout->addWidget(lblSMN, 1, 0);
    39     pageLayout->addWidget(lblSMN, 1, 0);
    66 
    64 
    67     tb = new QTextBrowser(this);
    65     tb = new QTextBrowser(this);
    68     tb->setOpenExternalLinks(true);
    66     tb->setOpenExternalLinks(true);
    69     tb->document()->setDefaultStyleSheet(HWChatWidget::STYLE);
    67     tb->document()->setDefaultStyleSheet(HWChatWidget::STYLE);
    70     pageLayout->addWidget(tb, 4, 1, 1, 2);
    68     pageLayout->addWidget(tb, 4, 1, 1, 2);
    71     connect(leServerMessageNew, SIGNAL(textEdited(const QString &)), tb, SLOT(setHtml(const QString &)));
       
    72     connect(leServerMessageOld, SIGNAL(textEdited(const QString &)), tb, SLOT(setHtml(const QString &)));
       
    73     
    69     
    74     // 5
    70     // 5
    75     pbClearAccountsCache = addButton(tr("Clear Accounts Cache"), pageLayout, 5, 0);
    71     pbClearAccountsCache = addButton(tr("Clear Accounts Cache"), pageLayout, 5, 0);
    76     connect(pbClearAccountsCache, SIGNAL(clicked()), this, SIGNAL(clearAccountsCache()));
       
    77     
    72     
    78     // 6
    73     // 6
    79     pbSetSM = addButton(tr("Set data"), pageLayout, 6, 0, 1, 3);
    74     pbSetSM = addButton(tr("Set data"), pageLayout, 6, 0, 1, 3);
       
    75 
       
    76     return pageLayout;
       
    77 }
       
    78 
       
    79 void PageAdmin::connectSignals()
       
    80 {
       
    81     connect(pbAsk, SIGNAL(clicked()), this, SIGNAL(askServerVars()));
       
    82     connect(leServerMessageNew, SIGNAL(textEdited(const QString &)), tb, SLOT(setHtml(const QString &)));
       
    83     connect(leServerMessageOld, SIGNAL(textEdited(const QString &)), tb, SLOT(setHtml(const QString &)));
       
    84     connect(pbClearAccountsCache, SIGNAL(clicked()), this, SIGNAL(clearAccountsCache()));
    80     connect(pbSetSM, SIGNAL(clicked()), this, SLOT(smChanged()));
    85     connect(pbSetSM, SIGNAL(clicked()), this, SLOT(smChanged()));
       
    86 }
    81 
    87 
    82 
    88 PageAdmin::PageAdmin(QWidget* parent) : AbstractPage(parent)
    83     // 7
    89 {
    84     BtnBack = addButton(":/res/Exit.png", pageLayout, 7, 0, true);
    90     initPage();
    85     connect(BtnBack, SIGNAL(clicked()), this, SIGNAL(goBack()));
       
    86 }
    91 }
    87 
    92 
    88 void PageAdmin::smChanged()
    93 void PageAdmin::smChanged()
    89 {
    94 {
    90     emit setServerMessageNew(leServerMessageNew->text());
    95     emit setServerMessageNew(leServerMessageNew->text());