mirror of
https://gitlab.com/kelteseth/ScreenPlay.git
synced 2024-11-07 03:22:33 +01:00
Fix DefaultVideoControls initial value from ScreenPlayWallpaper
This commit is contained in:
parent
81a62311aa
commit
b05ad7fe65
@ -80,6 +80,12 @@ App::App()
|
||||
qRegisterMetaType<Create*>();
|
||||
qRegisterMetaType<Settings*>();
|
||||
|
||||
qmlRegisterType<ScreenPlayWallpaper>("ScreenPlay", 1, 0, "ScreenPlayWallpaper");
|
||||
qmlRegisterType<ScreenPlayWidget>("ScreenPlay", 1, 0, "ScreenPlayWidget");
|
||||
|
||||
qRegisterMetaType<ScreenPlayWallpaper*>("ScreenPlayWallpaper*");
|
||||
qRegisterMetaType<ScreenPlayWidget*>("ScreenPlayWidget*");
|
||||
|
||||
qRegisterMetaType<InstalledListModel*>();
|
||||
qRegisterMetaType<InstalledListFilter*>();
|
||||
qRegisterMetaType<MonitorListModel*>();
|
||||
@ -118,6 +124,8 @@ App::App()
|
||||
// ScreenPlayManager first to check if another ScreenPlay Instace is running
|
||||
m_screenPlayManager = std::make_unique<ScreenPlayManager>();
|
||||
m_isAnotherScreenPlayInstanceRunning = m_screenPlayManager->isAnotherScreenPlayInstanceRunning();
|
||||
|
||||
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -15,6 +15,17 @@ ColumnLayout {
|
||||
state: "hidden"
|
||||
clip: true
|
||||
|
||||
property ScreenPlayWallpaper wallpaper
|
||||
onWallpaperChanged: {
|
||||
if(!wallpaper)
|
||||
{
|
||||
return
|
||||
}
|
||||
slVolume.slider.value = wallpaper.volume
|
||||
slPlaybackRate.slider.value = wallpaper.playbackRate
|
||||
//slCurrentVideoTime.slider.value = wallpaper.volume
|
||||
}
|
||||
|
||||
function indexOfValue(model, value) {
|
||||
|
||||
for (var i = 0; i < model.length; i++) {
|
||||
@ -28,26 +39,29 @@ ColumnLayout {
|
||||
property int activeMonitorIndex
|
||||
|
||||
SP.Slider {
|
||||
id:slVolume
|
||||
headline: qsTr("Volume")
|
||||
slider.stepSize: 0.1
|
||||
slider.onMoved: {
|
||||
ScreenPlay.screenPlayManager.setWallpaperValueAtMonitorIndex(
|
||||
activeMonitorIndex, "volume", slider.value)
|
||||
activeMonitorIndex, "volume", Number(slider.value).toFixed(1))
|
||||
}
|
||||
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
SP.Slider {
|
||||
id:slPlaybackRate
|
||||
headline: qsTr("Playback rate")
|
||||
slider.onMoved: ScreenPlay.screenPlayManager.setWallpaperValueAtMonitorIndex(
|
||||
activeMonitorIndex, "playbackRate", slider.value)
|
||||
activeMonitorIndex, "playbackRate", Number(slider.value).toFixed(1))
|
||||
Layout.fillWidth: true
|
||||
slider.stepSize: 0.1
|
||||
}
|
||||
SP.Slider {
|
||||
id: slCurrentVideoTime
|
||||
headline: qsTr("Current Video Time")
|
||||
slider.onMoved: ScreenPlay.screenPlayManager.setWallpaperValueAtMonitorIndex(
|
||||
activeMonitorIndex, "currentTime", slider.value)
|
||||
activeMonitorIndex, "currentTime", Number(slider.value).toFixed(1))
|
||||
Layout.fillWidth: true
|
||||
slider.stepSize: 0.1
|
||||
}
|
||||
|
@ -96,6 +96,7 @@ Popup {
|
||||
const wallpaper = ScreenPlay.screenPlayManager.getWallpaperByAppID(
|
||||
appID)
|
||||
print("volume", wallpaper.volume)
|
||||
videoControlWrapper.wallpaper = wallpaper
|
||||
} else {
|
||||
videoControlWrapper.state = "hidden"
|
||||
customPropertiesGridView.visible = true
|
||||
|
@ -313,9 +313,20 @@ 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 QString& value)
|
||||
void ScreenPlayManager::setWallpaperValueAtMonitorIndex(const int index, const QString& key, const QVariant& 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) {
|
||||
// _value = std::floor(_value * 100.0f) / 100.0f;
|
||||
qInfo() << _value;
|
||||
setWallpaperValue(*appID, key, _value);
|
||||
} else
|
||||
qWarning() << "Could not convert " << key << " to float with value " << value;
|
||||
}
|
||||
setWallpaperValue(*appID, key, value);
|
||||
} else {
|
||||
qWarning() << "Could net get appID from m_monitorListModel!";
|
||||
|
@ -123,7 +123,7 @@ public slots:
|
||||
bool removeWallpaperAt(const int index);
|
||||
|
||||
void requestProjectSettingsAtMonitorIndex(const int index);
|
||||
void setWallpaperValueAtMonitorIndex(const int index, const QString& key, const QString& value);
|
||||
void setWallpaperValueAtMonitorIndex(const int index, const QString& key, const QVariant &value);
|
||||
void setAllWallpaperValue(const QString& key, const QString& value);
|
||||
ScreenPlayWallpaper* getWallpaperByAppID(const QString& appID) const;
|
||||
|
||||
|
@ -14,7 +14,6 @@ namespace ScreenPlay {
|
||||
\brief Constructor for video Wallpaper.
|
||||
*/
|
||||
|
||||
|
||||
ScreenPlayWallpaper::ScreenPlayWallpaper(const QVector<int>& screenNumber,
|
||||
const std::shared_ptr<GlobalVariables>& globalVariables,
|
||||
const QString& appID,
|
||||
@ -37,6 +36,7 @@ ScreenPlayWallpaper::ScreenPlayWallpaper(const QVector<int>& screenNumber,
|
||||
, m_appID { appID }
|
||||
, m_absolutePath { absolutePath }
|
||||
, m_file { file }
|
||||
, m_volume { volume }
|
||||
, m_playbackRate { playbackRate }
|
||||
{
|
||||
{
|
||||
|
@ -67,7 +67,7 @@ public:
|
||||
const QString& previewImage, const QJsonObject& properties,
|
||||
const InstalledType::InstalledType type);
|
||||
|
||||
~ScreenPlayWidget() { }
|
||||
ScreenPlayWidget() { }
|
||||
|
||||
QString previewImage() const
|
||||
{
|
||||
@ -158,7 +158,7 @@ signals:
|
||||
void requestSave();
|
||||
|
||||
private:
|
||||
const std::shared_ptr<GlobalVariables>& m_globalVariables;
|
||||
const std::shared_ptr<GlobalVariables> m_globalVariables;
|
||||
std::shared_ptr<SDKConnection> m_connection;
|
||||
ProjectSettingsListModel m_projectSettingsListModel;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user