Skip to content

Commit

Permalink
Retina icons support
Browse files Browse the repository at this point in the history
  • Loading branch information
trol73 committed Dec 26, 2016
1 parent 956a767 commit 595c198
Show file tree
Hide file tree
Showing 27 changed files with 29 additions and 14 deletions.
Binary file modified res/runtime/images/action/ConnectToServer.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added res/runtime/images/action/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified res/runtime/images/action/EditCredentials.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added res/runtime/images/action/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added res/runtime/images/action/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added res/runtime/images/action/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified res/runtime/images/action/Email.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added res/runtime/images/action/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added res/runtime/images/action/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added res/runtime/images/action/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added res/runtime/images/action/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added res/runtime/images/action/Finder.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added res/runtime/images/action/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added res/runtime/images/action/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added res/runtime/images/action/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added res/runtime/images/action/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified res/runtime/images/action/ShowServerConnections.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added res/runtime/images/action/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ private String getStandardLabel() {
* @param actionId a String identification of MuAction
* @return the standard icon image corresponding to the specified MuAction, <code>null</code> if none was found
*/
private static ImageIcon getStandardIcon(String actionId) {
protected static ImageIcon getStandardIcon(String actionId) {
// Look for an icon image file with the /action/<action id>.png path and use it if it exists
String iconPath = getStandardIconPath(actionId);
return ResourceLoader.getResourceAsURL(iconPath) == null ? null : IconManager.getIcon(iconPath);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
*/
public class ChangeLocationAction extends ActiveTabAction {

public ChangeLocationAction(MainFrame mainFrame, Map<String, Object> properties) {
ChangeLocationAction(MainFrame mainFrame, Map<String, Object> properties) {
super(mainFrame, properties);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public OpenLocationAction(MainFrame mainFrame, Map<String, Object> properties, F
/**
* Creates a new OpenLocationAction instance using the provided FileURL and label.
*/
public OpenLocationAction(MainFrame mainFrame, Map<String, Object> properties, FileURL url, String label) {
private OpenLocationAction(MainFrame mainFrame, Map<String, Object> properties, FileURL url, String label) {
super(mainFrame, properties);

this.url = url;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
*/
public class PopupLeftDriveButtonAction extends MuAction implements ActiveTabListener {

public PopupLeftDriveButtonAction(MainFrame mainFrame, Map<String,Object> properties) {
PopupLeftDriveButtonAction(MainFrame mainFrame, Map<String, Object> properties) {
super(mainFrame, properties);

mainFrame.getLeftPanel().getTabs().addActiveTabListener(this);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
*/
public class PopupRightDriveButtonAction extends MuAction implements ActiveTabListener {

public PopupRightDriveButtonAction(MainFrame mainFrame, Map<String,Object> properties) {
PopupRightDriveButtonAction(MainFrame mainFrame, Map<String, Object> properties) {
super(mainFrame, properties);

mainFrame.getRightPanel().getTabs().addActiveTabListener(this);
Expand Down
15 changes: 12 additions & 3 deletions src/main/com/mucommander/ui/action/impl/RevealInDesktopAction.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
import com.mucommander.ui.dialog.InformationDialog;
import com.mucommander.ui.main.MainFrame;

import javax.swing.KeyStroke;
import javax.swing.*;
import java.awt.event.KeyEvent;
import java.util.Map;

Expand All @@ -42,7 +42,7 @@
*/
public class RevealInDesktopAction extends ParentFolderAction {

public RevealInDesktopAction(MainFrame mainFrame, Map<String,Object> properties) {
RevealInDesktopAction(MainFrame mainFrame, Map<String, Object> properties) {
super(mainFrame, properties);

setEnabled(DesktopManager.canOpenInFileManager());
Expand Down Expand Up @@ -91,7 +91,16 @@ public KeyStroke getDefaultKeyStroke() {

@Override
public String getLabel() {
return Translator.get(ActionProperties.getActionLabelKey(RevealInDesktopAction.Descriptor.ACTION_ID), DesktopManager.canOpenInFileManager()?DesktopManager.getFileManagerName():Translator.get("file_manager"));
return Translator.get(ActionProperties.getActionLabelKey(RevealInDesktopAction.Descriptor.ACTION_ID),
DesktopManager.canOpenInFileManager() ? DesktopManager.getFileManagerName() : Translator.get("file_manager"));
}

@Override
public ImageIcon getIcon() {
if (OsFamily.getCurrent() == OsFamily.MAC_OS_X) {
return super.getStandardIcon("Finder");
}
return super.getIcon();
}

public MuAction createAction(MainFrame mainFrame, Map<String,Object> properties) {
Expand Down
10 changes: 7 additions & 3 deletions src/main/com/mucommander/ui/main/DrivePopupButton.java
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ public class DrivePopupButton extends PopupButton implements BookmarkListener, C
*
* @param folderPanel the FolderPanel instance this button will be added to
*/
public DrivePopupButton(FolderPanel folderPanel) {
DrivePopupButton(FolderPanel folderPanel) {
this.folderPanel = folderPanel;

// Listen to location events to update the button when the current folder changes
Expand Down Expand Up @@ -352,10 +352,14 @@ public JPopupMenu getPopupMenu() {
if (!location.contains("://")) {
AbstractFile file = FileFactory.getFile(location);
if (file != null) {
Image icon = FileIconsCache.getInstance().getImageIcon(file);
Icon icon = FileIconsCache.getInstance().getIcon(file);
if (icon != null) {
item.setIcon(new ImageIcon(icon));
item.setIcon(icon);
}
// Image image = FileIconsCache.getInstance().getImageIcon(file);
// if (image != null) {
// item.setIcon(new ImageIcon(image));
// }
}
} else if (location.startsWith("ftp://") || location.startsWith("sftp://") || location.startsWith("http://")) {
item.setIcon(IconManager.getIcon(IconManager.IconSet.FILE, CustomFileIconProvider.NETWORK_ICON_NAME));
Expand Down
6 changes: 5 additions & 1 deletion src/main/com/mucommander/utils/FileIconsCache.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import com.mucommander.commons.file.FileFactory;
import com.mucommander.commons.file.FileURL;
import com.mucommander.ui.icon.FileIcons;
import ru.trolsoft.macosx.RetinaImageIcon;

import javax.swing.*;
import java.awt.*;
Expand Down Expand Up @@ -99,7 +100,10 @@ public Icon getIcon(String path) {

public Image getImageIcon(AbstractFile file) {
Icon icon = getIcon(file);
if (icon instanceof ImageIcon) {
System.out.println("> " + icon.getClass().getName());
if (icon instanceof RetinaImageIcon) {
return ((RetinaImageIcon) icon).getImage();
} else if (icon instanceof ImageIcon) {
return ((ImageIcon)icon).getImage();
} else {
int w = icon.getIconWidth();
Expand Down
2 changes: 0 additions & 2 deletions src/main/ru/trolsoft/macosx/RetinaImageIcon.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
*/
package ru.trolsoft.macosx;

import sun.swing.ImageIconUIResource;

import javax.swing.*;
import java.awt.*;
import java.awt.image.ImageObserver;
Expand Down

0 comments on commit 595c198

Please sign in to comment.