Skip to content

Commit

Permalink
Merge pull request #1445 from agalwood/feature/show_progess_bar_20230426
Browse files Browse the repository at this point in the history
feat: preference basic show progress bar
  • Loading branch information
agalwood authored Apr 26, 2023
2 parents 61365d7 + 292ad15 commit 1b27980
Show file tree
Hide file tree
Showing 33 changed files with 254 additions and 175 deletions.
Binary file modified extra/darwin/arm64/engine/aria2c
Binary file not shown.
Binary file modified extra/darwin/x64/engine/aria2c
Binary file not shown.
16 changes: 8 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
"@panter/vue-i18next": "^0.15.2",
"@vue/eslint-config-standard": "^6.1.0",
"ajv": "^8.12.0",
"axios": "^1.3.5",
"axios": "^1.3.6",
"babel-eslint": "^10.1.0",
"babel-loader": "^9.1.2",
"babel-plugin-component": "^1.1.1",
Expand All @@ -80,18 +80,18 @@
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^6.1.1",
"eslint-plugin-vue": "^9.10.0",
"eslint-plugin-vue": "^9.11.0",
"eslint-webpack-plugin": "^4.0.1",
"file-loader": "^6.2.0",
"html-webpack-plugin": "^5.5.0",
"i18next": "^22.4.14",
"html-webpack-plugin": "^5.5.1",
"i18next": "^22.4.15",
"lodash": "^4.17.21",
"mini-css-extract-plugin": "2.7.5",
"node-loader": "^2.0.0",
"normalize.css": "^8.0.1",
"parse-torrent": "^9.1.5",
"randomatic": "^3.1.1",
"sass": "1.62.0",
"sass": "1.62.1",
"sass-loader": "^12.6.0",
"style-loader": "^3.3.2",
"terser-webpack-plugin": "^5.3.7",
Expand All @@ -104,9 +104,9 @@
"vue-template-compiler": "^2.7.14",
"vuex": "^3.6.2",
"vuex-router-sync": "^5.0.0",
"webpack": "^5.79.0",
"webpack-cli": "^5.0.1",
"webpack-dev-server": "^4.13.2",
"webpack": "^5.80.0",
"webpack-cli": "^5.0.2",
"webpack-dev-server": "^4.13.3",
"webpack-hot-middleware": "^2.25.3",
"webpack-merge": "^5.8.0",
"worker-loader": "^3.0.8"
Expand Down
54 changes: 45 additions & 9 deletions src/main/Application.js
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,20 @@ export default class Application extends EventEmitter {
})
}

watchShowProgressBarChange () {
const { userConfig } = this.configManager
const key = 'show-progress-bar'
this.configListeners[key] = userConfig.onDidChange(key, async (newValue, oldValue) => {
logger.info(`[Motrix] detected ${key} value change event:`, newValue, oldValue)

if (newValue) {
this.bindProgressChange()
} else {
this.unbindProgressChange()
}
})
}

