Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DBus API for the RecordPage. #399

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -17473,11 +17473,11 @@ if test -n "$QT4_CFLAGS"; then
elif test -n "$PKG_CONFIG"; then
if test -n "$PKG_CONFIG" && \
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"QtCore >= 4.8.0 QtGui\""; } >&5
($PKG_CONFIG --exists --print-errors "QtCore >= 4.8.0 QtGui") 2>&5
($PKG_CONFIG --exists --print-errors "QtCore >= 4.8.0 QtGui QtDBus") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
pkg_cv_QT4_CFLAGS=`$PKG_CONFIG --cflags "QtCore >= 4.8.0 QtGui" 2>/dev/null`
pkg_cv_QT4_CFLAGS=`$PKG_CONFIG --cflags "QtCore >= 4.8.0 QtGui QtDBus" 2>/dev/null`
test "x$?" != "x0" && pkg_failed=yes
else
pkg_failed=yes
Expand All @@ -17490,11 +17490,11 @@ if test -n "$QT4_LIBS"; then
elif test -n "$PKG_CONFIG"; then
if test -n "$PKG_CONFIG" && \
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"QtCore >= 4.8.0 QtGui\""; } >&5
($PKG_CONFIG --exists --print-errors "QtCore >= 4.8.0 QtGui") 2>&5
($PKG_CONFIG --exists --print-errors "QtCore >= 4.8.0 QtGui QtDBus") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
pkg_cv_QT4_LIBS=`$PKG_CONFIG --libs "QtCore >= 4.8.0 QtGui" 2>/dev/null`
pkg_cv_QT4_LIBS=`$PKG_CONFIG --libs "QtCore >= 4.8.0 QtGui QtDBus" 2>/dev/null`
test "x$?" != "x0" && pkg_failed=yes
else
pkg_failed=yes
Expand Down
7 changes: 7 additions & 0 deletions src/GUI/MainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ along with SimpleScreenRecorder. If not, see <http://www.gnu.org/licenses/>.
#include "PageInput.h"
#include "PageOutput.h"
#include "PageRecord.h"
#include "PageRecordAdaptor.h"
#include "PageDone.h"

ENUMSTRINGS(MainWindow::enum_nvidia_disable_flipping) = {
Expand All @@ -53,6 +54,12 @@ MainWindow::MainWindow()
m_page_input = new PageInput(this);
m_page_output = new PageOutput(this);
m_page_record = new PageRecord(this);
m_page_record_adaptor = new PageRecordAdaptor(m_page_record);
QDBusConnection connection = QDBusConnection::sessionBus();
bool rel = connection.registerService("be.maartenbaert.ssr");
rel = connection.registerObject("/",m_page_record);


m_page_done = new PageDone(this);

m_stacked_layout = new QStackedLayout(centralwidget);
Expand Down
5 changes: 5 additions & 0 deletions src/GUI/MainWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,15 @@ along with SimpleScreenRecorder. If not, see <http://www.gnu.org/licenses/>.
#pragma once
#include "Global.h"

#include <QDBusConnection>


class PageWelcome;
class PageInput;
class PageOutput;
class PageRecord;
class PageDone;
class PageRecordAdaptor;

class MainWindow : public QMainWindow {
Q_OBJECT
Expand All @@ -50,6 +54,7 @@ class MainWindow : public QMainWindow {
PageInput *m_page_input;
PageOutput *m_page_output;
PageRecord *m_page_record;
PageRecordAdaptor *m_page_record_adaptor;
PageDone *m_page_done;

public:
Expand Down
38 changes: 36 additions & 2 deletions src/GUI/PageOutput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,19 @@ void PageOutput::LoadProfileSettings(QSettings* settings) {
}

// load settings
SetFile(settings->value("output/file", "").toString());
QString title("/home/renaud/Parties/%1_%2_%3.mp4");
QString date = QDate::currentDate().toString("yyyy_MM_dd");
QString game("L5R");
QString number;
number = number.setNum(settings->value("output/fileL5R", "57").toInt()+1);//57
if(QDate::currentDate().dayOfWeek() == 1 )//monday
{
game = "COPS";
number = number.setNum(settings->value("output/fileCOPS", "37").toInt()+1);//37
}

//SetFile(settings->value("output/file", "").toString());
SetFile(title.arg(game).arg(number).arg(date));
SetSeparateFiles(settings->value("output/separate_files", false).toBool());
SetContainer(StringToEnum(settings->value("output/container", QString()).toString(), default_container));
SetContainerAV(FindContainerAV(settings->value("output/container_av", QString()).toString()));
Expand Down Expand Up @@ -440,7 +452,29 @@ void PageOutput::LoadProfileSettings(QSettings* settings) {

void PageOutput::SaveProfileSettings(QSettings* settings) {

settings->setValue("output/file", GetFile());
//settings->setValue("output/file", GetFile());

QString filename = GetFile();
QStringList list = filename.split('_');
QString number;
QString game("L5R");
if(list.size()>=2)
{
number = list[1];
}
if(!number.isEmpty())
{
QString key("output/fileL5R");
if(QDate::currentDate().dayOfWeek() == 1 )//monday
{
game = "COPS";
key = "output/fileCOPS";
}
if(filename.contains(game))
{
settings->setValue(key,number);
}
}
settings->setValue("output/separate_files", GetSeparateFiles());
settings->setValue("output/container", EnumToString(GetContainer()));
settings->setValue("output/container_av", m_containers_av[GetContainerAV()].avname);
Expand Down
4 changes: 2 additions & 2 deletions src/GUI/PageRecord.h
Original file line number Diff line number Diff line change
Expand Up @@ -174,11 +174,11 @@ public slots:
void OnUpdateHotkey();
void OnUpdateSoundNotifications();

private slots:
void OnRecordStartPause();
void OnPreviewStartStop();
void OnCancel();
void OnSave();
private slots:
void OnPreviewStartStop();

void OnUpdateInformation();
void OnNewLogLine(Logger::enum_type type, QString string);
Expand Down
71 changes: 71 additions & 0 deletions src/GUI/PageRecordAdaptor.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
/*
* This file was generated by qdbusxml2cpp version 0.8
* Command line was: qdbusxml2cpp -c PageRecordAdaptor -a PageRecordAdaptor.h:PageRecordAdaptor.cpp be.maartenbaert.xml
*
* qdbusxml2cpp is Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
*
* This is an auto-generated file.
* Do not edit! All changes made to it will be lost.
*/

#include "PageRecordAdaptor.h"
#include <QtCore/QMetaObject>
#include <QtCore/QByteArray>
#include <QtCore/QList>
#include <QtCore/QMap>
#include <QtCore/QString>
#include <QtCore/QStringList>
#include <QtCore/QVariant>

/*
* Implementation of adaptor class PageRecordAdaptor
*/

PageRecordAdaptor::PageRecordAdaptor(QObject *parent)
: QDBusAbstractAdaptor(parent)
{
// constructor
setAutoRelaySignals(true);
}

PageRecordAdaptor::~PageRecordAdaptor()
{
// destructor
}

void PageRecordAdaptor::OnCancel()
{
// handle method call local.PageRecord.OnCancel
QMetaObject::invokeMethod(parent(), "OnCancel");
}

void PageRecordAdaptor::OnRecordStartPause()
{
// handle method call local.PageRecord.OnRecordStartPause
QMetaObject::invokeMethod(parent(), "OnRecordStartPause");
}

void PageRecordAdaptor::OnSave()
{
// handle method call local.PageRecord.OnSave
QMetaObject::invokeMethod(parent(), "OnSave");
}

void PageRecordAdaptor::OnUpdateHotkey()
{
// handle method call local.PageRecord.OnUpdateHotkey
QMetaObject::invokeMethod(parent(), "OnUpdateHotkey");
}

void PageRecordAdaptor::OnUpdateHotkeyFields()
{
// handle method call local.PageRecord.OnUpdateHotkeyFields
QMetaObject::invokeMethod(parent(), "OnUpdateHotkeyFields");
}

void PageRecordAdaptor::OnUpdateSoundNotifications()
{
// handle method call local.PageRecord.OnUpdateSoundNotifications
QMetaObject::invokeMethod(parent(), "OnUpdateSoundNotifications");
}

58 changes: 58 additions & 0 deletions src/GUI/PageRecordAdaptor.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
/*
* This file was generated by qdbusxml2cpp version 0.8
* Command line was: qdbusxml2cpp -c PageRecordAdaptor -a PageRecordAdaptor.h:PageRecordAdaptor.cpp be.maartenbaert.xml
*
* qdbusxml2cpp is Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
*
* This is an auto-generated file.
* This file may have been hand-edited. Look for HAND-EDIT comments
* before re-generating it.
*/

#ifndef PAGERECORDADAPTOR_H_1448527563
#define PAGERECORDADAPTOR_H_1448527563

#include <QtCore/QObject>
#include <QtDBus/QtDBus>
QT_BEGIN_NAMESPACE
class QByteArray;
template<class T> class QList;
template<class Key, class Value> class QMap;
class QString;
class QStringList;
class QVariant;
QT_END_NAMESPACE

/*
* Adaptor class for interface local.PageRecord
*/
class PageRecordAdaptor: public QDBusAbstractAdaptor
{
Q_OBJECT
Q_CLASSINFO("D-Bus Interface", "local.PageRecord")
Q_CLASSINFO("D-Bus Introspection", ""
" <interface name=\"local.PageRecord\">\n"
" <method name=\"OnUpdateHotkeyFields\"/>\n"
" <method name=\"OnUpdateHotkey\"/>\n"
" <method name=\"OnUpdateSoundNotifications\"/>\n"
" <method name=\"OnRecordStartPause\"/>\n"
" <method name=\"OnCancel\"/>\n"
" <method name=\"OnSave\"/>\n"
" </interface>\n"
"")
public:
PageRecordAdaptor(QObject *parent);
virtual ~PageRecordAdaptor();

public: // PROPERTIES
public Q_SLOTS: // METHODS
void OnCancel();
void OnRecordStartPause();
void OnSave();
void OnUpdateHotkey();
void OnUpdateHotkeyFields();
void OnUpdateSoundNotifications();
Q_SIGNALS: // SIGNALS
};

#endif
17 changes: 17 additions & 0 deletions src/GUI/be.maartenbaert.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
<node>
<interface name="local.PageRecord">
<method name="OnUpdateHotkeyFields">
</method>
<method name="OnUpdateHotkey">
</method>
<method name="OnUpdateSoundNotifications">
</method>
<method name="OnRecordStartPause">
</method>
<method name="OnCancel">
</method>
<method name="OnSave">
</method>
</interface>
</node>
Loading