kill dead code
[kdemultimedia.git] / kscd / kscd.h
blob58143b1defdd6d3243a53db7f1fb4cf5ac8bb624
1 /*
2 Kscd - A simple cd player for the KDE Project
4 $Id$
6 Copyright (c) 1997 Bernd Johannes Wuebben <wuebben@math.cornell.edu>
7 Copyright (c) 2002 Aaron J. Seigo <aseigo@kde.org>
8 Copyright (c) 2004 Alexander Kern <alex.kern@gmx.de>
10 This program is free software; you can redistribute it and/or modify
11 it under the terms of the GNU General Public License as published by
12 the Free Software Foundation; either version 2, or (at your option)
13 any later version.
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License for more details.
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
25 #ifndef __KSCD__
26 #define __KSCD__
28 #include <QGridLayout>
29 #include <QKeyEvent>
30 #include <QEvent>
31 #include <QCloseEvent>
33 // CD support.
34 class KCompactDisc;
36 // CDDB support via libkcddb
37 #include <libkcddb/kcddb.h>
38 #include <libkcddb/client.h>
41 #include <QPushButton>
42 #include <qdialog.h>
43 #include <qapplication.h>
44 #include <QTimer>
45 #include <qscrollbar.h>
46 #include <qslider.h>
47 #include <q3tabdialog.h>
49 #include "ledlamp.h"
50 #include "ui_panel.h"
51 #include "prefs.h"
52 #include "configWidget.h"
53 #include <kapplication.h>
54 #include <kconfigdialog.h>
55 #include <k3process.h>
56 #include <krandomsequence.h>
57 #include <kglobalaccel.h>
58 #include <ksessionmanager.h>
60 class CDDBDlg;
61 class DockWidget;
62 class QGridLayout;
63 class KActionCollection;
64 class KToggleAction;
66 class KSCD : public QWidget, Ui::kscdPanelDlg, public KSessionManager {
68 Q_OBJECT
69 Q_CLASSINFO("D-Bus Interface", "org.kde.KSCD")
71 public /*Q_SLOTS*/slots:
72 Q_SCRIPTABLE bool playing();
73 Q_SCRIPTABLE void play() { playClicked(); }
74 Q_SCRIPTABLE void stop() { stopClicked(); }
75 Q_SCRIPTABLE void previous() { prevClicked(); }
76 Q_SCRIPTABLE void next() { nextClicked(); }
77 Q_SCRIPTABLE void jumpTo(int seconds) { jumpToTime(seconds); }
78 Q_SCRIPTABLE void eject() { ejectClicked(); }
79 Q_SCRIPTABLE void quit() { quitClicked(); }
80 Q_SCRIPTABLE void toggleLoop() { loopClicked(); }
81 Q_SCRIPTABLE void toggleShuffle() { randomClicked(); }
82 Q_SCRIPTABLE void toggleTimeDisplay() { cycleplaytimemode(); }
83 Q_SCRIPTABLE void cddbDialog() { CDDialogSelected(); }
84 Q_SCRIPTABLE void optionDialog() { showConfig(); }
85 Q_SCRIPTABLE void setTrack(int t) { trackSelected(t > 0 ? t - 1 : 0); }
86 Q_SCRIPTABLE void volumeDown() { decVolume(); }
87 Q_SCRIPTABLE void volumeUp() { incVolume(); }
88 Q_SCRIPTABLE void setVolume(int v);
89 Q_SCRIPTABLE void setDevice(const QString& dev);
90 Q_SCRIPTABLE int getVolume() { return Prefs::volume(); }
91 Q_SCRIPTABLE int currentTrack();
92 Q_SCRIPTABLE int currentTrackLength();
93 Q_SCRIPTABLE int currentPosition();
94 Q_SCRIPTABLE int getStatus();
95 Q_SCRIPTABLE QString currentTrackTitle();
96 Q_SCRIPTABLE QString currentAlbum();
97 Q_SCRIPTABLE QString currentArtist();
98 Q_SCRIPTABLE QStringList trackList();
100 public:
101 explicit KSCD(QWidget *parent = 0);
102 ~KSCD();
103 virtual bool saveState(QSessionManager& sm);
105 void setDocking(bool dock);
106 void setDevicePaths();
108 signals:
109 void tooltipCurrentTrackChanged(const QString &);
111 public slots:
112 void setColors();
113 void writeSettings();
114 void playClicked();
115 void nextClicked();
116 void prevClicked();
117 void stopClicked();
118 void ejectClicked();
119 void jumpToTime(int);
120 void quitClicked();
121 void trackSelected(int);
122 void showConfig();
123 void incVolume();
124 void decVolume();
125 void volChanged(int);
126 void led_on();
127 void led_off();
128 void titlelabeltimeout();
129 void togglequeryled();
130 void cycleplaytimemode();
131 void showVolumeInLabel();
132 void showArtistLabel(QString);
133 void restoreArtistLabel();
135 void randomClicked();
136 void randomChanged(bool);
137 void loopClicked();
138 void loopChanged(bool);
140 void information(QAction *action);
142 protected:
143 // mostly start up stuff
144 void readSettings();
145 void drawPanel();
146 void setupPopups();
147 void setLEDs(int seconds);
148 void resetTimeSlider(bool enabled);
150 void closeEvent(QCloseEvent *e);
151 void keyPressEvent(QKeyEvent *e);
152 bool event(QEvent *e);
154 void populateSongList();
155 void updateConfigDialog(configWidget *widget);
157 private:
158 KConfigDialog *configDialog;
159 CDDBDlg *cddialog;
160 KCompactDisc *m_cd;
161 QTimer titlelabeltimer;
162 QTimer queryledtimer;
163 bool updateTime;
166 * Info from CDDB, and exploded versions thereof.
168 KCDDB::CDInfo cddbInfo;
169 KCDDB::Client *cddb;
170 KActionCollection *m_actions;
171 KToggleAction *m_togglePopupsAction;
172 DockWidget *m_dockWidget;
174 public slots:
175 void lookupCDDB();
177 private slots:
178 void CDDialogSelected();
179 void CDDialogDone();
180 void setCDInfo(KCDDB::CDInfo);
181 void lookupCDDBDone(KCDDB::Result);
182 void trackChanged(unsigned);
183 void trackPosition(unsigned);
184 void discChanged(unsigned);
185 void discInformation(KCompactDisc::DiscInfo);
186 void discStatusChanged(KCompactDisc::DiscStatus);
187 void configDone();
188 void configureKeys();
189 void setIcons();
191 void timeSliderPressed();
192 void timeSliderReleased();
193 void timeSliderMoved(int seconds);
196 #endif