Added "Cue Sheet" importer to GUI. Actual Cue Sheet parsing and splitting not yet implemented, but the model already works.

This commit is contained in:
LoRd_MuldeR 2011-05-12 22:57:08 +02:00
parent c1ca3a2302
commit c87a9b6217
12 changed files with 939 additions and 3 deletions

View File

@ -244,6 +244,7 @@ del "$(TargetDir)imageformats\q???d4.dll"
<ClCompile Include="src\Decoder_WavPack.cpp" />
<ClCompile Include="src\Decoder_WMA.cpp" />
<ClCompile Include="src\Dialog_About.cpp" />
<ClCompile Include="src\Dialog_CueImport.cpp" />
<ClCompile Include="src\Dialog_DropBox.cpp" />
<ClCompile Include="src\Dialog_LogView.cpp" />
<ClCompile Include="src\Dialog_MainWindow.cpp" />
@ -270,6 +271,7 @@ del "$(TargetDir)imageformats\q???d4.dll"
<ClCompile Include="src\Main.cpp" />
<ClCompile Include="src\Model_Artwork.cpp" />
<ClCompile Include="src\Model_AudioFile.cpp" />
<ClCompile Include="src\Model_CueSheet.cpp" />
<ClCompile Include="src\Model_FileList.cpp" />
<ClCompile Include="src\Model_FileSystem.cpp" />
<ClCompile Include="src\Model_MetaInfo.cpp" />
@ -288,6 +290,7 @@ del "$(TargetDir)imageformats\q???d4.dll"
<ClCompile Include="src\WinSevenTaskbar.cpp" />
<ClCompile Include="tmp\MOC_Decoder_Abstract.cpp" />
<ClCompile Include="tmp\MOC_Dialog_About.cpp" />
<ClCompile Include="tmp\MOC_Dialog_CueImport.cpp" />
<ClCompile Include="tmp\MOC_Dialog_DropBox.cpp" />
<ClCompile Include="tmp\MOC_Dialog_LogView.cpp" />
<ClCompile Include="tmp\MOC_Dialog_MainWindow.cpp" />
@ -305,6 +308,7 @@ del "$(TargetDir)imageformats\q???d4.dll"
<ClCompile Include="tmp\MOC_Encoder_Wave.cpp" />
<ClCompile Include="tmp\MOC_Filter_Abstract.cpp" />
<ClCompile Include="tmp\MOC_Model_AudioFile.cpp" />
<ClCompile Include="tmp\MOC_Model_CueSheet.cpp" />
<ClCompile Include="tmp\MOC_Model_FileList.cpp" />
<ClCompile Include="tmp\MOC_Model_MetaInfo.cpp" />
<ClCompile Include="tmp\MOC_Model_Progress.cpp" />
@ -338,6 +342,29 @@ del "$(TargetDir)imageformats\q???d4.dll"
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)tmp\MOC_%(Filename).cpp;%(Outputs)</Outputs>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release_Static|Win32'">$(SolutionDir)tmp\MOC_%(Filename).cpp;%(Outputs)</Outputs>
</CustomBuild>
<CustomBuild Include="src\Dialog_CueImport.h">
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">"$(QTDIR)\bin\moc.exe" -o "$(SolutionDir)tmp\MOC_%(Filename).cpp" "%(FullPath)"</Command>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">"$(QTDIR)\bin\moc.exe" -o "$(SolutionDir)tmp\MOC_%(Filename).cpp" "%(FullPath)"</Command>
<Command Condition="'$(Configuration)|$(Platform)'=='Release_Static|Win32'">"$(QTDIR)\bin\moc.exe" -o "$(SolutionDir)tmp\MOC_%(Filename).cpp" "%(FullPath)"</Command>
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">MOC "$(SolutionDir)tmp\MOC_%(Filename).cpp"</Message>
<Message Condition="'$(Configuration)|$(Platform)'=='Release_Static|Win32'">MOC "$(SolutionDir)tmp\MOC_%(Filename).cpp"</Message>
<Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">MOC "$(SolutionDir)tmp\MOC_%(Filename).cpp"</Message>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)tmp\MOC_%(Filename).cpp;%(Outputs)</Outputs>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release_Static|Win32'">$(SolutionDir)tmp\MOC_%(Filename).cpp;%(Outputs)</Outputs>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)tmp\MOC_%(Filename).cpp;%(Outputs)</Outputs>
</CustomBuild>
<CustomBuild Include="src\Model_CueSheet.h">
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">"$(QTDIR)\bin\moc.exe" -o "$(SolutionDir)tmp\MOC_%(Filename).cpp" "%(FullPath)"</Command>
<Command Condition="'$(Configuration)|$(Platform)'=='Release_Static|Win32'">"$(QTDIR)\bin\moc.exe" -o "$(SolutionDir)tmp\MOC_%(Filename).cpp" "%(FullPath)"</Command>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">"$(QTDIR)\bin\moc.exe" -o "$(SolutionDir)tmp\MOC_%(Filename).cpp" "%(FullPath)"</Command>
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">MOC "$(SolutionDir)tmp\MOC_%(Filename).cpp"</Message>
<Message Condition="'$(Configuration)|$(Platform)'=='Release_Static|Win32'">MOC "$(SolutionDir)tmp\MOC_%(Filename).cpp"</Message>
<Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">MOC "$(SolutionDir)tmp\MOC_%(Filename).cpp"</Message>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)tmp\MOC_%(Filename).cpp;%(Outputs)</Outputs>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release_Static|Win32'">$(SolutionDir)tmp\MOC_%(Filename).cpp;%(Outputs)</Outputs>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)tmp\MOC_%(Filename).cpp;%(Outputs)</Outputs>
</CustomBuild>
<ClInclude Include="tmp\UIC_CueSheetImport.h" />
<ClInclude Include="tmp\UIC_DropBox.h" />
<ClInclude Include="tmp\UIC_LogViewDialog.h" />
<ClInclude Include="tmp\UIC_MainWindow.h" />
@ -867,6 +894,18 @@ del "$(TargetDir)imageformats\q???d4.dll"
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalInputs)</AdditionalInputs>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)tmp\QRC_%(Filename).cpp;%(Outputs)</Outputs>
</CustomBuild>
<CustomBuild Include="gui\CueSheetImport.ui">
<FileType>Document</FileType>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">"$(QTDIR)\bin\uic.exe" -o "$(SolutionDir)tmp\UIC_%(Filename).h" "%(FullPath)"</Command>
<Command Condition="'$(Configuration)|$(Platform)'=='Release_Static|Win32'">"$(QTDIR)\bin\uic.exe" -o "$(SolutionDir)tmp\UIC_%(Filename).h" "%(FullPath)"</Command>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">"$(QTDIR)\bin\uic.exe" -o "$(SolutionDir)tmp\UIC_%(Filename).h" "%(FullPath)"</Command>
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">UIC "$(SolutionDir)tmp\UIC_%(Filename).h"</Message>
<Message Condition="'$(Configuration)|$(Platform)'=='Release_Static|Win32'">UIC "$(SolutionDir)tmp\UIC_%(Filename).h"</Message>
<Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">UIC "$(SolutionDir)tmp\UIC_%(Filename).h"</Message>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)tmp\UIC_%(Filename).h;%(Outputs)</Outputs>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release_Static|Win32'">$(SolutionDir)tmp\UIC_%(Filename).h;%(Outputs)</Outputs>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)tmp\UIC_%(Filename).h;%(Outputs)</Outputs>
</CustomBuild>
<None Include="res\MainIcon.ico" />
<CustomBuild Include="res\Tools.qrc">
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">RCC "$(SolutionDir)tmp\QRC_%(Filename).cpp"</Message>

