QTfrontend/pageroomslist.cpp
changeset 5259 926958e3e87b
parent 5204 e1a5f4d5d86a
child 5281 3324e9897ea7
equal deleted inserted replaced
5258:7e9dad2783bc 5259:926958e3e87b
    40     roomNameLabel->setText(tr("Room Name:"));
    40     roomNameLabel->setText(tr("Room Name:"));
    41     roomName = new QLineEdit(this);
    41     roomName = new QLineEdit(this);
    42     roomName->setMaxLength(60);
    42     roomName->setMaxLength(60);
    43     newRoomLayout->addWidget(roomNameLabel);
    43     newRoomLayout->addWidget(roomNameLabel);
    44     newRoomLayout->addWidget(roomName);
    44     newRoomLayout->addWidget(roomName);
    45     pageLayout->addLayout(newRoomLayout, 0, 0);
    45     pageLayout->addLayout(newRoomLayout, 0, 0, 1, 2);
    46 
    46 
    47     roomsList = new QTableWidget(this);
    47     roomsList = new QTableWidget(this);
    48     roomsList->setSelectionBehavior(QAbstractItemView::SelectRows);
    48     roomsList->setSelectionBehavior(QAbstractItemView::SelectRows);
    49     roomsList->verticalHeader()->setVisible(false);
    49     roomsList->verticalHeader()->setVisible(false);
    50     roomsList->horizontalHeader()->setResizeMode(QHeaderView::Interactive);
    50     roomsList->horizontalHeader()->setResizeMode(QHeaderView::Interactive);
    51     roomsList->setAlternatingRowColors(true);
    51     roomsList->setAlternatingRowColors(true);
    52     roomsList->setShowGrid(false);
    52     roomsList->setShowGrid(false);
    53     roomsList->setSelectionMode(QAbstractItemView::SingleSelection);
    53     roomsList->setSelectionMode(QAbstractItemView::SingleSelection);
    54     pageLayout->addWidget(roomsList, 1, 0, 3, 1);
    54     pageLayout->addWidget(roomsList, 1, 0, 3, 2);
    55     pageLayout->setRowStretch(2, 100);
    55     pageLayout->setRowStretch(2, 100);
    56     
    56     
    57     QHBoxLayout * filterLayout = new QHBoxLayout();
    57     QHBoxLayout * filterLayout = new QHBoxLayout();
    58     
    58     
    59     QLabel * stateLabel = new QLabel(this);
    59     QLabel * stateLabel = new QLabel(this);
    95     searchText = new QLineEdit(this);
    95     searchText = new QLineEdit(this);
    96     searchText->setMaxLength(60);
    96     searchText->setMaxLength(60);
    97     filterLayout->addWidget(searchLabel);
    97     filterLayout->addWidget(searchLabel);
    98     filterLayout->addWidget(searchText);
    98     filterLayout->addWidget(searchText);
    99 
    99 
   100     pageLayout->addLayout(filterLayout, 4, 0);
   100     pageLayout->addLayout(filterLayout, 4, 0, 1, 2);
   101 
   101 
   102     chatWidget = new HWChatWidget(this, gameSettings, sdli, false);
   102     chatWidget = new HWChatWidget(this, gameSettings, sdli, false);
   103     pageLayout->addWidget(chatWidget, 5, 0, 1, 2);
   103     pageLayout->addWidget(chatWidget, 5, 0, 1, 3);
   104     pageLayout->setRowStretch(5, 350);
   104     pageLayout->setRowStretch(5, 350);
   105 
   105 
   106     BtnCreate = addButton(tr("Create"), pageLayout, 0, 1);
   106     BtnCreate = addButton(tr("Create"), pageLayout, 0, 2);
   107     BtnJoin = addButton(tr("Join"), pageLayout, 1, 1);
   107     BtnJoin = addButton(tr("Join"), pageLayout, 1, 2);
   108     BtnRefresh = addButton(tr("Refresh"), pageLayout, 3, 1);
   108     BtnRefresh = addButton(tr("Refresh"), pageLayout, 3, 2);
   109     BtnClear = addButton(tr("Clear"), pageLayout, 4, 1);
   109     BtnClear = addButton(tr("Clear"), pageLayout, 4, 2);
   110 
   110 
   111     BtnBack = addButton(":/res/Exit.png", pageLayout, 6, 0, true);
   111     BtnBack = addButton(":/res/Exit.png", pageLayout, 6, 0, true);
   112     BtnAdmin = addButton(tr("Admin features"), pageLayout, 6, 1);
   112 
       
   113     lblCount = new QLabel(this);
       
   114     pageLayout->addWidget(lblCount, 6, 1, Qt::AlignHCenter);
       
   115     lblCount->setText("?");
       
   116     lblCount->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum);
       
   117 
       
   118     connect(chatWidget, SIGNAL(nickCountUpdate(const int)), this, SLOT(updateNickCounter(const int)));
       
   119 
       
   120     BtnAdmin = addButton(tr("Admin features"), pageLayout, 6, 2);
   113 
   121 
   114     connect(BtnCreate, SIGNAL(clicked()), this, SLOT(onCreateClick()));
   122     connect(BtnCreate, SIGNAL(clicked()), this, SLOT(onCreateClick()));
   115     connect(BtnJoin, SIGNAL(clicked()), this, SLOT(onJoinClick()));
   123     connect(BtnJoin, SIGNAL(clicked()), this, SLOT(onJoinClick()));
   116     connect(BtnRefresh, SIGNAL(clicked()), this, SLOT(onRefreshClick()));
   124     connect(BtnRefresh, SIGNAL(clicked()), this, SLOT(onRefreshClick()));
   117     connect(BtnClear, SIGNAL(clicked()), this, SLOT(onClearClick()));
   125     connect(BtnClear, SIGNAL(clicked()), this, SLOT(onClearClick()));
   378         QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes)
   386         QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes)
   379     {
   387     {
   380         emit askForJoinRoom(room);
   388         emit askForJoinRoom(room);
   381     }
   389     }
   382 }
   390 }
       
   391 
       
   392 void PageRoomsList::updateNickCounter(int cnt)
       
   393 {
       
   394     lblCount->setText(tr("%1 players online").arg(cnt));
       
   395 }
       
   396