• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdeedu API Reference
  • KDE Home
  • Contact Us
 

marble

  • sources
  • kde-4.14
  • kdeedu
  • marble
  • src
  • lib
  • marble
MovieCaptureDialog.cpp
Go to the documentation of this file.
1 //
2 // This file is part of the Marble Virtual Globe.
3 //
4 // This program is free software licensed under the GNU LGPL. You can
5 // find a copy of this license in LICENSE.txt in the top directory of
6 // the source code.
7 //
8 // Copyright 2013 Illya Kovalevskyy <illya.kovalevskyy@gmail.com>
9 //
10 
11 #include "MovieCaptureDialog.h"
12 #include "ui_MovieCaptureDialog.h"
13 
14 #include <QFileDialog>
15 #include <QMessageBox>
16 
17 #include "MarbleWidget.h"
18 #include "MovieCapture.h"
19 
20 namespace Marble {
21 
22 MovieCaptureDialog::MovieCaptureDialog(MarbleWidget *widget, QWidget *parent) :
23  QDialog(parent),
24  ui(new Ui::MovieCaptureDialog),
25  m_recorder(new MovieCapture(widget, parent))
26 {
27  ui->setupUi(this);
28 
29  connect(ui->fpsSlider, SIGNAL(valueChanged(int)),
30  ui->fpsSpin, SLOT(setValue(int)));
31 
32  connect(ui->fpsSpin, SIGNAL(valueChanged(int)),
33  ui->fpsSlider, SLOT(setValue(int)));
34 
35  connect(ui->fpsSlider, SIGNAL(valueChanged(int)),
36  m_recorder, SLOT(setFps(int)));
37 
38  connect(ui->cancelButton, SIGNAL(clicked()),
39  this, SLOT(close()));
40 
41  connect(ui->startButton, SIGNAL(clicked()),
42  this, SLOT(startRecording()));
43 
44  connect(ui->openButton, SIGNAL(clicked()),
45  this, SLOT(loadDestinationFile()));
46 }
47 
48 MovieCaptureDialog::~MovieCaptureDialog()
49 {
50  delete ui;
51 }
52 
53 void MovieCaptureDialog::loadDestinationFile()
54 {
55  const QString destination =
56  QFileDialog::getSaveFileName(this, tr("Save video file"), "",
57  tr("Supported video (*.mp4 *.webm *.ogg)"));
58 
59  if (destination.isEmpty()) {
60  return;
61  }
62 
63  QStringList formats;
64  formats << "mp4" << "webm" << "ogg";
65 
66  bool supported = false;
67  foreach(const QString &format, formats) {
68  if (destination.endsWith('.'+format))
69  supported = true;
70  }
71 
72  if (!supported) {
73  QMessageBox::warning(this, tr("Filename is not valid"),
74  tr("This file format is not supported. "
75  "Please, use .ogg, .mp4 or .webm instead"));
76  return;
77  }
78 
79  ui->destinationEdit->setText(destination);
80  m_recorder->setDestination(destination);
81 }
82 
83 void MovieCaptureDialog::startRecording()
84 {
85  const QString path = ui->destinationEdit->text();
86 
87  if (path.isEmpty()) {
88  QMessageBox::warning(this, tr("Missing filename"),
89  tr("Destination video file is not set. "
90  "I don't know where to save recorded "
91  "video. Please, specify one."));
92  return;
93  }
94 
95  hide();
96 
97  m_recorder->setFps(ui->fpsSlider->value());
98  m_recorder->startRecording();
99  emit started();
100 }
101 
102 void MovieCaptureDialog::stopRecording()
103 {
104  m_recorder->stopRecording();
105 }
106 
107 } // namespace Marble
108 
109 #include "MovieCaptureDialog.moc"
QWidget::close
bool close()
QWidget
Marble::MovieCaptureDialog::startRecording
void startRecording()
Definition: MovieCaptureDialog.cpp:83
Marble::MovieCaptureDialog::started
void started()
Marble::MovieCaptureDialog::MovieCaptureDialog
MovieCaptureDialog(MarbleWidget *widget, QWidget *parent=0)
Definition: MovieCaptureDialog.cpp:22
MovieCapture.h
Marble::MovieCaptureDialog::stopRecording
void stopRecording()
Definition: MovieCaptureDialog.cpp:102
QObject::tr
QString tr(const char *sourceText, const char *disambiguation, int n)
Marble::MarbleWidget
A widget class that displays a view of the earth.
Definition: MarbleWidget.h:104
Marble::MovieCaptureDialog
Definition: MovieCaptureDialog.h:27
QString::isEmpty
bool isEmpty() const
Marble::MovieCapture::startRecording
void startRecording()
Definition: MovieCapture.cpp:92
QString::endsWith
bool endsWith(const QString &s, Qt::CaseSensitivity cs) const
Marble::MovieCapture::stopRecording
void stopRecording()
Definition: MovieCapture.cpp:124
QString
QWidget::hide
void hide()
Marble::MovieCapture::setFps
void setFps(int fps)
Definition: MovieCapture.cpp:56
MovieCaptureDialog.h
QStringList
Marble::MovieCapture
Definition: MovieCapture.h:26
QFileDialog::getSaveFileName
QString getSaveFileName(QWidget *parent, const QString &caption, const QString &dir, const QString &filter, QString *selectedFilter, QFlags< QFileDialog::Option > options)
QDialog
MarbleWidget.h
This file contains the headers for MarbleWidget.
QMessageBox::warning
StandardButton warning(QWidget *parent, const QString &title, const QString &text, QFlags< QMessageBox::StandardButton > buttons, StandardButton defaultButton)
Marble::MovieCapture::setDestination
void setDestination(const QString &path)
Definition: MovieCapture.cpp:62
Marble::MovieCaptureDialog::~MovieCaptureDialog
~MovieCaptureDialog()
Definition: MovieCaptureDialog.cpp:48
QObject::connect
bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:13:41 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

marble

Skip menu "marble"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdeedu API Reference

Skip menu "kdeedu API Reference"
  • Analitza
  •     lib
  • kalgebra
  • kalzium
  •   libscience
  • kanagram
  • kig
  •   lib
  • klettres
  • marble
  • parley
  • rocs
  •   App
  •   RocsCore
  •   VisualEditor
  •   stepcore

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal