2019-02-22 16:50:45 +00:00
|
|
|
#include "core/MainWindow.h"
|
2019-01-19 20:54:02 +00:00
|
|
|
#include "CutterConfig.h"
|
|
|
|
|
|
|
|
#include "common/Helpers.h"
|
|
|
|
#include "WelcomeDialog.h"
|
|
|
|
#include "AboutDialog.h"
|
|
|
|
|
|
|
|
#include "ui_WelcomeDialog.h"
|
|
|
|
|
2019-03-06 20:30:39 +00:00
|
|
|
/**
|
|
|
|
* @brief Constructs a WelcomeDialog object
|
|
|
|
* @param parent
|
2019-01-19 20:54:02 +00:00
|
|
|
*/
|
|
|
|
WelcomeDialog::WelcomeDialog(QWidget *parent) :
|
|
|
|
QDialog(parent),
|
|
|
|
ui(new Ui::WelcomeDialog)
|
|
|
|
{
|
|
|
|
ui->setupUi(this);
|
2019-01-20 17:00:23 +00:00
|
|
|
setWindowFlag(Qt::WindowContextHelpButtonHint, false);
|
2019-01-19 20:54:02 +00:00
|
|
|
ui->logoSvgWidget->load(Config()->getLogoFile());
|
|
|
|
ui->versionLabel->setText("<font color='#a4a9b2'>" + tr("Version ") + CUTTER_VERSION_FULL + "</font>");
|
2019-05-01 16:15:33 +00:00
|
|
|
ui->themeComboBox->setCurrentIndex(Config()->getInterfaceTheme());
|
2019-03-09 13:11:39 +00:00
|
|
|
|
|
|
|
QSignalBlocker s(ui->updatesCheckBox);
|
|
|
|
ui->updatesCheckBox->setChecked(Config()->getAutoUpdateEnabled());
|
2019-01-19 20:54:02 +00:00
|
|
|
|
|
|
|
QStringList langs = Config()->getAvailableTranslations();
|
|
|
|
ui->languageComboBox->addItems(langs);
|
|
|
|
QString curr = Config()->getCurrLocale().nativeLanguageName();
|
|
|
|
curr = curr.at(0).toUpper() + curr.right(curr.length() - 1);
|
|
|
|
if (!langs.contains(curr)) {
|
|
|
|
curr = "English";
|
|
|
|
}
|
|
|
|
ui->languageComboBox->setCurrentText(curr);
|
|
|
|
connect(ui->languageComboBox,
|
|
|
|
static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
|
|
|
|
this,
|
|
|
|
&WelcomeDialog::onLanguageComboBox_currentIndexChanged);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2019-03-06 20:30:39 +00:00
|
|
|
/**
|
|
|
|
* @brief Destroys the WelcomeDialog
|
2019-01-19 20:54:02 +00:00
|
|
|
*/
|
|
|
|
WelcomeDialog::~WelcomeDialog()
|
|
|
|
{
|
|
|
|
delete ui;
|
|
|
|
}
|
|
|
|
|
2019-03-06 20:30:39 +00:00
|
|
|
/**
|
|
|
|
* @brief change Cutter's QT Theme as selected by the user
|
|
|
|
* @param index - a Slot being called after theme's value changes its index
|
2019-01-19 20:54:02 +00:00
|
|
|
*/
|
|
|
|
void WelcomeDialog::on_themeComboBox_currentIndexChanged(int index)
|
|
|
|
{
|
2019-05-01 16:15:33 +00:00
|
|
|
Config()->setInterfaceTheme(index);
|
2019-01-19 20:54:02 +00:00
|
|
|
|
2019-02-07 20:39:14 +00:00
|
|
|
// use "ayu" as the default color theme for dark interface
|
|
|
|
if (Config()->windowColorIsDark()) {
|
|
|
|
Config()->setColorTheme("ayu");
|
|
|
|
}
|
|
|
|
|
2019-01-19 20:54:02 +00:00
|
|
|
// make sure that Cutter's logo changes its color according to the selected theme
|
|
|
|
ui->logoSvgWidget->load(Config()->getLogoFile());
|
|
|
|
}
|
|
|
|
|
2019-03-06 20:30:39 +00:00
|
|
|
/**
|
|
|
|
* @brief change Cutter's interface language as selected by the user
|
|
|
|
* @param index - a Slot being called after language combo box value changes its index
|
2019-01-19 20:54:02 +00:00
|
|
|
*/
|
|
|
|
void WelcomeDialog::onLanguageComboBox_currentIndexChanged(int index)
|
|
|
|
{
|
|
|
|
QString language = ui->languageComboBox->itemText(index).toLower();
|
|
|
|
Config()->setLocaleByName(language);
|
|
|
|
|
|
|
|
QMessageBox mb;
|
|
|
|
mb.setWindowTitle(tr("Language settings"));
|
|
|
|
mb.setText(tr("Language will be changed after next application start."));
|
|
|
|
mb.setIcon(QMessageBox::Information);
|
|
|
|
mb.setStandardButtons(QMessageBox::Ok);
|
|
|
|
mb.exec();
|
|
|
|
}
|
|
|
|
|
2019-03-06 20:30:39 +00:00
|
|
|
/**
|
|
|
|
* @brief show Cutter's About dialog
|
2019-01-19 20:54:02 +00:00
|
|
|
*/
|
|
|
|
void WelcomeDialog::on_checkUpdateButton_clicked()
|
|
|
|
{
|
|
|
|
AboutDialog *a = new AboutDialog(this);
|
2019-02-06 14:30:29 +00:00
|
|
|
a->setAttribute(Qt::WA_DeleteOnClose);
|
2019-01-19 20:54:02 +00:00
|
|
|
a->open();
|
|
|
|
}
|
|
|
|
|
2019-03-06 20:30:39 +00:00
|
|
|
/**
|
|
|
|
* @brief accept user preferences, close the window and continue Cutter's execution
|
2019-01-19 20:54:02 +00:00
|
|
|
*/
|
|
|
|
void WelcomeDialog::on_continueButton_clicked()
|
|
|
|
{
|
|
|
|
accept();
|
|
|
|
}
|
2019-03-09 13:11:39 +00:00
|
|
|
|
2019-03-11 10:38:36 +00:00
|
|
|
void WelcomeDialog::on_updatesCheckBox_stateChanged(int)
|
2019-03-09 13:11:39 +00:00
|
|
|
{
|
|
|
|
Config()->setAutoUpdateEnabled(!Config()->getAutoUpdateEnabled());
|
|
|
|
}
|