PageRecord.cpp (ssr-0.4.0) | : | PageRecord.cpp (ssr-0.4.1) | ||
---|---|---|---|---|
skipping to change at line 52 | skipping to change at line 52 | |||
#if SSR_USE_PULSEAUDIO | #if SSR_USE_PULSEAUDIO | |||
#include "PulseAudioInput.h" | #include "PulseAudioInput.h" | |||
#endif | #endif | |||
#if SSR_USE_JACK | #if SSR_USE_JACK | |||
#include "JACKInput.h" | #include "JACKInput.h" | |||
#endif | #endif | |||
#include "SimpleSynth.h" | #include "SimpleSynth.h" | |||
#include "VideoPreviewer.h" | #include "VideoPreviewer.h" | |||
#include "AudioPreviewer.h" | #include "AudioPreviewer.h" | |||
#include <X11/keysym.h> | ||||
#include <X11/keysymdef.h> | ||||
#include <fcntl.h> | ||||
#include <sys/ioctl.h> | ||||
#include <sys/stat.h> | ||||
#include <sys/types.h> | ||||
#include <termios.h> | ||||
#include <unistd.h> | ||||
static QString GetNewSegmentFile(const QString& file, bool add_timestamp) { | static QString GetNewSegmentFile(const QString& file, bool add_timestamp) { | |||
QFileInfo fi(file); | QFileInfo fi(file); | |||
QDateTime now = QDateTime::currentDateTime(); | QDateTime now = QDateTime::currentDateTime(); | |||
QString newfile; | QString newfile; | |||
unsigned int counter = 0; | unsigned int counter = 0; | |||
do { | do { | |||
++counter; | ++counter; | |||
newfile = fi.path() + "/" + fi.completeBaseName(); | newfile = fi.path() + "/" + fi.completeBaseName(); | |||
if(add_timestamp) | if(add_timestamp) | |||
newfile += "-" + now.toString("yyyy-MM-dd_hh.mm.ss"); | newfile += "-" + now.toString("yyyy-MM-dd_hh.mm.ss"); | |||
skipping to change at line 1374 | skipping to change at line 1364 | |||
OnScheduleActivate(); | OnScheduleActivate(); | |||
} else if(command == "schedule-deactivate") { | } else if(command == "schedule-deactivate") { | |||
OnScheduleDeactivate(); | OnScheduleDeactivate(); | |||
} else if(command == "window-show") { | } else if(command == "window-show") { | |||
m_main_window->OnShow(); | m_main_window->OnShow(); | |||
} else if(command == "window-hide") { | } else if(command == "window-hide") { | |||
m_main_window->OnHide(); | m_main_window->OnHide(); | |||
} else if(command == "quit") { | } else if(command == "quit") { | |||
m_main_window->Quit(); | m_main_window->Quit(); | |||
} else { | } else { | |||
Logger::LogError("[PageRecord::OnStdin] " + tr("Unknown c ommand.").arg(command)); | Logger::LogError("[PageRecord::OnStdin] " + tr("Unknown c ommand.")); | |||
} | } | |||
} | } | |||
} | } | |||
void PageRecord::OnUpdateInformation() { | void PageRecord::OnUpdateInformation() { | |||
if(m_page_started) { | if(m_page_started) { | |||
int64_t total_time = 0; | int64_t total_time = 0; | |||
skipping to change at line 1443 | skipping to change at line 1433 | |||
"frame_rate_in\t" + QString::number(fps_i n, 'f', 8) + "\n" | "frame_rate_in\t" + QString::number(fps_i n, 'f', 8) + "\n" | |||
"frame_rate_out\t" + QString::number(fps_ out, 'f', 8) + "\n" | "frame_rate_out\t" + QString::number(fps_ out, 'f', 8) + "\n" | |||
"size_in_width\t" + QString::number(m_vid eo_in_width) + "\n" | "size_in_width\t" + QString::number(m_vid eo_in_width) + "\n" | |||
"size_in_height\t" + QString::number(m_vi deo_in_height) + "\n" | "size_in_height\t" + QString::number(m_vi deo_in_height) + "\n" | |||
"size_out_width\t" + QString::number(m_ou tput_settings.video_width) + "\n" | "size_out_width\t" + QString::number(m_ou tput_settings.video_width) + "\n" | |||
"size_out_height\t" + QString::number(m_o utput_settings.video_height) + "\n" | "size_out_height\t" + QString::number(m_o utput_settings.video_height) + "\n" | |||
"file_name\t" + file_name + "\n" | "file_name\t" + file_name + "\n" | |||
"file_size\t" + QString::number(total_byt es) + "\n" | "file_size\t" + QString::number(total_byt es) + "\n" | |||
"bit_rate\t" + QString::number(bit_rate) + "\n"; | "bit_rate\t" + QString::number(bit_rate) + "\n"; | |||
QByteArray data = str.toUtf8(); | QByteArray data = str.toUtf8(); | |||
QByteArray old_file = CommandLineOptions::GetStatsFile(). | QByteArray old_file = QFile::encodeName(CommandLineOption | |||
toLocal8Bit(); | s::GetStatsFile()); | |||
QByteArray new_file = (CommandLineOptions::GetStatsFile() | QByteArray new_file = QFile::encodeName(CommandLineOption | |||
+ "-new").toLocal8Bit(); | s::GetStatsFile() + "-new"); | |||
// Qt doesn't get the permissions right (you can only cha nge the permissions after creating the file, that's too late), | // Qt doesn't get the permissions right (you can only cha nge the permissions after creating the file, that's too late), | |||
// and it doesn't allow renaming a file over another file , so don't bother with QFile and just use POSIX and C functions. | // and it doesn't allow renaming a file over another file , so don't bother with QFile and just use POSIX and C functions. | |||
int fd = open(new_file.constData(), O_WRONLY | O_CREAT | O_CLOEXEC, 0600); | int fd = open(new_file.constData(), O_WRONLY | O_CREAT | O_CLOEXEC, 0600); | |||
if(fd != -1) { | if(fd != -1) { | |||
ssize_t b = write(fd, data.constData(), data.size ()); Q_UNUSED(b); | ssize_t b = write(fd, data.constData(), data.size ()); Q_UNUSED(b); | |||
::close(fd); | ::close(fd); | |||
rename(new_file.constData(), old_file.constData() ); | rename(new_file.constData(), old_file.constData() ); | |||
} | } | |||
} | } | |||
skipping to change at line 1467 | skipping to change at line 1457 | |||
m_label_info_total_time->clear(); | m_label_info_total_time->clear(); | |||
m_label_info_frame_rate_in->clear(); | m_label_info_frame_rate_in->clear(); | |||
m_label_info_frame_rate_out->clear(); | m_label_info_frame_rate_out->clear(); | |||
m_label_info_size_in->clear(); | m_label_info_size_in->clear(); | |||
m_label_info_size_out->clear(); | m_label_info_size_out->clear(); | |||
m_label_info_file_name->clear(); | m_label_info_file_name->clear(); | |||
m_label_info_file_size->clear(); | m_label_info_file_size->clear(); | |||
m_label_info_bit_rate->clear(); | m_label_info_bit_rate->clear(); | |||
if(!CommandLineOptions::GetStatsFile().isNull()) { | if(!CommandLineOptions::GetStatsFile().isNull()) { | |||
QByteArray old_file = CommandLineOptions::GetStatsFile(). toLocal8Bit(); | QByteArray old_file = QFile::encodeName(CommandLineOption s::GetStatsFile()); | |||
remove(old_file.constData()); | remove(old_file.constData()); | |||
} | } | |||
} | } | |||
} | } | |||
void PageRecord::OnNewLogLine(Logger::enum_type type, QString string) { | void PageRecord::OnNewLogLine(Logger::enum_type type, QString string) { | |||
#if SSR_USE_ALSA | #if SSR_USE_ALSA | |||
skipping to change at line 1498 | skipping to change at line 1488 | |||
if(m_page_started && type == Logger::TYPE_ERROR && !m_error_occurred) { | if(m_page_started && type == Logger::TYPE_ERROR && !m_error_occurred) { | |||
m_error_occurred = true; | m_error_occurred = true; | |||
UpdateSysTray(); | UpdateSysTray(); | |||
} | } | |||
// add line to log | // add line to log | |||
QTextCursor cursor = m_textedit_log->textCursor(); | QTextCursor cursor = m_textedit_log->textCursor(); | |||
QTextCharFormat format; | QTextCharFormat format; | |||
bool should_scroll = (m_textedit_log->verticalScrollBar()->value() >= m_t extedit_log->verticalScrollBar()->maximum()); | bool should_scroll = (m_textedit_log->verticalScrollBar()->value() >= m_t extedit_log->verticalScrollBar()->maximum()); | |||
switch(type) { | switch(type) { | |||
case Logger::TYPE_INFO: format.setForeground(m_textedit_log-> palette().foreground()); break; | case Logger::TYPE_INFO: format.setForeground(m_textedit_log-> palette().windowText()); break; | |||
case Logger::TYPE_WARNING: format.setForeground(Qt::darkYellow); break; | case Logger::TYPE_WARNING: format.setForeground(Qt::darkYellow); break; | |||
case Logger::TYPE_ERROR: format.setForeground(Qt::red); break; | case Logger::TYPE_ERROR: format.setForeground(Qt::red); break; | |||
case Logger::TYPE_STDERR: format.setForeground(Qt::gray); break; | ||||
} | } | |||
cursor.movePosition(QTextCursor::End); | cursor.movePosition(QTextCursor::End); | |||
if(cursor.position() != 0) | if(cursor.position() != 0) | |||
cursor.insertBlock(); | cursor.insertBlock(); | |||
cursor.insertText(string, format); | cursor.insertText(string, format); | |||
if(should_scroll) | if(should_scroll) | |||
m_textedit_log->verticalScrollBar()->setValue(m_textedit_log->ver ticalScrollBar()->maximum()); | m_textedit_log->verticalScrollBar()->setValue(m_textedit_log->ver ticalScrollBar()->maximum()); | |||
} | } | |||
End of changes. 6 change blocks. | ||||
17 lines changed or deleted | 8 lines changed or added |