Apply settings before saving style, otherwise unapplied settings are not written to qml file

Currently, in the raster layer properties, when selecting "Save Style", unapplied settings are not written to the qml file. This can potentially confuse users, but even worse, it resets the transparent pixel list to the previously applied state (due to  `QgsRasterLayerProperties::on_pbnSaveStyleAs_clicked` which calls `QgsRasterLayerProperties::sync` which calls `QgsRasterLayerProperties::setupTransparencyTable` and `QgsRasterLayerProperties::populateTransparencyTable`), which means that the user is potentially losing the entered list.

This solution is somewhat ugly, since users might potentially want to save settings without applying them. However, it is also how the issue was solved in the vector layer properties.

Funded by Sourcepole QGIS Enterprise.