| 1 | /* smplayer, GUI front-end for mplayer.
|
|---|
| 2 | Copyright (C) 2006-2013 Ricardo Villalba <rvm@users.sourceforge.net>
|
|---|
| 3 |
|
|---|
| 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.
|
|---|
| 8 |
|
|---|
| 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.
|
|---|
| 13 |
|
|---|
| 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
|
|---|
| 17 | */
|
|---|
| 18 |
|
|---|
| 19 | #include "videopreviewconfigdialog.h"
|
|---|
| 20 | #include <QImageReader>
|
|---|
| 21 |
|
|---|
| 22 | VideoPreviewConfigDialog::VideoPreviewConfigDialog( QWidget* parent, Qt::WindowFlags f )
|
|---|
| 23 | : QDialog(parent, f)
|
|---|
| 24 | {
|
|---|
| 25 | setupUi(this);
|
|---|
| 26 |
|
|---|
| 27 | connect(filename_edit, SIGNAL(textChanged(const QString &)),
|
|---|
| 28 | this, SLOT(filenameChanged(const QString &)) );
|
|---|
| 29 |
|
|---|
| 30 | dvd_device_label->setVisible(false);
|
|---|
| 31 | dvd_device_edit->setVisible(false);
|
|---|
| 32 |
|
|---|
| 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);
|
|---|
| 37 |
|
|---|
| 38 | format_combo->addItem("png", VideoPreview::PNG);
|
|---|
| 39 | if (QImageReader::supportedImageFormats().contains("jpg")) {
|
|---|
| 40 | format_combo->addItem("jpg", VideoPreview::JPEG);
|
|---|
| 41 | }
|
|---|
| 42 |
|
|---|
| 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.") );
|
|---|
| 54 |
|
|---|
| 55 | layout()->setSizeConstraint(QLayout::SetFixedSize);
|
|---|
| 56 | }
|
|---|
| 57 |
|
|---|
| 58 | VideoPreviewConfigDialog::~VideoPreviewConfigDialog() {
|
|---|
| 59 | }
|
|---|
| 60 |
|
|---|
| 61 | void VideoPreviewConfigDialog::setVideoFile(const QString & video_file) {
|
|---|
| 62 | filename_edit->setText(video_file);
|
|---|
| 63 | }
|
|---|
| 64 |
|
|---|
| 65 | QString VideoPreviewConfigDialog::videoFile() {
|
|---|
| 66 | return filename_edit->text();
|
|---|
| 67 | }
|
|---|
| 68 |
|
|---|
| 69 | void VideoPreviewConfigDialog::setDVDDevice(const QString & dvd_device) {
|
|---|
| 70 | dvd_device_edit->setText(dvd_device);
|
|---|
| 71 | }
|
|---|
| 72 |
|
|---|
| 73 | QString VideoPreviewConfigDialog::DVDDevice() {
|
|---|
| 74 | return dvd_device_edit->text();
|
|---|
| 75 | }
|
|---|
| 76 |
|
|---|
| 77 | void VideoPreviewConfigDialog::setCols(int cols) {
|
|---|
| 78 | columns_spin->setValue(cols);
|
|---|
| 79 | }
|
|---|
| 80 |
|
|---|
| 81 | int VideoPreviewConfigDialog::cols() {
|
|---|
| 82 | return columns_spin->value();
|
|---|
| 83 | }
|
|---|
| 84 |
|
|---|
| 85 | void VideoPreviewConfigDialog::setRows(int rows) {
|
|---|
| 86 | rows_spin->setValue(rows);
|
|---|
| 87 | }
|
|---|
| 88 |
|
|---|
| 89 | int VideoPreviewConfigDialog::rows() {
|
|---|
| 90 | return rows_spin->value();
|
|---|
| 91 | }
|
|---|
| 92 |
|
|---|
| 93 | void VideoPreviewConfigDialog::setInitialStep(int step) {
|
|---|
| 94 | initial_step_spin->setValue(step);
|
|---|
| 95 | }
|
|---|
| 96 |
|
|---|
| 97 | int VideoPreviewConfigDialog::initialStep() {
|
|---|
| 98 | return initial_step_spin->value();
|
|---|
| 99 | }
|
|---|
| 100 |
|
|---|
| 101 | void VideoPreviewConfigDialog::setMaxWidth(int w) {
|
|---|
| 102 | max_width_spin->setValue(w);
|
|---|
| 103 | }
|
|---|
| 104 |
|
|---|
| 105 | int VideoPreviewConfigDialog::maxWidth() {
|
|---|
| 106 | return max_width_spin->value();
|
|---|
| 107 | }
|
|---|
| 108 |
|
|---|
| 109 | void VideoPreviewConfigDialog::setDisplayOSD(bool b) {
|
|---|
| 110 | osd_check->setChecked(b);
|
|---|
| 111 | }
|
|---|
| 112 |
|
|---|
| 113 | bool VideoPreviewConfigDialog::displayOSD() {
|
|---|
| 114 | return osd_check->isChecked();
|
|---|
| 115 | }
|
|---|
| 116 |
|
|---|
| 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);
|
|---|
| 121 | }
|
|---|
| 122 |
|
|---|
| 123 | double VideoPreviewConfigDialog::aspectRatio() {
|
|---|
| 124 | int idx = aspect_ratio_combo->currentIndex();
|
|---|
| 125 | return aspect_ratio_combo->itemData(idx).toDouble();
|
|---|
| 126 | }
|
|---|
| 127 |
|
|---|
| 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);
|
|---|
| 132 | }
|
|---|
| 133 |
|
|---|
| 134 | VideoPreview::ExtractFormat VideoPreviewConfigDialog::format() {
|
|---|
| 135 | int idx = format_combo->currentIndex();
|
|---|
| 136 | return (VideoPreview::ExtractFormat) format_combo->itemData(idx).toInt();
|
|---|
| 137 | }
|
|---|
| 138 |
|
|---|
| 139 | void VideoPreviewConfigDialog::setSaveLastDirectory(bool b) {
|
|---|
| 140 | save_last_directory_check->setChecked(b);
|
|---|
| 141 | }
|
|---|
| 142 |
|
|---|
| 143 | bool VideoPreviewConfigDialog::saveLastDirectory() {
|
|---|
| 144 | return save_last_directory_check->isChecked();
|
|---|
| 145 | }
|
|---|
| 146 |
|
|---|
| 147 | void VideoPreviewConfigDialog::filenameChanged(const QString & text) {
|
|---|
| 148 | qDebug("VideoPreviewConfigDialog::filenameChanged");
|
|---|
| 149 |
|
|---|
| 150 | bool b = text.startsWith("dvd:");
|
|---|
| 151 | dvd_device_label->setVisible(b);
|
|---|
| 152 | dvd_device_edit->setVisible(b);
|
|---|
| 153 | }
|
|---|
| 154 |
|
|---|
| 155 | #include "moc_videopreviewconfigdialog.cpp"
|
|---|