mirror of
https://gitlab.com/kelteseth/ScreenPlay.git
synced 2025-02-01 13:01:47 +01:00
Revert setWallpaperValue from QVaraint to QString
This caused some floating convertion error. Because they get send as a string in the end anyways we just can use string here. I noticed Qt calls function multiple times when using QVariant for every version that fits!
This commit is contained in:
parent
b1362cab4e
commit
b81c513905
@ -313,17 +313,12 @@ void ScreenPlayManager::requestProjectSettingsAtMonitorIndex(const int index)
|
||||
/*!
|
||||
\brief Set a wallpaper \a value at a given \a index and \a key.
|
||||
*/
|
||||
void ScreenPlayManager::setWallpaperValueAtMonitorIndex(const int index, const QString& key, const QVariant& value)
|
||||
void ScreenPlayManager::setWallpaperValueAtMonitorIndex(const int index, const QString& key, const QString& value)
|
||||
{
|
||||
if (auto appID = m_monitorListModel->getAppIDByMonitorIndex(index)) {
|
||||
|
||||
if (key == "volume" || key == "currentTime" || key == "playbackRate") {
|
||||
bool ok = false;
|
||||
float _value = value.toFloat(&ok);
|
||||
if (ok) {
|
||||
setWallpaperValue(*appID, key, _value);
|
||||
} else
|
||||
qWarning() << "Could not convert " << key << " to float with value " << value;
|
||||
setWallpaperValue(*appID, key, value);
|
||||
}
|
||||
setWallpaperValue(*appID, key, value);
|
||||
} else {
|
||||
@ -434,7 +429,7 @@ bool ScreenPlayManager::closeWallpaper(const QString& appID)
|
||||
/*!
|
||||
\brief Sets a given \a value to a given \a key. The \a appID is used to identify the receiver socket.
|
||||
*/
|
||||
void ScreenPlayManager::setWallpaperValue(const QString& appID, const QString& key, const QVariant& value)
|
||||
void ScreenPlayManager::setWallpaperValue(const QString& appID, const QString& key, const QString& value)
|
||||
{
|
||||
for (const auto& wallpaper : qAsConst(m_screenPlayWallpapers)) {
|
||||
if (wallpaper->appID() == appID) {
|
||||
|
@ -124,7 +124,7 @@ public slots:
|
||||
bool removeWallpaperAt(const int index);
|
||||
|
||||
void requestProjectSettingsAtMonitorIndex(const int index);
|
||||
void setWallpaperValueAtMonitorIndex(const int index, const QString& key, const QVariant &value);
|
||||
void setWallpaperValueAtMonitorIndex(const int index, const QString& key, const QString &value);
|
||||
void setAllWallpaperValue(const QString& key, const QString& value);
|
||||
ScreenPlayWallpaper* getWallpaperByAppID(const QString& appID) const;
|
||||
|
||||
@ -133,7 +133,7 @@ public slots:
|
||||
void closeAllWidgets();
|
||||
void closeConntectionByType(const QStringList& list);
|
||||
bool closeWallpaper(const QString& appID);
|
||||
void setWallpaperValue(const QString& appID, const QString& key, const QVariant& value);
|
||||
void setWallpaperValue(const QString& appID, const QString& key, const QString &value);
|
||||
|
||||
void setActiveWallpaperCounter(int activeWallpaperCounter)
|
||||
{
|
||||
|
@ -141,10 +141,10 @@ void ScreenPlayWallpaper::processError(QProcess::ProcessError error)
|
||||
qDebug() << "EX: " << error;
|
||||
}
|
||||
|
||||
void ScreenPlayWallpaper::setWallpaperValue(const QString& key, const QVariant& value, const bool save)
|
||||
void ScreenPlayWallpaper::setWallpaperValue(const QString& key, const QString& value, const bool save)
|
||||
{
|
||||
QJsonObject obj;
|
||||
obj.insert(key, value.toString());
|
||||
obj.insert(key, value);
|
||||
|
||||
if (key == "volume") {
|
||||
setVolume(value.toFloat());
|
||||
@ -153,7 +153,7 @@ void ScreenPlayWallpaper::setWallpaperValue(const QString& key, const QVariant&
|
||||
setPlaybackRate(value.toFloat());
|
||||
}
|
||||
if (key == "fillmode") {
|
||||
setFillMode(QStringToEnum<FillMode::FillMode>(value.toString(), FillMode::FillMode::Cover));
|
||||
setFillMode(QStringToEnum<FillMode::FillMode>(value, FillMode::FillMode::Cover));
|
||||
}
|
||||
|
||||
m_connection->sendMessage(QJsonDocument(obj).toJson(QJsonDocument::Compact));
|
||||
@ -167,7 +167,7 @@ void ScreenPlayWallpaper::setSDKConnection(const std::shared_ptr<SDKConnection>&
|
||||
m_connection = connection;
|
||||
QTimer::singleShot(500, [this]() {
|
||||
if (playbackRate() != 1.0) {
|
||||
setWallpaperValue("playbackRate", playbackRate(), false);
|
||||
setWallpaperValue("playbackRate", QString::number(playbackRate()), false);
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -164,7 +164,7 @@ signals:
|
||||
public slots:
|
||||
void processExit(int exitCode, QProcess::ExitStatus exitStatus);
|
||||
void processError(QProcess::ProcessError error);
|
||||
void setWallpaperValue(const QString& key, const QVariant& value, const bool save = false);
|
||||
void setWallpaperValue(const QString& key, const QString &value, const bool save = false);
|
||||
|
||||
void setScreenNumber(QVector<int> screenNumber)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user