diff --git a/gapic/res/icons/add.png b/gapic/res/icons/add.png
new file mode 100644
index 0000000000..c31d7b8869
Binary files /dev/null and b/gapic/res/icons/add.png differ
diff --git a/gapic/res/icons/add@2x.png b/gapic/res/icons/add@2x.png
new file mode 100644
index 0000000000..c04b523c48
Binary files /dev/null and b/gapic/res/icons/add@2x.png differ
diff --git a/gapic/res/icons/clipboard.png b/gapic/res/icons/clipboard.png
new file mode 100644
index 0000000000..12fad35970
Binary files /dev/null and b/gapic/res/icons/clipboard.png differ
diff --git a/gapic/res/icons/clipboard@2x.png b/gapic/res/icons/clipboard@2x.png
new file mode 100644
index 0000000000..7792879709
Binary files /dev/null and b/gapic/res/icons/clipboard@2x.png differ
diff --git a/gapic/res/icons/help.png b/gapic/res/icons/help.png
new file mode 100755
index 0000000000..b6126844b8
Binary files /dev/null and b/gapic/res/icons/help.png differ
diff --git a/gapic/res/icons/help@2x.png b/gapic/res/icons/help@2x.png
new file mode 100755
index 0000000000..cf703c422c
Binary files /dev/null and b/gapic/res/icons/help@2x.png differ
diff --git a/gapic/res/icons/open.png b/gapic/res/icons/open.png
new file mode 100644
index 0000000000..b0292d92aa
Binary files /dev/null and b/gapic/res/icons/open.png differ
diff --git a/gapic/res/icons/open@2x.png b/gapic/res/icons/open@2x.png
new file mode 100644
index 0000000000..4f90c63104
Binary files /dev/null and b/gapic/res/icons/open@2x.png differ
diff --git a/gapic/res/icons/recent.png b/gapic/res/icons/recent.png
new file mode 100644
index 0000000000..8a3a509161
Binary files /dev/null and b/gapic/res/icons/recent.png differ
diff --git a/gapic/res/icons/recent@2x.png b/gapic/res/icons/recent@2x.png
new file mode 100644
index 0000000000..9e003f0e93
Binary files /dev/null and b/gapic/res/icons/recent@2x.png differ
diff --git a/gapic/src/main/com/google/gapid/LoadingScreen.java b/gapic/src/main/com/google/gapid/LoadingScreen.java
index 2eb067faf3..dca2374677 100644
--- a/gapic/src/main/com/google/gapid/LoadingScreen.java
+++ b/gapic/src/main/com/google/gapid/LoadingScreen.java
@@ -15,9 +15,25 @@
*/
package com.google.gapid;
+import static com.google.common.base.Preconditions.checkNotNull;
+import static com.google.gapid.util.GapidVersion.GAPID_VERSION;
+import static com.google.gapid.util.GeoUtils.bottomLeft;
+import static com.google.gapid.views.AboutDialog.showHelp;
+import static com.google.gapid.views.TracerDialog.showOpenTraceDialog;
+import static com.google.gapid.views.TracerDialog.showTracingDialog;
+import static com.google.gapid.widgets.Widgets.createComposite;
import static com.google.gapid.widgets.Widgets.createLabel;
+import static com.google.gapid.widgets.Widgets.createLink;
+import static com.google.gapid.widgets.Widgets.createMenuItem;
+import static com.google.gapid.widgets.Widgets.scheduleIfNotDisposed;
+import static com.google.gapid.widgets.Widgets.withMargin;
+import com.google.gapid.models.Analytics.View;
+import com.google.gapid.models.Models;
+import com.google.gapid.proto.service.Service.ClientAction;
+import com.google.gapid.server.Client;
import com.google.gapid.util.Messages;
+import com.google.gapid.util.OS;
import com.google.gapid.widgets.CenteringLayout;
import com.google.gapid.widgets.Theme;
import com.google.gapid.widgets.Widgets;
@@ -27,18 +43,29 @@
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Link;
+import org.eclipse.swt.widgets.Menu;
+
+import java.io.File;
/**
* The loading screen is a minimal view shown while the UI is loading, looking for gapis, etc.
*/
public class LoadingScreen extends Composite {
+ private final Theme theme;
private final Label statusLabel;
+ private final Composite optionsContainer;
+ private Link recentLink;
+ private Models models;
+ private Client client;
+ private Widgets widgets;
public LoadingScreen(Composite parent, Theme theme) {
super(parent, SWT.NONE);
+ this.theme = theme;
setLayout(CenteringLayout.goldenRatio());
- Composite container = Widgets.createComposite(this, new GridLayout(1, false));
+ Composite container = createComposite(this, new GridLayout(1, false));
createLabel(container, "", theme.dialogLogo())
.setLayoutData(new GridData(SWT.CENTER, SWT.TOP, true, false));
@@ -46,12 +73,76 @@ public LoadingScreen(Composite parent, Theme theme) {
titleLabel.setFont(theme.bigBoldFont());
titleLabel.setLayoutData(new GridData(SWT.CENTER, SWT.TOP, true, false));
+ Label versionLabel = createLabel(container, "Version " + GAPID_VERSION.toFriendlyString());
+ versionLabel.setForeground(theme.welcomeVersionColor());
+ versionLabel.setLayoutData(new GridData(SWT.CENTER, SWT.TOP, true, false));
+
statusLabel = createLabel(container, "Starting up...");
- statusLabel.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, true, false));
+ statusLabel.setLayoutData(new GridData(SWT.CENTER, SWT.TOP, true, false));
+
+ optionsContainer = createComposite(container, withMargin(new GridLayout(3, false), 15, 5));
+ optionsContainer.setLayoutData(new GridData(SWT.CENTER, SWT.TOP, true, false));
+ createOptions();
}
public void setText(String status) {
statusLabel.setText(status);
statusLabel.requestLayout();
}
+
+ /**
+ * Hide the messaging box and display the links after server set up.
+ */
+ public void showOptions(Client newClient, Models newModels, Widgets newWidgets) {
+ this.client = newClient;
+ this.models = newModels;
+ this.widgets = newWidgets;
+
+ statusLabel.setVisible(false);
+ optionsContainer.setVisible(true);
+ if (models.settings.getRecent().length <= 0) {
+ recentLink.setEnabled(false);
+ }
+ }
+
+ /**
+ * Initialize the links for layout settings. Hide them until server set up.
+ */
+ private void createOptions() {
+ createLabel(optionsContainer, "", theme.add());
+ createLink(optionsContainer, "Capture a new trace", e -> {
+ showTracingDialog(checkNotNull(client), getShell(), checkNotNull(models), checkNotNull(widgets));
+ });
+ Label captureHint = createLabel(optionsContainer, (OS.isMac ? "\u2318" : "Ctrl") + " + T");
+ captureHint.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, false));
+ captureHint.setForeground(theme.shortcutKeyHintColor());
+
+ createLabel(optionsContainer, "", theme.open());
+ createLink(optionsContainer, "Open an existing trace", e -> {
+ showOpenTraceDialog(getShell(), checkNotNull(this.models));
+ });
+ Label openHint = createLabel(optionsContainer, (OS.isMac ? "\u2318" : "Ctrl") + " + O");
+ openHint.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, false));
+ openHint.setForeground(theme.shortcutKeyHintColor());
+
+ createLabel(optionsContainer, "", theme.recent());
+ recentLink = createLink(optionsContainer, "Open recent traces", e -> {
+ Menu popup = new Menu(optionsContainer);
+ for (String file : checkNotNull(models).settings.recentFiles) {
+ createMenuItem(popup, file, 0, ev -> {
+ checkNotNull(models).analytics.postInteraction(View.Welcome, ClientAction.OpenRecent);
+ checkNotNull(models).capture.loadCapture(new File(file));
+ });
+ }
+ popup.addListener(SWT.Hide, ev -> scheduleIfNotDisposed(popup, popup::dispose));
+ popup.setLocation(optionsContainer.toDisplay(bottomLeft(((Link)e.widget).getBounds())));
+ popup.setVisible(true);
+ });
+ recentLink.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, false, 2, 1));
+
+ createLabel(optionsContainer, "", theme.help());
+ createLink(optionsContainer, "Help", e -> showHelp(models.analytics));
+
+ optionsContainer.setVisible(false);
+ }
}
diff --git a/gapic/src/main/com/google/gapid/Main.java b/gapic/src/main/com/google/gapid/Main.java
index 6a32e767f7..61d5740e6c 100644
--- a/gapic/src/main/com/google/gapid/Main.java
+++ b/gapic/src/main/com/google/gapid/Main.java
@@ -18,7 +18,6 @@
import static com.google.gapid.util.GapidVersion.GAPID_VERSION;
import static com.google.gapid.views.ErrorDialog.showErrorDialog;
import static com.google.gapid.views.WelcomeDialog.showFirstTimeDialog;
-import static com.google.gapid.views.WelcomeDialog.showWelcomeDialog;
import static com.google.gapid.widgets.Widgets.scheduleIfNotDisposed;
import com.google.common.base.Throwables;
@@ -147,8 +146,6 @@ private void uiStartup(Shell shell) {
Runnable onStart = () -> {
if (args.length == 1) {
models.capture.loadCapture(new File(args[0]));
- } else if (!models.settings.skipWelcomeScreen) {
- showWelcomeDialog(server.getClient(), window.getShell(), models, widgets);
}
};
@@ -158,6 +155,9 @@ private void uiStartup(Shell shell) {
} else {
shell.getDisplay().asyncExec(() -> showFirstTimeDialog(shell, models, widgets, onStart));
}
+
+ // Add the links on Loading Screen after the server set up.
+ window.updateLoadingScreen(server.getClient(), models, widgets);
}
@Override
diff --git a/gapic/src/main/com/google/gapid/MainWindow.java b/gapic/src/main/com/google/gapid/MainWindow.java
index 739ceb5003..4764b022eb 100644
--- a/gapic/src/main/com/google/gapid/MainWindow.java
+++ b/gapic/src/main/com/google/gapid/MainWindow.java
@@ -98,6 +98,10 @@ public void showLoadingMessage(String status) {
loadingScreen.setText(status);
}
+ public void updateLoadingScreen(Client client, Models models, Widgets widgets) {
+ loadingScreen.showOptions(client, models, widgets);
+ }
+
public void initMainUi(Client client, Models models, Widgets widgets) {
Shell shell = getShell();
@@ -130,7 +134,7 @@ public void onCaptureLoaded(Message error) {
if (OS.isMac) {
MacApplication.init(shell.getDisplay(),
- () -> showAbout(shell, models.analytics, widgets.theme),
+ () -> showAbout(shell, models.analytics, widgets),
() -> showSettingsDialog(shell, models, widgets.theme),
file -> models.capture.loadCapture(new File(file)));
}
@@ -347,7 +351,7 @@ private MenuManager createHelpMenu(Client client, Models models, Widgets widgets
MenuManager manager = new MenuManager("&Help");
manager.add(MenuItems.HelpOnlineHelp.create(() -> showHelp(models.analytics)));
manager.add(MenuItems.HelpAbout.create(
- () -> showAbout(getShell(), models.analytics, widgets.theme)));
+ () -> showAbout(getShell(), models.analytics, widgets)));
manager.add(MenuItems.HelpShowLogs.create(() -> showLogDir(models.analytics)));
manager.add(MenuItems.HelpLicenses.create(
() -> showLicensesDialog(getShell(), models.analytics, widgets.theme)));
diff --git a/gapic/src/main/com/google/gapid/views/AboutDialog.java b/gapic/src/main/com/google/gapid/views/AboutDialog.java
index cc624e9c3d..897a761fb4 100644
--- a/gapic/src/main/com/google/gapid/views/AboutDialog.java
+++ b/gapic/src/main/com/google/gapid/views/AboutDialog.java
@@ -16,10 +16,10 @@
package com.google.gapid.views;
import static com.google.gapid.util.GapidVersion.GAPID_VERSION;
-import static com.google.gapid.widgets.Widgets.centered;
import static com.google.gapid.widgets.Widgets.createComposite;
import static com.google.gapid.widgets.Widgets.createLabel;
import static com.google.gapid.widgets.Widgets.createTextbox;
+import static com.google.gapid.widgets.Widgets.withMargin;
import static java.util.logging.Level.SEVERE;
import com.google.gapid.models.Analytics;
@@ -30,15 +30,17 @@
import com.google.gapid.util.Messages;
import com.google.gapid.util.OS;
import com.google.gapid.widgets.DialogBase;
-import com.google.gapid.widgets.Theme;
+import com.google.gapid.widgets.Widgets;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.RowLayout;
+import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.program.Program;
+import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
@@ -69,9 +71,9 @@ public static void showLogDir(Analytics analytics) {
}
}
- public static void showAbout(Shell shell, Analytics analytics, Theme theme) {
+ public static void showAbout(Shell shell, Analytics analytics, Widgets widgets) {
analytics.postInteraction(View.About, ClientAction.Show);
- new DialogBase(shell, theme) {
+ new DialogBase(shell, widgets.theme) {
@Override
public String getTitle() {
return Messages.ABOUT_TITLE;
@@ -81,12 +83,25 @@ public String getTitle() {
protected Control createDialogArea(Composite parent) {
Composite area = (Composite)super.createDialogArea(parent);
- Composite container = createComposite(area, centered(new RowLayout(SWT.VERTICAL)));
- container.setLayoutData(new GridData(SWT.CENTER, SWT.FILL, true, true));
+ Composite container = createComposite(area, withMargin(new GridLayout(2, false), 20, 5));
+ container.setLayoutData(new GridData(SWT.CENTER, SWT.FILL, true, false));
+
+ Label logo = createLabel(container, "", theme.dialogLogo());
+ logo.setLayoutData(new GridData(SWT.CENTER, SWT.FILL, true, false, 2, 1));
- createLabel(container, "", theme.dialogLogo());
Text title = createForegroundLabel(container, Messages.WINDOW_TITLE);
title.setFont(theme.bigBoldFont());
+ title.setLayoutData(new GridData(SWT.CENTER, SWT.FILL, true, false, 2, 1));
+
+ createLabel(container, "").setLayoutData(new GridData(SWT.CENTER, SWT.FILL, true, true, 2, 1));
+ Button clipboard = Widgets.createButton(container, "", e -> {
+ String textData = "Version " + GAPID_VERSION;
+ widgets.copypaste.setContents(textData);
+ });
+
+ clipboard.setImage(theme.clipboard());
+ clipboard.setLayoutData(new GridData(SWT.CENTER, SWT.BEGINNING, true, true, 1, 3));
+
createForegroundLabel(container, "Version " + GAPID_VERSION);
createForegroundLabel(
container, "Server: " + Info.getServerName() + ", Version: " + Info.getServerVersion());
diff --git a/gapic/src/main/com/google/gapid/widgets/CopyPaste.java b/gapic/src/main/com/google/gapid/widgets/CopyPaste.java
index 1f67cf2485..58aac00b49 100644
--- a/gapic/src/main/com/google/gapid/widgets/CopyPaste.java
+++ b/gapic/src/main/com/google/gapid/widgets/CopyPaste.java
@@ -129,6 +129,10 @@ protected void doCopy(CopySource source) {
clipboard.setContents(objs, transfers);
}
+ public void setContents(String s) {
+ clipboard.setContents(new Object[]{s}, new Transfer[]{TextTransfer.getInstance()});
+ }
+
public void addListener(Listener listener) {
listeners.addListener(listener);
}
diff --git a/gapic/src/main/com/google/gapid/widgets/Theme.java b/gapic/src/main/com/google/gapid/widgets/Theme.java
index 7e1c184b6e..6652d4fa17 100644
--- a/gapic/src/main/com/google/gapid/widgets/Theme.java
+++ b/gapic/src/main/com/google/gapid/widgets/Theme.java
@@ -54,12 +54,14 @@
* {@link Color colors}, etc.).
*/
public interface Theme {
+ @Icon(file = "add.png") public Image add();
@Icon(file = "android.png", color = 0x335577) public Image androidLogo();
@Icon(file = "arrow.png") public Image arrow();
@Icon(file = "arrow_drop_down.png") public Image arrowDropDownLight();
@Icon(file = "arrow_drop_right.png") public Image arrowDropRightLight();
@Icon(file = "arrow_drop_down.png", color = 0xFFFFFF) public Image arrowDropDownDark();
@Icon(file = "arrow_drop_right.png", color = 0xFFFFFF) public Image arrowDropRightDark();
+ @Icon(file = "clipboard.png") public Image clipboard();
@Icon(file = "color_buffer0.png") public Image colorBuffer0();
@Icon(file = "color_buffer1.png") public Image colorBuffer1();
@Icon(file = "color_buffer2.png") public Image colorBuffer2();
@@ -72,16 +74,19 @@ public interface Theme {
@Icon(file = "flat.png") public Image flat();
@Icon(file = "flip_vertically.png") public Image flipVertically();
@Icon(file = "jump.png") public Image jump();
+ @Icon(file = "help.png") public Image help();
@Icon(file = "histogram.png") public Image toggleHistogram();
@Icon(file = "lit.png") public Image lit();
@Icon(file = "logo_128.png") public Image dialogLogo();
@Icon(file = "normals.png") public Image normals();
+ @Icon(file = "open.png") public Image open();
@Icon(file = "overdraw.png") public Image overdraw();
@Icon(file = "point_cloud.png") public Image pointCloud();
@Icon(file = "range_start.png") public Image rangeStartLight();
@Icon(file = "range_end.png") public Image rangeEndLight();
@Icon(file = "range_start.png", color = 0xFFFFFF) public Image rangeStartDark();
@Icon(file = "range_end.png", color = 0xFFFFFF) public Image rangeEndDark();
+ @Icon(file = "recent.png") public Image recent();
@Icon(file = "refresh.png") public Image refresh();
@Icon(file = "save.png") public Image save();
@Icon(file = "settings.png") public Image settings();
@@ -125,6 +130,7 @@ public interface Theme {
// About & Welcome dialog text colors
@RGB(argb = 0xffa9a9a9) public Color welcomeVersionColor();
+ @RGB(argb = 0xffa9a9a9) public Color shortcutKeyHintColor();
// Logging view colors by log level.
@RGB(argb = 0xbb000000) public Color logVerboseForeground();