Cleaned some code
Signed-off-by: Trial97 <alexandru.tripon97@gmail.com>
This commit is contained in:
parent
5afe75e821
commit
6c5bb3817b
6 changed files with 85 additions and 162 deletions
|
@ -17,21 +17,23 @@
|
|||
*/
|
||||
|
||||
#include "JavaDownload.h"
|
||||
#include <qdialogbuttonbox.h>
|
||||
#include <qlogging.h>
|
||||
#include <qmessagebox.h>
|
||||
#include <qpushbutton.h>
|
||||
|
||||
#include <QPushButton>
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "Application.h"
|
||||
#include "BaseVersionList.h"
|
||||
#include "FileSystem.h"
|
||||
#include "QObjectPtr.h"
|
||||
#include "SysInfo.h"
|
||||
#include "java/JavaInstallList.h"
|
||||
|
||||
#include "java/JavaRuntime.h"
|
||||
#include "java/download/ArchiveJavaDownloader.h"
|
||||
#include "java/download/ManifestJavaDownloader.h"
|
||||
|
||||
#include "meta/Index.h"
|
||||
#include "meta/Version.h"
|
||||
|
||||
#include "ui/dialogs/ProgressDialog.h"
|
||||
#include "ui/java/ListModel.h"
|
||||
#include "ui_JavaDownload.h"
|
||||
|
@ -44,7 +46,6 @@ JavaDownload::JavaDownload(QWidget* parent) : QDialog(parent), ui(new Ui::JavaDo
|
|||
connect(ui->widget, &VersionSelectWidget::selectedVersionChanged, this, &JavaDownload::setSelectedVersion);
|
||||
auto reset = ui->buttonBox->button(QDialogButtonBox::Reset);
|
||||
connect(reset, &QPushButton::clicked, this, &JavaDownload::refresh);
|
||||
connect(ui->widget_2, &VersionSelectWidget::selectedVersionChanged, this, &JavaDownload::setSelectedVersion2);
|
||||
}
|
||||
|
||||
JavaDownload::~JavaDownload()
|
||||
|
@ -54,8 +55,6 @@ JavaDownload::~JavaDownload()
|
|||
|
||||
void JavaDownload::setSelectedVersion(BaseVersion::Ptr version)
|
||||
{
|
||||
if (!version)
|
||||
return;
|
||||
auto dcast = std::dynamic_pointer_cast<Meta::Version>(version);
|
||||
if (!dcast) {
|
||||
return;
|
||||
|
@ -64,26 +63,14 @@ void JavaDownload::setSelectedVersion(BaseVersion::Ptr version)
|
|||
ui->widget_2->selectCurrent();
|
||||
}
|
||||
|
||||
void JavaDownload::setSelectedVersion2(BaseVersion::Ptr version)
|
||||
{
|
||||
if (!version)
|
||||
return;
|
||||
m_selectedVersion = std::dynamic_pointer_cast<Java::JavaRuntime2>(ui->widget_2->selectedVersion());
|
||||
}
|
||||
void JavaDownload::accept()
|
||||
{
|
||||
if (!m_selectedVersion) {
|
||||
m_selectedVersion = std::dynamic_pointer_cast<Java::JavaRuntime2>(ui->widget_2->selectedVersion());
|
||||
qDebug() << "=========?" << (ui->widget_2->selectedVersion() != nullptr);
|
||||
}
|
||||
if (!m_selectedVersion) {
|
||||
qDebug() << "faillllllllllllllllllllllllllll";
|
||||
auto meta = std::dynamic_pointer_cast<JavaRuntime::Meta>(ui->widget_2->selectedVersion());
|
||||
if (!meta) {
|
||||
return;
|
||||
}
|
||||
auto meta = m_selectedVersion->meta;
|
||||
Task::Ptr task;
|
||||
auto final_path = FS::PathCombine(APPLICATION->dataRoot(), "java", meta->name);
|
||||
qDebug() << "===============>>=>>" << meta->checksumType << meta->checksumHash;
|
||||
auto final_path = FS::PathCombine(APPLICATION->dataRoot(), "java", meta->m_name);
|
||||
switch (meta->downloadType) {
|
||||
case JavaRuntime::DownloadType::Manifest:
|
||||
task = makeShared<ManifestJavaDownloader>(meta->url, final_path, meta->checksumType, meta->checksumHash);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue