juk.cpp 19.9 KB
Newer Older
1 2 3 4 5
/***************************************************************************
                          juk.cpp  -  description
                             -------------------
    begin                : Mon Feb  4 23:40:41 EST 2002
    copyright            : (C) 2002 by Scott Wheeler
6
    email                : wheeler@kde.org
7
***************************************************************************/
8 9 10 11 12 13 14 15 16 17

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/

18 19
#include <config.h>

20 21 22 23
#include <kcmdlineargs.h>
#include <kstatusbar.h>
#include <kdebug.h>
#include <kmessagebox.h>
Scott Wheeler's avatar
Scott Wheeler committed
24
#include <kiconloader.h>
25 26 27

#include <qslider.h>

28 29 30 31 32 33 34
#include "juk.h"
#include "slideraction.h"
#include "statuslabel.h"
#include "splashscreen.h"
#include "systemtray.h"
#include "keydialog.h"
#include "tagguesserconfigdlg.h"
35
#include "filerenamerconfigdlg.h"
36
#include "actioncollection.h"
37
#include "cache.h"
38

39 40
using namespace ActionCollection;

41 42 43 44
////////////////////////////////////////////////////////////////////////////////
// public members
////////////////////////////////////////////////////////////////////////////////

Scott Wheeler's avatar
Scott Wheeler committed
45
JuK::JuK(QWidget *parent, const char *name) :
Scott Wheeler's avatar
Scott Wheeler committed
46
    DCOPObject("Collection"),
Scott Wheeler's avatar
Scott Wheeler committed
47
    KMainWindow(parent, name, WDestructiveClose),
48
    m_player(PlayerManager::instance()),
49
    m_shuttingDown(false)
50
{
51 52
    // Expect segfaults if you change this order.

53
    readSettings();
54

55
    if(m_showSplash && !m_startDocked) {
56 57 58 59
	SplashScreen::instance()->show();
	kapp->processEvents();
    }

60
    setupActions();
61 62
    setupLayout();
    setupSplitterConnections();
63
    slotPlaylistChanged();
64
    readConfig();
65
    setupSystemTray();
66
    setupGlobalAccels();
67
    processArgs();
68

69 70
    m_player->setPlaylistInterface(m_splitter);

71
    SplashScreen::finishedLoading();
Scott Wheeler's avatar
Scott Wheeler committed
72
    QTimer::singleShot(0, CollectionList::instance(), SLOT(slotCheckCache()));
73 74

    m_sliderAction->slotUpdateOrientation();
75 76 77 78
}

JuK::~JuK()
{
79

80 81
}

82 83 84 85 86
KActionCollection *JuK::actionCollection() const
{
    return ActionCollection::actions();
}

87 88 89 90
////////////////////////////////////////////////////////////////////////////////
// public slots
////////////////////////////////////////////////////////////////////////////////

91
void JuK::slotGuessTagInfoFromFile()
92
{
93 94 95 96 97 98
    m_splitter->slotGuessTagInfo(TagGuesser::FileName);
}

void JuK::slotGuessTagInfoFromInternet()
{
    m_splitter->slotGuessTagInfo(TagGuesser::MusicBrainz);
99 100
}

101 102 103 104 105
void JuK::openFile(const QString &file)
{
    m_splitter->open(file);
}

106 107 108 109 110 111
void JuK::openFile(const QStringList &files)
{
    for(QStringList::ConstIterator it = files.begin(); it != files.end(); ++it)
	openFile(*it);
}

112 113 114 115
////////////////////////////////////////////////////////////////////////////////
// private members
////////////////////////////////////////////////////////////////////////////////

116 117
void JuK::setupLayout()
{
118
    m_splitter = new PlaylistSplitter(this, "playlistSplitter");
119
    setCentralWidget(m_splitter);
120

121
    // create status bar
122

123
    m_statusLabel = new StatusLabel(statusBar());
124

125
    statusBar()->addWidget(m_statusLabel, 1);
126

Scott Wheeler's avatar
Scott Wheeler committed
127 128
    connect(m_statusLabel, SIGNAL(jumpButtonClicked()),
	    m_splitter, SLOT(slotSelectPlaying()));
129

130 131
    PlayerManager::instance()->setStatusLabel(m_statusLabel);

132 133
    // Needs to be here because m_splitter is not called before setupActions
    // (because PlaylistSplitter itself accesses the actionCollection)
134

Scott Wheeler's avatar
Scott Wheeler committed
135 136
    new KAction(i18n("&Rename File"), "filesaveas", "CTRL+r", m_splitter,
		SLOT(slotRenameFile()), actions(), "renameFile");
137

138
    m_splitter->setFocus();
139

140
    resize(750, 500);
141 142
}

