Skip to content

Commit 990b16a

Browse files
committed
Add max thread count
1 parent 8f3d36a commit 990b16a

2 files changed

Lines changed: 5 additions & 7 deletions

File tree

gui/settings.ui

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,12 +82,12 @@
8282
<item>
8383
<widget class="QLabel" name="label_3">
8484
<property name="text">
85-
<string>Ideal count:</string>
85+
<string>Max count:</string>
8686
</property>
8787
</widget>
8888
</item>
8989
<item>
90-
<widget class="QLabel" name="mLblIdealThreads">
90+
<widget class="QLabel" name="mLblMaxThreads">
9191
<property name="text">
9292
<string notr="true">TextLabel</string>
9393
</property>

gui/settingsdialog.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,9 @@ SettingsDialog::SettingsDialog(ApplicationList *list,
121121

122122
const int count = QThread::idealThreadCount();
123123
if (count != -1)
124-
mUI->mLblIdealThreads->setText(QString::number(count));
124+
mUI->mLblMaxThreads->setText(QString::number(count));
125125
else
126-
mUI->mLblIdealThreads->setText(tr("N/A"));
126+
mUI->mLblMaxThreads->setText(tr("N/A"));
127127

128128
loadSettings();
129129
initTranslationsList();
@@ -180,9 +180,7 @@ void SettingsDialog::saveSettings() const
180180
void SettingsDialog::saveSettingValues() const
181181
{
182182
int jobs = mUI->mJobs->text().toInt();
183-
if (jobs <= 0) {
184-
jobs = 1;
185-
}
183+
jobs = std::min(std::max(jobs, 1), QThread::idealThreadCount());
186184

187185
QSettings settings;
188186
settings.setValue(SETTINGS_CHECK_THREADS, jobs);

0 commit comments

Comments
 (0)