traverso-commit
[Top][All Lists]
Advanced

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

[Traverso-commit] traverso/src core/Project.cpp core/Project.h co...


From: Remon Sijrier
Subject: [Traverso-commit] traverso/src core/Project.cpp core/Project.h co...
Date: Wed, 04 Apr 2007 00:05:51 +0000

CVSROOT:        /sources/traverso
Module name:    traverso
Changes by:     Remon Sijrier <r_sijrier>       07/04/04 00:05:51

Modified files:
        src/core       : Project.cpp Project.h ProjectManager.cpp 
                         ProjectManager.h Song.cpp 
        src/traverso/dialogs/project: ProjectManagerDialog.cpp 
        src/traverso   : Interface.cpp Interface.h traverso.pro 
Removed files:
        src/traverso/dialogs/project: OpenCreateProjectDialog.cpp 
                                      OpenCreateProjectDialog.h 

Log message:
        * Further improved menubar layout, well, that's the idea
        * new project using template almost works
        * separation of open/create project dialog

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/traverso/src/core/Project.cpp?cvsroot=traverso&r1=1.25&r2=1.26
http://cvs.savannah.gnu.org/viewcvs/traverso/src/core/Project.h?cvsroot=traverso&r1=1.15&r2=1.16
http://cvs.savannah.gnu.org/viewcvs/traverso/src/core/ProjectManager.cpp?cvsroot=traverso&r1=1.26&r2=1.27
http://cvs.savannah.gnu.org/viewcvs/traverso/src/core/ProjectManager.h?cvsroot=traverso&r1=1.11&r2=1.12
http://cvs.savannah.gnu.org/viewcvs/traverso/src/core/Song.cpp?cvsroot=traverso&r1=1.72&r2=1.73
http://cvs.savannah.gnu.org/viewcvs/traverso/src/traverso/dialogs/project/ProjectManagerDialog.cpp?cvsroot=traverso&r1=1.8&r2=1.9
http://cvs.savannah.gnu.org/viewcvs/traverso/src/traverso/dialogs/project/OpenCreateProjectDialog.cpp?cvsroot=traverso&r1=1.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/traverso/src/traverso/dialogs/project/OpenCreateProjectDialog.h?cvsroot=traverso&r1=1.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/traverso/src/traverso/Interface.cpp?cvsroot=traverso&r1=1.54&r2=1.55
http://cvs.savannah.gnu.org/viewcvs/traverso/src/traverso/Interface.h?cvsroot=traverso&r1=1.27&r2=1.28
http://cvs.savannah.gnu.org/viewcvs/traverso/src/traverso/traverso.pro?cvsroot=traverso&r1=1.38&r2=1.39

Patches:
Index: core/Project.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/core/Project.cpp,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -b -r1.25 -r1.26
--- core/Project.cpp    3 Apr 2007 19:56:30 -0000       1.25
+++ core/Project.cpp    4 Apr 2007 00:05:51 -0000       1.26
@@ -107,7 +107,9 @@
                private_add_song(song);
        }
 
+       if (m_songs.size()) {
        set_current_song(m_songs.first()->get_id());
+       }
        
        m_id = create_id();
        m_importDir = config().get_property("Project", "DefaultDirectory", 
QDir::homePath()).toString();
@@ -117,11 +119,17 @@
 }
 
 
-int Project::load() // try to load the project by its title
+int Project::load(QString projectfile)
 {
        PENTER;
        QDomDocument doc("Project");
-       QFile file(rootDir + "/project.traverso");
+       
+       QFile file;
+       if (projectfile.isEmpty()) {
+               file.setFileName(rootDir + "/project.traverso");
+       } else {
+               file.setFileName(projectfile);
+       }
 
        if (!file.open(QIODevice::ReadOnly))
        {
@@ -222,7 +230,10 @@
        properties.setAttribute("projectfileversion", PROJECT_FILE_VERSION);
        if (! istemplate) {
                properties.setAttribute("id", m_id);
+       } else {
+               properties.setAttribute("title", "Template Project File!!");
        }
+       
        properties.setAttribute("importdir", m_importDir);
                
        projectNode.appendChild(properties);

Index: core/Project.h
===================================================================
RCS file: /sources/traverso/traverso/src/core/Project.h,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -b -r1.15 -r1.16
--- core/Project.h      3 Apr 2007 19:56:30 -0000       1.15
+++ core/Project.h      4 Apr 2007 00:05:51 -0000       1.16
@@ -75,7 +75,7 @@
        bool has_changed();
        
        int save();
-       int load();
+       int load(QString projectfile = "");
        int export_project(ExportSpecification* spec);
        int start_export(ExportSpecification* spec);
 

Index: core/ProjectManager.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/core/ProjectManager.cpp,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -b -r1.26 -r1.27
--- core/ProjectManager.cpp     2 Apr 2007 09:52:31 -0000       1.26
+++ core/ProjectManager.cpp     4 Apr 2007 00:05:51 -0000       1.27
@@ -115,7 +115,7 @@
                return 0;
        }
 
-       Project *newProject = new Project(projectName);
+       Project* newProject = new Project(projectName);
 
        if (newProject->create(numSongs, numTracks) < 0) {
                delete newProject;
@@ -126,6 +126,32 @@
        return newProject;
 }
 
+Project* ProjectManager::create_new_project(const QString& templatefile, const 
QString& projectName)
+{
+       if (project_exists(projectName)) {
+               info().critical(tr("Project %1 already 
exists!").arg(projectName));
+               return 0;
+       }
+
+       
+       Project* newProject = new Project(projectName);
+       
+       if (newProject->create(0, 0) < 0) {
+               delete newProject;
+               info().critical(tr("Unable to create new Project 
%1").arg(projectName));
+               return 0;
+       }
+       
+       if (newProject->load(templatefile) < 0) {
+               return 0;
+       }
+       
+       // title gets overwritten in newProject->load()
+       newProject->set_title(projectName);
+       
+       return newProject;
+}
+
 int ProjectManager::load_project(const QString& projectName)
 {
        PENTER;
@@ -317,4 +343,3 @@
 
 
 //eof
-

Index: core/ProjectManager.h
===================================================================
RCS file: /sources/traverso/traverso/src/core/ProjectManager.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -b -r1.11 -r1.12
--- core/ProjectManager.h       21 Mar 2007 19:21:46 -0000      1.11
+++ core/ProjectManager.h       4 Apr 2007 00:05:51 -0000       1.12
@@ -36,6 +36,7 @@
        Q_OBJECT
 public:
        Project* create_new_project(int numSong, int numTracks, const QString& 
projectName);
+       Project* create_new_project(const QString& templatefile, const QString& 
projectName);
        
        int load_project(const QString& projectName);
 

Index: core/Song.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/core/Song.cpp,v
retrieving revision 1.72
retrieving revision 1.73
diff -u -b -r1.72 -r1.73
--- core/Song.cpp       3 Apr 2007 14:18:54 -0000       1.72
+++ core/Song.cpp       4 Apr 2007 00:05:51 -0000       1.73
@@ -218,7 +218,7 @@
        QDomNode tracksNode = doc.createElement("Tracks");
 
        foreach(Track* track, m_tracks) {
-               tracksNode.appendChild(track->get_state(doc));
+               tracksNode.appendChild(track->get_state(doc, istemplate));
        }
 
        songNode.appendChild(tracksNode);

Index: traverso/dialogs/project/ProjectManagerDialog.cpp
===================================================================
RCS file: 
/sources/traverso/traverso/src/traverso/dialogs/project/ProjectManagerDialog.cpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- traverso/dialogs/project/ProjectManagerDialog.cpp   3 Apr 2007 19:56:30 
-0000       1.8
+++ traverso/dialogs/project/ProjectManagerDialog.cpp   4 Apr 2007 00:05:51 
-0000       1.9
@@ -225,7 +225,7 @@
        QDir dir;
        if (! dir.exists(fileName)) {
                if (! dir.mkdir(fileName)) {
-                       info().critical( tr("Couldn't open file %1 for 
writing!").arg(fileName));
+                       info().critical( tr("Unable to create directory 
%1!").arg(fileName));
                        return;
                }
        }

Index: traverso/Interface.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/traverso/Interface.cpp,v
retrieving revision 1.54
retrieving revision 1.55
diff -u -b -r1.54 -r1.55
--- traverso/Interface.cpp      3 Apr 2007 21:25:25 -0000       1.54
+++ traverso/Interface.cpp      4 Apr 2007 00:05:51 -0000       1.55
@@ -47,7 +47,8 @@
 
 #include "dialogs/settings/SettingsDialog.h"
 #include "dialogs/project/ProjectManagerDialog.h"
-#include "dialogs/project/OpenCreateProjectDialog.h"
+#include "dialogs/project/OpenProjectDialog.h"
+#include "dialogs/project/NewProjectDialog.h"
 #include <dialogs/project/NewSongDialog.h>
 #include "dialogs/CDTextDialog.h"
 #include "dialogs/MarkerDialog.h"
@@ -169,7 +170,8 @@
        exportWidget = 0;
        m_settingsdialog = 0;
        m_projectManagerDialog = 0;
-       m_openCreateProjectDialog = 0;
+       m_openProjectDialog = 0;
+       m_newProjectDialog = 0;
        m_cdTextDialog = 0;
        m_markerDialog = 0;
        m_busSelector = 0;
@@ -334,22 +336,20 @@
        QMenu* menu;
        QAction* action;
         
-       menu = menuBar()->addMenu(tr("&File"));
+       menu = menuBar()->addMenu(tr("&Project"));
+       
+       action = menu->addAction(tr("&New..."));
+       
action->setIcon(style()->standardIcon(QStyle::SP_FileDialogContentsView));
+       action->setShortcuts(QKeySequence::New);
+       connect(action, SIGNAL(triggered(bool)), this, 
SLOT(show_newproject_dialog()));
        
-       action = menu->addAction(tr("&Open / Create..."));
+       action = menu->addAction(tr("&Open..."));
        
action->setIcon(style()->standardIcon(QStyle::SP_FileDialogContentsView));
        action->setShortcuts(QKeySequence::Open);
-       connect(action, SIGNAL(triggered(bool)), this, 
SLOT(show_open_create_project_dialog()));
+       connect(action, SIGNAL(triggered(bool)), this, 
SLOT(show_open_project_dialog()));
        
        menu->addSeparator();
        
-       action = menu->addAction(tr("&Quit"));
-       action->setIcon(QIcon(find_pixmap(":/exit-16")));
-       connect(action, SIGNAL(triggered( bool )), &pm(), SLOT(exit()));
-       
-       
-       menu = menuBar()->addMenu(tr("&Project"));
-       
        action = menu->addAction(tr("&Save"));
        action->setShortcuts(QKeySequence::Save);
        m_projectSaveAction = action;
@@ -362,7 +362,6 @@
        action->setShortcuts(list);
        action->setIcon(QIcon(find_pixmap(":/songmanager-16")));
        m_projectSongManagerAction = action;
-       
        connect(action, SIGNAL(triggered(bool)), this, 
SLOT(show_project_manager_dialog()));
        
        action = menu->addAction(tr("&Export..."));
@@ -370,6 +369,20 @@
        m_projectExportAction = action;
        connect(action, SIGNAL(triggered(bool)), this, 
SLOT(show_export_widget()));
        
+       menu->addSeparator();
+       
+       action = menu->addAction(tr("&Quit"));
+       action->setIcon(QIcon(find_pixmap(":/exit-16")));
+       connect(action, SIGNAL(triggered( bool )), &pm(), SLOT(exit()));
+       
+       
+       menu = menuBar()->addMenu(tr("&Song"));
+       
+       action = menu->addAction(tr("New &Track(s)"));
+       connect(action, SIGNAL(triggered()), this, SLOT(add_new_track()));
+       action = menu->addAction(tr("New &Song(s)"));
+       connect(action, SIGNAL(triggered()), this, SLOT(add_new_song()));
+
        
        menu = menuBar()->addMenu(tr("&Views"));
        
@@ -732,14 +745,25 @@
        return 0;
 }
 
-Command* Interface::show_open_create_project_dialog()
+Command* Interface::show_open_project_dialog()
 {
-       if (! m_openCreateProjectDialog ) {
-               m_openCreateProjectDialog = new OpenCreateProjectDialog(this);
+       if (! m_openProjectDialog ) {
+               m_openProjectDialog = new OpenProjectDialog(this);
        }
-       m_openCreateProjectDialog->show();
+       m_openProjectDialog->show();
+       return 0;
+}
+
+Command * Interface::show_newproject_dialog()
+{
+       if (! m_newProjectDialog ) {
+               m_newProjectDialog = new NewProjectDialog(this);
+       }
+       m_newProjectDialog->show();
+       return 0;
 }
 
+
 Command * Interface::show_cdtext_dialog()
 {
        if (! m_cdTextDialog ) {
@@ -787,5 +811,13 @@
        return 0;
 }
 
-// eof
+void Interface::add_new_song()
+{
+       Interface::instance()->show_newsong_dialog();
+}
 
+void Interface::add_new_track()
+{
+}
+
+// eof

Index: traverso/Interface.h
===================================================================
RCS file: /sources/traverso/traverso/src/traverso/Interface.h,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -b -r1.27 -r1.28
--- traverso/Interface.h        3 Apr 2007 21:25:25 -0000       1.27
+++ traverso/Interface.h        4 Apr 2007 00:05:51 -0000       1.28
@@ -54,7 +54,7 @@
 class SpectralMeterWidget;
 class SettingsDialog;
 class ProjectManagerDialog;
-class OpenCreateProjectDialog;
+class OpenProjectDialog;
 class InfoToolBar;
 class SysInfoToolBar;
 class CDTextDialog;
@@ -62,6 +62,7 @@
 class BusSelectorDialog;
 class NewSongDialog;
 class NewTrackDialog;
+class NewProjectDialog;
 
 class Interface : public QMainWindow
 {
@@ -101,7 +102,7 @@
        SpectralMeterWidget*    spectralMeter;
        SettingsDialog*         m_settingsdialog;
        ProjectManagerDialog*   m_projectManagerDialog;
-       OpenCreateProjectDialog*        m_openCreateProjectDialog;
+       OpenProjectDialog*      m_openProjectDialog;
        CDTextDialog*           m_cdTextDialog;
        MarkerDialog*           m_markerDialog;
        InfoToolBar*            m_infoBar;
@@ -109,6 +110,7 @@
        BusSelectorDialog*      m_busSelector;
        NewSongDialog*          m_newSongDialog;
        NewTrackDialog*         m_newTrackDialog;
+       NewProjectDialog*       m_newProjectDialog;
 
 
        BusMonitor*             busMonitor;
@@ -145,16 +147,19 @@
        Command* about_traverso();
        Command* show_export_widget();
        Command* show_context_menu();
-       Command* show_open_create_project_dialog();
+       Command* show_open_project_dialog();
        Command* show_project_manager_dialog();
        Command* show_cdtext_dialog();
        Command* show_marker_dialog();
        Command* show_newsong_dialog();
+       Command* show_newproject_dialog();
        
 private slots:
        void delete_songwidget(Song*);
        void undo();
        void redo();
+       void add_new_song();
+       void add_new_track();
 };
 
 

Index: traverso/traverso.pro
===================================================================
RCS file: /sources/traverso/traverso/src/traverso/traverso.pro,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -b -r1.38 -r1.39
--- traverso/traverso.pro       3 Apr 2007 19:05:39 -0000       1.38
+++ traverso/traverso.pro       4 Apr 2007 00:05:51 -0000       1.39
@@ -53,7 +53,8 @@
        dialogs/MarkerDialog.h \
        dialogs/BusSelectorDialog.h \
        dialogs/project/NewSongDialog.h \
-       dialogs/project/OpenCreateProjectDialog.h
+       dialogs/project/NewProjectDialog.h \
+       dialogs/project/OpenProjectDialog.h
 SOURCES += \
        Traverso.cpp \
        AudioSourcesTreeWidget.cpp \
@@ -82,7 +83,8 @@
        dialogs/MarkerDialog.cpp \
        dialogs/BusSelectorDialog.cpp \
        dialogs/project/NewSongDialog.cpp \
-       dialogs/project/OpenCreateProjectDialog.cpp
+       dialogs/project/NewProjectDialog.cpp \
+       dialogs/project/OpenProjectDialog.cpp
 FORMS += ui/ExportWidget.ui \
        ui/AudioSourcesManagerWidget.ui \
        ui/PluginSelectorDialog.ui \
@@ -100,7 +102,8 @@
        ui/MarkerDialog.ui \
        ui/CDTextDialog.ui \
        ui/BusSelectorDialog.ui \
-       ui/OpenCreateProjectDialog.ui \
+       ui/OpenProjectDialog.ui \
+       ui/NewProjectDialog.ui \
 
 
 INCLUDEPATH +=         ../core \

Index: traverso/dialogs/project/OpenCreateProjectDialog.cpp
===================================================================
RCS file: traverso/dialogs/project/OpenCreateProjectDialog.cpp
diff -N traverso/dialogs/project/OpenCreateProjectDialog.cpp
--- traverso/dialogs/project/OpenCreateProjectDialog.cpp        3 Apr 2007 
19:05:38 -0000       1.1
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,288 +0,0 @@
-/*
-    Copyright (C) 2005-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.
- 
-*/
-
-#include "OpenCreateProjectDialog.h"
-#include "ui_OpenCreateProjectDialog.h"
-
-#include <QDir>
-#include <QStringList>
-#include <QMessageBox>
-#include <QTextStream>
-#include <QDomDocument>
-#include <QFileDialog>
-#include <QHeaderView>
-
-#include <Config.h>
-#include <Information.h>
-#include <ProjectManager.h>
-#include <Project.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"
-
-OpenCreateProjectDialog::OpenCreateProjectDialog( QWidget * parent )
-       : QDialog(parent)
-{
-       setupUi(this);
-       projectListView->setColumnCount(2);
-       update_projects_list();
-       QStringList stringList;
-       stringList << "Project Name" << "Songs";
-       projectListView->setHeaderLabels(stringList);
-       
-       projectListView->header()->resizeSection(0, 160);
-       projectListView->header()->resizeSection(1, 30);
-       
-       trackCountSpinBox->setValue(config().get_property("Song", 
"trackCreationCount", 4).toInt());
-
-
-       connect(projectListView, SIGNAL(itemClicked(QTreeWidgetItem*,int)), 
this, SLOT(projectitem_clicked(QTreeWidgetItem*,int)));
-}
-
-OpenCreateProjectDialog::~ OpenCreateProjectDialog( )
-{}
-
-void OpenCreateProjectDialog::update_projects_list()
-{
-       projectListView->clear();
-       
-       QString path = config().get_property("Project", "directory", 
getenv("HOME")).toString();
-
-       QDir dir(path);
-
-       QStringList list = dir.entryList(QDir::Dirs | QDir::NoDotAndDotDot);
-       
-       foreach(QString dirname, list) {
-       
-               /************ FROM HERE ****************/
-               QDomDocument doc("Project");
-               QString fileToOpen = path + "/" + dirname + "/project.traverso";
-               
-               QFile file(fileToOpen);
-
-               if (!file.open(QIODevice::ReadOnly)) {
-                       PWARN("OpenCreateProjectDialog:: Cannot open project 
properties file (%s)", fileToOpen.toAscii().data());
-                       continue;
-               }
-
-               QString errorMsg;
-               if (!doc.setContent(&file, &errorMsg)) {
-                       file.close();
-                       PWARN("OpenCreateProjectDialog:: Cannot set content of 
XML file (%s)", errorMsg.toAscii().data());
-                       continue;
-               }
-
-               file.close();
-
-               QDomElement docElem = doc.documentElement();
-               QDomNode propertiesNode = 
docElem.firstChildElement("Properties");
-               QDomElement e = propertiesNode.toElement();
-               QString title = e.attribute( "title", "" );
-               QString description = e.attribute("description", "No 
description set");
-               qint64 id = e.attribute( "id", "" ).toLongLong();
-               
-
-               QDomNode songsNode = docElem.firstChildElement("Songs");
-               QDomNode songNode = songsNode.firstChild();
-               int songCounter = 0;
-               
-               // count to get Songs number....
-               while(!songNode.isNull()) {
-                       songCounter++;
-                       songNode = songNode.nextSibling();
-               }
-
-               QString sNumSongs = QString::number(songCounter);
-
-               /*********** TO HERE THIS CODE IS DUPLICATE FROM THAT IN 
PROJECT.CC :-( 
-               Don't know if this is avoidable at all *********/
-
-
-               QTreeWidgetItem* item = new QTreeWidgetItem(projectListView);
-               item->setTextAlignment(0, Qt::AlignLeft);
-               item->setTextAlignment(1, Qt::AlignHCenter);
-               item->setText(0, title);
-               item->setText(1, sNumSongs);
-               QString html = "<html><head></head><body>Project: " + title + 
"<br /><br />";
-               html += tr("Description:") + "<br />";
-               html += description + "<br /><br />";
-               html += tr("Created on:") + " " + 
extract_date_time(id).toString() + "<br />";
-               html += "</body></html>";
-               item->setToolTip(0, html);
-       }
-}
-
-void OpenCreateProjectDialog::projectitem_clicked( QTreeWidgetItem* item, int)
-{
-       if (item) {
-               selectedProjectName->setText(item->text(0));
-       }
-}
-
-void OpenCreateProjectDialog::on_loadProjectButton_clicked( )
-{
-        // do we have the name of the project to load ?
-       QString title;
-       if (projectListView->currentItem()) {
-               title = projectListView->currentItem()->text(0);
-       }
-
-       if (title.isEmpty()) {
-               info().warning(tr("No Project selected!") );
-               info().information(tr("Select a project and click the 'Load' 
button again") );
-               return;
-       }
-       
-       Project* project = pm().get_project();
-
-       
-       if (project && (project->get_title() == title)) {
-               QMessageBox::StandardButton button = QMessageBox::question(this,
-                       "Traverso - Question",
-                       "Are you sure you want to reopen the current project ?",
-                       QMessageBox::Ok | QMessageBox::Cancel,
-                       QMessageBox::Cancel );
-               if (button == QMessageBox::Cancel) {
-                       return;
-               }
-       }
-               
-       // first test if project exists
-       // Note: this shouldn't be needed really, the projects in the view
-       // should exist, but just in case someone removed it, you never know!
-       if (!pm().project_exists(title)) {
-               info().warning(tr("Project does not exist! (%1)").arg(title));
-               return;
-       }
-       
-       if (pm().load_project(title)<0) {
-               PERROR("Could not load project %s", title.toAscii().data());
-       }
-}
-
-void OpenCreateProjectDialog::on_createProjectButton_clicked( )
-{
-
-        // do we have the name of the project to create ?
-       QString title = newProjectName->text();
-       
-       if (title.length() == 0) {
-               info().information(tr("You must supply a name for the 
project!") );
-               return;
-       }
-
-
-       // first test if project exists already
-       if (pm().project_exists(title)) {
-               switch (QMessageBox::information(this,
-                       tr("Traverso - Question"),
-                       tr("The Project \"%1\" already exists, do you want to 
remove it and replace it with a new one ?").arg(title),
-                       tr("Yes"), tr("No"), QString::null, 1, -1)) 
-               {
-                       case 0:
-                       pm().remove_project(title);
-                       break;
-                       default:
-                       return;
-                       break;
-               }
-       }
-       
-       int numSongs = songCountSpinBox->value();
-       int numTracks = trackCountSpinBox->value();
-       
-       Project* project;
-       if( (project = pm().create_new_project(numSongs, numTracks, title)) ) {
-               project->set_description(descriptionTextEdit->toPlainText());
-               project->set_engineer(newProjectEngineer->text());
-               project->save();
-               delete project;
-               update_projects_list();
-       } else {
-               info().warning(tr("Couldn't create project (%1)").arg(title) );
-       }
-}
-
-void OpenCreateProjectDialog::on_deleteProjectbutton_clicked( )
-{
-        // do we have the name of the project to delete ?
-       QString title = selectedProjectName->text();
-
-       if (title.isEmpty()) {
-               info().information(tr("You must supply a name for the 
project!") );
-               return;
-       }
-
-        // first test if project exists
-       if (!pm().project_exists(title)) {
-               info().warning(tr("Project does not exist! (%1)").arg(title));
-               return;
-       }
-
-       switch (QMessageBox::information(this,
-               tr("Traverso - Question"),
-                  tr("Are you sure that you want to remove the project %1 ? 
It's not possible to undo it !").arg(title).toAscii().data(),
-                     "Yes", "No", QString::null, 1, -1)) {
-                             case 0:
-                                     pm().remove_project(title);
-                                     update_projects_list();
-                                     break;
-                             default:
-                                     return;
-                                     break;
-                     }
-                     return;
-}
-
-
-void OpenCreateProjectDialog::on_projectDirSelectButton_clicked( )
-{
-       QString path = config().get_property("Project", "DefaultDirectory", 
getenv("HOME")).toString();
-       
-       QString newPath = QFileDialog::getExistingDirectory(this,
-                       tr("Choose an existing or create a new Project 
Directory"), path);
-                       
-       if (newPath.isEmpty() || newPath.isNull()) {
-               return;
-       }
-       
-       QDir dir;
-       
-       if (dir.exists(newPath)) {
-//             QMessageBox::information( interface, tr("Traverso - 
Information"), tr("Using existing Project directory: %1\n").arg(newPath), "OK", 
0 );
-       } else if (!dir.mkpath(newPath)) {
-               QMessageBox::warning( this, tr("Traverso - Warning"), 
tr("Unable to create Project directory! \n") +
-                               tr("Please check permission for this directory: 
%1").arg(newPath) );
-               return;
-       } else {
-               QMessageBox::information( this, tr("Traverso - Information"), 
tr("Created new Project directory for you here: %1\n").arg(newPath), "OK", 0 );
-       }
-       
-       config().set_property("Project", "directory", newPath);
-       
-       update_projects_list();
-}
-
-
-//eof

Index: traverso/dialogs/project/OpenCreateProjectDialog.h
===================================================================
RCS file: traverso/dialogs/project/OpenCreateProjectDialog.h
diff -N traverso/dialogs/project/OpenCreateProjectDialog.h
--- traverso/dialogs/project/OpenCreateProjectDialog.h  3 Apr 2007 19:05:38 
-0000       1.1
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,49 +0,0 @@
-/*
-    Copyright (C) 2005-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: OpenCreateProjectDialog.h,v 1.1 2007/04/03 19:05:38 r_sijrier Exp $
-*/
-
-#ifndef PROJECT_MANAGER_DIALOG_H
-#define PROJECT_MANAGER_DIALOG_H
-
-#include "ui_OpenCreateProjectDialog.h"
-#include <QDialog>
-
-class OpenCreateProjectDialog : public QDialog, protected 
Ui::OpenCreateProjectDialog
-{
-Q_OBJECT
-
-public:
-       OpenCreateProjectDialog(QWidget* parent = 0);
-       ~OpenCreateProjectDialog();
-
-private slots:
-       void update_projects_list();
-       void on_loadProjectButton_clicked();
-       void on_createProjectButton_clicked();
-       void on_deleteProjectbutton_clicked();
-       void on_projectDirSelectButton_clicked();
-       void projectitem_clicked( QTreeWidgetItem* , int  );
-};
-
-#endif
-
-//eof
-




reply via email to

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