Krita Source Code Documentation
Loading...
Searching...
No Matches
RecorderExportConfig Class Reference

#include <recorder_export_config.h>

Public Member Functions

QList< RecorderProfiledefaultProfiles () const
 
QSet< int > editedProfilesIndexes () const
 
bool extendResult () const
 
QString ffmpegPath () const
 
int firstFrameSec () const
 
int fps () const
 
int inputFps () const
 
int lastFrameSec () const
 
void loadConfiguration (RecorderExportSettings *settings, bool loadLockFps=true) const
 
bool lockFps () const
 
bool lockRatio () const
 
int profileIndex () const
 
QList< RecorderProfileprofiles () const
 
 RecorderExportConfig (bool readOnly)
 
bool resize () const
 
bool resultPreview () const
 
void setEditedProfilesIndexes (const QSet< int > &value)
 
void setExtendResult (bool value)
 
void setFfmpegPath (const QString &value)
 
void setFirstFrameSec (int value)
 
void setFps (int value)
 
void setInputFps (int value)
 
void setLastFrameSec (int value)
 
void setLockFps (bool value)
 
void setLockRatio (bool value)
 
void setProfileIndex (int value)
 
void setProfiles (const QList< RecorderProfile > &value)
 
void setResize (bool value)
 
void setResultPreview (bool value)
 
void setSize (const QSize &value)
 
void setVideoDirectory (const QString &value)
 
QSize size () const
 
QString videoDirectory () const
 
 ~RecorderExportConfig ()
 

Private Attributes

KisConfigconfig
 

Detailed Description

Definition at line 18 of file recorder_export_config.h.

Constructor & Destructor Documentation

◆ RecorderExportConfig()

RecorderExportConfig::RecorderExportConfig ( bool readOnly)

Definition at line 191 of file recorder_export_config.cpp.

192 : config(new KisConfig(readOnly))
193{
194}

◆ ~RecorderExportConfig()

RecorderExportConfig::~RecorderExportConfig ( )

Definition at line 196 of file recorder_export_config.cpp.

197{
198 delete config;
199}

References config.

Member Function Documentation

◆ defaultProfiles()

QList< RecorderProfile > RecorderExportConfig::defaultProfiles ( ) const

Definition at line 426 of file recorder_export_config.cpp.

427{
428 return ::defaultProfiles;
429}

◆ editedProfilesIndexes()

QSet< int > RecorderExportConfig::editedProfilesIndexes ( ) const

Definition at line 431 of file recorder_export_config.cpp.

432{
433 const QVariantList &readValue = config->readEntry(keyEditedProfiles, QVariantList());
434 QSet<int> result;
435 for (const QVariant &item : readValue) {
436 result.insert(item.toInt());
437 }
438 return result;
439}
T readEntry(const QString &name, const T &defaultValue=T())
Definition kis_config.h:875

References config, and KisConfig::readEntry().

◆ extendResult()

bool RecorderExportConfig::extendResult ( ) const

Definition at line 268 of file recorder_export_config.cpp.

269{
270 return config->readEntry(keyExtendResult, true);
271}

References config, and KisConfig::readEntry().

◆ ffmpegPath()

QString RecorderExportConfig::ffmpegPath ( ) const

Definition at line 451 of file recorder_export_config.cpp.

452{
453 return KisConfig(true).ffmpegLocation();
454}
QString ffmpegLocation(bool defaultValue=false) const

References KisConfig::ffmpegLocation().

◆ firstFrameSec()

int RecorderExportConfig::firstFrameSec ( ) const

Definition at line 257 of file recorder_export_config.cpp.

258{
259 return config->readEntry(keyFirstFrameSec, 2);
260}

References config, and KisConfig::readEntry().

◆ fps()

int RecorderExportConfig::fps ( ) const

Definition at line 237 of file recorder_export_config.cpp.

238{
239 return config->readEntry(keyFps, 30);
240}

References config, and KisConfig::readEntry().

◆ inputFps()

int RecorderExportConfig::inputFps ( ) const

Definition at line 226 of file recorder_export_config.cpp.

227{
228 return config->readEntry(keyInputFps, 30);
229}

References config, and KisConfig::readEntry().

◆ lastFrameSec()

int RecorderExportConfig::lastFrameSec ( ) const

Definition at line 278 of file recorder_export_config.cpp.

279{
280 return config->readEntry(keyLastFrameSec, 5);
281}

References config, and KisConfig::readEntry().

◆ loadConfiguration()

void RecorderExportConfig::loadConfiguration ( RecorderExportSettings * settings,
bool loadLockFps = true ) const

Definition at line 201 of file recorder_export_config.cpp.

