Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Add option to shutdown after rendering, only works for KDE sessions:

http://www.kdenlive.org/mantis/view.php?id=1162

svn path=/trunk/kdenlive/; revision=3944
parent d763dfa9
......@@ -1669,6 +1669,7 @@ void MainWindow::slotRenderProject()
if (!m_renderWidget) {
QString projectfolder = m_activeDocument ? m_activeDocument->projectFolder().path(KUrl::AddTrailingSlash) : KdenliveSettings::defaultprojectfolder();
m_renderWidget = new RenderWidget(projectfolder, this);
connect(m_renderWidget, SIGNAL(shutdown()), this, SLOT(slotShutdown()));
connect(m_renderWidget, SIGNAL(selectedRenderProfile(const QString &, const QString &, const QString&)), this, SLOT(slotSetDocumentRenderProfile(const QString &, const QString &, const QString&)));
connect(m_renderWidget, SIGNAL(prepareRenderingData(bool, bool, const QString&)), this, SLOT(slotPrepareRendering(bool, bool, const QString&)));
connect(m_renderWidget, SIGNAL(abortProcess(const QString &)), this, SIGNAL(abortRenderJob(const QString &)));
......@@ -2861,4 +2862,16 @@ void MainWindow::slotRevert()
doOpenFile(url, NULL);
}
void MainWindow::slotShutdown()
{
if (m_activeDocument) m_activeDocument->setModified(false);
// Call shutdown
QDBusConnectionInterface* interface = QDBusConnection::sessionBus().interface();
if (interface && interface->isServiceRegistered("org.kde.ksmserver")) {
QDBusInterface smserver("org.kde.ksmserver", "/KSMServer", "org.kde.KSMServerInterface");
smserver.call("logout", 1, 2, 2);
}
}
#include "mainwindow.moc"
......@@ -317,6 +317,7 @@ private slots:
void slotSetZoom(int value);
void slotUpdateClipMarkers(DocClipBase *clip);
void slotRevert();
void slotShutdown();
signals:
Q_SCRIPTABLE void abortRenderJob(const QString &url);
......
......@@ -380,7 +380,7 @@ void RecMonitor::slotStartCapture(bool play)
m_captureProcess->setStandardOutputProcess(m_displayProcess);
m_captureProcess->setWorkingDirectory(KdenliveSettings::capturefolder());
kDebug() << "Capture: Running dvgrab " << m_captureArgs.join(" ");
m_captureProcess->start(KdenliveSettings::dvgrab_path(), m_captureArgs);
if (play) m_captureProcess->write(" ", 1);
m_discAction->setEnabled(true);
......
......@@ -42,6 +42,8 @@
#include <QMenu>
#include <QInputDialog>
#include <QProcess>
#include <QDBusConnectionInterface>
#include <QDBusInterface>
const int GroupRole = Qt::UserRole;
const int ExtensionRole = GroupRole + 1;
......@@ -186,6 +188,11 @@ RenderWidget::RenderWidget(const QString &projectfolder, QWidget * parent) :
if (m_renderer.isEmpty()) m_renderer = "kdenlive_render";
}
QDBusConnectionInterface* interface = QDBusConnection::sessionBus().interface();
if (!interface || !interface->isServiceRegistered("org.kde.ksmserver")) {
m_view.shutdown->setEnabled(false);
}
focusFirstVisibleItem();
}
......@@ -815,6 +822,7 @@ void RenderWidget::slotExport(bool scriptExport, int zoneIn, int zoneOut, const
void RenderWidget::checkRenderStatus()
{
// check if we have a job waiting to render
if (m_blockProcessing) return;
QTreeWidgetItem *item = m_view.running_jobs->topLevelItem(0);
while (item) {
......@@ -822,9 +830,11 @@ void RenderWidget::checkRenderStatus()
item = m_view.running_jobs->itemBelow(item);
}
item = m_view.running_jobs->topLevelItem(0);
bool waitingJob = false;
while (item) {
if (item->data(1, Qt::UserRole + 2).toInt() == WAITINGJOB) {
item->setData(1, Qt::UserRole + 1, QTime::currentTime());
waitingJob = true;
if (item->data(1, Qt::UserRole + 4).isNull()) {
// Normal render process
if (QProcess::startDetached(m_renderer, item->data(1, Qt::UserRole + 3).toStringList()) == false) {
......@@ -846,6 +856,7 @@ void RenderWidget::checkRenderStatus()
}
item = m_view.running_jobs->itemBelow(item);
}
if (waitingJob == false && m_view.shutdown->isChecked()) emit shutdown();
}
int RenderWidget::waitingJobsCount() const
......
......@@ -162,6 +162,7 @@ signals:
(profile destination, profile name and url of rendered file */
void selectedRenderProfile(const QString &, const QString &, const QString &);
void prepareRenderingData(bool scriptExport, bool zoneOnly, const QString &chapterFile);
void shutdown();
};
......
......@@ -338,7 +338,7 @@
<string>Job Queue</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_5">
<item row="1" column="2">
<item row="2" column="2">
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
......@@ -351,14 +351,14 @@
</property>
</spacer>
</item>
<item row="1" column="0">
<item row="2" column="0">
<widget class="QPushButton" name="abort_job">
<property name="text">
<string>Abort Job</string>
</property>
</widget>
</item>
<item row="1" column="3">
<item row="2" column="3">
<widget class="KPushButton" name="buttonClose2">
<property name="text">
<string>Close</string>
......@@ -426,13 +426,20 @@
</widget>
</widget>
</item>
<item row="1" column="1">
<item row="2" column="1">
<widget class="QPushButton" name="clean_up">
<property name="text">
<string>Clean Up</string>
</property>
</widget>
</item>
<item row="1" column="0" colspan="4">
<widget class="QCheckBox" name="shutdown">
<property name="text">
<string>Shutdown computer after renderings</string>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_3">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment