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 180 of file recorder_export_config.cpp.

181 : config(new KisConfig(readOnly))
182{
183}

◆ ~RecorderExportConfig()

RecorderExportConfig::~RecorderExportConfig ( )

Definition at line 185 of file recorder_export_config.cpp.

186{
187 delete config;
188}

References config.

Member Function Documentation

◆ defaultProfiles()

QList< RecorderProfile > RecorderExportConfig::defaultProfiles ( ) const

Definition at line 382 of file recorder_export_config.cpp.

383{
384 return ::defaultProfiles;
385}

◆ editedProfilesIndexes()

QSet< int > RecorderExportConfig::editedProfilesIndexes ( ) const

Definition at line 387 of file recorder_export_config.cpp.

388{
389 const QVariantList &readValue = config->readEntry(keyEditedProfiles, QVariantList());
390 QSet<int> result;
391 for (const QVariant &item : readValue) {
392 result.insert(item.toInt());
393 }
394 return result;
395}
T readEntry(const QString &name, const T &defaultValue=T())
Definition kis_config.h:789

References config, and KisConfig::readEntry().

◆ extendResult()

bool RecorderExportConfig::extendResult ( ) const

Definition at line 252 of file recorder_export_config.cpp.

253{
254 return config->readEntry(keyExtendResult, true);
255}

References config, and KisConfig::readEntry().

◆ ffmpegPath()

QString RecorderExportConfig::ffmpegPath ( ) const

Definition at line 407 of file recorder_export_config.cpp.

408{
409 return KisConfig(true).ffmpegLocation();
410}
QString ffmpegLocation(bool defaultValue=false) const

References KisConfig::ffmpegLocation().

◆ firstFrameSec()

int RecorderExportConfig::firstFrameSec ( ) const

Definition at line 241 of file recorder_export_config.cpp.

242{
243 return config->readEntry(keyFirstFrameSec, 2);
244}

References config, and KisConfig::readEntry().

◆ fps()

int RecorderExportConfig::fps ( ) const

Definition at line 221 of file recorder_export_config.cpp.

222{
223 return config->readEntry(keyFps, 30);
224}

References config, and KisConfig::readEntry().

◆ inputFps()

int RecorderExportConfig::inputFps ( ) const

Definition at line 210 of file recorder_export_config.cpp.

211{
212 return config->readEntry(keyInputFps, 30);
213}

References config, and KisConfig::readEntry().

◆ lastFrameSec()

int RecorderExportConfig::lastFrameSec ( ) const

Definition at line 262 of file recorder_export_config.cpp.

263{
264 return config->readEntry(keyLastFrameSec, 5);
265}

References config, and KisConfig::readEntry().

◆ loadConfiguration()

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

Definition at line 190 of file recorder_export_config.cpp.

191{
192 settings->inputFps = inputFps();
193 settings->fps = fps();
194 settings->resultPreview = resultPreview();
195 settings->firstFrameSec = firstFrameSec();
196 settings->extendResult = extendResult();
197 settings->lastFrameSec = lastFrameSec();
198 settings->resize = resize();
199 settings->size = size();
200 settings->lockRatio = lockRatio();
201 settings->ffmpegPath = ffmpegPath();
202 settings->profiles = profiles();
203 settings->defaultProfiles = defaultProfiles();
204 settings->profileIndex = profileIndex();
205 settings->videoDirectory = videoDirectory();
206 if (loadLockFps)
207 settings->lockFps = lockFps();
208}
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 304 of file recorder_export_config.cpp.

305{
306 return config->readEntry(keyLockFps, false);
307}

References config, and KisConfig::readEntry().

◆ lockRatio()

bool RecorderExportConfig::lockRatio ( ) const

Definition at line 294 of file recorder_export_config.cpp.

295{
296 return config->readEntry(keyLockRatio, false);
297}

References config, and KisConfig::readEntry().

◆ profileIndex()

int RecorderExportConfig::profileIndex ( ) const

Definition at line 314 of file recorder_export_config.cpp.

315{
316 return config->readEntry(keyProfileIndex, 0);
317}

References config, and KisConfig::readEntry().

◆ profiles()

QList< RecorderProfile > RecorderExportConfig::profiles ( ) const

Definition at line 324 of file recorder_export_config.cpp.

325{
326 const QString &profilesStr = config->readEntry(keyProfiles, QString());
327 if (profilesStr.isEmpty())
328 return ::defaultProfiles;
329
330 const QSet<int> &editedIndexes = editedProfilesIndexes();
332 const QStringList &profilesList = profilesStr.split("\n");
333 int index = 0;
334 for (const QString &profileStr : profilesList) {
335 // take saved profile in case it's edited.. or something bad happen
336 if (editedIndexes.contains(index) || index >= ::defaultProfiles.size()) {
337 const QStringList& profileList = profileStr.split("|");
338 if (profileList.size() == 3) {
339 profiles.append({profileList[0], profileList[1], QString(profileList[2]).replace("\\n", "\n")});
340 }
341 } else {
342 // use default profile to make it possible to upgrade
343 profiles.append(::defaultProfiles[index]);
344 }
345
346 ++index;
347 }
348 return profiles;
349}
QSet< int > editedProfilesIndexes() const

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

◆ resize()

bool RecorderExportConfig::resize ( ) const

Definition at line 272 of file recorder_export_config.cpp.

273{
274 return config->readEntry(keyResize, false);
275}

References config, and KisConfig::readEntry().

