Use the MediaInfo model in MainWindow too

This commit is contained in:
LoRd_MuldeR 2010-11-10 19:44:51 +01:00
parent 6a480fd764
commit c80714b829
9 changed files with 364 additions and 532 deletions

View File

@ -93,7 +93,7 @@
<Tool
Name="VCPostBuildEventTool"
Description="Copy plugin DLL&apos;s"
CommandLine="mkdir &quot;$(TargetDir)\imageformats&quot;&#x0D;&#x0A;copy &quot;$(QTDIR)\plugins\imageformats\q???d4.dll&quot; &quot;$(TargetDir)\imageformats\&quot;&#x0D;&#x0A;"
CommandLine="mkdir &quot;$(TargetDir)imageformats&quot;&#x0D;&#x0A;copy &quot;$(QTDIR)\plugins\imageformats\q???d4.dll&quot; &quot;$(TargetDir)imageformats\&quot;&#x0D;&#x0A;"
/>
</Configuration>
<Configuration
@ -183,7 +183,7 @@
<Tool
Name="VCPostBuildEventTool"
Description="Copy plugin DLL&apos;s"
CommandLine="mkdir &quot;$(TargetDir)\imageformats&quot;&#x0D;&#x0A;copy &quot;$(QTDIR)\plugins\imageformats\q???4.dll&quot; &quot;$(TargetDir)\imageformats\&quot;&#x0D;&#x0A;"
CommandLine="mkdir &quot;$(TargetDir)imageformats&quot;&#x0D;&#x0A;copy &quot;$(QTDIR)\plugins\imageformats\q???4.dll&quot; &quot;$(TargetDir)imageformats\&quot;&#x0D;&#x0A;"
/>
</Configuration>
</Configurations>
@ -261,6 +261,10 @@
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
<File
RelativePath=".\src\Config.h"
>
</File>
<File
RelativePath=".\src\Dialog_MainWindow.h"
>

View File

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>676</width>
<height>557</height>
<height>550</height>
</rect>
</property>
<property name="windowTitle">
@ -198,19 +198,19 @@
</spacer>
</item>
<item>
<widget class="QPushButton" name="buttonEditMeta">
<widget class="QPushButton" name="buttonShowDetails">
<property name="minimumSize">
<size>
<width>90</width>
<width>105</width>
<height>0</height>
</size>
</property>
<property name="text">
<string> Edit Meta</string>
<string>Show Details</string>
</property>
<property name="icon">
<iconset resource="../res/Icons.qrc">
<normaloff>:/icons/table_edit.png</normaloff>:/icons/table_edit.png</iconset>
<normaloff>:/icons/zoom.png</normaloff>:/icons/zoom.png</iconset>
</property>
</widget>
</item>
@ -380,7 +380,7 @@
<layout class="QGridLayout" name="gridLayout_6">
<item row="0" column="0">
<layout class="QGridLayout" name="gridLayout_5">
<item row="0" column="0" colspan="2">
<item row="0" column="1" colspan="2">
<widget class="QGroupBox" name="metaDataGroupBox">
<property name="font">
<font>
@ -392,448 +392,95 @@
<string> Meta Information </string>
</property>
<layout class="QGridLayout" name="gridLayout_9">
<item row="0" column="0" colspan="4">
<widget class="QTableView" name="metaDataView">
<property name="selectionMode">
<enum>QAbstractItemView::SingleSelection</enum>
</property>
<property name="selectionBehavior">
<enum>QAbstractItemView::SelectRows</enum>
</property>
<property name="wordWrap">
<bool>false</bool>
</property>
<attribute name="horizontalHeaderHighlightSections">
<bool>false</bool>
</attribute>
<attribute name="horizontalHeaderStretchLastSection">
<bool>true</bool>
</attribute>
<attribute name="verticalHeaderHighlightSections">
<bool>false</bool>
</attribute>
</widget>
</item>
<item row="3" column="3">
<widget class="QPushButton" name="buttonEditMeta">
<property name="maximumSize">
<size>
<width>90</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>Edit</string>
</property>
<property name="icon">
<iconset resource="../res/Icons.qrc">
<normaloff>:/icons/table_edit.png</normaloff>:/icons/table_edit.png</iconset>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QLabel" name="labelEditMetaHint">
<property name="text">
<string>Note: Meta information you enter here will &lt;u&gt;supersede&lt;/u&gt; data from the source!</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="3" column="0">
<layout class="QGridLayout" name="gridLayout">
<item row="1" column="0">
<widget class="QLineEdit" name="lineEdit">
<property name="palette">
<palette>
<active>
<colorrole role="Text">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>85</red>
<green>85</green>
<blue>127</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="Text">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>85</red>
<green>85</green>
<blue>127</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="Text">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>120</red>
<green>120</green>
<blue>120</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="text">
<string>(Copy from Source File)</string>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Artist:</string>
</property>
</widget>
</item>
<item row="1" column="3">
<widget class="QLineEdit" name="lineEdit_2">
<property name="palette">
<palette>
<active>
<colorrole role="Text">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>85</red>
<green>85</green>
<blue>127</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="Text">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>85</red>
<green>85</green>
<blue>127</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="Text">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>120</red>
<green>120</green>
<blue>120</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="text">
<string>(Copy from Source File)</string>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="3">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Album:</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLineEdit" name="lineEdit_4">
<property name="palette">
<palette>
<active>
<colorrole role="Text">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>85</red>
<green>85</green>
<blue>127</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="Text">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>85</red>
<green>85</green>
<blue>127</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="Text">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>120</red>
<green>120</green>
<blue>120</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="text">
<string>(Copy from Source File)</string>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="4" column="3">
<widget class="QLineEdit" name="lineEdit_3">
<property name="palette">
<palette>
<active>
<colorrole role="Text">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>85</red>
<green>85</green>
<blue>127</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="Text">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>85</red>
<green>85</green>
<blue>127</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="Text">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>120</red>
<green>120</green>
<blue>120</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="text">
<string>(Copy from Source File)</string>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<string>Genre:</string>
</property>
</widget>
</item>
<item row="3" column="3">
<widget class="QLabel" name="label_6">
<property name="text">
<string>Year:</string>
</property>
</widget>
</item>
<item row="2" column="2">
<spacer name="verticalSpacer_5">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>4</width>
<height>2</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="1">
<widget class="QPushButton" name="pushButton">
<property name="maximumSize">
<size>
<width>32</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>...</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QPushButton" name="pushButton_2">
<property name="maximumSize">
<size>
<width>32</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>...</string>
</property>
</widget>
</item>
<item row="1" column="4">
<widget class="QPushButton" name="pushButton_3">
<property name="maximumSize">
<size>
<width>32</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>...</string>
</property>
</widget>
</item>
<item row="4" column="4">
<widget class="QPushButton" name="pushButton_4">
<property name="maximumSize">
<size>
<width>32</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>...</string>
</property>
</widget>
</item>
<item row="7" column="0">
<widget class="QLineEdit" name="lineEdit_5">
<property name="palette">
<palette>
<active>
<colorrole role="Text">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>85</red>
<green>85</green>
<blue>127</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="Text">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>85</red>
<green>85</green>
<blue>127</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="Text">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>120</red>
<green>120</green>
<blue>120</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="text">
<string>(Copy from Source File)</string>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QLabel" name="label_7">
<property name="text">
<string>Comment:</string>
</property>
</widget>
</item>
<item row="5" column="2">
<spacer name="verticalSpacer_6">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>4</width>
<height>2</height>
</size>
</property>
</spacer>
</item>
<item row="7" column="1">
<widget class="QPushButton" name="pushButton_5">
<property name="maximumSize">
<size>
<width>32</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>...</string>
</property>
</widget>
</item>
<item row="7" column="3">
<widget class="QLineEdit" name="lineEdit_6">
<property name="palette">
<palette>
<active>
<colorrole role="Text">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>85</red>
<green>85</green>
<blue>127</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="Text">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>85</red>
<green>85</green>
<blue>127</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="Text">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>120</red>
<green>120</green>
<blue>120</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="text">
<string>(Copy from Source File)</string>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="7" column="4">
<widget class="QPushButton" name="pushButton_6">
<property name="maximumSize">
<size>
<width>32</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>...</string>
</property>
</widget>
</item>
<item row="6" column="3">
<widget class="QLabel" name="label_8">
<property name="text">
<string>Position:</string>
</property>
</widget>
</item>
</layout>
<widget class="QLabel" name="labelEditMetaIcon">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="../res/Icons.qrc">:/icons/feed.png</pixmap>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="3" column="2">
<widget class="QPushButton" name="buttonClearMeta">
<property name="maximumSize">
<size>
<width>90</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>Reset</string>
</property>
<property name="icon">
<iconset resource="../res/Icons.qrc">
<normaloff>:/icons/bomb.png</normaloff>:/icons/bomb.png</iconset>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="1" column="0" rowspan="2" colspan="2">
<item row="1" column="1" rowspan="2" colspan="2">
<widget class="QGroupBox" name="groupBox">
<property name="font">
<font>
@ -847,7 +494,7 @@
<layout class="QGridLayout" name="gridLayout_11">
<item row="0" column="0">
<layout class="QGridLayout" name="gridLayout_10">
<item row="0" column="2">
<item row="0" column="1">
<widget class="QCheckBox" name="generatePlaylistCheckBox">
<property name="font">
<font>
@ -879,22 +526,6 @@
</property>
</widget>
</item>
<item row="0" column="1">
<spacer name="horizontalSpacer_7">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>4</width>
<height>2</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
@ -902,19 +533,6 @@
</item>
</layout>
</item>
<item row="3" column="0">
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<widget class="QWidget" name="tabCompressionSetting">
@ -1431,6 +1049,9 @@
<include location="../res/Images.qrc"/>
<include location="../res/Images.qrc"/>
<include location="../res/Images.qrc"/>
<include location="../res/Images.qrc"/>
<include location="../res/Icons.qrc"/>
<include location="../res/Images.qrc"/>
</resources>
<connections>
<connection>
@ -1500,7 +1121,7 @@
<connection>
<sender>sourceFileView</sender>
<signal>doubleClicked(QModelIndex)</signal>
<receiver>buttonEditMeta</receiver>
<receiver>buttonShowDetails</receiver>
<slot>click()</slot>
<hints>
<hint type="sourcelabel">
@ -1628,7 +1249,7 @@
<connection>
<sender>writeMetaDataCheckBox</sender>
<signal>clicked(bool)</signal>
<receiver>metaDataGroupBox</receiver>
<receiver>metaDataView</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
@ -1637,7 +1258,87 @@
</hint>
<hint type="destinationlabel">
<x>336</x>
<y>160</y>
<y>252</y>
</hint>
</hints>
</connection>
<connection>
<sender>writeMetaDataCheckBox</sender>
<signal>clicked(bool)</signal>
<receiver>buttonEditMeta</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>183</x>
<y>465</y>
</hint>
<hint type="destinationlabel">
<x>596</x>
<y>404</y>
</hint>
</hints>
</connection>
<connection>
<sender>writeMetaDataCheckBox</sender>
<signal>clicked(bool)</signal>
<receiver>labelEditMetaHint</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>183</x>
<y>465</y>
</hint>
<hint type="destinationlabel">
<x>299</x>
<y>404</y>
</hint>
</hints>
</connection>
<connection>
<sender>writeMetaDataCheckBox</sender>
<signal>clicked(bool)</signal>
<receiver>labelEditMetaIcon</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>183</x>
<y>465</y>
</hint>
<hint type="destinationlabel">
<x>39</x>
<y>404</y>
</hint>
</hints>
</connection>
<connection>
<sender>metaDataView</sender>
<signal>doubleClicked(QModelIndex)</signal>
<receiver>buttonEditMeta</receiver>
<slot>click()</slot>
<hints>
<hint type="sourcelabel">
<x>336</x>
<y>237</y>
</hint>
<hint type="destinationlabel">
<x>596</x>
<y>404</y>
</hint>
</hints>
</connection>
<connection>
<sender>writeMetaDataCheckBox</sender>
<signal>clicked(bool)</signal>
<receiver>buttonClearMeta</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>183</x>
<y>465</y>
</hint>
<hint type="destinationlabel">
<x>500</x>
<y>404</y>
</hint>
</hints>
</connection>

