mirror of
https://github.com/UltimMC/Launcher.git
synced 2025-12-14 04:32:14 +00:00
Compare commits
2 Commits
0.6.10
...
feature/of
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
836fefa2d9 | ||
|
|
060992b448 |
@@ -488,6 +488,10 @@ MultiMC::MultiMC(int &argc, char **argv) : QApplication(argc, argv)
|
|||||||
m_settings->registerSetting("InstSortMode", "Name");
|
m_settings->registerSetting("InstSortMode", "Name");
|
||||||
m_settings->registerSetting("SelectedInstance", QString());
|
m_settings->registerSetting("SelectedInstance", QString());
|
||||||
|
|
||||||
|
// Offline mode stuff
|
||||||
|
m_settings->registerSetting("OfflineModeNameMode", "UseAccountName");
|
||||||
|
m_settings->registerSetting("OfflineModeName", "Player");
|
||||||
|
|
||||||
// Window state and geometry
|
// Window state and geometry
|
||||||
m_settings->registerSetting("MainWindowState", "");
|
m_settings->registerSetting("MainWindowState", "");
|
||||||
m_settings->registerSetting("MainWindowGeometry", "");
|
m_settings->registerSetting("MainWindowGeometry", "");
|
||||||
|
|||||||
@@ -33,11 +33,18 @@
|
|||||||
|
|
||||||
#include "MultiMC.h"
|
#include "MultiMC.h"
|
||||||
|
|
||||||
|
enum class OfflineModeNameMode
|
||||||
|
{
|
||||||
|
UseAccountName = 1,
|
||||||
|
RememberPerAccount = 2,
|
||||||
|
RememberPerInstance = 3,
|
||||||
|
UseFixedName = 4
|
||||||
|
};
|
||||||
|
|
||||||
AccountListPage::AccountListPage(QWidget *parent)
|
AccountListPage::AccountListPage(QWidget *parent)
|
||||||
: QWidget(parent), ui(new Ui::AccountListPage)
|
: QWidget(parent), ui(new Ui::AccountListPage)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
ui->tabWidget->tabBar()->hide();
|
|
||||||
|
|
||||||
m_accounts = MMC->accounts();
|
m_accounts = MMC->accounts();
|
||||||
|
|
||||||
@@ -56,7 +63,15 @@ AccountListPage::AccountListPage(QWidget *parent)
|
|||||||
connect(m_accounts.get(), SIGNAL(listChanged()), SLOT(listChanged()));
|
connect(m_accounts.get(), SIGNAL(listChanged()), SLOT(listChanged()));
|
||||||
connect(m_accounts.get(), SIGNAL(activeAccountChanged()), SLOT(listChanged()));
|
connect(m_accounts.get(), SIGNAL(activeAccountChanged()), SLOT(listChanged()));
|
||||||
|
|
||||||
|
ui->offlineButtonGroup->setId(ui->useSelectedNameBtn, int(OfflineModeNameMode::UseAccountName));
|
||||||
|
ui->offlineButtonGroup->setId(ui->rememberNamesForAccountsBtn, int(OfflineModeNameMode::RememberPerAccount));
|
||||||
|
ui->offlineButtonGroup->setId(ui->rememberNamesForInstancesBtn, int(OfflineModeNameMode::RememberPerInstance));
|
||||||
|
ui->offlineButtonGroup->setId(ui->useFixedNameBtn, int(OfflineModeNameMode::UseFixedName));
|
||||||
|
|
||||||
|
connect(ui->offlineButtonGroup, SIGNAL(buttonToggled(int,bool)), this, SLOT(groupSelectionChanged(int,bool)));
|
||||||
|
|
||||||
updateButtonStates();
|
updateButtonStates();
|
||||||
|
loadSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
AccountListPage::~AccountListPage()
|
AccountListPage::~AccountListPage()
|
||||||
@@ -151,3 +166,68 @@ void AccountListPage::on_uploadSkinBtn_clicked()
|
|||||||
dialog.exec();
|
dialog.exec();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool AccountListPage::apply()
|
||||||
|
{
|
||||||
|
applySettings();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void AccountListPage::applySettings()
|
||||||
|
{
|
||||||
|
auto s = MMC->settings();
|
||||||
|
auto sortMode = (OfflineModeNameMode)ui->offlineButtonGroup->checkedId();
|
||||||
|
switch (sortMode)
|
||||||
|
{
|
||||||
|
default:
|
||||||
|
case OfflineModeNameMode::UseAccountName:
|
||||||
|
s->set("OfflineModeNameMode", "UseAccountName");
|
||||||
|
break;
|
||||||
|
case OfflineModeNameMode::RememberPerAccount:
|
||||||
|
s->set("OfflineModeNameMode", "RememberPerAccount");
|
||||||
|
break;
|
||||||
|
case OfflineModeNameMode::RememberPerInstance:
|
||||||
|
s->set("OfflineModeNameMode", "RememberPerInstance");
|
||||||
|
break;
|
||||||
|
case OfflineModeNameMode::UseFixedName:
|
||||||
|
s->set("OfflineModeNameMode", "UseFixedName");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
s->set("OfflineModeName", ui->mainOfflineNameEdit->text());
|
||||||
|
}
|
||||||
|
|
||||||
|
void AccountListPage::loadSettings()
|
||||||
|
{
|
||||||
|
auto s = MMC->settings();
|
||||||
|
auto value = s->get("OfflineModeNameMode").toString();
|
||||||
|
if(value == "UseAccountName")
|
||||||
|
{
|
||||||
|
ui->useSelectedNameBtn->setChecked(true);
|
||||||
|
}
|
||||||
|
else if(value == "RememberPerAccount")
|
||||||
|
{
|
||||||
|
ui->rememberNamesForAccountsBtn->setChecked(true);
|
||||||
|
}
|
||||||
|
else if(value == "RememberPerInstance")
|
||||||
|
{
|
||||||
|
ui->rememberNamesForInstancesBtn->setChecked(true);
|
||||||
|
}
|
||||||
|
else if(value == "UseFixedName")
|
||||||
|
{
|
||||||
|
ui->useFixedNameBtn->setChecked(true);
|
||||||
|
}
|
||||||
|
ui->mainOfflineNameEdit->setText(s->get("OfflineModeName").toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
void AccountListPage::groupSelectionChanged(int, bool)
|
||||||
|
{
|
||||||
|
auto sortMode = (OfflineModeNameMode)ui->offlineButtonGroup->checkedId();
|
||||||
|
if(sortMode == OfflineModeNameMode::UseFixedName)
|
||||||
|
{
|
||||||
|
ui->mainOfflineNameEdit->setEnabled(true);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ui->mainOfflineNameEdit->setEnabled(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -58,6 +58,7 @@ public:
|
|||||||
{
|
{
|
||||||
return "Getting-Started#adding-an-account";
|
return "Getting-Started#adding-an-account";
|
||||||
}
|
}
|
||||||
|
bool apply() override;
|
||||||
|
|
||||||
public
|
public
|
||||||
slots:
|
slots:
|
||||||
@@ -73,6 +74,8 @@ slots:
|
|||||||
|
|
||||||
void listChanged();
|
void listChanged();
|
||||||
|
|
||||||
|
void groupSelectionChanged(int, bool);
|
||||||
|
|
||||||
//! Updates the states of the dialog's buttons.
|
//! Updates the states of the dialog's buttons.
|
||||||
void updateButtonStates();
|
void updateButtonStates();
|
||||||
|
|
||||||
@@ -83,6 +86,10 @@ protected
|
|||||||
slots:
|
slots:
|
||||||
void addAccount(const QString& errMsg="");
|
void addAccount(const QString& errMsg="");
|
||||||
|
|
||||||
|
private:
|
||||||
|
void applySettings();
|
||||||
|
void loadSettings();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::AccountListPage *ui;
|
Ui::AccountListPage *ui;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -6,8 +6,8 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>694</width>
|
<width>333</width>
|
||||||
<height>609</height>
|
<height>302</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
@@ -28,9 +28,9 @@
|
|||||||
<property name="currentIndex">
|
<property name="currentIndex">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="tab">
|
<widget class="QWidget" name="onlineTab">
|
||||||
<attribute name="title">
|
<attribute name="title">
|
||||||
<string notr="true">Tab 1</string>
|
<string>Online</string>
|
||||||
</attribute>
|
</attribute>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
<item>
|
<item>
|
||||||
@@ -113,10 +113,89 @@
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
|
<widget class="QWidget" name="offlineTab">
|
||||||
|
<attribute name="title">
|
||||||
|
<string>Offline</string>
|
||||||
|
</attribute>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout22">
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="offlineBox">
|
||||||
|
<property name="title">
|
||||||
|
<string>Offline mode name</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout" name="foldersBoxLayout_2">
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QRadioButton" name="useSelectedNameBtn">
|
||||||
|
<property name="text">
|
||||||
|
<string>&Use selected account name</string>
|
||||||
|
</property>
|
||||||
|
<attribute name="buttonGroup">
|
||||||
|
<string notr="true">offlineButtonGroup</string>
|
||||||
|
</attribute>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="0">
|
||||||
|
<widget class="QRadioButton" name="useFixedNameBtn">
|
||||||
|
<property name="text">
|
||||||
|
<string>Always use &this offline name:</string>
|
||||||
|
</property>
|
||||||
|
<attribute name="buttonGroup">
|
||||||
|
<string notr="true">offlineButtonGroup</string>
|
||||||
|
</attribute>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="4" column="0">
|
||||||
|
<widget class="QLineEdit" name="mainOfflineNameEdit">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QRadioButton" name="rememberNamesForAccountsBtn">
|
||||||
|
<property name="text">
|
||||||
|
<string>Remember offline &names per account</string>
|
||||||
|
</property>
|
||||||
|
<attribute name="buttonGroup">
|
||||||
|
<string notr="true">offlineButtonGroup</string>
|
||||||
|
</attribute>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="0">
|
||||||
|
<widget class="QRadioButton" name="rememberNamesForInstancesBtn">
|
||||||
|
<property name="text">
|
||||||
|
<string>Remember offline &names per instance</string>
|
||||||
|
</property>
|
||||||
|
<attribute name="buttonGroup">
|
||||||
|
<string notr="true">offlineButtonGroup</string>
|
||||||
|
</attribute>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</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>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections/>
|
<connections/>
|
||||||
|
<buttongroups>
|
||||||
|
<buttongroup name="offlineButtonGroup"/>
|
||||||
|
</buttongroups>
|
||||||
</ui>
|
</ui>
|
||||||
|
|||||||
Reference in New Issue
Block a user