You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

app.vue 4.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. <template>
  2. <div class="settings-app">
  3. <PageHeader>
  4. <h2 class="title">
  5. <span class="icon"><font-awesome-icon icon="window-maximize" /></span>
  6. <span>Application</span>
  7. </h2>
  8. <h3 class="subtitle">
  9. Settings that affect the behavior of the application.
  10. </h3>
  11. <template v-slot:right>
  12. <button class="button button--danger" @click="reset()">
  13. <span>Reset</span>
  14. </button>
  15. <button v-tooltip="'Open the developer tools. This includes the application logs.'"
  16. class="button"
  17. @click.prevent="openDevTools">
  18. <span class="icon"><font-awesome-icon icon="code" /></span>
  19. <span>DevTools</span>
  20. </button>
  21. </template>
  22. </PageHeader>
  23. <div class="alerts">
  24. <!-- Models Folder -->
  25. <div v-if="!requirements.folders.models" class="notification notification--danger">
  26. <span class="icon"><font-awesome-icon icon="exclamation-triangle" /></span>
  27. <span v-if="!$dream.isPortable">
  28. The <strong>Models</strong> folder has <strong>invalid characters</strong>. <nuxt-link to="/settings/folders">Please change the location of the folder.</nuxt-link>
  29. </span>
  30. <span v-else>
  31. The place where you have extracted {{ $dream.name }} has <strong>invalid characters</strong>.
  32. Please move the application to another place.
  33. </span>
  34. </div>
  35. <!-- GPU -->
  36. <div v-if="$settings.preferences.advanced.device === 'GPU'">
  37. <div v-if="!requirements.recommended.vram" class="notification notification--warning">
  38. <span class="icon"><font-awesome-icon icon="exclamation-triangle" /></span>
  39. <span>Your NVIDIA GPU has very low VRAM! The algorithm is very likely to fail.</span>
  40. </div>
  41. </div>
  42. <!-- RAM -->
  43. <div v-if="!requirements.recommended.ram" class="notification notification--warning">
  44. <span class="icon"><font-awesome-icon icon="exclamation-triangle" /></span>
  45. <span>Your system has less than <strong>12 GB</strong> of RAM.</span>
  46. </div>
  47. </div>
  48. <section class="box">
  49. <div class="box__content">
  50. <SettingsField field-id="app.disableHardwareAcceleration" />
  51. <SettingsField field-id="app.uploadMode" />
  52. <SettingsField field-id="app.duplicates" />
  53. </div>
  54. </section>
  55. <section class="box">
  56. <div class="box__header">
  57. <h2 class="title">
  58. Menus
  59. </h2>
  60. <h3 class="subtitle">
  61. Settings that affect the left and right menus.
  62. </h3>
  63. </div>
  64. <div class="box__content">
  65. <SettingsField field-id="app.queuePosition" />
  66. <SettingsField field-id="app.showAds" @change="onChangeAds" />
  67. <SettingsField field-id="app.showTips" @change="onChangeAds" />
  68. </div>
  69. </section>
  70. </div>
  71. </template>
  72. <script>
  73. import { cloneDeep, merge } from 'lodash'
  74. import Swal from 'sweetalert2/dist/sweetalert2'
  75. import { VModel } from '~/mixins'
  76. import { events } from '~/modules'
  77. import { requirements } from '~/modules/system'
  78. export default {
  79. mixins: [VModel],
  80. data: () => ({
  81. requirements,
  82. }),
  83. methods: {
  84. openDevTools() {
  85. const mainWindow = require('electron').remote.BrowserWindow.getAllWindows()[0]
  86. mainWindow.webContents.openDevTools()
  87. },
  88. onChangeAds() {
  89. events.emit('settings:ads')
  90. },
  91. async reset() {
  92. const response = await Swal.fire({
  93. title: 'Are you sure?',
  94. text: 'This will set all options in this section to their default values.',
  95. icon: 'warning',
  96. showCancelButton: true,
  97. confirmButtonColor: '#F44336',
  98. confirmButtonText: 'Yes',
  99. })
  100. if (!response.value) {
  101. return
  102. }
  103. // eslint-disable-next-line no-underscore-dangle
  104. const settings = cloneDeep($provider.settings._default.app)
  105. delete settings.window
  106. this.value$.app = merge(this.value$.app, settings)
  107. window.$redirect('/')
  108. },
  109. },
  110. }
  111. </script>