Skip to content

Commit

Permalink
Add info dialog with current version number
Browse files Browse the repository at this point in the history
The main motivation for this dialog to allow users to easily see which
version they are running.

Shifted the `basePlugin` ID since it needs to be last. The newly added
menu item will always be the right-most as this is common for this kind
of information.
  • Loading branch information
ServiusHack committed Sep 22, 2024
1 parent 307cecb commit 07e8379
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 3 deletions.
1 change: 1 addition & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added

* Output channels can be activated and deactivated with one button click
* Show *about* dialog with version number.

## [1.1.111] - 2022-10-12
21 changes: 19 additions & 2 deletions Source/MainComponent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ juce::StringArray MainContentComponent::getMenuBarNames()
juce::StringArray names(menuBarNames, 4);
if (m_pluginLoader.count() > 0)
names.add("Plugins");
names.add("Info");
return names;
}

Expand Down Expand Up @@ -195,13 +196,16 @@ juce::PopupMenu MainContentComponent::getMenuForIndex(int menuIndex, const juce:
menu.addCommandItem(m_commandManager, configureMidi);
menu.addCommandItem(m_commandManager, editSettings);
break;
case 4:
}
if (menuIndex == 4 && m_pluginLoader.count() > 0)
{
const size_t numberOfPlugins = m_pluginLoader.count();
for (size_t i = 0; i < numberOfPlugins; ++i)
menu.addCommandItem(m_commandManager, basePlugin + i);
}
break;
else if (menuIndex == 4 && m_pluginLoader.count() == 0 || menuIndex == 5)
{
menu.addCommandItem(m_commandManager, applicationInfo);
}

return menu;
Expand Down Expand Up @@ -256,6 +260,8 @@ void MainContentComponent::getAllCommands(juce::Array<juce::CommandID>& commands
const size_t numberOfPlugins = m_pluginLoader.count();
for (size_t i = 0; i < numberOfPlugins; ++i)
commands.add(basePlugin + i);

commands.add(applicationInfo);
}

// This method is used when something needs to find out the details about one of the commands
Expand All @@ -267,6 +273,7 @@ void MainContentComponent::getCommandInfo(juce::CommandID commandID, juce::Appli
static const juce::String viewCategory("View");
static const juce::String optionsCategory("Options");
static const juce::String pluginsCategory("Plugins");
static const juce::String infoCategory("Info");

switch (commandID)
{
Expand Down Expand Up @@ -358,6 +365,10 @@ void MainContentComponent::getCommandInfo(juce::CommandID commandID, juce::Appli
result.setInfo(TRANS("Pink"), TRANS("Use a pink look and feel"), viewCategory, 0);
result.setTicked(&juce::LookAndFeel::getDefaultLookAndFeel() == s_pinkLookAndFeel);
break;

case applicationInfo:
result.setInfo(TRANS("About"), TRANS("Show information about the application"), infoCategory, 0);
break;
};

if (commandID >= basePlugin)
Expand Down Expand Up @@ -495,6 +506,12 @@ bool MainContentComponent::perform(const juce::ApplicationCommandTarget::Invocat
switchToPinkLookAndFeel();
m_applicationProperties.getUserSettings()->setValue("lookAndFeel", "pink");
break;
case applicationInfo:
juce::AlertWindow::showMessageBoxAsync(juce::MessageBoxIconType::InfoIcon,
"M*Player",
TRANS("Multi-channel, multi-track, multi-player player for audio files.") + "\n\n" +
TRANS("Version: ") + JUCE_APPLICATION_VERSION_STRING);
break;
default:
if (info.commandID >= basePlugin)
{
Expand Down
4 changes: 3 additions & 1 deletion Source/MainComponent.h
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,9 @@ class MainContentComponent
lookAndFeelDark = 0x6001,
lookAndFeelPink = 0x6002,

basePlugin = 0x7000,
applicationInfo = 0x7000,

basePlugin = 0x8000,
};

// Project file related methods and fields
Expand Down
3 changes: 3 additions & 0 deletions Translations/German.txt
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,9 @@ countries:de
"Use the default look and feel" = "Das Standardaussehen verwenden"
"Dark" = "Dunkel"
"Use a dark look and feel" = "Ein dunkles Aussehen verwenden"
"About" = "Über"
"Show information about the application" = "Informationen über die Anwendung anzeigen"
"Multi-channel, multi-track, multi-player player for audio files." = "Mehr-Kanal, Mehr-Spur, Mehr-Player Abspielsoftware für Audiodateien."
"Please select the project file you want to load ..." = "Bitte die zu öffnende Projektdatei auswählen ..."
"Save project?" = "Projekt speichern?"
"Do you want to save the current project?" = "Möchten Sie das aktuelle Projekt speichern?"
Expand Down

0 comments on commit 07e8379

Please sign in to comment.