1
0
mirror of https://gitlab.com/kelteseth/ScreenPlay.git synced 2024-09-14 22:42:34 +02:00

Fix setting video scaling by no longer using ui text value...

This makes no sense because we do not want translated text.
Add seperate function because QML only has int values for
c++ enum classes and conversion function are c++ only.
This commit is contained in:
Elias Steurer 2021-12-18 12:42:08 +01:00
parent 5fba1df486
commit 9133455199
3 changed files with 18 additions and 1 deletions

View File

@ -114,7 +114,7 @@ ColumnLayout {
"text": qsTr("Scale_Down")
}]
onActivated: {
ScreenPlay.screenPlayManager.setWallpaperValueAtMonitorIndex(activeMonitorIndex, "fillmode", settingsComboBox.currentText);
ScreenPlay.screenPlayManager.setWallpaperFillModeAtMonitorIndex(activeMonitorIndex,settingsComboBox.currentValue);
}
}

View File

@ -335,6 +335,22 @@ bool ScreenPlayManager::setWallpaperValueAtMonitorIndex(const int index, const Q
return false;
}
/*!
\brief Set a wallpaper \a fillmode at a given \a index and converts the qml enum (int)
into the c++ enum class value.
*/
bool ScreenPlayManager::setWallpaperFillModeAtMonitorIndex(const int index, const int fillmode)
{
const auto fillModeTyped = static_cast<FillMode::FillMode>(fillmode);
if (auto appID = m_monitorListModel->getAppIDByMonitorIndex(index)) {
return setWallpaperValue(*appID, "fillmode", QVariant::fromValue<FillMode::FillMode>(fillModeTyped).toString());
}
qWarning() << "Could net get appID from m_monitorListModel!";
return false;
}
/*!
\brief Convenient function to set a \a value at a given \a index and \a key for all wallaper. For exmaple used to mute all wallpaper.
*/

View File

@ -116,6 +116,7 @@ public slots:
bool requestProjectSettingsAtMonitorIndex(const int index);
bool setWallpaperValueAtMonitorIndex(const int index, const QString& key, const QString& value);
bool setWallpaperFillModeAtMonitorIndex(const int index, const int fillmode);
bool setAllWallpaperValue(const QString& key, const QString& value);
bool setWallpaperValue(const QString& appID, const QString& key, const QString& value);
ScreenPlayWallpaper* getWallpaperByAppID(const QString& appID) const;