Merge branch 'master' into editor-redesign
Conflicts: cockatrice/src/carddatabasemodel.cpp cockatrice/src/carddatabasemodel.h cockatrice/src/decklistmodel.cpp cockatrice/src/decklistmodel.h cockatrice/src/tab_deck_editor.cpp cockatrice/src/tab_deck_editor.h
This commit is contained in:
commit
0770626270
152 changed files with 13862 additions and 13865 deletions
19
TODO.md
19
TODO.md
|
@ -28,7 +28,6 @@ Note that "improve" and "write" always also means: "document and comment"
|
|||
* Rename the picture filenames to something more meaningful.
|
||||
* Create an index, lists of tables/figures/...
|
||||
|
||||
|
||||
## Storage
|
||||
* Find a better place for sets.xml than doc.
|
||||
|
||||
|
@ -41,24 +40,6 @@ Note that "improve" and "write" always also means: "document and comment"
|
|||
* Document everything!1!!
|
||||
* Coding guidelines
|
||||
|
||||
##Fix compile warnings
|
||||
* (CMAKE_VERBOSE_MAKEFILE, compile with clang++), this could indicate missing program functionality:
|
||||
|
||||
```
|
||||
cockatrice/src/abstractclient.cpp:72:12: warning: enumeration value 'SessionEvent_SessionEventType_SERVER_COMPLETE_LIST' not handled in switch [-Wswitch]
|
||||
switch ((SessionEvent::SessionEventType) getPbExtension(event)) {
|
||||
```
|
||||
|
||||
```
|
||||
cockatrice/Cockatrice.VanNostrand/cockatrice/src/player.cpp:1725:12: warning: 4 enumeration values not handled in switch: 'cmMoveToTopLibrary', 'cmMoveToBottomLibrary', 'cmMoveToGraveyard'... [-Wswitch]
|
||||
switch (static_cast<CardMenuActionType>(a->data().toInt())) {
|
||||
```
|
||||
|
||||
```
|
||||
cockatrice/src/cardzone.cpp:127:11: warning: enumeration values 'CaseTopCardsOfZone', 'CaseRevealZone', and 'CaseShuffleZone' not handled in switch [-Wswitch]
|
||||
switch (gc) {
|
||||
```
|
||||
|
||||
##Else
|
||||
|
||||
* Update SFMT library (http://www.math.sci.hiroshima-u.ac.jp/~m-mat@math.sci.hiroshima-u.ac.jp/MT/SFMT/) in common/sfmt and adapt common/rng_sfmt.cpp
|
||||
|
|
|
@ -82,6 +82,7 @@ void AbstractClient::processProtocolItem(const ServerMessage &item)
|
|||
case SessionEvent::USER_LEFT: emit userLeftEventReceived(event.GetExtension(Event_UserLeft::ext)); break;
|
||||
case SessionEvent::GAME_JOINED: emit gameJoinedEventReceived(event.GetExtension(Event_GameJoined::ext)); break;
|
||||
case SessionEvent::REPLAY_ADDED: emit replayAddedEventReceived(event.GetExtension(Event_ReplayAdded::ext)); break;
|
||||
default: break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -118,7 +118,6 @@ CardDatabaseDisplayModel::CardDatabaseDisplayModel(QObject *parent)
|
|||
bool CardDatabaseDisplayModel::filterAcceptsRow(int sourceRow, const QModelIndex & /*sourceParent*/) const
|
||||
{
|
||||
CardInfo const *info = static_cast<CardDatabaseModel *>(sourceModel())->getCard(sourceRow);
|
||||
|
||||
if (((isToken == ShowTrue) && !info->getIsToken()) || ((isToken == ShowFalse) && info->getIsToken()))
|
||||
return false;
|
||||
|
||||
|
|
|
@ -143,6 +143,7 @@ QString CardZone::getTranslatedName(bool hisOwn, GrammaticalCase gc) const
|
|||
? tr("his sideboard", "nominative, male owner")
|
||||
: tr("%1's sideboard", "nominative, male owner").arg(ownerName)
|
||||
);
|
||||
default: break;
|
||||
}
|
||||
return QString();
|
||||
}
|
||||
|
|
|
@ -4,8 +4,7 @@
|
|||
#include "decklist.h"
|
||||
|
||||
const QStringList DeckLoader::fileNameFilters = QStringList()
|
||||
<< QObject::tr("Cockatrice decks (*.cod)")
|
||||
<< QObject::tr("Plain text decks (*.dec *.mwDeck)")
|
||||
<< QObject::tr("Common deck formats (*.cod *.dec *.mwDeck)")
|
||||
<< QObject::tr("All files (*.*)");
|
||||
|
||||
DeckLoader::DeckLoader()
|
||||
|
@ -91,11 +90,10 @@ bool DeckLoader::saveToFile(const QString &fileName, FileFormat fmt)
|
|||
return result;
|
||||
}
|
||||
|
||||
DeckLoader::FileFormat DeckLoader::getFormatFromNameFilter(const QString &selectedNameFilter)
|
||||
DeckLoader::FileFormat DeckLoader::getFormatFromName(const QString &fileName)
|
||||
{
|
||||
switch (fileNameFilters.indexOf(selectedNameFilter)) {
|
||||
case 0: return CockatriceFormat;
|
||||
case 1: return PlainTextFormat;
|
||||
if (fileName.endsWith(".cod", Qt::CaseInsensitive)) {
|
||||
return CockatriceFormat;
|
||||
}
|
||||
return PlainTextFormat;
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ public:
|
|||
FileFormat getLastFileFormat() const { return lastFileFormat; }
|
||||
int getLastRemoteDeckId() const { return lastRemoteDeckId; }
|
||||
|
||||
static FileFormat getFormatFromNameFilter(const QString &selectedNameFilter);
|
||||
static FileFormat getFormatFromName(const QString &fileName);
|
||||
|
||||
bool loadFromFile(const QString &fileName, FileFormat fmt);
|
||||
bool loadFromRemote(const QString &nativeString, int remoteDeckId);
|
||||
|
|
|
@ -45,7 +45,6 @@ public:
|
|||
Qt::ItemFlags flags(const QModelIndex &index) const;
|
||||
bool setData(const QModelIndex &index, const QVariant &value, int role);
|
||||
bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex());
|
||||
|
||||
QModelIndex findCard(const QString &cardName, const QString &zoneName) const;
|
||||
QModelIndex addCard(const QString &cardName, const QString &zoneName);
|
||||
void sort(int column, Qt::SortOrder order = Qt::AscendingOrder);
|
||||
|
|
|
@ -1514,8 +1514,8 @@ void Player::playCard(CardItem *c, bool faceDown, bool tapped)
|
|||
|
||||
CardInfo *ci = c->getInfo();
|
||||
if ((!settingsCache->getPlayToStack() && ci->getTableRow() == 3) ||
|
||||
(settingsCache->getPlayToStack() && ci->getTableRow() != 0) &&
|
||||
c->getZone()->getName().toStdString() != "stack") {
|
||||
((settingsCache->getPlayToStack() && ci->getTableRow() != 0) &&
|
||||
c->getZone()->getName().toStdString() != "stack")) {
|
||||
cmd.set_target_zone("stack");
|
||||
cmd.set_x(0);
|
||||
cmd.set_y(0);
|
||||
|
@ -1784,6 +1784,7 @@ void Player::cardMenuAction()
|
|||
commandList.append(cmd);
|
||||
break;
|
||||
}
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -54,6 +54,7 @@ TabDeckEditor::TabDeckEditor(TabSupervisor *_tabSupervisor, QWidget *parent)
|
|||
searchLabel = new QLabel();
|
||||
searchEdit = new SearchLineEdit;
|
||||
searchLabel->setBuddy(searchEdit);
|
||||
|
||||
searchKeySignals.filterDelete(false);
|
||||
searchEdit->installEventFilter(&searchKeySignals);
|
||||
connect(searchEdit, SIGNAL(textChanged(const QString &)), this, SLOT(updateSearch(const QString &)));
|
||||
|
@ -96,7 +97,6 @@ TabDeckEditor::TabDeckEditor(TabSupervisor *_tabSupervisor, QWidget *parent)
|
|||
connect(&dbViewKeySignals, SIGNAL(onLeft()), this, SLOT(actDecrementCard()));
|
||||
connect(&dbViewKeySignals, SIGNAL(onCtrlLeft()), this, SLOT(actDecrementCardFromSideboard()));
|
||||
connect(&dbViewKeySignals, SIGNAL(onCtrlEnter()), this, SLOT(actAddCardToSideboard()));
|
||||
|
||||
searchEdit->setTreeView(databaseView);
|
||||
|
||||
QVBoxLayout *leftFrame = new QVBoxLayout;
|
||||
|
@ -414,7 +414,7 @@ void TabDeckEditor::actLoadDeck()
|
|||
return;
|
||||
|
||||
QString fileName = dialog.selectedFiles().at(0);
|
||||
DeckLoader::FileFormat fmt = DeckLoader::getFormatFromNameFilter(dialog.selectedNameFilter());
|
||||
DeckLoader::FileFormat fmt = DeckLoader::getFormatFromName(fileName);
|
||||
|
||||
DeckLoader *l = new DeckLoader;
|
||||
if (l->loadFromFile(fileName, fmt))
|
||||
|
@ -467,7 +467,7 @@ bool TabDeckEditor::actSaveDeckAs()
|
|||
return false;
|
||||
|
||||
QString fileName = dialog.selectedFiles().at(0);
|
||||
DeckLoader::FileFormat fmt = DeckLoader::getFormatFromNameFilter(dialog.selectedNameFilter());
|
||||
DeckLoader::FileFormat fmt = DeckLoader::getFormatFromName(fileName);
|
||||
|
||||
if (!deckModel->getDeckList()->saveToFile(fileName, fmt)) {
|
||||
QMessageBox::critical(this, tr("Error"), tr("The deck could not be saved.\nPlease check that the directory is writable and try again."));
|
||||
|
@ -561,7 +561,6 @@ void TabDeckEditor::addCardHelper(QString zoneName)
|
|||
QModelIndex newCardIndex = deckModel->addCard(info->getName(), zoneName);
|
||||
recursiveExpand(newCardIndex);
|
||||
deckView->setCurrentIndex(newCardIndex);
|
||||
|
||||
setModified(true);
|
||||
}
|
||||
|
||||
|
|
|
@ -79,6 +79,7 @@ private:
|
|||
CardDatabaseDisplayModel *databaseDisplayModel;
|
||||
DeckListModel *deckModel;
|
||||
QTreeView *databaseView;
|
||||
|
||||
KeySignals dbViewKeySignals;
|
||||
QTreeView *deckView;
|
||||
KeySignals deckViewKeySignals;
|
||||
|
@ -86,6 +87,7 @@ private:
|
|||
QLabel *searchLabel;
|
||||
SearchLineEdit *searchEdit;
|
||||
KeySignals searchKeySignals;
|
||||
|
||||
QLabel *nameLabel;
|
||||
QLineEdit *nameEdit;
|
||||
QLabel *commentsLabel;
|
||||
|
|
|
@ -154,7 +154,7 @@ void DeckViewContainer::loadLocalDeck()
|
|||
return;
|
||||
|
||||
QString fileName = dialog.selectedFiles().at(0);
|
||||
DeckLoader::FileFormat fmt = DeckLoader::getFormatFromNameFilter(dialog.selectedNameFilter());
|
||||
DeckLoader::FileFormat fmt = DeckLoader::getFormatFromName(fileName);
|
||||
DeckLoader deck;
|
||||
if (!deck.loadFromFile(fileName, fmt)) {
|
||||
QMessageBox::critical(this, tr("Error"), tr("The selected file could not be loaded."));
|
||||
|
|
|
@ -80,6 +80,7 @@ TabSupervisor::TabSupervisor(AbstractClient *_client, QWidget *parent)
|
|||
{
|
||||
tabChangedIcon = new QIcon(":/resources/icon_tab_changed.svg");
|
||||
setElideMode(Qt::ElideRight);
|
||||
setMovable(true);
|
||||
setIconSize(QSize(15, 15));
|
||||
connect(this, SIGNAL(currentChanged(int)), this, SLOT(updateCurrent(int)));
|
||||
|
||||
|
|
|
@ -48,5 +48,9 @@ INCLUDE_DIRECTORIES(${PROTOBUF_INCLUDE_DIR})
|
|||
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR})
|
||||
|
||||
add_library(cockatrice_common ${common_SOURCES} ${common_HEADERS_MOC})
|
||||
target_link_libraries(cockatrice_common cockatrice_protocol)
|
||||
|
||||
# Without this check, Linux will put -pthread out of order in link.txt and build will fail
|
||||
if (UNIX)
|
||||
target_link_libraries(cockatrice_common cockatrice_protocol pthread)
|
||||
else (UNIX)
|
||||
target_link_libraries(cockatrice_common cockatrice_protocol)
|
||||
endif (UNIX)
|
||||
|
|
|
@ -449,8 +449,12 @@ bool DeckList::loadFromStream_Plain(QTextStream &in)
|
|||
line.remove(rx);
|
||||
rx.setPattern("\\(.*\\)");
|
||||
line.remove(rx);
|
||||
//Filter out post card name editions
|
||||
rx.setPattern("\\|.*$");
|
||||
line.remove(rx);
|
||||
line = line.simplified();
|
||||
|
||||
|
||||
int i = line.indexOf(' ');
|
||||
bool ok;
|
||||
int number = line.left(i).toInt(&ok);
|
||||
|
|
Binary file not shown.
|
@ -195,7 +195,7 @@ Start the oracle.exe (the installer does this automatically) and let it generate
|
|||
Congratulations, you may now use Cockatrice!
|
||||
|
||||
\subsubsection{Linux and BSD}
|
||||
The following procedures have been tested with Debian Wheezy, Fedora 18 and FreeBSD 9.1.
|
||||
The following procedures have been tested with Debian Wheezy, Fedora 18, XUbuntu 13.10, FreeBSD 9.1 and 10.0.
|
||||
If you use Gentoo with KDE you have the needed prerequisites and may continue with downloading the source.
|
||||
If you use Bodhi or Arch Linux (AUR) or another distribution that includes Cockatrice, you might install Cockatrice from the default packages -- though the package might be old,
|
||||
so you probably should continue with this howto.
|
||||
|
@ -204,10 +204,11 @@ Before you install new software, you should update your system. The following in
|
|||
\begin{enumerate}
|
||||
\item You need to install the build tools and dependencies. This varies between the Linux distributions.
|
||||
\begin{description}
|
||||
\item[Debian, Ubuntu and spin-offs] \shellcmd{sudo apt-get install build-essential git libqt4-dev qtmobility-dev libprotobuf-dev protobuf-compiler cmake}
|
||||
\item[Debian, Ubuntu and spin-offs] \shellcmd{sudo apt-get install build-essential git libqt4-dev qtmobility-dev libprotobuf-dev protobuf-compiler cmake} (see note below regarding pthread)
|
||||
\item[Fedora] \shellcmd{sudo yum groupinstall "Development Tools"\\
|
||||
yum install qt-devel qt-mobility-devel protobuf-devel protobuf-compiler cmake}
|
||||
\item[FreeBSD] \shellcmd{pkg\_add -r qt4 qt4-linguist qt4-moc qt4-qmake qt4-rcc qt4-uic git cmake protobuf}
|
||||
\item[FreeBSD 9] \shellcmd{pkg\_add -r qt4 qt4-linguist qt4-moc qt4-qmake qt4-rcc qt4-uic git cmake protobuf}
|
||||
\item[FreeBSD 10] \shellcmd{pkg install qt4 qt4-linguist qt4-moc qt4-qmake qt4-rcc qt4-uic git cmake protobuf}
|
||||
\end{description}
|
||||
\item Download the sources from github via \\ \shellcmd{cd\\ git clone https://github.com/Daenyth/Cockatrice.git}
|
||||
\item To compile the sources, change into the newly created directory, create a build directory and invoke cmake:\\
|
||||
|
@ -216,10 +217,12 @@ mkdir build \\
|
|||
cd build \\
|
||||
cmake ..\\
|
||||
make}\\
|
||||
If you have some issues with pthread\_* add 'pthread' to the ``target\_link\_libraries'' entry in the \shellcmd{CMakeFiles.txt} in \shellcmd{Cockatrice/common}.
|
||||
\begin{framed}
|
||||
If you have linking errors with pthread\_* add 'pthread' to the ``target\_link\_libraries'' entry in the \shellcmd{CMakeFiles.txt} in \shellcmd{Cockatrice/common}, e.g. for Xubuntu, then continue the make process.
|
||||
\end{framed}
|
||||
\item You may install the program into the directory \shellcmd{/usr/local} by typing \shellcmd{sudo make install} but you should also be able to start
|
||||
cockatrice and the oracle from the build directory.
|
||||
\item Before you start Cockatrice for the first time, run \shellcmd{oracle -dlsets} and download available cards, denn run \shellcmd{cockatrice}.
|
||||
\item Before you start Cockatrice for the first time, run \shellcmd{oracle -dlsets} and download available cards, then run \shellcmd{cockatrice}.
|
||||
The default paths for decks, pics, cards and tokens are located in \\ \shellcmd{/home/<user>/.local/share/data/Cockatrice/Cockatrice}.
|
||||
\end{enumerate}
|
||||
|
||||
|
@ -233,6 +236,10 @@ The compilation works like already written above, but instead of invoking \shell
|
|||
\item If you want to build the server, use:\\ \shellcmd{cmake -DWITH\_SERVER=1 ..}
|
||||
\item If you want to build the server, but not the client, use:\\ \shellcmd{cmake -DWITH\_SERVER=1 -DWITHOUT\_CLIENT=1 ..}
|
||||
\end{itemize}
|
||||
Further, the server has a dependency on libgcrypt, so you need to install it as well:
|
||||
\begin{description}
|
||||
\item[FreeBSD 10] \shellcmd{pkg install libgcrypt}
|
||||
\end{description}
|
||||
There is more information on compiling and running Servatrice on CentOS 6 in chapter \ref{servatrice} on page \pageref{servatrice}.
|
||||
|
||||
\section{Downloading Card Database Using the Oracle}
|
||||
|
|
Loading…
Reference in a new issue