Changeset 1102 for trunk/src/org/apollo/agents/MelodySearch.java
- Timestamp:
- 05/10/18 16:04:51 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/apollo/agents/MelodySearch.java
r903 r1102 1 1 package org.apollo.agents; 2 2 3 import java.awt.Color;4 3 import java.io.File; 5 4 import java.io.FileNotFoundException; … … 10 9 11 10 import javax.sound.sampled.AudioFormat; 12 import javax.swing.SwingUtilities;13 11 14 12 import org.apollo.ApolloSystem; … … 26 24 import org.apollo.widgets.TrackWidgetCommons; 27 25 import org.expeditee.agents.SearchAgent; 26 import org.expeditee.core.Colour; 27 import org.expeditee.gui.DisplayController; 28 28 import org.expeditee.gui.Frame; 29 import org.expeditee.gui.FrameGraphics;30 29 import org.expeditee.gui.FrameIO; 31 import org.expeditee.settings.UserSettings;32 30 import org.expeditee.settings.folders.FolderSettings; 33 31 import org.expeditee.items.Item; 34 32 import org.expeditee.items.ItemUtils; 35 import org.expeditee.items.widgets. InteractiveWidget;33 import org.expeditee.items.widgets.Widget; 36 34 import org.expeditee.items.widgets.WidgetCorner; 37 35 import org.expeditee.items.widgets.WidgetEdge; … … 42 40 * Uses meldex. Thanks David Bainbridge. 43 41 * 44 * The agent runs a quer ry on the given track widget that launched it.42 * The agent runs a query on the given track widget that launched it. 45 43 * If the track launches it it does a full search for all tracks on the current frameset. 46 44 * … … 96 94 */ 97 95 @Override 98 public boolean initialise(Frame frame, Item item) { 96 public boolean initialise(Frame frame, Item item) 97 { 99 98 if (!super.initialise(frame, item)) return false; 100 99 … … 104 103 if (item != null) { 105 104 106 InteractiveWidget iw = null;105 Widget iw = null; 107 106 108 107 if (item instanceof WidgetCorner) { … … 162 161 163 162 if (querryMelody == null) { // abort - failed to get audio 164 SwingUtilities.invokeLater(new ExpediteeMessageBayFeedback( 165 "Melody search aborted: Failed to load tracks audio")); 163 overwriteMessage("Melody search aborted: Failed to load tracks audio"); 166 164 _results.addText("Melody search aborted: querry data not good enough to search with", 167 Colo r.RED, null, null, false);165 Colour.RED, null, null, false); 168 166 _results.addText("Click here for help on melody searches", 169 new Color(0, 180, 0), ApolloSystem.HELP_MELODYSEARCH_FRAMENAME, null, false);167 Colour.FromRGB255(0, 180, 0), ApolloSystem.HELP_MELODYSEARCH_FRAMENAME, null, false); 170 168 171 169 _results.save(); … … 186 184 187 185 if (querryMelody == null) { // abort - failed to get audio 188 SwingUtilities.invokeLater(new ExpediteeMessageBayFeedback( 189 "Melody search aborted: Failed to proccess querry data")); 190 _results.addText("Melody search aborted: querry data not good enough to search with", Color.RED, null, null, false); 186 overwriteMessage("Melody search aborted: Failed to proccess querry data"); 187 _results.addText("Melody search aborted: querry data not good enough to search with", Colour.RED, null, null, false); 191 188 _results.addText("Click here for help on melody searches", 192 new Color(0, 180, 0), ApolloSystem.HELP_MELODYSEARCH_FRAMENAME, null, false);189 Colour.FromRGB255(0, 180, 0), ApolloSystem.HELP_MELODYSEARCH_FRAMENAME, null, false); 193 190 _results.save(); 194 191 return null; … … 240 237 if(!results.isEmpty()) { 241 238 _results.addText(frameName + "(" + results.size() + ")", null, frameName, null, false); 242 FrameGraphics.requestRefresh(true);239 DisplayController.requestRefresh(true); 243 240 } 244 241 … … 395 392 396 393 if (melodyScores.isEmpty() || melodyScores.get(0).getScore() > threshold) { 397 _results.addText("No matches", Colo r.RED, null, null, false);394 _results.addText("No matches", Colour.RED, null, null, false); 398 395 _results.addText("Click here to find out how to improve your melody searches", 399 new Color(0, 180, 0), ApolloSystem.HELP_MELODYSEARCH_FRAMENAME, null, false);396 Colour.FromRGB255(0, 180, 0), ApolloSystem.HELP_MELODYSEARCH_FRAMENAME, null, false); 400 397 } else { 401 398 … … 426 423 427 424 if (_stop) { 428 _results.addText("Search cancelled", Colo r.RED, null, null, false);425 _results.addText("Search cancelled", Colour.RED, null, null, false); 429 426 } 430 427 … … 444 441 445 442 } 446 447 448 449 443 450 444 /** … … 470 464 471 465 } 472 473 /**474 * Safely outputs a message on the messagebay .. if ran on swing thread.475 * @author Brook Novak476 *477 */478 private class ExpediteeMessageBayFeedback implements Runnable {479 480 String feedbackMessage;481 482 public ExpediteeMessageBayFeedback(String feedbackMessage) {483 assert(feedbackMessage != null);484 this.feedbackMessage = feedbackMessage;485 }486 487 488 public void run() {489 assert(feedbackMessage != null);490 overwriteMessage(feedbackMessage);491 }492 }493 494 495 466 }
Note:
See TracChangeset
for help on using the changeset viewer.