1
0
mirror of https://gitlab.com/kelteseth/ScreenPlay.git synced 2024-10-07 01:37:08 +02:00

Add basic and not working check if user is ingame

This commit is contained in:
kelteseth 2018-02-23 12:34:10 +01:00
parent c906fd3009
commit 6e1a26c55e
3 changed files with 76 additions and 25 deletions

View File

@ -38,7 +38,7 @@ Item {
anchors {
top: parent.top
topMargin: 20
bottom:parent.bottom
bottom: parent.bottom
bottomMargin: 20
horizontalCenter: parent.horizontalCenter
}
@ -124,6 +124,19 @@ Item {
}
SettingsHorizontalSeperator {
}
SettingBool {
headline: qsTr("Send anonymous crash reports and statistics")
description: qsTr("Help us make ScreenPlay faster and more stable. All collected data is purely anonymous and only used for development purposes!")
isChecked: screenPlaySettings.sendStatistics
onCheckboxChanged: {
screenPlaySettings.setSendStatistics(checked)
screenPlaySettings.writeSingleSettingConfig(
"sendStatistics", checked)
}
}
SettingsHorizontalSeperator {
}
SettingsButton {
headline: qsTr("Set save location")
description: screenPlaySettings.localStoragePath //qsTr("Choose where to find you content. The default save location is you steam installation")
@ -139,24 +152,13 @@ Item {
}
}
}
SettingsHorizontalSeperator {
}
SettingBool {
headline: qsTr("Send anonymous crash reports and statistics")
description: qsTr("Help us make ScreenPlay faster and more stable. All collected data is purely anonymous and only used for development purposes!")
isChecked: screenPlaySettings.sendStatistics
onCheckboxChanged: {
screenPlaySettings.setSendStatistics(checked)
screenPlaySettings.writeSingleSettingConfig("sendStatistics",checked)
}
}
}
}
}
Item {
id: settingsPerformanceWrapper
height: 220
height: 300
width: parent.width
RectangularGlow {
@ -201,6 +203,18 @@ Item {
}
spacing: 10
SettingBool {
headline: qsTr("Pause wallpaper when ingame")
description: qsTr("To maximise your framerates ingame, you can enable this setting to pause all active wallpapers!")
isChecked: screenPlaySettings.pauseWallpaperWhenIngame
onCheckboxChanged: {
screenPlaySettings.setPauseWallpaperWhenIngame(checked)
screenPlaySettings.writeSingleSettingConfig("setPauseWallpaperWhenIngame",checked)
}
}
SettingsHorizontalSeperator {
}
SettingsComboBox {
id: settingsComboBox
headline: qsTr("Default decoder")
@ -330,13 +344,13 @@ Item {
horizontalAlignment: Text.AlignLeft
font.pixelSize: 14
font.family: "Roboto"
width: parent.width *.6
anchors{
top:txtHeadline.bottom
width: parent.width * .6
anchors {
top: txtHeadline.bottom
topMargin: 6
left:parent.left
left: parent.left
leftMargin: 20
right:imgLogoHead.left
right: imgLogoHead.left
rightMargin: 20
bottom: parent.bottom
}
@ -346,13 +360,12 @@ Item {
source: "qrc:/assets/icons/icon_logo_head.svg"
width: 150
height: 150
sourceSize: Qt.size(150,150)
anchors{
top:txtHeadline.bottom
sourceSize: Qt.size(150, 150)
anchors {
top: txtHeadline.bottom
topMargin: -10
right:parent.right
right: parent.right
rightMargin: 20
}
}
}
@ -366,7 +379,6 @@ Item {
}
}
}
}
}

View File

@ -79,6 +79,11 @@ Settings::Settings(ProfileListModel* plm, MonitorListModel* mlm, InstalledListMo
m_highPriorityStart = configObj.value("highPriorityStart").toBool();
m_sendStatistics = configObj.value("sendStatistics").toBool();
int renderer = static_cast<int>(configObj.value("renderer-value").toInt());
m_checkForOtherFullscreenApplicationTimer = new QTimer(this);
QObject::connect(&m_checkForOtherFullscreenApplicationTimer, &QTimer::timeout, this, &Settings::checkForOtherFullscreenApplication);
timer.start(1500);
}
Settings::~Settings()
@ -323,6 +328,20 @@ void Settings::setScreenPlayWindowPath(const QUrl& screenPlayWindowPath)
m_screenPlayWindowPath = screenPlayWindowPath;
}
void Settings::checkForOtherFullscreenApplication()
{
Wnd = GetForegroundWindow();
RECT appBounds;
RECT rc;
GetWindowRect(GetDesktopWindow(), &rc);
if(hWnd =! GetDesktopWindow() && hWnd != GetShellWindow())
{
GetWindowRect(hWnd, &appBounds);
} else {
}
}
ActiveProfiles::ActiveProfiles()
{
}

