Forge version list implementation. Needs integration and testing.
This commit is contained in:
@ -30,6 +30,7 @@ void ModListView::setModel ( QAbstractItemModel* model )
|
||||
auto head = header();
|
||||
head->setStretchLastSection(false);
|
||||
head->setSectionResizeMode(0, QHeaderView::Stretch);
|
||||
head->setSectionResizeMode(1, QHeaderView::ResizeToContents);
|
||||
for(int i = 1; i < head->count(); i++)
|
||||
head->setSectionResizeMode(i, QHeaderView::ResizeToContents);
|
||||
dropIndicatorPosition();
|
||||
}
|
||||
|
@ -22,6 +22,8 @@
|
||||
#include <QDebug>
|
||||
#include <QEvent>
|
||||
#include <QKeyEvent>
|
||||
#include "logic/OneSixVersion.h"
|
||||
#include <logic/EnabledItemFilter.h>
|
||||
|
||||
OneSixModEditDialog::OneSixModEditDialog(OneSixInstance * inst, QWidget *parent):
|
||||
m_inst(inst),
|
||||
@ -29,9 +31,15 @@ OneSixModEditDialog::OneSixModEditDialog(OneSixInstance * inst, QWidget *parent)
|
||||
ui(new Ui::OneSixModEditDialog)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
//TODO: libraries!
|
||||
//libraries!
|
||||
{
|
||||
// yeah... here be the real dragons.
|
||||
m_version = m_inst->getFullVersion();
|
||||
|
||||
auto filter = new EnabledItemFilter(this);
|
||||
filter->setActive(true);
|
||||
filter->setSourceModel(m_version.data());
|
||||
ui->libraryTreeView->setModel(filter);
|
||||
ui->libraryTreeView->installEventFilter( this );
|
||||
}
|
||||
// Loader mods
|
||||
{
|
||||
|
@ -46,6 +46,7 @@ protected:
|
||||
bool resourcePackListFilter( QKeyEvent* ev );
|
||||
private:
|
||||
Ui::OneSixModEditDialog *ui;
|
||||
QSharedPointer<OneSixVersion> m_version;
|
||||
QSharedPointer<ModList> m_mods;
|
||||
QSharedPointer<ModList> m_resourcepacks;
|
||||
OneSixInstance * m_inst;
|
||||
|
@ -6,15 +6,15 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>543</width>
|
||||
<height>423</height>
|
||||
<width>555</width>
|
||||
<height>463</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Dialog</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QTabWidget" name="tabWidget">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
@ -28,26 +28,121 @@
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="elideMode">
|
||||
<enum>Qt::ElideNone</enum>
|
||||
</property>
|
||||
<property name="tabsClosable">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<widget class="QWidget" name="libTab">
|
||||
<attribute name="title">
|
||||
<string>Library</string>
|
||||
<string>Version</string>
|
||||
</attribute>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="ModListView" name="jarModsTreeView">
|
||||
<property name="verticalScrollBarPolicy">
|
||||
<enum>Qt::ScrollBarAlwaysOn</enum>
|
||||
</property>
|
||||
<property name="horizontalScrollBarPolicy">
|
||||
<enum>Qt::ScrollBarAlwaysOff</enum>
|
||||
</property>
|
||||
</widget>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_10">
|
||||
<item>
|
||||
<widget class="ModListView" name="libraryTreeView">
|
||||
<property name="verticalScrollBarPolicy">
|
||||
<enum>Qt::ScrollBarAlwaysOn</enum>
|
||||
</property>
|
||||
<property name="horizontalScrollBarPolicy">
|
||||
<enum>Qt::ScrollBarAlwaysOff</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_7">
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Main Class:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="mainClassEdit"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||
<item>
|
||||
<widget class="QPushButton" name="forgeBrn">
|
||||
<property name="toolTip">
|
||||
<string>Replace any current custom version with Minecraft Forge</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Install Forge</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="customizeBtn">
|
||||
<property name="toolTip">
|
||||
<string>Create an customized copy of the base version</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Customize</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="revertBtn">
|
||||
<property name="toolTip">
|
||||
<string>Revert to original base version</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Revert</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line">
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Sunken</enum>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="addLibraryBtn">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Add new libraries</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Add</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="removeLibraryBtn">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Remove selected libraries</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Remove</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_7">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
@ -163,7 +258,7 @@
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="autoFillBackground">
|
||||
<bool>false</bool>
|
||||
|
@ -13,6 +13,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "MultiMC.h"
|
||||
#include "lwjglselectdialog.h"
|
||||
#include "ui_lwjglselectdialog.h"
|
||||
|
||||
@ -24,11 +25,12 @@ LWJGLSelectDialog::LWJGLSelectDialog(QWidget *parent) :
|
||||
{
|
||||
ui->setupUi(this);
|
||||
ui->labelStatus->setVisible(false);
|
||||
ui->lwjglListView->setModel(&LWJGLVersionList::get());
|
||||
auto lwjgllist = MMC->lwjgllist();
|
||||
ui->lwjglListView->setModel(lwjgllist);
|
||||
|
||||
connect(&LWJGLVersionList::get(), SIGNAL(loadingStateUpdated(bool)), SLOT(loadingStateUpdated(bool)));
|
||||
connect(&LWJGLVersionList::get(), SIGNAL(loadListFailed(QString)), SLOT(loadingFailed(QString)));
|
||||
loadingStateUpdated(LWJGLVersionList::get().isLoading());
|
||||
connect(lwjgllist, SIGNAL(loadingStateUpdated(bool)), SLOT(loadingStateUpdated(bool)));
|
||||
connect(lwjgllist, SIGNAL(loadListFailed(QString)), SLOT(loadingFailed(QString)));
|
||||
loadingStateUpdated(lwjgllist->isLoading());
|
||||
}
|
||||
|
||||
LWJGLSelectDialog::~LWJGLSelectDialog()
|
||||
@ -38,15 +40,15 @@ LWJGLSelectDialog::~LWJGLSelectDialog()
|
||||
|
||||
QString LWJGLSelectDialog::selectedVersion() const
|
||||
{
|
||||
return LWJGLVersionList::get().data(
|
||||
return MMC->lwjgllist()->data(
|
||||
ui->lwjglListView->selectionModel()->currentIndex(),
|
||||
Qt::DisplayRole).toString();
|
||||
}
|
||||
|
||||
void LWJGLSelectDialog::on_refreshButton_clicked()
|
||||
{
|
||||
if (!LWJGLVersionList::get().isLoading())
|
||||
LWJGLVersionList::get().loadList();
|
||||
if (!MMC->lwjgllist()->isLoading())
|
||||
MMC->lwjgllist()->loadList();
|
||||
}
|
||||
|
||||
void LWJGLSelectDialog::loadingStateUpdated(bool loading)
|
||||
|
@ -154,14 +154,14 @@ MainWindow::MainWindow ( QWidget *parent )
|
||||
// run the things that load and download other things... FIXME: this is NOT the place
|
||||
// FIXME: invisible actions in the background = NOPE.
|
||||
{
|
||||
if (!MinecraftVersionList::getMainList().isLoaded())
|
||||
if (!MMC->minecraftlist()->isLoaded())
|
||||
{
|
||||
m_versionLoadTask = MinecraftVersionList::getMainList().getLoadTask();
|
||||
m_versionLoadTask = MMC->minecraftlist()->getLoadTask();
|
||||
startTask(m_versionLoadTask);
|
||||
}
|
||||
if (!LWJGLVersionList::get().isLoaded())
|
||||
if (!MMC->lwjgllist()->isLoaded())
|
||||
{
|
||||
LWJGLVersionList::get().loadList();
|
||||
MMC->lwjgllist()->loadList();
|
||||
}
|
||||
assets_downloader = new OneSixAssets();
|
||||
assets_downloader->start();
|
||||
@ -245,7 +245,7 @@ void MainWindow::instanceActivated ( QModelIndex index )
|
||||
|
||||
void MainWindow::on_actionAddInstance_triggered()
|
||||
{
|
||||
if (!MinecraftVersionList::getMainList().isLoaded() &&
|
||||
if (!MMC->minecraftlist()->isLoaded() &&
|
||||
m_versionLoadTask && m_versionLoadTask->isRunning())
|
||||
{
|
||||
QEventLoop waitLoop;
|
||||
@ -604,7 +604,7 @@ void MainWindow::on_actionChangeInstMCVersion_triggered()
|
||||
VersionSelectDialog vselect(m_selectedInstance->versionList(), this);
|
||||
if (vselect.exec() && vselect.selectedVersion())
|
||||
{
|
||||
m_selectedInstance->setIntendedVersionId(vselect.selectedVersion()->descriptor);
|
||||
m_selectedInstance->setIntendedVersionId(vselect.selectedVersion()->descriptor());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -18,7 +18,7 @@
|
||||
#include "ui_newinstancedialog.h"
|
||||
|
||||
#include "logic/InstanceFactory.h"
|
||||
#include "logic/InstanceVersion.h"
|
||||
#include "logic/BaseVersion.h"
|
||||
#include "logic/lists/IconList.h"
|
||||
#include "logic/lists/MinecraftVersionList.h"
|
||||
#include "logic/tasks/Task.h"
|
||||
@ -48,7 +48,7 @@ NewInstanceDialog::NewInstanceDialog(QWidget *parent) :
|
||||
taskDlg->exec(loadTask);
|
||||
}
|
||||
*/
|
||||
setSelectedVersion(MinecraftVersionList::getMainList().getLatestStable());
|
||||
setSelectedVersion(MMC->minecraftlist()->getLatestStable());
|
||||
InstIconKey = "infinity";
|
||||
ui->iconButton->setIcon(MMC->icons()->getIcon(InstIconKey));
|
||||
}
|
||||
@ -63,13 +63,13 @@ void NewInstanceDialog::updateDialogState()
|
||||
ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(!instName().isEmpty() && m_selectedVersion);
|
||||
}
|
||||
|
||||
void NewInstanceDialog::setSelectedVersion(InstVersionPtr version)
|
||||
void NewInstanceDialog::setSelectedVersion(BaseVersionPtr version)
|
||||
{
|
||||
m_selectedVersion = version;
|
||||
|
||||
if (m_selectedVersion)
|
||||
{
|
||||
ui->versionTextBox->setText(version->name);
|
||||
ui->versionTextBox->setText(version->name());
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -89,18 +89,18 @@ QString NewInstanceDialog::iconKey() const
|
||||
return InstIconKey;
|
||||
}
|
||||
|
||||
InstVersionPtr NewInstanceDialog::selectedVersion() const
|
||||
BaseVersionPtr NewInstanceDialog::selectedVersion() const
|
||||
{
|
||||
return m_selectedVersion;
|
||||
}
|
||||
|
||||
void NewInstanceDialog::on_btnChangeVersion_clicked()
|
||||
{
|
||||
VersionSelectDialog vselect(&MinecraftVersionList::getMainList(), this);
|
||||
VersionSelectDialog vselect(MMC->minecraftlist(), this);
|
||||
vselect.exec();
|
||||
if (vselect.result() == QDialog::Accepted)
|
||||
{
|
||||
InstVersionPtr version = vselect.selectedVersion();
|
||||
BaseVersionPtr version = vselect.selectedVersion();
|
||||
if (version)
|
||||
setSelectedVersion(version);
|
||||
}
|
||||
|
@ -17,7 +17,7 @@
|
||||
#define NEWINSTANCEDIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
#include "logic/InstanceVersion.h"
|
||||
#include "logic/BaseVersion.h"
|
||||
|
||||
namespace Ui {
|
||||
class NewInstanceDialog;
|
||||
@ -33,13 +33,13 @@ public:
|
||||
|
||||
void updateDialogState();
|
||||
|
||||
void setSelectedVersion(InstVersionPtr version);
|
||||
void setSelectedVersion(BaseVersionPtr version);
|
||||
|
||||
void loadVersionList();
|
||||
|
||||
QString instName() const;
|
||||
QString iconKey() const;
|
||||
InstVersionPtr selectedVersion() const;
|
||||
BaseVersionPtr selectedVersion() const;
|
||||
|
||||
private slots:
|
||||
void on_btnChangeVersion_clicked();
|
||||
@ -49,7 +49,7 @@ private slots:
|
||||
private:
|
||||
Ui::NewInstanceDialog *ui;
|
||||
|
||||
InstVersionPtr m_selectedVersion;
|
||||
BaseVersionPtr m_selectedVersion;
|
||||
QString InstIconKey;
|
||||
};
|
||||
|
||||
|
@ -22,11 +22,11 @@
|
||||
|
||||
#include <gui/taskdialog.h>
|
||||
|
||||
#include <logic/InstanceVersion.h>
|
||||
#include <logic/lists/InstVersionList.h>
|
||||
#include <logic/BaseVersion.h>
|
||||
#include <logic/lists/BaseVersionList.h>
|
||||
#include <logic/tasks/Task.h>
|
||||
|
||||
VersionSelectDialog::VersionSelectDialog(InstVersionList *vlist, QWidget *parent) :
|
||||
VersionSelectDialog::VersionSelectDialog(BaseVersionList *vlist, QWidget *parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::VersionSelectDialog)
|
||||
{
|
||||
@ -69,11 +69,11 @@ void VersionSelectDialog::loadList()
|
||||
taskDlg->exec(loadTask);
|
||||
}
|
||||
|
||||
InstVersionPtr VersionSelectDialog::selectedVersion() const
|
||||
BaseVersionPtr VersionSelectDialog::selectedVersion() const
|
||||
{
|
||||
auto currentIndex = ui->listView->selectionModel()->currentIndex();
|
||||
auto variant = m_proxyModel->data(currentIndex, InstVersionList::VersionPointerRole);
|
||||
return variant.value<InstVersionPtr>();
|
||||
auto variant = m_proxyModel->data(currentIndex, BaseVersionList::VersionPointerRole);
|
||||
return variant.value<BaseVersionPtr>();
|
||||
}
|
||||
|
||||
void VersionSelectDialog::on_refreshButton_clicked()
|
||||
@ -83,7 +83,7 @@ void VersionSelectDialog::on_refreshButton_clicked()
|
||||
|
||||
void VersionSelectDialog::updateFilterState()
|
||||
{
|
||||
m_proxyModel->setFilterKeyColumn(InstVersionList::TypeColumn);
|
||||
m_proxyModel->setFilterKeyColumn(BaseVersionList::TypeColumn);
|
||||
|
||||
QStringList filteredTypes;
|
||||
if (!ui->filterSnapshotsCheckbox->isChecked())
|
||||
|
@ -19,9 +19,9 @@
|
||||
#include <QDialog>
|
||||
|
||||
#include <QSortFilterProxyModel>
|
||||
#include "logic/InstanceVersion.h"
|
||||
#include "logic/BaseVersion.h"
|
||||
|
||||
class InstVersionList;
|
||||
class BaseVersionList;
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
@ -33,7 +33,7 @@ class VersionSelectDialog : public QDialog
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit VersionSelectDialog(InstVersionList *vlist, QWidget *parent = 0);
|
||||
explicit VersionSelectDialog(BaseVersionList *vlist, QWidget *parent = 0);
|
||||
~VersionSelectDialog();
|
||||
|
||||
virtual int exec();
|
||||
@ -41,7 +41,7 @@ public:
|
||||
//! Starts a task that loads the list.
|
||||
void loadList();
|
||||
|
||||
InstVersionPtr selectedVersion() const;
|
||||
BaseVersionPtr selectedVersion() const;
|
||||
|
||||
private slots:
|
||||
void on_refreshButton_clicked();
|
||||
@ -51,7 +51,7 @@ private slots:
|
||||
private:
|
||||
Ui::VersionSelectDialog *ui;
|
||||
|
||||
InstVersionList *m_vlist;
|
||||
BaseVersionList *m_vlist;
|
||||
|
||||
QSortFilterProxyModel *m_proxyModel;
|
||||
};
|
||||
|
Reference in New Issue
Block a user