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()));
|
connect(this, SIGNAL(aboutToQuit()), SLOT(onExit()));
|
||||||
|
|
||||||
m_status = MultiMC::Initialized;
|
|
||||||
|
|
||||||
setIconTheme(settings()->get("IconTheme").toString());
|
setIconTheme(settings()->get("IconTheme").toString());
|
||||||
setApplicationTheme(settings()->get("ApplicationTheme").toString());
|
setApplicationTheme(settings()->get("ApplicationTheme").toString());
|
||||||
|
|
||||||
@ -322,10 +320,22 @@ MultiMC::MultiMC(int &argc, char **argv) : QApplication(argc, argv)
|
|||||||
if(SetupWizard::isRequired())
|
if(SetupWizard::isRequired())
|
||||||
{
|
{
|
||||||
m_setupWizard = new SetupWizard(nullptr);
|
m_setupWizard = new SetupWizard(nullptr);
|
||||||
int result = m_setupWizard->exec();
|
connect(m_setupWizard, &QDialog::finished, this, &MultiMC::setupWizardFinished);
|
||||||
qDebug() << "Wizard result =" << result;
|
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())
|
if(!m_instanceIdToLaunch.isEmpty())
|
||||||
{
|
{
|
||||||
auto inst = instances()->getInstanceById(m_instanceIdToLaunch);
|
auto inst = instances()->getInstanceById(m_instanceIdToLaunch);
|
||||||
@ -361,6 +371,11 @@ MultiMC::~MultiMC()
|
|||||||
|
|
||||||
void MultiMC::messageReceived(const QString& message)
|
void MultiMC::messageReceived(const QString& message)
|
||||||
{
|
{
|
||||||
|
if(status() != Initialized)
|
||||||
|
{
|
||||||
|
qDebug() << "Received message" << message << "while still initializing. It will be ignored.";
|
||||||
|
return;
|
||||||
|
}
|
||||||
if(message == "activate")
|
if(message == "activate")
|
||||||
{
|
{
|
||||||
showMainWindow();
|
showMainWindow();
|
||||||
|
@ -49,6 +49,7 @@ class MultiMC : public QApplication
|
|||||||
public:
|
public:
|
||||||
enum Status
|
enum Status
|
||||||
{
|
{
|
||||||
|
StartingUp,
|
||||||
Failed,
|
Failed,
|
||||||
Succeeded,
|
Succeeded,
|
||||||
Initialized
|
Initialized
|
||||||
@ -163,14 +164,12 @@ private slots:
|
|||||||
* Do all the things that should be done before we exit
|
* Do all the things that should be done before we exit
|
||||||
*/
|
*/
|
||||||
void onExit();
|
void onExit();
|
||||||
|
|
||||||
void on_windowClose();
|
void on_windowClose();
|
||||||
|
|
||||||
void messageReceived(const QString & message);
|
void messageReceived(const QString & message);
|
||||||
|
|
||||||
void controllerSucceeded();
|
void controllerSucceeded();
|
||||||
void controllerFailed(const QString & error);
|
void controllerFailed(const QString & error);
|
||||||
void analyticsSettingChanged(const Setting &setting, QVariant value);
|
void analyticsSettingChanged(const Setting &setting, QVariant value);
|
||||||
|
void setupWizardFinished(int status);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void initLogger();
|
void initLogger();
|
||||||
@ -185,6 +184,7 @@ private:
|
|||||||
void initMCEdit();
|
void initMCEdit();
|
||||||
void initAnalytics();
|
void initAnalytics();
|
||||||
void shutdownAnalytics();
|
void shutdownAnalytics();
|
||||||
|
void performMainStartupAction();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QDateTime startTime;
|
QDateTime startTime;
|
||||||
@ -208,7 +208,7 @@ private:
|
|||||||
QMap<QString, std::shared_ptr<BaseProfilerFactory>> m_profilers;
|
QMap<QString, std::shared_ptr<BaseProfilerFactory>> m_profilers;
|
||||||
|
|
||||||
QString m_rootPath;
|
QString m_rootPath;
|
||||||
Status m_status = MultiMC::Failed;
|
Status m_status = MultiMC::StartingUp;
|
||||||
|
|
||||||
// used on Windows to attach the standard IO streams
|
// used on Windows to attach the standard IO streams
|
||||||
bool consoleAttached = false;
|
bool consoleAttached = false;
|
||||||
|
@ -33,6 +33,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
switch (app.status())
|
switch (app.status())
|
||||||
{
|
{
|
||||||
|
case MultiMC::StartingUp:
|
||||||
case MultiMC::Initialized:
|
case MultiMC::Initialized:
|
||||||
{
|
{
|
||||||
Q_INIT_RESOURCE(multimc);
|
Q_INIT_RESOURCE(multimc);
|
||||||
|
Loading…
Reference in New Issue
Block a user