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
This commit is contained in:
Fabio Bas 2014-06-21 11:37:46 +02:00
parent bb9a79f83b
commit 1edc34f086
2 changed files with 8 additions and 2 deletions

View file

@ -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;

View file

@ -100,6 +100,7 @@ public:
SaveSetsPage(QWidget *parent = 0);
private:
QTextEdit *messageLog;
QCheckBox * defaultPathCheckBox;
protected:
void initializePage();
void cleanupPage();