View File

@ -44,6 +44,7 @@ public:
Q_PROPERTY(bool autostart READ autostart WRITE setAutostart NOTIFY autostartChanged)
Q_PROPERTY(bool highPriorityStart READ highPriorityStart WRITE setHighPriorityStart NOTIFY highPriorityStartChanged)
Q_PROPERTY(bool sendStatistics READ sendStatistics WRITE setSendStatistics NOTIFY sendStatisticsChanged)
Q_PROPERTY(bool pauseWallpaperWhenIngame READ pauseWallpaperWhenIngame WRITE setPauseWallpaperWhenIngame NOTIFY pauseWallpaperWhenIngameChanged)
Q_PROPERTY(QUrl localStoragePath READ localStoragePath WRITE setLocalStoragePath NOTIFY localStoragePathChanged)
Q_PROPERTY(QString decoder READ decoder WRITE setDecoder NOTIFY decoderChanged)
Q_PROPERTY(int activeWallpaperCounter READ activeWallpaperCounter WRITE setActiveWallpaperCounter NOTIFY activeWallpaperCounterChanged)
@ -113,6 +114,11 @@ public:
QUrl getScreenPlayWindowPath() const;
void setScreenPlayWindowPath(const QUrl &screenPlayWindowPath);
bool pauseWallpaperWhenIngame() const
{
return m_pauseWallpaperWhenIngame;
}
signals:
void autostartChanged(bool autostart);
void highPriorityStartChanged(bool highPriorityStart);
@ -123,8 +129,12 @@ signals:
void setMainWindowVisible(bool visible);
void activeWallpaperCounterChanged(int activeWallpaperCounter);
void pauseWallpaperWhenIngameChanged(bool pauseWallpaperWhenIngame);
public slots:
void checkForOtherFullscreenApplication();
void destroyWallpaper(QObject *ref);
//Global settings
@ -256,6 +266,15 @@ public slots:
emit activeWallpaperCounterChanged(m_activeWallpaperCounter);
}
void setPauseWallpaperWhenIngame(bool pauseWallpaperWhenIngame)
{
if (m_pauseWallpaperWhenIngame == pauseWallpaperWhenIngame)
return;
m_pauseWallpaperWhenIngame = pauseWallpaperWhenIngame;
emit pauseWallpaperWhenIngameChanged(m_pauseWallpaperWhenIngame);
}
private:
void createDefaultConfig();
void createProfileConfig();
@ -272,7 +291,7 @@ private:
MonitorListModel* m_mlm;
SDKConnector* m_sdkc;
QThread m_thread;
QTimer* m_checkForOtherFullscreenApplicationTimer;
QVector<QSharedPointer<Wallpaper>> m_wallpapers;
QVector<QProcess*> m_widgets;
@ -285,6 +304,7 @@ private:
bool m_hasWorkshopBannerSeen = false;
QString m_decoder;
int m_activeWallpaperCounter = 0;
bool m_pauseWallpaperWhenIngame = true;
};
class ActiveProfiles {