Merge remote-tracking branch 'upstream/master' into pixmap_memory_2nd_attempt

Conflicts:
	cockatrice/src/dlg_settings.cpp
	cockatrice/src/dlg_settings.h
This commit is contained in:
Fabio Bas 2015-01-05 22:46:12 +01:00
commit 2101ed7096
47 changed files with 12148 additions and 5727 deletions

View file

@ -79,9 +79,9 @@ ELSEIF (CMAKE_COMPILER_IS_GNUCXX)
include(CheckCXXCompilerFlag) include(CheckCXXCompilerFlag)
set(CMAKE_CXX_FLAGS_RELEASE "-s -O2") set(CMAKE_CXX_FLAGS_RELEASE "-s -O2")
set(CMAKE_CXX_FLAGS_DEBUG "-ggdb -O0 -Wall -Wextra -pedantic -Werror") set(CMAKE_CXX_FLAGS_DEBUG "-ggdb -O0 -Wall -Wextra -Werror")
set(ADDITIONAL_DEBUG_FLAGS -Wcast-align -Wmissing-declarations -Winline -Wno-long-long -Wno-error=extra -Wno-error=unused-parameter -Wno-inline -Wno-error=delete-non-virtual-dtor -Wno-error=sign-compare -Wno-error=reorder -Wno-error=missing-declarations) set(ADDITIONAL_DEBUG_FLAGS -Wcast-align -Wmissing-declarations -Wno-long-long -Wno-error=extra -Wno-error=delete-non-virtual-dtor -Wno-error=sign-compare -Wno-error=missing-declarations)
FOREACH(FLAG ${ADDITIONAL_DEBUG_FLAGS}) FOREACH(FLAG ${ADDITIONAL_DEBUG_FLAGS})
CHECK_CXX_COMPILER_FLAG("${FLAG}" CXX_HAS_WARNING_${FLAG}) CHECK_CXX_COMPILER_FLAG("${FLAG}" CXX_HAS_WARNING_${FLAG})

View file

