Add an option to stay running in the background when the window is closed, even if the tray icon is hidden. Fixes issue #914

This commit is contained in:
David Sansome 2010-12-04 17:31:50 +00:00
parent f818577907
commit 1dec3e9818
41 changed files with 145 additions and 15 deletions

View File

@ -1125,6 +1125,9 @@ msgstr ""
msgid "Keep buttons for %1 seconds..."
msgstr ""
msgid "Keep running in the background when the window is closed"
msgstr ""
msgid "Keep the original files"
msgstr ""

View File

@ -1129,6 +1129,9 @@ msgstr ""
msgid "Keep buttons for %1 seconds..."
msgstr ""
msgid "Keep running in the background when the window is closed"
msgstr ""
msgid "Keep the original files"
msgstr ""

View File

@ -1150,6 +1150,9 @@ msgstr ""
msgid "Keep buttons for %1 seconds..."
msgstr ""
msgid "Keep running in the background when the window is closed"
msgstr ""
msgid "Keep the original files"
msgstr "Manté els fitxers originals"

View File

@ -1129,6 +1129,9 @@ msgstr ""
msgid "Keep buttons for %1 seconds..."
msgstr ""
msgid "Keep running in the background when the window is closed"
msgstr ""
msgid "Keep the original files"
msgstr ""

View File

@ -1125,6 +1125,9 @@ msgstr ""
msgid "Keep buttons for %1 seconds..."
msgstr ""
msgid "Keep running in the background when the window is closed"
msgstr ""
msgid "Keep the original files"
msgstr ""

View File

@ -1130,6 +1130,9 @@ msgstr ""
msgid "Keep buttons for %1 seconds..."
msgstr ""
msgid "Keep running in the background when the window is closed"
msgstr ""
msgid "Keep the original files"
msgstr ""

View File

@ -1153,6 +1153,9 @@ msgstr "Knöpfe für %1 Sekunde halten..."
msgid "Keep buttons for %1 seconds..."
msgstr "Knöpfe für %1 Sekunden halten..."
msgid "Keep running in the background when the window is closed"
msgstr ""
msgid "Keep the original files"
msgstr "Originale behalten"

View File

@ -1164,6 +1164,9 @@ msgstr "Κράτημα των κουμπιών για %1 δευτερόλεπτ
msgid "Keep buttons for %1 seconds..."
msgstr "Κράτημα των κουμπιών για %1 δευτερόλεπτα..."
msgid "Keep running in the background when the window is closed"
msgstr ""
msgid "Keep the original files"
msgstr "Διατήρηση των αρχικών αρχείων"

View File

@ -1129,6 +1129,9 @@ msgstr ""
msgid "Keep buttons for %1 seconds..."
msgstr ""
msgid "Keep running in the background when the window is closed"
msgstr ""
msgid "Keep the original files"
msgstr ""

View File

@ -1127,6 +1127,9 @@ msgstr ""
msgid "Keep buttons for %1 seconds..."
msgstr ""
msgid "Keep running in the background when the window is closed"
msgstr ""
msgid "Keep the original files"
msgstr ""

View File

@ -1125,6 +1125,9 @@ msgstr ""
msgid "Keep buttons for %1 seconds..."
msgstr ""
msgid "Keep running in the background when the window is closed"
msgstr ""
msgid "Keep the original files"
msgstr ""

View File

@ -1162,6 +1162,9 @@ msgstr "Presione los botones por %1 segundo..."
msgid "Keep buttons for %1 seconds..."
msgstr "Presione los botones por %1 segundo..."
msgid "Keep running in the background when the window is closed"
msgstr ""
msgid "Keep the original files"
msgstr "Mantener los archivos originales"

View File

@ -1127,6 +1127,9 @@ msgstr ""
msgid "Keep buttons for %1 seconds..."
msgstr ""
msgid "Keep running in the background when the window is closed"
msgstr ""
msgid "Keep the original files"
msgstr ""

View File