202{
203 settings->inputFps = inputFps();
204 settings->fps = fps();
205 settings->resultPreview = resultPreview();
206 settings->firstFrameSec = firstFrameSec();
207 settings->extendResult = extendResult();
208 settings->lastFrameSec = lastFrameSec();
209 settings->resize = resize();
210 settings->size = size();
211 settings->lockRatio = lockRatio();
212#ifdef Q_OS_ANDROID
213 settings->selectedFormat = selectedFormat();
214 settings->formatPreferences = formatPreferences();
215#else
216 settings->ffmpegPath = ffmpegPath();
217 settings->profiles = profiles();
218 settings->defaultProfiles = defaultProfiles();
219 settings->profileIndex = profileIndex();
220 settings->videoDirectory = videoDirectory();
221#endif
222 if (loadLockFps)
223 settings->lockFps = lockFps();
224}
QList< RecorderProfile > defaultProfiles() const
QList< RecorderProfile > profiles() const
QList< RecorderProfile > profiles
QList< RecorderProfile > defaultProfiles

References defaultProfiles(), RecorderExportSettings::defaultProfiles, extendResult(), RecorderExportSettings::extendResult, ffmpegPath(), RecorderExportSettings::ffmpegPath, firstFrameSec(), RecorderExportSettings::firstFrameSec, fps(), RecorderExportSettings::fps, inputFps(), RecorderExportSettings::inputFps, lastFrameSec(), RecorderExportSettings::lastFrameSec, lockFps(), RecorderExportSettings::lockFps, lockRatio(), RecorderExportSettings::lockRatio, profileIndex(), RecorderExportSettings::profileIndex, profiles(), RecorderExportSettings::profiles, resize(), RecorderExportSettings::resize, resultPreview(), RecorderExportSettings::resultPreview, size(), RecorderExportSettings::size, videoDirectory(), and RecorderExportSettings::videoDirectory.

◆ lockFps()

bool RecorderExportConfig::lockFps ( ) const

Definition at line 320 of file recorder_export_config.cpp.

321{
322 return config->readEntry(keyLockFps, false);
323}

References config, and KisConfig::readEntry().

◆ lockRatio()

bool RecorderExportConfig::lockRatio ( ) const

Definition at line 310 of file recorder_export_config.cpp.

311{
312 return config->readEntry(keyLockRatio, false);
313}

References config, and KisConfig::readEntry().

◆ profileIndex()

int RecorderExportConfig::profileIndex ( ) const

Definition at line 358 of file recorder_export_config.cpp.

359{
360 return config->readEntry(keyProfileIndex, 0);
361}

References config, and KisConfig::readEntry().

◆ profiles()

QList< RecorderProfile > RecorderExportConfig::profiles ( ) const

Definition at line 368 of file recorder_export_config.cpp.

369{
370 const QString &profilesStr = config->readEntry(keyProfiles, QString());
371 if (profilesStr.isEmpty())
372 return ::defaultProfiles;
373
374 const QSet<int> &editedIndexes = editedProfilesIndexes();
376 const QStringList &profilesList = profilesStr.split("\n");
377 int index = 0;
378 for (const QString &profileStr : profilesList) {
379 // take saved profile in case it's edited.. or something bad happen
380 if (editedIndexes.contains(index) || index >= ::defaultProfiles.size()) {
381 const QStringList& profileList = profileStr.split("|");
382 if (profileList.size() == 3) {
383 profiles.append({profileList[0], profileList[1], QString(profileList[2]).replace("\\n", "\n")});
384 }
385 } else {
386 // use default profile to make it possible to upgrade
387 profiles.append(::defaultProfiles[index]);
388 }
389
390 ++index;
391 }
392 return profiles;
393}
QSet< int > editedProfilesIndexes() const

References config, defaultProfiles(), editedProfilesIndexes(), profiles(), and KisConfig::readEntry().

◆ resize()

bool RecorderExportConfig::resize ( ) const

Definition at line 288 of file recorder_export_config.cpp.

289{
290 return config->readEntry(keyResize, false);
291}

References config, and KisConfig::readEntry().

◆ resultPreview()

bool RecorderExportConfig::resultPreview ( ) const

Definition at line 247 of file recorder_export_config.cpp.

248{
249 return config->readEntry(keyResultPreview, true);
250}

References config, and KisConfig::readEntry().

◆ setEditedProfilesIndexes()

void RecorderExportConfig::setEditedProfilesIndexes ( const QSet< int > & value)

Definition at line 441 of file recorder_export_config.cpp.

442{
443 QVariantList writeValue;
444 for (int index : value) {
445 writeValue.append(index);
446 }
447 config->writeEntry(keyEditedProfiles, writeValue);
448}
float value(const T *src, size_t ch)
void writeEntry(const QString &name, const T &value)
Definition kis_config.h:865

References config, value(), and KisConfig::writeEntry().

◆ setExtendResult()

void RecorderExportConfig::setExtendResult ( bool value)

Definition at line 273 of file recorder_export_config.cpp.

274{
275 config->writeEntry(keyExtendResult, value);
276}

References config, value(), and KisConfig::writeEntry().

◆ setFfmpegPath()

void RecorderExportConfig::setFfmpegPath ( const QString & value)

Definition at line 456 of file recorder_export_config.cpp.

457{
458 KisConfig cfg(false);
459 cfg.setFFMpegLocation(value);
460}

References KisConfig::setFFMpegLocation(), and value().