View File

@ -4,10 +4,10 @@
<file>MainIcon.ico</file>
<file>MainIcon.png</file>
<file>icons/add.png</file>
<file>icons/application_view_list.png</file>
<file>icons/arrow_down.png</file>
<file>icons/arrow_up.png</file>
<file>icons/bin.png</file>
<file>icons/application_view_list.png</file>
<file>icons/arrow_down.png</file>
<file>icons/arrow_up.png</file>
<file>icons/bin.png</file>
<file>icons/bomb.png</file>
<file>icons/calendar.png</file>
<file>icons/cancel.png</file>
@ -25,7 +25,7 @@
<file>icons/date.png</file>
<file>icons/delete.png</file>
<file>icons/door_out.png</file>
<file>icons/drive_cd.png</file>
<file>icons/drive_cd.png</file>
<file>icons/feed.png</file>
<file>icons/folder_add.png</file>
<file>icons/folder_go.png</file>
@ -46,5 +46,6 @@
<file>icons/transmit_blue.png</file>
<file>icons/user.png</file>
<file>icons/world.png</file>
<file>icons/zoom.png</file>
</qresource>
</RCC>

43
src/Config.h Normal file
View File

@ -0,0 +1,43 @@
///////////////////////////////////////////////////////////////////////////////
// LameXP - Audio Encoder Front-End
// Copyright (C) 2004-2010 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
///////////////////////////////////////////////////////////////////////////////
/*
* LameXP Version Info
*/
#define VER_LAMEXP_MAJOR 4
#define VER_LAMEXP_MINOR_HI 0
#define VER_LAMEXP_MINOR_LO 0
#define VER_LAMEXP_BUILD 10
#define VER_LAMEXP_SUFFIX TechPreview
/*
* Helper macros (aka: having fun with the C pre-processor)
*/
#define VER_LAMEXP_STR_HLP1(X) #X
#define VER_LAMEXP_STR_HLP2(V,W,X,Y,Z) VER_LAMEXP_STR_HLP1(v##V.W##X Z [Build Y])
#define VER_LAMEXP_STR_HLP3(V,W,X,Y,Z) VER_LAMEXP_STR_HLP2(V,W,X,Y,Z)
#define VER_LAMEXP_STR VER_LAMEXP_STR_HLP3(VER_LAMEXP_MAJOR,VER_LAMEXP_MINOR_HI,VER_LAMEXP_MINOR_LO,VER_LAMEXP_BUILD,VER_LAMEXP_SUFFIX)
#define VER_LAMEXP_SUFFIX_STR_HLP1(X) #X
#define VER_LAMEXP_SUFFIX_STR_HLP2(X) VER_LAMEXP_SUFFIX_STR_HLP1(X)
#define VER_LAMEXP_SUFFIX_STR VER_LAMEXP_SUFFIX_STR_HLP2(VER_LAMEXP_SUFFIX)
#define VER_LAMEXP_MINOR_HLP1(X,Y) X##Y
#define VER_LAMEXP_MINOR_HLP2(X,Y) VER_LAMEXP_MINOR_HLP1(X,Y)
#define VER_LAMEXP_MINOR VER_LAMEXP_MINOR_HLP2(VER_LAMEXP_MINOR_HI,VER_LAMEXP_MINOR_LO)

