1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134
|
/***************************************************************************
NewSignalDialog.h - dialog for the "newsignal" plugin
-------------------
begin : Wed Jul 18 2001
copyright : (C) 2001 by Thomas Eschenbacher
email : Thomas.Eschenbacher@gmx.de
***************************************************************************/
/***************************************************************************
* *
* 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 NEW_SIGNAL_DIALOG_H
#define NEW_SIGNAL_DIALOG_H
#include "config.h"
#include <QDialog>
#include <QTimer>
#include <QWidget>
#include "ui_NewSigDlg.h"
#include "libkwave/Sample.h"
class QString;
namespace Kwave
{
class NewSignalDialog: public QDialog,
public Ui::NewSigDlg
{
Q_OBJECT
public:
/**
* Constructor.
* @param parent the parent widget the dialog belongs to
* @param samples default resolution in bits per sample
* @param rate default sample rate
* @param bits default resolution
* @param tracks default tracks
* @param by_time if true: select by time, if false: select by samples
*/
NewSignalDialog(QWidget *parent, sample_index_t samples,
unsigned int rate, unsigned int bits,
unsigned int tracks, bool by_time);
/** Destructor */
~NewSignalDialog() override {}
/** Returns the number of samples */
sample_index_t samples();
/** Returns the selected sample rate [samples/second] */
double rate();
/** Returns the selected resolution [bits per sample] */
unsigned int bitsPerSample();
/** Returns the selected number of tracks */
unsigned int tracks();
/** Returns true if the selection was made by time */
bool byTime();
private slots:
/**
* Checks for modifications of the sample number edit.
* That stupid QSpinBox doesn't notify us about changes :-[
*/
void checkNewSampleEdit();
/** Checks for changes in the samples or time info */
void checkTimeAndLengthInfo(int);
/** starts/stops the sample edit's timer if rbTime has been toggled */
void rbTimeToggled(bool);
/** updates the number of samples if the time changed */
void timeChanged(int);
/** called when the sample rate has been edited or changed */
void sampleRateChanged(const QString&);
/** called when the sample rate has been changed */
void tracksChanged(int);
/** number of samples changed */
void samplesChanged(int);
/** updates the file size */
void updateFileSize();
/** called if the slider for the length has been moved */
void setLengthPercentage(int percent);
/** invoke the online help */
void invokeHelp();
private:
/**
* Returns the maximum number of samples per track that can be created
* with the current settings, based on the maximum file size of a .wav
* file and the header sizes.
*/
sample_index_t maxSamples();
/**
* Sets hours, minutes and seconds according to a given
* number of samples.
*/
void setHMS(sample_index_t &samples);
private:
/** Timer that checks for changes in the sample edit field */
QTimer m_timer;
/** flag to avoid recursion */
bool m_recursive;
};
}
#endif /* NEW_SIGNAL_DIALOG_H */
//***************************************************************************
//***************************************************************************
|