QTfrontend/pagegamestats.cpp
changeset 6042 8b5345758f62
parent 6015 daffc14a518a
equal deleted inserted replaced
6040:a740069c21e3 6042:8b5345758f62
    16  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
    16  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
    17  */
    17  */
    18 
    18 
    19 #include <QLabel>
    19 #include <QLabel>
    20 #include <QGridLayout>
    20 #include <QGridLayout>
       
    21 #include <QHBoxLayout>
    21 #include <QGraphicsScene>
    22 #include <QGraphicsScene>
    22 #include <QGroupBox>
    23 #include <QGroupBox>
    23 #include <QSizePolicy>
    24 #include <QSizePolicy>
    24 
    25 
    25 #include "pagegamestats.h"
    26 #include "pagegamestats.h"
    35     Q_UNUSED(event);
    36     Q_UNUSED(event);
    36 
    37 
    37     fitInView(sceneRect());
    38     fitInView(sceneRect());
    38 }
    39 }
    39 
    40 
    40 PageGameStats::PageGameStats(QWidget* parent) : AbstractPage(parent)
    41 QLayout * PageGameStats::bodyLayoutDefinition()
    41 {
    42 {
    42     QGridLayout * pageLayout = new QGridLayout(this);
    43     QGridLayout * pageLayout = new QGridLayout();
    43     pageLayout->setSpacing(20);
    44     pageLayout->setSpacing(20);
    44     pageLayout->setColumnStretch(0, 1);
    45     pageLayout->setColumnStretch(0, 1);
    45     pageLayout->setColumnStretch(1, 1);
    46     pageLayout->setColumnStretch(1, 1);
    46     pageLayout->setContentsMargins(7, 7, 7, 0);
    47     pageLayout->setContentsMargins(7, 7, 7, 0);
    47 
       
    48     BtnSave = addButton(":/res/Save.png", pageLayout, 3, 2, true);
       
    49     BtnSave->setStyleSheet("QPushButton{margin: 12px 0px 12px 0px;}");
       
    50     connect(BtnSave, SIGNAL(clicked()), this, SIGNAL(saveDemoRequested()));
       
    51 
       
    52 
       
    53     BtnBack = addButton(":/res/Exit.png", pageLayout, 3, 0, true);
       
    54     BtnBack->setFixedHeight(BtnSave->height());
       
    55     BtnBack->setFixedWidth(BtnBack->width()+2);
       
    56     BtnBack->setStyleSheet("QPushButton{margin: 22px 0 9px 2px;}");
       
    57     connect(BtnBack, SIGNAL(clicked()), this, SIGNAL(goBack()));
       
    58 
       
    59 
    48 
    60     QGroupBox * gb = new QGroupBox(this);
    49     QGroupBox * gb = new QGroupBox(this);
    61     QVBoxLayout * gbl = new QVBoxLayout;
    50     QVBoxLayout * gbl = new QVBoxLayout;
    62 
    51 
    63     // details
    52     // details
   102     gb->setLayout(gbl);
    91     gb->setLayout(gbl);
   103 
    92 
   104     labelGameRank->setTextFormat(Qt::RichText);
    93     labelGameRank->setTextFormat(Qt::RichText);
   105     labelGameRank->setAlignment(Qt::AlignTop);
    94     labelGameRank->setAlignment(Qt::AlignTop);
   106     pageLayout->addWidget(gb, 1, 0);
    95     pageLayout->addWidget(gb, 1, 0);
       
    96 
       
    97     return pageLayout;
       
    98 }
       
    99 
       
   100 QLayout * PageGameStats::footerLayoutDefinition()
       
   101 {
       
   102     QHBoxLayout * bottomLayout = new QHBoxLayout();
       
   103 
       
   104     btnSave = addButton(":/res/Save.png", bottomLayout, 0, true);
       
   105     btnSave->setStyleSheet("QPushButton{margin: 24px 0 0 0;}");
       
   106     bottomLayout->setAlignment(btnSave, Qt::AlignRight | Qt::AlignBottom);
       
   107 
       
   108     return bottomLayout;
       
   109 }
       
   110 
       
   111 void PageGameStats::connectSignals()
       
   112 {
       
   113     connect(btnSave, SIGNAL(clicked()), this, SIGNAL(saveDemoRequested()));
       
   114 }
       
   115 
       
   116 PageGameStats::PageGameStats(QWidget* parent) : AbstractPage(parent)
       
   117 {
       
   118     initPage();
   107 }
   119 }
   108 
   120 
   109 void PageGameStats::AddStatText(const QString & msg)
   121 void PageGameStats::AddStatText(const QString & msg)
   110 {
   122 {
   111     labelGameStats->setText(labelGameStats->text() + msg);
   123     labelGameStats->setText(labelGameStats->text() + msg);