initUPnPManager () {
this.upnp = new UPnPManager()

Expand Down Expand Up @@ -829,6 +843,7 @@ export default class Application extends EventEmitter {
this.watchOpenAtLoginChange()
this.watchProtocolsChange()
this.watchRunModeChange()
this.watchShowProgressBarChange()

this.on('download-status-change', (downloading) => {
this.trayManager.handleDownloadStatusChange(downloading)
Expand All @@ -853,15 +868,36 @@ export default class Application extends EventEmitter {
app.addRecentDocument(path)
})

this.on('progress-change', (progress) => {
if (this.updateManager.isChecking) {
return
}
if (!is.windows() && progress === 2) {
progress = 0
}
this.windowManager.getWindow('index').setProgressBar(progress)
})
if (this.configManager.userConfig.get('show-progress-bar')) {
this.bindProgressChange()
}
}

handleProgressChange (progress) {
if (this.updateManager.isChecking) {
return
}
if (!is.windows() && progress === 2) {
progress = 0
}
this.windowManager.getWindow('index').setProgressBar(progress)
}

bindProgressChange () {
if (this.listeners('progress-change').length > 0) {
return
}

this.on('progress-change', this.handleProgressChange)
}

unbindProgressChange () {
if (this.listeners('progress-change').length === 0) {
return
}

this.off('progress-change', this.handleProgressChange)
this.windowManager.getWindow('index').setProgressBar(-1)
}

handleIpcMessages () {
Expand Down
1 change: 1 addition & 0 deletions src/main/core/ConfigManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ export default class ConfigManager {
'protocols': { 'magnet': true, 'thunder': false },
'resume-all-when-app-launched': false,
'run-mode': APP_RUN_MODE.STANDARD,
'show-progress-bar': true,
'task-notification': true,
'theme': APP_THEME.AUTO,
'tracker-source': [
Expand Down
7 changes: 7 additions & 0 deletions src/renderer/components/Preference/Basic.vue
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@
{{ $t('preferences.tray-speedometer') }}
</el-checkbox>
</el-col>
<el-col class="form-item-sub" :span="16">
<el-checkbox v-model="form.showProgressBar">
{{ $t('preferences.show-progress-bar') }}
</el-checkbox>
</el-col>
</el-form-item>
<el-form-item
v-if="isMac"
Expand Down Expand Up @@ -339,6 +344,7 @@
runMode,
seedRatio,
seedTime,
showProgressBar,
taskNotification,
theme,
traySpeedometer
Expand Down Expand Up @@ -368,6 +374,7 @@
runMode,
seedRatio,
seedTime,
showProgressBar,
taskNotification,
theme,
traySpeedometer
Expand Down
1 change: 1 addition & 0 deletions src/shared/configKeys.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ const userKeys = [
'resume-all-when-app-launched',
'run-mode',
'session-path',
'show-progress-bar',
'task-notification',
'theme',
'tracker-source',
Expand Down
1 change: 1 addition & 0 deletions src/shared/locales/ar/preferences.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ export default {
'run-mode-tray': 'تطبيق العلبة',
'run-mode-hide-tray': 'إخفاء تطبيق العلبة',
'tray-speedometer': 'يعرض درج شريط القوائم السرعة في الوقت الفعلي',
'show-progress-bar': 'عرض شريط تقدم التنزيل',
'language': 'اللغة',
'change-language': 'تغيير اللغة',
'hide-app-menu': 'إخفاء قائمة التطبيقات (Windows و Linux فقط)',
Expand Down
1 change: 1 addition & 0 deletions src/shared/locales/ca/preferences.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ export default {
'run-mode-tray': 'Aplicació de la safata',
'run-mode-hide-tray': 'Amagar l\'aplicació de la safata',
'tray-speedometer': 'La safata de barres de menús mostra la velocitat en temps real',
'show-progress-bar': 'Mostra la barra de progrés de la descàrrega',
'language': 'Idioma',
'change-language': 'Cambiar idioma',
'hide-app-menu': 'Ocultar el menú (només Windows i Linux)',
Expand Down
1 change: 1 addition & 0 deletions src/shared/locales/de/preferences.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ export default {
'run-mode-tray': 'Infobereichsanwendung',
'run-mode-hide-tray': 'Infobereichsanwendung ausblenden',
'tray-speedometer': 'Das Menüleistenfach zeigt die Echtzeitgeschwindigkeit an',
'show-progress-bar': 'Fortschrittsbalken anzeigen',
'language': 'Sprache',
'change-language': 'Sprache ändern',
'hide-app-menu': 'App Menü ausblenden (nur auf Windows & Linux)',
Expand Down
1 change: 1 addition & 0 deletions src/shared/locales/el/preferences.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ export default {
'run-mode-tray': 'Εφαρμογή περιοχής ειδοποιήσεων',
'run-mode-hide-tray': 'Απόκρυψη εφαρμογής της περιοχής ειδοποιήσεων',
'tray-speedometer': 'Δείξε τη ταχύτητα στο μενου',
'show-progress-bar': 'Εμφάνιση μπάρας προόδου λήψης',
'language': 'Γλώσσα',
'change-language': 'Αλλαγή Γλώσσας',
'hide-app-menu': 'Κρύψε το μενού της εφαρμογής (μόνο για Windows & Linux)',
Expand Down
1 change: 1 addition & 0 deletions src/shared/locales/en-US/preferences.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ export default {
'run-mode-tray': 'Tray Application',
'run-mode-hide-tray': 'Hide Tray Application',
'tray-speedometer': 'Show the real-time speed in the menu bar tray',
'show-progress-bar': 'Show download prgress bar',
'language': 'Language',
'change-language': 'Change language',
'hide-app-menu': 'Hide App Menu (Windows & Linux Only)',
Expand Down
1 change: 1 addition & 0 deletions src/shared/locales/es/preferences.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ export default {
'run-mode-tray': 'Aplicación de bandeja',
'run-mode-hide-tray': 'Ocultar aplicación de bandeja',
'tray-speedometer': 'La bandeja de la barra de menú muestra la velocidad en tiempo real',
'show-progress-bar': 'Mostrar la barra de progreso de descarga',
'language': 'Idioma',
'change-language': 'Cambiar Idioma',
'hide-app-menu': 'Ocultar el menú (Solo Windows y Linux)',
Expand Down
1 change: 1 addition & 0 deletions src/shared/locales/fa/preferences.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ export default {
'run-mode-tray': 'برنامه سینی',
'run-mode-hide-tray': 'مخفی کردن برنامه سینی',
'tray-speedometer': 'سینی نوار منو سرعت زمان واقعی را نشان می‌دهد',
'show-progress-bar': 'نمایش نوار پیشرفت دانلود',
'language': 'زبان',
'change-language': 'تغییر زبان',
'hide-app-menu': 'پنهان کردن منوی برنامه (تنها در ویندوز و لینوکس)',
Expand Down
1 change: 1 addition & 0 deletions src/shared/locales/fr/preferences.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ export default {
'run-mode-tray': 'Application de la zone de notification',
'run-mode-hide-tray': 'Masquer l\'application de la barre d\'état système',
'tray-speedometer': 'La barre de menus affiche la vitesse en temps réel',
'show-progress-bar': 'Afficher la barre de progression du téléchargement',
'language': 'Langues',
'change-language': 'Changer la langue',
'hide-app-menu': 'Cacher le menu de l\'application (Windows & Linux uniquement)',
Expand Down
1 change: 1 addition & 0 deletions src/shared/locales/hu/preferences.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ export default {
'run-mode-tray': 'Tálcás alkalmazás',
'run-mode-hide-tray': 'Tálca alkalmazás elrejtése',
'tray-speedometer': 'Menu csik mutasa a letöltés és feltöltés sebbeséget',
'show-progress-bar': 'Letöltési előrehaladási sáv megjelenítése',
'language': 'Nyelv',
'change-language': 'Nyelv váltas',
'hide-app-menu': 'Alkalmazás csik elrejtése (csak Windows és Linux)',
Expand Down
1 change: 1 addition & 0 deletions src/shared/locales/id/preferences.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ export default {
'run-mode-tray': 'Aplikasi Tray',
'run-mode-hide-tray': 'Sembunyikan Aplikasi Tray',
'tray-speedometer': 'Baki menu bar menunjukkan kecepatan waktu-nyata',
'show-progress-bar': 'Tampilkan bilah kemajuan unduhan',
'language': 'Bahasa',
'change-language': 'Ubah Bahasa',
'hide-app-menu': 'Sembunyikan Menu Aplikasi (hanya: Windows & Linux)',
Expand Down
1 change: 1 addition & 0 deletions src/shared/locales/it/preferences.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ export default {
'run-mode-tray': 'Applicazione della barra delle applicazioni',
'run-mode-hide-tray': 'Nascondi applicazione della barra delle applicazioni',
'tray-speedometer': 'La barra dei menu mostra la velocità in tempo reale',
'show-progress-bar': 'Mostra la barra di progresso del download',
'language': 'Lingua',
'change-language': 'Cambia lingua',
'hide-app-menu': 'Nascondi dal menu delle app (Solo Windows & Linux)',
Expand Down
1 change: 1 addition & 0 deletions src/shared/locales/ja/preferences.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ export default {
'run-mode-tray': 'トレイアプリケーション',
'run-mode-hide-tray': 'トレイアプリケーションを非表示にする',
'tray-speedometer': 'メニューバートレイは、リアルタイムの速度を示します',
'show-progress-bar': 'ダウンロード進行状況の表示',
'language': '言語',
'change-language': '言語を切り替え',
'hide-app-menu': 'メニューバーを隠す(Windows と Linux のみサポート)',
Expand Down
1 change: 1 addition & 0 deletions src/shared/locales/ko/preferences.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ export default {
'run-mode-tray': '트레이 애플리케이션',
'run-mode-hide-tray': '트레이 응용 프로그램 숨기기',
'tray-speedometer': '메뉴 막대 트레이에 실시간 속도가 표시됩니다',
'show-progress-bar': '다운로드 진행률 막대기 보이기',
'language': '언어',
'change-language': '언어 변경',
'hide-app-menu': '앱 메뉴 숨기기 (Windows 및 Linux)',
Expand Down
1 change: 1 addition & 0 deletions src/shared/locales/nb/preferences.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ export default {
'run-mode-tray': 'Tray-applikasjon',
'run-mode-hide-tray': 'Skjul statusfeltprogram',
'tray-speedometer': 'Menylinje viser sanntidshastighet',
'show-progress-bar': 'Vis fremgangslinjen for nedlastning',
'language': 'Språk',
'change-language': 'Skifte språk',
'hide-app-menu': 'Skjul appmeny (kun Windows og Linux)',
Expand Down
1 change: 1 addition & 0 deletions src/shared/locales/nl/preferences.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ export default {
'run-mode-tray': 'Toepassing voor systeemvak',
'run-mode-hide-tray': 'Toepassing in systeemvak verbergen',
'tray-speedometer': 'Menubalk toon real-time snelheid',
'show-progress-bar': 'Downloadvoortgangsbalk weergeven',
'language': 'Taal',
'change-language': 'Taal veranderen',
'hide-app-menu': 'App menu verbergen (alleen Windows & Linux)',
Expand Down
1 change: 1 addition & 0 deletions src/shared/locales/pl/preferences.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ export default {
'run-mode-tray': 'Aplikacja z paska powiadomień',
'run-mode-hide-tray': 'Ukryj aplikację zasobnika',
'tray-speedometer': 'Pasek zadań będzie pokazywać aktualną prędkość',
'show-progress-bar': 'Pokaż pasek postępu pobierania',
'language': 'Język',
'change-language': 'Zmień język',
'hide-app-menu': 'Schowaj menu aplikacji (Tylko Windows i Linux)',
Expand Down
1 change: 1 addition & 0 deletions src/shared/locales/pt-BR/preferences.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ export default {
'run-mode-tray': 'Aplicativo de bandeja',
'run-mode-hide-tray': 'Ocultar aplicativo da bandeja',
'tray-speedometer': 'A bandeja da barra de menus mostra a velocidade em tempo real',
'show-progress-bar': 'Mostrar barra de progresso de download',
'language': 'Idioma',
'change-language': 'Mudar o Idioma',
'hide-app-menu': 'Ocultar o Menu do App (Windows & Linux apenas)',
Expand Down
1 change: 1 addition & 0 deletions src/shared/locales/ro/preferences.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ export default {
'run-mode-tray': 'Aplicație pentru tava',
'run-mode-hide-tray': 'Ascundeți aplicația tăvii',
'tray-speedometer': 'Iconița din bară arată viteza în timp real',
'show-progress-bar': 'Afișează bara de progres a descărcării',
'language': 'Limba',
'change-language': 'Schimbă limba',
'hide-app-menu': 'Ascundeți meniul aplicației (numai Windows și Linux)',
Expand Down
1 change: 1 addition & 0 deletions src/shared/locales/ru/preferences.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ export default {
'run-mode-tray': 'Приложение в трее',
'run-mode-hide-tray': 'Скрыть приложение в трее',
'tray-speedometer': 'Панель меню отображает скорость в реальном времени',
'show-progress-bar': 'Показать индикатор загрузки',
'language': 'Язык',
'change-language': 'Сменить язык',
'hide-app-menu': 'Скрыть меню приложения (только для Windows и Linux)',
Expand Down
1 change: 1 addition & 0 deletions src/shared/locales/th/preferences.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ export default {
'run-mode-tray': 'แถบแจ้งเตือนแอปพลิเคชัน',
'run-mode-hide-tray': 'ซ่อนแอปพลิเคชันถาด',
'tray-speedometer': 'ถาดแถบเมนูแสดงความเร็วแบบเรียลไทม์',
'show-progress-bar': 'แสดงแถบความคืบหน้าการดาวน์โหลด',
'language': 'ภาษา',
'change-language': 'เปลี่ยนภาษา',
'hide-app-menu': 'ซ่อนเมนูแอป (Windows & Linux เท่านั้น)',
Expand Down
1 change: 1 addition & 0 deletions src/shared/locales/tr/preferences.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ export default {
'theme-dark': 'Koyu',
'run-mode-hide-tray': 'Tepsi uygulamasını gizle',
'tray-speedometer': 'Menü çubuğu tepsisi gerçek zamanlı hızı gösterir',
'show-progress-bar': 'İndirme ilerleme çubuğunu göster',
'language': 'Dil',
'change-language': 'Dil değiştir',
'hide-app-menu': 'Uygulama menüsünü göster (Windows & Linux için)',
Expand Down
1 change: 1 addition & 0 deletions src/shared/locales/uk/preferences.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ export default {
'run-mode-tray': 'Додаток у лотку',
'run-mode-hide-tray': 'Приховати програму лотка',
'tray-speedometer': 'Лоток панелі меню показує швидкість у режимі реального часу',
'show-progress-bar': 'Показати панель завантаження',
'language': 'Мова',
'change-language': 'Змінити мову',
'hide-app-menu': 'Сховати меню додатка (Тільки для Windows та Linux)',
Expand Down
1 change: 1 addition & 0 deletions src/shared/locales/vi/preferences.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ export default {
'run-mode-tray': 'Ứng dụng khay thông báo',
'run-mode-hide-tray': 'Ẩn ứng dụng khay hệ thống',
'tray-speedometer': 'Thanh menu hiển thị tốc độ thời gian thực',
'show-progress-bar': 'Hiển thị thanh tiến trình tải xuống',
'language': 'Ngôn ngữ',
'change-language': 'Thay đổi Ngôn ngữ',
'hide-app-menu': 'Ẩn thanh Menu (Chỉ Windows & Linux)',
Expand Down
1 change: 1 addition & 0 deletions src/shared/locales/zh-CN/preferences.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ export default {
'run-mode-tray': '托盘应用',
'run-mode-hide-tray': '隐藏托盘应用',
'tray-speedometer': '托盘显示实时速度',
'show-progress-bar': '显示下载进度条',
'language': '语言',
'change-language': '切换语言',
'hide-app-menu': '隐藏菜单栏(仅支持 Windows 和 Linux)',
Expand Down
1 change: 1 addition & 0 deletions src/shared/locales/zh-TW/preferences.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ export default {
'run-mode-tray': '托盤應用程式',
'run-mode-hide-tray': '隱藏托盤應用程式',
'tray-speedometer': '托盤顯示即時速度',
'show-progress-bar': '顯示下載進度條',
'language': '語言',
'change-language': '更改語言',
'hide-app-menu': '隱藏選單列(僅支援 Windows 和 Linux)',
Expand Down
Loading

0 comments on commit 1b27980

Please sign in to comment.