Skip to content

Commit

Permalink
Added compile option for checking for updates
Browse files Browse the repository at this point in the history
  • Loading branch information
SnazzyPanda committed Jan 13, 2025
1 parent 29d9296 commit fd9913e
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 2 deletions.
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ set(CMAKE_CXX_STANDARD 17)


option(USE_XDG_DIRECTORY "Use XDG directory to store data instead of the working directory" ON)
option(CHECK_FOR_UPDATES "Enables checking for updates from the Github repo" ON)

add_executable(${PROJECT_NAME} main.cpp
third-party/imgui/imconfig.h
Expand Down Expand Up @@ -55,6 +56,10 @@ if(USE_XDG_DIRECTORY)
endif(USE_XDG_DIRECTORY)


if(CHECK_FOR_UPDATES)
target_compile_definitions(${PROJECT_NAME} PUBLIC CHECK_FOR_UPDATES)
endif(CHECK_FOR_UPDATES)


find_package(PkgConfig REQUIRED)

Expand Down
3 changes: 2 additions & 1 deletion Lampray/Menu/lampCustomise.h
Original file line number Diff line number Diff line change
Expand Up @@ -188,11 +188,12 @@ namespace Lamp {
ImGui::DragFloat(lampLang::LS("LAMPRAY_CUSTOM_FONT"), &io.FontGlobalScale, 0.005f, MIN_SCALE, MAX_SCALE, "%.2f",
ImGuiSliderFlags_AlwaysClamp);
}
#ifdef CHECK_FOR_UPDATES
if (ImGui::CollapsingHeader(lampLang::LS("LAMPRAY_UPDATE_RULES"))) {
ImGui::Checkbox(lampLang::LS("LAMPRAY_UPDATE_RULES1")+" (Check_Updates_Startup)",
&lampConfig::getInstance().checkForUpdatesAtStartup);
}

#endif

if (ImGui::CollapsingHeader(lampLang::LS("LAMPRAY_CUSTOM_LANG"))) {
std::vector<std::string> xmlFiles;
Expand Down
3 changes: 2 additions & 1 deletion Lampray/Menu/lampMenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -283,10 +283,11 @@ void Lamp::Core::lampMenu::DefaultMenuBar() {
}



#ifdef CHECK_FOR_UPDATES
if (ImGui::MenuItem(lampLang::LS("LAMPRAY_UPDATE_CHECK"))) {
Lamp::Core::FS::lampUpdate::getInstance().checkForUpdates();
}
#endif

if (ImGui::MenuItem(lampLang::LS("LAMPRAY_CUSTOM"))) {
currentMenu = CUSTOMIZE;
Expand Down
3 changes: 3 additions & 0 deletions main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,9 @@ int main(int, char**)
if(loadedCheckUpdates == "0" || loadedCheckUpdates == "false"){
checkForUpdates = false;
}
#ifdef CHECK_FOR_UPDATES
checkForUpdates = false;
#endif
if(checkForUpdates){
Lamp::Core::FS::lampUpdate::getInstance().checkForUpdates();
}
Expand Down

0 comments on commit fd9913e

Please sign in to comment.