View File

@ -28,6 +28,7 @@
#include "Dialog_MetaInfo.h"
#include "Thread_FileAnalyzer.h"
#include "Thread_MessageHandler.h"
#include "Model_MetaInfo.h"
//Qt includes
#include <QMessageBox>
@ -47,7 +48,14 @@
//Win32 includes
#include <Windows.h>
//Helper macros
#define LINK(URL) QString("<a href=\"%1\">%2</a>").arg(URL).arg(URL)
#define ABORT_IF_BUSY \
if(m_banner->isVisible() || m_delayedFileTimer->isActive()) \
{ \
MessageBeep(MB_ICONEXCLAMATION); \
return; \
} \
////////////////////////////////////////////////////////////
// Constructor
@ -86,7 +94,7 @@ MainWindow::MainWindow(QWidget *parent)
connect(buttonClearFiles, SIGNAL(clicked()), this, SLOT(clearFilesButtonClicked()));
connect(buttonFileUp, SIGNAL(clicked()), this, SLOT(fileUpButtonClicked()));
connect(buttonFileDown, SIGNAL(clicked()), this, SLOT(fileDownButtonClicked()));
connect(buttonEditMeta, SIGNAL(clicked()), this, SLOT(editMetaButtonClicked()));
connect(buttonShowDetails, SIGNAL(clicked()), this, SLOT(showDetailsButtonClicked()));
//Setup "Output" tab
m_fileSystemModel = new QFileSystemModel();
@ -107,6 +115,17 @@ MainWindow::MainWindow(QWidget *parent)
connect(buttonGotoDesktop, SIGNAL(clicked()), this, SLOT(gotoDesktopButtonClicked()));
connect(buttonGotoMusic, SIGNAL(clicked()), this, SLOT(gotoMusicFolderButtonClicked()));
//Setup "Meta Data" tab
m_metaData = new AudioFileModel();
m_metaInfoModel = new MetaInfoModel(m_metaData, 6);
m_metaInfoModel->clearData();
metaDataView->setModel(m_metaInfoModel);
metaDataView->verticalHeader()->setResizeMode(QHeaderView::ResizeToContents);
metaDataView->verticalHeader()->hide();
metaDataView->horizontalHeader()->setResizeMode(QHeaderView::ResizeToContents);
connect(buttonEditMeta, SIGNAL(clicked()), this, SLOT(editMetaButtonClicked()));
connect(buttonClearMeta, SIGNAL(clicked()), this, SLOT(clearMetaButtonClicked()));
//Activate file menu actions
connect(actionOpenFolder, SIGNAL(triggered()), this, SLOT(openFolderActionActivated()));
@ -171,6 +190,10 @@ MainWindow::~MainWindow(void)
}
}
//Unset models
sourceFileView->setModel(NULL);
metaDataView->setModel(NULL);
//Free memory
LAMEXP_DELETE(m_tabActionGroup);
LAMEXP_DELETE(m_styleActionGroup);
@ -180,6 +203,8 @@ MainWindow::~MainWindow(void)
LAMEXP_DELETE(m_messageHandler);
LAMEXP_DELETE(m_delayedFileList);
LAMEXP_DELETE(m_delayedFileTimer);
LAMEXP_DELETE(m_metaData);
LAMEXP_DELETE(m_metaInfoModel);
}
////////////////////////////////////////////////////////////
@ -236,8 +261,9 @@ void MainWindow::windowShown(void)
*/
void MainWindow::aboutButtonClicked(void)
{
QString aboutText;
ABORT_IF_BUSY;
QString aboutText;
aboutText += "<h2>LameXP - Audio Encoder Front-end</h2>";
aboutText += QString("<b>Copyright (C) 2004-%1 LoRd_MuldeR &lt;MuldeR2@GMX.de&gt;. Some rights reserved.</b><br>").arg(max(lamexp_version_date().year(),QDate::currentDate().year()));
aboutText += QString().sprintf("<b>Version %d.%02d %s, Build %d [%s]</b><br><br>", lamexp_version_major(), lamexp_version_minor(), lamexp_version_release(), lamexp_version_build(), lamexp_version_date().toString(Qt::ISODate).toLatin1().constData());
@ -330,13 +356,7 @@ void MainWindow::aboutButtonClicked(void)
*/
void MainWindow::encodeButtonClicked(void)
{
if(m_delayedFileTimer->isActive())
{
MessageBeep(MB_ICONERROR);
return;
}
ABORT_IF_BUSY;
QMessageBox::warning(this, "LameXP", "Not implemented yet, please try again with a later version!");
}
@ -345,6 +365,8 @@ void MainWindow::encodeButtonClicked(void)
*/
void MainWindow::addFilesButtonClicked(void)
{
ABORT_IF_BUSY;
tabWidget->setCurrentIndex(0);
QStringList selectedFiles = QFileDialog::getOpenFileNames(this, "Add file(s)", QString(), "All supported files (*.*)");
@ -369,6 +391,8 @@ void MainWindow::addFilesButtonClicked(void)
*/
void MainWindow::openFolderActionActivated(void)
{
ABORT_IF_BUSY;
tabWidget->setCurrentIndex(0);
QString selectedFolder = QFileDialog::getExistingDirectory(this, "Add folder", QDesktopServices::storageLocation(QDesktopServices::MusicLocation));
@ -443,10 +467,12 @@ void MainWindow::fileDownButtonClicked(void)
}
/*
* Edit meta button
* Show details button
*/
void MainWindow::editMetaButtonClicked(void)
void MainWindow::showDetailsButtonClicked(void)
{
ABORT_IF_BUSY;
int iResult = 0;
MetaInfoDialog *metaInfoDialog = new MetaInfoDialog(this);
QModelIndex index = sourceFileView->currentIndex();
@ -574,6 +600,8 @@ void MainWindow::gotoMusicFolderButtonClicked(void)
*/
void MainWindow::makeFolderButtonClicked(void)
{
ABORT_IF_BUSY;
QDir basePath(m_fileSystemModel->filePath(outputFolderView->currentIndex()));
bool bApplied = true;
@ -614,6 +642,23 @@ void MainWindow::makeFolderButtonClicked(void)
}
}
/*
* Edit meta button clicked
*/
void MainWindow::editMetaButtonClicked(void)
{
ABORT_IF_BUSY;
m_metaInfoModel->editItem(metaDataView->currentIndex(), this);
}
/*
* Reset meta button clicked
*/
void MainWindow::clearMetaButtonClicked(void)
{
ABORT_IF_BUSY;
m_metaInfoModel->clearData();
}
/*
* Visit homepage action
@ -628,6 +673,8 @@ void MainWindow::visitHomepageActionActivated(void)
*/
void MainWindow::checkUpdatesActionActivated(void)
{
ABORT_IF_BUSY;
m_banner->show("Checking for updates, please be patient...");
for(int i = 0; i < 300; i++)

View File

@ -29,6 +29,8 @@
class QFileSystemModel;
class WorkingBanner;
class MessageHandlerThread;
class AudioFileModel;
class MetaInfoModel;
class MainWindow: public QMainWindow, private Ui::MainWindow
{
@ -47,7 +49,7 @@ private slots:
void removeFileButtonClicked(void);
void fileDownButtonClicked(void);
void fileUpButtonClicked(void);
void editMetaButtonClicked(void);
void showDetailsButtonClicked(void);
void tabPageChanged(int idx);
void tabActionActivated(QAction *action);
void styleActionActivated(QAction *action);
@ -62,6 +64,8 @@ private slots:
void notifyOtherInstance(void);
void addFileDelayed(const QString &filePath);
void handleDelayedFiles(void);
void editMetaButtonClicked(void);
void clearMetaButtonClicked(void);
protected:
void showEvent(QShowEvent *event);
@ -75,4 +79,6 @@ private:
MessageHandlerThread *m_messageHandler;
QStringList *m_delayedFileList;
QTimer *m_delayedFileTimer;
AudioFileModel *m_metaData;
MetaInfoModel *m_metaInfoModel;
};

View File

@ -25,8 +25,10 @@
#include <QMessageBox>
#include <QInputDialog>
#define CHECK1(STR) (STR.isEmpty() ? "(Unknown)" : STR)
#define CHECK2(VAL) ((VAL > 0) ? QString::number(VAL) : "(Unknown)")
#define MODEL_ROW_COUNT 12
#define CHECK1(STR) (STR.isEmpty() ? (m_offset ? "(Not Specified)" : "(Unknown)") : STR)
#define CHECK2(VAL) ((VAL > 0) ? QString::number(VAL) : (m_offset ? "(Not Specified)" : "(Unknown)"))
#define CHECK3(STR) (STR.isEmpty() ? Qt::darkGray : QVariant())
#define CHECK4(VAL) ((VAL == 0) ? Qt::darkGray : QVariant())
@ -34,9 +36,15 @@
// Constructor & Destructor
////////////////////////////////////////////////////////////
MetaInfoModel::MetaInfoModel(AudioFileModel *file)
MetaInfoModel::MetaInfoModel(AudioFileModel *file, unsigned int offset)
{
if(offset >= MODEL_ROW_COUNT)
{
throw "Offset is out of range!";
}
m_audioFile = file;
m_offset = offset;
}
MetaInfoModel::~MetaInfoModel(void)
@ -54,14 +62,14 @@ int MetaInfoModel::columnCount(const QModelIndex &parent) const
int MetaInfoModel::rowCount(const QModelIndex &parent) const
{
return 12;
return MODEL_ROW_COUNT - m_offset;
}
QVariant MetaInfoModel::data(const QModelIndex &index, int role) const
{
if(role == Qt::DisplayRole)
{
switch(index.row())
switch(index.row() + m_offset)
{
case 0:
return (!index.column()) ? "Full Path" : CHECK1(m_audioFile->filePath());
@ -94,7 +102,7 @@ QVariant MetaInfoModel::data(const QModelIndex &index, int role) const
return (!index.column()) ? "Year" : CHECK2(m_audioFile->fileYear());
break;
case 10:
return (!index.column()) ? "Position" : CHECK2(m_audioFile->filePosition());
return (!index.column()) ? "Position" : ((m_audioFile->filePosition() == UINT_MAX) ? "Generate from list position" : CHECK2(m_audioFile->filePosition()));
break;
case 11:
return (!index.column()) ? "Comment" : CHECK1(m_audioFile->fileComment());
@ -106,7 +114,7 @@ QVariant MetaInfoModel::data(const QModelIndex &index, int role) const
}
else if(role == Qt::DecorationRole && index.column() == 0)
{
switch(index.row())
switch(index.row() + m_offset)
{
case 0:
return QIcon(":/icons/folder_page.png");
@ -151,7 +159,7 @@ QVariant MetaInfoModel::data(const QModelIndex &index, int role) const
}
else if(role == Qt::TextColorRole && index.column() == 1)
{
switch(index.row())
switch(index.row() + m_offset)
{
case 0:
return CHECK3(m_audioFile->filePath());
@ -237,7 +245,7 @@ void MetaInfoModel::editItem(const QModelIndex &index, QWidget *parent)
QStringList generes("(Unspecified)");
QString temp;
switch(index.row())
switch(index.row() + m_offset)
{
case 5:
temp = QInputDialog::getText(parent, "Edit Title", "Please enter the title for this file:", QLineEdit::Normal, m_audioFile->fileName(), &ok).simplified();
@ -286,12 +294,28 @@ void MetaInfoModel::editItem(const QModelIndex &index, QWidget *parent)
}
break;
case 10:
val = QInputDialog::getInt(parent, "Edit Position", "Please enter the position (track no.) for this file:", (m_audioFile->filePosition() ? m_audioFile->filePosition() : 1), 0, 99, 1, &ok);
if(ok)
if(!m_offset)
{
beginResetModel();
m_audioFile->setFilePosition(val);
endResetModel();
val = QInputDialog::getInt(parent, "Edit Position", "Please enter the position (track no.) for this file:", (m_audioFile->filePosition() ? m_audioFile->filePosition() : 1), 0, 99, 1, &ok);
if(ok)
{
beginResetModel();
m_audioFile->setFilePosition(val);
endResetModel();
}
}
else
{
QStringList options;
options << "Unspecified (copy from source file)";
options << "Generate from list position";
temp = QInputDialog::getItem(parent, "Edit Position", "Please enter the position (track no.) for this file:", options, ((m_audioFile->filePosition() == UINT_MAX) ? 1 : 0), false, &ok);
if(ok)
{
beginResetModel();
m_audioFile->setFilePosition((options.indexOf(temp) == 1) ? UINT_MAX : 0);
endResetModel();
}
}
break;
case 11:
@ -309,6 +333,31 @@ void MetaInfoModel::editItem(const QModelIndex &index, QWidget *parent)
}
}
void MetaInfoModel::clearData(void)
{
beginResetModel();
m_audioFile->setFilePath(QString());
m_audioFile->setFileName(QString());
m_audioFile->setFileArtist(QString());
m_audioFile->setFileAlbum(QString());
m_audioFile->setFileGenre(QString());
m_audioFile->setFileComment("Encoded with LameXP");
m_audioFile->setFileYear(0);
m_audioFile->setFilePosition(UINT_MAX);
m_audioFile->setFileDuration(0);
m_audioFile->setFormatContainerType(QString());
m_audioFile->setFormatContainerProfile(QString());
m_audioFile->setFormatAudioType(QString());
m_audioFile->setFormatAudioProfile(QString());
m_audioFile->setFormatAudioVersion(QString());
m_audioFile->setFormatAudioSamplerate(0);
m_audioFile->setFormatAudioChannels(0);
m_audioFile->setFormatAudioBitdepth(0);
endResetModel();
}
Qt::ItemFlags MetaInfoModel::flags(const QModelIndex &index) const
{
return QAbstractTableModel::flags(index);

View File

@ -31,7 +31,7 @@ class MetaInfoModel : public QAbstractTableModel
Q_OBJECT
public:
MetaInfoModel(AudioFileModel *file);
MetaInfoModel(AudioFileModel *file, unsigned int offset = 0);
~MetaInfoModel(void);
//Model functions
@ -41,7 +41,9 @@ public:
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
Qt::ItemFlags flags(const QModelIndex &index) const;
void editItem(const QModelIndex &index, QWidget *parent);
void clearData(void);
private:
AudioFileModel* m_audioFile;
unsigned int m_offset;
};

View File

@ -19,14 +19,7 @@
// http://www.gnu.org/licenses/gpl-2.0.txt
///////////////////////////////////////////////////////////////////////////////
/*
* LameXP Version Info
*/
#define VER_LAMEXP_MAJOR 4
#define VER_LAMEXP_MINOR_HI 0
#define VER_LAMEXP_MINOR_LO 0
#define VER_LAMEXP_BUILD 9
#define VER_LAMEXP_SUFFIX TechPreview
#include "Config.h"
/*
* Resource ID's
@ -45,17 +38,3 @@
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif
/*
* Helper macros (having fun with the C pre-processor)
*/
#define VER_LAMEXP_STR_HLP1(X) #X
#define VER_LAMEXP_STR_HLP2(V,W,X,Y,Z) VER_LAMEXP_STR_HLP1(v##V.W##X Z [Build Y])
#define VER_LAMEXP_STR_HLP3(V,W,X,Y,Z) VER_LAMEXP_STR_HLP2(V,W,X,Y,Z)
#define VER_LAMEXP_STR VER_LAMEXP_STR_HLP3(VER_LAMEXP_MAJOR,VER_LAMEXP_MINOR_HI,VER_LAMEXP_MINOR_LO,VER_LAMEXP_BUILD,VER_LAMEXP_SUFFIX)
#define VER_LAMEXP_SUFFIX_STR_HLP1(X) #X
#define VER_LAMEXP_SUFFIX_STR_HLP2(X) VER_LAMEXP_SUFFIX_STR_HLP1(X)
#define VER_LAMEXP_SUFFIX_STR VER_LAMEXP_SUFFIX_STR_HLP2(VER_LAMEXP_SUFFIX)
#define VER_LAMEXP_MINOR_HLP1(X,Y) X##Y
#define VER_LAMEXP_MINOR_HLP2(X,Y) VER_LAMEXP_MINOR_HLP1(X,Y)
#define VER_LAMEXP_MINOR VER_LAMEXP_MINOR_HLP2(VER_LAMEXP_MINOR_HI,VER_LAMEXP_MINOR_LO)