From 6dbdaafb332aa1cde577ece46bb554cb0ac28c6b Mon Sep 17 00:00:00 2001 From: Fabio Bas Date: Tue, 24 Jun 2014 19:13:47 +0200 Subject: [PATCH] Ported cockatrice --- cockatrice/CMakeLists.txt | 7 +++ cockatrice/src/abstractcounter.cpp | 14 ++++- cockatrice/src/carddatabasemodel.cpp | 8 +++ cockatrice/src/decklistmodel.cpp | 8 +++ cockatrice/src/deckstats_interface.cpp | 8 +-- cockatrice/src/deckview.cpp | 4 ++ cockatrice/src/dlg_create_token.cpp | 5 ++ cockatrice/src/dlg_edit_tokens.cpp | 5 ++ cockatrice/src/gameselector.cpp | 5 +- cockatrice/src/main.cpp | 23 +++++++- cockatrice/src/pilezone.cpp | 4 ++ cockatrice/src/player.cpp | 52 ++++++++++++++++--- cockatrice/src/playerlistwidget.cpp | 4 ++ cockatrice/src/remotedecklist_treewidget.cpp | 13 +++++ .../src/remotereplaylist_treewidget.cpp | 4 ++ cockatrice/src/soundengine.cpp | 5 ++ cockatrice/src/tab_deck_editor.cpp | 4 ++ cockatrice/src/tab_deck_storage.cpp | 4 ++ cockatrice/src/tab_replays.cpp | 4 ++ cockatrice/src/tab_server.cpp | 8 ++- cockatrice/src/tablezone.cpp | 4 ++ cockatrice/src/userlist.cpp | 4 ++ 22 files changed, 181 insertions(+), 16 deletions(-) diff --git a/cockatrice/CMakeLists.txt b/cockatrice/CMakeLists.txt index 8edbf602..e02f9e2c 100644 --- a/cockatrice/CMakeLists.txt +++ b/cockatrice/CMakeLists.txt @@ -172,6 +172,13 @@ if(Qt5Widgets_FOUND) list(APPEND COCKATRICE_LIBS Multimedia) endif() + # QtPrinter + find_package(Qt5PrintSupport) + if(Qt5PrintSupport_FOUND) + include_directories(${Qt5PrintSupport_INCLUDE_DIRS}) + list(APPEND COCKATRICE_LIBS PrintSupport) + endif() + # QtXml find_package(Qt5Xml) if(Qt5Xml_FOUND) diff --git a/cockatrice/src/abstractcounter.cpp b/cockatrice/src/abstractcounter.cpp index 73fc9466..b9debae4 100644 --- a/cockatrice/src/abstractcounter.cpp +++ b/cockatrice/src/abstractcounter.cpp @@ -11,8 +11,12 @@ 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) { +#if QT_VERSION < 0x050000 setAcceptsHoverEvents(true); - +#else + setAcceptHoverEvents(true); +#endif + if (player->getLocal()) { menu = new QMenu(name); aSet = new QAction(this); @@ -129,7 +133,13 @@ void AbstractCounter::setCounter() { bool ok; 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) { deleteLater(); return; diff --git a/cockatrice/src/carddatabasemodel.cpp b/cockatrice/src/carddatabasemodel.cpp index e62664be..65b08d49 100644 --- a/cockatrice/src/carddatabasemodel.cpp +++ b/cockatrice/src/carddatabasemodel.cpp @@ -68,6 +68,10 @@ QVariant CardDatabaseModel::headerData(int section, Qt::Orientation orientation, void CardDatabaseModel::updateCardList() { +#if QT_VERSION >= 0x050000 + beginResetModel(); +#endif + for (int i = 0; i < cardList.size(); ++i) disconnect(cardList[i], 0, this, 0); @@ -75,7 +79,11 @@ void CardDatabaseModel::updateCardList() for (int i = 0; i < cardList.size(); ++i) connect(cardList[i], SIGNAL(cardInfoChanged(CardInfo *)), this, SLOT(cardInfoChanged(CardInfo *))); +#if QT_VERSION < 0x050000 reset(); +#else + endResetModel(); +#endif } void CardDatabaseModel::cardInfoChanged(CardInfo *card) diff --git a/cockatrice/src/decklistmodel.cpp b/cockatrice/src/decklistmodel.cpp index 00d92fae..8a1065f0 100644 --- a/cockatrice/src/decklistmodel.cpp +++ b/cockatrice/src/decklistmodel.cpp @@ -30,6 +30,10 @@ DeckListModel::~DeckListModel() void DeckListModel::rebuildTree() { +#if QT_VERSION >= 0x050000 + beginResetModel(); +#endif + root->clearTree(); InnerDecklistNode *listRoot = deckList->getRoot(); for (int i = 0; i < listRoot->size(); i++) { @@ -55,7 +59,11 @@ void DeckListModel::rebuildTree() } } +#if QT_VERSION < 0x050000 reset(); +#else + endResetModel(); +#endif } int DeckListModel::rowCount(const QModelIndex &parent) const diff --git a/cockatrice/src/deckstats_interface.cpp b/cockatrice/src/deckstats_interface.cpp index d5cb4ba0..4eb62d20 100644 --- a/cockatrice/src/deckstats_interface.cpp +++ b/cockatrice/src/deckstats_interface.cpp @@ -48,13 +48,15 @@ void DeckStatsInterface::analyzeDeck(DeckList *deck) QUrl params; #if QT_VERSION < 0x050000 params.addQueryItem("deck", deck->writeToString_Plain()); + QByteArray data; + data.append(params.encodedQuery()); #else QUrlQuery urlQuery; urlQuery.addQueryItem("deck", deck->writeToString_Plain()); - params.setUrlQuery(urlQuery); -#endif + params.setQuery(urlQuery); QByteArray data; - data.append(params.encodedQuery()); + data.append(params.query(QUrl::EncodeReserved)); +#endif QNetworkRequest request(QUrl("http://deckstats.net/index.php")); request.setHeader(QNetworkRequest::ContentTypeHeader, "application/x-www-form-urlencoded"); diff --git a/cockatrice/src/deckview.cpp b/cockatrice/src/deckview.cpp index 1746c58b..5a14ec3f 100644 --- a/cockatrice/src/deckview.cpp +++ b/cockatrice/src/deckview.cpp @@ -64,7 +64,11 @@ void DeckViewCardDragItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) DeckViewCard::DeckViewCard(const QString &_name, const QString &_originZone, QGraphicsItem *parent) : AbstractCardItem(_name, 0, -1, parent), originZone(_originZone), dragItem(0) { +#if QT_VERSION < 0x050000 setAcceptsHoverEvents(true); +#else + setAcceptHoverEvents(true); +#endif } DeckViewCard::~DeckViewCard() diff --git a/cockatrice/src/dlg_create_token.cpp b/cockatrice/src/dlg_create_token.cpp index 942fdda6..9775ed0c 100644 --- a/cockatrice/src/dlg_create_token.cpp +++ b/cockatrice/src/dlg_create_token.cpp @@ -79,8 +79,13 @@ DlgCreateToken::DlgCreateToken(const QStringList &_predefinedTokens, QWidget *pa chooseTokenView->header()->setStretchLastSection(false); chooseTokenView->header()->hideSection(1); chooseTokenView->header()->hideSection(2); +#if QT_VERSION < 0x050000 chooseTokenView->header()->setResizeMode(3, 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))); if (predefinedTokens.isEmpty()) diff --git a/cockatrice/src/dlg_edit_tokens.cpp b/cockatrice/src/dlg_edit_tokens.cpp index 038b1a4a..28fefa7d 100644 --- a/cockatrice/src/dlg_edit_tokens.cpp +++ b/cockatrice/src/dlg_edit_tokens.cpp @@ -73,8 +73,13 @@ DlgEditTokens::DlgEditTokens(CardDatabaseModel *_cardDatabaseModel, QWidget *par chooseTokenView->header()->setStretchLastSection(false); chooseTokenView->header()->hideSection(1); chooseTokenView->header()->hideSection(2); +#if QT_VERSION < 0x050000 chooseTokenView->header()->setResizeMode(3, 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))); QAction *aAddToken = new QAction(tr("Add token"), this); diff --git a/cockatrice/src/gameselector.cpp b/cockatrice/src/gameselector.cpp index 6a05d905..02fb323e 100644 --- a/cockatrice/src/gameselector.cpp +++ b/cockatrice/src/gameselector.cpp @@ -33,8 +33,11 @@ GameSelector::GameSelector(AbstractClient *_client, const TabSupervisor *_tabSup gameListView->header()->hideSection(1); else gameListProxyModel->setUnavailableGamesVisible(true); +#if QT_VERSION < 0x050000 gameListView->header()->setResizeMode(1, QHeaderView::ResizeToContents); - +#else + gameListView->header()->setSectionResizeMode(1, QHeaderView::ResizeToContents); +#endif filterButton = new QPushButton; filterButton->setIcon(QIcon(":/resources/icon_search.svg")); connect(filterButton, SIGNAL(clicked()), this, SLOT(actSetFilter())); diff --git a/cockatrice/src/main.cpp b/cockatrice/src/main.cpp index 23ca8c7a..c47eb7bc 100644 --- a/cockatrice/src/main.cpp +++ b/cockatrice/src/main.cpp @@ -55,6 +55,7 @@ QString translationPath = TRANSLATION_PATH; QString translationPath = QString(); #endif +#if QT_VERSION < 0x050000 void myMessageOutput(QtMsgType /*type*/, const char *msg) { QFile file("qdebug.txt"); @@ -63,6 +64,16 @@ void myMessageOutput(QtMsgType /*type*/, const char *msg) out << msg << endl; 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() { @@ -87,7 +98,13 @@ int main(int argc, char *argv[]) QApplication app(argc, argv); if (app.arguments().contains("--debug-output")) + { +#if QT_VERSION < 0x050000 qInstallMsgHandler(myMessageOutput); +#else + qInstallMessageHandler(myMessageOutput); +#endif + } #ifdef Q_OS_MAC QDir baseDir(app.applicationDirPath()); baseDir.cdUp(); @@ -100,7 +117,11 @@ int main(int argc, char *argv[]) #ifdef Q_OS_WIN app.addLibraryPath(app.applicationDirPath() + "/plugins"); #endif + +#if QT_VERSION < 0x050000 + // gone in Qt5, all source files _MUST_ be utf8-encoded QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8")); +#endif QCoreApplication::setOrganizationName("Cockatrice"); QCoreApplication::setOrganizationDomain("cockatrice.de"); @@ -131,7 +152,7 @@ int main(int argc, char *argv[]) #if QT_VERSION < 0x050000 const QString dataDir = QDesktopServices::storageLocation(QDesktopServices::DataLocation); #else - const QString dataDir = QStandardPaths::standardLocations(QStandardPaths::DataLocation)).toString(); + const QString dataDir = QStandardPaths::standardLocations(QStandardPaths::DataLocation).first(); #endif if (!db->getLoadSuccess()) if (db->loadCardDatabase(dataDir + "/cards.xml")) diff --git a/cockatrice/src/pilezone.cpp b/cockatrice/src/pilezone.cpp index 0dbdd566..ed9daa88 100644 --- a/cockatrice/src/pilezone.cpp +++ b/cockatrice/src/pilezone.cpp @@ -13,7 +13,11 @@ PileZone::PileZone(Player *_p, const QString &_name, bool _isShufflable, bool _c : CardZone(_p, _name, false, _isShufflable, _contentsKnown, parent) { setCacheMode(DeviceCoordinateCache); // Do not move this line to the parent constructor! +#if QT_VERSION < 0x050000 setAcceptsHoverEvents(true); +#else + setAcceptHoverEvents(true); +#endif 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)); diff --git a/cockatrice/src/player.cpp b/cockatrice/src/player.cpp index 762b4387..d260cbea 100644 --- a/cockatrice/src/player.cpp +++ b/cockatrice/src/player.cpp @@ -774,7 +774,13 @@ void Player::actViewLibrary() void Player::actViewTopCards() { 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) { defaultNumberTopCards = number; static_cast(scene())->toggleZoneView(this, "deck", number); @@ -829,7 +835,13 @@ void Player::actMulligan() 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) { Command_DrawCards cmd; cmd.set_number(number); @@ -844,8 +856,14 @@ void Player::actUndoDraw() void Player::actMoveTopCardsToGrave() { - int number = QInputDialog::getInteger(0, tr("Move top cards to grave"), tr("Number:")); - if (!number) + int number = +#if QT_VERSION < 0x050000 + QInputDialog::getInteger( +#else + QInputDialog::getInt( +#endif + 0, tr("Move top cards to grave"), tr("Number:")); + if (!number) return; const int maxCards = zones.value("deck")->getCards().size(); @@ -867,8 +885,14 @@ void Player::actMoveTopCardsToGrave() void Player::actMoveTopCardsToExile() { - int number = QInputDialog::getInteger(0, tr("Move top cards to exile"), tr("Number:")); - if (!number) + int number = +#if QT_VERSION < 0x050000 + QInputDialog::getInteger( +#else + QInputDialog::getInt( +#endif + 0, tr("Move top cards to exile"), tr("Number:")); + if (!number) return; const int maxCards = zones.value("deck")->getCards().size(); @@ -914,7 +938,13 @@ void Player::actUntapAll() void Player::actRollDie() { 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) { Command_RollDie cmd; cmd.set_sides(sides); @@ -2022,7 +2052,13 @@ void Player::actCardCounterTrigger() case 11: { bool ok; 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; if (clearCardsToDelete()) return; diff --git a/cockatrice/src/playerlistwidget.cpp b/cockatrice/src/playerlistwidget.cpp index f299cda9..ee088203 100644 --- a/cockatrice/src/playerlistwidget.cpp +++ b/cockatrice/src/playerlistwidget.cpp @@ -72,7 +72,11 @@ PlayerListWidget::PlayerListWidget(TabSupervisor *_tabSupervisor, AbstractClient setColumnCount(6); setHeaderHidden(true); setRootIsDecorated(false); +#if QT_VERSION < 0x050000 header()->setResizeMode(QHeaderView::ResizeToContents); +#else + header()->setSectionResizeMode(QHeaderView::ResizeToContents); +#endif retranslateUi(); } diff --git a/cockatrice/src/remotedecklist_treewidget.cpp b/cockatrice/src/remotedecklist_treewidget.cpp index b72df671..809f3fe8 100644 --- a/cockatrice/src/remotedecklist_treewidget.cpp +++ b/cockatrice/src/remotedecklist_treewidget.cpp @@ -258,8 +258,17 @@ void RemoteDeckList_TreeModel::deckListFinished(const Response &r) { const Response_DeckList &resp = r.GetExtension(Response_DeckList::ext); +#if QT_VERSION >= 0x050000 + beginResetModel(); +#endif + root->clearTree(); + +#if QT_VERSION < 0x050000 reset(); +#else + endResetModel(); +#endif ServerInfo_DeckStorage_TreeItem tempRoot; tempRoot.set_id(0); @@ -280,7 +289,11 @@ RemoteDeckList_TreeWidget::RemoteDeckList_TreeWidget(AbstractClient *_client, QW setModel(proxyModel); connect(treeModel, SIGNAL(treeRefreshed()), this, SLOT(expandAll())); +#if QT_VERSION < 0x050000 header()->setResizeMode(QHeaderView::ResizeToContents); +#else + header()->setSectionResizeMode(QHeaderView::ResizeToContents); +#endif setUniformRowHeights(true); setSortingEnabled(true); proxyModel->sort(0, Qt::AscendingOrder); diff --git a/cockatrice/src/remotereplaylist_treewidget.cpp b/cockatrice/src/remotereplaylist_treewidget.cpp index 6184049e..5357596f 100644 --- a/cockatrice/src/remotereplaylist_treewidget.cpp +++ b/cockatrice/src/remotereplaylist_treewidget.cpp @@ -278,7 +278,11 @@ RemoteReplayList_TreeWidget::RemoteReplayList_TreeWidget(AbstractClient *_client proxyModel->setSortCaseSensitivity(Qt::CaseInsensitive); setModel(proxyModel); +#if QT_VERSION < 0x050000 header()->setResizeMode(QHeaderView::ResizeToContents); +#else + header()->setSectionResizeMode(QHeaderView::ResizeToContents); +#endif header()->setStretchLastSection(false); setUniformRowHeights(true); setSortingEnabled(true); diff --git a/cockatrice/src/soundengine.cpp b/cockatrice/src/soundengine.cpp index 5847c9ae..89820f9d 100644 --- a/cockatrice/src/soundengine.cpp +++ b/cockatrice/src/soundengine.cpp @@ -33,8 +33,13 @@ void SoundEngine::soundEnabledChanged() if (settingsCache->getSoundEnabled()) { qDebug("SoundEngine: enabling sound"); QAudioFormat format; +#if QT_VERSION < 0x050000 format.setFrequency(44100); format.setChannels(1); +#else + format.setSampleRate(44100); + format.setChannelCount(1); +#endif format.setSampleSize(16); format.setCodec("audio/pcm"); format.setByteOrder(QAudioFormat::LittleEndian); diff --git a/cockatrice/src/tab_deck_editor.cpp b/cockatrice/src/tab_deck_editor.cpp index 0c1d44e1..0b27dcbf 100644 --- a/cockatrice/src/tab_deck_editor.cpp +++ b/cockatrice/src/tab_deck_editor.cpp @@ -134,7 +134,11 @@ TabDeckEditor::TabDeckEditor(TabSupervisor *_tabSupervisor, QWidget *parent) deckView->setUniformRowHeights(true); deckView->setSortingEnabled(true); deckView->sortByColumn(1, Qt::AscendingOrder); +#if QT_VERSION < 0x050000 deckView->header()->setResizeMode(QHeaderView::ResizeToContents); +#else + deckView->header()->setSectionResizeMode(QHeaderView::ResizeToContents); +#endif deckView->installEventFilter(&deckViewKeySignals); connect(deckView->selectionModel(), SIGNAL(currentRowChanged(const QModelIndex &, const QModelIndex &)), this, SLOT(updateCardInfoRight(const QModelIndex &, const QModelIndex &))); connect(&deckViewKeySignals, SIGNAL(onEnter()), this, SLOT(actIncrement())); diff --git a/cockatrice/src/tab_deck_storage.cpp b/cockatrice/src/tab_deck_storage.cpp index 7e7d30ed..9898c9ee 100644 --- a/cockatrice/src/tab_deck_storage.cpp +++ b/cockatrice/src/tab_deck_storage.cpp @@ -38,7 +38,11 @@ TabDeckStorage::TabDeckStorage(TabSupervisor *_tabSupervisor, AbstractClient *_c localDirView->setColumnHidden(1, true); localDirView->setRootIndex(localDirModel->index(localDirModel->rootPath(), 0)); localDirView->setSortingEnabled(true); +#if QT_VERSION < 0x050000 localDirView->header()->setResizeMode(QHeaderView::ResizeToContents); +#else + localDirView->header()->setSectionResizeMode(QHeaderView::ResizeToContents); +#endif localDirView->header()->setSortIndicator(0, Qt::AscendingOrder); leftToolBar = new QToolBar; diff --git a/cockatrice/src/tab_replays.cpp b/cockatrice/src/tab_replays.cpp index 92b0be08..6b3a6210 100644 --- a/cockatrice/src/tab_replays.cpp +++ b/cockatrice/src/tab_replays.cpp @@ -36,7 +36,11 @@ TabReplays::TabReplays(TabSupervisor *_tabSupervisor, AbstractClient *_client) localDirView->setColumnHidden(1, true); localDirView->setRootIndex(localDirModel->index(localDirModel->rootPath(), 0)); localDirView->setSortingEnabled(true); +#if QT_VERSION < 0x050000 localDirView->header()->setResizeMode(QHeaderView::ResizeToContents); +#else + localDirView->header()->setSectionResizeMode(QHeaderView::ResizeToContents); +#endif localDirView->header()->setSortIndicator(0, Qt::AscendingOrder); leftToolBar = new QToolBar; diff --git a/cockatrice/src/tab_server.cpp b/cockatrice/src/tab_server.cpp index a8e89af5..b82248a3 100644 --- a/cockatrice/src/tab_server.cpp +++ b/cockatrice/src/tab_server.cpp @@ -28,11 +28,17 @@ RoomSelector::RoomSelector(AbstractClient *_client, QWidget *parent) roomList->setRootIsDecorated(false); roomList->setColumnCount(4); roomList->header()->setStretchLastSection(false); +#if QT_VERSION < 0x050000 roomList->header()->setResizeMode(0, QHeaderView::ResizeToContents); roomList->header()->setResizeMode(1, QHeaderView::Stretch); roomList->header()->setResizeMode(2, 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; connect(joinButton, SIGNAL(clicked()), this, SLOT(joinClicked())); QHBoxLayout *buttonLayout = new QHBoxLayout; diff --git a/cockatrice/src/tablezone.cpp b/cockatrice/src/tablezone.cpp index d7fa4218..f716cfbc 100644 --- a/cockatrice/src/tablezone.cpp +++ b/cockatrice/src/tablezone.cpp @@ -28,7 +28,11 @@ TableZone::TableZone(Player *_p, QGraphicsItem *parent) currentMinimumWidth = minWidth; setCacheMode(DeviceCoordinateCache); +#if QT_VERSION < 0x050000 setAcceptsHoverEvents(true); +#else + setAcceptHoverEvents(true); +#endif } void TableZone::updateBgPixmap() diff --git a/cockatrice/src/userlist.cpp b/cockatrice/src/userlist.cpp index 562d395b..29d13781 100644 --- a/cockatrice/src/userlist.cpp +++ b/cockatrice/src/userlist.cpp @@ -216,7 +216,11 @@ UserList::UserList(TabSupervisor *_tabSupervisor, AbstractClient *_client, UserL userTree = new QTreeWidget; userTree->setColumnCount(3); +#if QT_VERSION < 0x050000 userTree->header()->setResizeMode(QHeaderView::ResizeToContents); +#else + userTree->header()->setSectionResizeMode(QHeaderView::ResizeToContents); +#endif userTree->setHeaderHidden(true); userTree->setRootIsDecorated(false); userTree->setIconSize(QSize(20, 12));