aboutsummaryrefslogtreecommitdiff
path: root/launcher/ui/setupwizard/PasteWizardPage.cpp
blob: 0f47da4b1f661ffbe7ffc2600e7aade5126cc6a5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
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);
}