[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Traverso-commit] traverso/src commands/Import.h traverso/CMakeLi...
From: |
Nicola Doebelin |
Subject: |
[Traverso-commit] traverso/src commands/Import.h traverso/CMakeLi... |
Date: |
Sun, 25 May 2008 13:59:12 +0000 |
CVSROOT: /sources/traverso
Module name: traverso
Changes by: Nicola Doebelin <n_doebelin> 08/05/25 13:59:12
Modified files:
src/commands : Import.h
src/traverso : CMakeLists.txt Interface.cpp
Added files:
src/traverso/dialogs/project: ImportClipsDialog.cpp
ImportClipsDialog.h
src/traverso/ui: ImportClipsDialog.ui
Log message:
* improved "Import Audio" function. Several clips can be imported into
a track. Adding markers doesn't work yet.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/traverso/src/commands/Import.h?cvsroot=traverso&r1=1.9&r2=1.10
http://cvs.savannah.gnu.org/viewcvs/traverso/src/traverso/CMakeLists.txt?cvsroot=traverso&r1=1.18&r2=1.19
http://cvs.savannah.gnu.org/viewcvs/traverso/src/traverso/Interface.cpp?cvsroot=traverso&r1=1.145&r2=1.146
http://cvs.savannah.gnu.org/viewcvs/traverso/src/traverso/dialogs/project/ImportClipsDialog.cpp?cvsroot=traverso&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/traverso/src/traverso/dialogs/project/ImportClipsDialog.h?cvsroot=traverso&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/traverso/src/traverso/ui/ImportClipsDialog.ui?cvsroot=traverso&rev=1.1
Patches:
Index: commands/Import.h
===================================================================
RCS file: /sources/traverso/traverso/src/commands/Import.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -b -r1.9 -r1.10
--- commands/Import.h 21 May 2008 11:11:33 -0000 1.9
+++ commands/Import.h 25 May 2008 13:59:10 -0000 1.10
@@ -17,7 +17,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- $Id: Import.h,v 1.9 2008/05/21 11:11:33 r_sijrier Exp $
+ $Id: Import.h,v 1.10 2008/05/25 13:59:10 n_doebelin Exp $
*/
#ifndef IMPORT_H
@@ -46,6 +46,7 @@
void create_audioclip();
void set_track(Track* track);
void set_position(const TimeRef& position);
+ ReadSource* readsource() {return m_source;};
private :
Track* m_track;
Index: traverso/CMakeLists.txt
===================================================================
RCS file: /sources/traverso/traverso/src/traverso/CMakeLists.txt,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -b -r1.18 -r1.19
--- traverso/CMakeLists.txt 24 May 2008 19:33:58 -0000 1.18
+++ traverso/CMakeLists.txt 25 May 2008 13:59:10 -0000 1.19
@@ -35,6 +35,7 @@
dialogs/project/NewProjectDialog.cpp
dialogs/project/OpenProjectDialog.cpp
dialogs/project/NewTrackDialog.cpp
+dialogs/project/ImportClipsDialog.cpp
dialogs/RestoreProjectBackupDialog.cpp
dialogs/PluginSelectorDialog.cpp
dialogs/ProjectConverterDialog.cpp
@@ -79,6 +80,7 @@
ui/ProjectConverterDialog.ui
ui/ExportDialog.ui
ui/CDWritingDialog.ui
+ui/ImportClipsDialog.ui
)
SET(TRAVERSO_GUI_MOC_CLASSES
@@ -95,6 +97,7 @@
dialogs/project/NewSheetDialog.h
dialogs/project/NewTrackDialog.h
dialogs/project/NewProjectDialog.h
+dialogs/project/ImportClipsDialog.h
dialogs/project/OpenProjectDialog.h
dialogs/project/ProjectManagerDialog.h
dialogs/settings/SettingsDialog.h
Index: traverso/Interface.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/traverso/Interface.cpp,v
retrieving revision 1.145
retrieving revision 1.146
diff -u -b -r1.145 -r1.146
--- traverso/Interface.cpp 24 May 2008 18:00:14 -0000 1.145
+++ traverso/Interface.cpp 25 May 2008 13:59:10 -0000 1.146
@@ -34,6 +34,7 @@
#include <QDesktopServices>
#include <QTextStream>
#include <QStackedWidget>
+#include <QFileDialog>
#include "Interface.h"
#include "ProjectManager.h"
@@ -67,6 +68,7 @@
#include "dialogs/ProjectConverterDialog.h"
#include "dialogs/ExportDialog.h"
#include "dialogs/CDWritingDialog.h"
+#include "dialogs/project/ImportClipsDialog.h"
// Always put me below _all_ includes, this is needed
// in case we run with memory leak detection enabled!
@@ -1141,19 +1143,49 @@
void Interface::import_audio()
{
- if (currentSheetWidget->get_sheet()->get_numtracks() > 0) {
+ if (!currentSheetWidget->get_sheet()->get_numtracks()) {
+ return;
+ }
+
+ QStringList files = QFileDialog::getOpenFileNames(this, tr("Open Audio
Files"),
+ config().get_property("Project", "directory",
"/directory/unknown").toString(),
+ tr("Audio files (*.wav *.flac *.ogg *.mp3 *.wv
*.w64)"));
+
QList<Track*> tracks =
currentSheetWidget->get_sheet()->get_tracks();
- Track* shortestTrack = tracks.first();
+ Track* track = tracks.first();
+ bool markers = false;
+
+ ImportClipsDialog *importClips = new ImportClipsDialog(this);
+
+ importClips->set_tracks(tracks);
- foreach(Track* track, tracks) {
- if (!track->get_cliplist().isEmpty() &&
(track->get_cliplist().last())->get_track_end_location() >
(shortestTrack->get_cliplist().last())->get_track_end_location()) {
- shortestTrack = track;
+ if (importClips->exec() == QDialog::Accepted) {
+ if (!importClips->has_tracks()) {
+ delete importClips;
+ return;
+ }
+
+ track = importClips->get_selected_track();
+ markers = importClips->get_add_markers();
}
+
+ // append the clips to the selected track
+ TimeRef position = TimeRef();
+ if (!track->get_cliplist().isEmpty()) {
+ position =
(track->get_cliplist().last())->get_track_end_location();
}
- Import* cmd = new Import(shortestTrack, TimeRef());
- Command::process_command(cmd);
+ while(!files.isEmpty()) {
+ Import* import = new Import(files.takeFirst());
+ import->set_track(track);
+ import->set_position(position);
+ if (import->create_readsource() != -1) {
+ position += import->readsource()->get_length();
+ Command::process_command(import);
+ }
}
+
+ delete importClips;
}
DigitalClock::DigitalClock(QWidget *parent)
Index: traverso/dialogs/project/ImportClipsDialog.cpp
===================================================================
RCS file: traverso/dialogs/project/ImportClipsDialog.cpp
diff -N traverso/dialogs/project/ImportClipsDialog.cpp
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ traverso/dialogs/project/ImportClipsDialog.cpp 25 May 2008 13:59:11
-0000 1.1
@@ -0,0 +1,69 @@
+/*
+ Copyright (C) 2008 Nicola Doebelin
+
+ This file is part of Traverso
+
+ Traverso 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.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+
+*/
+
+#include "ImportClipsDialog.h"
+#include "ui_ImportClipsDialog.h"
+
+#include <QComboBox>
+#include <QCheckBox>
+
+// Always put me below _all_ includes, this is needed
+// in case we run with memory leak detection enabled!
+#include "Debugger.h"
+
+ImportClipsDialog::ImportClipsDialog( QWidget * parent )
+ : QDialog(parent)
+{
+ setupUi(this);
+}
+
+ImportClipsDialog::~ ImportClipsDialog( )
+{}
+
+void ImportClipsDialog::set_tracks(QList<Track*> tracks)
+{
+ m_tracks = tracks;
+ for (int i = 0; i < m_tracks.size(); ++i) {
+ Track* t = m_tracks.at(i);
+ comboBoxTrack->addItem(QString("%1:
%2").arg(t->get_sort_index()).arg(t->get_name()));
+ }
+}
+
+Track* ImportClipsDialog::get_selected_track()
+{
+ if (m_tracks.isEmpty()) {
+ return (Track*)0;
+ }
+
+ return m_tracks.at(comboBoxTrack->currentIndex());
+}
+
+bool ImportClipsDialog::get_add_markers()
+{
+ return checkBoxMarkers->isChecked();
+}
+
+int ImportClipsDialog::has_tracks()
+{
+ return comboBoxTrack->count();
+}
+
+//eof
Index: traverso/dialogs/project/ImportClipsDialog.h
===================================================================
RCS file: traverso/dialogs/project/ImportClipsDialog.h
diff -N traverso/dialogs/project/ImportClipsDialog.h
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ traverso/dialogs/project/ImportClipsDialog.h 25 May 2008 13:59:11
-0000 1.1
@@ -0,0 +1,53 @@
+/*
+ Copyright (C) 2008 Nicola Doebelin
+
+ This file is part of Traverso
+
+ Traverso 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.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+
+*/
+
+#ifndef IMPORT_CLIPS_DIALOG_H
+#define IMPORT_CLIPS_DIALOG_H
+
+#include "ui_ImportClipsDialog.h"
+#include "Track.h"
+
+#include <QDialog>
+#include <QList>
+
+class ImportClipsDialog : public QDialog, protected Ui::ImportClipsDialog
+{
+ Q_OBJECT
+
+public:
+ ImportClipsDialog(QWidget* parent = 0);
+ ~ImportClipsDialog();
+
+ void set_tracks(QList<Track*>);
+
+ Track* get_selected_track();
+ bool get_add_markers();
+ int has_tracks();
+
+private:
+ QList<Track*> m_tracks;
+
+};
+
+#endif
+
+//eof
+
Index: traverso/ui/ImportClipsDialog.ui
===================================================================
RCS file: traverso/ui/ImportClipsDialog.ui
diff -N traverso/ui/ImportClipsDialog.ui
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ traverso/ui/ImportClipsDialog.ui 25 May 2008 13:59:11 -0000 1.1
@@ -0,0 +1,84 @@
+<ui version="4.0" >
+ <class>ImportClipsDialog</class>
+ <widget class="QDialog" name="ImportClipsDialog" >
+ <property name="geometry" >
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>344</width>
+ <height>103</height>
+ </rect>
+ </property>
+ <property name="windowTitle" >
+ <string>Import Audio Clips</string>
+ </property>
+ <layout class="QVBoxLayout" >
+ <item>
+ <layout class="QHBoxLayout" >
+ <item>
+ <widget class="QLabel" name="label" >
+ <property name="text" >
+ <string>Import to Track:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QComboBox" name="comboBoxTrack" />
+ </item>
+ </layout>
+ </item>
+ <item>
+ <widget class="QCheckBox" name="checkBoxMarkers" >
+ <property name="text" >
+ <string>Add Markers</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QDialogButtonBox" name="buttonBox" >
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="standardButtons" >
+
<set>QDialogButtonBox::Cancel|QDialogButtonBox::NoButton|QDialogButtonBox::Ok</set>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections>
+ <connection>
+ <sender>buttonBox</sender>
+ <signal>accepted()</signal>
+ <receiver>ImportClipsDialog</receiver>
+ <slot>accept()</slot>
+ <hints>
+ <hint type="sourcelabel" >
+ <x>248</x>
+ <y>254</y>
+ </hint>
+ <hint type="destinationlabel" >
+ <x>157</x>
+ <y>274</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>buttonBox</sender>
+ <signal>rejected()</signal>
+ <receiver>ImportClipsDialog</receiver>
+ <slot>reject()</slot>
+ <hints>
+ <hint type="sourcelabel" >
+ <x>316</x>
+ <y>260</y>
+ </hint>
+ <hint type="destinationlabel" >
+ <x>286</x>
+ <y>274</y>
+ </hint>
+ </hints>
+ </connection>
+ </connections>
+</ui>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Traverso-commit] traverso/src commands/Import.h traverso/CMakeLi...,
Nicola Doebelin <=