diff options
author | Petr Mrázek <peterix@gmail.com> | 2018-03-19 02:36:12 +0100 |
---|---|---|
committer | Petr Mrázek <peterix@gmail.com> | 2018-03-27 09:25:36 +0200 |
commit | 8e44ab2338f4ca63d58de4b3329c384df9d6c053 (patch) | |
tree | 60b915ec620221656d1c3a42f40124b15e9e69f0 /application/dialogs | |
parent | 4c7ea0f99a23f73fd3cae87f7dfaab89922a2311 (diff) | |
download | MultiMC-8e44ab2338f4ca63d58de4b3329c384df9d6c053.tar MultiMC-8e44ab2338f4ca63d58de4b3329c384df9d6c053.tar.gz MultiMC-8e44ab2338f4ca63d58de4b3329c384df9d6c053.tar.lz MultiMC-8e44ab2338f4ca63d58de4b3329c384df9d6c053.tar.xz MultiMC-8e44ab2338f4ca63d58de4b3329c384df9d6c053.zip |
NOISSUE redo new instance dialog
Diffstat (limited to 'application/dialogs')
-rw-r--r-- | application/dialogs/ChooseFtbPackDialog.cpp | 88 | ||||
-rw-r--r-- | application/dialogs/ChooseFtbPackDialog.h | 34 | ||||
-rw-r--r-- | application/dialogs/ChooseFtbPackDialog.ui | 119 | ||||
-rw-r--r-- | application/dialogs/NewInstanceDialog.cpp | 263 | ||||
-rw-r--r-- | application/dialogs/NewInstanceDialog.h | 43 | ||||
-rw-r--r-- | application/dialogs/NewInstanceDialog.ui | 346 | ||||
-rw-r--r-- | application/dialogs/VersionSelectDialog.cpp | 4 |
7 files changed, 110 insertions, 787 deletions
diff --git a/application/dialogs/ChooseFtbPackDialog.cpp b/application/dialogs/ChooseFtbPackDialog.cpp deleted file mode 100644 index b1deae6e..00000000 --- a/application/dialogs/ChooseFtbPackDialog.cpp +++ /dev/null @@ -1,88 +0,0 @@ -#include "ChooseFtbPackDialog.h" -#include <QPushButton> - -ChooseFtbPackDialog::ChooseFtbPackDialog(FtbModpackList modpacks) : ui(new Ui::ChooseFtbPackDialog) -{ - ui->setupUi(this); - - filterModel = new FtbFilterModel(this); - listModel = new FtbListModel(this); - filterModel->setSourceModel(listModel); - listModel->fill(modpacks); - - ui->packList->setModel(filterModel); - ui->packList->setSortingEnabled(true); - ui->packList->header()->hide(); - ui->packList->setIndentation(0); - - filterModel->setSorting(FtbFilterModel::Sorting::ByName); - - for(int i = 0; i < filterModel->getAvailableSortings().size(); i++){ - ui->sortByBox->addItem(filterModel->getAvailableSortings().keys().at(i)); - } - - ui->sortByBox->setCurrentText(filterModel->getAvailableSortings().key(filterModel->getCurrentSorting())); - - connect(ui->sortByBox, &QComboBox::currentTextChanged, this, &ChooseFtbPackDialog::onSortingSelectionChanged); - connect(ui->packVersionSelection, &QComboBox::currentTextChanged, this, &ChooseFtbPackDialog::onVersionSelectionItemChanged); - connect(ui->packList->selectionModel(), &QItemSelectionModel::currentChanged, this, &ChooseFtbPackDialog::onPackSelectionChanged); - - ui->modpackInfo->setOpenExternalLinks(true); - - ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false); -} - -ChooseFtbPackDialog::~ChooseFtbPackDialog() -{ - delete ui; -} - -void ChooseFtbPackDialog::onPackSelectionChanged(QModelIndex now, QModelIndex prev) -{ - ui->packVersionSelection->clear(); - FtbModpack selectedPack = filterModel->data(now, Qt::UserRole).value<FtbModpack>(); - - ui->modpackInfo->setHtml("Pack by <b>" + selectedPack.author + "</b>" + "<br>Minecraft " + selectedPack.mcVersion + "<br>" - "<br>" + selectedPack.description + "<ul><li>" + selectedPack.mods.replace(";", "</li><li>") + "</li></ul>"); - - bool currentAdded = false; - - for(int i = 0; i < selectedPack.oldVersions.size(); i++) { - if(selectedPack.currentVersion == selectedPack.oldVersions.at(i)) { - currentAdded = true; - } - ui->packVersionSelection->addItem(selectedPack.oldVersions.at(i)); - } - - if(!currentAdded) { - ui->packVersionSelection->addItem(selectedPack.currentVersion); - } - - selected = selectedPack; - ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(!selected.broken); -} - -void ChooseFtbPackDialog::onVersionSelectionItemChanged(QString data) -{ - if(data.isNull() || data.isEmpty()) { - selectedVersion = ""; - return; - } - - selectedVersion = data; -} - -FtbModpack ChooseFtbPackDialog::getSelectedModpack() -{ - return selected; -} - -QString ChooseFtbPackDialog::getSelectedVersion() -{ - return selectedVersion; -} - -void ChooseFtbPackDialog::onSortingSelectionChanged(QString data) -{ - filterModel->setSorting(filterModel->getAvailableSortings().value(data)); -} diff --git a/application/dialogs/ChooseFtbPackDialog.h b/application/dialogs/ChooseFtbPackDialog.h deleted file mode 100644 index f9f3dd08..00000000 --- a/application/dialogs/ChooseFtbPackDialog.h +++ /dev/null @@ -1,34 +0,0 @@ -#pragma once - -#include <QDialog> -#include <net/NetJob.h> -#include <modplatform/ftb/PackHelpers.h> -#include "ui_ChooseFtbPackDialog.h" -#include "FtbListModel.h" - -namespace Ui { - class ChooseFtbPackDialog; -} - -class ChooseFtbPackDialog : public QDialog { - - Q_OBJECT - -private: - Ui::ChooseFtbPackDialog *ui; - FtbModpack selected; - QString selectedVersion; - FtbListModel* listModel; - FtbFilterModel* filterModel; - -private slots: - void onSortingSelectionChanged(QString data); - void onVersionSelectionItemChanged(QString data); - void onPackSelectionChanged(QModelIndex first, QModelIndex second); -public: - ChooseFtbPackDialog(FtbModpackList packs); - ~ChooseFtbPackDialog(); - - FtbModpack getSelectedModpack(); - QString getSelectedVersion(); -}; diff --git a/application/dialogs/ChooseFtbPackDialog.ui b/application/dialogs/ChooseFtbPackDialog.ui deleted file mode 100644 index f590a4cd..00000000 --- a/application/dialogs/ChooseFtbPackDialog.ui +++ /dev/null @@ -1,119 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<ui version="4.0"> - <class>ChooseFtbPackDialog</class> - <widget class="QDialog" name="ChooseFtbPackDialog"> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>700</width> - <height>437</height> - </rect> - </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="Expanding" vsizetype="Expanding"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="sizeGripEnabled"> - <bool>false</bool> - </property> - <layout class="QGridLayout" name="gridLayout_2"> - <item row="1" column="1"> - <widget class="QLabel" name="selectedVersionLabel"> - <property name="text"> - <string>Version selected:</string> - </property> - <property name="alignment"> - <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set> - </property> - </widget> - </item> - <item row="0" column="0"> - <widget class="QTreeView" name="packList"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Expanding"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - </widget> - </item> - <item row="1" column="0"> - <widget class="QComboBox" name="sortByBox"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - </widget> - </item> - <item row="1" column="3"> - <widget class="QDialogButtonBox" name="buttonBox"> - <property name="enabled"> - <bool>true</bool> - </property> - <property name="autoFillBackground"> - <bool>false</bool> - </property> - <property name="standardButtons"> - <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set> - </property> - <property name="centerButtons"> - <bool>false</bool> - </property> - </widget> - </item> - <item row="1" column="2"> - <widget class="QComboBox" name="packVersionSelection"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - </widget> - </item> - <item row="0" column="1" colspan="3"> - <widget class="QTextBrowser" name="modpackInfo"/> - </item> - </layout> - </widget> - <resources/> - <connections> - <connection> - <sender>buttonBox</sender> - <signal>accepted()</signal> - <receiver>ChooseFtbPackDialog</receiver> - <slot>accept()</slot> - <hints> - <hint type="sourcelabel"> - <x>211</x> - <y>173</y> - </hint> - <hint type="destinationlabel"> - <x>889</x> - <y>501</y> - </hint> - </hints> - </connection> - <connection> - <sender>buttonBox</sender> - <signal>rejected()</signal> - <receiver>ChooseFtbPackDialog</receiver> - <slot>reject()</slot> - <hints> - <hint type="sourcelabel"> - <x>225</x> - <y>162</y> - </hint> - <hint type="destinationlabel"> - <x>524</x> - <y>458</y> - </hint> - </hints> - </connection> - </connections> -</ui> diff --git a/application/dialogs/NewInstanceDialog.cpp b/application/dialogs/NewInstanceDialog.cpp index eee3991c..f0783603 100644 --- a/application/dialogs/NewInstanceDialog.cpp +++ b/application/dialogs/NewInstanceDialog.cpp @@ -25,80 +25,30 @@ #include "VersionSelectDialog.h" #include "ProgressDialog.h" #include "IconPickerDialog.h" -#include "ChooseFtbPackDialog.h" #include <QLayout> #include <QPushButton> #include <QFileDialog> #include <QValidator> +#include <QDialogButtonBox> -#include <meta/Index.h> -#include <meta/VersionList.h> - -class UrlValidator : public QValidator -{ -public: - using QValidator::QValidator; - - State validate(QString &in, int &pos) const - { - const QUrl url(in); - if (url.isValid() && !url.isRelative() && !url.isEmpty()) - { - return Acceptable; - } - else if (QFile::exists(in)) - { - return Acceptable; - } - else - { - return Intermediate; - } - } -}; +#include "widgets/PageContainer.h" +#include <pages/modplatform/VanillaPage.h> +#include <pages/modplatform/FTBPage.h> +#include <pages/modplatform/TwitchPage.h> +#include <pages/modplatform/ImportPage.h> +#include <pages/modplatform/TechnicPage.h> NewInstanceDialog::NewInstanceDialog(const QString & initialGroup, const QString & url, QWidget *parent) : QDialog(parent), ui(new Ui::NewInstanceDialog) { ui->setupUi(this); - resize(minimumSizeHint()); - layout()->setSizeConstraint(QLayout::SetFixedSize); - auto vlist = ENV.metadataIndex()->get("net.minecraft"); - if(vlist->isLoaded()) - { - setSelectedVersion(vlist->getRecommended()); - } - else - { - vlist->load(Net::Mode::Online); - auto task = vlist->getLoadTask(); - if(vlist->isLoaded()) - { - setSelectedVersion(vlist->getRecommended()); - } - if(task) - { - connect(task.get(), &Task::succeeded, this, &NewInstanceDialog::versionListUpdated); - } - } + setWindowIcon(MMC->getThemedIcon("new")); InstIconKey = "default"; ui->iconButton->setIcon(MMC->icons()->getIcon(InstIconKey)); - ui->modpackEdit->setValidator(new UrlValidator(ui->modpackEdit)); - - ui->instNameTextBox->setAlignment(Qt::AlignHCenter); - - connect(ui->modpackEdit, &QLineEdit::textChanged, this, &NewInstanceDialog::updateDialogState); - connect(ui->modpackBox, &QRadioButton::clicked, this, &NewInstanceDialog::updateDialogState); - - connect(ui->versionBox, &QRadioButton::clicked, this, &NewInstanceDialog::updateDialogState); - connect(ui->versionTextBox, &QLineEdit::textChanged, this, &NewInstanceDialog::updateDialogState); - - connect(ui->ftbBox, &QRadioButton::clicked, this, &NewInstanceDialog::updateDialogState); - auto groups = MMC->instances()->getGroups().toSet(); auto groupList = QStringList(groups.toList()); groupList.sort(Qt::CaseInsensitive); @@ -113,32 +63,47 @@ NewInstanceDialog::NewInstanceDialog(const QString & initialGroup, const QString } ui->groupBox->setCurrentIndex(index); ui->groupBox->lineEdit()->setPlaceholderText(tr("No group")); - ui->buttonBox->setFocus(); - originalPlaceholderText = ui->instNameTextBox->placeholderText(); - if(!url.isEmpty()) - { - ui->modpackBox->setChecked(true); - ui->modpackEdit->setText(url); - } + m_buttons = new QDialogButtonBox(QDialogButtonBox::Help | QDialogButtonBox::Ok); + m_buttons->button(QDialogButtonBox::Ok)->setDefault(true); - ftbPackDownloader = new FtbPackDownloader(); + connect(m_buttons->button(QDialogButtonBox::Ok), &QPushButton::clicked, this, &QDialog::accept); + connect(m_buttons->button(QDialogButtonBox::Help), &QPushButton::clicked, m_container, &PageContainer::help); - connect(ftbPackDownloader, &FtbPackDownloader::ready, this, &NewInstanceDialog::ftbPackDataDownloadSuccessfully); - connect(ftbPackDownloader, &FtbPackDownloader::packFetchFailed, this, &NewInstanceDialog::ftbPackDataDownloadFailed); + m_container = new PageContainer(this); + m_container->setSizePolicy(QSizePolicy::Policy::Preferred, QSizePolicy::Policy::Expanding); + ui->verticalLayout->insertWidget(2, m_container); - ftbPackDownloader->fetchModpacks(false); + m_container->addButtons(m_buttons); + m_buttons->setFocus(); + + if(!url.isEmpty()) + { + m_container->selectPage("import"); + importPage->setUrl(url); + } updateDialogState(); + + restoreGeometry(QByteArray::fromBase64(MMC->settings()->get("NewInstanceGeometry").toByteArray())); } -void NewInstanceDialog::versionListUpdated() +QList<BasePage *> NewInstanceDialog::getPages() { - if(!m_versionSetByUser) + importPage = new ImportPage(this); + return { - auto vlist = ENV.metadataIndex()->get("net.minecraft"); - setSelectedVersion(vlist->getRecommended()); - } + new VanillaPage(this), + new FTBPage(this), + importPage, + new TwitchPage(this), + new TechnicPage(this) + }; +} + +QString NewInstanceDialog::dialogTitle() +{ + return tr("New Instance"); } NewInstanceDialog::~NewInstanceDialog() @@ -146,58 +111,29 @@ NewInstanceDialog::~NewInstanceDialog() delete ui; } -void NewInstanceDialog::updateDialogState() +void NewInstanceDialog::setSuggestedPack(const QString& name, InstanceTask* task) { - QString suggestedName; - if(ui->versionBox->isChecked()) - { - suggestedName = ui->versionTextBox->text(); - } - else if (ui->modpackBox->isChecked()) - { - auto url = QUrl::fromUserInput(ui->modpackEdit->text()); - QFileInfo fi(url.fileName()); - suggestedName = fi.completeBaseName(); - } - else if (ui->ftbBox->isChecked()) - { - if(ftbPackDownloader->isValidPackSelected()) { - suggestedName = ftbPackDownloader->getSuggestedInstanceName(); - ui->labelFtbPack->setText(selectedPack.name); - } + creationTask.reset(task); + ui->instNameTextBox->setPlaceholderText(name); - } - - ftbModpackRequested = ui->ftbBox->isChecked(); - - if(suggestedName.isEmpty()) - { - ui->instNameTextBox->setPlaceholderText(originalPlaceholderText); - } - else - { - ui->instNameTextBox->setPlaceholderText(suggestedName); - } - bool allowOK = !instName().isEmpty() && ( - (ui->versionBox->isChecked() && m_selectedVersion) || - (ui->modpackBox->isChecked() && ui->modpackEdit->hasAcceptableInput()) || - (ui->ftbBox->isChecked() && ftbPackDownloader && ftbPackDownloader->isValidPackSelected() ) - ); - ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(allowOK); + auto allowOK = task && !instName().isEmpty(); + m_buttons->button(QDialogButtonBox::Ok)->setEnabled(allowOK); } -void NewInstanceDialog::setSelectedVersion(BaseVersionPtr version) +InstanceTask * NewInstanceDialog::extractTask() { - m_selectedVersion = version; + InstanceTask * extracted = creationTask.get(); + creationTask.release(); + extracted->setName(instName()); + extracted->setGroup(instGroup()); + extracted->setIcon(iconKey()); + return extracted; +} - if (m_selectedVersion) - { - ui->versionTextBox->setText(version->descriptor()); - } - else - { - ui->versionTextBox->setText(""); - } +void NewInstanceDialog::updateDialogState() +{ + auto allowOK = creationTask && !instName().isEmpty(); + m_buttons->button(QDialogButtonBox::Ok)->setEnabled(allowOK); } QString NewInstanceDialog::instName() const @@ -208,7 +144,7 @@ QString NewInstanceDialog::instName() const return result.trimmed(); } result = ui->instNameTextBox->placeholderText(); - if(result.size() && result != originalPlaceholderText) + if(result.size()) { return result.trimmed(); } @@ -223,45 +159,6 @@ QString NewInstanceDialog::iconKey() const { return InstIconKey; } -QUrl NewInstanceDialog::modpackUrl() const -{ - if (ui->modpackBox->isChecked()) - { - const QUrl url(ui->modpackEdit->text()); - if (url.isValid() && !url.isRelative() && !url.host().isEmpty()) - { - return url; - } - else - { - return QUrl::fromLocalFile(ui->modpackEdit->text()); - } - } - else - { - return QUrl(); - } -} - -BaseVersionPtr NewInstanceDialog::selectedVersion() const -{ - return m_selectedVersion; -} - -void NewInstanceDialog::on_btnChangeVersion_clicked() -{ - VersionSelectDialog vselect(ENV.metadataIndex()->get("net.minecraft").get(), tr("Change Minecraft version"), this); - vselect.exec(); - if (vselect.result() == QDialog::Accepted) - { - BaseVersionPtr version = vselect.selectedVersion(); - if (version) - { - m_versionSetByUser = true; - setSelectedVersion(version); - } - } -} void NewInstanceDialog::on_iconButton_clicked() { @@ -280,46 +177,14 @@ void NewInstanceDialog::on_instNameTextBox_textChanged(const QString &arg1) updateDialogState(); } -void NewInstanceDialog::on_modpackBtn_clicked() +void NewInstanceDialog::closeEvent(QCloseEvent* event) { - const QUrl url = QFileDialog::getOpenFileUrl(this, tr("Choose modpack"), modpackUrl(), tr("Zip (*.zip)")); - if (url.isValid()) + qDebug() << "New instance dialog close requested"; + if (m_container->prepareToClose()) { - if (url.isLocalFile()) - { - ui->modpackEdit->setText(url.toLocalFile()); - } - else - { - ui->modpackEdit->setText(url.toString()); - } - } -} - -bool NewInstanceDialog::isFtbModpackRequested() { - return ftbModpackRequested; -} - -FtbPackDownloader *NewInstanceDialog::getFtbPackDownloader() { - return ftbPackDownloader; -} - -void NewInstanceDialog::on_btnChooseFtbPack_clicked() { - ChooseFtbPackDialog dl(ftbPackDownloader->getModpacks()); - dl.exec(); - if(dl.result() == QDialog::Accepted) { - selectedPack = dl.getSelectedModpack(); - ftbPackDownloader->selectPack(selectedPack, dl.getSelectedVersion()); + qDebug() << "New instance dialog close approved"; + MMC->settings()->set("NewInstanceGeometry", saveGeometry().toBase64()); + qDebug() << "New instance dialog geometry saved"; + QDialog::closeEvent(event); } - updateDialogState(); } - -void NewInstanceDialog::ftbPackDataDownloadSuccessfully() { - ui->packDataDownloadStatus->setText(tr("(Data download complete)")); - ui->ftbBox->setEnabled(true); -} - -void NewInstanceDialog::ftbPackDataDownloadFailed() { - ui->packDataDownloadStatus->setText(tr("(Data download failed)")); -} - diff --git a/application/dialogs/NewInstanceDialog.h b/application/dialogs/NewInstanceDialog.h index f1fe26f4..ca134d32 100644 --- a/application/dialogs/NewInstanceDialog.h +++ b/application/dialogs/NewInstanceDialog.h @@ -18,15 +18,19 @@ #include <QDialog> #include "BaseVersion.h" -#include "modplatform/ftb/FtbPackDownloader.h" -#include "modplatform/ftb/PackHelpers.h" +#include "pages/BasePageProvider.h" +#include "InstanceTask.h" namespace Ui { class NewInstanceDialog; } -class NewInstanceDialog : public QDialog +class PageContainer; +class QDialogButtonBox; +class ImportPage; + +class NewInstanceDialog : public QDialog, public BasePageProvider { Q_OBJECT @@ -36,39 +40,28 @@ public: void updateDialogState(); - void setSelectedVersion(BaseVersionPtr version); + void setSuggestedPack(const QString & name = QString(), InstanceTask * task = nullptr); + InstanceTask * extractTask(); + + QString dialogTitle() override; + QList<BasePage *> getPages() override; QString instName() const; QString instGroup() const; QString iconKey() const; - QUrl modpackUrl() const; - BaseVersionPtr selectedVersion() const; - - bool isFtbModpackRequested(); - FtbPackDownloader* getFtbPackDownloader(); private slots: - void on_btnChangeVersion_clicked(); void on_iconButton_clicked(); - void on_modpackBtn_clicked(); - void on_btnChooseFtbPack_clicked(); void on_instNameTextBox_textChanged(const QString &arg1); - void versionListUpdated(); - - void ftbPackDataDownloadSuccessfully(); - void ftbPackDataDownloadFailed(); + virtual void closeEvent(QCloseEvent *event); private: - Ui::NewInstanceDialog *ui; - - bool m_versionSetByUser = false; - bool ftbModpackRequested = false; + Ui::NewInstanceDialog *ui = nullptr; + PageContainer * m_container = nullptr; + QDialogButtonBox * m_buttons = nullptr; - BaseVersionPtr m_selectedVersion; QString InstIconKey; - QString originalPlaceholderText; - - FtbPackDownloader* ftbPackDownloader; - FtbModpack selectedPack; + ImportPage *importPage = nullptr; + std::unique_ptr<InstanceTask> creationTask; }; diff --git a/application/dialogs/NewInstanceDialog.ui b/application/dialogs/NewInstanceDialog.ui index 428b9c57..7fb19ff5 100644 --- a/application/dialogs/NewInstanceDialog.ui +++ b/application/dialogs/NewInstanceDialog.ui @@ -9,8 +9,8 @@ <rect> <x>0</x> <y>0</y> - <width>281</width> - <height>407</height> + <width>730</width> + <height>127</height> </rect> </property> <property name="windowTitle"> @@ -25,357 +25,63 @@ </property> <layout class="QVBoxLayout" name="verticalLayout"> <item> - <layout class="QHBoxLayout" name="iconBtnLayout"> - <item> - <spacer name="iconBtnLeftSpacer"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - <item> - <widget class="QToolButton" name="iconButton"> - <property name="iconSize"> - <size> - <width>80</width> - <height>80</height> - </size> - </property> - </widget> - </item> - <item> - <spacer name="iconBtnRightSpacer"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - </layout> - </item> - <item> - <widget class="QLineEdit" name="instNameTextBox"> - <property name="placeholderText"> - <string>Name</string> - </property> - </widget> - </item> - <item> - <widget class="Line" name="line"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - </widget> - </item> - <item> - <layout class="QHBoxLayout" name="horizontalLayout"> - <item> - <widget class="QLabel" name="labelVersion_3"> - <property name="text"> - <string>&Group:</string> - </property> - <property name="buddy"> - <cstring>groupBox</cstring> - </property> - </widget> - </item> - <item> + <layout class="QGridLayout" name="gridLayout_2"> + <item row="1" column="2"> <widget class="QComboBox" name="groupBox"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Expanding" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> <property name="editable"> <bool>true</bool> </property> </widget> </item> - </layout> - </item> - <item> - <layout class="QGridLayout" name="gridLayout"> - <item row="5" column="0"> - <widget class="QRadioButton" name="ftbBox"> - <property name="enabled"> - <bool>false</bool> - </property> + <item row="1" column="1"> + <widget class="QLabel" name="groupLabel"> <property name="text"> - <string>Install FTB Pack</string> - </property> - </widget> - </item> - <item row="2" column="2"> - <widget class="QToolButton" name="btnChangeVersion"> - <property name="text"> - <string notr="true">...</string> - </property> - </widget> - </item> - <item row="7" column="2"> - <widget class="QToolButton" name="btnChooseFtbPack"> - <property name="enabled"> - <bool>false</bool> - </property> - <property name="text"> - <string>...</string> - </property> - </widget> - </item> - <item row="4" column="2"> - <widget class="QToolButton" name="modpackBtn"> - <property name="enabled"> - <bool>false</bool> - </property> - <property name="text"> - <string notr="true">...</string> - </property> - </widget> - </item> - <item row="7" column="0" colspan="2"> - <widget class="QLabel" name="labelFtbPack"> - <property name="enabled"> - <bool>false</bool> + <string>&Group:</string> </property> - <property name="text"> - <string> No Pack choosen</string> + <property name="buddy"> + <cstring>groupBox</cstring> </property> </widget> </item> - <item row="3" column="0" colspan="3"> - <widget class="QRadioButton" name="modpackBox"> - <property name="text"> - <string>Impor&t Modpack (local file or link):</string> - </property> - </widget> + <item row="0" column="2"> + <widget class="QLineEdit" name="instNameTextBox"/> </item> - <item row="1" column="0" colspan="3"> - <widget class="QRadioButton" name="versionBox"> + <item row="0" column="1"> + <widget class="QLabel" name="nameLabel"> <property name="text"> - <string>Vani&lla Minecraft (select version):</string> - </property> - <property name="checked"> - <bool>true</bool> + <string>&Name:</string> </property> - </widget> - </item> - <item row="2" column="0" colspan="2"> - <widget class="QLineEdit" name="versionTextBox"> - <property name="readOnly"> - <bool>true</bool> - </property> - </widget> - </item> - <item row="4" column="0" colspan="2"> - <widget class="FocusLineEdit" name="modpackEdit"> - <property name="enabled"> - <bool>false</bool> - </property> - <property name="text"> - <string notr="true">http://</string> + <property name="buddy"> + <cstring>instNameTextBox</cstring> </property> </widget> </item> - <item row="5" column="1" colspan="2"> - <widget class="QLabel" name="packDataDownloadStatus"> - <property name="text"> - <string>(Loading Pack data...)</string> + <item row="0" column="0" rowspan="2"> + <widget class="QToolButton" name="iconButton"> + <property name="iconSize"> + <size> + <width>80</width> + <height>80</height> + </size> </property> </widget> </item> </layout> </item> <item> - <spacer name="verticalSpacer"> - <property name="orientation"> - <enum>Qt::Vertical</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>20</width> - <height>40</height> - </size> - </property> - </spacer> - </item> - <item> - <widget class="Line" name="line_2"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - </widget> - </item> - <item> - <widget class="QDialogButtonBox" name="buttonBox"> + <widget class="Line" name="line"> <property name="orientation"> <enum>Qt::Horizontal</enum> </property> - <property name="standardButtons"> - <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set> - </property> </widget> </item> </layout> </widget> - <customwidgets> - <customwidget> - <class>FocusLineEdit</class> - <extends>QLineEdit</extends> - <header>widgets/FocusLineEdit.h</header> - </customwidget> - </customwidgets> <tabstops> + <tabstop>iconButton</tabstop> <tabstop>instNameTextBox</tabstop> <tabstop>groupBox</tabstop> - <tabstop>versionBox</tabstop> - <tabstop>versionTextBox</tabstop> - <tabstop>btnChangeVersion</tabstop> - <tabstop>modpackBox</tabstop> - <tabstop>modpackEdit</tabstop> - <tabstop>modpackBtn</tabstop> - <tabstop>iconButton</tabstop> </tabstops> <resources/> - <connections> - <connection> - <sender>buttonBox</sender> - <signal>accepted()</signal> - <receiver>NewInstanceDialog</receiver> - <slot>accept()</slot> - <hints> - <hint type="sourcelabel"> - <x>266</x> - <y>378</y> - </hint> - <hint type="destinationlabel"> - <x>157</x> - <y>274</y> - </hint> - </hints> - </connection> - <connection> - <sender>buttonBox</sender> - <signal>rejected()</signal> - <receiver>NewInstanceDialog</receiver> - <slot>reject()</slot> - <hints> - <hint type="sourcelabel"> - <x>271</x> - <y>378</y> - </hint> - <hint type="destinationlabel"> - <x>280</x> - <y>274</y> - </hint> - </hints> - </connection> - <connection> - <sender>modpackBox</sender> - <signal>toggled(bool)</signal> - <receiver>modpackEdit</receiver> - <slot>setEnabled(bool)</slot> - <hints> - <hint type="sourcelabel"> - <x>91</x> - <y>251</y> - </hint> - <hint type="destinationlabel"> - <x>240</x> - <y>278</y> - </hint> - </hints> - </connection> - <connection> - <sender>modpackBox</sender> - <signal>toggled(bool)</signal> - <receiver>modpackBtn</receiver> - <slot>setEnabled(bool)</slot> - <hints> - <hint type="sourcelabel"> - <x>139</x> - <y>251</y> - </hint> - <hint type="destinationlabel"> - <x>270</x> - <y>278</y> - </hint> - </hints> - </connection> - <connection> - <sender>versionBox</sender> - <signal>toggled(bool)</signal> - <receiver>versionTextBox</receiver> - <slot>setEnabled(bool)</slot> - <hints> - <hint type="sourcelabel"> - <x>93</x> - <y>195</y> - </hint> - <hint type="destinationlabel"> - <x>223</x> - <y>224</y> - </hint> - </hints> - </connection> - <connection> - <sender>versionBox</sender> - <signal>toggled(bool)</signal> - <receiver>btnChangeVersion</receiver> - <slot>setEnabled(bool)</slot> - <hints> - <hint type="sourcelabel"> - <x>104</x> - <y>198</y> - </hint> - <hint type="destinationlabel"> - <x>270</x> - <y>224</y> - </hint> - </hints> - </connection> - <connection> - <sender>ftbBox</sender> - <signal>toggled(bool)</signal> - <receiver>btnChooseFtbPack</receiver> - <slot>setEnabled(bool)</slot> - <hints> - <hint type="sourcelabel"> - <x>67</x> - <y>301</y> - </hint> - <hint type="destinationlabel"> - <x>254</x> - <y>327</y> - </hint> - </hints> - </connection> - <connection> - <sender>ftbBox</sender> - <signal>toggled(bool)</signal> - <receiver>labelFtbPack</receiver> - <slot>setEnabled(bool)</slot> - <hints> - <hint type="sourcelabel"> - <x>81</x> - <y>310</y> - </hint> - <hint type="destinationlabel"> - <x>73</x> - <y>334</y> - </hint> - </hints> - </connection> - </connections> + <connections/> </ui> diff --git a/application/dialogs/VersionSelectDialog.cpp b/application/dialogs/VersionSelectDialog.cpp index a44572cc..1ed81e79 100644 --- a/application/dialogs/VersionSelectDialog.cpp +++ b/application/dialogs/VersionSelectDialog.cpp @@ -40,7 +40,7 @@ VersionSelectDialog::VersionSelectDialog(BaseVersionList *vlist, QString title, m_verticalLayout = new QVBoxLayout(this); m_verticalLayout->setObjectName(QStringLiteral("verticalLayout")); - m_versionWidget = new VersionSelectWidget(vlist, parent); + m_versionWidget = new VersionSelectWidget(parent); m_verticalLayout->addWidget(m_versionWidget); m_horizontalLayout = new QHBoxLayout(); @@ -107,7 +107,7 @@ void VersionSelectDialog::setResizeOn(int column) int VersionSelectDialog::exec() { QDialog::open(); - m_versionWidget->initialize(); + m_versionWidget->initialize(m_vlist); return QDialog::exec(); } |