1
/* smplayer, GUI front-end for mplayer.
2
Copyright (C) 2006-2009 Ricardo Villalba <rvm@escomposlinux.org>
4
This program is free software; you can redistribute it and/or modify
5
it under the terms of the GNU General Public License as published by
6
the Free Software Foundation; either version 2 of the License, or
7
(at your option) any later version.
9
This program is distributed in the hope that it will be useful,
10
but WITHOUT ANY WARRANTY; without even the implied warranty of
11
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
GNU General Public License for more details.
14
You should have received a copy of the GNU General Public License
15
along with this program; if not, write to the Free Software
16
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19
#include "videopreviewconfigdialog.h"
20
#include <QImageReader>
22
VideoPreviewConfigDialog::VideoPreviewConfigDialog( QWidget* parent, Qt::WindowFlags f )
27
connect(filename_edit->lineEdit(), SIGNAL(textChanged(const QString &)),
28
this, SLOT(filenameChanged(const QString &)) );
30
dvd_device_label->setVisible(false);
31
dvd_device_edit->setVisible(false);
33
aspect_ratio_combo->addItem(tr("Default"), 0);
34
aspect_ratio_combo->addItem("4:3", (double) 4/3);
35
aspect_ratio_combo->addItem("16:9", (double) 16/9);
36
aspect_ratio_combo->addItem("2.35:1", 2.35);
38
format_combo->addItem("png", VideoPreview::PNG);
39
if (QImageReader::supportedImageFormats().contains("jpg")) {
40
format_combo->addItem("jpg", VideoPreview::JPEG);
43
filename_edit->setWhatsThis( tr("The preview will be created for the video you specify here.") );
44
dvd_device_edit->setWhatsThis( tr("Enter here the DVD device or a folder with a DVD image.") );
45
columns_spin->setWhatsThis( tr("The thumbnails will be arranged on a table.") +" "+ tr("This option specifies the number of columns of the table.") );
46
rows_spin->setWhatsThis( tr("The thumbnails will be arranged on a table.") +" "+ tr("This option specifies the number of rows of the table.") );
47
osd_check->setWhatsThis( tr("If you check this option, the playing time will be displayed at the bottom of each thumbnail.") );
48
aspect_ratio_combo->setWhatsThis( tr("If the aspect ratio of the video is wrong, you can specify a different one here.") );
49
initial_step_spin->setWhatsThis( tr("Usually the first frames are black, so it's a good idea to skip some seconds at the beginning of the video. "
50
"This option allows to specify how many seconds will be skipped.") );
51
max_width_spin->setWhatsThis( tr("This option specifies the maximum width in pixels that the generated preview image will have.") );
52
format_combo->setWhatsThis( tr("Some frames will be extracted from the video in order to create the preview. Here you can choose "
53
"the image format for the extracted frames. PNG may give better quality.") );
55
layout()->setSizeConstraint(QLayout::SetFixedSize);
58
VideoPreviewConfigDialog::~VideoPreviewConfigDialog() {
61
void VideoPreviewConfigDialog::setVideoFile(const QString & video_file) {
62
filename_edit->setText(video_file);
65
QString VideoPreviewConfigDialog::videoFile() {
66
return filename_edit->text();
69
void VideoPreviewConfigDialog::setDVDDevice(const QString & dvd_device) {
70
dvd_device_edit->setText(dvd_device);
73
QString VideoPreviewConfigDialog::DVDDevice() {
74
return dvd_device_edit->text();
77
void VideoPreviewConfigDialog::setCols(int cols) {
78
columns_spin->setValue(cols);
81
int VideoPreviewConfigDialog::cols() {
82
return columns_spin->value();
85
void VideoPreviewConfigDialog::setRows(int rows) {
86
rows_spin->setValue(rows);
89
int VideoPreviewConfigDialog::rows() {
90
return rows_spin->value();
93
void VideoPreviewConfigDialog::setInitialStep(int step) {
94
initial_step_spin->setValue(step);
97
int VideoPreviewConfigDialog::initialStep() {
98
return initial_step_spin->value();
101
void VideoPreviewConfigDialog::setMaxWidth(int w) {
102
max_width_spin->setValue(w);
105
int VideoPreviewConfigDialog::maxWidth() {
106
return max_width_spin->value();
109
void VideoPreviewConfigDialog::setDisplayOSD(bool b) {
110
osd_check->setChecked(b);
113
bool VideoPreviewConfigDialog::displayOSD() {
114
return osd_check->isChecked();
117
void VideoPreviewConfigDialog::setAspectRatio(double asp) {
118
int idx = aspect_ratio_combo->findData(asp);
119
if (idx < 0) idx = 0;
120
aspect_ratio_combo->setCurrentIndex(idx);
123
double VideoPreviewConfigDialog::aspectRatio() {
124
int idx = aspect_ratio_combo->currentIndex();
125
return aspect_ratio_combo->itemData(idx).toDouble();
128
void VideoPreviewConfigDialog::setFormat(VideoPreview::ExtractFormat format) {
129
int idx = format_combo->findData(format);
130
if (idx < 0) idx = 0;
131
format_combo->setCurrentIndex(idx);
134
VideoPreview::ExtractFormat VideoPreviewConfigDialog::format() {
135
int idx = format_combo->currentIndex();
136
return (VideoPreview::ExtractFormat) format_combo->itemData(idx).toInt();
139
void VideoPreviewConfigDialog::setSaveLastDirectory(bool b) {
140
save_last_directory_check->setChecked(b);
143
bool VideoPreviewConfigDialog::saveLastDirectory() {
144
return save_last_directory_check->isChecked();
147
void VideoPreviewConfigDialog::filenameChanged(const QString & text) {
148
qDebug("VideoPreviewConfigDialog::filenameChanged");
150
bool b = text.startsWith("dvd:");
151
dvd_device_label->setVisible(b);
152
dvd_device_edit->setVisible(b);
155
#include "moc_videopreviewconfigdialog.cpp"