Tweaks to page dialog and version page.
This commit is contained in:
parent
f485885757
commit
6b3d1101cb
@ -507,6 +507,8 @@ void MultiMC::initGlobalSettings()
|
|||||||
m_settings->registerSetting("ConsoleWindowGeometry", "");
|
m_settings->registerSetting("ConsoleWindowGeometry", "");
|
||||||
|
|
||||||
m_settings->registerSetting("SettingsGeometry", "");
|
m_settings->registerSetting("SettingsGeometry", "");
|
||||||
|
|
||||||
|
m_settings->registerSetting("PagedGeometry", "");
|
||||||
}
|
}
|
||||||
|
|
||||||
void MultiMC::initHttpMetaCache()
|
void MultiMC::initHttpMetaCache()
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include <QDialogButtonBox>
|
#include <QDialogButtonBox>
|
||||||
#include <QGridLayout>
|
#include <QGridLayout>
|
||||||
|
#include <settingsobject.h>
|
||||||
|
|
||||||
#include "PageDialog_p.h"
|
#include "PageDialog_p.h"
|
||||||
#include <gui/widgets/IconLabel.h>
|
#include <gui/widgets/IconLabel.h>
|
||||||
@ -55,6 +56,7 @@ PageDialog::PageDialog(BasePageProviderPtr pageProvider, QWidget *parent) : QDia
|
|||||||
MultiMCPlatform::fixWM_CLASS(this);
|
MultiMCPlatform::fixWM_CLASS(this);
|
||||||
createUI();
|
createUI();
|
||||||
setWindowTitle(pageProvider->dialogTitle());
|
setWindowTitle(pageProvider->dialogTitle());
|
||||||
|
restoreGeometry(QByteArray::fromBase64(MMC->settings()->get("PagedGeometry").toByteArray()));
|
||||||
|
|
||||||
m_model = new PageModel(this);
|
m_model = new PageModel(this);
|
||||||
m_proxyModel = new PageEntryFilterModel(this);
|
m_proxyModel = new PageEntryFilterModel(this);
|
||||||
@ -111,8 +113,9 @@ void PageDialog::createUI()
|
|||||||
m_pageStack->setMargin(0);
|
m_pageStack->setMargin(0);
|
||||||
m_pageStack->addWidget(new QWidget(this));
|
m_pageStack->addWidget(new QWidget(this));
|
||||||
|
|
||||||
QDialogButtonBox *buttons = new QDialogButtonBox(
|
QDialogButtonBox *buttons =
|
||||||
QDialogButtonBox::Ok | QDialogButtonBox::Apply | QDialogButtonBox::Cancel);
|
new QDialogButtonBox(QDialogButtonBox::Help | QDialogButtonBox::Ok |
|
||||||
|
QDialogButtonBox::Apply | QDialogButtonBox::Cancel);
|
||||||
buttons->button(QDialogButtonBox::Ok)->setDefault(true);
|
buttons->button(QDialogButtonBox::Ok)->setDefault(true);
|
||||||
connect(buttons->button(QDialogButtonBox::Apply), SIGNAL(clicked()), this, SLOT(apply()));
|
connect(buttons->button(QDialogButtonBox::Apply), SIGNAL(clicked()), this, SLOT(apply()));
|
||||||
connect(buttons, SIGNAL(accepted()), this, SLOT(accept()));
|
connect(buttons, SIGNAL(accepted()), this, SLOT(accept()));
|
||||||
@ -149,6 +152,45 @@ void PageDialog::currentChanged(const QModelIndex ¤t)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PageDialog::accept()
|
||||||
|
{
|
||||||
|
bool accepted = true;
|
||||||
|
for(auto page: m_model->pages())
|
||||||
|
{
|
||||||
|
accepted &= page->accept();
|
||||||
|
}
|
||||||
|
if(accepted)
|
||||||
|
{
|
||||||
|
MMC->settings()->set("PagedGeometry", saveGeometry().toBase64());
|
||||||
|
QDialog::accept();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void PageDialog::reject()
|
||||||
|
{
|
||||||
|
bool rejected = true;
|
||||||
|
for(auto page: m_model->pages())
|
||||||
|
{
|
||||||
|
rejected &= page->reject();
|
||||||
|
}
|
||||||
|
if(rejected)
|
||||||
|
{
|
||||||
|
MMC->settings()->set("PagedGeometry", saveGeometry().toBase64());
|
||||||
|
QDialog::reject();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void PageDialog::apply()
|
void PageDialog::apply()
|
||||||
{
|
{
|
||||||
|
for(auto page: m_model->pages())
|
||||||
|
{
|
||||||
|
page->apply();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void PageDialog::closeEvent(QCloseEvent * event)
|
||||||
|
{
|
||||||
|
MMC->settings()->set("PagedGeometry", saveGeometry().toBase64());
|
||||||
|
QDialog::closeEvent(event);
|
||||||
}
|
}
|
||||||
|
@ -36,8 +36,11 @@ private:
|
|||||||
void createUI();
|
void createUI();
|
||||||
private slots:
|
private slots:
|
||||||
void apply();
|
void apply();
|
||||||
|
virtual void reject();
|
||||||
|
virtual void accept();
|
||||||
void currentChanged(const QModelIndex ¤t);
|
void currentChanged(const QModelIndex ¤t);
|
||||||
void showPage(int row);
|
void showPage(int row);
|
||||||
|
virtual void closeEvent(QCloseEvent *event);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QSortFilterProxyModel *m_proxyModel;
|
QSortFilterProxyModel *m_proxyModel;
|
||||||
|
@ -25,6 +25,18 @@ public:
|
|||||||
virtual QString id() = 0;
|
virtual QString id() = 0;
|
||||||
virtual QString displayName() = 0;
|
virtual QString displayName() = 0;
|
||||||
virtual QIcon icon() = 0;
|
virtual QIcon icon() = 0;
|
||||||
|
virtual bool accept()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
virtual bool reject()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
virtual bool apply()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
virtual bool shouldDisplay()
|
virtual bool shouldDisplay()
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
|
@ -79,6 +79,7 @@ VersionPage::VersionPage(OneSixInstance *inst, QWidget *parent)
|
|||||||
main_model->setSourceModel(m_version.get());
|
main_model->setSourceModel(m_version.get());
|
||||||
ui->libraryTreeView->setModel(main_model);
|
ui->libraryTreeView->setModel(main_model);
|
||||||
ui->libraryTreeView->installEventFilter(this);
|
ui->libraryTreeView->installEventFilter(this);
|
||||||
|
ui->libraryTreeView->setSelectionMode(QAbstractItemView::SingleSelection);
|
||||||
connect(ui->libraryTreeView->selectionModel(), &QItemSelectionModel::currentChanged,
|
connect(ui->libraryTreeView->selectionModel(), &QItemSelectionModel::currentChanged,
|
||||||
this, &VersionPage::versionCurrent);
|
this, &VersionPage::versionCurrent);
|
||||||
updateVersionControls();
|
updateVersionControls();
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>400</width>
|
<width>400</width>
|
||||||
<height>326</height>
|
<height>475</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
@ -51,6 +51,16 @@
|
|||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label">
|
||||||
|
<property name="text">
|
||||||
|
<string>Selection</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="changeMCVersionBtn">
|
<widget class="QPushButton" name="changeMCVersionBtn">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
@ -58,6 +68,46 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="moveLibraryUpBtn">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>This isn't implemented yet.</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Move up</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="moveLibraryDownBtn">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>This isn't implemented yet.</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Move down</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="removeLibraryBtn">
|
||||||
|
<property name="text">
|
||||||
|
<string>Remove</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="LineSeparator" name="separator" native="true"/>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_2">
|
||||||
|
<property name="text">
|
||||||
|
<string>Install</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="forgeBtn">
|
<widget class="QPushButton" name="forgeBtn">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
@ -83,50 +133,15 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="Line" name="line">
|
<widget class="LineSeparator" name="widget" native="true"/>
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="reloadLibrariesBtn">
|
<widget class="QLabel" name="label_5">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Reload</string>
|
<string>List</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
<property name="alignment">
|
||||||
</item>
|
<set>Qt::AlignCenter</set>
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="removeLibraryBtn">
|
|
||||||
<property name="text">
|
|
||||||
<string>Remove</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="Line" name="line_2">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="moveLibraryUpBtn">
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>This isn't implemented yet.</string>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Move up</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="moveLibraryDownBtn">
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>This isn't implemented yet.</string>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Move down</string>
|
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@ -140,6 +155,13 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="reloadLibrariesBtn">
|
||||||
|
<property name="text">
|
||||||
|
<string>Reload</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<spacer name="verticalSpacer_7">
|
<spacer name="verticalSpacer_7">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
@ -163,6 +185,12 @@
|
|||||||
<extends>QTreeView</extends>
|
<extends>QTreeView</extends>
|
||||||
<header>gui/widgets/ModListView.h</header>
|
<header>gui/widgets/ModListView.h</header>
|
||||||
</customwidget>
|
</customwidget>
|
||||||
|
<customwidget>
|
||||||
|
<class>LineSeparator</class>
|
||||||
|
<extends>QWidget</extends>
|
||||||
|
<header>gui/widgets/LineSeparator.h</header>
|
||||||
|
<container>1</container>
|
||||||
|
</customwidget>
|
||||||
</customwidgets>
|
</customwidgets>
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections/>
|
<connections/>
|
||||||
|
@ -9,10 +9,10 @@ class LineSeparator : public QWidget
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
/// Create a line separator. orientation is the orientation of the line.
|
/// Create a line separator. orientation is the orientation of the line.
|
||||||
explicit LineSeparator(QWidget *parent, Qt::Orientation orientation = Qt::Vertical);
|
explicit LineSeparator(QWidget *parent, Qt::Orientation orientation = Qt::Horizontal);
|
||||||
QSize sizeHint() const;
|
QSize sizeHint() const;
|
||||||
void paintEvent(QPaintEvent *);
|
void paintEvent(QPaintEvent *);
|
||||||
void initStyleOption(QStyleOption *option) const;
|
void initStyleOption(QStyleOption *option) const;
|
||||||
private:
|
private:
|
||||||
Qt::Orientation m_orientation = Qt::Vertical;
|
Qt::Orientation m_orientation = Qt::Horizontal;
|
||||||
};
|
};
|
||||||
|
@ -59,7 +59,7 @@ void ServerStatus::reloadStatus()
|
|||||||
|
|
||||||
void ServerStatus::addLine()
|
void ServerStatus::addLine()
|
||||||
{
|
{
|
||||||
layout->addWidget(new LineSeparator(this));
|
layout->addWidget(new LineSeparator(this, Qt::Vertical));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ServerStatus::addStatus(QString key, QString name)
|
void ServerStatus::addStatus(QString key, QString name)
|
||||||
|
Loading…
Reference in New Issue
Block a user