Skip to content

Commit

Permalink
Hide bitrate/quality fields instead of disabling.
Browse files Browse the repository at this point in the history
  • Loading branch information
ddennedy committed Feb 6, 2015
1 parent 7105ca0 commit c7f4aa2
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 40 deletions.
62 changes: 44 additions & 18 deletions src/docks/encodedock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ EncodeDock::EncodeDock(QWidget *parent) :
ui->videoCodecCombo->model()->sort(0);
ui->videoCodecCombo->insertItem(0, tr("Default for format"));
ui->videoCodecCombo->setCurrentIndex(0);
on_audioRateControlCombo_activated(ui->audioRateControlCombo->currentIndex());
on_videoRateControlCombo_activated(ui->videoRateControlCombo->currentIndex());
qDebug() << "end";
}

Expand Down Expand Up @@ -897,22 +899,37 @@ void EncodeDock::on_videoRateControlCombo_activated(int index)
{
switch (index) {
case RateControlAverage:
ui->videoBitrateCombo->setEnabled(true);
ui->videoBufferSizeSpinner->setEnabled(false);
ui->videoQualitySpinner->setEnabled(false);
ui->dualPassCheckbox->setEnabled(true);
ui->videoBitrateCombo->show();
ui->videoBufferSizeSpinner->hide();
ui->videoQualitySpinner->hide();
ui->dualPassCheckbox->show();
ui->videoBitrateLabel->show();
ui->videoBitrateSuffixLabel->show();
ui->videoBufferSizeLabel->hide();
ui->videoBufferSizeSuffixLabel->hide();
ui->videoQualityLabel->hide();
break;
case RateControlConstant:
ui->videoBitrateCombo->setEnabled(true);
ui->videoBufferSizeSpinner->setEnabled(true);
ui->videoQualitySpinner->setEnabled(false);
ui->dualPassCheckbox->setEnabled(false);
ui->videoBitrateCombo->show();
ui->videoBufferSizeSpinner->show();
ui->videoQualitySpinner->hide();
ui->dualPassCheckbox->hide();
ui->videoBitrateLabel->show();
ui->videoBitrateSuffixLabel->show();
ui->videoBufferSizeLabel->show();
ui->videoBufferSizeSuffixLabel->show();
ui->videoQualityLabel->hide();
break;
case RateControlQuality:
ui->videoBitrateCombo->setEnabled(false);
ui->videoBufferSizeSpinner->setEnabled(false);
ui->videoQualitySpinner->setEnabled(true);
ui->dualPassCheckbox->setEnabled(false);
ui->videoBitrateCombo->hide();
ui->videoBufferSizeSpinner->hide();
ui->videoQualitySpinner->show();
ui->dualPassCheckbox->hide();
ui->videoBitrateLabel->hide();
ui->videoBitrateSuffixLabel->hide();
ui->videoBufferSizeLabel->hide();
ui->videoBufferSizeSuffixLabel->hide();
ui->videoQualityLabel->show();
break;
}
}
Expand All @@ -924,16 +941,25 @@ void EncodeDock::on_audioRateControlCombo_activated(int index)
return;
switch (index) {
case RateControlAverage:
ui->audioBitrateCombo->setEnabled(true);
ui->audioQualitySpinner->setEnabled(false);
ui->audioBitrateCombo->show();
ui->audioQualitySpinner->hide();
ui->audioBitrateLabel->show();
ui->audioBitrateSuffixLabel->show();
ui->audioQualityLabel->hide();
break;
case RateControlConstant:
ui->audioBitrateCombo->setEnabled(true);
ui->audioQualitySpinner->setEnabled(false);
ui->audioBitrateCombo->show();
ui->audioQualitySpinner->hide();
ui->audioBitrateLabel->show();
ui->audioBitrateSuffixLabel->show();
ui->audioQualityLabel->hide();
break;
case RateControlQuality:
ui->audioBitrateCombo->setEnabled(false);
ui->audioQualitySpinner->setEnabled(true);
ui->audioBitrateCombo->hide();
ui->audioQualitySpinner->show();
ui->audioBitrateLabel->hide();
ui->audioBitrateSuffixLabel->hide();
ui->audioQualityLabel->show();
break;
}
}
Expand Down
34 changes: 12 additions & 22 deletions src/docks/encodedock.ui
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>341</width>
<height>447</height>
<width>329</width>
<height>465</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
Expand Down Expand Up @@ -919,7 +919,7 @@ codecs. However, not all codecs are multi-threaded.</string>
</layout>
</item>
<item row="7" column="0">
<widget class="QLabel" name="label_24">
<widget class="QLabel" name="videoBufferSizeLabel">
<property name="text">
<string>Buffer size</string>
</property>
Expand All @@ -929,12 +929,9 @@ codecs. However, not all codecs are multi-threaded.</string>
</widget>
</item>
<item row="7" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_18">
<layout class="QHBoxLayout" name="videoBufferSizeLayout">
<item>
<widget class="QDoubleSpinBox" name="videoBufferSizeSpinner">
<property name="enabled">
<bool>false</bool>
</property>
<property name="maximum">
<double>9999.000000000000000</double>
</property>
Expand All @@ -944,7 +941,7 @@ codecs. However, not all codecs are multi-threaded.</string>
</widget>
</item>
<item>
<widget class="QLabel" name="label_6">
<widget class="QLabel" name="videoBufferSizeSuffixLabel">
<property name="text">
<string>KiB</string>
</property>
Expand All @@ -966,7 +963,7 @@ codecs. However, not all codecs are multi-threaded.</string>
</layout>
</item>
<item row="8" column="0">
<widget class="QLabel" name="label_25">
<widget class="QLabel" name="videoQualityLabel">
<property name="text">
<string>Quality</string>
</property>
Expand All @@ -976,12 +973,9 @@ codecs. However, not all codecs are multi-threaded.</string>
</widget>
</item>
<item row="8" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_19">
<layout class="QHBoxLayout" name="videoQualityLayout">
<item>
<widget class="QSpinBox" name="videoQualitySpinner">
<property name="enabled">
<bool>false</bool>
</property>
<property name="suffix">
<string> %</string>
</property>
Expand Down Expand Up @@ -1146,7 +1140,7 @@ codecs. However, not all codecs are multi-threaded.</string>
</layout>
</item>
<item row="5" column="0">
<widget class="QLabel" name="label_4">
<widget class="QLabel" name="audioBitrateLabel">
<property name="text">
<string>Bitrate</string>
</property>
Expand All @@ -1156,7 +1150,7 @@ codecs. However, not all codecs are multi-threaded.</string>
</widget>
</item>
<item row="5" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_3">
<layout class="QHBoxLayout" name="audioBitrateLayout">
<item>
<widget class="QComboBox" name="audioBitrateCombo">
<property name="toolTip">
Expand Down Expand Up @@ -1226,7 +1220,7 @@ codecs. However, not all codecs are multi-threaded.</string>
</widget>
</item>
<item>
<widget class="QLabel" name="label_5">
<widget class="QLabel" name="audioBitrateSuffixLabel">
<property name="text">
<string>b/s</string>
</property>
Expand Down Expand Up @@ -1314,7 +1308,7 @@ codecs. However, not all codecs are multi-threaded.</string>
</layout>
</item>
<item row="6" column="0">
<widget class="QLabel" name="label_26">
<widget class="QLabel" name="audioQualityLabel">
<property name="text">
<string>Quality</string>
</property>
Expand All @@ -1324,12 +1318,9 @@ codecs. However, not all codecs are multi-threaded.</string>
</widget>
</item>
<item row="6" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_20">
<layout class="QHBoxLayout" name="audioQualityLayout">
<item>
<widget class="QSpinBox" name="audioQualitySpinner">
<property name="enabled">
<bool>false</bool>
</property>
<property name="suffix">
<string> %</string>
</property>
Expand Down Expand Up @@ -1449,7 +1440,6 @@ codecs. However, not all codecs are multi-threaded.</string>
</widget>
</item>
</layout>
<zorder>scrollArea</zorder>
</widget>
</widget>
<customwidgets>
Expand Down

0 comments on commit c7f4aa2

Please sign in to comment.