traverso-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Traverso-commit] traverso/src core/ResourcesManager.cpp core/Res...


From: Remon Sijrier
Subject: [Traverso-commit] traverso/src core/ResourcesManager.cpp core/Res...
Date: Tue, 24 Apr 2007 23:57:10 +0000

CVSROOT:        /sources/traverso
Module name:    traverso
Changes by:     Remon Sijrier <r_sijrier>       07/04/24 23:57:10

Modified files:
        src/core       : ResourcesManager.cpp ResourcesManager.h 
        src/traverso   : Interface.cpp Interface.h traverso.pro 
Added files:
        src/traverso/ui: ResourcesWidget.ui 
        src/traverso/widgets: ResourcesWidget.cpp ResourcesWidget.h 
Removed files:
        src/traverso   : AudioSourcesTreeWidget.cpp 
                         AudioSourcesTreeWidget.h 

Log message:
        * Renamed AudioSourcesWidget to ResourcesWidget
        * Using standard QTreeWidgets now to show a list of audioclip / audio 
files.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/traverso/src/core/ResourcesManager.cpp?cvsroot=traverso&r1=1.5&r2=1.6
http://cvs.savannah.gnu.org/viewcvs/traverso/src/core/ResourcesManager.h?cvsroot=traverso&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/traverso/src/traverso/Interface.cpp?cvsroot=traverso&r1=1.67&r2=1.68
http://cvs.savannah.gnu.org/viewcvs/traverso/src/traverso/Interface.h?cvsroot=traverso&r1=1.30&r2=1.31
http://cvs.savannah.gnu.org/viewcvs/traverso/src/traverso/traverso.pro?cvsroot=traverso&r1=1.45&r2=1.46
http://cvs.savannah.gnu.org/viewcvs/traverso/src/traverso/AudioSourcesTreeWidget.cpp?cvsroot=traverso&r1=1.3&r2=0
http://cvs.savannah.gnu.org/viewcvs/traverso/src/traverso/AudioSourcesTreeWidget.h?cvsroot=traverso&r1=1.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/traverso/src/traverso/ui/ResourcesWidget.ui?cvsroot=traverso&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/traverso/src/traverso/widgets/ResourcesWidget.cpp?cvsroot=traverso&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/traverso/src/traverso/widgets/ResourcesWidget.h?cvsroot=traverso&rev=1.1

Patches:
Index: core/ResourcesManager.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/core/ResourcesManager.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- core/ResourcesManager.cpp   23 Apr 2007 11:52:24 -0000      1.5
+++ core/ResourcesManager.cpp   24 Apr 2007 23:57:10 -0000      1.6
@@ -319,6 +319,11 @@
        return m_sources.values();
 }
 
