Merge branch 'master' of ssh://cockatrice.de/home/cockgit/cockatrice

This commit is contained in:
Max-Wilhelm Bruker 2010-07-17 18:24:37 +02:00
commit 6253d92053
3 changed files with 32 additions and 4 deletions

View file

@ -303,7 +303,7 @@ QList<ServerInfo_Player *> Server_Game::getGameState(Server_Player *playerWhosAs
Server_CardZone *zone = zoneIterator.next().value(); Server_CardZone *zone = zoneIterator.next().value();
QList<ServerInfo_Card *> cardList; QList<ServerInfo_Card *> cardList;
if ( if (
((playerWhosAsking == player) && (zone->getType() != HiddenZone)) (((playerWhosAsking == player) || (playerWhosAsking->getSpectator() && spectatorsSeeEverything)) && (zone->getType() != HiddenZone))
|| ((playerWhosAsking != player) && (zone->getType() == PublicZone)) || ((playerWhosAsking != player) && (zone->getType() == PublicZone))
) { ) {
QListIterator<Server_Card *> cardIterator(zone->cards); QListIterator<Server_Card *> cardIterator(zone->cards);

View file

@ -27,11 +27,21 @@ WindowMain::WindowMain(QWidget *parent)
checkboxArea->setWidget(checkboxFrame); checkboxArea->setWidget(checkboxFrame);
checkboxArea->setWidgetResizable(true); checkboxArea->setWidgetResizable(true);
checkAllButton = new QPushButton(tr("&Check all"));
connect(checkAllButton, SIGNAL(clicked()), this, SLOT(actCheckAll()));
uncheckAllButton = new QPushButton(tr("&Uncheck all"));
connect(uncheckAllButton, SIGNAL(clicked()), this, SLOT(actUncheckAll()));
QHBoxLayout *checkAllButtonLayout = new QHBoxLayout;
checkAllButtonLayout->addWidget(checkAllButton);
checkAllButtonLayout->addWidget(uncheckAllButton);
startButton = new QPushButton(tr("&Start download")); startButton = new QPushButton(tr("&Start download"));
connect(startButton, SIGNAL(clicked()), this, SLOT(actStart())); connect(startButton, SIGNAL(clicked()), this, SLOT(actStart()));
QVBoxLayout *settingsLayout = new QVBoxLayout; QVBoxLayout *settingsLayout = new QVBoxLayout;
settingsLayout->addWidget(checkboxArea); settingsLayout->addWidget(checkboxArea);
settingsLayout->addLayout(checkAllButtonLayout);
settingsLayout->addWidget(startButton); settingsLayout->addWidget(startButton);
totalLabel = new QLabel(tr("Total progress:")); totalLabel = new QLabel(tr("Total progress:"));
@ -155,12 +165,28 @@ void WindowMain::updateFileProgress(int bytesRead, int totalBytes)
fileProgressBar->setValue(bytesRead); fileProgressBar->setValue(bytesRead);
} }
void WindowMain::actCheckAll()
{
for (int i = 0; i < checkBoxList.size(); ++i)
checkBoxList[i]->setChecked(true);
}
void WindowMain::actUncheckAll()
{
for (int i = 0; i < checkBoxList.size(); ++i)
checkBoxList[i]->setChecked(false);
}
void WindowMain::actStart() void WindowMain::actStart()
{ {
startButton->setEnabled(false); int setsCount = importer->startDownload();
if (!setsCount) {
QMessageBox::critical(this, tr("Error"), tr("No sets to download selected."));
return;
}
for (int i = 0; i < checkBoxList.size(); ++i) for (int i = 0; i < checkBoxList.size(); ++i)
checkBoxList[i]->setEnabled(false); checkBoxList[i]->setEnabled(false);
int setsCount = importer->startDownload(); startButton->setEnabled(false);
totalProgressBar->setMaximum(setsCount); totalProgressBar->setMaximum(setsCount);
} }

View file

@ -25,7 +25,7 @@ private:
QMenu *fileMenu; QMenu *fileMenu;
QAction *aLoadSetsFile, *aDownloadSetsFile, *aExit; QAction *aLoadSetsFile, *aDownloadSetsFile, *aExit;
QPushButton *startButton; QPushButton *checkAllButton, *uncheckAllButton, *startButton;
QLabel *totalLabel, *fileLabel, *nextSetLabel1, *nextSetLabel2; QLabel *totalLabel, *fileLabel, *nextSetLabel1, *nextSetLabel2;
QProgressBar *totalProgressBar, *fileProgressBar; QProgressBar *totalProgressBar, *fileProgressBar;
QTextEdit *messageLog; QTextEdit *messageLog;
@ -37,6 +37,8 @@ private slots:
void updateTotalProgress(int cardsImported, int setIndex, const QString &nextSetName); void updateTotalProgress(int cardsImported, int setIndex, const QString &nextSetName);
void updateFileProgress(int bytesRead, int totalBytes); void updateFileProgress(int bytesRead, int totalBytes);
void updateSetList(); void updateSetList();
void actCheckAll();
void actUncheckAll();
void actStart(); void actStart();
void actLoadSetsFile(); void actLoadSetsFile();
void actDownloadSetsFile(); void actDownloadSetsFile();