main.js
Go to the documentation of this file.
1 /*
2  *=BEGIN SONGBIRD GPL
3  *
4  * This file is part of the Songbird web player.
5  *
6  * Copyright(c) 2005-2011 POTI, Inc.
7  * http://www.songbirdnest.com
8  *
9  * This file may be licensed under the terms of of the
10  * GNU General Public License Version 2 (the ``GPL'').
11  *
12  * Software distributed under the License is distributed
13  * on an ``AS IS'' basis, WITHOUT WARRANTY OF ANY KIND, either
14  * express or implied. See the GPL for the specific language
15  * governing rights and limitations.
16  *
17  * You should have received a copy of the GPL along with this
18  * program. If not, go to http://www.gnu.org/licenses/gpl.html
19  * or write to the Free Software Foundation, Inc.,
20  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21  *
22  *=END SONGBIRD GPL
23  */
24 
25 
26 // Make a namespace.
27 if (typeof QATestTools == 'undefined') {
28  var QATestTools = {};
29 }
30 
31 QATestTools.Controller =
32 {
33  onLoad: function()
34  {
35  this.addPlaylistGetInfo();
36  },
37 
38  addPlaylistGetInfo: function() {
39  var cmdHelper = Cc["@songbirdnest.com/Songbird/PlaylistCommandsHelper;1"]
40  .getService(Ci.sbIPlaylistCommandsHelper);
41  this.getInfoCmd = cmdHelper.createCommandObjectForAction
42  ("medialist-getinfo",
43  "Get Playlist Info",
44  "Get Playlist Info",
45  this.displayPlaylistInfo);
46  cmdHelper.addCommandObjectForType(cmdHelper.TARGET_SERVICEPANE_MENU,
47  "simple",
48  this.getInfoCmd);
49  cmdHelper.addCommandObjectForType(cmdHelper.TARGET_SERVICEPANE_MENU,
50  "smart",
51  this.getInfoCmd);
52  },
53 
54  displayPlaylistInfo: function(aContext, aSubMenuId, aCommandId, aHost) {
55  this._medialist = aContext.medialist;
56 
57  WindowUtils.openModalDialog
58  (window,
59  "chrome://mockcdcontroller/content/playlistInfoDialog.xul",
60  "",
61  "",
62  [ this._medialist ],
63  null);
64  },
65 
66  onUnload: function()
67  {
68  var cmdHelper = Cc["@songbirdnest.com/Songbird/PlaylistCommandsHelper;1"]
69  .getService(Ci.sbIPlaylistCommandsHelper);
70  cmdHelper.removeCommandObjectForType(cmdHelper.TARGET_SERVICEPANE_MENU,
71  "simple",
72  this.getInfoCmd);
73  cmdHelper.removeCommandObjectForType(cmdHelper.TARGET_SERVICEPANE_MENU,
74  "smart",
75  this.getInfoCmd);
76  }
77 }
78 
79 // Make a namespace.
80 if (typeof MockCDController == 'undefined') {
81  var MockCDController = {};
82 }
83 
87 MockCDController.Controller =
88 {
89  onLoad: function()
90  {
91  var showCommand =
92  document.getElementById("mockcdcontroller-showcontroller-cmd");
93 
94  var self = this;
95  showCommand.addEventListener(
96  "command",
97  function() { self.showCDControllerPane(); },
98  false);
99 
100  var showCommandDevice =
101  document.getElementById("mockdevicecontroller-showcontroller-cmd");
102 
103  showCommandDevice.addEventListener(
104  "command",
105  function() { self.showDeviceControllerPane(); },
106  false);
107 
108  var showDeviceCapsDump =
109  document.getElementById("dumpdevicecaps-cmd");
110 
111  showDeviceCapsDump.addEventListener(
112  "command",
113  function() { self.showDeviceCapsDump(); },
114  false);
115 
116  var showFakePDS =
117  document.getElementById("fakepds-cmd");
118 
119  showFakePDS.addEventListener(
120  "command",
121  function() { self.showFakePDS(); },
122  false);
123 
124  // Only open the controller pane if the pref is currently set.
125  if (Application.prefs.getValue("extensions.cdripcontroller.startup_show_controller",
126  false)) {
127  setTimeout(function() { self.showCDControllerPane(); }, 200);
128  }
129  },
130 
131  showCDControllerPane: function()
132  {
133  window.openDialog("chrome://mockcdcontroller/content/mockCDControllerDialog.xul",
134  "cd-controller-pane",
135  "chrome,centerscreen,resizable=false");
136  },
137 
138  showDeviceControllerPane: function()
139  {
140  window.openDialog("chrome://mockcdcontroller/content/deviceControllerDialog.xul",
141  "device-controller-pane",
142  "chrome,centerscreen,resizable=false");
143  },
144 
145  showDeviceCapsDump: function()
146  {
147  window.openDialog(
148  "chrome://mockcdcontroller/content/deviceCapsDump.xul",
149  "device-caps-dump-dialog",
150  "chrome,centerscreen,resizable=yes");
151  },
152 
153  showFakePDS: function() {
154  window.openDialog(
155  "chrome://mockcdcontroller/content/fakePDS.xul",
156  "fakepds-dialog",
157  "chrome,centerscreen,resizable=yes");
158  },
159 };
160 
161 window.addEventListener("load",
162  function(e) { QATestTools.Controller.onLoad(e);
163  MockCDController.Controller.onLoad(e); },
164  false);
165 
166 window.addEventListener("unload",
167  function(e) { QATestTools.Controller.onUnload(e); },
168  false);
const Cc
var Application
Definition: sbAboutDRM.js:37
_updateCookies aHost
let window
Lastfm onLoad
Definition: mini.js:36
aWindow setTimeout(function(){_this.restoreHistory(aWindow, aTabs, aTabData, aIdMap);}, 0)
return null
Definition: FeedWriter.js:1143
const Ci
function onUnload()
onUnload - called when the cover preview window unloads.
Definition: coverPreview.js:36