"Fossies" - the Fresh Open Source Software Archive

Member "cutter-1.10.3/src/dialogs/WelcomeDialog.cpp" (8 May 2020, 2971 Bytes) of package /linux/privat/cutter-1.10.3.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "WelcomeDialog.cpp" see the Fossies "Dox" file reference documentation and the latest Fossies "Diffs" side-by-side code changes report: 1.10.2_vs_1.10.3.

    1 #include "core/MainWindow.h"
    2 #include "CutterConfig.h"
    3 
    4 #include "common/Helpers.h"
    5 #include "WelcomeDialog.h"
    6 #include "AboutDialog.h"
    7 
    8 #include "ui_WelcomeDialog.h"
    9 
   10 /**
   11  * @brief Constructs a WelcomeDialog object
   12  * @param parent
   13  */
   14 WelcomeDialog::WelcomeDialog(QWidget *parent) :
   15     QDialog(parent),
   16     ui(new Ui::WelcomeDialog)
   17 {
   18     ui->setupUi(this);
   19     setWindowFlags(windowFlags() & (~Qt::WindowContextHelpButtonHint));
   20     ui->logoSvgWidget->load(Config()->getLogoFile());
   21     ui->versionLabel->setText("<font color='#a4a9b2'>" + tr("Version ") + CUTTER_VERSION_FULL + "</font>");
   22     ui->themeComboBox->setCurrentIndex(Config()->getInterfaceTheme());
   23 
   24     QSignalBlocker s(ui->updatesCheckBox);
   25     ui->updatesCheckBox->setChecked(Config()->getAutoUpdateEnabled());
   26 
   27     QStringList langs = Config()->getAvailableTranslations();
   28     ui->languageComboBox->addItems(langs);
   29     QString curr = Config()->getCurrLocale().nativeLanguageName();
   30     curr = curr.at(0).toUpper() + curr.right(curr.length() - 1);
   31     if (!langs.contains(curr)) {
   32         curr = "English";
   33     }
   34     ui->languageComboBox->setCurrentText(curr);
   35     connect(ui->languageComboBox,
   36             static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
   37             this,
   38             &WelcomeDialog::onLanguageComboBox_currentIndexChanged);
   39 
   40     Config()->adjustColorThemeDarkness();
   41 }
   42 
   43 /**
   44  * @brief Destroys the WelcomeDialog
   45  */
   46 WelcomeDialog::~WelcomeDialog()
   47 {
   48     delete ui;
   49 }
   50 
   51 /**
   52  * @brief change Cutter's QT Theme as selected by the user
   53  * @param index - a Slot being called after theme's value changes its index
   54  */
   55 void WelcomeDialog::on_themeComboBox_currentIndexChanged(int index)
   56 {
   57     Config()->setInterfaceTheme(index);
   58 
   59     // make sure that Cutter's logo changes its color according to the selected theme
   60     ui->logoSvgWidget->load(Config()->getLogoFile());
   61 }
   62 
   63 /**
   64  * @brief change Cutter's interface language as selected by the user
   65  * @param index - a Slot being called after language combo box value changes its index
   66  */
   67 void WelcomeDialog::onLanguageComboBox_currentIndexChanged(int index)
   68 {
   69     QString language = ui->languageComboBox->itemText(index).toLower();
   70     Config()->setLocaleByName(language);
   71 
   72     QMessageBox mb;
   73     mb.setWindowTitle(tr("Language settings"));
   74     mb.setText(tr("Language will be changed after next application start."));
   75     mb.setIcon(QMessageBox::Information);
   76     mb.setStandardButtons(QMessageBox::Ok);
   77     mb.exec();
   78 }
   79 
   80 /**
   81  * @brief show Cutter's About dialog
   82  */
   83 void WelcomeDialog::on_checkUpdateButton_clicked()
   84 {
   85     AboutDialog *a = new AboutDialog(this);
   86     a->setAttribute(Qt::WA_DeleteOnClose);
   87     a->open();
   88 }
   89 
   90 /**
   91  * @brief accept user preferences, close the window and continue Cutter's execution
   92  */
   93 void WelcomeDialog::on_continueButton_clicked()
   94 {
   95     accept();
   96 }
   97 
   98 void WelcomeDialog::on_updatesCheckBox_stateChanged(int)
   99 {
  100     Config()->setAutoUpdateEnabled(!Config()->getAutoUpdateEnabled());
  101 }