Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature version info #1100

Merged
merged 6 commits into from
Jan 12, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions src/main/java/net/rptools/maptool/client/functions/AboutMacro.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
* This software Copyright by the RPTools.net development team, and
* licensed under the Affero GPL Version 3 or, at your option, any later
* version.
*
* MapTool Source Code is distributed in the hope that it will be
* useful, but WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
* You should have received a copy of the GNU Affero General Public
* License * along with this source Code. If not, please visit
* <http://www.gnu.org/licenses/> and specifically the Affero license
* text at <http://www.gnu.org/licenses/agpl.html>.
*/
package net.rptools.maptool.client.functions;

import net.rptools.maptool.client.AppActions;
import net.rptools.maptool.client.AppActions.ClientAction;
import net.rptools.maptool.client.MapToolMacroContext;
import net.rptools.maptool.client.macro.Macro;
import net.rptools.maptool.client.macro.MacroContext;
import net.rptools.maptool.client.macro.MacroDefinition;

@MacroDefinition(
name = "about",
aliases = {"a"},
description = "slashabout.description")
public class AboutMacro implements Macro {

@Override
public void execute(MacroContext context, String macro, MapToolMacroContext executionContext) {
((ClientAction) AppActions.SHOW_ABOUT).execute(null);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import net.rptools.maptool.client.MapTool;
import net.rptools.maptool.client.MapToolMacroContext;
import net.rptools.maptool.client.functions.AbortFunction;
import net.rptools.maptool.client.functions.AboutMacro;
import net.rptools.maptool.client.functions.AssertFunction;
import net.rptools.maptool.client.macro.impl.*;
import net.rptools.maptool.client.ui.MapToolFrame;
Expand Down Expand Up @@ -78,7 +79,8 @@ public class MacroManager {
registerMacro(new EmotePluralMacro());
registerMacro(new ExperimentsMacro());
registerMacro(new TextureNoise());

registerMacro(new VersionMacro());
registerMacro(new AboutMacro());
registerMacro(UNDEFINED_MACRO);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
* This software Copyright by the RPTools.net development team, and
* licensed under the Affero GPL Version 3 or, at your option, any later
* version.
*
* MapTool Source Code is distributed in the hope that it will be
* useful, but WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
* You should have received a copy of the GNU Affero General Public
* License * along with this source Code. If not, please visit
* <http://www.gnu.org/licenses/> and specifically the Affero license
* text at <http://www.gnu.org/licenses/agpl.html>.
*/
package net.rptools.maptool.client.macro.impl;

import net.rptools.maptool.client.MapTool;
import net.rptools.maptool.client.MapToolMacroContext;
import net.rptools.maptool.client.macro.Macro;
import net.rptools.maptool.client.macro.MacroContext;
import net.rptools.maptool.client.macro.MacroDefinition;
import net.rptools.maptool.language.I18N;

@MacroDefinition(
name = "version",
aliases = {"v"},
description = "slashversion.description")

/** This class represents the /version command run from the chat panel. */
public class VersionMacro implements Macro {

@Override
public void execute(MacroContext context, String macro, MapToolMacroContext executionContext) {
String versionString = MapTool.getVersion();
if ("unspecified".equalsIgnoreCase(versionString)) {
versionString += " (development build)";
}
MapTool.addLocalMessage(I18N.getText("slashversion.message", versionString));
}
}
4 changes: 4 additions & 0 deletions src/main/java/net/rptools/maptool/client/ui/MapToolFrame.java
Original file line number Diff line number Diff line change
Expand Up @@ -1606,8 +1606,12 @@ public void setCurrentZoneRenderer(ZoneRenderer renderer) {
*/
public void setTitleViaRenderer(ZoneRenderer renderer) {
String campaignName = " - [" + MapTool.getCampaign().getName() + "]";
String versionString =
MapTool.getVersion().equals("unspecified") ? "Development" : "v" + MapTool.getVersion();
setTitle(
AppConstants.APP_NAME
+ " "
+ versionString
+ " - "
+ MapTool.getPlayer()
+ campaignName
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1332,6 +1332,12 @@ texturenoise.currentValsOn = Current Values, alpha = {0}, seed = {1}.
texturenoise.currentValsOff = Noise is currently off.
texturenoise.usage = To change use /texturenoise alpha [seed] or /texturenoise on | off.

# Version slash command
slashversion.description = Display the MapTool Version in the chat window.
slashversion.message = MapTool Version {0}.

# About slash command
slashabout.description = Display the about dialog.

# Slash Command errors
slash.mustBeGM = You must be a GM to use "/{0}".
Expand Down