mirror of
https://github.com/fwbuilder/fwbuilder
synced 2026-03-24 04:07:55 +01:00
see #1466 closing report works when application is terminated via File/Exit but does not work when main window is closed
This commit is contained in:
parent
91cdf9171e
commit
b465518637
@ -30,12 +30,32 @@
|
||||
#include "FWBApplication.h"
|
||||
|
||||
#include <QtDebug>
|
||||
#include <QTimer>
|
||||
|
||||
|
||||
void FWBApplication::quit()
|
||||
{
|
||||
if (st->getCheckUpdates()) wfl->report();
|
||||
QCoreApplication::processEvents(QEventLoop::ExcludeUserInputEvents, 10000);
|
||||
if (fwbdebug) qDebug() << "FWBApplication::quit()";
|
||||
timeout = 0;
|
||||
|
||||
if (st->getCheckUpdates())
|
||||
{
|
||||
wfl->report();
|
||||
QTimer::singleShot(100, this, SLOT(delayedQuit()));
|
||||
} else
|
||||
delayedQuit();
|
||||
}
|
||||
|
||||
void FWBApplication::delayedQuit()
|
||||
{
|
||||
if (fwbdebug) qDebug() << "FWBApplication::delayedQuit()";
|
||||
|
||||
if (timeout < 20 && wfl->reportInProgress())
|
||||
{
|
||||
QTimer::singleShot(100, this, SLOT(delayedQuit()));
|
||||
return;
|
||||
}
|
||||
|
||||
QApplication::quit();
|
||||
}
|
||||
|
||||
|
||||
@ -32,13 +32,15 @@
|
||||
class FWBApplication : public QApplication {
|
||||
|
||||
Q_OBJECT;
|
||||
|
||||
int timeout;
|
||||
|
||||
public:
|
||||
FWBApplication(int &argc, char **argv) : QApplication(argc, argv) {}
|
||||
|
||||
public slots:
|
||||
|
||||
void quit();
|
||||
void delayedQuit();
|
||||
|
||||
};
|
||||
|
||||
|
||||
@ -528,10 +528,12 @@ void PrefsDialog::accept()
|
||||
mw->updateTreeFont();
|
||||
// app->setFont(st->getTreeFont());
|
||||
|
||||
// annoyingly, widget shotTip has the name opposite to its meaning.
|
||||
// When it is checked, we do not show tip of the day.
|
||||
if (m_dialog->showTips->isChecked())
|
||||
wfl->clearEvent(UserWorkflow::TIP_OF_THE_DAY_DISABLED);
|
||||
else
|
||||
wfl->registerEvent(UserWorkflow::TIP_OF_THE_DAY_DISABLED);
|
||||
else
|
||||
wfl->clearEvent(UserWorkflow::TIP_OF_THE_DAY_DISABLED);
|
||||
|
||||
st->setBool("UI/NoStartTip", m_dialog->showTips->isChecked());
|
||||
|
||||
|
||||
@ -30,6 +30,7 @@
|
||||
#include "HttpGet.h"
|
||||
|
||||
#include <QtDebug>
|
||||
#include <QTimer>
|
||||
|
||||
/*
|
||||
* Create object UserWorkflow only after FWBSettings object has been
|
||||
@ -126,6 +127,8 @@ void UserWorkflow::report()
|
||||
qDebug() << "HttpGet error: " << report_query->getLastError();
|
||||
qDebug() << "Url: " << url;
|
||||
}
|
||||
|
||||
if (fwbdebug) qDebug() << "Request launched";
|
||||
}
|
||||
|
||||
void UserWorkflow::reportDone(const QString& resp)
|
||||
|
||||
@ -72,15 +72,15 @@ class UserWorkflow : public QObject {
|
||||
Q_OBJECT;
|
||||
|
||||
public:
|
||||
enum workflowEvents { UPDATE_CHECKS_DISABLED = 0,
|
||||
GETTING_STARTED_TUTOTIAL = 1,
|
||||
NEW_FW_WITH_TEMPLATE = 2,
|
||||
NEW_FW_NO_TEMPLATE = 4,
|
||||
RULE_MOD = 8,
|
||||
COMPILE = 16,
|
||||
INSTALL = 32,
|
||||
IMPORT = 64,
|
||||
TIP_OF_THE_DAY_DISABLED = 128,
|
||||
enum workflowEvents { UPDATE_CHECKS_DISABLED = 1,
|
||||
GETTING_STARTED_TUTOTIAL = 2,
|
||||
NEW_FW_WITH_TEMPLATE = 4,
|
||||
NEW_FW_NO_TEMPLATE = 8,
|
||||
RULE_MOD = 16,
|
||||
COMPILE = 32,
|
||||
INSTALL = 64,
|
||||
IMPORT = 128,
|
||||
TIP_OF_THE_DAY_DISABLED = 256,
|
||||
};
|
||||
|
||||
private:
|
||||
@ -98,10 +98,10 @@ public:
|
||||
void clearEvent(enum workflowEvents e);
|
||||
void registerTutorialViewing(const QString &tutorial_name);
|
||||
void report();
|
||||
|
||||
bool reportInProgress() { return report_query != NULL; }
|
||||
|
||||
public slots:
|
||||
void reportDone(const QString&);
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user