From c87a9b6217a3000e3612cf40cf362eed94a1f26f Mon Sep 17 00:00:00 2001 From: lordmulder Date: Thu, 12 May 2011 22:57:08 +0200 Subject: [PATCH] Added "Cue Sheet" importer to GUI. Actual Cue Sheet parsing and splitting not yet implemented, but the model already works. --- LameXP_VS2010.vcxproj | 39 ++++ LameXP_VS2010.vcxproj.filters | 24 +++ gui/CueSheetImport.ui | 367 ++++++++++++++++++++++++++++++++++ gui/MainWindow.ui | 15 +- res/Images.qrc | 1 + src/Config.h | 2 +- src/Dialog_CueImport.cpp | 126 ++++++++++++ src/Dialog_CueImport.h | 46 +++++ src/Dialog_MainWindow.cpp | 17 ++ src/Dialog_MainWindow.h | 1 + src/Model_CueSheet.cpp | 255 +++++++++++++++++++++++ src/Model_CueSheet.h | 49 +++++ 12 files changed, 939 insertions(+), 3 deletions(-) create mode 100644 gui/CueSheetImport.ui create mode 100644 src/Dialog_CueImport.cpp create mode 100644 src/Dialog_CueImport.h create mode 100644 src/Model_CueSheet.cpp create mode 100644 src/Model_CueSheet.h diff --git a/LameXP_VS2010.vcxproj b/LameXP_VS2010.vcxproj index 52953089..4725119a 100644 --- a/LameXP_VS2010.vcxproj +++ b/LameXP_VS2010.vcxproj @@ -244,6 +244,7 @@ del "$(TargetDir)imageformats\q???d4.dll" + @@ -270,6 +271,7 @@ del "$(TargetDir)imageformats\q???d4.dll" + @@ -288,6 +290,7 @@ del "$(TargetDir)imageformats\q???d4.dll" + @@ -305,6 +308,7 @@ del "$(TargetDir)imageformats\q???d4.dll" + @@ -338,6 +342,29 @@ del "$(TargetDir)imageformats\q???d4.dll" $(SolutionDir)tmp\MOC_%(Filename).cpp;%(Outputs) $(SolutionDir)tmp\MOC_%(Filename).cpp;%(Outputs) + + "$(QTDIR)\bin\moc.exe" -o "$(SolutionDir)tmp\MOC_%(Filename).cpp" "%(FullPath)" + "$(QTDIR)\bin\moc.exe" -o "$(SolutionDir)tmp\MOC_%(Filename).cpp" "%(FullPath)" + "$(QTDIR)\bin\moc.exe" -o "$(SolutionDir)tmp\MOC_%(Filename).cpp" "%(FullPath)" + MOC "$(SolutionDir)tmp\MOC_%(Filename).cpp" + MOC "$(SolutionDir)tmp\MOC_%(Filename).cpp" + MOC "$(SolutionDir)tmp\MOC_%(Filename).cpp" + $(SolutionDir)tmp\MOC_%(Filename).cpp;%(Outputs) + $(SolutionDir)tmp\MOC_%(Filename).cpp;%(Outputs) + $(SolutionDir)tmp\MOC_%(Filename).cpp;%(Outputs) + + + "$(QTDIR)\bin\moc.exe" -o "$(SolutionDir)tmp\MOC_%(Filename).cpp" "%(FullPath)" + "$(QTDIR)\bin\moc.exe" -o "$(SolutionDir)tmp\MOC_%(Filename).cpp" "%(FullPath)" + "$(QTDIR)\bin\moc.exe" -o "$(SolutionDir)tmp\MOC_%(Filename).cpp" "%(FullPath)" + MOC "$(SolutionDir)tmp\MOC_%(Filename).cpp" + MOC "$(SolutionDir)tmp\MOC_%(Filename).cpp" + MOC "$(SolutionDir)tmp\MOC_%(Filename).cpp" + $(SolutionDir)tmp\MOC_%(Filename).cpp;%(Outputs) + $(SolutionDir)tmp\MOC_%(Filename).cpp;%(Outputs) + $(SolutionDir)tmp\MOC_%(Filename).cpp;%(Outputs) + + @@ -867,6 +894,18 @@ del "$(TargetDir)imageformats\q???d4.dll" %(AdditionalInputs) $(SolutionDir)tmp\QRC_%(Filename).cpp;%(Outputs) + + Document + "$(QTDIR)\bin\uic.exe" -o "$(SolutionDir)tmp\UIC_%(Filename).h" "%(FullPath)" + "$(QTDIR)\bin\uic.exe" -o "$(SolutionDir)tmp\UIC_%(Filename).h" "%(FullPath)" + "$(QTDIR)\bin\uic.exe" -o "$(SolutionDir)tmp\UIC_%(Filename).h" "%(FullPath)" + UIC "$(SolutionDir)tmp\UIC_%(Filename).h" + UIC "$(SolutionDir)tmp\UIC_%(Filename).h" + UIC "$(SolutionDir)tmp\UIC_%(Filename).h" + $(SolutionDir)tmp\UIC_%(Filename).h;%(Outputs) + $(SolutionDir)tmp\UIC_%(Filename).h;%(Outputs) + $(SolutionDir)tmp\UIC_%(Filename).h;%(Outputs) + RCC "$(SolutionDir)tmp\QRC_%(Filename).cpp" diff --git a/LameXP_VS2010.vcxproj.filters b/LameXP_VS2010.vcxproj.filters index cd88958a..a5fbdcd7 100644 --- a/LameXP_VS2010.vcxproj.filters +++ b/LameXP_VS2010.vcxproj.filters @@ -289,6 +289,18 @@ Generated Files\MOC + + Source Files\Dialogs + + + Generated Files\MOC + + + Source Files\Models + + + Generated Files\MOC + @@ -405,6 +417,9 @@ Header Files + + Generated Files\UIC + @@ -545,6 +560,15 @@ Header Files\Encoders + + Dialogs + + + Header Files\Dialogs + + + Header Files\Models + diff --git a/gui/CueSheetImport.ui b/gui/CueSheetImport.ui new file mode 100644 index 00000000..39536534 --- /dev/null +++ b/gui/CueSheetImport.ui @@ -0,0 +1,367 @@ + + + CueSheetImport + + + + 0 + 0 + 621 + 478 + + + + Import Cue Sheet + + + + 0 + + + + + 0 + + + + + + 0 + 64 + + + + + 16777215 + 64 + + + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + + true + + + QFrame::NoFrame + + + QFrame::Raised + + + + + + + + + 56 + 16777215 + + + + + + + :/images/HeaderIcon_CueImport.png + + + + + + + + 50 + false + + + + <b>HEADER</b><br>(more header text) + + + + + + + + + + + + + 16777215 + 2 + + + + QFrame::HLine + + + QFrame::Sunken + + + + + + + 8 + + + 9 + + + + + true + + + QAbstractItemView::SingleSelection + + + QAbstractItemView::SelectRows + + + + + + + Qt::CustomContextMenu + + + Output Directory + + + + + + + + true + + + true + + + + + + + + 90 + 0 + + + + Browse... + + + + :/icons/folder_explore.png:/icons/folder_explore.png + + + + + + + + + + + + QFrame::HLine + + + QFrame::Sunken + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 130 + 0 + + + + Import Cue Sheet + + + + :/icons/add.png:/icons/add.png + + + + 16 + 16 + + + + false + + + + + + + + 90 + 0 + + + + Abort + + + + :/icons/cross.png:/icons/cross.png + + + + 16 + 16 + + + + false + + + + + + + + + + + + + abortButton + imprtButton + treeView + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + abortButton + clicked() + CueSheetImport + close() + + + 609 + 408 + + + 310 + 240 + + + + + diff --git a/gui/MainWindow.ui b/gui/MainWindow.ui index 8765da79..27601518 100644 --- a/gui/MainWindow.ui +++ b/gui/MainWindow.ui @@ -1067,8 +1067,8 @@ 0 0 - 604 - 1244 + 602 + 1241 @@ -3071,6 +3071,7 @@ + @@ -3371,6 +3372,15 @@ Check for Beta Updates + + + + :/icons/cd_add.png:/icons/cd_add.png + + + Import Cue Sheet + + @@ -3448,6 +3458,7 @@ + diff --git a/res/Images.qrc b/res/Images.qrc index d33eb6ef..9210fa9f 100644 --- a/res/Images.qrc +++ b/res/Images.qrc @@ -6,6 +6,7 @@ images/CD.png images/Disque.png images/DropBox.png + images/HeaderIcon_CueImport.png images/HeaderIcon_LogFile.png images/HeaderIcon_MetaInfo.png images/Label.png diff --git a/src/Config.h b/src/Config.h index bd495cd4..7820a09d 100644 --- a/src/Config.h +++ b/src/Config.h @@ -30,7 +30,7 @@ #define VER_LAMEXP_MINOR_LO 2 #define VER_LAMEXP_TYPE Alpha #define VER_LAMEXP_PATCH 14 -#define VER_LAMEXP_BUILD 500 +#define VER_LAMEXP_BUILD 505 /////////////////////////////////////////////////////////////////////////////// // Tools versions diff --git a/src/Dialog_CueImport.cpp b/src/Dialog_CueImport.cpp new file mode 100644 index 00000000..c7205691 --- /dev/null +++ b/src/Dialog_CueImport.cpp @@ -0,0 +1,126 @@ +/////////////////////////////////////////////////////////////////////////////// +// LameXP - Audio Encoder Front-End +// Copyright (C) 2004-2011 LoRd_MuldeR +// +// This program 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 Street, Fifth Floor, Boston, MA 02110-1301 USA. +// +// http://www.gnu.org/licenses/gpl-2.0.txt +/////////////////////////////////////////////////////////////////////////////// + +#include "Dialog_CueImport.h" + +#include "Global.h" +#include "Model_CueSheet.h" + +#include +#include +#include +#include +#include + +#define SET_FONT_BOLD(WIDGET,BOLD) { QFont _font = WIDGET->font(); _font.setBold(BOLD); WIDGET->setFont(_font); } + +//////////////////////////////////////////////////////////// +// Constructor & Destructor +//////////////////////////////////////////////////////////// + +CueImportDialog::CueImportDialog(QWidget *parent) +: + QDialog(parent) +{ + //Init the dialog, from the .ui file + setupUi(this); + + //Fix size + setMinimumSize(this->size()); + setMaximumHeight(this->height()); + + //Create model + m_model = new CueSheetModel(); + + //Setup table view + treeView->setModel(m_model); + treeView->header()->setStretchLastSection(false); + treeView->header()->setResizeMode(QHeaderView::ResizeToContents); + treeView->header()->setResizeMode(1, QHeaderView::Stretch); + treeView->header()->setMovable(false); + treeView->setItemsExpandable(false); + treeView->expandAll(); + + //Enable up/down button + connect(imprtButton, SIGNAL(clicked()), this, SLOT(importButtonClicked())); + + //Translate + labelHeaderText->setText(QString("%1
%2").arg(tr("Import Cue Sheet"), tr("The following Cue Sheet will be split and imported into LameXP."))); +} + +CueImportDialog::~CueImportDialog(void) +{ + LAMEXP_DELETE(m_model); +} + +//////////////////////////////////////////////////////////// +// Slots +//////////////////////////////////////////////////////////// + +int CueImportDialog::exec(const QString &cueFile) +{ + /* + MetaInfoModel *model = new MetaInfoModel(&audioFile); + tableView->setModel(model); + tableView->show(); + frameArtwork->hide(); + setWindowTitle(QString("Meta Information: %1").arg(QFileInfo(audioFile.filePath()).fileName())); + editButton->setEnabled(true); + upButton->setEnabled(allowUp); + downButton->setEnabled(allowDown); + buttonArtwork->setChecked(false); + + if(!audioFile.fileCover().isEmpty()) + { + QImage artwork; + if(artwork.load(audioFile.fileCover())) + { + if((artwork.width() > 256) || (artwork.height() > 256)) + { + artwork = artwork.scaled(256, 256, Qt::KeepAspectRatio, Qt::SmoothTransformation); + } + labelArtwork->setPixmap(QPixmap::fromImage(artwork)); + } + else + { + qWarning("Error: Failed to load cover art!"); + labelArtwork->setPixmap(QPixmap::fromImage(QImage(":/images/CD.png"))); + } + } + else + { + labelArtwork->setPixmap(QPixmap::fromImage(QImage(":/images/CD.png"))); + } + + int iResult = QDialog::exec(); + + tableView->setModel(NULL); + LAMEXP_DELETE(model); + + return iResult;*/ + + return QDialog::exec(); +} + +void CueImportDialog::importButtonClicked(void) +{ + QMessageBox::information(this, "Not implemenred", "Sorry, not yet. Please try again in a later version!"); +} diff --git a/src/Dialog_CueImport.h b/src/Dialog_CueImport.h new file mode 100644 index 00000000..d17dee90 --- /dev/null +++ b/src/Dialog_CueImport.h @@ -0,0 +1,46 @@ +/////////////////////////////////////////////////////////////////////////////// +// LameXP - Audio Encoder Front-End +// Copyright (C) 2004-2011 LoRd_MuldeR +// +// This program 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 Street, Fifth Floor, Boston, MA 02110-1301 USA. +// +// http://www.gnu.org/licenses/gpl-2.0.txt +/////////////////////////////////////////////////////////////////////////////// + +#pragma once + +#include +#include "../tmp/UIC_CueSheetImport.h" + +#include "Model_AudioFile.h" + +class CueSheetModel; + +class CueImportDialog : public QDialog, private Ui::CueSheetImport +{ + Q_OBJECT + +public: + CueImportDialog(QWidget *parent); + ~CueImportDialog(void); + + int exec(const QString &cueFile); + +private slots: + void importButtonClicked(void); + +private: + CueSheetModel *m_model; +}; diff --git a/src/Dialog_MainWindow.cpp b/src/Dialog_MainWindow.cpp index 68bd2c91..2c815bba 100644 --- a/src/Dialog_MainWindow.cpp +++ b/src/Dialog_MainWindow.cpp @@ -29,6 +29,7 @@ #include "Dialog_About.h" #include "Dialog_Update.h" #include "Dialog_DropBox.h" +#include "Dialog_CueImport.h" #include "Thread_FileAnalyzer.h" #include "Thread_MessageHandler.h" #include "Model_MetaInfo.h" @@ -340,6 +341,7 @@ MainWindow::MainWindow(FileListModel *fileListModel, AudioFileModel *metaInfo, S connect(actionDisableShellIntegration, SIGNAL(triggered(bool)), this, SLOT(disableShellIntegrationActionTriggered(bool))); connect(actionShowDropBoxWidget, SIGNAL(triggered(bool)), this, SLOT(showDropBoxWidgetActionTriggered(bool))); connect(actionCheckForBetaUpdates, SIGNAL(triggered(bool)), this, SLOT(checkForBetaUpdatesActionTriggered(bool))); + connect(actionImportCueSheet, SIGNAL(triggered(bool)), this, SLOT(importCueSheetActionTriggered(bool))); //Activate help menu actions actionVisitHomepage->setData(QString::fromLatin1(lamexp_website_url())); @@ -2556,6 +2558,21 @@ void MainWindow::installWMADecoderActionTriggered(bool checked) } } +/* + * Import a Cue Sheet file + */ +void MainWindow::importCueSheetActionTriggered(bool checked) +{ + ABORT_IF_BUSY; + + TEMP_HIDE_DROPBOX + ( + CueImportDialog *cueImporter = new CueImportDialog(this); + cueImporter->exec(QString()); + LAMEXP_DELETE(cueImporter); + ) +} + /* * Show the "drop box" widget */ diff --git a/src/Dialog_MainWindow.h b/src/Dialog_MainWindow.h index 316c78fd..7a4aaaad 100644 --- a/src/Dialog_MainWindow.h +++ b/src/Dialog_MainWindow.h @@ -118,6 +118,7 @@ private slots: void outputFolderContextMenu(const QPoint &pos); void showFolderContextActionTriggered(void); void installWMADecoderActionTriggered(bool checked); + void importCueSheetActionTriggered(bool checked); void disableNeroAacNotificationsActionTriggered(bool checked); void disableWmaDecoderNotificationsActionTriggered(bool checked); void showDropBoxWidgetActionTriggered(bool checked); diff --git a/src/Model_CueSheet.cpp b/src/Model_CueSheet.cpp new file mode 100644 index 00000000..70d87e98 --- /dev/null +++ b/src/Model_CueSheet.cpp @@ -0,0 +1,255 @@ +/////////////////////////////////////////////////////////////////////////////// +// LameXP - Audio Encoder Front-End +// Copyright (C) 2004-2011 LoRd_MuldeR +// +// This program 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 Street, Fifth Floor, Boston, MA 02110-1301 USA. +// +// http://www.gnu.org/licenses/gpl-2.0.txt +/////////////////////////////////////////////////////////////////////////////// + +#include "Model_CueSheet.h" +#include "Genres.h" + +#include +#include +#include + +#include +#include + +//////////////////////////////////////////////////////////// +// Helper Classes +//////////////////////////////////////////////////////////// + +class CueSheetItem +{ +public: + virtual const char* type(void) = 0; +}; + +class CueSheetTrack : public CueSheetItem +{ +public: + CueSheetTrack(CueSheetFile *parent, int trackNo) + : + m_parent(parent), + m_trackNo(trackNo) + { + m_startIndex = std::numeric_limits::quiet_NaN(); + } + int trackNo(void) { return m_trackNo; } + double startIndex(void) { return m_startIndex; } + QString title(void) { return m_title; } + QString performer(void) { return m_performer; } + CueSheetFile *parent(void) { return m_parent; } + void setStartIndex(double startIndex) { m_startIndex = startIndex; } + void setTitle(const QString &title) { m_title = title; } + void setPerformer(const QString &performer) { m_performer = performer; } + bool isValid(void) { return !(_isnan(m_startIndex) || (m_trackNo < 0)); } + virtual const char* type(void) { return "CueSheetTrack"; } +private: + int m_trackNo; + double m_startIndex; + QString m_title; + QString m_performer; + CueSheetFile *m_parent; +}; + +class CueSheetFile : public CueSheetItem +{ +public: + CueSheetFile(const QString &fileName) : m_fileName(fileName) {} + ~CueSheetFile(void) { while(!m_tracks.isEmpty()) delete m_tracks.takeLast(); } + QString fileName(void) { return m_fileName; } + void addTrack(CueSheetTrack *track) { m_tracks.append(track); } + void clearTracks(void) { while(!m_tracks.isEmpty()) delete m_tracks.takeLast(); } + CueSheetTrack *track(int index) { return m_tracks.at(index); } + int trackCount(void) { return m_tracks.count(); } + virtual const char* type(void) { return "CueSheetFile"; } +private: + const QString m_fileName; + QList m_tracks; +}; + +//////////////////////////////////////////////////////////// +// Constructor & Destructor +//////////////////////////////////////////////////////////// + +CueSheetModel::CueSheetModel() +{ + int trackNo = 0; + + for(int i = 0; i < 5; i++) + { + CueSheetFile *currentFile = new CueSheetFile(QString().sprintf("File %02d.wav", i+1)); + for(int j = 0; j < 8; j++) + { + CueSheetTrack *currentTrack = new CueSheetTrack(currentFile, trackNo++); + currentTrack->setTitle("ATWA (Air Trees Water Animals)"); + currentTrack->setPerformer("System of a Down"); + currentFile->addTrack(currentTrack); + } + m_files.append(currentFile); + } +} + +CueSheetModel::~CueSheetModel(void) +{ + while(!m_files.isEmpty()) delete m_files.takeLast(); +} + +//////////////////////////////////////////////////////////// +// Model Functions +//////////////////////////////////////////////////////////// + +QModelIndex CueSheetModel::index(int row, int column, const QModelIndex &parent) const +{ + if(!parent.isValid()) + { + return createIndex(row, column, m_files.at(row)); + } + + CueSheetItem *parentItem = static_cast(parent.internalPointer()); + if(CueSheetFile *filePtr = dynamic_cast(parentItem)) + { + return createIndex(row, column, filePtr->track(row)); + } + + return QModelIndex(); +} + +int CueSheetModel::columnCount(const QModelIndex &parent) const +{ + return 3; +} + +int CueSheetModel::rowCount(const QModelIndex &parent) const +{ + if(!parent.isValid()) + { + return m_files.count(); + } + + CueSheetItem *parentItem = static_cast(parent.internalPointer()); + if(CueSheetFile *filePtr = dynamic_cast(parentItem)) + { + return filePtr->trackCount(); + } + + return 0; +} + +QModelIndex CueSheetModel::parent(const QModelIndex &child) const +{ + if(child.isValid()) + { + CueSheetItem *childItem = static_cast(child.internalPointer()); + if(CueSheetTrack *trackPtr = dynamic_cast(childItem)) + { + return createIndex(m_files.indexOf(trackPtr->parent()), 0, trackPtr->parent()); + } + } + + return QModelIndex(); +} + +QVariant CueSheetModel::headerData (int section, Qt::Orientation orientation, int role) const +{ + if(role == Qt::DisplayRole) + { + switch(section) + { + case 0: + return tr("No."); + break; + case 1: + return tr("File / Track"); + break; + case 2: + return tr("Index"); + break; + default: + return QVariant(); + break; + } + } + else + { + return QVariant(); + } +} + +QVariant CueSheetModel::data(const QModelIndex &index, int role) const +{ + if(role == Qt::DisplayRole) + { + CueSheetItem *item = reinterpret_cast(index.internalPointer()); + + if(CueSheetFile *filePtr = dynamic_cast(item)) + { + switch(index.column()) + { + case 0: + return tr("File %1").arg(QString().sprintf("%02d", index.row() + 1)).append(" "); + break; + case 1: + return QString("[%1]").arg(QFileInfo(filePtr->fileName()).fileName()); + break; + default: + return QVariant(); + break; + } + } + else if(CueSheetTrack *trackPtr = dynamic_cast(item)) + { + switch(index.column()) + { + case 0: + return tr("Track %1").arg(QString().sprintf("%02d", trackPtr->trackNo() + 1)).append(" "); + break; + case 1: + if(!trackPtr->title().isEmpty() && !trackPtr->performer().isEmpty()) + { + return QString("%1 / %2").arg(trackPtr->performer(), trackPtr->title()); + } + else if(!trackPtr->title().isEmpty()) + { + return trackPtr->title(); + } + else if(!trackPtr->performer().isEmpty()) + { + return trackPtr->performer(); + } + return QVariant(); + break; + case 2: + return QString().sprintf("%07.2f", trackPtr->startIndex()); + break; + default: + return QVariant(); + break; + } + } + } + + return QVariant(); +} + +void CueSheetModel::clearData(void) +{ + beginResetModel(); + while(!m_files.isEmpty()) delete m_files.takeLast(); + endResetModel(); +} diff --git a/src/Model_CueSheet.h b/src/Model_CueSheet.h new file mode 100644 index 00000000..0f23aa33 --- /dev/null +++ b/src/Model_CueSheet.h @@ -0,0 +1,49 @@ +/////////////////////////////////////////////////////////////////////////////// +// LameXP - Audio Encoder Front-End +// Copyright (C) 2004-2011 LoRd_MuldeR +// +// This program 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 Street, Fifth Floor, Boston, MA 02110-1301 USA. +// +// http://www.gnu.org/licenses/gpl-2.0.txt +/////////////////////////////////////////////////////////////////////////////// + +#pragma once + +#include "Model_AudioFile.h" +#include +#include + +class CueSheetFile; + +class CueSheetModel : public QAbstractItemModel +{ + Q_OBJECT + +public: + CueSheetModel(); + ~CueSheetModel(void); + + //Model functions + QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const; + int columnCount(const QModelIndex &parent = QModelIndex()) const; + int rowCount(const QModelIndex &parent = QModelIndex()) const; + QVariant headerData (int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const; + QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; + QModelIndex parent(const QModelIndex &child) const; + void clearData(void); + +private: + QList m_files; +};