File indexing completed on 2022-05-30 12:20:51

0001 /**
0002  * Copyright (C) 2002-2004 Scott Wheeler <wheeler@kde.org>
0003  *
0004  * This program is free software; you can redistribute it and/or modify it under
0005  * the terms of the GNU General Public License as published by the Free Software
0006  * Foundation; either version 2 of the License, or (at your option) any later
0007  * version.
0008  *
0009  * This program is distributed in the hope that it will be useful, but WITHOUT ANY
0010  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
0011  * PARTICULAR PURPOSE. See the GNU General Public License for more details.
0012  *
0013  * You should have received a copy of the GNU General Public License along with
0014  * this program.  If not, see <http://www.gnu.org/licenses/>.
0015  */
0016 
0017 #ifndef JUK_H
0018 #define JUK_H
0019 
0020 #include <kxmlguiwindow.h>
0021 
0022 class KToggleAction;
0023 class KGlobalAccel;
0024 
0025 class SliderAction;
0026 class StatusLabel;
0027 class SystemTray;
0028 class PlayerManager;
0029 class PlaylistSplitter;
0030 class Scrobbler;
0031 
0032 class JuK : public KXmlGuiWindow
0033 {
0034     Q_OBJECT
0035 
0036 public:
0037     explicit JuK(const QStringList &filesToOpen, QWidget* parent = 0);
0038     virtual ~JuK();
0039 
0040     static JuK* JuKInstance();
0041 
0042     PlayerManager *playerManager() const;
0043 
0044     // Use a null cover for failure
0045     void coverDownloaded(const QPixmap &cover);
0046 
0047 private:
0048     void setupLayout();
0049     void setupActions();
0050     void setupGlobalAccels();
0051 
0052     void keyPressEvent(QKeyEvent *) override;
0053 
0054     void activateScrobblerIfEnabled();
0055 
0056     void readConfig();
0057     void saveConfig();
0058 
0059     virtual bool queryClose() override;
0060 
0061 private slots:
0062     void slotSetupSystemTray();
0063     void slotShowHide();
0064     void slotQuit();
0065     void slotToggleSystemTray(bool enabled);
0066     void slotEditKeys();
0067     void slotConfigureTagGuesser();
0068     void slotConfigureFileRenamer();
0069     void slotConfigureScrobbling();
0070     void slotUndo();
0071     void slotCheckAlbumNextAction(bool albumRandomEnabled);
0072     void slotProcessArgs();
0073     void slotClearOldCovers();
0074 
0075 private:
0076     PlaylistSplitter *m_splitter = nullptr;
0077     StatusLabel *m_statusLabel   = nullptr;
0078     SystemTray *m_systemTray     = nullptr;
0079 
0080     KToggleAction *m_randomPlayAction        = nullptr;
0081     KToggleAction *m_toggleSystemTrayAction  = nullptr;
0082     KToggleAction *m_toggleDockOnCloseAction = nullptr;
0083     KToggleAction *m_togglePopupsAction      = nullptr;
0084 
0085     PlayerManager *m_player     = nullptr;
0086     Scrobbler     *m_scrobbler  = nullptr;
0087 
0088     QStringList m_filesToOpen;
0089     bool m_shuttingDown = false;
0090     uint m_pmToken      = 0;
0091 
0092     static JuK* m_instance;
0093 };
0094 
0095 #endif
0096 
0097 // vim: set et sw=4 tw=0 sta: