Save the "Position" field on the "Meta Data" tab.

This commit is contained in:
LoRd_MuldeR 2011-02-10 16:08:03 +01:00
parent cfb20fe3cb
commit 476265df3a
11 changed files with 219 additions and 38 deletions

View File

@ -311,6 +311,12 @@ RUN\DOS\RUN
<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>
</widget>
</item>
<item row="1" column="2">
@ -328,6 +334,12 @@ RUN\DOS\RUN
<iconset resource="../res/Icons.qrc">
<normaloff>:/icons/disk.png</normaloff>:/icons/disk.png</iconset>
</property>
<property name="iconSize">
<size>
<width>16</width>
<height>16</height>
</size>
</property>
</widget>
</item>
<item row="1" column="0">
@ -358,6 +370,12 @@ RUN\DOS\RUN
<iconset resource="../res/Icons.qrc">
<normaloff>:/icons/paste_plain.png</normaloff>:/icons/paste_plain.png</iconset>
</property>
<property name="iconSize">
<size>
<width>16</width>
<height>16</height>
</size>
</property>
</widget>
</item>
</layout>
@ -373,6 +391,7 @@ RUN\DOS\RUN
<include location="../res/Images.qrc"/>
<include location="../res/Images.qrc"/>
<include location="../res/Images.qrc"/>
<include location="../res/Images.qrc"/>
</resources>
<connections>
<connection>

View File

@ -213,6 +213,12 @@
<iconset resource="../res/Icons.qrc">
<normaloff>:/icons/arrow_up.png</normaloff>:/icons/arrow_up.png</iconset>
</property>
<property name="iconSize">
<size>
<width>16</width>
<height>16</height>
</size>
</property>
<property name="autoDefault">
<bool>false</bool>
</property>
@ -227,6 +233,12 @@
<iconset resource="../res/Icons.qrc">
<normaloff>:/icons/arrow_down.png</normaloff>:/icons/arrow_down.png</iconset>
</property>
<property name="iconSize">
<size>
<width>16</width>
<height>16</height>
</size>
</property>
<property name="autoDefault">
<bool>false</bool>
</property>
@ -263,6 +275,12 @@
<iconset resource="../res/Icons.qrc">
<normaloff>:/icons/table_edit.png</normaloff>:/icons/table_edit.png</iconset>
</property>
<property name="iconSize">
<size>
<width>16</width>
<height>16</height>
</size>
</property>
<property name="autoDefault">
<bool>false</bool>
</property>
@ -283,6 +301,12 @@
<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>
@ -319,6 +343,7 @@
<include location="../res/Images.qrc"/>
<include location="../res/Images.qrc"/>
<include location="../res/Images.qrc"/>
<include location="../res/Images.qrc"/>
</resources>
<connections>
<connection>

View File

@ -390,6 +390,12 @@
<iconset resource="../res/Icons.qrc">
<normaloff>:/icons/cancel.png</normaloff>:/icons/cancel.png</iconset>
</property>
<property name="iconSize">
<size>
<width>16</width>
<height>16</height>
</size>
</property>
</widget>
</item>
<item>
@ -407,6 +413,12 @@
<iconset resource="../res/Icons.qrc">
<normaloff>:/icons/accept.png</normaloff>:/icons/accept.png</iconset>
</property>
<property name="iconSize">
<size>
<width>16</width>
<height>16</height>
</size>
</property>
</widget>
</item>
</layout>
@ -438,6 +450,8 @@
<include location="../res/Images.qrc"/>
<include location="../res/Icons.qrc"/>
<include location="../res/Images.qrc"/>
<include location="../res/Icons.qrc"/>
<include location="../res/Images.qrc"/>
</resources>
<connections>
<connection>

View File