143 144
void JuK::setupActions()
{
145
    //////////////////////////////////////////////////
146
    // file menu
147
    //////////////////////////////////////////////////
148

Scott Wheeler's avatar
Scott Wheeler committed
149
    KActionMenu *newMenu = new KActionMenu(i18n("&New"), "filenew",
150
					   actions(), "file_new");
Scott Wheeler's avatar
Scott Wheeler committed
151

152 153 154 155 156 157
    // This connection will call the
    // PlaylistSplitter::slotCreatePlaylist(const QString &) slot - this is
    // possible because the QString parameter has a default value, so the
    // slot can be called without arguments (as required by the signal's
    // signature).

158 159 160 161 162 163 164 165 166
    newMenu->insert(createSplitterAction(
			i18n("Empty Playlist..."), SLOT(slotCreatePlaylist()),
			"newPlaylist", "window_new", "CTRL+n"));
    newMenu->insert(createSplitterAction(
			i18n("Playlist From Folder..."), SLOT(slotCreatePlaylistFromDir()),
			"newDirectoryPlaylist", "file_open", "CTRL+d"));
    newMenu->insert(createSplitterAction(
			i18n("Search Playlist"), SLOT(slotAdvancedSearch()),
			"newSearchPlaylist", "find", "CTRL+f"));
Scott Wheeler's avatar
Scott Wheeler committed
167

168
    createSplitterAction(i18n("Open..."),         SLOT(slotOpen()),              "file_open", "fileopen", "CTRL+o");
Scott Wheeler's avatar
Scott Wheeler committed
169
    createSplitterAction(i18n("Add &Folder..."),  SLOT(slotOpenDirectory()),     "openDirectory", "fileopen");
170 171
    createSplitterAction(i18n("&Rename..."),      SLOT(slotRenamePlaylist()),    "renamePlaylist", "lineedit");
    createSplitterAction(i18n("D&uplicate..."),   SLOT(slotDuplicatePlaylist()), "duplicatePlaylist", "editcopy");
172 173 174 175
    createSplitterAction(i18n("Save"),            SLOT(slotSavePlaylist()),      "file_save", "filesave", "CTRL+s");
    createSplitterAction(i18n("Save As..."),      SLOT(slotSaveAsPlaylist()),    "file_save_as", "filesaveas");
    createSplitterAction(i18n("R&emove"),         SLOT(slotDeletePlaylist()),    "deleteItemPlaylist", "edittrash");
    createSplitterAction(i18n("Reload"),          SLOT(slotReloadPlaylist()),    "reloadPlaylist", "reload");
176
    createSplitterAction(i18n("Edit Search..."),  SLOT(slotEditSearch()),        "editSearch", "editclear");
177

178
    KStdAction::quit(this, SLOT(slotQuit()), actions());
179

180
    //////////////////////////////////////////////////
181
    // edit menu
182 183
    //////////////////////////////////////////////////

184 185 186 187
    KStdAction::cut(kapp,   SLOT(cut()),   actions());
    KStdAction::copy(kapp,  SLOT(copy()),  actions());
    KStdAction::paste(kapp, SLOT(paste()), actions());
    KStdAction::clear(kapp, SLOT(clear()), actions());
188

189
    KStdAction::selectAll(kapp, SLOT(selectAll()), actions());
190

191
    //////////////////////////////////////////////////
192
    // view menu
193
    //////////////////////////////////////////////////
194

Scott Wheeler's avatar
Scott Wheeler committed
195
    m_showSearchAction = new KToggleAction(i18n("Show &Search Bar"), "filefind",
196
					   0, actions(), "showSearch");
Scott Wheeler's avatar
Scott Wheeler committed
197
    m_showEditorAction = new KToggleAction(i18n("Show &Tag Editor"), "edit",
198
					   0, actions(), "showEditor");
199
    m_showHistoryAction = new KToggleAction(i18n("Show &History"), "history",
200
					   0, actions(), "showHistory");
201

202
    createSplitterAction(i18n("Refresh Items"), SLOT(slotRefresh()), "refresh", "reload");
203

204
    //////////////////////////////////////////////////
205
    // play menu
206 207
    //////////////////////////////////////////////////

Scott Wheeler's avatar
Scott Wheeler committed
208
    m_randomPlayAction = new KToggleAction(i18n("&Random Play"), 0,
209
					   actions(), "randomPlay");
Scott Wheeler's avatar
Scott Wheeler committed
210

211 212 213
    new KAction(i18n("&Play"),  "player_play",  0, m_player, SLOT(play()),  actions(), "play");
    new KAction(i18n("P&ause"), "player_pause", 0, m_player, SLOT(pause()), actions(), "pause");
    new KAction(i18n("&Stop"),  "player_stop",  0, m_player, SLOT(stop()),  actions(), "stop");
Scott Wheeler's avatar
Scott Wheeler committed
214

215 216 217 218
    // m_backAction = new KToolBarPopupAction(i18n("Previous &Track"), "player_start", 0,
    //                                        this, SLOT(back()), actions(), "back");

    // TODO: switch this back to being a popup action
219

220
    new KAction(i18n("Previous &Track"), "player_start", 0, m_player, SLOT(back()),    actions(), "back");
221
    new KAction(i18n("&Next Track"),     "player_end",   0, m_player, SLOT(forward()), actions(), "forward");
222

223 224 225
    new KToggleAction(i18n("&Loop Playlist"), 0, 0, actions(), "loopPlaylist");

    // the following are not visible by default
226

227 228 229 230 231 232 233
    new KAction(i18n("Mute"),         "mute",        0, m_player, SLOT(mute()),        actions(), "mute");
    new KAction(i18n("Volume Up"),    "volumeUp",    0, m_player, SLOT(volumeUp()),    actions(), "volumeUp");
    new KAction(i18n("Volume Down"),  "volumeDown",  0, m_player, SLOT(volumeDown()),  actions(), "volumeDown");
    new KAction(i18n("Play / Pause"), "playPause",   0, m_player, SLOT(playPause()),   actions(), "playPause");
    new KAction(i18n("Seek Forward"), "seekForward", 0, m_player, SLOT(seekForward()), actions(), "seekForward");
    new KAction(i18n("Seek Back"),    "seekBack",    0, m_player, SLOT(seekBack()),    actions(), "seekBack");
    
234

235
    //////////////////////////////////////////////////
236
    // tagger menu
237 238
    //////////////////////////////////////////////////

239
    createSplitterAction(i18n("&Save"), SLOT(slotSaveTag()),
Scott Wheeler's avatar
Scott Wheeler committed
240 241 242
			 "saveItem",   "filesave", "CTRL+t");
    createSplitterAction(i18n("&Delete"), SLOT(slotDeleteSelectedItems()),
			 "removeItem", "editdelete");
243

244 245
    KActionMenu *guessMenu = new KActionMenu(i18n("&Guess Tag Information"),
					     QString::null, actions(),
Scott Wheeler's avatar
Scott Wheeler committed
246
					     "guessTag");
Scott Wheeler's avatar
Scott Wheeler committed
247
    guessMenu->setIconSet(SmallIconSet("wizard"));
248

249
    guessMenu->insert(
Scott Wheeler's avatar
Scott Wheeler committed
250 251
	new KAction(i18n("From &Filename"), "fileimport", "CTRL+f",
		    this, SLOT(slotGuessTagInfoFromFile()), actions(), "guessTagFile"));
252
#if HAVE_MUSICBRAINZ
253
    guessMenu->insert(
Scott Wheeler's avatar
Scott Wheeler committed
254 255
	new KAction(i18n("From &Internet"), "connect_established", "CTRL+i",
		    this, SLOT(slotGuessTagInfoFromInternet()), actions(), "guessTagInternet"));
256
#endif
Scott Wheeler's avatar
Scott Wheeler committed
257

258
    //////////////////////////////////////////////////
259
    // settings menu
260 261
    //////////////////////////////////////////////////

262
    setStandardToolBarMenuEnabled(true);
263

Scott Wheeler's avatar
Scott Wheeler committed
264
    m_toggleSplashAction =
265
	new KToggleAction(i18n("Show Splash Screen on Startup"),
Scott Wheeler's avatar
Scott Wheeler committed
266 267 268 269 270 271 272 273
			  KShortcut(), actions(), "showSplashScreen");
    m_toggleSystemTrayAction =
	new KToggleAction(i18n("&Dock in System Tray"),
			  KShortcut(), actions(), "toggleSystemTray");
    m_toggleDockOnCloseAction = 
	new KToggleAction(i18n("&Stay in System Tray on Close"),
			  KShortcut(), actions(), "dockOnClose");
    m_togglePopupsAction =
274
	new KToggleAction(i18n("Popup &Track Announcement"),
Scott Wheeler's avatar
Scott Wheeler committed
275
			  KShortcut(), this, 0, actions(), "togglePopups");
276

Scott Wheeler's avatar
Scott Wheeler committed
277 278
    connect(m_toggleSystemTrayAction, SIGNAL(toggled(bool)),
	    this, SLOT(slotToggleSystemTray(bool)));
279

Scott Wheeler's avatar
Scott Wheeler committed
280

281
    m_outputSelectAction = PlayerManager::playerSelectAction(actions());
282

283
    if(m_outputSelectAction)
284
        m_outputSelectAction->setCurrentItem(0);
285

Scott Wheeler's avatar
Scott Wheeler committed
286
    new KAction(i18n("&Tag Guesser..."), 0, 0, this, SLOT(slotConfigureTagGuesser()),
287
		actions(), "tagGuesserConfig");
288

289
    new KAction(i18n("&File Renamer..."), 0, 0, this, SLOT(slotConfigureFileRenamer()),
290
		actions(), "fileRenamerConfig");
291

292
    KStdAction::keyBindings(this, SLOT(slotEditKeys()), actions());
293

294
    //////////////////////////////////////////////////
295
    // just in the toolbar
296 297
    //////////////////////////////////////////////////

298
    m_sliderAction = new SliderAction(i18n("Track Position"), actions(),
Scott Wheeler's avatar
Scott Wheeler committed
299
				      "trackPositionAction");
300 301

    createGUI();
302 303
}

