Skip to content

Commit

Permalink
added skip bigpicture intro
Browse files Browse the repository at this point in the history
  • Loading branch information
Odizinne committed Nov 8, 2024
1 parent e3d351d commit 000ca15
Show file tree
Hide file tree
Showing 6 changed files with 68 additions and 14 deletions.
4 changes: 4 additions & 0 deletions BigPictureTV/BigPictureTV.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@ void BigPictureTV::checkWindowTitle()
gamemodeActive = true;
handleActions(false);
handleMonitorChanges(false, disable_monitor_switch);
if (skip_intro) {
Utils::skipBigPictureIntro();
}
handleAudioChanges(false, disable_audio_switch);
settings.setValue("gamemode", gamemodeActive);
} else if (!isRunning && gamemodeActive) {
Expand Down Expand Up @@ -201,6 +204,7 @@ void BigPictureTV::loadSettings()
disable_nightlight_action = settings.value("disable_nightlight_action").toBool();
target_window_mode = settings.value("target_window_mode").toInt();
custom_window_title = settings.value("custom_window_title").toString();
skip_intro = settings.value("skip_intro").toBool();
}

void BigPictureTV::showSettings()
Expand Down
3 changes: 1 addition & 2 deletions BigPictureTV/BigPictureTV.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,7 @@ private slots:
bool disable_monitor_switch;
bool disable_nightlight_action;
bool target_window_mode;
bool autodetect_HDMI;
bool autodetect_desktop;
bool skip_intro;
QSettings settings;
bool gamemodeActive;
};
Expand Down
4 changes: 2 additions & 2 deletions Configurator/Configurator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,6 @@ void Configurator::onTargetWindowComboBoxIndexChanged(int index)
}
}



void Configurator::createDefaultSettings()
{
ui->checkrateSpinBox->setValue(1000);
Expand Down Expand Up @@ -135,6 +133,7 @@ void Configurator::loadSettings()
ui->disableMonitorCheckBox->setChecked(settings.value("disable_monitor_switch", false).toBool());
ui->customWindowLineEdit->setText(settings.value("custom_window_title", "").toString());
ui->targetWindowComboBox->setCurrentIndex(settings.value("target_window_mode", 0).toInt());
ui->skipIntroCheckBox->setChecked(settings.value("skip_intro", false).toBool());

toggleAudioSettings(!ui->disableAudioCheckBox->isChecked());
toggleMonitorSettings(!ui->disableMonitorCheckBox->isChecked());
Expand All @@ -161,6 +160,7 @@ void Configurator::saveSettings()
settings.setValue("disable_nightlight_action", ui->disableNightLightCheckBox->isChecked());
settings.setValue("target_window_mode", ui->targetWindowComboBox->currentIndex());
settings.setValue("custom_window_title", ui->customWindowLineEdit->text());
settings.setValue("skip_intro", ui->skipIntroCheckBox->isChecked());
}

void Configurator::toggleAudioSettings(bool state)
Expand Down
43 changes: 33 additions & 10 deletions Configurator/Configurator.ui
Original file line number Diff line number Diff line change
Expand Up @@ -374,20 +374,33 @@
<property name="spacing">
<number>6</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="startupLabel">
<property name="minimumSize">
<size>
<width>0</width>
<height>25</height>
</size>
</property>
<property name="text">
<string>Run at startup</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="disableMonitorLabel">
<widget class="QLabel" name="disableAudioLabel">
<property name="minimumSize">
<size>
<width>0</width>
<height>25</height>
</size>
</property>
<property name="text">
<string>Disable monitor switching</string>
<string>Disable audio switching</string>
</property>
</widget>
</item>
<item row="1" column="1">
<item row="2" column="1">
<widget class="QCheckBox" name="disableAudioCheckBox">
<property name="minimumSize">
<size>
Expand Down Expand Up @@ -419,7 +432,7 @@
</property>
</widget>
</item>
<item row="2" column="1">
<item row="3" column="1">
<widget class="QCheckBox" name="disableMonitorCheckBox">
<property name="minimumSize">
<size>
Expand All @@ -435,29 +448,39 @@
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="disableAudioLabel">
<item row="3" column="0">
<widget class="QLabel" name="disableMonitorLabel">
<property name="minimumSize">
<size>
<width>0</width>
<height>25</height>
</size>
</property>
<property name="text">
<string>Disable audio switching</string>
<string>Disable monitor switching</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="startupLabel">
<item row="1" column="0">
<widget class="QLabel" name="label">
<property name="minimumSize">
<size>
<width>0</width>
<height>25</height>
</size>
</property>
<property name="text">
<string>Run at startup</string>
<string>Skip Big Picture intro</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QCheckBox" name="skipIntroCheckBox">
<property name="layoutDirection">
<enum>Qt::LayoutDirection::RightToLeft</enum>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
Expand Down
27 changes: 27 additions & 0 deletions Utils/Utils.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include "Utils.h"
#include "Windows.h"
#include <QDebug>
#include <QDir>
#include <QFile>
Expand Down Expand Up @@ -169,3 +170,29 @@ void Utils::sendMediaKey(WORD keyCode) {
ip.ki.dwFlags = KEYEVENTF_KEYUP;
SendInput(1, &ip, sizeof(INPUT));
}

void Utils::skipBigPictureIntro() {
// Define the input event for mouse button down and up
INPUT input[2] = {};

// Mouse button down (left click)
input[0].type = INPUT_MOUSE;
input[0].mi.dx = 0; // X coordinate
input[0].mi.dy = 0; // Y coordinate
input[0].mi.mouseData = 0;
input[0].mi.dwFlags = MOUSEEVENTF_LEFTDOWN;
input[0].mi.time = 0;
input[0].mi.dwExtraInfo = 0;

// Mouse button up (release left click)
input[1].type = INPUT_MOUSE;
input[1].mi.dx = 0; // X coordinate
input[1].mi.dy = 0; // Y coordinate
input[1].mi.mouseData = 0;
input[1].mi.dwFlags = MOUSEEVENTF_LEFTUP;
input[1].mi.time = 0;
input[1].mi.dwExtraInfo = 0;

// Send the input events (left down and then left up)
SendInput(2, input, sizeof(INPUT));
}
1 change: 1 addition & 0 deletions Utils/Utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ namespace Utils {
void startDiscord();
void sendMediaKey(WORD keyCode);
void setFrameColorBasedOnWindow(QWidget *window, QFrame *frame);
void skipBigPictureIntro();
}

#endif // UTILS_H

0 comments on commit 000ca15

Please sign in to comment.