From 1edc34f086a9e9bb99891800de7d27c3d03d1f6e Mon Sep 17 00:00:00 2001 From: Fabio Bas Date: Sat, 21 Jun 2014 11:37:46 +0200 Subject: [PATCH] Add an option to force selection of save path By default oracle saves cards.xml to the correct path, where cockatrice will be able to pick it up; if oracle is not able to determine the path or the user unchecks the option, oracle will ask for a save path --- oracle/src/oraclewizard.cpp | 9 +++++++-- oracle/src/oraclewizard.h | 1 + 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/oracle/src/oraclewizard.cpp b/oracle/src/oraclewizard.cpp index 7b48b341..66417764 100644 --- a/oracle/src/oraclewizard.cpp +++ b/oracle/src/oraclewizard.cpp @@ -322,11 +322,16 @@ SaveSetsPage::SaveSetsPage(QWidget *parent) setSubTitle(tr("The following sets has been imported. " "Press \"Save\" to save the imported cards to the Cockatrice database.")); + defaultPathCheckBox = new QCheckBox(this); + defaultPathCheckBox->setText(tr("Save to the default path (recommended)")); + defaultPathCheckBox->setChecked(true); + messageLog = new QTextEdit(this); messageLog->setReadOnly(true); QGridLayout *layout = new QGridLayout(this); - layout->addWidget(messageLog, 0, 0); + layout->addWidget(defaultPathCheckBox, 0, 0); + layout->addWidget(messageLog, 1, 0); setLayout(layout); } @@ -366,7 +371,7 @@ bool SaveSetsPage::validatePage() QString savePath = dataDir + "/cards.xml"; do { QString fileName; - if (savePath.isEmpty()) + if (savePath.isEmpty() || !defaultPathCheckBox->isChecked()) fileName = QFileDialog::getSaveFileName(this, tr("Save card database"), dataDir + "/cards.xml", tr("XML card database (*.xml)")); else { fileName = savePath; diff --git a/oracle/src/oraclewizard.h b/oracle/src/oraclewizard.h index 5514b9da..152ce3ad 100644 --- a/oracle/src/oraclewizard.h +++ b/oracle/src/oraclewizard.h @@ -100,6 +100,7 @@ public: SaveSetsPage(QWidget *parent = 0); private: QTextEdit *messageLog; + QCheckBox * defaultPathCheckBox; protected: void initializePage(); void cleanupPage();