304 305 306 307 308 309
void JuK::setupSplitterConnections()
{
    QValueListConstIterator<SplitterConnection> it = m_splitterConnections.begin();
    for(; it != m_splitterConnections.end(); ++it)
        connect((*it).first, SIGNAL(activated()), m_splitter, (*it).second);

Scott Wheeler's avatar
Scott Wheeler committed
310 311 312 313
    connect(m_showSearchAction, SIGNAL(toggled(bool)),
	    m_splitter, SLOT(slotSetSearchVisible(bool)));
    connect(m_showEditorAction, SIGNAL(toggled(bool)),
	    m_splitter, SLOT(slotSetEditorVisible(bool)));
314 315
    connect(m_showHistoryAction, SIGNAL(toggled(bool)),
	    m_splitter, SLOT(slotSetHistoryVisible(bool)));
316
    connect(this, SIGNAL(dockWindowPositionChanged(QDockWindow *)),
Scott Wheeler's avatar
Scott Wheeler committed
317 318 319
	    m_sliderAction, SLOT(slotUpdateOrientation(QDockWindow *)));
    connect(m_splitter, SIGNAL(signalPlaylistChanged()),
	    this, SLOT(slotPlaylistChanged()));
320 321
}

322
void JuK::setupSystemTray()
323
{
324
    if(m_toggleSystemTrayAction && m_toggleSystemTrayAction->isChecked()) {
Scott Wheeler's avatar
Scott Wheeler committed
325 326
	m_systemTray = new SystemTray(this, "systemTray");
	m_systemTray->show();
327

Scott Wheeler's avatar
Scott Wheeler committed
328
	m_toggleDockOnCloseAction->setEnabled(true);
329
	m_togglePopupsAction->setEnabled(true);
330

Scott Wheeler's avatar
Scott Wheeler committed
331
	connect(m_systemTray, SIGNAL(quitSelected()), this, SLOT(slotQuit()));
332
    }
333
    else {
Scott Wheeler's avatar
Scott Wheeler committed
334 335
	m_systemTray = 0;
	m_toggleDockOnCloseAction->setEnabled(false);
336
	m_togglePopupsAction->setEnabled(false);
337
    }
338 339
}