View File

@ -289,6 +289,18 @@
<ClCompile Include="tmp\MOC_Encoder_AC3.cpp">
<Filter>Generated Files\MOC</Filter>
</ClCompile>
<ClCompile Include="src\Dialog_CueImport.cpp">
<Filter>Source Files\Dialogs</Filter>
</ClCompile>
<ClCompile Include="tmp\MOC_Dialog_CueImport.cpp">
<Filter>Generated Files\MOC</Filter>
</ClCompile>
<ClCompile Include="src\Model_CueSheet.cpp">
<Filter>Source Files\Models</Filter>
</ClCompile>
<ClCompile Include="tmp\MOC_Model_CueSheet.cpp">
<Filter>Generated Files\MOC</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="src\Config.h">
@ -405,6 +417,9 @@
<ClInclude Include="src\Global.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="tmp\UIC_CueSheetImport.h">
<Filter>Generated Files\UIC</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="LameXP.rc" />
@ -545,6 +560,15 @@
<CustomBuild Include="src\Encoder_AC3.h">
<Filter>Header Files\Encoders</Filter>
</CustomBuild>
<CustomBuild Include="gui\CueSheetImport.ui">
<Filter>Dialogs</Filter>
</CustomBuild>
<CustomBuild Include="src\Dialog_CueImport.h">
<Filter>Header Files\Dialogs</Filter>
</CustomBuild>
<CustomBuild Include="src\Model_CueSheet.h">
<Filter>Header Files\Models</Filter>
</CustomBuild>
</ItemGroup>
<ItemGroup>
<None Include="res\MainIcon.ico" />

