Added a file picker to the add set menu item.
This commit is contained in:
parent
646c4b4197
commit
2960cba12b
2 changed files with 21 additions and 0 deletions
|
@ -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() {
|
||||||
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 {
|
||||||
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);
|
||||||
|
|
Loading…
Reference in a new issue