diff --git a/TODO b/TODO index 3c371609..070036b8 100644 --- a/TODO +++ b/TODO @@ -1,7 +1,3 @@ -Before 3.0 beta: - -* export/import of settings (profiles?) - Before 3.0: * command-line scanning start @@ -10,8 +6,8 @@ Before 3.0: * add new fetchers by configuration of PortTextFetcher * startup as root option * compile librocksaw for mac -* preferences & select fetchers buttons in the toolbar * plugin loader +* export/import of settings (profiles?) Later: diff --git a/dictionary.txt b/dictionary.txt index b18c3497..399b9916 100644 --- a/dictionary.txt +++ b/dictionary.txt @@ -30,3 +30,4 @@ compiz placeholder firewall registry +combo diff --git a/resources/Labels.txt b/resources/Labels.txt index f5fce890..29574150 100755 --- a/resources/Labels.txt +++ b/resources/Labels.txt @@ -79,7 +79,7 @@ text.threads=Threads: text.display.ALL=Display: All text.display.ALIVE=Display: Alive only text.display.PORTS=Display: Open ports -text.hostsSelected= hosts selected +text.hostsSelected=\u00A0hosts selected text.favorite.add=Enter the name of the new favorite text.favorite.edit=Below you can rearrange or delete favorites text.find=Enter the text to search for @@ -133,6 +133,8 @@ button.kill=Stop! button.kill.img=images/buttons/kill.png button.ipUp=IP button.ipUp.img=images/buttons/ipup.png +button.preferences.img=images/buttons/prefs.png +button.fetchers.img=images/buttons/fetchers.png button.up=&Up button.down=&Down button.delete=De&lete diff --git a/resources/images/buttons/fetchers.png b/resources/images/buttons/fetchers.png new file mode 100644 index 00000000..36bcbebf Binary files /dev/null and b/resources/images/buttons/fetchers.png differ diff --git a/resources/images/buttons/fetchers.svg b/resources/images/buttons/fetchers.svg new file mode 100644 index 00000000..1476aeb1 --- /dev/null +++ b/resources/images/buttons/fetchers.svg @@ -0,0 +1,281 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/resources/images/buttons/fetchers2.png b/resources/images/buttons/fetchers2.png new file mode 100644 index 00000000..886804a6 Binary files /dev/null and b/resources/images/buttons/fetchers2.png differ diff --git a/resources/images/buttons/prefs.png b/resources/images/buttons/prefs.png new file mode 100644 index 00000000..5c15a416 Binary files /dev/null and b/resources/images/buttons/prefs.png differ diff --git a/resources/images/buttons/prefs.svg b/resources/images/buttons/prefs.svg new file mode 100644 index 00000000..26f2ef8e --- /dev/null +++ b/resources/images/buttons/prefs.svg @@ -0,0 +1,238 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + diff --git a/src/net/azib/ipscan/config/ComponentRegistry.java b/src/net/azib/ipscan/config/ComponentRegistry.java index efdf501d..77ea5d45 100755 --- a/src/net/azib/ipscan/config/ComponentRegistry.java +++ b/src/net/azib/ipscan/config/ComponentRegistry.java @@ -149,6 +149,8 @@ public class ComponentRegistry { anyComponentParameter, anyComponentParameter, anyComponentParameter, + anyComponentParameter, + anyComponentParameter, anyComponentParameter}); container.registerComponentImplementation(ResultTable.class, ResultTable.class, new Parameter[] { new ComponentParameter("mainShell"), @@ -186,6 +188,8 @@ public class ComponentRegistry { container.registerComponentImplementation(ColumnsActions.AboutFetcher.class); container.registerComponentImplementation(ColumnsActions.ColumnClick.class); container.registerComponentImplementation(ColumnsActions.ColumnResize.class); + container.registerComponentImplementation(ToolsActions.Preferences.class); + container.registerComponentImplementation(ToolsActions.ChooseFetchers.class); container.registerComponentImplementation(ToolsActions.TableSelection.class); } diff --git a/src/net/azib/ipscan/gui/MainWindow.java b/src/net/azib/ipscan/gui/MainWindow.java index 4e7052df..105f994c 100755 --- a/src/net/azib/ipscan/gui/MainWindow.java +++ b/src/net/azib/ipscan/gui/MainWindow.java @@ -15,6 +15,7 @@ import net.azib.ipscan.core.state.StateMachine; import net.azib.ipscan.core.state.StateTransitionListener; import net.azib.ipscan.gui.MainMenu.CommandsMenu; import net.azib.ipscan.gui.actions.StartStopScanningAction; +import net.azib.ipscan.gui.actions.ToolsActions; import net.azib.ipscan.gui.feeders.AbstractFeederGUI; import net.azib.ipscan.gui.feeders.FeederGUIRegistry; import net.azib.ipscan.gui.util.LayoutHelper; @@ -32,6 +33,7 @@ import org.eclipse.swt.layout.RowLayout; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Combo; import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Event; import org.eclipse.swt.widgets.Listener; import org.eclipse.swt.widgets.MessageBox; @@ -54,18 +56,20 @@ public class MainWindow { private Combo feederSelectionCombo; private FeederGUIRegistry feederRegistry; + private Button prefsButton; + private Button fetchersButton; /** * Creates and initializes the main window. */ - public MainWindow(Shell shell, GlobalConfig globalConfig, Composite feederArea, Composite controlsArea, Combo feederSelectionCombo, Button startStopButton, StartStopScanningAction startStopScanningAction, ResultTable resultTable, StatusBar statusBar, CommandsMenu resultsContextMenu, FeederGUIRegistry feederGUIRegistry, StateMachine stateMachine) { + public MainWindow(Shell shell, GlobalConfig globalConfig, Composite feederArea, Composite controlsArea, Combo feederSelectionCombo, Button startStopButton, StartStopScanningAction startStopScanningAction, ResultTable resultTable, StatusBar statusBar, CommandsMenu resultsContextMenu, FeederGUIRegistry feederGUIRegistry, StateMachine stateMachine, ToolsActions.Preferences preferencesListener, ToolsActions.ChooseFetchers chooseFetchersListsner) { this.globalConfig = globalConfig; initShell(shell); initFeederArea(feederArea, feederGUIRegistry); - initControlsArea(controlsArea, feederSelectionCombo, startStopButton, startStopScanningAction); + initControlsArea(controlsArea, feederSelectionCombo, startStopButton, startStopScanningAction, preferencesListener, chooseFetchersListsner); initTableAndStatusBar(resultTable, resultsContextMenu, statusBar); @@ -83,7 +87,7 @@ public class MainWindow { if (globalConfig.isFirstRun) { if (Platform.CRIPPLED_WINDOWS) { - // inform crippled windows owners of configuration changes + // inform crippled windows owners of their default configuration MessageBox box = new MessageBox(shell, SWT.ICON_WARNING | SWT.OK); box.setText(Version.NAME); box.setMessage(Labels.getLabel("text.crippledWindowsInfo")); @@ -150,7 +154,7 @@ public class MainWindow { /** * This method initializes main controls of the main window */ - private void initControlsArea(Composite controlsArea, Combo feederSelectionCombo, Button startStopButton, StartStopScanningAction startStopScanningAction) { + private void initControlsArea(final Composite controlsArea, final Combo feederSelectionCombo, final Button startStopButton, final StartStopScanningAction startStopScanningAction, final ToolsActions.Preferences preferencesListener, final ToolsActions.ChooseFetchers chooseFetchersListsner) { controlsArea.setLayoutData(LayoutHelper.formData(new FormAttachment(feederArea), new FormAttachment(100), new FormAttachment(0), new FormAttachment(feederArea, 0, SWT.BOTTOM))); RowLayout rowLayout = new RowLayout(SWT.VERTICAL); @@ -182,6 +186,31 @@ public class MainWindow { ((RowData)startStopButton.getLayoutData()).height = feederSelectionCombo.getBounds().height; ((RowData)startStopButton.getLayoutData()).width = feederSelectionCombo.getBounds().width; + + // traverse the button before the combo (and don't traverse other buttons at all) + controlsArea.setTabList(new Control[] {startStopButton, feederSelectionCombo}); + + prefsButton = new Button(controlsArea, SWT.NONE); + prefsButton.setImage(new Image(null, Labels.getInstance().getImageAsStream("button.preferences.img"))); + prefsButton.setToolTipText(Labels.getLabel("title.preferences")); + prefsButton.setLayoutData(new RowData(controlHeight, controlHeight)); + prefsButton.addListener(SWT.Selection, new Listener() { + public void handleEvent(Event event) { + startStopButton.forceFocus(); + preferencesListener.handleEvent(event); + } + }); + + fetchersButton = new Button(controlsArea, SWT.NONE); + fetchersButton.setImage(new Image(null, Labels.getInstance().getImageAsStream("button.fetchers.img"))); + fetchersButton.setToolTipText(Labels.getLabel("title.fetchers.select")); + fetchersButton.setLayoutData(new RowData(controlHeight, controlHeight)); + fetchersButton.addListener(SWT.Selection, new Listener() { + public void handleEvent(Event event) { + startStopButton.forceFocus(); + chooseFetchersListsner.handleEvent(event); + } + }); } /** @@ -215,7 +244,10 @@ public class MainWindow { shell.getDisplay().asyncExec(new Runnable() { public void run() { - feederSelectionCombo.setEnabled(state == ScanningState.IDLE); + boolean enabled = state == ScanningState.IDLE; + feederSelectionCombo.setEnabled(enabled); + prefsButton.setEnabled(enabled); + fetchersButton.setEnabled(enabled); } }); }