340 341 342
void JuK::setupGlobalAccels()
{
    m_accel = new KGlobalAccel(this);
343

344 345 346 347 348 349 350 351 352
    KeyDialog::insert(m_accel, "PlayPause",   i18n("Play / Pause"), action("playPause"),   SLOT(activate()));
    KeyDialog::insert(m_accel, "Stop",        i18n("Stop Playing"), action("stop"),        SLOT(activate()));
    KeyDialog::insert(m_accel, "Back",        i18n("Back"),         action("back"),        SLOT(activate()));
    KeyDialog::insert(m_accel, "Forward",     i18n("Forward"),      action("forward"),     SLOT(activate()));
    KeyDialog::insert(m_accel, "SeekBack",    i18n("Seek Back"),    action("seekBack"),    SLOT(activate()));
    KeyDialog::insert(m_accel, "SeekForward", i18n("Seek Forward"), action("seekForward"), SLOT(activate()));
    KeyDialog::insert(m_accel, "VolumeUp",    i18n("Volume Up"),    action("volumeUp"),    SLOT(activate()));
    KeyDialog::insert(m_accel, "VolumeDown",  i18n("Volume Down"),  action("volumeDown"),  SLOT(activate()));
    KeyDialog::insert(m_accel, "Mute",        i18n("Mute"),         action("mute"),        SLOT(activate()));
353
    KeyDialog::insert(m_accel, "ShowHide",    i18n("Show / Hide"),  this,                  SLOT(slotShowHide()));
354

355 356 357 358 359
    m_accel->setConfigGroup("Shortcuts");
    m_accel->readSettings();
    m_accel->updateConnections();
}

