Before: If default is checked, Oracle will always save to the AppData path.
If a path to cards.xml is set, Oracle will update that cards.xml. If Oracle is run before a path to cards.xml is set, if default is checked, cards.xml will be saved on the AppData path. Furthermore, this path will be set as the cards.xml path for both Oracle and Cockatrice. If Oracle is run before a path to cards.xml is set, if default is NOT checked, cards.xml will be saved at the selected path and this path will be set as the cards.xml path for both Oracle and Cockatrice. If a path to cards.xml is set, if default is NOT checked, cards.xml will be saved at the selected path but this path will NOT be set as the cards.xml path for either Oracle or Cockatrice. This allows people who already have a cards.xml (which may be customized), to still obtain clean copies of cards.xml through Oracle without overwriting their own
This commit is contained in:
parent
ffed0e00fe
commit
8be4a14fcc
1 changed files with 18 additions and 7 deletions
|
@ -402,16 +402,27 @@ bool SaveSetsPage::validatePage()
|
|||
#else
|
||||
QStandardPaths::standardLocations(QStandardPaths::DataLocation).first();
|
||||
#endif
|
||||
QDir dir(dataDir);
|
||||
if (!dir.exists())
|
||||
dir.mkpath(dataDir);
|
||||
QString savePath = dataDir + "/cards.xml";
|
||||
QSettings* settings = new QSettings(this);
|
||||
QString savePath = settings->value("paths/carddatabase").toString();
|
||||
if (savePath.isEmpty()) {
|
||||
QDir dir(dataDir);
|
||||
if (!dir.exists())
|
||||
dir.mkpath(dataDir);
|
||||
}
|
||||
do {
|
||||
QString fileName;
|
||||
if (savePath.isEmpty() || !defaultPathCheckBox->isChecked())
|
||||
fileName = QFileDialog::getSaveFileName(this, tr("Save card database"), dataDir + "/cards.xml", tr("XML card database (*.xml)"));
|
||||
if (savePath.isEmpty()) {
|
||||
if (!defaultPathCheckBox->isChecked())
|
||||
fileName = QFileDialog::getSaveFileName(this, tr("Save card database"), dataDir + "/cards.xml", tr("XML card database (*.xml)"));
|
||||
else
|
||||
fileName = dataDir + "/cards.xml";;
|
||||
settings->setValue("paths/carddatabase", fileName);
|
||||
}
|
||||
else {
|
||||
fileName = savePath;
|
||||
if (!defaultPathCheckBox->isChecked())
|
||||
fileName = QFileDialog::getSaveFileName(this, tr("Save card database"), savePath, tr("XML card database (*.xml)"));
|
||||
else
|
||||
fileName = savePath;
|
||||
savePath.clear();
|
||||
}
|
||||
if (fileName.isEmpty()) {
|
||||
|
|
Loading…
Reference in a new issue