aboutsummaryrefslogtreecommitdiff
path: root/launcher/ui/setupwizard/PasteWizardPage.cpp
diff options
context:
space:
mode:
authorLenny McLennington <lennymclennington@protonmail.com>2022-05-17 05:00:06 +0100
committerLenny McLennington <lennymclennington@protonmail.com>2022-05-21 17:30:19 +0100
commite2ad3b01837e52a55e859412474978fa8a1e9625 (patch)
treec6b76c23c4f2d190b24ef8b930d0c15b0065c486 /launcher/ui/setupwizard/PasteWizardPage.cpp
parentcaf6d027282392a58b935185d787c4c22a861409 (diff)
downloadPrismLauncher-e2ad3b01837e52a55e859412474978fa8a1e9625.tar.gz
PrismLauncher-e2ad3b01837e52a55e859412474978fa8a1e9625.tar.bz2
PrismLauncher-e2ad3b01837e52a55e859412474978fa8a1e9625.zip
Add migration wizard, fix migration from custom paste instance
- Very basic wizard just to allow the user to choose whether to keep their old paste settings or use the new default settings. - People who used custom 0x0 instances would just be kept on those settings and won't see the wizard.
Diffstat (limited to 'launcher/ui/setupwizard/PasteWizardPage.cpp')
-rw-r--r--launcher/ui/setupwizard/PasteWizardPage.cpp42
1 files changed, 42 insertions, 0 deletions
diff --git a/launcher/ui/setupwizard/PasteWizardPage.cpp b/launcher/ui/setupwizard/PasteWizardPage.cpp
new file mode 100644
index 00000000..0f47da4b
--- /dev/null
+++ b/launcher/ui/setupwizard/PasteWizardPage.cpp
@@ -0,0 +1,42 @@
+#include "PasteWizardPage.h"
+#include "ui_PasteWizardPage.h"
+
+#include "Application.h"
+#include "net/PasteUpload.h"
+
+PasteWizardPage::PasteWizardPage(QWidget *parent) :
+ BaseWizardPage(parent),
+ ui(new Ui::PasteWizardPage)
+{
+ ui->setupUi(this);
+}
+
+PasteWizardPage::~PasteWizardPage()
+{
+ delete ui;
+}
+
+void PasteWizardPage::initializePage()
+{
+}
+
+bool PasteWizardPage::validatePage()
+{
+ auto s = APPLICATION->settings();
+ QString prevPasteURL = s->get("PastebinURL").toString();
+ s->reset("PastebinURL");
+ if (ui->previousSettingsRadioButton->isChecked())
+ {
+ bool usingDefaultBase = prevPasteURL == PasteUpload::PasteTypes.at(PasteUpload::PasteType::NullPointer).defaultBase;
+ s->set("PastebinType", PasteUpload::PasteType::NullPointer);
+ if (!usingDefaultBase)
+ s->set("PastebinCustomAPIBase", prevPasteURL);
+ }
+
+ return true;
+}
+
+void PasteWizardPage::retranslate()
+{
+ ui->retranslateUi(this);
+}