cutter/src/dialogs/WelcomeDialog.cpp
a1ext 73cf41b81e Translations deployment for MAC & Linux has fixed (#1119)
* Translations load refactoring

* Translations: Added MAC support

* Translations: fixed getting of translation folders

* Fixed code style, documented some methods
2019-01-20 19:00:23 +02:00

94 lines
2.6 KiB
C++

#include "MainWindow.h"
#include "CutterConfig.h"
#include "common/Helpers.h"
#include "WelcomeDialog.h"
#include "AboutDialog.h"
#include "ui_WelcomeDialog.h"
/*!
* \brief Constructs a WelcomeDialog object
* \param parent
*/
WelcomeDialog::WelcomeDialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::WelcomeDialog)
{
ui->setupUi(this);
setWindowFlag(Qt::WindowContextHelpButtonHint, false);
ui->logoSvgWidget->load(Config()->getLogoFile());
ui->versionLabel->setText("<font color='#a4a9b2'>" + tr("Version ") + CUTTER_VERSION_FULL + "</font>");
ui->themeComboBox->setCurrentIndex(Config()->getTheme());
ui->themeComboBox->setFixedWidth(200);
ui->themeComboBox->view()->setFixedWidth(200);
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);
}
/*!
* \brief Destroys the WelcomeDialog
*/
WelcomeDialog::~WelcomeDialog()
{
delete ui;
}
/*!
* \brief change Cutter's QT Theme as selected by the user
* \param index - a Slot being called after theme's value changes its index
*/
void WelcomeDialog::on_themeComboBox_currentIndexChanged(int index)
{
Config()->setTheme(index);
// make sure that Cutter's logo changes its color according to the selected theme
ui->logoSvgWidget->load(Config()->getLogoFile());
}
/*!
* \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
*/
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();
}
/*!
* \brief show Cutter's About dialog
*/
void WelcomeDialog::on_checkUpdateButton_clicked()
{
AboutDialog *a = new AboutDialog(this);
a->open();
}
/*!
* \brief accept user preferences, close the window and continue Cutter's execution
*/
void WelcomeDialog::on_continueButton_clicked()
{
accept();
}