@ -1126,6 +1126,9 @@ msgstr ""
msgid "Keep buttons for %1 seconds..."
msgstr ""
msgid "Keep running in the background when the window is closed"
msgstr ""
msgid "Keep the original files"
msgstr ""

View File

@ -1159,6 +1159,9 @@ msgstr "Pressez le bouton pendant %1 seconde..."
msgid "Keep buttons for %1 seconds..."
msgstr "Pressez le bouton pendant %1 secondes..."
msgid "Keep running in the background when the window is closed"
msgstr ""
msgid "Keep the original files"
msgstr "Conserver les fichiers originaux"

View File

@ -1130,6 +1130,9 @@ msgstr ""
msgid "Keep buttons for %1 seconds..."
msgstr ""
msgid "Keep running in the background when the window is closed"
msgstr ""
msgid "Keep the original files"
msgstr ""

View File

@ -1156,6 +1156,9 @@ msgstr "Tartsa nyomva a gombokat %1 másodpercig"
msgid "Keep buttons for %1 seconds..."
msgstr "Tartsa nyomva a gombokat %1 másodpercig"
msgid "Keep running in the background when the window is closed"
msgstr ""
msgid "Keep the original files"
msgstr "Eredeti fájlok megőrzése"

View File

@ -1163,6 +1163,9 @@ msgstr "Trattieni i pulsanti per %1 secondo..."
msgid "Keep buttons for %1 seconds..."
msgstr "Trattieni i pulsanti per %1 secondi..."
msgid "Keep running in the background when the window is closed"
msgstr ""
msgid "Keep the original files"
msgstr "Mantieni i file originali"

View File

@ -1150,6 +1150,9 @@ msgstr "ボタンを %1 秒長押し..."
msgid "Keep buttons for %1 seconds..."
msgstr "ボタンを %1 秒長押し..."
msgid "Keep running in the background when the window is closed"
msgstr ""
msgid "Keep the original files"
msgstr "元のファイルを維持する"

View File

@ -1127,6 +1127,9 @@ msgstr ""
msgid "Keep buttons for %1 seconds..."
msgstr ""
msgid "Keep running in the background when the window is closed"
msgstr ""
msgid "Keep the original files"
msgstr ""

View File

@ -1125,6 +1125,9 @@ msgstr ""
msgid "Keep buttons for %1 seconds..."
msgstr ""
msgid "Keep running in the background when the window is closed"
msgstr ""
msgid "Keep the original files"
msgstr ""

View File

@ -1139,6 +1139,9 @@ msgstr ""
msgid "Keep buttons for %1 seconds..."
msgstr ""
msgid "Keep running in the background when the window is closed"
msgstr ""
msgid "Keep the original files"
msgstr ""

View File

@ -1153,6 +1153,9 @@ msgstr "Hou de toetsen ingedrukt voor %1 seconde..."
msgid "Keep buttons for %1 seconds..."
msgstr "Hou de toetsen ingedrukt voor %1 seconden..."
msgid "Keep running in the background when the window is closed"
msgstr ""
msgid "Keep the original files"
msgstr "Behoud de originele bestanden"

View File

@ -1125,6 +1125,9 @@ msgstr ""
msgid "Keep buttons for %1 seconds..."
msgstr ""
msgid "Keep running in the background when the window is closed"
msgstr ""
msgid "Keep the original files"
msgstr ""

View File

@ -1150,6 +1150,9 @@ msgstr "Przytrzymaj klawisze przez %1 sekunde..."
msgid "Keep buttons for %1 seconds..."
msgstr "Przytrzymaj klawisze przez %1 sekundy..."
msgid "Keep running in the background when the window is closed"
msgstr ""
msgid "Keep the original files"
msgstr "Zachowaj oryginalne pliki"

View File

@ -1159,6 +1159,9 @@ msgstr "Manter botões por %1 segundo..."
msgid "Keep buttons for %1 seconds..."
msgstr "Manter botões por %1 segundos..."
msgid "Keep running in the background when the window is closed"
msgstr ""
msgid "Keep the original files"
msgstr "Manter os ficheiros originais"

