aboutsummaryrefslogtreecommitdiff
path: root/src/qt/settings.cpp
blob: 507e8c8d945b5275b9e9df43d15e9d17b232f370 (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
43
44
#include <QMessageBox>
#include <iostream>

#include "workers.hpp"
#include "settings.hpp"
#include "./ui_settings.h"

Settings::Settings(Worker* pworker, QWidget *parent)
    : QDialog(parent)
    , ui(new Ui::Settings)
{
    this->worker = pworker;
    ui->setupUi(this);

    connect(ui->buttonBox, SIGNAL(accepted()), this, SLOT(applySettings()));
    connect(ui->verifyButton, SIGNAL(clicked()), this, SLOT(verify()));
    connect(this, &Settings::workerOperate, worker, &Worker::doWork);
}

void Settings::refresh()
{
    ui->serverEdit->setText(this->worker->getRemote());

    ui->revisionLabel->setText(QString("%1").arg(this->worker->getRevision()));
    ui->installLabel->setText(this->worker->getOfDir());
}

void Settings::applySettings()
{
    worker->setRemote(ui->serverEdit->text());
    this->hide();
}

void Settings::verify()
{
    workerOperate(Worker::TASK_INSTALL);
    QMessageBox::information(this, windowTitle(), "Verification Started" );
}

Settings::~Settings()
{
    delete ui;
}