Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Attempt to update #19

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
80 changes: 47 additions & 33 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,54 +1,68 @@
project(sc2switcher3)
include_directories(${OBS_JANSSON_INCLUDE_DIRS})

set(sc2switcher3_HEADERS
${sc2switcher3_HEADERS}
SC2Data.h
add_library(sc2switcher3 MODULE)
add_library(OBS::sc2switcher3 ALIAS sc2switcher3)

find_qt(COMPONENTS Widgets)
find_package(CURL REQUIRED)

set_target_properties(
sc2switcher3
PROPERTIES AUTOMOC ON
AUTOUIC ON
AUTORCC ON
AUTOUIC_SEARCH_PATHS "forms")

target_sources(sc2switcher3 PRIVATE forms/SettingsDialog.ui)

target_sources(
sc2switcher3
PRIVATE
SC2Data.h
Observer.h
SC2State.h
Constants.h
SceneSwitcher.h
ScoreTracker.h
Webhook.h
Config.h
forms/SettingsDialog.h
SettingsDialog.h
log.h
)
set(sc2switcher3_SOURCES
${sc2switcher3_SOURCES}
sc2switcher.cpp
sc2switcher.cpp
SC2Data.cpp
SC2State.cpp
SceneSwitcher.cpp
ScoreTracker.cpp
Webhook.cpp
Config.cpp
forms/SettingsDialog.cpp
)
set(sc2switcher3_UI
${sc2switcher3_UI}
SettingsDialog.cpp
forms/SettingsDialog.ui
)
set(sc2switcher3_PLATFORM_LIBS
${OBS_JANSSON_IMPORT}
)

qt5_wrap_ui(sc2switcher3_UI_HEADERS
${sc2switcher3_UI}
${sc2switcher3_PLATFORM_UI})

add_library(sc2switcher3 MODULE
${sc2switcher3_HEADERS}
${sc2switcher3_SOURCES}
${sc2switcher3_UI_HEADERS}
${sc2switcher3_PLATFORM_SOURCES}
${sc2switcher3_PLATFORM_HEADERS}
)
)

target_link_libraries(sc2switcher3
${sc2switcher3_PLATFORM_LIBS}
obs-frontend-api
Qt5::Widgets
${LIBCURL_LIBRARIES}
jansson
Qt::Widgets
CURL::libcurl
libobs)

install_obs_plugin(sc2switcher3)

set(MODULE_DESCRIPTION "OBS SC2 Switcher UI")
configure_file(${CMAKE_SOURCE_DIR}/cmake/bundle/windows/obs-module.rc.in
sc2switcher3.rc)
target_sources(sc2switcher3 PRIVATE sc2switcher3.rc)


get_target_property(_SOURCES sc2switcher3 SOURCES)
set(_UI ${_SOURCES})
list(FILTER _UI INCLUDE REGEX ".*\\.ui?")

source_group(
TREE "${CMAKE_CURRENT_SOURCE_DIR}/forms"
PREFIX "UI Files"
FILES ${_UI})
unset(_SOURCES)
unset(_UI)

setup_plugin_target(sc2switcher3)