@ -374,6 +374,12 @@
<iconset resource="../res/Icons.qrc">
<normaloff>:/icons/arrow_refresh.png</normaloff>:/icons/arrow_refresh.png</iconset>
</property>
<property name="iconSize">
<size>
<width>16</width>
<height>16</height>
</size>
</property>
</widget>
</item>
<item>
@ -391,6 +397,12 @@
<iconset resource="../res/Icons.qrc">
<normaloff>:/icons/application_view_list.png</normaloff>:/icons/application_view_list.png</iconset>
</property>
<property name="iconSize">
<size>
<width>16</width>
<height>16</height>
</size>
</property>
</widget>
</item>
<item>
@ -473,6 +485,12 @@
<iconset resource="../res/Icons.qrc">
<normaloff>:/icons/accept.png</normaloff>:/icons/accept.png</iconset>
</property>
<property name="iconSize">
<size>
<width>16</width>
<height>16</height>
</size>
</property>
</widget>
</item>
<item>
@ -490,6 +508,12 @@
<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>
</widget>
</item>
</layout>
@ -559,6 +583,8 @@
<include location="../res/Images.qrc"/>
<include location="../res/Icons.qrc"/>
<include location="../res/Images.qrc"/>
<include location="../res/Icons.qrc"/>
<include location="../res/Images.qrc"/>
</resources>
<connections>
<connection>

View File