+QList< AudioClip * > ResourcesManager::get_all_clips() const
+{
+       return m_clips.values();
+}
+
 QList< AudioClip * > ResourcesManager::get_clips_for_source( ReadSource * 
source ) const
 {
        QList<AudioClip*> clips;
@@ -335,5 +340,3 @@
 
 
 //eof
-
-

Index: core/ResourcesManager.h
===================================================================
RCS file: /sources/traverso/traverso/src/core/ResourcesManager.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- core/ResourcesManager.h     29 Mar 2007 11:09:38 -0000      1.2
+++ core/ResourcesManager.h     24 Apr 2007 23:57:10 -0000      1.3
@@ -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: ResourcesManager.h,v 1.2 2007/03/29 11:09:38 r_sijrier Exp $
+$Id: ResourcesManager.h,v 1.3 2007/04/24 23:57:10 r_sijrier Exp $
 */
 
 #ifndef RESOURCES_MANAGER_H
@@ -69,6 +69,7 @@
        int get_total_sources();
        
        QList<ReadSource*> get_all_audio_sources() const;
+       QList<AudioClip*> get_all_clips() const;
        QList<AudioClip*> get_clips_for_source(ReadSource* source) const;
 
 

Index: traverso/Interface.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/traverso/Interface.cpp,v
retrieving revision 1.67
retrieving revision 1.68
diff -u -b -r1.67 -r1.68
--- traverso/Interface.cpp      20 Apr 2007 06:40:55 -0000      1.67
+++ traverso/Interface.cpp      24 Apr 2007 23:57:10 -0000      1.68
@@ -33,7 +33,7 @@
 #include "TrackView.h"
 #include "ViewPort.h"
 #include "Help.h"
-#include "AudioSourcesTreeWidget.h"
+#include "widgets/ResourcesWidget.h"
 #include <FadeCurve.h>
 #include <Config.h>
 #include "widgets/InfoWidgets.h"
@@ -120,15 +120,13 @@
        addDockWidget(Qt::RightDockWidgetArea, historyDW);
        
        // AudioSources View
-/*     AudioSourcesDW = new QDockWidget(tr("AudioSources"), this);
+       AudioSourcesDW = new QDockWidget(tr("Audio Bin"), this);
        AudioSourcesDW->setObjectName("AudioSourcesDockWidget");
-       audiosourcesview = new QTreeView(AudioSourcesDW);
+       audiosourcesview = new ResourcesWidget(AudioSourcesDW);
        audiosourcesview->setFocusPolicy(Qt::NoFocus);
-       TreeModel* model = new TreeModel("hoi, test");
-       audiosourcesview->setModel(model);
        AudioSourcesDW->setWidget(audiosourcesview);
        addDockWidget(Qt::TopDockWidgetArea, AudioSourcesDW);
-       AudioSourcesDW->hide();*/
+       AudioSourcesDW->hide();
        
        // Meter Widgets
        correlationMeterDW = new QDockWidget(tr("Correlation Meter"), this);
@@ -388,7 +386,7 @@
 
        menu->addAction(historyDW->toggleViewAction());
        menu->addAction(busMonitorDW->toggleViewAction());
-//     menu->addAction(AudioSourcesDW->toggleViewAction());
+       menu->addAction(AudioSourcesDW->toggleViewAction());
        
        menu->addSeparator();
        

Index: traverso/Interface.h
===================================================================
RCS file: /sources/traverso/traverso/src/traverso/Interface.h,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -b -r1.30 -r1.31
--- traverso/Interface.h        11 Apr 2007 15:56:35 -0000      1.30
+++ traverso/Interface.h        24 Apr 2007 23:57:10 -0000      1.31
@@ -45,7 +45,7 @@
 class QDockWidget;
 class QToolBar;
 class QToolButton;
-class QTreeView;
+class ResourcesWidget;
 class ResourcesInfoWidget;
 class DriverInfoWidget;
 class HDDSpaceInfoWidget;
@@ -95,7 +95,7 @@
        QDockWidget*            historyDW;
        QDockWidget*            busMonitorDW;
        QDockWidget*            AudioSourcesDW;
-       QTreeView*              audiosourcesview;
+       ResourcesWidget*                audiosourcesview;
        QDockWidget*            correlationMeterDW;
        CorrelationMeterWidget* correlationMeter;
        QDockWidget*            spectralMeterDW;

Index: traverso/traverso.pro
===================================================================
RCS file: /sources/traverso/traverso/src/traverso/traverso.pro,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -b -r1.45 -r1.46
--- traverso/traverso.pro       23 Apr 2007 11:56:52 -0000      1.45
+++ traverso/traverso.pro       24 Apr 2007 23:57:10 -0000      1.46
@@ -24,7 +24,6 @@
        -lfftw3 \
 
 HEADERS += \
-       AudioSourcesTreeWidget.h \
        BusMonitor.h \
        BusSelector.h \
        ContextDialog.h \
@@ -54,10 +53,10 @@
        dialogs/project/NewProjectDialog.h \
        dialogs/project/OpenProjectDialog.h \
        dialogs/project/NewTrackDialog.h \
-       songcanvas/PositionIndicator.h
+       songcanvas/PositionIndicator.h \
+       widgets/ResourcesWidget.h
 SOURCES += \
        Traverso.cpp \
-       AudioSourcesTreeWidget.cpp \
        BusMonitor.cpp \
        BusSelector.cpp \
        ContextDialog.cpp \
@@ -85,7 +84,8 @@
        dialogs/project/NewProjectDialog.cpp \
        dialogs/project/OpenProjectDialog.cpp \
        dialogs/project/NewTrackDialog.cpp \
-       songcanvas/PositionIndicator.cpp
+       songcanvas/PositionIndicator.cpp \
+       widgets/ResourcesWidget.cpp
 FORMS += ui/ExportWidget.ui \
        ui/AudioSourcesManagerWidget.ui \
        ui/PluginSelectorDialog.ui \
@@ -107,7 +107,8 @@
        ui/OpenProjectDialog.ui \
        ui/NewProjectDialog.ui \
        ui/NewSongDialog.ui \
-       ui/NewTrackDialog.ui
+       ui/NewTrackDialog.ui \
+       ui/ResourcesWidget.ui
 
 
 INCLUDEPATH +=         ../core \

Index: traverso/ui/ResourcesWidget.ui
===================================================================
RCS file: traverso/ui/ResourcesWidget.ui
diff -N traverso/ui/ResourcesWidget.ui
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ traverso/ui/ResourcesWidget.ui      24 Apr 2007 23:57:10 -0000      1.1
@@ -0,0 +1,99 @@
+<ui version="4.0" >
+ <class>ResourcesWidget</class>
+ <widget class="QWidget" name="ResourcesWidget" >
+  <property name="geometry" >
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>151</width>
+    <height>258</height>
+   </rect>
+  </property>
+  <property name="windowTitle" >
+   <string>Form</string>
+  </property>
+  <layout class="QVBoxLayout" >
+   <property name="margin" >
+    <number>0</number>
+   </property>
+   <property name="spacing" >
+    <number>6</number>
+   </property>
+   <item>
+    <layout class="QHBoxLayout" >
+     <property name="margin" >
+      <number>0</number>
+     </property>
+     <property name="spacing" >
+      <number>6</number>
+     </property>
+     <item>
+      <widget class="QComboBox" name="comboBox_2" >
+       <item>
+        <property name="text" >
+         <string>Audio</string>
+        </property>
+       </item>
+       <item>
+        <property name="text" >
+         <string>Clips</string>
+        </property>
+       </item>
+       <item>
+        <property name="text" >
+         <string>Both</string>
+        </property>
+       </item>
+      </widget>
+     </item>
+     <item>
+      <widget class="QComboBox" name="comboBox" />
+     </item>
+     <item>
+      <spacer>
+       <property name="orientation" >
+        <enum>Qt::Horizontal</enum>
+       </property>
+       <property name="sizeHint" >
+        <size>
+         <width>2</width>
+         <height>20</height>
+        </size>
+       </property>
+      </spacer>
+     </item>
+    </layout>
+   </item>
+   <item>
+    <layout class="QVBoxLayout" >
+     <property name="margin" >
+      <number>0</number>
+     </property>
+     <property name="spacing" >
+      <number>6</number>
+     </property>
+     <item>
+      <widget class="QTreeWidget" name="audioFileTreeWidget" >
+       <column>
+        <property name="text" >
+         <string>AudioFiles</string>
+        </property>
+       </column>
+      </widget>
+     </item>
+     <item>
+      <widget class="QTreeWidget" name="clipTreeWidget" >
+       <column>
+        <property name="text" >
+         <string>Clips</string>
+        </property>
+       </column>
+      </widget>
+     </item>
+    </layout>
+   </item>
+  </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>

Index: traverso/widgets/ResourcesWidget.cpp
===================================================================
RCS file: traverso/widgets/ResourcesWidget.cpp
diff -N traverso/widgets/ResourcesWidget.cpp
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ traverso/widgets/ResourcesWidget.cpp        24 Apr 2007 23:57:10 -0000      
1.1
@@ -0,0 +1,86 @@
+/*
+Copyright (C) 2007 Remon Sijrier 
+
+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 "ResourcesWidget.h"
+
+#include <ProjectManager.h>
+#include <Project.h>
+#include <ResourcesManager.h>
+#include <AudioSource.h>
+#include <ReadSource.h>
+#include <AudioClip.h>
+#include <Utils.h>
+
+
+ResourcesWidget::ResourcesWidget(QWidget * parent)
+       : QWidget(parent)
+{
+       setupUi(this);
+/*     audioFileTreeWidget->hide();
+       clipTreeWidget->show();*/
+       
+       set_project(pm().get_project());
+       connect(&pm(), SIGNAL(projectLoaded(Project*)), this, 
SLOT(set_project(Project*)));
+}
+
+ResourcesWidget::~ ResourcesWidget()
+{
+}
+
+void ResourcesWidget::set_project(Project * project)
+{
+/*     audioFileTreeWidget->clear();
+       clipTreeWidget->clear();*/
+       
+       m_project = project;
+       
+       if (!m_project) {
+               return;
+       }
+       
+       connect(m_project->get_audiosource_manager(), SIGNAL(sourceAdded()), 
this, SLOT(update_tree_widgets()));
+       update_tree_widgets();
+}
+
+void ResourcesWidget::update_tree_widgets()
+{
+       ResourcesManager* manager = resources_manager();
+       if (! manager) {
+               return;
+       }
+       
+       foreach(ReadSource* rs, manager->get_all_audio_sources()) {
+               QTreeWidgetItem* item = new 
QTreeWidgetItem(audioFileTreeWidget);
+               item->setText(0, rs->get_name());
+               item->setData(0, Qt::UserRole, rs->get_id());
+       }
+       
+       
+       foreach(AudioClip* clip, resources_manager()->get_all_clips()) {
+               QTreeWidgetItem* item = new QTreeWidgetItem(clipTreeWidget);
+               item->setText(0, clip->get_name());
+               item->setData(0, Qt::UserRole, clip->get_id());
+       }
+
+       clipTreeWidget->sortItems(0, Qt::AscendingOrder);
+       audioFileTreeWidget->sortItems(0, Qt::AscendingOrder);
+}
+

Index: traverso/widgets/ResourcesWidget.h
===================================================================
RCS file: traverso/widgets/ResourcesWidget.h
diff -N traverso/widgets/ResourcesWidget.h
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ traverso/widgets/ResourcesWidget.h  24 Apr 2007 23:57:10 -0000      1.1
@@ -0,0 +1,49 @@
+/*
+Copyright (C) 2007 Remon Sijrier 
+
+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 RESOURCESWIDGET_H
+#define RESOURCESWIDGET_H
+
+#include <QWidget>
+#include "ui_ResourcesWidget.h"
+
+class Project;
+
+class ResourcesWidget : public QWidget, protected Ui::ResourcesWidget
+{
+       Q_OBJECT
+
+public:
+       ResourcesWidget(QWidget* parent=0);
+       ~ResourcesWidget();
+
+       
+       
+private:
+       Project* m_project;
+       
+
+private slots:
+       void set_project(Project* project);
+       void update_tree_widgets();
+};
+
+#endif

Index: traverso/AudioSourcesTreeWidget.cpp
===================================================================
RCS file: traverso/AudioSourcesTreeWidget.cpp
diff -N traverso/AudioSourcesTreeWidget.cpp
--- traverso/AudioSourcesTreeWidget.cpp 16 Mar 2007 00:10:26 -0000      1.3
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,288 +0,0 @@
-/*
-Copyright (C) 2006 Remon Sijrier 
-
-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.
-
-$Id: AudioSourcesTreeWidget.cpp,v 1.3 2007/03/16 00:10:26 r_sijrier Exp $
-*/ 
-
-
-#include "AudioSourcesTreeWidget.h"
-
-#include <ProjectManager.h>
-#include <Project.h>
-#include <ResourcesManager.h>
-#include <AudioSource.h>
-#include <ReadSource.h>
-#include <AudioClip.h>
-#include <Utils.h>
-
-// Always put me below _all_ includes, this is needed
-// in case we run with memory leak detection enabled!
-#include "Debugger.h"
-
-
-TreeItem::TreeItem(const QList<QVariant> &data, TreeItem *parent)
-{
-       parentItem = parent;
-       itemData = data;
-}
-
-TreeItem::~TreeItem()
-{
-       qDeleteAll(childItems);
-}
-
-void TreeItem::appendChild(TreeItem *item)
-{
-       childItems.append(item);
-}
-
-TreeItem *TreeItem::child(int row)
-{
-       return childItems.value(row);
-}
-
-int TreeItem::childCount() const
-{
-       return childItems.count();
-}
-
-int TreeItem::columnCount() const
-{
-       return itemData.count();
-}
-
-QVariant TreeItem::data(int column) const
-{
-       return itemData.value(column);
-}
-
-TreeItem *TreeItem::parent()
-{
-       return parentItem;
-}
-
-int TreeItem::row() const
-{
-       if (parentItem)
-               return 
parentItem->childItems.indexOf(const_cast<TreeItem*>(this));
-
-       return 0;
-}
-
-
-
-
-
-
-
-
-TreeModel::TreeModel(const QString &data, QObject *parent)
-       : QAbstractItemModel(parent)
-{
-       QList<QVariant> rootData;
-       rootData << "Name";
-       rootItem = new TreeItem(rootData);
-       m_project = 0;
-       connect(&pm(), SIGNAL(projectLoaded( Project* )), this, 
SLOT(set_project(Project*)));
-}
-
-TreeModel::~TreeModel()
-{
-       delete rootItem;
-}
-
-int TreeModel::columnCount(const QModelIndex &parent) const
-{
-       if (parent.isValid())
-               return 
static_cast<TreeItem*>(parent.internalPointer())->columnCount();
-       else
-               return rootItem->columnCount();
-}
-
-QVariant TreeModel::data(const QModelIndex &index, int role) const
-{
-       if (!index.isValid())
-               return QVariant();
-
-       if (role != Qt::DisplayRole)
-               return QVariant();
-
-       TreeItem *item = static_cast<TreeItem*>(index.internalPointer());
-
-       return item->data(index.column());
-}
-
-Qt::ItemFlags TreeModel::flags(const QModelIndex &index) const
-{
-       if (!index.isValid())
-               return Qt::ItemIsEnabled;
-
-       return Qt::ItemIsEnabled | Qt::ItemIsSelectable;
-}
-
-QVariant TreeModel::headerData(int section, Qt::Orientation orientation,
-                              int role) const
-{
-       if (orientation == Qt::Horizontal && role == Qt::DisplayRole)
-               return rootItem->data(section);
-
-       return QVariant();
-}
-
-QModelIndex TreeModel::index(int row, int column, const QModelIndex &parent)
-               const
-{
-       TreeItem *parentItem;
-
-       if (!parent.isValid())
-               parentItem = rootItem;
-       else
-               parentItem = static_cast<TreeItem*>(parent.internalPointer());
-
-       TreeItem *childItem = parentItem->child(row);
-       if (childItem)
-               return createIndex(row, column, childItem);
-       else
-               return QModelIndex();
-}
-
-QModelIndex TreeModel::parent(const QModelIndex &index) const
-{
-       if (!index.isValid())
-               return QModelIndex();
-
-       TreeItem *childItem = static_cast<TreeItem*>(index.internalPointer());
-       TreeItem *parentItem = childItem->parent();
-
-       if (parentItem == rootItem)
-               return QModelIndex();
-
-       return createIndex(parentItem->row(), 0, parentItem);
-}
-
-int TreeModel::rowCount(const QModelIndex &parent) const
-{
-       TreeItem *parentItem;
-
-       if (!parent.isValid())
-               parentItem = rootItem;
-       else
-               parentItem = static_cast<TreeItem*>(parent.internalPointer());
-
-       return parentItem->childCount();
-}
-
-void TreeModel::setupModelData()
-{
-       QList<int> indentations;
-       parents << rootItem;
-       indentations << 0;
-
-       int number = 0;
-       QStringList lines;
-       lines << "hoi" << "test";
-       
-       ResourcesManager* asmanager;
-       if (m_project) {
-               asmanager = m_project->get_audiosource_manager();
-       } else {
-               printf("No project set!\n");
-               return;
-       }
-       
-       QList<ReadSource*> sources = asmanager->get_all_audio_sources();
-       
-       foreach(ReadSource* source, sources) {
-               QList<QVariant> columnData;
-               columnData << source->get_name();
-               parents.last()->appendChild(new TreeItem(columnData, 
parents.last()));
-               
-               QList<AudioClip*> clips = 
asmanager->get_clips_for_source(source);
-               parents << 
parents.last()->child(parents.last()->childCount()-1);
-               
-               foreach(AudioClip* clip, clips) {
-                       columnData << clip->get_name();
-                       parents.last()->appendChild(new TreeItem(columnData, 
parents.last()));
-               }
-               
-               parents.pop_back();
-       }
-       
-       return;
-
-       while (number < lines.count()) {
-               int position = 0;
-               while (position < lines[number].length()) {
-                       if (lines[number].mid(position, 1) != " ")
-                               break;
-                       position++;
-               }
-
-               QString lineData = lines[number].mid(position).trimmed();
-
-               if (!lineData.isEmpty()) {
-            // Read the column data from the rest of the line.
-                       QStringList columnStrings = lineData.split("\t", 
QString::SkipEmptyParts);
-                       QList<QVariant> columnData;
-                       for (int column = 0; column < columnStrings.count(); 
++column)
-                               columnData << columnStrings[column];
-
-                       if (position > indentations.last()) {
-                // The last child of the current parent is now the new parent
-                // unless the current parent has no children.
-
-                               if (parents.last()->childCount() > 0) {
-                                       parents << 
parents.last()->child(parents.last()->childCount()-1);
-                                       indentations << position;
-                               }
-                       } else {
-                               while (position < indentations.last() && 
parents.count() > 0) {
-                                       parents.pop_back();
-                                       indentations.pop_back();
-                               }
-                       }
-
-            // Append a new item to the current parent's list of children.
-                       parents.last()->appendChild(new TreeItem(columnData, 
parents.last()));
-               }
-
-               number++;
-       }
-}
-
-void TreeModel::set_project( Project * project )
-{
-       reset();
-       
-       for (int i=0; i< rowCount(); ++i) {
-               if ( ! QAbstractItemModel::removeRow(i, QModelIndex())) {
-//                     printf("Failed to remove row %d\n", i);
-               }
-       }
-       
-       parents.clear();
-               
-       m_project = project;
-       
-       if (m_project) {
-               connect(m_project->get_audiosource_manager(), 
SIGNAL(sourceAdded()), this, SLOT(setupModelData()));
-       }
-       
-       setupModelData(); 
-}

