QTfrontend/pageroomslist.cpp
changeset 6009 14f6fc9869f2
parent 5602 c89b81817ee4
child 6042 8b5345758f62
equal deleted inserted replaced
6008:215f0c9719e3 6009:14f6fc9869f2
    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, 2);
    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);
    60     stateLabel->setText(tr("State:"));
    60     stateLabel->setText(tr("State:"));
    61     CBState = new QComboBox(this);
    61     CBState = new QComboBox(this);
    62     CBState->addItem(QComboBox::tr("Any"));
    62     CBState->addItem(QComboBox::tr("Any"));
    63     CBState->addItem(QComboBox::tr("In lobby"));
    63     CBState->addItem(QComboBox::tr("In lobby"));
    64     CBState->addItem(QComboBox::tr("In progress"));
    64     CBState->addItem(QComboBox::tr("In progress"));
    65     filterLayout->addWidget(stateLabel);
    65     filterLayout->addWidget(stateLabel);
    66     filterLayout->addWidget(CBState);
    66     filterLayout->addWidget(CBState);
    67     filterLayout->addSpacing(30);
    67     filterLayout->addSpacing(30);
    68     
    68 
    69     QLabel * ruleLabel = new QLabel(this);
    69     QLabel * ruleLabel = new QLabel(this);
    70     ruleLabel->setText(tr("Rules:"));
    70     ruleLabel->setText(tr("Rules:"));
    71     CBRules = new QComboBox(this);
    71     CBRules = new QComboBox(this);
    72     CBRules->addItem(QComboBox::tr("Any"));
    72     CBRules->addItem(QComboBox::tr("Any"));
    73     // not the most elegant solution but it works
    73     // not the most elegant solution but it works
    75     for (int i = 0; i < ammoSchemeModel->predefSchemesNames.count(); i++)
    75     for (int i = 0; i < ammoSchemeModel->predefSchemesNames.count(); i++)
    76         CBRules->addItem(ammoSchemeModel->predefSchemesNames.at(i).toAscii().constData());
    76         CBRules->addItem(ammoSchemeModel->predefSchemesNames.at(i).toAscii().constData());
    77     filterLayout->addWidget(ruleLabel);
    77     filterLayout->addWidget(ruleLabel);
    78     filterLayout->addWidget(CBRules);
    78     filterLayout->addWidget(CBRules);
    79     filterLayout->addSpacing(30);
    79     filterLayout->addSpacing(30);
    80     
    80 
    81     QLabel * weaponLabel = new QLabel(this);
    81     QLabel * weaponLabel = new QLabel(this);
    82     weaponLabel->setText(tr("Weapons:"));
    82     weaponLabel->setText(tr("Weapons:"));
    83     CBWeapons = new QComboBox(this);
    83     CBWeapons = new QComboBox(this);
    84     CBWeapons->addItem(QComboBox::tr("Any"));
    84     CBWeapons->addItem(QComboBox::tr("Any"));
    85     for (int i = 0; i < cDefaultAmmos.count(); i++) {
    85     for (int i = 0; i < cDefaultAmmos.count(); i++) {
   106     BtnCreate = addButton(tr("Create"), pageLayout, 0, 2);
   106     BtnCreate = addButton(tr("Create"), pageLayout, 0, 2);
   107     BtnJoin = addButton(tr("Join"), pageLayout, 1, 2);
   107     BtnJoin = addButton(tr("Join"), pageLayout, 1, 2);
   108     BtnRefresh = addButton(tr("Refresh"), pageLayout, 3, 2);
   108     BtnRefresh = addButton(tr("Refresh"), pageLayout, 3, 2);
   109     BtnClear = addButton(tr("Clear"), pageLayout, 4, 2);
   109     BtnClear = addButton(tr("Clear"), pageLayout, 4, 2);
   110 
   110 
       
   111 
   111     BtnBack = addButton(":/res/Exit.png", pageLayout, 6, 0, true);
   112     BtnBack = addButton(":/res/Exit.png", pageLayout, 6, 0, true);
       
   113     connect(BtnBack, SIGNAL(clicked()), this, SIGNAL(goBack()));
       
   114 
   112 
   115 
   113     lblCount = new QLabel(this);
   116     lblCount = new QLabel(this);
   114     pageLayout->addWidget(lblCount, 6, 1, Qt::AlignHCenter);
   117     pageLayout->addWidget(lblCount, 6, 1, Qt::AlignHCenter);
   115     lblCount->setText("?");
   118     lblCount->setText("?");
   116     lblCount->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum);
   119     lblCount->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum);
   127     connect(CBState, SIGNAL(currentIndexChanged (int)), this, SLOT(onRefreshClick()));
   130     connect(CBState, SIGNAL(currentIndexChanged (int)), this, SLOT(onRefreshClick()));
   128     connect(CBRules, SIGNAL(currentIndexChanged (int)), this, SLOT(onRefreshClick()));
   131     connect(CBRules, SIGNAL(currentIndexChanged (int)), this, SLOT(onRefreshClick()));
   129     connect(CBWeapons, SIGNAL(currentIndexChanged (int)), this, SLOT(onRefreshClick()));
   132     connect(CBWeapons, SIGNAL(currentIndexChanged (int)), this, SLOT(onRefreshClick()));
   130     connect(searchText, SIGNAL(textChanged (const QString &)), this, SLOT(onRefreshClick()));
   133     connect(searchText, SIGNAL(textChanged (const QString &)), this, SLOT(onRefreshClick()));
   131     connect(this, SIGNAL(askJoinConfirmation (const QString &)), this, SLOT(onJoinConfirmation(const QString &)), Qt::QueuedConnection);
   134     connect(this, SIGNAL(askJoinConfirmation (const QString &)), this, SLOT(onJoinConfirmation(const QString &)), Qt::QueuedConnection);
   132     
   135 
   133     gameInLobby = false;
   136     gameInLobby = false;
   134 }
   137 }
   135 
   138 
   136 void PageRoomsList::setAdmin(bool flag)
   139 void PageRoomsList::setAdmin(bool flag)
   137 {
   140 {