@ -25,7 +25,7 @@
#define VER_LAMEXP_MAJOR 4
#define VER_LAMEXP_MINOR_HI 0
#define VER_LAMEXP_MINOR_LO 0
#define VER_LAMEXP_BUILD 300
#define VER_LAMEXP_BUILD 302
#define VER_LAMEXP_SUFFIX Beta-4
/*

View File

@ -104,16 +104,19 @@ AboutDialog::AboutDialog(SettingsModel *settings, QWidget *parent, bool firstSta
{
QPushButton *firstButton = addButton(tr("Show License Text"), QMessageBox::AcceptRole);
firstButton->setIcon(QIcon(":/icons/script.png"));
firstButton->setIconSize(QSize(16, 16));
firstButton->setMinimumWidth(135);
firstButton->disconnect();
connect(firstButton, SIGNAL(clicked()), this, SLOT(openLicenseText()));
QPushButton *secondButton = addButton(tr("Accept License"), QMessageBox::AcceptRole);
secondButton->setIcon(QIcon(":/icons/accept.png"));
secondButton->setIconSize(QSize(16, 16));
secondButton->setMinimumWidth(120);
QPushButton *thirdButton = addButton(tr("Decline License"), QMessageBox::AcceptRole);
thirdButton->setIcon(QIcon(":/icons/delete.png"));
thirdButton->setIconSize(QSize(16, 16));
thirdButton->setMinimumWidth(120);
thirdButton->setEnabled(false);
}
@ -121,24 +124,28 @@ AboutDialog::AboutDialog(SettingsModel *settings, QWidget *parent, bool firstSta
{
QPushButton *firstButton = addButton(tr("3rd Party S/W"), QMessageBox::AcceptRole);
firstButton->setIcon(QIcon(":/icons/page_white_cplusplus.png"));
firstButton->setIconSize(QSize(16, 16));
firstButton->setMinimumWidth(120);
firstButton->disconnect();
connect(firstButton, SIGNAL(clicked()), this, SLOT(showMoreAbout()));
QPushButton *secondButton = addButton(tr("Contributors"), QMessageBox::AcceptRole);
secondButton->setIcon(QIcon(":icons/user_suit.png"));
secondButton->setIconSize(QSize(16, 16));
secondButton->setMinimumWidth(120);
secondButton->disconnect();
connect(secondButton, SIGNAL(clicked()), this, SLOT(showAboutContributors()));
QPushButton *thirdButton = addButton(tr("About Qt4"), QMessageBox::AcceptRole);
thirdButton->setIcon(QIcon(":/images/Qt.svg"));
thirdButton->setIconSize(QSize(16, 16));
thirdButton->setMinimumWidth(120);
thirdButton->disconnect();
connect(thirdButton, SIGNAL(clicked()), this, SLOT(showAboutQt()));
QPushButton *fourthButton = addButton(tr("Discard"), QMessageBox::AcceptRole);
fourthButton->setIcon(QIcon(":/icons/cross.png"));
fourthButton->setIconSize(QSize(16, 16));
fourthButton->setMinimumWidth(90);
}

View File

@ -168,6 +168,7 @@ MainWindow::MainWindow(FileListModel *fileListModel, AudioFileModel *metaInfo, S
//Setup "Meta Data" tab
m_metaInfoModel = new MetaInfoModel(m_metaData, 6);
m_metaInfoModel->clearData();
m_metaInfoModel->setData(m_metaInfoModel->index(4, 1), m_settings->metaInfoPosition());
metaDataView->setModel(m_metaInfoModel);
metaDataView->verticalHeader()->setResizeMode(QHeaderView::ResizeToContents);
metaDataView->verticalHeader()->hide();
@ -574,6 +575,7 @@ void MainWindow::changeEvent(QEvent *e)
//Force GUI update
m_metaInfoModel->clearData();
m_metaInfoModel->setData(m_metaInfoModel->index(4, 1), m_settings->metaInfoPosition());
updateEncoder(m_settings->compressionEncoder());
updateLameAlgoQuality(sliderLameAlgoQuality->value());
@ -1406,7 +1408,14 @@ void MainWindow::makeFolderButtonClicked(void)
void MainWindow::editMetaButtonClicked(void)
{
ABORT_IF_BUSY;
m_metaInfoModel->editItem(metaDataView->currentIndex(), this);
const QModelIndex index = metaDataView->currentIndex();
m_metaInfoModel->editItem(index, this);
if(index.row() == 4)
{
m_settings->metaInfoPosition(m_metaData->filePosition());
}
}
/*

View File

@ -244,6 +244,56 @@ QVariant MetaInfoModel::headerData(int section, Qt::Orientation orientation, int
}
}
bool MetaInfoModel::setData (const QModelIndex &index, const QVariant &value, int role)
{
if((role != Qt::EditRole) || (index.column() != 1) || !value.isValid())
{
return false;
}
switch(index.row() + m_offset)
{
case 0:
m_audioFile->setFilePath(value.toString());
break;
case 1:
case 2:
case 3:
return false;
break;
case 4:
m_audioFile->setFileDuration(value.toUInt());
break;
case 5:
m_audioFile->setFileName(value.toString());
break;
case 6:
m_audioFile->setFileArtist(value.toString());
break;
case 7:
m_audioFile->setFileAlbum(value.toString());
break;
case 8:
m_audioFile->setFileGenre(value.toString());
break;
case 9:
m_audioFile->setFileYear(value.toUInt());
break;
case 10:
m_audioFile->setFilePosition(value.toUInt());
break;
case 11:
m_audioFile->setFileComment(value.toString());
break;
default:
return false;
break;
}
emit dataChanged(index, index);
return true;
}
void MetaInfoModel::editItem(const QModelIndex &index, QWidget *parent)
{
bool ok = false;

View File

@ -39,6 +39,7 @@ public:
int rowCount(const QModelIndex &parent = QModelIndex()) const;
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
bool setData (const QModelIndex &index, const QVariant &value, int role = Qt::EditRole);
Qt::ItemFlags flags(const QModelIndex &index) const;
void editItem(const QModelIndex &index, QWidget *parent);
void clearData(void);

View File

@ -32,44 +32,11 @@
#include <QStringList>
#include <QLocale>
//Constants
static const char *g_settingsId_versionNumber = "VersionNumber";
static const char *g_settingsId_licenseAccepted = "LicenseAccepted";
static const char *g_settingsId_interfaceStyle = "InterfaceStyle";
static const char *g_settingsId_compressionEncoder = "Compression/Encoder";
static const char *g_settingsId_compressionRCMode = "Compression/RCMode";
static const char *g_settingsId_compressionBitrate = "Compression/Bitrate";
static const char *g_settingsId_outputDir = "OutputDirectory/SelectedPath";
static const char *g_settingsId_outputToSourceDir = "OutputDirectory/OutputToSourceFolder";
static const char *g_settingsId_prependRelativeSourcePath = "OutputDirectory/PrependRelativeSourcePath";
static const char *g_settingsId_writeMetaTags = "Flags/WriteMetaTags";
static const char *g_settingsId_createPlaylist = "Flags/AutoCreatePlaylist";
static const char *g_settingsId_autoUpdateLastCheck = "AutoUpdate/LastCheck";
static const char *g_settingsId_autoUpdateEnabled = "AutoUpdate/Enabled";
static const char *g_settingsId_soundsEnabled = "Flags/EnableSounds";
static const char *g_settingsId_neroAacNotificationsEnabled = "Flags/EnableNeroAacNotifications";
static const char *g_settingsId_wmaDecoderNotificationsEnabled = "Flags/EnableWmaDecoderNotifications";
static const char *g_settingsId_dropBoxWidgetEnabled = "Flags/EnableDropBoxWidget";
static const char *g_settingsId_shellIntegrationEnabled = "Flags/EnableShellIntegration";
static const char *g_settingsId_currentLanguage = "Localization/Language";
static const char *g_settingsId_lameAlgoQuality = "AdvancedOptions/LAME/AlgorithmQuality";
static const char *g_settingsId_lameChannelMode = "AdvancedOptions/LAME/ChannelMode";
static const char *g_settingsId_bitrateManagementEnabled = "AdvancedOptions/BitrateManagement/Enabled";
static const char *g_settingsId_bitrateManagementMinRate = "AdvancedOptions/BitrateManagement/MinRate";
static const char *g_settingsId_bitrateManagementMaxRate = "AdvancedOptions/BitrateManagement/MaxRate";
static const char *g_settingsId_samplingRate = "AdvancedOptions/Common/Resampling";
static const char *g_settingsId_neroAACEnable2Pass = "AdvancedOptions/NeroAAC/Enable2Pass";
static const char *g_settingsId_neroAACProfile = "AdvancedOptions/NeroAAC/ForceProfile";
static const char *g_settingsId_normalizationFilterEnabled = "AdvancedOptions/VolumeNormalization/Enabled";
static const char *g_settingsId_normalizationFilterMaxVolume = "AdvancedOptions/VolumeNormalization/MaxVolume";
static const char *g_settingsId_toneAdjustBass = "AdvancedOptions/ToneAdjustment/Bass";
static const char *g_settingsId_toneAdjustTreble = "AdvancedOptions/ToneAdjustment/Treble";
static const char *g_settingsId_customParametersLAME = "AdvancedOptions/CustomParameters/LAME";
static const char *g_settingsId_customParametersOggEnc = "AdvancedOptions/CustomParameters/OggEnc";
static const char *g_settingsId_customParametersNeroAAC = "AdvancedOptions/CustomParameters/NeroAAC";
static const char *g_settingsId_customParametersFLAC = "AdvancedOptions/CustomParameters/FLAC";
////////////////////////////////////////////////////////////
//Macros
////////////////////////////////////////////////////////////
#define MAKE_OPTION1(OPT,DEF) \
int SettingsModel::OPT(void) { return m_settings->value(g_settingsId_##OPT, DEF).toInt(); } \
void SettingsModel::OPT(int value) { m_settings->setValue(g_settingsId_##OPT, value); } \
@ -85,6 +52,55 @@ bool SettingsModel::OPT(void) { return m_settings->value(g_settingsId_##OPT, DEF
void SettingsModel::OPT(bool value) { m_settings->setValue(g_settingsId_##OPT, value); } \
bool SettingsModel::OPT##Default(void) { return DEF; }
#define MAKE_OPTION4(OPT,DEF) \
unsigned int SettingsModel::OPT(void) { return m_settings->value(g_settingsId_##OPT, DEF).toUInt(); } \
void SettingsModel::OPT(unsigned int value) { m_settings->setValue(g_settingsId_##OPT, value); } \
unsigned int SettingsModel::OPT##Default(void) { return DEF; }
#define MAKE_ID(DEC,STR) static const char *g_settingsId_##DEC = STR
////////////////////////////////////////////////////////////
//Constants
////////////////////////////////////////////////////////////
//Setting ID's
MAKE_ID(versionNumber, "VersionNumber");
MAKE_ID(licenseAccepted, "LicenseAccepted");
MAKE_ID(interfaceStyle, "InterfaceStyle");
MAKE_ID(compressionEncoder, "Compression/Encoder");
MAKE_ID(compressionRCMode, "Compression/RCMode");
MAKE_ID(compressionBitrate, "Compression/Bitrate");
MAKE_ID(outputDir, "OutputDirectory/SelectedPath");
MAKE_ID(outputToSourceDir, "OutputDirectory/OutputToSourceFolder");
MAKE_ID(prependRelativeSourcePath, "OutputDirectory/PrependRelativeSourcePath");
MAKE_ID(writeMetaTags, "Flags/WriteMetaTags");
MAKE_ID(createPlaylist, "Flags/AutoCreatePlaylist");
MAKE_ID(autoUpdateLastCheck, "AutoUpdate/LastCheck");
MAKE_ID(autoUpdateEnabled, "AutoUpdate/Enabled");
MAKE_ID(soundsEnabled, "Flags/EnableSounds");
MAKE_ID(neroAacNotificationsEnabled, "Flags/EnableNeroAacNotifications");
MAKE_ID(wmaDecoderNotificationsEnabled, "Flags/EnableWmaDecoderNotifications");
MAKE_ID(dropBoxWidgetEnabled, "Flags/EnableDropBoxWidget");
MAKE_ID(shellIntegrationEnabled, "Flags/EnableShellIntegration");
MAKE_ID(currentLanguage, "Localization/Language");
MAKE_ID(lameAlgoQuality, "AdvancedOptions/LAME/AlgorithmQuality");
MAKE_ID(lameChannelMode, "AdvancedOptions/LAME/ChannelMode");
MAKE_ID(bitrateManagementEnabled, "AdvancedOptions/BitrateManagement/Enabled");
MAKE_ID(bitrateManagementMinRate, "AdvancedOptions/BitrateManagement/MinRate");
MAKE_ID(bitrateManagementMaxRate, "AdvancedOptions/BitrateManagement/MaxRate");
MAKE_ID(samplingRate, "AdvancedOptions/Common/Resampling");
MAKE_ID(neroAACEnable2Pass, "AdvancedOptions/NeroAAC/Enable2Pass");
MAKE_ID(neroAACProfile, "AdvancedOptions/NeroAAC/ForceProfile");
MAKE_ID(normalizationFilterEnabled, "AdvancedOptions/VolumeNormalization/Enabled");
MAKE_ID(normalizationFilterMaxVolume, "AdvancedOptions/VolumeNormalization/MaxVolume");
MAKE_ID(toneAdjustBass, "AdvancedOptions/ToneAdjustment/Bass");
MAKE_ID(toneAdjustTreble, "AdvancedOptions/ToneAdjustment/Treble");
MAKE_ID(customParametersLAME, "AdvancedOptions/CustomParameters/LAME");
MAKE_ID(customParametersOggEnc, "AdvancedOptions/CustomParameters/OggEnc");
MAKE_ID(customParametersNeroAAC, "AdvancedOptions/CustomParameters/NeroAAC");
MAKE_ID(customParametersFLAC, "AdvancedOptions/CustomParameters/FLAC");
MAKE_ID(metaInfoPosition, "MetaInformation/PlaylistPosition");
//LUT
const int SettingsModel::mp3Bitrates[15] = {32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, -1};
const int SettingsModel::samplingRates[8] = {0, 16000, 22050, 24000, 32000, 44100, 48000, -1};
@ -241,3 +257,4 @@ MAKE_OPTION2(customParametersLAME, QString());
MAKE_OPTION2(customParametersOggEnc, QString());
MAKE_OPTION2(customParametersNeroAAC, QString());
MAKE_OPTION2(customParametersFLAC, QString());
MAKE_OPTION4(metaInfoPosition, UINT_MAX);

View File

@ -24,6 +24,8 @@
class QSettings;
class QString;
///////////////////////////////////////////////////////////////////////////////
#define MAKE_OPTION_DEC1(OPT) \
int OPT(void); \
void OPT(int value); \
@ -39,6 +41,13 @@ bool OPT(void); \
void OPT(bool value); \
bool OPT##Default(void);
#define MAKE_OPTION_DEC4(OPT) \
unsigned int OPT(void); \
void OPT(unsigned int value); \
unsigned int OPT##Default(void);
///////////////////////////////////////////////////////////////////////////////
class SettingsModel
{
public:
@ -100,6 +109,7 @@ public:
MAKE_OPTION_DEC2(customParametersOggEnc);
MAKE_OPTION_DEC2(customParametersNeroAAC);
MAKE_OPTION_DEC2(customParametersFLAC);
MAKE_OPTION_DEC4(metaInfoPosition);
//Misc
void validate(void);
@ -110,6 +120,9 @@ private:
QString defaultLanguage(void);
};
///////////////////////////////////////////////////////////////////////////////
#undef MAKE_OPTION_DEC1
#undef MAKE_OPTION_DEC2
#undef MAKE_OPTION_DEC3
#undef MAKE_OPTION_DEC4