367
gui/CueSheetImport.ui Normal file
View File

@ -0,0 +1,367 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>CueSheetImport</class>
<widget class="QDialog" name="CueSheetImport">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>621</width>
<height>478</height>
</rect>
</property>
<property name="windowTitle">
<string>Import Cue Sheet</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<property name="margin">
<number>0</number>
</property>
<item>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="spacing">
<number>0</number>
</property>
<item>
<widget class="QFrame" name="headerFrame">
<property name="minimumSize">
<size>
<width>0</width>
<height>64</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>64</height>
</size>
</property>
<property name="palette">
<palette>
<active>
<colorrole role="Base">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Window">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="Base">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Window">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="Base">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Window">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="autoFillBackground">
<bool>true</bool>
</property>
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="label">
<property name="maximumSize">
<size>
<width>56</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="../res/Images.qrc">:/images/HeaderIcon_CueImport.png</pixmap>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="labelHeaderText">
<property name="font">
<font>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
<property name="text">
<string notr="true">&lt;b&gt;HEADER&lt;/b&gt;&lt;br&gt;(more header text)</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QFrame" name="frame">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>2</height>
</size>
</property>
<property name="frameShape">
<enum>QFrame::HLine</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Sunken</enum>
</property>
</widget>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_3">
<property name="spacing">
<number>8</number>
</property>
<property name="margin">
<number>9</number>
</property>
<item>
<widget class="QTreeView" name="treeView">
<property name="alternatingRowColors">
<bool>true</bool>
</property>
<property name="selectionMode">
<enum>QAbstractItemView::SingleSelection</enum>
</property>
<property name="selectionBehavior">
<enum>QAbstractItemView::SelectRows</enum>
</property>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBoxArtwork">
<property name="contextMenuPolicy">
<enum>Qt::CustomContextMenu</enum>
</property>
<property name="title">
<string> Output Directory </string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_5">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="QLineEdit" name="editOutputDir">
<property name="frame">
<bool>true</bool>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="browseButton">
<property name="minimumSize">
<size>
<width>90</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>Browse...</string>
</property>
<property name="icon">
<iconset resource="../res/Icons.qrc">
<normaloff>:/icons/folder_explore.png</normaloff>:/icons/folder_explore.png</iconset>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QFrame" name="frame_2">
<property name="frameShape">
<enum>QFrame::HLine</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Sunken</enum>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="imprtButton">
<property name="minimumSize">
<size>
<width>130</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>Import Cue Sheet</string>
</property>
<property name="icon">
<iconset resource="../res/Icons.qrc">
<normaloff>:/icons/add.png</normaloff>:/icons/add.png</iconset>
</property>
<property name="iconSize">
<size>
<width>16</width>
<height>16</height>
</size>
</property>
<property name="autoDefault">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="abortButton">
<property name="minimumSize">
<size>
<width>90</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>Abort</string>
</property>
<property name="icon">
<iconset resource="../res/Icons.qrc">
<normaloff>:/icons/cross.png</normaloff>:/icons/cross.png</iconset>
</property>
<property name="iconSize">
<size>
<width>16</width>
<height>16</height>
</size>
</property>
<property name="autoDefault">
<bool>false</bool>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
</layout>
</item>
</layout>
</widget>
<tabstops>
<tabstop>abortButton</tabstop>
<tabstop>imprtButton</tabstop>
<tabstop>treeView</tabstop>
</tabstops>
<resources>
<include location="../res/Icons.qrc"/>
<include location="../res/Images.qrc"/>
<include location="../res/Images.qrc"/>
<include location="../res/Images.qrc"/>
<include location="../res/Images.qrc"/>
<include location="../res/Images.qrc"/>
<include location="../res/Images.qrc"/>
<include location="../res/Images.qrc"/>
<include location="../res/Images.qrc"/>
<include location="../res/Images.qrc"/>
<include location="../res/Images.qrc"/>
<include location="../res/Images.qrc"/>
<include location="../res/Images.qrc"/>
<include location="../res/Images.qrc"/>
<include location="../res/Images.qrc"/>
<include location="../res/Images.qrc"/>
<include location="../res/Images.qrc"/>
<include location="../res/Images.qrc"/>
<include location="../res/Images.qrc"/>
<include location="../res/Images.qrc"/>
<include location="../res/Images.qrc"/>
<include location="../res/Images.qrc"/>
<include location="../res/Images.qrc"/>
<include location="../res/Images.qrc"/>
<include location="../res/Images.qrc"/>
<include location="../res/Images.qrc"/>
<include location="../res/Images.qrc"/>
<include location="../res/Images.qrc"/>
</resources>
<connections>
<connection>
<sender>abortButton</sender>
<signal>clicked()</signal>
<receiver>CueSheetImport</receiver>
<slot>close()</slot>
<hints>
<hint type="sourcelabel">
<x>609</x>
<y>408</y>
</hint>
<hint type="destinationlabel">
<x>310</x>
<y>240</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View File

