00001
00002
00003
00004
00005 #ifndef QTREC_H
00006 #define QTREC_H
00007 #define VERSION 20040628
00008
00009 #include <qpe/ir.h>
00010
00011 #include <qfile.h>
00012 #include <qimage.h>
00013 #include <qlineedit.h>
00014 #include <qpixmap.h>
00015 #include <qvariant.h>
00016 #include <qwidget.h>
00017 #include <stdio.h>
00018 #include <stdlib.h>
00019
00020 #include "device.h"
00021 #include "wavFile.h"
00022
00023 class QButtonGroup;
00024 class QCheckBox;
00025 class QComboBox;
00026 class QGridLayout;
00027 class QGroupBox;
00028 class QHBoxLayout;
00029 class QIconView;
00030 class QIconViewItem;
00031 class QLabel;
00032 class QLabel;
00033 class QListView;
00034 class QListViewItem;
00035 class QPushButton;
00036 class QSlider;
00037 class QTabWidget;
00038 class QTimer;
00039 class QVBoxLayout;
00040 class QLineEdit;
00041
00042 #define MAX_TRACKS 2
00043
00044
00045 #define BUFSIZE 1024
00046
00047 #define FRAGSIZE 0x7fff000A;
00048
00049 #define WAVE_FORMAT_DVI_ADPCM (0x0011)
00050 #define WAVE_FORMAT_PCM (0x0001)
00051
00052
00053 class QtRec : public QWidget
00054 {
00055 Q_OBJECT
00056
00057 public:
00058 static QString appName() { return QString::fromLatin1("opierec"); }
00059 QtRec( QWidget* parent=0, const char* name=0, WFlags fl=0 );
00060 ~QtRec();
00061 QSlider *OutputSlider,*InputSlider;
00062
00063 signals:
00064 void stopRecording();
00065 void startRecording();
00066 void stopPlaying();
00067 void startPlaying();
00068
00069 public slots:
00070
00071 private:
00072
00073 int fd1;
00074 int secCount;
00075 QString timeString;
00076
00077 QLineEdit *renameBox;
00078 QGroupBox* GroupBox1;
00079 QString currentFile;
00080 QString date, currentFileName, tmpFileName;
00081 QTimer *t_timer;
00082 bool needsStereoOut, paused;
00083 bool useTmpFile, autoMute;
00084
00085 bool eventFilter( QObject * , QEvent * );
00086 void okRename();
00087 void cancelRename();
00088 QString getStorage(const QString &);
00089 bool rec();
00090 int getCurrentSizeLimit();
00091 long checkDiskSpace(const QString &);
00092 void doMute(bool);
00093 void errorStop();
00094 void fillDirectoryCombo();
00095 void getInVol();
00096 void getOutVol();
00097 void init();
00098 void initConfig();
00099 void initConnections();
00100 void selectItemByName(const QString &);
00101 void setRecordButton(bool);
00102 void start();
00103 void stop();
00104 void timerEvent( QTimerEvent *e );
00105
00106 private slots:
00107 void endPlaying();
00108 void endRecording();
00109
00110 void FastforwardPressed();
00111 void FastforwardReleased();
00112
00113 void changeDirCombo(int);
00114 void changeSizeLimitCombo(int);
00115 void changeTimeSlider(int);
00116 void changebitrateCombo(int);
00117 void changeStereoCheck( bool);
00118
00119 void changedInVolume();
00120 void changedOutVolume();
00121 void changesamplerateCombo(int);
00122
00123 void cleanUp();
00124 void compressionSelected(bool);
00125 void deleteSound();
00126 void doBeam();
00127 void doMenuPlay();
00128 void doMicMuting(bool);
00129 void doPlayBtn();
00130 void doRename();
00131 void doVolMuting(bool);
00132 void forwardTimerTimeout();
00133 void itClick(QListViewItem *item);
00134 void listPressed(int, QListViewItem *, const QPoint&, int);
00135 void newSound();
00136 void rewindPressed();
00137 void rewindReleased();
00138 void rewindTimerTimeout();
00139 void slotAutoMute(bool);
00140 void thisTab(QWidget*);
00141 void timeSliderPressed();
00142 void timeSliderReleased();
00143 void timerBreak();
00144 void initIconView();
00145
00146
00147
00148 protected:
00149
00150 WavFile *wavFile;
00151 QButtonGroup *ButtonGroup1;
00152 QCheckBox *outMuteCheckBox, *inMuteCheckBox, *compressionCheckBox, *autoMuteCheckBox, *stereoCheckBox;
00153 QComboBox* sampleRateComboBox, * bitRateComboBox, *directoryComboBox, *sizeLimitCombo;
00154 QHBoxLayout* Layout12;
00155 QHBoxLayout* Layout13;
00156 QHBoxLayout* Layout14;
00157 QHBoxLayout* Layout16;
00158 QHBoxLayout* Layout17;
00159 QHBoxLayout* Layout19;
00160 QIconView *IconView1;
00161 QLabel *NewSoundLabel,*playLabel2;
00162 QLabel *TextLabel3, *TextLabel1, *TextLabel2;
00163 QListView *ListView1;
00164 QPushButton *Stop_PushButton, *Play_PushButton, *Rec_PushButton, *NewSoundButton, *deleteSoundButton, *toBeginningButton, *toEndButton;
00165 QString recDir;
00166 QTabWidget *TabWidget;
00167 QTimer *t, *rewindTimer, *forwardTimer;
00168 QVBoxLayout* Layout15;
00169 QVBoxLayout* Layout15b;
00170 QVBoxLayout* Layout18;
00171 QWidget *tab, *tab_2, *tab_3, *tab_4, *tab_5;
00172 int sliderPos, total;
00173
00174
00175 QGroupBox *sampleGroup, *bitGroup, *dirGroup, *sizeGroup;
00176
00177
00178
00179
00180 bool doPlay();
00181 bool openPlayFile();
00182 bool setUpFile();
00183 bool setupAudio( bool b);
00184 void fileBeamFinished( Ir *ir);
00185 void keyPressEvent( QKeyEvent *e);
00186 void keyReleaseEvent( QKeyEvent *e);
00187 void receive( const QCString &, const QByteArray & );
00188 void showListMenu(QListViewItem * );
00189 #ifndef THREADED
00190 void quickRec();
00191 void playIt();
00192 #endif
00193
00194 };
00195
00196 #endif // QTREC_H