diff options
Diffstat (limited to 'src/gui/dialogs/AudioManagerDialog.cpp')
-rw-r--r-- | src/gui/dialogs/AudioManagerDialog.cpp | 212 |
1 files changed, 106 insertions, 106 deletions
diff --git a/src/gui/dialogs/AudioManagerDialog.cpp b/src/gui/dialogs/AudioManagerDialog.cpp index 5982632..a5c326c 100644 --- a/src/gui/dialogs/AudioManagerDialog.cpp +++ b/src/gui/dialogs/AudioManagerDialog.cpp @@ -67,23 +67,23 @@ #include <kurl.h> #include <kxmlguiclient.h> #include <kio/netaccess.h> -#include <qaccel.h> -#include <qcstring.h> -#include <qdatastream.h> -#include <qdialog.h> -#include <qdragobject.h> -#include <qfile.h> -#include <qfileinfo.h> -#include <qiconset.h> -#include <qlabel.h> -#include <qlistview.h> -#include <qpainter.h> -#include <qpixmap.h> -#include <qstring.h> -#include <qstrlist.h> -#include <qtimer.h> -#include <qvbox.h> -#include <qwidget.h> +#include <tqaccel.h> +#include <tqcstring.h> +#include <tqdatastream.h> +#include <tqdialog.h> +#include <tqdragobject.h> +#include <tqfile.h> +#include <tqfileinfo.h> +#include <tqiconset.h> +#include <tqlabel.h> +#include <tqlistview.h> +#include <tqpainter.h> +#include <tqpixmap.h> +#include <tqstring.h> +#include <tqstrlist.h> +#include <tqtimer.h> +#include <tqvbox.h> +#include <tqwidget.h> namespace Rosegarden @@ -93,29 +93,29 @@ const int AudioManagerDialog::m_maxPreviewWidth = 100; const int AudioManagerDialog::m_previewHeight = 30; const char* const AudioManagerDialog::m_listViewLayoutName = "AudioManagerDialog Layout"; -AudioManagerDialog::AudioManagerDialog(QWidget *parent, +AudioManagerDialog::AudioManagerDialog(TQWidget *parent, RosegardenGUIDoc *doc): KMainWindow(parent, "audioManagerDialog"), m_doc(doc), m_playingAudioFile(0), m_audioPlayingDialog(0), - m_playTimer(new QTimer(this)), + m_playTimer(new TQTimer(this)), m_audiblePreview(true) { setCaption(i18n("Audio File Manager")); setWFlags(WDestructiveClose); - QVBox *box = new QVBox(this); + TQVBox *box = new TQVBox(this); setCentralWidget(box); box->setMargin(10); box->setSpacing(5); m_sampleRate = 0; - QCString replyType; - QByteArray replyData; + TQCString replyType; + TQByteArray replyData; if (rgapp->sequencerCall("getSampleRate()", replyType, replyData)) { - QDataStream streamIn(replyData, IO_ReadOnly); + TQDataStream streamIn(replyData, IO_ReadOnly); unsigned int result; streamIn >> result; m_sampleRate = result; @@ -123,54 +123,54 @@ AudioManagerDialog::AudioManagerDialog(QWidget *parent, m_fileList = new AudioListView(box); - m_wrongSampleRates = new QLabel(i18n("* Some audio files are encoded at a sample rate different from that of the JACK audio server.\nRosegarden will play them at the correct speed, but they will sound terrible.\nPlease consider resampling such files externally, or adjusting the sample rate of the JACK server."), box); + m_wrongSampleRates = new TQLabel(i18n("* Some audio files are encoded at a sample rate different from that of the JACK audio server.\nRosegarden will play them at the correct speed, but they will sound terrible.\nPlease consider resampling such files externally, or adjusting the sample rate of the JACK server."), box); m_wrongSampleRates->hide(); - QString pixmapDir = KGlobal::dirs()->findResource("appdata", "pixmaps/"); - QIconSet icon(QPixmap(pixmapDir + "/toolbar/transport-play.xpm")); + TQString pixmapDir = KGlobal::dirs()->findResource("appdata", "pixmaps/"); + TQIconSet icon(TQPixmap(pixmapDir + "/toolbar/transport-play.xpm")); new KAction(i18n("&Add Audio File..."), "fileopen", 0, this, - SLOT(slotAdd()), actionCollection(), "add_audio"); + TQT_SLOT(slotAdd()), actionCollection(), "add_audio"); new KAction(i18n("&Unload Audio File"), "editdelete", 0, this, - SLOT(slotRemove()), + TQT_SLOT(slotRemove()), actionCollection(), "remove_audio"); - icon = QIconSet(QPixmap(pixmapDir + "/toolbar/transport-play.xpm")); + icon = TQIconSet(TQPixmap(pixmapDir + "/toolbar/transport-play.xpm")); new KAction(i18n("&Play Preview"), icon, 0, this, - SLOT(slotPlayPreview()), + TQT_SLOT(slotPlayPreview()), actionCollection(), "preview_audio"); /*!!! Not actually implemented -- this never worked right! new KAction(i18n("Re&label"), 0, 0, this, - SLOT(slotRename()), + TQT_SLOT(slotRename()), actionCollection(), "rename_audio"); */ - icon = QIconSet(QPixmap(pixmapDir + "/toolbar/insert_audio_into_track.xpm")); + icon = TQIconSet(TQPixmap(pixmapDir + "/toolbar/insert_audio_into_track.xpm")); new KAction(i18n("&Insert into Selected Audio Track"), - icon, 0, this, SLOT(slotInsert()), + icon, 0, this, TQT_SLOT(slotInsert()), actionCollection(), "insert_audio"); new KAction(i18n("Unload &all Audio Files"), 0, 0, this, - SLOT(slotRemoveAll()), + TQT_SLOT(slotRemoveAll()), actionCollection(), "remove_all_audio"); new KAction(i18n("Unload all &Unused Audio Files"), 0, 0, this, - SLOT(slotRemoveAllUnused()), + TQT_SLOT(slotRemoveAllUnused()), actionCollection(), "remove_all_unused_audio"); new KAction(i18n("&Delete Unused Audio Files..."), 0, 0, this, - SLOT(slotDeleteUnused()), + TQT_SLOT(slotDeleteUnused()), actionCollection(), "delete_unused_audio"); new KAction(i18n("&Export Audio File..."), "fileexport", 0, this, - SLOT(slotExportAudio()), + TQT_SLOT(slotExportAudio()), actionCollection(), "export_audio"); /* new KAction(i18n("Distribute Audio on &MIDI"), 0, 0, this, - SLOT(slotDistributeOnMidiSegment()), + TQT_SLOT(slotDistributeOnMidiSegment()), actionCollection(), "distribute_audio"); */ @@ -202,36 +202,36 @@ AudioManagerDialog::AudioManagerDialog(QWidget *parent, m_fileList->setShowToolTips(true); // connect selection mechanism - connect(m_fileList, SIGNAL(selectionChanged(QListViewItem*)), - SLOT(slotSelectionChanged(QListViewItem*))); + connect(m_fileList, TQT_SIGNAL(selectionChanged(TQListViewItem*)), + TQT_SLOT(slotSelectionChanged(TQListViewItem*))); - connect(m_fileList, SIGNAL(dropped(QDropEvent*, QListViewItem*)), - SLOT(slotDropped(QDropEvent*, QListViewItem*))); + connect(m_fileList, TQT_SIGNAL(dropped(TQDropEvent*, TQListViewItem*)), + TQT_SLOT(slotDropped(TQDropEvent*, TQListViewItem*))); // setup local accelerators // - m_accelerators = new QAccel(this); + m_accelerators = new TQAccel(this); // delete // m_accelerators->connectItem(m_accelerators->insertItem(Key_Delete), this, - SLOT(slotRemove())); + TQT_SLOT(slotRemove())); slotPopulateFileList(); // Connect command history for updates // - connect(getCommandHistory(), SIGNAL(commandExecuted(KCommand *)), - this, SLOT(slotCommandExecuted(KCommand *))); + connect(getCommandHistory(), TQT_SIGNAL(commandExecuted(KCommand *)), + this, TQT_SLOT(slotCommandExecuted(KCommand *))); //setInitialSize(configDialogSize(AudioManagerDialogConfigGroup)); - connect(m_playTimer, SIGNAL(timeout()), - this, SLOT(slotCancelPlayingAudio())); + connect(m_playTimer, TQT_SIGNAL(timeout()), + this, TQT_SLOT(slotCancelPlayingAudio())); KStdAction::close(this, - SLOT(slotClose()), + TQT_SLOT(slotClose()), actionCollection()); createGUI("audiomanager.rc"); @@ -250,7 +250,7 @@ void AudioManagerDialog::slotPopulateFileList() { // create pixmap of given size - QPixmap *audioPixmap = new QPixmap(m_maxPreviewWidth, m_previewHeight); + TQPixmap *audioPixmap = new TQPixmap(m_maxPreviewWidth, m_previewHeight); // Store last selected item if we have one // @@ -280,7 +280,7 @@ AudioManagerDialog::slotPopulateFileList() // Turn off selection and report empty list // new AudioListItem(m_fileList, i18n("<no audio files>"), 0); - m_fileList->setSelectionMode(QListView::NoSelection); + m_fileList->setSelectionMode(TQListView::NoSelection); m_fileList->setRootIsDecorated(false); m_fileList->blockSignals(false); @@ -292,10 +292,10 @@ AudioManagerDialog::slotPopulateFileList() m_fileList->setRootIsDecorated(true); // enable selection - m_fileList->setSelectionMode(QListView::Single); + m_fileList->setSelectionMode(TQListView::Single); // for the sample file length - QString msecs, sRate; + TQString msecs, sRate; RealTime length; // Create a vector of audio Segments only @@ -325,15 +325,15 @@ AudioManagerDialog::slotPopulateFileList() audioPixmap); } catch (Exception e) { audioPixmap->fill(); // white - QPainter p(audioPixmap); + TQPainter p(audioPixmap); p.setPen(Qt::black); - p.drawText(10, m_previewHeight / 2, QString("<no preview>")); + p.drawText(10, m_previewHeight / 2, TQString("<no preview>")); } //!!! Why isn't the label the label the user assigned to the file? // Why do we allow the user to assign a label at all, then? - QString label = QString((*it)->getShortFilename().c_str()); + TQString label = TQString((*it)->getShortFilename().c_str()); // Set the label, duration, envelope pixmap and filename // @@ -343,7 +343,7 @@ AudioManagerDialog::slotPopulateFileList() // length = (*it)->getLength(); msecs.sprintf("%03d", length.nsec / 1000000); - item->setText(1, QString("%1.%2s").arg(length.sec).arg(msecs)); + item->setText(1, TQString("%1.%2s").arg(length.sec).arg(msecs)); // set start time and duration item->setStartTime(RealTime::zeroTime); @@ -355,17 +355,17 @@ AudioManagerDialog::slotPopulateFileList() // File location // - item->setText(6, QString( + item->setText(6, TQString( m_doc->getAudioFileManager(). substituteHomeForTilde((*it)->getFilename()).c_str())); // Resolution // - item->setText(5, QString("%1 bits").arg((*it)->getBitsPerSample())); + item->setText(5, TQString("%1 bits").arg((*it)->getBitsPerSample())); // Channels // - item->setText(4, QString("%1").arg((*it)->getChannels())); + item->setText(4, TQString("%1").arg((*it)->getChannels())); // Sample rate // @@ -390,7 +390,7 @@ AudioManagerDialog::slotPopulateFileList() if ((*iit)->getAudioFileId() == (*it)->getId()) { AudioListItem *childItem = new AudioListItem(item, - QString((*iit)->getLabel().c_str()), + TQString((*iit)->getLabel().c_str()), (*it)->getId()); segmentDuration = (*iit)->getAudioEndTime() - (*iit)->getAudioStartTime(); @@ -403,7 +403,7 @@ AudioManagerDialog::slotPopulateFileList() // Write segment duration // msecs.sprintf("%03d", segmentDuration.nsec / 1000000); - childItem->setText(1, QString("%1.%2s") + childItem->setText(1, TQString("%1.%2s") .arg(segmentDuration.sec) .arg(msecs)); @@ -483,7 +483,7 @@ AudioManagerDialog::slotExportAudio() Segment *segment = item->getSegment(); - QString saveFile = + TQString saveFile = KFileDialog::getSaveFileName(":WAVS", i18n("*.wav|WAV files (*.wav)"), this, i18n("Choose a name to save this file as")); @@ -551,7 +551,7 @@ AudioManagerDialog::slotRemove() if (item->getSegment()) { // Get the next item to highlight // - QListViewItem *newItem = item->itemBelow(); + TQListViewItem *newItem = item->itemBelow(); // Or try above // @@ -606,8 +606,8 @@ AudioManagerDialog::slotRemove() if (haveSegments) { - QString question = i18n("This will unload audio file \"%1\" and remove all associated segments. Are you sure?") - .arg(QString(audioFile->getFilename().c_str())); + TQString question = i18n("This will unload audio file \"%1\" and remove all associated segments. Are you sure?") + .arg(TQString(audioFile->getFilename().c_str())); // Ask the question int reply = KMessageBox::warningContinueCancel(this, question); @@ -655,7 +655,7 @@ AudioManagerDialog::slotPlayPreview() // now open up the playing dialog // m_audioPlayingDialog = - new AudioPlayingDialog(this, QString(audioFile->getFilename().c_str())); + new AudioPlayingDialog(this, TQString(audioFile->getFilename().c_str())); // Setup timer to pop down dialog after file has completed // @@ -665,7 +665,7 @@ AudioManagerDialog::slotPlayPreview() // just execute // - if (m_audioPlayingDialog->exec() == QDialog::Rejected) + if (m_audioPlayingDialog->exec() == TQDialog::Rejected) emit cancelPlayingAudioFile(m_playingAudioFile); delete m_audioPlayingDialog; @@ -689,7 +689,7 @@ AudioManagerDialog::slotCancelPlayingAudio() void AudioManagerDialog::slotAdd() { - QString extensionList = i18n("*.wav|WAV files (*.wav)\n*.*|All files"); + TQString extensionList = i18n("*.wav|WAV files (*.wav)\n*.*|All files"); if (RosegardenGUIApp::self()->haveAudioImporter()) { //!!! This list really needs to come from the importer helper program @@ -759,7 +759,7 @@ AudioManagerDialog::slotInsert() void AudioManagerDialog::slotRemoveAll() { - QString question = + TQString question = i18n("This will unload all audio files and remove their associated segments.\nThis action cannot be undone, and associations with these files will be lost.\nFiles will not be removed from your disk.\nAre you sure?"); int reply = KMessageBox::warningContinueCancel(this, question); @@ -796,7 +796,7 @@ AudioManagerDialog::slotRemoveAll() void AudioManagerDialog::slotRemoveAllUnused() { - QString question = + TQString question = i18n("This will unload all audio files that are not associated with any segments in this composition.\nThis action cannot be undone, and associations with these files will be lost.\nFiles will not be removed from your disk.\nAre you sure?"); int reply = KMessageBox::warningContinueCancel(this, question); @@ -848,8 +848,8 @@ AudioManagerDialog::slotDeleteUnused() audioFiles.insert((*it)->getAudioFileId()); } - std::vector<QString> toDelete; - std::map<QString, AudioFileId> nameMap; + std::vector<TQString> toDelete; + std::map<TQString, AudioFileId> nameMap; for (std::vector<AudioFile*>::const_iterator aIt = m_doc->getAudioFileManager().begin(); @@ -865,13 +865,13 @@ AudioManagerDialog::slotDeleteUnused() i18n("The following audio files are not used in the current composition.\n\nPlease select the ones you wish to delete permanently from the hard disk.\n"), toDelete); - if (dialog->exec() == QDialog::Accepted) { + if (dialog->exec() == TQDialog::Accepted) { - std::vector<QString> names = dialog->getSelectedAudioFileNames(); + std::vector<TQString> names = dialog->getSelectedAudioFileNames(); if (names.size() > 0) { - QString question = + TQString question = i18n("<qt>About to delete 1 audio file permanently from the hard disk.<br>This action cannot be undone, and there will be no way to recover this file.<br>Are you sure?</qt>\n", "<qt>About to delete %n audio files permanently from the hard disk.<br>This action cannot be undone, and there will be no way to recover these files.<br>Are you sure?</qt>", names.size()); int reply = KMessageBox::warningContinueCancel(this, question); @@ -883,7 +883,7 @@ AudioManagerDialog::slotDeleteUnused() for (int i = 0; i < names.size(); ++i) { std::cerr << i << ": " << names[i] << std::endl; - QFile file(names[i]); + TQFile file(names[i]); if (!file.remove()) { KMessageBox::error(this, i18n("File %1 could not be deleted.").arg(names[i])); } else { @@ -894,7 +894,7 @@ AudioManagerDialog::slotDeleteUnused() std::cerr << "WARNING: Audio file name " << names[i] << " not in name map" << std::endl; } - QFile peakFile(QString("%1.pk").arg(names[i])); + TQFile peakFile(TQString("%1.pk").arg(names[i])); peakFile.remove(); } } @@ -917,10 +917,10 @@ AudioManagerDialog::slotRename() bool ok = false; - QString newText = KLineEditDlg::getText( + TQString newText = KLineEditDlg::getText( i18n("Change Audio File label"), i18n("Enter new label"), - QString(audioFile->getName().c_str()), + TQString(audioFile->getName().c_str()), &ok, this); @@ -931,7 +931,7 @@ AudioManagerDialog::slotRename() } void -AudioManagerDialog::slotSelectionChanged(QListViewItem *item) +AudioManagerDialog::slotSelectionChanged(TQListViewItem *item) { AudioListItem *aItem = dynamic_cast<AudioListItem*>(item); @@ -952,8 +952,8 @@ AudioManagerDialog::setSelected(AudioFileId id, const Segment *segment, bool propagate) { - QListViewItem *it = m_fileList->firstChild(); - QListViewItem *chIt = 0; + TQListViewItem *it = m_fileList->firstChild(); + TQListViewItem *chIt = 0; AudioListItem *aItem; while (it) { @@ -997,7 +997,7 @@ AudioManagerDialog::setSelected(AudioFileId id, } void -AudioManagerDialog::selectFileListItemNoSignal(QListViewItem* it) +AudioManagerDialog::selectFileListItemNoSignal(TQListViewItem* it) { m_fileList->blockSignals(true); @@ -1093,31 +1093,31 @@ AudioManagerDialog::addFile(const KURL& kurl) // Connect the progress dialog // - connect(&aFM, SIGNAL(setProgress(int)), - progressDlg.progressBar(), SLOT(setValue(int))); - connect(&aFM, SIGNAL(setOperationName(QString)), - &progressDlg, SLOT(slotSetOperationName(QString))); - connect(&progressDlg, SIGNAL(cancelClicked()), - &aFM, SLOT(slotStopImport())); + connect(&aFM, TQT_SIGNAL(setProgress(int)), + progressDlg.progressBar(), TQT_SLOT(setValue(int))); + connect(&aFM, TQT_SIGNAL(setOperationName(TQString)), + &progressDlg, TQT_SLOT(slotSetOperationName(TQString))); + connect(&progressDlg, TQT_SIGNAL(cancelClicked()), + &aFM, TQT_SLOT(slotStopImport())); try { id = aFM.importURL(kurl, m_sampleRate); } catch (AudioFileManager::BadAudioPathException e) { CurrentProgressDialog::freeze(); - QString errorString = i18n("Failed to add audio file. ") + strtoqstr(e.getMessage()); + TQString errorString = i18n("Failed to add audio file. ") + strtoqstr(e.getMessage()); KMessageBox::sorry(this, errorString); return false; } catch (SoundFile::BadSoundFileException e) { CurrentProgressDialog::freeze(); - QString errorString = i18n("Failed to add audio file. ") + strtoqstr(e.getMessage()); + TQString errorString = i18n("Failed to add audio file. ") + strtoqstr(e.getMessage()); KMessageBox::sorry(this, errorString); return false; } - disconnect(&progressDlg, SIGNAL(cancelClicked()), - &aFM, SLOT(slotStopImport())); - connect(&progressDlg, SIGNAL(cancelClicked()), - &aFM, SLOT(slotStopPreview())); + disconnect(&progressDlg, TQT_SIGNAL(cancelClicked()), + &aFM, TQT_SLOT(slotStopImport())); + connect(&progressDlg, TQT_SIGNAL(cancelClicked()), + &aFM, TQT_SLOT(slotStopPreview())); progressDlg.progressBar()->show(); progressDlg.slotSetOperationName(i18n("Generating audio preview...")); @@ -1126,13 +1126,13 @@ AudioManagerDialog::addFile(const KURL& kurl) } catch (Exception e) { CurrentProgressDialog::freeze(); - QString message = strtoqstr(e.getMessage()) + "\n\n" + + TQString message = strtoqstr(e.getMessage()) + "\n\n" + i18n("Try copying this file to a directory where you have write permission and re-add it"); KMessageBox::information(this, message); } - disconnect(&progressDlg, SIGNAL(cancelClicked()), - &aFM, SLOT(slotStopPreview())); + disconnect(&progressDlg, TQT_SIGNAL(cancelClicked()), + &aFM, TQT_SLOT(slotStopPreview())); slotPopulateFileList(); @@ -1143,14 +1143,14 @@ AudioManagerDialog::addFile(const KURL& kurl) } void -AudioManagerDialog::slotDropped(QDropEvent *event, QListViewItem*) +AudioManagerDialog::slotDropped(TQDropEvent *event, TQListViewItem*) { - QStrList uri; + TQStrList uri; // see if we can decode a URI.. if not, just ignore it - if (QUriDrag::decode(event, uri)) { + if (TQUriDrag::decode(event, uri)) { // okay, we have a URI.. process it - for (QString url = uri.first(); url; url = uri.next()) { + for (TQString url = uri.first(); url; url = uri.next()) { RG_DEBUG << "AudioManagerDialog::dropEvent() : got " << url << endl; @@ -1162,7 +1162,7 @@ AudioManagerDialog::slotDropped(QDropEvent *event, QListViewItem*) } void -AudioManagerDialog::closeEvent(QCloseEvent *e) +AudioManagerDialog::closeEvent(TQCloseEvent *e) { RG_DEBUG << "AudioManagerDialog::closeEvent()\n"; emit closing(); @@ -1188,9 +1188,9 @@ AudioManagerDialog::setAudioSubsystemStatus(bool ok) } bool -AudioManagerDialog::addAudioFile(const QString &filePath) +AudioManagerDialog::addAudioFile(const TQString &filePath) { - return addFile(QFileInfo(filePath).absFilePath()); + return addFile(TQFileInfo(filePath).absFilePath()); } bool |