@ -101,8 +101,8 @@ set(cockatrice_RESOURCES cockatrice.qrc)
FILE(GLOB cockatrice_TS "${CMAKE_CURRENT_SOURCE_DIR}/translations/*.ts") FILE(GLOB cockatrice_TS "${CMAKE_CURRENT_SOURCE_DIR}/translations/*.ts")
IF(UPDATE_TRANSLATIONS) IF(UPDATE_TRANSLATIONS)
FILE(GLOB_RECURSE translate_cockatrice_SRCS ${CMAKE_SOURCE_DIR}/cockatrice/src/*.cpp) FILE(GLOB_RECURSE translate_cockatrice_SRCS ${CMAKE_SOURCE_DIR}/cockatrice/src/*.cpp ${CMAKE_SOURCE_DIR}/cockatrice/src/*.h)
FILE(GLOB_RECURSE translate_common_SRCS ${CMAKE_CURRENT_SOURCE_DIR}/common/*.cpp) FILE(GLOB_RECURSE translate_common_SRCS ${CMAKE_CURRENT_SOURCE_DIR}/common/*.cpp ${CMAKE_CURRENT_SOURCE_DIR}/common/*.h)
SET(translate_SRCS ${translate_cockatrice_SRCS} ${translate_common_SRCS}) SET(translate_SRCS ${translate_cockatrice_SRCS} ${translate_common_SRCS})
ENDIF(UPDATE_TRANSLATIONS) ENDIF(UPDATE_TRANSLATIONS)
@ -269,18 +269,12 @@ if(APPLE)
set(plugin_dest_dir cockatrice.app/Contents/Plugins) set(plugin_dest_dir cockatrice.app/Contents/Plugins)
set(qtconf_dest_dir cockatrice.app/Contents/Resources) set(qtconf_dest_dir cockatrice.app/Contents/Resources)
# note: no codecs in qt5 # qt4: codecs, iconengines, imageformats, phonon_backend
# note: phonon_backend => audio | mediaservice # qt5: audio, iconengines, imageformats, platforms, printsupport
# note: needs platform on osx
if (CMAKE_BUILD_TYPE STREQUAL "Debug") install(DIRECTORY "${QT_PLUGINS_DIR}/" DESTINATION ${plugin_dest_dir} COMPONENT Runtime
install(DIRECTORY "${QT_PLUGINS_DIR}/" DESTINATION ${plugin_dest_dir} COMPONENT Runtime FILES_MATCHING REGEX "(audio|codecs|iconengines|imageformats|phonon_backend|platforms|printsupport)/.*\\.dylib"
FILES_MATCHING REGEX "(audio|codecs|iconengines|imageformats|mediaservice|phonon_backend|platforms)/.*_debug\\.dylib") REGEX ".*_debug\\.dylib" EXCLUDE)
else()
install(DIRECTORY "${QT_PLUGINS_DIR}/" DESTINATION ${plugin_dest_dir} COMPONENT Runtime
FILES_MATCHING REGEX "(audio|codecs|iconengines|imageformats|mediaservice|phonon_backend|platforms)/.*\\.dylib"
REGEX ".*_debug\\.dylib" EXCLUDE)
endif()
install(CODE " install(CODE "
file(WRITE \"\${CMAKE_INSTALL_PREFIX}/${qtconf_dest_dir}/qt.conf\" \"[Paths] file(WRITE \"\${CMAKE_INSTALL_PREFIX}/${qtconf_dest_dir}/qt.conf\" \"[Paths]
@ -303,17 +297,11 @@ if(WIN32)
set(plugin_dest_dir Plugins) set(plugin_dest_dir Plugins)
set(qtconf_dest_dir .) set(qtconf_dest_dir .)
# note: no codecs in qt5 # qt4: codecs, iconengines, imageformats, phonon_backend
# note: phonon_backend => audio | mediaservice # qt5: audio, iconengines, imageformats, platforms, printsupport
# note: needs platform on osx
if (CMAKE_BUILD_TYPE STREQUAL "Debug") install(DIRECTORY "${QT_PLUGINS_DIR}/" DESTINATION ${plugin_dest_dir} COMPONENT Runtime
install(DIRECTORY "${QT_PLUGINS_DIR}/" DESTINATION ${plugin_dest_dir} COMPONENT Runtime FILES_MATCHING REGEX "(audio|codecs|iconengines|imageformats|phonon_backend|platforms|printsupport)/.*[^d]\\.dll")
FILES_MATCHING REGEX "(audio|codecs|iconengines|imageformats|mediaservice|phonon_backend|platforms)/.*d\\.dll")
else()
install(DIRECTORY "${QT_PLUGINS_DIR}/" DESTINATION ${plugin_dest_dir} COMPONENT Runtime
FILES_MATCHING REGEX "(audio|codecs|iconengines|imageformats|mediaservice|phonon_backend|platforms)/.*[^d]\\.dll")
endif()
install(CODE " install(CODE "
file(WRITE \"\${CMAKE_INSTALL_PREFIX}/${qtconf_dest_dir}/qt.conf\" \"[Paths] file(WRITE \"\${CMAKE_INSTALL_PREFIX}/${qtconf_dest_dir}/qt.conf\" \"[Paths]

View file

@ -31,7 +31,7 @@ static QXmlStreamWriter &operator<<(QXmlStreamWriter &xml, const CardSet *set)
} }
CardSet::CardSet(const QString &_shortName, const QString &_longName, const QString &_setType, const QDate &_releaseDate) CardSet::CardSet(const QString &_shortName, const QString &_longName, const QString &_setType, const QDate &_releaseDate)
: shortName(_shortName), longName(_longName), setType(_setType), releaseDate(_releaseDate) : shortName(_shortName), longName(_longName), releaseDate(_releaseDate), setType(_setType)
{ {
updateSortKey(); updateSortKey();
} }

View file

@ -96,7 +96,7 @@ void ChatView::appendMessage(QString message, QString sender, UserLevelFlags use
QTextCharFormat timeFormat; QTextCharFormat timeFormat;
timeFormat.setForeground(Qt::black); timeFormat.setForeground(Qt::black);
cursor.setCharFormat(timeFormat); cursor.setCharFormat(timeFormat);
cursor.insertText(QDateTime::currentDateTime().toString("[hh:mm] ")); cursor.insertText(QDateTime::currentDateTime().toString("[hh:mm:ss] "));
} }
QTextCharFormat senderFormat; QTextCharFormat senderFormat;

View file

@ -75,6 +75,7 @@ DlgConnect::DlgConnect(QWidget *parent)
void DlgConnect::passwordSaved(int state) void DlgConnect::passwordSaved(int state)
{ {
Q_UNUSED(state);
if(savePasswordCheckBox->isChecked()) { if(savePasswordCheckBox->isChecked()) {
autoConnectCheckBox->setEnabled(true); autoConnectCheckBox->setEnabled(true);
} else { } else {

View file

@ -12,49 +12,37 @@
#include <QSettings> #include <QSettings>
#include <QCryptographicHash> #include <QCryptographicHash>
DlgFilterGames::DlgFilterGames(const QMap<int, QString> &_allGameTypes, QWidget *parent) DlgFilterGames::DlgFilterGames(const QMap<int, QString> &_allGameTypes, const GamesProxyModel *_gamesProxyModel, QWidget *parent)
: QDialog(parent), : QDialog(parent),
allGameTypes(_allGameTypes) allGameTypes(_allGameTypes),
gamesProxyModel(_gamesProxyModel)
{ {
QSettings settings; QSettings settings;
settings.beginGroup("filter_games"); settings.beginGroup("filter_games");
unavailableGamesVisibleCheckBox = new QCheckBox(tr("Show &unavailable games")); unavailableGamesVisibleCheckBox = new QCheckBox(tr("Show &unavailable games"));
unavailableGamesVisibleCheckBox->setChecked( unavailableGamesVisibleCheckBox->setChecked(gamesProxyModel->getUnavailableGamesVisible());
settings.value("unavailable_games_visible", false).toBool()
);
passwordProtectedGamesVisibleCheckBox = new QCheckBox(tr("Show &password protected games")); passwordProtectedGamesVisibleCheckBox = new QCheckBox(tr("Show &password protected games"));
passwordProtectedGamesVisibleCheckBox->setChecked( passwordProtectedGamesVisibleCheckBox->setChecked(gamesProxyModel->getPasswordProtectedGamesVisible());
settings.value("password_protected_games_visible", false).toBool()
);
gameNameFilterEdit = new QLineEdit; gameNameFilterEdit = new QLineEdit;
gameNameFilterEdit->setText( gameNameFilterEdit->setText(gamesProxyModel->getGameNameFilter());
settings.value("game_name_filter", "").toString()
);
QLabel *gameNameFilterLabel = new QLabel(tr("Game &description:")); QLabel *gameNameFilterLabel = new QLabel(tr("Game &description:"));
gameNameFilterLabel->setBuddy(gameNameFilterEdit); gameNameFilterLabel->setBuddy(gameNameFilterEdit);
creatorNameFilterEdit = new QLineEdit; creatorNameFilterEdit = new QLineEdit;
creatorNameFilterEdit->setText( creatorNameFilterEdit->setText(gamesProxyModel->getCreatorNameFilter());
settings.value("creator_name_filter", "").toString()
);
QLabel *creatorNameFilterLabel = new QLabel(tr("&Creator name:")); QLabel *creatorNameFilterLabel = new QLabel(tr("&Creator name:"));
creatorNameFilterLabel->setBuddy(creatorNameFilterEdit); creatorNameFilterLabel->setBuddy(creatorNameFilterEdit);
QVBoxLayout *gameTypeFilterLayout = new QVBoxLayout; QVBoxLayout *gameTypeFilterLayout = new QVBoxLayout;
QMapIterator<int, QString> gameTypesIterator(allGameTypes); QMapIterator<int, QString> gameTypesIterator(allGameTypes);
while (gameTypesIterator.hasNext()) { while (gameTypesIterator.hasNext()) {
gameTypesIterator.next(); gameTypesIterator.next();
QCheckBox *temp = new QCheckBox(gameTypesIterator.value()); QCheckBox *temp = new QCheckBox(gameTypesIterator.value());
temp->setChecked( temp->setChecked(gamesProxyModel->getGameTypeFilter().contains(gameTypesIterator.key()));
settings.value(
"game_type/" + hashGameType(gameTypesIterator.value()),
false
).toBool()
);
gameTypeFilterCheckBoxes.insert(gameTypesIterator.key(), temp); gameTypeFilterCheckBoxes.insert(gameTypesIterator.key(), temp);
gameTypeFilterLayout->addWidget(temp); gameTypeFilterLayout->addWidget(temp);
@ -65,34 +53,30 @@ DlgFilterGames::DlgFilterGames(const QMap<int, QString> &_allGameTypes, QWidget
gameTypeFilterGroupBox->setLayout(gameTypeFilterLayout); gameTypeFilterGroupBox->setLayout(gameTypeFilterLayout);
} else } else
gameTypeFilterGroupBox = 0; gameTypeFilterGroupBox = 0;
QLabel *maxPlayersFilterMinLabel = new QLabel(tr("at &least:")); QLabel *maxPlayersFilterMinLabel = new QLabel(tr("at &least:"));
maxPlayersFilterMinSpinBox = new QSpinBox; maxPlayersFilterMinSpinBox = new QSpinBox;
maxPlayersFilterMinSpinBox->setMinimum(1); maxPlayersFilterMinSpinBox->setMinimum(1);
maxPlayersFilterMinSpinBox->setMaximum(99); maxPlayersFilterMinSpinBox->setMaximum(99);
maxPlayersFilterMinSpinBox->setValue( maxPlayersFilterMinSpinBox->setValue(gamesProxyModel->getMaxPlayersFilterMin());
settings.value("min_players", 1).toInt()
);
maxPlayersFilterMinLabel->setBuddy(maxPlayersFilterMinSpinBox); maxPlayersFilterMinLabel->setBuddy(maxPlayersFilterMinSpinBox);
QLabel *maxPlayersFilterMaxLabel = new QLabel(tr("at &most:")); QLabel *maxPlayersFilterMaxLabel = new QLabel(tr("at &most:"));
maxPlayersFilterMaxSpinBox = new QSpinBox; maxPlayersFilterMaxSpinBox = new QSpinBox;
maxPlayersFilterMaxSpinBox->setMinimum(1); maxPlayersFilterMaxSpinBox->setMinimum(1);
maxPlayersFilterMaxSpinBox->setMaximum(99); maxPlayersFilterMaxSpinBox->setMaximum(99);
maxPlayersFilterMaxSpinBox->setValue( maxPlayersFilterMaxSpinBox->setValue(gamesProxyModel->getMaxPlayersFilterMax());
settings.value("max_players", 99).toInt()
);
maxPlayersFilterMaxLabel->setBuddy(maxPlayersFilterMaxSpinBox); maxPlayersFilterMaxLabel->setBuddy(maxPlayersFilterMaxSpinBox);
QGridLayout *maxPlayersFilterLayout = new QGridLayout; QGridLayout *maxPlayersFilterLayout = new QGridLayout;
maxPlayersFilterLayout->addWidget(maxPlayersFilterMinLabel, 0, 0); maxPlayersFilterLayout->addWidget(maxPlayersFilterMinLabel, 0, 0);
maxPlayersFilterLayout->addWidget(maxPlayersFilterMinSpinBox, 0, 1); maxPlayersFilterLayout->addWidget(maxPlayersFilterMinSpinBox, 0, 1);
maxPlayersFilterLayout->addWidget(maxPlayersFilterMaxLabel, 1, 0); maxPlayersFilterLayout->addWidget(maxPlayersFilterMaxLabel, 1, 0);
maxPlayersFilterLayout->addWidget(maxPlayersFilterMaxSpinBox, 1, 1); maxPlayersFilterLayout->addWidget(maxPlayersFilterMaxSpinBox, 1, 1);
QGroupBox *maxPlayersGroupBox = new QGroupBox(tr("Maximum player count")); QGroupBox *maxPlayersGroupBox = new QGroupBox(tr("Maximum player count"));
maxPlayersGroupBox->setLayout(maxPlayersFilterLayout); maxPlayersGroupBox->setLayout(maxPlayersFilterLayout);
QGridLayout *leftGrid = new QGridLayout; QGridLayout *leftGrid = new QGridLayout;
leftGrid->addWidget(gameNameFilterLabel, 0, 0); leftGrid->addWidget(gameNameFilterLabel, 0, 0);
leftGrid->addWidget(gameNameFilterEdit, 0, 1); leftGrid->addWidget(gameNameFilterEdit, 0, 1);
@ -101,66 +85,34 @@ DlgFilterGames::DlgFilterGames(const QMap<int, QString> &_allGameTypes, QWidget
leftGrid->addWidget(maxPlayersGroupBox, 2, 0, 1, 2); leftGrid->addWidget(maxPlayersGroupBox, 2, 0, 1, 2);
leftGrid->addWidget(unavailableGamesVisibleCheckBox, 3, 0, 1, 2); leftGrid->addWidget(unavailableGamesVisibleCheckBox, 3, 0, 1, 2);
leftGrid->addWidget(passwordProtectedGamesVisibleCheckBox, 4, 0, 1, 2); leftGrid->addWidget(passwordProtectedGamesVisibleCheckBox, 4, 0, 1, 2);
QVBoxLayout *leftColumn = new QVBoxLayout; QVBoxLayout *leftColumn = new QVBoxLayout;
leftColumn->addLayout(leftGrid); leftColumn->addLayout(leftGrid);
leftColumn->addStretch(); leftColumn->addStretch();
QVBoxLayout *rightColumn = new QVBoxLayout; QVBoxLayout *rightColumn = new QVBoxLayout;
rightColumn->addWidget(gameTypeFilterGroupBox); rightColumn->addWidget(gameTypeFilterGroupBox);
QHBoxLayout *hbox = new QHBoxLayout; QHBoxLayout *hbox = new QHBoxLayout;
hbox->addLayout(leftColumn); hbox->addLayout(leftColumn);
hbox->addLayout(rightColumn); hbox->addLayout(rightColumn);
QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel); QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
connect(buttonBox, SIGNAL(accepted()), this, SLOT(actOk())); connect(buttonBox, SIGNAL(accepted()), this, SLOT(actOk()));
connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject())); connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
QVBoxLayout *mainLayout = new QVBoxLayout; QVBoxLayout *mainLayout = new QVBoxLayout;
mainLayout->addLayout(hbox); mainLayout->addLayout(hbox);
mainLayout->addWidget(buttonBox); mainLayout->addWidget(buttonBox);
setLayout(mainLayout); setLayout(mainLayout);
setWindowTitle(tr("Filter games")); setWindowTitle(tr("Filter games"));
} }
void DlgFilterGames::actOk() { void DlgFilterGames::actOk() {
QSettings settings;
settings.beginGroup("filter_games");
settings.setValue(
"unavailable_games_visible",
unavailableGamesVisibleCheckBox->isChecked()
);
settings.setValue(
"password_protected_games_visible",
passwordProtectedGamesVisibleCheckBox->isChecked()
);
settings.setValue("game_name_filter", gameNameFilterEdit->text());
settings.setValue("creator_name_filter", creatorNameFilterEdit->text());
QMapIterator<int, QString> gameTypeIterator(allGameTypes);
QMapIterator<int, QCheckBox *> checkboxIterator(gameTypeFilterCheckBoxes);
while (gameTypeIterator.hasNext()) {
gameTypeIterator.next();
checkboxIterator.next();
settings.setValue(
"game_type/" + hashGameType(gameTypeIterator.value()),
checkboxIterator.value()->isChecked()
);
}
settings.setValue("min_players", maxPlayersFilterMinSpinBox->value());
settings.setValue("max_players", maxPlayersFilterMaxSpinBox->value());
accept(); accept();
} }
QString DlgFilterGames::hashGameType(const QString &gameType) const {
return QCryptographicHash::hash(gameType.toUtf8(), QCryptographicHash::Md5).toHex();
}
bool DlgFilterGames::getUnavailableGamesVisible() const bool DlgFilterGames::getUnavailableGamesVisible() const
{ {
return unavailableGamesVisibleCheckBox->isChecked(); return unavailableGamesVisibleCheckBox->isChecked();

View file

@ -4,6 +4,7 @@
#include <QDialog> #include <QDialog>
#include <QSet> #include <QSet>
#include <QMap> #include <QMap>
#include "gamesmodel.h"
class QCheckBox; class QCheckBox;
class QLineEdit; class QLineEdit;
@ -21,17 +22,13 @@ private:
QSpinBox *maxPlayersFilterMaxSpinBox; QSpinBox *maxPlayersFilterMaxSpinBox;
const QMap<int, QString> &allGameTypes; const QMap<int, QString> &allGameTypes;
const GamesProxyModel *gamesProxyModel;
/*
* The game type might contain special characters, so to use it in
* QSettings we just hash it.
*/
QString hashGameType(const QString &gameType) const;
private slots: private slots:
void actOk(); void actOk();
public: public:
DlgFilterGames(const QMap<int, QString> &allGameTypes, QWidget *parent = 0); DlgFilterGames(const QMap<int, QString> &_allGameTypes, const GamesProxyModel *_gamesProxyModel, QWidget *parent = 0);
bool getUnavailableGamesVisible() const; bool getUnavailableGamesVisible() const;
void setUnavailableGamesVisible(bool _unavailableGamesVisible); void setUnavailableGamesVisible(bool _unavailableGamesVisible);
bool getPasswordProtectedGamesVisible() const; bool getPasswordProtectedGamesVisible() const;

View file

@ -44,7 +44,7 @@ GeneralSettingsPage::GeneralSettingsPage()
picDownloadCheckBox = new QCheckBox; picDownloadCheckBox = new QCheckBox;
picDownloadCheckBox->setChecked(settingsCache->getPicDownload()); picDownloadCheckBox->setChecked(settingsCache->getPicDownload());
QPushButton *clearDownloadedPicsButton = new QPushButton(tr("Reset/Clear Downloaded Pictures")); clearDownloadedPicsButton = new QPushButton();
connect(clearDownloadedPicsButton, SIGNAL(clicked()), this, SLOT(clearDownloadedPicsButtonClicked())); connect(clearDownloadedPicsButton, SIGNAL(clicked()), this, SLOT(clearDownloadedPicsButtonClicked()));
picDownloadHqCheckBox = new QCheckBox; picDownloadHqCheckBox = new QCheckBox;
@ -239,6 +239,7 @@ void GeneralSettingsPage::retranslateUi()
cardDatabasePathLabel->setText(tr("Card database:")); cardDatabasePathLabel->setText(tr("Card database:"));
tokenDatabasePathLabel->setText(tr("Token database:")); tokenDatabasePathLabel->setText(tr("Token database:"));
pixmapCacheLabel->setText(tr("Picture cache size:")); pixmapCacheLabel->setText(tr("Picture cache size:"));
clearDownloadedPicsButton->setText(tr("Reset/Clear Downloaded Pictures"));
} }
AppearanceSettingsPage::AppearanceSettingsPage() AppearanceSettingsPage::AppearanceSettingsPage()

