Skip to content

Commit

Permalink
RecordingManager: style cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
ronso0 committed Jan 25, 2022
1 parent 1755034 commit edb6559
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 40 deletions.
2 changes: 1 addition & 1 deletion src/library/recording/recordingfeature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ QVariant RecordingFeature::title() {
TreeItemModel* RecordingFeature::sidebarModel() const {
return m_pSidebarModel;
}

void RecordingFeature::bindLibraryWidget(WLibrary* pLibraryWidget,
KeyboardEventFilter *keyboard) {
//The view will be deleted by LibraryWidget
Expand Down Expand Up @@ -67,7 +68,6 @@ void RecordingFeature::bindLibraryWidget(WLibrary* pLibraryWidget,
&RecordingFeature::restoreModelState);
}


void RecordingFeature::activate() {
emit refreshBrowseModel();
emit switchToView(kViewName);
Expand Down
71 changes: 32 additions & 39 deletions src/recording/recordingmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,7 @@ void RecordingManager::splitContinueRecording()
m_recReady->set(RECORD_SPLIT_CONTINUE);
}

void RecordingManager::stopRecording()
{
void RecordingManager::stopRecording() {
qDebug() << "Recording stopped";
m_recReady->set(RECORD_OFF);
m_recordingFile = "";
Expand Down Expand Up @@ -201,20 +200,18 @@ QString& RecordingManager::getRecordingDir() {
}

// Only called when recording is active.
void RecordingManager::slotDurationRecorded(quint64 duration)
{
if(m_secondsRecordedSplit != duration)
{
void RecordingManager::slotDurationRecorded(quint64 duration) {
if (m_secondsRecordedSplit != duration) {
m_secondsRecordedSplit = duration;
if(duration >= m_split_time)
{
if (duration >= m_split_time) {
qDebug() << "Splitting after " << duration << " seconds";
// This will reuse the previous filename but append a suffix.
splitContinueRecording();
}
emit durationRecorded(getRecordedDurationStr(m_secondsRecorded+m_secondsRecordedSplit));
}
}

// Copy from the implementation in enginerecord.cpp
QString RecordingManager::getRecordedDurationStr(unsigned int duration) {
return QString("%1:%2")
Expand All @@ -223,17 +220,15 @@ QString RecordingManager::getRecordedDurationStr(unsigned int duration) {
}

// Only called when recording is active.
void RecordingManager::slotBytesRecorded(int bytes)
{
void RecordingManager::slotBytesRecorded(int bytes) {
// auto conversion to quint64
m_iNumberOfBytesRecorded += bytes;
m_iNumberOfBytesRecordedSplit += bytes;

//Split before reaching the max size. m_split_size has some headroom, as
//seen in the constant definitions in defs_recording.h. Also, note that
//bytes are increased in the order of 10s of KBs each call.
if(m_iNumberOfBytesRecordedSplit >= m_split_size)
{
if (m_iNumberOfBytesRecordedSplit >= m_split_size) {
qDebug() << "Splitting after " << m_iNumberOfBytesRecorded << " bytes written";
// This will reuse the previous filename but append a suffix.
splitContinueRecording();
Expand Down Expand Up @@ -314,34 +309,32 @@ const QString& RecordingManager::getRecordingLocation() const {
return m_recordingLocation;
}


quint64 RecordingManager::getFileSplitSize()
{
QString fileSizeStr = m_pConfig->getValueString(ConfigKey(RECORDING_PREF_KEY, "FileSize"));
if (fileSizeStr == SPLIT_650MB) {
return SIZE_650MB;
} else if (fileSizeStr == SPLIT_700MB) {
return SIZE_700MB;
} else if (fileSizeStr == SPLIT_1024MB) {
return SIZE_1GB;
} else if (fileSizeStr == SPLIT_2048MB) {
return SIZE_2GB;
} else if (fileSizeStr == SPLIT_4096MB) {
return SIZE_4GB;
} else if (fileSizeStr == SPLIT_60MIN) {
return SIZE_4GB; //Ignore size limit. use time limit
} else if (fileSizeStr == SPLIT_74MIN) {
return SIZE_4GB; //Ignore size limit. use time limit
} else if (fileSizeStr == SPLIT_80MIN) {
return SIZE_4GB; //Ignore size limit. use time limit
} else if (fileSizeStr == SPLIT_120MIN) {
return SIZE_4GB; //Ignore size limit. use time limit
} else {
return SIZE_650MB;
}
quint64 RecordingManager::getFileSplitSize() {
QString fileSizeStr = m_pConfig->getValueString(ConfigKey(RECORDING_PREF_KEY, "FileSize"));
if (fileSizeStr == SPLIT_650MB) {
return SIZE_650MB;
} else if (fileSizeStr == SPLIT_700MB) {
return SIZE_700MB;
} else if (fileSizeStr == SPLIT_1024MB) {
return SIZE_1GB;
} else if (fileSizeStr == SPLIT_2048MB) {
return SIZE_2GB;
} else if (fileSizeStr == SPLIT_4096MB) {
return SIZE_4GB;
} else if (fileSizeStr == SPLIT_60MIN) {
return SIZE_4GB; //Ignore size limit. use time limit
} else if (fileSizeStr == SPLIT_74MIN) {
return SIZE_4GB; //Ignore size limit. use time limit
} else if (fileSizeStr == SPLIT_80MIN) {
return SIZE_4GB; //Ignore size limit. use time limit
} else if (fileSizeStr == SPLIT_120MIN) {
return SIZE_4GB; //Ignore size limit. use time limit
} else {
return SIZE_650MB;
}
}
unsigned int RecordingManager::getFileSplitSeconds()
{

unsigned int RecordingManager::getFileSplitSeconds() {
QString fileSizeStr = m_pConfig->getValueString(ConfigKey(RECORDING_PREF_KEY, "FileSize"));
if (fileSizeStr == SPLIT_60MIN) {
return 60*60;
Expand Down

0 comments on commit edb6559

Please sign in to comment.