Merge remote-tracking branch 'upstream/master' into message_log
Conflicts: servatrice/CMakeLists.txt
This commit is contained in:
commit
2896f05823
42 changed files with 6834 additions and 5177 deletions
|
@ -79,9 +79,9 @@ ELSEIF (CMAKE_COMPILER_IS_GNUCXX)
|
|||
include(CheckCXXCompilerFlag)
|
||||
|
||||
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})
|
||||
CHECK_CXX_COMPILER_FLAG("${FLAG}" CXX_HAS_WARNING_${FLAG})
|
||||
|
|
|
@ -101,8 +101,8 @@ set(cockatrice_RESOURCES cockatrice.qrc)
|
|||
FILE(GLOB cockatrice_TS "${CMAKE_CURRENT_SOURCE_DIR}/translations/*.ts")
|
||||
|
||||
IF(UPDATE_TRANSLATIONS)
|
||||
FILE(GLOB_RECURSE translate_cockatrice_SRCS ${CMAKE_SOURCE_DIR}/cockatrice/src/*.cpp)
|
||||
FILE(GLOB_RECURSE translate_common_SRCS ${CMAKE_CURRENT_SOURCE_DIR}/common/*.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 ${CMAKE_CURRENT_SOURCE_DIR}/common/*.h)
|
||||
SET(translate_SRCS ${translate_cockatrice_SRCS} ${translate_common_SRCS})
|
||||
ENDIF(UPDATE_TRANSLATIONS)
|
||||
|
||||
|
@ -269,18 +269,12 @@ if(APPLE)
|
|||
set(plugin_dest_dir cockatrice.app/Contents/Plugins)
|
||||
set(qtconf_dest_dir cockatrice.app/Contents/Resources)
|
||||
|
||||
# note: no codecs in qt5
|
||||
# note: phonon_backend => audio | mediaservice
|
||||
# note: needs platform on osx
|
||||
# qt4: codecs, iconengines, imageformats, phonon_backend
|
||||
# qt5: audio, iconengines, imageformats, platforms, printsupport
|
||||
|
||||
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||
install(DIRECTORY "${QT_PLUGINS_DIR}/" DESTINATION ${plugin_dest_dir} COMPONENT Runtime
|
||||
FILES_MATCHING REGEX "(audio|codecs|iconengines|imageformats|mediaservice|phonon_backend|platforms)/.*_debug\\.dylib")
|
||||
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(DIRECTORY "${QT_PLUGINS_DIR}/" DESTINATION ${plugin_dest_dir} COMPONENT Runtime
|
||||
FILES_MATCHING REGEX "(audio|codecs|iconengines|imageformats|phonon_backend|platforms|printsupport)/.*\\.dylib"
|
||||
REGEX ".*_debug\\.dylib" EXCLUDE)
|
||||
|
||||
install(CODE "
|
||||
file(WRITE \"\${CMAKE_INSTALL_PREFIX}/${qtconf_dest_dir}/qt.conf\" \"[Paths]
|
||||
|
@ -303,17 +297,11 @@ if(WIN32)
|
|||
set(plugin_dest_dir Plugins)
|
||||
set(qtconf_dest_dir .)
|
||||
|
||||
# note: no codecs in qt5
|
||||
# note: phonon_backend => audio | mediaservice
|
||||
# note: needs platform on osx
|
||||
# qt4: codecs, iconengines, imageformats, phonon_backend
|
||||
# qt5: audio, iconengines, imageformats, platforms, printsupport
|
||||
|
||||
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||
install(DIRECTORY "${QT_PLUGINS_DIR}/" DESTINATION ${plugin_dest_dir} COMPONENT Runtime
|
||||
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(DIRECTORY "${QT_PLUGINS_DIR}/" DESTINATION ${plugin_dest_dir} COMPONENT Runtime
|
||||
FILES_MATCHING REGEX "(audio|codecs|iconengines|imageformats|phonon_backend|platforms|printsupport)/.*[^d]\\.dll")
|
||||
|
||||
install(CODE "
|
||||
file(WRITE \"\${CMAKE_INSTALL_PREFIX}/${qtconf_dest_dir}/qt.conf\" \"[Paths]
|
||||
|
|
|
@ -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)
|
||||
: shortName(_shortName), longName(_longName), setType(_setType), releaseDate(_releaseDate)
|
||||
: shortName(_shortName), longName(_longName), releaseDate(_releaseDate), setType(_setType)
|
||||
{
|
||||
updateSortKey();
|
||||
}
|
||||
|
|
|
@ -180,9 +180,11 @@ void DeckViewCardContainer::paint(QPainter *painter, const QStyleOptionGraphicsI
|
|||
qreal thisRowHeight = CARD_HEIGHT * currentRowsAndCols[i].first;
|
||||
QRectF textRect(0, yUntilNow, totalTextWidth, thisRowHeight);
|
||||
yUntilNow += thisRowHeight + paddingY;
|
||||
|
||||
|
||||
QString displayString = QString("%1\n(%2)").arg(cardTypeList[i]).arg(cardsByType.count(cardTypeList[i]));
|
||||
|
||||
painter->setPen(Qt::white);
|
||||
painter->drawText(textRect, Qt::AlignHCenter | Qt::AlignVCenter | Qt::TextSingleLine, cardTypeList[i]);
|
||||
painter->drawText(textRect, Qt::AlignHCenter | Qt::AlignVCenter, displayString);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -75,6 +75,7 @@ DlgConnect::DlgConnect(QWidget *parent)
|
|||
|
||||
void DlgConnect::passwordSaved(int state)
|
||||
{
|
||||
Q_UNUSED(state);
|
||||
if(savePasswordCheckBox->isChecked()) {
|
||||
autoConnectCheckBox->setEnabled(true);
|
||||
} else {
|
||||
|
|
|
@ -44,7 +44,7 @@ GeneralSettingsPage::GeneralSettingsPage()
|
|||
picDownloadCheckBox = new QCheckBox;
|
||||
picDownloadCheckBox->setChecked(settingsCache->getPicDownload());
|
||||
|
||||
QPushButton *clearDownloadedPicsButton = new QPushButton(tr("Reset/Clear Downloaded Pictures"));
|
||||
clearDownloadedPicsButton = new QPushButton();
|
||||
connect(clearDownloadedPicsButton, SIGNAL(clicked()), this, SLOT(clearDownloadedPicsButtonClicked()));
|
||||
|
||||
picDownloadHqCheckBox = new QCheckBox;
|
||||
|
@ -227,6 +227,7 @@ void GeneralSettingsPage::retranslateUi()
|
|||
picsPathLabel->setText(tr("Pictures directory:"));
|
||||
cardDatabasePathLabel->setText(tr("Card database:"));
|
||||
tokenDatabasePathLabel->setText(tr("Token database:"));
|
||||
clearDownloadedPicsButton->setText(tr("Reset/Clear Downloaded Pictures"));
|
||||
}
|
||||
|
||||
AppearanceSettingsPage::AppearanceSettingsPage()
|
||||
|
@ -567,29 +568,10 @@ DeckEditorSettingsPage::DeckEditorSettingsPage()
|
|||
priceTagsCheckBox->setChecked(settingsCache->getPriceTagFeature());
|
||||
connect(priceTagsCheckBox, SIGNAL(stateChanged(int)), settingsCache, SLOT(setPriceTagFeature(int)));
|
||||
|
||||
priceTagSource0 = new QRadioButton;
|
||||
priceTagSource1 = new QRadioButton;
|
||||
|
||||
switch(settingsCache->getPriceTagSource())
|
||||
{
|
||||
case AbstractPriceUpdater::DBPriceSource:
|
||||
priceTagSource1->setChecked(true);
|
||||
break;
|
||||
case AbstractPriceUpdater::BLPPriceSource:
|
||||
default:
|
||||
priceTagSource0->setChecked(true);
|
||||
break;
|
||||
}
|
||||
|
||||
connect(priceTagSource0, SIGNAL(toggled(bool)), this, SLOT(radioPriceTagSourceClicked(bool)));
|
||||
connect(priceTagSource1, SIGNAL(toggled(bool)), this, SLOT(radioPriceTagSourceClicked(bool)));
|
||||
|
||||
connect(this, SIGNAL(priceTagSourceChanged(int)), settingsCache, SLOT(setPriceTagSource(int)));
|
||||
|
||||
QGridLayout *generalGrid = new QGridLayout;
|
||||
generalGrid->addWidget(priceTagsCheckBox, 0, 0);
|
||||
generalGrid->addWidget(priceTagSource0, 1, 0);
|
||||
generalGrid->addWidget(priceTagSource1, 2, 0);
|
||||
|
||||
generalGroupBox = new QGroupBox;
|
||||
generalGroupBox->setLayout(generalGrid);
|
||||
|
@ -602,9 +584,7 @@ DeckEditorSettingsPage::DeckEditorSettingsPage()
|
|||
|
||||
void DeckEditorSettingsPage::retranslateUi()
|
||||
{
|
||||
priceTagsCheckBox->setText(tr("Enable &price tag feature"));
|
||||
priceTagSource0->setText(tr("using data from blacklotusproject.com"));
|
||||
priceTagSource1->setText(tr("using data from deckbrew.com"));
|
||||
priceTagsCheckBox->setText(tr("Enable &price tag feature from deckbrew.com"));
|
||||
generalGroupBox->setTitle(tr("General"));
|
||||
}
|
||||
|
||||
|
@ -613,12 +593,7 @@ void DeckEditorSettingsPage::radioPriceTagSourceClicked(bool checked)
|
|||
if(!checked)
|
||||
return;
|
||||
|
||||
int source=AbstractPriceUpdater::BLPPriceSource;
|
||||
if(priceTagSource0->isChecked())
|
||||
source=AbstractPriceUpdater::BLPPriceSource;
|
||||
if(priceTagSource1->isChecked())
|
||||
source=AbstractPriceUpdater::DBPriceSource;
|
||||
|
||||
int source=AbstractPriceUpdater::DBPriceSource;
|
||||
emit priceTagSourceChanged(source);
|
||||
}
|
||||
|
||||
|
|
|
@ -44,6 +44,7 @@ private:
|
|||
QCheckBox *picDownloadCheckBox;
|
||||
QCheckBox *picDownloadHqCheckBox;
|
||||
QLabel *languageLabel, *deckPathLabel, *replaysPathLabel, *picsPathLabel, *cardDatabasePathLabel, *tokenDatabasePathLabel;
|
||||
QPushButton *clearDownloadedPicsButton;
|
||||
};
|
||||
|
||||
class AppearanceSettingsPage : public AbstractSettingsPage {
|
||||
|
|
|
@ -154,7 +154,7 @@ public:
|
|||
FilterTreeNode *termNode(const CardFilter *f);
|
||||
FilterTreeNode *attrTypeNode(CardFilter::Attr attr,
|
||||
CardFilter::Type type);
|
||||
const char *textCStr() { return "root"; }
|
||||
const char *textCStr() const { return "root"; }
|
||||
int index() const { return 0; }
|
||||
|
||||
bool acceptsCard(const CardInfo *info) const;
|
||||
|
|
|
@ -70,13 +70,13 @@ PlayerListWidget::PlayerListWidget(TabSupervisor *_tabSupervisor, AbstractClient
|
|||
setMinimumHeight(60);
|
||||
setIconSize(QSize(20, 15));
|
||||
setColumnCount(6);
|
||||
setColumnWidth(0, 20);
|
||||
setColumnWidth(1, 20);
|
||||
setColumnWidth(2, 20);
|
||||
setColumnWidth(3, 20);
|
||||
setColumnWidth(5, 20);
|
||||
setHeaderHidden(true);
|
||||
setRootIsDecorated(false);
|
||||
#if QT_VERSION < 0x050000
|
||||
header()->setResizeMode(QHeaderView::ResizeToContents);
|
||||
#else
|
||||
header()->setSectionResizeMode(QHeaderView::ResizeToContents);
|
||||
#endif
|
||||
retranslateUi();
|
||||
}
|
||||
|
||||
|
@ -116,6 +116,7 @@ void PlayerListWidget::updatePlayerProperties(const ServerInfo_PlayerProperties
|
|||
player->setData(3, Qt::UserRole, 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()));
|
||||
resizeColumnToContents(4);
|
||||
const QString country = QString::fromStdString(prop.user_info().country());
|
||||
if (!country.isEmpty())
|
||||
player->setIcon(4, QIcon(CountryPixmapGenerator::generatePixmap(12, country)));
|
||||
|
@ -123,8 +124,10 @@ void PlayerListWidget::updatePlayerProperties(const ServerInfo_PlayerProperties
|
|||
}
|
||||
if (prop.has_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()));
|
||||
resizeColumnToContents(5);
|
||||
}
|
||||
if (prop.has_sideboard_locked())
|
||||
player->setIcon(5, prop.sideboard_locked() ? lockIcon : QIcon());
|
||||
if (prop.has_ping_seconds())
|
||||
|
|
|
@ -28,82 +28,6 @@ AbstractPriceUpdater::AbstractPriceUpdater(const DeckList *_deck)
|
|||
deck = _deck;
|
||||
}
|
||||
|
||||
// blacklotusproject.com
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param _deck deck.
|
||||
*/
|
||||
BLPPriceUpdater::BLPPriceUpdater(const DeckList *_deck)
|
||||
: AbstractPriceUpdater(_deck)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the prices of the cards in deckList.
|
||||
*/
|
||||
void BLPPriceUpdater::updatePrices()
|
||||
{
|
||||
QString q = "http://blacklotusproject.com/json/?cards=";
|
||||
QStringList cards = deck->getCardList();
|
||||
for (int i = 0; i < cards.size(); ++i) {
|
||||
q += cards[i].toLower() + "|";
|
||||
}
|
||||
QUrl url(q.replace(' ', '+'));
|
||||
|
||||
QNetworkReply *reply = nam->get(QNetworkRequest(url));
|
||||
connect(reply, SIGNAL(finished()), this, SLOT(downloadFinished()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the download of the json file with the prices is finished.
|
||||
*/
|
||||
void BLPPriceUpdater::downloadFinished()
|
||||
{
|
||||
QNetworkReply *reply = static_cast<QNetworkReply *>(sender());
|
||||
bool ok;
|
||||
QVariantMap resultMap = QtJson::Json::parse(QString(reply->readAll()), ok).toMap();
|
||||
if (!ok) {
|
||||
reply->deleteLater();
|
||||
deleteLater();
|
||||
return;
|
||||
}
|
||||
|
||||
QMap<QString, float> cardsPrice;
|
||||
|
||||
QListIterator<QVariant> it(resultMap.value("cards").toList());
|
||||
while (it.hasNext()) {
|
||||
QVariantMap map = it.next().toMap();
|
||||
QString name = map.value("name").toString().toLower();
|
||||
float price = map.value("price").toString().toFloat();
|
||||
QString set = map.value("set_code").toString();
|
||||
|
||||
/**
|
||||
* Make sure Masters Edition (MED) isn't the set, as it doesn't
|
||||
* physically exist. Also check the price to see that the cheapest set
|
||||
* ends up as the final price.
|
||||
*/
|
||||
if (set != "MED" && (!cardsPrice.contains(name) || cardsPrice.value(name) > price))
|
||||
cardsPrice.insert(name, price);
|
||||
}
|
||||
|
||||
InnerDecklistNode *listRoot = deck->getRoot();
|
||||
for (int i = 0; i < listRoot->size(); i++) {
|
||||
InnerDecklistNode *currentZone = dynamic_cast<InnerDecklistNode *>(listRoot->at(i));
|
||||
for (int j = 0; j < currentZone->size(); j++) {
|
||||
DecklistCardNode *currentCard = dynamic_cast<DecklistCardNode *>(currentZone->at(j));
|
||||
if (!currentCard)
|
||||
continue;
|
||||
currentCard->setPrice(cardsPrice[currentCard->getName().toLower()]);
|
||||
}
|
||||
}
|
||||
|
||||
reply->deleteLater();
|
||||
deleteLater();
|
||||
emit finishedUpdate();
|
||||
}
|
||||
|
||||
// deckbrew.com
|
||||
|
||||
/**
|
||||
|
|
|
@ -18,7 +18,7 @@ class AbstractPriceUpdater : public QWidget
|
|||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
enum PriceSource { BLPPriceSource, DBPriceSource };
|
||||
enum PriceSource { DBPriceSource };
|
||||
protected:
|
||||
const DeckList *deck;
|
||||
QNetworkAccessManager *nam;
|
||||
|
@ -31,16 +31,6 @@ public:
|
|||
virtual void updatePrices() = 0;
|
||||
};
|
||||
|
||||
class BLPPriceUpdater : public AbstractPriceUpdater
|
||||
{
|
||||
Q_OBJECT
|
||||
protected:
|
||||
virtual void downloadFinished();
|
||||
public:
|
||||
BLPPriceUpdater(const DeckList *deck);
|
||||
virtual void updatePrices();
|
||||
};
|
||||
|
||||
class DBPriceUpdater : public AbstractPriceUpdater
|
||||
{
|
||||
Q_OBJECT
|
||||
|
|
|
@ -25,11 +25,11 @@ QVariant SetsModel::data(const QModelIndex &index, int role) const
|
|||
|
||||
CardSet *set = sets[index.row()];
|
||||
switch (index.column()) {
|
||||
case SortKeyCol: return set->getSortKey();
|
||||
case SortKeyCol: return QString("%1").arg(set->getSortKey(), 4, 10, QChar('0'));
|
||||
case SetTypeCol: return set->getSetType();
|
||||
case ShortNameCol: return set->getShortName();
|
||||
case LongNameCol: return set->getLongName();
|
||||
case ReleaseDateCol: return set->getReleaseDate();
|
||||
case ReleaseDateCol: return set->getReleaseDate().toString(Qt::ISODate);
|
||||
default: return QVariant();
|
||||
}
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ QVariant SetsModel::headerData(int section, Qt::Orientation orientation, int rol
|
|||
switch (section) {
|
||||
case SortKeyCol: return tr("Key");
|
||||
case SetTypeCol: return tr("Set type");
|
||||
case ShortNameCol: return tr("Short name");
|
||||
case ShortNameCol: return tr("Set code");
|
||||
case LongNameCol: return tr("Long name");
|
||||
case ReleaseDateCol: return tr("Release date");
|
||||
default: return QVariant();
|
||||
|
@ -78,47 +78,69 @@ bool SetsModel::dropMimeData(const QMimeData *data, Qt::DropAction action, int r
|
|||
row = parent.row();
|
||||
}
|
||||
int oldRow = qobject_cast<const SetsMimeData *>(data)->getOldRow();
|
||||
if (oldRow < row)
|
||||
row--;
|
||||
|
||||
swapRows(oldRow, row);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void SetsModel::swapRows(int oldRow, int newRow)
|
||||
{
|
||||
beginRemoveRows(QModelIndex(), oldRow, oldRow);
|
||||
CardSet *temp = sets.takeAt(oldRow);
|
||||
endRemoveRows();
|
||||
if (oldRow < row)
|
||||
row--;
|
||||
beginInsertRows(QModelIndex(), row, row);
|
||||
sets.insert(row, temp);
|
||||
|
||||
beginInsertRows(QModelIndex(), newRow, newRow);
|
||||
sets.insert(newRow, temp);
|
||||
endInsertRows();
|
||||
|
||||
emit dataChanged(index(0, 0), index(rowCount() - 1, columnCount() - 1));
|
||||
}
|
||||
|
||||
void SetsModel::sort(int column, Qt::SortOrder order)
|
||||
{
|
||||
QMap<QString, CardSet *> setMap;
|
||||
int numRows = rowCount();
|
||||
int row;
|
||||
|
||||
for(row = 0; row < numRows; ++row)
|
||||
setMap.insertMulti(index(row, column).data().toString(), sets.at(row));
|
||||
|
||||
QList<CardSet *> tmp = setMap.values();
|
||||
sets.clear();
|
||||
if(order == Qt::AscendingOrder)
|
||||
{
|
||||
for(row = 0; row < tmp.size(); row++) {
|
||||
sets.append(tmp.at(row));
|
||||
}
|
||||
} else {
|
||||
for(row = tmp.size() - 1; row >= 0; row--) {
|
||||
sets.append(tmp.at(row));
|
||||
}
|
||||
}
|
||||
|
||||
emit dataChanged(index(0, 0), index(numRows - 1, columnCount() - 1));
|
||||
}
|
||||
|
||||
void SetsModel::save()
|
||||
{
|
||||
for (int i = 0; i < sets.size(); i++)
|
||||
sets[i]->setSortKey(i);
|
||||
|
||||
sets.sortByKey();
|
||||
}
|
||||
|
||||
void SetsModel::restore(CardDatabase *db)
|
||||
{
|
||||
sets = db->getSetList();
|
||||
sets.sortByKey();
|
||||
|
||||
emit dataChanged(index(0, 0), index(rowCount() - 1, columnCount() - 1));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
QStringList SetsModel::mimeTypes() const
|
||||
{
|
||||
return QStringList() << "application/x-cockatricecardset";
|
||||
}
|
||||
|
||||
SetsProxyModel::SetsProxyModel(QObject *parent)
|
||||
: QSortFilterProxyModel(parent)
|
||||
{
|
||||
setDynamicSortFilter(true);
|
||||
}
|
||||
|
||||
void SetsProxyModel::saveOrder()
|
||||
{
|
||||
int numRows = rowCount();
|
||||
SetsModel * model = (SetsModel*) sourceModel();
|
||||
for(int row = 0; row < numRows; ++row) {
|
||||
QModelIndex idx = index(row, 0);
|
||||
int oldRow = data(idx, Qt::DisplayRole).toInt();
|
||||
CardSet *temp = model->sets.at(oldRow);
|
||||
temp->setSortKey(row);
|
||||
}
|
||||
model->sets.sortByKey();
|
||||
|
||||
emit model->dataChanged(model->index(0, 0), model->index(model->rowCount() - 1, model->columnCount() - 1));
|
||||
}
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
#define SETSMODEL_H
|
||||
|
||||
#include <QAbstractTableModel>
|
||||
#include <QSortFilterProxyModel>
|
||||
#include <QMimeData>
|
||||
#include "carddatabase.h"
|
||||
|
||||
|
@ -25,12 +24,12 @@ private:
|
|||
static const int NUM_COLS = 5;
|
||||
SetList sets;
|
||||
public:
|
||||
enum SetsColumns { SortKeyCol, SetTypeCol, ShortNameCol, LongNameCol, ReleaseDateCol };
|
||||
enum SetsColumns { SortKeyCol, LongNameCol, ShortNameCol, SetTypeCol, ReleaseDateCol };
|
||||
|
||||
SetsModel(CardDatabase *_db, QObject *parent = 0);
|
||||
~SetsModel();
|
||||
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 headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
|
||||
Qt::ItemFlags flags(const QModelIndex &index) const;
|
||||
|
@ -39,12 +38,10 @@ public:
|
|||
QMimeData *mimeData(const QModelIndexList &indexes) const;
|
||||
bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent);
|
||||
QStringList mimeTypes() const;
|
||||
void swapRows(int oldRow, int newRow);
|
||||
void sort(int column, Qt::SortOrder order = Qt::AscendingOrder);
|
||||
void save();
|
||||
void restore(CardDatabase *db);
|
||||
};
|
||||
|
||||
class SetsProxyModel : public QSortFilterProxyModel {
|
||||
Q_OBJECT
|
||||
public:
|
||||
SetsProxyModel(QObject *parent = 0);
|
||||
void saveOrder();
|
||||
};
|
||||
#endif
|
||||
|
|
|
@ -10,6 +10,10 @@ Tab::Tab(TabSupervisor *_tabSupervisor, QWidget *parent)
|
|||
|
||||
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->setAttribute(Qt::WA_TransparentForMouseEvents);
|
||||
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)
|
||||
{
|
||||
if (infoPopup) {
|
||||
if ((infoPopup->getCardName() == cardName) || (cardName == "_")) {
|
||||
if ((currentCardName == cardName) || (cardName == "_")) {
|
||||
infoPopup->deleteLater();
|
||||
infoPopup = 0;
|
||||
}
|
||||
|
|
|
@ -19,6 +19,7 @@ protected slots:
|
|||
void showCardInfoPopup(const QPoint &pos, const QString &cardName);
|
||||
void deleteCardInfoPopup(const QString &cardName);
|
||||
private:
|
||||
QString currentCardName;
|
||||
bool contentsChanged;
|
||||
CardInfoWidget *infoPopup;
|
||||
QList<QMenu *> tabMenus;
|
||||
|
|
|
@ -680,11 +680,8 @@ void TabDeckEditor::actUpdatePrices()
|
|||
switch(settingsCache->getPriceTagSource())
|
||||
{
|
||||
case AbstractPriceUpdater::DBPriceSource:
|
||||
up = new DBPriceUpdater(deckModel->getDeckList());
|
||||
break;
|
||||
case AbstractPriceUpdater::BLPPriceSource:
|
||||
default:
|
||||
up = new BLPPriceUpdater(deckModel->getDeckList());
|
||||
up = new DBPriceUpdater(deckModel->getDeckList());
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -119,7 +119,7 @@ void TabReplays::retranslateUi()
|
|||
aOpenRemoteReplay->setText(tr("Watch replay"));
|
||||
aDownload->setText(tr("Download replay"));
|
||||
aKeep->setText(tr("Toggle expiration lock"));
|
||||
aDeleteLocalReplay->setText(tr("Delete"));
|
||||
aDeleteRemoteReplay->setText(tr("Delete"));
|
||||
}
|
||||
|
||||
void TabReplays::actOpenLocalReplay()
|
||||
|
|
|
@ -410,7 +410,7 @@ void MainWindow::closeEvent(QCloseEvent *event)
|
|||
}
|
||||
event->accept();
|
||||
settingsCache->setMainWindowGeometry(saveGeometry());
|
||||
delete tabSupervisor;
|
||||
tabSupervisor->deleteLater();
|
||||
}
|
||||
|
||||
void MainWindow::changeEvent(QEvent *event)
|
||||
|
|
|
@ -5,41 +5,72 @@
|
|||
#include <QGridLayout>
|
||||
#include <QHeaderView>
|
||||
#include <QPushButton>
|
||||
#include <QItemSelection>
|
||||
#include <QMessageBox>
|
||||
|
||||
WndSets::WndSets(QWidget *parent)
|
||||
: QMainWindow(parent)
|
||||
{
|
||||
model = new SetsModel(db, this);
|
||||
proxyModel = new SetsProxyModel(this);
|
||||
proxyModel->setSourceModel(model);
|
||||
proxyModel->setSortCaseSensitivity(Qt::CaseInsensitive);
|
||||
view = new QTreeView;
|
||||
view->setModel(proxyModel);
|
||||
view->setModel(model);
|
||||
|
||||
view->setAlternatingRowColors(true);
|
||||
view->setUniformRowHeights(true);
|
||||
view->setAllColumnsShowFocus(true);
|
||||
view->setSortingEnabled(true);
|
||||
view->sortByColumn(SetsModel::SortKeyCol, Qt::AscendingOrder);
|
||||
view->setSelectionMode(QAbstractItemView::SingleSelection);
|
||||
view->setSelectionBehavior(QAbstractItemView::SelectRows);
|
||||
|
||||
view->setDragEnabled(true);
|
||||
view->setAcceptDrops(true);
|
||||
view->setDropIndicatorShown(true);
|
||||
view->setDragDropMode(QAbstractItemView::InternalMove);
|
||||
|
||||
#if QT_VERSION < 0x050000
|
||||
view->header()->setResizeMode(QHeaderView::Stretch);
|
||||
view->header()->setResizeMode(SetsModel::LongNameCol, QHeaderView::ResizeToContents);
|
||||
#else
|
||||
view->header()->setSectionResizeMode(QHeaderView::Stretch);
|
||||
view->header()->setSectionResizeMode(SetsModel::LongNameCol, QHeaderView::ResizeToContents);
|
||||
#endif
|
||||
|
||||
view->sortByColumn(SetsModel::SortKeyCol, Qt::AscendingOrder);
|
||||
view->setColumnHidden(SetsModel::SortKeyCol, true);
|
||||
view->setRootIsDecorated(false);
|
||||
|
||||
saveButton = new QPushButton(tr("Save set ordering"));
|
||||
connect(saveButton, SIGNAL(clicked()), this, SLOT(actSave()));
|
||||
restoreButton = new QPushButton(tr("Restore saved set ordering"));
|
||||
connect(restoreButton, SIGNAL(clicked()), this, SLOT(actRestore()));
|
||||
upButton = new QPushButton(tr("Move selected set up"));
|
||||
connect(upButton, SIGNAL(clicked()), this, SLOT(actUp()));
|
||||
downButton = new QPushButton(tr("Move selected set down"));
|
||||
connect(downButton, SIGNAL(clicked()), this, SLOT(actDown()));
|
||||
topButton = new QPushButton(tr("Move selected set to top"));
|
||||
connect(topButton, SIGNAL(clicked()), this, SLOT(actTop()));
|
||||
bottomButton = new QPushButton(tr("Move selected set to bottom"));
|
||||
connect(bottomButton, SIGNAL(clicked()), this, SLOT(actBottom()));
|
||||
|
||||
upButton->setDisabled(true);
|
||||
downButton->setDisabled(true);
|
||||
topButton->setDisabled(true);
|
||||
bottomButton->setDisabled(true);
|
||||
|
||||
connect(view->selectionModel(), SIGNAL(selectionChanged(const QItemSelection &, const QItemSelection &)),
|
||||
this, SLOT(actToggleButtons(const QItemSelection &, const QItemSelection &)));
|
||||
|
||||
QGridLayout *mainLayout = new QGridLayout;
|
||||
mainLayout->addWidget(view, 0, 0, 1, 2);
|
||||
mainLayout->addWidget(saveButton, 1, 0, 1, 1);
|
||||
mainLayout->addWidget(restoreButton, 1, 1, 1, 1);
|
||||
|
||||
mainLayout->addWidget(upButton, 1, 0, 1, 1);
|
||||
mainLayout->addWidget(downButton, 2, 0, 1, 1);
|
||||
|
||||
mainLayout->addWidget(topButton, 1, 1, 1, 1);
|
||||
mainLayout->addWidget(bottomButton, 2, 1, 1, 1);
|
||||
|
||||
mainLayout->addWidget(saveButton, 3, 0, 1, 1);
|
||||
mainLayout->addWidget(restoreButton, 3, 1, 1, 1);
|
||||
|
||||
QWidget *centralWidget = new QWidget;
|
||||
centralWidget->setLayout(mainLayout);
|
||||
|
@ -55,10 +86,91 @@ WndSets::~WndSets()
|
|||
|
||||
void WndSets::actSave()
|
||||
{
|
||||
proxyModel->saveOrder();
|
||||
model->save();
|
||||
QMessageBox::information(this, tr("Success"), tr("The sets database has been saved successfully."));
|
||||
}
|
||||
|
||||
void WndSets::actRestore()
|
||||
{
|
||||
view->sortByColumn(SetsModel::SortKeyCol, Qt::AscendingOrder);
|
||||
model->restore(db);
|
||||
}
|
||||
|
||||
void WndSets::actToggleButtons(const QItemSelection & selected, const QItemSelection &)
|
||||
{
|
||||
bool disabled = selected.empty();
|
||||
upButton->setDisabled(disabled);
|
||||
downButton->setDisabled(disabled);
|
||||
topButton->setDisabled(disabled);
|
||||
bottomButton->setDisabled(disabled);
|
||||
}
|
||||
|
||||
void WndSets::selectRow(int row)
|
||||
{
|
||||
QModelIndex idx = model->index(row, 0);
|
||||
view->selectionModel()->select(idx, QItemSelectionModel::ClearAndSelect | QItemSelectionModel::Rows);
|
||||
view->scrollTo(idx, QAbstractItemView::EnsureVisible);
|
||||
}
|
||||
|
||||
void WndSets::actUp()
|
||||
{
|
||||
QModelIndexList rows = view->selectionModel()->selectedRows();
|
||||
if(rows.empty())
|
||||
return;
|
||||
|
||||
QModelIndex selectedRow = rows.first();
|
||||
int oldRow = selectedRow.row();
|
||||
int newRow = oldRow - 1;
|
||||
if(oldRow <= 0)
|
||||
return;
|
||||
|
||||
model->swapRows(oldRow, newRow);
|
||||
selectRow(newRow);
|
||||
}
|
||||
|
||||
void WndSets::actDown()
|
||||
{
|
||||
QModelIndexList rows = view->selectionModel()->selectedRows();
|
||||
if(rows.empty())
|
||||
return;
|
||||
|
||||
QModelIndex selectedRow = rows.first();
|
||||
int oldRow = selectedRow.row();
|
||||
int newRow = oldRow + 1;
|
||||
if(oldRow >= model->rowCount() - 1)
|
||||
return;
|
||||
|
||||
model->swapRows(oldRow, newRow);
|
||||
selectRow(newRow);
|
||||
}
|
||||
|
||||
void WndSets::actTop()
|
||||
{
|
||||
QModelIndexList rows = view->selectionModel()->selectedRows();
|
||||
if(rows.empty())
|
||||
return;
|
||||
|
||||
QModelIndex selectedRow = rows.first();
|
||||
int oldRow = selectedRow.row();
|
||||
int newRow = 0;
|
||||
if(oldRow <= 0)
|
||||
return;
|
||||
|
||||
model->swapRows(oldRow, newRow);
|
||||
selectRow(newRow);
|
||||
}
|
||||
|
||||
void WndSets::actBottom()
|
||||
{
|
||||
QModelIndexList rows = view->selectionModel()->selectedRows();
|
||||
if(rows.empty())
|
||||
return;
|
||||
|
||||
QModelIndex selectedRow = rows.first();
|
||||
int oldRow = selectedRow.row();
|
||||
int newRow = model->rowCount() - 1;
|
||||
if(oldRow >= newRow)
|
||||
return;
|
||||
|
||||
model->swapRows(oldRow, newRow);
|
||||
selectRow(newRow);
|
||||
}
|
||||
|
|
|
@ -5,23 +5,30 @@
|
|||
|
||||
class SetsModel;
|
||||
class SetsProxyModel;
|
||||
class QTreeView;
|
||||
class QPushButton;
|
||||
class CardDatabase;
|
||||
class QItemSelection;
|
||||
class QTreeView;
|
||||
|
||||
class WndSets : public QMainWindow {
|
||||
Q_OBJECT
|
||||
private:
|
||||
SetsModel *model;
|
||||
SetsProxyModel *proxyModel;
|
||||
QTreeView *view;
|
||||
QPushButton *saveButton, *restoreButton;
|
||||
QPushButton *saveButton, *restoreButton, *upButton, *downButton, *bottomButton, *topButton;
|
||||
public:
|
||||
WndSets(QWidget *parent = 0);
|
||||
~WndSets();
|
||||
protected:
|
||||
void selectRow(int row);
|
||||
private slots:
|
||||
void actSave();
|
||||
void actRestore();
|
||||
void actUp();
|
||||
void actDown();
|
||||
void actTop();
|
||||
void actBottom();
|
||||
void actToggleButtons(const QItemSelection & selected, const QItemSelection & deselected);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
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
|
@ -138,17 +138,12 @@ if(APPLE)
|
|||
set(plugin_dest_dir oracle.app/Contents/Plugins)
|
||||
set(qtconf_dest_dir oracle.app/Contents/Resources)
|
||||
|
||||
# note: no codecs in qt5
|
||||
# note: phonon_backend => mediaservice
|
||||
# note: needs platform on osx
|
||||
# qt4: codecs, iconengines, imageformats
|
||||
# qt5: iconengines, platforms
|
||||
|
||||
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||
install(DIRECTORY "${QT_PLUGINS_DIR}/" DESTINATION ${plugin_dest_dir} COMPONENT Runtime
|
||||
FILES_MATCHING REGEX "(codecs|iconengines|imageformats|mediaservice|phonon_backend|platforms)/.*_debug\\.dylib")
|
||||
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(DIRECTORY "${QT_PLUGINS_DIR}/" DESTINATION ${plugin_dest_dir} COMPONENT Runtime
|
||||
FILES_MATCHING REGEX "(codecs|iconengines|platforms)/.*\\.dylib"
|
||||
REGEX ".*_debug\\.dylib" EXCLUDE)
|
||||
|
||||
install(CODE "
|
||||
file(WRITE \"\${CMAKE_INSTALL_PREFIX}/${qtconf_dest_dir}/qt.conf\" \"[Paths]
|
||||
|
@ -170,17 +165,11 @@ IF(WIN32)
|
|||
set(plugin_dest_dir Plugins)
|
||||
set(qtconf_dest_dir .)
|
||||
|
||||
# note: no codecs in qt5
|
||||
# note: phonon_backend => mediaservice
|
||||
# note: needs platform on osx
|
||||
# qt4: codecs, iconengines, imageformats
|
||||
# qt5: iconengines, imageformats, platforms
|
||||
|
||||
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||
install(DIRECTORY "${QT_PLUGINS_DIR}/" DESTINATION ${plugin_dest_dir} COMPONENT Runtime
|
||||
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(DIRECTORY "${QT_PLUGINS_DIR}/" DESTINATION ${plugin_dest_dir} COMPONENT Runtime
|
||||
FILES_MATCHING REGEX "(codecs|iconengines|platforms)/.*[^d]\\.dll")
|
||||
|
||||
install(CODE "
|
||||
file(WRITE \"\${CMAKE_INSTALL_PREFIX}/${qtconf_dest_dir}/qt.conf\" \"[Paths]
|
||||
|
|
|
@ -40,6 +40,9 @@ bool OracleImporter::readSetsFromByteArray(const QByteArray &data)
|
|||
editionLong = map.value("name").toString();
|
||||
editionCards = map.value("cards");
|
||||
setType = map.value("type").toString();
|
||||
// capitalize set type
|
||||
if(setType.length() > 0)
|
||||
setType[0] = setType[0].toUpper();
|
||||
releaseDate = map.value("releaseDate").toDate();
|
||||
|
||||
// core and expansion sets are marked to be imported by default
|
||||
|
@ -236,7 +239,7 @@ int OracleImporter::startImport()
|
|||
const SetToDownload * curSet;
|
||||
|
||||
// add an empty set for tokens
|
||||
CardSet *tokenSet = new CardSet(TOKENS_SETNAME, tr("Dummy set containing tokens"), "tokens");
|
||||
CardSet *tokenSet = new CardSet(TOKENS_SETNAME, tr("Dummy set containing tokens"), "Tokens");
|
||||
sets.insert(TOKENS_SETNAME, tokenSet);
|
||||
|
||||
while (it.hasNext())
|
||||
|
|
|
@ -21,7 +21,7 @@ public:
|
|||
bool getImport() const { return 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())
|
||||
: 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; }
|
||||
};
|
||||
|
||||
|
|
|
@ -139,17 +139,12 @@ if(APPLE)
|
|||
set(plugin_dest_dir servatrice.app/Contents/Plugins)
|
||||
set(qtconf_dest_dir servatrice.app/Contents/Resources)
|
||||
|
||||
# note: no codecs in qt5
|
||||
# note: phonon_backend => mediaservice
|
||||
# note: needs platform on osx
|
||||
# qt4: codecs, sqldrivers
|
||||
# qt5: platforms, sqldrivers
|
||||
|
||||
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||
install(DIRECTORY "${QT_PLUGINS_DIR}/" DESTINATION ${plugin_dest_dir} COMPONENT Runtime
|
||||
FILES_MATCHING REGEX "(sqldrivers|platforms)/.*_debug\\.dylib")
|
||||
else()
|
||||
install(DIRECTORY "${QT_PLUGINS_DIR}/" DESTINATION ${plugin_dest_dir} COMPONENT Runtime
|
||||
FILES_MATCHING REGEX "(sqldrivers|platforms)/[^_]*\\.dylib")
|
||||
endif()
|
||||
install(DIRECTORY "${QT_PLUGINS_DIR}/" DESTINATION ${plugin_dest_dir} COMPONENT Runtime
|
||||
FILES_MATCHING REGEX "(codecs|platforms|sqldrivers)/.*\\.dylib"
|
||||
REGEX ".*_debug\\.dylib" EXCLUDE)
|
||||
|
||||
install(CODE "
|
||||
file(WRITE \"\${CMAKE_INSTALL_PREFIX}/${qtconf_dest_dir}/qt.conf\" \"[Paths]
|
||||
|
@ -171,17 +166,11 @@ if(WIN32)
|
|||
set(plugin_dest_dir Plugins)
|
||||
set(qtconf_dest_dir .)
|
||||
|
||||
# note: no codecs in qt5
|
||||
# note: phonon_backend => mediaservice
|
||||
# note: needs platform on osx
|
||||
# qt4: codecs, sqldrivers
|
||||
# qt5: platforms, sqldrivers
|
||||
|
||||
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||
install(DIRECTORY "${QT_PLUGINS_DIR}/" DESTINATION ${plugin_dest_dir} COMPONENT Runtime
|
||||
FILES_MATCHING REGEX "(sqldrivers|platforms)/.*d\\.dll")
|
||||
else()
|
||||
install(DIRECTORY "${QT_PLUGINS_DIR}/" DESTINATION ${plugin_dest_dir} COMPONENT Runtime
|
||||
FILES_MATCHING REGEX "(sqldrivers|platforms)/.*[^d]\\.dll")
|
||||
endif()
|
||||
install(DIRECTORY "${QT_PLUGINS_DIR}/" DESTINATION ${plugin_dest_dir} COMPONENT Runtime
|
||||
FILES_MATCHING REGEX "(codecs|platforms|sqldrivers)/.*[^d]\\.dll")
|
||||
|
||||
install(CODE "
|
||||
file(WRITE \"\${CMAKE_INSTALL_PREFIX}/${qtconf_dest_dir}/qt.conf\" \"[Paths]
|
||||
|
|
|
@ -108,7 +108,11 @@ void Servatrice_GameServer::incomingConnection(qintptr socketDescriptor)
|
|||
QMetaObject::invokeMethod(ssi, "initConnection", Qt::QueuedConnection, Q_ARG(int, socketDescriptor));
|
||||
}
|
||||
|
||||
#if QT_VERSION < 0x050000
|
||||
void Servatrice_IslServer::incomingConnection(int socketDescriptor)
|
||||
#else
|
||||
void Servatrice_IslServer::incomingConnection(qintptr socketDescriptor)
|
||||
#endif
|
||||
{
|
||||
QThread *thread = new QThread;
|
||||
connect(thread, SIGNAL(finished()), thread, SLOT(deleteLater()));
|
||||
|
|
|
@ -68,7 +68,11 @@ public:
|
|||
Servatrice_IslServer(Servatrice *_server, const QSslCertificate &_cert, const QSslKey &_privateKey, QObject *parent = 0)
|
||||
: QTcpServer(parent), server(_server), cert(_cert), privateKey(_privateKey) { }
|
||||
protected:
|
||||
#if QT_VERSION < 0x050000
|
||||
void incomingConnection(int socketDescriptor);
|
||||
#else
|
||||
void incomingConnection(qintptr socketDescriptor);
|
||||
#endif
|
||||
};
|
||||
|
||||
class ServerProperties {
|
||||
|
|
|
@ -6,7 +6,7 @@ mkdir build
|
|||
cd build
|
||||
prefix=""
|
||||
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
|
||||
cmake .. -DWITH_SERVER=1 -DWITH_QT4=$QT4 $prefix
|
||||
make
|
||||
|
|
Loading…
Reference in a new issue