View file

@ -46,6 +46,7 @@ private:
QCheckBox *picDownloadCheckBox; QCheckBox *picDownloadCheckBox;
QCheckBox *picDownloadHqCheckBox; QCheckBox *picDownloadHqCheckBox;
QLabel *languageLabel, *deckPathLabel, *replaysPathLabel, *picsPathLabel, *cardDatabasePathLabel, *tokenDatabasePathLabel, *pixmapCacheLabel; QLabel *languageLabel, *deckPathLabel, *replaysPathLabel, *picsPathLabel, *cardDatabasePathLabel, *tokenDatabasePathLabel, *pixmapCacheLabel;
QPushButton *clearDownloadedPicsButton;
}; };
class AppearanceSettingsPage : public AbstractSettingsPage { class AppearanceSettingsPage : public AbstractSettingsPage {

View file

@ -154,7 +154,7 @@ public:
FilterTreeNode *termNode(const CardFilter *f); FilterTreeNode *termNode(const CardFilter *f);
FilterTreeNode *attrTypeNode(CardFilter::Attr attr, FilterTreeNode *attrTypeNode(CardFilter::Attr attr,
CardFilter::Type type); CardFilter::Type type);
const char *textCStr() { return "root"; } const char *textCStr() const { return "root"; }
int index() const { return 0; } int index() const { return 0; }
bool acceptsCard(const CardInfo *info) const; bool acceptsCard(const CardInfo *info) const;

View file

@ -32,8 +32,12 @@ GameSelector::GameSelector(AbstractClient *_client, const TabSupervisor *_tabSup
gameListView->setRootIsDecorated(true); gameListView->setRootIsDecorated(true);
if (_room) if (_room)
gameListView->header()->hideSection(gameListModel->roomColIndex()); gameListView->header()->hideSection(gameListModel->roomColIndex());
else
gameListProxyModel->setUnavailableGamesVisible(true); if (room)
gameTypeMap = gameListModel->getGameTypes().value(room->getRoomId());
gameListProxyModel->loadFilterParameters(gameTypeMap);
#if QT_VERSION < 0x050000 #if QT_VERSION < 0x050000
gameListView->header()->setResizeMode(0, QHeaderView::ResizeToContents); gameListView->header()->setResizeMode(0, QHeaderView::ResizeToContents);
#else #else
@ -44,7 +48,7 @@ GameSelector::GameSelector(AbstractClient *_client, const TabSupervisor *_tabSup
connect(filterButton, SIGNAL(clicked()), this, SLOT(actSetFilter())); connect(filterButton, SIGNAL(clicked()), this, SLOT(actSetFilter()));
clearFilterButton = new QPushButton; clearFilterButton = new QPushButton;
clearFilterButton->setIcon(QIcon(":/resources/icon_clearsearch.svg")); clearFilterButton->setIcon(QIcon(":/resources/icon_clearsearch.svg"));
clearFilterButton->setEnabled(false); clearFilterButton->setEnabled(true);
connect(clearFilterButton, SIGNAL(clicked()), this, SLOT(actClearFilter())); connect(clearFilterButton, SIGNAL(clicked()), this, SLOT(actClearFilter()));
if (room) { if (room) {
@ -82,29 +86,28 @@ GameSelector::GameSelector(AbstractClient *_client, const TabSupervisor *_tabSup
void GameSelector::actSetFilter() void GameSelector::actSetFilter()
{ {
GameTypeMap gameTypeMap; DlgFilterGames dlg(gameTypeMap, gameListProxyModel, this);
if (room)
gameTypeMap = gameListModel->getGameTypes().value(room->getRoomId());
DlgFilterGames dlg(gameTypeMap, this);
if (!dlg.exec()) if (!dlg.exec())
return; return;
clearFilterButton->setEnabled(true); clearFilterButton->setEnabled(true);
gameListProxyModel->setUnavailableGamesVisible(dlg.getUnavailableGamesVisible()); gameListProxyModel->setUnavailableGamesVisible(dlg.getUnavailableGamesVisible());
gameListProxyModel->setPasswordProtectedGamesVisible(dlg.getPasswordProtectedGamesVisible()); gameListProxyModel->setPasswordProtectedGamesVisible(dlg.getPasswordProtectedGamesVisible());
gameListProxyModel->setGameNameFilter(dlg.getGameNameFilter()); gameListProxyModel->setGameNameFilter(dlg.getGameNameFilter());
gameListProxyModel->setCreatorNameFilter(dlg.getCreatorNameFilter()); gameListProxyModel->setCreatorNameFilter(dlg.getCreatorNameFilter());
gameListProxyModel->setGameTypeFilter(dlg.getGameTypeFilter()); gameListProxyModel->setGameTypeFilter(dlg.getGameTypeFilter());
gameListProxyModel->setMaxPlayersFilter(dlg.getMaxPlayersFilterMin(), dlg.getMaxPlayersFilterMax()); gameListProxyModel->setMaxPlayersFilter(dlg.getMaxPlayersFilterMin(), dlg.getMaxPlayersFilterMax());
gameListProxyModel->saveFilterParameters(gameTypeMap);
} }
void GameSelector::actClearFilter() void GameSelector::actClearFilter()
{ {
clearFilterButton->setEnabled(false); clearFilterButton->setEnabled(false);
gameListProxyModel->resetFilterParameters(); gameListProxyModel->resetFilterParameters();
gameListProxyModel->saveFilterParameters(gameTypeMap);
} }
void GameSelector::actCreate() void GameSelector::actCreate()
@ -136,7 +139,7 @@ void GameSelector::checkResponse(const Response &response)
void GameSelector::actJoin() void GameSelector::actJoin()
{ {
bool spectator = sender() == spectateButton; bool spectator = sender() == spectateButton;
QModelIndex ind = gameListView->currentIndex(); QModelIndex ind = gameListView->currentIndex();
if (!ind.isValid()) if (!ind.isValid())
return; return;
@ -149,19 +152,19 @@ void GameSelector::actJoin()
if (!ok) if (!ok)
return; return;
} }
Command_JoinGame cmd; Command_JoinGame cmd;
cmd.set_game_id(game.game_id()); cmd.set_game_id(game.game_id());
cmd.set_password(password.toStdString()); cmd.set_password(password.toStdString());
cmd.set_spectator(spectator); cmd.set_spectator(spectator);
cmd.set_override_restrictions(overrideRestrictions); cmd.set_override_restrictions(overrideRestrictions);
TabRoom *r = tabSupervisor->getRoomTabs().value(game.room_id()); TabRoom *r = tabSupervisor->getRoomTabs().value(game.room_id());
if (!r) { if (!r) {
QMessageBox::critical(this, tr("Error"), tr("Please join the respective room first.")); QMessageBox::critical(this, tr("Error"), tr("Please join the respective room first."));
return; return;
} }
PendingCommand *pend = r->prepareRoomCommand(cmd); PendingCommand *pend = r->prepareRoomCommand(cmd);
connect(pend, SIGNAL(finished(Response, CommandContainer, QVariant)), this, SLOT(checkResponse(Response))); connect(pend, SIGNAL(finished(Response, CommandContainer, QVariant)), this, SLOT(checkResponse(Response)));
r->sendRoomCommand(pend); r->sendRoomCommand(pend);

View file

@ -34,6 +34,7 @@ private:
GamesModel *gameListModel; GamesModel *gameListModel;
GamesProxyModel *gameListProxyModel; GamesProxyModel *gameListProxyModel;
QPushButton *filterButton, *clearFilterButton, *createButton, *joinButton, *spectateButton; QPushButton *filterButton, *clearFilterButton, *createButton, *joinButton, *spectateButton;
GameTypeMap gameTypeMap;
public: public:
GameSelector(AbstractClient *_client, const TabSupervisor *_tabSupervisor, TabRoom *_room, const QMap<int, QString> &_rooms, const QMap<int, GameTypeMap> &_gameTypes, QWidget *parent = 0); GameSelector(AbstractClient *_client, const TabSupervisor *_tabSupervisor, TabRoom *_room, const QMap<int, QString> &_rooms, const QMap<int, GameTypeMap> &_gameTypes, QWidget *parent = 0);
void retranslateUi(); void retranslateUi();

View file

@ -3,6 +3,8 @@
#include <QDebug> #include <QDebug>
#include <QStringList> #include <QStringList>
#include <QDateTime> #include <QDateTime>
#include <QSettings>
#include <QCryptographicHash>
namespace { namespace {
const unsigned SECS_PER_MIN = 60; const unsigned SECS_PER_MIN = 60;
@ -10,7 +12,7 @@ namespace {
/** /**
* Pretty print an integer number of seconds ago. Accurate to only one unit, * Pretty print an integer number of seconds ago. Accurate to only one unit,
* rounded; <5 minutes and >5 hours are displayed as such. As a special case, * rounded; <5 minutes and >5 hours are displayed as such. As a special case,
* time between 60 and 90 minutes will display both the hours and minutes. * time between 60 and 90 minutes will display both the hours and minutes.
* *
* For example... * For example...
@ -85,7 +87,7 @@ QVariant GamesModel::data(const QModelIndex &index, int role) const
QDateTime then; QDateTime then;
then.setTime_t(g.start_time()); then.setTime_t(g.start_time());
unsigned int secs = then.secsTo(QDateTime::currentDateTime()); unsigned int secs = then.secsTo(QDateTime::currentDateTime());
switch (role) { switch (role) {
case Qt::DisplayRole: return prettyPrintSecsAgo(secs); case Qt::DisplayRole: return prettyPrintSecsAgo(secs);
case SORT_ROLE: return QVariant(secs); case SORT_ROLE: return QVariant(secs);
@ -221,12 +223,62 @@ void GamesProxyModel::resetFilterParameters()
gameNameFilter = QString(); gameNameFilter = QString();
creatorNameFilter = QString(); creatorNameFilter = QString();
gameTypeFilter.clear(); gameTypeFilter.clear();
maxPlayersFilterMin = -1; maxPlayersFilterMin = 1;
maxPlayersFilterMax = -1; maxPlayersFilterMax = DEFAULT_MAX_PLAYERS_MAX;
invalidateFilter(); invalidateFilter();
} }
void GamesProxyModel::loadFilterParameters(const QMap<int, QString> &allGameTypes)
{
QSettings settings;
settings.beginGroup("filter_games");
unavailableGamesVisible = settings.value("unavailable_games_visible", false).toBool();
passwordProtectedGamesVisible = settings.value("password_protected_games_visible", false).toBool();
gameNameFilter = settings.value("game_name_filter", "").toString();
creatorNameFilter = settings.value("creator_name_filter", "").toString();
maxPlayersFilterMin = settings.value("min_players", 1).toInt();
maxPlayersFilterMax = settings.value("max_players", DEFAULT_MAX_PLAYERS_MAX).toInt();
QMapIterator<int, QString> gameTypesIterator(allGameTypes);
while (gameTypesIterator.hasNext()) {
gameTypesIterator.next();
if (settings.value("game_type/" + hashGameType(gameTypesIterator.value()), false).toBool()) {
gameTypeFilter.insert(gameTypesIterator.key());
}
}
invalidateFilter();
}
void GamesProxyModel::saveFilterParameters(const QMap<int, QString> &allGameTypes)
{
QSettings settings;
settings.beginGroup("filter_games");
settings.setValue("unavailable_games_visible", unavailableGamesVisible);
settings.setValue(
"password_protected_games_visible",
passwordProtectedGamesVisible
);
settings.setValue("game_name_filter", gameNameFilter);
settings.setValue("creator_name_filter", creatorNameFilter);
QMapIterator<int, QString> gameTypeIterator(allGameTypes);
while (gameTypeIterator.hasNext()) {
gameTypeIterator.next();
settings.setValue(
"game_type/" + hashGameType(gameTypeIterator.value()),
gameTypeFilter.contains(gameTypeIterator.key())
);
}
settings.setValue("min_players", maxPlayersFilterMin);
settings.setValue("max_players", maxPlayersFilterMax);
}
bool GamesProxyModel::filterAcceptsRow(int sourceRow, const QModelIndex &/*sourceParent*/) const bool GamesProxyModel::filterAcceptsRow(int sourceRow, const QModelIndex &/*sourceParent*/) const
{ {
GamesModel *model = qobject_cast<GamesModel *>(sourceModel()); GamesModel *model = qobject_cast<GamesModel *>(sourceModel());
@ -265,3 +317,7 @@ bool GamesProxyModel::filterAcceptsRow(int sourceRow, const QModelIndex &/*sourc
return true; return true;
} }
QString GamesProxyModel::hashGameType(const QString &gameType) const {
return QCryptographicHash::hash(gameType.toUtf8(), QCryptographicHash::Md5).toHex();
}

View file

@ -49,6 +49,14 @@ private:
QString gameNameFilter, creatorNameFilter; QString gameNameFilter, creatorNameFilter;
QSet<int> gameTypeFilter; QSet<int> gameTypeFilter;
int maxPlayersFilterMin, maxPlayersFilterMax; int maxPlayersFilterMin, maxPlayersFilterMax;
static const int DEFAULT_MAX_PLAYERS_MAX = 99;
/*
* The game type might contain special characters, so to use it in
* QSettings we just hash it.
*/
QString hashGameType(const QString &gameType) const;
public: public:
GamesProxyModel(QObject *parent = 0, ServerInfo_User *_ownUser = 0); GamesProxyModel(QObject *parent = 0, ServerInfo_User *_ownUser = 0);
@ -66,6 +74,8 @@ public:
int getMaxPlayersFilterMax() const { return maxPlayersFilterMax; } int getMaxPlayersFilterMax() const { return maxPlayersFilterMax; }
void setMaxPlayersFilter(int _maxPlayersFilterMin, int _maxPlayersFilterMax); void setMaxPlayersFilter(int _maxPlayersFilterMin, int _maxPlayersFilterMax);
void resetFilterParameters(); void resetFilterParameters();
void loadFilterParameters(const QMap<int, QString> &allGameTypes);
void saveFilterParameters(const QMap<int, QString> &allGameTypes);
protected: protected:
bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const; bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const;
}; };

View file

@ -8,6 +8,7 @@
#include "pb/context_move_card.pb.h" #include "pb/context_move_card.pb.h"
#include "pb/context_mulligan.pb.h" #include "pb/context_mulligan.pb.h"
#include <QScrollBar> #include <QScrollBar>
#include <QDateTime>
QString MessageLogWidget::sanitizeHtml(QString dirty) const QString MessageLogWidget::sanitizeHtml(QString dirty) const
{ {
@ -797,7 +798,7 @@ void MessageLogWidget::logSetActivePlayer(Player *player)
str = tr("It is now %1's turn.", "female"); str = tr("It is now %1's turn.", "female");
else else
str = tr("It is now %1's turn.", "male"); str = tr("It is now %1's turn.", "male");
appendHtml("<br><font color=\"green\"><b>" + str.arg(player->getName()) + "</b></font><br>"); appendHtml("<br><font color=\"green\"><b>" + QDateTime::currentDateTime().toString("[hh:mm:ss] ") + str.arg(player->getName()) + "</b></font><br>");
} }
void MessageLogWidget::logSetActivePhase(int phase) void MessageLogWidget::logSetActivePhase(int phase)
@ -817,7 +818,7 @@ void MessageLogWidget::logSetActivePhase(int phase)
case 9: phaseName = tr("second main phase"); break; case 9: phaseName = tr("second main phase"); break;
case 10: phaseName = tr("ending phase"); break; case 10: phaseName = tr("ending phase"); break;
} }
appendHtml("<font color=\"green\"><b>" + tr("It is now the %1.").arg(phaseName) + "</b></font>"); appendHtml("<font color=\"green\"><b>" + QDateTime::currentDateTime().toString("[hh:mm:ss] ") + tr("It is now the %1.").arg(phaseName) + "</b></font>");
} }
void MessageLogWidget::containerProcessingStarted(const GameEventContext &_context) void MessageLogWidget::containerProcessingStarted(const GameEventContext &_context)
@ -876,6 +877,6 @@ void MessageLogWidget::connectToPlayer(Player *player)
} }
MessageLogWidget::MessageLogWidget(const TabSupervisor *_tabSupervisor, TabGame *_game, QWidget *parent) MessageLogWidget::MessageLogWidget(const TabSupervisor *_tabSupervisor, TabGame *_game, QWidget *parent)
: ChatView(_tabSupervisor, _game, false, parent), currentContext(MessageContext_None) : ChatView(_tabSupervisor, _game, true, parent), currentContext(MessageContext_None)
{ {
} }

View file

@ -2225,6 +2225,13 @@ qreal Player::getMinimumWidth() const
return result; return result;
} }
void Player::setGameStarted()
{
if (local)
aAlwaysRevealTopCard->setChecked(false);
setConceded(false);
}
void Player::setConceded(bool _conceded) void Player::setConceded(bool _conceded)
{ {
conceded = _conceded; conceded = _conceded;

View file

@ -286,6 +286,8 @@ public:
void setConceded(bool _conceded); void setConceded(bool _conceded);
bool getConceded() const { return conceded; } bool getConceded() const { return conceded; }
void setGameStarted();
qreal getMinimumWidth() const; qreal getMinimumWidth() const;
void setMirrored(bool _mirrored); void setMirrored(bool _mirrored);

View file

@ -70,13 +70,13 @@ PlayerListWidget::PlayerListWidget(TabSupervisor *_tabSupervisor, AbstractClient
setMinimumHeight(60); setMinimumHeight(60);
setIconSize(QSize(20, 15)); setIconSize(QSize(20, 15));
setColumnCount(6); setColumnCount(6);
setColumnWidth(0, 20);
setColumnWidth(1, 20);
setColumnWidth(2, 20);
setColumnWidth(3, 20);
setColumnWidth(5, 20);
setHeaderHidden(true); setHeaderHidden(true);
setRootIsDecorated(false); setRootIsDecorated(false);
#if QT_VERSION < 0x050000
header()->setResizeMode(QHeaderView::ResizeToContents);
#else
header()->setSectionResizeMode(QHeaderView::ResizeToContents);
#endif
retranslateUi(); retranslateUi();
} }
@ -116,6 +116,7 @@ void PlayerListWidget::updatePlayerProperties(const ServerInfo_PlayerProperties
player->setData(3, Qt::UserRole, prop.user_info().user_level()); player->setData(3, Qt::UserRole, prop.user_info().user_level());
player->setIcon(3, QIcon(UserLevelPixmapGenerator::generatePixmap(12, UserLevelFlags(prop.user_info().user_level())))); player->setIcon(3, QIcon(UserLevelPixmapGenerator::generatePixmap(12, UserLevelFlags(prop.user_info().user_level()))));
player->setText(4, QString::fromStdString(prop.user_info().name())); player->setText(4, QString::fromStdString(prop.user_info().name()));
resizeColumnToContents(4);
const QString country = QString::fromStdString(prop.user_info().country()); const QString country = QString::fromStdString(prop.user_info().country());
if (!country.isEmpty()) if (!country.isEmpty())
player->setIcon(4, QIcon(CountryPixmapGenerator::generatePixmap(12, country))); player->setIcon(4, QIcon(CountryPixmapGenerator::generatePixmap(12, country)));
@ -123,8 +124,10 @@ void PlayerListWidget::updatePlayerProperties(const ServerInfo_PlayerProperties
} }
if (prop.has_player_id()) if (prop.has_player_id())
player->setData(4, Qt::UserRole + 1, prop.player_id()); player->setData(4, Qt::UserRole + 1, prop.player_id());
if (prop.has_deck_hash()) if (prop.has_deck_hash()) {
player->setText(5, QString::fromStdString(prop.deck_hash())); player->setText(5, QString::fromStdString(prop.deck_hash()));
resizeColumnToContents(5);
}
if (prop.has_sideboard_locked()) if (prop.has_sideboard_locked())
player->setIcon(5, prop.sideboard_locked() ? lockIcon : QIcon()); player->setIcon(5, prop.sideboard_locked() ? lockIcon : QIcon());
if (prop.has_ping_seconds()) if (prop.has_ping_seconds())

View file

@ -29,7 +29,7 @@ public:
SetsModel(CardDatabase *_db, QObject *parent = 0); SetsModel(CardDatabase *_db, QObject *parent = 0);
~SetsModel(); ~SetsModel();
int rowCount(const QModelIndex &parent = QModelIndex()) const; int rowCount(const QModelIndex &parent = QModelIndex()) const;
int columnCount(const QModelIndex &parent = QModelIndex()) const { return NUM_COLS; } int columnCount(const QModelIndex &parent = QModelIndex()) const { Q_UNUSED(parent); return NUM_COLS; }
QVariant data(const QModelIndex &index, int role) const; QVariant data(const QModelIndex &index, int role) const;
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const; QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
Qt::ItemFlags flags(const QModelIndex &index) const; Qt::ItemFlags flags(const QModelIndex &index) const;

View file

@ -10,6 +10,10 @@ Tab::Tab(TabSupervisor *_tabSupervisor, QWidget *parent)
void Tab::showCardInfoPopup(const QPoint &pos, const QString &cardName) void Tab::showCardInfoPopup(const QPoint &pos, const QString &cardName)
{ {
if (infoPopup) {
infoPopup->deleteLater();
}
currentCardName = cardName;
infoPopup = new CardInfoWidget(CardInfoWidget::ModePopUp, cardName, 0, Qt::Widget | Qt::FramelessWindowHint | Qt::X11BypassWindowManagerHint | Qt::WindowStaysOnTopHint); infoPopup = new CardInfoWidget(CardInfoWidget::ModePopUp, cardName, 0, Qt::Widget | Qt::FramelessWindowHint | Qt::X11BypassWindowManagerHint | Qt::WindowStaysOnTopHint);
infoPopup->setAttribute(Qt::WA_TransparentForMouseEvents); infoPopup->setAttribute(Qt::WA_TransparentForMouseEvents);
QRect screenRect = qApp->desktop()->screenGeometry(this); QRect screenRect = qApp->desktop()->screenGeometry(this);
@ -23,7 +27,7 @@ void Tab::showCardInfoPopup(const QPoint &pos, const QString &cardName)
void Tab::deleteCardInfoPopup(const QString &cardName) void Tab::deleteCardInfoPopup(const QString &cardName)
{ {
if (infoPopup) { if (infoPopup) {
if ((infoPopup->getCardName() == cardName) || (cardName == "_")) { if ((currentCardName == cardName) || (cardName == "_")) {
infoPopup->deleteLater(); infoPopup->deleteLater();
infoPopup = 0; infoPopup = 0;
} }

View file

@ -19,6 +19,7 @@ protected slots:
void showCardInfoPopup(const QPoint &pos, const QString &cardName); void showCardInfoPopup(const QPoint &pos, const QString &cardName);
void deleteCardInfoPopup(const QString &cardName); void deleteCardInfoPopup(const QString &cardName);
private: private:
QString currentCardName;
bool contentsChanged; bool contentsChanged;
CardInfoWidget *infoPopup; CardInfoWidget *infoPopup;
QList<QMenu *> tabMenus; QList<QMenu *> tabMenus;

View file

@ -872,7 +872,7 @@ void TabGame::startGame(bool resuming)
if (!resuming) { if (!resuming) {
QMapIterator<int, Player *> playerIterator(players); QMapIterator<int, Player *> playerIterator(players);
while (playerIterator.hasNext()) while (playerIterator.hasNext())
playerIterator.next().value()->setConceded(false); playerIterator.next().value()->setGameStarted();
} }
playerListWidget->setGameStarted(true, resuming); playerListWidget->setGameStarted(true, resuming);

View file

@ -119,7 +119,7 @@ void TabReplays::retranslateUi()
aOpenRemoteReplay->setText(tr("Watch replay")); aOpenRemoteReplay->setText(tr("Watch replay"));
aDownload->setText(tr("Download replay")); aDownload->setText(tr("Download replay"));
aKeep->setText(tr("Toggle expiration lock")); aKeep->setText(tr("Toggle expiration lock"));
aDeleteLocalReplay->setText(tr("Delete")); aDeleteRemoteReplay->setText(tr("Delete"));
} }
void TabReplays::actOpenLocalReplay() void TabReplays::actOpenLocalReplay()

View file

@ -224,6 +224,7 @@ void MainWindow::actAbout()
+ tr("Portugese (Brazil):") + " Thiago Queiroz<br>" + tr("Portugese (Brazil):") + " Thiago Queiroz<br>"
+ tr("French:") + " Yannick Hammer, Arnaud Faes<br>" + tr("French:") + " Yannick Hammer, Arnaud Faes<br>"
+ tr("Japanese:") + " Nagase Task<br>" + tr("Japanese:") + " Nagase Task<br>"
+ tr("Korean:") + " Jaeic Lee<br>"
+ tr("Russian:") + " Alexander Davidov<br>" + tr("Russian:") + " Alexander Davidov<br>"
+ tr("Italian:") + " Luigi Sciolla<br>" + tr("Italian:") + " Luigi Sciolla<br>"
+ tr("Swedish:") + " Jessica Dahl<br>" + tr("Swedish:") + " Jessica Dahl<br>"
@ -411,7 +412,7 @@ void MainWindow::closeEvent(QCloseEvent *event)
} }
event->accept(); event->accept();
settingsCache->setMainWindowGeometry(saveGeometry()); settingsCache->setMainWindowGeometry(saveGeometry());
delete tabSupervisor; tabSupervisor->deleteLater();
} }
void MainWindow::changeEvent(QEvent *event) void MainWindow::changeEvent(QEvent *event)

View file

@ -37,6 +37,7 @@ WndSets::WndSets(QWidget *parent)
view->sortByColumn(SetsModel::SortKeyCol, Qt::AscendingOrder); view->sortByColumn(SetsModel::SortKeyCol, Qt::AscendingOrder);
view->setColumnHidden(SetsModel::SortKeyCol, true); view->setColumnHidden(SetsModel::SortKeyCol, true);
view->setRootIsDecorated(false);
saveButton = new QPushButton(tr("Save set ordering")); saveButton = new QPushButton(tr("Save set ordering"));
connect(saveButton, SIGNAL(clicked()), this, SLOT(actSave())); connect(saveButton, SIGNAL(clicked()), this, SLOT(actSave()));

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -138,17 +138,12 @@ if(APPLE)
set(plugin_dest_dir oracle.app/Contents/Plugins) set(plugin_dest_dir oracle.app/Contents/Plugins)
set(qtconf_dest_dir oracle.app/Contents/Resources) set(qtconf_dest_dir oracle.app/Contents/Resources)
# note: no codecs in qt5 # qt4: codecs, iconengines, imageformats
# note: phonon_backend => mediaservice # qt5: iconengines, platforms
# note: needs platform on osx
if (CMAKE_BUILD_TYPE STREQUAL "Debug") install(DIRECTORY "${QT_PLUGINS_DIR}/" DESTINATION ${plugin_dest_dir} COMPONENT Runtime
install(DIRECTORY "${QT_PLUGINS_DIR}/" DESTINATION ${plugin_dest_dir} COMPONENT Runtime FILES_MATCHING REGEX "(codecs|iconengines|platforms)/.*\\.dylib"
FILES_MATCHING REGEX "(codecs|iconengines|imageformats|mediaservice|phonon_backend|platforms)/.*_debug\\.dylib") REGEX ".*_debug\\.dylib" EXCLUDE)
else()
install(DIRECTORY "${QT_PLUGINS_DIR}/" DESTINATION ${plugin_dest_dir} COMPONENT Runtime
FILES_MATCHING REGEX "(codecs|iconengines|imageformats|mediaservice|phonon_backend|platforms)/[^_]*\\.dylib")
endif()
install(CODE " install(CODE "
file(WRITE \"\${CMAKE_INSTALL_PREFIX}/${qtconf_dest_dir}/qt.conf\" \"[Paths] file(WRITE \"\${CMAKE_INSTALL_PREFIX}/${qtconf_dest_dir}/qt.conf\" \"[Paths]
@ -170,17 +165,11 @@ IF(WIN32)
set(plugin_dest_dir Plugins) set(plugin_dest_dir Plugins)
set(qtconf_dest_dir .) set(qtconf_dest_dir .)
# note: no codecs in qt5 # qt4: codecs, iconengines, imageformats
# note: phonon_backend => mediaservice # qt5: iconengines, imageformats, platforms
# note: needs platform on osx
if (CMAKE_BUILD_TYPE STREQUAL "Debug") install(DIRECTORY "${QT_PLUGINS_DIR}/" DESTINATION ${plugin_dest_dir} COMPONENT Runtime
install(DIRECTORY "${QT_PLUGINS_DIR}/" DESTINATION ${plugin_dest_dir} COMPONENT Runtime FILES_MATCHING REGEX "(codecs|iconengines|platforms)/.*[^d]\\.dll")
FILES_MATCHING REGEX "(codecs|iconengines|imageformats|mediaservice|phonon_backend|platforms)/.*d\\.dll")
else()
install(DIRECTORY "${QT_PLUGINS_DIR}/" DESTINATION ${plugin_dest_dir} COMPONENT Runtime
FILES_MATCHING REGEX "(codecs|iconengines|imageformats|mediaservice|phonon_backend|platforms)/.*[^d]\\.dll")
endif()
install(CODE " install(CODE "
file(WRITE \"\${CMAKE_INSTALL_PREFIX}/${qtconf_dest_dir}/qt.conf\" \"[Paths] file(WRITE \"\${CMAKE_INSTALL_PREFIX}/${qtconf_dest_dir}/qt.conf\" \"[Paths]

View file

@ -21,7 +21,7 @@ public:
bool getImport() const { return import; } bool getImport() const { return import; }
void setImport(bool _import) { import = _import; } void setImport(bool _import) { import = _import; }
SetToDownload(const QString &_shortName, const QString &_longName, const QVariant &_cards, bool _import, const QString &_setType = QString(), const QDate &_releaseDate = QDate()) SetToDownload(const QString &_shortName, const QString &_longName, const QVariant &_cards, bool _import, const QString &_setType = QString(), const QDate &_releaseDate = QDate())
: shortName(_shortName), longName(_longName), import(_import), cards(_cards), setType(_setType), releaseDate(_releaseDate) { } : shortName(_shortName), longName(_longName), import(_import), cards(_cards), releaseDate(_releaseDate), setType(_setType) { }
bool operator<(const SetToDownload &set) const { return longName.compare(set.longName, Qt::CaseInsensitive) < 0; } bool operator<(const SetToDownload &set) const { return longName.compare(set.longName, Qt::CaseInsensitive) < 0; }
}; };

View file

@ -139,17 +139,12 @@ if(APPLE)
set(plugin_dest_dir servatrice.app/Contents/Plugins) set(plugin_dest_dir servatrice.app/Contents/Plugins)
set(qtconf_dest_dir servatrice.app/Contents/Resources) set(qtconf_dest_dir servatrice.app/Contents/Resources)
# note: no codecs in qt5 # qt4: codecs, sqldrivers
# note: phonon_backend => mediaservice # qt5: platforms, sqldrivers
# note: needs platform on osx
if (CMAKE_BUILD_TYPE STREQUAL "Debug") install(DIRECTORY "${QT_PLUGINS_DIR}/" DESTINATION ${plugin_dest_dir} COMPONENT Runtime
install(DIRECTORY "${QT_PLUGINS_DIR}/" DESTINATION ${plugin_dest_dir} COMPONENT Runtime FILES_MATCHING REGEX "(codecs|platforms|sqldrivers)/.*\\.dylib"
FILES_MATCHING REGEX "(codecs|iconengines|imageformats|mediaservice|phonon_backend|platforms)/.*_debug\\.dylib") REGEX ".*_debug\\.dylib" EXCLUDE)
else()
install(DIRECTORY "${QT_PLUGINS_DIR}/" DESTINATION ${plugin_dest_dir} COMPONENT Runtime
FILES_MATCHING REGEX "(codecs|iconengines|imageformats|mediaservice|phonon_backend|platforms)/[^_]*\\.dylib")
endif()
install(CODE " install(CODE "
file(WRITE \"\${CMAKE_INSTALL_PREFIX}/${qtconf_dest_dir}/qt.conf\" \"[Paths] file(WRITE \"\${CMAKE_INSTALL_PREFIX}/${qtconf_dest_dir}/qt.conf\" \"[Paths]
@ -171,17 +166,11 @@ if(WIN32)
set(plugin_dest_dir Plugins) set(plugin_dest_dir Plugins)
set(qtconf_dest_dir .) set(qtconf_dest_dir .)
# note: no codecs in qt5 # qt4: codecs, sqldrivers
# note: phonon_backend => mediaservice # qt5: platforms, sqldrivers
# note: needs platform on osx
if (CMAKE_BUILD_TYPE STREQUAL "Debug") install(DIRECTORY "${QT_PLUGINS_DIR}/" DESTINATION ${plugin_dest_dir} COMPONENT Runtime
install(DIRECTORY "${QT_PLUGINS_DIR}/" DESTINATION ${plugin_dest_dir} COMPONENT Runtime FILES_MATCHING REGEX "(codecs|platforms|sqldrivers)/.*[^d]\\.dll")
FILES_MATCHING REGEX "(codecs|iconengines|imageformats|mediaservice|phonon_backend|platforms)/.*d\\.dll")
else()
install(DIRECTORY "${QT_PLUGINS_DIR}/" DESTINATION ${plugin_dest_dir} COMPONENT Runtime
FILES_MATCHING REGEX "(codecs|iconengines|imageformats|mediaservice|phonon_backend|platforms)/.*[^d]\\.dll")
endif()
install(CODE " install(CODE "
file(WRITE \"\${CMAKE_INSTALL_PREFIX}/${qtconf_dest_dir}/qt.conf\" \"[Paths] file(WRITE \"\${CMAKE_INSTALL_PREFIX}/${qtconf_dest_dir}/qt.conf\" \"[Paths]

View file

@ -108,7 +108,11 @@ void Servatrice_GameServer::incomingConnection(qintptr socketDescriptor)
QMetaObject::invokeMethod(ssi, "initConnection", Qt::QueuedConnection, Q_ARG(int, socketDescriptor)); QMetaObject::invokeMethod(ssi, "initConnection", Qt::QueuedConnection, Q_ARG(int, socketDescriptor));
} }
#if QT_VERSION < 0x050000
void Servatrice_IslServer::incomingConnection(int socketDescriptor) void Servatrice_IslServer::incomingConnection(int socketDescriptor)
#else
void Servatrice_IslServer::incomingConnection(qintptr socketDescriptor)
#endif
{ {
QThread *thread = new QThread; QThread *thread = new QThread;
connect(thread, SIGNAL(finished()), thread, SLOT(deleteLater())); connect(thread, SIGNAL(finished()), thread, SLOT(deleteLater()));

View file

@ -68,7 +68,11 @@ public:
Servatrice_IslServer(Servatrice *_server, const QSslCertificate &_cert, const QSslKey &_privateKey, QObject *parent = 0) Servatrice_IslServer(Servatrice *_server, const QSslCertificate &_cert, const QSslKey &_privateKey, QObject *parent = 0)
: QTcpServer(parent), server(_server), cert(_cert), privateKey(_privateKey) { } : QTcpServer(parent), server(_server), cert(_cert), privateKey(_privateKey) { }
protected: protected:
#if QT_VERSION < 0x050000
void incomingConnection(int socketDescriptor); void incomingConnection(int socketDescriptor);
#else
void incomingConnection(qintptr socketDescriptor);
#endif
}; };
class ServerProperties { class ServerProperties {

View file

@ -6,7 +6,7 @@ mkdir build
cd build cd build
prefix="" prefix=""
if [[ $TRAVIS_OS_NAME == "osx" && $QT4 == 0 ]]; then if [[ $TRAVIS_OS_NAME == "osx" && $QT4 == 0 ]]; then
prefix="-DCMAKE_PREFIX_PATH=/usr/local/Cellar/qt5/5.3.2/" prefix="-DCMAKE_PREFIX_PATH=/usr/local/Cellar/qt5/5.4.0/"
fi fi
cmake .. -DWITH_SERVER=1 -DWITH_QT4=$QT4 $prefix cmake .. -DWITH_SERVER=1 -DWITH_QT4=$QT4 $prefix
make make