360 361 362 363
void JuK::processArgs()
{
    KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
    QStringList files;
364

365
    for(int i = 0; i < args->count(); i++)
366
        files.append(args->arg(i));
367

368
    m_splitter->open(files);
369 370
}

371 372 373
void JuK::keyPressEvent(QKeyEvent *e)
{
    if (e->key() >= Qt::Key_Back && e->key() <= Qt::Key_MediaLast)
374
        e->accept();
375 376 377
    KMainWindow::keyPressEvent(e);
}

378 379 380 381 382 383 384 385 386
/**
 * These are settings that need to be know before setting up the GUI.
 */

void JuK::readSettings()
{
    KConfig *config = KGlobal::config();
    { // general settings
        KConfigGroupSaver saver(config, "Settings");
387
        m_showSplash = config->readBoolEntry("ShowSplashScreen", true);
388
        m_startDocked = config->readBoolEntry("StartDocked", false);
389 390 391
    }
}

392 393
void JuK::readConfig()
{
394
    // Automagically save and m_restore many window settings.
395 396
    setAutoSaveSettings();

397
    KConfig *config = KGlobal::config();
398
    { // player settings
399
        KConfigGroupSaver saver(config, "Player");
400 401
        if(m_sliderAction->volumeSlider()) {
	    int maxVolume = m_sliderAction->volumeSlider()->maxValue();
Scott Wheeler's avatar
Scott Wheeler committed
402
	    int volume = config->readNumEntry("Volume", maxVolume);
403
            m_sliderAction->volumeSlider()->setVolume(volume);
404
        }
405 406
        bool randomPlay = config->readBoolEntry("RandomPlay", false);
        m_randomPlayAction->setChecked(randomPlay);
407

408
        bool loopPlaylist = config->readBoolEntry("LoopPlaylist", false);
409
        ActionCollection::action<KToggleAction>("loopPlaylist")->setChecked(loopPlaylist);
410
    }
411
    { // view settings
412
        KConfigGroupSaver saver(config, "View");
413 414 415 416 417

        bool showSearch = config->readBoolEntry("ShowSearch", true);
        m_showSearchAction->setChecked(showSearch);
        m_splitter->slotSetSearchVisible(showSearch);

418 419 420
        bool showEditor = config->readBoolEntry("ShowEditor", false);
        m_showEditorAction->setChecked(showEditor);
        m_splitter->slotSetEditorVisible(showEditor);
421

422 423 424
	// The history list will actually be created by the playlist restoration
	// code, but we want to remember the checkbox's setting and hope that
	// it's in synch with the code that does the real work.
425

426 427
	bool showHistory = config->readBoolEntry("ShowHistory", false);
	m_showHistoryAction->setChecked(showHistory);
428
    }
429 430
    { // general settings
        KConfigGroupSaver saver(config, "Settings");
431

432 433
        bool dockInSystemTray = config->readBoolEntry("DockInSystemTray", true);
        m_toggleSystemTrayAction->setChecked(dockInSystemTray);
434

435 436
        bool dockOnClose = config->readBoolEntry("DockOnClose", true);
        m_toggleDockOnCloseAction->setChecked(dockOnClose);
437

438 439
        bool showPopups = config->readBoolEntry("TrackPopup", false);
        m_togglePopupsAction->setChecked(showPopups);
440

441 442
        if(m_outputSelectAction)
            m_outputSelectAction->setCurrentItem(config->readNumEntry("MediaSystem", 0));
443
    }
444

445
    m_toggleSplashAction->setChecked(m_showSplash);
446 447 448 449
}

