1 /**************************************************************************
3 kmidclient.h - The main client widget of KMid
4 Copyright (C) 1997,98 Antonio Larrosa Jimenez
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 Send comments and bug fixes to larrosa@kde.org
21 or to Antonio Larrosa, Rio Arnoya, 10 5B, 29006 Malaga, Spain
23 ***************************************************************************/
27 #include "qslidertime.h"
30 #include <libkmid/player.h>
31 #include <libkmid/track.h>
32 #include <libkmid/notearray.h>
33 #include <libkmid/libkmid.h>
37 #include <sys/types.h>
38 #include "kdisptext.h"
56 class kmidClient
: public QWidget
67 struct kMidData m_kMid
;
69 QTimer
*timer4timebar
;
73 ulong pausedatmillisec
;
84 char *midifile_opened
;
91 QString collectionsfile
;
93 int initializing_songs
;
95 int collectionplaymode
;
96 int *collectionplaylist
; // the list of songs ordered in the
99 class KActionCollection
*actionCollection
;
101 void generateCPL(void);
102 int searchInCPL(int song
); // Returns the index of song
104 void fillInComboSongs(void);
106 int openFile(const char *filename
);
107 void allNotesOff(void);
108 ulong
timeOfNextEvent(int *type
);
110 kmidClient(QWidget
*parent
, KActionCollection
*ac
);
113 char *midiFileName(void) {return midifile_opened
;}
114 // If it returns NULL then there isn't any file opened
116 int isPlaying(void) {return m_kMid
.pctl
->playing
;}
117 int isPaused(void) {return (m_kMid
.pctl
->playing
)&&(m_kMid
.pctl
->paused
);}
119 int openUrl(const QString s
);
121 void repaintText(int typeoftextevents
);
122 static void kmidOutput(void);
124 int ChooseTypeOfTextEvents(void);
126 QFont
*getFont(void);
127 void fontChanged(void); // The new font is already in KConfig
129 SLManager
*getSLManager(void) {return slman
;}
130 void setSLManager(SLManager
*slm
);
131 // setSLManager only change the pointer, so DO NOT DELETE
132 // the objectr you pass to it
133 int getActiveCollection(void) {return activecollection
;}
134 void setActiveCollection(int i
);
135 int getSelectedSong(void);
136 void saveCollections(void);
138 void setSongType(int i
);
139 void setSongLoop(int i
);
140 void setCollectionPlayMode(int i
);
142 void visibleVolumeBar(int i
); // 1 shows it, and 0 hides it
143 // int isVisibleVolumeBar(void) {return visiblevolumebar;};
144 void visibleChannelView(int i
);
146 void shuttingDown(void);
148 void rethinkNextEvent(void);
149 // Recalculates time of next event and updates the timer4events according to it
152 void moveEventPointersTo(ulong ms
);
155 // void resizeEvent(QResizeEvent *qre);
160 // void help_About();
169 void timebarUpdate();
170 void slotSeek(int i
);
171 void slotSetVolume(int i
);
172 void slotSelectSong(int i
);
173 void slotSelectEncoding(int i
);
175 void downloadFinished( KJob
* );
177 void processSpecialEvent();
179 void channelViewDestroyed();
181 void communicationFromChannelView(int *);
183 void slotSetTempo(double value
);
186 void mustRechooseTextEvent();
188 // void channelView_Destroyed();
191 void saveLyrics(FILE *fh
);
193 DeviceManager
*devman(void) {return midi
;}
194 void setMidiDevice(int i
);
195 void setMidiMapFilename(const char *mapfilename
);
197 ChannelView
*getChannelView(void) { return channelView
; }
198 KDisplayText
*getKDisplayText(void) { return kdispt
; }
200 QSizePolicy
sizePolicy();
202 QComboBox
*getComboSongs() { return comboSongs
; }
213 void setVolume(int i
);
214 void setTempo(int i
);
215 void setSongEncoding( int i
);
216 void setLyricEvents( int i
);
217 void setCurrentSong(int i
);
218 void setPlayListMode(int i
);
220 QSize
sizeHint() const;
223 QSliderTime
*timetags
;
226 KLCDNumber
*tempoLCD
;
227 KDisplayText
*kdispt
;
229 QComboBox
*comboSongs
;
230 QComboBox
*comboEncodings
;
231 RhythmView
*rhythmview
;
234 ChannelView
*channelView
;
238 char *extractFilename(const char *in
,char *out
); // returns a pointer to out