Skip to content

Commit

Permalink
Merge pull request xbmc#26035 from garbear/donate-qr
Browse files Browse the repository at this point in the history
System Info: Add Donate tab and QR codes
  • Loading branch information
garbear authored Dec 18, 2024
2 parents b794e36 + f2059ee commit f09a585
Show file tree
Hide file tree
Showing 8 changed files with 95 additions and 7 deletions.
20 changes: 19 additions & 1 deletion addons/resource.language.en_gb/resources/strings.po
Original file line number Diff line number Diff line change
Expand Up @@ -6290,7 +6290,25 @@ msgctxt "#12395"
msgid "Battery level"
msgstr ""

#empty strings from id 12396 to 12599
#. Label of button in the System Info screen asking for donations. "Thank you!" is used to convey gratitude to the users of our beloved software.
#: addons/skin.estuary/xml/SettingsSystemInfo.xml
msgctxt "#12396"
msgid "Thank you!"
msgstr ""

#. Label of text box asking for donations
#: addons/skin.estuary/xml/SettingsSystemInfo.xml
msgctxt "#12397"
msgid "Kodi is brought to you with love from the Kodi Foundation, a 501(c)(3) nonprofit organization. Thank you for using our software!"
msgstr ""

#. URL for donations. Do not translate.
#: addons/skin.estuary/xml/SettingsSystemInfo.xml
msgctxt "#12398"
msgid "kodi.tv/donate"
msgstr ""

#empty strings from id 12399 to 12599

#: xbmc/guilib/WindowIDs.h
msgctxt "#12600"
Expand Down
35 changes: 34 additions & 1 deletion addons/skin.estuary/xml/SettingsSystemInfo.xml
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,31 @@
<height>3</height>
<texture colordiffuse="button_focus" border="2">dialogs/separator-grey.png</texture>
</control>
<control type="group" id="102">
<description>System Info page that shows a QR code linking to https://kodi.tv/donate/</description>
<left>420</left>
<right>50</right>
<top>30</top>
<bottom>30</bottom>
<control type="textbox">
<height>110</height>
<label>$LOCALIZE[12397]</label>
</control>
<control type="multiimage" id="103">
<top>110</top>
<height>620</height>
<imagepath>special://xbmc/media/qr/kodilove/</imagepath>
<aspectratio>keep</aspectratio>
<timeperimage>5000</timeperimage>
<fadetime>1000</fadetime>
<randomize>false</randomize>
</control>
<control type="label">
<top>748</top>
<align>center</align>
<label>$LOCALIZE[12398]</label>
</control>
</control>
</control>
<control type="group">
<left>0</left>
Expand Down Expand Up @@ -189,13 +214,21 @@
<width>420</width>
<label>$LOCALIZE[12389]</label>
</control>
<control type="button" id="101">
<description>Button "Thank you!"</description>
<include content="DefaultSettingButton">
<param name="height" value="85" />
</include>
<width>420</width>
<label>$LOCALIZE[12396]</label>
</control>
</control>
</control>
<include content="TopBar">
<param name="breadcrumbs_label" value="$LOCALIZE[130]" />
</include>
<include>BottomBar</include>
<control type="group">
<control type="group" id="104">
<bottom>0</bottom>
<left>40</left>
<height>370</height>
Expand Down
Binary file added media/qr/kodilove/qr-logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added media/qr/kodilove/qr-popcorn.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions xbmc/guilib/GUIMessage.h
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,10 @@ constexpr const int GUI_MSG_STATE_CHANGED = 51;
*/
constexpr const int GUI_MSG_SUBTITLE_DOWNLOADED = 52;

/*!
* \brief Reset a multiimage to its initial state
*/
constexpr const int GUI_MSG_RESET_MULTI_IMAGE = 53;

constexpr const int GUI_MSG_USER = 1000;

Expand Down
16 changes: 13 additions & 3 deletions xbmc/guilib/GUIMultiImage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,11 @@ bool CGUIMultiImage::OnMessage(CGUIMessage &message)
FreeResources();
return true;
}
if (message.GetMessage() == GUI_MSG_RESET_MULTI_IMAGE)
{
ResetMultiImage();
return true;
}
return CGUIControl::OnMessage(message);
}

Expand Down Expand Up @@ -252,9 +257,7 @@ void CGUIMultiImage::OnDirectoryLoaded()

// flag as loaded - no point in constantly reloading them
m_directoryStatus = READY;
m_imageTimer.StartZero();
m_currentImage = 0;
m_image.SetFileName(m_files.empty() ? "" : m_files[0]);
ResetMultiImage();
}

void CGUIMultiImage::CancelLoading()
Expand All @@ -265,6 +268,13 @@ void CGUIMultiImage::CancelLoading()
m_directoryStatus = UNLOADED;
}

void CGUIMultiImage::ResetMultiImage()
{
m_imageTimer.StartZero();
m_currentImage = 0;
m_image.SetFileName(m_files.empty() ? "" : m_files[0]);
}

void CGUIMultiImage::OnJobComplete(unsigned int jobID, bool success, CJob *job)
{
std::unique_lock<CCriticalSection> lock(m_section);
Expand Down
1 change: 1 addition & 0 deletions xbmc/guilib/GUIMultiImage.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ class CGUIMultiImage : public CGUIControl, public IJobCallback
void LoadDirectory();
void OnDirectoryLoaded();
void CancelLoading();
void ResetMultiImage();

enum DIRECTORY_STATUS { UNLOADED = 0, LOADING, LOADED, READY };
void OnJobComplete(unsigned int jobID, bool success, CJob *job) override;
Expand Down
26 changes: 24 additions & 2 deletions xbmc/windows/GUIWindowSystemInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,14 @@ constexpr int CONTROL_TEXT_END = 13; // 12 lines
#define CONTROL_BT_PVR 99
#define CONTROL_BT_POLICY 100

#define CONTROL_START CONTROL_BT_STORAGE
#define CONTROL_END CONTROL_BT_POLICY
constexpr int CONTROL_BT_DONATE = 101;
constexpr int CONTROL_GROUP_DONATE = 102;
constexpr int CONTROL_MULTI_IMAGE_DONATE = 103;

constexpr int CONTROL_GROUP_SYSTEM_BAR = 104;

constexpr int CONTROL_START = CONTROL_BT_STORAGE;
constexpr int CONTROL_END = CONTROL_BT_DONATE;

CGUIWindowSystemInfo::CGUIWindowSystemInfo(void) :
CGUIWindow(WINDOW_SYSTEM_INFORMATION, "SettingsSystemInfo.xml")
Expand Down Expand Up @@ -78,11 +84,23 @@ bool CGUIWindowSystemInfo::OnMessage(CGUIMessage& message)
m_section = focusedControl;
}
if (m_section >= CONTROL_BT_STORAGE && m_section <= CONTROL_BT_PVR)
{
SET_CONTROL_HIDDEN(CONTROL_TB_POLICY);
SET_CONTROL_HIDDEN(CONTROL_GROUP_DONATE);
SET_CONTROL_VISIBLE(CONTROL_GROUP_SYSTEM_BAR);
}
else if (m_section == CONTROL_BT_POLICY)
{
LoadPrivacyPolicy();
SET_CONTROL_VISIBLE(CONTROL_TB_POLICY);
SET_CONTROL_HIDDEN(CONTROL_GROUP_DONATE);
SET_CONTROL_VISIBLE(CONTROL_GROUP_SYSTEM_BAR);
}
else if (m_section == CONTROL_BT_DONATE)
{
SET_CONTROL_HIDDEN(CONTROL_TB_POLICY);
SET_CONTROL_VISIBLE(CONTROL_GROUP_DONATE);
SET_CONTROL_HIDDEN(CONTROL_GROUP_SYSTEM_BAR);
}
return true;
}
Expand Down Expand Up @@ -251,6 +269,10 @@ void CGUIWindowSystemInfo::ResetLabels()
{
SET_CONTROL_LABEL(i, "");
}

// Reset the multiimage to the beginning
CGUIMessage msg{GUI_MSG_RESET_MULTI_IMAGE, GetID(), CONTROL_MULTI_IMAGE_DONATE};
OnMessage(msg);
}

void CGUIWindowSystemInfo::SetControlLabel(int id, const char *format, int label, int info)
Expand Down

0 comments on commit f09a585

Please sign in to comment.