QTfrontend/ui/page/pageroomslist.cpp
changeset 9997 879fc2f86c36
parent 9738 18bb6d1fc9d9
child 9998 736015b847e3
equal deleted inserted replaced
9996:d93fb04619ee 9997:879fc2f86c36
    58 
    58 
    59     QGridLayout * topLayout = new QGridLayout();
    59     QGridLayout * topLayout = new QGridLayout();
    60     topLayout->setSpacing(0);
    60     topLayout->setSpacing(0);
    61     pageLayout->addLayout(topLayout, 0);
    61     pageLayout->addLayout(topLayout, 0);
    62 
    62 
       
    63     // State button
       
    64 
       
    65     QPushButton * btnState = new QPushButton(tr("Room state"));
       
    66     btnState->setStyleSheet("QPushButton { padding: 2px; margin: 0px; margin-right: 10px; border-bottom: none; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; } QPushButton:pressed { background-color: #ffcc00; border-color: #ffcc00; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; color: #11084A; }");
       
    67     btnState->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Preferred);
       
    68 
       
    69     // State menu
       
    70 
       
    71     QMenu * stateMenu = new QMenu(btnState);
       
    72     showGamesInLobby = new QAction(QAction::tr("Show games in lobby"), stateMenu);
       
    73     showGamesInLobby->setCheckable(true);
       
    74     showGamesInLobby->setChecked(true);
       
    75     showGamesInProgress = new QAction(QAction::tr("Show games in-progress"), stateMenu);
       
    76     showGamesInProgress->setCheckable(true);
       
    77     showGamesInProgress->setChecked(true);
       
    78     stateMenu->addAction(showGamesInLobby);
       
    79     stateMenu->addAction(showGamesInProgress);
       
    80     btnState->setMenu(stateMenu);
       
    81 
    63     // Help/prompt message at top
    82     // Help/prompt message at top
    64     QLabel * lblDesc = new QLabel(tr("Search for a room:"));
    83     QLabel * lblDesc = new QLabel(tr("Search for a room:"));
    65     lblDesc->setObjectName("lblDesc");
    84     lblDesc->setObjectName("lblDesc");
    66     lblDesc->setStyleSheet("#lblDesc { color: #130F2A; background: #F6CB1C; border: solid 4px #F6CB1C; border-top-left-radius: 10px; padding: 4px 10px;}");
    85     lblDesc->setStyleSheet("#lblDesc { color: #130F2A; background: #F6CB1C; border: solid 4px #F6CB1C; border-top-left-radius: 10px; padding: 4px 10px;}");
    67     lblDesc->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
    86     lblDesc->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
    95     BtnJoin = new QPushButton(tr("Join room"));
   114     BtnJoin = new QPushButton(tr("Join room"));
    96     BtnJoin->setStyleSheet("padding: 4px 8px; margin-bottom: 6px; margin-left: 6px;");
   115     BtnJoin->setStyleSheet("padding: 4px 8px; margin-bottom: 6px; margin-left: 6px;");
    97     BtnJoin->setEnabled(false);
   116     BtnJoin->setEnabled(false);
    98 
   117 
    99     // Add widgets to top layout
   118     // Add widgets to top layout
   100     topLayout->addWidget(lblDesc, 1, 0);
   119     topLayout->addWidget(btnState, 1, 0);
   101     topLayout->addWidget(searchContainer, 1, 1);
   120     topLayout->addWidget(lblDesc, 1, 1);
   102     topLayout->addWidget(corner, 1, 2, Qt::AlignBottom);
   121     topLayout->addWidget(searchContainer, 1, 2);
   103     topLayout->addWidget(BtnCreate, 0, 4, 2, 1);
   122     topLayout->addWidget(corner, 1, 3, Qt::AlignBottom);
   104     topLayout->addWidget(BtnJoin, 0, 5, 2, 1);
   123     topLayout->addWidget(BtnCreate, 0, 5, 2, 1);
       
   124     topLayout->addWidget(BtnJoin, 0, 6, 2, 1);
   105 
   125 
   106     // Top layout stretch
   126     // Top layout stretch
   107     topLayout->setRowStretch(0, 1);
   127     topLayout->setRowStretch(0, 1);
   108     topLayout->setRowStretch(1, 0);
   128     topLayout->setRowStretch(1, 0);
   109     topLayout->setColumnStretch(3, 1);
   129     topLayout->setColumnStretch(4, 1);
   110 
   130 
   111     // Rooms list and chat with splitter
   131     // Rooms list and chat with splitter
   112     m_splitter = new QSplitter();
   132     m_splitter = new QSplitter();
   113     m_splitter->setChildrenCollapsible(false);
   133     m_splitter->setChildrenCollapsible(false);
   114     pageLayout->addWidget(m_splitter, 100);
   134     pageLayout->addWidget(m_splitter, 100);
   129     roomsList->setShowGrid(false);
   149     roomsList->setShowGrid(false);
   130     roomsList->setSelectionMode(QAbstractItemView::SingleSelection);
   150     roomsList->setSelectionMode(QAbstractItemView::SingleSelection);
   131     roomsList->setStyleSheet("QTableView { border-top-left-radius: 0px; }");
   151     roomsList->setStyleSheet("QTableView { border-top-left-radius: 0px; }");
   132     roomsList->setFocusPolicy(Qt::NoFocus);
   152     roomsList->setFocusPolicy(Qt::NoFocus);
   133     roomsLayout->addWidget(roomsList, 200);
   153     roomsLayout->addWidget(roomsList, 200);
   134 
       
   135     // Room filters container
       
   136 
       
   137     QWidget * filtersContainer = new QWidget();
       
   138     filtersContainer->setMaximumWidth(800);
       
   139     filtersContainer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
       
   140 
       
   141     roomsLayout->addSpacing(7);
       
   142     roomsLayout->addWidget(filtersContainer, 0, Qt::AlignHCenter);
       
   143     roomsLayout->addSpacing(7);
       
   144     
       
   145     QHBoxLayout * filterLayout = new QHBoxLayout(filtersContainer);
       
   146     filterLayout->setSpacing(0);
       
   147     filterLayout->setMargin(0);
       
   148 
       
   149     const int filterSpacing = 20;
       
   150 
       
   151     // State button
       
   152 
       
   153     QPushButton * btnState = new QPushButton(tr("Room state"));
       
   154     btnState->setStyleSheet("QPushButton { padding: 2px 4px; } QPushButton:pressed { background-color: #ffcc00; border-color: #ffcc00; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; color: #11084A; }");
       
   155     btnState->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Preferred);
       
   156     filterLayout->addWidget(btnState);
       
   157     filterLayout->addSpacing(filterSpacing);
       
   158 
       
   159     // State menu
       
   160 
       
   161     QMenu * stateMenu = new QMenu(btnState);
       
   162     showGamesInLobby = new QAction(QAction::tr("Show games in lobby"), stateMenu);
       
   163     showGamesInLobby->setCheckable(true);
       
   164     showGamesInLobby->setChecked(true);
       
   165     showGamesInProgress = new QAction(QAction::tr("Show games in-progress"), stateMenu);
       
   166     showGamesInProgress->setCheckable(true);
       
   167     showGamesInProgress->setChecked(true);
       
   168     stateMenu->addAction(showGamesInLobby);
       
   169     stateMenu->addAction(showGamesInProgress);
       
   170     btnState->setMenu(stateMenu);
       
   171 
   154 
   172     // Lobby chat
   155     // Lobby chat
   173 
   156 
   174     chatWidget = new HWChatWidget(this, false);
   157     chatWidget = new HWChatWidget(this, false);
   175     m_splitter->addWidget(chatWidget);
   158     m_splitter->addWidget(chatWidget);