◆ setFirstFrameSec()

void RecorderExportConfig::setFirstFrameSec ( int value)

Definition at line 262 of file recorder_export_config.cpp.

263{
264 config->writeEntry(keyFirstFrameSec, value);
265}

References config, value(), and KisConfig::writeEntry().

◆ setFps()

void RecorderExportConfig::setFps ( int value)

Definition at line 242 of file recorder_export_config.cpp.

243{
244 config->writeEntry(keyFps, value);
245}

References config, value(), and KisConfig::writeEntry().

◆ setInputFps()

void RecorderExportConfig::setInputFps ( int value)

Definition at line 231 of file recorder_export_config.cpp.

232{
233 config->writeEntry(keyInputFps, value);
234}

References config, value(), and KisConfig::writeEntry().

◆ setLastFrameSec()

void RecorderExportConfig::setLastFrameSec ( int value)

Definition at line 283 of file recorder_export_config.cpp.

284{
285 config->writeEntry(keyLastFrameSec, value);
286}

References config, value(), and KisConfig::writeEntry().

◆ setLockFps()

void RecorderExportConfig::setLockFps ( bool value)

Definition at line 325 of file recorder_export_config.cpp.

326{
327 config->writeEntry(keyLockFps, value);
328}

References config, value(), and KisConfig::writeEntry().

◆ setLockRatio()

void RecorderExportConfig::setLockRatio ( bool value)

Definition at line 315 of file recorder_export_config.cpp.

316{
317 config->writeEntry(keyLockRatio, value);
318}

References config, value(), and KisConfig::writeEntry().

◆ setProfileIndex()

void RecorderExportConfig::setProfileIndex ( int value)

Definition at line 363 of file recorder_export_config.cpp.

364{
365 config->writeEntry(keyProfileIndex, value);
366}

References config, value(), and KisConfig::writeEntry().

◆ setProfiles()

void RecorderExportConfig::setProfiles ( const QList< RecorderProfile > & value)

Definition at line 395 of file recorder_export_config.cpp.

396{
397 Q_ASSERT(value.size() == ::defaultProfiles.size());
398
399 const QSet<int> &savedEditedProfilesIndexes = editedProfilesIndexes();
400 QSet<int> editedProfilesIndexes = savedEditedProfilesIndexes;
401 QString outValue;
402 const QRegularExpression cleanUp("[\n|]");
403 int index = 0;
404 for (const RecorderProfile &profile : value) {
405 const RecorderProfile &defaultProfile = ::defaultProfiles[index];
406 if (profile != defaultProfile) {
407 editedProfilesIndexes.insert(index);
408 } else {
409 editedProfilesIndexes.remove(index);
410 }
411
412 outValue += QString(profile.name).replace(cleanUp, " ") % "|"
413 % QString(profile.extension).replace(cleanUp, " ") % "|"
414 % QString(profile.arguments).replace("\n", "\\n").replace("|", " ") % "\n";
415
416 ++index;
417 }
418
419 config->writeEntry(keyProfiles, outValue);
420 if (savedEditedProfilesIndexes != editedProfilesIndexes) {
422 }
423}
void setEditedProfilesIndexes(const QSet< int > &value)

References config, defaultProfiles(), editedProfilesIndexes(), setEditedProfilesIndexes(), value(), and KisConfig::writeEntry().

◆ setResize()

void RecorderExportConfig::setResize ( bool value)

Definition at line 293 of file recorder_export_config.cpp.

294{
295 config->writeEntry(keyResize, value);
296}

References config, value(), and KisConfig::writeEntry().

◆ setResultPreview()

void RecorderExportConfig::setResultPreview ( bool value)

Definition at line 252 of file recorder_export_config.cpp.

253{
254 config->writeEntry(keyResultPreview, value);
255}

References config, value(), and KisConfig::writeEntry().

◆ setSize()

void RecorderExportConfig::setSize ( const QSize & value)

Definition at line 304 of file recorder_export_config.cpp.

305{
306 config->writeEntry(keySize, value);
307}

References config, value(), and KisConfig::writeEntry().

◆ setVideoDirectory()

void RecorderExportConfig::setVideoDirectory ( const QString & value)

Definition at line 468 of file recorder_export_config.cpp.

469{
470 config->writeEntry(keyVideoDirectory, value);
471}

References config, value(), and KisConfig::writeEntry().

◆ size()

QSize RecorderExportConfig::size ( ) const

Definition at line 299 of file recorder_export_config.cpp.

300{
301 return config->readEntry(keySize, QSize(1024, 1024));
302}

References config, and KisConfig::readEntry().

◆ videoDirectory()

QString RecorderExportConfig::videoDirectory ( ) const

Definition at line 463 of file recorder_export_config.cpp.

464{
465 return config->readEntry(keyVideoDirectory, QDir::homePath());
466}

References config, and KisConfig::readEntry().

Member Data Documentation

◆ config

KisConfig* RecorderExportConfig::config
mutableprivate

Definition at line 83 of file recorder_export_config.h.


The documentation for this class was generated from the following files: