Mod info, with less HTML!
And responding to keyboard events too.
This commit is contained in:
parent
36edf6cbc6
commit
6bc9df84d9
@ -47,6 +47,9 @@ LegacyModEditDialog::LegacyModEditDialog(LegacyInstance *inst, QWidget *parent)
|
||||
#endif
|
||||
ui->jarModsTreeView->installEventFilter(this);
|
||||
m_jarmods->startWatching();
|
||||
auto smodel = ui->jarModsTreeView->selectionModel();
|
||||
connect(smodel, SIGNAL(currentChanged(QModelIndex, QModelIndex)),
|
||||
SLOT(jarCurrent(QModelIndex, QModelIndex)));
|
||||
}
|
||||
// Core mods
|
||||
{
|
||||
@ -55,6 +58,9 @@ LegacyModEditDialog::LegacyModEditDialog(LegacyInstance *inst, QWidget *parent)
|
||||
ui->coreModsTreeView->setModel(m_coremods.get());
|
||||
ui->coreModsTreeView->installEventFilter(this);
|
||||
m_coremods->startWatching();
|
||||
auto smodel = ui->coreModsTreeView->selectionModel();
|
||||
connect(smodel, SIGNAL(currentChanged(QModelIndex, QModelIndex)),
|
||||
SLOT(coreCurrent(QModelIndex, QModelIndex)));
|
||||
}
|
||||
// Loader mods
|
||||
{
|
||||
@ -63,6 +69,9 @@ LegacyModEditDialog::LegacyModEditDialog(LegacyInstance *inst, QWidget *parent)
|
||||
ui->loaderModTreeView->setModel(m_mods.get());
|
||||
ui->loaderModTreeView->installEventFilter(this);
|
||||
m_mods->startWatching();
|
||||
auto smodel = ui->loaderModTreeView->selectionModel();
|
||||
connect(smodel, SIGNAL(currentChanged(QModelIndex, QModelIndex)),
|
||||
SLOT(loaderCurrent(QModelIndex, QModelIndex)));
|
||||
}
|
||||
// texture packs
|
||||
{
|
||||
@ -201,7 +210,7 @@ void LegacyModEditDialog::on_addForgeBtn_clicked()
|
||||
if (vselect.exec() && vselect.selectedVersion())
|
||||
{
|
||||
ForgeVersionPtr forge =
|
||||
std::dynamic_pointer_cast<ForgeVersion> (vselect.selectedVersion());
|
||||
std::dynamic_pointer_cast<ForgeVersion>(vselect.selectedVersion());
|
||||
if (!forge)
|
||||
return;
|
||||
auto entry = MMC->metacache()->resolveEntry("minecraftforge", forge->filename);
|
||||
@ -345,41 +354,38 @@ void LegacyModEditDialog::on_buttonBox_rejected()
|
||||
close();
|
||||
}
|
||||
|
||||
void LegacyModEditDialog::on_jarModsTreeView_pressed(const QModelIndex &index)
|
||||
void LegacyModEditDialog::jarCurrent(QModelIndex current, QModelIndex previous)
|
||||
{
|
||||
int first, last;
|
||||
auto list = ui->jarModsTreeView->selectionModel()->selectedRows();
|
||||
|
||||
if (!lastfirst(list, first, last))
|
||||
if(!current.isValid())
|
||||
{
|
||||
ui->jarMIFrame->clear();
|
||||
return;
|
||||
|
||||
Mod &m = m_jarmods->operator[](first);
|
||||
|
||||
handleModInfoUpdate(m, ui->jarMIFrame);
|
||||
}
|
||||
int row = current.row();
|
||||
Mod &m = m_jarmods->operator[](row);
|
||||
ui->jarMIFrame->updateWithMod(m);
|
||||
}
|
||||
|
||||
void LegacyModEditDialog::on_coreModsTreeView_pressed(const QModelIndex &index)
|
||||
void LegacyModEditDialog::coreCurrent(QModelIndex current, QModelIndex previous)
|
||||
{
|
||||
int first, last;
|
||||
auto list = ui->coreModsTreeView->selectionModel()->selectedRows();
|
||||
|
||||
if (!lastfirst(list, first, last))
|
||||
if(!current.isValid())
|
||||
{
|
||||
ui->coreMIFrame->clear();
|
||||
return;
|
||||
|
||||
Mod &m = m_coremods->operator[](first);
|
||||
|
||||
handleModInfoUpdate(m, ui->coreMIFrame);
|
||||
}
|
||||
int row = current.row();
|
||||
Mod &m = m_coremods->operator[](row);
|
||||
ui->coreMIFrame->updateWithMod(m);
|
||||
}
|
||||
|
||||
void LegacyModEditDialog::on_loaderModTreeView_pressed(const QModelIndex &index)
|
||||
void LegacyModEditDialog::loaderCurrent(QModelIndex current, QModelIndex previous)
|
||||
{
|
||||
int first, last;
|
||||
auto list = ui->loaderModTreeView->selectionModel()->selectedRows();
|
||||
|
||||
if (!lastfirst(list, first, last))
|
||||
if(!current.isValid())
|
||||
{
|
||||
ui->loaderMIFrame->clear();
|
||||
return;
|
||||
|
||||
Mod &m = m_mods->operator[](first);
|
||||
|
||||
handleModInfoUpdate(m, ui->loaderMIFrame);
|
||||
}
|
||||
int row = current.row();
|
||||
Mod &m = m_mods->operator[](row);
|
||||
ui->loaderMIFrame->updateWithMod(m);
|
||||
}
|
||||
|
@ -56,9 +56,9 @@ slots:
|
||||
// Questionable: SettingsDialog doesn't need this for some reason?
|
||||
void on_buttonBox_rejected();
|
||||
|
||||
void on_jarModsTreeView_pressed(const QModelIndex &index);
|
||||
void on_coreModsTreeView_pressed(const QModelIndex &index);
|
||||
void on_loaderModTreeView_pressed(const QModelIndex &index);
|
||||
void jarCurrent(QModelIndex current, QModelIndex previous);
|
||||
void coreCurrent(QModelIndex current, QModelIndex previous);
|
||||
void loaderCurrent(QModelIndex current, QModelIndex previous);
|
||||
|
||||
protected:
|
||||
bool eventFilter(QObject *obj, QEvent *ev);
|
||||
|
@ -15,21 +15,15 @@
|
||||
|
||||
#include "MCModInfoFrame.h"
|
||||
#include "ui_MCModInfoFrame.h"
|
||||
|
||||
void handleModInfoUpdate(Mod &m, MCModInfoFrame *frame)
|
||||
void MCModInfoFrame::updateWithMod(Mod &m)
|
||||
{
|
||||
if(m.type() == m.MOD_FOLDER)
|
||||
{
|
||||
frame->setName("<p><span style=\" font-size:9pt; font-weight:600; font-style:italic;\">Select a mod to view information...</span></p>");
|
||||
frame->setDescription("<p><span style=\" font-style:italic;\">Mod description</span></p>");
|
||||
frame->setAuthors("<p><span style=\" font-style:italic; color:#4a4a4a;\">Mod authors</span></p>");
|
||||
frame->setCredits("<p><span style=\" font-style:italic; color:#4a4a4a;\">Mod credits</span></p>");
|
||||
frame->setWebsite("<p><span style=\" font-style:italic; color:#4a4a4a;\">Mod website</span></p>");
|
||||
|
||||
clear();
|
||||
return;
|
||||
}
|
||||
|
||||
QString missing = "<p><span style=\" font-style:italic; color:#4a4a4a;\">Missing from mcmod.info</span></p>";
|
||||
QString missing = tr("Missing from mcmod.info");
|
||||
|
||||
QString name = m.name();
|
||||
if(name.isEmpty()) name = missing;
|
||||
@ -43,11 +37,20 @@ void handleModInfoUpdate(Mod &m, MCModInfoFrame *frame)
|
||||
if(website.isEmpty()) website = missing;
|
||||
else website = "<a href=\"" + website + "\">" + website + "</a>";
|
||||
|
||||
frame->setName("<p><span style=\" font-size:9pt; font-weight:600;\">" + name + "</span></p>");
|
||||
frame->setDescription(description);
|
||||
frame->setAuthors(authors);
|
||||
frame->setCredits(credits);
|
||||
frame->setWebsite(website);
|
||||
setName(name);
|
||||
setDescription(description);
|
||||
setAuthors(authors);
|
||||
setCredits(credits);
|
||||
setWebsite(website);
|
||||
}
|
||||
|
||||
void MCModInfoFrame::clear()
|
||||
{
|
||||
setName(tr("Select a mod to view information..."));
|
||||
setDescription(tr("Mod description"));
|
||||
setAuthors(tr("Mod authors"));
|
||||
setCredits(tr("Mod credits"));
|
||||
setWebsite(tr("Mod website"));
|
||||
}
|
||||
|
||||
MCModInfoFrame::MCModInfoFrame(QWidget *parent) :
|
||||
@ -65,25 +68,25 @@ MCModInfoFrame::~MCModInfoFrame()
|
||||
void MCModInfoFrame::setName(QString name)
|
||||
{
|
||||
ui->label_Name->setText(name);
|
||||
ui->label_Name->setToolTip(name);
|
||||
//ui->label_Name->setToolTip(name);
|
||||
}
|
||||
|
||||
void MCModInfoFrame::setDescription(QString description)
|
||||
{
|
||||
ui->label_Description->setText(description);
|
||||
ui->label_Description->setToolTip(description);
|
||||
//ui->label_Description->setToolTip(description);
|
||||
}
|
||||
|
||||
void MCModInfoFrame::setAuthors(QString authors)
|
||||
{
|
||||
ui->label_Authors->setText(authors);
|
||||
ui->label_Authors->setToolTip(authors);
|
||||
//ui->label_Authors->setToolTip(authors);
|
||||
}
|
||||
|
||||
void MCModInfoFrame::setCredits(QString credits)
|
||||
{
|
||||
ui->label_Credits->setText(credits);
|
||||
ui->label_Credits->setToolTip(credits);
|
||||
//ui->label_Credits->setToolTip(credits);
|
||||
}
|
||||
|
||||
void MCModInfoFrame::setWebsite(QString website)
|
||||
|
@ -18,14 +18,15 @@
|
||||
#include <QFrame>
|
||||
#include "logic/Mod.h"
|
||||
|
||||
namespace Ui {
|
||||
namespace Ui
|
||||
{
|
||||
class MCModInfoFrame;
|
||||
}
|
||||
|
||||
class MCModInfoFrame : public QFrame
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
|
||||
public:
|
||||
explicit MCModInfoFrame(QWidget *parent = 0);
|
||||
~MCModInfoFrame();
|
||||
@ -36,9 +37,9 @@ public:
|
||||
void setCredits(QString credits);
|
||||
void setWebsite(QString website);
|
||||
|
||||
|
||||
void updateWithMod(Mod &m);
|
||||
void clear();
|
||||
|
||||
private:
|
||||
Ui::MCModInfoFrame *ui;
|
||||
};
|
||||
|
||||
void handleModInfoUpdate(Mod &m, MCModInfoFrame *frame);
|
||||
|
@ -2,136 +2,81 @@
|
||||
<ui version="4.0">
|
||||
<class>MCModInfoFrame</class>
|
||||
<widget class="QFrame" name="MCModInfoFrame">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>571</width>
|
||||
<height>55</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Frame</string>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QFrame" name="frame_2">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>250</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_5">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_Name">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>250</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>92</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string><html><head/><body><p><span style=" font-size:9pt; font-weight:600; font-style:italic;">Select a mod to view information...</span></p></body></html></string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_Description">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>250</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>92</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string><html><head/><body><p><span style=" font-style:italic;">Mod description</span></p></body></html></string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_Name">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>250</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>92</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Select a mod to view information...</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_Description">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>250</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>92</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Mod description</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
@ -169,7 +114,7 @@
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string><html><head/><body><p><span style=" font-style:italic; color:#4a4a4a;">Mod authors</span></p></body></html></string>
|
||||
<string>Mod authors</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
||||
@ -204,7 +149,7 @@
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string><html><head/><body><p><span style=" font-style:italic; color:#4a4a4a;">Mod website</span></p></body></html></string>
|
||||
<string>Mod website</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
||||
@ -232,7 +177,7 @@
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string><html><head/><body><p><span style=" font-style:italic; color:#4a4a4a;">Mod credits</span></p></body></html></string>
|
||||
<string>Mod credits</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
||||
|
@ -60,6 +60,9 @@ OneSixModEditDialog::OneSixModEditDialog(OneSixInstance *inst, QWidget *parent)
|
||||
ui->loaderModTreeView->setModel(m_mods.get());
|
||||
ui->loaderModTreeView->installEventFilter(this);
|
||||
m_mods->startWatching();
|
||||
auto smodel = ui->loaderModTreeView->selectionModel();
|
||||
connect(smodel, SIGNAL(currentChanged(QModelIndex, QModelIndex)),
|
||||
SLOT(loaderCurrent(QModelIndex,QModelIndex)));
|
||||
}
|
||||
// resource packs
|
||||
{
|
||||
@ -298,15 +301,14 @@ void OneSixModEditDialog::on_viewResPackBtn_clicked()
|
||||
openDirInDefaultProgram(m_inst->resourcePacksDir(), true);
|
||||
}
|
||||
|
||||
void OneSixModEditDialog::on_loaderModTreeView_pressed(const QModelIndex &index)
|
||||
void OneSixModEditDialog::loaderCurrent(QModelIndex current, QModelIndex previous)
|
||||
{
|
||||
int first, last;
|
||||
auto list = ui->loaderModTreeView->selectionModel()->selectedRows();
|
||||
|
||||
if (!lastfirst(list, first, last))
|
||||
if(!current.isValid())
|
||||
{
|
||||
ui->frame->clear();
|
||||
return;
|
||||
|
||||
Mod &m = m_mods->operator[](first);
|
||||
|
||||
handleModInfoUpdate(m, ui->frame);
|
||||
}
|
||||
int row = current.row();
|
||||
Mod &m = m_mods->operator[](row);
|
||||
ui->frame->updateWithMod(m);
|
||||
}
|
||||
|
@ -1,9 +1,9 @@
|
||||
/* Copyright 2013 MultiMC Contributors
|
||||
*
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
@ -19,23 +19,25 @@
|
||||
#include <logic/OneSixInstance.h>
|
||||
|
||||
class EnabledItemFilter;
|
||||
namespace Ui {
|
||||
class OneSixModEditDialog;
|
||||
namespace Ui
|
||||
{
|
||||
class OneSixModEditDialog;
|
||||
}
|
||||
|
||||
class OneSixModEditDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
|
||||
public:
|
||||
explicit OneSixModEditDialog(OneSixInstance* inst, QWidget *parent = 0);
|
||||
explicit OneSixModEditDialog(OneSixInstance *inst, QWidget *parent = 0);
|
||||
virtual ~OneSixModEditDialog();
|
||||
|
||||
private slots:
|
||||
|
||||
private
|
||||
slots:
|
||||
void on_addModBtn_clicked();
|
||||
void on_rmModBtn_clicked();
|
||||
void on_viewModBtn_clicked();
|
||||
|
||||
|
||||
void on_addResPackBtn_clicked();
|
||||
void on_rmResPackBtn_clicked();
|
||||
void on_viewResPackBtn_clicked();
|
||||
@ -44,20 +46,22 @@ private slots:
|
||||
void on_forgeBtn_clicked();
|
||||
void on_customizeBtn_clicked();
|
||||
void on_revertBtn_clicked();
|
||||
void updateVersionControls();
|
||||
void updateVersionControls();
|
||||
void disableVersionControls();
|
||||
|
||||
void on_loaderModTreeView_pressed(const QModelIndex &index);
|
||||
|
||||
protected:
|
||||
bool eventFilter(QObject *obj, QEvent *ev);
|
||||
bool loaderListFilter( QKeyEvent* ev );
|
||||
bool resourcePackListFilter( QKeyEvent* ev );
|
||||
bool loaderListFilter(QKeyEvent *ev);
|
||||
bool resourcePackListFilter(QKeyEvent *ev);
|
||||
|
||||
private:
|
||||
Ui::OneSixModEditDialog *ui;
|
||||
std::shared_ptr<OneSixVersion> m_version;
|
||||
std::shared_ptr<ModList> m_mods;
|
||||
std::shared_ptr<ModList> m_resourcepacks;
|
||||
EnabledItemFilter * main_model;
|
||||
OneSixInstance * m_inst;
|
||||
EnabledItemFilter *main_model;
|
||||
OneSixInstance *m_inst;
|
||||
public
|
||||
slots:
|
||||
void loaderCurrent(QModelIndex current, QModelIndex previous);
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user