Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/gui/src/ScreenSettingsDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ ScreenSettingsDialog::ScreenSettingsDialog(QWidget *parent, Screen *pScreen, con
m_pCheckBoxXTest->setChecked(m_pScreen->fix(XTest));

m_pLineEditAnchoredKeys->setText(m_pScreen->anchoredKeys());
m_pCheckBoxAnchorMediaKeys->setChecked(m_pScreen->anchorMediaKeys());
}

void ScreenSettingsDialog::accept()
Expand Down Expand Up @@ -125,6 +126,7 @@ void ScreenSettingsDialog::accept()
m_pScreen->setFix(static_cast<int>(XTest), m_pCheckBoxXTest->isChecked());

m_pScreen->setAnchoredKeys(m_pLineEditAnchoredKeys->text());
m_pScreen->setAnchorMediaKeys(m_pCheckBoxAnchorMediaKeys->isChecked());

QDialog::accept();
}
Expand Down
7 changes: 7 additions & 0 deletions src/gui/src/ScreenSettingsDialogBase.ui
Original file line number Diff line number Diff line change
Expand Up @@ -757,6 +757,13 @@ Comma-separated. Use + for combos (e.g. Alt+Tab, Ctrl+A).</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="m_pCheckBoxAnchorMediaKeys">
<property name="text">
<string>Anchor media keys to server (play, stop, next, prev, volume)</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
Expand Down
20 changes: 16 additions & 4 deletions src/lib/gui/config/Screen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ void Screen::loadSettings(QSettingsProxy &settings)
readSettings(settings, fixes(), "fix", 0, static_cast<int>(NumFixes));

setAnchoredKeys(settings.value("anchoredKeys").toString());
setAnchorMediaKeys(settings.value("anchorMediaKeys").toBool());
}

void Screen::saveSettings(QSettingsProxy &settings) const
Expand All @@ -94,6 +95,7 @@ void Screen::saveSettings(QSettingsProxy &settings) const
writeSettings(settings, fixes(), "fix");

settings.setValue("anchoredKeys", anchoredKeys());
settings.setValue("anchorMediaKeys", anchorMediaKeys());
}

QTextStream &Screen::writeScreensSection(QTextStream &outStream) const
Expand All @@ -117,9 +119,18 @@ QTextStream &Screen::writeScreensSection(QTextStream &outStream) const
outStream << "\t\t"
<< "switchCornerSize = " << switchCornerSize() << Qt::endl;

if (!anchoredKeys().isEmpty())
outStream << "\t\t"
<< "anchoredKeys = " << anchoredKeys() << Qt::endl;
{
QString keys = anchoredKeys();
if (anchorMediaKeys()) {
QString media = "MediaPlay, MediaStop, MediaNext, MediaPrev, VolumeMute, VolumeUp, VolumeDown";
if (!keys.isEmpty())
keys += ", " + media;
else
keys = media;
}
if (!keys.isEmpty())
outStream << "\t\t" << "anchoredKeys = " << keys << Qt::endl;
}

return outStream;
}
Expand All @@ -140,6 +151,7 @@ bool Screen::operator==(const Screen &screen) const
{
return m_Name == screen.m_Name && m_Aliases == screen.m_Aliases && m_Modifiers == screen.m_Modifiers &&
m_SwitchCorners == screen.m_SwitchCorners && m_SwitchCornerSize == screen.m_SwitchCornerSize &&
m_Fixes == screen.m_Fixes && m_AnchoredKeys == screen.m_AnchoredKeys && m_Swapped == screen.m_Swapped &&
m_Fixes == screen.m_Fixes && m_AnchoredKeys == screen.m_AnchoredKeys &&
m_AnchorMediaKeys == screen.m_AnchorMediaKeys && m_Swapped == screen.m_Swapped &&
m_isServer == screen.m_isServer;
}
9 changes: 9 additions & 0 deletions src/lib/gui/config/Screen.h
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,14 @@ class Screen : public ScreenConfig
{
m_AnchoredKeys = keys;
}
bool anchorMediaKeys() const
{
return m_AnchorMediaKeys;
}
void setAnchorMediaKeys(bool on)
{
m_AnchorMediaKeys = on;
}

private:
QPixmap m_Pixmap = QPixmap(":res/icons/64x64/video-display.png");
Expand All @@ -190,6 +198,7 @@ class Screen : public ScreenConfig
int m_SwitchCornerSize;
QList<bool> m_Fixes;
QString m_AnchoredKeys;
bool m_AnchorMediaKeys = false;
bool m_Swapped = false;
bool m_isServer = false;
};
Loading