◆ resultPreview()

bool RecorderExportConfig::resultPreview ( ) const

Definition at line 231 of file recorder_export_config.cpp.

232{
233 return config->readEntry(keyResultPreview, true);
234}

References config, and KisConfig::readEntry().

◆ setEditedProfilesIndexes()

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

Definition at line 397 of file recorder_export_config.cpp.

398{
399 QVariantList writeValue;
400 for (int index : value) {
401 writeValue.append(index);
402 }
403 config->writeEntry(keyEditedProfiles, writeValue);
404}
float value(const T *src, size_t ch)
void writeEntry(const QString &name, const T &value)
Definition kis_config.h:779

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

◆ setExtendResult()

void RecorderExportConfig::setExtendResult ( bool value)

Definition at line 257 of file recorder_export_config.cpp.

258{
259 config->writeEntry(keyExtendResult, value);
260}

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

◆ setFfmpegPath()

void RecorderExportConfig::setFfmpegPath ( const QString & value)

Definition at line 412 of file recorder_export_config.cpp.

413{
414 KisConfig cfg(false);
415 cfg.setFFMpegLocation(value);
416}

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

◆ setFirstFrameSec()

void RecorderExportConfig::setFirstFrameSec ( int value)

Definition at line 246 of file recorder_export_config.cpp.

247{
248 config->writeEntry(keyFirstFrameSec, value);
249}

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

◆ setFps()

void RecorderExportConfig::setFps ( int value)

Definition at line 226 of file recorder_export_config.cpp.

227{
228 config->writeEntry(keyFps, value);
229}

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

◆ setInputFps()

void RecorderExportConfig::setInputFps ( int value)

Definition at line 215 of file recorder_export_config.cpp.

216{
217 config->writeEntry(keyInputFps, value);
218}

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

◆ setLastFrameSec()

void RecorderExportConfig::setLastFrameSec ( int value)

Definition at line 267 of file recorder_export_config.cpp.

268{
269 config->writeEntry(keyLastFrameSec, value);
270}

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

◆ setLockFps()

void RecorderExportConfig::setLockFps ( bool value)

Definition at line 309 of file recorder_export_config.cpp.

310{
311 config->writeEntry(keyLockFps, value);
312}

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

◆ setLockRatio()

void RecorderExportConfig::setLockRatio ( bool value)

Definition at line 299 of file recorder_export_config.cpp.

300{
301 config->writeEntry(keyLockRatio, value);
302}

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

◆ setProfileIndex()

void RecorderExportConfig::setProfileIndex ( int value)

Definition at line 319 of file recorder_export_config.cpp.

320{
321 config->writeEntry(keyProfileIndex, value);
322}

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

◆ setProfiles()

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

Definition at line 351 of file recorder_export_config.cpp.

352{
353 Q_ASSERT(value.size() == ::defaultProfiles.size());
354
355 const QSet<int> &savedEditedProfilesIndexes = editedProfilesIndexes();
356 QSet<int> editedProfilesIndexes = savedEditedProfilesIndexes;
357 QString outValue;
358 const QRegularExpression cleanUp("[\n|]");
359 int index = 0;
360 for (const RecorderProfile &profile : value) {
361 const RecorderProfile &defaultProfile = ::defaultProfiles[index];
362 if (profile != defaultProfile) {
363 editedProfilesIndexes.insert(index);
364 } else {
365 editedProfilesIndexes.remove(index);
366 }
367
368 outValue += QString(profile.name).replace(cleanUp, " ") % "|"
369 % QString(profile.extension).replace(cleanUp, " ") % "|"
370 % QString(profile.arguments).replace("\n", "\\n").replace("|", " ") % "\n";
371
372 ++index;
373 }
374
375 config->writeEntry(keyProfiles, outValue);
376 if (savedEditedProfilesIndexes != editedProfilesIndexes) {
378 }
379}
void setEditedProfilesIndexes(const QSet< int > &value)

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

◆ setResize()

void RecorderExportConfig::setResize ( bool value)

Definition at line 277 of file recorder_export_config.cpp.

278{
279 config->writeEntry(keyResize, value);
280}

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

◆ setResultPreview()

void RecorderExportConfig::setResultPreview ( bool value)

Definition at line 236 of file recorder_export_config.cpp.

237{
238 config->writeEntry(keyResultPreview, value);
239}

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

◆ setSize()

void RecorderExportConfig::setSize ( const QSize & value)

Definition at line 288 of file recorder_export_config.cpp.

289{
290 config->writeEntry(keySize, value);
291}

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

◆ setVideoDirectory()

void RecorderExportConfig::setVideoDirectory ( const QString & value)

Definition at line 424 of file recorder_export_config.cpp.

425{
426 config->writeEntry(keyVideoDirectory, value);
427}

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

◆ size()

QSize RecorderExportConfig::size ( ) const

Definition at line 283 of file recorder_export_config.cpp.

284{
285 return config->readEntry(keySize, QSize(1024, 1024));
286}

References config, and KisConfig::readEntry().

◆ videoDirectory()

QString RecorderExportConfig::videoDirectory ( ) const

Definition at line 419 of file recorder_export_config.cpp.

420{
421 return config->readEntry(keyVideoDirectory, QDir::homePath());
422}

References config, and KisConfig::readEntry().

Member Data Documentation

◆ config

KisConfig* RecorderExportConfig::config
mutableprivate

Definition at line 75 of file recorder_export_config.h.


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