Commit 3464894902d9605950872d75a8ba250e2c4d41a3
1 parent
a3530015
Fixed emptygallery progress bug
Showing
1 changed file
with
13 additions
and
1 deletions
openbr/plugins/gallery.cpp
| @@ -145,6 +145,7 @@ class BinaryGallery : public Gallery | @@ -145,6 +145,7 @@ class BinaryGallery : public Gallery | ||
| 145 | gallery.seek(0); | 145 | gallery.seek(0); |
| 146 | 146 | ||
| 147 | TemplateList templates; | 147 | TemplateList templates; |
| 148 | + qDebug() << "testing..."; | ||
| 148 | while ((templates.size() < readBlockSize) && !gallery.atEnd()) { | 149 | while ((templates.size() < readBlockSize) && !gallery.atEnd()) { |
| 149 | const Template t = readTemplate(); | 150 | const Template t = readTemplate(); |
| 150 | if (!t.isEmpty() || !t.file.isNull()) { | 151 | if (!t.isEmpty() || !t.file.isNull()) { |
| @@ -385,9 +386,13 @@ class EmptyGallery : public Gallery | @@ -385,9 +386,13 @@ class EmptyGallery : public Gallery | ||
| 385 | Q_PROPERTY(QString regexp READ get_regexp WRITE set_regexp RESET reset_regexp STORED false) | 386 | Q_PROPERTY(QString regexp READ get_regexp WRITE set_regexp RESET reset_regexp STORED false) |
| 386 | BR_PROPERTY(QString, regexp, QString()) | 387 | BR_PROPERTY(QString, regexp, QString()) |
| 387 | 388 | ||
| 389 | + qint64 gallerySize; | ||
| 390 | + | ||
| 388 | void init() | 391 | void init() |
| 389 | { | 392 | { |
| 390 | - QtUtils::touchDir(QDir(file.name)); | 393 | + QDir dir(file.name); |
| 394 | + QtUtils::touchDir(dir); | ||
| 395 | + gallerySize = dir.count(); | ||
| 391 | } | 396 | } |
| 392 | 397 | ||
| 393 | TemplateList readBlock(bool *done) | 398 | TemplateList readBlock(bool *done) |
| @@ -422,6 +427,8 @@ class EmptyGallery : public Gallery | @@ -422,6 +427,8 @@ class EmptyGallery : public Gallery | ||
| 422 | } | 427 | } |
| 423 | } | 428 | } |
| 424 | 429 | ||
| 430 | + for (int i = 0; i < templates.size(); i++) templates[i].file.set("progress", i); | ||
| 431 | + | ||
| 425 | return templates; | 432 | return templates; |
| 426 | } | 433 | } |
| 427 | 434 | ||
| @@ -445,6 +452,11 @@ class EmptyGallery : public Gallery | @@ -445,6 +452,11 @@ class EmptyGallery : public Gallery | ||
| 445 | } | 452 | } |
| 446 | } | 453 | } |
| 447 | 454 | ||
| 455 | + qint64 totalSize() | ||
| 456 | + { | ||
| 457 | + return gallerySize; | ||
| 458 | + } | ||
| 459 | + | ||
| 448 | static TemplateList getTemplates(const QDir &dir) | 460 | static TemplateList getTemplates(const QDir &dir) |
| 449 | { | 461 | { |
| 450 | const QStringList files = QtUtils::getFiles(dir, true); | 462 | const QStringList files = QtUtils::getFiles(dir, true); |