Initial support for bitrate management (under "Advanced Options").

This commit is contained in:
LoRd_MuldeR 2011-01-21 21:41:50 +01:00
parent 476edebda8
commit 41d040e7aa
6 changed files with 302 additions and 24 deletions

View File

@ -985,7 +985,7 @@
<layout class="QGridLayout" name="gridLayout_17">
<item row="0" column="1">
<layout class="QGridLayout" name="gridLayout_16">
<item row="1" column="1" colspan="3">
<item row="7" column="1" colspan="3">
<widget class="QSlider" name="sliderLameAlgoQuality">
<property name="maximum">
<number>4</number>
@ -993,6 +993,9 @@
<property name="pageStep">
<number>1</number>
</property>
<property name="value">
<number>3</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
@ -1004,7 +1007,7 @@
</property>
</widget>
</item>
<item row="1" column="0">
<item row="7" column="0">
<spacer name="horizontalSpacer_12">
<property name="orientation">
<enum>Qt::Horizontal</enum>
@ -1020,7 +1023,7 @@
</property>
</spacer>
</item>
<item row="1" column="4">
<item row="7" column="4">
<spacer name="horizontalSpacer_13">
<property name="orientation">
<enum>Qt::Horizontal</enum>
@ -1036,30 +1039,14 @@
</property>
</spacer>
</item>
<item row="0" column="1">
<spacer name="verticalSpacer_4">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>8</height>
</size>
</property>
</spacer>
</item>
<item row="2" column="1">
<item row="8" column="1">
<widget class="QLabel" name="label">
<property name="text">
<string>Faster Processing</string>
</property>
</widget>
</item>
<item row="2" column="2">
<item row="8" column="2">
<widget class="QLabel" name="labelLameAlgoQuality">
<property name="font">
<font>
@ -1075,7 +1062,7 @@
</property>
</widget>
</item>
<item row="2" column="3">
<item row="8" column="3">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Better quality</string>
@ -1085,27 +1072,191 @@
</property>
</widget>
</item>
<item row="6" column="1" colspan="3">
<spacer name="verticalSpacer_4">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>8</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</widget>
</item>
</layout>
</item>
<item row="2" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="0">
<widget class="QGroupBox" name="groupBox_6">
<property name="font">
<font>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
<property name="title">
<string> Bitrate Management </string>
</property>
<layout class="QGridLayout" name="gridLayout_19">
<item row="0" column="0">
<layout class="QGridLayout" name="gridLayout_18">
<item row="0" column="1" colspan="5">
<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>20</width>
<height>10</height>
</size>
</property>
</spacer>
</item>
<item row="2" column="1" colspan="5">
<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>20</width>
<height>10</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="1">
<widget class="QCheckBox" name="checkBoxBitrateManagement">
<property name="text">
<string>Enable Bitrate Management</string>
</property>
</widget>
</item>
<item row="1" column="5">
<widget class="QSpinBox" name="spinBoxBitrateManagementMax">
<property name="enabled">
<bool>false</bool>
</property>
<property name="minimum">
<number>32</number>
</property>
<property name="maximum">
<number>500</number>
</property>
<property name="value">
<number>500</number>
</property>
</widget>
</item>
<item row="1" column="3">
<widget class="QSpinBox" name="spinBoxBitrateManagementMin">
<property name="enabled">
<bool>false</bool>
</property>
<property name="minimum">
<number>32</number>
</property>
<property name="maximum">
<number>500</number>
</property>
</widget>
</item>
<item row="1" column="6">
<spacer name="horizontalSpacer_15">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>8</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="0">
<spacer name="horizontalSpacer_14">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>8</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="2">
<widget class="QLabel" name="labelBitrateManagementMin">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Minimum (kbps):</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="1" column="4">
<widget class="QLabel" name="labelBitrateManagementMax">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Maximum (kbps):</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
</layout>
</item>
<item row="1" column="0">
<spacer name="verticalSpacer">
<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>
</item>
@ -1546,6 +1697,9 @@
<include location="../res/Images.qrc"/>
<include location="../res/Icons.qrc"/>
<include location="../res/Images.qrc"/>
<include location="../res/Icons.qrc"/>
<include location="../res/Icons.qrc"/>
<include location="../res/Icons.qrc"/>
</resources>
<connections>
<connection>
@ -1852,5 +2006,69 @@
</hint>
</hints>
</connection>
<connection>
<sender>checkBoxBitrateManagement</sender>
<signal>clicked(bool)</signal>
<receiver>labelBitrateManagementMin</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>123</x>
<y>214</y>
</hint>
<hint type="destinationlabel">
<x>256</x>
<y>214</y>
</hint>
</hints>
</connection>
<connection>
<sender>checkBoxBitrateManagement</sender>
<signal>clicked(bool)</signal>
<receiver>labelBitrateManagementMax</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>123</x>
<y>214</y>
</hint>
<hint type="destinationlabel">
<x>465</x>
<y>214</y>
</hint>
</hints>
</connection>
<connection>
<sender>checkBoxBitrateManagement</sender>
<signal>clicked(bool)</signal>
<receiver>spinBoxBitrateManagementMin</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>123</x>
<y>214</y>
</hint>
<hint type="destinationlabel">
<x>360</x>
<y>214</y>
</hint>
</hints>
</connection>
<connection>
<sender>checkBoxBitrateManagement</sender>
<signal>clicked(bool)</signal>
<receiver>spinBoxBitrateManagementMax</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>123</x>
<y>214</y>
</hint>
<hint type="destinationlabel">
<x>569</x>
<y>214</y>
</hint>
</hints>
</connection>
</connections>
</ui>

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 243
#define VER_LAMEXP_BUILD 245
#define VER_LAMEXP_SUFFIX Beta-1
/*

View File

@ -214,7 +214,13 @@ MainWindow::MainWindow(FileListModel *fileListModel, AudioFileModel *metaInfo, S
//Setup "Advanced Options" tab
sliderLameAlgoQuality->setValue(m_settings->lameAlgoQuality());
spinBoxBitrateManagementMin->setValue(m_settings->bitrateManagementMinRate());
spinBoxBitrateManagementMax->setValue(m_settings->bitrateManagementMaxRate());
while(checkBoxBitrateManagement->isChecked() != m_settings->bitrateManagementEnabled()) checkBoxBitrateManagement->click();
connect(sliderLameAlgoQuality, SIGNAL(valueChanged(int)), this, SLOT(updateLameAlgoQuality(int)));
connect(checkBoxBitrateManagement, SIGNAL(clicked(bool)), this, SLOT(bitrateManagementEnabledChanged(bool)));
connect(spinBoxBitrateManagementMin, SIGNAL(valueChanged(int)), this, SLOT(bitrateManagementMinChanged(int)));
connect(spinBoxBitrateManagementMax, SIGNAL(valueChanged(int)), this, SLOT(bitrateManagementMaxChanged(int)));
updateLameAlgoQuality(sliderLameAlgoQuality->value());
//Activate file menu actions
@ -1587,6 +1593,47 @@ void MainWindow::updateLameAlgoQuality(int value)
}
}
/*
* Bitrate management endabled/disabled
*/
void MainWindow::bitrateManagementEnabledChanged(bool checked)
{
m_settings->bitrateManagementEnabled(checked);
}
/*
* Minimum bitrate has changed
*/
void MainWindow::bitrateManagementMinChanged(int value)
{
if(value > spinBoxBitrateManagementMax->value())
{
spinBoxBitrateManagementMin->setValue(spinBoxBitrateManagementMax->value());
m_settings->bitrateManagementMinRate(spinBoxBitrateManagementMax->value());
}
else
{
m_settings->bitrateManagementMinRate(value);
}
}
/*
* Maximum bitrate has changed
*/
void MainWindow::bitrateManagementMaxChanged(int value)
{
if(value < spinBoxBitrateManagementMin->value())
{
spinBoxBitrateManagementMax->setValue(spinBoxBitrateManagementMin->value());
m_settings->bitrateManagementMaxRate(spinBoxBitrateManagementMin->value());
}
else
{
m_settings->bitrateManagementMaxRate(value);
}
}
/*
* Model reset
*/

View File

@ -80,6 +80,9 @@ private slots:
void updateRCMode(int id);
void updateBitrate(int value);
void updateLameAlgoQuality(int value);
void bitrateManagementEnabledChanged(bool checked);
void bitrateManagementMinChanged(int value);
void bitrateManagementMaxChanged(int value);
void sourceModelChanged(void);
void metaTagsEnabledChanged(void);
void playlistEnabledChanged(void);

View File

@ -51,6 +51,9 @@ static const char *g_settingsId_wmaDecoderNotificationsEnabled = "Flags/EnableWm
static const char *g_settingsId_dropBoxWidgetEnabled = "Flags/EnableDropBoxWidget";
static const char *g_settingsId_currentLanguage = "Localization/Language";
static const char *g_settingsId_lameAlgoQuality = "AdvancedOptions/LAME/AlgorithmQuality";
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";
//Macros
#define MAKE_OPTION1(OPT,DEF) \
@ -188,3 +191,6 @@ MAKE_OPTION3(wmaDecoderNotificationsEnabled, true)
MAKE_OPTION3(dropBoxWidgetEnabled, true)
MAKE_OPTION2(currentLanguage, defaultLanguage());
MAKE_OPTION1(lameAlgoQuality, 3)
MAKE_OPTION3(bitrateManagementEnabled, false)
MAKE_OPTION1(bitrateManagementMinRate, 32)
MAKE_OPTION1(bitrateManagementMaxRate, 500)

View File

@ -80,6 +80,10 @@ public:
MAKE_OPTION_DEC3(dropBoxWidgetEnabled)
MAKE_OPTION_DEC2(currentLanguage);
MAKE_OPTION_DEC1(lameAlgoQuality);
MAKE_OPTION_DEC3(bitrateManagementEnabled);
MAKE_OPTION_DEC1(bitrateManagementMinRate);
MAKE_OPTION_DEC1(bitrateManagementMaxRate);
//Misc
void validate(void);