"cockatrice/git@gitlab.completext.com:quzar/Cockatrice.git" did not exist on "d078cf52c982e3eff6eb06b80216040edfe4bc11"
Commit 0ec5842c authored by Fabio Bas's avatar Fabio Bas
Browse files

Add an unexposed config value for the AllSets.json file url

It will be saved only if:
* it’s different than the default (the user used a custom url);
* the download actually worked
parent 17f7fe7a
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
OracleWizard::OracleWizard(QWidget *parent) OracleWizard::OracleWizard(QWidget *parent)
: QWizard(parent) : QWizard(parent)
{ {
settings = new QSettings(this);
importer = new OracleImporter(QDesktopServices::storageLocation(QDesktopServices::DataLocation), this); importer = new OracleImporter(QDesktopServices::storageLocation(QDesktopServices::DataLocation), this);
addPage(new IntroPage); addPage(new IntroPage);
...@@ -76,7 +77,6 @@ LoadSetsPage::LoadSetsPage(QWidget *parent) ...@@ -76,7 +77,6 @@ LoadSetsPage::LoadSetsPage(QWidget *parent)
progressBar = new QProgressBar(this); progressBar = new QProgressBar(this);
urlRadioButton->setChecked(true); urlRadioButton->setChecked(true);
urlLineEdit->setText(ALLSETS_URL);
fileButton = new QPushButton(tr("Choose file..."), this); fileButton = new QPushButton(tr("Choose file..."), this);
connect(fileButton, SIGNAL(clicked()), this, SLOT(actLoadSetsFile())); connect(fileButton, SIGNAL(clicked()), this, SLOT(actLoadSetsFile()));
...@@ -97,6 +97,8 @@ LoadSetsPage::LoadSetsPage(QWidget *parent) ...@@ -97,6 +97,8 @@ LoadSetsPage::LoadSetsPage(QWidget *parent)
void LoadSetsPage::initializePage() void LoadSetsPage::initializePage()
{ {
urlLineEdit->setText(wizard()->settings->value("allsetsurl", ALLSETS_URL).toString());
progressLabel->hide(); progressLabel->hide();
progressBar->hide(); progressBar->hide();
} }
...@@ -200,7 +202,13 @@ void LoadSetsPage::actDownloadFinishedSetsFile() ...@@ -200,7 +202,13 @@ void LoadSetsPage::actDownloadFinishedSetsFile()
return; return;
} }
this->readSetsFromByteArray(reply->readAll()); // save allsets.json url, but only if the user customized it and download was successfull
if(urlLineEdit->text() != QString(ALLSETS_URL))
wizard()->settings->setValue("allsetsurl", urlLineEdit->text());
else
wizard()->settings->remove("allsetsurl");
readSetsFromByteArray(reply->readAll());
reply->deleteLater(); reply->deleteLater();
} }
......
...@@ -15,6 +15,7 @@ class QNetworkAccessManager; ...@@ -15,6 +15,7 @@ class QNetworkAccessManager;
class QTextEdit; class QTextEdit;
class QVBoxLayout; class QVBoxLayout;
class OracleImporter; class OracleImporter;
class QSettings;
class OracleWizard : public QWizard class OracleWizard : public QWizard
{ {
...@@ -26,6 +27,7 @@ public: ...@@ -26,6 +27,7 @@ public:
void disableButtons(); void disableButtons();
public: public:
OracleImporter *importer; OracleImporter *importer;
QSettings * settings;
}; };
......
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