Ported cockatrice
This commit is contained in:
parent
bab340f7b7
commit
6dbdaafb33
22 changed files with 181 additions and 16 deletions
|
@ -172,6 +172,13 @@ if(Qt5Widgets_FOUND)
|
||||||
list(APPEND COCKATRICE_LIBS Multimedia)
|
list(APPEND COCKATRICE_LIBS Multimedia)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# QtPrinter
|
||||||
|
find_package(Qt5PrintSupport)
|
||||||
|
if(Qt5PrintSupport_FOUND)
|
||||||
|
include_directories(${Qt5PrintSupport_INCLUDE_DIRS})
|
||||||
|
list(APPEND COCKATRICE_LIBS PrintSupport)
|
||||||
|
endif()
|
||||||
|
|
||||||
# QtXml
|
# QtXml
|
||||||
find_package(Qt5Xml)
|
find_package(Qt5Xml)
|
||||||
if(Qt5Xml_FOUND)
|
if(Qt5Xml_FOUND)
|
||||||
|
|
|
@ -11,8 +11,12 @@
|
||||||
AbstractCounter::AbstractCounter(Player *_player, int _id, const QString &_name, bool _shownInCounterArea, int _value, QGraphicsItem *parent)
|
AbstractCounter::AbstractCounter(Player *_player, int _id, const QString &_name, bool _shownInCounterArea, int _value, QGraphicsItem *parent)
|
||||||
: QGraphicsItem(parent), player(_player), id(_id), name(_name), value(_value), hovered(false), aDec(0), aInc(0), dialogSemaphore(false), deleteAfterDialog(false), shownInCounterArea(_shownInCounterArea)
|
: QGraphicsItem(parent), player(_player), id(_id), name(_name), value(_value), hovered(false), aDec(0), aInc(0), dialogSemaphore(false), deleteAfterDialog(false), shownInCounterArea(_shownInCounterArea)
|
||||||
{
|
{
|
||||||
|
#if QT_VERSION < 0x050000
|
||||||
setAcceptsHoverEvents(true);
|
setAcceptsHoverEvents(true);
|
||||||
|
#else
|
||||||
|
setAcceptHoverEvents(true);
|
||||||
|
#endif
|
||||||
|
|
||||||
if (player->getLocal()) {
|
if (player->getLocal()) {
|
||||||
menu = new QMenu(name);
|
menu = new QMenu(name);
|
||||||
aSet = new QAction(this);
|
aSet = new QAction(this);
|
||||||
|
@ -129,7 +133,13 @@ void AbstractCounter::setCounter()
|
||||||
{
|
{
|
||||||
bool ok;
|
bool ok;
|
||||||
dialogSemaphore = true;
|
dialogSemaphore = true;
|
||||||
int newValue = QInputDialog::getInteger(0, tr("Set counter"), tr("New value for counter '%1':").arg(name), value, -2000000000, 2000000000, 1, &ok);
|
int newValue =
|
||||||
|
#if QT_VERSION < 0x050000
|
||||||
|
QInputDialog::getInteger(
|
||||||
|
#else
|
||||||
|
QInputDialog::getInt(
|
||||||
|
#endif
|
||||||
|
0, tr("Set counter"), tr("New value for counter '%1':").arg(name), value, -2000000000, 2000000000, 1, &ok);
|
||||||
if (deleteAfterDialog) {
|
if (deleteAfterDialog) {
|
||||||
deleteLater();
|
deleteLater();
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -68,6 +68,10 @@ QVariant CardDatabaseModel::headerData(int section, Qt::Orientation orientation,
|
||||||
|
|
||||||
void CardDatabaseModel::updateCardList()
|
void CardDatabaseModel::updateCardList()
|
||||||
{
|
{
|
||||||
|
#if QT_VERSION >= 0x050000
|
||||||
|
beginResetModel();
|
||||||
|
#endif
|
||||||
|
|
||||||
for (int i = 0; i < cardList.size(); ++i)
|
for (int i = 0; i < cardList.size(); ++i)
|
||||||
disconnect(cardList[i], 0, this, 0);
|
disconnect(cardList[i], 0, this, 0);
|
||||||
|
|
||||||
|
@ -75,7 +79,11 @@ void CardDatabaseModel::updateCardList()
|
||||||
for (int i = 0; i < cardList.size(); ++i)
|
for (int i = 0; i < cardList.size(); ++i)
|
||||||
connect(cardList[i], SIGNAL(cardInfoChanged(CardInfo *)), this, SLOT(cardInfoChanged(CardInfo *)));
|
connect(cardList[i], SIGNAL(cardInfoChanged(CardInfo *)), this, SLOT(cardInfoChanged(CardInfo *)));
|
||||||
|
|
||||||
|
#if QT_VERSION < 0x050000
|
||||||
reset();
|
reset();
|
||||||
|
#else
|
||||||
|
endResetModel();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void CardDatabaseModel::cardInfoChanged(CardInfo *card)
|
void CardDatabaseModel::cardInfoChanged(CardInfo *card)
|
||||||
|
|
|
@ -30,6 +30,10 @@ DeckListModel::~DeckListModel()
|
||||||
|
|
||||||
void DeckListModel::rebuildTree()
|
void DeckListModel::rebuildTree()
|
||||||
{
|
{
|
||||||
|
#if QT_VERSION >= 0x050000
|
||||||
|
beginResetModel();
|
||||||
|
#endif
|
||||||
|
|
||||||
root->clearTree();
|
root->clearTree();
|
||||||
InnerDecklistNode *listRoot = deckList->getRoot();
|
InnerDecklistNode *listRoot = deckList->getRoot();
|
||||||
for (int i = 0; i < listRoot->size(); i++) {
|
for (int i = 0; i < listRoot->size(); i++) {
|
||||||
|
@ -55,7 +59,11 @@ void DeckListModel::rebuildTree()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if QT_VERSION < 0x050000
|
||||||
reset();
|
reset();
|
||||||
|
#else
|
||||||
|
endResetModel();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int DeckListModel::rowCount(const QModelIndex &parent) const
|
int DeckListModel::rowCount(const QModelIndex &parent) const
|
||||||
|
|
|
@ -48,13 +48,15 @@ void DeckStatsInterface::analyzeDeck(DeckList *deck)
|
||||||
QUrl params;
|
QUrl params;
|
||||||
#if QT_VERSION < 0x050000
|
#if QT_VERSION < 0x050000
|
||||||
params.addQueryItem("deck", deck->writeToString_Plain());
|
params.addQueryItem("deck", deck->writeToString_Plain());
|
||||||
|
QByteArray data;
|
||||||
|
data.append(params.encodedQuery());
|
||||||
#else
|
#else
|
||||||
QUrlQuery urlQuery;
|
QUrlQuery urlQuery;
|
||||||
urlQuery.addQueryItem("deck", deck->writeToString_Plain());
|
urlQuery.addQueryItem("deck", deck->writeToString_Plain());
|
||||||
params.setUrlQuery(urlQuery);
|
params.setQuery(urlQuery);
|
||||||
#endif
|
|
||||||
QByteArray data;
|
QByteArray data;
|
||||||
data.append(params.encodedQuery());
|
data.append(params.query(QUrl::EncodeReserved));
|
||||||
|
#endif
|
||||||
|
|
||||||
QNetworkRequest request(QUrl("http://deckstats.net/index.php"));
|
QNetworkRequest request(QUrl("http://deckstats.net/index.php"));
|
||||||
request.setHeader(QNetworkRequest::ContentTypeHeader, "application/x-www-form-urlencoded");
|
request.setHeader(QNetworkRequest::ContentTypeHeader, "application/x-www-form-urlencoded");
|
||||||
|
|
|
@ -64,7 +64,11 @@ void DeckViewCardDragItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
|
||||||
DeckViewCard::DeckViewCard(const QString &_name, const QString &_originZone, QGraphicsItem *parent)
|
DeckViewCard::DeckViewCard(const QString &_name, const QString &_originZone, QGraphicsItem *parent)
|
||||||
: AbstractCardItem(_name, 0, -1, parent), originZone(_originZone), dragItem(0)
|
: AbstractCardItem(_name, 0, -1, parent), originZone(_originZone), dragItem(0)
|
||||||
{
|
{
|
||||||
|
#if QT_VERSION < 0x050000
|
||||||
setAcceptsHoverEvents(true);
|
setAcceptsHoverEvents(true);
|
||||||
|
#else
|
||||||
|
setAcceptHoverEvents(true);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
DeckViewCard::~DeckViewCard()
|
DeckViewCard::~DeckViewCard()
|
||||||
|
|
|
@ -79,8 +79,13 @@ DlgCreateToken::DlgCreateToken(const QStringList &_predefinedTokens, QWidget *pa
|
||||||
chooseTokenView->header()->setStretchLastSection(false);
|
chooseTokenView->header()->setStretchLastSection(false);
|
||||||
chooseTokenView->header()->hideSection(1);
|
chooseTokenView->header()->hideSection(1);
|
||||||
chooseTokenView->header()->hideSection(2);
|
chooseTokenView->header()->hideSection(2);
|
||||||
|
#if QT_VERSION < 0x050000
|
||||||
chooseTokenView->header()->setResizeMode(3, QHeaderView::ResizeToContents);
|
chooseTokenView->header()->setResizeMode(3, QHeaderView::ResizeToContents);
|
||||||
chooseTokenView->header()->setResizeMode(4, QHeaderView::ResizeToContents);
|
chooseTokenView->header()->setResizeMode(4, QHeaderView::ResizeToContents);
|
||||||
|
#else
|
||||||
|
chooseTokenView->header()->setSectionResizeMode(3, QHeaderView::ResizeToContents);
|
||||||
|
chooseTokenView->header()->setSectionResizeMode(4, QHeaderView::ResizeToContents);
|
||||||
|
#endif
|
||||||
connect(chooseTokenView->selectionModel(), SIGNAL(currentRowChanged(QModelIndex, QModelIndex)), this, SLOT(tokenSelectionChanged(QModelIndex, QModelIndex)));
|
connect(chooseTokenView->selectionModel(), SIGNAL(currentRowChanged(QModelIndex, QModelIndex)), this, SLOT(tokenSelectionChanged(QModelIndex, QModelIndex)));
|
||||||
|
|
||||||
if (predefinedTokens.isEmpty())
|
if (predefinedTokens.isEmpty())
|
||||||
|
|
|
@ -73,8 +73,13 @@ DlgEditTokens::DlgEditTokens(CardDatabaseModel *_cardDatabaseModel, QWidget *par
|
||||||
chooseTokenView->header()->setStretchLastSection(false);
|
chooseTokenView->header()->setStretchLastSection(false);
|
||||||
chooseTokenView->header()->hideSection(1);
|
chooseTokenView->header()->hideSection(1);
|
||||||
chooseTokenView->header()->hideSection(2);
|
chooseTokenView->header()->hideSection(2);
|
||||||
|
#if QT_VERSION < 0x050000
|
||||||
chooseTokenView->header()->setResizeMode(3, QHeaderView::ResizeToContents);
|
chooseTokenView->header()->setResizeMode(3, QHeaderView::ResizeToContents);
|
||||||
chooseTokenView->header()->setResizeMode(4, QHeaderView::ResizeToContents);
|
chooseTokenView->header()->setResizeMode(4, QHeaderView::ResizeToContents);
|
||||||
|
#else
|
||||||
|
chooseTokenView->header()->setSectionResizeMode(3, QHeaderView::ResizeToContents);
|
||||||
|
chooseTokenView->header()->setSectionResizeMode(4, QHeaderView::ResizeToContents);
|
||||||
|
#endif
|
||||||
connect(chooseTokenView->selectionModel(), SIGNAL(currentRowChanged(QModelIndex, QModelIndex)), this, SLOT(tokenSelectionChanged(QModelIndex, QModelIndex)));
|
connect(chooseTokenView->selectionModel(), SIGNAL(currentRowChanged(QModelIndex, QModelIndex)), this, SLOT(tokenSelectionChanged(QModelIndex, QModelIndex)));
|
||||||
|
|
||||||
QAction *aAddToken = new QAction(tr("Add token"), this);
|
QAction *aAddToken = new QAction(tr("Add token"), this);
|
||||||
|
|
|
@ -33,8 +33,11 @@ GameSelector::GameSelector(AbstractClient *_client, const TabSupervisor *_tabSup
|
||||||
gameListView->header()->hideSection(1);
|
gameListView->header()->hideSection(1);
|
||||||
else
|
else
|
||||||
gameListProxyModel->setUnavailableGamesVisible(true);
|
gameListProxyModel->setUnavailableGamesVisible(true);
|
||||||
|
#if QT_VERSION < 0x050000
|
||||||
gameListView->header()->setResizeMode(1, QHeaderView::ResizeToContents);
|
gameListView->header()->setResizeMode(1, QHeaderView::ResizeToContents);
|
||||||
|
#else
|
||||||
|
gameListView->header()->setSectionResizeMode(1, QHeaderView::ResizeToContents);
|
||||||
|
#endif
|
||||||
filterButton = new QPushButton;
|
filterButton = new QPushButton;
|
||||||
filterButton->setIcon(QIcon(":/resources/icon_search.svg"));
|
filterButton->setIcon(QIcon(":/resources/icon_search.svg"));
|
||||||
connect(filterButton, SIGNAL(clicked()), this, SLOT(actSetFilter()));
|
connect(filterButton, SIGNAL(clicked()), this, SLOT(actSetFilter()));
|
||||||
|
|
|
@ -55,6 +55,7 @@ QString translationPath = TRANSLATION_PATH;
|
||||||
QString translationPath = QString();
|
QString translationPath = QString();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if QT_VERSION < 0x050000
|
||||||
void myMessageOutput(QtMsgType /*type*/, const char *msg)
|
void myMessageOutput(QtMsgType /*type*/, const char *msg)
|
||||||
{
|
{
|
||||||
QFile file("qdebug.txt");
|
QFile file("qdebug.txt");
|
||||||
|
@ -63,6 +64,16 @@ void myMessageOutput(QtMsgType /*type*/, const char *msg)
|
||||||
out << msg << endl;
|
out << msg << endl;
|
||||||
file.close();
|
file.close();
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
void myMessageOutput(QtMsgType /*type*/, const QMessageLogContext &, const QString &msg)
|
||||||
|
{
|
||||||
|
QFile file("qdebug.txt");
|
||||||
|
file.open(QIODevice::WriteOnly | QIODevice::Truncate | QIODevice::Text);
|
||||||
|
QTextStream out(&file);
|
||||||
|
out << msg << endl;
|
||||||
|
file.close();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void installNewTranslator()
|
void installNewTranslator()
|
||||||
{
|
{
|
||||||
|
@ -87,7 +98,13 @@ int main(int argc, char *argv[])
|
||||||
QApplication app(argc, argv);
|
QApplication app(argc, argv);
|
||||||
|
|
||||||
if (app.arguments().contains("--debug-output"))
|
if (app.arguments().contains("--debug-output"))
|
||||||
|
{
|
||||||
|
#if QT_VERSION < 0x050000
|
||||||
qInstallMsgHandler(myMessageOutput);
|
qInstallMsgHandler(myMessageOutput);
|
||||||
|
#else
|
||||||
|
qInstallMessageHandler(myMessageOutput);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
#ifdef Q_OS_MAC
|
#ifdef Q_OS_MAC
|
||||||
QDir baseDir(app.applicationDirPath());
|
QDir baseDir(app.applicationDirPath());
|
||||||
baseDir.cdUp();
|
baseDir.cdUp();
|
||||||
|
@ -100,7 +117,11 @@ int main(int argc, char *argv[])
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
app.addLibraryPath(app.applicationDirPath() + "/plugins");
|
app.addLibraryPath(app.applicationDirPath() + "/plugins");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if QT_VERSION < 0x050000
|
||||||
|
// gone in Qt5, all source files _MUST_ be utf8-encoded
|
||||||
QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8"));
|
QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8"));
|
||||||
|
#endif
|
||||||
|
|
||||||
QCoreApplication::setOrganizationName("Cockatrice");
|
QCoreApplication::setOrganizationName("Cockatrice");
|
||||||
QCoreApplication::setOrganizationDomain("cockatrice.de");
|
QCoreApplication::setOrganizationDomain("cockatrice.de");
|
||||||
|
@ -131,7 +152,7 @@ int main(int argc, char *argv[])
|
||||||
#if QT_VERSION < 0x050000
|
#if QT_VERSION < 0x050000
|
||||||
const QString dataDir = QDesktopServices::storageLocation(QDesktopServices::DataLocation);
|
const QString dataDir = QDesktopServices::storageLocation(QDesktopServices::DataLocation);
|
||||||
#else
|
#else
|
||||||
const QString dataDir = QStandardPaths::standardLocations(QStandardPaths::DataLocation)).toString();
|
const QString dataDir = QStandardPaths::standardLocations(QStandardPaths::DataLocation).first();
|
||||||
#endif
|
#endif
|
||||||
if (!db->getLoadSuccess())
|
if (!db->getLoadSuccess())
|
||||||
if (db->loadCardDatabase(dataDir + "/cards.xml"))
|
if (db->loadCardDatabase(dataDir + "/cards.xml"))
|
||||||
|
|
|
@ -13,7 +13,11 @@ PileZone::PileZone(Player *_p, const QString &_name, bool _isShufflable, bool _c
|
||||||
: CardZone(_p, _name, false, _isShufflable, _contentsKnown, parent)
|
: CardZone(_p, _name, false, _isShufflable, _contentsKnown, parent)
|
||||||
{
|
{
|
||||||
setCacheMode(DeviceCoordinateCache); // Do not move this line to the parent constructor!
|
setCacheMode(DeviceCoordinateCache); // Do not move this line to the parent constructor!
|
||||||
|
#if QT_VERSION < 0x050000
|
||||||
setAcceptsHoverEvents(true);
|
setAcceptsHoverEvents(true);
|
||||||
|
#else
|
||||||
|
setAcceptHoverEvents(true);
|
||||||
|
#endif
|
||||||
setCursor(Qt::OpenHandCursor);
|
setCursor(Qt::OpenHandCursor);
|
||||||
|
|
||||||
setTransform(QTransform().translate((float) CARD_WIDTH / 2, (float) CARD_HEIGHT / 2).rotate(90).translate((float) -CARD_WIDTH / 2, (float) -CARD_HEIGHT / 2));
|
setTransform(QTransform().translate((float) CARD_WIDTH / 2, (float) CARD_HEIGHT / 2).rotate(90).translate((float) -CARD_WIDTH / 2, (float) -CARD_HEIGHT / 2));
|
||||||
|
|
|
@ -774,7 +774,13 @@ void Player::actViewLibrary()
|
||||||
void Player::actViewTopCards()
|
void Player::actViewTopCards()
|
||||||
{
|
{
|
||||||
bool ok;
|
bool ok;
|
||||||
int number = QInputDialog::getInteger(0, tr("View top cards of library"), tr("Number of cards:"), defaultNumberTopCards, 1, 2000000000, 1, &ok);
|
int number =
|
||||||
|
#if QT_VERSION < 0x050000
|
||||||
|
QInputDialog::getInteger(
|
||||||
|
#else
|
||||||
|
QInputDialog::getInt(
|
||||||
|
#endif
|
||||||
|
0, tr("View top cards of library"), tr("Number of cards:"), defaultNumberTopCards, 1, 2000000000, 1, &ok);
|
||||||
if (ok) {
|
if (ok) {
|
||||||
defaultNumberTopCards = number;
|
defaultNumberTopCards = number;
|
||||||
static_cast<GameScene *>(scene())->toggleZoneView(this, "deck", number);
|
static_cast<GameScene *>(scene())->toggleZoneView(this, "deck", number);
|
||||||
|
@ -829,7 +835,13 @@ void Player::actMulligan()
|
||||||
|
|
||||||
void Player::actDrawCards()
|
void Player::actDrawCards()
|
||||||
{
|
{
|
||||||
int number = QInputDialog::getInteger(0, tr("Draw cards"), tr("Number:"));
|
int number =
|
||||||
|
#if QT_VERSION < 0x050000
|
||||||
|
QInputDialog::getInteger(
|
||||||
|
#else
|
||||||
|
QInputDialog::getInt(
|
||||||
|
#endif
|
||||||
|
0, tr("Draw cards"), tr("Number:"));
|
||||||
if (number) {
|
if (number) {
|
||||||
Command_DrawCards cmd;
|
Command_DrawCards cmd;
|
||||||
cmd.set_number(number);
|
cmd.set_number(number);
|
||||||
|
@ -844,8 +856,14 @@ void Player::actUndoDraw()
|
||||||
|
|
||||||
void Player::actMoveTopCardsToGrave()
|
void Player::actMoveTopCardsToGrave()
|
||||||
{
|
{
|
||||||
int number = QInputDialog::getInteger(0, tr("Move top cards to grave"), tr("Number:"));
|
int number =
|
||||||
if (!number)
|
#if QT_VERSION < 0x050000
|
||||||
|
QInputDialog::getInteger(
|
||||||
|
#else
|
||||||
|
QInputDialog::getInt(
|
||||||
|
#endif
|
||||||
|
0, tr("Move top cards to grave"), tr("Number:"));
|
||||||
|
if (!number)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const int maxCards = zones.value("deck")->getCards().size();
|
const int maxCards = zones.value("deck")->getCards().size();
|
||||||
|
@ -867,8 +885,14 @@ void Player::actMoveTopCardsToGrave()
|
||||||
|
|
||||||
void Player::actMoveTopCardsToExile()
|
void Player::actMoveTopCardsToExile()
|
||||||
{
|
{
|
||||||
int number = QInputDialog::getInteger(0, tr("Move top cards to exile"), tr("Number:"));
|
int number =
|
||||||
if (!number)
|
#if QT_VERSION < 0x050000
|
||||||
|
QInputDialog::getInteger(
|
||||||
|
#else
|
||||||
|
QInputDialog::getInt(
|
||||||
|
#endif
|
||||||
|
0, tr("Move top cards to exile"), tr("Number:"));
|
||||||
|
if (!number)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const int maxCards = zones.value("deck")->getCards().size();
|
const int maxCards = zones.value("deck")->getCards().size();
|
||||||
|
@ -914,7 +938,13 @@ void Player::actUntapAll()
|
||||||
void Player::actRollDie()
|
void Player::actRollDie()
|
||||||
{
|
{
|
||||||
bool ok;
|
bool ok;
|
||||||
int sides = QInputDialog::getInteger(0, tr("Roll die"), tr("Number of sides:"), 20, 2, 1000, 1, &ok);
|
int sides =
|
||||||
|
#if QT_VERSION < 0x050000
|
||||||
|
QInputDialog::getInteger(
|
||||||
|
#else
|
||||||
|
QInputDialog::getInt(
|
||||||
|
#endif
|
||||||
|
0, tr("Roll die"), tr("Number of sides:"), 20, 2, 1000, 1, &ok);
|
||||||
if (ok) {
|
if (ok) {
|
||||||
Command_RollDie cmd;
|
Command_RollDie cmd;
|
||||||
cmd.set_sides(sides);
|
cmd.set_sides(sides);
|
||||||
|
@ -2022,7 +2052,13 @@ void Player::actCardCounterTrigger()
|
||||||
case 11: {
|
case 11: {
|
||||||
bool ok;
|
bool ok;
|
||||||
dialogSemaphore = true;
|
dialogSemaphore = true;
|
||||||
int number = QInputDialog::getInteger(0, tr("Set counters"), tr("Number:"), 0, 0, MAX_COUNTERS_ON_CARD, 1, &ok);
|
int number =
|
||||||
|
#if QT_VERSION < 0x050000
|
||||||
|
QInputDialog::getInteger(
|
||||||
|
#else
|
||||||
|
QInputDialog::getInt(
|
||||||
|
#endif
|
||||||
|
0, tr("Set counters"), tr("Number:"), 0, 0, MAX_COUNTERS_ON_CARD, 1, &ok);
|
||||||
dialogSemaphore = false;
|
dialogSemaphore = false;
|
||||||
if (clearCardsToDelete())
|
if (clearCardsToDelete())
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -72,7 +72,11 @@ PlayerListWidget::PlayerListWidget(TabSupervisor *_tabSupervisor, AbstractClient
|
||||||
setColumnCount(6);
|
setColumnCount(6);
|
||||||
setHeaderHidden(true);
|
setHeaderHidden(true);
|
||||||
setRootIsDecorated(false);
|
setRootIsDecorated(false);
|
||||||
|
#if QT_VERSION < 0x050000
|
||||||
header()->setResizeMode(QHeaderView::ResizeToContents);
|
header()->setResizeMode(QHeaderView::ResizeToContents);
|
||||||
|
#else
|
||||||
|
header()->setSectionResizeMode(QHeaderView::ResizeToContents);
|
||||||
|
#endif
|
||||||
retranslateUi();
|
retranslateUi();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -258,8 +258,17 @@ void RemoteDeckList_TreeModel::deckListFinished(const Response &r)
|
||||||
{
|
{
|
||||||
const Response_DeckList &resp = r.GetExtension(Response_DeckList::ext);
|
const Response_DeckList &resp = r.GetExtension(Response_DeckList::ext);
|
||||||
|
|
||||||
|
#if QT_VERSION >= 0x050000
|
||||||
|
beginResetModel();
|
||||||
|
#endif
|
||||||
|
|
||||||
root->clearTree();
|
root->clearTree();
|
||||||
|
|
||||||
|
#if QT_VERSION < 0x050000
|
||||||
reset();
|
reset();
|
||||||
|
#else
|
||||||
|
endResetModel();
|
||||||
|
#endif
|
||||||
|
|
||||||
ServerInfo_DeckStorage_TreeItem tempRoot;
|
ServerInfo_DeckStorage_TreeItem tempRoot;
|
||||||
tempRoot.set_id(0);
|
tempRoot.set_id(0);
|
||||||
|
@ -280,7 +289,11 @@ RemoteDeckList_TreeWidget::RemoteDeckList_TreeWidget(AbstractClient *_client, QW
|
||||||
setModel(proxyModel);
|
setModel(proxyModel);
|
||||||
connect(treeModel, SIGNAL(treeRefreshed()), this, SLOT(expandAll()));
|
connect(treeModel, SIGNAL(treeRefreshed()), this, SLOT(expandAll()));
|
||||||
|
|
||||||
|
#if QT_VERSION < 0x050000
|
||||||
header()->setResizeMode(QHeaderView::ResizeToContents);
|
header()->setResizeMode(QHeaderView::ResizeToContents);
|
||||||
|
#else
|
||||||
|
header()->setSectionResizeMode(QHeaderView::ResizeToContents);
|
||||||
|
#endif
|
||||||
setUniformRowHeights(true);
|
setUniformRowHeights(true);
|
||||||
setSortingEnabled(true);
|
setSortingEnabled(true);
|
||||||
proxyModel->sort(0, Qt::AscendingOrder);
|
proxyModel->sort(0, Qt::AscendingOrder);
|
||||||
|
|
|
@ -278,7 +278,11 @@ RemoteReplayList_TreeWidget::RemoteReplayList_TreeWidget(AbstractClient *_client
|
||||||
proxyModel->setSortCaseSensitivity(Qt::CaseInsensitive);
|
proxyModel->setSortCaseSensitivity(Qt::CaseInsensitive);
|
||||||
setModel(proxyModel);
|
setModel(proxyModel);
|
||||||
|
|
||||||
|
#if QT_VERSION < 0x050000
|
||||||
header()->setResizeMode(QHeaderView::ResizeToContents);
|
header()->setResizeMode(QHeaderView::ResizeToContents);
|
||||||
|
#else
|
||||||
|
header()->setSectionResizeMode(QHeaderView::ResizeToContents);
|
||||||
|
#endif
|
||||||
header()->setStretchLastSection(false);
|
header()->setStretchLastSection(false);
|
||||||
setUniformRowHeights(true);
|
setUniformRowHeights(true);
|
||||||
setSortingEnabled(true);
|
setSortingEnabled(true);
|
||||||
|
|
|
@ -33,8 +33,13 @@ void SoundEngine::soundEnabledChanged()
|
||||||
if (settingsCache->getSoundEnabled()) {
|
if (settingsCache->getSoundEnabled()) {
|
||||||
qDebug("SoundEngine: enabling sound");
|
qDebug("SoundEngine: enabling sound");
|
||||||
QAudioFormat format;
|
QAudioFormat format;
|
||||||
|
#if QT_VERSION < 0x050000
|
||||||
format.setFrequency(44100);
|
format.setFrequency(44100);
|
||||||
format.setChannels(1);
|
format.setChannels(1);
|
||||||
|
#else
|
||||||
|
format.setSampleRate(44100);
|
||||||
|
format.setChannelCount(1);
|
||||||
|
#endif
|
||||||
format.setSampleSize(16);
|
format.setSampleSize(16);
|
||||||
format.setCodec("audio/pcm");
|
format.setCodec("audio/pcm");
|
||||||
format.setByteOrder(QAudioFormat::LittleEndian);
|
format.setByteOrder(QAudioFormat::LittleEndian);
|
||||||
|
|
|
@ -134,7 +134,11 @@ TabDeckEditor::TabDeckEditor(TabSupervisor *_tabSupervisor, QWidget *parent)
|
||||||
deckView->setUniformRowHeights(true);
|
deckView->setUniformRowHeights(true);
|
||||||
deckView->setSortingEnabled(true);
|
deckView->setSortingEnabled(true);
|
||||||
deckView->sortByColumn(1, Qt::AscendingOrder);
|
deckView->sortByColumn(1, Qt::AscendingOrder);
|
||||||
|
#if QT_VERSION < 0x050000
|
||||||
deckView->header()->setResizeMode(QHeaderView::ResizeToContents);
|
deckView->header()->setResizeMode(QHeaderView::ResizeToContents);
|
||||||
|
#else
|
||||||
|
deckView->header()->setSectionResizeMode(QHeaderView::ResizeToContents);
|
||||||
|
#endif
|
||||||
deckView->installEventFilter(&deckViewKeySignals);
|
deckView->installEventFilter(&deckViewKeySignals);
|
||||||
connect(deckView->selectionModel(), SIGNAL(currentRowChanged(const QModelIndex &, const QModelIndex &)), this, SLOT(updateCardInfoRight(const QModelIndex &, const QModelIndex &)));
|
connect(deckView->selectionModel(), SIGNAL(currentRowChanged(const QModelIndex &, const QModelIndex &)), this, SLOT(updateCardInfoRight(const QModelIndex &, const QModelIndex &)));
|
||||||
connect(&deckViewKeySignals, SIGNAL(onEnter()), this, SLOT(actIncrement()));
|
connect(&deckViewKeySignals, SIGNAL(onEnter()), this, SLOT(actIncrement()));
|
||||||
|
|
|
@ -38,7 +38,11 @@ TabDeckStorage::TabDeckStorage(TabSupervisor *_tabSupervisor, AbstractClient *_c
|
||||||
localDirView->setColumnHidden(1, true);
|
localDirView->setColumnHidden(1, true);
|
||||||
localDirView->setRootIndex(localDirModel->index(localDirModel->rootPath(), 0));
|
localDirView->setRootIndex(localDirModel->index(localDirModel->rootPath(), 0));
|
||||||
localDirView->setSortingEnabled(true);
|
localDirView->setSortingEnabled(true);
|
||||||
|
#if QT_VERSION < 0x050000
|
||||||
localDirView->header()->setResizeMode(QHeaderView::ResizeToContents);
|
localDirView->header()->setResizeMode(QHeaderView::ResizeToContents);
|
||||||
|
#else
|
||||||
|
localDirView->header()->setSectionResizeMode(QHeaderView::ResizeToContents);
|
||||||
|
#endif
|
||||||
localDirView->header()->setSortIndicator(0, Qt::AscendingOrder);
|
localDirView->header()->setSortIndicator(0, Qt::AscendingOrder);
|
||||||
|
|
||||||
leftToolBar = new QToolBar;
|
leftToolBar = new QToolBar;
|
||||||
|
|
|
@ -36,7 +36,11 @@ TabReplays::TabReplays(TabSupervisor *_tabSupervisor, AbstractClient *_client)
|
||||||
localDirView->setColumnHidden(1, true);
|
localDirView->setColumnHidden(1, true);
|
||||||
localDirView->setRootIndex(localDirModel->index(localDirModel->rootPath(), 0));
|
localDirView->setRootIndex(localDirModel->index(localDirModel->rootPath(), 0));
|
||||||
localDirView->setSortingEnabled(true);
|
localDirView->setSortingEnabled(true);
|
||||||
|
#if QT_VERSION < 0x050000
|
||||||
localDirView->header()->setResizeMode(QHeaderView::ResizeToContents);
|
localDirView->header()->setResizeMode(QHeaderView::ResizeToContents);
|
||||||
|
#else
|
||||||
|
localDirView->header()->setSectionResizeMode(QHeaderView::ResizeToContents);
|
||||||
|
#endif
|
||||||
localDirView->header()->setSortIndicator(0, Qt::AscendingOrder);
|
localDirView->header()->setSortIndicator(0, Qt::AscendingOrder);
|
||||||
|
|
||||||
leftToolBar = new QToolBar;
|
leftToolBar = new QToolBar;
|
||||||
|
|
|
@ -28,11 +28,17 @@ RoomSelector::RoomSelector(AbstractClient *_client, QWidget *parent)
|
||||||
roomList->setRootIsDecorated(false);
|
roomList->setRootIsDecorated(false);
|
||||||
roomList->setColumnCount(4);
|
roomList->setColumnCount(4);
|
||||||
roomList->header()->setStretchLastSection(false);
|
roomList->header()->setStretchLastSection(false);
|
||||||
|
#if QT_VERSION < 0x050000
|
||||||
roomList->header()->setResizeMode(0, QHeaderView::ResizeToContents);
|
roomList->header()->setResizeMode(0, QHeaderView::ResizeToContents);
|
||||||
roomList->header()->setResizeMode(1, QHeaderView::Stretch);
|
roomList->header()->setResizeMode(1, QHeaderView::Stretch);
|
||||||
roomList->header()->setResizeMode(2, QHeaderView::ResizeToContents);
|
roomList->header()->setResizeMode(2, QHeaderView::ResizeToContents);
|
||||||
roomList->header()->setResizeMode(3, QHeaderView::ResizeToContents);
|
roomList->header()->setResizeMode(3, QHeaderView::ResizeToContents);
|
||||||
|
#else
|
||||||
|
roomList->header()->setSectionResizeMode(0, QHeaderView::ResizeToContents);
|
||||||
|
roomList->header()->setSectionResizeMode(1, QHeaderView::Stretch);
|
||||||
|
roomList->header()->setSectionResizeMode(2, QHeaderView::ResizeToContents);
|
||||||
|
roomList->header()->setSectionResizeMode(3, QHeaderView::ResizeToContents);
|
||||||
|
#endif
|
||||||
joinButton = new QPushButton;
|
joinButton = new QPushButton;
|
||||||
connect(joinButton, SIGNAL(clicked()), this, SLOT(joinClicked()));
|
connect(joinButton, SIGNAL(clicked()), this, SLOT(joinClicked()));
|
||||||
QHBoxLayout *buttonLayout = new QHBoxLayout;
|
QHBoxLayout *buttonLayout = new QHBoxLayout;
|
||||||
|
|
|
@ -28,7 +28,11 @@ TableZone::TableZone(Player *_p, QGraphicsItem *parent)
|
||||||
currentMinimumWidth = minWidth;
|
currentMinimumWidth = minWidth;
|
||||||
|
|
||||||
setCacheMode(DeviceCoordinateCache);
|
setCacheMode(DeviceCoordinateCache);
|
||||||
|
#if QT_VERSION < 0x050000
|
||||||
setAcceptsHoverEvents(true);
|
setAcceptsHoverEvents(true);
|
||||||
|
#else
|
||||||
|
setAcceptHoverEvents(true);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void TableZone::updateBgPixmap()
|
void TableZone::updateBgPixmap()
|
||||||
|
|
|
@ -216,7 +216,11 @@ UserList::UserList(TabSupervisor *_tabSupervisor, AbstractClient *_client, UserL
|
||||||
|
|
||||||
userTree = new QTreeWidget;
|
userTree = new QTreeWidget;
|
||||||
userTree->setColumnCount(3);
|
userTree->setColumnCount(3);
|
||||||
|
#if QT_VERSION < 0x050000
|
||||||
userTree->header()->setResizeMode(QHeaderView::ResizeToContents);
|
userTree->header()->setResizeMode(QHeaderView::ResizeToContents);
|
||||||
|
#else
|
||||||
|
userTree->header()->setSectionResizeMode(QHeaderView::ResizeToContents);
|
||||||
|
#endif
|
||||||
userTree->setHeaderHidden(true);
|
userTree->setHeaderHidden(true);
|
||||||
userTree->setRootIsDecorated(false);
|
userTree->setRootIsDecorated(false);
|
||||||
userTree->setIconSize(QSize(20, 12));
|
userTree->setIconSize(QSize(20, 12));
|
||||||
|
|
Loading…
Reference in a new issue