Repository: nuttyartist/notes
File: src/updaterwindow.cpp (C++)

Code before:
#elif _WIN32
    QFont fontToUse = QFont(QStringLiteral("Segoe UI")).exactMatch() ? QStringLiteral("Segoe UI")
                                                                     : QStringLiteral("Roboto");
#else
    QFont fontToUse = QFont(QStringLiteral("Roboto"));
#endif

    this->setFont(fontToUse);
    m_ui->changelog->setFont(fontToUse);
    m_ui->changelog->setTextColor(QColor(26, 26, 26));
    foreach (QWidget *widgetChild, this->findChildren<QWidget *>()) {
        widgetChild->setFont(fontToUse);
    }

    /* Connect UI signals/slots */
    connect(m_ui->closeButton, &QPushButton::clicked, this, &UpdaterWindow::close);
    connect(m_ui->updateButton, &QPushButton::clicked, this,
            &UpdaterWindow::onDownloadButtonClicked);
    connect(m_updater, &QSimpleUpdater::checkingFinished, this, &UpdaterWindow::onCheckFinished);
    connect(m_ui->checkBox, &QCheckBox::toggled, this, &UpdaterWindow::dontShowUpdateWindowChanged);

    /* Start the UI loops */
    updateTitleLabel();

    /* Remove window border */
    setWindowFlags(Qt::CustomizeWindowHint);

    /* React when xdg-open finishes (Linux only) */
#ifdef UseXdgOpen
    connect(&XDGOPEN_PROCESS, SIGNAL(finished(int)), this, SLOT(onXdgOpenFinished(int)));
#endif

    /* Set window flags */
    setWindowModality(Qt::ApplicationModal);
}

/**
 * Deletes the user interface
 */
UpdaterWindow::~UpdaterWindow()
{
    /* Ensure that xdg-open process is closed */
#ifdef UseXdgOpen
    if (XDGOPEN_PROCESS.isOpen())
        XDGOPEN_PROCESS.close();
#endif

    /* Delete UI controls */
    delete m_ui;
}


Review comment (suggestion):
I think this may unset some flags, so instead it should probably be:
```suggestion
    setWindowFlags(windowFlags() | Qt::CustomizeWindowHint);
```

Code after:
#elif _WIN32
    QFont fontToUse = QFont(QStringLiteral("Segoe UI")).exactMatch() ? QStringLiteral("Segoe UI")
                                                                     : QStringLiteral("Roboto");
#else
    QFont fontToUse = QFont(QStringLiteral("Roboto"));
#endif

    this->setFont(fontToUse);
    m_ui->changelog->setFont(fontToUse);
    m_ui->changelog->setTextColor(QColor(26, 26, 26));
    foreach (QWidget *widgetChild, this->findChildren<QWidget *>()) {
        widgetChild->setFont(fontToUse);
    }

    /* Connect UI signals/slots */
    connect(m_ui->closeButton, &QPushButton::clicked, this, &UpdaterWindow::close);
    connect(m_ui->updateButton, &QPushButton::clicked, this,
            &UpdaterWindow::onDownloadButtonClicked);
    connect(m_updater, &QSimpleUpdater::checkingFinished, this, &UpdaterWindow::onCheckFinished);
    connect(m_ui->checkBox, &QCheckBox::toggled, this, &UpdaterWindow::dontShowUpdateWindowChanged);

    /* Start the UI loops */
    updateTitleLabel();

    /* Remove window border */
    setWindowFlags(windowFlags() | Qt::CustomizeWindowHint);

    /* React when xdg-open finishes (Linux only) */
#ifdef UseXdgOpen
    connect(&XDGOPEN_PROCESS, SIGNAL(finished(int)), this, SLOT(onXdgOpenFinished(int)));
#endif

    /* Set window flags */
    setWindowModality(Qt::ApplicationModal);
}

/**
 * Deletes the user interface
 */
UpdaterWindow::~UpdaterWindow()
{
    /* Ensure that xdg-open process is closed */
#ifdef UseXdgOpen
    if (XDGOPEN_PROCESS.isOpen())
        XDGOPEN_PROCESS.close();
#endif

    /* Delete UI controls */
    delete m_ui;
}