From 67c4d089be15f2704bcdb76f4ed3dfceddafdc73 Mon Sep 17 00:00:00 2001 From: jfreake Date: Wed, 8 Jan 2014 11:54:02 -0400 Subject: [PATCH] Deck Load Mods and Movable Tabs Changes: Deck Load - Default to all types *.* Decklist - Strip "|edition" from .dec formats that include a pipe and the edition after the card name Tab_Supervisor - Make tabs movable (able to rearrange tabs) --- cockatrice/src/deck_loader.cpp | 8 ++++---- cockatrice/src/tab_supervisor.cpp | 1 + common/decklist.cpp | 4 ++++ 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/cockatrice/src/deck_loader.cpp b/cockatrice/src/deck_loader.cpp index b0e34d80..e4678711 100644 --- a/cockatrice/src/deck_loader.cpp +++ b/cockatrice/src/deck_loader.cpp @@ -4,9 +4,9 @@ #include "decklist.h" const QStringList DeckLoader::fileNameFilters = QStringList() + << QObject::tr("All files (*.*)") << QObject::tr("Cockatrice decks (*.cod)") - << QObject::tr("Plain text decks (*.dec *.mwDeck)") - << QObject::tr("All files (*.*)"); + << QObject::tr("Plain text decks (*.dec *.mwDeck)"); DeckLoader::DeckLoader() : DeckList(), @@ -94,8 +94,8 @@ bool DeckLoader::saveToFile(const QString &fileName, FileFormat fmt) DeckLoader::FileFormat DeckLoader::getFormatFromNameFilter(const QString &selectedNameFilter) { switch (fileNameFilters.indexOf(selectedNameFilter)) { - case 0: return CockatriceFormat; - case 1: return PlainTextFormat; + case 1: return CockatriceFormat; + case 2: return PlainTextFormat; } return PlainTextFormat; } diff --git a/cockatrice/src/tab_supervisor.cpp b/cockatrice/src/tab_supervisor.cpp index fde4ff6e..f5a06d67 100644 --- a/cockatrice/src/tab_supervisor.cpp +++ b/cockatrice/src/tab_supervisor.cpp @@ -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))); diff --git a/common/decklist.cpp b/common/decklist.cpp index 7c1430a6..57e1e188 100644 --- a/common/decklist.cpp +++ b/common/decklist.cpp @@ -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);