Implement status_display_type
This commit is contained in:
parent
7d4bc6dd89
commit
d15980375c
34
src/main.cpp
34
src/main.cpp
|
@ -116,9 +116,10 @@ void handleMediaTasks() {
|
|||
}
|
||||
std::string serviceName = app.appName;
|
||||
|
||||
std::string activityState = "by " + mediaInformation->songArtist;
|
||||
std::string activityState = mediaInformation->songArtist;
|
||||
DiscordRichPresence activity{};
|
||||
activity.type = app.type;
|
||||
activity.displayType = app.displayType;
|
||||
activity.details = mediaInformation->songTitle.c_str();
|
||||
activity.state = activityState.c_str();
|
||||
activity.smallImageText = serviceName.c_str();
|
||||
|
@ -271,6 +272,37 @@ public:
|
|||
});
|
||||
|
||||
formSizer->Add(activityChoice, 1, wxALL | wxEXPAND, 5);
|
||||
|
||||
|
||||
formSizer->Add(new wxStaticText(this, wxID_ANY, "Display Type:"), 0, wxALL | wxALIGN_CENTER_VERTICAL, 5);
|
||||
wxString displayChoices[] = {_("App"), _("State/Artist"), _("Details/Title")};
|
||||
wxChoice* displayTypeChoice = new wxChoice(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 3, displayChoices);
|
||||
|
||||
switch (app->displayType) {
|
||||
case StatusDisplayType::DETAILS:
|
||||
displayTypeChoice->SetSelection(2);
|
||||
break;
|
||||
case StatusDisplayType::APPNAME:
|
||||
displayTypeChoice->SetSelection(0);
|
||||
break;
|
||||
case StatusDisplayType::STATE:
|
||||
displayTypeChoice->SetSelection(1);
|
||||
break;
|
||||
default:
|
||||
displayTypeChoice->SetSelection(0);
|
||||
}
|
||||
|
||||
displayTypeChoice->Bind(wxEVT_CHOICE, [displayTypeChoice, app](wxCommandEvent& event) {
|
||||
const std::map<wxString, StatusDisplayType> typeMap = {
|
||||
{_("App"), StatusDisplayType::APPNAME},
|
||||
{_("State/Artist"), StatusDisplayType::STATE},
|
||||
{_("Details/Title"), StatusDisplayType::DETAILS},
|
||||
};
|
||||
app->displayType = typeMap.at(event.GetString());
|
||||
});
|
||||
|
||||
formSizer->Add(displayTypeChoice, 1, wxALL | wxEXPAND, 5);
|
||||
|
||||
mainSizer->Add(formSizer, 0, wxEXPAND);
|
||||
|
||||
// Process names group
|
||||
|
|
|
@ -21,6 +21,7 @@ namespace utils {
|
|||
struct App {
|
||||
bool enabled;
|
||||
int type;
|
||||
int displayType;
|
||||
std::string appName;
|
||||
std::string clientId;
|
||||
std::string searchEndpoint;
|
||||
|
@ -271,6 +272,7 @@ namespace utils {
|
|||
appJson["search_endpoint"] = app.searchEndpoint;
|
||||
appJson["enabled"] = app.enabled;
|
||||
appJson["type"] = app.type;
|
||||
appJson["display_type"] = app.displayType;
|
||||
for (const auto& processName : app.processNames) appJson["process_names"].push_back(processName);
|
||||
|
||||
j["apps"].push_back(appJson);
|
||||
|
@ -316,6 +318,7 @@ namespace utils {
|
|||
a.searchEndpoint = app.value("search_endpoint", "");
|
||||
a.enabled = app.value("enabled", false);
|
||||
a.type = app.value("type", 2);
|
||||
a.displayType = app.value("display_type", 0);
|
||||
|
||||
for (const auto& process : app.value("process_names", nlohmann::json())) a.processNames.push_back(process.get<std::string>());
|
||||
|
||||
|
@ -339,6 +342,7 @@ namespace utils {
|
|||
a.appName = DEFAULT_APP_NAME;
|
||||
a.enabled = settings.anyOtherEnabled;
|
||||
a.type = 2; // Default to listening
|
||||
a.displayType = 0;
|
||||
a.searchEndpoint = "";
|
||||
return a;
|
||||
}
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 6bc42071f109083178ae824898ca4b3cb40a8307
|
||||
Subproject commit cf0003c11982e9c04eadbb57a17b66f869559575
|
Loading…
Reference in New Issue