🔨 Automatically generate resources files with cmake (#4159)

Co-authored-by: pajlada <rasmus.karlsson@pajlada.com>
Fixes https://github.com/Chatterino/chatterino2/issues/3949
This commit is contained in:
Edgar
2022-11-19 12:29:12 +01:00
committed by GitHub
parent 2f4272cc2a
commit 9f5477c433
14 changed files with 134 additions and 425 deletions
+5 -6
View File
@@ -537,11 +537,7 @@ set(SOURCE_FILES
widgets/splits/SplitOverlay.cpp
widgets/splits/SplitOverlay.hpp
autogenerated/ResourcesAutogen.cpp
autogenerated/ResourcesAutogen.hpp
${CMAKE_SOURCE_DIR}/resources/resources.qrc
${CMAKE_SOURCE_DIR}/resources/resources_autogenerated.qrc
)
if (WIN32)
@@ -559,6 +555,9 @@ endif ()
# Generate source groups for use in IDEs
source_group(TREE ${CMAKE_SOURCE_DIR} FILES ${SOURCE_FILES})
# Add autogenerated files
list(APPEND SOURCE_FILES ${RES_AUTOGEN_FILES})
add_library(${LIBRARY_PROJECT} OBJECT ${SOURCE_FILES})
if (CHATTERINO_GENERATE_COVERAGE)
@@ -616,7 +615,7 @@ if (BUILD_APP)
endif()
add_sanitizers(${EXECUTABLE_PROJECT})
target_include_directories(${EXECUTABLE_PROJECT} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
target_include_directories(${EXECUTABLE_PROJECT} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_BINARY_DIR}/autogen/)
target_link_libraries(${EXECUTABLE_PROJECT} PUBLIC ${LIBRARY_PROJECT})
@@ -740,7 +739,7 @@ if (APPLE AND BUILD_APP)
)
endif ()
target_include_directories(${LIBRARY_PROJECT} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
target_include_directories(${LIBRARY_PROJECT} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_BINARY_DIR}/autogen/)
if (WinToast_FOUND)
target_link_libraries(${LIBRARY_PROJECT}
-80
View File
@@ -1,80 +0,0 @@
#include "ResourcesAutogen.hpp"
namespace chatterino {
Resources2::Resources2()
{
this->avatars._1xelerate = QPixmap(":/avatars/_1xelerate.png");
this->avatars.alazymeme = QPixmap(":/avatars/alazymeme.png");
this->avatars.brian6932 = QPixmap(":/avatars/brian6932.png");
this->avatars.explooosion_code = QPixmap(":/avatars/explooosion_code.png");
this->avatars.fourtf = QPixmap(":/avatars/fourtf.png");
this->avatars.hicupalot = QPixmap(":/avatars/hicupalot.png");
this->avatars.iprodigy = QPixmap(":/avatars/iprodigy.png");
this->avatars.jaxkey = QPixmap(":/avatars/jaxkey.png");
this->avatars.kararty = QPixmap(":/avatars/kararty.png");
this->avatars.karlpolice = QPixmap(":/avatars/karlpolice.png");
this->avatars.mm2pl = QPixmap(":/avatars/mm2pl.png");
this->avatars.mohad12211 = QPixmap(":/avatars/mohad12211.png");
this->avatars.pajlada = QPixmap(":/avatars/pajlada.png");
this->avatars.slch = QPixmap(":/avatars/slch.png");
this->avatars.xheaveny = QPixmap(":/avatars/xheaveny.png");
this->avatars.zneix = QPixmap(":/avatars/zneix.png");
this->buttons.addSplit = QPixmap(":/buttons/addSplit.png");
this->buttons.addSplitDark = QPixmap(":/buttons/addSplitDark.png");
this->buttons.ban = QPixmap(":/buttons/ban.png");
this->buttons.banRed = QPixmap(":/buttons/banRed.png");
this->buttons.clearSearch = QPixmap(":/buttons/clearSearch.png");
this->buttons.copyDark = QPixmap(":/buttons/copyDark.png");
this->buttons.copyLight = QPixmap(":/buttons/copyLight.png");
this->buttons.menuDark = QPixmap(":/buttons/menuDark.png");
this->buttons.menuLight = QPixmap(":/buttons/menuLight.png");
this->buttons.mod = QPixmap(":/buttons/mod.png");
this->buttons.modModeDisabled = QPixmap(":/buttons/modModeDisabled.png");
this->buttons.modModeDisabled2 = QPixmap(":/buttons/modModeDisabled2.png");
this->buttons.modModeEnabled = QPixmap(":/buttons/modModeEnabled.png");
this->buttons.modModeEnabled2 = QPixmap(":/buttons/modModeEnabled2.png");
this->buttons.pinDisabledDark = QPixmap(":/buttons/pinDisabledDark.png");
this->buttons.pinDisabledLight = QPixmap(":/buttons/pinDisabledLight.png");
this->buttons.pinEnabled = QPixmap(":/buttons/pinEnabled.png");
this->buttons.replyDark = QPixmap(":/buttons/replyDark.png");
this->buttons.replyThreadDark = QPixmap(":/buttons/replyThreadDark.png");
this->buttons.search = QPixmap(":/buttons/search.png");
this->buttons.timeout = QPixmap(":/buttons/timeout.png");
this->buttons.trashCan = QPixmap(":/buttons/trashCan.png");
this->buttons.unban = QPixmap(":/buttons/unban.png");
this->buttons.unmod = QPixmap(":/buttons/unmod.png");
this->buttons.unvip = QPixmap(":/buttons/unvip.png");
this->buttons.update = QPixmap(":/buttons/update.png");
this->buttons.updateError = QPixmap(":/buttons/updateError.png");
this->buttons.viewersDark = QPixmap(":/buttons/viewersDark.png");
this->buttons.viewersLight = QPixmap(":/buttons/viewersLight.png");
this->buttons.vip = QPixmap(":/buttons/vip.png");
this->error = QPixmap(":/error.png");
this->icon = QPixmap(":/icon.png");
this->pajaDank = QPixmap(":/pajaDank.png");
this->scrolling.downScroll = QPixmap(":/scrolling/downScroll.png");
this->scrolling.neutralScroll = QPixmap(":/scrolling/neutralScroll.png");
this->scrolling.upScroll = QPixmap(":/scrolling/upScroll.png");
this->settings.aboutlogo = QPixmap(":/settings/aboutlogo.png");
this->split.down = QPixmap(":/split/down.png");
this->split.left = QPixmap(":/split/left.png");
this->split.move = QPixmap(":/split/move.png");
this->split.right = QPixmap(":/split/right.png");
this->split.up = QPixmap(":/split/up.png");
this->streamerMode = QPixmap(":/streamerMode.png");
this->twitch.admin = QPixmap(":/twitch/admin.png");
this->twitch.automod = QPixmap(":/twitch/automod.png");
this->twitch.broadcaster = QPixmap(":/twitch/broadcaster.png");
this->twitch.cheer1 = QPixmap(":/twitch/cheer1.png");
this->twitch.globalmod = QPixmap(":/twitch/globalmod.png");
this->twitch.moderator = QPixmap(":/twitch/moderator.png");
this->twitch.prime = QPixmap(":/twitch/prime.png");
this->twitch.staff = QPixmap(":/twitch/staff.png");
this->twitch.subscriber = QPixmap(":/twitch/subscriber.png");
this->twitch.turbo = QPixmap(":/twitch/turbo.png");
this->twitch.verified = QPixmap(":/twitch/verified.png");
this->twitch.vip = QPixmap(":/twitch/vip.png");
}
} // namespace chatterino
-96
View File
@@ -1,96 +0,0 @@
#include <QPixmap>
#include "common/Singleton.hpp"
namespace chatterino {
class Resources2 : public Singleton
{
public:
Resources2();
struct {
QPixmap _1xelerate;
QPixmap alazymeme;
QPixmap brian6932;
QPixmap explooosion_code;
QPixmap fourtf;
QPixmap hicupalot;
QPixmap iprodigy;
QPixmap jaxkey;
QPixmap kararty;
QPixmap karlpolice;
QPixmap mm2pl;
QPixmap mohad12211;
QPixmap pajlada;
QPixmap slch;
QPixmap xheaveny;
QPixmap zneix;
} avatars;
struct {
QPixmap addSplit;
QPixmap addSplitDark;
QPixmap ban;
QPixmap banRed;
QPixmap clearSearch;
QPixmap copyDark;
QPixmap copyLight;
QPixmap menuDark;
QPixmap menuLight;
QPixmap mod;
QPixmap modModeDisabled;
QPixmap modModeDisabled2;
QPixmap modModeEnabled;
QPixmap modModeEnabled2;
QPixmap pinDisabledDark;
QPixmap pinDisabledLight;
QPixmap pinEnabled;
QPixmap replyDark;
QPixmap replyThreadDark;
QPixmap search;
QPixmap timeout;
QPixmap trashCan;
QPixmap unban;
QPixmap unmod;
QPixmap unvip;
QPixmap update;
QPixmap updateError;
QPixmap viewersDark;
QPixmap viewersLight;
QPixmap vip;
} buttons;
QPixmap error;
QPixmap icon;
QPixmap pajaDank;
struct {
QPixmap downScroll;
QPixmap neutralScroll;
QPixmap upScroll;
} scrolling;
struct {
QPixmap aboutlogo;
} settings;
struct {
QPixmap down;
QPixmap left;
QPixmap move;
QPixmap right;
QPixmap up;
} split;
QPixmap streamerMode;
struct {
QPixmap admin;
QPixmap automod;
QPixmap broadcaster;
QPixmap cheer1;
QPixmap globalmod;
QPixmap moderator;
QPixmap prime;
QPixmap staff;
QPixmap subscriber;
QPixmap turbo;
QPixmap verified;
QPixmap vip;
} twitch;
};
} // namespace chatterino
+1 -1
View File
@@ -1,6 +1,6 @@
#pragma once
#include "autogenerated/ResourcesAutogen.hpp"
#include "ResourcesAutogen.hpp"
namespace chatterino {