NOISSUE stuff and things happened. Maybe.
This commit is contained in:
@ -487,22 +487,16 @@ int VersionPage::currentRow()
|
||||
|
||||
void VersionPage::on_customizeBtn_clicked()
|
||||
{
|
||||
// TODO: implement
|
||||
/*
|
||||
auto version = currentRow();
|
||||
if(version == -1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
//HACK HACK remove, this is dumb
|
||||
auto patch = m_profile->versionPatch(version);
|
||||
auto mc = std::dynamic_pointer_cast<MinecraftVersion>(patch);
|
||||
if(mc && mc->needsUpdate())
|
||||
if(!patch->getVersionFile())
|
||||
{
|
||||
if(!doUpdate())
|
||||
{
|
||||
return;
|
||||
}
|
||||
// TODO: wait for the update task to finish here...
|
||||
return;
|
||||
}
|
||||
if(!m_profile->customize(version))
|
||||
{
|
||||
@ -510,7 +504,6 @@ void VersionPage::on_customizeBtn_clicked()
|
||||
}
|
||||
updateButtons();
|
||||
preselect(currentIdx);
|
||||
*/
|
||||
}
|
||||
|
||||
void VersionPage::on_editBtn_clicked()
|
||||
@ -531,22 +524,11 @@ void VersionPage::on_editBtn_clicked()
|
||||
|
||||
void VersionPage::on_revertBtn_clicked()
|
||||
{
|
||||
// TODO: implement
|
||||
/*
|
||||
auto version = currentRow();
|
||||
if(version == -1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
auto mcraw = MMC->minecraftlist()->findVersion(m_inst->intendedVersionId());
|
||||
auto mc = std::dynamic_pointer_cast<MinecraftVersion>(mcraw);
|
||||
if(mc && mc->needsUpdate())
|
||||
{
|
||||
if(!doUpdate())
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
if(!m_profile->revertToBase(version))
|
||||
{
|
||||
// TODO: some error box here
|
||||
@ -554,7 +536,6 @@ void VersionPage::on_revertBtn_clicked()
|
||||
updateButtons();
|
||||
preselect(currentIdx);
|
||||
m_container->refreshContainer();
|
||||
*/
|
||||
}
|
||||
|
||||
#include "VersionPage.moc"
|
||||
|
@ -80,52 +80,42 @@ void VersionSelectWidget::initialize()
|
||||
|
||||
void VersionSelectWidget::closeEvent(QCloseEvent * event)
|
||||
{
|
||||
if(loadTask)
|
||||
{
|
||||
loadTask->abort();
|
||||
loadTask->deleteLater();
|
||||
loadTask = nullptr;
|
||||
}
|
||||
QWidget::closeEvent(event);
|
||||
}
|
||||
|
||||
void VersionSelectWidget::loadList()
|
||||
{
|
||||
if(loadTask)
|
||||
auto newTask = m_vlist->getLoadTask();
|
||||
if (!newTask)
|
||||
{
|
||||
return;
|
||||
}
|
||||
loadTask = m_vlist->getLoadTask();
|
||||
if (!loadTask)
|
||||
{
|
||||
return;
|
||||
}
|
||||
connect(loadTask, &Task::finished, this, &VersionSelectWidget::onTaskFinished);
|
||||
loadTask = newTask.get();
|
||||
connect(loadTask, &Task::succeeded, this, &VersionSelectWidget::onTaskSucceeded);
|
||||
connect(loadTask, &Task::failed, this, &VersionSelectWidget::onTaskFailed);
|
||||
connect(loadTask, &Task::progress, this, &VersionSelectWidget::changeProgress);
|
||||
loadTask->start();
|
||||
if(!loadTask->isRunning())
|
||||
{
|
||||
loadTask->start();
|
||||
}
|
||||
sneakyProgressBar->setHidden(false);
|
||||
}
|
||||
|
||||
void VersionSelectWidget::onTaskFinished()
|
||||
void VersionSelectWidget::onTaskSucceeded()
|
||||
{
|
||||
if (!loadTask->successful())
|
||||
{
|
||||
CustomMessageBox::selectable(this, tr("Error"),
|
||||
tr("List update failed:\n%1").arg(loadTask->failReason()),
|
||||
QMessageBox::Warning)->show();
|
||||
if (m_proxyModel->rowCount() == 0)
|
||||
{
|
||||
listView->setEmptyMode(VersionListView::ErrorString);
|
||||
}
|
||||
}
|
||||
else if (m_proxyModel->rowCount() == 0)
|
||||
if (m_proxyModel->rowCount() == 0)
|
||||
{
|
||||
listView->setEmptyMode(VersionListView::String);
|
||||
}
|
||||
sneakyProgressBar->setHidden(true);
|
||||
loadTask->deleteLater();
|
||||
loadTask = nullptr;
|
||||
preselect();
|
||||
loadTask = nullptr;
|
||||
}
|
||||
|
||||
void VersionSelectWidget::onTaskFailed(const QString& reason)
|
||||
{
|
||||
CustomMessageBox::selectable(this, tr("Error"), tr("List update failed:\n%1").arg(reason), QMessageBox::Warning)->show();
|
||||
onTaskSucceeded();
|
||||
}
|
||||
|
||||
void VersionSelectWidget::changeProgress(qint64 current, qint64 total)
|
||||
|
@ -55,7 +55,8 @@ protected:
|
||||
virtual void closeEvent ( QCloseEvent* );
|
||||
|
||||
private slots:
|
||||
void onTaskFinished();
|
||||
void onTaskSucceeded();
|
||||
void onTaskFailed(const QString &reason);
|
||||
void changeProgress(qint64 current, qint64 total);
|
||||
void currentRowChanged(const QModelIndex ¤t, const QModelIndex &);
|
||||
|
||||
@ -66,7 +67,7 @@ private:
|
||||
BaseVersionList *m_vlist = nullptr;
|
||||
VersionProxyModel *m_proxyModel = nullptr;
|
||||
int resizeOnColumn = 0;
|
||||
Task * loadTask = nullptr;
|
||||
Task * loadTask;
|
||||
bool preselectedAlready = false;
|
||||
|
||||
private:
|
||||
|
Reference in New Issue
Block a user