Skip to content

Commit 0115540

Browse files
committed
Refactor URLs.
1 parent 2e07de9 commit 0115540

File tree

10 files changed

+51
-27
lines changed

10 files changed

+51
-27
lines changed

SerialPrograms/Source/CommonFramework/GlobalSettingsPanel.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ GlobalSettings::GlobalSettings()
140140
, m_discord_settings(
141141
"<font size=4><b>Discord Settings:</b> Integrate with Discord. (" +
142142
make_text_url(
143-
ONLINE_DOC_URL + "ComputerControl/blob/master/Wiki/Software/DiscordIntegration.md",
143+
ONLINE_DOC_URL_BASE + "ComputerControl/blob/master/Wiki/Software/DiscordIntegration.md",
144144
"online documentation"
145145
) + ")</font>"
146146
)
@@ -248,7 +248,7 @@ void GlobalSettings::load_json(const JsonValue& json){
248248
m_discord_settings.set_text(
249249
"<font size=4><b>Discord Settings:</b> Integrate with Discord. (" +
250250
make_text_url(
251-
ONLINE_DOC_URL + "ComputerControl/blob/master/Wiki/Software/DiscordIntegration.md",
251+
ONLINE_DOC_URL_BASE + "ComputerControl/blob/master/Wiki/Software/DiscordIntegration.md",
252252
"online documentation"
253253
) + ")</font>"
254254
);

SerialPrograms/Source/CommonFramework/Globals.cpp

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,15 +43,34 @@ const std::string PROGRAM_VERSION = PROGRAM_VERSION_BASE + "-user";
4343

4444

4545

46-
4746
const std::string PROGRAM_NAME = "Pok\u00e9mon Automation";
4847

49-
const std::string DISCORD_LINK = "discord.gg/PokemonAutomation";
50-
const std::string DISCORD_LINK_URL = "https://discord.gg/BSjDp27";
51-
const std::string ONLINE_DOC_URL = "https://github.com/PokemonAutomation/";
52-
const std::string PROJECT_GITHUB = "github.com/PokemonAutomation";
53-
const std::string PROJECT_GITHUB_URL = "https://github.com/PokemonAutomation/";
48+
const std::string ONLINE_DOC_URL_BASE = "https://github.com/PokemonAutomation/";
5449
const std::string PROJECT_SOURCE_URL = "https://github.com/PokemonAutomation/Arduino-Source/";
50+
const std::string RESOURCES_URL_BASE = "https://github.com/PokemonAutomation/Packages/";
51+
52+
53+
54+
// This the URL that we display. We don't actually use this for linking.
55+
const std::string GITHUB_LINK_TEXT = "github.com/PokemonAutomation";
56+
57+
// This is the URL that we actually link to.
58+
const std::string GITHUB_LINK_URL = "https://github.com/PokemonAutomation/About/blob/master/README.md";
59+
60+
61+
62+
// URL to display. (the vanity link)
63+
// We don't actually use this URL for linking since the vanity link will go
64+
// away if we lose too many nitro boosts.
65+
const std::string DISCORD_LINK_TEXT = "discord.gg/PokemonAutomation";
66+
67+
// URL to use inside the program.
68+
const std::string DISCORD_LINK_URL_PROGRAM = "https://discord.gg/BSjDp27";
69+
70+
// URL to use in the Discord notifications/embeds.
71+
const std::string DISCORD_LINK_URL_EMBED = "https://discord.gg/xMJcveK";
72+
73+
5574

5675
#if 0
5776
#elif __INTEL_LLVM_COMPILER

SerialPrograms/Source/CommonFramework/Globals.h

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
#ifndef PokemonAutomation_Globals_H
88
#define PokemonAutomation_Globals_H
99

10-
#include <chrono>
1110
#include <string>
1211

1312
namespace PokemonAutomation{
@@ -22,16 +21,18 @@ extern const std::string PROGRAM_VERSION;
2221

2322
extern const std::string PROGRAM_NAME;
2423

25-
extern const std::string DISCORD_LINK;
26-
extern const std::string DISCORD_LINK_URL;
27-
extern const std::string ONLINE_DOC_URL;
28-
extern const std::string PROJECT_GITHUB;
29-
extern const std::string PROJECT_GITHUB_URL;
24+
extern const std::string ONLINE_DOC_URL_BASE;
3025
extern const std::string PROJECT_SOURCE_URL;
26+
extern const std::string RESOURCES_URL_BASE;
3127

32-
extern const std::string COMPILER_VERSION;
28+
extern const std::string GITHUB_LINK_TEXT;
29+
extern const std::string GITHUB_LINK_URL;
30+
31+
extern const std::string DISCORD_LINK_TEXT;
32+
extern const std::string DISCORD_LINK_URL_PROGRAM;
33+
extern const std::string DISCORD_LINK_URL_EMBED;
3334

34-
const auto SERIAL_REFRESH_RATE = std::chrono::milliseconds(1000);
35+
extern const std::string COMPILER_VERSION;
3536

3637
extern const size_t LOG_HISTORY_LINES;
3738

SerialPrograms/Source/CommonFramework/Notifications/ProgramNotifications.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,9 @@ JsonObject make_credits_field(const ProgramInfo& info){
4343
? PROGRAM_NAME + " CC " + PROGRAM_VERSION + "-dev"
4444
: PROGRAM_NAME + " CC " + PROGRAM_VERSION + "";
4545
if (GlobalSettings::instance().HIDE_NOTIF_DISCORD_LINK){
46-
text += " ([GitHub](" + PROJECT_GITHUB_URL + "About/))";
46+
text += " ([GitHub](" + GITHUB_LINK_URL + "))";
4747
}else{
48-
text += " ([GitHub](" + PROJECT_GITHUB_URL + "About/)/[Discord](" + DISCORD_LINK_URL + "))";
48+
text += " ([GitHub](" + GITHUB_LINK_URL + ")/[Discord](" + DISCORD_LINK_URL_EMBED + "))";
4949
}
5050
field["value"] = std::move(text);
5151
return field;

SerialPrograms/Source/CommonFramework/Panels/UI/PanelElements.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ CollapsibleGroupBox* make_panel_header(
3131

3232
std::string name_text = "<b>Name:</b> " + display_name;
3333
if (!doc_link.empty()){
34-
std::string path = ONLINE_DOC_URL + doc_link;
34+
std::string path = ONLINE_DOC_URL_BASE + doc_link;
3535
name_text += " (" + make_text_url(path, "online documentation") + ")";
3636
}
3737
QLabel* name_label = new QLabel(QString::fromStdString(name_text), header);

SerialPrograms/Source/CommonFramework/Windows/MainWindow.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ MainWindow::MainWindow(QWidget* parent)
9696
layout->addWidget(m_sleep_text, 2);
9797
m_sleep_box = new QCheckBox("Force On", support_box);
9898
layout->addWidget(m_sleep_box, 1, Qt::AlignHCenter);
99-
sleep_suppress_state_changed(SystemSleepController::instance().current_state());
99+
MainWindow::sleep_suppress_state_changed(SystemSleepController::instance().current_state());
100100
#if QT_VERSION < 0x060700
101101
connect(
102102
m_sleep_box, &QCheckBox::stateChanged,
@@ -131,23 +131,23 @@ MainWindow::MainWindow(QWidget* parent)
131131
{
132132
QLabel* github = new QLabel(support_box);
133133
links->addWidget(github);
134-
github->setText(QString::fromStdString(make_text_url(ONLINE_DOC_URL + "ComputerControl/", "Online Documentation")));
134+
github->setText(QString::fromStdString(make_text_url(ONLINE_DOC_URL_BASE + "ComputerControl/", "Online Documentation")));
135135
github->setTextFormat(Qt::RichText);
136136
github->setTextInteractionFlags(Qt::TextBrowserInteraction);
137137
github->setOpenExternalLinks(true);
138138
}
139139
{
140140
QLabel* discord = new QLabel(support_box);
141141
links->addWidget(discord);
142-
discord->setText(QString::fromStdString(make_text_url(DISCORD_LINK_URL, DISCORD_LINK)));
142+
discord->setText(QString::fromStdString(make_text_url(DISCORD_LINK_URL_PROGRAM, DISCORD_LINK_TEXT)));
143143
discord->setTextFormat(Qt::RichText);
144144
discord->setTextInteractionFlags(Qt::TextBrowserInteraction);
145145
discord->setOpenExternalLinks(true);
146146
}
147147
{
148148
QLabel* github = new QLabel(support_box);
149149
links->addWidget(github);
150-
github->setText(QString::fromStdString(make_text_url(PROJECT_GITHUB_URL, PROJECT_GITHUB)));
150+
github->setText(QString::fromStdString(make_text_url(GITHUB_LINK_URL, GITHUB_LINK_TEXT)));
151151
// github->setText("<a href=\"" + GITHUB_REPO + "\">GitHub Repository</a>");
152152
github->setTextFormat(Qt::RichText);
153153
github->setTextInteractionFlags(Qt::TextBrowserInteraction);
@@ -156,7 +156,7 @@ MainWindow::MainWindow(QWidget* parent)
156156
{
157157
QLabel* about = new QLabel(support_box);
158158
links->addWidget(about);
159-
about->setText(QString::fromStdString(make_text_url(PROJECT_GITHUB_URL, "About this Program")));
159+
about->setText(QString::fromStdString(make_text_url(GITHUB_LINK_URL, "About this Program")));
160160
about->setTextFormat(Qt::RichText);
161161
connect(
162162
about, &QLabel::linkActivated,

SerialPrograms/Source/CommonTools/Options/QtWidgets/LanguageOCRWidget.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ void LanguageOCRCellWidget::update_value(){
9898
m_status->setText(
9999
QString::fromStdString(
100100
"<font color=\"red\">No text recognition data found for " + language.name + ".</font>\n" +
101-
"<a href=\"" + PROJECT_GITHUB_URL + "Packages/blob/master/SerialPrograms/Resources/Tesseract/\">Download from here.</a>"
101+
"<a href=\"" + RESOURCES_URL_BASE + "blob/master/SerialPrograms/Resources/Tesseract/\">Download from here.</a>"
102102
)
103103
);
104104
m_status->setVisible(true);

SerialPrograms/Source/Integrations/DppIntegration/DppCommandHandler.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,10 @@ void Handler::create_unified_commands(commandhandler& handler){
194194
embed.add_field("Guilds", std::to_string(Utility::user_counts.size()));
195195
embed.add_field("Users", std::to_string(counts));
196196
embed.add_field("Uptime", handler.owner->uptime().to_string());
197-
embed.add_field("Powered By", PROGRAM_NAME + " " + PROGRAM_VERSION + " ([GitHub](" + PROJECT_GITHUB_URL + "/About)/[Discord](" + DISCORD_LINK_URL + "))");
197+
embed.add_field(
198+
"Powered By",
199+
PROGRAM_NAME + " " + PROGRAM_VERSION + " ([GitHub](" + GITHUB_LINK_URL + ")/[Discord](" + DISCORD_LINK_URL_EMBED + "))"
200+
);
198201

199202
message message;
200203
message.add_embed(embed);

SerialPrograms/Source/NintendoSwitch/DevPrograms/TestProgramComputer.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@
145145

146146

147147
//#include <opencv2/core.hpp>
148+
#include <onnxruntime_cxx_api.h>
148149
#include <random>
149150

150151

SerialPrograms/Source/PokemonSV/Programs/Eggs/PokemonSV_EggAutonomous.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ EggAutonomous::EggAutonomous()
100100
, AUTO_SAVING(
101101
"<b>Auto-Saving:</b><br>Automatically save the game to recover from crashes and allow eggs to be unhatched.<br>" +
102102
make_text_url(
103-
ONLINE_DOC_URL + "ComputerControl/blob/master/Wiki/Programs/PokemonSV/EggAutonomous.md#auto-saving-mode",
103+
ONLINE_DOC_URL_BASE + "ComputerControl/blob/master/Wiki/Programs/PokemonSV/EggAutonomous.md#auto-saving-mode",
104104
"See the wiki for the full explanations of each mode."
105105
),
106106
{

0 commit comments

Comments
 (0)