juk.h 4.39 KB
Newer Older
1 2 3 4 5
/***************************************************************************
                          juk.h  -  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 18 19 20 21

/***************************************************************************
 *                                                                         *
 *   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.                                   *
 *                                                                         *
 ***************************************************************************/

#ifndef JUK_H
#define JUK_H

#include <kaction.h>
22
#include <kglobalaccel.h>
23
#include <kmainwindow.h>
24
#include <kpopupmenu.h>
25 26


27
#include "playermanager.h"
28 29 30 31
#include "playlistsplitter.h"

class QTimer;
class QListViewItem;
32

33
class SliderAction;
34
class StatusLabel;
35
class SystemTray;
36

37
class JuK : public KMainWindow
38
{
39
    Q_OBJECT
40

41
public:
42
    JuK(QWidget* parent = 0, const char *name = 0);
43
    virtual ~JuK();
44
    virtual KActionCollection *actionCollection() const;
45

46
signals:
47 48
    void signalEdit();
    void signalNewSong(const QString& songTitle);
49

50 51
private:
    void setupLayout();
52
    void setupActions();
53 54 55 56 57 58 59 60
    /**
     * Solves the problem of the splitter needing to use some of the actions from
     * this class and as such them needing to be created before the
     * PlaylistSplitter, but also needing to connect to the playlist splitter.
     *
     * @see createSplitterAction();
     */
    void setupSplitterConnections();
61
    void setupSystemTray();
62
    void setupGlobalAccels();
63

64
    void processArgs();
65

66 67
    void keyPressEvent(QKeyEvent *);

68
    /**
69 70
     * readSettings() is separate from readConfig() in that it contains settings
     * that need to be read before the GUI is setup.
71 72
     */
    void readSettings();
73
    void readConfig();
74
    void saveConfig();
75

76
    virtual bool queryExit();
77 78
    virtual bool queryClose();

79
    QString playingString() const;
80

81 82
    void updatePlaylistInfo();

83
    void openFile(const QString &file);
84
    void openFile(const QStringList &files);
85

86 87 88 89 90 91 92 93
    /**
     * Because we want to be able to reuse these actions in the main GUI classes,
     * which are created by the PlaylistSplitter, it is useful to create them
     * before creating the splitter.  This however creates a problem in that we
     * also need to connect them to the splitter.  This method builds creates
     * actions and builds a list of connections that can be set up after the
     * splitter is created.
     */
94 95
    KAction *createSplitterAction(const QString &text,
				  const char *slot,
96 97 98 99
				  const char *name,
				  const QString &pix = QString::null,
				  const KShortcut &shortcut = KShortcut());

100
private slots:
101 102 103 104 105 106

    /**
     * Toggles the shown / hidden state of the main window.
     */
    void slotShowHide();

107
    void slotPlaylistChanged();
108

109
    // file menu
110
    void slotQuit();
111

112
    // settings menu
113
    void slotToggleSystemTray(bool enabled);
114
    void slotEditKeys();
115
    void slotConfigureTagGuesser();
116
    void slotConfigureFileRenamer();
117

118 119
    void slotPlayCurrent();

120 121
    void slotGuessTagInfoFromFile();
    void slotGuessTagInfoFromInternet();
122

123 124
private:
    // layout objects
125 126 127
    PlaylistSplitter *m_splitter;
    StatusLabel *m_statusLabel;
    SystemTray *m_systemTray;
128

129 130 131
    typedef QPair<KAction *, const char *> SplitterConnection;
    QValueList<SplitterConnection> m_splitterConnections;

132
    // actions
133
    SliderAction *m_sliderAction;
134
    KToggleAction *m_showSearchAction;
135
    KToggleAction *m_showEditorAction;
136
    KToggleAction *m_showHistoryAction;
137 138
    KToggleAction *m_randomPlayAction;
    KToggleAction *m_toggleSystemTrayAction;
139
    KToggleAction *m_toggleDockOnCloseAction;
140
    KToggleAction *m_togglePopupsAction;
141
    KToggleAction *m_toggleSplashAction;
142
    KToggleAction *m_loopPlaylistAction;
143
    KSelectAction *m_outputSelectAction;
144
    KToolBarPopupAction *m_backAction;
145

146
    PlayerManager *m_player;
147
    KGlobalAccel *m_accel;
148

149
    bool m_startDocked;
150
    bool m_showSplash;
151
    bool m_shuttingDown;
152 153 154
};

#endif