aboutsummaryrefslogtreecommitdiff
path: root/launcher
diff options
context:
space:
mode:
Diffstat (limited to 'launcher')
-rw-r--r--launcher/Application.cpp31
-rw-r--r--launcher/CMakeLists.txt3
-rw-r--r--launcher/ui/setupwizard/PasteWizardPage.cpp42
-rw-r--r--launcher/ui/setupwizard/PasteWizardPage.h27
-rw-r--r--launcher/ui/setupwizard/PasteWizardPage.ui80
5 files changed, 169 insertions, 14 deletions
diff --git a/launcher/Application.cpp b/launcher/Application.cpp
index 40c6e760..438c7d61 100644
--- a/launcher/Application.cpp
+++ b/launcher/Application.cpp
@@ -63,6 +63,7 @@
#include "ui/setupwizard/SetupWizard.h"
#include "ui/setupwizard/LanguageWizardPage.h"
#include "ui/setupwizard/JavaWizardPage.h"
+#include "ui/setupwizard/PasteWizardPage.h"
#include "ui/dialogs/CustomMessageBox.h"
@@ -676,21 +677,17 @@ Application::Application(int &argc, char **argv) : QApplication(argc, argv)
// HACK: This code feels so stupid is there a less stupid way of doing this?
{
m_settings->registerSetting("PastebinURL", "");
- QString pastebinURL = m_settings->get("PastebinURL").toString();
+ m_settings->registerSetting("PastebinType", PasteUpload::PasteType::Mclogs);
+ m_settings->registerSetting("PastebinCustomAPIBase", "");
- // If PastebinURL hasn't been set before then use the new default: mclo.gs
- if (pastebinURL == "") {
- m_settings->registerSetting("PastebinType", PasteUpload::PasteType::Mclogs);
- m_settings->registerSetting("PastebinCustomAPIBase", "");
- }
- // Otherwise: use 0x0.st
- else {
- // The default custom endpoint would usually be "" (meaning there is no custom endpoint specified)
- // But if the user had customised the paste URL then that should be carried over into the custom endpoint.
- QString defaultCustomEndpoint = (pastebinURL == "https://0x0.st") ? "" : pastebinURL;
- m_settings->registerSetting("PastebinType", PasteUpload::PasteType::NullPointer);
- m_settings->registerSetting("PastebinCustomAPIBase", defaultCustomEndpoint);
+ QString pastebinURL = m_settings->get("PastebinURL").toString();
+ bool userHadNoPastebin = pastebinURL == "";
+ bool userHadDefaultPastebin = pastebinURL == "https://0x0.st";
+ if (!(userHadNoPastebin || userHadDefaultPastebin))
+ {
+ m_settings->set("PastebinType", PasteUpload::PasteType::NullPointer);
+ m_settings->set("PastebinCustomAPIBase", pastebinURL);
m_settings->reset("PastebinURL");
}
@@ -929,7 +926,8 @@ bool Application::createSetupWizard()
return true;
return false;
}();
- bool wizardRequired = javaRequired || languageRequired;
+ bool pasteInterventionRequired = settings()->get("PastebinURL") != "";
+ bool wizardRequired = javaRequired || languageRequired || pasteInterventionRequired;
if(wizardRequired)
{
@@ -943,6 +941,11 @@ bool Application::createSetupWizard()
{
m_setupWizard->addPage(new JavaWizardPage(m_setupWizard));
}
+
+ if (pasteInterventionRequired)
+ {
+ m_setupWizard->addPage(new PasteWizardPage(m_setupWizard));
+ }
connect(m_setupWizard, &QDialog::finished, this, &Application::setupWizardFinished);
m_setupWizard->show();
return true;
diff --git a/launcher/CMakeLists.txt b/launcher/CMakeLists.txt
index 8e75be20..15534c71 100644
--- a/launcher/CMakeLists.txt
+++ b/launcher/CMakeLists.txt
@@ -661,6 +661,8 @@ SET(LAUNCHER_SOURCES
ui/setupwizard/JavaWizardPage.h
ui/setupwizard/LanguageWizardPage.cpp
ui/setupwizard/LanguageWizardPage.h
+ ui/setupwizard/PasteWizardPage.cpp
+ ui/setupwizard/PasteWizardPage.h
# GUI - themes
ui/themes/FusionTheme.cpp
@@ -890,6 +892,7 @@ SET(LAUNCHER_SOURCES
)
qt5_wrap_ui(LAUNCHER_UI
+ ui/setupwizard/PasteWizardPage.ui
ui/pages/global/AccountListPage.ui
ui/pages/global/JavaPage.ui
ui/pages/global/LauncherPage.ui
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);
+}
diff --git a/launcher/ui/setupwizard/PasteWizardPage.h b/launcher/ui/setupwizard/PasteWizardPage.h
new file mode 100644
index 00000000..513a14cb
--- /dev/null
+++ b/launcher/ui/setupwizard/PasteWizardPage.h
@@ -0,0 +1,27 @@
+#ifndef PASTEDEFAULTSCONFIRMATIONWIZARD_H
+#define PASTEDEFAULTSCONFIRMATIONWIZARD_H
+
+#include <QWidget>
+#include "BaseWizardPage.h"
+
+namespace Ui {
+class PasteWizardPage;
+}
+
+class PasteWizardPage : public BaseWizardPage
+{
+ Q_OBJECT
+
+public:
+ explicit PasteWizardPage(QWidget *parent = nullptr);
+ ~PasteWizardPage();
+
+ void initializePage() override;
+ bool validatePage() override;
+ void retranslate() override;
+
+private:
+ Ui::PasteWizardPage *ui;
+};
+
+#endif // PASTEDEFAULTSCONFIRMATIONWIZARD_H
diff --git a/launcher/ui/setupwizard/PasteWizardPage.ui b/launcher/ui/setupwizard/PasteWizardPage.ui
new file mode 100644
index 00000000..247d3a75
--- /dev/null
+++ b/launcher/ui/setupwizard/PasteWizardPage.ui
@@ -0,0 +1,80 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>PasteWizardPage</class>
+ <widget class="QWidget" name="PasteWizardPage">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>400</width>
+ <height>300</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Form</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <widget class="QLabel" name="label">
+ <property name="text">
+ <string>The default paste service has changed to mclo.gs, please choose what you want to do with your settings.</string>
+ </property>
+ <property name="wordWrap">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="Line" name="line">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QRadioButton" name="defaultSettingsRadioButton">
+ <property name="text">
+ <string>Use new default service</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ <attribute name="buttonGroup">
+ <string notr="true">buttonGroup</string>
+ </attribute>
+ </widget>
+ </item>
+ <item>
+ <widget class="QRadioButton" name="previousSettingsRadioButton">
+ <property name="text">
+ <string>Keep previous settings</string>
+ </property>
+ <property name="checked">
+ <bool>false</bool>
+ </property>
+ <attribute name="buttonGroup">
+ <string notr="true">buttonGroup</string>
+ </attribute>
+ </widget>
+ </item>
+ <item>
+ <spacer name="verticalSpacer">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>156</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections/>
+ <buttongroups>
+ <buttongroup name="buttonGroup"/>
+ </buttongroups>
+</ui>