Browse Source

Identation

pull/2229/head
Ramiro Saenz 6 years ago
parent
commit
956ff0377e
  1. 722
      app/view/preferences/Preferences.js

722
app/view/preferences/Preferences.js

@ -1,371 +1,371 @@
Ext.define('Rambox.view.preferences.Preferences',{ Ext.define('Rambox.view.preferences.Preferences',{
extend: 'Ext.window.Window' extend: 'Ext.window.Window'
,xtype: 'preferences' ,xtype: 'preferences'
,requires: [ ,requires: [
'Rambox.view.preferences.PreferencesController' 'Rambox.view.preferences.PreferencesController'
,'Rambox.view.preferences.PreferencesModel' ,'Rambox.view.preferences.PreferencesModel'
,'Ext.form.field.ComboBox' ,'Ext.form.field.ComboBox'
,'Ext.form.field.Checkbox' ,'Ext.form.field.Checkbox'
] ]
,controller: 'preferences-preferences' ,controller: 'preferences-preferences'
,viewModel: { ,viewModel: {
type: 'preferences-preferences' type: 'preferences-preferences'
} }
,title: locale['preferences[0]'] ,title: locale['preferences[0]']
,width: 420 ,width: 420
,height: 500 ,height: 500
,modal: true ,modal: true
,closable: true ,closable: true
,minimizable: false ,minimizable: false
,maximizable: false ,maximizable: false
,draggable: true ,draggable: true
,resizable: false ,resizable: false
,scrollable: 'vertical' ,scrollable: 'vertical'
,bodyStyle: 'margin-right:15px;' ,bodyStyle: 'margin-right:15px;'
,buttons: [ ,buttons: [
{ {
text: locale['button[1]'] text: locale['button[1]']
,ui: 'decline' ,ui: 'decline'
,handler: 'cancel' ,handler: 'cancel'
} }
,'->' ,'->'
,{ ,{
text: locale['button[4]'] text: locale['button[4]']
,handler: 'save' ,handler: 'save'
} }
] ]
,initComponent: function() { ,initComponent: function() {
var config = ipc.sendSync('getConfig'); var config = ipc.sendSync('getConfig');
var defaultServiceOptions = []; var defaultServiceOptions = [];
defaultServiceOptions.push({ value: 'ramboxTab', label: 'Rambox Tab' }); defaultServiceOptions.push({ value: 'ramboxTab', label: 'Rambox Tab' });
defaultServiceOptions.push({ value: 'last', label: 'Last Active Service' }); defaultServiceOptions.push({ value: 'last', label: 'Last Active Service' });
Ext.getStore('Services').each(function(rec) { Ext.getStore('Services').each(function(rec) {
defaultServiceOptions.push({ defaultServiceOptions.push({
value: rec.get('id') value: rec.get('id')
,label: rec.get('name') ,label: rec.get('name')
}); });
}); });
this.items = [ this.items = [
{ {
xtype: 'form' xtype: 'form'
,bodyPadding: 20 ,bodyPadding: 20
,items: [ ,items: [
{ {
xtype: 'container' xtype: 'container'
,layout: 'hbox' ,layout: 'hbox'
,items: [ ,items: [
{ {
xtype: 'combo' xtype: 'combo'
,name: 'locale' ,name: 'locale'
,fieldLabel: 'Language' ,fieldLabel: 'Language'
,labelAlign: 'left' ,labelAlign: 'left'
,flex: 1 ,flex: 1
,labelWidth: 80 ,labelWidth: 80
,value: config.locale ,value: config.locale
,displayField: 'label' ,displayField: 'label'
,valueField: 'value' ,valueField: 'value'
,editable: false ,editable: false
,store: Ext.create('Ext.data.Store', { ,store: Ext.create('Ext.data.Store', {
fields: ['value', 'label'] fields: ['value', 'label']
,data: [ ,data: [
{ 'value': 'af', 'auth0': 'af', 'label': 'Afrikaans' } { 'value': 'af', 'auth0': 'af', 'label': 'Afrikaans' }
,{ 'value': 'ar', 'auth0': 'en', 'label': 'Arabic' } ,{ 'value': 'ar', 'auth0': 'en', 'label': 'Arabic' }
,{ 'value': 'bs2', 'auth0': 'en', 'label': 'Barndutsch, Switzerland' } ,{ 'value': 'bs2', 'auth0': 'en', 'label': 'Barndutsch, Switzerland' }
,{ 'value': 'bn', 'auth0': 'en', 'label': 'Bengali' } ,{ 'value': 'bn', 'auth0': 'en', 'label': 'Bengali' }
,{ 'value': 'bg', 'auth0': 'en', 'label': 'Bulgarian' } ,{ 'value': 'bg', 'auth0': 'en', 'label': 'Bulgarian' }
,{ 'value': 'ca', 'auth0': 'ca', 'label': 'Catalan' } ,{ 'value': 'ca', 'auth0': 'ca', 'label': 'Catalan' }
,{ 'value': 'zh-CN', 'auth0': 'zh', 'label': 'Chinese Simplified' } ,{ 'value': 'zh-CN', 'auth0': 'zh', 'label': 'Chinese Simplified' }
,{ 'value': 'zh-TW', 'auth0': 'zh-tw', 'label': 'Chinese Traditional' } ,{ 'value': 'zh-TW', 'auth0': 'zh-tw', 'label': 'Chinese Traditional' }
,{ 'value': 'hr', 'auth0': 'en', 'label': 'Croatian' } ,{ 'value': 'hr', 'auth0': 'en', 'label': 'Croatian' }
,{ 'value': 'cs', 'auth0': 'cs', 'label': 'Czech' } ,{ 'value': 'cs', 'auth0': 'cs', 'label': 'Czech' }
,{ 'value': 'da', 'auth0': 'da', 'label': 'Danish' } ,{ 'value': 'da', 'auth0': 'da', 'label': 'Danish' }
,{ 'value': 'nl', 'auth0': 'nl', 'label': 'Dutch' } ,{ 'value': 'nl', 'auth0': 'nl', 'label': 'Dutch' }
,{ 'value': 'en', 'auth0': 'en', 'label': 'English' } ,{ 'value': 'en', 'auth0': 'en', 'label': 'English' }
,{ 'value': 'fi', 'auth0': 'fi', 'label': 'Finnish' } ,{ 'value': 'fi', 'auth0': 'fi', 'label': 'Finnish' }
,{ 'value': 'fr', 'auth0': 'fr', 'label': 'French' } ,{ 'value': 'fr', 'auth0': 'fr', 'label': 'French' }
,{ 'value': 'de', 'auth0': 'de', 'label': 'German' } ,{ 'value': 'de', 'auth0': 'de', 'label': 'German' }
,{ 'value': 'de-CH', 'auth0': 'de', 'label': 'German, Switzerland' } ,{ 'value': 'de-CH', 'auth0': 'de', 'label': 'German, Switzerland' }
,{ 'value': 'el', 'auth0': 'en', 'label': 'Greek' } ,{ 'value': 'el', 'auth0': 'en', 'label': 'Greek' }
,{ 'value': 'he', 'auth0': 'en', 'label': 'Hebrew' } ,{ 'value': 'he', 'auth0': 'en', 'label': 'Hebrew' }
,{ 'value': 'hi', 'auth0': 'en', 'label': 'Hindi' } ,{ 'value': 'hi', 'auth0': 'en', 'label': 'Hindi' }
,{ 'value': 'hu', 'auth0': 'hu', 'label': 'Hungarian' } ,{ 'value': 'hu', 'auth0': 'hu', 'label': 'Hungarian' }
,{ 'value': 'id', 'auth0': 'en', 'label': 'Indonesian' } ,{ 'value': 'id', 'auth0': 'en', 'label': 'Indonesian' }
,{ 'value': 'it', 'auth0': 'it', 'label': 'Italian' } ,{ 'value': 'it', 'auth0': 'it', 'label': 'Italian' }
,{ 'value': 'ja', 'auth0': 'ja', 'label': 'Japanese' } ,{ 'value': 'ja', 'auth0': 'ja', 'label': 'Japanese' }
,{ 'value': 'ko', 'auth0': 'ko', 'label': 'Korean' } ,{ 'value': 'ko', 'auth0': 'ko', 'label': 'Korean' }
,{ 'value': 'no', 'auth0': 'no', 'label': 'Norwegian' } ,{ 'value': 'no', 'auth0': 'no', 'label': 'Norwegian' }
,{ 'value': 'fa', 'auth0': 'fa', 'label': 'Persian' } ,{ 'value': 'fa', 'auth0': 'fa', 'label': 'Persian' }
,{ 'value': 'pl', 'auth0': 'pl', 'label': 'Polish' } ,{ 'value': 'pl', 'auth0': 'pl', 'label': 'Polish' }
,{ 'value': 'pt-PT', 'auth0': 'pt-br', 'label': 'Portuguese' } ,{ 'value': 'pt-PT', 'auth0': 'pt-br', 'label': 'Portuguese' }
,{ 'value': 'pt-BR', 'auth0': 'pt-br', 'label': 'Portuguese (Brazilian)' } ,{ 'value': 'pt-BR', 'auth0': 'pt-br', 'label': 'Portuguese (Brazilian)' }
,{ 'value': 'ro', 'auth0': 'ro', 'label': 'Romanian' } ,{ 'value': 'ro', 'auth0': 'ro', 'label': 'Romanian' }
,{ 'value': 'ru', 'auth0': 'ru', 'label': 'Russian' } ,{ 'value': 'ru', 'auth0': 'ru', 'label': 'Russian' }
,{ 'value': 'sr', 'auth0': 'en', 'label': 'Serbian (Cyrillic)' } ,{ 'value': 'sr', 'auth0': 'en', 'label': 'Serbian (Cyrillic)' }
,{ 'value': 'sk', 'auth0': 'sk', 'label': 'Slovak' } ,{ 'value': 'sk', 'auth0': 'sk', 'label': 'Slovak' }
,{ 'value': 'es-ES', 'auth0': 'es', 'label': 'Spanish' } ,{ 'value': 'es-ES', 'auth0': 'es', 'label': 'Spanish' }
,{ 'value': 'sv-SE', 'auth0': 'sv', 'label': 'Swedish' } ,{ 'value': 'sv-SE', 'auth0': 'sv', 'label': 'Swedish' }
,{ 'value': 'tr', 'auth0': 'tr', 'label': 'Turkish' } ,{ 'value': 'tr', 'auth0': 'tr', 'label': 'Turkish' }
,{ 'value': 'uk', 'auth0': 'en', 'label': 'Ukrainian' } ,{ 'value': 'uk', 'auth0': 'en', 'label': 'Ukrainian' }
,{ 'value': 'vi', 'auth0': 'en', 'label': 'Vietnamese' } ,{ 'value': 'vi', 'auth0': 'en', 'label': 'Vietnamese' }
] ]
}) })
} }
,{ ,{
xtype: 'button' xtype: 'button'
,text: 'Help us Translate' ,text: 'Help us Translate'
,style: 'border-top-left-radius:0;border-bottom-left-radius:0;' ,style: 'border-top-left-radius:0;border-bottom-left-radius:0;'
,href: 'https://crowdin.com/project/rambox/invite' ,href: 'https://crowdin.com/project/rambox/invite'
} }
] ]
} }
,{ ,{
xtype: 'label' xtype: 'label'
,text: 'English is the only language that has full translation. We are working with all the others, help us!' ,text: 'English is the only language that has full translation. We are working with all the others, help us!'
,style: 'display:block;font-size:10px;line-height:15px;' ,style: 'display:block;font-size:10px;line-height:15px;'
,margin: '0 0 10 0' ,margin: '0 0 10 0'
} }
,{ ,{
xtype: 'checkbox'
,name: 'auto_launch'
,boxLabel: locale['preferences[5]']
,value: config.auto_launch
}
,{
xtype: 'checkbox'
,name: 'start_minimized'
,boxLabel: locale['preferences[4]']
,value: config.start_minimized
}
,{
xtype: 'checkbox'
,name: 'hide_menu_bar'
,boxLabel: locale['preferences[1]']+' (<code>Alt</code> key to display)'
,value: config.hide_menu_bar
,hidden: process.platform === 'darwin'
}
,{
xtype: 'combo'
,name: 'tabbar_location'
,fieldLabel: locale['preferences[11]']
,labelAlign: 'left'
,width: 380
,labelWidth: 180
,value: config.tabbar_location
,displayField: 'label'
,valueField: 'value'
,editable: false
,store: Ext.create('Ext.data.Store', {
fields: ['value', 'label']
,data: [
{ 'value': 'top', 'label': 'Top' }
,{ 'value': 'left', 'label': 'Left' }
,{ 'value': 'bottom', 'label': 'Bottom' }
,{ 'value': 'right', 'label': 'Right' }
]
})
}
,{
xtype: 'checkbox' xtype: 'checkbox'
,name: 'auto_launch' ,name: 'hide_tabbar_labels'
,boxLabel: locale['preferences[5]'] ,boxLabel: locale['preferences[28]']
,value: config.auto_launch ,value: config.hide_tabbar_labels
} }
,{ ,{
xtype: 'checkbox' xtype: 'combo'
,name: 'start_minimized' ,name: 'default_service'
,boxLabel: locale['preferences[4]'] ,fieldLabel: locale['preferences[12]']
,value: config.start_minimized ,labelAlign: 'top'
} //,width: 380
,{ //,labelWidth: 105
xtype: 'checkbox' ,value: config.default_service
,name: 'hide_menu_bar' ,displayField: 'label'
,boxLabel: locale['preferences[1]']+' (<code>Alt</code> key to display)' ,valueField: 'value'
,value: config.hide_menu_bar ,editable: false
,hidden: process.platform === 'darwin' ,store: Ext.create('Ext.data.Store', {
} fields: ['value', 'label']
,{ ,data: defaultServiceOptions
xtype: 'combo' })
,name: 'tabbar_location' }
,fieldLabel: locale['preferences[11]'] ,{
,labelAlign: 'left' xtype: 'combo'
,width: 380 ,name: 'window_display_behavior'
,labelWidth: 180 ,fieldLabel: locale['preferences[13]']
,value: config.tabbar_location ,labelAlign: 'left'
,displayField: 'label' ,width: 380
,valueField: 'value' ,labelWidth: 105
,editable: false ,value: config.window_display_behavior
,store: Ext.create('Ext.data.Store', { ,displayField: 'label'
fields: ['value', 'label'] ,valueField: 'value'
,data: [ ,editable: false
{ 'value': 'top', 'label': 'Top' } ,store: Ext.create('Ext.data.Store', {
,{ 'value': 'left', 'label': 'Left' } fields: ['value', 'label']
,{ 'value': 'bottom', 'label': 'Bottom' } ,data: [
,{ 'value': 'right', 'label': 'Right' } { 'value': 'show_taskbar', 'label': locale['preferences[14]'] }
] ,{ 'value': 'show_trayIcon', 'label': locale['preferences[15]'] }
}) ,{ 'value': 'taskbar_tray', 'label': locale['preferences[16]'] }
} ]
,{ })
xtype: 'checkbox' ,hidden: process.platform === 'darwin'
,name: 'hide_tabbar_labels' }
,boxLabel: locale['preferences[28]'] ,{
,value: config.hide_tabbar_labels xtype: 'combo'
} ,name: 'window_close_behavior'
,{ ,fieldLabel: locale['preferences[17]']
xtype: 'combo' ,labelAlign: 'left'
,name: 'default_service' ,width: 380
,fieldLabel: locale['preferences[12]'] ,labelWidth: 180
,labelAlign: 'top' ,value: config.window_close_behavior
//,width: 380 ,displayField: 'label'
//,labelWidth: 105 ,valueField: 'value'
,value: config.default_service ,editable: false
,displayField: 'label' ,store: Ext.create('Ext.data.Store', {
,valueField: 'value' fields: ['value', 'label']
,editable: false ,data: [
,store: Ext.create('Ext.data.Store', { { 'value': 'keep_in_tray', 'label': locale['preferences[18]'] }
fields: ['value', 'label'] ,{ 'value': 'keep_in_tray_and_taskbar', 'label': locale['preferences[19]'] }
,data: defaultServiceOptions ,{ 'value': 'quit', 'label': locale['preferences[20]'] }
}) ]
} })
,{ ,hidden: process.platform === 'darwin'
xtype: 'combo' }
,name: 'window_display_behavior' ,{
,fieldLabel: locale['preferences[13]'] xtype: 'checkbox'
,labelAlign: 'left' ,name: 'always_on_top'
,width: 380 ,boxLabel: locale['preferences[21]']
,labelWidth: 105 ,value: config.always_on_top
,value: config.window_display_behavior }
,displayField: 'label' ,{
,valueField: 'value' xtype: 'checkbox'
,editable: false ,name: 'systemtray_indicator'
,store: Ext.create('Ext.data.Store', { ,boxLabel: locale['preferences[22]']
fields: ['value', 'label'] ,value: config.systemtray_indicator
,data: [ ,hidden: process.platform === 'darwin'
{ 'value': 'show_taskbar', 'label': locale['preferences[14]'] } }
,{ 'value': 'show_trayIcon', 'label': locale['preferences[15]'] } ,{
,{ 'value': 'taskbar_tray', 'label': locale['preferences[16]'] } xtype: 'checkbox'
] ,name: 'flash_frame'
}) ,boxLabel: process.platform === 'darwin' ? locale['preferences[10]'] : locale['preferences[9]']
,hidden: process.platform === 'darwin' ,value: config.flash_frame
} }
,{ ,{
xtype: 'combo' xtype: 'checkbox'
,name: 'window_close_behavior' ,name: 'disable_gpu'
,fieldLabel: locale['preferences[17]'] ,boxLabel: locale['preferences[23]']
,labelAlign: 'left' ,value: config.disable_gpu
,width: 380 }
,labelWidth: 180 ,{
,value: config.window_close_behavior xtype: 'checkbox'
,displayField: 'label' ,name: 'enable_hidpi_support'
,valueField: 'value' ,boxLabel: locale['preferences[8]']
,editable: false ,value: config.enable_hidpi_support
,store: Ext.create('Ext.data.Store', { ,hidden: process.platform !== 'win32'
fields: ['value', 'label'] },
,data: [ {
{ 'value': 'keep_in_tray', 'label': locale['preferences[18]'] } xtype: 'textfield'
,{ 'value': 'keep_in_tray_and_taskbar', 'label': locale['preferences[19]'] } ,fieldLabel: 'Override User-Agent for all services (needs to relaunch)'
,{ 'value': 'quit', 'label': locale['preferences[20]'] } ,labelAlign: 'top'
] ,name: 'user_agent'
}) ,value: config.user_agent
,hidden: process.platform === 'darwin' ,width: 360
} ,emptyText: 'Leave blank for default user agent'
,{ }
xtype: 'checkbox' ,{
,name: 'always_on_top' xtype: 'fieldset'
,boxLabel: locale['preferences[21]'] ,title: locale['preferences[24]']
,value: config.always_on_top ,collapsed: !config.master_password
} ,checkboxToggle: true
,{ ,checkboxName: 'master_password'
xtype: 'checkbox' ,margin: '10 0 0 0'
,name: 'systemtray_indicator' ,padding: 10
,boxLabel: locale['preferences[22]'] ,layout: 'hbox'
,value: config.systemtray_indicator ,defaults: { labelAlign: 'top' }
,hidden: process.platform === 'darwin' ,items: [
} {
,{ xtype: 'textfield'
xtype: 'checkbox' ,inputType: 'password'
,name: 'flash_frame' ,fieldLabel: locale['preferences[25]']
,boxLabel: process.platform === 'darwin' ? locale['preferences[10]'] : locale['preferences[9]'] ,name: 'master_password1'
,value: config.flash_frame ,itemId: 'pass'
} ,flex: 1
,{ ,listeners: {
xtype: 'checkbox' validitychange: function(field) {
,name: 'disable_gpu' field.next().validate();
,boxLabel: locale['preferences[23]'] },
,value: config.disable_gpu blur: function(field) {
} field.next().validate();
,{ }
xtype: 'checkbox' }
,name: 'enable_hidpi_support' }
,boxLabel: locale['preferences[8]'] ,{
,value: config.enable_hidpi_support xtype: 'textfield'
,hidden: process.platform !== 'win32' ,inputType: 'password'
}, ,fieldLabel: locale['preferences[26]']
{ ,name: 'master_password2'
xtype: 'textfield' ,margin: '0 0 0 10'
,fieldLabel: 'Override User-Agent for all services (needs to relaunch)' ,vtype: 'password'
,labelAlign: 'top' ,initialPassField: 'pass'
,name: 'user_agent' ,flex: 1
,value: config.user_agent }
,width: 360 ]
,emptyText: 'Leave blank for default user agent' }
} ,{
,{ xtype: 'fieldset'
xtype: 'fieldset' ,title: 'Proxy (needs to relaunch) - <a href="https://github.com/saenzramiro/rambox/wiki/FREE-PROXY-SERVERS" target="_blank">Free Proxy Servers</a>'
,title: locale['preferences[24]'] ,collapsed: !config.proxy
,collapsed: !config.master_password ,checkboxToggle: true
,checkboxToggle: true ,checkboxName: 'proxy'
,checkboxName: 'master_password' ,margin: '10 0 0 0'
,margin: '10 0 0 0' ,padding: 10
,padding: 10 ,layout: 'vbox'
,layout: 'hbox' ,defaults: { labelAlign: 'left' }
,defaults: { labelAlign: 'top' } ,items: [
,items: [ {
{ xtype: 'textfield'
xtype: 'textfield' ,vtype: 'url'
,inputType: 'password' ,fieldLabel: 'Host'
,fieldLabel: locale['preferences[25]'] ,name: 'proxyHost'
,name: 'master_password1' ,value: config.proxyHost
,itemId: 'pass' //,flex: 1
,flex: 1 }
,listeners: { ,{
validitychange: function(field) { xtype: 'numberfield'
field.next().validate(); ,fieldLabel: 'Port'
}, ,name: 'proxyPort'
blur: function(field) { ,value: config.proxyPort
field.next().validate(); }
} ,{
} xtype: 'textfield'
} ,fieldLabel: 'Login'
,{ ,name: 'proxyLogin'
xtype: 'textfield' ,value: config.proxyLogin
,inputType: 'password' ,emptyText: 'Optional'
,fieldLabel: locale['preferences[26]'] }
,name: 'master_password2' ,{
,margin: '0 0 0 10' xtype: 'textfield'
,vtype: 'password' ,fieldLabel: 'Password'
,initialPassField: 'pass' ,name: 'proxyPassword'
,flex: 1 ,value: config.proxyPassword
} ,emptyText: 'Optional'
] ,inputType: 'password'
} }
,{ ]
xtype: 'fieldset' }
,title: 'Proxy (needs to relaunch) - <a href="https://github.com/saenzramiro/rambox/wiki/FREE-PROXY-SERVERS" target="_blank">Free Proxy Servers</a>' ,{
,collapsed: !config.proxy xtype: 'checkbox'
,checkboxToggle: true ,name: 'sendStatistics'
,checkboxName: 'proxy' ,boxLabel: locale['preferences[27]']
,margin: '10 0 0 0' ,value: config.sendStatistics
,padding: 10 }
,layout: 'vbox' ]
,defaults: { labelAlign: 'left' } }
,items: [ ];
{
xtype: 'textfield'
,vtype: 'url'
,fieldLabel: 'Host'
,name: 'proxyHost'
,value: config.proxyHost
//,flex: 1
}
,{
xtype: 'numberfield'
,fieldLabel: 'Port'
,name: 'proxyPort'
,value: config.proxyPort
}
,{
xtype: 'textfield'
,fieldLabel: 'Login'
,name: 'proxyLogin'
,value: config.proxyLogin
,emptyText: 'Optional'
}
,{
xtype: 'textfield'
,fieldLabel: 'Password'
,name: 'proxyPassword'
,value: config.proxyPassword
,emptyText: 'Optional'
,inputType: 'password'
}
]
}
,{
xtype: 'checkbox'
,name: 'sendStatistics'
,boxLabel: locale['preferences[27]']
,value: config.sendStatistics
}
]
}
];
this.callParent(); this.callParent();
} }
}); });

Loading…
Cancel
Save