Commit 67c4d089 authored by jfreake's avatar jfreake
Browse files

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)
parent 95c6058d
...@@ -4,9 +4,9 @@ ...@@ -4,9 +4,9 @@
#include "decklist.h" #include "decklist.h"
const QStringList DeckLoader::fileNameFilters = QStringList() const QStringList DeckLoader::fileNameFilters = QStringList()
<< QObject::tr("All files (*.*)")
<< QObject::tr("Cockatrice decks (*.cod)") << QObject::tr("Cockatrice decks (*.cod)")
<< QObject::tr("Plain text decks (*.dec *.mwDeck)") << QObject::tr("Plain text decks (*.dec *.mwDeck)");
<< QObject::tr("All files (*.*)");
DeckLoader::DeckLoader() DeckLoader::DeckLoader()
: DeckList(), : DeckList(),
...@@ -94,8 +94,8 @@ bool DeckLoader::saveToFile(const QString &fileName, FileFormat fmt) ...@@ -94,8 +94,8 @@ bool DeckLoader::saveToFile(const QString &fileName, FileFormat fmt)
DeckLoader::FileFormat DeckLoader::getFormatFromNameFilter(const QString &selectedNameFilter) DeckLoader::FileFormat DeckLoader::getFormatFromNameFilter(const QString &selectedNameFilter)
{ {
switch (fileNameFilters.indexOf(selectedNameFilter)) { switch (fileNameFilters.indexOf(selectedNameFilter)) {
case 0: return CockatriceFormat; case 1: return CockatriceFormat;
case 1: return PlainTextFormat; case 2: return PlainTextFormat;
} }
return PlainTextFormat; return PlainTextFormat;
} }
...@@ -80,6 +80,7 @@ TabSupervisor::TabSupervisor(AbstractClient *_client, QWidget *parent) ...@@ -80,6 +80,7 @@ TabSupervisor::TabSupervisor(AbstractClient *_client, QWidget *parent)
{ {
tabChangedIcon = new QIcon(":/resources/icon_tab_changed.svg"); tabChangedIcon = new QIcon(":/resources/icon_tab_changed.svg");
setElideMode(Qt::ElideRight); setElideMode(Qt::ElideRight);
setMovable(true);
setIconSize(QSize(15, 15)); setIconSize(QSize(15, 15));
connect(this, SIGNAL(currentChanged(int)), this, SLOT(updateCurrent(int))); connect(this, SIGNAL(currentChanged(int)), this, SLOT(updateCurrent(int)));
......
...@@ -449,8 +449,12 @@ bool DeckList::loadFromStream_Plain(QTextStream &in) ...@@ -449,8 +449,12 @@ bool DeckList::loadFromStream_Plain(QTextStream &in)
line.remove(rx); line.remove(rx);
rx.setPattern("\\(.*\\)"); rx.setPattern("\\(.*\\)");
line.remove(rx); line.remove(rx);
//Filter out post card name editions
rx.setPattern("\\|.*");
line.remove(rx);
line = line.simplified(); line = line.simplified();
int i = line.indexOf(' '); int i = line.indexOf(' ');
bool ok; bool ok;
int number = line.left(i).toInt(&ok); int number = line.left(i).toInt(&ok);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment