1 /* 2 Copyright (C) 2005-2007 Remon Sijrier 3 4 This file is part of Traverso 5 6 Traverso is free software; you can redistribute it and/or modify 7 it under the terms of the GNU General Public License as published by 8 the Free Software Foundation; either version 2 of the License, or 9 (at your option) any later version. 10 11 This program is distributed in the hope that it will be useful, 12 but WITHOUT ANY WARRANTY; without even the implied warranty of 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 GNU General Public License for more details. 15 16 You should have received a copy of the GNU General Public License 17 along with this program; if not, write to the Free Software 18 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 19 20 */ 21 22 #ifndef PROJECT_H 23 #define PROJECT_H 24 25 #include <QString> 26 #include <QList> 27 #include <QDomNode> 28 #include "ContextItem.h" 29 30 31 class Sheet; 32 class ResourcesManager; 33 struct ExportSpecification; 34 class ExportThread; 35 36 class Project : public ContextItem 37 { 38 Q_OBJECT 39 40 public : 41 ~Project(); 42 43 44 // Get functions 45 int get_current_sheet_id() const; 46 int get_num_sheets() const; 47 int get_rate() const; 48 int get_bitdepth() const; 49 50 ResourcesManager* get_audiosource_manager() const; 51 QString get_title() const; 52 QString get_engineer() const; 53 QString get_description() const; 54 QString get_discid() const; 55 QString get_performer() const; 56 QString get_arranger() const; 57 QString get_songwriter() const; 58 QString get_message() const; 59 QString get_upc_ean() const; 60 int get_genre(); 61 QString get_root_dir() const; 62 QString get_audiosources_dir() const; 63 QString get_import_dir() const; get_error_string()64 QString get_error_string() const {return m_errorString;} 65 QList<Sheet* > get_sheets() const; 66 Sheet* get_current_sheet() const ; 67 Sheet* get_sheet(qint64 id) const; 68 int get_sheet_index(qint64 id) const; 69 QDomNode get_state(QDomDocument doc, bool istemplate=false); 70 71 72 // Set functions 73 void set_title(const QString& title); 74 void set_engineer(const QString& pEngineer); 75 void set_description(const QString& des); 76 void set_discid(const QString& pId); 77 void set_performer(const QString& pPerformer); 78 void set_arranger(const QString& pArranger); 79 void set_songwriter(const QString& sw); 80 void set_message(const QString& pMessage); 81 void set_upc_ean(const QString& pUPC); 82 void set_genre(int pGenre); 83 void set_sheet_export_progress(int pogress); 84 void set_current_sheet(qint64 id); 85 void set_import_dir(const QString& dir); 86 87 88 Command* add_sheet(Sheet* sheet, bool historable=true); 89 Command* remove_sheet(Sheet* sheet, bool historable=true); 90 91 bool has_changed(); 92 bool is_save_to_close() const; 93 bool is_recording() const; 94 95 int save(bool autosave=false); 96 int load(QString projectfile = ""); 97 int export_project(ExportSpecification* spec); 98 int start_export(ExportSpecification* spec); 99 int create_cdrdao_toc(ExportSpecification* spec); 100 101 enum { 102 SETTING_XML_CONTENT_FAILED = -1, 103 PROJECT_FILE_COULD_NOT_BE_OPENED = -2, 104 PROJECT_FILE_VERSION_MISMATCH = -3 105 }; 106 107 108 public slots: 109 Command* select(); 110 111 private: 112 Project(const QString& title); 113 114 QList<Sheet* > m_sheets; 115 ResourcesManager* m_resourcesManager; 116 ExportThread* m_exportThread; 117 118 QString m_title; 119 QString m_rootDir; 120 QString m_sourcesDir; 121 QString engineer; 122 QString m_description; 123 QString m_importDir; 124 QString m_discid; 125 int m_genre; 126 QString m_upcEan; 127 QString m_performer; 128 QString m_arranger; 129 QString m_songwriter; 130 QString m_message; 131 QString m_errorString; 132 133 int m_rate; 134 int m_bitDepth; 135 bool m_useResampling; 136 137 int overallExportProgress; 138 int renderedSheets; 139 QList<Sheet* > sheetsToRender; 140 141 qint64 m_currentSheetId; 142 143 int create(int sheetcount, int numtracks); 144 int create_audiosources_dir(); 145 int create_peakfiles_dir(); 146 147 friend class ProjectManager; 148 149 private slots: 150 void private_add_sheet(Sheet* sheet); 151 void private_remove_sheet(Sheet* sheet); 152 153 signals: 154 void currentSheetChanged(Sheet* ); 155 void sheetAdded(Sheet*); 156 void sheetRemoved(Sheet*); 157 void sheetExportProgressChanged(int ); 158 void overallExportProgressChanged(int ); 159 void exportFinished(); 160 void exportStartedForSheet(Sheet* ); 161 void projectLoadFinished(); 162 }; 163 164 #endif 165