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 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
|
#ifdef PORTABLE_CONFIG
#include "newversiondialog.h"
#include "services/pluginmanager.h"
#include "sqlitestudio.h"
#include "ui_newversiondialog.h"
#include "services/config.h"
#include <QDesktopServices>
#include <QInputDialog>
#include <QUrl>
NewVersionDialog::NewVersionDialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::NewVersionDialog)
{
init();
}
NewVersionDialog::~NewVersionDialog()
{
delete ui;
}
void NewVersionDialog::setUpdate(const QString& version, const QString& url)
{
downloadUrl = url;
ui->versionLabel->setText(version);
}
void NewVersionDialog::init()
{
ui->setupUi(this);
connect(ui->abortButton, SIGNAL(clicked()), this, SLOT(reject()));
connect(ui->updateButton, SIGNAL(clicked()), this, SLOT(downloadUpdates()));
connect(ui->homepageButton, SIGNAL(clicked()), this, SLOT(openHomePage()));
connect(ui->checkOnStartupCheck, &QCheckBox::clicked, [=](bool checked)
{
CFG_CORE.General.CheckUpdatesOnStartup.set(checked);
});
}
void NewVersionDialog::downloadUpdates()
{
QDesktopServices::openUrl(QUrl(downloadUrl));
close();
}
void NewVersionDialog::openHomePage()
{
QDesktopServices::openUrl(QUrl(SQLITESTUDIO->getHomePage()));
close();
}
void NewVersionDialog::showEvent(QShowEvent*)
{
ui->checkOnStartupCheck->setChecked(CFG_CORE.General.CheckUpdatesOnStartup.get());
}
#endif // PORTABLE_CONFIG
|