Skip to content

Commit

Permalink
Rename screencap to screencast
Browse files Browse the repository at this point in the history
  • Loading branch information
plfiorini committed Apr 15, 2016
1 parent d3a99d2 commit 4a404d3
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 34 deletions.
10 changes: 5 additions & 5 deletions screencast/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@ include_directories(

set(SOURCES
main.cpp
screencap.cpp
screencast.cpp
)

add_executable(hawaii-screencap ${SOURCES})
set_target_properties(hawaii-screencap PROPERTIES
add_executable(hawaii-screencast ${SOURCES})
set_target_properties(hawaii-screencast PROPERTIES
COMPILE_FLAGS "-fexceptions")
target_link_libraries(hawaii-screencap
target_link_libraries(hawaii-screencast
Qt5::Core
Qt5::Gui
GreenIsland::Client
Qt5GStreamerUtils)

install(TARGETS hawaii-screencap
install(TARGETS hawaii-screencast
DESTINATION ${CMAKE_INSTALL_BINDIR})
8 changes: 4 additions & 4 deletions screencast/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
#include <Qt5GStreamer/QGst/Init>

#include "config.h"
#include "screencap.h"
#include "screencast.h"

#define TR(x) QT_TRANSLATE_NOOP("Command line parser", QStringLiteral(x))

Expand All @@ -42,7 +42,7 @@ int main(int argc, char *argv[])

// Setup application
QGuiApplication app(argc, argv);
app.setApplicationName(QStringLiteral("Screen Capture"));
app.setApplicationName(QStringLiteral("Screencast"));
app.setApplicationVersion(QStringLiteral(HAWAII_WORKSPACE_VERSION));
app.setOrganizationDomain(QStringLiteral("hawaiios.org"));
app.setOrganizationName(QStringLiteral("Hawaii"));
Expand All @@ -66,10 +66,10 @@ int main(int argc, char *argv[])
QGst::init(&argc, &argv);

// Run the application
Screencap *screencap = new Screencap();
Screencast *screencap = new Screencast();
QGuiApplication::postEvent(screencap, new StartupEvent());
QObject::connect(&app, &QGuiApplication::aboutToQuit,
screencap, &Screencap::deleteLater);
screencap, &Screencast::deleteLater);

return app.exec();
}
38 changes: 19 additions & 19 deletions screencast/screencap.cpp → screencast/screencast.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
#include <Qt5GStreamer/QGst/Parse>
#include <Qt5GStreamer/QGst/Sample>

#include "screencap.h"
#include "screencast.h"

/*
* StartupEvent
Expand Down Expand Up @@ -78,10 +78,10 @@ void AppSource::enoughData()
}

/*
* Screencap
* Screencast
*/

Screencap::Screencap(QObject *parent)
Screencast::Screencast(QObject *parent)
: QObject(parent)
, m_initialized(false)
, m_inProgress(false)
Expand All @@ -99,7 +99,7 @@ Screencap::Screencap(QObject *parent)
m_thread->start();
}

Screencap::~Screencap()
Screencast::~Screencast()
{
if (!m_pipeline.isNull()) {
m_pipeline->setState(QGst::StateNull);
Expand All @@ -115,7 +115,7 @@ Screencap::~Screencap()
m_thread->wait();
}

bool Screencap::event(QEvent *event)
bool Screencast::event(QEvent *event)
{
if (event->type() == StartupEventType) {
initialize();
Expand All @@ -125,23 +125,23 @@ bool Screencap::event(QEvent *event)
return QObject::event(event);
}

QString Screencap::videoFileName() const
QString Screencast::videoFileName() const
{
return QStringLiteral("%1/%2.ogv")
.arg(QStandardPaths::writableLocation(QStandardPaths::MoviesLocation))
.arg(tr("Screencast from %1").arg(QDateTime::currentDateTime().toString(QLatin1String("yyyy-MM-dd hh:mm:ss"))));
}

void Screencap::initialize()
void Screencast::initialize()
{
if (m_initialized)
return;

// Interfaces
connect(m_registry, &Client::Registry::interfacesAnnounced,
this, &Screencap::interfacesAnnounced);
this, &Screencast::interfacesAnnounced);
connect(m_registry, &Client::Registry::interfaceAnnounced,
this, &Screencap::interfaceAnnounced);
this, &Screencast::interfaceAnnounced);

// Setup registry
m_registry->create(m_connection->display());
Expand All @@ -150,7 +150,7 @@ void Screencap::initialize()
m_initialized = true;
}

void Screencap::process()
void Screencast::process()
{
// Do not create the pipeline twice
if (!m_pipeline.isNull())
Expand Down Expand Up @@ -180,15 +180,15 @@ void Screencap::process()
m_pipeline = QGst::Parse::launch(pipelineDescr).dynamicCast<QGst::Pipeline>();
m_appSource.setElement(m_pipeline->getElementByName("screencap"));

QGlib::connect(m_pipeline->bus(), "message::info", this, &Screencap::busMessage);
QGlib::connect(m_pipeline->bus(), "message::warning", this, &Screencap::busMessage);
QGlib::connect(m_pipeline->bus(), "message::error", this, &Screencap::busMessage);
QGlib::connect(m_pipeline->bus(), "message::info", this, &Screencast::busMessage);
QGlib::connect(m_pipeline->bus(), "message::warning", this, &Screencast::busMessage);
QGlib::connect(m_pipeline->bus(), "message::error", this, &Screencast::busMessage);
m_pipeline->bus()->addSignalWatch();

m_pipeline->setState(QGst::StatePlaying);
}

void Screencap::start()
void Screencast::start()
{
if (m_inProgress) {
qWarning("Cannot take another screenshot while a previous capture is in progress");
Expand Down Expand Up @@ -263,7 +263,7 @@ void Screencap::start()
m_inProgress = true;
}

void Screencap::interfacesAnnounced()
void Screencast::interfacesAnnounced()
{
if (!m_shm)
qCritical("Unable to create shared memory buffers");
Expand All @@ -274,16 +274,16 @@ void Screencap::interfacesAnnounced()
start();
}

void Screencap::interfaceAnnounced(const QByteArray &interface,
quint32 name, quint32 version)
void Screencast::interfaceAnnounced(const QByteArray &interface,
quint32 name, quint32 version)
{
if (interface == Client::Shm::interfaceName())
m_shm = m_registry->createShm(name, version);
else if (interface == Client::Screencaster::interfaceName())
m_screencaster = m_registry->createScreencaster(m_shm, name, version);
}

void Screencap::busMessage(const QGst::MessagePtr &message)
void Screencast::busMessage(const QGst::MessagePtr &message)
{
switch (message->type()) {
case QGst::MessageEos:
Expand All @@ -305,4 +305,4 @@ void Screencap::busMessage(const QGst::MessagePtr &message)
}
}

#include "moc_screencap.cpp"
#include "moc_screencast.cpp"
12 changes: 6 additions & 6 deletions screencast/screencap.h → screencast/screencast.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
* $END_LICENSE$
***************************************************************************/

#ifndef SCREENCAP_H
#define SCREENCAP_H
#ifndef SCREENCAST_H
#define SCREENCAST_H

#include <QtCore/QObject>
#include <QtCore/QThread>
Expand Down Expand Up @@ -55,12 +55,12 @@ class AppSource : public QGst::Utils::ApplicationSource
bool m_stop;
};

class Screencap : public QObject
class Screencast : public QObject
{
Q_OBJECT
public:
Screencap(QObject *parent = Q_NULLPTR);
~Screencap();
Screencast(QObject *parent = Q_NULLPTR);
~Screencast();

protected:
bool event(QEvent *event) Q_DECL_OVERRIDE;
Expand Down Expand Up @@ -98,4 +98,4 @@ class StartupEvent : public QEvent
StartupEvent();
};

#endif // SCREENCAP_H
#endif // SCREENCAST_H

0 comments on commit 4a404d3

Please sign in to comment.