Fixed java refresh button

Signed-off-by: Trial97 <alexandru.tripon97@gmail.com>
This commit is contained in:
Trial97 2024-02-18 22:32:54 +02:00
parent 889f604a41
commit 1c96ae5807
No known key found for this signature in database
GPG Key ID: 55EF5DA53DB36318
3 changed files with 10 additions and 7 deletions

View File

@ -55,7 +55,7 @@ Downloader::Downloader(QWidget* parent) : QDialog(parent), ui(new Ui::JavaDownlo
ui->javaVersionSelect->setEmptyString(tr("No java versions are currently available for your OS."));
ui->javaVersionSelect->setEmptyErrorString(tr("Couldn't load or download the java version lists!"));
ui->buttonBox->button(QDialogButtonBox::Retry)->setText(tr("Refresh"));
ui->buttonBox->button(QDialogButtonBox::Reset)->setText(tr("Refresh"));
ui->buttonBox->button(QDialogButtonBox::Ok)->setText(tr("Download"));
connect(ui->majorVersionSelect, &VersionSelectWidget::selectedVersionChanged, this, &Downloader::setSelectedVersion);
@ -98,6 +98,7 @@ void Downloader::accept()
connect(task.get(), &Task::failed, this, deletePath);
connect(task.get(), &Task::aborted, this, deletePath);
ProgressDialog pg(this);
pg.setSkipButton(true, tr("Abort"));
pg.execWithTask(task.get());
QDialog::accept();
}

View File

@ -48,7 +48,7 @@
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok|QDialogButtonBox::Retry</set>
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok|QDialogButtonBox::Reset</set>
</property>
</widget>
</item>
@ -71,8 +71,8 @@
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>248</x>
<y>254</y>
<x>257</x>
<y>583</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
@ -87,8 +87,8 @@
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
<x>325</x>
<y>583</y>
</hint>
<hint type="destinationlabel">
<x>286</x>

View File

@ -104,10 +104,12 @@ bool sortJavas(BaseVersion::Ptr left, BaseVersion::Ptr right)
void VersionList::sortVersions()
{
if (!m_version || !m_version->data())
return;
QString versionStr = SysInfo::getSupportedJavaArchitecture();
beginResetModel();
auto runtimes = m_version->data()->runtimes;
if (!versionStr.isEmpty() && runtimes.contains(versionStr)) {
if (!versionStr.isEmpty() && !runtimes.isEmpty() && runtimes.contains(versionStr)) {
m_vlist = runtimes.value(versionStr);
std::sort(m_vlist.begin(), m_vlist.end(), sortJavas);
} else {