mirror of
https://github.com/MultiMC/MultiMC5.git
synced 2024-12-26 09:17:00 +00:00
NOISSUE make the setup wizard use the main event loop
This should fix any issues with receiving events over IPC.
This commit is contained in:
parent
0249bd9eea
commit
6f17183bf0
@ -312,8 +312,6 @@ MultiMC::MultiMC(int &argc, char **argv) : QApplication(argc, argv)
|
||||
|
||||
connect(this, SIGNAL(aboutToQuit()), SLOT(onExit()));
|
||||
|
||||
m_status = MultiMC::Initialized;
|
||||
|
||||
setIconTheme(settings()->get("IconTheme").toString());
|
||||
setApplicationTheme(settings()->get("ApplicationTheme").toString());
|
||||
|
||||
@ -322,10 +320,22 @@ MultiMC::MultiMC(int &argc, char **argv) : QApplication(argc, argv)
|
||||
if(SetupWizard::isRequired())
|
||||
{
|
||||
m_setupWizard = new SetupWizard(nullptr);
|
||||
int result = m_setupWizard->exec();
|
||||
qDebug() << "Wizard result =" << result;
|
||||
connect(m_setupWizard, &QDialog::finished, this, &MultiMC::setupWizardFinished);
|
||||
m_setupWizard->show();
|
||||
return;
|
||||
}
|
||||
performMainStartupAction();
|
||||
}
|
||||
|
||||
void MultiMC::setupWizardFinished(int status)
|
||||
{
|
||||
qDebug() << "Wizard result =" << status;
|
||||
performMainStartupAction();
|
||||
}
|
||||
|
||||
void MultiMC::performMainStartupAction()
|
||||
{
|
||||
m_status = MultiMC::Initialized;
|
||||
if(!m_instanceIdToLaunch.isEmpty())
|
||||
{
|
||||
auto inst = instances()->getInstanceById(m_instanceIdToLaunch);
|
||||
@ -361,6 +371,11 @@ MultiMC::~MultiMC()
|
||||
|
||||
void MultiMC::messageReceived(const QString& message)
|
||||
{
|
||||
if(status() != Initialized)
|
||||
{
|
||||
qDebug() << "Received message" << message << "while still initializing. It will be ignored.";
|
||||
return;
|
||||
}
|
||||
if(message == "activate")
|
||||
{
|
||||
showMainWindow();
|
||||
|
@ -49,6 +49,7 @@ class MultiMC : public QApplication
|
||||
public:
|
||||
enum Status
|
||||
{
|
||||
StartingUp,
|
||||
Failed,
|
||||
Succeeded,
|
||||
Initialized
|
||||
@ -163,14 +164,12 @@ private slots:
|
||||
* Do all the things that should be done before we exit
|
||||
*/
|
||||
void onExit();
|
||||
|
||||
void on_windowClose();
|
||||
|
||||
void messageReceived(const QString & message);
|
||||
|
||||
void controllerSucceeded();
|
||||
void controllerFailed(const QString & error);
|
||||
void analyticsSettingChanged(const Setting &setting, QVariant value);
|
||||
void setupWizardFinished(int status);
|
||||
|
||||
private:
|
||||
void initLogger();
|
||||
@ -185,6 +184,7 @@ private:
|
||||
void initMCEdit();
|
||||
void initAnalytics();
|
||||
void shutdownAnalytics();
|
||||
void performMainStartupAction();
|
||||
|
||||
private:
|
||||
QDateTime startTime;
|
||||
@ -208,7 +208,7 @@ private:
|
||||
QMap<QString, std::shared_ptr<BaseProfilerFactory>> m_profilers;
|
||||
|
||||
QString m_rootPath;
|
||||
Status m_status = MultiMC::Failed;
|
||||
Status m_status = MultiMC::StartingUp;
|
||||
|
||||
// used on Windows to attach the standard IO streams
|
||||
bool consoleAttached = false;
|
||||
|
@ -33,6 +33,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
switch (app.status())
|
||||
{
|
||||
case MultiMC::StartingUp:
|
||||
case MultiMC::Initialized:
|
||||
{
|
||||
Q_INIT_RESOURCE(multimc);
|
||||
|
Loading…
Reference in New Issue
Block a user