Skip to content

Commit e4fc90a

Browse files
committed
Tweaks/fixes
1 parent dd86c8d commit e4fc90a

File tree

7 files changed

+43
-19
lines changed

7 files changed

+43
-19
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
cmake_minimum_required(VERSION 3.5)
22

3-
project(parpargui VERSION 0.2 LANGUAGES CXX)
3+
project(parpargui VERSION 0.4 LANGUAGES CXX)
44

55
set(CMAKE_INCLUDE_CURRENT_DIR ON)
66

createprogress.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ void CreateProgress::finished(int exitCode, QProcess::ExitStatus exitStatus)
204204
{
205205
if(isCancelled) return;
206206
if(exitStatus != QProcess::ExitStatus::NormalExit) {
207-
this->ended(tr("ParPar process crashed"), true);
207+
this->ended(tr("ParPar process crashed or failed to start"), true);
208208
} else if(exitCode != 0) {
209209
ended(tr("PAR2 creation failed (exit code: %1)").arg(exitCode), true);
210210
} else {

mainwindow.ui

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@
334334
</size>
335335
</property>
336336
<property name="toolTip">
337-
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Remove selected files from the list of source files&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
337+
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Remove selected files from the list of source files. Removing a folder will remove all files within.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
338338
</property>
339339
<property name="text">
340340
<string>Re&amp;move</string>
@@ -475,7 +475,7 @@
475475
</size>
476476
</property>
477477
<property name="toolTip">
478-
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;How path names should be stored in the PAR2 output&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
478+
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;How path names should be stored in the PAR2 output. This can be:&lt;/p&gt;&lt;p&gt;&lt;span style=&quot; font-style:italic;&quot;&gt;Discard paths&lt;/span&gt;: discard all path names and only store file names (note that you'll need to ensure there's no duplicates)&lt;br/&gt;&lt;span style=&quot; font-style:italic;&quot;&gt;Relative path names&lt;/span&gt;: store the relative path from the &lt;span style=&quot; font-style:italic;&quot;&gt;Base path&lt;/span&gt; for each file&lt;br/&gt;&lt;span style=&quot; font-style:italic;&quot;&gt;Absolute path names&lt;/span&gt;: store full file paths&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
479479
</property>
480480
<property name="currentIndex">
481481
<number>1</number>
@@ -616,6 +616,9 @@
616616
<height>16777215</height>
617617
</size>
618618
</property>
619+
<property name="toolTip">
620+
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Divide each input file by slices of this size.&lt;/p&gt;&lt;p&gt;Slice size must be a multiple of 4 bytes.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
621+
</property>
619622
<property name="text">
620623
<string notr="true">1M</string>
621624
</property>
@@ -642,6 +645,9 @@
642645
<height>16777215</height>
643646
</size>
644647
</property>
648+
<property name="toolTip">
649+
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Total number of slices to divide input files into.&lt;/p&gt;&lt;p&gt;Value must be between 1 and 32768.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
650+
</property>
645651
<property name="minimum">
646652
<number>1</number>
647653
</property>
@@ -662,6 +668,9 @@
662668
</item>
663669
<item row="2" column="1">
664670
<widget class="QLabel" name="lblInslicePadding">
671+
<property name="toolTip">
672+
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Total amount of source data that will be allocated to padding.&lt;/p&gt;&lt;p&gt;Padding occurs when an input file's size is not a multiple of the slice size, to ensure all files fit to whole slices. Padding can generally be reduced by choosing a smaller slice size, or finding a size that suits the input files more appropriately.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
673+
</property>
665674
<property name="text">
666675
<string/>
667676
</property>
@@ -706,6 +715,9 @@
706715
<height>16777215</height>
707716
</size>
708717
</property>
718+
<property name="toolTip">
719+
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Number of recovery slices to generate as a ratio of the number of source slices&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
720+
</property>
709721
<property name="suffix">
710722
<string notr="true">%</string>
711723
</property>
@@ -738,6 +750,9 @@
738750
<height>16777215</height>
739751
</size>
740752
</property>
753+
<property name="toolTip">
754+
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Exact number of recovery slices to generate.&lt;/p&gt;&lt;p&gt;Value must be between 0 and 65535&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
755+
</property>
741756
<property name="maximum">
742757
<number>65535</number>
743758
</property>
@@ -767,6 +782,9 @@
767782
<height>16777215</height>
768783
</size>
769784
</property>
785+
<property name="toolTip">
786+
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Target size of recovery data to generate.&lt;/p&gt;&lt;p&gt;Note that the size of the PAR2 files will be larger (see &lt;span style=&quot; font-style:italic;&quot;&gt;Preview Output&lt;/span&gt; for total output size)&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
787+
</property>
770788
<property name="text">
771789
<string notr="true">100M</string>
772790
</property>

optionsdialog.cpp

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ void OptionsDialog::accept()
231231
QList<OpenclDevice> oclDevices;
232232
if(ui->chkOpencl->isChecked()) {
233233
float totalAlloc = 0;
234-
QHashIterator it(openclSettings);
234+
QHashIterator<QString, OpenclDevice> it(openclSettings);
235235
while(it.hasNext()) {
236236
it.next();
237237
const auto& dev = it.value();
@@ -403,7 +403,7 @@ void OptionsDialog::rescale()
403403
{
404404
int w = ui->treeDevices->width();
405405
ui->treeDevices->header()->setUpdatesEnabled(false);
406-
ui->treeDevices->header()->resizeSection(0, w>185 ? w-65 : 120);
406+
ui->treeDevices->header()->resizeSection(0, w>190 ? w-70 : 120);
407407
ui->treeDevices->header()->resizeSection(1, 60);
408408
ui->treeDevices->header()->setUpdatesEnabled(true);
409409
}
@@ -602,7 +602,7 @@ void OptionsDialog::fillDeviceList(bool opencl)
602602
topItems[0]->setText(1, QLocale().toString(cpuAlloc, 'f', 2) + "%");
603603

604604
// prune unrecognised devices
605-
QMutableHashIterator it(openclSettings);
605+
QMutableHashIterator<QString, OpenclDevice> it(openclSettings);
606606
while(it.hasNext()) {
607607
it.next();
608608
if(!seenDevices.contains(it.key()))
@@ -638,18 +638,21 @@ void OptionsDialog::loadOpenclDevices()
638638

639639
auto parpar = new ParParClient(this);
640640
connect(parpar, &ParParClient::failed, this, [=](const QString& error) {
641-
if(!error.isEmpty()) // isEmpty = cancelled
642-
QMessageBox::warning(this, tr("OpenCL Options"), tr("Failed to query list of OpenCL devices.\n%1").arg(error));
641+
progress->setValue(0); // closes window
642+
delete progress;
643643
haveOclDevices = false;
644644
ui->chkOpencl->setChecked(false);
645-
delete parpar;
645+
parpar->deleteLater();
646+
647+
if(!error.isEmpty()) // isEmpty = cancelled
648+
QMessageBox::warning(this, tr("OpenCL Options"), tr("Failed to query list of OpenCL devices.\n%1").arg(error));
646649
});
647650
connect(parpar, &ParParClient::output, this, [=](const QJsonObject& obj) {
648651
oclPlatforms = obj.value("platforms").toArray();
649652
progress->setValue(0); // closes window
650653
delete progress;
651654
fillDeviceList(ui->chkOpencl->isChecked());
652-
delete parpar;
655+
parpar->deleteLater();
653656
});
654657
connect(progress, &QProgressDialog::canceled, this, [=]() {
655658
parpar->kill();

optionsdialog.ui

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
<item>
2121
<widget class="QTabWidget" name="tabWidget">
2222
<property name="currentIndex">
23-
<number>2</number>
23+
<number>0</number>
2424
</property>
2525
<widget class="QWidget" name="tab">
2626
<attribute name="title">
@@ -324,7 +324,7 @@
324324
</size>
325325
</property>
326326
<property name="toolTip">
327-
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;The default allocation for recovery slices. This can be:&lt;/p&gt;&lt;p&gt;&lt;span style=&quot; font-style:italic;&quot;&gt;By source ratio&lt;/span&gt;: the ratio of recovery to generate, based on the number of source slices&lt;span style=&quot; font-style:italic;&quot;&gt;&lt;br/&gt;By slice count&lt;/span&gt;: number of recovery slices to generate&lt;br/&gt;&lt;span style=&quot; font-style:italic;&quot;&gt;By total size&lt;/span&gt;: target amount of recovery to generate, based on total recovery data size&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
327+
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;The default allocation for recovery slices. This can be:&lt;/p&gt;&lt;p&gt;&lt;span style=&quot; font-style:italic;&quot;&gt;By source ratio&lt;/span&gt;: the ratio of recovery to generate, based on the number of source slices&lt;span style=&quot; font-style:italic;&quot;&gt;&lt;br/&gt;By slice count&lt;/span&gt;: exact number of recovery slices to generate&lt;br/&gt;&lt;span style=&quot; font-style:italic;&quot;&gt;By total size&lt;/span&gt;: target amount of recovery to generate, based on total recovery data size&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
328328
</property>
329329
<item>
330330
<property name="text">
@@ -493,7 +493,7 @@
493493
</size>
494494
</property>
495495
<property name="toolTip">
496-
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;The default allocation for source/input slices. This can be:&lt;/p&gt;&lt;p&gt;&lt;span style=&quot; font-style:italic;&quot;&gt;By size&lt;/span&gt;: a fixed slice size&lt;br/&gt;&lt;span style=&quot; font-style:italic;&quot;&gt;By slice count&lt;/span&gt;: target number of slices to divide source files by&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
496+
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;The default allocation for source/input slices. This can be:&lt;/p&gt;&lt;p&gt;&lt;span style=&quot; font-style:italic;&quot;&gt;By size&lt;/span&gt;: a fixed slice size&lt;br/&gt;&lt;span style=&quot; font-style:italic;&quot;&gt;By slice count&lt;/span&gt;: target number of slices to divide source files by&lt;br/&gt;&lt;span style=&quot; font-style:italic;&quot;&gt;By count÷size&lt;/span&gt;: target ratio between number of slices and slice size&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
497497
</property>
498498
<item>
499499
<property name="text">
@@ -515,7 +515,7 @@
515515
<item row="3" column="0" colspan="2">
516516
<widget class="QLabel" name="label_8">
517517
<property name="text">
518-
<string>Limit number of slices to</string>
518+
<string>Max number of source slices</string>
519519
</property>
520520
<property name="buddy">
521521
<cstring>txtSliceLimit</cstring>
@@ -1161,7 +1161,7 @@
11611161
<number>0</number>
11621162
</property>
11631163
<property name="currentIndex">
1164-
<number>1</number>
1164+
<number>0</number>
11651165
</property>
11661166
<widget class="QWidget" name="page">
11671167
<layout class="QVBoxLayout" name="verticalLayout_3">

par2outinfo.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,10 @@ Par2RecoveryFile Par2OutInfo::makeRecFile(int sliceCount, int sliceOffset)
153153

154154
if(1 /*pow2 repetition*/ && sliceCount) {
155155
int critCopies = static_cast<int>(round(log(static_cast<double>(sliceCount)) / log(2.0)));
156-
if(critCopies < 1) critCopies = 1;
156+
157+
const auto& s = Settings::getInstance();
158+
critCopies = std::max(critCopies, s.packetRepMin());
159+
critCopies = std::min(critCopies, s.packetRepMax());
157160
critTotalSize *= critCopies;
158161
}
159162

parparclient.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,12 @@ void ParParClient::run(const QStringList& _args, int timeout)
3232
isRunning = true;
3333
isCancelled = false;
3434
stdoutBuffer.clear();
35-
parpar.start(cmd[0], args);
3635
if(timeout)
3736
{
3837
timer.setInterval(timeout);
3938
timer.start();
4039
}
40+
parpar.start(cmd[0], args);
4141
}
4242

4343
void ParParClient::finished(int exitCode, QProcess::ExitStatus exitStatus)
@@ -48,7 +48,7 @@ void ParParClient::finished(int exitCode, QProcess::ExitStatus exitStatus)
4848
if(isCancelled) {
4949
emit failed(QString());
5050
} else if(exitStatus != QProcess::ExitStatus::NormalExit) {
51-
emit failed(tr("ParPar process crashed"));
51+
emit failed(tr("ParPar process crashed or failed to start"));
5252
} else if(exitCode != 0) {
5353
emit failed(tr("ParPar failure (exit code: %1)").arg(exitCode));
5454
} else {

0 commit comments

Comments
 (0)