application: Add a Starting() slot to Application

Add a slot that is invoked when the main application loop starts. This
can be used to perform setup tasks after the initialization has
occurred. Initial use is to hide a splash.
This commit is contained in:
Jim Broadus 2021-02-20 21:35:32 -08:00 committed by John Maguire
parent b40d9ed44b
commit 59864bf1b6
3 changed files with 9 additions and 0 deletions

View File

@ -252,6 +252,10 @@ void Application::MoveToThread(QObject* object, QThread* thread) {
void Application::AddError(const QString& message) { emit ErrorAdded(message); }
void Application::Starting() {
qLog(Debug) << "Application starting";
}
QString Application::language_without_region() const {
const int underscore = language_name_.indexOf('_');
if (underscore != -1) {

View File

@ -114,6 +114,7 @@ class Application : public QObject {
void MoveToThread(QObject* object, QThread* thread);
public slots:
void Starting();
void AddError(const QString& message);
void ReloadSettings();
void OpenSettingsDialogAtPage(SettingsDialog::Page page);

View File

@ -460,6 +460,10 @@ int main(int argc, char* argv[]) {
QObject::connect(&a, SIGNAL(messageReceived(QString)), &w,
SLOT(CommandlineOptionsReceived(QString)));
// Use a queued connection so the invokation occurs after the application
// loop starts.
QMetaObject::invokeMethod(&app, "Starting", Qt::QueuedConnection);
int ret = a.exec();
return ret;