void JuK::saveConfig()
{
450
    KConfig *config = KGlobal::config();
451
    { // player settings
452
        KConfigGroupSaver saver(config, "Player");
453
	config->writeEntry("Volume", m_sliderAction->volumeSlider()->volume());
454 455 456 457
	config->writeEntry("RandomPlay", m_randomPlayAction->isChecked());

	KToggleAction *a = ActionCollection::action<KToggleAction>("loopPlaylist");
	config->writeEntry("LoopPlaylist", a->isChecked());
458
    }
459 460
    { // view settings
        KConfigGroupSaver saver(config, "View");
461

462
        config->writeEntry("ShowEditor", m_showEditorAction->isChecked());
463
        config->writeEntry("ShowSearch", m_showSearchAction->isChecked());
464
	config->writeEntry("ShowHistory", m_showHistoryAction->isChecked());
465
    }
466 467
    { // general settings
        KConfigGroupSaver saver(config, "Settings");
468
        config->writeEntry("ShowSplashScreen", m_toggleSplashAction->isChecked());
469
        config->writeEntry("StartDocked", m_startDocked);
470 471 472 473 474
        config->writeEntry("DockInSystemTray", m_toggleSystemTrayAction->isChecked());
        config->writeEntry("DockOnClose", m_toggleDockOnCloseAction->isChecked());
        config->writeEntry("TrackPopup", m_togglePopupsAction->isChecked());
        if(m_outputSelectAction)
            config->writeEntry("MediaSystem", m_outputSelectAction->currentItem());
475
    }
476
    config->sync();
477 478
}

479
bool JuK::queryExit()
480
{
481 482
    m_startDocked = !isVisible();

483
    hide();
484
    action("stop")->activate();
485 486 487
    delete m_systemTray;
    m_systemTray = 0;

488
    Cache::instance()->save();
489
    saveConfig();
490
    delete m_splitter;
491
    return true;
492 493
}

494 495
bool JuK::queryClose()
{
496 497 498 499 500
    if(!m_shuttingDown &&
       !kapp->sessionSaving() &&
       m_systemTray &&
       m_toggleDockOnCloseAction->isChecked())
    {
501
	KMessageBox::information(this,
Scott Wheeler's avatar
Scott Wheeler committed
502 503 504
	    i18n("<qt>Closing the main window will keep JuK running in the system tray. "
		 "Use Quit from the File menu to quit the application.</qt>"),
	    i18n("Docking in System Tray"), "hideOnCloseInfo");
505 506 507 508 509 510 511
	hide();
	return false;
    }
    else
	return true;
}

Scott Wheeler's avatar
Scott Wheeler committed
512 513 514
KAction *JuK::createSplitterAction(const QString &text, const char *slot,
				   const char *name, const QString &pix,
				   const KShortcut &shortcut)
515 516 517 518
{
    KAction *action;

    if(pix.isNull())
519
	action = new KAction(text, shortcut, actions(), name);
520
    else
521
	action = new KAction(text, pix, shortcut, actions(), name);
522 523

    m_splitterConnections.append(SplitterConnection(action, slot));
524

525 526 527
    return action;
}

528 529 530 531
////////////////////////////////////////////////////////////////////////////////
// private slot definitions
////////////////////////////////////////////////////////////////////////////////

532 533 534 535 536
void JuK::slotShowHide()
{
    setShown(!isShown());
}

537
void JuK::slotPlaylistChanged()
538
{
539
    m_statusLabel->setPlaylist(m_splitter);
540 541
}

542 543 544 545 546
void JuK::slotQuit()
{
    kapp->quit();
}

547 548 549 550
////////////////////////////////////////////////////////////////////////////////
// settings menu
////////////////////////////////////////////////////////////////////////////////

551
void JuK::slotToggleSystemTray(bool enabled)
552
{
553
    if(enabled && !m_systemTray)
554
	setupSystemTray();
555 556 557
    else if(!enabled && m_systemTray) {
	delete m_systemTray;
	m_systemTray = 0;
558
	m_toggleDockOnCloseAction->setEnabled(false);
559
	m_togglePopupsAction->setEnabled(false);
560 561 562
    }
}

563 564
void JuK::slotEditKeys()
{
565
    KeyDialog::configure(m_accel, actions(), this);
566 567
}

568 569
void JuK::slotConfigureTagGuesser()
{
570
    TagGuesserConfigDlg(this).exec();
571 572
}

573 574
void JuK::slotConfigureFileRenamer()
{
575
    FileRenamerConfigDlg(this).exec();
576 577
}

578
#include "juk.moc"