@ -1067,8 +1067,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>604</width>
<height>1244</height>
<width>602</width>
<height>1241</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_22">
@ -3071,6 +3071,7 @@
<addaction name="separator"/>
<addaction name="actionCheckForBetaUpdates"/>
</widget>
<addaction name="actionImportCueSheet"/>
<addaction name="actionInstallWMADecoder"/>
<addaction name="actionShowDropBoxWidget"/>
<addaction name="separator"/>
@ -3371,6 +3372,15 @@
<string>Check for Beta Updates</string>
</property>
</action>
<action name="actionImportCueSheet">
<property name="icon">
<iconset resource="../res/Icons.qrc">
<normaloff>:/icons/cd_add.png</normaloff>:/icons/cd_add.png</iconset>
</property>
<property name="text">
<string>Import Cue Sheet</string>
</property>
</action>
</widget>
<resources>
<include location="../res/Icons.qrc"/>
@ -3448,6 +3458,7 @@
<include location="../res/Icons.qrc"/>
<include location="../res/Icons.qrc"/>
<include location="../res/Icons.qrc"/>
<include location="../res/Icons.qrc"/>
</resources>
<connections>
<connection>

View File

@ -6,6 +6,7 @@
<file>images/CD.png</file>
<file>images/Disque.png</file>
<file>images/DropBox.png</file>
<file>images/HeaderIcon_CueImport.png</file>
<file>images/HeaderIcon_LogFile.png</file>
<file>images/HeaderIcon_MetaInfo.png</file>
<file>images/Label.png</file>

View File

@ -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

126
src/Dialog_CueImport.cpp Normal file
View File

@ -0,0 +1,126 @@
///////////////////////////////////////////////////////////////////////////////
// LameXP - Audio Encoder Front-End
// Copyright (C) 2004-2011 LoRd_MuldeR <MuldeR2@GMX.de>
//
// 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 <QFileInfo>
#include <QMessageBox>
#include <QTimer>
#include <QFileDialog>
#include <QMenu>
#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("<b>%1</b><br>%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!");
}

46
src/Dialog_CueImport.h Normal file
View File

@ -0,0 +1,46 @@
///////////////////////////////////////////////////////////////////////////////
// LameXP - Audio Encoder Front-End
// Copyright (C) 2004-2011 LoRd_MuldeR <MuldeR2@GMX.de>
//
// 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 <QDialog>
#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;
};

View File

@ -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
*/

View File

@ -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);

255
src/Model_CueSheet.cpp Normal file
View File

@ -0,0 +1,255 @@
///////////////////////////////////////////////////////////////////////////////
// LameXP - Audio Encoder Front-End
// Copyright (C) 2004-2011 LoRd_MuldeR <MuldeR2@GMX.de>
//
// 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 <QMessageBox>
#include <QInputDialog>
#include <QFileInfo>
#include <float.h>
#include <limits>
////////////////////////////////////////////////////////////
// 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<double>::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<CueSheetTrack*> 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<CueSheetItem*>(parent.internalPointer());
if(CueSheetFile *filePtr = dynamic_cast<CueSheetFile*>(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<CueSheetItem*>(parent.internalPointer());
if(CueSheetFile *filePtr = dynamic_cast<CueSheetFile*>(parentItem))
{
return filePtr->trackCount();
}
return 0;
}
QModelIndex CueSheetModel::parent(const QModelIndex &child) const
{
if(child.isValid())
{
CueSheetItem *childItem = static_cast<CueSheetItem*>(child.internalPointer());
if(CueSheetTrack *trackPtr = dynamic_cast<CueSheetTrack*>(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<CueSheetItem*>(index.internalPointer());
if(CueSheetFile *filePtr = dynamic_cast<CueSheetFile*>(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<CueSheetTrack*>(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();
}

49
src/Model_CueSheet.h Normal file
View File

@ -0,0 +1,49 @@
///////////////////////////////////////////////////////////////////////////////
// LameXP - Audio Encoder Front-End
// Copyright (C) 2004-2011 LoRd_MuldeR <MuldeR2@GMX.de>
//
// 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 <QAbstractItemModel>
#include <QIcon>
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<CueSheetFile*> m_files;
};