Index: traverso/AudioSourcesTreeWidget.h
===================================================================
RCS file: traverso/AudioSourcesTreeWidget.h
diff -N traverso/AudioSourcesTreeWidget.h
--- traverso/AudioSourcesTreeWidget.h   18 Oct 2006 12:09:47 -0000      1.1
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,83 +0,0 @@
-/*
-Copyright (C) 2006 Remon Sijrier 
-
-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.
-
-$Id: AudioSourcesTreeWidget.h,v 1.1 2006/10/18 12:09:47 r_sijrier Exp $
-*/
- 
-#ifndef AUDIO_SOURCES_TREE_WIDGET_H
-#define AUDIO_SOURCES_TREE_WIDGET_H
-
-#include <QTreeWidget>
-
-#include <QList>
-#include <QVariant>
-
-class Project;
-
-class TreeItem
-{
-public:
-       TreeItem(const QList<QVariant> &data, TreeItem *parent = 0);
-       ~TreeItem();
-
-       void appendChild(TreeItem *child);
-
-       TreeItem *child(int row);
-       int childCount() const;
-       int columnCount() const;
-       QVariant data(int column) const;
-       int row() const;
-       TreeItem *parent();
-
-private:
-       QList<TreeItem*> childItems;
-       QList<QVariant> itemData;
-       TreeItem *parentItem;
-};
-
-
-class TreeModel : public QAbstractItemModel
-{
-       Q_OBJECT
-
-public:
-       TreeModel(const QString &data, QObject *parent = 0);
-       ~TreeModel();
-
-       QVariant data(const QModelIndex &index, int role) const;
-       Qt::ItemFlags flags(const QModelIndex &index) const;
-       QVariant headerData(int section, Qt::Orientation orientation,
-                               int role = Qt::DisplayRole) const;
-       QModelIndex index(int row, int column,
-                               const QModelIndex &parent = QModelIndex()) 
const;
-       QModelIndex parent(const QModelIndex &index) const;
-       int rowCount(const QModelIndex &parent = QModelIndex()) const;
-       int columnCount(const QModelIndex &parent = QModelIndex()) const;
-
-private:
-       QList<TreeItem*> parents;
-       TreeItem*       rootItem;
-       Project*        m_project;
-       
-private slots:
-       void setupModelData();
-       void set_project(Project* project);
-};
-
-#endif




reply via email to

[Prev in Thread] Current Thread [Next in Thread]