View File

@ -1139,6 +1139,9 @@ msgstr ""
msgid "Keep buttons for %1 seconds..."
msgstr ""
msgid "Keep running in the background when the window is closed"
msgstr ""
msgid "Keep the original files"
msgstr ""

View File

@ -1126,6 +1126,9 @@ msgstr ""
msgid "Keep buttons for %1 seconds..."
msgstr ""
msgid "Keep running in the background when the window is closed"
msgstr ""
msgid "Keep the original files"
msgstr ""

View File

@ -1146,6 +1146,9 @@ msgstr "Отображать кнопки в течении %1 секунд"
msgid "Keep buttons for %1 seconds..."
msgstr "Отображать кнопки в течении %1 секунды"
msgid "Keep running in the background when the window is closed"
msgstr ""
msgid "Keep the original files"
msgstr "Сохранить оригинальные файлы"

View File

@ -1150,6 +1150,9 @@ msgstr "Držte tlačidlá %1 sekundu..."
msgid "Keep buttons for %1 seconds..."
msgstr "Držte tlačidlá %1 sekúnd..."
msgid "Keep running in the background when the window is closed"
msgstr ""
msgid "Keep the original files"
msgstr "Nechať pôvodné súbory"

View File

@ -1152,6 +1152,9 @@ msgstr "Obdrži gumbe za %1 sekundo ..."
msgid "Keep buttons for %1 seconds..."
msgstr "Obdrži gumbe za %1 sekund ..."
msgid "Keep running in the background when the window is closed"
msgstr ""
msgid "Keep the original files"
msgstr "Obdrži izvorne datoteke"

View File

@ -1129,6 +1129,9 @@ msgstr ""
msgid "Keep buttons for %1 seconds..."
msgstr ""
msgid "Keep running in the background when the window is closed"
msgstr ""
msgid "Keep the original files"
msgstr ""

View File

@ -1151,6 +1151,9 @@ msgstr "Behåll knappar i %1 sekund..."
msgid "Keep buttons for %1 seconds..."
msgstr "Behåll knappar i %1 sekunder..."
msgid "Keep running in the background when the window is closed"
msgstr ""
msgid "Keep the original files"
msgstr "Behåll originalfilerna"

View File

@ -1147,6 +1147,9 @@ msgstr "Düğmeleri %1 saniye tut..."
msgid "Keep buttons for %1 seconds..."
msgstr "Düğmeleri %1 saniye tut..."
msgid "Keep running in the background when the window is closed"
msgstr ""
msgid "Keep the original files"
msgstr "Orijinal dosyaları sakla"

View File

@ -1115,6 +1115,9 @@ msgstr ""
msgid "Keep buttons for %1 seconds..."
msgstr ""
msgid "Keep running in the background when the window is closed"
msgstr ""
msgid "Keep the original files"
msgstr ""

View File

@ -1151,6 +1151,9 @@ msgstr "Тримати кнопки %1 секунду..."
msgid "Keep buttons for %1 seconds..."
msgstr "Тримати кнопки %1 секунд..."
msgid "Keep running in the background when the window is closed"
msgstr ""
msgid "Keep the original files"
msgstr "Зберегти оригінальні файли"

View File

@ -1127,6 +1127,9 @@ msgstr ""
msgid "Keep buttons for %1 seconds..."
msgstr ""
msgid "Keep running in the background when the window is closed"
msgstr ""
msgid "Keep the original files"
msgstr ""

View File

@ -1130,6 +1130,9 @@ msgstr ""
msgid "Keep buttons for %1 seconds..."
msgstr ""
msgid "Keep running in the background when the window is closed"
msgstr ""
msgid "Keep the original files"
msgstr ""

View File