2 changes: 1 addition & 1 deletion Config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ void Config::checkForUpdates() {
json_t* url = json_object_get(root, "tag_name");
const char *urlText = json_string_value(url);
float latestVer = std::stof(urlText);
float currentVer = 0.98;
float currentVer = static_cast<float>(0.98);
if(latestVer > currentVer) {
json_t* url2 = json_object_get(root, "html_url");
const char *urlText2 = json_string_value(url2);
Expand Down
6 changes: 3 additions & 3 deletions forms/SettingsDialog.cpp → SettingsDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -396,15 +396,15 @@ void SettingsDialog::on_removeUsernameButton_clicked() {

void SettingsDialog::on_userNames_itemSelectionChanged() {
if(!isLoading) {
if (ui->userNames->currentItem() != NULL && ui->userNames->currentItem()->text() != NULL) {
if (ui->userNames->currentItem() != NULL && ui->userNames->currentItem()->text().isNull() == false ) {
ui->usernameLine->setText(ui->userNames->currentItem()->text());
}
}
}

void SettingsDialog::on_recentUsernames_itemSelectionChanged() {
if(!isLoading) {
if (ui->recentUsernames->currentItem() != NULL && ui->recentUsernames->currentItem()->text() != NULL) {
if (ui->recentUsernames->currentItem() != NULL && ui->recentUsernames->currentItem()->text().isNull() == false) {
ui->usernameLine->setText(ui->recentUsernames->currentItem()->text());
}
}
Expand Down Expand Up @@ -656,7 +656,7 @@ void SettingsDialog::on_removeURLButton_clicked() {

void SettingsDialog::on_webhookURLList_itemSelectionChanged() {
if(!isLoading) {
if (ui->webhookURLList->currentItem() != NULL && ui->webhookURLList->currentItem()->text() != NULL) {
if (ui->webhookURLList->currentItem() != NULL && ui->webhookURLList->currentItem()->text().isNull() == false) {
ui->webhookEnterGame->setText(ui->webhookURLList->currentItem()->text());
}
}
Expand Down
2 changes: 1 addition & 1 deletion forms/SettingsDialog.h → SettingsDialog.h
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,4 @@ class SettingsDialog : public QDialog
private:
Ui::SettingsDialog* ui;
bool isLoading = false;
};
};
35 changes: 17 additions & 18 deletions forms/SettingsDialog.ui
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>590</width>
<width>640</width>
<height>419</height>
</rect>
</property>
Expand All @@ -18,12 +18,12 @@
<rect>
<x>0</x>
<y>0</y>
<width>591</width>
<width>641</width>
<height>421</height>
</rect>
</property>
<property name="currentIndex">
<number>0</number>
<number>5</number>
</property>
<widget class="QWidget" name="tab_2">
<attribute name="title">
Expand All @@ -32,7 +32,7 @@
<widget class="QWidget" name="verticalLayoutWidget">
<property name="geometry">
<rect>
<x>40</x>
<x>60</x>
<y>40</y>
<width>511</width>
<height>331</height>
Expand Down Expand Up @@ -78,7 +78,6 @@
<widget class="QLabel" name="label_3">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
Expand Down Expand Up @@ -163,7 +162,7 @@
<widget class="QWidget" name="layoutWidget">
<property name="geometry">
<rect>
<x>40</x>
<x>70</x>
<y>150</y>
<width>501</width>
<height>171</height>
Expand Down Expand Up @@ -207,7 +206,7 @@
<widget class="QWidget" name="layoutWidget">
<property name="geometry">
<rect>
<x>140</x>
<x>170</x>
<y>20</y>
<width>301</width>
<height>100</height>
Expand Down Expand Up @@ -252,7 +251,7 @@
<widget class="QWidget" name="layoutWidget">
<property name="geometry">
<rect>
<x>30</x>
<x>60</x>
<y>30</y>
<width>521</width>
<height>301</height>
Expand Down Expand Up @@ -362,7 +361,7 @@
<widget class="QWidget" name="layoutWidget">
<property name="geometry">
<rect>
<x>20</x>
<x>50</x>
<y>10</y>
<width>251</width>
<height>351</height>
Expand Down Expand Up @@ -424,7 +423,7 @@
<widget class="QWidget" name="layoutWidget">
<property name="geometry">
<rect>
<x>310</x>
<x>340</x>
<y>10</y>
<width>241</width>
<height>351</height>
Expand Down Expand Up @@ -491,7 +490,7 @@
<widget class="QWidget" name="layoutWidget">
<property name="geometry">
<rect>
<x>270</x>
<x>300</x>
<y>20</y>
<width>261</width>
<height>151</height>
Expand Down Expand Up @@ -524,7 +523,7 @@
<widget class="QWidget" name="layoutWidget">
<property name="geometry">
<rect>
<x>50</x>
<x>80</x>
<y>20</y>
<width>191</width>
<height>116</height>
Expand Down Expand Up @@ -564,7 +563,7 @@
<widget class="QLabel" name="scoresLabel">
<property name="geometry">
<rect>
<x>380</x>
<x>410</x>
<y>200</y>
<width>141</width>
<height>151</height>
Expand All @@ -580,7 +579,7 @@
<widget class="QWidget" name="horizontalLayoutWidget_3">
<property name="geometry">
<rect>
<x>20</x>
<x>50</x>
<y>200</y>
<width>321</width>
<height>175</height>
Expand Down Expand Up @@ -879,7 +878,7 @@
<widget class="QCheckBox" name="webhookEnabled">
<property name="geometry">
<rect>
<x>70</x>
<x>100</x>
<y>30</y>
<width>191</width>
<height>22</height>
Expand All @@ -892,7 +891,7 @@
<widget class="QWidget" name="horizontalLayoutWidget_8">
<property name="geometry">
<rect>
<x>70</x>
<x>100</x>
<y>60</y>
<width>431</width>
<height>41</height>
Expand Down Expand Up @@ -922,7 +921,7 @@
<widget class="QWidget" name="verticalLayoutWidget_3">
<property name="geometry">
<rect>
<x>70</x>
<x>100</x>
<y>150</y>
<width>431</width>
<height>221</height>
Expand All @@ -944,7 +943,7 @@
<widget class="QWidget" name="horizontalLayoutWidget">
<property name="geometry">
<rect>
<x>140</x>
<x>170</x>
<y>110</y>
<width>271</width>
<height>36</height>
Expand Down
2 changes: 1 addition & 1 deletion sc2switcher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include "SceneSwitcher.h"
#include "ScoreTracker.h"
#include "Webhook.h"
#include "forms/SettingsDialog.h"
#include "SettingsDialog.h"

OBS_DECLARE_MODULE()

Expand Down