summaryrefslogtreecommitdiffstats
path: root/tools/qmlviewer
diff options
context:
space:
mode:
authorWarwick Allison <warwick.allison@nokia.com>2009-07-30 06:03:36 (GMT)
committerWarwick Allison <warwick.allison@nokia.com>2009-07-30 06:03:36 (GMT)
commitf7b08934580ddc2716fbf4ac3ecd9684158d3cf7 (patch)
tree0574d7e40629e4adf9df99da982f66195f3d1182 /tools/qmlviewer
parent8b168b8f969c1eafaeb0276a3c81b58a388f93d2 (diff)
downloadQt-f7b08934580ddc2716fbf4ac3ecd9684158d3cf7.zip
Qt-f7b08934580ddc2716fbf4ac3ecd9684158d3cf7.tar.gz
Qt-f7b08934580ddc2716fbf4ac3ecd9684158d3cf7.tar.bz2
Video size and aspect ratio.
Diffstat (limited to 'tools/qmlviewer')
-rw-r--r--tools/qmlviewer/qmlviewer.cpp36
-rw-r--r--tools/qmlviewer/qmlviewer.h1
-rw-r--r--tools/qmlviewer/recopts.ui407
3 files changed, 326 insertions, 118 deletions
diff --git a/tools/qmlviewer/qmlviewer.cpp b/tools/qmlviewer/qmlviewer.cpp
index d7d8b82..098f749 100644
--- a/tools/qmlviewer/qmlviewer.cpp
+++ b/tools/qmlviewer/qmlviewer.cpp
@@ -298,7 +298,7 @@ void QmlViewer::createMenu(QMenuBar *menu, QMenu *flatmenu)
connect(recordAction, SIGNAL(triggered()), this, SLOT(toggleRecordingWithSelection()));
recordMenu->addAction(recordAction);
- QAction *recordOptions = new QAction(tr("Recording &Options..."), parent);
+ QAction *recordOptions = new QAction(tr("Video &Options..."), parent);
connect(recordOptions, SIGNAL(triggered()), this, SLOT(chooseRecordingOptions()));
recordMenu->addAction(recordOptions);
@@ -416,7 +416,17 @@ void QmlViewer::pickRecordingFile()
void QmlViewer::chooseRecordingOptions()
{
+ // File
recdlg->file->setText(record_file);
+
+ // Size
+ recdlg->sizeOriginal->setText(tr("Original (%1x%2)").arg(canvas->width()).arg(canvas->height()));
+ if (recdlg->sizeWidth->value()<=1) {
+ recdlg->sizeWidth->setValue(canvas->width());
+ recdlg->sizeHeight->setValue(canvas->height());
+ }
+
+ // Rate
if (record_rate == 24)
recdlg->hz24->setChecked(true);
else if (record_rate == 25)
@@ -429,9 +439,24 @@ void QmlViewer::chooseRecordingOptions()
recdlg->hzCustom->setChecked(true);
recdlg->hz->setText(QString::number(record_rate));
}
+
+ // Profile
recdlg->setArguments(record_args.join(" "));
if (recdlg->exec()) {
+ // File
record_file = recdlg->file->text();
+ // Size
+ if (recdlg->sizeOriginal->isChecked())
+ record_outsize = QSize();
+ else if (recdlg->size720p->isChecked())
+ record_outsize = QSize(1280,720);
+ else if (recdlg->sizeVGA->isChecked())
+ record_outsize = QSize(640,480);
+ else if (recdlg->sizeQVGA->isChecked())
+ record_outsize = QSize(320,240);
+ else
+ record_outsize = QSize(recdlg->sizeWidth->value(),recdlg->sizeHeight->value());
+ // Rate
if (recdlg->hz24->isChecked())
record_rate = 24;
else if (recdlg->hz25->isChecked())
@@ -443,6 +468,7 @@ void QmlViewer::chooseRecordingOptions()
else {
record_rate = recdlg->hz->text().toDouble();
}
+ // Profile
record_args = recdlg->arguments().split(" ",QString::SkipEmptyParts);
}
}
@@ -686,7 +712,7 @@ void QmlViewer::senseFfmpeg()
proc.waitForFinished(2000);
QString ffmpegHelp = proc.readAllStandardOutput();
ffmpegAvailable = ffmpegHelp.contains("-s ");
- ffmpegHelp = tr("Video recording use ffmpeg:")+"\n\n"+ffmpegHelp;
+ ffmpegHelp = tr("Video recording uses ffmpeg:")+"\n\n"+ffmpegHelp;
QDialog *d = new QDialog(recdlg);
QVBoxLayout *l = new QVBoxLayout(d);
@@ -729,6 +755,10 @@ void QmlViewer::setRecording(bool on)
args << "-pix_fmt" << (frame_fmt == ".gif" ? "rgb24" : "rgb32");
args << "-s" << QString("%1x%2").arg(canvas->width()).arg(canvas->height());
args << "-i" << "-";
+ if (record_outsize.isValid()) {
+ args << "-s" << QString("%1x%2").arg(record_outsize.width()).arg(record_outsize.height());
+ args << "-aspect" << QString::number(double(canvas->width())/canvas->height());
+ }
args += record_args;
args << record_file;
proc->start("ffmpeg",args);
@@ -770,6 +800,8 @@ void QmlViewer::setRecording(bool on)
break;
QString name;
name.sprintf(framename.toLocal8Bit(),frame++);
+ if (record_outsize.isValid())
+ *img = img->scaled(record_outsize,Qt::IgnoreAspectRatio,Qt::SmoothTransformation);
if (record_dither=="ordered")
img->convertToFormat(QImage::Format_Indexed8,Qt::PreferDither|Qt::OrderedDither).save(name);
else if (record_dither=="threshold")
diff --git a/tools/qmlviewer/qmlviewer.h b/tools/qmlviewer/qmlviewer.h
index e3864eb..914f77d 100644
--- a/tools/qmlviewer/qmlviewer.h
+++ b/tools/qmlviewer/qmlviewer.h
@@ -88,6 +88,7 @@ private:
QmlTimer autoStopTimer;
QString record_dither;
QString record_file;
+ QSize record_outsize;
QStringList record_args;
int record_rate;
int record_autotime;
diff --git a/tools/qmlviewer/recopts.ui b/tools/qmlviewer/recopts.ui
index 041a4c4..ce2da30 100644
--- a/tools/qmlviewer/recopts.ui
+++ b/tools/qmlviewer/recopts.ui
@@ -6,133 +6,194 @@
<rect>
<x>0</x>
<y>0</y>
- <width>290</width>
- <height>297</height>
+ <width>316</width>
+ <height>436</height>
</rect>
</property>
<property name="windowTitle">
- <string>Recording options</string>
+ <string>Video options</string>
</property>
- <layout class="QGridLayout" name="gridLayout">
- <item row="0" column="0">
- <widget class="QLabel" name="label">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Minimum" vsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string>File:</string>
- </property>
- </widget>
- </item>
- <item row="0" column="1" colspan="2">
- <widget class="QLineEdit" name="file"/>
- </item>
- <item row="6" column="2" colspan="2">
- <widget class="QDialogButtonBox" name="buttonBox">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="standardButtons">
- <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
- </property>
- </widget>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_3">
+ <item>
+ <widget class="QLabel" name="label">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Minimum" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>File:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLineEdit" name="file"/>
+ </item>
+ <item>
+ <widget class="QToolButton" name="pickfile">
+ <property name="text">
+ <string>...</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
</item>
- <item row="0" column="3">
- <widget class="QToolButton" name="pickfile">
- <property name="text">
- <string>...</string>
+ <item>
+ <widget class="QGroupBox" name="groupBox">
+ <property name="title">
+ <string>Size</string>
</property>
- </widget>
- </item>
- <item row="2" column="0" colspan="4">
- <widget class="QWidget" name="ffmpegOptions" native="true">
<layout class="QGridLayout" name="gridLayout_2">
- <property name="margin">
- <number>0</number>
- </property>
- <item row="1" column="0">
- <widget class="QLabel" name="label_4">
+ <item row="0" column="0">
+ <widget class="QRadioButton" name="sizeOriginal">
<property name="text">
- <string>Profile:</string>
+ <string/>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
</property>
</widget>
</item>
- <item row="1" column="1" colspan="2">
- <widget class="QComboBox" name="profile"/>
+ <item row="0" column="1">
+ <widget class="QRadioButton" name="sizeVGA">
+ <property name="text">
+ <string>VGA</string>
+ </property>
+ </widget>
</item>
- <item row="2" column="1">
- <widget class="QLineEdit" name="args"/>
+ <item row="1" column="0">
+ <widget class="QRadioButton" name="size720p">
+ <property name="text">
+ <string>720p</string>
+ </property>
+ </widget>
</item>
- <item row="2" column="2">
- <widget class="QToolButton" name="ffmpegHelp">
+ <item row="1" column="1">
+ <widget class="QRadioButton" name="sizeQVGA">
<property name="text">
- <string>Help</string>
+ <string>QVGA</string>
</property>
</widget>
</item>
+ <item row="2" column="0" colspan="3">
+ <layout class="QHBoxLayout" name="horizontalLayout_2">
+ <item>
+ <widget class="QRadioButton" name="sizeCustom">
+ <property name="text">
+ <string>Width:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QSpinBox" name="sizeWidth">
+ <property name="minimum">
+ <number>1</number>
+ </property>
+ <property name="maximum">
+ <number>9999</number>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="label_2">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Minimum" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Height:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QSpinBox" name="sizeHeight">
+ <property name="minimum">
+ <number>1</number>
+ </property>
+ <property name="maximum">
+ <number>9999</number>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="horizontalSpacer_3">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>QSizePolicy::MinimumExpanding</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </item>
+ <item row="0" column="2">
+ <spacer name="horizontalSpacer_4">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>QSizePolicy::MinimumExpanding</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
</layout>
</widget>
</item>
- <item row="1" column="0" colspan="4">
- <widget class="QWidget" name="rateOptions" native="true">
- <layout class="QGridLayout" name="gridLayout_3">
- <property name="margin">
- <number>0</number>
- </property>
+ <item>
+ <widget class="QGroupBox" name="rateOptions">
+ <property name="title">
+ <string>Rate</string>
+ </property>
+ <layout class="QGridLayout" name="gridLayout_4">
<item row="0" column="0">
- <widget class="QLabel" name="label_2">
+ <widget class="QRadioButton" name="hz60">
<property name="sizePolicy">
- <sizepolicy hsizetype="Minimum" vsizetype="Preferred">
+ <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
- <string>Rate:</string>
+ <string>60Hz</string>
</property>
- </widget>
- </item>
- <item row="0" column="1">
- <widget class="QRadioButton" name="hz24">
- <property name="text">
- <string>24Hz</string>
+ <property name="checked">
+ <bool>true</bool>
</property>
</widget>
</item>
- <item row="0" column="2">
+ <item row="1" column="0">
<widget class="QRadioButton" name="hz50">
<property name="text">
<string>50Hz</string>
</property>
</widget>
</item>
- <item row="1" column="1">
+ <item row="0" column="2">
<widget class="QRadioButton" name="hz25">
<property name="text">
<string>25Hz</string>
</property>
</widget>
</item>
- <item row="1" column="2">
- <widget class="QRadioButton" name="hz60">
- <property name="sizePolicy">
- <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string>60Hz</string>
- </property>
- <property name="checked">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item row="2" column="1" colspan="2">
+ <item row="2" column="0" colspan="4">
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="spacing">
<number>0</number>
@@ -178,6 +239,9 @@
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
+ <property name="sizeType">
+ <enum>QSizePolicy::MinimumExpanding</enum>
+ </property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
@@ -188,31 +252,110 @@
</item>
</layout>
</item>
+ <item row="1" column="2">
+ <widget class="QRadioButton" name="hz24">
+ <property name="text">
+ <string>24Hz</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="3">
+ <spacer name="horizontalSpacer">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>QSizePolicy::MinimumExpanding</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="0" column="1">
+ <spacer name="horizontalSpacer_5">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>QSizePolicy::Fixed</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
</layout>
</widget>
</item>
- <item row="4" 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>
+ <item>
+ <widget class="QGroupBox" name="ffmpegOptions">
+ <property name="title">
+ <string>Profile</string>
</property>
- </spacer>
+ <layout class="QGridLayout" name="gridLayout_3">
+ <item row="0" column="0" colspan="3">
+ <widget class="QComboBox" name="profile"/>
+ </item>
+ <item row="1" column="0" colspan="2">
+ <widget class="QLineEdit" name="args"/>
+ </item>
+ <item row="1" column="2">
+ <widget class="QToolButton" name="ffmpegHelp">
+ <property name="text">
+ <string>Help</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
</item>
- <item row="3" column="0" colspan="4">
+ <item>
<widget class="QLabel" name="warning">
<property name="text">
<string/>
</property>
</widget>
</item>
+ <item>
+ <widget class="QDialogButtonBox" name="buttonBox">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="standardButtons">
+ <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
+ </property>
+ </widget>
+ </item>
</layout>
</widget>
+ <tabstops>
+ <tabstop>file</tabstop>
+ <tabstop>pickfile</tabstop>
+ <tabstop>sizeOriginal</tabstop>
+ <tabstop>sizeVGA</tabstop>
+ <tabstop>size720p</tabstop>
+ <tabstop>sizeQVGA</tabstop>
+ <tabstop>sizeCustom</tabstop>
+ <tabstop>sizeWidth</tabstop>
+ <tabstop>sizeHeight</tabstop>
+ <tabstop>hz60</tabstop>
+ <tabstop>hz25</tabstop>
+ <tabstop>hz50</tabstop>
+ <tabstop>hz24</tabstop>
+ <tabstop>hzCustom</tabstop>
+ <tabstop>hz</tabstop>
+ <tabstop>profile</tabstop>
+ <tabstop>args</tabstop>
+ <tabstop>ffmpegHelp</tabstop>
+ <tabstop>buttonBox</tabstop>
+ </tabstops>
<resources/>
<connections>
<connection>
@@ -222,12 +365,12 @@
<slot>setFocus()</slot>
<hints>
<hint type="sourcelabel">
- <x>54</x>
- <y>104</y>
+ <x>43</x>
+ <y>257</y>
</hint>
<hint type="destinationlabel">
- <x>85</x>
- <y>107</y>
+ <x>129</x>
+ <y>262</y>
</hint>
</hints>
</connection>
@@ -238,12 +381,12 @@
<slot>toggle()</slot>
<hints>
<hint type="sourcelabel">
- <x>138</x>
- <y>102</y>
+ <x>143</x>
+ <y>262</y>
</hint>
<hint type="destinationlabel">
- <x>49</x>
- <y>104</y>
+ <x>43</x>
+ <y>257</y>
</hint>
</hints>
</connection>
@@ -254,12 +397,12 @@
<slot>toggle()</slot>
<hints>
<hint type="sourcelabel">
- <x>110</x>
- <y>105</y>
+ <x>143</x>
+ <y>262</y>
</hint>
<hint type="destinationlabel">
- <x>51</x>
- <y>103</y>
+ <x>43</x>
+ <y>257</y>
</hint>
</hints>
</connection>
@@ -270,8 +413,8 @@
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
- <x>280</x>
- <y>287</y>
+ <x>258</x>
+ <y>424</y>
</hint>
<hint type="destinationlabel">
<x>60</x>
@@ -286,8 +429,8 @@
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
- <x>280</x>
- <y>287</y>
+ <x>258</x>
+ <y>424</y>
</hint>
<hint type="destinationlabel">
<x>92</x>
@@ -302,8 +445,8 @@
<slot>pickProfile(int)</slot>
<hints>
<hint type="sourcelabel">
- <x>72</x>
- <y>132</y>
+ <x>92</x>
+ <y>329</y>
</hint>
<hint type="destinationlabel">
<x>48</x>
@@ -318,8 +461,8 @@
<slot>storeCustomArgs(QString)</slot>
<hints>
<hint type="sourcelabel">
- <x>108</x>
- <y>161</y>
+ <x>128</x>
+ <y>357</y>
</hint>
<hint type="destinationlabel">
<x>102</x>
@@ -327,6 +470,38 @@
</hint>
</hints>
</connection>
+ <connection>
+ <sender>sizeWidth</sender>
+ <signal>valueChanged(int)</signal>
+ <receiver>sizeCustom</receiver>
+ <slot>toggle()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>108</x>
+ <y>133</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>48</x>
+ <y>133</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>sizeHeight</sender>
+ <signal>valueChanged(int)</signal>
+ <receiver>sizeCustom</receiver>
+ <slot>toggle()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>212</x>
+ <y>133</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>64</x>
+ <y>129</y>
+ </hint>
+ </hints>
+ </connection>
</connections>
<slots>
<signal>filePicked(QString)</signal>