@ -904,19 +904,18 @@ void MainWindow::StopAfterCurrent() {
playlists_->current()->StopAfter(playlists_->current()->current_index());
}
/**
* Exit if the tray icon is not visible, otherwise ignore and set hidden in tray.
* On OS X, never quit when the main window is closed. This is equivalent to hiding in the tray.
*/
void MainWindow::closeEvent(QCloseEvent* event) {
#ifndef Q_OS_DARWIN
if (tray_icon_->IsVisible() && event->spontaneous()) {
QSettings s;
s.beginGroup(kSettingsGroup);
bool keep_running = s.value("keeprunning", tray_icon_->IsVisible()).toBool();
if (keep_running && event->spontaneous()) {
event->ignore();
SetHiddenInTray(true);
} else {
QApplication::quit();
}
#endif
}
void MainWindow::SetHiddenInTray(bool hidden) {

View File

@ -256,6 +256,7 @@ void SettingsDialog::accept() {
s.beginGroup(MainWindow::kSettingsGroup);
s.setValue("showtray", ui_->b_show_tray_icon_->isChecked());
s.setValue("keeprunning", ui_->b_keep_running_->isChecked());
s.setValue("startupbehaviour", int(behaviour));
s.endGroup();
@ -367,6 +368,9 @@ void SettingsDialog::showEvent(QShowEvent*) {
// Behaviour
s.beginGroup(MainWindow::kSettingsGroup);
ui_->b_show_tray_icon_->setChecked(s.value("showtray", true).toBool());
ui_->b_keep_running_->setChecked(s.value("keeprunning",
ui_->b_show_tray_icon_->isChecked()).toBool());
MainWindow::StartupBehaviour behaviour = MainWindow::StartupBehaviour(
s.value("startupbehaviour", MainWindow::Startup_Remember).toInt());
switch (behaviour) {

View File

@ -124,7 +124,7 @@
<item>
<widget class="QStackedWidget" name="stacked_widget">
<property name="currentIndex">
<number>0</number>
<number>1</number>
</property>
<widget class="QWidget" name="playback_page">
<layout class="QVBoxLayout" name="verticalLayout_10">
@ -406,6 +406,13 @@
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="b_keep_running_">
<property name="text">
<string>Keep running in the background when the window is closed</string>
</property>
</widget>
</item>
<item>
<widget class="QGroupBox" name="startup_group_">
<property name="title">
@ -881,6 +888,13 @@
</customwidgets>
<tabstops>
<tabstop>list</tabstop>
<tabstop>b_show_tray_icon_</tabstop>
<tabstop>b_keep_running_</tabstop>
<tabstop>b_always_show_</tabstop>
<tabstop>b_always_hide_</tabstop>
<tabstop>b_remember_</tabstop>
<tabstop>language</tabstop>
<tabstop>current_glow</tabstop>
<tabstop>fading_out</tabstop>
<tabstop>fading_cross</tabstop>
<tabstop>fading_auto</tabstop>
@ -891,7 +905,9 @@
<tabstop>replaygain_compression</tabstop>
<tabstop>gst_plugin</tabstop>
<tabstop>gst_device</tabstop>
<tabstop>buttonBox</tabstop>
<tabstop>buffer_duration</tabstop>
<tabstop>notifications_none</tabstop>
<tabstop>notifications_native</tabstop>
<tabstop>notifications_pretty</tabstop>
<tabstop>notifications_tray</tabstop>
<tabstop>notifications_duration</tabstop>
@ -900,12 +916,9 @@
<tabstop>notifications_opacity</tabstop>
<tabstop>notifications_bg_preset</tabstop>
<tabstop>notifications_fg_choose</tabstop>
<tabstop>notifications_native</tabstop>
<tabstop>b_remember_</tabstop>
<tabstop>notifications_none</tabstop>
<tabstop>b_show_tray_icon_</tabstop>
<tabstop>b_always_hide_</tabstop>
<tabstop>b_always_show_</tabstop>
<tabstop>song_info_font_size</tabstop>
<tabstop>song_info_font_preview</tabstop>
<tabstop>buttonBox</tabstop>
</tabstops>
<resources>
<include location="../../data/data.qrc"/>