Commit 2960cba1 authored by Ira Aspen's avatar Ira Aspen
Browse files

Added a file picker to the add set menu item.

parent 646c4b41
...@@ -45,6 +45,10 @@ ...@@ -45,6 +45,10 @@
#include "cardframe.h" #include "cardframe.h"
#include "filterbuilder.h" #include "filterbuilder.h"
const QStringList TabDeckEditor::fileNameFilters = QStringList()
<< QObject::tr("Cockatrice set format (*.xml)")
<< QObject::tr("All files (*.*)");
void SearchLineEdit::keyPressEvent(QKeyEvent *event) void SearchLineEdit::keyPressEvent(QKeyEvent *event)
{ {
if (treeView && ((event->key() == Qt::Key_Up) || (event->key() == Qt::Key_Down))) if (treeView && ((event->key() == Qt::Key_Up) || (event->key() == Qt::Key_Down)))
...@@ -871,6 +875,22 @@ void TabDeckEditor::actOpenCustomsetsFolder() { ...@@ -871,6 +875,22 @@ void TabDeckEditor::actOpenCustomsetsFolder() {
void TabDeckEditor::actAddCustomSet() void TabDeckEditor::actAddCustomSet()
{ {
#if QT_VERSION < 0x050000
QString dataDir = QDesktopServices::storageLocation(QDesktopServices::DataLocation);
#else
QString dataDir = QStandardPaths::standardLocations(QStandardPaths::DataLocation).first();
#endif
if (!confirmClose())
return;
QFileDialog dialog(this, tr("Load set"));
dialog.setDirectory(dataDir);
dialog.setNameFilters(TabDeckEditor::fileNameFilters);
if (!dialog.exec())
return;
QString fileName = dialog.selectedFiles().at(0);
} }
void TabDeckEditor::actEditSets() void TabDeckEditor::actEditSets()
......
...@@ -89,6 +89,7 @@ class TabDeckEditor : public Tab { ...@@ -89,6 +89,7 @@ class TabDeckEditor : public Tab {
void dockFloatingTriggered(); void dockFloatingTriggered();
void dockTopLevelChanged(bool topLevel); void dockTopLevelChanged(bool topLevel);
private: private:
static const QStringList fileNameFilters;
CardInfo *currentCardInfo() const; CardInfo *currentCardInfo() const;
void addCardHelper(QString zoneName); void addCardHelper(QString zoneName);
void offsetCountAtIndex(const QModelIndex &idx, int offset); void offsetCountAtIndex(const QModelIndex &idx, int offset);
......
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