mirror of
https://github.com/PrismLauncher/PrismLauncher.git
synced 2026-06-29 01:54:20 +03:00
fix ui/miscellanous issues
This commit is contained in:
parent
ed612a49e8
commit
66b20c990f
4 changed files with 11 additions and 10 deletions
|
|
@ -46,7 +46,7 @@
|
|||
#include <QUuid>
|
||||
#include <Qt>
|
||||
|
||||
MultiWorldList::MultiWorldList(const QList<QString&> dirs, QList<BaseInstance*> instances) : QAbstractListModel(), m_instances(instances)
|
||||
MultiWorldList::MultiWorldList(const QList<QString>& dirs, QList<BaseInstance*> instances) : QAbstractListModel(), m_instances(instances)
|
||||
{
|
||||
for (int i = 0; i < dirs.length(); i++) { // better way to do this? iy
|
||||
m_dirs[i] = dirs[i];
|
||||
|
|
@ -413,7 +413,7 @@ bool MultiWorldList::dropMimeData(const QMimeData* data,
|
|||
return false;
|
||||
}
|
||||
|
||||
int64_t calculateWorldSize(const QFileInfo& file)
|
||||
int64_t MultiWorldList::calculateWorldSize(const QFileInfo& file)
|
||||
{
|
||||
if (file.isFile() && file.suffix() == "zip") {
|
||||
return file.size();
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ class MultiWorldList : public QAbstractListModel {
|
|||
|
||||
enum Roles { ObjectRole = Qt::UserRole + 1, FolderRole, SeedRole, NameRole, GameModeRole, LastPlayedRole, SizeRole, IconFileRole };
|
||||
|
||||
MultiWorldList(const QList<QString&> dirs, QList<BaseInstance*> instances);
|
||||
MultiWorldList(const QList<QString>& dirs, QList<BaseInstance*> instances);
|
||||
|
||||
virtual QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const;
|
||||
|
||||
|
|
@ -68,6 +68,7 @@ class MultiWorldList : public QAbstractListModel {
|
|||
/// process data from drop action
|
||||
virtual bool dropMimeData(const QMimeData* data, Qt::DropAction action, int row, int column, const QModelIndex& parent);
|
||||
/// what drag actions do we support?
|
||||
int64_t calculateWorldSize(const QFileInfo& file);
|
||||
virtual Qt::DropActions supportedDragActions() const;
|
||||
|
||||
/// what drop actions do we support?
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@
|
|||
#include "MultiWorldListPage.h"
|
||||
#include "minecraft/MultiWorldList.h"
|
||||
#include "ui/dialogs/CustomMessageBox.h"
|
||||
#include "ui_WorldListPage.h" //fix this iy
|
||||
#include "ui_MultiWorldListPage.h" //fix this iy
|
||||
|
||||
#include <ui/widgets/PageContainer.h>
|
||||
#include <QClipboard>
|
||||
|
|
@ -62,11 +62,11 @@
|
|||
#include "Application.h"
|
||||
#include "pages/instance/DataPackPage.h"
|
||||
|
||||
class WorldListProxyModel : public QSortFilterProxyModel {
|
||||
class MultiWorldListProxyModel : public QSortFilterProxyModel {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
WorldListProxyModel(QObject* parent) : QSortFilterProxyModel(parent) {}
|
||||
MultiWorldListProxyModel(QObject* parent) : QSortFilterProxyModel(parent) {}
|
||||
|
||||
virtual QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const
|
||||
{
|
||||
|
|
@ -87,13 +87,13 @@ class WorldListProxyModel : public QSortFilterProxyModel {
|
|||
};
|
||||
|
||||
MultiWorldListPage::MultiWorldListPage(MinecraftInstance* inst, MultiWorldList* worlds, QWidget* parent)
|
||||
: QMainWindow(parent), m_inst(inst), ui(new Ui::WorldListPage), m_worlds(worlds) //use MultiWorldListPage.ui to have separate ui from normal world list page iy
|
||||
: QMainWindow(parent), m_inst(inst), ui(new Ui::MultiWorldListPage), m_worlds(worlds) //use MultiWorldListPage.ui to have separate ui from normal world list page iy
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
ui->toolBar->insertSpacer(ui->actionRefresh);
|
||||
|
||||
WorldListProxyModel* proxy = new WorldListProxyModel(this);
|
||||
MultiWorldListProxyModel* proxy = new MultiWorldListProxyModel(this);
|
||||
proxy->setSortCaseSensitivity(Qt::CaseInsensitive);
|
||||
proxy->setSourceModel(m_worlds);
|
||||
proxy->setSortRole(Qt::UserRole);
|
||||
|
|
@ -474,4 +474,4 @@ void MultiWorldListPage::on_actionJoin_triggered()
|
|||
APPLICATION->launch(m_inst, LaunchMode::Normal, std::make_shared<MinecraftTarget>(MinecraftTarget::parse(world->folderName(), true)));
|
||||
}
|
||||
|
||||
#include "WorldListPage.moc" //change this iy
|
||||
#include "MultiWorldListPage.moc" //change this iy
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@ class MultiWorldListPage : public QMainWindow, public BasePage {
|
|||
void mceditError();
|
||||
|
||||
private:
|
||||
Ui::WorldListPage* ui;
|
||||
Ui::MultiWorldListPage* ui;
|
||||
MultiWorldList* m_worlds;
|
||||
unique_qobject_ptr<LoggedProcess> m_mceditProcess;
|
||||
bool m_mceditStarting = false;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue