forked from 0x2620/pandora
add menu entry and keyboard shortcut for application fullscreen
This commit is contained in:
parent
1b5ffde5bd
commit
d6745ad5c8
1 changed files with 18 additions and 6 deletions
|
@ -1,11 +1,13 @@
|
||||||
// vim: et:ts=4:sw=4:sts=4:ft=javascript
|
// vim: et:ts=4:sw=4:sts=4:ft=javascript
|
||||||
// FIXME: this should be mainMenu.js!
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
pandora.ui.mainMenu = function() {
|
pandora.ui.mainMenu = function() {
|
||||||
|
|
||||||
var isGuest = pandora.user.level == 'guest',
|
var isGuest = pandora.user.level == 'guest',
|
||||||
ui = pandora.user.ui,
|
ui = pandora.user.ui,
|
||||||
findState = pandora.getFindState(ui.find),
|
findState = pandora.getFindState(ui.find),
|
||||||
|
fullscreenState = Ox.Fullscreen.getState(),
|
||||||
that = Ox.MainMenu({
|
that = Ox.MainMenu({
|
||||||
extras: [
|
extras: [
|
||||||
pandora.$ui.loadingIcon = Ox.LoadingIcon({
|
pandora.$ui.loadingIcon = Ox.LoadingIcon({
|
||||||
|
@ -110,7 +112,8 @@ pandora.ui.mainMenu = function() {
|
||||||
{ id: 'showannotations', title: (ui.showAnnotations ? 'Hide' : 'Show') + ' Annotations', disabled: !ui.item || ['timeline', 'player', 'editor'].indexOf(ui.itemView) == -1, keyboard: 'shift a' },
|
{ id: 'showannotations', title: (ui.showAnnotations ? 'Hide' : 'Show') + ' Annotations', disabled: !ui.item || ['timeline', 'player', 'editor'].indexOf(ui.itemView) == -1, keyboard: 'shift a' },
|
||||||
{ id: 'showtimeline', title: (ui.showTimeline ? 'Hide' : 'Show') + ' Timeline', disabled: !ui.item || ui.itemView != 'player', keyboard: 'shift t' },
|
{ id: 'showtimeline', title: (ui.showTimeline ? 'Hide' : 'Show') + ' Timeline', disabled: !ui.item || ui.itemView != 'player', keyboard: 'shift t' },
|
||||||
{},
|
{},
|
||||||
{ id: 'fullscreen', title: 'Enter Fullscreen', disabled: !ui.item || ui.itemView != 'player' },
|
{ id: 'toggleapplicationfullscreen', title: (fullscreenState ? 'Exit' : 'Enter') + ' Application Fullscreen', disabled: fullscreenState === void 0, keyboard: 'shift alt control f' },
|
||||||
|
{ id: 'entervideofullscreen', title: 'Enter Video Fullscreen', disabled: !ui.item || ui.itemView != 'player' },
|
||||||
{},
|
{},
|
||||||
{ id: 'theme', title: 'Theme', items: [
|
{ id: 'theme', title: 'Theme', items: [
|
||||||
{ group: 'settheme', min: 1, max: 1, items: [
|
{ group: 'settheme', min: 1, max: 1, items: [
|
||||||
|
@ -291,7 +294,9 @@ pandora.ui.mainMenu = function() {
|
||||||
pandora.UI.set({showAnnotations: !ui.showAnnotations});
|
pandora.UI.set({showAnnotations: !ui.showAnnotations});
|
||||||
} else if (data.id == 'showtimeline') {
|
} else if (data.id == 'showtimeline') {
|
||||||
pandora.UI.set({showTimeline: !ui.showTimeline});
|
pandora.UI.set({showTimeline: !ui.showTimeline});
|
||||||
} else if (data.id == 'fullscreen') {
|
} else if (data.id == 'toggleapplicationfullscreen') {
|
||||||
|
Ox.Fullscreen.toggle();
|
||||||
|
} else if (data.id == 'entervideofullscreen') {
|
||||||
pandora.$ui.player.options({fullscreen: true});
|
pandora.$ui.player.options({fullscreen: true});
|
||||||
} else if (data.id == 'advancedfind') {
|
} else if (data.id == 'advancedfind') {
|
||||||
pandora.$ui.filterDialog = pandora.ui.filterDialog().open();
|
pandora.$ui.filterDialog = pandora.ui.filterDialog().open();
|
||||||
|
@ -353,6 +358,9 @@ pandora.ui.mainMenu = function() {
|
||||||
pandora.$ui.sequencesDialog = pandora.ui.sequencesDialog().open();
|
pandora.$ui.sequencesDialog = pandora.ui.sequencesDialog().open();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
key_alt_control_shift_f: function() {
|
||||||
|
Ox.Fullscreen.toggle();
|
||||||
|
},
|
||||||
key_backtick: function() {
|
key_backtick: function() {
|
||||||
changeFocus(1);
|
changeFocus(1);
|
||||||
},
|
},
|
||||||
|
@ -449,14 +457,14 @@ pandora.ui.mainMenu = function() {
|
||||||
if (!data.value) {
|
if (!data.value) {
|
||||||
that.disableItem('showannotations');
|
that.disableItem('showannotations');
|
||||||
that.disableItem('showtimeline');
|
that.disableItem('showtimeline');
|
||||||
that.disableItem('fullscreen');
|
that.disableItem('entervideofullscreen');
|
||||||
} else {
|
} else {
|
||||||
if (['timeline', 'player', 'editor'].indexOf(ui.itemView) > -1) {
|
if (['timeline', 'player', 'editor'].indexOf(ui.itemView) > -1) {
|
||||||
that.enableItem('showannotations');
|
that.enableItem('showannotations');
|
||||||
}
|
}
|
||||||
if (ui.itemView == 'player') {
|
if (ui.itemView == 'player') {
|
||||||
that.enableItem('showtimeline');
|
that.enableItem('showtimeline');
|
||||||
that.enableItem('fullscreen');
|
that.enableItem('entervideofullscreen');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -474,7 +482,7 @@ pandora.ui.mainMenu = function() {
|
||||||
if ((data.value == 'player') != (data.previousValue == 'player')) {
|
if ((data.value == 'player') != (data.previousValue == 'player')) {
|
||||||
action = data.value == 'player' ? 'enableItem' : 'disableItem';
|
action = data.value == 'player' ? 'enableItem' : 'disableItem';
|
||||||
that[action]('showtimeline');
|
that[action]('showtimeline');
|
||||||
that[action]('fullscreen');
|
that[action]('entervideofullscreen');
|
||||||
}
|
}
|
||||||
that[
|
that[
|
||||||
pandora.getItemIdAndPosition() ? 'enableItem' : 'disableItem'
|
pandora.getItemIdAndPosition() ? 'enableItem' : 'disableItem'
|
||||||
|
@ -527,6 +535,10 @@ pandora.ui.mainMenu = function() {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Ox.Fullscreen.bind('change', function(state) {
|
||||||
|
that.setItemTitle('toggleapplicationfullscreen', (state ? 'Exit' : 'Enter') + ' Application Fullscreen');
|
||||||
|
});
|
||||||
|
|
||||||
function changeFocus(direction) {
|
function changeFocus(direction) {
|
||||||
var elements = [],
|
var elements = [],
|
||||||
index,
|
index,
|
||||||
|
|
Loading…
Reference in a new issue